hypnotranz 1a0419dc0c feat: initial Matrix SDK
Full SDK workspace: core, contracts, sdk, cli, browser-host, browser-kit,
federation, omega-core, oracle, self-healing, strategies, tools, emacs.
Clean extraction from the development monorepo.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 15:54:15 -06:00

21 lines
582 B
TypeScript

export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export async function eventually(assertFn: () => void, opts?: { timeoutMs?: number; intervalMs?: number }): Promise<void> {
const timeoutMs = opts?.timeoutMs ?? 500;
const intervalMs = opts?.intervalMs ?? 10;
const start = Date.now();
let lastErr: any = null;
while (Date.now() - start < timeoutMs) {
try {
assertFn();
return;
} catch (e: any) {
lastErr = e;
await sleep(intervalMs);
}
}
if (lastErr) throw lastErr;
}