@ai-sdk/harness-claude-code 0.0.0-cca10482-20260708215408
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 +355 -0
- package/LICENSE +13 -0
- package/README.md +62 -0
- package/dist/bridge/index.mjs +1084 -0
- package/dist/bridge/index.mjs.map +1 -0
- package/dist/bridge/package.json +13 -0
- package/dist/bridge/pnpm-lock.yaml +1035 -0
- package/dist/index.d.ts +378 -0
- package/dist/index.js +1285 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -0
- package/src/bridge/claude-skills-option.ts +11 -0
- package/src/bridge/compaction-latch.ts +62 -0
- package/src/bridge/index.ts +967 -0
- package/src/bridge/package.json +13 -0
- package/src/bridge/pnpm-lock.yaml +1035 -0
- package/src/claude-code-auth.ts +141 -0
- package/src/claude-code-bridge-protocol.ts +38 -0
- package/src/claude-code-harness.ts +1545 -0
- package/src/index.ts +13 -0
- package/src/version.ts +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# @ai-sdk/harness-claude-code
|
|
2
|
+
|
|
3
|
+
## 0.0.0-cca10482-20260708215408
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [90cd96d]
|
|
8
|
+
- @ai-sdk/provider-utils@0.0.0-cca10482-20260708215408
|
|
9
|
+
- @ai-sdk/harness@0.0.0-cca10482-20260708215408
|
|
10
|
+
|
|
11
|
+
## 1.0.21
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [ac306ed]
|
|
16
|
+
- @ai-sdk/provider-utils@5.0.6
|
|
17
|
+
- @ai-sdk/harness@1.0.21
|
|
18
|
+
|
|
19
|
+
## 1.0.20
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- b2d0306: feat(harness): send `User-Agent` and `x-client-app` headers in harness adapters
|
|
24
|
+
- Updated dependencies [b7aa06a]
|
|
25
|
+
- @ai-sdk/harness@1.0.20
|
|
26
|
+
|
|
27
|
+
## 1.0.19
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- @ai-sdk/harness@1.0.19
|
|
32
|
+
|
|
33
|
+
## 1.0.18
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- @ai-sdk/harness@1.0.18
|
|
38
|
+
|
|
39
|
+
## 1.0.17
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [5c5c0f5]
|
|
44
|
+
- @ai-sdk/provider-utils@5.0.5
|
|
45
|
+
- @ai-sdk/harness@1.0.17
|
|
46
|
+
|
|
47
|
+
## 1.0.16
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- @ai-sdk/harness@1.0.16
|
|
52
|
+
|
|
53
|
+
## 1.0.15
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [c6f5e62]
|
|
58
|
+
- @ai-sdk/provider-utils@5.0.4
|
|
59
|
+
- @ai-sdk/harness@1.0.15
|
|
60
|
+
|
|
61
|
+
## 1.0.14
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- @ai-sdk/harness@1.0.14
|
|
66
|
+
|
|
67
|
+
## 1.0.13
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [8c616f0]
|
|
72
|
+
- @ai-sdk/provider-utils@5.0.3
|
|
73
|
+
- @ai-sdk/harness@1.0.13
|
|
74
|
+
|
|
75
|
+
## 1.0.12
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- 7859cea: feat(harness): add tool filtering via `activeTools` and `inactiveTools`
|
|
80
|
+
- c857346: feat(harness): add utility functions for certain duplicated layers in harnesses
|
|
81
|
+
- 7a24276: fix(harness-claude-code): declare Claude Code's Monitor tool as built-in tool
|
|
82
|
+
- Updated dependencies [7859cea]
|
|
83
|
+
- Updated dependencies [c857346]
|
|
84
|
+
- @ai-sdk/harness@1.0.12
|
|
85
|
+
|
|
86
|
+
## 1.0.11
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- @ai-sdk/harness@1.0.11
|
|
91
|
+
|
|
92
|
+
## 1.0.10
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- @ai-sdk/harness@1.0.10
|
|
97
|
+
- @ai-sdk/provider-utils@5.0.2
|
|
98
|
+
|
|
99
|
+
## 1.0.9
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- @ai-sdk/harness@1.0.9
|
|
104
|
+
|
|
105
|
+
## 1.0.8
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- @ai-sdk/harness@1.0.8
|
|
110
|
+
|
|
111
|
+
## 1.0.7
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- @ai-sdk/harness@1.0.7
|
|
116
|
+
|
|
117
|
+
## 1.0.6
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Updated dependencies [6a436e3]
|
|
122
|
+
- @ai-sdk/provider-utils@5.0.1
|
|
123
|
+
- @ai-sdk/harness@1.0.6
|
|
124
|
+
|
|
125
|
+
## 1.0.5
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- 43a8c68: fix(harness): use `shellQuote` where appropriate in harness adapters
|
|
130
|
+
- ba6d510: chore: fix deprecated use of zod `.passthrough()`
|
|
131
|
+
- @ai-sdk/harness@1.0.5
|
|
132
|
+
|
|
133
|
+
## 1.0.4
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- c493634: fix(harness): fix harness Zod usage to be v3/v4 compatible
|
|
138
|
+
- Updated dependencies [c493634]
|
|
139
|
+
- @ai-sdk/harness@1.0.4
|
|
140
|
+
|
|
141
|
+
## 1.0.3
|
|
142
|
+
|
|
143
|
+
### Patch Changes
|
|
144
|
+
|
|
145
|
+
- Updated dependencies [51d10a0]
|
|
146
|
+
- @ai-sdk/harness@1.0.3
|
|
147
|
+
|
|
148
|
+
## 1.0.2
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- @ai-sdk/harness@1.0.2
|
|
153
|
+
|
|
154
|
+
## 1.0.1
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- @ai-sdk/harness@1.0.1
|
|
159
|
+
|
|
160
|
+
## 1.0.0
|
|
161
|
+
|
|
162
|
+
### Major Changes
|
|
163
|
+
|
|
164
|
+
- 3d9a50c: feat(harness): implement harness adapters for Claude Code, Codex, Pi
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- e5d4a24: chore(harness): update ws package
|
|
169
|
+
- bc77265: chore(harness): enforce more structural conventions in harness adapters
|
|
170
|
+
- aae0138: fix(harness): make listening for sandbox bridge readiness compatible with Bun
|
|
171
|
+
- 6b81cfe: chore(harness-claude-code): update Claude Code SDK
|
|
172
|
+
- 1ea15a3: fix(harness): fix various bugs with harness skills not being correctly processed by the harness adapters
|
|
173
|
+
- b8396f0: trigger initial beta release
|
|
174
|
+
- e551763: fix(harness): avoid using peer dependencies for underlying harness and sandbox SDKs
|
|
175
|
+
- 534dac6: fix(harness): fix incomplete OIDC token support for AI Gateway auth in harness adapters
|
|
176
|
+
|
|
177
|
+
## 1.0.0-beta.24
|
|
178
|
+
|
|
179
|
+
### Patch Changes
|
|
180
|
+
|
|
181
|
+
- @ai-sdk/harness@1.0.0-beta.27
|
|
182
|
+
|
|
183
|
+
## 1.0.0-beta.23
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- Updated dependencies [a83a367]
|
|
188
|
+
- @ai-sdk/harness@1.0.0-beta.26
|
|
189
|
+
|
|
190
|
+
## 1.0.0-beta.22
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- @ai-sdk/harness@1.0.0-beta.25
|
|
195
|
+
|
|
196
|
+
## 1.0.0-beta.21
|
|
197
|
+
|
|
198
|
+
### Patch Changes
|
|
199
|
+
|
|
200
|
+
- @ai-sdk/harness@1.0.0-beta.24
|
|
201
|
+
|
|
202
|
+
## 1.0.0-beta.20
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- Updated dependencies [57e0a59]
|
|
207
|
+
- @ai-sdk/harness@1.0.0-beta.23
|
|
208
|
+
|
|
209
|
+
## 1.0.0-beta.19
|
|
210
|
+
|
|
211
|
+
### Patch Changes
|
|
212
|
+
|
|
213
|
+
- @ai-sdk/harness@1.0.0-beta.22
|
|
214
|
+
- @ai-sdk/provider-utils@5.0.0-beta.50
|
|
215
|
+
|
|
216
|
+
## 1.0.0-beta.18
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- bc77265: chore(harness): enforce more structural conventions in harness adapters
|
|
221
|
+
|
|
222
|
+
## 1.0.0-beta.17
|
|
223
|
+
|
|
224
|
+
### Patch Changes
|
|
225
|
+
|
|
226
|
+
- @ai-sdk/harness@1.0.0-beta.21
|
|
227
|
+
|
|
228
|
+
## 1.0.0-beta.16
|
|
229
|
+
|
|
230
|
+
### Patch Changes
|
|
231
|
+
|
|
232
|
+
- e5d4a24: chore(harness): update ws package
|
|
233
|
+
- 6b81cfe: chore(harness-claude-code): update Claude Code SDK
|
|
234
|
+
- Updated dependencies [e5d4a24]
|
|
235
|
+
- @ai-sdk/harness@1.0.0-beta.20
|
|
236
|
+
|
|
237
|
+
## 1.0.0-beta.15
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- @ai-sdk/harness@1.0.0-beta.19
|
|
242
|
+
|
|
243
|
+
## 1.0.0-beta.14
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- @ai-sdk/harness@1.0.0-beta.18
|
|
248
|
+
|
|
249
|
+
## 1.0.0-beta.13
|
|
250
|
+
|
|
251
|
+
### Patch Changes
|
|
252
|
+
|
|
253
|
+
- 534dac6: fix(harness): fix incomplete OIDC token support for AI Gateway auth in harness adapters
|
|
254
|
+
- Updated dependencies [534dac6]
|
|
255
|
+
- @ai-sdk/harness@1.0.0-beta.17
|
|
256
|
+
|
|
257
|
+
## 1.0.0-beta.12
|
|
258
|
+
|
|
259
|
+
### Patch Changes
|
|
260
|
+
|
|
261
|
+
- @ai-sdk/harness@1.0.0-beta.16
|
|
262
|
+
|
|
263
|
+
## 1.0.0-beta.11
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- @ai-sdk/harness@1.0.0-beta.15
|
|
268
|
+
|
|
269
|
+
## 1.0.0-beta.10
|
|
270
|
+
|
|
271
|
+
### Patch Changes
|
|
272
|
+
|
|
273
|
+
- b8396f0: trigger initial beta release
|
|
274
|
+
- Updated dependencies [b8396f0]
|
|
275
|
+
- @ai-sdk/harness@1.0.0-beta.14
|
|
276
|
+
- @ai-sdk/provider-utils@5.0.0-beta.49
|
|
277
|
+
|
|
278
|
+
## 1.0.0-canary.9
|
|
279
|
+
|
|
280
|
+
### Patch Changes
|
|
281
|
+
|
|
282
|
+
- @ai-sdk/harness@1.0.0-canary.13
|
|
283
|
+
|
|
284
|
+
## 1.0.0-canary.8
|
|
285
|
+
|
|
286
|
+
### Patch Changes
|
|
287
|
+
|
|
288
|
+
- @ai-sdk/harness@1.0.0-canary.12
|
|
289
|
+
|
|
290
|
+
## 1.0.0-canary.7
|
|
291
|
+
|
|
292
|
+
### Patch Changes
|
|
293
|
+
|
|
294
|
+
- Updated dependencies [be83911]
|
|
295
|
+
- @ai-sdk/harness@1.0.0-canary.11
|
|
296
|
+
|
|
297
|
+
## 1.0.0-canary.6
|
|
298
|
+
|
|
299
|
+
### Patch Changes
|
|
300
|
+
|
|
301
|
+
- @ai-sdk/harness@1.0.0-canary.10
|
|
302
|
+
|
|
303
|
+
## 1.0.0-canary.5
|
|
304
|
+
|
|
305
|
+
### Patch Changes
|
|
306
|
+
|
|
307
|
+
- @ai-sdk/harness@1.0.0-canary.9
|
|
308
|
+
|
|
309
|
+
## 1.0.0-canary.4
|
|
310
|
+
|
|
311
|
+
### Patch Changes
|
|
312
|
+
|
|
313
|
+
- aae0138: fix(harness): make listening for sandbox bridge readiness compatible with Bun
|
|
314
|
+
- Updated dependencies [aae0138]
|
|
315
|
+
- @ai-sdk/harness@1.0.0-canary.8
|
|
316
|
+
|
|
317
|
+
## 1.0.0-canary.3
|
|
318
|
+
|
|
319
|
+
### Patch Changes
|
|
320
|
+
|
|
321
|
+
- 1ea15a3: fix(harness): fix various bugs with harness skills not being correctly processed by the harness adapters
|
|
322
|
+
- e551763: fix(harness): avoid using peer dependencies for underlying harness and sandbox SDKs
|
|
323
|
+
- Updated dependencies [3d87086]
|
|
324
|
+
- Updated dependencies [aeda373]
|
|
325
|
+
- Updated dependencies [1ea15a3]
|
|
326
|
+
- Updated dependencies [375fdd7]
|
|
327
|
+
- Updated dependencies [b4507d5]
|
|
328
|
+
- @ai-sdk/harness@1.0.0-canary.7
|
|
329
|
+
- @ai-sdk/provider-utils@5.0.0-canary.48
|
|
330
|
+
|
|
331
|
+
## 1.0.0-canary.2
|
|
332
|
+
|
|
333
|
+
### Patch Changes
|
|
334
|
+
|
|
335
|
+
- @ai-sdk/harness@1.0.0-canary.6
|
|
336
|
+
|
|
337
|
+
## 1.0.0-canary.1
|
|
338
|
+
|
|
339
|
+
### Patch Changes
|
|
340
|
+
|
|
341
|
+
- Updated dependencies [d77bed4]
|
|
342
|
+
- Updated dependencies [bae5e2b]
|
|
343
|
+
- @ai-sdk/harness@1.0.0-canary.5
|
|
344
|
+
- @ai-sdk/provider-utils@5.0.0-canary.47
|
|
345
|
+
|
|
346
|
+
## 1.0.0-canary.0
|
|
347
|
+
|
|
348
|
+
### Major Changes
|
|
349
|
+
|
|
350
|
+
- 3d9a50c: feat(harness): implement harness adapters for Claude Code, Codex, Pi
|
|
351
|
+
|
|
352
|
+
### Patch Changes
|
|
353
|
+
|
|
354
|
+
- Updated dependencies [3d9a50c]
|
|
355
|
+
- @ai-sdk/harness@1.0.0-canary.4
|
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2023 Vercel, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# AI SDK - Claude Code Harness
|
|
2
|
+
|
|
3
|
+
`HarnessV1` adapter backed by [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk), which drives the `claude` CLI. The adapter ships a bridge process that runs inside a sandbox and talks to the host over a WebSocket on a sandbox-proxied loopback port.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @ai-sdk/harness-claude-code @ai-sdk/harness @ai-sdk/sandbox-vercel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The bridge installs `@anthropic-ai/claude-agent-sdk` and `@anthropic-ai/claude-code` inside the sandbox the first time the session starts.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { HarnessAgent } from '@ai-sdk/harness/agent';
|
|
17
|
+
import { createClaudeCode } from '@ai-sdk/harness-claude-code';
|
|
18
|
+
import { createVercelSandbox } from '@ai-sdk/sandbox-vercel';
|
|
19
|
+
import { tool } from 'ai';
|
|
20
|
+
import { z } from 'zod/v4';
|
|
21
|
+
|
|
22
|
+
const agent = new HarnessAgent({
|
|
23
|
+
harness: createClaudeCode({
|
|
24
|
+
skills: [
|
|
25
|
+
{
|
|
26
|
+
name: 'careful-refactors',
|
|
27
|
+
description: 'Make minimal diffs and keep tests green.',
|
|
28
|
+
content: 'Prefer changes that touch the fewest files possible.',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}),
|
|
32
|
+
id: 'demo',
|
|
33
|
+
sandbox: createVercelSandbox({
|
|
34
|
+
runtime: 'node24',
|
|
35
|
+
ports: [4000],
|
|
36
|
+
}),
|
|
37
|
+
tools: {
|
|
38
|
+
deploy: tool({
|
|
39
|
+
description: 'Deploy a service.',
|
|
40
|
+
inputSchema: z.object({ env: z.enum(['staging', 'production']) }),
|
|
41
|
+
execute: async ({ env }) => ({ url: `https://${env}.example.com` }),
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
harnessOptions: {
|
|
45
|
+
'claude-code': { thinking: 'adaptive' },
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const session = await agent.createSession();
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const result = await agent.generate({
|
|
53
|
+
session,
|
|
54
|
+
prompt: 'Read README.md and summarise the goals.',
|
|
55
|
+
});
|
|
56
|
+
console.log(result.text);
|
|
57
|
+
} finally {
|
|
58
|
+
await session.destroy();
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The adapter requires a `HarnessV1SandboxProvider` whose handles expose at least one port — `@ai-sdk/sandbox-vercel` is the supported choice today. The agent calls `provider.createSession()` when a session starts. Use `session.detach()` to park the bridge and sandbox, `session.stop()` to save state and stop the sandbox, or `session.destroy()` to clean up without keeping resume state.
|