Add first-party teammate agents#1
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces first-party “teammate” agents that are associated with a parent agent, hidden from the normal dashboard by default, but still navigable via new team-focused UI affordances and supported end-to-end through tmux statusline/control, multiplexer state, and the metadata API.
Changes:
- Add teammate identity/ordering metadata (
teamId,parentSessionId,role,label,order) and propagate it through runtime state, tmux window metadata, snapshots, persistence, and graveyard views. - Add teammate navigation and visibility features: dashboard details “Team” section, teammate picker overlay (
e), and tmux statusline segments + tmuxCtrl-A eteam toggle. - Add metadata server endpoints for teammate discovery/creation/messaging/lifecycle, plus supporting pending-action plumbing and diagnostics tooling.
Reviewed changes
Copilot reviewed 81 out of 82 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/tui/screens/subscreen-renderers.ts | Render orphan teammate rows in graveyard screen output. |
| src/tui/screens/overlay-renderers.ts | Add teammate picker overlay renderer/output builder. |
| src/tui/screens/dashboard-renderers.ts | Add team hotkey hint and “Team” details section rendering. |
| src/tui/screens/dashboard-renderers.test.ts | Cover teammate details rendering and stale semantic vs pending label behavior. |
| src/tmux/statusline.ts | Add teammate segments + focused teammate chip handling; use unified session lookup. |
| src/tmux/statusline.test.ts | Add coverage for teammate segment behavior and chip ordering. |
| src/tmux/runtime-manager.ts | Persist team in tmux window metadata; bind prefix+e for team toggle. |
| src/tmux/runtime-manager.test.ts | Validate e unbind/bind behavior. |
| src/tmux/control-script.test.ts | Test team control action switching between parent/teammates. |
| src/team.ts | Introduce teammate metadata + selection/sorting utilities. |
| src/team.test.ts | Add tests for orphan teammate selection. |
| src/statusline-model.ts | Add teammate support to statusline data and current/focused teammate resolution. |
| src/session-semantics.ts | Introduce sessionDisplayStatusLabel and centralize raw/pending/semantic label precedence. |
| src/session-semantics.test.ts | Add tests for raw fallback labels and pending-action precedence. |
| src/session-runtime.ts | Store teammate metadata on live runtimes. |
| src/session-bootstrap.ts | Adjust agent preambles to include teammate API guidance and prevent nested teammate creation. |
| src/session-bootstrap.test.ts | Add tests ensuring teammate sessions don’t get nested teammate creation instructions. |
| src/pending-actions.ts | Centralize pending-action kinds and blocking detection helper. |
| src/paths.ts | Add read-only project path resolver for non-mutating diagnostics. |
| src/multiplexer/worktrees.ts | Rework worktree pending action handling to use structured pending-actions store + longer timeouts. |
| src/multiplexer/worktrees.test.ts | Update tests for new pending-actions application and worktree settlement logic. |
| src/multiplexer/subscreens.ts | Allow thread navigation to target hidden teammates while preserving dashboard selection. |
| src/multiplexer/subscreens.test.ts | Add tests for teammate thread navigation. |
| src/multiplexer/session-runtime-core.ts | Preserve/propagate team through runtime registration and tmux metadata sync. |
| src/multiplexer/session-runtime-core.test.ts | Add tests for teammate metadata preservation across hydration/offline transitions. |
| src/multiplexer/session-launch.ts | Thread teammate metadata through create/restore/resume/migrate flows and preamble decisions. |
| src/multiplexer/session-launch.test.ts | Add tests for teammate launch/resume/migrate behavior. |
| src/multiplexer/session-actions.ts | Add teammate creation + ensure stop/graveyard cascades to direct teammates. |
| src/multiplexer/services.ts | Use service-specific pending-action setter and updated settlement signature. |
| src/multiplexer/services.test.ts | Update pending-action expectations for services. |
| src/multiplexer/service-state-snapshot.ts | Preserve team when snapshotting managed agent windows. |
| src/multiplexer/service-state-snapshot.test.ts | Add tests for teammate metadata snapshotting. |
| src/multiplexer/runtime-state.ts | Persist/restore team across offline/live transitions and instance refs. |
| src/multiplexer/runtime-state.test.ts | Add tests for pending-action separation and restoring team metadata from tmux. |
| src/multiplexer/runtime-lifecycle-methods.ts | Include team in lifecycle session state projections. |
| src/multiplexer/notifications.ts | Allow notifications to target hidden teammates and preserve dashboard selection. |
| src/multiplexer/notifications.test.ts | Add tests for teammate notification targeting/opening. |
| src/multiplexer/index.ts | Add teammate caches/state fields and thread team through create/register APIs. |
| src/multiplexer/graveyard-view-model.ts | Add orphan teammate diagnostic rows; avoid duplication with existing graveyard entries. |
| src/multiplexer/graveyard-view-model.test.ts | Add coverage for orphan teammate row behavior. |
| src/multiplexer/dashboard-view-methods.ts | Include selected teammates in dashboard VM; refine create-pending settlement targeting. |
| src/multiplexer/dashboard-view-methods.test.ts | Add coverage for teammate selection injection and settlement signature. |
| src/multiplexer/dashboard-tail-methods.ts | Expose teammate creation + service pending setter; propagate claimed team. |
| src/multiplexer/dashboard-tail-methods.test.ts | Update takeover session expectations for new argument threading. |
| src/multiplexer/dashboard-state-methods.ts | Expand dashboard model application/snapshot to include teammates. |
| src/multiplexer/dashboard-ops.ts | Split session vs service pending actions; propagate team on resume seed; updated deps. |
| src/multiplexer/dashboard-interaction.ts | Add teammate picker overlay + activateDashboardEntry option to preserve selection; refresh statusline on reorder. |
| src/multiplexer/dashboard-interaction.test.ts | Add tests for teammate picker navigation and selection-preservation behavior. |
| src/multiplexer/dashboard-control.ts | Route overlay rendering/keys for teammate picker overlay. |
| src/multiplexer/archives.ts | Feed parent/teammate session sets into graveyard view model for orphan detection. |
| src/metadata-server.ts | Add teammate API endpoints for list/create/send/lifecycle guarded by direct-parent attachment. |
| src/main.ts | Include teammates when rewriting local statusline artifacts; add debug-state command wiring. |
| src/instance-registry.ts | Add team to instance session references. |
| src/instance-directory.ts | Persist team through sessions file entries and remote dedupe. |
| src/instance-directory.test.ts | Add test coverage for team propagation in sessions file entries. |
| src/debug-state.test.ts | Add tests for non-mutating debug state report behavior. |
| src/dashboard/ui-state-store.ts | Refactor shared UI-state load into loadSharedState. |
| src/dashboard/state.ts | Add teammate picker overlay kind. |
| src/dashboard/session-registry.ts | Hide teammates by default; add selection helper for a parent’s direct teammates. |
| src/dashboard/session-registry.test.ts | Add tests for teammate hiding/inclusion and teammate selection ordering. |
| src/dashboard/session-actions.ts | Update pending-action types to shared pending-actions module. |
| src/dashboard/quick-jump.ts | Preserve pre-ordered worktree group entries when present. |
| src/dashboard/quick-jump.test.ts | Add test for preserving ordered entries from rendered groups. |
| src/dashboard/pending-actions.ts | Redesign pending actions to be target-scoped with tokens + teammate-aware synthesis. |
| src/dashboard/index.ts | Add team/pending fields and route derived status labels through semantic display helper. |
| src/dashboard/index.test.ts | Add tests for pending-action precedence in derived status label. |
| src/daemon.ts | Serialize concurrent ensures; safer replace-on-unhealthy with grace periods + exit waiting. |
| src/daemon.test.ts | Add tests for unhealthy replacement waiting + concurrent ensure serialization. |
| scripts/tmux-control.sh | Add team action to local control resolution and fallback switching. |
| README.md | Document teammate API endpoints, UI navigation, caps, and usage examples. |
| desktop-ui/src/stores/state.svelte.js | Use pendingAction mapping for overlays; improve action-blocking to consider raw pending flags. |
| desktop-ui/src/lib/WorktreePanel.svelte | Respect pendingAction semantics and block actions when worktree/service/session is pending. |
| .gitignore | Ignore .claude/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const identity = session.team?.label ?? session.label ?? session.command; | ||
| const role = session.team?.role ?? session.role; | ||
| const status = session.semantic?.presentation.statusLabel ?? derivedStatusLabel(session); | ||
| const hint = session.semantic?.presentation.compactHint; | ||
| return [role ? `${identity}(${role})` : identity, status, hint && hint !== status ? hint : undefined] | ||
| .filter(Boolean) | ||
| .join(" · "); |
There was a problem hiding this comment.
Fixed in fa36d86 - teammate detail summaries now use the shared derived status label so pending actions stay authoritative over stale semantic labels.
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (86)
📝 WalkthroughWalkthroughAdds teammate agents and typed pending-actions across server, multiplexer, UI, statusline, and tmux. Implements teammate picker/UX, endpoints, lifecycle orchestration, persistence, and extensive tests. Refactors dashboards, overlays, worktrees, and control retries. Introduces debug-state CLI and read-only paths. ChangesTeammates feature and pending-actions overhaul
Sequence Diagram(s)(skipped) Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
|
Summary
Verification
Summary by CodeRabbit
New Features
eto navigate between parent agents and their teammatesaimux debug-statecommand for troubleshooting session stateImprovements