refactor(agent): add wait_for_agent tool and simplify prompt sending API

This commit is contained in:
Mohamed Boudra
2025-11-03 11:47:15 +01:00
parent 1d22fe46e7
commit a118fd3315
12 changed files with 592 additions and 146 deletions
+10 -3
View File
@@ -116,13 +116,20 @@ async function testWorktreeE2E() {
// Step 7: Test agent can run commands in worktree
console.log("Step 7: Testing agent execution in worktree...");
const { didComplete } = await agentManager.sendPrompt(
await agentManager.sendPrompt(
createdAgentId,
"Run 'pwd' and 'git branch --show-current'. Just show me the output.",
{ maxWait: 30000 }
);
console.log(` Prompt completed: ${didComplete}`);
let status = agentManager.getAgentStatus(createdAgentId);
let attempts = 0;
while (status === "processing" && attempts < 60) {
await new Promise((resolve) => setTimeout(resolve, 1000));
status = agentManager.getAgentStatus(createdAgentId);
attempts++;
}
console.log(` Agent status after prompt: ${status}`);
const updates = agentManager.getAgentUpdates(createdAgentId);
const messageChunks = updates