import type { SystemDefinition } from "./defineSystem.js"; /** Default fixed-sim stage order — systems pick a stage; most need only this. */ export declare const DEFAULT_FIXED_STAGES: readonly ["input", "movement", "combat", "ai", "activities", "cleanup"]; /** * Default frame stage order. Gameplay stages mirror the fixed table so once-per-frame systems * (`type: "frame"`) can pick `combat`/`ai`/… without falling into the unknown-stage bucket; * presentation stages follow. */ export declare const DEFAULT_FRAME_STAGES: readonly ["input", "movement", "combat", "ai", "activities", "cleanup", "animation", "camera", "effects"]; /** @internal */ export type TimingChannel = "fixed" | "frame" | "interval" | "manual" | "event"; /** @internal */ export interface ScheduledSystem { readonly id: string; readonly channel: TimingChannel; readonly stage: string; readonly rate?: number; readonly every?: number; readonly after: readonly string[]; readonly before: readonly string[]; readonly dependsOn: readonly string[]; } /** @internal */ export interface StageBucket { readonly stage: string; /** System ids in deterministic order within this stage. */ readonly systems: readonly string[]; } /** @internal */ export interface FixedRateGroup { readonly rate: number; readonly stages: readonly StageBucket[]; /** Flat ordered ids for this rate (all stages). */ readonly order: readonly string[]; } /** * Deterministic compiled schedule: stage buckets, multi-subscribe channels, dependency validation. * Order never depends on import order — only stage tables + explicit before/after constraints. */ export interface CompiledSystemSchedule { readonly systemsById: ReadonlyMap; readonly scheduled: readonly ScheduledSystem[]; /** Fixed-sim groups keyed by rate (Hz); multiple systems may share a rate. */ readonly fixed: readonly FixedRateGroup[]; readonly frame: readonly StageBucket[]; readonly frameOrder: readonly string[]; /** Interval systems — each keeps its own period; multi-subscribe is per-system. */ readonly intervals: readonly ScheduledSystem[]; readonly manual: readonly string[]; readonly eventOnly: readonly string[]; /** All auto-ticking systems in a diagnostic flat order (fixed rates → frame → intervals). */ readonly tickOrder: readonly string[]; } /** @internal */ export interface CompileSystemScheduleOptions { fixedStages?: readonly string[]; frameStages?: readonly string[]; defaultFixedRate?: number; } /** * Topological sort with a stable tie-break on original declaration index, then id. * Edges: `after: "x"` means this runs after x (x → this); `before: "y"` means this → y. * @internal */ export declare function orderWithConstraints(ids: readonly string[], after: ReadonlyMap, before: ReadonlyMap, indexOf: ReadonlyMap): string[]; /** * Compile system definitions into a deterministic schedule. * Validates unique ids, `dependsOn`, and before/after cycles. * * @capability system-schedule compile fixed/frame/interval system ticks into deterministic ordered stages */ export declare function compileSystemSchedule(systems: readonly SystemDefinition[], options?: CompileSystemScheduleOptions): CompiledSystemSchedule;