@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,47 @@
1
+ /**
2
+ * Framework-error bridge for the section runtime engine adapter (M7 —
3
+ * Variant C, layered).
4
+ *
5
+ * Routes `framework-error` engine outputs into a `FrameworkErrorBus`
6
+ * (write side: `FrameworkErrorReporter`). The bus is the single
7
+ * fan-out point shared with the toolkit CE's banner, the coordinator's
8
+ * canonical `onFrameworkError` lifecycle hook, and any direct host
9
+ * subscribers via `subscribeFrameworkErrors`. See
10
+ * `packages/assessment-toolkit/src/services/framework-error-bus.ts`
11
+ * for the full bus contract.
12
+ *
13
+ * **Why a separate bridge.** The dom-event-bridge dispatches the
14
+ * `framework-error` DOM event on the host. The framework-error-bridge
15
+ * routes the same model into the in-process bus so listeners that
16
+ * subscribe via `coordinator.subscribeFrameworkErrors(...)` see the
17
+ * same fan-out with byte-identical payloads. Splitting the
18
+ * responsibilities lets a host opt out of either side (DOM-only or
19
+ * bus-only) without re-implementing the other.
20
+ *
21
+ * **Bus ownership.** The bridge does not construct the bus; the
22
+ * adapter receives one externally so the toolkit CE can keep sharing
23
+ * its bus with the coordinator (matching today's
24
+ * `PieAssessmentToolkit.svelte` lifetime model). This avoids the
25
+ * "second bus" pitfall — a dual-bus topology would silently fragment
26
+ * fan-out.
27
+ */
28
+ export function createFrameworkErrorBridge(options) {
29
+ const { bus } = options;
30
+ function dispatch(output) {
31
+ switch (output.kind) {
32
+ case "framework-error":
33
+ bus.reportFrameworkError(output.error);
34
+ return;
35
+ case "stage-change":
36
+ case "loading-complete":
37
+ return;
38
+ default: {
39
+ const exhaustive = output;
40
+ void exhaustive;
41
+ return;
42
+ }
43
+ }
44
+ }
45
+ return { dispatch };
46
+ }
47
+ //# sourceMappingURL=framework-error-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-error-bridge.js","sourceRoot":"","sources":["../../../src/runtime/adapter/framework-error-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAaH,MAAM,UAAU,0BAA0B,CACzC,OAAoC;IAEpC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAExB,SAAS,QAAQ,CAAC,MAA2B;QAC5C,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,iBAAiB;gBACrB,GAAG,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvC,OAAO;YACR,KAAK,cAAc,CAAC;YACpB,KAAK,kBAAkB;gBACtB,OAAO;YACR,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM,UAAU,GAAU,MAAM,CAAC;gBACjC,KAAK,UAAU,CAAC;gBAChB,OAAO;YACR,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Instrumentation bridge for the section runtime engine adapter (M7 —
3
+ * Variant C, layered).
4
+ *
5
+ * Forwards every `SectionEngineOutput` to an optional observability
6
+ * hook the host injects (telemetry, debug logger, e2e probe). The
7
+ * bridge is intentionally thin: it does not buffer, transform, or
8
+ * filter. Hosts that need a different shape can run their own subscriber
9
+ * via the adapter's public `subscribe(...)` channel.
10
+ *
11
+ * **Why a dedicated bridge instead of a generic subscriber.** The
12
+ * subscriber-fanout channel is host-shaped — listeners receive batched
13
+ * arrays of outputs per `core.dispatch` call so they can reason about
14
+ * "what happened in this transition." The instrumentation hook is
15
+ * per-output: telemetry pipelines want one record per stage change,
16
+ * one record per readiness flip, etc. Splitting the channels keeps
17
+ * both shapes ergonomic.
18
+ *
19
+ * The bridge **must not** import `svelte` per the M7 layering
20
+ * constraint.
21
+ */
22
+ import type { SectionEngineOutput } from "../core/engine-output.js";
23
+ export type InstrumentationHook = (output: SectionEngineOutput) => void;
24
+ export interface InstrumentationBridgeOptions {
25
+ hook?: InstrumentationHook;
26
+ }
27
+ export interface InstrumentationBridgeHandle {
28
+ dispatch(output: SectionEngineOutput): void;
29
+ setHook(hook: InstrumentationHook | undefined): void;
30
+ }
31
+ export declare function createInstrumentationBridge(options?: InstrumentationBridgeOptions): InstrumentationBridgeHandle;
32
+ //# sourceMappingURL=instrumentation-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation-bridge.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapter/instrumentation-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAExE,MAAM,WAAW,4BAA4B;IAC5C,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC5C,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI,CAAC;CACrD;AAED,wBAAgB,2BAA2B,CAC1C,OAAO,GAAE,4BAAiC,GACxC,2BAA2B,CAiB7B"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Instrumentation bridge for the section runtime engine adapter (M7 —
3
+ * Variant C, layered).
4
+ *
5
+ * Forwards every `SectionEngineOutput` to an optional observability
6
+ * hook the host injects (telemetry, debug logger, e2e probe). The
7
+ * bridge is intentionally thin: it does not buffer, transform, or
8
+ * filter. Hosts that need a different shape can run their own subscriber
9
+ * via the adapter's public `subscribe(...)` channel.
10
+ *
11
+ * **Why a dedicated bridge instead of a generic subscriber.** The
12
+ * subscriber-fanout channel is host-shaped — listeners receive batched
13
+ * arrays of outputs per `core.dispatch` call so they can reason about
14
+ * "what happened in this transition." The instrumentation hook is
15
+ * per-output: telemetry pipelines want one record per stage change,
16
+ * one record per readiness flip, etc. Splitting the channels keeps
17
+ * both shapes ergonomic.
18
+ *
19
+ * The bridge **must not** import `svelte` per the M7 layering
20
+ * constraint.
21
+ */
22
+ export function createInstrumentationBridge(options = {}) {
23
+ let hook = options.hook;
24
+ function dispatch(output) {
25
+ if (!hook)
26
+ return;
27
+ try {
28
+ hook(output);
29
+ }
30
+ catch (error) {
31
+ console.warn("[InstrumentationBridge] hook failed:", error);
32
+ }
33
+ }
34
+ function setHook(next) {
35
+ hook = next;
36
+ }
37
+ return { dispatch, setHook };
38
+ }
39
+ //# sourceMappingURL=instrumentation-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation-bridge.js","sourceRoot":"","sources":["../../../src/runtime/adapter/instrumentation-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAeH,MAAM,UAAU,2BAA2B,CAC1C,UAAwC,EAAE;IAE1C,IAAI,IAAI,GAAoC,OAAO,CAAC,IAAI,CAAC;IAEzD,SAAS,QAAQ,CAAC,MAA2B;QAC5C,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,IAAI,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,SAAS,OAAO,CAAC,IAAqC;QACrD,IAAI,GAAG,IAAI,CAAC;IACb,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Subscriber fan-out for the section runtime engine adapter (M7 — Variant
3
+ * C, layered).
4
+ *
5
+ * The adapter exposes a single `subscribe(listener)` channel for hosts
6
+ * that want a synchronous stream of `SectionEngineOutput[]` batches —
7
+ * one batch per `core.dispatch(input)` call.
8
+ *
9
+ * **Why not reuse `SectionEngineCore.subscribe` directly.** The core
10
+ * channel is the engine's internal contract. The fan-out is the
11
+ * adapter's public channel: it is the single seam every facade method
12
+ * goes through, and the only seam that ever sees host-side errors. The
13
+ * separation lets us swap the core implementation (or skip it for
14
+ * tests) without changing the public subscriber shape.
15
+ *
16
+ * **Subscriber contract.** Mirrors `SectionEngineCore.subscribe`:
17
+ * - Listeners are invoked synchronously, in registration order.
18
+ * - A listener that throws is caught and `console.warn`-logged. Fan-out
19
+ * is not interrupted — same isolation guarantee as
20
+ * `FrameworkErrorBus`.
21
+ * - The disposer returned from `subscribe` is idempotent.
22
+ * - Listeners receive a frozen, defensively-copied output array.
23
+ * - There is no replay; subscribe at adapter construction time if you
24
+ * need every output from `idle` onward.
25
+ */
26
+ import type { SectionEngineOutput } from "../core/engine-output.js";
27
+ export type EngineOutputListener = (outputs: readonly SectionEngineOutput[]) => void;
28
+ export interface SubscriberFanoutHandle {
29
+ emit(outputs: readonly SectionEngineOutput[]): void;
30
+ subscribe(listener: EngineOutputListener): () => void;
31
+ dispose(): void;
32
+ getListenerCount(): number;
33
+ }
34
+ export declare function createSubscriberFanout(): SubscriberFanoutHandle;
35
+ //# sourceMappingURL=subscriber-fanout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber-fanout.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapter/subscriber-fanout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,CAClC,OAAO,EAAE,SAAS,mBAAmB,EAAE,KACnC,IAAI,CAAC;AAEV,MAAM,WAAW,sBAAsB;IACtC,IAAI,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,GAAG,IAAI,CAAC;IACpD,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IACtD,OAAO,IAAI,IAAI,CAAC;IAChB,gBAAgB,IAAI,MAAM,CAAC;CAC3B;AAED,wBAAgB,sBAAsB,IAAI,sBAAsB,CAmC/D"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Subscriber fan-out for the section runtime engine adapter (M7 — Variant
3
+ * C, layered).
4
+ *
5
+ * The adapter exposes a single `subscribe(listener)` channel for hosts
6
+ * that want a synchronous stream of `SectionEngineOutput[]` batches —
7
+ * one batch per `core.dispatch(input)` call.
8
+ *
9
+ * **Why not reuse `SectionEngineCore.subscribe` directly.** The core
10
+ * channel is the engine's internal contract. The fan-out is the
11
+ * adapter's public channel: it is the single seam every facade method
12
+ * goes through, and the only seam that ever sees host-side errors. The
13
+ * separation lets us swap the core implementation (or skip it for
14
+ * tests) without changing the public subscriber shape.
15
+ *
16
+ * **Subscriber contract.** Mirrors `SectionEngineCore.subscribe`:
17
+ * - Listeners are invoked synchronously, in registration order.
18
+ * - A listener that throws is caught and `console.warn`-logged. Fan-out
19
+ * is not interrupted — same isolation guarantee as
20
+ * `FrameworkErrorBus`.
21
+ * - The disposer returned from `subscribe` is idempotent.
22
+ * - Listeners receive a frozen, defensively-copied output array.
23
+ * - There is no replay; subscribe at adapter construction time if you
24
+ * need every output from `idle` onward.
25
+ */
26
+ export function createSubscriberFanout() {
27
+ const listeners = new Set();
28
+ function emit(outputs) {
29
+ if (outputs.length === 0)
30
+ return;
31
+ const snapshot = Array.from(listeners);
32
+ const frozen = Object.freeze(outputs.slice());
33
+ for (const listener of snapshot) {
34
+ try {
35
+ listener(frozen);
36
+ }
37
+ catch (error) {
38
+ console.warn("[SubscriberFanout] listener failed:", error);
39
+ }
40
+ }
41
+ }
42
+ function subscribe(listener) {
43
+ listeners.add(listener);
44
+ let attached = true;
45
+ return () => {
46
+ if (!attached)
47
+ return;
48
+ attached = false;
49
+ listeners.delete(listener);
50
+ };
51
+ }
52
+ function dispose() {
53
+ listeners.clear();
54
+ }
55
+ function getListenerCount() {
56
+ return listeners.size;
57
+ }
58
+ return { emit, subscribe, dispose, getListenerCount };
59
+ }
60
+ //# sourceMappingURL=subscriber-fanout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber-fanout.js","sourceRoot":"","sources":["../../../src/runtime/adapter/subscriber-fanout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAeH,MAAM,UAAU,sBAAsB;IACrC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAwB,CAAC;IAElD,SAAS,IAAI,CAAC,OAAuC;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QACjC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9C,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;YACjC,IAAI,CAAC;gBACJ,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;QACF,CAAC;IACF,CAAC;IAED,SAAS,SAAS,CAAC,QAA8B;QAChD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,QAAQ;gBAAE,OAAO;YACtB,QAAQ,GAAG,KAAK,CAAC;YACjB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC,CAAC;IACH,CAAC;IAED,SAAS,OAAO;QACf,SAAS,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,SAAS,gBAAgB;QACxB,OAAO,SAAS,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Section runtime engine — pure core (M7 — Variant C, layered).
3
+ *
4
+ * `SectionEngineCore` is a thin object oriented wrapper over the pure
5
+ * `transition()` function. It owns the current `SectionEngineState`,
6
+ * applies inputs serially, and fans out the resulting
7
+ * `SectionEngineOutput[]` to subscribers. There is no DOM, Svelte,
8
+ * coordinator, or timing dependency in this module — all I/O lives in
9
+ * the adapter layer (PR 2).
10
+ *
11
+ * Lifetime model:
12
+ * - One instance per cohort logical lifetime. Cohort changes happen
13
+ * through `dispatch({ kind: "cohort-change" })`, not through
14
+ * re-construction.
15
+ * - After a `dispose` input, additional inputs are no-ops (the
16
+ * transition handles this), but subscribers stay attached so the
17
+ * adapter can still deliver final cleanup outputs.
18
+ *
19
+ * Subscriber contract:
20
+ * - Listeners are invoked synchronously, in registration order.
21
+ * - A throwing listener is caught and `console.warn`-logged. Fan-out
22
+ * is not interrupted — same isolation guarantee as
23
+ * `FrameworkErrorBus`.
24
+ * - The disposer returned from `subscribe` is idempotent.
25
+ * - Listeners receive only the output array. State snapshots are
26
+ * read via `getState()` for callers that need them.
27
+ */
28
+ import type { SectionEngineInput } from "./engine-input.js";
29
+ import type { SectionEngineOutput } from "./engine-output.js";
30
+ import { type SectionEngineState } from "./engine-state.js";
31
+ export type SectionEngineCoreListener = (outputs: readonly SectionEngineOutput[]) => void;
32
+ export declare class SectionEngineCore {
33
+ private state;
34
+ private readonly listeners;
35
+ /** Read-only state snapshot. Callers must not mutate the returned object. */
36
+ getState(): Readonly<SectionEngineState>;
37
+ /**
38
+ * Apply one input. Returns the outputs that resulted from the
39
+ * transition; subscribers also receive them.
40
+ */
41
+ dispatch(input: SectionEngineInput): readonly SectionEngineOutput[];
42
+ /**
43
+ * Subscribe to engine outputs. Returns an idempotent disposer.
44
+ * Listeners do not receive a replay of past outputs; subscribe at
45
+ * construction time if you need every output from `idle` onward.
46
+ */
47
+ subscribe(listener: SectionEngineCoreListener): () => void;
48
+ /** Test-only: detach every listener. */
49
+ disposeListeners(): void;
50
+ private fanOut;
51
+ }
52
+ //# sourceMappingURL=SectionEngineCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionEngineCore.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/SectionEngineCore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,yBAAyB,GAAG,CACvC,OAAO,EAAE,SAAS,mBAAmB,EAAE,KACnC,IAAI,CAAC;AAEV,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,KAAK,CAAkD;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAElE,6EAA6E;IAC7E,QAAQ,IAAI,QAAQ,CAAC,kBAAkB,CAAC;IAIxC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,mBAAmB,EAAE;IASnE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,IAAI;IAU1D,wCAAwC;IACxC,gBAAgB,IAAI,IAAI;IAIxB,OAAO,CAAC,MAAM;CAWd"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Section runtime engine — pure core (M7 — Variant C, layered).
3
+ *
4
+ * `SectionEngineCore` is a thin object oriented wrapper over the pure
5
+ * `transition()` function. It owns the current `SectionEngineState`,
6
+ * applies inputs serially, and fans out the resulting
7
+ * `SectionEngineOutput[]` to subscribers. There is no DOM, Svelte,
8
+ * coordinator, or timing dependency in this module — all I/O lives in
9
+ * the adapter layer (PR 2).
10
+ *
11
+ * Lifetime model:
12
+ * - One instance per cohort logical lifetime. Cohort changes happen
13
+ * through `dispatch({ kind: "cohort-change" })`, not through
14
+ * re-construction.
15
+ * - After a `dispose` input, additional inputs are no-ops (the
16
+ * transition handles this), but subscribers stay attached so the
17
+ * adapter can still deliver final cleanup outputs.
18
+ *
19
+ * Subscriber contract:
20
+ * - Listeners are invoked synchronously, in registration order.
21
+ * - A throwing listener is caught and `console.warn`-logged. Fan-out
22
+ * is not interrupted — same isolation guarantee as
23
+ * `FrameworkErrorBus`.
24
+ * - The disposer returned from `subscribe` is idempotent.
25
+ * - Listeners receive only the output array. State snapshots are
26
+ * read via `getState()` for callers that need them.
27
+ */
28
+ import { createInitialEngineState, } from "./engine-state.js";
29
+ import { transition } from "./engine-transition.js";
30
+ export class SectionEngineCore {
31
+ state = createInitialEngineState();
32
+ listeners = new Set();
33
+ /** Read-only state snapshot. Callers must not mutate the returned object. */
34
+ getState() {
35
+ return this.state;
36
+ }
37
+ /**
38
+ * Apply one input. Returns the outputs that resulted from the
39
+ * transition; subscribers also receive them.
40
+ */
41
+ dispatch(input) {
42
+ const result = transition(this.state, input);
43
+ this.state = result.state;
44
+ if (result.outputs.length > 0) {
45
+ this.fanOut(result.outputs);
46
+ }
47
+ return result.outputs;
48
+ }
49
+ /**
50
+ * Subscribe to engine outputs. Returns an idempotent disposer.
51
+ * Listeners do not receive a replay of past outputs; subscribe at
52
+ * construction time if you need every output from `idle` onward.
53
+ */
54
+ subscribe(listener) {
55
+ this.listeners.add(listener);
56
+ let attached = true;
57
+ return () => {
58
+ if (!attached)
59
+ return;
60
+ attached = false;
61
+ this.listeners.delete(listener);
62
+ };
63
+ }
64
+ /** Test-only: detach every listener. */
65
+ disposeListeners() {
66
+ this.listeners.clear();
67
+ }
68
+ fanOut(outputs) {
69
+ const snapshot = Array.from(this.listeners);
70
+ const frozen = Object.freeze(outputs.slice());
71
+ for (const listener of snapshot) {
72
+ try {
73
+ listener(frozen);
74
+ }
75
+ catch (error) {
76
+ console.warn("[SectionEngineCore] listener failed:", error);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ //# sourceMappingURL=SectionEngineCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionEngineCore.js","sourceRoot":"","sources":["../../../src/runtime/core/SectionEngineCore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EACN,wBAAwB,GAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMpD,MAAM,OAAO,iBAAiB;IACrB,KAAK,GAAuB,wBAAwB,EAAE,CAAC;IAC9C,SAAS,GAAG,IAAI,GAAG,EAA6B,CAAC;IAElE,6EAA6E;IAC7E,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,KAAyB;QACjC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,QAAmC;QAC5C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,QAAQ;gBAAE,OAAO;YACtB,QAAQ,GAAG,KAAK,CAAC;YACjB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC,CAAC;IACH,CAAC;IAED,wCAAwC;IACxC,gBAAgB;QACf,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEO,MAAM,CAAC,OAA8B;QAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9C,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;YACjC,IAAI,CAAC;gBACJ,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Cohort identity for the section runtime engine (M7).
3
+ *
4
+ * One cohort is the tuple `(sectionId, attemptId)` for the section the
5
+ * host is currently rendering. Stage progression, readiness latches, and
6
+ * `pie-loading-complete` emission are all gated on this tuple — when it
7
+ * changes, the engine emits `disposed` for the outgoing cohort and
8
+ * resets to `composed` for the new one.
9
+ *
10
+ * `attemptId` is optional in the public surface (per the toolkit /
11
+ * layout-CE prop shape) but the engine carries it as the empty string
12
+ * when absent so the cohort key is total.
13
+ */
14
+ export interface CohortKey {
15
+ /** Section identifier; required for any non-idle cohort. */
16
+ sectionId: string;
17
+ /** Attempt identifier; empty string if the host did not provide one. */
18
+ attemptId: string;
19
+ }
20
+ /**
21
+ * Stable string form of the cohort tuple used as a key for the
22
+ * `loadingCompleteEmittedForCohort` latch and equality checks.
23
+ */
24
+ export declare function cohortKey(cohort: CohortKey | null): string;
25
+ /**
26
+ * `true` iff the two cohorts have the same `(sectionId, attemptId)` pair.
27
+ * Treats both inputs as identifying the cohort by value, never by
28
+ * reference.
29
+ */
30
+ export declare function cohortsEqual(a: CohortKey | null, b: CohortKey | null): boolean;
31
+ /**
32
+ * Normalize host-provided `(sectionId, attemptId)` into a cohort. Returns
33
+ * `null` when the section identifier is empty — that is the engine's
34
+ * idle state (no cohort).
35
+ */
36
+ export declare function makeCohort(args: {
37
+ sectionId: string | null | undefined;
38
+ attemptId: string | null | undefined;
39
+ }): CohortKey | null;
40
+ //# sourceMappingURL=cohort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cohort.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/cohort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,SAAS;IACzB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAI9E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAChC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACrC,GAAG,SAAS,GAAG,IAAI,CAOnB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Cohort identity for the section runtime engine (M7).
3
+ *
4
+ * One cohort is the tuple `(sectionId, attemptId)` for the section the
5
+ * host is currently rendering. Stage progression, readiness latches, and
6
+ * `pie-loading-complete` emission are all gated on this tuple — when it
7
+ * changes, the engine emits `disposed` for the outgoing cohort and
8
+ * resets to `composed` for the new one.
9
+ *
10
+ * `attemptId` is optional in the public surface (per the toolkit /
11
+ * layout-CE prop shape) but the engine carries it as the empty string
12
+ * when absent so the cohort key is total.
13
+ */
14
+ /**
15
+ * Stable string form of the cohort tuple used as a key for the
16
+ * `loadingCompleteEmittedForCohort` latch and equality checks.
17
+ */
18
+ export function cohortKey(cohort) {
19
+ if (!cohort)
20
+ return "";
21
+ return `${cohort.sectionId}|${cohort.attemptId}`;
22
+ }
23
+ /**
24
+ * `true` iff the two cohorts have the same `(sectionId, attemptId)` pair.
25
+ * Treats both inputs as identifying the cohort by value, never by
26
+ * reference.
27
+ */
28
+ export function cohortsEqual(a, b) {
29
+ if (a === b)
30
+ return true;
31
+ if (!a || !b)
32
+ return false;
33
+ return a.sectionId === b.sectionId && a.attemptId === b.attemptId;
34
+ }
35
+ /**
36
+ * Normalize host-provided `(sectionId, attemptId)` into a cohort. Returns
37
+ * `null` when the section identifier is empty — that is the engine's
38
+ * idle state (no cohort).
39
+ */
40
+ export function makeCohort(args) {
41
+ const sectionId = args.sectionId ?? "";
42
+ if (!sectionId)
43
+ return null;
44
+ return {
45
+ sectionId,
46
+ attemptId: args.attemptId ?? "",
47
+ };
48
+ }
49
+ //# sourceMappingURL=cohort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cohort.js","sourceRoot":"","sources":["../../../src/runtime/core/cohort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAAwB;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,CAAmB,EAAE,CAAmB;IACpE,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAG1B;IACA,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5B,OAAO;QACN,SAAS;QACT,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;KAC/B,CAAC;AACH,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Section runtime engine inputs (M7 — Variant C, layered core).
3
+ *
4
+ * Inputs are the discriminated union of events the adapter (PR 2) feeds
5
+ * into the pure transition function (`engine-transition.ts`). The shape
6
+ * is closed: every field is plain data so the transition can be tested
7
+ * without any DOM, Svelte, or coordinator wiring.
8
+ *
9
+ * Adapter→core boundary contract:
10
+ * - The adapter never mutates engine state directly. It always
11
+ * constructs an input and calls `core.dispatch(input)`.
12
+ * - Inputs are total: an unhandled `kind` is a programming error
13
+ * (the transition uses `assertNever` exhaustiveness).
14
+ * - Inputs carry only data, never live host references that would
15
+ * pin lifetime. Coordinator and controller handles live in the
16
+ * adapter; the core only sees readiness signals derived from them.
17
+ */
18
+ import type { CohortKey } from "./cohort.js";
19
+ import type { EffectiveRuntime, RuntimeInputs } from "./engine-resolver.js";
20
+ import type { EngineReadinessSignals } from "./engine-readiness.js";
21
+ import type { FrameworkErrorModel } from "../../services/framework-error.js";
22
+ /**
23
+ * `initialize` is the first transition out of `idle`. It carries the
24
+ * cohort key and the resolved runtime/tools snapshot for the cohort.
25
+ * The adapter constructs this input after running the resolver against
26
+ * the host's two-tier inputs.
27
+ */
28
+ export type EngineInputInitialize = {
29
+ kind: "initialize";
30
+ cohort: CohortKey;
31
+ effectiveRuntime: EffectiveRuntime;
32
+ effectiveToolsConfig: unknown;
33
+ itemCount: number;
34
+ };
35
+ /**
36
+ * `update-runtime` is sent when the host two-tier inputs change but
37
+ * the cohort does not. The transition stores the latest resolver
38
+ * output without changing phase; readiness gates and stage progression
39
+ * stay where they are.
40
+ */
41
+ export type EngineInputUpdateRuntime = {
42
+ kind: "update-runtime";
43
+ effectiveRuntime: EffectiveRuntime;
44
+ effectiveToolsConfig: unknown;
45
+ };
46
+ /**
47
+ * `cohort-change` is sent when `(sectionId, attemptId)` changes. The
48
+ * transition emits `disposed` for the outgoing cohort, resets state
49
+ * to `booting-section` for the new one, and re-arms latches.
50
+ */
51
+ export type EngineInputCohortChange = {
52
+ kind: "cohort-change";
53
+ cohort: CohortKey;
54
+ effectiveRuntime: EffectiveRuntime;
55
+ effectiveToolsConfig: unknown;
56
+ itemCount: number;
57
+ };
58
+ /**
59
+ * `section-controller-resolved` is sent when the coordinator returns
60
+ * the controller for the current cohort. Advances the phase from
61
+ * `booting-section` → `engine-ready` (assuming `composed` is already
62
+ * implied by `phase >= booting-section`, which the FSM treats as
63
+ * monotonic).
64
+ */
65
+ export type EngineInputSectionControllerResolved = {
66
+ kind: "section-controller-resolved";
67
+ };
68
+ /**
69
+ * `update-readiness-signals` carries the latest readiness snapshot
70
+ * from the host. The transition uses it to gate the move into
71
+ * `interactive` and to decide whether to emit `loading-complete`.
72
+ *
73
+ * The full signal set is sent every time so the transition does not
74
+ * have to reason about partial overlays.
75
+ */
76
+ export type EngineInputUpdateReadinessSignals = {
77
+ kind: "update-readiness-signals";
78
+ signals: EngineReadinessSignals;
79
+ loadedCount: number;
80
+ itemCount: number;
81
+ /**
82
+ * Strict-mode gate. When `"strict"`, `interactive` only fires
83
+ * after `allLoadingComplete`; in `"progressive"`, `interactionReady`
84
+ * is sufficient. Carried per-input so the host can reconfigure
85
+ * mode mid-cohort without re-initializing.
86
+ */
87
+ mode: "progressive" | "strict";
88
+ };
89
+ /**
90
+ * `framework-error` is sent for every framework-error report (M3
91
+ * canonical channel). The transition records the latest error in
92
+ * state and emits a `framework-error` output so the adapter can fan
93
+ * out to subscribers and the DOM event.
94
+ */
95
+ export type EngineInputFrameworkError = {
96
+ kind: "framework-error";
97
+ error: FrameworkErrorModel;
98
+ };
99
+ /**
100
+ * `dispose` tears the engine down. Emits `disposed` for the current
101
+ * cohort (if any) and moves to the terminal `disposed` phase. After
102
+ * dispose the engine accepts no further inputs (the transition logs
103
+ * a warning and is a no-op).
104
+ */
105
+ export type EngineInputDispose = {
106
+ kind: "dispose";
107
+ };
108
+ export type SectionEngineInput = EngineInputInitialize | EngineInputUpdateRuntime | EngineInputCohortChange | EngineInputSectionControllerResolved | EngineInputUpdateReadinessSignals | EngineInputFrameworkError | EngineInputDispose;
109
+ /**
110
+ * Convenience re-export so the adapter can import `RuntimeInputs`
111
+ * from a single place when it constructs `initialize` inputs.
112
+ */
113
+ export type { RuntimeInputs };
114
+ //# sourceMappingURL=engine-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-input.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/engine-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACX,gBAAgB,EAChB,aAAa,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,gBAAgB,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,SAAS,CAAC;IAClB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IAClD,IAAI,EAAE,6BAA6B,CAAC;CACpC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC/C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,sBAAsB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,IAAI,EAAE,aAAa,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,SAAS,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC3B,qBAAqB,GACrB,wBAAwB,GACxB,uBAAuB,GACvB,oCAAoC,GACpC,iCAAiC,GACjC,yBAAyB,GACzB,kBAAkB,CAAC;AAEtB;;;GAGG;AACH,YAAY,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Section runtime engine inputs (M7 — Variant C, layered core).
3
+ *
4
+ * Inputs are the discriminated union of events the adapter (PR 2) feeds
5
+ * into the pure transition function (`engine-transition.ts`). The shape
6
+ * is closed: every field is plain data so the transition can be tested
7
+ * without any DOM, Svelte, or coordinator wiring.
8
+ *
9
+ * Adapter→core boundary contract:
10
+ * - The adapter never mutates engine state directly. It always
11
+ * constructs an input and calls `core.dispatch(input)`.
12
+ * - Inputs are total: an unhandled `kind` is a programming error
13
+ * (the transition uses `assertNever` exhaustiveness).
14
+ * - Inputs carry only data, never live host references that would
15
+ * pin lifetime. Coordinator and controller handles live in the
16
+ * adapter; the core only sees readiness signals derived from them.
17
+ */
18
+ export {};
19
+ //# sourceMappingURL=engine-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-input.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}