Skip to content

feat(coordination): reachability-split worklist + uniform hoisted layout - #174

Merged
TraderSamwise merged 4 commits into
masterfrom
chore/tui-next-29
Jun 19, 2026
Merged

feat(coordination): reachability-split worklist + uniform hoisted layout#174
TraderSamwise merged 4 commits into
masterfrom
chore/tui-next-29

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Continues the Coordination/TUI polish arc. Three changes:

  1. Reachability-split worklist — the unified Coordination "Needs you" group now splits by reachability into Awake · act now (live/sessionless actionable) and Asleep · wake to act (offline actionable), then Handled and Unreachable. Bucket now dominates the worklist sort so each group renders as one contiguous run.

  2. Offline is visually distinct + Enter is honest — added a dormant sleep tone (the old offline tag used attn = \x1b[1;33m, byte-identical to the gold selection accent, so offline read as selection). Reachability is encoded in the leading dot ( awake / asleep / gone). Entering an offline agent no longer breaks: it switches to the dashboard screen before the resume runs (so resumeOfflineSessionWithFeedback's renderDashboard() is coherent instead of painting the dashboard under a coordination screen-state), and the footer says [Enter] wake for asleep rows.

  3. Hoisted shared layout — extracted the dashboard's body composition (centered content block, scrolling column with ▲/▼, whitespace-separated details pane, full-width footer rule) into composeScreenFrame, and routed the dashboard + all five subscreens through it. This removes the central vertical divider from the subscreens and makes every screen's chrome uniform (top header and bottom footer). Dead composeSplitScreen/composeTwoPaneLines host methods removed.

Subscreen top headers also now mirror the dashboard exactly (version tag, runtime dot, dev badge, full-width rule).

Test plan

  • yarn typecheck
  • yarn lint
  • yarn vitest run — 1466 tests ✅
  • yarn build
  • Verified live in the installed 0.1.21-tui-ia build across all screens.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Enhanced visual distinction for offline agents with new "asleep" state indicator paired with "awake" for online agents
    • Improved notification feedback when attempting to open offline session targets with clearer error messages
  • Refactor

    • Restructured worklist to explicitly separate "awake" (online) and "asleep" (offline) agent states for clearer prioritization
    • Unified screen layout and scrolling rendering across dashboard and detail screens for consistency
  • Documentation

    • Added UI mockups demonstrating proposed layout variants addressing offline state visualization improvements

test and others added 2 commits June 19, 2026 19:39
Split the unified worklist's "Needs you" into reachability buckets:
Awake (act now) for live/sessionless actionable agents and Asleep
(wake to act) for offline ones, then Handled and Unreachable. Bucket
now dominates the worklist sort so each group renders contiguously.

Make offline visually distinct: add a dormant `sleep` tone (the old
`offline` tag used `attn`, byte-identical to the gold selection accent)
and encode reachability in the leading dot (● awake / ◐ asleep / ○ gone).

De-jank entering an offline agent: switch to the dashboard screen before
the resume runs, so its renderDashboard() is coherent instead of painting
the dashboard under a "coordination" screen-state. Footer says [Enter]
wake for asleep rows (and drops Enter for gone rows).

Unify the subscreen top header with the dashboard's (version tag, runtime
dot, dev badge, full-width rule); only the descriptor changes per screen.
Add breathing room between worklist bucket groups.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extract the dashboard's body composition — centered content block,
scrolling main column with ▲/▼ affordances, whitespace-separated right
details pane, and full-width footer rule — into composeScreenFrame, and
route the dashboard and all five subscreens through it. Removes the
central vertical "│" divider on the subscreens (they now use the
dashboard's 3-space separator) and makes every screen's chrome uniform.

Delete the now-dead composeSplitScreen / composeTwoPaneLines host methods
and their dashboard-ops implementations, plus the orphaned test stubs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 19, 2026 12:49pm

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@TraderSamwise, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 hours, 47 minutes, and 30 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19bc09d3-6396-4b61-9b48-099333d00904

📥 Commits

Reviewing files that changed from the base of the PR and between f0c1f17 and 4fa00f2.

📒 Files selected for processing (2)
  • src/coordination-model.test.ts
  • src/coordination-model.ts
📝 Walkthrough

Walkthrough

The PR splits the coordination worklist "needs-you" bucket into "awake" and "asleep" sub-buckets based on agent reachability, adds a "sleep" theme tone, introduces a new shared composeScreenFrame TUI utility, migrates all subscreen and dashboard renderers from composeSplitScreen to it, removes composeSplitScreen from the multiplexer host API, updates notification open flow for offline targets, and adds HTML mockup documentation.

Changes

Reachability Buckets & Screen Frame Refactor

Layer / File(s) Summary
Theme token and coordination bucket type contracts
src/tui/render/theme.ts, src/coordination-model.ts
Adds "sleep" to the Tone union with its ANSI SGR mapping, and redefines WorklistBucket from "needs-you" to "awake" | "asleep" | "handled" | "unreachable".
New composeScreenFrame module
src/tui/render/screen-frame.ts
Introduces ScreenFrameInput, ScreenFrameResult, screenContentWidth, screenLeftWidth, and composeScreenFrame(), which handles viewport sizing, scroll-offset auto-adjustment with focused-block expansion, scroll indicator injection, optional right-pane two-column merging, and ANSI frame assembly.
Coordination model bucketing logic and tests
src/coordination-model.ts, src/coordination-model.test.ts
Updates notificationBucket to map items to awake/asleep/handled, introduces BUCKET_RANK and two-parameter notificationUrgency(item, bucket), updates thread row bucket assignment, redefines needsYou/tail for new buckets, and adds awake/asleep split tests.
Remove composeSplitScreen from multiplexer host API
src/multiplexer/dashboard-ops.ts, src/multiplexer/dashboard-tail-methods.ts, src/multiplexer/notifications.test.ts, src/tui/screens/subscreen-renderers.test.ts
Removes composeSplitScreen and composeTwoPaneLines from dashboard-ops.ts, strips their declarations and implementations from DashboardTailMethods, and removes their mocks from notification and subscreen test setups.
Dashboard renderer migrated to composeScreenFrame
src/tui/screens/dashboard-renderers.ts
Replaces manual footer/viewport/scroll/two-pane composition with a single composeScreenFrame call; imports drop composeTwoPane/stripAnsi; local padBlockLine helper is removed; footerLines computed via renderFooterHints.
Subscreen renderers migrated to composeScreenFrame with coordination UI updates
src/tui/screens/subscreen-renderers.ts
Redesigns screenHeader with optional DEV badge; coordination worklist renders awake/asleep/unreachable labels via reachabilityDot with bucket tone mappings and contextual [Enter] wake/open footer hints; Project, Topology, Graveyard, and Library screens all replace composeSplitScreen + manual composition with composeScreenFrame.
Notification open flow: offline branch handling
src/multiplexer/notifications.ts
openCoordinationNotification adds explicit "missing" early-return, an offline boolean, and a centralized failOpen helper; service targets switch to dashboard screen before activating when offline.
Coordination UI variant mockups documentation
docs/mockups/coordination-view.html
Adds HTML mockup page with embedded styles (including --sleep CSS token) and four rendered screen variants showing reachability dot, wake verb, reachability column, and awake/asleep bucket groupings with per-state footer behaviors.

Sequence Diagram(s)

sequenceDiagram
  participant UI as TUI Renderer
  participant openCoordinationNotification
  participant composeScreenFrame
  participant activateSession as activateSession/Service

  UI->>openCoordinationNotification: notification selected (Enter)
  openCoordinationNotification->>openCoordinationNotification: compute targetState
  alt target missing
    openCoordinationNotification-->>UI: flash "missing" footer, render coordination screen
  else target offline
    openCoordinationNotification->>UI: switch to dashboard screen
    openCoordinationNotification->>activateSession: activate (wake)
    activateSession-->>openCoordinationNotification: failure
    openCoordinationNotification-->>UI: failOpen → flash error, render dashboard/coordination
  else target live
    openCoordinationNotification->>activateSession: activate (open)
    activateSession-->>openCoordinationNotification: failure
    openCoordinationNotification-->>UI: failOpen → flash error
  end
Loading
sequenceDiagram
  participant Renderer as SubscreenRenderer
  participant buildCoordinationWorklist
  participant composeScreenFrame
  participant composeTwoPane

  Renderer->>buildCoordinationWorklist: sessions, notifications
  buildCoordinationWorklist-->>Renderer: needsYou (awake/asleep rows), tail (handled/unreachable rows)
  Renderer->>Renderer: map rows to reachabilityDot + bucketRule labels
  Renderer->>Renderer: compute footerLines (wake / open / no-enter by reachability)
  Renderer->>composeScreenFrame: header, content, footerLines, focusLine, scrollOffset, twoPane, rightPanel
  composeScreenFrame->>composeTwoPane: leftLines, rightPanel renderer
  composeTwoPane-->>composeScreenFrame: merged body
  composeScreenFrame-->>Renderer: ScreenFrameResult (frame, scrollOffset)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • TraderSamwise/aimux#171: Directly overlaps with this PR's coordination inbox/worklist refactor — the retrieved PR reworks coordination-model-driven reachability/actionable inbox ordering and notification row metadata that this PR's awake/asleep bucket split extends.
  • TraderSamwise/aimux#173: Both PRs refactor buildCoordinationWorklist and its bucket/urgency logic in src/coordination-model.ts; this PR's awake/asleep changes build directly on the unified Variant C worklist work from the retrieved PR.
  • TraderSamwise/aimux#165: Both PRs refactor TUI dashboard/subscreen footers to the flat renderFooterHints-driven hint rendering model in dashboard-renderers.ts/subscreen-renderers.ts, and this PR consumes that infrastructure via composeScreenFrame.

Poem

🐇 Hop! A sleepy session snoozes in its burrow,
But awake ones bounce to the top in a hurrow!
composeScreenFrame now does the layout dance,
No more split-screen cobwebs — just one neat expanse.
The rabbit stamps "sleep" in dormant-slate tone,
Every screen now shares a frame it can call home. 🌙

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the two main changes: reachability-based worklist bucket splitting and unified screen frame layout approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tui-next-29

Comment @coderabbitai help to get the list of available commands and usage tips.

Switch to the dashboard screen only just before activating an offline
target, and render the dashboard (not coordination) on activation
failure, so failure feedback lands on the screen we end up on. Also
compute the worklist tail by explicit bucket membership instead of an
O(n²) exclusion scan.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/coordination-model.ts`:
- Around line 271-278: The secondary urgency calculation in the
notificationUrgency function can grow unbounded and exceed the 1,000,000 bucket
stride, causing buckets to interleave and break contiguous group rendering. Cap
the secondary value to ensure it remains less than the bucket stride of
1,000,000 by either clamping the individual component factors or using Math.min
to limit the total secondary value to a maximum that preserves the bucket
boundaries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85c9b018-852c-4488-9450-ef7fb81aa9ed

📥 Commits

Reviewing files that changed from the base of the PR and between 9fefc07 and f0c1f17.

📒 Files selected for processing (12)
  • docs/mockups/coordination-view.html
  • src/coordination-model.test.ts
  • src/coordination-model.ts
  • src/multiplexer/dashboard-ops.ts
  • src/multiplexer/dashboard-tail-methods.ts
  • src/multiplexer/notifications.test.ts
  • src/multiplexer/notifications.ts
  • src/tui/render/screen-frame.ts
  • src/tui/render/theme.ts
  • src/tui/screens/dashboard-renderers.ts
  • src/tui/screens/subscreen-renderers.test.ts
  • src/tui/screens/subscreen-renderers.ts
💤 Files with no reviewable changes (3)
  • src/tui/screens/subscreen-renderers.test.ts
  • src/multiplexer/notifications.test.ts
  • src/multiplexer/dashboard-tail-methods.ts

Comment thread src/coordination-model.ts
Cap the within-bucket secondary term below the 1,000,000 bucket stride so
a high unread/pending/attention total can never push an item past its
bucket boundary and fragment the contiguous group rendering. Unify the
notification and thread urgency through one bucketUrgency helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant