ai 7.0.66 → 7.0.67
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/CHANGELOG.md +7 -0
- package/dist/index.js +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/03-ai-sdk-core/18-code-mode.mdx +11 -3
- package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +55 -0
- package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +13 -9
- package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +8 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1143,7 +1143,7 @@ import {
|
|
|
1143
1143
|
} from "@ai-sdk/provider-utils";
|
|
1144
1144
|
|
|
1145
1145
|
// src/version.ts
|
|
1146
|
-
var VERSION = true ? "7.0.
|
|
1146
|
+
var VERSION = true ? "7.0.67" : "0.0.0-test";
|
|
1147
1147
|
|
|
1148
1148
|
// src/util/download/download.ts
|
|
1149
1149
|
var download = async ({
|
package/dist/internal/index.js
CHANGED
|
@@ -180,6 +180,17 @@ const result = await runCodeMode({
|
|
|
180
180
|
`runCodeMode` returns the value returned by the program. It uses the same
|
|
181
181
|
sandbox and execution limits as the AI SDK tool.
|
|
182
182
|
|
|
183
|
+
## Tool Approval
|
|
184
|
+
|
|
185
|
+
Code mode does not currently integrate with AI SDK tool approval flows. Tool
|
|
186
|
+
calls made by generated code are nested inside the code mode invocation, so
|
|
187
|
+
they cannot pause the generation and surface a tool approval request to your
|
|
188
|
+
application.
|
|
189
|
+
|
|
190
|
+
Do not expose tools that rely on user approval to code mode. Keep those tools
|
|
191
|
+
directly callable by the model instead. If a nested tool requires approval,
|
|
192
|
+
the call is rejected rather than executed.
|
|
193
|
+
|
|
183
194
|
## Execution Limits
|
|
184
195
|
|
|
185
196
|
Every invocation has limits for runtime, memory, source size, results, tool
|
|
@@ -244,6 +255,3 @@ to code mode.
|
|
|
244
255
|
|
|
245
256
|
Tool input schemas are validated before their `execute` functions run. Abort
|
|
246
257
|
signals and AI SDK tool execution context are forwarded to nested tool calls.
|
|
247
|
-
|
|
248
|
-
Code mode does not currently support approval flows for nested tool calls.
|
|
249
|
-
Tools that require approval are rejected instead of being executed.
|
|
@@ -93,6 +93,60 @@ try {
|
|
|
93
93
|
}
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
+
## Generate Structured Output
|
|
97
|
+
|
|
98
|
+
Set `output` when constructing `HarnessAgent` to require the same typed output
|
|
99
|
+
on every turn. The agent converts the output specification to JSON Schema for
|
|
100
|
+
the harness adapter, validates the completed response, and returns the parsed
|
|
101
|
+
value through `result.output`.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { HarnessAgent } from '@ai-sdk/harness/agent';
|
|
105
|
+
import { Output } from 'ai';
|
|
106
|
+
import { z } from 'zod';
|
|
107
|
+
|
|
108
|
+
const agent = new HarnessAgent({
|
|
109
|
+
harness: claudeCode,
|
|
110
|
+
sandbox,
|
|
111
|
+
output: Output.object({
|
|
112
|
+
schema: z.object({
|
|
113
|
+
recipe: z.object({
|
|
114
|
+
name: z.string(),
|
|
115
|
+
ingredients: z.array(
|
|
116
|
+
z.object({
|
|
117
|
+
name: z.string(),
|
|
118
|
+
amount: z.number(),
|
|
119
|
+
unit: z.enum(['oz', 'fl oz', 'cup', 'gallon']),
|
|
120
|
+
}),
|
|
121
|
+
),
|
|
122
|
+
steps: z.array(z.string()),
|
|
123
|
+
}),
|
|
124
|
+
}),
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const session = await agent.createSession();
|
|
129
|
+
try {
|
|
130
|
+
const result = await agent.generate({
|
|
131
|
+
session,
|
|
132
|
+
prompt: 'Generate a lasagna recipe.',
|
|
133
|
+
});
|
|
134
|
+
console.dir(result.output, { depth: Infinity });
|
|
135
|
+
} finally {
|
|
136
|
+
await session.destroy();
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
With `stream()`, read `partialOutputStream` for incrementally parsed values and
|
|
141
|
+
await `result.output` for the validated final value. Structured data also remains
|
|
142
|
+
available as JSON in the normal text and stream surfaces; adapters do not add it
|
|
143
|
+
to the `finish` part.
|
|
144
|
+
|
|
145
|
+
Harness structured output requires a schema. Schema-less `Output.json()` and
|
|
146
|
+
adapters or runtime configurations that cannot enforce the schema throw
|
|
147
|
+
`HarnessCapabilityUnsupportedError`; see the
|
|
148
|
+
[adapter capability table](/docs/ai-sdk-harnesses/harness-adapters#adapter-capabilities).
|
|
149
|
+
|
|
96
150
|
## Messages and History
|
|
97
151
|
|
|
98
152
|
A harness session owns its native conversation history. When you pass `messages`
|
|
@@ -366,6 +420,7 @@ console.log(preparation.identity);
|
|
|
366
420
|
- `id`: optional stable agent identifier.
|
|
367
421
|
- `instructions`: instructions appended to the runtime's system or developer
|
|
368
422
|
prompt when supported, or prepended to the first user prompt otherwise.
|
|
423
|
+
- `output`: typed output specification applied to every turn.
|
|
369
424
|
- `stopWhen`: condition(s) for finishing a result slice after a completed
|
|
370
425
|
harness tool step that can continue into another model step.
|
|
371
426
|
- `tools`: AI SDK tools executed by the host when the harness calls them.
|
|
@@ -30,12 +30,16 @@ The AI SDK includes the following harness adapters:
|
|
|
30
30
|
|
|
31
31
|
## Adapter Capabilities
|
|
32
32
|
|
|
33
|
-
| Adapter | Runtime location | Custom tools | Custom skills | Built-in tool approval | Built-in tool filtering |
|
|
34
|
-
| ------------------------------------------------------ | ---------------- | ------------ | ------------- | ---------------------- | ---------------------------- |
|
|
35
|
-
| [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
36
|
-
| [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
37
|
-
| [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Cross /> | <Cross /> |
|
|
38
|
-
| [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
|
|
39
|
-
| [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Cross /> |
|
|
40
|
-
| [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
|
|
41
|
-
| [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
33
|
+
| Adapter | Runtime location | Custom tools | Custom skills | Structured output | Built-in tool approval | Built-in tool filtering |
|
|
34
|
+
| ------------------------------------------------------ | ---------------- | ------------ | ------------- | ----------------- | ---------------------- | ---------------------------- |
|
|
35
|
+
| [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
36
|
+
| [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
37
|
+
| [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
|
|
38
|
+
| [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
|
|
39
|
+
| [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
|
|
40
|
+
| [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
|
|
41
|
+
| [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Cross /> | <Check /> | <Check /> |
|
|
42
|
+
|
|
43
|
+
Generic ACP profiles do not support structured output unless they configure an
|
|
44
|
+
implementation-specific prompt metadata mapping; Grok Build includes the
|
|
45
|
+
required mapping, while Codex ACP does not expose one.
|
|
@@ -404,7 +404,8 @@ To see `WorkflowAgent` in action, check out [these examples](#examples).
|
|
|
404
404
|
name: 'maxRetries',
|
|
405
405
|
type: 'number',
|
|
406
406
|
isOptional: true,
|
|
407
|
-
description:
|
|
407
|
+
description:
|
|
408
|
+
'How many times to retry retryable model-call failures. Set to 0 to disable retries. Retry-After response headers are respected, and durable workflow step retries are not stacked. Default: 2.',
|
|
408
409
|
},
|
|
409
410
|
{
|
|
410
411
|
name: 'headers',
|
|
@@ -678,6 +679,12 @@ Returns a `Promise<WorkflowAgentStreamResult>` with the following properties:
|
|
|
678
679
|
description:
|
|
679
680
|
'Tool results from the last step. Only includes results for tools that were executed.',
|
|
680
681
|
},
|
|
682
|
+
{
|
|
683
|
+
name: 'error',
|
|
684
|
+
type: 'unknown | undefined',
|
|
685
|
+
description:
|
|
686
|
+
"The original value from a model stream error part. The property is present when an error part was emitted, even if its value is undefined; use `'error' in result` to distinguish that case.",
|
|
687
|
+
},
|
|
681
688
|
{
|
|
682
689
|
name: 'output',
|
|
683
690
|
type: 'OUTPUT',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.67",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/gateway": "4.0.
|
|
45
|
+
"@ai-sdk/gateway": "4.0.53",
|
|
46
46
|
"@ai-sdk/provider": "4.0.7",
|
|
47
47
|
"@ai-sdk/provider-utils": "5.0.27"
|
|
48
48
|
},
|