(condition: () => boolean, timeoutMs = 500)
| 45 | } |
| 46 | |
| 47 | async function waitForCondition(condition: () => boolean, timeoutMs = 500): Promise<boolean> { |
| 48 | const deadline = Date.now() + timeoutMs; |
| 49 | while (Date.now() < deadline) { |
| 50 | if (condition()) { |
| 51 | return true; |
| 52 | } |
| 53 | await new Promise((resolve) => setTimeout(resolve, 10)); |
| 54 | } |
| 55 | return condition(); |
| 56 | } |
| 57 | |
| 58 | describe("AgentSession queued message tool-call dispatch", () => { |
| 59 | test("soft-stops the current stream after a real tool call when a tool-end message is queued", async () => { |
no outgoing calls
no test coverage detected