@@ -38,7 +38,7 @@ import {
|
38 | 38 | SESSIONS_SEND_TOOL_DISPLAY_SUMMARY, |
39 | 39 | } from "../tool-description-presets.js"; |
40 | 40 | import type { AnyAgentTool } from "./common.js"; |
41 | | -import { jsonResult, readStringParam } from "./common.js"; |
| 41 | +import { jsonResult, readNonNegativeIntegerParam, readStringParam } from "./common.js"; |
42 | 42 | import { |
43 | 43 | createSessionVisibilityGuard, |
44 | 44 | createAgentToAgentPolicy, |
@@ -55,7 +55,7 @@ const SessionsSendToolSchema = Type.Object({
|
55 | 55 | label: Type.Optional(Type.String({ minLength: 1, maxLength: SESSION_LABEL_MAX_LENGTH })), |
56 | 56 | agentId: Type.Optional(Type.String({ minLength: 1, maxLength: 64 })), |
57 | 57 | message: Type.String(), |
58 | | -timeoutSeconds: Type.Optional(Type.Number({ minimum: 0 })), |
| 58 | +timeoutSeconds: Type.Optional(Type.Integer({ minimum: 0 })), |
59 | 59 | }); |
60 | 60 | |
61 | 61 | type GatewayCaller = typeof callGateway; |
@@ -283,6 +283,7 @@ export function createSessionsSendTool(opts?: {
|
283 | 283 | const params = args as Record<string, unknown>; |
284 | 284 | const gatewayCall = opts?.callGateway ?? callGateway; |
285 | 285 | const message = readStringParam(params, "message", { required: true }); |
| 286 | +const timeoutSeconds = readNonNegativeIntegerParam(params, "timeoutSeconds") ?? 30; |
286 | 287 | const { cfg, mainKey, alias, effectiveRequesterKey, restrictToSpawned } = |
287 | 288 | resolveSessionToolContext(opts); |
288 | 289 | |
@@ -435,10 +436,6 @@ export function createSessionsSendTool(opts?: {
|
435 | 436 | // Normalize sessionKey/sessionId input into a canonical session key. |
436 | 437 | const resolvedKey = visibleSession.key; |
437 | 438 | const displayKey = visibleSession.displayKey; |
438 | | -const timeoutSeconds = |
439 | | -typeof params.timeoutSeconds === "number" && Number.isFinite(params.timeoutSeconds) |
440 | | - ? Math.max(0, Math.floor(params.timeoutSeconds)) |
441 | | - : 30; |
442 | 439 | const timeoutMs = timeoutSeconds * 1000; |
443 | 440 | const announceTimeoutMs = timeoutSeconds === 0 ? 30_000 : timeoutMs; |
444 | 441 | const idempotencyKey = crypto.randomUUID(); |
|