Skip to content

Bump claude-agent-sdk ^0.1.0 → ^0.3.x (unlocks native agentic harness; fixes cross-turn ScheduleWakeup/background) #303

Description

@edspencer

Summary

Bump @anthropic-ai/claude-agent-sdk in packages/core from ^0.1.0 (resolves 0.1.77) to ^0.3.x (latest 0.3.205). The pinned ^0.1.0 range cannot cross 0.x minors, so herdctl is frozen on a stale SDK line whose bundled harness lacks the current agentic toolset (ScheduleWakeup, ToolSearch, Cron*, Monitor, …). This is the root cause of a real cross-turn-autonomy failure for consumers running long-lived chat agents (e.g. Paddock keepers): an agent that schedules a wakeup or a background task to "continue later" is never re-invoked.

packages/core/package.json:21:

"@anthropic-ai/claude-agent-sdk": "^0.1.0",

Why it matters (evidence)

Root-caused why a keeper's "schedule a wakeup / continue later" never fires:

  • 0.1.x bundles its own JS cli.js harness — grep of the installed 0.1.77 cli.js: 0 ScheduleWakeup refs. So the SDK runtime's openSession() hands the agent a harness that doesn't even contain the tool.
  • System claude 2.1.199 (what the CLI runtime spawns): 9 ScheduleWakeup refs — the tool exists, but the CLI runtime runs it one-shot (claude -p, print-and-exit), so a wakeup timer has no live process to fire in.
  • 0.3.x changed architecture: it drops the bundled JS harness and instead extracts/runs the native Claude Code 2.1.205 binary (per its manifest.json, linux-x64 ~257 MB) — the same 2.1.x line that has the agentic tools.

Empirical confirmation (reproducible): installed claude-agent-sdk@0.3.205, drove a persistent streaming query() (the openSession() path), had the agent call ScheduleWakeup(delaySeconds: 60), then held the session open and idle. The harness re-invoked the same session at the scheduled time and did real work:

tools=34  (ScheduleWakeup loaded via ToolSearch)
RESULT #1  → turn ends, session idle
   … ~83s idle, one live streaming process, no input …
system/init (SAME session id) → TOOL_USE Bash → file written → ASSISTANT: WOKE → RESULT #2
VERDICT: wake fired during idle ✅

The identical test against 0.1.77: ScheduleWakeup / ToolSearch are not available to the agent at all.

Scope / risk

Not a trivial version nudge — the SDK changed substantially between 0.1 and 0.3:

  • Packaging changed: 0.1.x bundled cli.js; 0.3.x ships bridge.mjs + extractFromBunfs.js + a native-binary manifest.json (extracted at runtime). Executable-resolution / startup differs.
  • Verify the surface used by runner/sdk-adapter.ts, runner/runtime/sdk-runtime.ts, and runner/runtime/message-queue.ts still typechecks and behaves: query() signature, Options (systemPrompt preset, permissionMode, allowedTools, canUseTool, cwd, includePartialMessages), and the Query control methods (interrupt, supportedCommands, setModel) + streaming-input AsyncIterable<SDKUserMessage>.
  • Confirm Max-plan auth still resolves via CLAUDE_CODE_OAUTH_TOKEN (verified working with 0.3.205 in the repro).
  • Observed SDK warning on 0.3.205: bare allowedTools entries auto-approve and shadow the canUseTool callback — relevant to per-call permission gating; use a PreToolUse hook if callback gating is required.

Downstream/consumer impact

The bump unlocks the fix but does not deliver it alone. runtime.execute() (the per-turn job path behind trigger()) still runs one query() per turn and ends when the turn's result arrives — so wakeups only survive when a consumer uses the persistent openSession() path, which is SDK-runtime-only (CLI/Docker leave openSession undefined). Consumers wanting cross-turn autonomy must (a) run the agent on runtime: "sdk" and (b) drive turns through openChatSession / openSession, not one-shot trigger(). (Tracked separately on the Paddock side.)

Acceptance criteria

  • packages/core depends on @anthropic-ai/claude-agent-sdk@^0.3.x; lockfile updated.
  • sdk-adapter / sdk-runtime / message-queue build and pass tests against 0.3.x.
  • A test (or documented manual repro) shows a persistent openSession() agent scheduling ScheduleWakeup and being re-invoked at fire time.
  • Changeset added per RELEASING.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions