fix(auto-reply): acknowledge reset triggers

This commit is contained in:
Peter Steinberger
2025-12-10 15:55:20 +00:00
parent 8f456ea73b
commit 51d77aea2e
5 changed files with 108 additions and 82 deletions

View File

@@ -1,3 +1,5 @@
import { join } from "node:path";
import { tmpdir } from "node:os";
import { afterEach, describe, expect, it, vi } from "vitest";
import * as tauRpc from "../process/tau-rpc.js";
@@ -75,6 +77,32 @@ describe("trigger handling", () => {
expect(commandSpy).not.toHaveBeenCalled();
});
it("acknowledges a bare /new without treating it as empty", async () => {
const commandSpy = vi.spyOn(commandReply, "runCommandReply");
const res = await getReplyFromConfig(
{
Body: "/new",
From: "+1003",
To: "+2000",
},
{},
{
inbound: {
reply: {
mode: "command",
command: ["echo", "{{Body}}"],
session: {
store: join(tmpdir(), `clawdis-session-test-${Date.now()}.json`),
},
},
},
},
);
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(text).toMatch(/fresh session/i);
expect(commandSpy).not.toHaveBeenCalled();
});
it("ignores think directives that only appear in the context wrapper", async () => {
const rpcMock = vi.spyOn(tauRpc, "runPiRpc").mockResolvedValue({
stdout: