@ai-sdk/harness-claude-code 1.0.3 → 1.0.5
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 +16 -0
- package/dist/bridge/index.mjs +1 -1
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +52 -64
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/src/bridge/index.ts +1 -1
- package/src/claude-code-harness.ts +21 -22
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
|
-
import { z } from 'zod';
|
|
3
1
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
2
|
import * as _ai_sdk_harness from '@ai-sdk/harness';
|
|
5
3
|
import { HarnessV1, HarnessV1BuiltinTool } from '@ai-sdk/harness';
|
|
@@ -62,8 +60,8 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
62
60
|
}, unknown>;
|
|
63
61
|
readonly bash: HarnessV1BuiltinTool<{
|
|
64
62
|
command: string;
|
|
65
|
-
description?: string | undefined;
|
|
66
63
|
timeout?: number | undefined;
|
|
64
|
+
description?: string | undefined;
|
|
67
65
|
run_in_background?: boolean | undefined;
|
|
68
66
|
dangerouslyDisableSandbox?: boolean | undefined;
|
|
69
67
|
}, unknown>;
|
|
@@ -73,10 +71,8 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
73
71
|
}, unknown>;
|
|
74
72
|
readonly grep: HarnessV1BuiltinTool<{
|
|
75
73
|
pattern: string;
|
|
76
|
-
glob?: string | undefined;
|
|
77
|
-
type?: string | undefined;
|
|
78
74
|
path?: string | undefined;
|
|
79
|
-
|
|
75
|
+
glob?: string | undefined;
|
|
80
76
|
output_mode?: "content" | "files_with_matches" | "count" | undefined;
|
|
81
77
|
'-B'?: number | undefined;
|
|
82
78
|
'-A'?: number | undefined;
|
|
@@ -85,7 +81,9 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
85
81
|
'-n'?: boolean | undefined;
|
|
86
82
|
'-i'?: boolean | undefined;
|
|
87
83
|
'-o'?: boolean | undefined;
|
|
84
|
+
type?: string | undefined;
|
|
88
85
|
head_limit?: number | undefined;
|
|
86
|
+
offset?: number | undefined;
|
|
89
87
|
multiline?: boolean | undefined;
|
|
90
88
|
}, unknown>;
|
|
91
89
|
readonly webSearch: HarnessV1BuiltinTool<{
|
|
@@ -106,51 +104,51 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
106
104
|
}, any, any>;
|
|
107
105
|
readonly TodoWrite: _ai_sdk_provider_utils.Tool<{
|
|
108
106
|
todos: {
|
|
109
|
-
status: "pending" | "in_progress" | "completed";
|
|
110
107
|
content: string;
|
|
108
|
+
status: "pending" | "in_progress" | "completed";
|
|
111
109
|
activeForm: string;
|
|
112
110
|
}[];
|
|
113
111
|
}, any, any>;
|
|
114
112
|
readonly Agent: _ai_sdk_provider_utils.Tool<{
|
|
115
113
|
description: string;
|
|
116
114
|
prompt: string;
|
|
117
|
-
run_in_background?: boolean | undefined;
|
|
118
115
|
subagent_type?: string | undefined;
|
|
119
116
|
model?: "sonnet" | "opus" | "haiku" | undefined;
|
|
117
|
+
run_in_background?: boolean | undefined;
|
|
120
118
|
name?: string | undefined;
|
|
121
119
|
team_name?: string | undefined;
|
|
122
|
-
mode?: "
|
|
120
|
+
mode?: "default" | "acceptEdits" | "auto" | "bypassPermissions" | "dontAsk" | "plan" | undefined;
|
|
123
121
|
isolation?: "worktree" | undefined;
|
|
124
122
|
}, any, any>;
|
|
125
123
|
readonly TaskCreate: _ai_sdk_provider_utils.Tool<{
|
|
126
|
-
description: string;
|
|
127
124
|
subject: string;
|
|
128
|
-
|
|
125
|
+
description: string;
|
|
129
126
|
activeForm?: string | undefined;
|
|
127
|
+
metadata?: Record<string, unknown> | undefined;
|
|
130
128
|
}, any, any>;
|
|
131
129
|
readonly TaskGet: _ai_sdk_provider_utils.Tool<{
|
|
132
130
|
taskId: string;
|
|
133
131
|
}, any, any>;
|
|
134
132
|
readonly TaskUpdate: _ai_sdk_provider_utils.Tool<{
|
|
135
133
|
taskId: string;
|
|
136
|
-
|
|
134
|
+
subject?: string | undefined;
|
|
137
135
|
description?: string | undefined;
|
|
138
|
-
status?: "pending" | "in_progress" | "completed" | "deleted" | undefined;
|
|
139
136
|
activeForm?: string | undefined;
|
|
140
|
-
|
|
137
|
+
status?: "pending" | "in_progress" | "completed" | "deleted" | undefined;
|
|
141
138
|
addBlocks?: string[] | undefined;
|
|
142
139
|
addBlockedBy?: string[] | undefined;
|
|
143
140
|
owner?: string | undefined;
|
|
141
|
+
metadata?: Record<string, unknown> | undefined;
|
|
144
142
|
}, any, any>;
|
|
145
|
-
readonly TaskList: _ai_sdk_provider_utils.Tool<
|
|
143
|
+
readonly TaskList: _ai_sdk_provider_utils.Tool<Record<string, never>, any, any>;
|
|
146
144
|
readonly TaskStop: _ai_sdk_provider_utils.Tool<{
|
|
147
145
|
task_id?: string | undefined;
|
|
148
146
|
shell_id?: string | undefined;
|
|
149
147
|
}, any, any>;
|
|
150
148
|
readonly TaskOutput: _ai_sdk_provider_utils.Tool<{
|
|
151
|
-
timeout: number;
|
|
152
149
|
task_id: string;
|
|
153
150
|
block: boolean;
|
|
151
|
+
timeout: number;
|
|
154
152
|
}, any, any>;
|
|
155
153
|
readonly ListMcpResources: _ai_sdk_provider_utils.Tool<{
|
|
156
154
|
server?: string | undefined;
|
|
@@ -159,21 +157,16 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
159
157
|
server: string;
|
|
160
158
|
uri: string;
|
|
161
159
|
}, any, any>;
|
|
162
|
-
readonly ExitPlanMode: _ai_sdk_provider_utils.Tool<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
prompt: z.ZodString;
|
|
166
|
-
}, "strip", z.ZodTypeAny, {
|
|
167
|
-
prompt: string;
|
|
160
|
+
readonly ExitPlanMode: _ai_sdk_provider_utils.Tool<{
|
|
161
|
+
[x: string]: unknown;
|
|
162
|
+
allowedPrompts?: {
|
|
168
163
|
tool: "Bash";
|
|
169
|
-
}, {
|
|
170
164
|
prompt: string;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}, z.ZodTypeAny, "passthrough">, any, any>;
|
|
165
|
+
}[] | undefined;
|
|
166
|
+
}, any, any>;
|
|
174
167
|
readonly EnterWorktree: _ai_sdk_provider_utils.Tool<{
|
|
175
|
-
path?: string | undefined;
|
|
176
168
|
name?: string | undefined;
|
|
169
|
+
path?: string | undefined;
|
|
177
170
|
}, any, any>;
|
|
178
171
|
readonly ExitWorktree: _ai_sdk_provider_utils.Tool<{
|
|
179
172
|
action: "keep" | "remove";
|
|
@@ -181,23 +174,23 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
181
174
|
}, any, any>;
|
|
182
175
|
readonly AskUserQuestion: _ai_sdk_provider_utils.Tool<{
|
|
183
176
|
questions: {
|
|
177
|
+
question: string;
|
|
178
|
+
header: string;
|
|
184
179
|
options: {
|
|
185
|
-
description: string;
|
|
186
180
|
label: string;
|
|
181
|
+
description: string;
|
|
187
182
|
preview?: string | undefined;
|
|
188
183
|
}[];
|
|
189
|
-
question: string;
|
|
190
|
-
header: string;
|
|
191
184
|
multiSelect: boolean;
|
|
192
185
|
}[];
|
|
193
|
-
metadata?: {
|
|
194
|
-
source?: string | undefined;
|
|
195
|
-
} | undefined;
|
|
196
186
|
answers?: Record<string, string> | undefined;
|
|
197
187
|
annotations?: Record<string, {
|
|
198
188
|
preview?: string | undefined;
|
|
199
189
|
notes?: string | undefined;
|
|
200
190
|
}> | undefined;
|
|
191
|
+
metadata?: {
|
|
192
|
+
source?: string | undefined;
|
|
193
|
+
} | undefined;
|
|
201
194
|
}, any, any>;
|
|
202
195
|
readonly Skill: _ai_sdk_provider_utils.Tool<{
|
|
203
196
|
skill: string;
|
|
@@ -230,8 +223,8 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
230
223
|
}, unknown>;
|
|
231
224
|
readonly bash: _ai_sdk_harness.HarnessV1BuiltinTool<{
|
|
232
225
|
command: string;
|
|
233
|
-
description?: string | undefined;
|
|
234
226
|
timeout?: number | undefined;
|
|
227
|
+
description?: string | undefined;
|
|
235
228
|
run_in_background?: boolean | undefined;
|
|
236
229
|
dangerouslyDisableSandbox?: boolean | undefined;
|
|
237
230
|
}, unknown>;
|
|
@@ -241,10 +234,8 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
241
234
|
}, unknown>;
|
|
242
235
|
readonly grep: _ai_sdk_harness.HarnessV1BuiltinTool<{
|
|
243
236
|
pattern: string;
|
|
244
|
-
glob?: string | undefined;
|
|
245
|
-
type?: string | undefined;
|
|
246
237
|
path?: string | undefined;
|
|
247
|
-
|
|
238
|
+
glob?: string | undefined;
|
|
248
239
|
output_mode?: "content" | "files_with_matches" | "count" | undefined;
|
|
249
240
|
'-B'?: number | undefined;
|
|
250
241
|
'-A'?: number | undefined;
|
|
@@ -253,7 +244,9 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
253
244
|
'-n'?: boolean | undefined;
|
|
254
245
|
'-i'?: boolean | undefined;
|
|
255
246
|
'-o'?: boolean | undefined;
|
|
247
|
+
type?: string | undefined;
|
|
256
248
|
head_limit?: number | undefined;
|
|
249
|
+
offset?: number | undefined;
|
|
257
250
|
multiline?: boolean | undefined;
|
|
258
251
|
}, unknown>;
|
|
259
252
|
readonly webSearch: _ai_sdk_harness.HarnessV1BuiltinTool<{
|
|
@@ -274,51 +267,51 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
274
267
|
}, any, any>;
|
|
275
268
|
readonly TodoWrite: _ai_sdk_provider_utils.Tool<{
|
|
276
269
|
todos: {
|
|
277
|
-
status: "pending" | "in_progress" | "completed";
|
|
278
270
|
content: string;
|
|
271
|
+
status: "pending" | "in_progress" | "completed";
|
|
279
272
|
activeForm: string;
|
|
280
273
|
}[];
|
|
281
274
|
}, any, any>;
|
|
282
275
|
readonly Agent: _ai_sdk_provider_utils.Tool<{
|
|
283
276
|
description: string;
|
|
284
277
|
prompt: string;
|
|
285
|
-
run_in_background?: boolean | undefined;
|
|
286
278
|
subagent_type?: string | undefined;
|
|
287
279
|
model?: "sonnet" | "opus" | "haiku" | undefined;
|
|
280
|
+
run_in_background?: boolean | undefined;
|
|
288
281
|
name?: string | undefined;
|
|
289
282
|
team_name?: string | undefined;
|
|
290
|
-
mode?: "
|
|
283
|
+
mode?: "default" | "acceptEdits" | "auto" | "bypassPermissions" | "dontAsk" | "plan" | undefined;
|
|
291
284
|
isolation?: "worktree" | undefined;
|
|
292
285
|
}, any, any>;
|
|
293
286
|
readonly TaskCreate: _ai_sdk_provider_utils.Tool<{
|
|
294
|
-
description: string;
|
|
295
287
|
subject: string;
|
|
296
|
-
|
|
288
|
+
description: string;
|
|
297
289
|
activeForm?: string | undefined;
|
|
290
|
+
metadata?: Record<string, unknown> | undefined;
|
|
298
291
|
}, any, any>;
|
|
299
292
|
readonly TaskGet: _ai_sdk_provider_utils.Tool<{
|
|
300
293
|
taskId: string;
|
|
301
294
|
}, any, any>;
|
|
302
295
|
readonly TaskUpdate: _ai_sdk_provider_utils.Tool<{
|
|
303
296
|
taskId: string;
|
|
304
|
-
|
|
297
|
+
subject?: string | undefined;
|
|
305
298
|
description?: string | undefined;
|
|
306
|
-
status?: "pending" | "in_progress" | "completed" | "deleted" | undefined;
|
|
307
299
|
activeForm?: string | undefined;
|
|
308
|
-
|
|
300
|
+
status?: "pending" | "in_progress" | "completed" | "deleted" | undefined;
|
|
309
301
|
addBlocks?: string[] | undefined;
|
|
310
302
|
addBlockedBy?: string[] | undefined;
|
|
311
303
|
owner?: string | undefined;
|
|
304
|
+
metadata?: Record<string, unknown> | undefined;
|
|
312
305
|
}, any, any>;
|
|
313
|
-
readonly TaskList: _ai_sdk_provider_utils.Tool<
|
|
306
|
+
readonly TaskList: _ai_sdk_provider_utils.Tool<Record<string, never>, any, any>;
|
|
314
307
|
readonly TaskStop: _ai_sdk_provider_utils.Tool<{
|
|
315
308
|
task_id?: string | undefined;
|
|
316
309
|
shell_id?: string | undefined;
|
|
317
310
|
}, any, any>;
|
|
318
311
|
readonly TaskOutput: _ai_sdk_provider_utils.Tool<{
|
|
319
|
-
timeout: number;
|
|
320
312
|
task_id: string;
|
|
321
313
|
block: boolean;
|
|
314
|
+
timeout: number;
|
|
322
315
|
}, any, any>;
|
|
323
316
|
readonly ListMcpResources: _ai_sdk_provider_utils.Tool<{
|
|
324
317
|
server?: string | undefined;
|
|
@@ -327,21 +320,16 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
327
320
|
server: string;
|
|
328
321
|
uri: string;
|
|
329
322
|
}, any, any>;
|
|
330
|
-
readonly ExitPlanMode: _ai_sdk_provider_utils.Tool<
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
prompt: zod.ZodString;
|
|
334
|
-
}, "strip", zod.ZodTypeAny, {
|
|
335
|
-
prompt: string;
|
|
323
|
+
readonly ExitPlanMode: _ai_sdk_provider_utils.Tool<{
|
|
324
|
+
[x: string]: unknown;
|
|
325
|
+
allowedPrompts?: {
|
|
336
326
|
tool: "Bash";
|
|
337
|
-
}, {
|
|
338
327
|
prompt: string;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}, zod.ZodTypeAny, "passthrough">, any, any>;
|
|
328
|
+
}[] | undefined;
|
|
329
|
+
}, any, any>;
|
|
342
330
|
readonly EnterWorktree: _ai_sdk_provider_utils.Tool<{
|
|
343
|
-
path?: string | undefined;
|
|
344
331
|
name?: string | undefined;
|
|
332
|
+
path?: string | undefined;
|
|
345
333
|
}, any, any>;
|
|
346
334
|
readonly ExitWorktree: _ai_sdk_provider_utils.Tool<{
|
|
347
335
|
action: "keep" | "remove";
|
|
@@ -349,23 +337,23 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
349
337
|
}, any, any>;
|
|
350
338
|
readonly AskUserQuestion: _ai_sdk_provider_utils.Tool<{
|
|
351
339
|
questions: {
|
|
340
|
+
question: string;
|
|
341
|
+
header: string;
|
|
352
342
|
options: {
|
|
353
|
-
description: string;
|
|
354
343
|
label: string;
|
|
344
|
+
description: string;
|
|
355
345
|
preview?: string | undefined;
|
|
356
346
|
}[];
|
|
357
|
-
question: string;
|
|
358
|
-
header: string;
|
|
359
347
|
multiSelect: boolean;
|
|
360
348
|
}[];
|
|
361
|
-
metadata?: {
|
|
362
|
-
source?: string | undefined;
|
|
363
|
-
} | undefined;
|
|
364
349
|
answers?: Record<string, string> | undefined;
|
|
365
350
|
annotations?: Record<string, {
|
|
366
351
|
preview?: string | undefined;
|
|
367
352
|
notes?: string | undefined;
|
|
368
353
|
}> | undefined;
|
|
354
|
+
metadata?: {
|
|
355
|
+
source?: string | undefined;
|
|
356
|
+
} | undefined;
|
|
369
357
|
}, any, any>;
|
|
370
358
|
readonly Skill: _ai_sdk_provider_utils.Tool<{
|
|
371
359
|
skill: string;
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
tool
|
|
19
19
|
} from "@ai-sdk/provider-utils";
|
|
20
20
|
import { WebSocket } from "ws";
|
|
21
|
-
import { z as z2 } from "zod";
|
|
21
|
+
import { z as z2 } from "zod/v4";
|
|
22
22
|
|
|
23
23
|
// src/claude-code-auth.ts
|
|
24
24
|
import { execFileSync } from "child_process";
|
|
@@ -270,7 +270,7 @@ var CLAUDE_CODE_BUILTIN_TOOLS = {
|
|
|
270
270
|
subject: z2.string(),
|
|
271
271
|
description: z2.string(),
|
|
272
272
|
activeForm: z2.string().optional(),
|
|
273
|
-
metadata: z2.record(z2.unknown()).optional()
|
|
273
|
+
metadata: z2.record(z2.string(), z2.unknown()).optional()
|
|
274
274
|
})
|
|
275
275
|
}),
|
|
276
276
|
TaskGet: tool({
|
|
@@ -291,7 +291,7 @@ var CLAUDE_CODE_BUILTIN_TOOLS = {
|
|
|
291
291
|
addBlocks: z2.array(z2.string()).optional(),
|
|
292
292
|
addBlockedBy: z2.array(z2.string()).optional(),
|
|
293
293
|
owner: z2.string().optional(),
|
|
294
|
-
metadata: z2.record(z2.unknown()).optional()
|
|
294
|
+
metadata: z2.record(z2.string(), z2.unknown()).optional()
|
|
295
295
|
})
|
|
296
296
|
}),
|
|
297
297
|
TaskList: tool({
|
|
@@ -323,14 +323,14 @@ var CLAUDE_CODE_BUILTIN_TOOLS = {
|
|
|
323
323
|
}),
|
|
324
324
|
ExitPlanMode: tool({
|
|
325
325
|
description: "Exit plan mode with optional permission approvals",
|
|
326
|
-
inputSchema: z2.
|
|
326
|
+
inputSchema: z2.looseObject({
|
|
327
327
|
allowedPrompts: z2.array(
|
|
328
328
|
z2.object({
|
|
329
329
|
tool: z2.literal("Bash"),
|
|
330
330
|
prompt: z2.string()
|
|
331
331
|
})
|
|
332
332
|
).optional()
|
|
333
|
-
})
|
|
333
|
+
})
|
|
334
334
|
}),
|
|
335
335
|
EnterWorktree: tool({
|
|
336
336
|
description: "Create or enter an isolated git worktree",
|
|
@@ -363,8 +363,9 @@ var CLAUDE_CODE_BUILTIN_TOOLS = {
|
|
|
363
363
|
multiSelect: z2.boolean()
|
|
364
364
|
})
|
|
365
365
|
).min(1).max(4),
|
|
366
|
-
answers: z2.record(z2.string()).optional(),
|
|
366
|
+
answers: z2.record(z2.string(), z2.string()).optional(),
|
|
367
367
|
annotations: z2.record(
|
|
368
|
+
z2.string(),
|
|
368
369
|
z2.object({
|
|
369
370
|
preview: z2.string().optional(),
|
|
370
371
|
notes: z2.string().optional()
|
|
@@ -388,7 +389,9 @@ var claudeCodeBridgeCoordsSchema = z2.object({
|
|
|
388
389
|
lastSeenEventId: z2.number(),
|
|
389
390
|
sandboxId: z2.string().optional()
|
|
390
391
|
});
|
|
391
|
-
var claudeCodeResumeStateSchema = z2.
|
|
392
|
+
var claudeCodeResumeStateSchema = z2.looseObject({
|
|
393
|
+
bridge: claudeCodeBridgeCoordsSchema.optional()
|
|
394
|
+
});
|
|
392
395
|
function createClaudeCode(settings = {}) {
|
|
393
396
|
let cachedBootstrap;
|
|
394
397
|
return {
|
|
@@ -509,7 +512,7 @@ function createClaudeCode(settings = {}) {
|
|
|
509
512
|
};
|
|
510
513
|
if (respawnStrategy === void 0) {
|
|
511
514
|
await session.run({
|
|
512
|
-
command: `mkdir -p ${workDir} ${bridgeStateDir}`,
|
|
515
|
+
command: `mkdir -p ${shellQuote(workDir)} ${shellQuote(bridgeStateDir)}`,
|
|
513
516
|
abortSignal: startOpts.abortSignal
|
|
514
517
|
});
|
|
515
518
|
if (startOpts.skills && startOpts.skills.length > 0) {
|
|
@@ -531,7 +534,7 @@ function createClaudeCode(settings = {}) {
|
|
|
531
534
|
abortSignal: startOpts.abortSignal
|
|
532
535
|
});
|
|
533
536
|
const proc = await session.spawn({
|
|
534
|
-
command: `node ${BOOTSTRAP_DIR}/bridge.mjs --workdir ${workDir} --bridge-state-dir ${bridgeStateDir}`,
|
|
537
|
+
command: `node ${BOOTSTRAP_DIR}/bridge.mjs --workdir ${shellQuote(workDir)} --bridge-state-dir ${shellQuote(bridgeStateDir)}`,
|
|
535
538
|
env,
|
|
536
539
|
abortSignal: startOpts.abortSignal
|
|
537
540
|
});
|