Skip to content

chore(deps): @anthropic-ai/claude-agent-sdk 0.2→0.3 + zod 3→4#66

Merged
terraboops merged 3 commits into
mainfrom
deps/agent-sdk-0.3
Jul 6, 2026
Merged

chore(deps): @anthropic-ai/claude-agent-sdk 0.2→0.3 + zod 3→4#66
terraboops merged 3 commits into
mainfrom
deps/agent-sdk-0.3

Conversation

@terraboops

Copy link
Copy Markdown
Owner

Summary

Coupled major upgrade of the core harness SDK and its required zod peer.

  • @anthropic-ai/claude-agent-sdk ^0.2.87^0.3.201
  • zod ^3.x^4.4.3 in every package that declares it: @autonav/core, @autonav/communication-layer, @autonav/pack-server
  • @anthropic-ai/sdk ^0.52.0^0.93.0 — required: agent-sdk 0.3.201 peer-requires @anthropic-ai/sdk >=0.93.0. The one usage (packages/autonav/src/mend/llm-review.ts, messages.create) is on stable API and unchanged.

This PR also contains the zod 3→4 migration (the SDK 0.3.x peer-requires zod ^4, so the two are inseparable). No standalone zod-4 PR is currently open; if one is later opened, this PR supersedes it. Note it also touches @anthropic-ai/sdk, overlapping with #59 (@anthropic-ai/sdk 0.52→0.110) — whichever merges second should re-resolve the lockfile.

agent-sdk 0.2→0.3

The SDK surface used by the harness — query, tool, createSdkMcpServer, and SDKMessage/SDKResultMessage flattening — is unchanged across 0.2→0.3. The Harness abstraction kept the bump localized to packages/autonav/src/harness/claude-code-harness.ts (the only file importing the SDK). The SDK's tool() now types its input schema as a zod v4 AnyZodRawShape, matching this upgrade; the SDK itself declares zod: ^4.0.0.

zod 3→4 migration

  • z.record(z.unknown())z.record(z.string(), z.unknown()) — zod 4 requires an explicit key type (5 call sites: communication-layer config/navigator-response, core plugin-manager/config-schema/self-config).
  • ZodError.errorsZodError.issues (plugin-config.ts, mend/index.ts).
  • .refine(check, (val) => ({ message })).refine(check, { error: (issue) => ... }) — the positional message-thunk form was removed; dynamic value read from issue.input (config.ts SafeCommandSchema).
  • Schema introspection rewrite (config-describe.ts): zod 4 replaced the v3 _def.typeName discriminator with _zod.def.type (lowercase). Also: array item is def.element (was def.type), enum values live in def.entries (was def.values), ZodDefault.defaultValue is now a plain value (was a thunk), and descriptions are read via the .description getter. Verified empirically against zod 4.4.3.

Test

Run from repo root on branch deps/agent-sdk-0.3:

Command Outcome
npm install ✅ resolved (after @anthropic-ai/sdk bump to satisfy peer)
npm run typecheck (builds both packages + tsc --noEmit all 3 workspaces) ✅ clean
npm test ✅ pass

npm test results:

  • core (@autonav/core): 112 passed, 9 skipped (121 total)
  • communication-layer: 45 passed, 13 skipped (58 total)

Harness tests (the highest-risk paths) — all pass

  • tests/harness/chibi-harness.test.ts — 4 passed
  • tests/harness/fake-harness.test.ts — 15 passed
  • tests/harness/opencode-harness.test.ts — 19 passed
  • tests/harness/factory.test.ts — 22 passed
  • tests/adapter.test.ts — 18 passed

No harness test was skipped or weakened; no schema was loosened. Note: no test exercises the live claude-code-harness SDK subprocess path (it needs a real API/subprocess), but it compiles against the 0.3 SDK types and the SDK now natively expects zod v4 shapes.

Coupled major upgrade. SDK 0.3.x peer-requires zod ^4, so both are bumped
together across all packages.

- @anthropic-ai/claude-agent-sdk ^0.2.87 → ^0.3.201
- zod ^3.x → ^4.4.3 in core, communication-layer, pack-server
- @anthropic-ai/sdk ^0.52 → ^0.93 (transitive peer of agent-sdk 0.3;
  SDK 0.3.201 peer-requires @anthropic-ai/sdk >=0.93.0)

zod 4 migration:
- z.record(z.unknown()) → z.record(z.string(), z.unknown()) (key type now required)
- ZodError.errors → ZodError.issues
- .refine positional message thunk → { error: (issue) => ... }
- config schema introspection rewritten for zod 4 internals
  (_def.typeName → _zod.def.type; array item `type`→`element`;
  enum `values`→`entries`; default value is now a plain value not a thunk)

The claude-agent-sdk 0.2→0.3 API surface used by the harness
(query/tool/createSdkMcpServer, SDKMessage/SDKResultMessage flattening)
is unchanged; the Harness abstraction kept the SDK bump localized to
claude-code-harness.ts. The SDK's tool() now expects zod v4 shapes,
matching our upgrade.
# Conflicts:
#	package-lock.json
#	packages/autonav/package.json
#	packages/communication-layer/src/schemas/config-describe.ts
#	packages/communication-layer/src/schemas/config.ts
#	packages/communication-layer/src/schemas/plugin-config.ts
#	packages/knowledge-pack-server/package.json
@terraboops
terraboops merged commit 052662f into main Jul 6, 2026
5 checks passed
@terraboops
terraboops deleted the deps/agent-sdk-0.3 branch July 6, 2026 15:26
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