Skip to content

feat: drive Claude Code via Claude Agent SDK instead of CLI subprocess - #10

Merged
fsqinghuayu merged 4 commits into
mainfrom
dev
Jul 29, 2026
Merged

feat: drive Claude Code via Claude Agent SDK instead of CLI subprocess#10
fsqinghuayu merged 4 commits into
mainfrom
dev

Conversation

@fsqinghuayu

Copy link
Copy Markdown
Collaborator

No description provided.

  Replace the `claude -p` CLI subprocess in `_run_claude_code_cmd` with an
  in-process Claude Agent SDK client (ClaudeSDKClient), while keeping the
  SSE stream-json output byte-compatible so the frontend needs no changes.

  - Add `claude-agent-sdk` to requirements.txt
  - Reconstruct CLI stream-json lines from typed SDK messages
    (system/stream_event/assistant/user/result) so existing session-id
    binding and result-save logic keep working
  - Map system prompt / resume / plan mode / model / max_thinking_tokens
    to ClaudeAgentOptions; keep forwarding ANTHROPIC_* and bash-timeout env
  - Preserve heartbeat parity, client-disconnect interrupt, and the
    forced-skill session bootstrap (now via the SDK)
  - Filter out new SDK-only system subtypes (status, thinking_tokens) to
    match the legacy CLI output
@fsqinghuayu
fsqinghuayu merged commit 452c446 into main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant