ai-sdk-provider-claude-code 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -225,7 +225,7 @@ If you're upgrading from version 1.x:
|
|
|
225
225
|
|
|
226
226
|
## Structured Outputs
|
|
227
227
|
|
|
228
|
-
This provider supports **native structured outputs** via the Claude Agent SDK (v0.1.45+). When using `generateObject()` or `streamObject()`, the SDK
|
|
228
|
+
This provider supports **native structured outputs** via the Claude Agent SDK (v0.1.45+). When using `generateObject()` or `streamObject()`, the SDK returns schema-compliant JSON for **supported** JSON Schema features via constrained decoding.
|
|
229
229
|
|
|
230
230
|
```typescript
|
|
231
231
|
import { generateObject } from 'ai';
|
|
@@ -237,30 +237,32 @@ const result = await generateObject({
|
|
|
237
237
|
schema: z.object({
|
|
238
238
|
name: z.string(),
|
|
239
239
|
age: z.number(),
|
|
240
|
-
email: z.string().
|
|
240
|
+
email: z.string().describe('Email address (validate client-side)'),
|
|
241
241
|
}),
|
|
242
242
|
prompt: 'Generate a user profile for a software developer',
|
|
243
243
|
});
|
|
244
244
|
|
|
245
|
-
console.log(result.object); //
|
|
245
|
+
console.log(result.object); // Matches the schema above
|
|
246
246
|
// { name: "Alex Chen", age: 28, email: "alex@example.com" }
|
|
247
247
|
```
|
|
248
248
|
|
|
249
249
|
**Benefits:**
|
|
250
250
|
|
|
251
|
-
- ✅ **
|
|
251
|
+
- ✅ **Schema compliance (supported features)** - Constrained decoding ensures valid output
|
|
252
252
|
- ✅ **No JSON parsing errors** - SDK handles all validation
|
|
253
253
|
- ✅ **No prompt engineering** - Schema enforcement is native to the SDK
|
|
254
254
|
- ✅ **Better performance** - No retry/extraction logic needed
|
|
255
255
|
|
|
256
|
-
> **Note:** A schema is required for JSON output. Using `responseFormat: { type: 'json' }` without a schema is not supported by Claude Code (matching Anthropic's official provider behavior). An `unsupported-setting` warning will be emitted and the call will be treated as plain text.
|
|
256
|
+
> **Note:** A schema is required for JSON output. Using `responseFormat: { type: 'json' }` without a schema is not supported by Claude Code (matching Anthropic's official provider behavior). An `unsupported-setting` warning will be emitted and the call will be treated as plain text.
|
|
257
|
+
>
|
|
258
|
+
> **Current CLI limitation:** Some JSON Schema features can cause the Claude Code CLI to silently fall back to prose (no `structured_output`). This includes `format` constraints (e.g., `email`, `uri`) and complex regex patterns (lookaheads/backreferences). Workaround: keep the generation schema simple, then validate with a stricter schema client-side. See `examples/structured-output-repro.ts` and `examples/limitations.ts`.
|
|
257
259
|
|
|
258
260
|
## Core Features
|
|
259
261
|
|
|
260
262
|
- 🚀 Vercel AI SDK compatibility
|
|
261
263
|
- 🔄 Streaming support
|
|
262
264
|
- 💬 Multi-turn conversations
|
|
263
|
-
- 🎯 Native structured outputs with
|
|
265
|
+
- 🎯 Native structured outputs with schema compliance for supported features
|
|
264
266
|
- 🛑 AbortSignal support
|
|
265
267
|
- 🔧 Tool management (MCP servers, permissions)
|
|
266
268
|
- 🧩 Callbacks (hooks, canUseTool)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-sdk-provider-claude-code",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "AI SDK v6 provider for Claude via Claude Agent SDK (use Pro/Max subscription)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-sdk",
|
|
@@ -67,12 +67,13 @@
|
|
|
67
67
|
"example:tools": "npm run build && npx tsx examples/tool-management.ts",
|
|
68
68
|
"example:timeout": "npm run build && npx tsx examples/long-running-tasks.ts",
|
|
69
69
|
"example:zod4": "npm run build && npx tsx examples/zod4-compatibility-test.ts",
|
|
70
|
+
"example:structured-repro": "npx tsx examples/structured-output-repro.ts",
|
|
70
71
|
"example:all": "npm run build && npm run example:basic && npm run example:streaming && npm run example:conversation && npm run example:config && npm run example:object:basic && npm run example:object:nested && npm run example:object:constraints && npm run example:tools && npm run example:timeout"
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
74
|
"@ai-sdk/provider": "^3.0.0",
|
|
74
75
|
"@ai-sdk/provider-utils": "^4.0.1",
|
|
75
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.
|
|
76
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.9"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@edge-runtime/vm": "5.0.0",
|