Skip to content

Open-source, local-first AI agent for real work.

339 B
Raw Blame
export async function waitUntil(predicate: () => boolean): Promise<void> {
	for (let attempt = 0; attempt < 100; attempt += 1) {
		if (predicate()) return;
		await delay(1);
	}
	throw new Error("Condition was not reached");
}

export function delay(ms: number): Promise<void> {
	return new Promise((resolve) => setTimeout(resolve, ms));
}