import { DataStore } from '@voltro/runtime'; import { StartupContext } from '@voltro/runtime'; import { StartupFn } from '@voltro/runtime'; import { SyncLogger } from '@voltro/logger'; /** * How long a startup may run before the boot refuses it. * * ── Why there is a ceiling at all, and why it used to be 2 seconds ───────── * * The old value was 2000 ms and it was not a ceiling — it was a RACE the boot * always won. A startup slower than that was reported as fine and the boot * moved on, so a rejection arriving afterwards had nothing left to refuse. * * That race existed to protect one shape: a startup that never returns because * it holds a fiber until shutdown. Counted before changing it, that shape * appears in ZERO of the four startups this framework ships — `warm.startup.tsx` * (twice), `searchBackfill.startup.tsx` and the memory fixture's all return. * `warm` is the one to copy: it starts an interval, hands the teardown back * through `onShutdown`, and returns. * * So the race protected the shape we discourage and penalised the shape we * teach — and the penalised one includes `searchBackfill`, our own example, * which awaits a full-table query plus an index backfill and is the likeliest * thing in the box to exceed two seconds. Slow AND failing put a deployment back * in exactly the silent state this file was fixed for. * * 60 seconds because the number now has one job: turn "hangs forever" into * something diagnosable. It must never fire for honest work, and a boot that * refuses after a minute with a message naming the file beats one that waits * for a fiber that is never coming. */ export declare const DEFAULT_STARTUP_TIMEOUT_MS = 60000; export declare interface DiscoveredStartup { readonly file: string; readonly id: string; readonly fn: StartupFn; } export declare const loadStartupFiles: (files: ReadonlyArray, log: SyncLogger) => Promise>; /** Run every discovered startup. Returns a handle whose `shutdown()` * drains every registered teardown LIFO. */ export declare const runStartups: (startups: ReadonlyArray, store: DataStore, parentLog: SyncLogger, ceilingMs?: number) => Promise; export { StartupContext } export { StartupFn } export declare interface StartupHandle { readonly shutdown: () => Promise; } /** * The ceiling, from `VOLTRO_STARTUP_TIMEOUT_MS`. * * An app with a genuinely long backfill raises it; the env var is the whole * knob, and the refusal names it so nobody has to find this constant. Not an * `app.config.ts` field: this is an operational safety limit, not a design * choice about the app, and the parameter below is the seam if that changes. */ export declare const startupTimeoutMsFromEnv: (envValue: string | undefined) => number; export { } declare module '@voltro/protocol' { interface VoltroTableNames { 'tasks': true; 'task_sub_tasks': true; '_voltro_workflow_runs': true; '_voltro_workflow_run_steps': true; '_voltro_workflow_run_events': true; '_voltro_workflow_events': true; '_voltro_workflow_event_deliveries': true; '_voltro_approvals': true; '_voltro_connections': true; '_voltro_undo_log': true; } } declare module '@voltro/protocol' { interface VoltroTableNames { 'invoices': true; 'invoice_lines': true; } }