@anthropic-ai/claude-agent-sdk 0.1.49 → 0.1.50
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/cli.js +2114 -2080
- package/package.json +1 -1
- package/sdk.d.ts +8 -0
- package/sdk.mjs +12 -6
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -315,6 +315,14 @@ type SDKUserMessageContent = {
|
|
|
315
315
|
* the user directly, but instead was generated by the system.
|
|
316
316
|
*/
|
|
317
317
|
isSynthetic?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* If present, the JSON result of a tool use that this user message is
|
|
320
|
+
* responding to. This is provided to make it easier for applications to
|
|
321
|
+
* present the tool result in a formatted way. The model only receives
|
|
322
|
+
* the content within the user message.
|
|
323
|
+
* The specific format is tool-dependent.
|
|
324
|
+
*/
|
|
325
|
+
tool_use_result?: unknown;
|
|
318
326
|
};
|
|
319
327
|
export type SDKUserMessage = SDKUserMessageContent & {
|
|
320
328
|
uuid?: UUID;
|
package/sdk.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://docs.claude.com/en/docs/claude-code/legal-and-compliance.
|
|
3
3
|
|
|
4
|
-
// Version: 0.1.
|
|
4
|
+
// Version: 0.1.50
|
|
5
5
|
|
|
6
6
|
// Want to see the unminified source? We're hiring!
|
|
7
7
|
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
|
|
@@ -7443,7 +7443,10 @@ function getInitialState() {
|
|
|
7443
7443
|
inMemoryErrorLog: [],
|
|
7444
7444
|
inlinePlugins: [],
|
|
7445
7445
|
sessionBypassPermissionsMode: false,
|
|
7446
|
-
hasExitedPlanMode: false
|
|
7446
|
+
hasExitedPlanMode: false,
|
|
7447
|
+
initJsonSchema: null,
|
|
7448
|
+
registeredHooks: null,
|
|
7449
|
+
planSlugCache: new Map
|
|
7447
7450
|
};
|
|
7448
7451
|
}
|
|
7449
7452
|
var STATE = getInitialState();
|
|
@@ -7527,6 +7530,7 @@ class Query {
|
|
|
7527
7530
|
canUseTool;
|
|
7528
7531
|
hooks;
|
|
7529
7532
|
abortController;
|
|
7533
|
+
jsonSchema;
|
|
7530
7534
|
pendingControlResponses = new Map;
|
|
7531
7535
|
cleanupPerformed = false;
|
|
7532
7536
|
sdkMessages;
|
|
@@ -7540,12 +7544,13 @@ class Query {
|
|
|
7540
7544
|
firstResultReceivedPromise;
|
|
7541
7545
|
firstResultReceivedResolve;
|
|
7542
7546
|
streamCloseTimeout;
|
|
7543
|
-
constructor(transport, isSingleUserTurn, canUseTool, hooks, abortController, sdkMcpServers = new Map) {
|
|
7547
|
+
constructor(transport, isSingleUserTurn, canUseTool, hooks, abortController, sdkMcpServers = new Map, jsonSchema) {
|
|
7544
7548
|
this.transport = transport;
|
|
7545
7549
|
this.isSingleUserTurn = isSingleUserTurn;
|
|
7546
7550
|
this.canUseTool = canUseTool;
|
|
7547
7551
|
this.hooks = hooks;
|
|
7548
7552
|
this.abortController = abortController;
|
|
7553
|
+
this.jsonSchema = jsonSchema;
|
|
7549
7554
|
this.streamCloseTimeout = 60000;
|
|
7550
7555
|
if (typeof process !== "undefined" && process.env?.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT) {
|
|
7551
7556
|
this.streamCloseTimeout = parseInt(process.env.CLAUDE_CODE_STREAM_CLOSE_TIMEOUT);
|
|
@@ -7737,7 +7742,8 @@ class Query {
|
|
|
7737
7742
|
const initRequest = {
|
|
7738
7743
|
subtype: "initialize",
|
|
7739
7744
|
hooks,
|
|
7740
|
-
sdkMcpServers
|
|
7745
|
+
sdkMcpServers,
|
|
7746
|
+
jsonSchema: this.jsonSchema
|
|
7741
7747
|
};
|
|
7742
7748
|
const response = await this.request(initRequest);
|
|
7743
7749
|
return response.response;
|
|
@@ -14823,7 +14829,7 @@ function query({
|
|
|
14823
14829
|
const dirname2 = join3(filename, "..");
|
|
14824
14830
|
pathToClaudeCodeExecutable = join3(dirname2, "cli.js");
|
|
14825
14831
|
}
|
|
14826
|
-
process.env.CLAUDE_AGENT_SDK_VERSION = "0.1.
|
|
14832
|
+
process.env.CLAUDE_AGENT_SDK_VERSION = "0.1.50";
|
|
14827
14833
|
const {
|
|
14828
14834
|
abortController = createAbortController(),
|
|
14829
14835
|
additionalDirectories = [],
|
|
@@ -14919,7 +14925,7 @@ function query({
|
|
|
14919
14925
|
includePartialMessages,
|
|
14920
14926
|
plugins
|
|
14921
14927
|
});
|
|
14922
|
-
const queryInstance = new Query(transport, isSingleUserTurn, canUseTool, hooks, abortController, sdkMcpServers);
|
|
14928
|
+
const queryInstance = new Query(transport, isSingleUserTurn, canUseTool, hooks, abortController, sdkMcpServers, jsonSchema);
|
|
14923
14929
|
if (typeof prompt === "string") {
|
|
14924
14930
|
transport.write(JSON.stringify({
|
|
14925
14931
|
type: "user",
|