

























@@ -140,6 +140,22 @@ describe("createNodesTool screen_record duration guardrails", () => {
140140expect(schema.properties?.durationMs?.maximum).toBe(300_000);
141141});
142142143+it("bounds photos_latest limit schema to positive values capped at 20", () => {
144+const tool = createNodesTool();
145+const schema = tool.parameters as {
146+properties?: {
147+limit?: {
148+minimum?: number;
149+maximum?: number;
150+type?: string;
151+};
152+};
153+};
154+expect(schema.properties?.limit?.type).toBe("integer");
155+expect(schema.properties?.limit?.minimum).toBe(1);
156+expect(schema.properties?.limit?.maximum).toBe(20);
157+});
158+143159it("clamps screen_record durationMs argument to 300000 before gateway invoke", async () => {
144160gatewayMocks.callGatewayTool.mockResolvedValue({ payload: { ok: true } });
145161const tool = createNodesTool();
@@ -295,6 +311,36 @@ describe("createNodesTool screen_record duration guardrails", () => {
295311expect(JSON.stringify(result?.content ?? [])).not.toContain("MEDIA:");
296312});
297313314+it("rejects invalid photos_latest limit values before gateway invoke", async () => {
315+const tool = createNodesTool();
316+317+await expect(
318+tool.execute("call-photos-limit", {
319+action: "photos_latest",
320+node: "macbook",
321+limit: 1.5,
322+}),
323+).rejects.toThrow("limit must be a positive integer");
324+expect(gatewayMocks.callGatewayTool).not.toHaveBeenCalled();
325+});
326+327+it("caps photos_latest limit at 20 before gateway invoke", async () => {
328+gatewayMocks.callGatewayTool.mockResolvedValue({ payload: { photos: [] } });
329+const tool = createNodesTool();
330+331+await tool.execute("call-photos-limit", {
332+action: "photos_latest",
333+node: "macbook",
334+limit: 99,
335+});
336+337+const call = gatewayMocks.callGatewayTool.mock.calls[0] as
338+| [string, unknown, { params?: { limit?: unknown } }]
339+| undefined;
340+expect(call?.[0]).toBe("node.invoke");
341+expect(call?.[2].params?.limit).toBe(20);
342+});
343+298344it("uses operator.pairing plus operator.admin to approve exec-capable node pair requests", async () => {
299345mockNodePairApproveFlow({
300346requiredApproveScopes: ["operator.pairing", "operator.admin"],
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。