@directive-run/core 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -680,8 +680,10 @@ interface CreateSystemOptionsNamed<Modules extends ModulesMap> {
680
680
  modules: Modules;
681
681
  /** Plugins to register */
682
682
  plugins?: Array<Plugin<ModuleSchema>>;
683
- /** Debug configuration */
684
- debug?: DebugConfig;
683
+ /** History configuration for snapshot-based state history */
684
+ history?: HistoryOption;
685
+ /** Trace: per-run reconciliation changelog */
686
+ trace?: TraceOption;
685
687
  /** Error boundary configuration */
686
688
  errorBoundary?: ErrorBoundaryConfig;
687
689
  /**
@@ -727,8 +729,8 @@ interface NamespacedSystem<Modules extends ModulesMap> {
727
729
  readonly _mode: "namespaced";
728
730
  /** Namespaced facts accessor: system.facts.auth.token */
729
731
  readonly facts: MutableNamespacedFacts<Modules>;
730
- /** Time-travel debugging API (if enabled) */
731
- readonly debug: TimeTravelAPI | null;
732
+ /** History API for undo/redo, rollback, audit trails (if enabled) */
733
+ readonly history: HistoryAPI | null;
732
734
  /** Namespaced derivations accessor: system.derive.auth.status */
733
735
  readonly derive: NamespacedDerivations<Modules> & DerivationsControl;
734
736
  /** Events accessor (union of all module events) */
@@ -739,8 +741,8 @@ interface NamespacedSystem<Modules extends ModulesMap> {
739
741
  readonly effects: EffectsControl;
740
742
  /** Runtime control for resolvers (dynamic CRUD) */
741
743
  readonly resolvers: ResolversControl;
742
- /** Per-run changelog entries (null if debug.runHistory is not enabled) */
743
- readonly runHistory: RunChangelogEntry[] | null;
744
+ /** Per-run trace entries (null if trace is not enabled) */
745
+ readonly trace: TraceEntry[] | null;
744
746
  /** Initialize facts and derivations without starting reconciliation. Safe for SSR. */
745
747
  initialize(): void;
746
748
  /** Start the system (initialize modules, begin reconciliation) */
@@ -788,8 +790,8 @@ interface NamespacedSystem<Modules extends ModulesMap> {
788
790
  * (resolver starts/completes, reconcile starts/ends).
789
791
  */
790
792
  onSettledChange(listener: () => void): () => void;
791
- /** Subscribe to time-travel state changes (snapshot taken, navigation). */
792
- onTimeTravelChange(listener: () => void): () => void;
793
+ /** Subscribe to history state changes (snapshot taken, navigation). */
794
+ onHistoryChange(listener: () => void): () => void;
793
795
  /**
794
796
  * Read a derivation value by namespaced key.
795
797
  * Accepts "namespace.key" format (e.g., "auth.status").
@@ -933,8 +935,10 @@ interface CreateSystemOptionsSingle<S extends ModuleSchema> {
933
935
  module: ModuleDef<S>;
934
936
  /** Plugins to register */
935
937
  plugins?: Array<Plugin<ModuleSchema>>;
936
- /** Debug configuration */
937
- debug?: DebugConfig;
938
+ /** History configuration for snapshot-based state history */
939
+ history?: HistoryOption;
940
+ /** Trace: per-run reconciliation changelog */
941
+ trace?: TraceOption;
938
942
  /** Error boundary configuration */
939
943
  errorBoundary?: ErrorBoundaryConfig;
940
944
  /** Tick interval for time-based systems (ms) */
@@ -956,20 +960,20 @@ interface SingleModuleSystem<S extends ModuleSchema> {
956
960
  readonly _mode: "single";
957
961
  /** Direct facts accessor: system.facts.count */
958
962
  readonly facts: Facts<S["facts"]>;
959
- /** Time-travel debugging API (if enabled) */
960
- readonly debug: TimeTravelAPI | null;
963
+ /** History API for undo/redo, rollback, audit trails (if enabled) */
964
+ readonly history: HistoryAPI | null;
961
965
  /** Direct derivations accessor: system.derive.doubled */
962
- readonly derive: InferDerivations<S> & DerivationsControl;
966
+ readonly derive: InferDerivations<S> & DerivationsControl<S>;
963
967
  /** Direct events accessor: system.events.increment() */
964
968
  readonly events: SingleModuleEvents<S>;
965
969
  /** Runtime control for constraints (disable/enable/isDisabled) */
966
- readonly constraints: ConstraintsControl;
970
+ readonly constraints: ConstraintsControl<S>;
967
971
  /** Runtime control for effects (disable/enable/isEnabled) */
968
- readonly effects: EffectsControl;
972
+ readonly effects: EffectsControl<S>;
969
973
  /** Runtime control for resolvers (register/assign/unregister/call) */
970
- readonly resolvers: ResolversControl;
971
- /** Per-run changelog entries (null if debug.runHistory is not enabled) */
972
- readonly runHistory: RunChangelogEntry[] | null;
974
+ readonly resolvers: ResolversControl<S>;
975
+ /** Per-run trace entries (null if trace is not enabled) */
976
+ readonly trace: TraceEntry[] | null;
973
977
  /** Initialize facts and derivations without starting reconciliation. Safe for SSR. */
974
978
  initialize(): void;
975
979
  /** Start the system (initialize modules, begin reconciliation) */
@@ -1002,8 +1006,8 @@ interface SingleModuleSystem<S extends ModuleSchema> {
1002
1006
  * (resolver starts/completes, reconcile starts/ends).
1003
1007
  */
1004
1008
  onSettledChange(listener: () => void): () => void;
1005
- /** Subscribe to time-travel state changes (snapshot taken, navigation). */
1006
- onTimeTravelChange(listener: () => void): () => void;
1009
+ /** Subscribe to history state changes (snapshot taken, navigation). */
1010
+ onHistoryChange(listener: () => void): () => void;
1007
1011
  /**
1008
1012
  * Read a derivation value by key.
1009
1013
  * @example system.read("doubled")
@@ -1360,11 +1364,17 @@ interface ModuleDef<M extends ModuleSchema = ModuleSchema> {
1360
1364
  resolvers?: TypedResolversDef<M>;
1361
1365
  hooks?: ModuleHooks<M>;
1362
1366
  /**
1363
- * Events that create time-travel snapshots.
1364
- * If omitted, ALL events create snapshots (default).
1365
- * If provided, only listed events create snapshots for undo/redo.
1367
+ * History configuration for this module.
1368
+ * Controls which events create snapshots for undo/redo.
1366
1369
  */
1367
- snapshotEvents?: Array<keyof GetEventsSchema<M> & string>;
1370
+ history?: {
1371
+ /**
1372
+ * Events that create history snapshots.
1373
+ * If omitted, ALL events create snapshots (default).
1374
+ * If provided, only listed events create snapshots for undo/redo.
1375
+ */
1376
+ snapshotEvents?: Array<keyof GetEventsSchema<M> & string>;
1377
+ };
1368
1378
  /**
1369
1379
  * Cross-module dependencies (runtime marker).
1370
1380
  * When present, constraints/effects receive `facts.self.*` + `facts.{dep}.*`.
@@ -1405,19 +1415,24 @@ type ObservableKeys<M extends ModuleSchema> = FactKeys<M> | DerivationKeys<M>;
1405
1415
  * Events accessor from module schema.
1406
1416
  */
1407
1417
  type EventsAccessor<M extends ModuleSchema> = EventsAccessorFromSchema<M>;
1408
- /** Debug configuration */
1409
- interface DebugConfig {
1410
- timeTravel?: boolean;
1418
+ /** History configuration for snapshot-based state history (undo/redo, rollback, audit trails) */
1419
+ interface HistoryConfig {
1420
+ /** Maximum number of snapshots in the ring buffer (default 100) */
1411
1421
  maxSnapshots?: number;
1412
1422
  /** Only snapshot events from these modules. Omit to snapshot all modules. Multi-module only. */
1413
1423
  snapshotModules?: string[];
1414
- /** Enable per-run changelog (default false) */
1415
- runHistory?: boolean;
1416
- /** Ring buffer cap for run history (default 100) */
1424
+ }
1425
+ /** History option: boolean shorthand or full config (presence implies enabled) */
1426
+ type HistoryOption = boolean | HistoryConfig;
1427
+ /** Trace configuration for per-run reconciliation changelogs */
1428
+ interface TraceConfig {
1429
+ /** Ring buffer cap for trace entries (default 100) */
1417
1430
  maxRuns?: number;
1418
1431
  }
1419
- /** Time-travel API */
1420
- interface TimeTravelAPI {
1432
+ /** Trace option: boolean shorthand or full config (presence implies enabled) */
1433
+ type TraceOption = boolean | TraceConfig;
1434
+ /** History API for snapshot navigation, changesets, and export/import */
1435
+ interface HistoryAPI {
1421
1436
  readonly snapshots: Snapshot[];
1422
1437
  readonly currentIndex: number;
1423
1438
  readonly isPaused: boolean;
@@ -1438,19 +1453,17 @@ interface SnapshotMeta {
1438
1453
  timestamp: number;
1439
1454
  trigger: string;
1440
1455
  }
1441
- /** Reactive time-travel state for framework hooks */
1442
- interface TimeTravelState {
1443
- canUndo: boolean;
1444
- canRedo: boolean;
1445
- undo: () => void;
1446
- redo: () => void;
1456
+ /** Reactive history state for framework hooks */
1457
+ interface HistoryState {
1458
+ canGoBack: boolean;
1459
+ canGoForward: boolean;
1447
1460
  currentIndex: number;
1448
1461
  totalSnapshots: number;
1449
1462
  snapshots: SnapshotMeta[];
1450
1463
  getSnapshotFacts: (id: number) => Record<string, unknown> | null;
1451
1464
  goTo: (snapshotId: number) => void;
1452
- goBack: (steps: number) => void;
1453
- goForward: (steps: number) => void;
1465
+ goBack: (steps?: number) => void;
1466
+ goForward: (steps?: number) => void;
1454
1467
  replay: () => void;
1455
1468
  exportSession: () => string;
1456
1469
  importSession: (json: string) => void;
@@ -1460,8 +1473,8 @@ interface TimeTravelState {
1460
1473
  pause: () => void;
1461
1474
  resume: () => void;
1462
1475
  }
1463
- /** A structured record of one reconciliation run — from facts through resolvers and effects. */
1464
- interface RunChangelogEntry {
1476
+ /** A structured record of one reconciliation run — fact changes, derivation recomputes, constraints hit, resolvers, effects. */
1477
+ interface TraceEntry {
1465
1478
  /** Monotonic run ID */
1466
1479
  id: number;
1467
1480
  /** When the reconcile started */
@@ -1555,10 +1568,10 @@ interface SystemInspection {
1555
1568
  id: string;
1556
1569
  requirement: string;
1557
1570
  }>;
1558
- /** Whether debug.runHistory is enabled on this system */
1559
- runHistoryEnabled: boolean;
1560
- /** Per-run changelog entries (only present if debug.runHistory is enabled) */
1561
- runHistory?: RunChangelogEntry[];
1571
+ /** Whether trace is enabled on this system */
1572
+ traceEnabled: boolean;
1573
+ /** Per-run trace entries (only present if trace is enabled) */
1574
+ trace?: TraceEntry[];
1562
1575
  }
1563
1576
  /** Explanation of why a requirement exists */
1564
1577
  interface RequirementExplanation {
@@ -1632,7 +1645,7 @@ interface DistributableSnapshot<T = Record<string, unknown>> {
1632
1645
  * Provides full type inference for facts, derivations, events, and dispatch.
1633
1646
  */
1634
1647
  /** Runtime control for constraints */
1635
- interface ConstraintsControl {
1648
+ interface ConstraintsControl<M extends ModuleSchema = ModuleSchema> {
1636
1649
  /** Disable a constraint by ID — it will be excluded from evaluation */
1637
1650
  disable(id: string): void;
1638
1651
  /** Enable a previously disabled constraint — it will be re-evaluated on the next cycle */
@@ -1644,14 +1657,14 @@ interface ConstraintsControl {
1644
1657
  * @throws If a constraint with this ID already exists (use `assign` to override)
1645
1658
  * @remarks During reconciliation, the registration is deferred and applied after the current cycle completes.
1646
1659
  */
1647
- register(id: string, def: Record<string, unknown>): void;
1660
+ register(id: string, def: DynamicConstraintDef<M>): void;
1648
1661
  /**
1649
1662
  * Override an existing constraint (static or dynamic).
1650
1663
  * Stores the original definition for potential inspection.
1651
1664
  * @throws If no constraint with this ID exists (use `register` to create)
1652
1665
  * @remarks During reconciliation, the assignment is deferred and applied after the current cycle completes.
1653
1666
  */
1654
- assign(id: string, def: Record<string, unknown>): void;
1667
+ assign(id: string, def: DynamicConstraintDef<M>): void;
1655
1668
  /**
1656
1669
  * Remove a dynamically registered constraint.
1657
1670
  * Static (module-defined) constraints cannot be unregistered — logs a dev warning and no-ops.
@@ -1671,7 +1684,7 @@ interface ConstraintsControl {
1671
1684
  listDynamic(): string[];
1672
1685
  }
1673
1686
  /** Runtime control for effects */
1674
- interface EffectsControl {
1687
+ interface EffectsControl<M extends ModuleSchema = ModuleSchema> {
1675
1688
  /** Disable an effect by ID — it will be skipped during reconciliation */
1676
1689
  disable(id: string): void;
1677
1690
  /** Enable a previously disabled effect */
@@ -1683,14 +1696,14 @@ interface EffectsControl {
1683
1696
  * @throws If an effect with this ID already exists (use `assign` to override)
1684
1697
  * @remarks During reconciliation, the registration is deferred and applied after the current cycle completes.
1685
1698
  */
1686
- register(id: string, def: Record<string, unknown>): void;
1699
+ register(id: string, def: DynamicEffectDef<M>): void;
1687
1700
  /**
1688
1701
  * Override an existing effect (static or dynamic).
1689
1702
  * Runs cleanup of the old effect before replacing.
1690
1703
  * @throws If no effect with this ID exists (use `register` to create)
1691
1704
  * @remarks During reconciliation, the assignment is deferred and applied after the current cycle completes.
1692
1705
  */
1693
- assign(id: string, def: Record<string, unknown>): void;
1706
+ assign(id: string, def: DynamicEffectDef<M>): void;
1694
1707
  /**
1695
1708
  * Remove a dynamically registered effect.
1696
1709
  * Static (module-defined) effects cannot be unregistered — logs a dev warning and no-ops.
@@ -1708,19 +1721,19 @@ interface EffectsControl {
1708
1721
  listDynamic(): string[];
1709
1722
  }
1710
1723
  /** Runtime control for derivations (dynamic registration + value access) */
1711
- interface DerivationsControl {
1724
+ interface DerivationsControl<M extends ModuleSchema = ModuleSchema> {
1712
1725
  /**
1713
1726
  * Register a new derivation at runtime.
1714
1727
  * @throws If a derivation with this ID already exists (use `assign` to override)
1715
1728
  * @remarks During reconciliation, the registration is deferred and applied after the current cycle completes.
1716
1729
  */
1717
- register(id: string, fn: (facts: Record<string, unknown>, derive: Record<string, unknown>) => unknown): void;
1730
+ register(id: string, fn: (facts: Readonly<InferSchema<M["facts"]>>, derived: Readonly<InferDerivations<M>>) => unknown): void;
1718
1731
  /**
1719
1732
  * Override an existing derivation (static or dynamic).
1720
1733
  * @throws If no derivation with this ID exists (use `register` to create)
1721
1734
  * @remarks During reconciliation, the assignment is deferred and applied after the current cycle completes.
1722
1735
  */
1723
- assign(id: string, fn: (facts: Record<string, unknown>, derive: Record<string, unknown>) => unknown): void;
1736
+ assign(id: string, fn: (facts: Readonly<InferSchema<M["facts"]>>, derived: Readonly<InferDerivations<M>>) => unknown): void;
1724
1737
  /**
1725
1738
  * Remove a dynamically registered derivation.
1726
1739
  * Static (module-defined) derivations cannot be unregistered — logs a dev warning and no-ops.
@@ -1729,29 +1742,30 @@ interface DerivationsControl {
1729
1742
  unregister(id: string): void;
1730
1743
  /**
1731
1744
  * Recompute and return a derivation's current value.
1745
+ * Use the type parameter to specify the return type: `call<number>("id")`.
1732
1746
  * @throws If no derivation with this ID exists
1733
1747
  */
1734
- call(id: string): unknown;
1748
+ call<T = unknown>(id: string): T;
1735
1749
  /** Check if a derivation was dynamically registered (not from a module definition) */
1736
1750
  isDynamic(id: string): boolean;
1737
1751
  /** List all dynamically registered derivation IDs */
1738
1752
  listDynamic(): string[];
1739
1753
  }
1740
1754
  /** Runtime control for resolvers */
1741
- interface ResolversControl {
1755
+ interface ResolversControl<M extends ModuleSchema = ModuleSchema> {
1742
1756
  /**
1743
1757
  * Register a new resolver at runtime.
1744
1758
  * @throws If a resolver with this ID already exists (use `assign` to override)
1745
1759
  * @remarks During reconciliation, the registration is deferred and applied after the current cycle completes.
1746
1760
  */
1747
- register(id: string, def: Record<string, unknown>): void;
1761
+ register(id: string, def: DynamicResolverDef<M>): void;
1748
1762
  /**
1749
1763
  * Override an existing resolver (static or dynamic).
1750
1764
  * Clears the resolver-by-type cache.
1751
1765
  * @throws If no resolver with this ID exists (use `register` to create)
1752
1766
  * @remarks During reconciliation, the assignment is deferred and applied after the current cycle completes.
1753
1767
  */
1754
- assign(id: string, def: Record<string, unknown>): void;
1768
+ assign(id: string, def: DynamicResolverDef<M>): void;
1755
1769
  /**
1756
1770
  * Remove a dynamically registered resolver.
1757
1771
  * Static (module-defined) resolvers cannot be unregistered — logs a dev warning and no-ops.
@@ -1771,16 +1785,70 @@ interface ResolversControl {
1771
1785
  /** List all dynamically registered resolver IDs */
1772
1786
  listDynamic(): string[];
1773
1787
  }
1788
+ /** Constraint definition for dynamic registration — typed facts, relaxed requirements */
1789
+ interface DynamicConstraintDef<M extends ModuleSchema = ModuleSchema> {
1790
+ priority?: number;
1791
+ async?: boolean;
1792
+ when: (facts: Readonly<InferSchema<M["facts"]>>) => boolean | Promise<boolean>;
1793
+ require: {
1794
+ type: string;
1795
+ [key: string]: unknown;
1796
+ } | {
1797
+ type: string;
1798
+ [key: string]: unknown;
1799
+ }[] | null | ((facts: Readonly<InferSchema<M["facts"]>>) => {
1800
+ type: string;
1801
+ [key: string]: unknown;
1802
+ } | {
1803
+ type: string;
1804
+ [key: string]: unknown;
1805
+ }[] | null);
1806
+ timeout?: number;
1807
+ after?: string[];
1808
+ deps?: string[];
1809
+ }
1810
+ /** Effect definition for dynamic registration — typed facts */
1811
+ interface DynamicEffectDef<M extends ModuleSchema = ModuleSchema> {
1812
+ run: (facts: Readonly<InferSchema<M["facts"]>>, prev: InferSchema<M["facts"]> | null) => void | (() => void) | Promise<void | (() => void)>;
1813
+ deps?: Array<string & keyof InferSchema<M["facts"]>>;
1814
+ }
1815
+ /** Resolver definition for dynamic registration — typed context.facts, relaxed requirement */
1816
+ interface DynamicResolverDef<M extends ModuleSchema = ModuleSchema> {
1817
+ requirement: string;
1818
+ key?: (req: {
1819
+ type: string;
1820
+ [key: string]: unknown;
1821
+ }) => string;
1822
+ retry?: RetryPolicy;
1823
+ timeout?: number;
1824
+ batch?: BatchConfig;
1825
+ resolve?: (req: {
1826
+ type: string;
1827
+ [key: string]: unknown;
1828
+ }, context: {
1829
+ facts: InferSchema<M["facts"]>;
1830
+ signal: AbortSignal;
1831
+ snapshot: () => InferSchema<M["facts"]>;
1832
+ }) => Promise<void>;
1833
+ resolveBatch?: (reqs: {
1834
+ type: string;
1835
+ [key: string]: unknown;
1836
+ }[], context: {
1837
+ facts: InferSchema<M["facts"]>;
1838
+ signal: AbortSignal;
1839
+ snapshot: () => InferSchema<M["facts"]>;
1840
+ }) => Promise<void>;
1841
+ }
1774
1842
  interface System<M extends ModuleSchema = ModuleSchema> {
1775
1843
  readonly facts: Facts<M["facts"]>;
1776
- readonly debug: TimeTravelAPI | null;
1777
- readonly derive: InferDerivations<M> & DerivationsControl;
1844
+ readonly history: HistoryAPI | null;
1845
+ readonly derive: InferDerivations<M> & DerivationsControl<M>;
1778
1846
  readonly events: EventsAccessorFromSchema<M>;
1779
- readonly constraints: ConstraintsControl;
1780
- readonly effects: EffectsControl;
1781
- readonly resolvers: ResolversControl;
1782
- /** Per-run changelog entries (null if debug.runHistory is not enabled) */
1783
- readonly runHistory: RunChangelogEntry[] | null;
1847
+ readonly constraints: ConstraintsControl<M>;
1848
+ readonly effects: EffectsControl<M>;
1849
+ readonly resolvers: ResolversControl<M>;
1850
+ /** Per-run trace entries (null if trace is not enabled) */
1851
+ readonly trace: TraceEntry[] | null;
1784
1852
  /** Initialize facts and derivations without starting reconciliation. Safe for SSR. */
1785
1853
  initialize(): void;
1786
1854
  start(): void;
@@ -1804,11 +1872,11 @@ interface System<M extends ModuleSchema = ModuleSchema> {
1804
1872
  */
1805
1873
  onSettledChange(listener: () => void): () => void;
1806
1874
  /**
1807
- * Subscribe to time-travel state changes.
1808
- * Called whenever a snapshot is taken or time-travel navigation occurs.
1875
+ * Subscribe to history state changes.
1876
+ * Called whenever a snapshot is taken or history navigation occurs.
1809
1877
  * Returns an unsubscribe function.
1810
1878
  */
1811
- onTimeTravelChange(listener: () => void): () => void;
1879
+ onHistoryChange(listener: () => void): () => void;
1812
1880
  read<K extends DerivationKeys<M>>(id: K): DerivationReturnType<M, K>;
1813
1881
  read<K extends FactKeys<M>>(id: K): FactReturnType<M, K>;
1814
1882
  read<T = unknown>(id: string): T;
@@ -1903,7 +1971,8 @@ interface System<M extends ModuleSchema = ModuleSchema> {
1903
1971
  interface SystemConfig<M extends ModuleSchema = ModuleSchema> {
1904
1972
  modules: Array<ModuleDef<M>>;
1905
1973
  plugins?: Array<Plugin<any>>;
1906
- debug?: DebugConfig;
1974
+ history?: HistoryOption;
1975
+ trace?: TraceOption;
1907
1976
  errorBoundary?: ErrorBoundaryConfig;
1908
1977
  /**
1909
1978
  * Callback invoked after module inits but before first reconcile.
@@ -2092,16 +2161,16 @@ interface Plugin<M extends ModuleSchema = ModuleSchema> {
2092
2161
  */
2093
2162
  onEffectError?: (id: string, error: unknown) => void;
2094
2163
  /**
2095
- * Called when a time-travel snapshot is taken.
2164
+ * Called when a history snapshot is taken.
2096
2165
  * @param snapshot - The snapshot that was captured
2097
2166
  */
2098
2167
  onSnapshot?: (snapshot: Snapshot) => void;
2099
2168
  /**
2100
- * Called when time-travel navigation occurs.
2169
+ * Called when history navigation occurs (undo/redo/goTo).
2101
2170
  * @param from - The index we navigated from
2102
2171
  * @param to - The index we navigated to
2103
2172
  */
2104
- onTimeTravel?: (from: number, to: number) => void;
2173
+ onHistoryNavigate?: (from: number, to: number) => void;
2105
2174
  /**
2106
2175
  * Called when any error occurs in the system.
2107
2176
  * @param error - The DirectiveError with source and context
@@ -2142,11 +2211,11 @@ interface Plugin<M extends ModuleSchema = ModuleSchema> {
2142
2211
  */
2143
2212
  onDefinitionCall?: (type: string, id: string, props?: unknown) => void;
2144
2213
  /**
2145
- * Called when a run finalizes (all resolvers settled or no resolvers started).
2146
- * Only fires when debug.runHistory is enabled.
2147
- * @param run - The complete run changelog entry
2214
+ * Called when a trace entry finalizes (all resolvers settled or no resolvers started).
2215
+ * Only fires when trace is enabled.
2216
+ * @param entry - The complete trace entry
2148
2217
  */
2149
- onRunComplete?: (run: RunChangelogEntry) => void;
2218
+ onTraceComplete?: (entry: TraceEntry) => void;
2150
2219
  }
2151
2220
 
2152
- export { type AnySystem as $, type ConstraintState as A, type BatchConfig as B, type CrossModuleDeps as C, type DerivationsSchema as D, type EffectsDef as E, type Facts as F, type ResolversDef as G, type ResolverStatus as H, type InferRequirements as I, type System as J, type FactChange as K, type FactsSnapshot as L, type ModuleSchema as M, type NamespacedSystem as N, type ReconcileResult as O, type Plugin as P, type Snapshot as Q, type Requirement as R, type Schema as S, type TypedDerivationsDef as T, DirectiveError as U, type RecoveryStrategy as V, type RunChangelogEntry as W, type ErrorSource as X, type RetryLaterConfig as Y, type TimeTravelAPI as Z, type SystemConfig as _, type RequirementOutput$1 as a, type BatchItemResult as a0, type BatchResolveResults as a1, type ConstraintsControl as a2, type CrossModuleConstraintDef as a3, type CrossModuleDerivationFn as a4, type CrossModuleEffectDef as a5, type CrossModuleFactsWithSelf as a6, type DerivationKeys as a7, type DerivationReturnType as a8, type DerivationsControl as a9, type ObservableKeys as aA, type RequirementExplanation as aB, type RequirementPayloadSchema$1 as aC, type RequirementsSchema as aD, type ResolversControl as aE, type SnapshotMeta as aF, type SystemEvent as aG, type SystemInspection as aH, type SystemMode as aI, type SystemSnapshot as aJ, type TimeTravelState as aK, type TypedResolverContext as aL, type TypedResolverDef as aM, type UnionEvents as aN, isNamespacedSystem as aO, isSingleModuleSystem as aP, type DeriveAccessor as aa, type DispatchEventsFromSchema as ab, type DistributableSnapshot as ac, type DistributableSnapshotOptions as ad, type EffectCleanup as ae, type EffectsControl as af, type EventPayloadSchema as ag, type EventsAccessor as ah, type EventsAccessorFromSchema as ai, type EventsDef as aj, type EventsSchema as ak, type FactKeys as al, type FactReturnType as am, type FlexibleEventHandler as an, type InferDerivations as ao, type InferEventPayloadFromSchema as ap, type InferEvents as aq, type InferRequirementPayloadFromSchema as ar, type InferRequirementTypes as as, type InferSchema as at, type InferSchemaType as au, type InferSelectorState as av, type MutableNamespacedFacts as aw, type NamespacedDerivations as ax, type NamespacedEventsAccessor as ay, type NamespacedFacts as az, type RetryPolicy as b, type ResolverContext as c, type SchemaType as d, type TypedEventsDef as e, type TypedConstraintsDef as f, type TypedResolversDef as g, type ModuleHooks as h, type CrossModuleDerivationsDef as i, type CrossModuleEffectsDef as j, type CrossModuleConstraintsDef as k, type ModuleDef as l, type CreateSystemOptionsSingle as m, type SingleModuleSystem as n, type ModulesMap as o, type CreateSystemOptionsNamed as p, type TypedConstraintDef as q, type RequirementOutput as r, type DebugConfig as s, type ErrorBoundaryConfig as t, type InferFacts as u, type ExtractSchema as v, type RequirementWithId as w, type RequirementKeyFn as x, type FactsStore as y, type ConstraintsDef as z };
2221
+ export { type CrossModuleDerivationFn as $, type FactChange as A, type BatchConfig as B, type CrossModuleDeps as C, type FactsSnapshot as D, type EffectsDef as E, type Facts as F, type ReconcileResult as G, type Snapshot as H, DirectiveError as I, type RecoveryStrategy as J, type TraceEntry as K, type ErrorSource as L, type ModuleSchema as M, type NamespacedSystem as N, type RetryLaterConfig as O, type Plugin as P, type HistoryAPI as Q, type Requirement as R, type Schema as S, type TypedDerivationsDef as T, type HistoryOption as U, type SystemConfig as V, type AnySystem as W, type BatchItemResult as X, type BatchResolveResults as Y, type ConstraintsControl as Z, type CrossModuleConstraintDef as _, type RequirementOutput$1 as a, type CrossModuleEffectDef as a0, type CrossModuleFactsWithSelf as a1, type DerivationKeys as a2, type DerivationReturnType as a3, type DerivationsControl as a4, type DerivationsSchema as a5, type DeriveAccessor as a6, type DispatchEventsFromSchema as a7, type DistributableSnapshot as a8, type DistributableSnapshotOptions as a9, type NamespacedDerivations as aA, type NamespacedEventsAccessor as aB, type NamespacedFacts as aC, type ObservableKeys as aD, type RequirementExplanation as aE, type RequirementOutput as aF, type RequirementPayloadSchema$1 as aG, type RequirementsSchema as aH, type ResolversControl as aI, type SnapshotMeta as aJ, type SystemEvent as aK, type SystemInspection as aL, type SystemMode as aM, type SystemSnapshot as aN, type TraceConfig as aO, type TypedConstraintDef as aP, type TypedResolverContext as aQ, type TypedResolverDef as aR, type UnionEvents as aS, isNamespacedSystem as aT, isSingleModuleSystem as aU, type DynamicConstraintDef as aa, type DynamicEffectDef as ab, type DynamicResolverDef as ac, type EffectCleanup as ad, type EffectsControl as ae, type EventPayloadSchema as af, type EventsAccessor as ag, type EventsAccessorFromSchema as ah, type EventsDef as ai, type EventsSchema as aj, type FactKeys as ak, type FactReturnType as al, type FlexibleEventHandler as am, type HistoryConfig as an, type HistoryState as ao, type InferDerivations as ap, type InferEventPayloadFromSchema as aq, type InferEvents as ar, type InferFacts as as, type InferRequirementPayloadFromSchema as at, type InferRequirementTypes as au, type InferRequirements as av, type InferSchema as aw, type InferSchemaType as ax, type InferSelectorState as ay, type MutableNamespacedFacts as az, type RetryPolicy as b, type ResolverContext as c, type SchemaType as d, type TypedEventsDef as e, type TypedConstraintsDef as f, type TypedResolversDef as g, type ModuleHooks as h, type CrossModuleDerivationsDef as i, type CrossModuleEffectsDef as j, type CrossModuleConstraintsDef as k, type ModuleDef as l, type CreateSystemOptionsSingle as m, type SingleModuleSystem as n, type ModulesMap as o, type CreateSystemOptionsNamed as p, type TraceOption as q, type ErrorBoundaryConfig as r, type RequirementWithId as s, type RequirementKeyFn as t, type FactsStore as u, type ConstraintsDef as v, type ConstraintState as w, type ResolversDef as x, type ResolverStatus as y, type System as z };