Skip to content

feat(agent): Claude SDK migration with chat UI and worktree isolation - #15

Merged
roccoppp merged 24 commits into
masterfrom
l-mendez/chat-ui-redesign
Apr 2, 2026
Merged

feat(agent): Claude SDK migration with chat UI and worktree isolation#15
roccoppp merged 24 commits into
masterfrom
l-mendez/chat-ui-redesign

Conversation

@l-mendez

@l-mendez l-mendez commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rewrites the Agent Orchestrator integration from tmux-based session management to direct Claude CLI spawning via the Claude Code SDK. Adds a new chat UI for agent interaction, and implements per-issue git worktree isolation so each agent session works in a dedicated branch.

Key changes:

  • Claude SDK migration: Replace tmux IPC with direct Claude CLI --print --output-format stream-json spawning, streaming structured SDK events (assistant messages, thinking, tool use) back to the renderer.
  • Chat UI redesign (AO web dashboard): New chat components (ChatPanel, MessageList, AssistantMessage, ToolCallGroup, ThinkingRow, etc.) with SSE streaming via AgentProcessManager.
  • AgentChat component: Replace EmbeddedTerminal in the desktop app renderer with an AgentChat component consuming streamed agent events.
  • Git worktree isolation: Each issue gets its own worktree at ~/.worktrees/{projectId}/{issue-id}/ on branch oli/{identifier}, so diffs, git status, and file changes work correctly per issue.
  • Shared AgentEvent types: New common/agentEvents.ts module with typed event creation for cross-process event streaming.

Ticket Link

N/A — internal architectural improvement

Checklist

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • executed npm run lint:js for proper code formatting

Release Note

Replaced terminal-based agent UI with structured chat interface. Agent sessions now run in isolated git worktrees per issue.

l-mendez and others added 22 commits March 31, 2026 16:38
Replace xterm.js terminal with structured chat UI using Claude Code SDK
subprocesses, SSE streaming, and custom React components.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
11-task plan covering: event types, agent process manager, SSE endpoint,
React hooks, chat components, SessionDetail integration, and send route wiring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduces foundational AgentEvent type definitions (EventType, EventData variants, AgentStatus) and the createAgentEvent factory with unique counter-based IDs. All 3 unit tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the AgentProcessManager class that wraps the Claude Code SDK
(claude function) to manage one agent process per chat session, replacing
tmux-based session management for chat-mode interactions.

Also fixes vitest.config.ts to resolve @anthropic-ai/claude-code by pointing
its bare specifier to cli.js (the package ships no exports/main field).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements GET /api/sessions/[id]/stream as a Server-Sent Events route
that replays session history on connect, sends current status, subscribes
to live AgentProcessManager events, and sends a heartbeat every 15s.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Groups consecutive tool_use and file_change events into renderable blocks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
UserMessage, ThinkingRow, ToolCallGroup, FileBadge, FileChangeSummary,
StreamingIndicator, MarkdownContent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Composite components that wire hooks to atomic UI pieces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sessions with metadata.useChatUI=true render ChatPanel instead of DirectTerminal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sessions with metadata.useChatUI=true bypass tmux and use Claude Code SDK.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…remove tmux IPC channels

Add @anthropic-ai/claude-code as a dependency and webpack external for the
main process. Create shared AgentEvent types (src/common/agentEvents.ts) for
structured event communication between main and renderer. Remove three
tmux-specific IPC channels (AO_SEND_RAW_INPUT, AO_RESIZE_TERMINAL,
AO_OPEN_TERMINAL) that are no longer needed with the SDK approach.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all tmux/CLI-based session management with direct Claude SDK
calls. Sessions now stream structured AgentEvents (assistant messages,
thinking, tool use) via BrowserWindow IPC instead of raw terminal output.

Removed: AO CLI spawn, tmux capture/polling/streaming, FIFO pipes,
YAML config generation, session persistence to disk, raw terminal input,
resize, and openTerminal.

Added: broadcastEvent (sends to all windows), processSDKEvent (converts
SDK stream to AgentEvents), summarizeToolInput, runClaude (async stream
runner with AbortController). Updated spawnSession, sendMessage,
killSession, and getSessionStatus accordingly.

All git methods (getDiff, getGitFiles, getGitChanges, getGitFullStatus,
gitAction) and path helpers are preserved unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The @anthropic-ai/claude-code package is CLI-only (no programmatic
export). Replace `import {claude}` with spawning the CLI using
`--print --output-format stream-json --verbose --dangerously-skip-permissions`
and parsing the newline-delimited JSON stream.

Follow-up messages use --resume to continue the conversation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove AO_SEND_RAW_INPUT, AO_RESIZE_TERMINAL, AO_OPEN_TERMINAL handler
registrations from initialize.ts and their preload bridge methods from
internalAPI.js. Fix AO_GET_SESSION_STATUS handler to drop the unused
event.sender argument, matching the updated aoManager API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the never-defined EmbeddedTerminal reference with the existing
AgentChat component that renders structured AgentEvent objects in a
chat UI. Replace xterm terminal styles with chat message styles.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove sendRawInput, resizeTerminal, openTerminal from window type
definitions. Update onOutputUpdate/offOutputUpdate callback to use
AgentEvent instead of old {data: string} shape.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The --bare flag skips keychain reads and OAuth, requiring
ANTHROPIC_API_KEY instead. Users logged in via OAuth get
"Not logged in" errors. Remove the flag so normal auth works.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Agents now work in dedicated git worktrees (~/.worktrees/{projectId}/{issue-id}/)
instead of the linked repo directly. This ensures each issue gets its own branch
(oli/{identifier}) based on origin/{defaultBranch}, making diffs and git status
work correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roccoppp and others added 2 commits April 2, 2026 12:05
…shboard

The agent-process-manager was importing a non-existent `claude` function
from @anthropic-ai/claude-code (which is a CLI tool, not a JS library).
Rewrite to spawn the Claude CLI directly via child_process, matching the
desktop app's aoManager.ts approach with stream-json output parsing and
session resumption via --resume flag.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roccoppp
roccoppp merged commit 0da7076 into master Apr 2, 2026
2 of 3 checks passed
@github-actions github-actions Bot added E2E/Run and removed E2E/Run labels Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants