cf60e6df51
- Added a unified eval framework with parser grammar, backend interfaces, and JS/Python execution result types. - Added eval tool docs and updated prompts for fenced cells, `eval.py`/`eval.js`, and fallback behavior. - Replaced the built-in `python` tool with `eval` across registry, rendering, interactive modes, and tool settings. - Migrated Python execution runtime from `src/ipy` to `src/eval/py`, renamed state fields, and removed legacy introspection. - Refactored browser tooling from in-process VM helpers to worker-managed tab supervisors and protocol transport. - Added eval parser fallback and JS tool-bridge tests, updated imports, and removed obsolete python-mode suites.
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
export interface ToolTimeoutConfig {
|
|
/** Default timeout in seconds when agent omits the field */
|
|
default: number;
|
|
/** Minimum allowed timeout in seconds */
|
|
min: number;
|
|
/** Maximum allowed timeout in seconds (per-tool ceiling) */
|
|
max: number;
|
|
}
|
|
|
|
export const TOOL_TIMEOUTS = {
|
|
bash: { default: 300, min: 1, max: 3600 },
|
|
eval: { default: 30, min: 1, max: 600 },
|
|
browser: { default: 30, min: 1, max: 30 },
|
|
ssh: { default: 60, min: 1, max: 3600 },
|
|
fetch: { default: 20, min: 1, max: 45 },
|
|
lsp: { default: 20, min: 5, max: 60 },
|
|
debug: { default: 30, min: 5, max: 300 },
|
|
} as const satisfies Record<string, ToolTimeoutConfig>;
|
|
|
|
export type ToolWithTimeout = keyof typeof TOOL_TIMEOUTS;
|
|
|
|
/**
|
|
* Clamp a raw timeout to the allowed range for a tool.
|
|
* If rawTimeout is undefined, returns the tool's default.
|
|
*/
|
|
export function clampTimeout(tool: ToolWithTimeout, rawTimeout?: number): number {
|
|
const config = TOOL_TIMEOUTS[tool];
|
|
const timeout = rawTimeout ?? config.default;
|
|
return Math.max(config.min, Math.min(config.max, timeout));
|
|
}
|