@aragon-agent/core 0.2.27 → 0.2.29

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.
@@ -1,6 +1,12 @@
1
1
  import type { ModelInfo } from './types.js';
2
2
  export type ContextWindowInfo = Pick<ModelInfo, 'contextWindow'> & {
3
- contextWindowSource: 'api' | 'catalog' | 'fallback';
3
+ /**
4
+ * `user` is produced ONLY by a host layer (the CLI's model-windows.json); no
5
+ * Core code path ever returns it. It is in the union because `ModelInfo`
6
+ * carries whatever the host resolved, and a source Core cannot even name is
7
+ * a host value silently laundered into `catalog`.
8
+ */
9
+ contextWindowSource: 'api' | 'catalog' | 'fallback' | 'user';
4
10
  };
5
11
  /** Never interpret output-token limits as an input/context limit. */
6
12
  export declare function reportedContextWindow(model: Record<string, unknown>): ContextWindowInfo;
@@ -160,8 +160,12 @@ export interface ModelInfo {
160
160
  name: string;
161
161
  provider: string;
162
162
  contextWindow: number;
163
- /** Provenance of the context limit; omitted by legacy/custom providers. */
164
- contextWindowSource?: 'api' | 'catalog' | 'fallback';
163
+ /**
164
+ * Provenance of the context limit; omitted by legacy/custom providers.
165
+ * `user` is set only by a host layer from user configuration (the CLI's
166
+ * model-windows.json); Core itself never produces it.
167
+ */
168
+ contextWindowSource?: 'api' | 'catalog' | 'fallback' | 'user';
165
169
  maxOutputTokens: number;
166
170
  supportsThinking: boolean;
167
171
  supportsTools: boolean;
@@ -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
- /** Per-tool timeout overrides, keyed by tool name. */
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;
@@ -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
- clearTimeout(timeoutId);
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
- clearTimeout(timeoutId);
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.27",
3
+ "version": "0.2.29",
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",