@ai-sdk/harness-claude-code 1.0.103 → 1.0.105
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 +18 -0
- package/dist/bridge/index.mjs +213 -22
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +37 -36
- package/dist/index.js +14 -31
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/bridge/create-emit-stream-event.ts +61 -22
- package/src/bridge/index.ts +116 -9
- package/src/bridge/question-tool.ts +104 -0
- package/src/bridge/tool-filtering.ts +1 -1
- package/src/claude-code-harness.ts +18 -34
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Experimental_SandboxSession } from '@ai-sdk/provider-utils';
|
|
4
4
|
import * as _ai_sdk_harness from '@ai-sdk/harness';
|
|
5
|
-
import { HarnessV1Authentication, HarnessV1CredentialForwarding, HarnessV1PortEndpoint, HarnessV1, HarnessV1BuiltinTool } from '@ai-sdk/harness';
|
|
5
|
+
import { HarnessV1Authentication, HarnessV1CredentialForwarding, HarnessV1PortEndpoint, HarnessV1, HarnessV1BuiltinTool, HARNESS_V1_BUILTIN_TOOLS } from '@ai-sdk/harness';
|
|
6
6
|
|
|
7
7
|
type ClaudeCodeAuthenticationMode = HarnessV1Authentication;
|
|
8
8
|
|
|
@@ -3245,26 +3245,10 @@ declare const CLAUDE_CODE_BUILTIN_TOOLS: {
|
|
|
3245
3245
|
action: "keep" | "remove";
|
|
3246
3246
|
discard_changes?: boolean | undefined;
|
|
3247
3247
|
}, any, any>;
|
|
3248
|
-
readonly
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
options: {
|
|
3253
|
-
label: string;
|
|
3254
|
-
description: string;
|
|
3255
|
-
preview?: string | undefined;
|
|
3256
|
-
}[];
|
|
3257
|
-
multiSelect: boolean;
|
|
3258
|
-
}[];
|
|
3259
|
-
answers?: Record<string, string> | undefined;
|
|
3260
|
-
annotations?: Record<string, {
|
|
3261
|
-
preview?: string | undefined;
|
|
3262
|
-
notes?: string | undefined;
|
|
3263
|
-
}> | undefined;
|
|
3264
|
-
metadata?: {
|
|
3265
|
-
source?: string | undefined;
|
|
3266
|
-
} | undefined;
|
|
3267
|
-
}, any, any>;
|
|
3248
|
+
readonly askUserQuestions: typeof HARNESS_V1_BUILTIN_TOOLS.askUserQuestions & {
|
|
3249
|
+
readonly nativeName: "AskUserQuestion";
|
|
3250
|
+
readonly toolUseKind: "readonly";
|
|
3251
|
+
};
|
|
3268
3252
|
readonly Skill: {
|
|
3269
3253
|
readonly toolUseKind: "readonly";
|
|
3270
3254
|
readonly title?: string;
|
|
@@ -15928,26 +15912,43 @@ declare const claudeCode: _ai_sdk_harness.HarnessV1<{
|
|
|
15928
15912
|
action: "keep" | "remove";
|
|
15929
15913
|
discard_changes?: boolean | undefined;
|
|
15930
15914
|
}, any, any>;
|
|
15931
|
-
readonly
|
|
15915
|
+
readonly askUserQuestions: _ai_sdk_provider_utils.FunctionTool<{
|
|
15916
|
+
allowPartialAnswers: boolean;
|
|
15932
15917
|
questions: {
|
|
15918
|
+
id: string;
|
|
15933
15919
|
question: string;
|
|
15934
|
-
header
|
|
15935
|
-
options
|
|
15920
|
+
header?: string | undefined;
|
|
15921
|
+
options?: {
|
|
15922
|
+
id: string;
|
|
15936
15923
|
label: string;
|
|
15937
|
-
description
|
|
15924
|
+
description?: string | undefined;
|
|
15938
15925
|
preview?: string | undefined;
|
|
15939
|
-
}[];
|
|
15940
|
-
|
|
15926
|
+
}[] | undefined;
|
|
15927
|
+
allowMultiple?: boolean | undefined;
|
|
15928
|
+
allowFreeForm?: boolean | {
|
|
15929
|
+
secret: boolean;
|
|
15930
|
+
} | undefined;
|
|
15941
15931
|
}[];
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15932
|
+
}, {
|
|
15933
|
+
action: "answered";
|
|
15934
|
+
answers: Record<string, {
|
|
15935
|
+
optionIds: string[];
|
|
15936
|
+
freeform?: string | undefined;
|
|
15937
|
+
}>;
|
|
15938
|
+
} | {
|
|
15939
|
+
action: "partially-answered";
|
|
15940
|
+
answers: Record<string, {
|
|
15941
|
+
optionIds: string[];
|
|
15942
|
+
freeform?: string | undefined;
|
|
15943
|
+
}>;
|
|
15944
|
+
} | {
|
|
15945
|
+
action: "declined";
|
|
15946
|
+
} | {
|
|
15947
|
+
action: "cancelled";
|
|
15948
|
+
}> & {
|
|
15949
|
+
readonly nativeName: "AskUserQuestion";
|
|
15950
|
+
readonly toolUseKind: "readonly";
|
|
15951
|
+
};
|
|
15951
15952
|
readonly Skill: {
|
|
15952
15953
|
readonly toolUseKind: "readonly";
|
|
15953
15954
|
readonly title?: string;
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { posix } from "path";
|
|
3
3
|
import {
|
|
4
4
|
commonTool,
|
|
5
|
+
HARNESS_V1_BUILTIN_TOOLS,
|
|
5
6
|
harnessV1DiagnosticFromBridgeFrame,
|
|
6
7
|
HarnessCapabilityUnsupportedError
|
|
7
8
|
} from "@ai-sdk/harness";
|
|
@@ -260,7 +261,7 @@ var inboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
260
261
|
]);
|
|
261
262
|
|
|
262
263
|
// src/version.ts
|
|
263
|
-
var VERSION = true ? "1.0.
|
|
264
|
+
var VERSION = true ? "1.0.105" : "0.0.0-test";
|
|
264
265
|
|
|
265
266
|
// src/claude-code-harness.ts
|
|
266
267
|
var CLAUDE_CODE_CLIENT_APP = `ai-sdk/harness-claude-code/${VERSION}`;
|
|
@@ -563,34 +564,11 @@ var CLAUDE_CODE_BUILTIN_TOOLS = {
|
|
|
563
564
|
discard_changes: z2.boolean().optional()
|
|
564
565
|
})
|
|
565
566
|
}),
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
question: z2.string(),
|
|
572
|
-
header: z2.string(),
|
|
573
|
-
options: z2.array(
|
|
574
|
-
z2.object({
|
|
575
|
-
label: z2.string(),
|
|
576
|
-
description: z2.string(),
|
|
577
|
-
preview: z2.string().optional()
|
|
578
|
-
})
|
|
579
|
-
),
|
|
580
|
-
multiSelect: z2.boolean()
|
|
581
|
-
})
|
|
582
|
-
).min(1).max(4),
|
|
583
|
-
answers: z2.record(z2.string(), z2.string()).optional(),
|
|
584
|
-
annotations: z2.record(
|
|
585
|
-
z2.string(),
|
|
586
|
-
z2.object({
|
|
587
|
-
preview: z2.string().optional(),
|
|
588
|
-
notes: z2.string().optional()
|
|
589
|
-
})
|
|
590
|
-
).optional(),
|
|
591
|
-
metadata: z2.object({ source: z2.string().optional() }).optional()
|
|
592
|
-
})
|
|
593
|
-
}),
|
|
567
|
+
askUserQuestions: {
|
|
568
|
+
...HARNESS_V1_BUILTIN_TOOLS.askUserQuestions,
|
|
569
|
+
nativeName: "AskUserQuestion",
|
|
570
|
+
toolUseKind: "readonly"
|
|
571
|
+
},
|
|
594
572
|
Skill: {
|
|
595
573
|
...tool({
|
|
596
574
|
description: "Activate a skill by name",
|
|
@@ -958,12 +936,16 @@ function createClaudeCode(settings = {}) {
|
|
|
958
936
|
);
|
|
959
937
|
}
|
|
960
938
|
} else {
|
|
961
|
-
warnCredentialBrokeringUnavailable();
|
|
962
939
|
sandboxClaudeEnvironment = await applyCredentialForwarding({
|
|
963
940
|
environment: sandboxClaudeEnvironment,
|
|
964
941
|
credentialEnvironmentVariables: CLAUDE_CODE_CREDENTIAL_ENVIRONMENT_VARIABLES,
|
|
965
942
|
credentialForwarding: settings.credentialForwarding
|
|
966
943
|
});
|
|
944
|
+
warnCredentialBrokeringUnavailable({
|
|
945
|
+
environment: claudeEnvironment,
|
|
946
|
+
forwardedEnvironment: sandboxClaudeEnvironment,
|
|
947
|
+
credentialEnvironmentVariables: CLAUDE_CODE_CREDENTIAL_ENVIRONMENT_VARIABLES
|
|
948
|
+
});
|
|
967
949
|
}
|
|
968
950
|
const bootstrapDir = posix.resolve(
|
|
969
951
|
defaultWorkingDirectory,
|
|
@@ -1519,7 +1501,8 @@ function createSession({
|
|
|
1519
1501
|
type: "tool-result",
|
|
1520
1502
|
toolCallId: input.toolCallId,
|
|
1521
1503
|
output: input.output,
|
|
1522
|
-
isError: input.isError
|
|
1504
|
+
isError: input.isError,
|
|
1505
|
+
...input.toolResult !== void 0 ? { toolResult: input.toolResult } : {}
|
|
1523
1506
|
});
|
|
1524
1507
|
},
|
|
1525
1508
|
submitToolApproval: async (input) => {
|