(predicate, { timeoutMs = 1000, intervalMs = 10 } = {})
| 1019 | } |
| 1020 | |
| 1021 | async function waitForCondition(predicate, { timeoutMs = 1000, intervalMs = 10 } = {}) { |
| 1022 | const deadline = Date.now() + timeoutMs; |
| 1023 | while (Date.now() < deadline) { |
| 1024 | const value = predicate(); |
| 1025 | if (value) { |
| 1026 | return value; |
| 1027 | } |
| 1028 | await new Promise((resolve) => setTimeout(resolve, intervalMs)); |
| 1029 | } |
| 1030 | throw new Error('Timed out waiting for condition'); |
| 1031 | } |
| 1032 | |
| 1033 | async function fullyConfirmLatestAgentJob(runtime, externalScopeId: string) { |
| 1034 | const created = await runtime.services.bridgeCoordinator.handleInboundEvent({ |
no outgoing calls
no test coverage detected