chore: log elevated and reasoning toggles

This commit is contained in:
Peter Steinberger
2026-01-12 18:37:44 +00:00
parent 1baf9f6a83
commit ffbcd83d1e
3 changed files with 150 additions and 0 deletions

View File

@@ -1913,6 +1913,67 @@ describe("directive behavior", () => {
});
});
it("queues a system event when toggling elevated", async () => {
await withTempHome(async (home) => {
drainSystemEvents(MAIN_SESSION_KEY);
const storePath = path.join(home, "sessions.json");
await getReplyFromConfig(
{
Body: "/elevated on",
From: "+1222",
To: "+1222",
Provider: "whatsapp",
},
{},
{
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
},
},
tools: { elevated: { allowFrom: { whatsapp: ["*"] } } },
whatsapp: { allowFrom: ["*"] },
session: { store: storePath },
},
);
const events = drainSystemEvents(MAIN_SESSION_KEY);
expect(events.some((e) => e.includes("Elevated ON"))).toBe(true);
});
});
it("queues a system event when toggling reasoning", async () => {
await withTempHome(async (home) => {
drainSystemEvents(MAIN_SESSION_KEY);
const storePath = path.join(home, "sessions.json");
await getReplyFromConfig(
{
Body: "/reasoning stream",
From: "+1222",
To: "+1222",
Provider: "whatsapp",
},
{},
{
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
},
},
whatsapp: { allowFrom: ["*"] },
session: { store: storePath },
},
);
const events = drainSystemEvents(MAIN_SESSION_KEY);
expect(events.some((e) => e.includes("Reasoning STREAM"))).toBe(true);
});
});
it("ignores inline /model and uses the default model", async () => {
await withTempHome(async (home) => {
const storePath = path.join(home, "sessions.json");