Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.9 KB
Raw Blame
/** Startup budgets are independent of the 10s cache-read deadline. Loading the
 * worker module graph and the WASM binary must not look like a wedged database.
 */
export const COORDINATOR_CONNECT_TIMEOUT_MS = 60_000;
export const ENGINE_ASSET_LOAD_TIMEOUT_MS = 5 * 60_000;
export const ENGINE_DATABASE_OPEN_TIMEOUT_MS = 20_000;
/** Delays between attempts to take a busy database owner lock. The engine
 * never queues for it: a handoff between owners of one build frees it within
 * milliseconds, and after these ~10s the engine gives up without touching
 * storage, so pages use the network until they reload.
 */
export const OWNER_LOCK_RETRY_DELAYS_MS: readonly number[] = [
  25, 50, 100, 200, 400, 800, 1_600, 3_200, 3_200,
];
/** When another build has live tabs, a busy lock is almost certainly theirs.
 * The coordinator asks that build to hand the database over and asks again
 * this often until it answers or the engine's own lock wait ends; builds from
 * before handover never answer, so their holders cost that whole wait. */
export const TAKEOVER_REPLY_TIMEOUT_MS = 1_000;
/** Coordinator backstop for an engine that stops reporting while it waits. */
export const OWNER_LOCK_WAIT_TIMEOUT_MS =
  OWNER_LOCK_RETRY_DELAYS_MS.reduce((total, delay) => total + delay, 0) + 5_000;
/** Lets the coordinator's phase timeout/retry reach a page before its guard fires. */
export const STARTUP_RESPONSE_GRACE_MS = 5_000;
/** Safari can briefly reuse a failed SharedWorker startup after its creator
 * leaves during download. Let that entry retire before consuming another try. */
export const COORDINATOR_CONNECT_RETRY_DELAYS_MS: readonly number[] = [
  100, 200,
];
export const COORDINATOR_CONNECT_ATTEMPTS =
  COORDINATOR_CONNECT_RETRY_DELAYS_MS.length + 1;

/** Only the live coordinator can prove that every failed attempt stayed before
 * the open grant. A missing progress message is not proof of untouched storage.
 */
export class CacheBootstrapExhaustedError extends Error {}