@@ -35,6 +35,7 @@ import type { AnyAgentTool } from "./common.js";
|
35 | 35 | import { |
36 | 36 | jsonResult, |
37 | 37 | normalizeToolModelOverride, |
| 38 | +readNonNegativeIntegerParam, |
38 | 39 | readStringParam, |
39 | 40 | ToolInputError, |
40 | 41 | } from "./common.js"; |
@@ -169,9 +170,9 @@ function createSessionsSpawnToolSchema(params: {
|
169 | 170 | model: Type.Optional(Type.String()), |
170 | 171 | thinking: Type.Optional(Type.String()), |
171 | 172 | cwd: Type.Optional(Type.String()), |
172 | | -runTimeoutSeconds: Type.Optional(Type.Number({ minimum: 0 })), |
| 173 | +runTimeoutSeconds: Type.Optional(Type.Integer({ minimum: 0 })), |
173 | 174 | // Back-compat: older callers used timeoutSeconds for this tool. |
174 | | -timeoutSeconds: Type.Optional(Type.Number({ minimum: 0 })), |
| 175 | +timeoutSeconds: Type.Optional(Type.Integer({ minimum: 0 })), |
175 | 176 | ...(params.threadAvailable |
176 | 177 | ? { |
177 | 178 | thread: Type.Optional( |
@@ -342,17 +343,10 @@ export function createSessionsSpawnTool(
|
342 | 343 | if (runtime === "acp" && context === "fork") { |
343 | 344 | throw new Error('context="fork" is only supported for runtime="subagent".'); |
344 | 345 | } |
345 | | -// Back-compat: older callers used timeoutSeconds for this tool. |
346 | | -const timeoutSecondsCandidate = |
347 | | -typeof params.runTimeoutSeconds === "number" |
348 | | - ? params.runTimeoutSeconds |
349 | | - : typeof params.timeoutSeconds === "number" |
350 | | - ? params.timeoutSeconds |
351 | | - : undefined; |
352 | 346 | const runTimeoutSeconds = |
353 | | -typeof timeoutSecondsCandidate === "number" && Number.isFinite(timeoutSecondsCandidate) |
354 | | - ? Math.max(0, Math.floor(timeoutSecondsCandidate)) |
355 | | - : undefined; |
| 347 | +readNonNegativeIntegerParam(params, "runTimeoutSeconds") ?? |
| 348 | +// Back-compat: older callers used timeoutSeconds for this tool. |
| 349 | +readNonNegativeIntegerParam(params, "timeoutSeconds"); |
356 | 350 | const thread = params.thread === true; |
357 | 351 | const attachments = Array.isArray(params.attachments) |
358 | 352 | ? (params.attachments as Array<{ |
|