feat(sdk): expose terminal agent lifecycle status - #7007
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe terminal listing now enriches sessions with optional normalized agent lifecycle status. The SDK exports the new status types, integration tests cover permission requests, and CLI and SDK documentation describe the updated response shape. ChangesTerminal agent status
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The PR adds agent identity and lifecycle timestamps and events to workspace-scoped terminal listings. If a caller can reach a host service outside its authorized workspace, the response could disclose another workspace’s terminal and agent state; the change is otherwise additive and mergeable with explicit owner awareness that this isolation is enforced upstream. Sequence Diagram(s)sequenceDiagram
participant notifications.hook
participant terminal.list
participant SDK consumer
notifications.hook->>terminal.list: Store request_user_input event
SDK consumer->>terminal.list: List terminal sessions
terminal.list-->>SDK consumer: Return session with agentStatus
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description includes the required What & why, How I tested it, and Checklist sections. It explains the change, links the related issue, lists validation results, and marks the checklist items. It also clearly documents the known partial test-suite failure. Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6 files. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Exact pending question/choice transport is intentionally kept out of this lifecycle-only PR and tracked as follow-up #7009. That contract needs provider-neutral semantics and explicit payload minimization; this PR remains the small prerequisite that exposes the existing normalized state. |
FOR TODD — 1 decision, 0 actions
Decision: expose the existing normalized lifecycle record on
terminals.list, rather than add a second status endpoint.I recommend this because the terminal is already the public CLI/SDK object consumers use to read and send messages, while the host service remains the single owner of agent-state normalization.
What & why
Superset already knows when Claude, Codex, and other supported agents are working or waiting for attention, and the workspace board renders that state. CLI and SDK consumers could only see that the PTY existed, though, so they could not distinguish a working agent from one waiting for input.
This adds an optional
agentStatusfield to each live terminal returned byterminal.list/terminals.list(). It exposes agent/session identity, timestamps, and the latest normalized lifecycle event. In particular,PermissionRequestgives integrations the same needs-attention signal used by the workspace board.The response is joined from the existing
TerminalAgentStore; this does not introduce another detector or status model. The CLI and SDK reference docs describe the additive field.Downstream context: todd-studio/workstation#252
How I tested it
bun test test/integration/terminal.integration.test.ts --test-name-pattern "createSession uses the configured shell and list includes live agent status"— passedbun run typecheckinpackages/host-service— passedbun run typecheckinpackages/sdk— passedbun run buildinpackages/sdk— passedbun run lint— passedbun run typecheck— passedbun run test— not fully green: two dynamic-import tests in the untouched@superset/agent-setuppackage could not find their shared temporary module after another suite removed it; the same failures remained under the repository-pinned Bun 1.3.14Checklist
type(scope): subject)bun run lintandbun run typecheckpass (CI fails on lint warnings too)Summary by cubic
Exposes the terminal agent's lifecycle status on
terminals.listresponses, so SDK and CLI consumers can tell when a supported agent is working or waiting for input instead of only knowing the PTY exists.agentStatusfield with agent identity, timestamps, and the latest normalized lifecycle event, populated only when listing a specific workspace; workspace-wide listings still return just PTY presence.PermissionRequestsignals the agent needs attention, matching what the workspace board displays.TerminalAgentStore; no new detector or status model is introduced.TerminalAgentStatusandTerminalAgentLifecycleEventTypefrom the SDK and documents the field in the CLI and SDK reference docs.Written for commit da713eb. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation