feat: add cron agent binding

This commit is contained in:
Peter Steinberger
2026-01-12 10:23:45 +00:00
parent a3938d62f6
commit 115591c5b6
14 changed files with 383 additions and 83 deletions

View File

@@ -24,6 +24,38 @@ describe("normalizeCronJobCreate", () => {
expect("channel" in payload).toBe(false);
});
it("normalizes agentId and drops null", () => {
const normalized = normalizeCronJobCreate({
name: "agent-set",
enabled: true,
schedule: { kind: "cron", expr: "* * * * *" },
sessionTarget: "isolated",
wakeMode: "now",
agentId: " Ops ",
payload: {
kind: "agentTurn",
message: "hi",
},
}) as unknown as Record<string, unknown>;
expect(normalized.agentId).toBe("Ops");
const cleared = normalizeCronJobCreate({
name: "agent-clear",
enabled: true,
schedule: { kind: "cron", expr: "* * * * *" },
sessionTarget: "isolated",
wakeMode: "now",
agentId: null,
payload: {
kind: "agentTurn",
message: "hi",
},
}) as unknown as Record<string, unknown>;
expect(cleared.agentId).toBeNull();
});
it("canonicalizes payload.provider casing", () => {
const normalized = normalizeCronJobCreate({
name: "legacy provider",