@strands-agents/sdk 1.12.0 → 1.14.0
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/dist/src/agent/agent-as-tool.d.ts.map +1 -1
- package/dist/src/agent/agent-as-tool.js +8 -2
- package/dist/src/agent/agent-as-tool.js.map +1 -1
- package/dist/src/agent/agent.d.ts +27 -7
- package/dist/src/agent/agent.d.ts.map +1 -1
- package/dist/src/agent/agent.js +141 -38
- package/dist/src/agent/agent.js.map +1 -1
- package/dist/src/agent/continuation.d.ts +36 -0
- package/dist/src/agent/continuation.d.ts.map +1 -0
- package/dist/src/agent/continuation.js +126 -0
- package/dist/src/agent/continuation.js.map +1 -0
- package/dist/src/agent/tool-caller.d.ts.map +1 -1
- package/dist/src/agent/tool-caller.js +1 -0
- package/dist/src/agent/tool-caller.js.map +1 -1
- package/dist/src/context-manager/context-manager.d.ts +30 -0
- package/dist/src/context-manager/context-manager.d.ts.map +1 -0
- package/dist/src/context-manager/context-manager.js +89 -0
- package/dist/src/context-manager/context-manager.js.map +1 -0
- package/dist/src/context-manager/methods/summarize.d.ts +41 -0
- package/dist/src/context-manager/methods/summarize.d.ts.map +1 -0
- package/dist/src/context-manager/methods/summarize.js +108 -0
- package/dist/src/context-manager/methods/summarize.js.map +1 -0
- package/dist/src/context-manager/methods/truncate.d.ts +36 -0
- package/dist/src/context-manager/methods/truncate.d.ts.map +1 -0
- package/dist/src/context-manager/methods/truncate.js +86 -0
- package/dist/src/context-manager/methods/truncate.js.map +1 -0
- package/dist/src/context-manager/modes/agentic/agentic-context.d.ts +1 -2
- package/dist/src/context-manager/modes/agentic/agentic-context.d.ts.map +1 -1
- package/dist/src/context-manager/modes/agentic/agentic-context.js +6 -3
- package/dist/src/context-manager/modes/agentic/agentic-context.js.map +1 -1
- package/dist/src/context-manager/strategies/offload/base.d.ts +140 -0
- package/dist/src/context-manager/strategies/offload/base.d.ts.map +1 -0
- package/dist/src/context-manager/strategies/offload/base.js +376 -0
- package/dist/src/context-manager/strategies/offload/base.js.map +1 -0
- package/dist/src/context-manager/strategies/offload/drop.d.ts +19 -0
- package/dist/src/context-manager/strategies/offload/drop.d.ts.map +1 -0
- package/dist/src/context-manager/strategies/offload/drop.js +31 -0
- package/dist/src/context-manager/strategies/offload/drop.js.map +1 -0
- package/dist/src/context-manager/strategies/offload/index.d.ts +43 -0
- package/dist/src/context-manager/strategies/offload/index.d.ts.map +1 -0
- package/dist/src/context-manager/strategies/offload/index.js +37 -0
- package/dist/src/context-manager/strategies/offload/index.js.map +1 -0
- package/dist/src/context-manager/strategies/offload/summarize.d.ts +22 -0
- package/dist/src/context-manager/strategies/offload/summarize.d.ts.map +1 -0
- package/dist/src/context-manager/strategies/offload/summarize.js +104 -0
- package/dist/src/context-manager/strategies/offload/summarize.js.map +1 -0
- package/dist/src/context-manager/strategies/offload/truncate.d.ts +21 -0
- package/dist/src/context-manager/strategies/offload/truncate.d.ts.map +1 -0
- package/dist/src/context-manager/strategies/offload/truncate.js +66 -0
- package/dist/src/context-manager/strategies/offload/truncate.js.map +1 -0
- package/dist/src/context-manager/types.d.ts +50 -0
- package/dist/src/context-manager/types.d.ts.map +1 -0
- package/dist/src/context-manager/types.js +5 -0
- package/dist/src/context-manager/types.js.map +1 -0
- package/dist/src/conversation-manager/sliding-window-conversation-manager.d.ts +25 -0
- package/dist/src/conversation-manager/sliding-window-conversation-manager.d.ts.map +1 -1
- package/dist/src/conversation-manager/sliding-window-conversation-manager.js +90 -2
- package/dist/src/conversation-manager/sliding-window-conversation-manager.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/injection/message-injection.d.ts +12 -9
- package/dist/src/injection/message-injection.d.ts.map +1 -1
- package/dist/src/injection/message-injection.js +17 -16
- package/dist/src/injection/message-injection.js.map +1 -1
- package/dist/src/mcp/client.d.ts.map +1 -1
- package/dist/src/mcp/client.js +9 -0
- package/dist/src/mcp/client.js.map +1 -1
- package/dist/src/middleware/stages.d.ts +15 -2
- package/dist/src/middleware/stages.d.ts.map +1 -1
- package/dist/src/middleware/stages.js.map +1 -1
- package/dist/src/mime.d.ts +1 -0
- package/dist/src/mime.d.ts.map +1 -1
- package/dist/src/mime.js.map +1 -1
- package/dist/src/models/anthropic.d.ts +26 -1
- package/dist/src/models/anthropic.d.ts.map +1 -1
- package/dist/src/models/anthropic.js +178 -54
- package/dist/src/models/anthropic.js.map +1 -1
- package/dist/src/models/bedrock.d.ts +51 -19
- package/dist/src/models/bedrock.d.ts.map +1 -1
- package/dist/src/models/bedrock.js +239 -30
- package/dist/src/models/bedrock.js.map +1 -1
- package/dist/src/models/model.d.ts +73 -5
- package/dist/src/models/model.d.ts.map +1 -1
- package/dist/src/models/model.js +15 -0
- package/dist/src/models/model.js.map +1 -1
- package/dist/src/models/openai/model.d.ts.map +1 -1
- package/dist/src/models/openai/model.js +5 -0
- package/dist/src/models/openai/model.js.map +1 -1
- package/dist/src/multiagent/plugins.d.ts +3 -1
- package/dist/src/multiagent/plugins.d.ts.map +1 -1
- package/dist/src/multiagent/plugins.js +6 -1
- package/dist/src/multiagent/plugins.js.map +1 -1
- package/dist/src/plugins/registry.d.ts +3 -1
- package/dist/src/plugins/registry.d.ts.map +1 -1
- package/dist/src/plugins/registry.js +6 -1
- package/dist/src/plugins/registry.js.map +1 -1
- package/dist/src/sandbox/docker.js +1 -1
- package/dist/src/sandbox/docker.js.map +1 -1
- package/dist/src/sandbox/ssh.js +1 -1
- package/dist/src/sandbox/ssh.js.map +1 -1
- package/dist/src/storage/in-memory-storage.d.ts +8 -1
- package/dist/src/storage/in-memory-storage.d.ts.map +1 -1
- package/dist/src/storage/in-memory-storage.js +10 -0
- package/dist/src/storage/in-memory-storage.js.map +1 -1
- package/dist/src/storage/local-file-storage.d.ts +8 -1
- package/dist/src/storage/local-file-storage.d.ts.map +1 -1
- package/dist/src/storage/local-file-storage.js +10 -0
- package/dist/src/storage/local-file-storage.js.map +1 -1
- package/dist/src/storage/s3-storage.d.ts +8 -1
- package/dist/src/storage/s3-storage.d.ts.map +1 -1
- package/dist/src/storage/s3-storage.js +10 -0
- package/dist/src/storage/s3-storage.js.map +1 -1
- package/dist/src/storage/search/index.d.ts +13 -0
- package/dist/src/storage/search/index.d.ts.map +1 -0
- package/dist/src/storage/search/index.js +11 -0
- package/dist/src/storage/search/index.js.map +1 -0
- package/dist/src/storage/search/keyword.d.ts +23 -0
- package/dist/src/storage/search/keyword.d.ts.map +1 -0
- package/dist/src/storage/search/keyword.js +53 -0
- package/dist/src/storage/search/keyword.js.map +1 -0
- package/dist/src/storage/search/types.d.ts +24 -0
- package/dist/src/storage/search/types.d.ts.map +1 -0
- package/dist/src/storage/search/types.js +2 -0
- package/dist/src/storage/search/types.js.map +1 -0
- package/dist/src/storage/storage.d.ts +46 -1
- package/dist/src/storage/storage.d.ts.map +1 -1
- package/dist/src/storage/storage.js +22 -0
- package/dist/src/storage/storage.js.map +1 -1
- package/dist/src/tools/executors/executor.d.ts +2 -0
- package/dist/src/tools/executors/executor.d.ts.map +1 -1
- package/dist/src/tools/executors/executor.js +6 -4
- package/dist/src/tools/executors/executor.js.map +1 -1
- package/dist/src/tools/executors/sequential.d.ts +1 -1
- package/dist/src/tools/executors/sequential.js +2 -2
- package/dist/src/tools/executors/sequential.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +2 -1
- package/dist/src/tools/mcp-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-tool.js +2 -1
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/tool.d.ts +2 -0
- package/dist/src/tools/tool.d.ts.map +1 -1
- package/dist/src/tools/tool.js.map +1 -1
- package/dist/src/tools/types.d.ts +8 -0
- package/dist/src/tools/types.d.ts.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/types/agent.d.ts +2 -2
- package/dist/src/types/media.d.ts +65 -3
- package/dist/src/types/media.d.ts.map +1 -1
- package/dist/src/types/media.js +68 -1
- package/dist/src/types/media.js.map +1 -1
- package/dist/src/types/messages.d.ts +6 -4
- package/dist/src/types/messages.d.ts.map +1 -1
- package/dist/src/types/messages.js +4 -1
- package/dist/src/types/messages.js.map +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.d.ts +11 -0
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.d.ts.map +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.js +53 -3
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.js.map +1 -1
- package/dist/src/vended-memory-stores/file-memory-store/index.d.ts +3 -0
- package/dist/src/vended-memory-stores/file-memory-store/index.d.ts.map +1 -0
- package/dist/src/vended-memory-stores/file-memory-store/index.js +2 -0
- package/dist/src/vended-memory-stores/file-memory-store/index.js.map +1 -0
- package/dist/src/vended-memory-stores/file-memory-store/store.d.ts +82 -0
- package/dist/src/vended-memory-stores/file-memory-store/store.d.ts.map +1 -0
- package/dist/src/vended-memory-stores/file-memory-store/store.js +219 -0
- package/dist/src/vended-memory-stores/file-memory-store/store.js.map +1 -0
- package/dist/src/vended-memory-stores/test-memory-store/store.d.ts.map +1 -1
- package/dist/src/vended-memory-stores/test-memory-store/store.js +2 -25
- package/dist/src/vended-memory-stores/test-memory-store/store.js.map +1 -1
- package/dist/src/vended-plugins/context-offloader/plugin.d.ts.map +1 -1
- package/dist/src/vended-plugins/context-offloader/plugin.js +2 -8
- package/dist/src/vended-plugins/context-offloader/plugin.js.map +1 -1
- package/dist/src/vended-tools/bash/index.d.ts +13 -7
- package/dist/src/vended-tools/bash/index.d.ts.map +1 -1
- package/dist/src/vended-tools/bash/index.js +13 -6
- package/dist/src/vended-tools/bash/index.js.map +1 -1
- package/dist/src/vended-tools/bash/types.d.ts +4 -24
- package/dist/src/vended-tools/bash/types.d.ts.map +1 -1
- package/dist/src/vended-tools/bash/types.js +4 -31
- package/dist/src/vended-tools/bash/types.js.map +1 -1
- package/dist/src/vended-tools/http-request/http-request.d.ts +1 -1
- package/dist/src/vended-tools/http-request/http-request.js +2 -2
- package/dist/src/vended-tools/http-request/http-request.js.map +1 -1
- package/dist/src/vended-tools/index.d.ts +1 -0
- package/dist/src/vended-tools/index.d.ts.map +1 -1
- package/dist/src/vended-tools/index.js +1 -0
- package/dist/src/vended-tools/index.js.map +1 -1
- package/dist/src/vended-tools/notebook/notebook.d.ts +1 -1
- package/dist/src/vended-tools/notebook/notebook.d.ts.map +1 -1
- package/dist/src/vended-tools/notebook/notebook.js +20 -6
- package/dist/src/vended-tools/notebook/notebook.js.map +1 -1
- package/dist/src/vended-tools/notebook/types.d.ts +15 -1
- package/dist/src/vended-tools/notebook/types.d.ts.map +1 -1
- package/dist/src/vended-tools/shell/index.d.ts +15 -0
- package/dist/src/vended-tools/shell/index.d.ts.map +1 -0
- package/dist/src/vended-tools/shell/index.js +13 -0
- package/dist/src/vended-tools/shell/index.js.map +1 -0
- package/dist/src/vended-tools/{bash → shell}/make-shell.d.ts +7 -8
- package/dist/src/vended-tools/shell/make-shell.d.ts.map +1 -0
- package/dist/src/vended-tools/{bash → shell}/make-shell.js +16 -9
- package/dist/src/vended-tools/shell/make-shell.js.map +1 -0
- package/dist/src/vended-tools/shell/types.d.ts +47 -0
- package/dist/src/vended-tools/shell/types.d.ts.map +1 -0
- package/dist/src/vended-tools/shell/types.js +34 -0
- package/dist/src/vended-tools/shell/types.js.map +1 -0
- package/dist/src/vended-tools/sleep/make-sleep.d.ts +4 -6
- package/dist/src/vended-tools/sleep/make-sleep.d.ts.map +1 -1
- package/dist/src/vended-tools/sleep/make-sleep.js +5 -7
- package/dist/src/vended-tools/sleep/make-sleep.js.map +1 -1
- package/package.json +15 -2
- package/dist/src/vended-tools/bash/make-shell.d.ts.map +0 -1
- package/dist/src/vended-tools/bash/make-shell.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/bash/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/bash/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAA;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,YAAY,CAAA;AAEnD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type definitions for the bash
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated SANDBOX_BASH_DESCRIPTION is deprecated and will be removed in v2.0.0. Use SANDBOX_SHELL_DESCRIPTION instead. The tool routes commands through the sandbox, which runs sh or the remote login shell rather than bash specifically.
|
|
2
|
+
* Type definitions for the persistent bash tool.
|
|
3
|
+
*
|
|
4
|
+
* The sandbox-routed shell tool's types live in `../shell/types.js`; its error
|
|
5
|
+
* classes extend the ones here so pre-rename catch clauses keep matching.
|
|
8
6
|
*/
|
|
9
|
-
export const SANDBOX_BASH_DESCRIPTION = SANDBOX_SHELL_DESCRIPTION;
|
|
10
7
|
/**
|
|
11
8
|
* Error thrown when a bash command exceeds its timeout.
|
|
12
9
|
*/
|
|
@@ -25,28 +22,4 @@ export class BashSessionError extends Error {
|
|
|
25
22
|
this.name = 'BashSessionError';
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Error thrown when a sandbox-routed shell command exceeds its timeout.
|
|
30
|
-
*
|
|
31
|
-
* Extends {@link BashTimeoutError} so that callers who caught the previous error
|
|
32
|
-
* type keep working; new code should catch this instead.
|
|
33
|
-
*/
|
|
34
|
-
export class ShellTimeoutError extends BashTimeoutError {
|
|
35
|
-
constructor(message) {
|
|
36
|
-
super(message);
|
|
37
|
-
this.name = 'ShellTimeoutError';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Error thrown when a sandbox-routed shell command fails.
|
|
42
|
-
*
|
|
43
|
-
* Extends {@link BashSessionError} so that callers who caught the previous error
|
|
44
|
-
* type keep working; new code should catch this instead.
|
|
45
|
-
*/
|
|
46
|
-
export class ShellExecutionError extends BashSessionError {
|
|
47
|
-
constructor(message) {
|
|
48
|
-
super(message);
|
|
49
|
-
this.name = 'ShellExecutionError';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
25
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/vended-tools/bash/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/vended-tools/bash/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2DH;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare const httpRequest: import("../../index.js").InvokableTool<{
|
|
24
|
-
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "
|
|
24
|
+
method: "HEAD" | "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
|
|
25
25
|
url: string;
|
|
26
26
|
headers?: Record<string, string> | undefined;
|
|
27
27
|
body?: string | undefined;
|
|
@@ -40,9 +40,9 @@ export const httpRequest = tool({
|
|
|
40
40
|
inputSchema: httpRequestInputSchema,
|
|
41
41
|
callback: async (input, context) => {
|
|
42
42
|
const { method, url, headers, body, timeout = 30 } = input;
|
|
43
|
-
// Abort on timeout or
|
|
43
|
+
// Abort on timeout or tool-execution cancellation, whichever comes first
|
|
44
44
|
const timeoutSignal = AbortSignal.timeout(timeout * 1000);
|
|
45
|
-
const signal = context ? AbortSignal.any([timeoutSignal, context.
|
|
45
|
+
const signal = context ? AbortSignal.any([timeoutSignal, context.cancelSignal]) : timeoutSignal;
|
|
46
46
|
try {
|
|
47
47
|
const fetchOptions = { method, signal };
|
|
48
48
|
if (headers !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../src/vended-tools/http-request/http-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC;SACN,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EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAC1E,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vended-tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vended-tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vended-tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vended-tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Notebook tool for managing persistent text notebooks.
|
|
3
3
|
*
|
|
4
4
|
* Notebooks are stored in agent state under the 'notebooks' key and persist within an agent session.
|
|
5
|
-
* Supports create, list, read, write (replace/insert), and clear operations.
|
|
5
|
+
* Supports create, list, read, write (append/replace/insert), and clear operations.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/notebook/notebook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/notebook/notebook.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,QAAQ;;;;;;;UAsDnB,CAAA"}
|
|
@@ -9,7 +9,10 @@ const notebookInputSchema = z
|
|
|
9
9
|
.enum(['create', 'list', 'read', 'write', 'clear'])
|
|
10
10
|
.describe('The operation to perform: `create`, `list`, `read`, `write`, `clear`.'),
|
|
11
11
|
name: z.string().optional().describe('Name of the notebook to operate on. Defaults to "default".'),
|
|
12
|
-
newStr: z
|
|
12
|
+
newStr: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Text to append, or the new string for replacement and insertion operations.'),
|
|
13
16
|
readRange: z
|
|
14
17
|
.array(z.number())
|
|
15
18
|
.optional()
|
|
@@ -25,17 +28,18 @@ const notebookInputSchema = z
|
|
|
25
28
|
if (data.mode === 'write') {
|
|
26
29
|
const hasReplacement = data.oldStr !== undefined && data.newStr !== undefined;
|
|
27
30
|
const hasInsertion = data.insertLine !== undefined && data.newStr !== undefined;
|
|
28
|
-
|
|
31
|
+
const hasAppend = data.oldStr === undefined && data.insertLine === undefined && data.newStr !== undefined;
|
|
32
|
+
return hasReplacement || hasInsertion || hasAppend;
|
|
29
33
|
}
|
|
30
34
|
return true;
|
|
31
35
|
}, {
|
|
32
|
-
message: 'Write operation requires
|
|
36
|
+
message: 'Write operation requires newStr, optionally with oldStr for replacement or insertLine for insertion',
|
|
33
37
|
});
|
|
34
38
|
/**
|
|
35
39
|
* Notebook tool for managing persistent text notebooks.
|
|
36
40
|
*
|
|
37
41
|
* Notebooks are stored in agent state under the 'notebooks' key and persist within an agent session.
|
|
38
|
-
* Supports create, list, read, write (replace/insert), and clear operations.
|
|
42
|
+
* Supports create, list, read, write (append/replace/insert), and clear operations.
|
|
39
43
|
*
|
|
40
44
|
* @example
|
|
41
45
|
* ```typescript
|
|
@@ -53,7 +57,7 @@ const notebookInputSchema = z
|
|
|
53
57
|
*/
|
|
54
58
|
export const notebook = tool({
|
|
55
59
|
name: 'notebook',
|
|
56
|
-
description: 'Manages text notebooks for note-taking and documentation. Supports create, list, read, write (replace or insert), and clear operations. Notebooks persist within the agent invocation.',
|
|
60
|
+
description: 'Manages text notebooks for note-taking and documentation. Supports create, list, read, write (append, replace, or insert), and clear operations. In write mode: newStr alone appends to the end; newStr with oldStr replaces matching text; newStr with insertLine inserts at a position. A write only succeeds on a notebook that already exists: use list to check, or create to start a new one (create replaces any existing content). Notebooks persist within the agent invocation.',
|
|
57
61
|
inputSchema: notebookInputSchema,
|
|
58
62
|
callback: (input, context) => {
|
|
59
63
|
if (!context) {
|
|
@@ -149,12 +153,22 @@ function handleRead(notebooks, name, readRange) {
|
|
|
149
153
|
return selectedLines.length > 0 ? selectedLines.join('\n') : 'No valid lines found in range';
|
|
150
154
|
}
|
|
151
155
|
/**
|
|
152
|
-
* Handles write operation (
|
|
156
|
+
* Handles write operation (append, string replacement, or line insertion).
|
|
153
157
|
*/
|
|
154
158
|
function handleWrite(notebooks, name, oldStr, newStr, insertLine) {
|
|
155
159
|
if (!(name in notebooks)) {
|
|
156
160
|
throw new Error(`Notebook '${name}' not found`);
|
|
157
161
|
}
|
|
162
|
+
// Append mode
|
|
163
|
+
if (oldStr === undefined && insertLine === undefined && newStr !== undefined) {
|
|
164
|
+
if (newStr.length === 0) {
|
|
165
|
+
return `No changes made to notebook '${name}'`;
|
|
166
|
+
}
|
|
167
|
+
const content = notebooks[name];
|
|
168
|
+
const separator = content.length > 0 && !content.endsWith('\n') ? '\n' : '';
|
|
169
|
+
notebooks[name] = `${content}${separator}${newStr}`;
|
|
170
|
+
return `Appended text to notebook '${name}'`;
|
|
171
|
+
}
|
|
158
172
|
// String replacement mode
|
|
159
173
|
if (oldStr !== undefined && newStr !== undefined) {
|
|
160
174
|
if (!notebooks[name].includes(oldStr)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../../../src/vended-tools/notebook/notebook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAClD,QAAQ,CAAC,uEAAuE,CAAC;IACpF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IAClG,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../../../src/vended-tools/notebook/notebook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAClD,QAAQ,C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,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA;QACpC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC,CAAA;QAEpD,OAAO,yBAAyB,OAAO,GAAG,CAAC,iBAAiB,IAAI,GAAG,CAAA;IACrE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;AAC5C,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,SAAiC,EAAE,IAAY;IAClE,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAChC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,aAAa,CAAC,CAAA;IACjD,CAAC;IAED,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;IACpB,OAAO,qBAAqB,IAAI,GAAG,CAAA;AACrC,CAAC"}
|
|
@@ -37,6 +37,20 @@ export interface ReadInput {
|
|
|
37
37
|
name?: string;
|
|
38
38
|
readRange?: [number, number];
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Input parameters for write operation (append to the end).
|
|
42
|
+
* - mode: Operation mode, must be 'write'
|
|
43
|
+
* - name: Name of the notebook to append to
|
|
44
|
+
* - newStr: Text to append. A newline separator is added only when the notebook is non-empty and
|
|
45
|
+
* does not already end in one; an empty string is a no-op.
|
|
46
|
+
*/
|
|
47
|
+
export interface WriteAppendInput {
|
|
48
|
+
mode: 'write';
|
|
49
|
+
name?: string;
|
|
50
|
+
newStr: string;
|
|
51
|
+
oldStr?: never;
|
|
52
|
+
insertLine?: never;
|
|
53
|
+
}
|
|
40
54
|
/**
|
|
41
55
|
* Input parameters for write operation (string replacement).
|
|
42
56
|
* - mode: Operation mode, must be 'write'
|
|
@@ -75,5 +89,5 @@ export interface ClearInput {
|
|
|
75
89
|
/**
|
|
76
90
|
* Union type of all valid notebook inputs.
|
|
77
91
|
*/
|
|
78
|
-
export type NotebookInput = CreateInput | ListInput | ReadInput | WriteReplaceInput | WriteInsertInput | ClearInput;
|
|
92
|
+
export type NotebookInput = CreateInput | ListInput | ReadInput | WriteAppendInput | WriteReplaceInput | WriteInsertInput | ClearInput;
|
|
79
93
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/notebook/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/notebook/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACvB,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,UAAU,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox-routed shell tool.
|
|
3
|
+
*
|
|
4
|
+
* `makeShell` builds a stateless tool that routes commands through a
|
|
5
|
+
* [Sandbox](../../sandbox/base.ts), which runs `sh` locally and in Docker or
|
|
6
|
+
* the remote login shell over SSH. Each call runs in a fresh shell; state such
|
|
7
|
+
* as variables and the working directory does not persist across calls.
|
|
8
|
+
*
|
|
9
|
+
* The persistent, host-spawned `bash` tool lives in `../bash`.
|
|
10
|
+
*/
|
|
11
|
+
export { makeShell, makeBash } from './make-shell.js';
|
|
12
|
+
export type { MakeShellOptions, MakeBashOptions } from './make-shell.js';
|
|
13
|
+
export { SANDBOX_SHELL_DESCRIPTION, ShellTimeoutError, ShellExecutionError } from './types.js';
|
|
14
|
+
export type { ShellOutput } from './types.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC9F,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox-routed shell tool.
|
|
3
|
+
*
|
|
4
|
+
* `makeShell` builds a stateless tool that routes commands through a
|
|
5
|
+
* [Sandbox](../../sandbox/base.ts), which runs `sh` locally and in Docker or
|
|
6
|
+
* the remote login shell over SSH. Each call runs in a fresh shell; state such
|
|
7
|
+
* as variables and the working directory does not persist across calls.
|
|
8
|
+
*
|
|
9
|
+
* The persistent, host-spawned `bash` tool lives in `../bash`.
|
|
10
|
+
*/
|
|
11
|
+
export { makeShell, makeBash } from './make-shell.js';
|
|
12
|
+
export { SANDBOX_SHELL_DESCRIPTION, ShellTimeoutError, ShellExecutionError } from './types.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/vended-tools/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sandbox-bound shell tool factory.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Lives apart from the bash tool so sandbox implementations can import it
|
|
5
|
+
* without pulling in Node dependencies (child_process, Buffer).
|
|
6
6
|
*
|
|
7
7
|
* The command runs in whichever shell the sandbox provides -- `sh` for the Docker
|
|
8
8
|
* and local environments, the remote login shell over SSH -- so it must not rely
|
|
@@ -16,19 +16,18 @@ export interface MakeShellOptions {
|
|
|
16
16
|
description?: string;
|
|
17
17
|
inputSchema?: z.ZodType;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Create a sandbox shell tool. If a sandbox is passed, it's bound at creation time.
|
|
21
|
-
* Otherwise, the tool reads from `context.agent.sandbox` at call time.
|
|
22
|
-
* Used by sandbox implementations in `getTools()` and by users who want a customized shell tool.
|
|
23
|
-
*/
|
|
24
19
|
export declare function makeShell(options?: MakeShellOptions): ReturnType<typeof tool>;
|
|
25
20
|
export declare function makeShell(sandbox: Sandbox | undefined, options?: MakeShellOptions): ReturnType<typeof tool>;
|
|
26
21
|
/**
|
|
27
22
|
* @deprecated makeBash is deprecated and will be removed in v2.0.0. Use makeShell instead. The tool
|
|
28
23
|
* routes commands through the sandbox, which runs sh or the remote login shell rather than bash
|
|
29
24
|
* specifically.
|
|
25
|
+
*
|
|
26
|
+
* Defaults the tool name to `'bash'` so callers keyed on the pre-rename name (hooks, prompts,
|
|
27
|
+
* tool lists) keep working until the alias is removed.
|
|
30
28
|
*/
|
|
31
|
-
export declare
|
|
29
|
+
export declare function makeBash(options?: MakeShellOptions): ReturnType<typeof tool>;
|
|
30
|
+
export declare function makeBash(sandbox: Sandbox | undefined, options?: MakeShellOptions): ReturnType<typeof tool>;
|
|
32
31
|
/**
|
|
33
32
|
* @deprecated MakeBashOptions is deprecated and will be removed in v2.0.0. Use MakeShellOptions instead.
|
|
34
33
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-shell.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/shell/make-shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAQ/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;CACxB;AAgBD,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAA;AAC9E,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAA;AA6B5G;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAA;AAC7E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAA;AAS3G;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sandbox-bound shell tool factory.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Lives apart from the bash tool so sandbox implementations can import it
|
|
5
|
+
* without pulling in Node dependencies (child_process, Buffer).
|
|
6
6
|
*
|
|
7
7
|
* The command runs in whichever shell the sandbox provides -- `sh` for the Docker
|
|
8
8
|
* and local environments, the remote login shell over SSH -- so it must not rely
|
|
@@ -17,9 +17,18 @@ const sandboxShellInputSchema = z.object({
|
|
|
17
17
|
command: z.string().describe('The shell command to execute.'),
|
|
18
18
|
timeout: z.number().positive().optional().describe('Timeout in seconds (default: 120).'),
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Create a sandbox shell tool. If a sandbox is passed, it's bound at creation time.
|
|
22
|
+
* Otherwise, the tool reads from `context.agent.sandbox` at call time.
|
|
23
|
+
* Used by sandbox implementations in `getTools()` and by users who want a customized shell tool.
|
|
24
|
+
*/
|
|
25
|
+
function resolveShellArgs(sandboxOrOptions, maybeOptions) {
|
|
21
26
|
const boundSandbox = sandboxOrOptions instanceof Sandbox ? sandboxOrOptions : undefined;
|
|
22
27
|
const options = sandboxOrOptions instanceof Sandbox || maybeOptions ? (maybeOptions ?? {}) : (sandboxOrOptions ?? {});
|
|
28
|
+
return { boundSandbox, options };
|
|
29
|
+
}
|
|
30
|
+
export function makeShell(sandboxOrOptions, maybeOptions) {
|
|
31
|
+
const { boundSandbox, options } = resolveShellArgs(sandboxOrOptions, maybeOptions);
|
|
23
32
|
return tool({
|
|
24
33
|
name: options.name ?? 'shell',
|
|
25
34
|
description: options.description ?? SANDBOX_SHELL_DESCRIPTION,
|
|
@@ -42,10 +51,8 @@ export function makeShell(sandboxOrOptions, maybeOptions) {
|
|
|
42
51
|
},
|
|
43
52
|
});
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
export const makeBash = makeShell;
|
|
54
|
+
export function makeBash(sandboxOrOptions, maybeOptions) {
|
|
55
|
+
const { boundSandbox, options } = resolveShellArgs(sandboxOrOptions, maybeOptions);
|
|
56
|
+
return makeShell(boundSandbox, { ...options, name: options.name ?? 'bash' });
|
|
57
|
+
}
|
|
51
58
|
//# sourceMappingURL=make-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-shell.js","sourceRoot":"","sources":["../../../../src/vended-tools/shell/make-shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,yBAAyB,EAAoB,MAAM,YAAY,CAAA;A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;gBACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAA;gBACtF,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAiB,CAAA;YACvE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,kEAAkE;gBAClE,IAAI,GAAG,YAAY,mBAAmB;oBAAE,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBAChF,MAAM,IAAI,mBAAmB,CAAE,GAAa,CAAC,OAAO,CAAC,CAAA;YACvD,CAAC;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAYD,MAAM,UAAU,QAAQ,CACtB,gBAA6C,EAC7C,YAA+B;IAE/B,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAA;IAClF,OAAO,SAAS,CAAC,YAAY,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE,CAAC,CAAA;AAC9E,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the sandbox-routed shell tool.
|
|
3
|
+
*
|
|
4
|
+
* The Shell* errors extend the Bash* errors from `../bash/types.js` so that
|
|
5
|
+
* callers who caught the pre-rename error types keep working.
|
|
6
|
+
*/
|
|
7
|
+
import { BashTimeoutError, BashSessionError } from '../bash/types.js';
|
|
8
|
+
export declare const SANDBOX_SHELL_DESCRIPTION: string;
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when a sandbox-routed shell command exceeds its timeout.
|
|
11
|
+
*
|
|
12
|
+
* Extends {@link BashTimeoutError} so that callers who caught the previous error
|
|
13
|
+
* type keep working; new code should catch this instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ShellTimeoutError extends BashTimeoutError {
|
|
16
|
+
constructor(message: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Error thrown when a sandbox-routed shell command fails.
|
|
20
|
+
*
|
|
21
|
+
* Extends {@link BashSessionError} so that callers who caught the previous error
|
|
22
|
+
* type keep working; new code should catch this instead.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ShellExecutionError extends BashSessionError {
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Output format for shell command execution. Structurally identical to the bash
|
|
29
|
+
* tool's output, so pre-rename consumers keep working, but declared standalone;
|
|
30
|
+
* mirrors the Python SDK's `ShellOutput`.
|
|
31
|
+
*/
|
|
32
|
+
export interface ShellOutput {
|
|
33
|
+
/**
|
|
34
|
+
* Standard output from the command.
|
|
35
|
+
*/
|
|
36
|
+
output: string;
|
|
37
|
+
/**
|
|
38
|
+
* Standard error from the command.
|
|
39
|
+
* Empty string if no errors occurred.
|
|
40
|
+
*/
|
|
41
|
+
error: string;
|
|
42
|
+
/**
|
|
43
|
+
* Allow indexing with string keys for JSONValue compatibility.
|
|
44
|
+
*/
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/shell/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAErE,eAAO,MAAM,yBAAyB,QAE8C,CAAA;AAEpF;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;gBAC3C,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the sandbox-routed shell tool.
|
|
3
|
+
*
|
|
4
|
+
* The Shell* errors extend the Bash* errors from `../bash/types.js` so that
|
|
5
|
+
* callers who caught the pre-rename error types keep working.
|
|
6
|
+
*/
|
|
7
|
+
import { BashTimeoutError, BashSessionError } from '../bash/types.js';
|
|
8
|
+
export const SANDBOX_SHELL_DESCRIPTION = 'Executes shell commands. Each call runs in a fresh shell; ' +
|
|
9
|
+
'state such as variables and the working directory does not persist across calls.';
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when a sandbox-routed shell command exceeds its timeout.
|
|
12
|
+
*
|
|
13
|
+
* Extends {@link BashTimeoutError} so that callers who caught the previous error
|
|
14
|
+
* type keep working; new code should catch this instead.
|
|
15
|
+
*/
|
|
16
|
+
export class ShellTimeoutError extends BashTimeoutError {
|
|
17
|
+
constructor(message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'ShellTimeoutError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when a sandbox-routed shell command fails.
|
|
24
|
+
*
|
|
25
|
+
* Extends {@link BashSessionError} so that callers who caught the previous error
|
|
26
|
+
* type keep working; new code should catch this instead.
|
|
27
|
+
*/
|
|
28
|
+
export class ShellExecutionError extends BashSessionError {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'ShellExecutionError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/vended-tools/shell/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAErE,MAAM,CAAC,MAAM,yBAAyB,GACpC,4DAA4D;IAC5D,kFAAkF,CAAA;AAEpF;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,gBAAgB;IACrD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB;IACvD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sleep tool factory: pauses execution for a bounded, cooperative duration.
|
|
3
3
|
*
|
|
4
|
-
* The returned tool honors
|
|
5
|
-
*
|
|
6
|
-
* immediately rather than waiting for the full duration.
|
|
4
|
+
* The returned tool honors `context.cancelSignal`, so cancelling the current
|
|
5
|
+
* tool call aborts the sleep immediately.
|
|
7
6
|
*/
|
|
8
7
|
import type { InvokableTool } from '../../tools/tool.js';
|
|
9
8
|
import type { JSONValue } from '../../types/json.js';
|
|
@@ -30,9 +29,8 @@ export interface MakeSleepOptions {
|
|
|
30
29
|
* Creates a sleep tool with a configurable maximum duration.
|
|
31
30
|
*
|
|
32
31
|
* The returned tool pauses for the requested number of seconds. It attaches a
|
|
33
|
-
* one-shot listener to `context.
|
|
34
|
-
*
|
|
35
|
-
* `AbortError`.
|
|
32
|
+
* one-shot listener to `context.cancelSignal` so that cancellation immediately
|
|
33
|
+
* aborts the sleep with an `AbortError`.
|
|
36
34
|
*
|
|
37
35
|
* @param options - Configuration options.
|
|
38
36
|
* @returns A tool that pauses execution for the requested duration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-sleep.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/sleep/make-sleep.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"make-sleep.d.ts","sourceRoot":"","sources":["../../../../src/vended-tools/sleep/make-sleep.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CA0D9F"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sleep tool factory: pauses execution for a bounded, cooperative duration.
|
|
3
3
|
*
|
|
4
|
-
* The returned tool honors
|
|
5
|
-
*
|
|
6
|
-
* immediately rather than waiting for the full duration.
|
|
4
|
+
* The returned tool honors `context.cancelSignal`, so cancelling the current
|
|
5
|
+
* tool call aborts the sleep immediately.
|
|
7
6
|
*/
|
|
8
7
|
import { tool } from '../../tools/tool-factory.js';
|
|
9
8
|
import { z } from 'zod';
|
|
@@ -12,9 +11,8 @@ import { DEFAULT_MAX_DURATION, sleepDescription } from './types.js';
|
|
|
12
11
|
* Creates a sleep tool with a configurable maximum duration.
|
|
13
12
|
*
|
|
14
13
|
* The returned tool pauses for the requested number of seconds. It attaches a
|
|
15
|
-
* one-shot listener to `context.
|
|
16
|
-
*
|
|
17
|
-
* `AbortError`.
|
|
14
|
+
* one-shot listener to `context.cancelSignal` so that cancellation immediately
|
|
15
|
+
* aborts the sleep with an `AbortError`.
|
|
18
16
|
*
|
|
19
17
|
* @param options - Configuration options.
|
|
20
18
|
* @returns A tool that pauses execution for the requested duration.
|
|
@@ -45,7 +43,7 @@ export function makeSleep(options = {}) {
|
|
|
45
43
|
inputSchema,
|
|
46
44
|
callback: async (input, context) => {
|
|
47
45
|
const { duration } = input;
|
|
48
|
-
const cancelSignal = context?.
|
|
46
|
+
const cancelSignal = context?.cancelSignal;
|
|
49
47
|
if (cancelSignal?.aborted) {
|
|
50
48
|
throw cancelSignal.reason ?? new DOMException('Sleep cancelled before it started', 'AbortError');
|
|
51
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-sleep.js","sourceRoot":"","sources":["../../../../src/vended-tools/sleep/make-sleep.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"make-sleep.js","sourceRoot":"","sources":["../../../../src/vended-tools/sleep/make-sleep.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAqBnE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,UAA4B,EAAE;IACtD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAA;IAC/D,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CAAC,sDAAsD,MAAM,CAAC,WAAW,C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