diff --git a/src/auto-reply/reply.directive.test.ts b/src/auto-reply/reply.directive.test.ts index 5f471f095..0a3eb9ee2 100644 --- a/src/auto-reply/reply.directive.test.ts +++ b/src/auto-reply/reply.directive.test.ts @@ -116,7 +116,11 @@ describe("directive parsing", () => { vi.mocked(runEmbeddedPiAgent).mockReset(); const res = await getReplyFromConfig( - { Body: "/queue collect debounce:bogus cap:zero drop:maybe", From: "+1222", To: "+1222" }, + { + Body: "/queue collect debounce:bogus cap:zero drop:maybe", + From: "+1222", + To: "+1222", + }, {}, { agent: { diff --git a/src/auto-reply/reply.queue.test.ts b/src/auto-reply/reply.queue.test.ts index 6aafdeb71..aa54ba0a9 100644 --- a/src/auto-reply/reply.queue.test.ts +++ b/src/auto-reply/reply.queue.test.ts @@ -42,9 +42,8 @@ async function withTempHome(fn: (home: string) => Promise): Promise { process.env.HOME = previousHome; try { await fs.rm(base, { recursive: true, force: true }); - } catch (err) { - const msg = err instanceof Error ? err.message : String(err); - if (!msg.includes("ENOTEMPTY")) throw err; + } catch { + // ignore cleanup failures in tests } } } @@ -105,9 +104,7 @@ describe("queue followups", () => { cfg, ); - const secondText = Array.isArray(second) - ? second[0]?.text - : second?.text; + const secondText = Array.isArray(second) ? second[0]?.text : second?.text; expect(secondText).toBe("main"); await vi.runAllTimersAsync(); diff --git a/src/auto-reply/reply.triggers.test.ts b/src/auto-reply/reply.triggers.test.ts index d60b308da..9a0395708 100644 --- a/src/auto-reply/reply.triggers.test.ts +++ b/src/auto-reply/reply.triggers.test.ts @@ -450,6 +450,8 @@ describe("trigger handling", () => { }); describe("group intro prompts", () => { + const groupParticipationNote = + "Be a good group participant: lurk and follow the conversation, but only chime in when you have something genuinely helpful or relevant to add. Don't feel obligated to respond to every message — quality over quantity. Even when lurking silently, you can use emoji reactions to acknowledge messages, show support, or react to humor — reactions are always appreciated and don't clutter the chat."; it("labels Discord groups using the surface metadata", async () => { await withTempHome(async (home) => { vi.mocked(runEmbeddedPiAgent).mockResolvedValue({ @@ -479,7 +481,7 @@ describe("group intro prompts", () => { vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] ?.extraSystemPrompt ?? ""; expect(extraSystemPrompt).toBe( - 'You are replying inside the Discord group "Release Squad". Group members: Alice, Bob. Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). Address the specific sender noted in the message context.', + `You are replying inside the Discord group "Release Squad". Group members: Alice, Bob. Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). ${groupParticipationNote} Address the specific sender noted in the message context.`, ); }); }); @@ -512,7 +514,7 @@ describe("group intro prompts", () => { vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] ?.extraSystemPrompt ?? ""; expect(extraSystemPrompt).toBe( - 'You are replying inside the WhatsApp group "Ops". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). Address the specific sender noted in the message context.', + `You are replying inside the WhatsApp group "Ops". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). ${groupParticipationNote} Address the specific sender noted in the message context.`, ); }); }); @@ -545,7 +547,7 @@ describe("group intro prompts", () => { vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] ?.extraSystemPrompt ?? ""; expect(extraSystemPrompt).toBe( - 'You are replying inside the Telegram group "Dev Chat". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). Address the specific sender noted in the message context.', + `You are replying inside the Telegram group "Dev Chat". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). ${groupParticipationNote} Address the specific sender noted in the message context.`, ); }); }); diff --git a/src/web/auto-reply.test.ts b/src/web/auto-reply.test.ts index 7731da36a..aa89c85b0 100644 --- a/src/web/auto-reply.test.ts +++ b/src/web/auto-reply.test.ts @@ -8,6 +8,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; vi.mock("../agents/pi-embedded.js", () => ({ abortEmbeddedPiRun: vi.fn().mockReturnValue(false), + isEmbeddedPiRunActive: vi.fn().mockReturnValue(false), + isEmbeddedPiRunStreaming: vi.fn().mockReturnValue(false), runEmbeddedPiAgent: vi.fn(), queueEmbeddedPiMessage: vi.fn().mockReturnValue(false), resolveEmbeddedSessionLane: (key: string) =>