From a3772d2fd70bf643901ede9ce2e380f4812c84a1 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 2 Jan 2026 22:48:39 +0100 Subject: [PATCH] test(agent): update tests for steer()/followUp() API, update AGENTS.md --- .pi/settings.json | 3 +++ AGENTS.md | 5 +++-- packages/agent/test/agent.test.ts | 18 ++++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .pi/settings.json diff --git a/.pi/settings.json b/.pi/settings.json new file mode 100644 index 00000000..fb4d6c48 --- /dev/null +++ b/.pi/settings.json @@ -0,0 +1,3 @@ +{ + "customTools": ["packages/coding-agent/examples/custom-tools/todo/index.ts"] +} diff --git a/AGENTS.md b/AGENTS.md index 686a1a32..3196088f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -81,5 +81,6 @@ Use these sections under `## [Unreleased]`: The script handles: version bump, CHANGELOG finalization, commit, tag, publish, and adding new `[Unreleased]` sections. -### Tool Usage -**CTRICIAL**: NEVER use sed/cat to read a file or a range of a file. Always use the read tool (use offset + limit for ranged reads). \ No newline at end of file +### **CRITICAL** Tool Usage Rules **CRITICAL** +- NEVER use sed/cat to read a file or a range of a file. Always use the read tool (use offset + limit for ranged reads). +- You MUST read every file you modify in full before editing. \ No newline at end of file diff --git a/packages/agent/test/agent.test.ts b/packages/agent/test/agent.test.ts index 21012841..3332d16e 100644 --- a/packages/agent/test/agent.test.ts +++ b/packages/agent/test/agent.test.ts @@ -127,11 +127,21 @@ describe("Agent", () => { expect(agent.state.messages).toEqual([]); }); - it("should support message queueing", async () => { + it("should support steering message queue", async () => { const agent = new Agent(); - const message = { role: "user" as const, content: "Queued message", timestamp: Date.now() }; - agent.queueMessage(message); + const message = { role: "user" as const, content: "Steering message", timestamp: Date.now() }; + agent.steer(message); + + // The message is queued but not yet in state.messages + expect(agent.state.messages).not.toContainEqual(message); + }); + + it("should support follow-up message queue", async () => { + const agent = new Agent(); + + const message = { role: "user" as const, content: "Follow-up message", timestamp: Date.now() }; + agent.followUp(message); // The message is queued but not yet in state.messages expect(agent.state.messages).not.toContainEqual(message); @@ -176,7 +186,7 @@ describe("Agent", () => { // Second prompt should reject await expect(agent.prompt("Second message")).rejects.toThrow( - "Agent is already processing a prompt. Use queueMessage() or wait for completion.", + "Agent is already processing a prompt. Use steer() or followUp() to queue messages, or wait for completion.", ); // Cleanup - abort to stop the stream