Files
openclaw/src/cron/normalize.session-target-default.test.ts
T
Peter Steinberger b5137604ef feat(cron): default agent turns to the current conversation, add /loop, tighten cron tool surface (#114328)
* feat(cron): bind agent turns to current sessions

* feat(commands): add loop chat command

* test(cron): cover session defaults and loop commands

* docs(cron): document current defaults and loops

* fix(commands): scope /loop status and stop by conversation name tag

* fix(commands): widen /loop conversation tag to 48 bits

* fix(commands): include disabled jobs in /loop status and stop

* docs(cron): regenerate docs map

* test(cron): split session-target default tests to satisfy max-lines
2026-07-27 01:44:38 -04:00

34 lines
1.2 KiB
TypeScript

// Create-time sessionTarget defaulting: agentTurn binds to the creating conversation.
import { describe, expect, it } from "vitest";
import { normalizeCronJobCreate } from "./normalize.js";
describe("normalizeCronJobCreate sessionTarget defaults", () => {
it("defaults agentTurn jobs with session context to current announce jobs", () => {
const normalized = normalizeCronJobCreate(
{
name: "agent turn current default",
schedule: { kind: "every", everyMs: 60_000 },
payload: { kind: "agentTurn", message: "hello" },
},
{ sessionContext: { sessionKey: "agent:main:discord:channel:ops" } },
);
expect(normalized).toMatchObject({
sessionTarget: "current",
sessionKey: "agent:main:discord:channel:ops",
delivery: { mode: "announce" },
});
});
it("downgrades the agentTurn current default to isolated without session context", () => {
const normalized = normalizeCronJobCreate({
name: "agent turn isolated fallback",
schedule: { kind: "every", everyMs: 60_000 },
payload: { kind: "agentTurn", message: "hello" },
});
expect(normalized).toMatchObject({
sessionTarget: "isolated",
delivery: { mode: "announce" },
});
});
});