ai 7.0.0-beta.185 → 7.0.0-beta.187

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.0-beta.187
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [77cc1af]
8
+ - @ai-sdk/gateway@4.0.0-beta.114
9
+
10
+ ## 7.0.0-beta.186
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [eb024b6]
15
+ - @ai-sdk/gateway@4.0.0-beta.113
16
+
3
17
  ## 7.0.0-beta.185
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1089,7 +1089,7 @@ import {
1089
1089
  } from "@ai-sdk/provider-utils";
1090
1090
 
1091
1091
  // src/version.ts
1092
- var VERSION = true ? "7.0.0-beta.185" : "0.0.0-test";
1092
+ var VERSION = true ? "7.0.0-beta.187" : "0.0.0-test";
1093
1093
 
1094
1094
  // src/util/download/download.ts
1095
1095
  var download = async ({
@@ -83,7 +83,7 @@ import {
83
83
  } from "@ai-sdk/provider-utils";
84
84
 
85
85
  // src/version.ts
86
- var VERSION = true ? "7.0.0-beta.185" : "0.0.0-test";
86
+ var VERSION = true ? "7.0.0-beta.187" : "0.0.0-test";
87
87
 
88
88
  // src/util/download/download.ts
89
89
  var download = async ({
@@ -7,7 +7,7 @@ description: Create and run AI SDK HarnessAgent sessions.
7
7
 
8
8
  `HarnessAgent` is an AI SDK `Agent` implementation backed by a harness adapter.
9
9
  It gives you `generate()` and `stream()` methods that return AI SDK-compatible
10
- results while an preconfigured harness powers these results.
10
+ results while a preconfigured harness powers these results.
11
11
 
12
12
  ## Installation
13
13
 
@@ -213,8 +213,17 @@ the continued turn and return a `GenerateTextResult`.
213
213
 
214
214
  ## Prepare the Sandbox
215
215
 
216
- Use `onSandboxSession` to prepare files, install lightweight utilities, or write
217
- configuration before the harness starts:
216
+ Use `sandboxConfig` to prepare the sandbox before the harness starts.
217
+
218
+ `sandboxConfig.onBootstrap` runs during sandbox template creation, after the
219
+ harness adapter's own bootstrap and before snapshot-capable providers publish a
220
+ snapshot. Use it for expensive setup that should be reused by future sessions.
221
+ When you provide `onBootstrap`, also provide `bootstrapHash`; change the hash
222
+ whenever the bootstrap output should invalidate the reusable snapshot.
223
+
224
+ `sandboxConfig.onSession` runs after each sandbox session is acquired and its
225
+ working directory exists, including resumed sessions. Use it for per-session
226
+ files or lightweight configuration.
218
227
 
219
228
  ```ts
220
229
  const agent = new HarnessAgent({
@@ -223,17 +232,34 @@ const agent = new HarnessAgent({
223
232
  runtime: 'node24',
224
233
  ports: [4000],
225
234
  }),
226
- onSandboxSession: async ({ session, sessionWorkDir, abortSignal }) => {
227
- await session.writeTextFile({
228
- path: `${sessionWorkDir}/README.md`,
229
- content: 'Session notes for the harness.',
230
- abortSignal,
231
- });
235
+ sandboxConfig: {
236
+ workDir: 'repo',
237
+ bootstrapHash: 'ripgrep-v1',
238
+ onBootstrap: async ({ session, abortSignal }) => {
239
+ const result = await session.run({
240
+ command:
241
+ 'command -v rg >/dev/null || (apt-get update && apt-get install -y ripgrep)',
242
+ abortSignal,
243
+ });
244
+ if (result.exitCode !== 0) {
245
+ throw new Error(`Failed to install ripgrep: ${result.stderr}`);
246
+ }
247
+ },
248
+ onSession: async ({ session, sessionWorkDir, abortSignal }) => {
249
+ await session.writeTextFile({
250
+ path: `${sessionWorkDir}/README.md`,
251
+ content: 'Session notes for the harness.',
252
+ abortSignal,
253
+ });
254
+ },
232
255
  },
233
256
  });
234
257
  ```
235
258
 
236
- This hook runs for fresh and resumed sessions. Keep it idempotent.
259
+ `workDir` is optional. When provided, it must be relative to the sandbox's
260
+ default working directory and is used as the session working directory. When
261
+ omitted, regular sessions use the default `<harnessId>-<sessionId>` directory,
262
+ while `onBootstrap` receives the sandbox's default working directory.
237
263
 
238
264
  ## Settings
239
265
 
@@ -247,7 +273,7 @@ This hook runs for fresh and resumed sessions. Keep it idempotent.
247
273
  - `skills`: instruction bundles surfaced by the adapter.
248
274
  - `permissionMode`: built-in tool permission mode.
249
275
  - `toolApproval`: approval status map for host-executed tools.
250
- - `onSandboxSession`: sandbox preparation hook.
276
+ - `sandboxConfig`: sandbox working-directory and lifecycle hook configuration.
251
277
  - `telemetry`, `debug`, and `onLog`: observability and diagnostics.
252
278
 
253
279
  Adapter-specific settings belong on the adapter factory, for example
@@ -164,11 +164,8 @@ In direct agent code, pass the approval response as `messages` on the next
164
164
 
165
165
  ## Built-in Approval Support
166
166
 
167
- Not every adapter can pause built-in tool calls for approval:
168
-
169
- - Claude Code supports built-in approval requests.
170
- - Pi supports built-in approval requests.
171
- - Codex currently does not; use `permissionMode: 'allow-all'`.
167
+ Most adapters can pause built-in tool calls for approval. Adapters that do not
168
+ support it will error if an unsupported tool approval mode is specified.
172
169
 
173
170
  Host-executed tool approvals are handled by `HarnessAgent`, so they work across
174
171
  adapters.
@@ -16,6 +16,7 @@ The AI SDK includes the following harness adapters:
16
16
 
17
17
  - [Claude Code](/providers/ai-sdk-harnesses/claude-code) (`@ai-sdk/harness-claude-code`)
18
18
  - [Codex](/providers/ai-sdk-harnesses/codex) (`@ai-sdk/harness-codex`)
19
+ - [OpenCode](/providers/ai-sdk-harnesses/opencode) (`@ai-sdk/harness-opencode`)
19
20
  - [Pi](/providers/ai-sdk-harnesses/pi) (`@ai-sdk/harness-pi`)
20
21
 
21
22
  ### Coming Soon
@@ -24,7 +25,6 @@ The AI SDK includes the following harness adapters:
24
25
  - DeepAgents (`@ai-sdk/harness-deepagents`)
25
26
  - Goose (`@ai-sdk/harness-goose`)
26
27
  - Mastra (`@ai-sdk/harness-mastra`)
27
- - OpenCode (`@ai-sdk/harness-opencode`)
28
28
 
29
29
  ## Adapter Capabilities
30
30
 
@@ -32,4 +32,5 @@ The AI SDK includes the following harness adapters:
32
32
  | ------------------------------------------------------ | ---------------- | ------------------- | ------------------- | ---------------------- |
33
33
  | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
34
34
  | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check size={18} /> | <Check size={18} /> | <Cross size={18} /> |
35
+ | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
35
36
  | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
@@ -35,8 +35,7 @@ running established agent harnesses such as Claude Code, Codex, and Pi.
35
35
  },
36
36
  {
37
37
  title: 'Harness Adapters',
38
- description:
39
- 'Choose from the implemented Claude Code, Codex, and Pi harness adapters.',
38
+ description: 'Learn about the available harness adapters.',
40
39
  href: '/docs/ai-sdk-harnesses/harness-adapters',
41
40
  },
42
41
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.0-beta.185",
3
+ "version": "7.0.0-beta.187",
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.0-beta.112",
45
+ "@ai-sdk/gateway": "4.0.0-beta.114",
46
46
  "@ai-sdk/provider": "4.0.0-beta.20",
47
47
  "@ai-sdk/provider-utils": "5.0.0-beta.50"
48
48
  },