fix(cron): use jobId parameter instead of id for AI tool schema

Fixes parameter mismatch between AI tool schema and internal validation.
The TypeBox schema now uses `jobId` for update/remove/run/runs actions,
matching what users expect based on the returned job objects.

Changes:
- Changed parameter from `id` to `jobId` in TypeBox schema for update/remove/run/runs
- Updated execute function to read `jobId` parameter
- Updated tests to use `jobId` in input parameters

The gateway protocol still uses `id` internally - the tool now maps
`jobId` from the AI to `id` for the gateway call.

Fixes #185

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yurii Chukhlib
2026-01-08 20:28:03 +01:00
committed by Peter Steinberger
parent 28a0864de8
commit 4dac298ae2
2 changed files with 12 additions and 12 deletions

View File

@@ -16,12 +16,12 @@ describe("cron tool", () => {
it.each([
[
"update",
{ action: "update", id: "job-1", patch: { foo: "bar" } },
{ action: "update", jobId: "job-1", patch: { foo: "bar" } },
{ id: "job-1", patch: { foo: "bar" } },
],
["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" }],
["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" }],
])("%s sends id to gateway", async (action, args, expectedParams) => {
const tool = createCronTool();
await tool.execute("call1", args);