@@ -11,7 +11,12 @@ import type { DeliveryContext } from "../../utils/delivery-context.shared.js";
|
11 | 11 | import { resolveSessionAgentId } from "../agent-scope.js"; |
12 | 12 | import { optionalStringEnum, stringEnum } from "../schema/typebox.js"; |
13 | 13 | import { CRON_TOOL_DISPLAY_SUMMARY } from "../tool-description-presets.js"; |
14 | | -import { type AnyAgentTool, jsonResult, readStringParam } from "./common.js"; |
| 14 | +import { |
| 15 | +type AnyAgentTool, |
| 16 | +jsonResult, |
| 17 | +readNonNegativeIntegerParam, |
| 18 | +readStringParam, |
| 19 | +} from "./common.js"; |
15 | 20 | import { callGatewayTool, readGatewayCallOptions, type GatewayCallOptions } from "./gateway.js"; |
16 | 21 | import { resolveInternalSessionKey, resolveMainSessionAlias } from "./sessions-helpers.js"; |
17 | 22 | |
@@ -301,7 +306,7 @@ export const CronToolSchema = Type.Object(
|
301 | 306 | mode: optionalStringEnum(CRON_WAKE_MODES), |
302 | 307 | runMode: optionalStringEnum(CRON_RUN_MODES), |
303 | 308 | contextMessages: Type.Optional( |
304 | | -Type.Number({ minimum: 0, maximum: REMINDER_CONTEXT_MESSAGES_MAX }), |
| 309 | +Type.Integer({ minimum: 0, maximum: REMINDER_CONTEXT_MESSAGES_MAX }), |
305 | 310 | ), |
306 | 311 | agentId: Type.Optional(Type.String({ description: "List filter: agent id" })), |
307 | 312 | }, |
@@ -723,10 +728,7 @@ Use jobId canonical; id accepted compat. contextMessages (0-10) adds previous me
|
723 | 728 | } |
724 | 729 | } |
725 | 730 | |
726 | | -const contextMessages = |
727 | | -typeof params.contextMessages === "number" && Number.isFinite(params.contextMessages) |
728 | | - ? params.contextMessages |
729 | | - : 0; |
| 731 | +const contextMessages = readNonNegativeIntegerParam(params, "contextMessages") ?? 0; |
730 | 732 | if ( |
731 | 733 | job && |
732 | 734 | typeof job === "object" && |
|