@pie-players/pie-assessment-toolkit 0.3.73 → 0.3.75

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 (274) hide show
  1. package/README.md +469 -318
  2. package/dist/attempt/AssessmentSession.d.ts +1 -5
  3. package/dist/attempt/AssessmentSession.js +0 -29
  4. package/dist/attempt/TestSession.d.ts +1 -20
  5. package/dist/attempt/TestSession.js +8 -99
  6. package/dist/components/ItemScope.custom-element.d.ts +1 -0
  7. package/dist/components/ItemScope.custom-element.js +1 -0
  8. package/dist/components/ItemToolBar.custom-element.d.ts +1 -0
  9. package/dist/components/ItemToolBar.custom-element.js +1 -1
  10. package/dist/components/PieAssessmentToolkit.custom-element.d.ts +1 -0
  11. package/dist/components/PieAssessmentToolkit.custom-element.js +13 -13
  12. package/dist/components/SectionToolBar.custom-element.d.ts +1 -0
  13. package/dist/components/SectionToolBar.custom-element.js +1 -1
  14. package/dist/components/chunks/ItemToolBar-7tt7v2xp.js +4 -0
  15. package/dist/components/chunks/ItemToolBar-97hx60z4.js +2 -0
  16. package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +2 -0
  17. package/dist/components/chunks/ItemToolBar-jx38w99s.js +2 -0
  18. package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +40 -0
  19. package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
  20. package/dist/components/chunks/sre-engine-jd8cc08x.js +1 -0
  21. package/dist/components/item-scope-element.d.ts +2 -0
  22. package/dist/components/item-scope-element.js +2 -0
  23. package/dist/context/assessment-toolkit-context.d.ts +32 -6
  24. package/dist/index.d.ts +23 -48
  25. package/dist/index.js +12 -37
  26. package/dist/policy/core/PolicySource.d.ts +1 -1
  27. package/dist/policy/core/ToolPolicyEngine.d.ts +85 -34
  28. package/dist/policy/core/ToolPolicyEngine.js +148 -46
  29. package/dist/policy/core/compose-decision.d.ts +28 -7
  30. package/dist/policy/core/compose-decision.js +75 -54
  31. package/dist/policy/core/decision-types.d.ts +65 -34
  32. package/dist/policy/core/feature-decision.d.ts +16 -9
  33. package/dist/policy/core/feature-decision.js +14 -8
  34. package/dist/policy/core/pnp-policy-inputs.d.ts +24 -33
  35. package/dist/policy/core/pnp-policy-inputs.js +28 -56
  36. package/dist/policy/core/provenance.d.ts +9 -4
  37. package/dist/policy/core/provenance.js +1 -1
  38. package/dist/policy/engine.d.ts +7 -23
  39. package/dist/policy/engine.js +5 -20
  40. package/dist/policy/sources/PnpPolicySource.d.ts +44 -61
  41. package/dist/policy/sources/PnpPolicySource.js +117 -118
  42. package/dist/runtime/SectionControllerBinding.d.ts +279 -0
  43. package/dist/runtime/SectionControllerBinding.js +450 -0
  44. package/dist/runtime/SectionRuntimeEngine.d.ts +26 -289
  45. package/dist/runtime/SectionRuntimeEngine.js +30 -372
  46. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +19 -80
  47. package/dist/runtime/adapter/SectionEngineAdapter.js +19 -92
  48. package/dist/runtime/adapter/dom-event-bridge.d.ts +15 -30
  49. package/dist/runtime/adapter/dom-event-bridge.js +17 -44
  50. package/dist/runtime/adapter/subscriber-fanout.d.ts +1 -2
  51. package/dist/runtime/adapter/subscriber-fanout.js +1 -2
  52. package/dist/runtime/catalog-context.d.ts +19 -0
  53. package/dist/runtime/catalog-context.js +28 -0
  54. package/dist/runtime/composition-emit-scheduler.d.ts +9 -15
  55. package/dist/runtime/composition-emit-scheduler.js +9 -15
  56. package/dist/runtime/content-language.d.ts +32 -0
  57. package/dist/runtime/content-language.js +46 -0
  58. package/dist/runtime/content-region.d.ts +17 -0
  59. package/dist/runtime/content-region.js +29 -0
  60. package/dist/runtime/content-registration.d.ts +13 -0
  61. package/dist/runtime/content-registration.js +25 -0
  62. package/dist/runtime/core/SectionEngineCore.d.ts +2 -2
  63. package/dist/runtime/core/SectionEngineCore.js +2 -2
  64. package/dist/runtime/core/cohort.d.ts +1 -1
  65. package/dist/runtime/core/cohort.js +1 -1
  66. package/dist/runtime/core/engine-input.d.ts +18 -30
  67. package/dist/runtime/core/engine-input.js +11 -12
  68. package/dist/runtime/core/engine-output.d.ts +16 -40
  69. package/dist/runtime/core/engine-output.js +9 -21
  70. package/dist/runtime/core/engine-readiness.d.ts +5 -37
  71. package/dist/runtime/core/engine-readiness.js +8 -41
  72. package/dist/runtime/core/engine-resolver.d.ts +46 -74
  73. package/dist/runtime/core/engine-resolver.js +18 -43
  74. package/dist/runtime/core/engine-state.d.ts +28 -36
  75. package/dist/runtime/core/engine-state.js +18 -21
  76. package/dist/runtime/core/engine-transition.d.ts +14 -19
  77. package/dist/runtime/core/engine-transition.js +71 -51
  78. package/dist/runtime/engine.d.ts +16 -19
  79. package/dist/runtime/engine.js +12 -19
  80. package/dist/runtime/page-warnings.d.ts +13 -0
  81. package/dist/runtime/page-warnings.js +22 -0
  82. package/dist/runtime/policy-input-forwarding.d.ts +25 -0
  83. package/dist/runtime/policy-input-forwarding.js +25 -0
  84. package/dist/runtime/registration-events.d.ts +14 -0
  85. package/dist/runtime/runtime-event-claim.d.ts +8 -0
  86. package/dist/runtime/runtime-event-claim.js +15 -0
  87. package/dist/runtime/shell-event-bridge.d.ts +45 -0
  88. package/dist/runtime/shell-event-bridge.js +127 -0
  89. package/dist/runtime/shell-registration.d.ts +73 -0
  90. package/dist/runtime/shell-registration.js +95 -0
  91. package/dist/runtime/shell-scope.d.ts +68 -0
  92. package/dist/runtime/shell-scope.js +188 -0
  93. package/dist/runtime/tool-host-contract.d.ts +28 -10
  94. package/dist/runtime/tool-host-contract.js +31 -10
  95. package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
  96. package/dist/runtime/unclaimed-registration-watch.js +23 -0
  97. package/dist/services/ElementToolStateStore.d.ts +14 -10
  98. package/dist/services/ElementToolStateStore.js +37 -13
  99. package/dist/services/HighlightCoordinator.d.ts +22 -28
  100. package/dist/services/HighlightCoordinator.js +431 -327
  101. package/dist/services/RangeSerializer.d.ts +10 -1
  102. package/dist/services/RangeSerializer.js +87 -14
  103. package/dist/services/TTSService.d.ts +130 -69
  104. package/dist/services/TTSService.js +713 -570
  105. package/dist/services/ToolCoordinator.d.ts +43 -66
  106. package/dist/services/ToolCoordinator.js +164 -208
  107. package/dist/services/ToolRegistry.d.ts +78 -54
  108. package/dist/services/ToolRegistry.js +107 -105
  109. package/dist/services/ToolkitCoordinator.d.ts +261 -175
  110. package/dist/services/ToolkitCoordinator.js +667 -433
  111. package/dist/services/audio-handoff.d.ts +6 -7
  112. package/dist/services/audio-handoff.js +20 -14
  113. package/dist/services/catalog-owner.d.ts +11 -1
  114. package/dist/services/catalog-owner.js +25 -0
  115. package/dist/services/create-tools-config.d.ts +2 -2
  116. package/dist/services/framework-error-bus.d.ts +3 -6
  117. package/dist/services/framework-error-bus.js +3 -6
  118. package/dist/services/framework-error.d.ts +30 -8
  119. package/dist/services/framework-error.js +9 -7
  120. package/dist/services/interfaces.d.ts +158 -129
  121. package/dist/services/section-controller-types.d.ts +15 -0
  122. package/dist/services/section-session-assignment.d.ts +21 -0
  123. package/dist/services/section-session-assignment.js +82 -0
  124. package/dist/services/spoken-audio-cards.d.ts +0 -2
  125. package/dist/services/spoken-audio-cards.js +1 -3
  126. package/dist/services/tool-config-defaults.d.ts +3 -3
  127. package/dist/services/tool-config-defaults.js +3 -3
  128. package/dist/services/tool-config-validation.d.ts +14 -4
  129. package/dist/services/tool-config-validation.js +63 -71
  130. package/dist/services/tool-context.d.ts +0 -8
  131. package/dist/services/tool-context.js +29 -25
  132. package/dist/services/tool-icons.d.ts +4 -3
  133. package/dist/services/tool-icons.js +4 -3
  134. package/dist/services/tool-instance-id.d.ts +0 -1
  135. package/dist/services/tool-instance-id.js +0 -6
  136. package/dist/services/tool-providers/TTSToolProvider.d.ts +41 -80
  137. package/dist/services/tool-providers/TTSToolProvider.js +81 -40
  138. package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -4
  139. package/dist/services/tool-providers/ToolProviderRegistry.d.ts +32 -28
  140. package/dist/services/tool-providers/ToolProviderRegistry.js +121 -107
  141. package/dist/services/tool-providers/index.d.ts +0 -9
  142. package/dist/services/tool-providers/index.js +2 -4
  143. package/dist/services/tool-request.d.ts +27 -12
  144. package/dist/services/tool-request.js +24 -14
  145. package/dist/services/toolbar-decided-tools.d.ts +15 -0
  146. package/dist/services/toolbar-decided-tools.js +28 -0
  147. package/dist/services/tools-config-normalizer.d.ts +37 -23
  148. package/dist/services/tools-config-normalizer.js +2 -10
  149. package/dist/services/tts/browser-provider.d.ts +38 -2
  150. package/dist/services/tts/browser-provider.js +276 -140
  151. package/dist/services/tts/catalog-span-alignment.d.ts +2 -17
  152. package/dist/services/tts/catalog-span-alignment.js +17 -142
  153. package/dist/services/tts/flat-tree.d.ts +71 -0
  154. package/dist/services/tts/flat-tree.js +269 -0
  155. package/dist/services/tts/generated-speech/assemble-plan.d.ts +3 -1
  156. package/dist/services/tts/generated-speech/assemble-plan.js +3 -1
  157. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +2 -0
  158. package/dist/services/tts/generated-speech/dom/build-dom-plan.js +1 -1
  159. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +3 -1
  160. package/dist/services/tts/generated-speech/math-speech-cache.js +5 -1
  161. package/dist/services/tts/generated-speech/types.d.ts +0 -12
  162. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +12 -62
  163. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +38 -5
  164. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +3 -6
  165. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +6 -4
  166. package/dist/services/tts/highlight-pipeline/readable-region.js +3 -2
  167. package/dist/services/tts/highlight-pipeline/types.d.ts +5 -0
  168. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +12 -0
  169. package/dist/services/tts/highlight-pipeline/visible-map-range.js +73 -7
  170. package/dist/services/tts/math-alignment/index.d.ts +0 -5
  171. package/dist/services/tts/math-alignment/index.js +5 -25
  172. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +9 -1
  173. package/dist/services/tts/math-alignment/speech-tokenizer.js +38 -36
  174. package/dist/services/tts/math-alignment/types.d.ts +4 -2
  175. package/dist/services/tts/math-aware-text-processing.d.ts +5 -1
  176. package/dist/services/tts/math-aware-text-processing.js +74 -18
  177. package/dist/services/tts/math-control-names.d.ts +21 -0
  178. package/dist/services/tts/math-control-names.js +142 -0
  179. package/dist/services/tts/math-speech.d.ts +16 -1
  180. package/dist/services/tts/math-speech.js +55 -19
  181. package/dist/services/tts/provider-options.d.ts +41 -0
  182. package/dist/services/tts/provider-options.js +1 -0
  183. package/dist/services/tts/sre-engine.d.ts +7 -0
  184. package/dist/services/tts/sre-engine.js +11 -0
  185. package/dist/services/tts/sre-locales.d.ts +14 -0
  186. package/dist/services/tts/sre-locales.js +57 -0
  187. package/dist/services/tts/ssml/spoken-text.d.ts +2 -26
  188. package/dist/services/tts/ssml/spoken-text.js +29 -0
  189. package/dist/services/tts/start-failure.d.ts +11 -0
  190. package/dist/services/tts/start-failure.js +19 -0
  191. package/dist/services/tts/text-processing.d.ts +9 -1
  192. package/dist/services/tts/text-processing.js +46 -34
  193. package/dist/services/tts/text-segmentation.d.ts +7 -0
  194. package/dist/services/tts/text-segmentation.js +47 -0
  195. package/dist/services/tts-runtime-config.d.ts +44 -18
  196. package/dist/services/tts-runtime-config.js +22 -93
  197. package/dist/tools/content-capability-resolution.d.ts +7 -9
  198. package/dist/tools/content-capability-resolution.js +8 -45
  199. package/dist/tools/registration.d.ts +58 -0
  200. package/dist/tools/registration.js +54 -0
  201. package/dist/tools/registrations/toolbar-registration-helpers.js +2 -2
  202. package/dist/tools/tool-surface-host.d.ts +6 -10
  203. package/dist/tools/tool-surface-host.js +44 -42
  204. package/dist/tools/tool-tag-map.d.ts +5 -15
  205. package/dist/tools/tool-tag-map.js +6 -20
  206. package/dist/utils/structural-equality.d.ts +11 -0
  207. package/dist/utils/structural-equality.js +47 -0
  208. package/package.json +24 -59
  209. package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -49
  210. package/dist/attempt/adapters/activity-to-test-attempt-session.js +0 -138
  211. package/dist/components/chunks/ItemToolBar-byq80z42.js +0 -40
  212. package/dist/components/chunks/ItemToolBar-d36g3aw4.js +0 -49
  213. package/dist/context/runtime-context-consumer.d.ts +0 -13
  214. package/dist/context/runtime-context-consumer.js +0 -51
  215. package/dist/item-loader.d.ts +0 -44
  216. package/dist/item-loader.js +0 -61
  217. package/dist/policy/core/engine-context.d.ts +0 -29
  218. package/dist/policy/core/engine-context.js +0 -27
  219. package/dist/policy/core/policy-source-tag.d.ts +0 -31
  220. package/dist/policy/core/policy-source-tag.js +0 -28
  221. package/dist/policy/internal.d.ts +0 -25
  222. package/dist/policy/internal.js +0 -25
  223. package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -92
  224. package/dist/runtime/adapter/coordinator-bridge.js +0 -126
  225. package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -36
  226. package/dist/runtime/adapter/framework-error-bridge.js +0 -46
  227. package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -31
  228. package/dist/runtime/adapter/instrumentation-bridge.js +0 -38
  229. package/dist/runtime/core/engine-stage-derivation.d.ts +0 -18
  230. package/dist/runtime/core/engine-stage-derivation.js +0 -29
  231. package/dist/runtime/engine-context.d.ts +0 -39
  232. package/dist/runtime/engine-context.js +0 -31
  233. package/dist/runtime/internal.d.ts +0 -43
  234. package/dist/runtime/internal.js +0 -45
  235. package/dist/runtime/section-runtime-engine-host-context.d.ts +0 -80
  236. package/dist/runtime/section-runtime-engine-host-context.js +0 -95
  237. package/dist/runtime/stage-emit-gate.d.ts +0 -92
  238. package/dist/runtime/stage-emit-gate.js +0 -82
  239. package/dist/services/I18nService.d.ts +0 -47
  240. package/dist/services/I18nService.js +0 -84
  241. package/dist/services/ThemeProvider.d.ts +0 -95
  242. package/dist/services/ThemeProvider.js +0 -334
  243. package/dist/services/ToolConfigResolver.d.ts +0 -161
  244. package/dist/services/ToolConfigResolver.js +0 -229
  245. package/dist/services/catalog-media.d.ts +0 -56
  246. package/dist/services/catalog-media.js +0 -190
  247. package/dist/services/createDefaultToolRegistry.d.ts +0 -53
  248. package/dist/services/createDefaultToolRegistry.js +0 -45
  249. package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -21
  250. package/dist/services/defaultPersonalNeedsProfile.js +0 -26
  251. package/dist/services/pnp-standard-features.d.ts +0 -238
  252. package/dist/services/pnp-standard-features.js +0 -338
  253. package/dist/services/tool-providers/CortexToolProvider.d.ts +0 -13
  254. package/dist/services/tool-providers/CortexToolProvider.js +0 -32
  255. package/dist/services/tool-providers/DesmosToolProvider.d.ts +0 -14
  256. package/dist/services/tool-providers/DesmosToolProvider.js +0 -32
  257. package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +0 -16
  258. package/dist/services/tool-providers/GeoGebraToolProvider.js +0 -32
  259. package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +0 -35
  260. package/dist/services/tool-providers/LazyCalculatorToolProvider.js +0 -95
  261. package/dist/services/tts/visual-line-ranges.d.ts +0 -18
  262. package/dist/services/tts/visual-line-ranges.js +0 -226
  263. package/dist/tools/client.d.ts +0 -12
  264. package/dist/tools/client.js +0 -14
  265. package/dist/tools/index.d.ts +0 -8
  266. package/dist/tools/index.js +0 -10
  267. package/dist/tools/internal.d.ts +0 -43
  268. package/dist/tools/internal.js +0 -41
  269. package/dist/tools/response-discovery.d.ts +0 -61
  270. package/dist/tools/response-discovery.js +0 -113
  271. package/dist/tools/types.d.ts +0 -337
  272. package/dist/tools/types.js +0 -12
  273. package/dist/tools/variant-resolver.d.ts +0 -41
  274. package/dist/tools/variant-resolver.js +0 -207
@@ -1,11 +1,9 @@
1
1
  /**
2
- * Section runtime engine resolver (M7).
2
+ * Section runtime engine resolver.
3
3
  *
4
4
  * Canonical home of `resolveRuntime`, `resolveToolsConfig`, and their
5
- * supporting helpers/types. As of M7 PR 7 the previous duplicates in
6
- * `packages/section-player/src/components/shared/section-player-runtime.ts`
7
- * have been deleted; section-player now consumes these helpers via
8
- * `@pie-players/pie-assessment-toolkit/runtime/internal`.
5
+ * supporting helpers/types; section-player consumes them through
6
+ * `@pie-players/pie-assessment-toolkit/runtime/engine`.
9
7
  *
10
8
  * What is NOT absorbed in this module:
11
9
  * - `resolvePlayerRuntime` stays in section-player because it depends on
@@ -18,33 +16,26 @@
18
16
  * `packages/section-player/src/components/shared/section-player-host-runtime.ts`)
19
17
  * hands its local implementation in.
20
18
  *
21
- * Runtime-owned configuration flows through `runtime.<key>`. Layout-only
22
- * inputs stay on the section-player host elements.
19
+ * Each input has one tier. `assessmentId`, the tools and player config and the
20
+ * `on*` callbacks arrive on `runtime`. The primitive inputs (`nds-icons`,
21
+ * `locale`, `tool-config-strictness`) are element attributes; the resolver takes
22
+ * `toolConfigStrictness` beside `runtime`.
23
23
  */
24
- export const DEFAULT_ASSESSMENT_ID = "section-demo-direct";
25
24
  export const DEFAULT_PLAYER_TYPE = "iife";
26
- export const DEFAULT_LAZY_INIT = true;
25
+ export const DEFAULT_LAZY_INIT = false;
27
26
  export const DEFAULT_ISOLATION = "inherit";
28
27
  export const DEFAULT_ENV = { mode: "gather", role: "student" };
29
28
  /**
30
- * Pick the runtime-tier value when defined, otherwise the prop/attribute
31
- * value. The strict mirror rule means every tier-1 surface is resolved
32
- * with this single helper; per-feature special-casing is forbidden.
29
+ * The id a section runs under: the host's `section-id`, else the section's own
30
+ * `identifier`, else one named after the assessment. The toolkit keys the
31
+ * section's controller by it, and the layout kernel its stage cohort.
33
32
  */
34
- function pick(runtimeVal, attrVal) {
35
- return runtimeVal !== undefined ? runtimeVal : attrVal;
36
- }
37
- /**
38
- * Resolve the canonical `onFrameworkError` handler from the two-tier
39
- * surface. Precedence (highest first): `runtime.onFrameworkError`,
40
- * then top-level `onFrameworkError`. Layout CEs and the kernel call
41
- * this so every entry point converges on the same handler.
42
- */
43
- export function resolveOnFrameworkError(args) {
44
- const r = args.runtime ?? {};
45
- if (r.onFrameworkError !== undefined)
46
- return r.onFrameworkError;
47
- return args.onFrameworkError;
33
+ export function resolveSectionId(args) {
34
+ const identifier = args.section
35
+ ?.identifier;
36
+ return (args.sectionId ||
37
+ (typeof identifier === "string" ? identifier : "") ||
38
+ `section-${args.assessmentId || "default"}`);
48
39
  }
49
40
  export function resolveToolsConfig(args) {
50
41
  const runtimeTools = (args.runtime?.tools || {});
@@ -58,7 +49,6 @@ export function resolveRuntime(args) {
58
49
  const runtimePlayer = r.player ? { ...r.player } : null;
59
50
  return {
60
51
  ...r,
61
- assessmentId: pick(r.assessmentId, args.assessmentId),
62
52
  playerType: r.playerType ?? DEFAULT_PLAYER_TYPE,
63
53
  player: runtimePlayer,
64
54
  lazyInit: r.lazyInit ?? DEFAULT_LAZY_INIT,
@@ -67,17 +57,7 @@ export function resolveRuntime(args) {
67
57
  createSectionController: r.createSectionController,
68
58
  isolation: r.isolation ?? DEFAULT_ISOLATION,
69
59
  env: r.env ?? DEFAULT_ENV,
70
- toolConfigStrictness: pick(r.toolConfigStrictness, args.toolConfigStrictness) ?? "error",
71
- // Runtime callback wins; top-level callback remains a layout CE event
72
- // convenience for hosts that do not use DOM listeners.
73
- onFrameworkError: resolveOnFrameworkError({
74
- runtime: args.runtime,
75
- onFrameworkError: args.onFrameworkError,
76
- }),
77
- // Runtime callback wins over the top-level callback prop.
78
- onStageChange: pick(r.onStageChange, args.onStageChange),
79
- // Runtime callback wins over the top-level callback prop.
80
- onLoadingComplete: pick(r.onLoadingComplete, args.onLoadingComplete),
60
+ toolConfigStrictness: args.toolConfigStrictness ?? "error",
81
61
  tools: args.effectiveToolsConfig,
82
62
  };
83
63
  }
@@ -88,18 +68,13 @@ export function resolveRuntime(args) {
88
68
  * stays free of host-coupled defaults (`DEFAULT_PLAYER_DEFINITIONS`).
89
69
  */
90
70
  export function resolveSectionEngineRuntimeState(args, deps) {
91
- const assessmentId = args.assessmentId ?? DEFAULT_ASSESSMENT_ID;
92
71
  const effectiveToolsConfig = resolveToolsConfig({
93
72
  runtime: args.runtime,
94
73
  });
95
74
  const effectiveRuntime = resolveRuntime({
96
- assessmentId,
97
75
  runtime: args.runtime,
98
76
  effectiveToolsConfig,
99
77
  toolConfigStrictness: args.toolConfigStrictness,
100
- onFrameworkError: args.onFrameworkError,
101
- onStageChange: args.onStageChange,
102
- onLoadingComplete: args.onLoadingComplete,
103
78
  });
104
79
  const playerRuntime = deps.resolvePlayerRuntime({
105
80
  effectiveRuntime: effectiveRuntime,
@@ -1,33 +1,30 @@
1
1
  /**
2
- * Section runtime engine state (M7 — Variant C, layered core).
2
+ * Section runtime engine state.
3
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.
4
+ * The state object is the single source of truth for stage, cohort and
5
+ * readiness signals across one engine instance. The transition function in
6
+ * `engine-transition.ts` is its only mutator; the adapter reads it through
7
+ * `SectionEngineCore.getState()`.
10
8
  *
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:
9
+ * Phases map onto the canonical stages:
13
10
  *
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`.
11
+ * `idle` → no cohort yet. No stage.
12
+ * `booting-section` → cohort known, controller pending. Stage `composed`.
13
+ * `engine-ready` → controller resolved. Stage `engine-ready`.
14
+ * `interactive` → readiness gate satisfied. Stage `interactive`.
15
+ * `failed` → a runtime error ended the cohort's chain before
16
+ * `interactive`. No stage of its own: the transition
17
+ * records the stages it did not reach as `failed` and
18
+ * `skipped`.
19
+ * `disposed` → engine torn down. Stage `disposed`.
19
20
  *
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.
21
+ * `loading-complete` is an output, emitted once per cohort when the readiness
22
+ * signals report every item loaded.
25
23
  */
26
24
  import type { CohortKey } from "./cohort.js";
27
25
  import type { EffectiveRuntime } from "./engine-resolver.js";
28
26
  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";
27
+ export type SectionEnginePhase = "idle" | "booting-section" | "engine-ready" | "interactive" | "failed" | "disposed";
31
28
  export type SectionEngineState = {
32
29
  /** Current FSM phase. The single source of truth for stage derivation. */
33
30
  phase: SectionEnginePhase;
@@ -45,13 +42,17 @@ export type SectionEngineState = {
45
42
  */
46
43
  controllerResolved: boolean;
47
44
  /**
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.
45
+ * Readiness signal snapshot, replaced by each `update-readiness-signals`
46
+ * input from the host. Strict-mode gating is applied at derivation time
47
+ * through `resolveReadinessGates`.
53
48
  */
54
49
  readinessSignals: EngineReadinessSignals;
50
+ /**
51
+ * Readiness mode of the last `update-readiness-signals` input. Kept with
52
+ * the signals so `section-controller-resolved` can apply a snapshot that
53
+ * arrived while the controller was pending.
54
+ */
55
+ readinessMode: "progressive" | "strict";
55
56
  /** Last resolved effective runtime (output of `resolveRuntime`). */
56
57
  effectiveRuntime: EffectiveRuntime | null;
57
58
  /** Last resolved tools config. */
@@ -63,17 +64,8 @@ export type SectionEngineState = {
63
64
  * preserved by gating emission on this flag in the transition.
64
65
  */
65
66
  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. */
67
+ /** Number of items in the current cohort's composition. */
74
68
  itemCount: number;
75
- /** Number of items reported as loaded. */
76
- loadedCount: number;
77
69
  };
78
70
  /**
79
71
  * Initial state. Kept as a function so callers cannot mutate a shared
@@ -1,27 +1,25 @@
1
1
  /**
2
- * Section runtime engine state (M7 — Variant C, layered core).
2
+ * Section runtime engine state.
3
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.
4
+ * The state object is the single source of truth for stage, cohort and
5
+ * readiness signals across one engine instance. The transition function in
6
+ * `engine-transition.ts` is its only mutator; the adapter reads it through
7
+ * `SectionEngineCore.getState()`.
10
8
  *
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:
9
+ * Phases map onto the canonical stages:
13
10
  *
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`.
11
+ * `idle` → no cohort yet. No stage.
12
+ * `booting-section` → cohort known, controller pending. Stage `composed`.
13
+ * `engine-ready` → controller resolved. Stage `engine-ready`.
14
+ * `interactive` → readiness gate satisfied. Stage `interactive`.
15
+ * `failed` → a runtime error ended the cohort's chain before
16
+ * `interactive`. No stage of its own: the transition
17
+ * records the stages it did not reach as `failed` and
18
+ * `skipped`.
19
+ * `disposed` → engine torn down. Stage `disposed`.
19
20
  *
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.
21
+ * `loading-complete` is an output, emitted once per cohort when the readiness
22
+ * signals report every item loaded.
25
23
  */
26
24
  /**
27
25
  * Initial state. Kept as a function so callers cannot mutate a shared
@@ -38,11 +36,10 @@ export function createInitialEngineState() {
38
36
  allLoadingComplete: false,
39
37
  runtimeError: false,
40
38
  },
39
+ readinessMode: "progressive",
41
40
  effectiveRuntime: null,
42
41
  effectiveToolsConfig: null,
43
42
  loadingCompleteEmitted: false,
44
- lastFrameworkError: null,
45
43
  itemCount: 0,
46
- loadedCount: 0,
47
44
  };
48
45
  }
@@ -1,36 +1,31 @@
1
1
  /**
2
- * Pure transition function for the section runtime engine (M7 — Variant
3
- * C, layered core).
2
+ * Pure transition function for the section runtime engine.
4
3
  *
5
4
  * `transition(state, input)` is total over `(state, input)` pairs and
6
5
  * 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.).
6
+ * - the next `SectionEngineState` (the input state object is never
7
+ * mutated);
8
+ * - the ordered list of `SectionEngineOutput`s the adapter dispatches.
11
9
  *
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.
10
+ * The function imports nothing from Svelte, the DOM, or the coordinator;
11
+ * `scripts/check-engine-core-purity.mjs` enforces that.
15
12
  *
16
13
  * Phase machine (per `engine-state.ts`):
17
14
  * 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)
15
+ * booting-section | engine-ready → failed → disposed
16
+ * (cohort-change emits `disposed` for the outgoing cohort and restarts at
17
+ * booting-section for the new one)
18
+ *
19
+ * A readiness update that reports `runtimeError` before `interactive` ends the
20
+ * chain: the first stage the cohort did not reach is recorded as `failed` and
21
+ * any after it as `skipped`, so a host waiting on `engine-ready` or
22
+ * `interactive` always hears an answer.
20
23
  *
21
24
  * Output ordering invariants:
22
25
  * 1. `stage-change` for stage advancement fires before any
23
26
  * `loading-complete` triggered by the same input.
24
27
  * 2. `loading-complete` fires once per cohort, gated on
25
28
  * `state.loadingCompleteEmitted`.
26
- * 3. `framework-error` outputs are independent of the stage chain
27
- * and do not move the phase.
28
- *
29
- * Readiness alias 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
29
  */
35
30
  import type { SectionEngineInput } from "./engine-input.js";
36
31
  import type { SectionEngineOutput } from "./engine-output.js";
@@ -1,41 +1,51 @@
1
1
  /**
2
- * Pure transition function for the section runtime engine (M7 — Variant
3
- * C, layered core).
2
+ * Pure transition function for the section runtime engine.
4
3
  *
5
4
  * `transition(state, input)` is total over `(state, input)` pairs and
6
5
  * 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.).
6
+ * - the next `SectionEngineState` (the input state object is never
7
+ * mutated);
8
+ * - the ordered list of `SectionEngineOutput`s the adapter dispatches.
11
9
  *
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.
10
+ * The function imports nothing from Svelte, the DOM, or the coordinator;
11
+ * `scripts/check-engine-core-purity.mjs` enforces that.
15
12
  *
16
13
  * Phase machine (per `engine-state.ts`):
17
14
  * 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)
15
+ * booting-section | engine-ready → failed → disposed
16
+ * (cohort-change emits `disposed` for the outgoing cohort and restarts at
17
+ * booting-section for the new one)
18
+ *
19
+ * A readiness update that reports `runtimeError` before `interactive` ends the
20
+ * chain: the first stage the cohort did not reach is recorded as `failed` and
21
+ * any after it as `skipped`, so a host waiting on `engine-ready` or
22
+ * `interactive` always hears an answer.
20
23
  *
21
24
  * Output ordering invariants:
22
25
  * 1. `stage-change` for stage advancement fires before any
23
26
  * `loading-complete` triggered by the same input.
24
27
  * 2. `loading-complete` fires once per cohort, gated on
25
28
  * `state.loadingCompleteEmitted`.
26
- * 3. `framework-error` outputs are independent of the stage chain
27
- * and do not move the phase.
28
- *
29
- * Readiness alias 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
29
  */
35
30
  import { cohortsEqual } from "./cohort.js";
36
- import { createReadinessDetail, } from "./engine-readiness.js";
37
- import { phaseToStage } from "./engine-stage-derivation.js";
31
+ import { resolveReadinessGates, } from "./engine-readiness.js";
38
32
  import { createInitialEngineState, } from "./engine-state.js";
33
+ /** `idle` and `failed` have no stage of their own. */
34
+ function phaseToStage(phase) {
35
+ switch (phase) {
36
+ case "idle":
37
+ case "failed":
38
+ return null;
39
+ case "booting-section":
40
+ return "composed";
41
+ case "engine-ready":
42
+ return "engine-ready";
43
+ case "interactive":
44
+ return "interactive";
45
+ case "disposed":
46
+ return "disposed";
47
+ }
48
+ }
39
49
  function emitStageChange(outputs, phase, cohort, status = "entered") {
40
50
  const stage = phaseToStage(phase);
41
51
  if (!stage)
@@ -52,6 +62,7 @@ function startCohort(args) {
52
62
  ...createInitialEngineState(),
53
63
  phase: "booting-section",
54
64
  cohort: args.cohort,
65
+ readinessMode: args.state.readinessMode,
55
66
  effectiveRuntime: args.effectiveRuntime,
56
67
  effectiveToolsConfig: args.effectiveToolsConfig,
57
68
  itemCount: args.itemCount,
@@ -60,26 +71,42 @@ function startCohort(args) {
60
71
  emitStageChange(outputs, "booting-section", args.cohort);
61
72
  return { state: next, outputs };
62
73
  }
74
+ /**
75
+ * End the chain of a cohort that has not reached `interactive`. Returns the
76
+ * `failed` phase after recording the stages it will not reach.
77
+ */
78
+ function failChain(outputs, phase, cohort) {
79
+ if (phase === "booting-section") {
80
+ emitStageChange(outputs, "engine-ready", cohort, "failed");
81
+ emitStageChange(outputs, "interactive", cohort, "skipped");
82
+ }
83
+ else {
84
+ emitStageChange(outputs, "interactive", cohort, "failed");
85
+ }
86
+ return "failed";
87
+ }
63
88
  /**
64
89
  * 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.
90
+ * the requested mode, end the chain on a runtime error before
91
+ * `interactive`, advance the phase to `interactive` when gated, and emit
92
+ * `loading-complete` once per cohort.
67
93
  */
68
94
  function applyReadinessUpdate(state, args) {
69
95
  if (state.phase === "idle" || state.phase === "disposed") {
70
96
  // No cohort to update; ignore.
71
97
  return { state, outputs: [] };
72
98
  }
73
- const detail = createReadinessDetail({
74
- mode: args.mode,
75
- signals: args.signals,
76
- });
99
+ const detail = resolveReadinessGates(args.mode, args.signals);
77
100
  const outputs = [];
78
101
  let phase = state.phase;
79
102
  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) {
103
+ if (args.signals.runtimeError &&
104
+ (phase === "booting-section" || phase === "engine-ready")) {
105
+ phase = failChain(outputs, phase, state.cohort);
106
+ }
107
+ else if (phase === "engine-ready" && detail.interactionReady) {
108
+ // engine-ready → interactive when readiness satisfies
109
+ // `interactionReady` (mode-aware via `resolveReadinessGates`).
83
110
  phase = "interactive";
84
111
  emitStageChange(outputs, phase, state.cohort);
85
112
  }
@@ -92,14 +119,13 @@ function applyReadinessUpdate(state, args) {
92
119
  kind: "loading-complete",
93
120
  cohort: state.cohort,
94
121
  itemCount: args.itemCount,
95
- loadedCount: args.loadedCount,
96
122
  });
97
123
  }
98
124
  const nextState = {
99
125
  ...state,
100
126
  phase,
101
127
  readinessSignals: args.signals,
102
- loadedCount: args.loadedCount,
128
+ readinessMode: args.mode,
103
129
  itemCount: args.itemCount,
104
130
  loadingCompleteEmitted,
105
131
  };
@@ -194,8 +220,8 @@ export function transition(state, input) {
194
220
  }
195
221
  case "section-controller-resolved": {
196
222
  if (state.phase !== "booting-section") {
197
- // Either too early (idle), too late (interactive / disposed),
198
- // or a duplicate notification; the FSM is monotonic.
223
+ // Either too early (idle), too late (interactive / failed /
224
+ // disposed), or a duplicate notification; the FSM is monotonic.
199
225
  return {
200
226
  state: { ...state, controllerResolved: true },
201
227
  outputs: [],
@@ -203,10 +229,20 @@ export function transition(state, input) {
203
229
  }
204
230
  const outputs = [];
205
231
  emitStageChange(outputs, "engine-ready", state.cohort);
232
+ // Readiness can be satisfied before the controller resolves: with
233
+ // preloaded elements the items load in the same flush as the
234
+ // composition. No later signal change would move the cohort on, so
235
+ // the stored snapshot gates `interactive` here.
236
+ let phase = "engine-ready";
237
+ if (resolveReadinessGates(state.readinessMode, state.readinessSignals)
238
+ .interactionReady) {
239
+ phase = "interactive";
240
+ emitStageChange(outputs, phase, state.cohort);
241
+ }
206
242
  return {
207
243
  state: {
208
244
  ...state,
209
- phase: "engine-ready",
245
+ phase,
210
246
  controllerResolved: true,
211
247
  },
212
248
  outputs,
@@ -216,25 +252,9 @@ export function transition(state, input) {
216
252
  return applyReadinessUpdate(state, {
217
253
  signals: input.signals,
218
254
  mode: input.mode,
219
- loadedCount: input.loadedCount,
220
255
  itemCount: input.itemCount,
221
256
  });
222
257
  }
223
- case "framework-error": {
224
- return {
225
- state: {
226
- ...state,
227
- lastFrameworkError: input.error,
228
- readinessSignals: {
229
- ...state.readinessSignals,
230
- runtimeError: input.error.recoverable === true
231
- ? state.readinessSignals.runtimeError
232
- : true,
233
- },
234
- },
235
- outputs: [{ kind: "framework-error", error: input.error }],
236
- };
237
- }
238
258
  case "dispose": {
239
259
  if (state.phase === "disposed") {
240
260
  return { state, outputs: [] };
@@ -1,23 +1,20 @@
1
1
  /**
2
- * Section runtime engine — facade entry point (M7 — Variant C).
2
+ * Section runtime engine — the stable entry for a host that drives a section's
3
+ * stage chain.
3
4
  *
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.
5
+ * Besides the `SectionRuntimeEngine` facade it carries the vocabulary of the
6
+ * facade's own surface: the inputs `dispatchInput` takes and the outputs
7
+ * `subscribe` delivers, the state `getState` returns, the runtime config and its
8
+ * resolution, the id a section runs under, the cohort an `initialize` or
9
+ * `cohort-change` input names, and the
10
+ * readiness signals. The section player's layout kernel is the host
11
+ * this was cut for. The engine's core, adapter and bridges stay behind the
12
+ * facade, with no entry of their own.
20
13
  */
21
14
  export { SectionRuntimeEngine, type SectionRuntimeEngineHostArgs, } from "./SectionRuntimeEngine.js";
22
- export { SECTION_RUNTIME_ENGINE_KEY, type SectionRuntimeEngineContext, } from "./engine-context.js";
23
- export { sectionRuntimeEngineHostContext, connectSectionRuntimeEngineHostContext, type SectionRuntimeLifecycleHandle, type SectionRuntimeEngineHostContextValue, type SectionRuntimeEngineHostContextListener, } from "./section-runtime-engine-host-context.js";
15
+ export type { SectionEngineInput } from "./core/engine-input.js";
16
+ export type { SectionEngineOutput } from "./core/engine-output.js";
17
+ export type { SectionEnginePhase, SectionEngineState, } from "./core/engine-state.js";
18
+ export { DEFAULT_ENV, DEFAULT_ISOLATION, DEFAULT_PLAYER_TYPE, resolveSectionEngineRuntimeState, resolveSectionId, type FrameworkErrorHandler, type LoadingCompleteHandler, type PlayerOverrides, type RuntimeConfig, type RuntimeInputs, type StageChangeHandler, } from "./core/engine-resolver.js";
19
+ export { cohortsEqual, makeCohort, type CohortKey } from "./core/cohort.js";
20
+ export type { EngineReadinessSignals } from "./core/engine-readiness.js";
@@ -1,23 +1,16 @@
1
1
  /**
2
- * Section runtime engine — facade entry point (M7 — Variant C).
2
+ * Section runtime engine — the stable entry for a host that drives a section's
3
+ * stage chain.
3
4
  *
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.
5
+ * Besides the `SectionRuntimeEngine` facade it carries the vocabulary of the
6
+ * facade's own surface: the inputs `dispatchInput` takes and the outputs
7
+ * `subscribe` delivers, the state `getState` returns, the runtime config and its
8
+ * resolution, the id a section runs under, the cohort an `initialize` or
9
+ * `cohort-change` input names, and the
10
+ * readiness signals. The section player's layout kernel is the host
11
+ * this was cut for. The engine's core, adapter and bridges stay behind the
12
+ * facade, with no entry of their own.
20
13
  */
21
14
  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";
15
+ export { DEFAULT_ENV, DEFAULT_ISOLATION, DEFAULT_PLAYER_TYPE, resolveSectionEngineRuntimeState, resolveSectionId, } from "./core/engine-resolver.js";
16
+ export { cohortsEqual, makeCohort } from "./core/cohort.js";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * How long a warning about a missing input waits when a host may still be
3
+ * supplying it, such as a toolkit or a registry loaded after mount.
4
+ */
5
+ export declare const PENDING_INPUT_WARNING_DELAY_MS = 10000;
6
+ /**
7
+ * Warns about a setup mistake once per document, across every copy of the
8
+ * toolkit loaded into it: the latch is a `Symbol.for` slot on the document, so
9
+ * the custom-element bundle and the modules a host imports share it. Not
10
+ * development-only, because the custom-element build compiles those branches
11
+ * out, and a host misconfigures in production as readily as anywhere.
12
+ */
13
+ export declare function warnOncePerDocument(doc: Document | null | undefined, key: string, message: string): void;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * How long a warning about a missing input waits when a host may still be
3
+ * supplying it, such as a toolkit or a registry loaded after mount.
4
+ */
5
+ export const PENDING_INPUT_WARNING_DELAY_MS = 10_000;
6
+ /**
7
+ * Warns about a setup mistake once per document, across every copy of the
8
+ * toolkit loaded into it: the latch is a `Symbol.for` slot on the document, so
9
+ * the custom-element bundle and the modules a host imports share it. Not
10
+ * development-only, because the custom-element build compiles those branches
11
+ * out, and a host misconfigures in production as readily as anywhere.
12
+ */
13
+ export function warnOncePerDocument(doc, key, message) {
14
+ if (!doc)
15
+ return;
16
+ const slot = Symbol.for(`pie.assessmentToolkit.warned.${key}`);
17
+ const latches = doc;
18
+ if (latches[slot])
19
+ return;
20
+ latches[slot] = true;
21
+ console.warn(message);
22
+ }