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
@@ -88,13 +88,20 @@ async function testWorktreeAgent() {
// Step 6: Send a prompt to verify it's working in the worktree
console.log("Step 6: Sending test prompt to agent...");
const { didComplete } = await agentManager.sendPrompt(
await agentManager.sendPrompt(
agentId,
"Run pwd and git status to verify you're in a worktree. Reply with the output.",
{ maxWait: 30000 }
);
console.log(` Prompt completed: ${didComplete}`);
let status = agentManager.getAgentStatus(agentId);
let attempts = 0;
while (status === "processing" && attempts < 60) {
await new Promise((resolve) => setTimeout(resolve, 1000));
status = agentManager.getAgentStatus(agentId);
attempts++;
}
console.log(` Agent status after prompt: ${status}`);
// Get agent updates to see the response
const updates = agentManager.getAgentUpdates(agentId);