Cotal TypeScript packages
    Preparing search index...

    Interface RunOptions

    interface RunOptions {
        cancellation?: RootCancellationSource;
        ceilings?: Readonly<
            Partial<
                Record<
                    | "conclave"
                    | "waitUntil"
                    | "spawn"
                    | "participant"
                    | "turn"
                    | "ask"
                    | "checkpoint"
                    | "sleep"
                    | "wait"
                    | "notify"
                    | "monitor",
                    number,
                >,
            >,
        >;
        effectCeiling?: number;
        file?: string;
        handler: EffectHandler;
        journal?: Journal;
        migration?: boolean;
        onLog?: (line: { scope: string; values: readonly unknown[] }) => void;
        pins?: RunPins;
        runId: string;
        seed?: string;
        shouldStop?: () => string | undefined;
        startedAt?: number;
        stepBudget?: number;
        yieldEvery?: number;
    }
    Index
    cancellation?: RootCancellationSource

    Cooperative root cancellation, distinct from a next-boundary host release.

    ceilings?: Readonly<
        Partial<
            Record<
                | "conclave"
                | "waitUntil"
                | "spawn"
                | "participant"
                | "turn"
                | "ask"
                | "checkpoint"
                | "sleep"
                | "wait"
                | "notify"
                | "monitor",
                number,
            >,
        >,
    >
    effectCeiling?: number

    Fail loud rather than spinning forever when a loop does not terminate.

    file?: string
    handler: EffectHandler
    journal?: Journal

    An existing journal resumes the run; omit it to start fresh.

    migration?: boolean

    This walk is a MIGRATION's dry replay, not a resume.

    The two differ in exactly one place and it is a concurrency scope. A resume delivers a settled scope from its own entry and accounts for the whole subtree without entering a branch, which is correct: the program hash is unchanged, so nothing beneath it can have been removed and the branches were decided rather than deleted. A migration runs EDITED source against that journal, so the same short-circuit would account for entries the new source no longer reaches — and an orphan that is never reported is an effect nobody is told about, which for a resolved human checkpoint means a decision silently discarded with L5004 never firing.

    Set here rather than inferred, because "the source changed" is not something the interpreter can see: it is handed a program and a journal and both are what the caller says they are.

    onLog?: (line: { scope: string; values: readonly unknown[] }) => void

    Where log(...) goes. Not journalled, and it must never influence control flow: it exists so a human reading a trace can follow what the author meant. Each line carries the scope it was written from, which is what makes a log from inside a concurrent branch readable.

    pins?: RunPins

    The pins recorded when this run STARTED, read back from the run record.

    Present on a resume, absent on a fresh run. When present they are authoritative: every loose option below must either agree with them or be absent, and a caller value that differs is refused (L5009) rather than honoured, because a pin selects which effects run and honouring the override would make this a different run against a journal that was not written for it.

    runId: string
    seed?: string
    shouldStop?: () => string | undefined

    The HOST's stop, asked before every effect that has not already been recorded.

    Return a reason to stop the run where it stands; return undefined to carry on. The interpreter raises RunReleased itself rather than accepting an error from the caller — a driver that could throw the class could also throw something a workflow's try would swallow, and then the guarantee would be the caller's to keep.

    This exists because a driver's reasons to stop are not the program's business and must not be recorded as its outcome: an absolute work horizon reached, a pause requested by an operator. Asked here, nothing is half-done — no entry begun, no handler dispatched — so the run is exactly where its journal says it is and the next driver resumes from there.

    startedAt?: number

    The run's logical epoch. Resolved from the host clock on a fresh run and read from the pins on a resume; now() derives from it, so the resuming host's clock never moves a replayed program.

    stepBudget?: number

    Fail loud on a loop the effect ceiling cannot see, counted in walker dispatches (L4013).

    while (true) { n = n + 1 } performs no effect, so nothing increments the effect count. This one counts the work itself.

    yieldEvery?: number

    How many dispatches the walker runs before handing the macrotask queue back to the host.

    This is the load-bearing half of the ceiling, not the budget. The walker is async all the way down, so a pure loop floods the MICROTASK queue and starves the macrotask queue completely: a host watchdog's setTimeout never fires, and the runaway takes the timer plane, the run lease, and every other run on that host down with it. Yielding turns an outage back into an incident.