feat(v2): migrate sidecar from raw CLI spawning to @anthropic-ai/claude-agent-sdk

Claude CLI v2.1.69 hangs silently when spawned via child_process.spawn()
with piped stdio (known bug github.com/anthropics/claude-code/issues/6775).

Replace raw CLI spawning in both sidecar runners with the SDK's query()
function, which handles subprocess management internally. SDK message
format matches CLI stream-json, so the sdk-messages.ts adapter is
unchanged.

- agent-runner.ts: use SDK query() with AbortController for stop
- agent-runner-deno.ts: use npm:@anthropic-ai/claude-agent-sdk import
- sidecar.rs: add --allow-write and --allow-net Deno permissions
- package.json: add @anthropic-ai/claude-agent-sdk ^0.2.70, build:sidecar script
This commit is contained in:
Hibryda 2026-03-06 22:57:36 +01:00
parent fdd1884015
commit 323703caba
5 changed files with 457 additions and 151 deletions

View file

@ -220,6 +220,8 @@ impl SidecarManager {
"--allow-run".to_string(),
"--allow-env".to_string(),
"--allow-read".to_string(),
"--allow-write".to_string(),
"--allow-net".to_string(),
deno_path.to_string_lossy().to_string(),
],
});