Repository navigation
Add Tauri commands and xterm.js terminal UI for PTY agent sessions (#1120) - #1162
Conversation
Code Review SummaryThis PR delivers a complete vertical slice for PTY agent session UI: Tauri command proxies, streaming event bridge, xterm.js terminal component, launch/sessions panels, and navigation wiring. All acceptance criteria from #1120 are met. The implementation is clean, follows established project patterns, and the architecture is sound. Recommending approval with two improvements noted. Acceptance Criteria Status
FindingsImprovements[Improvement]
This creates a split contract: the typed service layer exists but is unused by the components that need it most. When a command signature changes, you must update two places instead of one, and the compiler cannot catch the mismatch. Per the DRY principle, the typed wrappers are the single source of truth. Suggested fix: Replace all raw [Improvement]
The existing pattern in the codebase for streaming (e.g., For this greenfield stage, the current behavior is acceptable since the stream will naturally terminate when the gRPC session ends, but the handle should not be silently dropped — it should at minimum be logged or tracked. NitpicksNit: The bare Nit: If the proto-generated Nit: Extra blank line at end of file — cosmetic. Nit: Both functions do identical logic (find existing tab by type, set active or create new). A single |
malibio
left a comment
There was a problem hiding this comment.
Net positive — all acceptance criteria met, clean vertical slice. Two improvements flagged in the comment above (invoke bypass of typed wrapper layer, untracked streaming task handle). Neither is a blocker for merge, but the typed wrapper issue should be addressed before this pattern propagates to more components.
Review AddressedAll reviewer findings from the code review have been implemented. Changes Made🟡 Important: Typed wrapper functions (finding 1)
🟡 Important: Streaming task cancellation (finding 2)
Skipped🟢 Nit: Module-level doc comment on 🟢 Nit: Verification
|
…loses #1120) - Add AgentSessionService to in-process gRPC server (GrpcClient) and extend daemon lib.rs re-exports with all proto request/response types - Add agent_session.rs Tauri command proxies: launch_session, write_input, resize_terminal, terminate_session, list_sessions; launch_session spawns a background tokio task that reads StreamOutput and emits pty-output-{id} events - Add xterm.js + @xterm/addon-fit packages; import xterm CSS in app.css - Add pty-terminal.svelte: wraps xterm.js, subscribes to pty-output-{sessionId} events, forwards keystrokes via write_input, uses ResizeObserver + FitAddon - Add agent-launch-panel.svelte: agent selector, optional prompt input, Launch button - Add sessions-panel.svelte: lists active sessions with per-session Terminate buttons - Add agent-sessions-panel.svelte: composite panel combining launch + sessions + terminal - Wire 'agent-sessions' tab type into navigation store, pane-content, sidebar, tab-persistence-service, and layout store - Add ResizeObserver/TextEncoder/TextDecoder to Svelte eslint globals - Update layout.test.ts for new navigation item count Co-Authored-By: Claude <[email protected]>
- Replace direct invoke() calls with typed ptyLaunchSession/ptyWriteInput/ ptyResizeTerminal/ptyListSessions/ptyTerminateSession wrappers - Add StreamingTaskRegistry (Mutex<HashMap<sessionId, CancellationToken>>) so terminate_session cancels the background StreamOutput reader promptly - Register StreamingTaskRegistry as Tauri managed state in lib.rs - Use tokio::select! in launch_session background task to respond to cancellation without waiting for the next gRPC message Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
e2c53ac to
788fcb0
Compare
…1120) (#1162) * Add Tauri commands and xterm.js terminal UI for PTY agent sessions (closes #1120) - Add AgentSessionService to in-process gRPC server (GrpcClient) and extend daemon lib.rs re-exports with all proto request/response types - Add agent_session.rs Tauri command proxies: launch_session, write_input, resize_terminal, terminate_session, list_sessions; launch_session spawns a background tokio task that reads StreamOutput and emits pty-output-{id} events - Add xterm.js + @xterm/addon-fit packages; import xterm CSS in app.css - Add pty-terminal.svelte: wraps xterm.js, subscribes to pty-output-{sessionId} events, forwards keystrokes via write_input, uses ResizeObserver + FitAddon - Add agent-launch-panel.svelte: agent selector, optional prompt input, Launch button - Add sessions-panel.svelte: lists active sessions with per-session Terminate buttons - Add agent-sessions-panel.svelte: composite panel combining launch + sessions + terminal - Wire 'agent-sessions' tab type into navigation store, pane-content, sidebar, tab-persistence-service, and layout store - Add ResizeObserver/TextEncoder/TextDecoder to Svelte eslint globals - Update layout.test.ts for new navigation item count Co-Authored-By: Claude <[email protected]> * Address review: use typed wrappers and add streaming task cancellation - Replace direct invoke() calls with typed ptyLaunchSession/ptyWriteInput/ ptyResizeTerminal/ptyListSessions/ptyTerminateSession wrappers - Add StreamingTaskRegistry (Mutex<HashMap<sessionId, CancellationToken>>) so terminate_session cancels the background StreamOutput reader promptly - Register StreamingTaskRegistry as Tauri managed state in lib.rs - Use tokio::select! in launch_session background task to respond to cancellation without waiting for the next gRPC message Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
Summary
AgentSessionServiceinto the in-process gRPC server alongside the existing Node/Import/Embeddings servicesagent_session.rsTauri commands (launch_session,write_input,resize_terminal,terminate_session,list_sessions) —launch_sessionspawns a background tokio task that bridgesStreamOutputtopty-output-{sessionId}Tauri eventspty-terminal.sveltewrapping xterm.js with FitAddon + ResizeObserver, subscribing to output events and forwarding keystrokesagent-launch-panel.svelte(agent selector + prompt + Launch button) andsessions-panel.svelte(active sessions list with Terminate buttons)agent-sessions-panel.sveltecomposite pane combining the above with a terminal areaagent-sessionstab type into navigation sidebar, pane-content, and tab-persistenceTest plan
bun run test)bun run quality:fixexits 0 (svelte-check: 0 errors)cargo check -p nodespace-appexits cleanCloses #1120
🤖 Generated with Claude Code