/** * Whole-graph checks for `helix.device/1` behavior graphs. * * Two independent rules live here because both need the whole `graph.triggers` * list rather than one step list at a time: * * 1. The runtime step budget. The portable engine adapter * (`PortableDeviceSupport.ts` `unsupportedStep`) charges ONE shared counter * for every step of every trigger, nested steps included, and refuses the * Device past `DEVICE_BUDGETS.maxActionAstNodes` (512) or a nesting depth * past `maxActionAstDepth` (32). The CLI used to check only the per-action * AST, so a graph that was CLI-green was refused when mounted. This is a * deliberate copy of that algorithm (the CLI cannot import the engine); * keep the two in step. * * 2. Room authority (`helix device validate --room`). The room (server) only * evaluates a closed subset of an `interact` trigger: top-level * `toggleState` of a boolean. A state write reached through `emitSignal` * handlers (transitively), `delay`, `repeat`, `sequence` or `branch` runs * on the client only, so every other viewer never sees it. The backend seal * compiler applies the same rule to new publishes * (`strictAuthority`); this lets a creator find out offline. */ type JsonObject = Record; /** Mirrors `DEVICE_BUDGETS.maxActionAstNodes` in the engine's `DeviceTypes.ts`. */ export declare const DEVICE_GRAPH_MAX_NODES = 512; /** Mirrors `DEVICE_BUDGETS.maxActionAstDepth` in the engine's `DeviceTypes.ts`. */ export declare const DEVICE_GRAPH_MAX_DEPTH = 32; export interface DeviceGraphBudgetReport { /** Steps charged across every trigger, nested steps included. */ nodes: number; /** The deepest nesting seen (a top-level step is depth 1). */ depth: number; /** Per-trigger step counts, for the error message. */ perTrigger: Array<{ index: number; nodes: number; }>; } export declare function measureDeviceGraphBudget(triggers: unknown): DeviceGraphBudgetReport; /** The runtime whole-graph budget as validation errors (empty when within). */ export declare function deviceGraphBudgetErrors(triggers: unknown): string[]; /** * Room authority: refuse a state write the room cannot run for an `interact` * trigger. Only a top-level `toggleState` of a declared boolean is evaluated by * the room; everything else that writes state is client-only and desyncs the * viewers. Presentation steps (audio, motion, vfx, character) are fine. */ export declare function deviceRoomAuthorityErrors(definition: JsonObject): string[]; /** * Shape of a `{ on: 'deadline', key, graceSeconds?, do }` trigger. * * `key` holds an epoch-millisecond instant; the trigger fires once when the * clock passes it (within `graceSeconds`, default 120) and consumes the key * first. The room runs it as a ~1 Hz tick rule, so `do` is held to what the * room can evaluate: `setState`/`toggleState` (top level or inside `sequence`) * with lit/state/add/sub/mul expressions, plus presentation steps (which the * room drops). No `emitSignal`, `delay`, `repeat` or `branch`. This mirrors the * engine's deadline validator (T2 SNAPSHOT-API.md), so the CLI never passes a * Device the engine refuses. */ export declare function deviceDeadlineTriggerErrors(trigger: JsonObject, path: string, state: JsonObject): string[]; export {};