diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d94f6a70..e04caa9dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ - Control UI: render Markdown in tool result cards. - Control UI: prevent overlapping action buttons in Discord guild rules on narrow layouts. - Android: tapping the foreground service notification brings the app to the front. (#179) — thanks @Syhids -- Cron tool passes `id` to the gateway for update/remove/run/runs (keeps `jobId` input). (#180) — thanks @adamgall +- Cron tool uses `id` for update/remove/run/runs (aligns with gateway params). (#180) — thanks @adamgall - Control UI: chat view uses page scroll with sticky header/sidebar and fixed composer (no inner scroll frame). - macOS: treat location permission as always-only to avoid iOS-only enums. (#165) — thanks @Nachx639 - macOS: make generated gateway protocol models `Sendable` for Swift 6 strict concurrency. (#195) — thanks @andranik-sahakyan diff --git a/src/agents/tools/cron-tool.test.ts b/src/agents/tools/cron-tool.test.ts index 6a31a3e44..3a8c92d4a 100644 --- a/src/agents/tools/cron-tool.test.ts +++ b/src/agents/tools/cron-tool.test.ts @@ -16,12 +16,12 @@ describe("cron tool", () => { it.each([ [ "update", - { action: "update", jobId: "job-1", patch: { foo: "bar" } }, + { action: "update", id: "job-1", patch: { foo: "bar" } }, { id: "job-1", patch: { foo: "bar" } }, ], - ["remove", { action: "remove", jobId: "job-1" }, { id: "job-1" }], - ["run", { action: "run", jobId: "job-1" }, { id: "job-1" }], - ["runs", { action: "runs", jobId: "job-1" }, { id: "job-1" }], + ["remove", { action: "remove", id: "job-1" }, { id: "job-1" }], + ["run", { action: "run", id: "job-1" }, { id: "job-1" }], + ["runs", { action: "runs", id: "job-1" }, { id: "job-1" }], ])("%s sends id to gateway", async (action, args, expectedParams) => { const tool = createCronTool(); await tool.execute("call1", args); @@ -34,4 +34,15 @@ describe("cron tool", () => { expect(call.method).toBe(`cron.${action}`); expect(call.params).toEqual(expectedParams); }); + + it("rejects jobId params", async () => { + const tool = createCronTool(); + await expect( + tool.execute("call2", { + action: "update", + jobId: "job-1", + patch: { foo: "bar" }, + }), + ).rejects.toThrow("id required"); + }); }); diff --git a/src/agents/tools/cron-tool.ts b/src/agents/tools/cron-tool.ts index f043de4cd..ccc0fa33f 100644 --- a/src/agents/tools/cron-tool.ts +++ b/src/agents/tools/cron-tool.ts @@ -29,7 +29,7 @@ const CronToolSchema = Type.Union([ gatewayUrl: Type.Optional(Type.String()), gatewayToken: Type.Optional(Type.String()), timeoutMs: Type.Optional(Type.Number()), - jobId: Type.String(), + id: Type.String(), patch: Type.Object({}, { additionalProperties: true }), }), Type.Object({ @@ -37,21 +37,21 @@ const CronToolSchema = Type.Union([ gatewayUrl: Type.Optional(Type.String()), gatewayToken: Type.Optional(Type.String()), timeoutMs: Type.Optional(Type.Number()), - jobId: Type.String(), + id: Type.String(), }), Type.Object({ action: Type.Literal("run"), gatewayUrl: Type.Optional(Type.String()), gatewayToken: Type.Optional(Type.String()), timeoutMs: Type.Optional(Type.Number()), - jobId: Type.String(), + id: Type.String(), }), Type.Object({ action: Type.Literal("runs"), gatewayUrl: Type.Optional(Type.String()), gatewayToken: Type.Optional(Type.String()), timeoutMs: Type.Optional(Type.Number()), - jobId: Type.String(), + id: Type.String(), }), Type.Object({ action: Type.Literal("wake"), @@ -102,7 +102,7 @@ export function createCronTool(): AnyAgentTool { ); } case "update": { - const id = readStringParam(params, "jobId", { required: true }); + const id = readStringParam(params, "id", { required: true }); if (!params.patch || typeof params.patch !== "object") { throw new Error("patch required"); } @@ -114,19 +114,19 @@ export function createCronTool(): AnyAgentTool { ); } case "remove": { - const id = readStringParam(params, "jobId", { required: true }); + const id = readStringParam(params, "id", { required: true }); return jsonResult( await callGatewayTool("cron.remove", gatewayOpts, { id }), ); } case "run": { - const id = readStringParam(params, "jobId", { required: true }); + const id = readStringParam(params, "id", { required: true }); return jsonResult( await callGatewayTool("cron.run", gatewayOpts, { id }), ); } case "runs": { - const id = readStringParam(params, "jobId", { required: true }); + const id = readStringParam(params, "id", { required: true }); return jsonResult( await callGatewayTool("cron.runs", gatewayOpts, { id }), );