mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 06:04:51 +00:00
test(agent): update tests for steer()/followUp() API, update AGENTS.md
This commit is contained in:
parent
1625d127c7
commit
a3772d2fd7
3 changed files with 20 additions and 6 deletions
3
.pi/settings.json
Normal file
3
.pi/settings.json
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"customTools": ["packages/coding-agent/examples/custom-tools/todo/index.ts"]
|
||||||
|
}
|
||||||
|
|
@ -81,5 +81,6 @@ Use these sections under `## [Unreleased]`:
|
||||||
|
|
||||||
The script handles: version bump, CHANGELOG finalization, commit, tag, publish, and adding new `[Unreleased]` sections.
|
The script handles: version bump, CHANGELOG finalization, commit, tag, publish, and adding new `[Unreleased]` sections.
|
||||||
|
|
||||||
### Tool Usage
|
### **CRITICAL** Tool Usage Rules **CRITICAL**
|
||||||
**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).
|
- 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.
|
||||||
|
|
@ -127,11 +127,21 @@ describe("Agent", () => {
|
||||||
expect(agent.state.messages).toEqual([]);
|
expect(agent.state.messages).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should support message queueing", async () => {
|
it("should support steering message queue", async () => {
|
||||||
const agent = new Agent();
|
const agent = new Agent();
|
||||||
|
|
||||||
const message = { role: "user" as const, content: "Queued message", timestamp: Date.now() };
|
const message = { role: "user" as const, content: "Steering message", timestamp: Date.now() };
|
||||||
agent.queueMessage(message);
|
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
|
// The message is queued but not yet in state.messages
|
||||||
expect(agent.state.messages).not.toContainEqual(message);
|
expect(agent.state.messages).not.toContainEqual(message);
|
||||||
|
|
@ -176,7 +186,7 @@ describe("Agent", () => {
|
||||||
|
|
||||||
// Second prompt should reject
|
// Second prompt should reject
|
||||||
await expect(agent.prompt("Second message")).rejects.toThrow(
|
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
|
// Cleanup - abort to stop the stream
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue