@anthropic-ai/claude-code 1.0.80 → 1.0.82
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 +848 -839
- package/package.json +1 -1
- package/sdk.d.ts +4 -0
- package/sdk.mjs +21 -4
- package/vendor/claude-code.vsix +0 -0
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ export type PermissionResult =
|
|
|
49
49
|
export type CanUseTool = (
|
|
50
50
|
toolName: string,
|
|
51
51
|
input: Record<string, unknown>,
|
|
52
|
+
options: {
|
|
53
|
+
// Signaled if the operation should be aborted
|
|
54
|
+
signal: AbortSignal
|
|
55
|
+
},
|
|
52
56
|
) => Promise<PermissionResult>
|
|
53
57
|
|
|
54
58
|
export type Options = {
|
package/sdk.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms).
|
|
4
4
|
|
|
5
|
-
// Version: 1.0.
|
|
5
|
+
// Version: 1.0.82
|
|
6
6
|
|
|
7
7
|
// Want to see the unminified source? We're hiring!
|
|
8
8
|
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
|
|
@@ -258,6 +258,7 @@ class Query {
|
|
|
258
258
|
sdkMessages;
|
|
259
259
|
inputStream = new Stream;
|
|
260
260
|
intialization;
|
|
261
|
+
cancelControllers = new Map;
|
|
261
262
|
constructor(childStdin, childStdout, processExitPromise, canUseTool) {
|
|
262
263
|
this.childStdin = childStdin;
|
|
263
264
|
this.childStdout = childStdout;
|
|
@@ -302,6 +303,9 @@ class Query {
|
|
|
302
303
|
} else if (message.type === "control_request") {
|
|
303
304
|
this.handleControlRequest(message);
|
|
304
305
|
continue;
|
|
306
|
+
} else if (message.type === "control_cancel_request") {
|
|
307
|
+
this.handleControlCancelRequest(message);
|
|
308
|
+
continue;
|
|
305
309
|
}
|
|
306
310
|
this.inputStream.enqueue(message);
|
|
307
311
|
}
|
|
@@ -315,8 +319,10 @@ class Query {
|
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
321
|
async handleControlRequest(request) {
|
|
322
|
+
const controller = new AbortController;
|
|
323
|
+
this.cancelControllers.set(request.request_id, controller);
|
|
318
324
|
try {
|
|
319
|
-
const response = await this.processControlRequest(request);
|
|
325
|
+
const response = await this.processControlRequest(request, controller.signal);
|
|
320
326
|
const controlResponse = {
|
|
321
327
|
type: "control_response",
|
|
322
328
|
response: {
|
|
@@ -338,14 +344,25 @@ class Query {
|
|
|
338
344
|
};
|
|
339
345
|
this.childStdin?.write(JSON.stringify(controlErrorResponse) + `
|
|
340
346
|
`);
|
|
347
|
+
} finally {
|
|
348
|
+
this.cancelControllers.delete(request.request_id);
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
|
-
|
|
351
|
+
handleControlCancelRequest(request) {
|
|
352
|
+
const controller = this.cancelControllers.get(request.request_id);
|
|
353
|
+
if (controller) {
|
|
354
|
+
controller.abort();
|
|
355
|
+
this.cancelControllers.delete(request.request_id);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
async processControlRequest(request, signal) {
|
|
344
359
|
if (request.request.subtype === "can_use_tool") {
|
|
345
360
|
if (!this.canUseTool) {
|
|
346
361
|
throw new Error("canUseTool callback is not provided.");
|
|
347
362
|
}
|
|
348
|
-
return this.canUseTool(request.request.tool_name, request.request.input
|
|
363
|
+
return this.canUseTool(request.request.tool_name, request.request.input, {
|
|
364
|
+
signal
|
|
365
|
+
});
|
|
349
366
|
}
|
|
350
367
|
throw new Error("Unsupported control request subtype: " + request.request.subtype);
|
|
351
368
|
}
|
package/vendor/claude-code.vsix
CHANGED
|
Binary file
|