



























@@ -21,7 +21,13 @@ import {
2121SESSIONS_LIST_TOOL_DISPLAY_SUMMARY,
2222} from "../tool-description-presets.js";
2323import type { AnyAgentTool } from "./common.js";
24-import { jsonResult, readStringArrayParam, readStringParam } from "./common.js";
24+import {
25+jsonResult,
26+readNonNegativeIntegerParam,
27+readPositiveIntegerParam,
28+readStringArrayParam,
29+readStringParam,
30+} from "./common.js";
2531import {
2632createAgentToAgentPolicy,
2733createSessionVisibilityRowChecker,
@@ -38,9 +44,9 @@ import {
38443945const SessionsListToolSchema = Type.Object({
4046kinds: Type.Optional(Type.Array(Type.String())),
41-limit: Type.Optional(Type.Number({ minimum: 1 })),
42-activeMinutes: Type.Optional(Type.Number({ minimum: 1 })),
43-messageLimit: Type.Optional(Type.Number({ minimum: 0 })),
47+limit: Type.Optional(Type.Integer({ minimum: 1 })),
48+activeMinutes: Type.Optional(Type.Integer({ minimum: 1 })),
49+messageLimit: Type.Optional(Type.Integer({ minimum: 0 })),
4450label: Type.Optional(Type.String({ minLength: 1 })),
4551agentId: Type.Optional(Type.String({ minLength: 1, maxLength: 64 })),
4652search: Type.Optional(Type.String({ minLength: 1 })),
@@ -97,18 +103,9 @@ export function createSessionsListTool(opts?: {
97103);
98104const allowedKinds = allowedKindsList.length ? new Set(allowedKindsList) : undefined;
99105100-const limit =
101-typeof params.limit === "number" && Number.isFinite(params.limit)
102- ? Math.max(1, Math.floor(params.limit))
103- : undefined;
104-const activeMinutes =
105-typeof params.activeMinutes === "number" && Number.isFinite(params.activeMinutes)
106- ? Math.max(1, Math.floor(params.activeMinutes))
107- : undefined;
108-const messageLimitRaw =
109-typeof params.messageLimit === "number" && Number.isFinite(params.messageLimit)
110- ? Math.max(0, Math.floor(params.messageLimit))
111- : 0;
106+const limit = readPositiveIntegerParam(params, "limit");
107+const activeMinutes = readPositiveIntegerParam(params, "activeMinutes");
108+const messageLimitRaw = readNonNegativeIntegerParam(params, "messageLimit") ?? 0;
112109const messageLimit = Math.min(messageLimitRaw, 20);
113110const label = readStringParam(params, "label");
114111const agentId = readStringParam(params, "agentId");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。