mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-22 02:15:26 -06:00
b5137604ef
* 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
34 lines
1.2 KiB
TypeScript
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" },
|
|
});
|
|
});
|
|
});
|