@pie-players/pie-assessment-toolkit 0.3.44 → 0.3.45
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.
- package/README.md +54 -69
- package/dist/components/ItemToolBar.custom-element.js +479 -324
- package/dist/components/PieAssessmentToolkit.custom-element.js +19498 -3590
- package/dist/components/SectionToolBar.custom-element.js +761 -507
- package/dist/index.d.ts +3 -6
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +1 -2
- package/dist/policy/core/ToolPolicyEngine.js +1 -2
- package/dist/policy/core/ToolPolicyEngine.js.map +1 -1
- package/dist/policy/core/pnp-policy-inputs.d.ts +2 -3
- package/dist/policy/core/pnp-policy-inputs.js +2 -3
- package/dist/policy/core/pnp-policy-inputs.js.map +1 -1
- package/dist/policy/core/provenance.d.ts +7 -34
- package/dist/policy/core/provenance.js +4 -21
- package/dist/policy/core/provenance.js.map +1 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +6 -19
- package/dist/policy/sources/PnpPolicySource.js +6 -19
- package/dist/policy/sources/PnpPolicySource.js.map +1 -1
- package/dist/runtime/SectionRuntimeEngine.d.ts +13 -28
- package/dist/runtime/SectionRuntimeEngine.js +13 -27
- package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts +2 -2
- package/dist/runtime/adapter/SectionEngineAdapter.js +2 -2
- package/dist/runtime/adapter/SectionEngineAdapter.js.map +1 -1
- package/dist/runtime/adapter/coordinator-bridge.d.ts +1 -1
- package/dist/runtime/adapter/coordinator-bridge.js +1 -1
- package/dist/runtime/adapter/coordinator-bridge.js.map +1 -1
- package/dist/runtime/adapter/dom-event-bridge.d.ts +1 -1
- package/dist/runtime/adapter/dom-event-bridge.js +1 -1
- package/dist/runtime/adapter/dom-event-bridge.js.map +1 -1
- package/dist/runtime/catalog-registration.d.ts +12 -0
- package/dist/runtime/catalog-registration.js +54 -0
- package/dist/runtime/catalog-registration.js.map +1 -0
- package/dist/runtime/core/engine-output.d.ts +2 -2
- package/dist/runtime/core/engine-output.js +2 -2
- package/dist/runtime/core/engine-output.js.map +1 -1
- package/dist/runtime/core/engine-readiness.d.ts +2 -2
- package/dist/runtime/core/engine-readiness.js.map +1 -1
- package/dist/runtime/core/engine-resolver.d.ts +13 -41
- package/dist/runtime/core/engine-resolver.js +19 -76
- package/dist/runtime/core/engine-resolver.js.map +1 -1
- package/dist/runtime/core/engine-transition.d.ts +1 -1
- package/dist/runtime/core/engine-transition.js +1 -1
- package/dist/runtime/core/engine-transition.js.map +1 -1
- package/dist/runtime/engine.d.ts +1 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/section-runtime-engine-host-context.d.ts +22 -15
- package/dist/runtime/section-runtime-engine-host-context.js +10 -10
- package/dist/runtime/section-runtime-engine-host-context.js.map +1 -1
- package/dist/runtime/stage-emit-gate.d.ts +4 -4
- package/dist/runtime/stage-emit-gate.js +3 -3
- package/dist/runtime/stage-emit-gate.js.map +1 -1
- package/dist/services/AccessibilityCatalogResolver.d.ts +23 -0
- package/dist/services/AccessibilityCatalogResolver.js +200 -28
- package/dist/services/AccessibilityCatalogResolver.js.map +1 -1
- package/dist/services/HighlightCoordinator.d.ts +25 -0
- package/dist/services/HighlightCoordinator.js +125 -0
- package/dist/services/HighlightCoordinator.js.map +1 -1
- package/dist/services/SSMLExtractor.d.ts +16 -1
- package/dist/services/SSMLExtractor.js +86 -7
- package/dist/services/SSMLExtractor.js.map +1 -1
- package/dist/services/TTSService.d.ts +30 -4
- package/dist/services/TTSService.js +652 -159
- package/dist/services/TTSService.js.map +1 -1
- package/dist/services/ToolRegistry.d.ts +2 -2
- package/dist/services/ToolRegistry.js +1 -1
- package/dist/services/ToolRegistry.js.map +1 -1
- package/dist/services/ToolkitCoordinator.d.ts +16 -73
- package/dist/services/ToolkitCoordinator.js +34 -113
- package/dist/services/ToolkitCoordinator.js.map +1 -1
- package/dist/services/interfaces.d.ts +20 -2
- package/dist/services/interfaces.js.map +1 -1
- package/dist/services/tool-config-validation.d.ts +1 -1
- package/dist/services/tool-config-validation.js +7 -7
- package/dist/services/tool-config-validation.js.map +1 -1
- package/dist/services/tool-instance-id.js +1 -1
- package/dist/services/tool-instance-id.js.map +1 -1
- package/dist/services/tool-providers/TTSToolProvider.js +3 -3
- package/dist/services/tool-providers/TTSToolProvider.js.map +1 -1
- package/dist/services/tools-config-normalizer.d.ts +13 -2
- package/dist/services/tools-config-normalizer.js +3 -8
- package/dist/services/tools-config-normalizer.js.map +1 -1
- package/dist/services/tts/browser-provider.js +2 -0
- package/dist/services/tts/browser-provider.js.map +1 -1
- package/dist/services/tts/catalog-span-alignment.d.ts +39 -0
- package/dist/services/tts/catalog-span-alignment.js +300 -0
- package/dist/services/tts/catalog-span-alignment.js.map +1 -0
- package/dist/services/tts/generated-speech/assemble-plan.d.ts +33 -0
- package/dist/services/tts/generated-speech/assemble-plan.js +111 -0
- package/dist/services/tts/generated-speech/assemble-plan.js.map +1 -0
- package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +25 -0
- package/dist/services/tts/generated-speech/dom/build-dom-plan.js +66 -0
- package/dist/services/tts/generated-speech/dom/build-dom-plan.js.map +1 -0
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +19 -0
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.js +71 -0
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.js.map +1 -0
- package/dist/services/tts/generated-speech/dom/types.d.ts +37 -0
- package/dist/services/tts/generated-speech/dom/types.js +2 -0
- package/dist/services/tts/generated-speech/dom/types.js.map +1 -0
- package/dist/services/tts/generated-speech/index.d.ts +17 -0
- package/dist/services/tts/generated-speech/index.js +17 -0
- package/dist/services/tts/generated-speech/index.js.map +1 -0
- package/dist/services/tts/generated-speech/math-speech-cache.d.ts +15 -0
- package/dist/services/tts/generated-speech/math-speech-cache.js +78 -0
- package/dist/services/tts/generated-speech/math-speech-cache.js.map +1 -0
- package/dist/services/tts/generated-speech/types.d.ts +104 -0
- package/dist/services/tts/generated-speech/types.js +18 -0
- package/dist/services/tts/generated-speech/types.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/boundary-normalizer.d.ts +2 -0
- package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +106 -0
- package/dist/services/tts/highlight-pipeline/boundary-normalizer.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.d.ts +6 -0
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +217 -0
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/highlight-policy.d.ts +2 -0
- package/dist/services/tts/highlight-pipeline/highlight-policy.js +32 -0
- package/dist/services/tts/highlight-pipeline/highlight-policy.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/index.d.ts +9 -0
- package/dist/services/tts/highlight-pipeline/index.js +9 -0
- package/dist/services/tts/highlight-pipeline/index.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/math-semantic-resolver.d.ts +3 -0
- package/dist/services/tts/highlight-pipeline/math-semantic-resolver.js +32 -0
- package/dist/services/tts/highlight-pipeline/math-semantic-resolver.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.d.ts +29 -0
- package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +44 -0
- package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.d.ts +2 -0
- package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +20 -0
- package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/readable-region.d.ts +1 -0
- package/dist/services/tts/highlight-pipeline/readable-region.js +19 -0
- package/dist/services/tts/highlight-pipeline/readable-region.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.d.ts +6 -0
- package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.js +198 -0
- package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/types.d.ts +72 -0
- package/dist/services/tts/highlight-pipeline/types.js +2 -0
- package/dist/services/tts/highlight-pipeline/types.js.map +1 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +2 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.js +22 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.js.map +1 -0
- package/dist/services/tts/math-alignment/index.d.ts +30 -0
- package/dist/services/tts/math-alignment/index.js +66 -0
- package/dist/services/tts/math-alignment/index.js.map +1 -0
- package/dist/services/tts/math-alignment/mathml-tokenizer.d.ts +2 -0
- package/dist/services/tts/math-alignment/mathml-tokenizer.js +317 -0
- package/dist/services/tts/math-alignment/mathml-tokenizer.js.map +1 -0
- package/dist/services/tts/math-alignment/range-resolver.d.ts +10 -0
- package/dist/services/tts/math-alignment/range-resolver.js +13 -0
- package/dist/services/tts/math-alignment/range-resolver.js.map +1 -0
- package/dist/services/tts/math-alignment/sequence-aligner.d.ts +7 -0
- package/dist/services/tts/math-alignment/sequence-aligner.js +119 -0
- package/dist/services/tts/math-alignment/sequence-aligner.js.map +1 -0
- package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +31 -0
- package/dist/services/tts/math-alignment/speech-tokenizer.js +143 -0
- package/dist/services/tts/math-alignment/speech-tokenizer.js.map +1 -0
- package/dist/services/tts/math-alignment/types.d.ts +58 -0
- package/dist/services/tts/math-alignment/types.js +2 -0
- package/dist/services/tts/math-alignment/types.js.map +1 -0
- package/dist/services/tts/math-aware-text-processing.d.ts +18 -0
- package/dist/services/tts/math-aware-text-processing.js +348 -0
- package/dist/services/tts/math-aware-text-processing.js.map +1 -0
- package/dist/services/tts/math-speech.d.ts +44 -0
- package/dist/services/tts/math-speech.js +147 -0
- package/dist/services/tts/math-speech.js.map +1 -0
- package/dist/services/tts/mathml-sanitization.d.ts +1 -0
- package/dist/services/tts/mathml-sanitization.js +170 -0
- package/dist/services/tts/mathml-sanitization.js.map +1 -0
- package/dist/services/tts/ssml/spoken-text.d.ts +33 -0
- package/dist/services/tts/ssml/spoken-text.js +159 -0
- package/dist/services/tts/ssml/spoken-text.js.map +1 -0
- package/dist/services/tts/text-processing.d.ts +3 -0
- package/dist/services/tts/text-processing.js +30 -4
- package/dist/services/tts/text-processing.js.map +1 -1
- package/dist/services/tts-runtime-config.d.ts +17 -1
- package/dist/services/tts-runtime-config.js +11 -1
- package/dist/services/tts-runtime-config.js.map +1 -1
- package/dist/tools/registrations/accessibility-tools.js +0 -1
- package/dist/tools/registrations/accessibility-tools.js.map +1 -1
- package/dist/tools/registrations/calculator.js +41 -2
- package/dist/tools/registrations/calculator.js.map +1 -1
- package/dist/tools/tool-tag-map.js +0 -1
- package/dist/tools/tool-tag-map.js.map +1 -1
- package/package.json +8 -11
- package/dist/services/PNPToolResolver.d.ts +0 -280
- package/dist/services/PNPToolResolver.js +0 -514
- package/dist/services/PNPToolResolver.js.map +0 -1
- package/dist/services/pnp-provenance.d.ts +0 -166
- package/dist/services/pnp-provenance.js +0 -231
- package/dist/services/pnp-provenance.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-transition.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAG3D,OAAO,EACN,qBAAqB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACN,wBAAwB,GAGxB,MAAM,mBAAmB,CAAC;AAO3B,SAAS,eAAe,CACvB,OAA8B,EAC9B,KAAyB,EACzB,MAAwB,EACxB,SAA2C,SAAS;IAEpD,MAAM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;gBACD,OAAO;aACP,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACT,MAAM,UAAU,GAAU,KAAK,CAAC;YAChC,KAAK,UAAU,CAAC;YAChB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/**\n * Pure transition function for the section runtime engine (M7 — Variant\n * C, layered core).\n *\n * `transition(state, input)` is total over `(state, input)` pairs and\n * returns:\n * - the next `SectionEngineState` (immutable; the input state object\n * is never mutated);\n * - the ordered list of `SectionEngineOutput`s the adapter must\n * dispatch (DOM events, framework-error fan-out, etc.).\n *\n * The function imports nothing from Svelte, the DOM, or the\n * coordinator. The `core/` constraint is enforced by the per-PR audit\n * step in the M7 implementation plan.\n *\n * Phase machine (per `engine-state.ts`):\n * idle → booting-section → engine-ready → interactive → disposed\n * (cohort-change rolls back to booting-section for the new cohort\n * after emitting `disposed` for the outgoing cohort)\n *\n * Output ordering invariants:\n * 1. `stage-change` for stage advancement fires before any\n * `loading-complete` triggered by the same input.\n * 2. `loading-complete` fires once per cohort, gated on\n * `state.loadingCompleteEmitted`.\n * 3. `framework-error` outputs are independent of the stage chain\n * and do not move the phase.\n *\n * The deprecated readiness output kinds (`readiness-change`,\n * `interaction-ready`, `ready`) and their DOM-event bridge were\n * removed in the broad architecture review compat sweep. Hosts that\n * need the readiness detail read it via the kernel's `selectReadiness`\n * / `getSnapshot` selectors or via `SectionEngineCore.getState()`.\n */\n\nimport { cohortsEqual, type CohortKey } from \"./cohort.js\";\nimport type { SectionEngineInput } from \"./engine-input.js\";\nimport type { SectionEngineOutput } from \"./engine-output.js\";\nimport {\n\tcreateReadinessDetail,\n\ttype EngineReadinessSignals,\n} from \"./engine-readiness.js\";\nimport { phaseToStage } from \"./engine-stage-derivation.js\";\nimport {\n\tcreateInitialEngineState,\n\ttype SectionEnginePhase,\n\ttype SectionEngineState,\n} from \"./engine-state.js\";\n\nexport interface TransitionResult {\n\tstate: SectionEngineState;\n\toutputs: SectionEngineOutput[];\n}\n\nfunction emitStageChange(\n\toutputs: SectionEngineOutput[],\n\tphase: SectionEnginePhase,\n\tcohort: CohortKey | null,\n\tstatus: \"entered\" | \"skipped\" | \"failed\" = \"entered\",\n): void {\n\tconst stage = phaseToStage(phase);\n\tif (!stage) return;\n\toutputs.push({ kind: \"stage-change\", stage, status, cohort });\n}\n\n/**\n * Transition the engine after `initialize` / `cohort-change`. Sets\n * the new cohort, resets latches, stores the resolved runtime/tools,\n * and emits the `composed` stage.\n */\nfunction startCohort(args: {\n\tstate: SectionEngineState;\n\tcohort: CohortKey;\n\teffectiveRuntime: SectionEngineState[\"effectiveRuntime\"];\n\teffectiveToolsConfig: unknown;\n\titemCount: number;\n}): { state: SectionEngineState; outputs: SectionEngineOutput[] } {\n\tconst next: SectionEngineState = {\n\t\t...createInitialEngineState(),\n\t\tphase: \"booting-section\",\n\t\tcohort: args.cohort,\n\t\teffectiveRuntime: args.effectiveRuntime,\n\t\teffectiveToolsConfig: args.effectiveToolsConfig,\n\t\titemCount: args.itemCount,\n\t};\n\tconst outputs: SectionEngineOutput[] = [];\n\temitStageChange(outputs, \"booting-section\", args.cohort);\n\treturn { state: next, outputs };\n}\n\n/**\n * Apply a readiness update: store new signals, derive the detail in\n * the requested mode, advance the phase to `interactive` when gated,\n * and emit `loading-complete` once per cohort.\n */\nfunction applyReadinessUpdate(\n\tstate: SectionEngineState,\n\targs: {\n\t\tsignals: EngineReadinessSignals;\n\t\tmode: \"progressive\" | \"strict\";\n\t\tloadedCount: number;\n\t\titemCount: number;\n\t},\n): TransitionResult {\n\tif (state.phase === \"idle\" || state.phase === \"disposed\") {\n\t\t// No cohort to update; ignore.\n\t\treturn { state, outputs: [] };\n\t}\n\n\tconst detail = createReadinessDetail({\n\t\tmode: args.mode,\n\t\tsignals: args.signals,\n\t});\n\tconst outputs: SectionEngineOutput[] = [];\n\n\tlet phase = state.phase;\n\tlet loadingCompleteEmitted = state.loadingCompleteEmitted;\n\n\t// Stage advancement: engine-ready → interactive when readiness\n\t// satisfies `interactionReady` (mode-aware via `createReadinessDetail`).\n\tif (phase === \"engine-ready\" && detail.interactionReady) {\n\t\tphase = \"interactive\";\n\t\temitStageChange(outputs, phase, state.cohort);\n\t}\n\n\t// Canonical `loading-complete` emission. One-shot per cohort, gated\n\t// on the readiness signals indicating every item has finished\n\t// loading.\n\tif (\n\t\tdetail.allLoadingComplete &&\n\t\tstate.cohort &&\n\t\t!loadingCompleteEmitted\n\t) {\n\t\tloadingCompleteEmitted = true;\n\t\toutputs.push({\n\t\t\tkind: \"loading-complete\",\n\t\t\tcohort: state.cohort,\n\t\t\titemCount: args.itemCount,\n\t\t\tloadedCount: args.loadedCount,\n\t\t});\n\t}\n\n\tconst nextState: SectionEngineState = {\n\t\t...state,\n\t\tphase,\n\t\treadinessSignals: args.signals,\n\t\tloadedCount: args.loadedCount,\n\t\titemCount: args.itemCount,\n\t\tloadingCompleteEmitted,\n\t};\n\treturn { state: nextState, outputs };\n}\n\n/**\n * Pure transition. Total over `(state, input)`; never mutates inputs;\n * never throws. Unhandled inputs after `disposed` fall through to a\n * no-op (the adapter is responsible for not feeding them in, but the\n * core stays safe by design).\n */\nexport function transition(\n\tstate: SectionEngineState,\n\tinput: SectionEngineInput,\n): TransitionResult {\n\tswitch (input.kind) {\n\t\tcase \"initialize\": {\n\t\t\tif (state.phase === \"disposed\") {\n\t\t\t\t// The engine has been disposed; ignore.\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\tif (state.phase !== \"idle\") {\n\t\t\t\t// Already initialized. Treat as `update-runtime` for the\n\t\t\t\t// current cohort if the cohort matches; otherwise treat as\n\t\t\t\t// a `cohort-change`.\n\t\t\t\tif (cohortsEqual(state.cohort, input.cohort)) {\n\t\t\t\t\treturn transition(state, {\n\t\t\t\t\t\tkind: \"update-runtime\",\n\t\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn transition(state, {\n\t\t\t\t\tkind: \"cohort-change\",\n\t\t\t\t\tcohort: input.cohort,\n\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t\titemCount: input.itemCount,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn startCohort({\n\t\t\t\tstate,\n\t\t\t\tcohort: input.cohort,\n\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\titemCount: input.itemCount,\n\t\t\t});\n\t\t}\n\n\t\tcase \"update-runtime\": {\n\t\t\tif (state.phase === \"idle\" || state.phase === \"disposed\") {\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t},\n\t\t\t\toutputs: [],\n\t\t\t};\n\t\t}\n\n\t\tcase \"cohort-change\": {\n\t\t\tif (state.phase === \"disposed\") {\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\tif (cohortsEqual(state.cohort, input.cohort)) {\n\t\t\t\t// No-op cohort change; fall back to a runtime update.\n\t\t\t\treturn transition(state, {\n\t\t\t\t\tkind: \"update-runtime\",\n\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst outputs: SectionEngineOutput[] = [];\n\t\t\tif (state.phase !== \"idle\") {\n\t\t\t\t// Emit `disposed` for the outgoing cohort before we wipe state.\n\t\t\t\toutputs.push({\n\t\t\t\t\tkind: \"stage-change\",\n\t\t\t\t\tstage: \"disposed\",\n\t\t\t\t\tstatus: \"entered\",\n\t\t\t\t\tcohort: state.cohort,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst started = startCohort({\n\t\t\t\tstate,\n\t\t\t\tcohort: input.cohort,\n\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\titemCount: input.itemCount,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tstate: started.state,\n\t\t\t\toutputs: [...outputs, ...started.outputs],\n\t\t\t};\n\t\t}\n\n\t\tcase \"section-controller-resolved\": {\n\t\t\tif (state.phase !== \"booting-section\") {\n\t\t\t\t// Either too early (idle), too late (interactive / disposed),\n\t\t\t\t// or a duplicate notification; the FSM is monotonic.\n\t\t\t\treturn {\n\t\t\t\t\tstate: { ...state, controllerResolved: true },\n\t\t\t\t\toutputs: [],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outputs: SectionEngineOutput[] = [];\n\t\t\temitStageChange(outputs, \"engine-ready\", state.cohort);\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\tphase: \"engine-ready\",\n\t\t\t\t\tcontrollerResolved: true,\n\t\t\t\t},\n\t\t\t\toutputs,\n\t\t\t};\n\t\t}\n\n\t\tcase \"update-readiness-signals\": {\n\t\t\treturn applyReadinessUpdate(state, {\n\t\t\t\tsignals: input.signals,\n\t\t\t\tmode: input.mode,\n\t\t\t\tloadedCount: input.loadedCount,\n\t\t\t\titemCount: input.itemCount,\n\t\t\t});\n\t\t}\n\n\t\tcase \"framework-error\": {\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\tlastFrameworkError: input.error,\n\t\t\t\t\treadinessSignals: {\n\t\t\t\t\t\t...state.readinessSignals,\n\t\t\t\t\t\truntimeError: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toutputs: [{ kind: \"framework-error\", error: input.error }],\n\t\t\t};\n\t\t}\n\n\t\tcase \"dispose\": {\n\t\t\tif (state.phase === \"disposed\") {\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\tconst outputs: SectionEngineOutput[] = [];\n\t\t\tif (state.phase !== \"idle\") {\n\t\t\t\temitStageChange(outputs, \"disposed\", state.cohort);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\tphase: \"disposed\",\n\t\t\t\t},\n\t\t\t\toutputs,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\tconst exhaustive: never = input;\n\t\t\tvoid exhaustive;\n\t\t\treturn { state, outputs: [] };\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"engine-transition.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAG3D,OAAO,EACN,qBAAqB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACN,wBAAwB,GAGxB,MAAM,mBAAmB,CAAC;AAO3B,SAAS,eAAe,CACvB,OAA8B,EAC9B,KAAyB,EACzB,MAAwB,EACxB,SAA2C,SAAS;IAEpD,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAMpB;IACA,MAAM,IAAI,GAAuB;QAChC,GAAG,wBAAwB,EAAE;QAC7B,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,IAAI,CAAC,MAAM;Q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AI;gBAChB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;aAC1B,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,iBAAiB,CAAC,CAAC,CAAC;YACxB,OAAO;gBACN,KAAK,EAAE;oBACN,GAAG,KAAK;oBACR,kBAAkB,EAAE,KAAK,CAAC,KAAK;oBAC/B,gBAAgB,EAAE;wBACjB,GAAG,KAAK,CAAC,gBAAgB;wBACzB,YAAY,EAAE,IAAI;qBAClB;iBACD;gBACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;aAC1D,CAAC;QACH,CAAC;QAED,KAAK,SAAS,CAAC,CAAC,CAAC;YAChB,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBAChC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;YAC/B,CAAC;YACD,MAAM,OAAO,GAA0B,EAAE,CAAC;YAC1C,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;gBAC5B,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACpD,CAAC;YACD,OAAO;gBACN,KAAK,EAAE;oBACN,GAAG,KAAK;oBACR,KAAK,EAAE,UAAU;iBACjB;gBACD,OAAO;aACP,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACT,MAAM,UAAU,GAAU,KAAK,CAAC;YAChC,KAAK,UAAU,CAAC;YAChB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/**\n * Pure transition function for the section runtime engine (M7 — Variant\n * C, layered core).\n *\n * `transition(state, input)` is total over `(state, input)` pairs and\n * returns:\n * - the next `SectionEngineState` (immutable; the input state object\n * is never mutated);\n * - the ordered list of `SectionEngineOutput`s the adapter must\n * dispatch (DOM events, framework-error fan-out, etc.).\n *\n * The function imports nothing from Svelte, the DOM, or the\n * coordinator. The `core/` constraint is enforced by the per-PR audit\n * step in the M7 implementation plan.\n *\n * Phase machine (per `engine-state.ts`):\n * idle → booting-section → engine-ready → interactive → disposed\n * (cohort-change rolls back to booting-section for the new cohort\n * after emitting `disposed` for the outgoing cohort)\n *\n * Output ordering invariants:\n * 1. `stage-change` for stage advancement fires before any\n * `loading-complete` triggered by the same input.\n * 2. `loading-complete` fires once per cohort, gated on\n * `state.loadingCompleteEmitted`.\n * 3. `framework-error` outputs are independent of the stage chain\n * and do not move the phase.\n *\n * Readiness alias output kinds (`readiness-change`,\n * `interaction-ready`, `ready`) and their DOM-event bridge were\n * removed in the broad architecture review compat sweep. Hosts that\n * need the readiness detail read it via the kernel's `selectReadiness`\n * / `getSnapshot` selectors or via `SectionEngineCore.getState()`.\n */\n\nimport { cohortsEqual, type CohortKey } from \"./cohort.js\";\nimport type { SectionEngineInput } from \"./engine-input.js\";\nimport type { SectionEngineOutput } from \"./engine-output.js\";\nimport {\n\tcreateReadinessDetail,\n\ttype EngineReadinessSignals,\n} from \"./engine-readiness.js\";\nimport { phaseToStage } from \"./engine-stage-derivation.js\";\nimport {\n\tcreateInitialEngineState,\n\ttype SectionEnginePhase,\n\ttype SectionEngineState,\n} from \"./engine-state.js\";\n\nexport interface TransitionResult {\n\tstate: SectionEngineState;\n\toutputs: SectionEngineOutput[];\n}\n\nfunction emitStageChange(\n\toutputs: SectionEngineOutput[],\n\tphase: SectionEnginePhase,\n\tcohort: CohortKey | null,\n\tstatus: \"entered\" | \"skipped\" | \"failed\" = \"entered\",\n): void {\n\tconst stage = phaseToStage(phase);\n\tif (!stage) return;\n\toutputs.push({ kind: \"stage-change\", stage, status, cohort });\n}\n\n/**\n * Transition the engine after `initialize` / `cohort-change`. Sets\n * the new cohort, resets latches, stores the resolved runtime/tools,\n * and emits the `composed` stage.\n */\nfunction startCohort(args: {\n\tstate: SectionEngineState;\n\tcohort: CohortKey;\n\teffectiveRuntime: SectionEngineState[\"effectiveRuntime\"];\n\teffectiveToolsConfig: unknown;\n\titemCount: number;\n}): { state: SectionEngineState; outputs: SectionEngineOutput[] } {\n\tconst next: SectionEngineState = {\n\t\t...createInitialEngineState(),\n\t\tphase: \"booting-section\",\n\t\tcohort: args.cohort,\n\t\teffectiveRuntime: args.effectiveRuntime,\n\t\teffectiveToolsConfig: args.effectiveToolsConfig,\n\t\titemCount: args.itemCount,\n\t};\n\tconst outputs: SectionEngineOutput[] = [];\n\temitStageChange(outputs, \"booting-section\", args.cohort);\n\treturn { state: next, outputs };\n}\n\n/**\n * Apply a readiness update: store new signals, derive the detail in\n * the requested mode, advance the phase to `interactive` when gated,\n * and emit `loading-complete` once per cohort.\n */\nfunction applyReadinessUpdate(\n\tstate: SectionEngineState,\n\targs: {\n\t\tsignals: EngineReadinessSignals;\n\t\tmode: \"progressive\" | \"strict\";\n\t\tloadedCount: number;\n\t\titemCount: number;\n\t},\n): TransitionResult {\n\tif (state.phase === \"idle\" || state.phase === \"disposed\") {\n\t\t// No cohort to update; ignore.\n\t\treturn { state, outputs: [] };\n\t}\n\n\tconst detail = createReadinessDetail({\n\t\tmode: args.mode,\n\t\tsignals: args.signals,\n\t});\n\tconst outputs: SectionEngineOutput[] = [];\n\n\tlet phase = state.phase;\n\tlet loadingCompleteEmitted = state.loadingCompleteEmitted;\n\n\t// Stage advancement: engine-ready → interactive when readiness\n\t// satisfies `interactionReady` (mode-aware via `createReadinessDetail`).\n\tif (phase === \"engine-ready\" && detail.interactionReady) {\n\t\tphase = \"interactive\";\n\t\temitStageChange(outputs, phase, state.cohort);\n\t}\n\n\t// Canonical `loading-complete` emission. One-shot per cohort, gated\n\t// on the readiness signals indicating every item has finished\n\t// loading.\n\tif (\n\t\tdetail.allLoadingComplete &&\n\t\tstate.cohort &&\n\t\t!loadingCompleteEmitted\n\t) {\n\t\tloadingCompleteEmitted = true;\n\t\toutputs.push({\n\t\t\tkind: \"loading-complete\",\n\t\t\tcohort: state.cohort,\n\t\t\titemCount: args.itemCount,\n\t\t\tloadedCount: args.loadedCount,\n\t\t});\n\t}\n\n\tconst nextState: SectionEngineState = {\n\t\t...state,\n\t\tphase,\n\t\treadinessSignals: args.signals,\n\t\tloadedCount: args.loadedCount,\n\t\titemCount: args.itemCount,\n\t\tloadingCompleteEmitted,\n\t};\n\treturn { state: nextState, outputs };\n}\n\n/**\n * Pure transition. Total over `(state, input)`; never mutates inputs;\n * never throws. Unhandled inputs after `disposed` fall through to a\n * no-op (the adapter is responsible for not feeding them in, but the\n * core stays safe by design).\n */\nexport function transition(\n\tstate: SectionEngineState,\n\tinput: SectionEngineInput,\n): TransitionResult {\n\tswitch (input.kind) {\n\t\tcase \"initialize\": {\n\t\t\tif (state.phase === \"disposed\") {\n\t\t\t\t// The engine has been disposed; ignore.\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\tif (state.phase !== \"idle\") {\n\t\t\t\t// Already initialized. Treat as `update-runtime` for the\n\t\t\t\t// current cohort if the cohort matches; otherwise treat as\n\t\t\t\t// a `cohort-change`.\n\t\t\t\tif (cohortsEqual(state.cohort, input.cohort)) {\n\t\t\t\t\treturn transition(state, {\n\t\t\t\t\t\tkind: \"update-runtime\",\n\t\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn transition(state, {\n\t\t\t\t\tkind: \"cohort-change\",\n\t\t\t\t\tcohort: input.cohort,\n\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t\titemCount: input.itemCount,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn startCohort({\n\t\t\t\tstate,\n\t\t\t\tcohort: input.cohort,\n\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\titemCount: input.itemCount,\n\t\t\t});\n\t\t}\n\n\t\tcase \"update-runtime\": {\n\t\t\tif (state.phase === \"idle\" || state.phase === \"disposed\") {\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t},\n\t\t\t\toutputs: [],\n\t\t\t};\n\t\t}\n\n\t\tcase \"cohort-change\": {\n\t\t\tif (state.phase === \"disposed\") {\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\tif (cohortsEqual(state.cohort, input.cohort)) {\n\t\t\t\t// No-op cohort change; fall back to a runtime update.\n\t\t\t\treturn transition(state, {\n\t\t\t\t\tkind: \"update-runtime\",\n\t\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst outputs: SectionEngineOutput[] = [];\n\t\t\tif (state.phase !== \"idle\") {\n\t\t\t\t// Emit `disposed` for the outgoing cohort before we wipe state.\n\t\t\t\toutputs.push({\n\t\t\t\t\tkind: \"stage-change\",\n\t\t\t\t\tstage: \"disposed\",\n\t\t\t\t\tstatus: \"entered\",\n\t\t\t\t\tcohort: state.cohort,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst started = startCohort({\n\t\t\t\tstate,\n\t\t\t\tcohort: input.cohort,\n\t\t\t\teffectiveRuntime: input.effectiveRuntime,\n\t\t\t\teffectiveToolsConfig: input.effectiveToolsConfig,\n\t\t\t\titemCount: input.itemCount,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tstate: started.state,\n\t\t\t\toutputs: [...outputs, ...started.outputs],\n\t\t\t};\n\t\t}\n\n\t\tcase \"section-controller-resolved\": {\n\t\t\tif (state.phase !== \"booting-section\") {\n\t\t\t\t// Either too early (idle), too late (interactive / disposed),\n\t\t\t\t// or a duplicate notification; the FSM is monotonic.\n\t\t\t\treturn {\n\t\t\t\t\tstate: { ...state, controllerResolved: true },\n\t\t\t\t\toutputs: [],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outputs: SectionEngineOutput[] = [];\n\t\t\temitStageChange(outputs, \"engine-ready\", state.cohort);\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\tphase: \"engine-ready\",\n\t\t\t\t\tcontrollerResolved: true,\n\t\t\t\t},\n\t\t\t\toutputs,\n\t\t\t};\n\t\t}\n\n\t\tcase \"update-readiness-signals\": {\n\t\t\treturn applyReadinessUpdate(state, {\n\t\t\t\tsignals: input.signals,\n\t\t\t\tmode: input.mode,\n\t\t\t\tloadedCount: input.loadedCount,\n\t\t\t\titemCount: input.itemCount,\n\t\t\t});\n\t\t}\n\n\t\tcase \"framework-error\": {\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\tlastFrameworkError: input.error,\n\t\t\t\t\treadinessSignals: {\n\t\t\t\t\t\t...state.readinessSignals,\n\t\t\t\t\t\truntimeError: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toutputs: [{ kind: \"framework-error\", error: input.error }],\n\t\t\t};\n\t\t}\n\n\t\tcase \"dispose\": {\n\t\t\tif (state.phase === \"disposed\") {\n\t\t\t\treturn { state, outputs: [] };\n\t\t\t}\n\t\t\tconst outputs: SectionEngineOutput[] = [];\n\t\t\tif (state.phase !== \"idle\") {\n\t\t\t\temitStageChange(outputs, \"disposed\", state.cohort);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstate: {\n\t\t\t\t\t...state,\n\t\t\t\t\tphase: \"disposed\",\n\t\t\t\t},\n\t\t\t\toutputs,\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\tconst exhaustive: never = input;\n\t\t\tvoid exhaustive;\n\t\t\treturn { state, outputs: [] };\n\t\t}\n\t}\n}\n"]}
|
package/dist/runtime/engine.d.ts
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*/
|
|
21
21
|
export { SectionRuntimeEngine, type SectionRuntimeEngineHostArgs, } from "./SectionRuntimeEngine.js";
|
|
22
22
|
export { SECTION_RUNTIME_ENGINE_KEY, type SectionRuntimeEngineContext, } from "./engine-context.js";
|
|
23
|
-
export { sectionRuntimeEngineHostContext, connectSectionRuntimeEngineHostContext, type SectionRuntimeEngineHostContextValue, type SectionRuntimeEngineHostContextListener, } from "./section-runtime-engine-host-context.js";
|
|
23
|
+
export { sectionRuntimeEngineHostContext, connectSectionRuntimeEngineHostContext, type SectionRuntimeLifecycleHandle, type SectionRuntimeEngineHostContextValue, type SectionRuntimeEngineHostContextListener, } from "./section-runtime-engine-host-context.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/runtime/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACN,oBAAoB,GAEpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,0BAA0B,GAE1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,+BAA+B,EAC/B,sCAAsC,
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/runtime/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACN,oBAAoB,GAEpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,0BAA0B,GAE1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,+BAA+B,EAC/B,sCAAsC,GAItC,MAAM,0CAA0C,CAAC","sourcesContent":["/**\n * Section runtime engine — facade entry point (M7 — Variant C).\n *\n * Narrow, stable public surface for hosts that want to mount, drive,\n * or dispose a section runtime via the layered engine. Re-exports the\n * `SectionRuntimeEngine` facade and its `attachHost` arg shape.\n *\n * **Pairing.** This module is the stable counterpart to\n * `./runtime/internal`, which exposes the wider, evolving surface\n * (core types, adapter bridges, cohort helpers) for advanced hosts and\n * for the engine's own tests / benchmarks. Consumers that only need to\n * mount + drive a section runtime should import from here. Consumers\n * that need to reach past the facade (e.g. construct an adapter\n * manually, inspect FSM state types, build alternate fan-out paths)\n * should import from `./runtime/internal` and accept the documented\n * stability disclaimer there.\n *\n * The package's `exports` map adds `./runtime/engine` in M7 PR 3\n * alongside the facade refactor.\n */\n\nexport {\n\tSectionRuntimeEngine,\n\ttype SectionRuntimeEngineHostArgs,\n} from \"./SectionRuntimeEngine.js\";\n\nexport {\n\tSECTION_RUNTIME_ENGINE_KEY,\n\ttype SectionRuntimeEngineContext,\n} from \"./engine-context.js\";\n\nexport {\n\tsectionRuntimeEngineHostContext,\n\tconnectSectionRuntimeEngineHostContext,\n\ttype SectionRuntimeLifecycleHandle,\n\ttype SectionRuntimeEngineHostContextValue,\n\ttype SectionRuntimeEngineHostContextListener,\n} from \"./section-runtime-engine-host-context.js\";\n"]}
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
*
|
|
10
10
|
* - The kernel (`SectionPlayerLayoutKernel.svelte`) installs a
|
|
11
11
|
* `ContextProvider` for `sectionRuntimeEngineHostContext` on its
|
|
12
|
-
* `host` (the layout CE). The provider value carries
|
|
13
|
-
*
|
|
12
|
+
* `host` (the layout CE). The provider value carries a narrow
|
|
13
|
+
* lifecycle handle for the engine owned by that kernel mount.
|
|
14
14
|
* - The toolkit CE installs a `ContextConsumer` on its own host. When
|
|
15
15
|
* wrapped by a section player layout, the consumer resolves to the
|
|
16
|
-
* kernel's
|
|
17
|
-
*
|
|
18
|
-
* `initialize`, etc.)
|
|
19
|
-
*
|
|
20
|
-
* responds and the toolkit keeps using
|
|
21
|
-
*
|
|
16
|
+
* kernel's lifecycle handle and suppresses its standalone lifecycle
|
|
17
|
+
* DOM emits in favor of the section-player host. Controller-side
|
|
18
|
+
* calls (`register`, `handleContent*`, `initialize`, etc.) remain
|
|
19
|
+
* owned by the toolkit's locally-constructed engine. When
|
|
20
|
+
* standalone, no host provider responds and the toolkit keeps using
|
|
21
|
+
* its standalone lifecycle path.
|
|
22
22
|
*
|
|
23
23
|
* The two engine-context surfaces (`SECTION_RUNTIME_ENGINE_KEY` and
|
|
24
24
|
* this one) are deliberately distinct:
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* single component tree (kernel + descendants in the same shadow
|
|
27
27
|
* root) and is the right hook for in-tree consumers.
|
|
28
28
|
* - `sectionRuntimeEngineHostContext` (DOM-event context) is the
|
|
29
|
-
* bridge for cross-CE consumers and only carries data that is
|
|
30
|
-
*
|
|
29
|
+
* bridge for cross-CE consumers and only carries data that is safe
|
|
30
|
+
* to share across CE boundaries (a stable lifecycle handle).
|
|
31
31
|
*
|
|
32
32
|
* **Stability.** This export is part of the stable runtime/engine
|
|
33
33
|
* surface; the symbol identity and value shape are part of the
|
|
@@ -35,15 +35,22 @@
|
|
|
35
35
|
* breaking change. Adding optional fields to the value shape is
|
|
36
36
|
* allowed; required fields are not.
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Narrow cross-CE handle published by section-player. Deliberately omits
|
|
40
|
+
* controller-facing methods (`initialize`, `register`, `handleContent*`,
|
|
41
|
+
* etc.) so the package seam cannot grow an accidental controller contract.
|
|
42
|
+
*/
|
|
43
|
+
export interface SectionRuntimeLifecycleHandle {
|
|
44
|
+
getRuntimeId(): string;
|
|
45
|
+
}
|
|
39
46
|
/**
|
|
40
47
|
* Value shape published by the kernel and consumed by the wrapped
|
|
41
|
-
* toolkit CE. Carries only the
|
|
42
|
-
*
|
|
43
|
-
*
|
|
48
|
+
* toolkit CE. Carries only the lifecycle handle today; if more cross-CE
|
|
49
|
+
* shared runtime state is needed later, fields can be added here
|
|
50
|
+
* additively.
|
|
44
51
|
*/
|
|
45
52
|
export interface SectionRuntimeEngineHostContextValue {
|
|
46
|
-
engine:
|
|
53
|
+
engine: SectionRuntimeLifecycleHandle;
|
|
47
54
|
}
|
|
48
55
|
/**
|
|
49
56
|
* `pie-context` context key for the cross-CE engine bridge. Uses a
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
*
|
|
10
10
|
* - The kernel (`SectionPlayerLayoutKernel.svelte`) installs a
|
|
11
11
|
* `ContextProvider` for `sectionRuntimeEngineHostContext` on its
|
|
12
|
-
* `host` (the layout CE). The provider value carries
|
|
13
|
-
*
|
|
12
|
+
* `host` (the layout CE). The provider value carries a narrow
|
|
13
|
+
* lifecycle handle for the engine owned by that kernel mount.
|
|
14
14
|
* - The toolkit CE installs a `ContextConsumer` on its own host. When
|
|
15
15
|
* wrapped by a section player layout, the consumer resolves to the
|
|
16
|
-
* kernel's
|
|
17
|
-
*
|
|
18
|
-
* `initialize`, etc.)
|
|
19
|
-
*
|
|
20
|
-
* responds and the toolkit keeps using
|
|
21
|
-
*
|
|
16
|
+
* kernel's lifecycle handle and suppresses its standalone lifecycle
|
|
17
|
+
* DOM emits in favor of the section-player host. Controller-side
|
|
18
|
+
* calls (`register`, `handleContent*`, `initialize`, etc.) remain
|
|
19
|
+
* owned by the toolkit's locally-constructed engine. When
|
|
20
|
+
* standalone, no host provider responds and the toolkit keeps using
|
|
21
|
+
* its standalone lifecycle path.
|
|
22
22
|
*
|
|
23
23
|
* The two engine-context surfaces (`SECTION_RUNTIME_ENGINE_KEY` and
|
|
24
24
|
* this one) are deliberately distinct:
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* single component tree (kernel + descendants in the same shadow
|
|
27
27
|
* root) and is the right hook for in-tree consumers.
|
|
28
28
|
* - `sectionRuntimeEngineHostContext` (DOM-event context) is the
|
|
29
|
-
* bridge for cross-CE consumers and only carries data that is
|
|
30
|
-
*
|
|
29
|
+
* bridge for cross-CE consumers and only carries data that is safe
|
|
30
|
+
* to share across CE boundaries (a stable lifecycle handle).
|
|
31
31
|
*
|
|
32
32
|
* **Stability.** This export is part of the stable runtime/engine
|
|
33
33
|
* surface; the symbol identity and value shape are part of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-runtime-engine-host-context.js","sourceRoot":"","sources":["../../src/runtime/section-runtime-engine-host-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EACN,eAAe,EACf,aAAa,GAEb,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"section-runtime-engine-host-context.js","sourceRoot":"","sources":["../../src/runtime/section-runtime-engine-host-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EACN,eAAe,EACf,aAAa,GAEb,MAAM,0BAA0B,CAAC;AAqBlC;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC3C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CACjD,CAAC;AAUH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sCAAsC,CACrD,IAAiB,EACjB,OAAgD;IAEhD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE;QAC1C,OAAO,EAAE,+BAA+B;QACxC,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;KACD,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC;IAEnB,MAAM,iBAAiB,GAAG,CAAC,KAA+B,EAAE,EAAE;QAC7D,IACC,KAAK,CAAC,OAAO;YACZ,+BAA6D,EAC7D,CAAC;YACF,OAAO;QACR,CAAC;QACD,QAAQ,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC,CAAC;IACF,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IAE7D,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,WAAW,GAAG,GAAG,CAAC;IACxB,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE;QAC9C,IAAI,QAAQ,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;YACzC,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACrC,OAAO;QACR,CAAC;QACD,QAAQ,IAAI,CAAC,CAAC;QACd,QAAQ,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,GAAG,EAAE;QACX,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;QAChE,QAAQ,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Cross-Custom-Element context for the section runtime engine (M7 PR 6).\n *\n * The toolkit CE renders inside its own Shadow DOM, so Svelte's native\n * `setContext`/`getContext` (used by `engine-context.ts`) cannot bridge\n * the kernel-provided engine reference to the toolkit's component tree.\n * This module exposes a `@pie-players/pie-context` based context that\n * does cross the CE boundary via DOM events:\n *\n * - The kernel (`SectionPlayerLayoutKernel.svelte`) installs a\n * `ContextProvider` for `sectionRuntimeEngineHostContext` on its\n * `host` (the layout CE). The provider value carries a narrow\n * lifecycle handle for the engine owned by that kernel mount.\n * - The toolkit CE installs a `ContextConsumer` on its own host. When\n * wrapped by a section player layout, the consumer resolves to the\n * kernel's lifecycle handle and suppresses its standalone lifecycle\n * DOM emits in favor of the section-player host. Controller-side\n * calls (`register`, `handleContent*`, `initialize`, etc.) remain\n * owned by the toolkit's locally-constructed engine. When\n * standalone, no host provider responds and the toolkit keeps using\n * its standalone lifecycle path.\n *\n * The two engine-context surfaces (`SECTION_RUNTIME_ENGINE_KEY` and\n * this one) are deliberately distinct:\n * - `SECTION_RUNTIME_ENGINE_KEY` (Svelte context) stays scoped to a\n * single component tree (kernel + descendants in the same shadow\n * root) and is the right hook for in-tree consumers.\n * - `sectionRuntimeEngineHostContext` (DOM-event context) is the\n * bridge for cross-CE consumers and only carries data that is safe\n * to share across CE boundaries (a stable lifecycle handle).\n *\n * **Stability.** This export is part of the stable runtime/engine\n * surface; the symbol identity and value shape are part of the\n * cross-CE contract. Renaming or replacing the symbol is a major\n * breaking change. Adding optional fields to the value shape is\n * allowed; required fields are not.\n */\n\nimport {\n\tContextConsumer,\n\tcreateContext,\n\ttype UnknownContext,\n} from \"@pie-players/pie-context\";\n\n/**\n * Narrow cross-CE handle published by section-player. Deliberately omits\n * controller-facing methods (`initialize`, `register`, `handleContent*`,\n * etc.) so the package seam cannot grow an accidental controller contract.\n */\nexport interface SectionRuntimeLifecycleHandle {\n\tgetRuntimeId(): string;\n}\n\n/**\n * Value shape published by the kernel and consumed by the wrapped\n * toolkit CE. Carries only the lifecycle handle today; if more cross-CE\n * shared runtime state is needed later, fields can be added here\n * additively.\n */\nexport interface SectionRuntimeEngineHostContextValue {\n\tengine: SectionRuntimeLifecycleHandle;\n}\n\n/**\n * `pie-context` context key for the cross-CE engine bridge. Uses a\n * `Symbol.for(...)` registry key so providers and consumers in\n * separately-bundled CEs see the same identity.\n */\nexport const sectionRuntimeEngineHostContext =\n\tcreateContext<SectionRuntimeEngineHostContextValue>(\n\t\tSymbol.for(\"pie.sectionRuntimeEngineHostContext\"),\n\t);\n\nexport type SectionRuntimeEngineHostContextListener = (\n\tvalue: SectionRuntimeEngineHostContextValue,\n) => void;\n\ntype ContextProviderLikeEvent = Event & {\n\tcontext?: unknown;\n};\n\n/**\n * Connect a DOM host to the cross-CE engine context with the same\n * provider-retry semantics used elsewhere in the toolkit (initial\n * synchronous request + `context-provider` re-request + 50 ms polling\n * fallback up to 200 attempts ≈ 10 s).\n *\n * The retry mirrors the existing\n * `connectAssessmentToolkitHostRuntimeContext` infrastructure so the\n * timing characteristics of cross-CE handshakes stay consistent across\n * the toolkit's contexts.\n *\n * Returns a cleanup function that disconnects the consumer and clears\n * the retry interval. Standalone toolkits naturally exhaust the retry\n * window without ever resolving and continue using their local\n * engine — that is by design and is not an error.\n */\nexport function connectSectionRuntimeEngineHostContext(\n\thost: HTMLElement,\n\tonValue: SectionRuntimeEngineHostContextListener,\n): () => void {\n\tlet hasValue = false;\n\tconst consumer = new ContextConsumer(host, {\n\t\tcontext: sectionRuntimeEngineHostContext,\n\t\tsubscribe: true,\n\t\tonValue: (value) => {\n\t\t\thasValue = true;\n\t\t\tonValue(value);\n\t\t},\n\t});\n\tconsumer.connect();\n\n\tconst onContextProvider = (event: ContextProviderLikeEvent) => {\n\t\tif (\n\t\t\tevent.context !==\n\t\t\t(sectionRuntimeEngineHostContext as unknown as UnknownContext)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconsumer.requestValue();\n\t};\n\thost.addEventListener(\"context-provider\", onContextProvider);\n\n\tlet attempts = 0;\n\tconst maxAttempts = 200;\n\tconst retryTimer = globalThis.setInterval(() => {\n\t\tif (hasValue || attempts >= maxAttempts) {\n\t\t\tglobalThis.clearInterval(retryTimer);\n\t\t\treturn;\n\t\t}\n\t\tattempts += 1;\n\t\tconsumer.requestValue();\n\t}, 50);\n\n\treturn () => {\n\t\tglobalThis.clearInterval(retryTimer);\n\t\thost.removeEventListener(\"context-provider\", onContextProvider);\n\t\tconsumer.disconnect();\n\t};\n}\n"]}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* event and invokes the runtime-tier `onStageChange` callback. PR 6
|
|
7
7
|
* introduces the wrapped/standalone branch:
|
|
8
8
|
*
|
|
9
|
-
* - **Standalone** (no
|
|
9
|
+
* - **Standalone** (no host lifecycle provider on
|
|
10
10
|
* the layout CE host): emit + `onStageChange` fire as before.
|
|
11
|
-
* - **Wrapped** (kernel publishes its
|
|
11
|
+
* - **Wrapped** (kernel publishes its lifecycle handle via
|
|
12
12
|
* `sectionRuntimeEngineHostContext` and the toolkit consumer
|
|
13
13
|
* resolves it): emit + `onStageChange` are suppressed on the
|
|
14
14
|
* toolkit CE, because the kernel's engine already emits the
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* unit test without mounting the toolkit CE — see
|
|
33
33
|
* `tests/runtime/stage-emit-gate.test.ts`. The closure in the toolkit
|
|
34
34
|
* passes thunks for `isSuppressed` and `getOnStageChange` so the live
|
|
35
|
-
* Svelte reactive variables (`
|
|
35
|
+
* Svelte reactive variables (`hostLifecycleEngine`, `onStageChange`) are
|
|
36
36
|
* read at emit time, not captured at construction time. This keeps the
|
|
37
37
|
* pre-PR-6 behavior of always reading the latest `onStageChange` prop
|
|
38
38
|
* value (cohort change, host swap, etc.) intact.
|
|
@@ -46,7 +46,7 @@ export type StageOnChangeHandler = (detail: StageChangeDetail) => void;
|
|
|
46
46
|
export interface StageEmitGateContext {
|
|
47
47
|
/**
|
|
48
48
|
* Reads the current suppression flag. Implemented as a thunk so
|
|
49
|
-
* the reactive Svelte `$state(
|
|
49
|
+
* the reactive Svelte `$state(hostLifecycleEngine)` is read at emit
|
|
50
50
|
* time. Return `true` to suppress; `false` to fire.
|
|
51
51
|
*/
|
|
52
52
|
isSuppressed: () => boolean;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* event and invokes the runtime-tier `onStageChange` callback. PR 6
|
|
7
7
|
* introduces the wrapped/standalone branch:
|
|
8
8
|
*
|
|
9
|
-
* - **Standalone** (no
|
|
9
|
+
* - **Standalone** (no host lifecycle provider on
|
|
10
10
|
* the layout CE host): emit + `onStageChange` fire as before.
|
|
11
|
-
* - **Wrapped** (kernel publishes its
|
|
11
|
+
* - **Wrapped** (kernel publishes its lifecycle handle via
|
|
12
12
|
* `sectionRuntimeEngineHostContext` and the toolkit consumer
|
|
13
13
|
* resolves it): emit + `onStageChange` are suppressed on the
|
|
14
14
|
* toolkit CE, because the kernel's engine already emits the
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* unit test without mounting the toolkit CE — see
|
|
33
33
|
* `tests/runtime/stage-emit-gate.test.ts`. The closure in the toolkit
|
|
34
34
|
* passes thunks for `isSuppressed` and `getOnStageChange` so the live
|
|
35
|
-
* Svelte reactive variables (`
|
|
35
|
+
* Svelte reactive variables (`hostLifecycleEngine`, `onStageChange`) are
|
|
36
36
|
* read at emit time, not captured at construction time. This keeps the
|
|
37
37
|
* pre-PR-6 behavior of always reading the latest `onStageChange` prop
|
|
38
38
|
* value (cohort change, host swap, etc.) intact.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage-emit-gate.js","sourceRoot":"","sources":["../../src/runtime/stage-emit-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAoCH,MAAM,sBAAsB,GAAG,CAAC,KAAc,EAAQ,EAAE;IACvD,OAAO,CAAC,KAAK,CAAC,sDAAsD,EAAE,KAAK,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,2BAA2B,CAC1C,OAA6B,EAC7B,MAAyB;IAEzB,IAAI,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAC3C,IAAI,OAAO,EAAE,CAAC;QACb,IAAI,CAAC;YACJ,OAAO,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,CAAC,OAAO,CAAC,eAAe,IAAI,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/**\n * Stage-emit suppression gate (M7 PR 6).\n *\n * `PieAssessmentToolkit.svelte` builds a `createStageTracker(...)` whose\n * `emit` callback dispatches the toolkit CE's `pie-stage-change` DOM\n * event and invokes the runtime-tier `onStageChange` callback. PR 6\n * introduces the wrapped/standalone branch:\n *\n * - **Standalone** (no
|
|
1
|
+
{"version":3,"file":"stage-emit-gate.js","sourceRoot":"","sources":["../../src/runtime/stage-emit-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAoCH,MAAM,sBAAsB,GAAG,CAAC,KAAc,EAAQ,EAAE;IACvD,OAAO,CAAC,KAAK,CAAC,sDAAsD,EAAE,KAAK,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,2BAA2B,CAC1C,OAA6B,EAC7B,MAAyB;IAEzB,IAAI,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAC3C,IAAI,OAAO,EAAE,CAAC;QACb,IAAI,CAAC;YACJ,OAAO,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,CAAC,OAAO,CAAC,eAAe,IAAI,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/**\n * Stage-emit suppression gate (M7 PR 6).\n *\n * `PieAssessmentToolkit.svelte` builds a `createStageTracker(...)` whose\n * `emit` callback dispatches the toolkit CE's `pie-stage-change` DOM\n * event and invokes the runtime-tier `onStageChange` callback. PR 6\n * introduces the wrapped/standalone branch:\n *\n * - **Standalone** (no host lifecycle provider on\n * the layout CE host): emit + `onStageChange` fire as before.\n * - **Wrapped** (kernel publishes its lifecycle handle via\n * `sectionRuntimeEngineHostContext` and the toolkit consumer\n * resolves it): emit + `onStageChange` are suppressed on the\n * toolkit CE, because the kernel's engine already emits the\n * canonical `pie-stage-change` chain on the layout CE host and\n * invokes the runtime-tier callback. Without suppression the\n * toolkit CE would also dispatch its own event, which bubbles\n * through `composed: true` to the layout CE host and produces a\n * duplicate emission for outside listeners.\n *\n * The internal `stageTracker` latch state advances **before** this\n * helper is reached (the latch is updated inside\n * `createStageTracker.enter` prior to `opts.emit(...)`), so suppression\n * here only short-circuits the externally-visible side effects. The\n * toolkit's own readiness path (`waitUntilReady` / `engine-ready` /\n * `interactive`) keeps working in standalone mode and degenerates into\n * a series of suppressed emits in wrapped mode without losing any\n * latch transitions.\n *\n * Splitting this helper out of the inline `emit:` closure in\n * `PieAssessmentToolkit.svelte` lets us pin the suppression branch in a\n * unit test without mounting the toolkit CE — see\n * `tests/runtime/stage-emit-gate.test.ts`. The closure in the toolkit\n * passes thunks for `isSuppressed` and `getOnStageChange` so the live\n * Svelte reactive variables (`hostLifecycleEngine`, `onStageChange`) are\n * read at emit time, not captured at construction time. This keeps the\n * pre-PR-6 behavior of always reading the latest `onStageChange` prop\n * value (cohort change, host swap, etc.) intact.\n *\n * NOT a public surface: this helper is internal to the toolkit and is\n * not exported from `runtime/engine.ts`. It only exists to make the\n * gate testable.\n */\n\nimport type { StageChangeDetail } from \"@pie-players/pie-players-shared/pie\";\n\nexport type StageOnChangeHandler = (detail: StageChangeDetail) => void;\n\nexport interface StageEmitGateContext {\n\t/**\n\t * Reads the current suppression flag. Implemented as a thunk so\n\t * the reactive Svelte `$state(hostLifecycleEngine)` is read at emit\n\t * time. Return `true` to suppress; `false` to fire.\n\t */\n\tisSuppressed: () => boolean;\n\n\t/**\n\t * Dispatches the `pie-stage-change` DOM event on the toolkit's\n\t * CE host. In `PieAssessmentToolkit.svelte` this is the\n\t * Svelte-generated `emit(\"pie-stage-change\", detail)` helper.\n\t */\n\tdispatchDomEvent: (detail: StageChangeDetail) => void;\n\n\t/**\n\t * Reads the current `onStageChange` runtime-tier callback. Thunk\n\t * so the latest reassigned handler is invoked, not whichever\n\t * handler was current at construction time.\n\t */\n\tgetOnStageChange: () => StageOnChangeHandler | null | undefined;\n\n\t/**\n\t * Optional logger for handler errors. Defaults to `console.error`\n\t * with the same prefix the toolkit used pre-PR-6 so test output\n\t * matches production logs.\n\t */\n\tlogHandlerError?: (error: unknown) => void;\n}\n\nconst defaultLogHandlerError = (error: unknown): void => {\n\tconsole.error(\"[pie-assessment-toolkit] onStageChange handler threw\", error);\n};\n\n/**\n * Run the toolkit's stage emit pipeline with the suppression gate\n * applied.\n *\n * - When `isSuppressed()` returns `true`, the helper returns\n * immediately with neither side effect.\n * - Otherwise it dispatches the `pie-stage-change` DOM event first,\n * then invokes `onStageChange(detail)` (preserving the\n * \"DOM-event-then-callback\" ordering pre-PR-6 consumers depend\n * on).\n * - A throwing `onStageChange` handler does not interrupt the DOM\n * event (already fired) and does not propagate up to\n * `stageTracker.enter` (latch state already advanced); the error\n * is logged and swallowed, matching pre-PR-6 behavior.\n *\n * Returns `true` if the emit pipeline ran (i.e. it was not\n * suppressed); `false` if it was suppressed. Tests use the return\n * value to assert the gate's decision in isolation from the side\n * effects.\n */\nexport function runStageEmitWithSuppression(\n\tcontext: StageEmitGateContext,\n\tdetail: StageChangeDetail,\n): boolean {\n\tif (context.isSuppressed()) {\n\t\treturn false;\n\t}\n\tcontext.dispatchDomEvent(detail);\n\tconst handler = context.getOnStageChange();\n\tif (handler) {\n\t\ttry {\n\t\t\thandler(detail);\n\t\t} catch (error) {\n\t\t\t(context.logHandlerError ?? defaultLogHandlerError)(error);\n\t\t}\n\t}\n\treturn true;\n}\n"]}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { AccessibilityCatalog } from "@pie-players/pie-players-shared/types";
|
|
2
|
+
export type CatalogOwnerKind = "global" | "passage" | "itemModel";
|
|
3
|
+
export interface CatalogOwnerContext {
|
|
4
|
+
ownerKind: CatalogOwnerKind;
|
|
5
|
+
assessmentId?: string;
|
|
6
|
+
sectionId?: string;
|
|
7
|
+
canonicalItemId?: string;
|
|
8
|
+
itemId?: string;
|
|
9
|
+
passageId?: string;
|
|
10
|
+
modelId?: string;
|
|
11
|
+
}
|
|
12
|
+
export type CatalogLookupContext = CatalogOwnerContext;
|
|
2
13
|
/**
|
|
3
14
|
* Supported accessibility catalog types from QTI 3.0 / APIP
|
|
4
15
|
*/
|
|
@@ -13,6 +24,8 @@ export interface CatalogLookupOptions {
|
|
|
13
24
|
language?: string;
|
|
14
25
|
/** Fallback to default language if requested language not found */
|
|
15
26
|
useFallback?: boolean;
|
|
27
|
+
/** Scope used to resolve local catalog idrefs for rendered content */
|
|
28
|
+
context?: CatalogLookupContext;
|
|
16
29
|
}
|
|
17
30
|
/**
|
|
18
31
|
* Resolved catalog result
|
|
@@ -73,7 +86,9 @@ export interface CatalogStatistics {
|
|
|
73
86
|
export declare class AccessibilityCatalogResolver {
|
|
74
87
|
private assessmentCatalogs;
|
|
75
88
|
private itemCatalogs;
|
|
89
|
+
private scopedCatalogs;
|
|
76
90
|
private defaultLanguage;
|
|
91
|
+
private sanitizedSpokenCache;
|
|
77
92
|
constructor(assessmentCatalogs?: AccessibilityCatalog[], defaultLanguage?: string);
|
|
78
93
|
/**
|
|
79
94
|
* Set the default language for fallback resolution
|
|
@@ -87,6 +102,7 @@ export declare class AccessibilityCatalogResolver {
|
|
|
87
102
|
* Index catalogs into the appropriate map
|
|
88
103
|
*/
|
|
89
104
|
private indexCatalogs;
|
|
105
|
+
registerCatalogs(context: CatalogOwnerContext, catalogs?: AccessibilityCatalog[]): () => void;
|
|
90
106
|
/**
|
|
91
107
|
* Add item-level catalogs (called when rendering a new item)
|
|
92
108
|
*/
|
|
@@ -105,6 +121,13 @@ export declare class AccessibilityCatalogResolver {
|
|
|
105
121
|
* Priority: Item-level catalogs take precedence over assessment-level
|
|
106
122
|
*/
|
|
107
123
|
getAlternative(catalogId: string, options: CatalogLookupOptions): ResolvedCatalog | null;
|
|
124
|
+
private resolveCard;
|
|
125
|
+
private ensureSpokenSanitized;
|
|
126
|
+
private getOwnerKey;
|
|
127
|
+
private scopedCatalogEntries;
|
|
128
|
+
private findScopedCandidates;
|
|
129
|
+
private isCompatibleOwnerContext;
|
|
130
|
+
private sanitizeCatalogs;
|
|
108
131
|
/**
|
|
109
132
|
* Find a matching catalog card based on lookup options
|
|
110
133
|
*/
|