export declare const WORLD_SCENARIO_ENV = "TWIN_WORLD_SCENARIO_FILE"; /** The outcome of a vendor's judgement at one of its decision points, for the subject it is keyed to (absent: every * subject); a model vendor's turn is the point `turn`, keyed by `on`, the pack's scenario matchers. */ export type ScenarioDecisionInput = { vendor: string; point: string; subject?: string; on?: Record; outcome: unknown; once?: boolean; }; declare const FAULT_KINDS: { readonly request: readonly ["rejected", "failed", "lost", "slow", "drop", "generation"]; readonly 'over-time': readonly ["webhook-delay", "webhook-duplicate", "webhook-drop", "lag", "rate-limit"]; readonly network: readonly ["reset", "dns", "tls", "latency", "loss", "partition"]; readonly infrastructure: readonly ["oom", "disk-full", "crash", "restart"]; readonly time: readonly ["jump", "dst"]; }; type FaultLayer = keyof typeof FAULT_KINDS; /** The layers asked of the machine the app runs on, through its fault door (ADR 0036 §4): its network, its * infrastructure, and its clock as the app's processes see it (the World clock's own moves are the user's). */ export declare const MACHINE_LAYERS: ReadonlyArray; export type ScenarioFaultInput = { layer: FaultLayer; kind: string; /** the twin a vendor-layer fault lands in */ vendor?: string; /** a request fault's operation (the spec's operationId), or a model turn's `on`; neither: every request */ operation?: string; on?: Record; /** a point of the pack's own (`ctx.fault(point, subject)`: one item of a batch) */ point?: string; subject?: string; status?: number; message?: string; errorType?: string; metadata?: Record; partialText?: string; event?: string; retryAfterSeconds?: number; ms?: number; /** a delay or a lag: `90s`, `5m`, `12h`, `30d` */ by?: string; /** a rate limit: the vendor's bucket it switches on alone (else every one it declares), tightened to `limit` units a * `per` window where given */ bucket?: string; per?: string; limit?: number; /** a machine fault's part of the app, as the machine knows it; a reset's or a TLS failure's destination; a full disk's * volume */ target?: string; to?: string; volume?: string; between?: [string, string]; rate?: number; /** how many times it lands (default: every time, until `until`) */ times?: number; until?: string; }; /** A World fact changes at a World time: from its `at`, the fact `kind`/`key` is `value` (ADR 0036 §2-3). */ export type ScenarioFact = { kind: string; key: string; value: unknown; }; /** One placement in the record: its World time, its place in the record (what a twin's record of a consumption names), * and what was placed. */ export type PlacementEntry = { at: string; index: number; } & ({ decision: ScenarioDecisionInput; } | { fault: ScenarioFaultInput; } | { fact: ScenarioFact; }); /** The World's record of placements, as the twins read it (TWIN_WORLD_SCENARIO_FILE): the program that began it * (`name`), the instant it began (`start`, from which `world.at` reads a duration), the browsers' entropy (`random`) and * every placement in the order it was made (`timeline`). */ export type PlacementRecord = { name: string; start: string; random: string; timeline: PlacementEntry[]; }; export declare class PlacementError extends Error { } /** `90s`, `5m`, `12h`, `30d` in milliseconds. */ export declare function durationMs(by: string): number; /** A placement a program makes at the World's current time (`world.decide`, `world.fault`, `world.fact`; ADR 0036 §2), * read strictly in the shape the scenario in force holds it: every refusal names the vocabulary it expected. */ export declare function parsePlacement(kind: 'decision', raw: unknown): ScenarioDecisionInput; export declare function parsePlacement(kind: 'fault', raw: unknown): ScenarioFaultInput; export declare function parsePlacement(kind: 'fact', raw: unknown): ScenarioFact; /** A JSON file of the active World's own (its scenario, its facts; worldStateFile), read through the World's store at * each call as the clock is, and parsed again only when it changed; null where the World names none or the file is * absent. */ export declare function worldJsonFile(name: 'scenario' | 'facts'): T | null; /** The decisions and vendor faults placed on one vendor, in the order they were placed. */ export declare function placedOn(vendor: string): PlacementEntry[]; export type PlacedDecision = ScenarioDecisionInput & { index: number; at: string; }; export type PlacedFault = ScenarioFaultInput & { index: number; at: string; }; /** A World fact as it stands at `now`: the last change placed for it at or before then, else the World's own * (`world.json`'s `facts`, as the runtime hands them to its twins); undefined where the World holds none. */ export declare function factAt(kind: string, key: string, now?: string): unknown; /** The decisions placed for a vendor's point at or before the World's now, in the order they were placed. */ export declare function placedDecisions(vendor: string, point: string, now?: string): PlacedDecision[]; /** The vendor faults placed on a vendor at or before the World's now and not past their `until`, in the order they were * placed. */ export declare function placedFaults(vendor: string, layer: 'request' | 'over-time', now?: string): PlacedFault[]; export {};