@pie-players/pie-assessment-toolkit 0.3.43 → 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/attempt/AssessmentSession.d.ts +0 -1
- package/dist/attempt/AssessmentSession.js.map +1 -1
- package/dist/attempt/TestSession.d.ts +0 -1
- package/dist/attempt/TestSession.js.map +1 -1
- package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -1
- package/dist/attempt/adapters/activity-to-test-attempt-session.js.map +1 -1
- package/dist/components/ItemToolBar.custom-element.js +1607 -428
- package/dist/components/PieAssessmentToolkit.custom-element.js +19498 -3590
- package/dist/components/SectionToolBar.custom-element.js +1887 -611
- package/dist/components/item-toolbar-element.d.ts +0 -1
- package/dist/components/item-toolbar-element.js.map +1 -1
- package/dist/components/pie-assessment-toolkit-element.d.ts +0 -1
- package/dist/components/pie-assessment-toolkit-element.js.map +1 -1
- package/dist/components/section-toolbar-element.d.ts +0 -1
- package/dist/components/section-toolbar-element.js.map +1 -1
- package/dist/components/vendor/nds/README.md +110 -0
- package/dist/components/vendor/nds/nds-icon-button.js +826 -0
- package/dist/context/assessment-toolkit-context.d.ts +0 -1
- package/dist/context/assessment-toolkit-context.js.map +1 -1
- package/dist/context/runtime-context-consumer.d.ts +0 -1
- package/dist/context/runtime-context-consumer.js.map +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/item-loader.d.ts +0 -1
- package/dist/item-loader.js.map +1 -1
- package/dist/policy/core/PolicySource.d.ts +0 -1
- package/dist/policy/core/PolicySource.js.map +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +1 -3
- package/dist/policy/core/ToolPolicyEngine.js +1 -2
- package/dist/policy/core/ToolPolicyEngine.js.map +1 -1
- package/dist/policy/core/compose-decision.d.ts +0 -1
- package/dist/policy/core/compose-decision.js.map +1 -1
- package/dist/policy/core/decision-types.d.ts +0 -1
- package/dist/policy/core/decision-types.js.map +1 -1
- package/dist/policy/core/engine-context.d.ts +0 -1
- package/dist/policy/core/engine-context.js.map +1 -1
- package/dist/policy/core/pnp-policy-inputs.d.ts +2 -4
- 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/policy-source-tag.d.ts +0 -1
- package/dist/policy/core/policy-source-tag.js.map +1 -1
- package/dist/policy/core/provenance.d.ts +7 -35
- package/dist/policy/core/provenance.js +4 -21
- package/dist/policy/core/provenance.js.map +1 -1
- package/dist/policy/engine.d.ts +0 -1
- package/dist/policy/engine.js.map +1 -1
- package/dist/policy/internal.d.ts +0 -1
- package/dist/policy/internal.js.map +1 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +6 -20
- package/dist/policy/sources/PnpPolicySource.js +6 -19
- package/dist/policy/sources/PnpPolicySource.js.map +1 -1
- package/dist/runtime/RuntimeRegistry.d.ts +0 -1
- package/dist/runtime/RuntimeRegistry.js.map +1 -1
- package/dist/runtime/SectionRuntimeEngine.d.ts +13 -29
- package/dist/runtime/SectionRuntimeEngine.js +13 -27
- package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts +2 -3
- 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 -2
- 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 -2
- package/dist/runtime/adapter/dom-event-bridge.js +1 -1
- package/dist/runtime/adapter/dom-event-bridge.js.map +1 -1
- package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -1
- package/dist/runtime/adapter/framework-error-bridge.js.map +1 -1
- package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -1
- package/dist/runtime/adapter/instrumentation-bridge.js.map +1 -1
- package/dist/runtime/adapter/subscriber-fanout.d.ts +0 -1
- package/dist/runtime/adapter/subscriber-fanout.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/SectionEngineCore.d.ts +0 -1
- package/dist/runtime/core/SectionEngineCore.js.map +1 -1
- package/dist/runtime/core/cohort.d.ts +0 -1
- package/dist/runtime/core/cohort.js.map +1 -1
- package/dist/runtime/core/engine-input.d.ts +0 -1
- package/dist/runtime/core/engine-input.js.map +1 -1
- package/dist/runtime/core/engine-output.d.ts +2 -3
- 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 -3
- package/dist/runtime/core/engine-readiness.js.map +1 -1
- package/dist/runtime/core/engine-resolver.d.ts +13 -42
- package/dist/runtime/core/engine-resolver.js +19 -76
- package/dist/runtime/core/engine-resolver.js.map +1 -1
- package/dist/runtime/core/engine-stage-derivation.d.ts +0 -1
- package/dist/runtime/core/engine-stage-derivation.js.map +1 -1
- package/dist/runtime/core/engine-state.d.ts +0 -1
- package/dist/runtime/core/engine-state.js.map +1 -1
- package/dist/runtime/core/engine-transition.d.ts +1 -2
- package/dist/runtime/core/engine-transition.js +1 -1
- package/dist/runtime/core/engine-transition.js.map +1 -1
- package/dist/runtime/engine-context.d.ts +0 -1
- package/dist/runtime/engine-context.js.map +1 -1
- package/dist/runtime/engine.d.ts +1 -2
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/internal.d.ts +0 -1
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/registration-events.d.ts +0 -1
- package/dist/runtime/registration-events.js.map +1 -1
- package/dist/runtime/runtime-id.d.ts +0 -1
- package/dist/runtime/runtime-id.js.map +1 -1
- package/dist/runtime/section-runtime-engine-host-context.d.ts +22 -16
- 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/session-event-emitter-policy.d.ts +0 -1
- package/dist/runtime/session-event-emitter-policy.js.map +1 -1
- package/dist/runtime/stage-emit-gate.d.ts +4 -5
- package/dist/runtime/stage-emit-gate.js +3 -3
- package/dist/runtime/stage-emit-gate.js.map +1 -1
- package/dist/runtime/tool-host-contract.d.ts +0 -1
- package/dist/runtime/tool-host-contract.js.map +1 -1
- package/dist/services/AccessibilityCatalogResolver.d.ts +23 -1
- package/dist/services/AccessibilityCatalogResolver.js +200 -28
- package/dist/services/AccessibilityCatalogResolver.js.map +1 -1
- package/dist/services/ContextVariableStore.d.ts +0 -1
- package/dist/services/ContextVariableStore.js.map +1 -1
- package/dist/services/ElementToolStateStore.d.ts +0 -1
- package/dist/services/ElementToolStateStore.js.map +1 -1
- package/dist/services/HighlightCoordinator.d.ts +25 -1
- package/dist/services/HighlightCoordinator.js +125 -0
- package/dist/services/HighlightCoordinator.js.map +1 -1
- package/dist/services/I18nService.d.ts +0 -1
- package/dist/services/I18nService.js.map +1 -1
- package/dist/services/RangeSerializer.d.ts +0 -1
- package/dist/services/RangeSerializer.js.map +1 -1
- package/dist/services/SSMLExtractor.d.ts +16 -2
- package/dist/services/SSMLExtractor.js +86 -7
- package/dist/services/SSMLExtractor.js.map +1 -1
- package/dist/services/TTSService.d.ts +30 -5
- package/dist/services/TTSService.js +652 -159
- package/dist/services/TTSService.js.map +1 -1
- package/dist/services/ThemeProvider.d.ts +0 -1
- package/dist/services/ThemeProvider.js.map +1 -1
- package/dist/services/ToolConfigResolver.d.ts +0 -1
- package/dist/services/ToolConfigResolver.js.map +1 -1
- package/dist/services/ToolCoordinator.d.ts +0 -1
- package/dist/services/ToolCoordinator.js.map +1 -1
- package/dist/services/ToolRegistry.d.ts +2 -3
- package/dist/services/ToolRegistry.js +1 -1
- package/dist/services/ToolRegistry.js.map +1 -1
- package/dist/services/ToolkitCoordinator.d.ts +16 -74
- package/dist/services/ToolkitCoordinator.js +34 -113
- package/dist/services/ToolkitCoordinator.js.map +1 -1
- package/dist/services/create-tools-config.d.ts +0 -1
- package/dist/services/create-tools-config.js.map +1 -1
- package/dist/services/createDefaultToolRegistry.d.ts +0 -1
- package/dist/services/createDefaultToolRegistry.js.map +1 -1
- package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -1
- package/dist/services/defaultPersonalNeedsProfile.js.map +1 -1
- package/dist/services/framework-error-bus.d.ts +0 -1
- package/dist/services/framework-error-bus.js.map +1 -1
- package/dist/services/framework-error.d.ts +0 -1
- package/dist/services/framework-error.js.map +1 -1
- package/dist/services/interfaces.d.ts +20 -3
- package/dist/services/interfaces.js.map +1 -1
- package/dist/services/pnp-standard-features.d.ts +0 -1
- package/dist/services/pnp-standard-features.js.map +1 -1
- package/dist/services/section-controller-types.d.ts +0 -1
- package/dist/services/section-controller-types.js.map +1 -1
- package/dist/services/tool-config-defaults.d.ts +0 -1
- package/dist/services/tool-config-defaults.js.map +1 -1
- package/dist/services/tool-config-validation.d.ts +1 -2
- package/dist/services/tool-config-validation.js +7 -7
- package/dist/services/tool-config-validation.js.map +1 -1
- package/dist/services/tool-context.d.ts +0 -1
- package/dist/services/tool-context.js.map +1 -1
- package/dist/services/tool-instance-id.d.ts +0 -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/DesmosToolProvider.d.ts +0 -1
- package/dist/services/tool-providers/DesmosToolProvider.js.map +1 -1
- package/dist/services/tool-providers/TTSToolProvider.d.ts +0 -1
- package/dist/services/tool-providers/TTSToolProvider.js +3 -3
- package/dist/services/tool-providers/TTSToolProvider.js.map +1 -1
- package/dist/services/tool-providers/ToolProviderApi.d.ts +0 -1
- package/dist/services/tool-providers/ToolProviderApi.js.map +1 -1
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +0 -1
- package/dist/services/tool-providers/ToolProviderRegistry.js.map +1 -1
- package/dist/services/tool-providers/index.d.ts +0 -1
- package/dist/services/tool-providers/index.js.map +1 -1
- package/dist/services/toolbar-items.d.ts +0 -1
- package/dist/services/toolbar-items.js.map +1 -1
- package/dist/services/tools-config-normalizer.d.ts +13 -3
- 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.d.ts +0 -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 -1
- package/dist/services/tts/text-processing.js +30 -4
- package/dist/services/tts/text-processing.js.map +1 -1
- package/dist/services/tts/text-segmentation.d.ts +0 -1
- package/dist/services/tts/text-segmentation.js.map +1 -1
- package/dist/services/tts/visual-line-ranges.d.ts +0 -1
- package/dist/services/tts/visual-line-ranges.js.map +1 -1
- package/dist/services/tts-control-events.d.ts +0 -1
- package/dist/services/tts-control-events.js.map +1 -1
- package/dist/services/tts-runtime-config.d.ts +17 -2
- package/dist/services/tts-runtime-config.js +11 -1
- package/dist/services/tts-runtime-config.js.map +1 -1
- package/dist/tools/calculators/desmos-provider.d.ts +0 -1
- package/dist/tools/calculators/desmos-provider.js.map +1 -1
- package/dist/tools/client.d.ts +0 -1
- package/dist/tools/client.js.map +1 -1
- package/dist/tools/default-tool-module-loaders.d.ts +0 -1
- package/dist/tools/default-tool-module-loaders.js.map +1 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/library-loader.d.ts +0 -1
- package/dist/tools/library-loader.js.map +1 -1
- package/dist/tools/registrations/accessibility-tools.d.ts +0 -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.d.ts +0 -1
- package/dist/tools/registrations/calculator.js +41 -2
- package/dist/tools/registrations/calculator.js.map +1 -1
- package/dist/tools/registrations/interaction-tools.d.ts +0 -1
- package/dist/tools/registrations/interaction-tools.js.map +1 -1
- package/dist/tools/registrations/measurement-tools.d.ts +0 -1
- package/dist/tools/registrations/measurement-tools.js.map +1 -1
- package/dist/tools/registrations/subject-specific-tools.d.ts +0 -1
- package/dist/tools/registrations/subject-specific-tools.js.map +1 -1
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts +0 -1
- package/dist/tools/registrations/toolbar-registration-helpers.js.map +1 -1
- package/dist/tools/registrations/tts.d.ts +0 -1
- package/dist/tools/registrations/tts.js.map +1 -1
- package/dist/tools/response-discovery.d.ts +0 -1
- package/dist/tools/response-discovery.js.map +1 -1
- package/dist/tools/tool-tag-map.d.ts +0 -1
- package/dist/tools/tool-tag-map.js +0 -1
- package/dist/tools/tool-tag-map.js.map +1 -1
- package/dist/tools/types.d.ts +0 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/variant-resolver.d.ts +0 -1
- package/dist/tools/variant-resolver.js.map +1 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js.map +1 -1
- package/package.json +8 -11
- package/dist/attempt/AssessmentSession.d.ts.map +0 -1
- package/dist/attempt/TestSession.d.ts.map +0 -1
- package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts.map +0 -1
- package/dist/components/item-toolbar-element.d.ts.map +0 -1
- package/dist/components/pie-assessment-toolkit-element.d.ts.map +0 -1
- package/dist/components/section-toolbar-element.d.ts.map +0 -1
- package/dist/context/assessment-toolkit-context.d.ts.map +0 -1
- package/dist/context/runtime-context-consumer.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/item-loader.d.ts.map +0 -1
- package/dist/policy/core/PolicySource.d.ts.map +0 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts.map +0 -1
- package/dist/policy/core/compose-decision.d.ts.map +0 -1
- package/dist/policy/core/decision-types.d.ts.map +0 -1
- package/dist/policy/core/engine-context.d.ts.map +0 -1
- package/dist/policy/core/pnp-policy-inputs.d.ts.map +0 -1
- package/dist/policy/core/policy-source-tag.d.ts.map +0 -1
- package/dist/policy/core/provenance.d.ts.map +0 -1
- package/dist/policy/engine.d.ts.map +0 -1
- package/dist/policy/internal.d.ts.map +0 -1
- package/dist/policy/sources/PnpPolicySource.d.ts.map +0 -1
- package/dist/runtime/RuntimeRegistry.d.ts.map +0 -1
- package/dist/runtime/SectionRuntimeEngine.d.ts.map +0 -1
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts.map +0 -1
- package/dist/runtime/adapter/coordinator-bridge.d.ts.map +0 -1
- package/dist/runtime/adapter/dom-event-bridge.d.ts.map +0 -1
- package/dist/runtime/adapter/framework-error-bridge.d.ts.map +0 -1
- package/dist/runtime/adapter/instrumentation-bridge.d.ts.map +0 -1
- package/dist/runtime/adapter/subscriber-fanout.d.ts.map +0 -1
- package/dist/runtime/core/SectionEngineCore.d.ts.map +0 -1
- package/dist/runtime/core/cohort.d.ts.map +0 -1
- package/dist/runtime/core/engine-input.d.ts.map +0 -1
- package/dist/runtime/core/engine-output.d.ts.map +0 -1
- package/dist/runtime/core/engine-readiness.d.ts.map +0 -1
- package/dist/runtime/core/engine-resolver.d.ts.map +0 -1
- package/dist/runtime/core/engine-stage-derivation.d.ts.map +0 -1
- package/dist/runtime/core/engine-state.d.ts.map +0 -1
- package/dist/runtime/core/engine-transition.d.ts.map +0 -1
- package/dist/runtime/engine-context.d.ts.map +0 -1
- package/dist/runtime/engine.d.ts.map +0 -1
- package/dist/runtime/internal.d.ts.map +0 -1
- package/dist/runtime/registration-events.d.ts.map +0 -1
- package/dist/runtime/runtime-id.d.ts.map +0 -1
- package/dist/runtime/section-runtime-engine-host-context.d.ts.map +0 -1
- package/dist/runtime/session-event-emitter-policy.d.ts.map +0 -1
- package/dist/runtime/stage-emit-gate.d.ts.map +0 -1
- package/dist/runtime/tool-host-contract.d.ts.map +0 -1
- package/dist/services/AccessibilityCatalogResolver.d.ts.map +0 -1
- package/dist/services/ContextVariableStore.d.ts.map +0 -1
- package/dist/services/ElementToolStateStore.d.ts.map +0 -1
- package/dist/services/HighlightCoordinator.d.ts.map +0 -1
- package/dist/services/I18nService.d.ts.map +0 -1
- package/dist/services/PNPToolResolver.d.ts +0 -281
- package/dist/services/PNPToolResolver.d.ts.map +0 -1
- package/dist/services/PNPToolResolver.js +0 -514
- package/dist/services/PNPToolResolver.js.map +0 -1
- package/dist/services/RangeSerializer.d.ts.map +0 -1
- package/dist/services/SSMLExtractor.d.ts.map +0 -1
- package/dist/services/TTSService.d.ts.map +0 -1
- package/dist/services/ThemeProvider.d.ts.map +0 -1
- package/dist/services/ToolConfigResolver.d.ts.map +0 -1
- package/dist/services/ToolCoordinator.d.ts.map +0 -1
- package/dist/services/ToolRegistry.d.ts.map +0 -1
- package/dist/services/ToolkitCoordinator.d.ts.map +0 -1
- package/dist/services/create-tools-config.d.ts.map +0 -1
- package/dist/services/createDefaultToolRegistry.d.ts.map +0 -1
- package/dist/services/defaultPersonalNeedsProfile.d.ts.map +0 -1
- package/dist/services/framework-error-bus.d.ts.map +0 -1
- package/dist/services/framework-error.d.ts.map +0 -1
- package/dist/services/interfaces.d.ts.map +0 -1
- package/dist/services/pnp-provenance.d.ts +0 -167
- package/dist/services/pnp-provenance.d.ts.map +0 -1
- package/dist/services/pnp-provenance.js +0 -231
- package/dist/services/pnp-provenance.js.map +0 -1
- package/dist/services/pnp-standard-features.d.ts.map +0 -1
- package/dist/services/section-controller-types.d.ts.map +0 -1
- package/dist/services/tool-config-defaults.d.ts.map +0 -1
- package/dist/services/tool-config-validation.d.ts.map +0 -1
- package/dist/services/tool-context.d.ts.map +0 -1
- package/dist/services/tool-instance-id.d.ts.map +0 -1
- package/dist/services/tool-providers/DesmosToolProvider.d.ts.map +0 -1
- package/dist/services/tool-providers/TTSToolProvider.d.ts.map +0 -1
- package/dist/services/tool-providers/ToolProviderApi.d.ts.map +0 -1
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts.map +0 -1
- package/dist/services/tool-providers/index.d.ts.map +0 -1
- package/dist/services/toolbar-items.d.ts.map +0 -1
- package/dist/services/tools-config-normalizer.d.ts.map +0 -1
- package/dist/services/tts/browser-provider.d.ts.map +0 -1
- package/dist/services/tts/text-processing.d.ts.map +0 -1
- package/dist/services/tts/text-segmentation.d.ts.map +0 -1
- package/dist/services/tts/visual-line-ranges.d.ts.map +0 -1
- package/dist/services/tts-control-events.d.ts.map +0 -1
- package/dist/services/tts-runtime-config.d.ts.map +0 -1
- package/dist/tools/calculators/desmos-provider.d.ts.map +0 -1
- package/dist/tools/client.d.ts.map +0 -1
- package/dist/tools/default-tool-module-loaders.d.ts.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/library-loader.d.ts.map +0 -1
- package/dist/tools/registrations/accessibility-tools.d.ts.map +0 -1
- package/dist/tools/registrations/calculator.d.ts.map +0 -1
- package/dist/tools/registrations/interaction-tools.d.ts.map +0 -1
- package/dist/tools/registrations/measurement-tools.d.ts.map +0 -1
- package/dist/tools/registrations/subject-specific-tools.d.ts.map +0 -1
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts.map +0 -1
- package/dist/tools/registrations/tts.d.ts.map +0 -1
- package/dist/tools/response-discovery.d.ts.map +0 -1
- package/dist/tools/tool-tag-map.d.ts.map +0 -1
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/variant-resolver.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool Policy Provenance —
|
|
3
|
-
* (M8 — see `.cursor/plans/m8-design.md` § 4).
|
|
2
|
+
* Tool Policy Provenance (M8 — see `.cursor/plans/m8-design.md` § 4).
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* shape to track decisions from every Pass-1 contributor — host
|
|
8
|
-
* placement, host policy, provider veto, PNP/profile gates, and custom policy
|
|
9
|
-
* sources — without losing PNP debugger compatibility.
|
|
10
|
-
*
|
|
11
|
-
* **Compatibility posture.** This module is the new home of the shape;
|
|
12
|
-
* the legacy `pnp-provenance.ts` module remains untouched in PR 1 and
|
|
13
|
-
* is deleted in PR 5 (the rip-out PR) once every consumer has migrated
|
|
14
|
-
* to the engine. The shape stays structurally compatible: existing
|
|
15
|
-
* fields (`contextId`, `resolvedAt`, `sources`, `features`,
|
|
16
|
-
* `decisionLog`, `summary`) are preserved verbatim. The rule
|
|
17
|
-
* vocabulary expands, and `ResolutionDecision.precedence` widens from
|
|
18
|
-
* `1 | 2 | 3 | 4 | 5 | 6` to a `number` so non-profile rules can fit
|
|
19
|
-
* (the PNP/profile rules continue to use `1`–`6` exactly as before).
|
|
4
|
+
* Tracks decisions from every Pass-1 contributor: host placement, host policy,
|
|
5
|
+
* provider veto, PNP/profile gates, and custom policy sources.
|
|
20
6
|
*/
|
|
21
7
|
/**
|
|
22
|
-
* Builder
|
|
23
|
-
* `ToolPolicyProvenance` shape. Identical API where the field names
|
|
24
|
-
* overlap so an `M8 PR 5` rename of the legacy builder is a near-pure
|
|
25
|
-
* import-path swap.
|
|
8
|
+
* Builder for `ToolPolicyProvenance`.
|
|
26
9
|
*/
|
|
27
10
|
export class ToolPolicyProvenanceBuilder {
|
|
28
11
|
provenance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provenance.js","sourceRoot":"","sources":["../../../src/policy/core/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAkHH;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IAC/B,UAAU,CAAuB;IACjC,WAAW,GAAG,CAAC,CAAC;IAExB,YAAY,SAAiB;QAC5B,IAAI,CAAC,UAAU,GAAG;YACjB,SAAS;YACT,UAAU,EAAE,IAAI,IAAI,EAAE;YACtB,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI,GAAG,EAAE;YACnB,WAAW,EAAE,EAAE;YACf,OAAO,EAAE;gBACR,aAAa,EAAE,CAAC;gBAChB,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,aAAa,EAAE,CAAC;gBAChB,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;aACV;SACD,CAAC;IACH,CAAC;IAED,SAAS,CACR,IAA2C,EAC3C,IAAqD;QAErD,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI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K,UAAU;QACvB,CAAC,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CACnC,CAAC;IACF,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,WAAW,IAAI,2BAA2B,CAAC;QAC3C,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC5B,WAAW,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC;QAC7C,CAAC;IACF,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["/**\n * Tool Policy Provenance (M8 — see `.cursor/plans/m8-design.md` § 4).\n *\n * Tracks decisions from every Pass-1 contributor: host placement, host policy,\n * provider veto, PNP/profile gates, and custom policy sources.\n */\n\n/**\n * Rule vocabulary for tool policy decisions.\n */\nexport type ToolPolicyDecisionRule =\n\t| \"district-block\"\n\t| \"test-admin-override\"\n\t| \"item-restriction\"\n\t| \"item-requirement\"\n\t| \"district-requirement\"\n\t| \"pnp-support\"\n\t| \"pnp-prohibited\"\n\t| \"placement-membership\"\n\t| \"provider-disabled\"\n\t| \"host-allowlist\"\n\t| \"host-blocked\"\n\t| \"required-tool-blocked\"\n\t| \"custom-source\"\n\t| \"system-default\";\n\nexport type ToolPolicySourceType =\n\t| \"organization\"\n\t| \"assessment\"\n\t| \"section\"\n\t| \"item\"\n\t| \"student\"\n\t| \"system\"\n\t| \"host\"\n\t| \"custom\";\n\nexport interface ToolPolicyResolutionDecision {\n\t/** Monotonic step index across the entire decision log. */\n\tstep: number;\n\n\t/**\n\t * Precedence level. PNP/profile rules use `1`–`6`; non-profile rules use `0`\n\t * for host-side gates or `7+` for custom sources that run after PNP/profile policy.\n\t */\n\tprecedence: number;\n\n\trule: ToolPolicyDecisionRule;\n\n\t/** Tool ID being resolved (post-PNP-support-mapping where applicable). */\n\tfeatureId: string;\n\n\taction: \"block\" | \"enable\" | \"skip\" | \"advisory\";\n\n\tsource: {\n\t\ttype: ToolPolicySourceType;\n\t\tid?: string;\n\t\tname?: string;\n\t};\n\n\treason: string;\n\n\tvalue?: unknown;\n\n\ttimestamp: Date;\n}\n\nexport interface ToolPolicyFeatureTrail {\n\tfeatureId: string;\n\tfinalState: \"enabled\" | \"blocked\" | \"not-configured\" | \"advisory-only\";\n\twinningDecision?: ToolPolicyResolutionDecision;\n\tallDecisions: ToolPolicyResolutionDecision[];\n\texplanation: string;\n}\n\nexport interface ToolPolicyProvenance {\n\tcontextId: string;\n\tresolvedAt: Date;\n\tsources: {\n\t\torganization?: { id: string; name: string; pnpDefaults?: unknown };\n\t\tassessment?: { id: string; name: string; settings?: unknown };\n\t\tsection?: { id: string; title?: string; settings?: unknown };\n\t\titem?: { id: string; name?: string; settings?: unknown };\n\t\tstudent?: { id: string; pnpProfile?: unknown };\n\t\thost?: { id: string; config?: unknown };\n\t};\n\tfeatures: Map<string, ToolPolicyFeatureTrail>;\n\tdecisionLog: ToolPolicyResolutionDecision[];\n\tsummary: {\n\t\ttotalFeatures: number;\n\t\tenabled: number;\n\t\tblocked: number;\n\t\tnotConfigured: number;\n\t\tbySource: Record<string, number>;\n\t\tbyRule: Record<string, number>;\n\t};\n}\n\ninterface AddDecisionParams {\n\tprecedence: number;\n\trule: ToolPolicyDecisionRule;\n\tfeatureId: string;\n\taction: ToolPolicyResolutionDecision[\"action\"];\n\tsourceType: ToolPolicySourceType;\n\tsourceId?: string;\n\tsourceName?: string;\n\treason: string;\n\tvalue?: unknown;\n}\n\n/**\n * Builder for `ToolPolicyProvenance`.\n */\nexport class ToolPolicyProvenanceBuilder {\n\tprivate provenance: ToolPolicyProvenance;\n\tprivate stepCounter = 0;\n\n\tconstructor(contextId: string) {\n\t\tthis.provenance = {\n\t\t\tcontextId,\n\t\t\tresolvedAt: new Date(),\n\t\t\tsources: {},\n\t\t\tfeatures: new Map(),\n\t\t\tdecisionLog: [],\n\t\t\tsummary: {\n\t\t\t\ttotalFeatures: 0,\n\t\t\t\tenabled: 0,\n\t\t\t\tblocked: 0,\n\t\t\t\tnotConfigured: 0,\n\t\t\t\tbySource: {},\n\t\t\t\tbyRule: {},\n\t\t\t},\n\t\t};\n\t}\n\n\taddSource(\n\t\ttype: keyof ToolPolicyProvenance[\"sources\"],\n\t\tdata: { id: string; name?: string; config?: unknown },\n\t): this {\n\t\tconst base = { id: data.id, name: data.name ?? data.id };\n\t\tswitch (type) {\n\t\t\tcase \"organization\":\n\t\t\t\tthis.provenance.sources.organization = {\n\t\t\t\t\t...base,\n\t\t\t\t\tpnpDefaults: data.config,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase \"assessment\":\n\t\t\t\tthis.provenance.sources.assessment = {\n\t\t\t\t\t...base,\n\t\t\t\t\tsettings: data.config,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase \"section\":\n\t\t\t\tthis.provenance.sources.section = { ...base, settings: data.config };\n\t\t\t\tbreak;\n\t\t\tcase \"item\":\n\t\t\t\tthis.provenance.sources.item = { ...base, settings: data.config };\n\t\t\t\tbreak;\n\t\t\tcase \"student\":\n\t\t\t\tthis.provenance.sources.student = {\n\t\t\t\t\tid: data.id,\n\t\t\t\t\tpnpProfile: data.config,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase \"host\":\n\t\t\t\tthis.provenance.sources.host = { id: data.id, config: data.config };\n\t\t\t\tbreak;\n\t\t}\n\t\treturn this;\n\t}\n\n\taddDecision(params: AddDecisionParams): this {\n\t\tconst decision: ToolPolicyResolutionDecision = {\n\t\t\tstep: ++this.stepCounter,\n\t\t\tprecedence: params.precedence,\n\t\t\trule: params.rule,\n\t\t\tfeatureId: params.featureId,\n\t\t\taction: params.action,\n\t\t\tsource: {\n\t\t\t\ttype: params.sourceType,\n\t\t\t\tid: params.sourceId,\n\t\t\t\tname: params.sourceName,\n\t\t\t},\n\t\t\treason: params.reason,\n\t\t\tvalue: params.value,\n\t\t\ttimestamp: new Date(),\n\t\t};\n\n\t\tthis.provenance.decisionLog.push(decision);\n\n\t\tlet trail = this.provenance.features.get(params.featureId);\n\t\tif (!trail) {\n\t\t\ttrail = {\n\t\t\t\tfeatureId: params.featureId,\n\t\t\t\tfinalState: \"not-configured\",\n\t\t\t\tallDecisions: [],\n\t\t\t\texplanation: \"\",\n\t\t\t};\n\t\t\tthis.provenance.features.set(params.featureId, trail);\n\t\t}\n\t\ttrail.allDecisions.push(decision);\n\n\t\t// \"advisory\" doesn't change finalState — it preserves the existing\n\t\t// blocked/enabled state and only flags a documented conflict.\n\t\tif (params.action === \"advisory\") {\n\t\t\tif (trail.finalState === \"not-configured\") {\n\t\t\t\ttrail.finalState = \"advisory-only\";\n\t\t\t}\n\t\t} else if (params.action !== \"skip\") {\n\t\t\tconst isWinning =\n\t\t\t\t!trail.winningDecision ||\n\t\t\t\tdecision.precedence < trail.winningDecision.precedence;\n\t\t\tif (isWinning) {\n\t\t\t\ttrail.winningDecision = decision;\n\t\t\t\ttrail.finalState = decision.action === \"enable\" ? \"enabled\" : \"blocked\";\n\t\t\t}\n\t\t}\n\n\t\tthis.provenance.summary.bySource[params.sourceType] =\n\t\t\t(this.provenance.summary.bySource[params.sourceType] || 0) + 1;\n\t\tthis.provenance.summary.byRule[params.rule] =\n\t\t\t(this.provenance.summary.byRule[params.rule] || 0) + 1;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Reconcile every feature's `finalState` against the post-pipeline\n\t * candidate set.\n\t *\n\t * The eager `finalState` updates inside `addDecision` track the\n\t * highest-precedence non-skip decision per feature, but a tool's\n\t * *actual* visibility is only known after step 6 of the\n\t * composition pipeline — earlier decisions can be reversed by\n\t * later host gates, PNP/profile gates, or custom sources. This method\n\t * walks every feature trail and rewrites `finalState` from the\n\t * final candidate set so callers can rely on\n\t * `provenance.features.get(toolId)?.finalState` as the canonical\n\t * \"is this tool visible right now?\" answer (M8 design § 4 + § 12).\n\t *\n\t * Semantics applied per feature:\n\t * - In `survivingIds` → \"enabled\"\n\t * - Not in `survivingIds`, has any non-skip decision → \"blocked\"\n\t * - Not in `survivingIds`, only advisory decisions → \"advisory-only\"\n\t * - Otherwise → \"not-configured\"\n\t *\n\t * Surviving features without any logged decisions get a synthetic\n\t * \"enabled\" trail so the provenance is dense enough for hosts that\n\t * iterate `provenance.features` to find the visible set.\n\t */\n\treconcileFinalStates(survivingIds: ReadonlySet<string>): this {\n\t\tfor (const featureId of survivingIds) {\n\t\t\tlet trail = this.provenance.features.get(featureId);\n\t\t\tif (!trail) {\n\t\t\t\ttrail = {\n\t\t\t\t\tfeatureId,\n\t\t\t\t\tfinalState: \"enabled\",\n\t\t\t\t\tallDecisions: [],\n\t\t\t\t\texplanation: \"\",\n\t\t\t\t};\n\t\t\t\tthis.provenance.features.set(featureId, trail);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttrail.finalState = \"enabled\";\n\t\t}\n\n\t\tfor (const trail of this.provenance.features.values()) {\n\t\t\tif (survivingIds.has(trail.featureId)) continue;\n\t\t\tconst hasNonSkip = trail.allDecisions.some(\n\t\t\t\t(d) => d.action !== \"skip\" && d.action !== \"advisory\",\n\t\t\t);\n\t\t\tconst hasAdvisory = trail.allDecisions.some(\n\t\t\t\t(d) => d.action === \"advisory\",\n\t\t\t);\n\t\t\tif (hasNonSkip) {\n\t\t\t\ttrail.finalState = \"blocked\";\n\t\t\t} else if (hasAdvisory) {\n\t\t\t\ttrail.finalState = \"advisory-only\";\n\t\t\t} else {\n\t\t\t\ttrail.finalState = \"not-configured\";\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\tbuild(): ToolPolicyProvenance {\n\t\tfor (const trail of this.provenance.features.values()) {\n\t\t\ttrail.explanation = generateExplanation(trail);\n\t\t}\n\t\tfor (const trail of this.provenance.features.values()) {\n\t\t\tthis.provenance.summary.totalFeatures++;\n\t\t\tif (trail.finalState === \"enabled\") {\n\t\t\t\tthis.provenance.summary.enabled++;\n\t\t\t} else if (trail.finalState === \"blocked\") {\n\t\t\t\tthis.provenance.summary.blocked++;\n\t\t\t} else {\n\t\t\t\tthis.provenance.summary.notConfigured++;\n\t\t\t}\n\t\t}\n\t\treturn this.provenance;\n\t}\n}\n\nfunction generateExplanation(trail: ToolPolicyFeatureTrail): string {\n\tif (!trail.winningDecision) {\n\t\tif (trail.finalState === \"advisory-only\") {\n\t\t\tconst advisory = trail.allDecisions.find((d) => d.action === \"advisory\");\n\t\t\treturn advisory\n\t\t\t\t? `Feature \"${trail.featureId}\" was kept in its host-decided state; ${advisory.reason}`\n\t\t\t\t: `Feature \"${trail.featureId}\" carries an advisory note.`;\n\t\t}\n\t\treturn `Feature \"${trail.featureId}\" was not configured at any level.`;\n\t}\n\n\tconst decision = trail.winningDecision;\n\tconst sourceName = decision.source.name || decision.source.type;\n\tlet explanation = `Feature \"${trail.featureId}\" is ${trail.finalState}.\\n\\n`;\n\texplanation += `**Primary Reason** (${decision.rule}):\\n`;\n\texplanation += `${decision.reason}\\n`;\n\texplanation += `Source: ${sourceName} (${decision.source.type})\\n`;\n\tconst overridden = trail.allDecisions.filter(\n\t\t(d) =>\n\t\t\td.step !== decision.step &&\n\t\t\td.action !== \"skip\" &&\n\t\t\td.action !== \"advisory\" &&\n\t\t\td.precedence > decision.precedence,\n\t);\n\tif (overridden.length > 0) {\n\t\texplanation += `\\n**Overridden Rules**:\\n`;\n\t\tfor (const d of overridden) {\n\t\t\texplanation += `- ${d.rule}: ${d.reason}\\n`;\n\t\t}\n\t}\n\treturn explanation;\n}\n\n"]}
|
package/dist/policy/engine.d.ts
CHANGED
|
@@ -25,4 +25,3 @@ export type { RequiredToolBlockedDetails, ToolPolicyDecision, ToolPolicyDecision
|
|
|
25
25
|
export type { PolicySource, PolicySourceDecisionContext, PolicySourceProvenanceEntry, PolicySourceResult, } from "./core/PolicySource.js";
|
|
26
26
|
export type { PolicySourceTag, PnpPolicySourceRule, PnpPolicySourceTag, CustomPolicySourceTag, } from "./core/policy-source-tag.js";
|
|
27
27
|
export type { ToolPolicyDecisionRule, ToolPolicyFeatureTrail, ToolPolicyProvenance, ToolPolicyResolutionDecision, ToolPolicySourceType, } from "./core/provenance.js";
|
|
28
|
-
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,gBAAgB,GAOhB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,sBAAsB,GAEtB,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,gBAAgB,GAOhB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,sBAAsB,GAEtB,MAAM,0BAA0B,CAAC","sourcesContent":["/**\n * Tool policy engine — facade entry point (M8 PR 1).\n *\n * Narrow, stable public surface for hosts that want to instantiate or\n * consume a `ToolPolicyEngine`. Re-exports the engine class, its\n * decision request/response types, the Svelte context key, and the\n * minimal `PolicySource` extension contract.\n *\n * **Pairing.** This module is the stable counterpart to\n * `./policy/internal`, which exposes the wider, evolving surface\n * (composition pipeline, provenance builder, PNP policy source). Consumers\n * that only need to drive an engine and read its decisions should\n * import from here. Consumers that need to reach past the facade\n * (e.g. test the composition pipeline directly, build a custom PNP policy\n * source variant, instrument provenance generation) should import\n * from `./policy/internal` and accept the documented stability\n * disclaimer there.\n *\n * Mirrors the M7 `runtime/engine` / `runtime/internal` split — see\n * the same rationale in `src/runtime/engine.ts`.\n */\n\nexport {\n\tToolPolicyEngine,\n\ttype PnpEnforcementMode,\n\ttype ResolvedEngineInputs,\n\ttype ToolPolicyChangeEvent,\n\ttype ToolPolicyChangeListener,\n\ttype ToolPolicyEngineArgs,\n\ttype ToolPolicyEngineInputs,\n} from \"./core/ToolPolicyEngine.js\";\n\nexport {\n\tTOOL_POLICY_ENGINE_KEY,\n\ttype ToolPolicyEngineContext,\n} from \"./core/engine-context.js\";\n\nexport type {\n\tRequiredToolBlockedDetails,\n\tToolPolicyDecision,\n\tToolPolicyDecisionRequest,\n\tToolPolicyDiagnostic,\n\tToolPolicyDiagnosticCode,\n\tToolPolicyEntry,\n\tToolPolicyHostGate,\n\tToolScope,\n} from \"./core/decision-types.js\";\n\nexport type {\n\tPolicySource,\n\tPolicySourceDecisionContext,\n\tPolicySourceProvenanceEntry,\n\tPolicySourceResult,\n} from \"./core/PolicySource.js\";\n\nexport type {\n\tPolicySourceTag,\n\tPnpPolicySourceRule,\n\tPnpPolicySourceTag,\n\tCustomPolicySourceTag,\n} from \"./core/policy-source-tag.js\";\n\nexport type {\n\tToolPolicyDecisionRule,\n\tToolPolicyFeatureTrail,\n\tToolPolicyProvenance,\n\tToolPolicyResolutionDecision,\n\tToolPolicySourceType,\n} from \"./core/provenance.js\";\n"]}
|
|
@@ -23,4 +23,3 @@ export { composeDecision, type ComposeDecisionInputs, } from "./core/compose-dec
|
|
|
23
23
|
export { PnpPolicySource, type PnpPolicyApplyArgs, type PnpPolicyDecisionEvent, type PnpPolicyResult, type PnpPolicyToolFlags, } from "./sources/PnpPolicySource.js";
|
|
24
24
|
export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
|
|
25
25
|
export { assessmentHasPnpPolicyInputs, itemRefHasPnpPolicyInputs, resolveDefaultPnpEnforcement, } from "./core/pnp-policy-inputs.js";
|
|
26
|
-
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/policy/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,eAAe,GAEf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,eAAe,GAKf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EACN,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/policy/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,eAAe,GAEf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,eAAe,GAKf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EACN,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * Tool policy engine — **internal** entry point (M8 PR 1).\n *\n * Re-exports the composition pipeline, the PNP policy source, and the\n * provenance builder for advanced hosts that want to drive the engine\n * components directly, and for the engine's own tests.\n *\n * **Stability posture.** This module is **not** part of the stable\n * public API. Symbols here are subject to change between minor\n * versions with only a changeset note. Hosts that need long-term\n * stability should depend on the facade (`ToolPolicyEngine` exported\n * from `./policy/engine`) instead.\n *\n * The split is intentional:\n * - `./policy/engine` — narrow, stable facade for common host\n * wiring and Svelte context.\n * - `./policy/internal` — wide, evolving surface for the\n * composition pipeline, PNP policy source, and\n * any host that wants to reach past the\n * facade.\n */\n\nexport {\n\tcomposeDecision,\n\ttype ComposeDecisionInputs,\n} from \"./core/compose-decision.js\";\n\nexport {\n\tPnpPolicySource,\n\ttype PnpPolicyApplyArgs,\n\ttype PnpPolicyDecisionEvent,\n\ttype PnpPolicyResult,\n\ttype PnpPolicyToolFlags,\n} from \"./sources/PnpPolicySource.js\";\n\nexport { ToolPolicyProvenanceBuilder } from \"./core/provenance.js\";\n\nexport {\n\tassessmentHasPnpPolicyInputs,\n\titemRefHasPnpPolicyInputs,\n\tresolveDefaultPnpEnforcement,\n} from \"./core/pnp-policy-inputs.js\";\n"]}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PNP Policy Source
|
|
3
|
-
* (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5
|
|
2
|
+
* PNP Policy Source for the M8 engine
|
|
3
|
+
* (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5).
|
|
4
4
|
*
|
|
5
|
-
* This source applies the PNP/profile precedence rules
|
|
6
|
-
* `PnpToolResolver` but exposes them as a `(candidates, pnpPolicyInputs) →
|
|
5
|
+
* This source applies the PNP/profile precedence rules as a `(candidates, pnpPolicyInputs) →
|
|
7
6
|
* (refinedCandidates, perToolFlags, mandates, decisions)` function the
|
|
8
7
|
* engine can call once per `decide(...)` request, with all results
|
|
9
8
|
* routed through the unified `ToolPolicyProvenanceBuilder`.
|
|
10
|
-
*
|
|
11
|
-
* **Why this lives next to the legacy resolver instead of replacing
|
|
12
|
-
* it.** PR 1 introduces the engine without callers; the legacy
|
|
13
|
-
* `PnpToolResolver` is still in active use by `<pie-item-toolbar>`
|
|
14
|
-
* and by external tests. PR 5 deletes the legacy class once the
|
|
15
|
-
* toolbar (PR 3) and the PNP default flip (PR 4) have landed and the
|
|
16
|
-
* caller list is empty. Until then this source is the *canonical*
|
|
17
|
-
* implementation and the legacy class is the deprecated mirror.
|
|
18
9
|
*/
|
|
19
10
|
import type { AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-players-shared/types";
|
|
20
11
|
import type { ToolRegistry } from "../../services/ToolRegistry.js";
|
|
@@ -122,25 +113,20 @@ export declare class PnpPolicySource {
|
|
|
122
113
|
* strings for tools the registry does not (yet) carry without
|
|
123
114
|
* losing them in policy evaluation.
|
|
124
115
|
*
|
|
125
|
-
*
|
|
126
|
-
* see `tests/policy/PnpPolicySource.test.ts` for the regression
|
|
127
|
-
* lock.
|
|
116
|
+
* `tests/policy/PnpPolicySource.test.ts` locks this mapping behavior.
|
|
128
117
|
*/
|
|
129
118
|
private mapSupportToToolId;
|
|
130
119
|
/**
|
|
131
120
|
* Resolve tool-specific settings, item-level taking precedence over
|
|
132
121
|
* assessment-level.
|
|
133
122
|
*
|
|
134
|
-
* Uses `??` (nullish-coalescing)
|
|
135
|
-
* `||`. Tool config values are typed `unknown` and may legitimately
|
|
123
|
+
* Uses `??` (nullish-coalescing). Tool config values are typed `unknown` and may legitimately
|
|
136
124
|
* be `false` / `0` / `""` (e.g. a tool whose canonical "off" config
|
|
137
125
|
* is the literal `false`). `||` would treat those as missing and
|
|
138
126
|
* silently fall through to the assessment-level config, masking the
|
|
139
127
|
* authored item-level intent. `??` only falls through on
|
|
140
128
|
* `null`/`undefined`, which matches the semantic of "value not
|
|
141
|
-
* provided."
|
|
142
|
-
* `PnpToolResolver` (M8 PR 1).
|
|
129
|
+
* provided."
|
|
143
130
|
*/
|
|
144
131
|
private resolveToolSettings;
|
|
145
132
|
}
|
|
146
|
-
//# sourceMappingURL=PnpPolicySource.d.ts.map
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PNP Policy Source
|
|
3
|
-
* (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5
|
|
2
|
+
* PNP Policy Source for the M8 engine
|
|
3
|
+
* (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5).
|
|
4
4
|
*
|
|
5
|
-
* This source applies the PNP/profile precedence rules
|
|
6
|
-
* `PnpToolResolver` but exposes them as a `(candidates, pnpPolicyInputs) →
|
|
5
|
+
* This source applies the PNP/profile precedence rules as a `(candidates, pnpPolicyInputs) →
|
|
7
6
|
* (refinedCandidates, perToolFlags, mandates, decisions)` function the
|
|
8
7
|
* engine can call once per `decide(...)` request, with all results
|
|
9
8
|
* routed through the unified `ToolPolicyProvenanceBuilder`.
|
|
10
|
-
*
|
|
11
|
-
* **Why this lives next to the legacy resolver instead of replacing
|
|
12
|
-
* it.** PR 1 introduces the engine without callers; the legacy
|
|
13
|
-
* `PnpToolResolver` is still in active use by `<pie-item-toolbar>`
|
|
14
|
-
* and by external tests. PR 5 deletes the legacy class once the
|
|
15
|
-
* toolbar (PR 3) and the PNP default flip (PR 4) have landed and the
|
|
16
|
-
* caller list is empty. Until then this source is the *canonical*
|
|
17
|
-
* implementation and the legacy class is the deprecated mirror.
|
|
18
9
|
*/
|
|
19
10
|
export class PnpPolicySource {
|
|
20
11
|
id = "pnp";
|
|
@@ -239,9 +230,7 @@ export class PnpPolicySource {
|
|
|
239
230
|
* strings for tools the registry does not (yet) carry without
|
|
240
231
|
* losing them in policy evaluation.
|
|
241
232
|
*
|
|
242
|
-
*
|
|
243
|
-
* see `tests/policy/PnpPolicySource.test.ts` for the regression
|
|
244
|
-
* lock.
|
|
233
|
+
* `tests/policy/PnpPolicySource.test.ts` locks this mapping behavior.
|
|
245
234
|
*/
|
|
246
235
|
mapSupportToToolId(supportId) {
|
|
247
236
|
const toolIds = this.toolRegistry.getToolsByPNPSupport(supportId);
|
|
@@ -253,15 +242,13 @@ export class PnpPolicySource {
|
|
|
253
242
|
* Resolve tool-specific settings, item-level taking precedence over
|
|
254
243
|
* assessment-level.
|
|
255
244
|
*
|
|
256
|
-
* Uses `??` (nullish-coalescing)
|
|
257
|
-
* `||`. Tool config values are typed `unknown` and may legitimately
|
|
245
|
+
* Uses `??` (nullish-coalescing). Tool config values are typed `unknown` and may legitimately
|
|
258
246
|
* be `false` / `0` / `""` (e.g. a tool whose canonical "off" config
|
|
259
247
|
* is the literal `false`). `||` would treat those as missing and
|
|
260
248
|
* silently fall through to the assessment-level config, masking the
|
|
261
249
|
* authored item-level intent. `??` only falls through on
|
|
262
250
|
* `null`/`undefined`, which matches the semantic of "value not
|
|
263
|
-
* provided."
|
|
264
|
-
* `PnpToolResolver` (M8 PR 1).
|
|
251
|
+
* provided."
|
|
265
252
|
*/
|
|
266
253
|
resolveToolSettings(supportId, ctx) {
|
|
267
254
|
return (ctx.itemSettings?.toolParameters?.[supportId] ??
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PnpPolicySource.js","sourceRoot":"","sources":["../../../src/policy/sources/PnpPolicySource.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AAgE;QAChE,8DAA8D;QAC9D,oDAAoD;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QAClD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;YAClB,UAAU,EAAE,CAAC;YACb,IAAI,EAAE,aAAa;YACnB,SAAS,EAAE,MAAM;YACjB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,YAAY,SAAS,+BAA+B;YAC5D,KAAK,EAAE,EAAE,SAAS,EAAE;SACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACK,kBAAkB,CAAC,SAAiB;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAClE,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACzC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;OAWG;IACK,mBAAmB,CAC1B,SAAiB,EACjB,GAAyB;QAEzB,OAAO,CACN,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,CAAC,SAAS,CAAC;YAC7C,GAAG,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAC5B,CAAC;IACH,CAAC;CACD","sourcesContent":["/**\n * PNP Policy Source for the M8 engine\n * (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5).\n *\n * This source applies the PNP/profile precedence rules as a `(candidates, pnpPolicyInputs) →\n * (refinedCandidates, perToolFlags, mandates, decisions)` function the\n * engine can call once per `decide(...)` request, with all results\n * routed through the unified `ToolPolicyProvenanceBuilder`.\n */\n\nimport type {\n\tAssessmentEntity,\n\tAssessmentItemRef,\n\tAssessmentSettings,\n\tItemSettings,\n\tPersonalNeedsProfile,\n} from \"@pie-players/pie-players-shared/types\";\n\nimport type { ToolRegistry } from \"../../services/ToolRegistry.js\";\nimport type {\n\tToolPolicyResolutionDecision,\n\tToolPolicySourceType,\n} from \"../core/provenance.js\";\nimport type { PnpPolicySourceRule } from \"../core/policy-source-tag.js\";\n\n/** Per-tool flags PNP/profile policy may attach to a surviving entry. */\nexport interface PnpPolicyToolFlags {\n\t/** PNP/profile policy mandates this tool (item or district `requiredTools`). */\n\trequired: boolean;\n\t/** Student PNP marks this tool as a support (host UI cannot toggle off). */\n\talwaysAvailable: boolean;\n\t/** Tool-specific settings derived from item / assessment settings. */\n\tsettings?: unknown;\n\t/** Which PNP/profile rule contributed the surviving verdict. */\n\trule: PnpPolicySourceRule;\n\t/** Source attribution for `ToolPolicyEntry.sources`. */\n\tsourceType: ToolPolicySourceType;\n}\n\nexport interface PnpPolicyApplyArgs {\n\tassessment?: AssessmentEntity | null;\n\tcurrentItemRef?: AssessmentItemRef;\n}\n\n/**\n * Provenance event the engine should append to its builder. Pre-baked\n * here so the source has a single allocation pattern and the engine\n * keeps a uniform `addDecision(...)` shape.\n */\nexport interface PnpPolicyDecisionEvent {\n\tprecedence: 1 | 2 | 3 | 4 | 5 | 6;\n\trule:\n\t\t| \"district-block\"\n\t\t| \"test-admin-override\"\n\t\t| \"item-restriction\"\n\t\t| \"item-requirement\"\n\t\t| \"district-requirement\"\n\t\t| \"pnp-support\"\n\t\t| \"pnp-prohibited\";\n\tfeatureId: string;\n\taction: ToolPolicyResolutionDecision[\"action\"];\n\tsourceType: ToolPolicySourceType;\n\treason: string;\n\tvalue?: unknown;\n}\n\nexport interface PnpPolicyResult {\n\t/**\n\t * Tool IDs PNP/profile policy explicitly blocked. Engine removes these from the\n\t * candidate set in step 5.\n\t */\n\tblockedToolIds: Set<string>;\n\t/**\n\t * Tool IDs PNP/profile policy mandates (item or district `requiredTools`). Used\n\t * by the engine to detect `tool-policy.requiredToolBlocked`\n\t * diagnostics for tools removed by host policy.\n\t */\n\tmandatedToolIds: Set<string>;\n\t/**\n\t * Per-tool flags merged into surviving `ToolPolicyEntry`s.\n\t */\n\tperToolFlags: Map<string, PnpPolicyToolFlags>;\n\t/**\n\t * Decision log entries the engine must record. Order matches the\n\t * order rules fired internally (highest precedence first per\n\t * support id).\n\t */\n\tdecisions: PnpPolicyDecisionEvent[];\n\t/** Configuration sources the engine should attach to its provenance. */\n\tsources: {\n\t\tassessment?: { id: string; name: string; config?: unknown };\n\t\tstudent?: { id: string; name: string; config?: unknown };\n\t\titem?: { id: string; name: string; config?: unknown };\n\t};\n}\n\n/**\n * Internal context: every PNP/profile policy input bundled together for the rule\n * evaluation loop.\n */\ninterface PnpResolutionContext {\n\tpnp?: PersonalNeedsProfile;\n\tdistrictPolicy?: AssessmentSettings[\"districtPolicy\"];\n\ttestAdmin?: AssessmentSettings[\"testAdministration\"];\n\titemSettings?: ItemSettings;\n\ttoolConfigs?: AssessmentSettings[\"toolConfigs\"];\n}\n\nexport class PnpPolicySource {\n\treadonly id = \"pnp\";\n\tprivate readonly toolRegistry: ToolRegistry;\n\n\tconstructor(toolRegistry: ToolRegistry) {\n\t\tthis.toolRegistry = toolRegistry;\n\t}\n\n\tapply(args: PnpPolicyApplyArgs): PnpPolicyResult {\n\t\tconst { assessment, currentItemRef } = args;\n\t\tconst pnp = assessment?.personalNeedsProfile;\n\t\tconst settings = assessment?.settings as AssessmentSettings | undefined;\n\t\tconst itemSettings = currentItemRef?.settings as ItemSettings | undefined;\n\n\t\tconst result: PnpPolicyResult = {\n\t\t\tblockedToolIds: new Set(),\n\t\t\tmandatedToolIds: new Set(),\n\t\t\tperToolFlags: new Map(),\n\t\t\tdecisions: [],\n\t\t\tsources: {},\n\t\t};\n\n\t\tif (settings?.districtPolicy || settings?.testAdministration) {\n\t\t\tresult.sources.assessment = {\n\t\t\t\tid: assessment?.id || \"unknown\",\n\t\t\t\tname: assessment?.name || assessment?.id || \"Assessment\",\n\t\t\t\tconfig: settings,\n\t\t\t};\n\t\t}\n\t\tif (pnp) {\n\t\t\tresult.sources.student = {\n\t\t\t\tid: \"student\",\n\t\t\t\tname: \"Student PNP Profile\",\n\t\t\t\tconfig: pnp,\n\t\t\t};\n\t\t}\n\t\tif (currentItemRef && itemSettings) {\n\t\t\tresult.sources.item = {\n\t\t\t\tid: currentItemRef.identifier,\n\t\t\t\tname: currentItemRef.identifier,\n\t\t\t\tconfig: itemSettings,\n\t\t\t};\n\t\t}\n\n\t\tconst allSupports = new Set<string>();\n\t\tpnp?.supports?.forEach((s) => allSupports.add(s));\n\t\tpnp?.prohibitedSupports?.forEach((s) => allSupports.add(s));\n\t\tsettings?.districtPolicy?.blockedTools?.forEach((s) => allSupports.add(s));\n\t\tsettings?.districtPolicy?.requiredTools?.forEach((s) => allSupports.add(s));\n\t\titemSettings?.requiredTools?.forEach((s) => allSupports.add(s));\n\t\titemSettings?.restrictedTools?.forEach((s) => allSupports.add(s));\n\n\t\tconst ctx: PnpResolutionContext = {\n\t\t\tpnp,\n\t\t\tdistrictPolicy: settings?.districtPolicy,\n\t\t\ttestAdmin: settings?.testAdministration,\n\t\t\titemSettings,\n\t\t\ttoolConfigs: settings?.toolConfigs,\n\t\t};\n\n\t\tfor (const supportId of allSupports) {\n\t\t\tthis.resolveSupport(supportId, ctx, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate resolveSupport(\n\t\tsupportId: string,\n\t\tctx: PnpResolutionContext,\n\t\tout: PnpPolicyResult,\n\t): void {\n\t\t// 1. District block (absolute veto)\n\t\tif (ctx.districtPolicy?.blockedTools?.includes(supportId)) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.blockedToolIds.add(toolId);\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 1,\n\t\t\t\trule: \"district-block\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"assessment\",\n\t\t\t\treason: `District policy blocks \"${supportId}\" for all assessments`,\n\t\t\t\tvalue: ctx.districtPolicy.blockedTools,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// 2. Test administration override\n\t\tif (ctx.testAdmin?.toolOverrides?.[supportId] === false) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.blockedToolIds.add(toolId);\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 2,\n\t\t\t\trule: \"test-admin-override\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"assessment\",\n\t\t\t\treason: `Test administrator disabled \"${supportId}\" for this session`,\n\t\t\t\tvalue: ctx.testAdmin.toolOverrides,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// 3. Item restriction (per-item block)\n\t\tif (ctx.itemSettings?.restrictedTools?.includes(supportId)) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.blockedToolIds.add(toolId);\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 3,\n\t\t\t\trule: \"item-restriction\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"item\",\n\t\t\t\treason: `Item restricts \"${supportId}\" (e.g., mental math question blocks calculator)`,\n\t\t\t\tvalue: ctx.itemSettings.restrictedTools,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// 4. Item requirement (forces enable)\n\t\tif (ctx.itemSettings?.requiredTools?.includes(supportId)) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.mandatedToolIds.add(toolId);\n\t\t\tout.perToolFlags.set(toolId, {\n\t\t\t\trequired: true,\n\t\t\t\talwaysAvailable: false,\n\t\t\t\tsettings: this.resolveToolSettings(supportId, ctx),\n\t\t\t\trule: \"item-requirement\",\n\t\t\t\tsourceType: \"item\",\n\t\t\t});\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 4,\n\t\t\t\trule: \"item-requirement\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"enable\",\n\t\t\t\tsourceType: \"item\",\n\t\t\t\treason: `Item requires \"${supportId}\" for this question`,\n\t\t\t\tvalue: ctx.itemSettings.requiredTools,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// 5. District requirement\n\t\tif (ctx.districtPolicy?.requiredTools?.includes(supportId)) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.mandatedToolIds.add(toolId);\n\t\t\tout.perToolFlags.set(toolId, {\n\t\t\t\trequired: true,\n\t\t\t\talwaysAvailable: false,\n\t\t\t\tsettings: this.resolveToolSettings(supportId, ctx),\n\t\t\t\trule: \"district-requirement\",\n\t\t\t\tsourceType: \"assessment\",\n\t\t\t});\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 5,\n\t\t\t\trule: \"district-requirement\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"enable\",\n\t\t\t\tsourceType: \"assessment\",\n\t\t\t\treason: `District policy requires \"${supportId}\" for all assessments`,\n\t\t\t\tvalue: ctx.districtPolicy.requiredTools,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// 6. PNP prohibitions and supports (student needs)\n\t\tif (ctx.pnp?.prohibitedSupports?.includes(supportId)) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.blockedToolIds.add(toolId);\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 6,\n\t\t\t\trule: \"pnp-prohibited\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"student\",\n\t\t\t\treason: `Student PNP profile prohibits \"${supportId}\"`,\n\t\t\t\tvalue: ctx.pnp.prohibitedSupports,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (ctx.pnp?.supports?.includes(supportId)) {\n\t\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\t\tout.perToolFlags.set(toolId, {\n\t\t\t\trequired: false,\n\t\t\t\talwaysAvailable: true,\n\t\t\t\tsettings: this.resolveToolSettings(supportId, ctx),\n\t\t\t\trule: \"pnp-support\",\n\t\t\t\tsourceType: \"student\",\n\t\t\t});\n\t\t\tout.decisions.push({\n\t\t\t\tprecedence: 6,\n\t\t\t\trule: \"pnp-support\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"enable\",\n\t\t\t\tsourceType: \"student\",\n\t\t\t\treason: `Student PNP profile requests \"${supportId}\"`,\n\t\t\t\tvalue: ctx.pnp.supports,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// 6 (skip): support-id mentioned somewhere but no rule fired.\n\t\t// Use the mapped tool id as `featureId` so the trail is keyed\n\t\t// the same way as every other branch — PR 5's debugger surfaces\n\t\t// index provenance trails by tool id and would otherwise show\n\t\t// orphaned support-id entries here (M8 PR 1 R3 S1).\n\t\tconst toolId = this.mapSupportToToolId(supportId);\n\t\tout.decisions.push({\n\t\t\tprecedence: 6,\n\t\t\trule: \"pnp-support\",\n\t\t\tfeatureId: toolId,\n\t\t\taction: \"skip\",\n\t\t\tsourceType: \"system\",\n\t\t\treason: `Feature \"${supportId}\" not configured at any level`,\n\t\t\tvalue: { supportId },\n\t\t});\n\t}\n\n\t/**\n\t * Map a QTI / PNP support id (e.g. `\"calculator-basic\"`) to the\n\t * registered tool id that owns it.\n\t *\n\t * Resolution rules:\n\t *\n\t * 1. **Multiple tools register the same support id:** the\n\t * *first-registered* tool wins. `ToolRegistry.getToolsByPNPSupport`\n\t * returns a `Set<string>` whose iteration order matches the\n\t * `register(...)` insertion order, so the result is\n\t * deterministic across runs but order-sensitive at registration\n\t * time. This is an unusual configuration — the typical case is\n\t * one tool per support id — but it is reachable when an\n\t * integrator overrides a default tool with a replacement that\n\t * claims the same `pnpSupportIds`. In that case the integrator\n\t * should `unregister(...)` the default before registering the\n\t * replacement.\n\t *\n\t * 2. **No tool registers the support id:** the support id is\n\t * returned verbatim as the `featureId` for provenance trails\n\t * and `ToolPolicyEntry.toolId`. This lets hosts use raw QTI\n\t * strings for tools the registry does not (yet) carry without\n\t * losing them in policy evaluation.\n\t *\n\t * `tests/policy/PnpPolicySource.test.ts` locks this mapping behavior.\n\t */\n\tprivate mapSupportToToolId(supportId: string): string {\n\t\tconst toolIds = this.toolRegistry.getToolsByPNPSupport(supportId);\n\t\tif (toolIds.size === 0) return supportId;\n\t\treturn Array.from(toolIds)[0];\n\t}\n\n\t/**\n\t * Resolve tool-specific settings, item-level taking precedence over\n\t * assessment-level.\n\t *\n\t * Uses `??` (nullish-coalescing). Tool config values are typed `unknown` and may legitimately\n\t * be `false` / `0` / `\"\"` (e.g. a tool whose canonical \"off\" config\n\t * is the literal `false`). `||` would treat those as missing and\n\t * silently fall through to the assessment-level config, masking the\n\t * authored item-level intent. `??` only falls through on\n\t * `null`/`undefined`, which matches the semantic of \"value not\n\t * provided.\"\n\t */\n\tprivate resolveToolSettings(\n\t\tsupportId: string,\n\t\tctx: PnpResolutionContext,\n\t): unknown {\n\t\treturn (\n\t\t\tctx.itemSettings?.toolParameters?.[supportId] ??\n\t\t\tctx.toolConfigs?.[supportId]\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeRegistry.js","sourceRoot":"","sources":["../../src/runtime/RuntimeRegistry.ts"],"names":[],"mappings":"AASA,SAAS,oBAAoB,CAAC,CAAc,EAAE,CAAc;IAC3D,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,MAAM,QAAQ,GAAG,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAC9C,IAAI,QAAQ,GAAG,IAAI,CAAC,2BAA2B;QAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,QAAQ,GAAG,IAAI,CAAC,2BAA2B;QAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,CAAC;AACV,CAAC;AAED,MAAM,OAAO,eAAe;IACV,eAAe,GAAG,IAAI,GAAG,EAAgC,CAAC;IAE3E,QAAQ,CAAC,MAAiC;Q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AE,UAAU,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,UAAU,CAAC,OAAoB;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,gBAAgB,CAAC,IAA8B;QAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAC/D,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CACvC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,iBAAiB;QAChB,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,KAAK,CAAC,MAAM;gBAAE,SAAS;YAC5B,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,eAAe,IAAI,KAAK,CAAC,MAAM,CAAC;QAC3D,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD","sourcesContent":["import type {\n\tRuntimeRegistrationDetail,\n\tRuntimeRegistrationKind,\n} from \"./registration-events.js\";\n\nexport interface RegisteredShell extends RuntimeRegistrationDetail {\n\tsortKey: number;\n}\n\nfunction compareDocumentOrder(a: HTMLElement, b: HTMLElement): number {\n\tif (a === b) return 0;\n\tconst position = a.compareDocumentPosition(b);\n\tif (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;\n\tif (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;\n\treturn 0;\n}\n\nexport class RuntimeRegistry {\n\tprivate readonly shellsByElement = new Map<HTMLElement, RegisteredShell>();\n\n\tregister(detail: RuntimeRegistrationDetail): boolean {\n\t\tconst existing = this.shellsByElement.get(detail.element);\n\t\tconst nextRecord: RegisteredShell = {\n\t\t\t...detail,\n\t\t\tsortKey: Date.now(),\n\t\t};\n\n\t\t// Idempotent no-op for identical registrations.\n\t\tif (\n\t\t\texisting &&\n\t\t\texisting.kind === nextRecord.kind &&\n\t\t\texisting.itemId === nextRecord.itemId &&\n\t\t\texisting.canonicalItemId === nextRecord.canonicalItemId\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.shellsByElement.set(detail.element, nextRecord);\n\t\treturn true;\n\t}\n\n\tunregister(element: HTMLElement): boolean {\n\t\treturn this.shellsByElement.delete(element);\n\t}\n\n\tgetOrderedShells(kind?: RuntimeRegistrationKind): RegisteredShell[] {\n\t\tconst records = Array.from(this.shellsByElement.values()).filter(\n\t\t\t(entry) => !kind || entry.kind === kind,\n\t\t);\n\t\trecords.sort((a, b) => compareDocumentOrder(a.element, b.element));\n\t\treturn records;\n\t}\n\n\tgetCanonicalIdMap(): Record<string, string> {\n\t\tconst map: Record<string, string> = {};\n\t\tfor (const entry of this.getOrderedShells(\"item\")) {\n\t\t\tif (!entry.itemId) continue;\n\t\t\tmap[entry.itemId] = entry.canonicalItemId || entry.itemId;\n\t\t}\n\t\treturn map;\n\t}\n\n\tclear(): void {\n\t\tthis.shellsByElement.clear();\n\t}\n}\n"]}
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
* shells in document order, used for canonical-id lookup;
|
|
10
10
|
* - the **adapter** (`SectionEngineAdapter`) — single I/O seam over
|
|
11
11
|
* the pure FSM core, fanning outputs to the DOM, framework-error
|
|
12
|
-
* bus,
|
|
12
|
+
* bus, instrumentation hook, and host subscribers;
|
|
13
13
|
* - the **resolver** (`resolveSectionEngineRuntimeState`) — the
|
|
14
14
|
* toolkit-side resolution helper that produces the effective
|
|
15
15
|
* runtime + tools snapshot a host feeds to the FSM core.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* The facade exposes an engine-side surface for stage/lifecycle inputs and a
|
|
18
|
+
* controller-facing surface for item registration, session updates, and host
|
|
19
|
+
* controller commands:
|
|
19
20
|
*
|
|
20
21
|
* 1. The **engine-side** surface (`attachHost`, `dispatchInput`,
|
|
21
22
|
* `subscribe`, `getState`, `getEffectiveRuntime`,
|
|
@@ -28,28 +29,14 @@
|
|
|
28
29
|
* new layout shell) update the adapter's host element via
|
|
29
30
|
* `setHost(...)`.
|
|
30
31
|
*
|
|
31
|
-
* 2. The **
|
|
32
|
+
* 2. The **controller-side** surface (`initialize`,
|
|
32
33
|
* `register`, `unregister`, `handleContent*`, `updateItemSession`,
|
|
33
34
|
* `navigateToItem`, `persist`, `hydrate`, `dispose`). The
|
|
34
|
-
* `PieAssessmentToolkit.svelte` CE
|
|
35
|
-
*
|
|
36
|
-
* PR 6 deletes the toolkit's reliance on this surface; PR 7
|
|
37
|
-
* removes the methods that the engine FSM has fully absorbed.
|
|
35
|
+
* `PieAssessmentToolkit.svelte` CE drives section-controller and
|
|
36
|
+
* item-shell events through this surface.
|
|
38
37
|
*
|
|
39
|
-
* The two surfaces share `RuntimeRegistry`
|
|
40
|
-
*
|
|
41
|
-
* legacy generation holds inline. The adapter holds its own
|
|
42
|
-
* `coordinator-bridge` independently — the legacy `initialize(...)` and
|
|
43
|
-
* the engine-side `dispatchInput({ kind: "initialize" })` do **not**
|
|
44
|
-
* fight over the coordinator because PR 3 only activates one of them
|
|
45
|
-
* per host (legacy from the toolkit CE, engine-side from the PR 5+
|
|
46
|
-
* tests and the kernel/toolkit switches).
|
|
47
|
-
*
|
|
48
|
-
* **Why the legacy surface stays.** The plan's PR-3 acceptance criterion
|
|
49
|
-
* is "existing toolkit tests still pass; no section-player or toolkit
|
|
50
|
-
* CE code changes yet" — so PR 3 cannot delete the controller-side
|
|
51
|
-
* methods. PR 6 (toolkit switch) and PR 7 (rip-out) will remove them
|
|
52
|
-
* once the engine surface is the only consumer.
|
|
38
|
+
* The two surfaces share `RuntimeRegistry` and the resolved
|
|
39
|
+
* `SectionControllerHandle`.
|
|
53
40
|
*/
|
|
54
41
|
import type { ToolkitCoordinator } from "../services/ToolkitCoordinator.js";
|
|
55
42
|
import type { FrameworkErrorReporter } from "../services/framework-error-bus.js";
|
|
@@ -110,10 +97,8 @@ interface RuntimeController extends SectionControllerHandle {
|
|
|
110
97
|
navigateToItem?: (index: number) => unknown;
|
|
111
98
|
}
|
|
112
99
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* delete this in favor of the engine-side `attachHost` +
|
|
116
|
-
* `dispatchInput({ kind: "initialize" })` flow.
|
|
100
|
+
* Initialize args used by the toolkit CE to resolve the coordinator-backed
|
|
101
|
+
* section controller.
|
|
117
102
|
*/
|
|
118
103
|
interface EngineInitArgs {
|
|
119
104
|
coordinator: ToolkitCoordinator;
|
|
@@ -128,7 +113,7 @@ interface EngineInitArgs {
|
|
|
128
113
|
/**
|
|
129
114
|
* Engine-side `attachHost` args. The host element, framework-error bus,
|
|
130
115
|
* and `sourceCe` together let the adapter dispatch DOM events and bus
|
|
131
|
-
* fan-outs
|
|
116
|
+
* fan-outs consistently with the kernel emit chain.
|
|
132
117
|
*/
|
|
133
118
|
export interface SectionRuntimeEngineHostArgs {
|
|
134
119
|
host: EventTarget;
|
|
@@ -175,7 +160,7 @@ export declare class SectionRuntimeEngine {
|
|
|
175
160
|
/**
|
|
176
161
|
* Forward a host-constructed input to the FSM core via the adapter.
|
|
177
162
|
* Returns the outputs the transition produced (subscribers and the
|
|
178
|
-
* DOM/
|
|
163
|
+
* DOM/framework-error/instrumentation bridges have already
|
|
179
164
|
* received them).
|
|
180
165
|
*
|
|
181
166
|
* No-op (returns `[]`) before `attachHost(...)` so callers that
|
|
@@ -294,4 +279,3 @@ export declare class SectionRuntimeEngine {
|
|
|
294
279
|
dispose(): Promise<void>;
|
|
295
280
|
}
|
|
296
281
|
export {};
|
|
297
|
-
//# sourceMappingURL=SectionRuntimeEngine.d.ts.map
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
* shells in document order, used for canonical-id lookup;
|
|
10
10
|
* - the **adapter** (`SectionEngineAdapter`) — single I/O seam over
|
|
11
11
|
* the pure FSM core, fanning outputs to the DOM, framework-error
|
|
12
|
-
* bus,
|
|
12
|
+
* bus, instrumentation hook, and host subscribers;
|
|
13
13
|
* - the **resolver** (`resolveSectionEngineRuntimeState`) — the
|
|
14
14
|
* toolkit-side resolution helper that produces the effective
|
|
15
15
|
* runtime + tools snapshot a host feeds to the FSM core.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* The facade exposes an engine-side surface for stage/lifecycle inputs and a
|
|
18
|
+
* controller-facing surface for item registration, session updates, and host
|
|
19
|
+
* controller commands:
|
|
19
20
|
*
|
|
20
21
|
* 1. The **engine-side** surface (`attachHost`, `dispatchInput`,
|
|
21
22
|
* `subscribe`, `getState`, `getEffectiveRuntime`,
|
|
@@ -28,28 +29,14 @@
|
|
|
28
29
|
* new layout shell) update the adapter's host element via
|
|
29
30
|
* `setHost(...)`.
|
|
30
31
|
*
|
|
31
|
-
* 2. The **
|
|
32
|
+
* 2. The **controller-side** surface (`initialize`,
|
|
32
33
|
* `register`, `unregister`, `handleContent*`, `updateItemSession`,
|
|
33
34
|
* `navigateToItem`, `persist`, `hydrate`, `dispose`). The
|
|
34
|
-
* `PieAssessmentToolkit.svelte` CE
|
|
35
|
-
*
|
|
36
|
-
* PR 6 deletes the toolkit's reliance on this surface; PR 7
|
|
37
|
-
* removes the methods that the engine FSM has fully absorbed.
|
|
35
|
+
* `PieAssessmentToolkit.svelte` CE drives section-controller and
|
|
36
|
+
* item-shell events through this surface.
|
|
38
37
|
*
|
|
39
|
-
* The two surfaces share `RuntimeRegistry`
|
|
40
|
-
*
|
|
41
|
-
* legacy generation holds inline. The adapter holds its own
|
|
42
|
-
* `coordinator-bridge` independently — the legacy `initialize(...)` and
|
|
43
|
-
* the engine-side `dispatchInput({ kind: "initialize" })` do **not**
|
|
44
|
-
* fight over the coordinator because PR 3 only activates one of them
|
|
45
|
-
* per host (legacy from the toolkit CE, engine-side from the PR 5+
|
|
46
|
-
* tests and the kernel/toolkit switches).
|
|
47
|
-
*
|
|
48
|
-
* **Why the legacy surface stays.** The plan's PR-3 acceptance criterion
|
|
49
|
-
* is "existing toolkit tests still pass; no section-player or toolkit
|
|
50
|
-
* CE code changes yet" — so PR 3 cannot delete the controller-side
|
|
51
|
-
* methods. PR 6 (toolkit switch) and PR 7 (rip-out) will remove them
|
|
52
|
-
* once the engine surface is the only consumer.
|
|
38
|
+
* The two surfaces share `RuntimeRegistry` and the resolved
|
|
39
|
+
* `SectionControllerHandle`.
|
|
53
40
|
*/
|
|
54
41
|
import { SectionEngineAdapter, } from "./adapter/SectionEngineAdapter.js";
|
|
55
42
|
import { resolveSectionEngineRuntimeState, } from "./core/engine-resolver.js";
|
|
@@ -61,7 +48,7 @@ export class SectionRuntimeEngine {
|
|
|
61
48
|
runtimeId = createRuntimeId("section-engine");
|
|
62
49
|
// Engine-side state (PR 3+).
|
|
63
50
|
adapter = null;
|
|
64
|
-
//
|
|
51
|
+
// Controller-side state.
|
|
65
52
|
controller = null;
|
|
66
53
|
coordinator = null;
|
|
67
54
|
sectionId = "";
|
|
@@ -116,7 +103,7 @@ export class SectionRuntimeEngine {
|
|
|
116
103
|
/**
|
|
117
104
|
* Forward a host-constructed input to the FSM core via the adapter.
|
|
118
105
|
* Returns the outputs the transition produced (subscribers and the
|
|
119
|
-
* DOM/
|
|
106
|
+
* DOM/framework-error/instrumentation bridges have already
|
|
120
107
|
* received them).
|
|
121
108
|
*
|
|
122
109
|
* No-op (returns `[]`) before `attachHost(...)` so callers that
|
|
@@ -168,8 +155,7 @@ export class SectionRuntimeEngine {
|
|
|
168
155
|
return this.runtimeId;
|
|
169
156
|
}
|
|
170
157
|
// ============================================================
|
|
171
|
-
//
|
|
172
|
-
// identical to pre-PR 3).
|
|
158
|
+
// Controller-side surface.
|
|
173
159
|
// ============================================================
|
|
174
160
|
async initialize(args) {
|
|
175
161
|
this.activeInitToken += 1;
|
|
@@ -321,7 +307,7 @@ export class SectionRuntimeEngine {
|
|
|
321
307
|
// delete keys round-trip identically. The `|| detail.kind`
|
|
322
308
|
// fallback is preserved for the controller-forwarded payload
|
|
323
309
|
// because the controller normalizes via `toSectionContentKind`
|
|
324
|
-
// and the
|
|
310
|
+
// and the `kind` field remains meaningful there.
|
|
325
311
|
this.loadedRenderableKeys.delete(this.getLoadedKey(canonicalItemId, detail.contentKind));
|
|
326
312
|
this.controller?.handleContentUnregistered?.({
|
|
327
313
|
itemId: detail.itemId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionRuntimeEngine.js","sourceRoot":"","sources":["../../src/runtime/SectionRuntimeEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAQH,OAAO,EACN,oBAAoB,GAEpB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EACN,gCAAgC,GAGhC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,wBAAwB,GAExB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAiFlD,MAAM,OAAO,oBAAoB;IACf,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IACjC,SAAS,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAE/D,6BAA6B;IACrB,OAAO,GAAgC,IAAI,CAAC;IAEpD,6CAA6C;IACrC,UAAU,GAA6B,IAAI,CAAC;IAC5C,WAAW,GAA8B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AC5D,4DAA4D;QAC5D,uBAAuB;QACvB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACF,CAAC;CACD;AAED,MAAM,WAAW,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC","sourcesContent":["/**\n * Section runtime engine — public facade (M7 — Variant C, layered).\n *\n * The facade is the narrow, stable entry point hosts use to mount,\n * drive, and dispose a section runtime. It composes three layers\n * introduced in earlier M7 PRs:\n *\n * - the **registry** (`RuntimeRegistry`) — registered item/passage\n * shells in document order, used for canonical-id lookup;\n * - the **adapter** (`SectionEngineAdapter`) — single I/O seam over\n * the pure FSM core, fanning outputs to the DOM, framework-error\n * bus, instrumentation hook, and host subscribers;\n * - the **resolver** (`resolveSectionEngineRuntimeState`) — the\n * toolkit-side resolution helper that produces the effective\n * runtime + tools snapshot a host feeds to the FSM core.\n *\n * The facade exposes an engine-side surface for stage/lifecycle inputs and a\n * controller-facing surface for item registration, session updates, and host\n * controller commands:\n *\n * 1. The **engine-side** surface (`attachHost`, `dispatchInput`,\n * `subscribe`, `getState`, `getEffectiveRuntime`,\n * `setInstrumentationHook`). This is what the kernel and the\n * `pie-assessment-toolkit` CE will switch onto in M7 PR 5 and\n * PR 6. Construction is lazy: `attachHost(...)` builds the\n * adapter on first call, with the supplied host element,\n * framework-error bus, and (optional) coordinator. After\n * construction, host re-attachments (e.g. cohort change with a\n * new layout shell) update the adapter's host element via\n * `setHost(...)`.\n *\n * 2. The **controller-side** surface (`initialize`,\n * `register`, `unregister`, `handleContent*`, `updateItemSession`,\n * `navigateToItem`, `persist`, `hydrate`, `dispose`). The\n * `PieAssessmentToolkit.svelte` CE drives section-controller and\n * item-shell events through this surface.\n *\n * The two surfaces share `RuntimeRegistry` and the resolved\n * `SectionControllerHandle`.\n */\n\nimport type { ToolkitCoordinator } from \"../services/ToolkitCoordinator.js\";\nimport type { FrameworkErrorReporter } from \"../services/framework-error-bus.js\";\nimport type {\n\tSectionControllerEvent,\n\tSectionControllerHandle,\n} from \"../services/section-controller-types.js\";\nimport {\n\tSectionEngineAdapter,\n\ttype SectionEngineAdapterOptions,\n} from \"./adapter/SectionEngineAdapter.js\";\nimport type { InstrumentationHook } from \"./adapter/instrumentation-bridge.js\";\nimport type { EngineOutputListener } from \"./adapter/subscriber-fanout.js\";\nimport type { SectionEngineInput } from \"./core/engine-input.js\";\nimport type { SectionEngineOutput } from \"./core/engine-output.js\";\nimport {\n\tresolveSectionEngineRuntimeState,\n\ttype EffectiveRuntime,\n\ttype RuntimeInputs,\n} from \"./core/engine-resolver.js\";\nimport {\n\tcreateInitialEngineState,\n\ttype SectionEngineState,\n} from \"./core/engine-state.js\";\nimport type { RuntimeRegistrationDetail } from \"./registration-events.js\";\nimport { RuntimeRegistry } from \"./RuntimeRegistry.js\";\nimport { createRuntimeId } from \"./runtime-id.js\";\n\n/**\n * Structural view of the resolved section controller, widened with the\n * extra methods the toolkit's runtime CE calls directly. Optional so\n * stub controllers used in tests do not need every entry point.\n */\ninterface RuntimeController extends SectionControllerHandle {\n\tgetCompositionModel?: () => unknown;\n\tgetCanonicalItemId?: (itemId: string) => string;\n\thandleContentLoaded?: (args: {\n\t\titemId: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t\tdetail?: unknown;\n\t\ttimestamp?: number;\n\t}) => void;\n\thandleContentRegistered?: (args: {\n\t\titemId: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t}) => void;\n\thandleContentUnregistered?: (args: {\n\t\titemId: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t}) => void;\n\thandleItemPlayerError?: (args: {\n\t\titemId: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t\terror: unknown;\n\t\ttimestamp?: number;\n\t}) => void;\n\treportSectionError?: (args: {\n\t\tsource: \"item-player\" | \"section-runtime\" | \"toolkit\" | \"controller\";\n\t\terror: unknown;\n\t\titemId?: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t\ttimestamp?: number;\n\t}) => void;\n\tupdateItemSession?: (\n\t\titemId: string,\n\t\tsessionDetail: unknown,\n\t) => { eventDetail?: unknown } | null;\n\tsubscribe?: (listener: (event: SectionControllerEvent) => void) => () => void;\n\tnavigateToItem?: (index: number) => unknown;\n}\n\n/**\n * Initialize args used by the toolkit CE to resolve the coordinator-backed\n * section controller.\n */\ninterface EngineInitArgs {\n\tcoordinator: ToolkitCoordinator;\n\tsection: unknown;\n\tsectionId: string;\n\tassessmentId: string;\n\tview: string;\n\tattemptId?: string;\n\tcreateDefaultController: () => Promise<RuntimeController> | RuntimeController;\n\tonCompositionChanged?: (composition: unknown) => void;\n}\n\n/**\n * Engine-side `attachHost` args. The host element, framework-error bus,\n * and `sourceCe` together let the adapter dispatch DOM events and bus\n * fan-outs consistently with the kernel emit chain.\n */\nexport interface SectionRuntimeEngineHostArgs {\n\thost: EventTarget;\n\tsourceCe: string;\n\tframeworkErrorBus: FrameworkErrorReporter;\n\tcoordinator?: SectionEngineAdapterOptions[\"coordinator\"];\n\tinstrumentationHook?: InstrumentationHook;\n\tnow?: () => string;\n}\n\nexport class SectionRuntimeEngine {\n\tprivate readonly registry = new RuntimeRegistry();\n\tprivate readonly runtimeId = createRuntimeId(\"section-engine\");\n\n\t// Engine-side state (PR 3+).\n\tprivate adapter: SectionEngineAdapter | null = null;\n\n\t// Controller-side state.\n\tprivate controller: RuntimeController | null = null;\n\tprivate coordinator: ToolkitCoordinator | null = null;\n\tprivate sectionId = \"\";\n\tprivate attemptId: string | undefined;\n\tprivate unsubscribeController: (() => void) | null = null;\n\tprivate activeInitToken = 0;\n\n\t/**\n\t * Tracks which `(canonicalItemId, contentKind)` pairs have already\n\t * fired `handleContentLoaded` on this engine. Mirrored alongside\n\t * `RuntimeRegistry`'s registered set so a cohort handoff can\n\t * replay the persistent shells' loaded state into the new\n\t * controller — see `replayRegisteredShellsIntoController` and the\n\t * PIE-512 Phase B regression test.\n\t *\n\t * Cleared in lockstep with `handleContentUnregistered` and on\n\t * `dispose`. Not exposed publicly: the registry alone is the\n\t * external surface; the loaded set exists only to seed cohort B's\n\t * controller with the live state cohort A's shells produced.\n\t */\n\tprivate readonly loadedRenderableKeys = new Set<string>();\n\n\t// ============================================================\n\t// Engine-side surface (PR 3+; driven by the kernel from PR 5,\n\t// by the toolkit CE from PR 6, and by the facade smoke test today).\n\t// ============================================================\n\n\t/**\n\t * Attach the host element + framework-error bus + sourceCe so the\n\t * adapter can dispatch DOM events and bus errors. Required before\n\t * `dispatchInput` / `subscribe` produce observable effects.\n\t *\n\t * Constructs the adapter on the first call. Subsequent calls keep\n\t * the adapter and update its host element / instrumentation hook\n\t * (used by layout-shell rollovers and instrumentation reconfig).\n\t */\n\tattachHost(args: SectionRuntimeEngineHostArgs): void {\n\t\tif (this.adapter) {\n\t\t\tthis.adapter.setHost(args.host);\n\t\t\tif (args.instrumentationHook !== undefined) {\n\t\t\t\tthis.adapter.setInstrumentationHook(args.instrumentationHook);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis.adapter = new SectionEngineAdapter({\n\t\t\thost: args.host,\n\t\t\truntimeId: this.runtimeId,\n\t\t\tsourceCe: args.sourceCe,\n\t\t\tframeworkErrorBus: args.frameworkErrorBus,\n\t\t\tcoordinator: args.coordinator,\n\t\t\tinstrumentationHook: args.instrumentationHook,\n\t\t\tnow: args.now,\n\t\t});\n\t}\n\n\t/**\n\t * Forward a host-constructed input to the FSM core via the adapter.\n\t * Returns the outputs the transition produced (subscribers and the\n\t * DOM/framework-error/instrumentation bridges have already\n\t * received them).\n\t *\n\t * No-op (returns `[]`) before `attachHost(...)` so callers that\n\t * dispatch optimistically during teardown do not throw.\n\t */\n\tdispatchInput(input: SectionEngineInput): readonly SectionEngineOutput[] {\n\t\treturn this.adapter?.dispatchInput(input) ?? [];\n\t}\n\n\t/**\n\t * Subscribe to batched engine outputs (one batch per\n\t * `dispatchInput`). Returns an idempotent disposer. Pre-`attachHost`\n\t * subscriptions return a no-op disposer so callers can wire\n\t * subscriptions early without lifecycle-ordering hazards.\n\t */\n\tsubscribe(listener: EngineOutputListener): () => void {\n\t\treturn this.adapter?.subscribe(listener) ?? noopDispose;\n\t}\n\n\t/**\n\t * Read-only snapshot of the FSM state. Returns the initial idle\n\t * state before `attachHost` so callers can probe state without\n\t * special-casing the pre-attach phase.\n\t */\n\tgetState(): Readonly<SectionEngineState> {\n\t\treturn this.adapter?.getState() ?? createInitialEngineState();\n\t}\n\n\t/**\n\t * Resolve the effective runtime + tools snapshot for the given\n\t * two-tier inputs. This is a pure function over the resolver — it\n\t * does not depend on adapter state — so callers can use it both\n\t * pre- and post-`attachHost`. The kernel uses it to seed\n\t * `dispatchInput({ kind: \"initialize\", effectiveRuntime, ... })`.\n\t */\n\tgetEffectiveRuntime<P>(\n\t\targs: RuntimeInputs,\n\t\tdeps: {\n\t\t\tresolvePlayerRuntime: (resolverArgs: {\n\t\t\t\teffectiveRuntime: Record<string, unknown>;\n\t\t\t\tplayerType: string;\n\t\t\t\tenv: Record<string, unknown> | null;\n\t\t\t}) => P;\n\t\t},\n\t): EffectiveRuntime {\n\t\treturn resolveSectionEngineRuntimeState(args, deps).effectiveRuntime;\n\t}\n\n\t/**\n\t * Update the adapter's instrumentation hook. No-op pre-attach.\n\t * Hosts that always want a hook should pass it via `attachHost`.\n\t */\n\tsetInstrumentationHook(hook: InstrumentationHook | undefined): void {\n\t\tthis.adapter?.setInstrumentationHook(hook);\n\t}\n\n\t/**\n\t * Stable per-engine runtime id used to scope DOM-event details and\n\t * registry telemetry. Exposed so tests and instrumentation can pin\n\t * the value the bridges emit.\n\t */\n\tgetRuntimeId(): string {\n\t\treturn this.runtimeId;\n\t}\n\n\t// ============================================================\n\t// Controller-side surface.\n\t// ============================================================\n\n\tasync initialize(args: EngineInitArgs): Promise<void> {\n\t\tthis.activeInitToken += 1;\n\t\tconst token = this.activeInitToken;\n\t\tthis.coordinator = args.coordinator;\n\t\tthis.sectionId = args.sectionId;\n\t\tthis.attemptId = args.attemptId;\n\n\t\tconst resolved = (await args.coordinator.getOrCreateSectionController({\n\t\t\tsectionId: args.sectionId,\n\t\t\tattemptId: args.attemptId,\n\t\t\tinput: {\n\t\t\t\tsection: args.section,\n\t\t\t\tsectionId: args.sectionId,\n\t\t\t\tassessmentId: args.assessmentId,\n\t\t\t\tview: args.view,\n\t\t\t},\n\t\t\tupdateExisting: true,\n\t\t\tcreateDefaultController: args.createDefaultController,\n\t\t})) as RuntimeController;\n\n\t\tif (token !== this.activeInitToken) return;\n\t\tthis.unsubscribeController?.();\n\t\tthis.controller = resolved;\n\t\t// PIE-512 Phase C: always re-feed the registry's currently\n\t\t// registered shells (and their loaded state) into the resolved\n\t\t// controller. We do NOT gate on `resolved !== previousController`\n\t\t// any more.\n\t\t//\n\t\t// Why the gate had to go:\n\t\t// - Cohort flip resolving to a fresh controller — replay seeds\n\t\t// the new controller, which is the original Phase B fix.\n\t\t// - Same-cohort `updateInput` resolving to the existing\n\t\t// controller — the coordinator's\n\t\t// `resolveExistingSectionController` calls\n\t\t// `existingController.updateInput(input)` (engine always\n\t\t// passes `updateExisting: true`), and pre-Phase-C\n\t\t// `SectionController.initialize` wiped lifecycle tracking\n\t\t// unconditionally. A subscriber attaching between the wipe\n\t\t// and the next live event saw an empty\n\t\t// `loadedRenderables` snapshot.\n\t\t//\n\t\t// Phase C makes this re-feed safe by combining (a) the\n\t\t// section-identity gate around `resetLifecycleTracking()` in\n\t\t// `SectionController.initialize` (so same-cohort `updateInput`\n\t\t// preserves tracking) with (b) idempotent\n\t\t// `handleContentRegistered` / `handleContentLoaded` on the\n\t\t// controller (so re-feeding the same registry entries is a\n\t\t// no-op if the controller already knows about them, but\n\t\t// re-seeds the controller in the post-`updateInput`-wipe case\n\t\t// that pre-Phase-C used to encounter).\n\t\tthis.replayRegisteredShellsIntoController(resolved);\n\t\targs.onCompositionChanged?.(resolved.getCompositionModel?.());\n\t\tthis.unsubscribeController =\n\t\t\tresolved.subscribe?.(() => {\n\t\t\t\targs.onCompositionChanged?.(resolved.getCompositionModel?.());\n\t\t\t}) || null;\n\t}\n\n\t/**\n\t * Re-feed the engine's `RuntimeRegistry` and loaded-set into the\n\t * resolved controller. Call site: `initialize(...)` — runs on\n\t * EVERY initialize, both cohort-flip-resolves-fresh-controller\n\t * and same-cohort-resolves-existing-controller cases. Phase C\n\t * dropped the `resolved !== previousController` gate; see the\n\t * comment at the call site for why.\n\t *\n\t * Two-pass order — register every shell in document order, then\n\t * issue `handleContentLoaded` for each shell whose load already\n\t * fired on this engine. The two-pass shape prevents\n\t * `evaluateSectionLoadingState` from flapping\n\t * `section-loading-complete` `false→true→false→…` while replay is\n\t * mid-walk: any subscriber wired before the engine's own\n\t * `controller.subscribe` (no such caller today, but cheap defense\n\t * for future wiring) sees one clean `false→true` transition.\n\t *\n\t * Idempotent on the controller side — Phase C makes\n\t * `SectionController.handleContentRegistered` and\n\t * `handleContentLoaded` early-return on duplicates so re-feeding\n\t * the same shells into a controller that already tracks them is\n\t * a true no-op (no spurious re-emits, no re-evaluation of\n\t * `section-loading-complete`). At the call site no listener is\n\t * attached during the replay window, so `emitChange` side effects\n\t * fire into a void on this pass anyway, but the controller-side\n\t * idempotence is what makes the replay safe to run on every\n\t * initialize regardless of whether the controller is fresh.\n\t */\n\tprivate replayRegisteredShellsIntoController(\n\t\tcontroller: RuntimeController,\n\t): void {\n\t\tif (!controller.handleContentRegistered) return;\n\t\tconst shells = this.registry.getOrderedShells();\n\t\tif (shells.length === 0) return;\n\t\tfor (const shell of shells) {\n\t\t\tconst canonicalItemId = shell.canonicalItemId || shell.itemId;\n\t\t\tcontroller.handleContentRegistered({\n\t\t\t\titemId: shell.itemId,\n\t\t\t\tcanonicalItemId,\n\t\t\t\tcontentKind: shell.contentKind || shell.kind,\n\t\t\t});\n\t\t}\n\t\tconst now = Date.now();\n\t\tfor (const shell of shells) {\n\t\t\tconst canonicalItemId = shell.canonicalItemId || shell.itemId;\n\t\t\tconst key = this.getLoadedKey(canonicalItemId, shell.contentKind);\n\t\t\tif (this.loadedRenderableKeys.has(key)) {\n\t\t\t\tcontroller.handleContentLoaded?.({\n\t\t\t\t\titemId: shell.itemId,\n\t\t\t\t\tcanonicalItemId,\n\t\t\t\t\tcontentKind: shell.contentKind || shell.kind,\n\t\t\t\t\ttimestamp: now,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Stable key for the engine's `loadedRenderableKeys` set. Mirrors\n\t * the `(canonicalItemId, contentKind)` shape `SectionController`\n\t * uses internally (see `getRenderableKey`); we only need\n\t * consistent add/check semantics on this side, not byte-identical\n\t * normalization with the controller.\n\t */\n\tprivate getLoadedKey(\n\t\tcanonicalItemId: string,\n\t\tcontentKind: string | undefined,\n\t): string {\n\t\treturn `${contentKind ?? \"\"}:${canonicalItemId}`;\n\t}\n\n\tregister(detail: RuntimeRegistrationDetail): boolean {\n\t\treturn this.registry.register(detail);\n\t}\n\n\tunregister(element: HTMLElement): boolean {\n\t\treturn this.registry.unregister(element);\n\t}\n\n\tgetCompositionModel(): unknown {\n\t\treturn this.controller?.getCompositionModel?.() ?? null;\n\t}\n\n\tgetCanonicalItemId(itemId: string): string {\n\t\tconst map = this.registry.getCanonicalIdMap();\n\t\treturn map[itemId] || this.controller?.getCanonicalItemId?.(itemId) || itemId;\n\t}\n\n\thandleContentRegistered(detail: RuntimeRegistrationDetail): void {\n\t\tthis.controller?.handleContentRegistered?.({\n\t\t\titemId: detail.itemId,\n\t\t\tcanonicalItemId: detail.canonicalItemId || detail.itemId,\n\t\t\tcontentKind: detail.contentKind || detail.kind,\n\t\t});\n\t}\n\n\thandleContentUnregistered(detail: RuntimeRegistrationDetail): void {\n\t\tconst canonicalItemId = detail.canonicalItemId || detail.itemId;\n\t\t// Key the load-set delete with the same `contentKind`-only\n\t\t// shape that `handleContentLoaded` and\n\t\t// `replayRegisteredShellsIntoController` use, so add/check/\n\t\t// delete keys round-trip identically. The `|| detail.kind`\n\t\t// fallback is preserved for the controller-forwarded payload\n\t\t// because the controller normalizes via `toSectionContentKind`\n\t\t// and the `kind` field remains meaningful there.\n\t\tthis.loadedRenderableKeys.delete(\n\t\t\tthis.getLoadedKey(canonicalItemId, detail.contentKind),\n\t\t);\n\t\tthis.controller?.handleContentUnregistered?.({\n\t\t\titemId: detail.itemId,\n\t\t\tcanonicalItemId,\n\t\t\tcontentKind: detail.contentKind || detail.kind,\n\t\t});\n\t}\n\n\thandleContentLoaded(args: {\n\t\titemId: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t\tdetail?: unknown;\n\t\ttimestamp?: number;\n\t}): void {\n\t\tconst canonicalItemId = args.canonicalItemId || args.itemId;\n\t\tthis.loadedRenderableKeys.add(\n\t\t\tthis.getLoadedKey(canonicalItemId, args.contentKind),\n\t\t);\n\t\tthis.controller?.handleContentLoaded?.(args);\n\t}\n\n\thandleItemPlayerError(args: {\n\t\titemId: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t\terror: unknown;\n\t\ttimestamp?: number;\n\t}): void {\n\t\tthis.controller?.handleItemPlayerError?.(args);\n\t}\n\n\treportSectionError(args: {\n\t\tsource: \"item-player\" | \"section-runtime\" | \"toolkit\" | \"controller\";\n\t\terror: unknown;\n\t\titemId?: string;\n\t\tcanonicalItemId?: string;\n\t\tcontentKind?: string;\n\t\ttimestamp?: number;\n\t}): void {\n\t\tthis.controller?.reportSectionError?.(args);\n\t}\n\n\tupdateItemSession(itemId: string, session: unknown): unknown {\n\t\tconst canonicalId = this.getCanonicalItemId(itemId);\n\t\treturn this.controller?.updateItemSession?.(canonicalId, session) ?? null;\n\t}\n\n\tnavigateToItem(index: number): unknown {\n\t\treturn this.controller?.navigateToItem?.(index) ?? null;\n\t}\n\n\tasync persist(): Promise<void> {\n\t\tawait this.controller?.persist?.();\n\t}\n\n\tasync hydrate(): Promise<void> {\n\t\tawait this.controller?.hydrate?.();\n\t}\n\n\tgetRegistry(): RuntimeRegistry {\n\t\treturn this.registry;\n\t}\n\n\tasync dispose(): Promise<void> {\n\t\tthis.activeInitToken += 1;\n\t\tthis.unsubscribeController?.();\n\t\tthis.unsubscribeController = null;\n\t\tif (this.coordinator && this.sectionId) {\n\t\t\tawait this.coordinator.disposeSectionController({\n\t\t\t\tsectionId: this.sectionId,\n\t\t\t\tattemptId: this.attemptId,\n\t\t\t});\n\t\t}\n\t\tthis.registry.clear();\n\t\tthis.loadedRenderableKeys.clear();\n\t\tthis.controller = null;\n\t\tthis.coordinator = null;\n\t\t// Tear down the engine-side adapter (if attached) last so any\n\t\t// `dispose` FSM input flows through the bridges before they\n\t\t// detach. Adapter disposal is idempotent and safe even when\n\t\t// nothing is attached.\n\t\tif (this.adapter) {\n\t\t\tconst adapter = this.adapter;\n\t\t\tthis.adapter = null;\n\t\t\tawait adapter.dispose();\n\t\t}\n\t}\n}\n\nconst noopDispose = (): void => {};\n"]}
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
* - public subscriber fan-out (batched, runs once per
|
|
30
30
|
* `core.dispatch`)
|
|
31
31
|
*
|
|
32
|
-
* The
|
|
33
|
-
* DOM events and their
|
|
32
|
+
* The `readiness-change` / `interaction-ready` / `ready`
|
|
33
|
+
* DOM events and their event bridge were removed in the
|
|
34
34
|
* broad architecture review compat sweep; the corresponding output
|
|
35
35
|
* kinds are gone from `engine-output.ts`.
|
|
36
36
|
*
|
|
@@ -141,4 +141,3 @@ export declare class SectionEngineAdapter {
|
|
|
141
141
|
private routeOutputs;
|
|
142
142
|
private routeOne;
|
|
143
143
|
}
|
|
144
|
-
//# sourceMappingURL=SectionEngineAdapter.d.ts.map
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
* - public subscriber fan-out (batched, runs once per
|
|
30
30
|
* `core.dispatch`)
|
|
31
31
|
*
|
|
32
|
-
* The
|
|
33
|
-
* DOM events and their
|
|
32
|
+
* The `readiness-change` / `interaction-ready` / `ready`
|
|
33
|
+
* DOM events and their event bridge were removed in the
|
|
34
34
|
* broad architecture review compat sweep; the corresponding output
|
|
35
35
|
* kinds are gone from `engine-output.ts`.
|
|
36
36
|
*
|