@aragon-agent/core 0.2.28 → 0.2.30
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/tools/executor.d.ts +7 -1
- package/dist/tools/executor.js +11 -3
- package/package.json +1 -1
package/dist/tools/executor.d.ts
CHANGED
|
@@ -15,7 +15,13 @@ import type { ToolExecutionResult, ToolProgressUpdate } from './types.js';
|
|
|
15
15
|
export interface ToolExecutorOptions {
|
|
16
16
|
/** Default per-tool execution timeout in milliseconds. Defaults to 120_000 (2 minutes). */
|
|
17
17
|
defaultTimeout?: number;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Per-tool timeout overrides, keyed by tool name. An override of `0` means
|
|
20
|
+
* NO ceiling for that tool: no timer is armed, and only an external abort
|
|
21
|
+
* can end it. (`setTimeout(fn, 0)` fires immediately, so before this
|
|
22
|
+
* semantics existed a `0` override aborted the tool at once - a value no
|
|
23
|
+
* working caller could ever have wanted.)
|
|
24
|
+
*/
|
|
19
25
|
timeoutOverrides?: Record<string, number>;
|
|
20
26
|
/** Maximum size (in bytes) of combined text output before truncation. Defaults to 100_000 (100 KB). */
|
|
21
27
|
maxOutputSize?: number;
|
package/dist/tools/executor.js
CHANGED
|
@@ -83,16 +83,23 @@ export class ToolExecutor {
|
|
|
83
83
|
return this.buildResult(toolCallId, toolName, errorResult(`Parameter validation error: ${err instanceof Error ? err.message : String(err)}`), startTime);
|
|
84
84
|
}
|
|
85
85
|
// 4. Set up timeout and merged abort signal.
|
|
86
|
+
//
|
|
87
|
+
// AN OVERRIDE OF `0` ARMS NO TIMER: the tool runs until it settles or an
|
|
88
|
+
// external abort arrives. The CLI's `task` fan-out is the caller this
|
|
89
|
+
// exists for - a dispatch must be able to outlast every generic
|
|
90
|
+
// `defaultTimeout` a session may carry, and a huge sentinel number would
|
|
91
|
+
// merely move the cliff.
|
|
86
92
|
const timeoutMs = this.timeoutOverrides[toolName] ?? this.defaultTimeout;
|
|
87
93
|
const controller = new AbortController();
|
|
88
|
-
const timeoutId = setTimeout(() => controller.abort(TIMEOUT_REASON), timeoutMs);
|
|
94
|
+
const timeoutId = timeoutMs > 0 ? setTimeout(() => controller.abort(TIMEOUT_REASON), timeoutMs) : null;
|
|
89
95
|
// Propagate external signal to our controller.
|
|
90
96
|
const externalAbortHandler = () => {
|
|
91
97
|
controller.abort(signal?.reason ?? new Error('aborted'));
|
|
92
98
|
};
|
|
93
99
|
if (signal) {
|
|
94
100
|
if (signal.aborted) {
|
|
95
|
-
|
|
101
|
+
if (timeoutId)
|
|
102
|
+
clearTimeout(timeoutId);
|
|
96
103
|
return this.buildResult(toolCallId, toolName, errorResult('Execution aborted before start'), startTime);
|
|
97
104
|
}
|
|
98
105
|
signal.addEventListener('abort', externalAbortHandler, { once: true });
|
|
@@ -172,7 +179,8 @@ export class ToolExecutor {
|
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
181
|
finally {
|
|
175
|
-
|
|
182
|
+
if (timeoutId)
|
|
183
|
+
clearTimeout(timeoutId);
|
|
176
184
|
if (graceTimer)
|
|
177
185
|
clearTimeout(graceTimer);
|
|
178
186
|
if (onAbandonAbort) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aragon-agent/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"description": "AragonAgent core engine — LLM provider adapters, streaming, tool registry/execution, steering, idle watchdog, and an optional isolated-vm sandbox.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AragonAgent contributors",
|