test(agent): update tests for steer()/followUp() API, update AGENTS.md

This commit is contained in:
Mario Zechner 2026-01-02 22:48:39 +01:00
parent 1625d127c7
commit a3772d2fd7
3 changed files with 20 additions and 6 deletions

3
.pi/settings.json Normal file
View file

@ -0,0 +1,3 @@
{
"customTools": ["packages/coding-agent/examples/custom-tools/todo/index.ts"]
}

View file

@ -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).
### **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.

View file

@ -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