@pie-players/pie-assessment-toolkit 0.3.30 → 0.3.32

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.
Files changed (179) hide show
  1. package/README.md +289 -5
  2. package/dist/components/ItemToolBar.custom-element.js +165 -92
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +604 -107
  4. package/dist/components/SectionToolBar.custom-element.js +0 -36
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/policy/core/PolicySource.d.ts +64 -0
  9. package/dist/policy/core/PolicySource.d.ts.map +1 -0
  10. package/dist/policy/core/PolicySource.js +17 -0
  11. package/dist/policy/core/PolicySource.js.map +1 -0
  12. package/dist/policy/core/ToolPolicyEngine.d.ts +123 -0
  13. package/dist/policy/core/ToolPolicyEngine.d.ts.map +1 -0
  14. package/dist/policy/core/ToolPolicyEngine.js +217 -0
  15. package/dist/policy/core/ToolPolicyEngine.js.map +1 -0
  16. package/dist/policy/core/compose-decision.d.ts +37 -0
  17. package/dist/policy/core/compose-decision.d.ts.map +1 -0
  18. package/dist/policy/core/compose-decision.js +332 -0
  19. package/dist/policy/core/compose-decision.js.map +1 -0
  20. package/dist/policy/core/decision-types.d.ts +142 -0
  21. package/dist/policy/core/decision-types.d.ts.map +1 -0
  22. package/dist/policy/core/decision-types.js +13 -0
  23. package/dist/policy/core/decision-types.js.map +1 -0
  24. package/dist/policy/core/engine-context.d.ts +30 -0
  25. package/dist/policy/core/engine-context.d.ts.map +1 -0
  26. package/dist/policy/core/engine-context.js +28 -0
  27. package/dist/policy/core/engine-context.js.map +1 -0
  28. package/dist/policy/core/policy-source-tag.d.ts +32 -0
  29. package/dist/policy/core/policy-source-tag.d.ts.map +1 -0
  30. package/dist/policy/core/policy-source-tag.js +29 -0
  31. package/dist/policy/core/policy-source-tag.js.map +1 -0
  32. package/dist/policy/core/provenance.d.ts +163 -0
  33. package/dist/policy/core/provenance.d.ts.map +1 -0
  34. package/dist/policy/core/provenance.js +232 -0
  35. package/dist/policy/core/provenance.js.map +1 -0
  36. package/dist/policy/core/qti-inputs.d.ts +67 -0
  37. package/dist/policy/core/qti-inputs.d.ts.map +1 -0
  38. package/dist/policy/core/qti-inputs.js +139 -0
  39. package/dist/policy/core/qti-inputs.js.map +1 -0
  40. package/dist/policy/engine.d.ts +28 -0
  41. package/dist/policy/engine.d.ts.map +1 -0
  42. package/dist/policy/engine.js +24 -0
  43. package/dist/policy/engine.js.map +1 -0
  44. package/dist/policy/internal.d.ts +26 -0
  45. package/dist/policy/internal.d.ts.map +1 -0
  46. package/dist/policy/internal.js +26 -0
  47. package/dist/policy/internal.js.map +1 -0
  48. package/dist/policy/sources/QtiPolicySource.d.ts +146 -0
  49. package/dist/policy/sources/QtiPolicySource.d.ts.map +1 -0
  50. package/dist/policy/sources/QtiPolicySource.js +270 -0
  51. package/dist/policy/sources/QtiPolicySource.js.map +1 -0
  52. package/dist/runtime/SectionRuntimeEngine.d.ts +145 -0
  53. package/dist/runtime/SectionRuntimeEngine.d.ts.map +1 -1
  54. package/dist/runtime/SectionRuntimeEngine.js +164 -3
  55. package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
  56. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +144 -0
  57. package/dist/runtime/adapter/SectionEngineAdapter.d.ts.map +1 -0
  58. package/dist/runtime/adapter/SectionEngineAdapter.js +183 -0
  59. package/dist/runtime/adapter/SectionEngineAdapter.js.map +1 -0
  60. package/dist/runtime/adapter/coordinator-bridge.d.ts +93 -0
  61. package/dist/runtime/adapter/coordinator-bridge.d.ts.map +1 -0
  62. package/dist/runtime/adapter/coordinator-bridge.js +127 -0
  63. package/dist/runtime/adapter/coordinator-bridge.js.map +1 -0
  64. package/dist/runtime/adapter/dom-event-bridge.d.ts +63 -0
  65. package/dist/runtime/adapter/dom-event-bridge.d.ts.map +1 -0
  66. package/dist/runtime/adapter/dom-event-bridge.js +95 -0
  67. package/dist/runtime/adapter/dom-event-bridge.js.map +1 -0
  68. package/dist/runtime/adapter/framework-error-bridge.d.ts +37 -0
  69. package/dist/runtime/adapter/framework-error-bridge.d.ts.map +1 -0
  70. package/dist/runtime/adapter/framework-error-bridge.js +47 -0
  71. package/dist/runtime/adapter/framework-error-bridge.js.map +1 -0
  72. package/dist/runtime/adapter/instrumentation-bridge.d.ts +32 -0
  73. package/dist/runtime/adapter/instrumentation-bridge.d.ts.map +1 -0
  74. package/dist/runtime/adapter/instrumentation-bridge.js +39 -0
  75. package/dist/runtime/adapter/instrumentation-bridge.js.map +1 -0
  76. package/dist/runtime/adapter/subscriber-fanout.d.ts +35 -0
  77. package/dist/runtime/adapter/subscriber-fanout.d.ts.map +1 -0
  78. package/dist/runtime/adapter/subscriber-fanout.js +60 -0
  79. package/dist/runtime/adapter/subscriber-fanout.js.map +1 -0
  80. package/dist/runtime/core/SectionEngineCore.d.ts +52 -0
  81. package/dist/runtime/core/SectionEngineCore.d.ts.map +1 -0
  82. package/dist/runtime/core/SectionEngineCore.js +81 -0
  83. package/dist/runtime/core/SectionEngineCore.js.map +1 -0
  84. package/dist/runtime/core/cohort.d.ts +40 -0
  85. package/dist/runtime/core/cohort.d.ts.map +1 -0
  86. package/dist/runtime/core/cohort.js +49 -0
  87. package/dist/runtime/core/cohort.js.map +1 -0
  88. package/dist/runtime/core/engine-input.d.ts +114 -0
  89. package/dist/runtime/core/engine-input.d.ts.map +1 -0
  90. package/dist/runtime/core/engine-input.js +19 -0
  91. package/dist/runtime/core/engine-input.js.map +1 -0
  92. package/dist/runtime/core/engine-output.d.ts +62 -0
  93. package/dist/runtime/core/engine-output.d.ts.map +1 -0
  94. package/dist/runtime/core/engine-output.js +27 -0
  95. package/dist/runtime/core/engine-output.js.map +1 -0
  96. package/dist/runtime/core/engine-readiness.d.ts +49 -0
  97. package/dist/runtime/core/engine-readiness.d.ts.map +1 -0
  98. package/dist/runtime/core/engine-readiness.js +47 -0
  99. package/dist/runtime/core/engine-readiness.js.map +1 -0
  100. package/dist/runtime/core/engine-resolver.d.ts +172 -0
  101. package/dist/runtime/core/engine-resolver.d.ts.map +1 -0
  102. package/dist/runtime/core/engine-resolver.js +170 -0
  103. package/dist/runtime/core/engine-resolver.js.map +1 -0
  104. package/dist/runtime/core/engine-stage-derivation.d.ts +19 -0
  105. package/dist/runtime/core/engine-stage-derivation.d.ts.map +1 -0
  106. package/dist/runtime/core/engine-stage-derivation.js +30 -0
  107. package/dist/runtime/core/engine-stage-derivation.js.map +1 -0
  108. package/dist/runtime/core/engine-state.d.ts +83 -0
  109. package/dist/runtime/core/engine-state.d.ts.map +1 -0
  110. package/dist/runtime/core/engine-state.js +49 -0
  111. package/dist/runtime/core/engine-state.js.map +1 -0
  112. package/dist/runtime/core/engine-transition.d.ts +49 -0
  113. package/dist/runtime/core/engine-transition.d.ts.map +1 -0
  114. package/dist/runtime/core/engine-transition.js +261 -0
  115. package/dist/runtime/core/engine-transition.js.map +1 -0
  116. package/dist/runtime/engine-context.d.ts +40 -0
  117. package/dist/runtime/engine-context.d.ts.map +1 -0
  118. package/dist/runtime/engine-context.js +32 -0
  119. package/dist/runtime/engine-context.js.map +1 -0
  120. package/dist/runtime/engine.d.ts +24 -0
  121. package/dist/runtime/engine.d.ts.map +1 -0
  122. package/dist/runtime/engine.js +24 -0
  123. package/dist/runtime/engine.js.map +1 -0
  124. package/dist/runtime/internal.d.ts +44 -0
  125. package/dist/runtime/internal.d.ts.map +1 -0
  126. package/dist/runtime/internal.js +46 -0
  127. package/dist/runtime/internal.js.map +1 -0
  128. package/dist/runtime/runtime-id.d.ts +8 -0
  129. package/dist/runtime/runtime-id.d.ts.map +1 -0
  130. package/dist/runtime/runtime-id.js +10 -0
  131. package/dist/runtime/runtime-id.js.map +1 -0
  132. package/dist/runtime/section-runtime-engine-host-context.d.ts +74 -0
  133. package/dist/runtime/section-runtime-engine-host-context.d.ts.map +1 -0
  134. package/dist/runtime/section-runtime-engine-host-context.js +96 -0
  135. package/dist/runtime/section-runtime-engine-host-context.js.map +1 -0
  136. package/dist/runtime/stage-emit-gate.d.ts +93 -0
  137. package/dist/runtime/stage-emit-gate.d.ts.map +1 -0
  138. package/dist/runtime/stage-emit-gate.js +83 -0
  139. package/dist/runtime/stage-emit-gate.js.map +1 -0
  140. package/dist/services/ToolkitCoordinator.d.ts +280 -7
  141. package/dist/services/ToolkitCoordinator.d.ts.map +1 -1
  142. package/dist/services/ToolkitCoordinator.js +412 -32
  143. package/dist/services/ToolkitCoordinator.js.map +1 -1
  144. package/dist/services/framework-error-bus.d.ts +73 -0
  145. package/dist/services/framework-error-bus.d.ts.map +1 -0
  146. package/dist/services/framework-error-bus.js +68 -0
  147. package/dist/services/framework-error-bus.js.map +1 -0
  148. package/dist/services/framework-error.d.ts +36 -1
  149. package/dist/services/framework-error.d.ts.map +1 -1
  150. package/dist/services/framework-error.js +37 -0
  151. package/dist/services/framework-error.js.map +1 -1
  152. package/dist/services/interfaces.d.ts +78 -0
  153. package/dist/services/interfaces.d.ts.map +1 -1
  154. package/dist/services/interfaces.js.map +1 -1
  155. package/dist/services/section-controller-types.d.ts +20 -0
  156. package/dist/services/section-controller-types.d.ts.map +1 -1
  157. package/dist/services/tools-config-normalizer.d.ts +23 -0
  158. package/dist/services/tools-config-normalizer.d.ts.map +1 -1
  159. package/dist/services/tools-config-normalizer.js +13 -1
  160. package/dist/services/tools-config-normalizer.js.map +1 -1
  161. package/dist/tools/client.d.ts +0 -1
  162. package/dist/tools/client.d.ts.map +1 -1
  163. package/dist/tools/client.js +0 -2
  164. package/dist/tools/client.js.map +1 -1
  165. package/dist/tools/types.d.ts +0 -26
  166. package/dist/tools/types.d.ts.map +1 -1
  167. package/package.json +23 -7
  168. package/dist/runtime/runtime-event-guards.d.ts +0 -2
  169. package/dist/runtime/runtime-event-guards.d.ts.map +0 -1
  170. package/dist/runtime/runtime-event-guards.js +0 -4
  171. package/dist/runtime/runtime-event-guards.js.map +0 -1
  172. package/dist/tools/tool-coordinator.d.ts +0 -72
  173. package/dist/tools/tool-coordinator.d.ts.map +0 -1
  174. package/dist/tools/tool-coordinator.js +0 -194
  175. package/dist/tools/tool-coordinator.js.map +0 -1
  176. package/dist/types/events.d.ts +0 -157
  177. package/dist/types/events.d.ts.map +0 -1
  178. package/dist/types/events.js +0 -11
  179. package/dist/types/events.js.map +0 -1
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Section runtime engine state (M7 — Variant C, layered core).
3
+ *
4
+ * The state object is the single source of truth for stage, cohort,
5
+ * readiness signals, and the resolved coordinator/controller handles
6
+ * across one engine instance. The transition function in
7
+ * `engine-transition.ts` is the only legal mutator; the adapter (M7
8
+ * PR 2) reads the state via `SectionEngineCore.getState()` and emits
9
+ * the bundled `SectionEngineOutput[]` to its bridges.
10
+ *
11
+ * Phases (the FSM). Adjustment A2 of the M7 implementation plan locks
12
+ * this list to four phases that map 1:1 onto the M6 canonical stages:
13
+ *
14
+ * `idle` → no cohort yet (before `initialize`).
15
+ * `booting-section` → cohort known, controller resolution pending. Maps to stage `composed`.
16
+ * `engine-ready` → controller resolved. Maps to stage `engine-ready`.
17
+ * `interactive` → readiness gate satisfied. Maps to stage `interactive`.
18
+ * `disposed` → engine torn down. Maps to stage `disposed`.
19
+ *
20
+ * `loading-complete` is intentionally **not** an FSM phase — it is a
21
+ * `SectionEngineOutput` emitted from the `interactive` phase when the
22
+ * readiness signals satisfy `allLoadingComplete`. See
23
+ * `engine-output.ts` for the output shape and the implementation
24
+ * plan's Adjustment A2 fence.
25
+ */
26
+ import type { CohortKey } from "./cohort.js";
27
+ import type { EffectiveRuntime } from "./engine-resolver.js";
28
+ import type { EngineReadinessSignals } from "./engine-readiness.js";
29
+ import type { FrameworkErrorModel } from "../../services/framework-error.js";
30
+ export type SectionEnginePhase = "idle" | "booting-section" | "engine-ready" | "interactive" | "disposed";
31
+ export type SectionEngineState = {
32
+ /** Current FSM phase. The single source of truth for stage derivation. */
33
+ phase: SectionEnginePhase;
34
+ /**
35
+ * Active cohort, or `null` when the engine is `idle` or `disposed`.
36
+ * `phase === "idle"` always implies `cohort === null`. A non-idle,
37
+ * non-disposed phase always has a cohort.
38
+ */
39
+ cohort: CohortKey | null;
40
+ /**
41
+ * Whether the host has reported the section controller is resolved.
42
+ * Latched by the `section-controller-resolved` input; the
43
+ * transition uses it (along with `phase >= booting-section`) to
44
+ * advance into `engine-ready`.
45
+ */
46
+ controllerResolved: boolean;
47
+ /**
48
+ * Readiness signal snapshot. Updated by `update-readiness-signals`
49
+ * inputs from the host (kernel) — the engine itself does not
50
+ * compute these from scratch in PR 1. Strict-mode gating is
51
+ * applied at derivation time via `createReadinessDetail`, not by
52
+ * mutating the signals.
53
+ */
54
+ readinessSignals: EngineReadinessSignals;
55
+ /** Last resolved effective runtime (output of `resolveRuntime`). */
56
+ effectiveRuntime: EffectiveRuntime | null;
57
+ /** Last resolved tools config. */
58
+ effectiveToolsConfig: unknown;
59
+ /**
60
+ * `true` once the engine has emitted `loading-complete` for the
61
+ * current cohort. Re-armed on cohort change. The single-shot
62
+ * semantics of the canonical `pie-loading-complete` event are
63
+ * preserved by gating emission on this flag in the transition.
64
+ */
65
+ loadingCompleteEmitted: boolean;
66
+ /**
67
+ * Most recent framework error, if any. The engine routes errors
68
+ * through outputs, not through state — this field is kept so
69
+ * subscribers asking for the latest snapshot (e.g. error banners)
70
+ * can read it without replaying the output stream.
71
+ */
72
+ lastFrameworkError: FrameworkErrorModel | null;
73
+ /** Number of items the host has registered for the current cohort. */
74
+ itemCount: number;
75
+ /** Number of items reported as loaded. */
76
+ loadedCount: number;
77
+ };
78
+ /**
79
+ * Initial state. Kept as a function so callers cannot mutate a shared
80
+ * default by reference.
81
+ */
82
+ export declare function createInitialEngineState(): SectionEngineState;
83
+ //# sourceMappingURL=engine-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-state.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/engine-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,MAAM,MAAM,kBAAkB,GAC3B,MAAM,GACN,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,UAAU,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG;IAChC,0EAA0E;IAC1E,KAAK,EAAE,kBAAkB,CAAC;IAE1B;;;;OAIG;IACH,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IAEzB;;;;;OAKG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;;;;;OAMG;IACH,gBAAgB,EAAE,sBAAsB,CAAC;IAEzC,oEAAoE;IACpE,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE1C,kCAAkC;IAClC,oBAAoB,EAAE,OAAO,CAAC;IAE9B;;;;;OAKG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IACH,kBAAkB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAE/C,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAElB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,kBAAkB,CAkB7D"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Section runtime engine state (M7 — Variant C, layered core).
3
+ *
4
+ * The state object is the single source of truth for stage, cohort,
5
+ * readiness signals, and the resolved coordinator/controller handles
6
+ * across one engine instance. The transition function in
7
+ * `engine-transition.ts` is the only legal mutator; the adapter (M7
8
+ * PR 2) reads the state via `SectionEngineCore.getState()` and emits
9
+ * the bundled `SectionEngineOutput[]` to its bridges.
10
+ *
11
+ * Phases (the FSM). Adjustment A2 of the M7 implementation plan locks
12
+ * this list to four phases that map 1:1 onto the M6 canonical stages:
13
+ *
14
+ * `idle` → no cohort yet (before `initialize`).
15
+ * `booting-section` → cohort known, controller resolution pending. Maps to stage `composed`.
16
+ * `engine-ready` → controller resolved. Maps to stage `engine-ready`.
17
+ * `interactive` → readiness gate satisfied. Maps to stage `interactive`.
18
+ * `disposed` → engine torn down. Maps to stage `disposed`.
19
+ *
20
+ * `loading-complete` is intentionally **not** an FSM phase — it is a
21
+ * `SectionEngineOutput` emitted from the `interactive` phase when the
22
+ * readiness signals satisfy `allLoadingComplete`. See
23
+ * `engine-output.ts` for the output shape and the implementation
24
+ * plan's Adjustment A2 fence.
25
+ */
26
+ /**
27
+ * Initial state. Kept as a function so callers cannot mutate a shared
28
+ * default by reference.
29
+ */
30
+ export function createInitialEngineState() {
31
+ return {
32
+ phase: "idle",
33
+ cohort: null,
34
+ controllerResolved: false,
35
+ readinessSignals: {
36
+ sectionReady: false,
37
+ interactionReady: false,
38
+ allLoadingComplete: false,
39
+ runtimeError: false,
40
+ },
41
+ effectiveRuntime: null,
42
+ effectiveToolsConfig: null,
43
+ loadingCompleteEmitted: false,
44
+ lastFrameworkError: null,
45
+ itemCount: 0,
46
+ loadedCount: 0,
47
+ };
48
+ }
49
+ //# sourceMappingURL=engine-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-state.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAuEH;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACvC,OAAO;QACN,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,IAAI;QACZ,kBAAkB,EAAE,KAAK;QACzB,gBAAgB,EAAE;YACjB,YAAY,EAAE,KAAK;YACnB,gBAAgB,EAAE,KAAK;YACvB,kBAAkB,EAAE,KAAK;YACzB,YAAY,EAAE,KAAK;SACnB;QACD,gBAAgB,EAAE,IAAI;QACtB,oBAAoB,EAAE,IAAI;QAC1B,sBAAsB,EAAE,KAAK;QAC7B,kBAAkB,EAAE,IAAI;QACxB,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;KACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Pure transition function for the section runtime engine (M7 — Variant
3
+ * C, layered core).
4
+ *
5
+ * `transition(state, input)` is total over `(state, input)` pairs and
6
+ * returns:
7
+ * - the next `SectionEngineState` (immutable; the input state object
8
+ * is never mutated);
9
+ * - the ordered list of `SectionEngineOutput`s the adapter must
10
+ * dispatch (DOM events, framework-error fan-out, etc.).
11
+ *
12
+ * The function imports nothing from Svelte, the DOM, or the
13
+ * coordinator. The `core/` constraint is enforced by the per-PR audit
14
+ * step in the M7 implementation plan.
15
+ *
16
+ * Phase machine (per `engine-state.ts`):
17
+ * idle → booting-section → engine-ready → interactive → disposed
18
+ * (cohort-change rolls back to booting-section for the new cohort
19
+ * after emitting `disposed` for the outgoing cohort)
20
+ *
21
+ * Output ordering invariants:
22
+ * 1. `stage-change` for stage advancement fires before any
23
+ * `loading-complete` triggered by the same input.
24
+ * 2. `loading-complete` fires once per cohort, gated on
25
+ * `state.loadingCompleteEmitted`.
26
+ * 3. `framework-error` outputs are independent of the stage chain
27
+ * and do not move the phase.
28
+ *
29
+ * The deprecated readiness output kinds (`readiness-change`,
30
+ * `interaction-ready`, `ready`) and their DOM-event bridge were
31
+ * removed in the broad architecture review compat sweep. Hosts that
32
+ * need the readiness detail read it via the kernel's `selectReadiness`
33
+ * / `getSnapshot` selectors or via `SectionEngineCore.getState()`.
34
+ */
35
+ import type { SectionEngineInput } from "./engine-input.js";
36
+ import type { SectionEngineOutput } from "./engine-output.js";
37
+ import { type SectionEngineState } from "./engine-state.js";
38
+ export interface TransitionResult {
39
+ state: SectionEngineState;
40
+ outputs: SectionEngineOutput[];
41
+ }
42
+ /**
43
+ * Pure transition. Total over `(state, input)`; never mutates inputs;
44
+ * never throws. Unhandled inputs after `disposed` fall through to a
45
+ * no-op (the adapter is responsible for not feeding them in, but the
46
+ * core stays safe by design).
47
+ */
48
+ export declare function transition(state: SectionEngineState, input: SectionEngineInput): TransitionResult;
49
+ //# sourceMappingURL=engine-transition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-transition.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/engine-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAM9D,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAqGD;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,kBAAkB,GACvB,gBAAgB,CAuJlB"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Pure transition function for the section runtime engine (M7 — Variant
3
+ * C, layered core).
4
+ *
5
+ * `transition(state, input)` is total over `(state, input)` pairs and
6
+ * returns:
7
+ * - the next `SectionEngineState` (immutable; the input state object
8
+ * is never mutated);
9
+ * - the ordered list of `SectionEngineOutput`s the adapter must
10
+ * dispatch (DOM events, framework-error fan-out, etc.).
11
+ *
12
+ * The function imports nothing from Svelte, the DOM, or the
13
+ * coordinator. The `core/` constraint is enforced by the per-PR audit
14
+ * step in the M7 implementation plan.
15
+ *
16
+ * Phase machine (per `engine-state.ts`):
17
+ * idle → booting-section → engine-ready → interactive → disposed
18
+ * (cohort-change rolls back to booting-section for the new cohort
19
+ * after emitting `disposed` for the outgoing cohort)
20
+ *
21
+ * Output ordering invariants:
22
+ * 1. `stage-change` for stage advancement fires before any
23
+ * `loading-complete` triggered by the same input.
24
+ * 2. `loading-complete` fires once per cohort, gated on
25
+ * `state.loadingCompleteEmitted`.
26
+ * 3. `framework-error` outputs are independent of the stage chain
27
+ * and do not move the phase.
28
+ *
29
+ * The deprecated readiness output kinds (`readiness-change`,
30
+ * `interaction-ready`, `ready`) and their DOM-event bridge were
31
+ * removed in the broad architecture review compat sweep. Hosts that
32
+ * need the readiness detail read it via the kernel's `selectReadiness`
33
+ * / `getSnapshot` selectors or via `SectionEngineCore.getState()`.
34
+ */
35
+ import { cohortsEqual } from "./cohort.js";
36
+ import { createReadinessDetail, } from "./engine-readiness.js";
37
+ import { phaseToStage } from "./engine-stage-derivation.js";
38
+ import { createInitialEngineState, } from "./engine-state.js";
39
+ function emitStageChange(outputs, phase, cohort, status = "entered") {
40
+ const stage = phaseToStage(phase);
41
+ if (!stage)
42
+ return;
43
+ outputs.push({ kind: "stage-change", stage, status, cohort });
44
+ }
45
+ /**
46
+ * Transition the engine after `initialize` / `cohort-change`. Sets
47
+ * the new cohort, resets latches, stores the resolved runtime/tools,
48
+ * and emits the `composed` stage.
49
+ */
50
+ function startCohort(args) {
51
+ const next = {
52
+ ...createInitialEngineState(),
53
+ phase: "booting-section",
54
+ cohort: args.cohort,
55
+ effectiveRuntime: args.effectiveRuntime,
56
+ effectiveToolsConfig: args.effectiveToolsConfig,
57
+ itemCount: args.itemCount,
58
+ };
59
+ const outputs = [];
60
+ emitStageChange(outputs, "booting-section", args.cohort);
61
+ return { state: next, outputs };
62
+ }
63
+ /**
64
+ * Apply a readiness update: store new signals, derive the detail in
65
+ * the requested mode, advance the phase to `interactive` when gated,
66
+ * and emit `loading-complete` once per cohort.
67
+ */
68
+ function applyReadinessUpdate(state, args) {
69
+ if (state.phase === "idle" || state.phase === "disposed") {
70
+ // No cohort to update; ignore.
71
+ return { state, outputs: [] };
72
+ }
73
+ const detail = createReadinessDetail({
74
+ mode: args.mode,
75
+ signals: args.signals,
76
+ });
77
+ const outputs = [];
78
+ let phase = state.phase;
79
+ let loadingCompleteEmitted = state.loadingCompleteEmitted;
80
+ // Stage advancement: engine-ready → interactive when readiness
81
+ // satisfies `interactionReady` (mode-aware via `createReadinessDetail`).
82
+ if (phase === "engine-ready" && detail.interactionReady) {
83
+ phase = "interactive";
84
+ emitStageChange(outputs, phase, state.cohort);
85
+ }
86
+ // Canonical `loading-complete` emission. One-shot per cohort, gated
87
+ // on the readiness signals indicating every item has finished
88
+ // loading.
89
+ if (detail.allLoadingComplete &&
90
+ state.cohort &&
91
+ !loadingCompleteEmitted) {
92
+ loadingCompleteEmitted = true;
93
+ outputs.push({
94
+ kind: "loading-complete",
95
+ cohort: state.cohort,
96
+ itemCount: args.itemCount,
97
+ loadedCount: args.loadedCount,
98
+ });
99
+ }
100
+ const nextState = {
101
+ ...state,
102
+ phase,
103
+ readinessSignals: args.signals,
104
+ loadedCount: args.loadedCount,
105
+ itemCount: args.itemCount,
106
+ loadingCompleteEmitted,
107
+ };
108
+ return { state: nextState, outputs };
109
+ }
110
+ /**
111
+ * Pure transition. Total over `(state, input)`; never mutates inputs;
112
+ * never throws. Unhandled inputs after `disposed` fall through to a
113
+ * no-op (the adapter is responsible for not feeding them in, but the
114
+ * core stays safe by design).
115
+ */
116
+ export function transition(state, input) {
117
+ switch (input.kind) {
118
+ case "initialize": {
119
+ if (state.phase === "disposed") {
120
+ // The engine has been disposed; ignore.
121
+ return { state, outputs: [] };
122
+ }
123
+ if (state.phase !== "idle") {
124
+ // Already initialized. Treat as `update-runtime` for the
125
+ // current cohort if the cohort matches; otherwise treat as
126
+ // a `cohort-change`.
127
+ if (cohortsEqual(state.cohort, input.cohort)) {
128
+ return transition(state, {
129
+ kind: "update-runtime",
130
+ effectiveRuntime: input.effectiveRuntime,
131
+ effectiveToolsConfig: input.effectiveToolsConfig,
132
+ });
133
+ }
134
+ return transition(state, {
135
+ kind: "cohort-change",
136
+ cohort: input.cohort,
137
+ effectiveRuntime: input.effectiveRuntime,
138
+ effectiveToolsConfig: input.effectiveToolsConfig,
139
+ itemCount: input.itemCount,
140
+ });
141
+ }
142
+ return startCohort({
143
+ state,
144
+ cohort: input.cohort,
145
+ effectiveRuntime: input.effectiveRuntime,
146
+ effectiveToolsConfig: input.effectiveToolsConfig,
147
+ itemCount: input.itemCount,
148
+ });
149
+ }
150
+ case "update-runtime": {
151
+ if (state.phase === "idle" || state.phase === "disposed") {
152
+ return { state, outputs: [] };
153
+ }
154
+ return {
155
+ state: {
156
+ ...state,
157
+ effectiveRuntime: input.effectiveRuntime,
158
+ effectiveToolsConfig: input.effectiveToolsConfig,
159
+ },
160
+ outputs: [],
161
+ };
162
+ }
163
+ case "cohort-change": {
164
+ if (state.phase === "disposed") {
165
+ return { state, outputs: [] };
166
+ }
167
+ if (cohortsEqual(state.cohort, input.cohort)) {
168
+ // No-op cohort change; fall back to a runtime update.
169
+ return transition(state, {
170
+ kind: "update-runtime",
171
+ effectiveRuntime: input.effectiveRuntime,
172
+ effectiveToolsConfig: input.effectiveToolsConfig,
173
+ });
174
+ }
175
+ const outputs = [];
176
+ if (state.phase !== "idle") {
177
+ // Emit `disposed` for the outgoing cohort before we wipe state.
178
+ outputs.push({
179
+ kind: "stage-change",
180
+ stage: "disposed",
181
+ status: "entered",
182
+ cohort: state.cohort,
183
+ });
184
+ }
185
+ const started = startCohort({
186
+ state,
187
+ cohort: input.cohort,
188
+ effectiveRuntime: input.effectiveRuntime,
189
+ effectiveToolsConfig: input.effectiveToolsConfig,
190
+ itemCount: input.itemCount,
191
+ });
192
+ return {
193
+ state: started.state,
194
+ outputs: [...outputs, ...started.outputs],
195
+ };
196
+ }
197
+ case "section-controller-resolved": {
198
+ if (state.phase !== "booting-section") {
199
+ // Either too early (idle), too late (interactive / disposed),
200
+ // or a duplicate notification; the FSM is monotonic.
201
+ return {
202
+ state: { ...state, controllerResolved: true },
203
+ outputs: [],
204
+ };
205
+ }
206
+ const outputs = [];
207
+ emitStageChange(outputs, "engine-ready", state.cohort);
208
+ return {
209
+ state: {
210
+ ...state,
211
+ phase: "engine-ready",
212
+ controllerResolved: true,
213
+ },
214
+ outputs,
215
+ };
216
+ }
217
+ case "update-readiness-signals": {
218
+ return applyReadinessUpdate(state, {
219
+ signals: input.signals,
220
+ mode: input.mode,
221
+ loadedCount: input.loadedCount,
222
+ itemCount: input.itemCount,
223
+ });
224
+ }
225
+ case "framework-error": {
226
+ return {
227
+ state: {
228
+ ...state,
229
+ lastFrameworkError: input.error,
230
+ readinessSignals: {
231
+ ...state.readinessSignals,
232
+ runtimeError: true,
233
+ },
234
+ },
235
+ outputs: [{ kind: "framework-error", error: input.error }],
236
+ };
237
+ }
238
+ case "dispose": {
239
+ if (state.phase === "disposed") {
240
+ return { state, outputs: [] };
241
+ }
242
+ const outputs = [];
243
+ if (state.phase !== "idle") {
244
+ emitStageChange(outputs, "disposed", state.cohort);
245
+ }
246
+ return {
247
+ state: {
248
+ ...state,
249
+ phase: "disposed",
250
+ },
251
+ outputs,
252
+ };
253
+ }
254
+ default: {
255
+ const exhaustive = input;
256
+ void exhaustive;
257
+ return { state, outputs: [] };
258
+ }
259
+ }
260
+ }
261
+ //# sourceMappingURL=engine-transition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-transition.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAG3D,OAAO,EACN,qBAAqB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACN,wBAAwB,GAGxB,MAAM,mBAAmB,CAAC;AAO3B,SAAS,eAAe,CACvB,OAA8B,EAC9B,KAAyB,EACzB,MAAwB,EACxB,SAA2C,SAAS;IAEpD,MAAM,KAAK,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OAAO;aACP,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACT,MAAM,UAAU,GAAU,KAAK,CAAC;YAChC,KAAK,UAAU,CAAC;YAChB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Svelte context key for the section runtime engine (M7 PR 5).
3
+ *
4
+ * Components inside a section player layout consume the engine through
5
+ * Svelte's native `getContext(SECTION_RUNTIME_ENGINE_KEY)`. The kernel
6
+ * (`SectionPlayerLayoutKernel.svelte`) is the canonical provider — it
7
+ * constructs the engine, attaches it to the layout CE host, and exposes
8
+ * it to descendants via `setContext(SECTION_RUNTIME_ENGINE_KEY, engine)`.
9
+ *
10
+ * The contract is one-directional:
11
+ * - Provider: the component that owns engine lifetime (kernel today;
12
+ * in M7 PR 6 the toolkit CE will fall back to constructing its own
13
+ * engine when no upstream provider is present).
14
+ * - Consumers: any descendant Svelte component that needs to read
15
+ * state, subscribe to outputs, or feed inputs (e.g. the toolkit CE
16
+ * reaching the engine through the wrapping kernel).
17
+ *
18
+ * The key is a `Symbol` so it cannot collide with userland context keys
19
+ * and so descendants are forced to import this module rather than
20
+ * guess a string id.
21
+ *
22
+ * **Stability.** This export is part of the stable runtime/engine
23
+ * surface; renaming or replacing the symbol is a major breaking
24
+ * change. Adding adjacent context keys (e.g. for dedicated read-only
25
+ * snapshots) is allowed.
26
+ */
27
+ import type { SectionRuntimeEngine } from "./SectionRuntimeEngine.js";
28
+ /**
29
+ * Svelte context key under which a `SectionRuntimeEngine` instance is
30
+ * provided to descendants.
31
+ */
32
+ export declare const SECTION_RUNTIME_ENGINE_KEY: unique symbol;
33
+ /**
34
+ * Type-level alias for the value stored under
35
+ * `SECTION_RUNTIME_ENGINE_KEY`. Exposed as a separate alias so
36
+ * consumers can spell the type without importing the implementing
37
+ * class directly.
38
+ */
39
+ export type SectionRuntimeEngineContext = SectionRuntimeEngine;
40
+ //# sourceMappingURL=engine-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-context.d.ts","sourceRoot":"","sources":["../../src/runtime/engine-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,OAAO,MAE/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Svelte context key for the section runtime engine (M7 PR 5).
3
+ *
4
+ * Components inside a section player layout consume the engine through
5
+ * Svelte's native `getContext(SECTION_RUNTIME_ENGINE_KEY)`. The kernel
6
+ * (`SectionPlayerLayoutKernel.svelte`) is the canonical provider — it
7
+ * constructs the engine, attaches it to the layout CE host, and exposes
8
+ * it to descendants via `setContext(SECTION_RUNTIME_ENGINE_KEY, engine)`.
9
+ *
10
+ * The contract is one-directional:
11
+ * - Provider: the component that owns engine lifetime (kernel today;
12
+ * in M7 PR 6 the toolkit CE will fall back to constructing its own
13
+ * engine when no upstream provider is present).
14
+ * - Consumers: any descendant Svelte component that needs to read
15
+ * state, subscribe to outputs, or feed inputs (e.g. the toolkit CE
16
+ * reaching the engine through the wrapping kernel).
17
+ *
18
+ * The key is a `Symbol` so it cannot collide with userland context keys
19
+ * and so descendants are forced to import this module rather than
20
+ * guess a string id.
21
+ *
22
+ * **Stability.** This export is part of the stable runtime/engine
23
+ * surface; renaming or replacing the symbol is a major breaking
24
+ * change. Adding adjacent context keys (e.g. for dedicated read-only
25
+ * snapshots) is allowed.
26
+ */
27
+ /**
28
+ * Svelte context key under which a `SectionRuntimeEngine` instance is
29
+ * provided to descendants.
30
+ */
31
+ export const SECTION_RUNTIME_ENGINE_KEY = Symbol("@pie-players/section-runtime-engine");
32
+ //# sourceMappingURL=engine-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-context.js","sourceRoot":"","sources":["../../src/runtime/engine-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAkB,MAAM,CAC9D,qCAAqC,CACrC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Section runtime engine — facade entry point (M7 — Variant C).
3
+ *
4
+ * Narrow, stable public surface for hosts that want to mount, drive,
5
+ * or dispose a section runtime via the layered engine. Re-exports the
6
+ * `SectionRuntimeEngine` facade and its `attachHost` arg shape.
7
+ *
8
+ * **Pairing.** This module is the stable counterpart to
9
+ * `./runtime/internal`, which exposes the wider, evolving surface
10
+ * (core types, adapter bridges, cohort helpers) for advanced hosts and
11
+ * for the engine's own tests / benchmarks. Consumers that only need to
12
+ * mount + drive a section runtime should import from here. Consumers
13
+ * that need to reach past the facade (e.g. construct an adapter
14
+ * manually, inspect FSM state types, build alternate fan-out paths)
15
+ * should import from `./runtime/internal` and accept the documented
16
+ * stability disclaimer there.
17
+ *
18
+ * The package's `exports` map adds `./runtime/engine` in M7 PR 3
19
+ * alongside the facade refactor.
20
+ */
21
+ export { SectionRuntimeEngine, type SectionRuntimeEngineHostArgs, } from "./SectionRuntimeEngine.js";
22
+ export { SECTION_RUNTIME_ENGINE_KEY, type SectionRuntimeEngineContext, } from "./engine-context.js";
23
+ export { sectionRuntimeEngineHostContext, connectSectionRuntimeEngineHostContext, type SectionRuntimeEngineHostContextValue, type SectionRuntimeEngineHostContextListener, } from "./section-runtime-engine-host-context.js";
24
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/runtime/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACN,oBAAoB,EACpB,KAAK,4BAA4B,GACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,0BAA0B,EAC1B,KAAK,2BAA2B,GAChC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,+BAA+B,EAC/B,sCAAsC,EACtC,KAAK,oCAAoC,EACzC,KAAK,uCAAuC,GAC5C,MAAM,0CAA0C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Section runtime engine — facade entry point (M7 — Variant C).
3
+ *
4
+ * Narrow, stable public surface for hosts that want to mount, drive,
5
+ * or dispose a section runtime via the layered engine. Re-exports the
6
+ * `SectionRuntimeEngine` facade and its `attachHost` arg shape.
7
+ *
8
+ * **Pairing.** This module is the stable counterpart to
9
+ * `./runtime/internal`, which exposes the wider, evolving surface
10
+ * (core types, adapter bridges, cohort helpers) for advanced hosts and
11
+ * for the engine's own tests / benchmarks. Consumers that only need to
12
+ * mount + drive a section runtime should import from here. Consumers
13
+ * that need to reach past the facade (e.g. construct an adapter
14
+ * manually, inspect FSM state types, build alternate fan-out paths)
15
+ * should import from `./runtime/internal` and accept the documented
16
+ * stability disclaimer there.
17
+ *
18
+ * The package's `exports` map adds `./runtime/engine` in M7 PR 3
19
+ * alongside the facade refactor.
20
+ */
21
+ export { SectionRuntimeEngine, } from "./SectionRuntimeEngine.js";
22
+ export { SECTION_RUNTIME_ENGINE_KEY, } from "./engine-context.js";
23
+ export { sectionRuntimeEngineHostContext, connectSectionRuntimeEngineHostContext, } from "./section-runtime-engine-host-context.js";
24
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/runtime/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACN,oBAAoB,GAEpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,0BAA0B,GAE1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,+BAA+B,EAC/B,sCAAsC,GAGtC,MAAM,0CAA0C,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Section runtime engine — **internal** entry point (M7 — Variant C).
3
+ *
4
+ * Re-exports the layered core + adapter surface for advanced hosts that
5
+ * want to construct or inspect engines directly, and for the engine's
6
+ * own tests / benchmarks.
7
+ *
8
+ * **Stability posture.** This module is **not** part of the stable
9
+ * public API. Symbols here are subject to change between minor versions
10
+ * with only a changeset note. Hosts that need long-term stability
11
+ * should depend on the facade (`SectionRuntimeEngine` exported from
12
+ * `./runtime/engine`) instead.
13
+ *
14
+ * The split is intentional:
15
+ * - `./runtime/engine` (PR 3) — narrow, stable facade for common
16
+ * host wiring.
17
+ * - `./runtime/internal` — wide, evolving surface for the kernel,
18
+ * adapter tests, and any host that wants to reach past the facade.
19
+ *
20
+ * The `runtime/engine` and `runtime/internal` package `exports` map
21
+ * entries are added in PR 3 alongside the facade refactor.
22
+ */
23
+ export { SectionEngineAdapter } from "./adapter/SectionEngineAdapter.js";
24
+ export type { SectionEngineAdapterOptions } from "./adapter/SectionEngineAdapter.js";
25
+ export { FrameworkErrorBus, type FrameworkErrorListener, type FrameworkErrorPort, type FrameworkErrorReporter, } from "../services/framework-error-bus.js";
26
+ export { createCoordinatorBridge, type CoordinatorBridgeHandle, type CoordinatorBridgeOptions, type CoordinatorPort, type ResolveSectionControllerArgs, } from "./adapter/coordinator-bridge.js";
27
+ export { createDomEventBridge, type DomEventBridgeHandle, type DomEventBridgeOptions, } from "./adapter/dom-event-bridge.js";
28
+ export { createFrameworkErrorBridge, type FrameworkErrorBridgeHandle, type FrameworkErrorBridgeOptions, } from "./adapter/framework-error-bridge.js";
29
+ export { createInstrumentationBridge, type InstrumentationBridgeHandle, type InstrumentationBridgeOptions, type InstrumentationHook, } from "./adapter/instrumentation-bridge.js";
30
+ export { createSubscriberFanout, type EngineOutputListener, type SubscriberFanoutHandle, } from "./adapter/subscriber-fanout.js";
31
+ export { SectionEngineCore } from "./core/SectionEngineCore.js";
32
+ export type { SectionEngineCoreListener } from "./core/SectionEngineCore.js";
33
+ export { cohortKey, cohortsEqual, makeCohort, type CohortKey, } from "./core/cohort.js";
34
+ export type { SectionEngineInput } from "./core/engine-input.js";
35
+ export type { SectionEngineOutput } from "./core/engine-output.js";
36
+ export type { EngineReadinessDetail, EngineReadinessPhase, EngineReadinessSignals, } from "./core/engine-readiness.js";
37
+ export type { SectionEnginePhase, SectionEngineState, } from "./core/engine-state.js";
38
+ export { createInitialEngineState } from "./core/engine-state.js";
39
+ export { phaseToStage } from "./core/engine-stage-derivation.js";
40
+ export { DEFAULT_ASSESSMENT_ID, DEFAULT_ENV, DEFAULT_ISOLATION, DEFAULT_LAZY_INIT, DEFAULT_PLAYER_TYPE, resolveOnFrameworkError, resolveRuntime, resolveSectionEngineRuntimeState, resolveToolsConfig, type EffectiveRuntime, type FrameworkErrorHandler, type LoadingCompleteHandler, type PlayerOverrides, type RuntimeConfig, type RuntimeInputs, type StageChangeHandler, } from "./core/engine-resolver.js";
41
+ export { createReadinessDetail, resolveReadinessPhase, } from "./core/engine-readiness.js";
42
+ export { transition } from "./core/engine-transition.js";
43
+ export type { TransitionResult } from "./core/engine-transition.js";
44
+ //# sourceMappingURL=internal.d.ts.map