Description
Extend ClaudeCommandBuilder.build(...) to accept a SessionSurface parameter and emit the correct CLI arguments for each surface. For .agentDialogue(.claudeCode) — append stream-json flags per spec.
Spec: Epic #250 §4.1 (ClaudeCommandBuilder); docs/architecture/dialogue-events.md §7 (CLI launch flags).
Scope
File
MacApp/Packages/AgentOrchestrator/Sources/AgentOrchestrator/ClaudeCommandBuilder.swift
New signature
```swift
public static func build(
claudePath: String,
workingDirectory: URL,
shellPATH: String? = nil,
surface: SessionSurface,
sessionIDForResume: SessionID? = nil // optional, for --resume when opening sibling
) -> TerminalCommand
```
Arguments by surface
.shell — should not reach this builder (shell launched through different path); assert / fatalError.
.agentTerminal(.claudeCode) — current behavior (no extra args; interactive mode).
.agentDialogue(.claudeCode) — append:
-p (headless)
--output-format stream-json
--verbose
--include-partial-messages
--bare
--permission-mode acceptEdits (MVP — auto-accept edits only)
--allowedTools <csv> (from SettingsStore; whitelist for Bash, WebFetch, etc. that aren't edits)
- If
sessionIDForResume is provided — append --resume <UUID> regardless of surface.
Environment (unchanged)
Keep existing env: PATH, TERM=xterm-256color, COLORTERM=truecolor, GIT_PAGER=cat, PAGER=cat, strip TERM_PROGRAM*.
Caller sites
Update all call sites:
AgentSessionFeature._claudeDetected — passes surface from state.
- New "Open as X" action handler (D-25) — passes
sessionIDForResume.
Acceptance Criteria
Relationships
Description
Extend
ClaudeCommandBuilder.build(...)to accept aSessionSurfaceparameter and emit the correct CLI arguments for each surface. For.agentDialogue(.claudeCode)— append stream-json flags per spec.Spec: Epic #250 §4.1 (ClaudeCommandBuilder); docs/architecture/dialogue-events.md §7 (CLI launch flags).
Scope
File
MacApp/Packages/AgentOrchestrator/Sources/AgentOrchestrator/ClaudeCommandBuilder.swiftNew signature
```swift
public static func build(
claudePath: String,
workingDirectory: URL,
shellPATH: String? = nil,
surface: SessionSurface,
sessionIDForResume: SessionID? = nil // optional, for --resume when opening sibling
) -> TerminalCommand
```
Arguments by surface
.shell— should not reach this builder (shell launched through different path); assert / fatalError..agentTerminal(.claudeCode)— current behavior (no extra args; interactive mode)..agentDialogue(.claudeCode)— append:-p(headless)--output-format stream-json--verbose--include-partial-messages--bare--permission-mode acceptEdits(MVP — auto-accept edits only)--allowedTools <csv>(from SettingsStore; whitelist for Bash, WebFetch, etc. that aren't edits)sessionIDForResumeis provided — append--resume <UUID>regardless of surface.Environment (unchanged)
Keep existing env:
PATH,TERM=xterm-256color,COLORTERM=truecolor,GIT_PAGER=cat,PAGER=cat, stripTERM_PROGRAM*.Caller sites
Update all call sites:
AgentSessionFeature._claudeDetected— passessurfacefrom state.sessionIDForResume.Acceptance Criteria
build(...)signature updated withsurface+sessionIDForResume..agentDialogue(.claudeCode)produces all 6 expected flags exactly (-p --output-format stream-json --verbose --include-partial-messages --bare --permission-mode acceptEdits+--allowedToolswhitelist).--input-format stream-jsonis Post-MVP (undocumented per Anthropic issue #24594)..agentTerminal(.claudeCode)produces no extra flags (unchanged).--resumeappended correctly whensessionIDForResumepresent.(surface, sessionIDForResume)combination.Relationships