@pie-players/pie-assessment-toolkit 0.3.43 → 0.3.44
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/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 +1181 -157
- package/dist/components/SectionToolBar.custom-element.js +1179 -157
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts +0 -1
- package/dist/runtime/adapter/SectionEngineAdapter.js.map +1 -1
- package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -1
- package/dist/runtime/adapter/coordinator-bridge.js.map +1 -1
- package/dist/runtime/adapter/dom-event-bridge.d.ts +0 -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/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 +0 -1
- package/dist/runtime/core/engine-output.js.map +1 -1
- package/dist/runtime/core/engine-readiness.d.ts +0 -1
- package/dist/runtime/core/engine-readiness.js.map +1 -1
- package/dist/runtime/core/engine-resolver.d.ts +0 -1
- 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 +0 -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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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/PNPToolResolver.d.ts +0 -1
- package/dist/services/PNPToolResolver.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 +0 -1
- package/dist/services/SSMLExtractor.js.map +1 -1
- package/dist/services/TTSService.d.ts +0 -1
- 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 +0 -1
- package/dist/services/ToolRegistry.js.map +1 -1
- package/dist/services/ToolkitCoordinator.d.ts +0 -1
- 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 +0 -1
- package/dist/services/interfaces.js.map +1 -1
- package/dist/services/pnp-provenance.d.ts +0 -1
- package/dist/services/pnp-provenance.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 +0 -1
- 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.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.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 +0 -1
- 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.map +1 -1
- package/dist/services/tts/text-processing.d.ts +0 -1
- 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 +0 -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.map +1 -1
- package/dist/tools/registrations/calculator.d.ts +0 -1
- 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.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 +7 -7
- 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.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.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assessment-toolkit-context.js","sourceRoot":"","sources":["../../src/context/assessment-toolkit-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAoCzD,MAAM,CAAC,MAAM,+BAA+B,GAC3C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAClD,CAAC;AAOH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC;AAeH,MAAM,CAAC,MAAM,6BAA6B,GACzC,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAChD,CAAC;AAMH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC"}
|
|
1
|
+
{"version":3,"file":"assessment-toolkit-context.js","sourceRoot":"","sources":["../../src/context/assessment-toolkit-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAoCzD,MAAM,CAAC,MAAM,+BAA+B,GAC3C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAClD,CAAC;AAOH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC;AAeH,MAAM,CAAC,MAAM,6BAA6B,GACzC,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAChD,CAAC;AAMH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC","sourcesContent":["import { createContext } from \"@pie-players/pie-context\";\nimport type { LoaderConfig } from \"@pie-players/pie-players-shared/loader-config\";\nimport type {\n\tAccessibilityCatalogResolverApi,\n\tElementToolStateStoreApi,\n\tHighlightCoordinatorApi,\n\tToolCoordinatorApi,\n\tToolkitCoordinatorApi,\n\tTtsServiceApi,\n} from \"../services/interfaces.js\";\n\nexport type ItemPlayerType = \"iife\" | \"esm\" | \"preloaded\" | \"custom\";\n\nexport interface ItemPlayerConfig {\n\ttype: ItemPlayerType;\n\ttagName: string;\n\tversion?: string;\n\tsource?: string;\n\tloaderConfig?: LoaderConfig;\n\tloaderOptions?: Record<string, unknown>;\n\tisDefault: boolean;\n}\n\nexport interface AssessmentToolkitRuntimeContext {\n\ttoolkitCoordinator: ToolkitCoordinatorApi;\n\ttoolCoordinator: ToolCoordinatorApi;\n\tttsService: TtsServiceApi;\n\thighlightCoordinator: HighlightCoordinatorApi;\n\tcatalogResolver: AccessibilityCatalogResolverApi;\n\telementToolStateStore: ElementToolStateStoreApi;\n\tassessmentId: string;\n\tsectionId: string;\n\titemPlayer: ItemPlayerConfig;\n\treportSessionChanged?: (itemId: string, detail: unknown) => void;\n}\n\nexport const assessmentToolkitRuntimeContext =\n\tcreateContext<AssessmentToolkitRuntimeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.runtimeContext\"),\n\t);\n\nexport interface AssessmentToolkitHostRuntimeContext {\n\truntimeId: string;\n\tcoordinator: ToolkitCoordinatorApi;\n}\n\nexport const assessmentToolkitHostRuntimeContext =\n\tcreateContext<AssessmentToolkitHostRuntimeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.hostRuntimeContext\"),\n\t);\n\nexport type ShellContextKind = \"item\" | \"passage\";\n\nexport interface AssessmentToolkitShellContext {\n\tkind: ShellContextKind;\n\titemId: string;\n\tcanonicalItemId: string;\n\tcontentKind: string;\n\tregionPolicy: string;\n\tscopeElement: HTMLElement | null;\n\titem: unknown;\n\tcontextVersion: number;\n}\n\nexport const assessmentToolkitShellContext =\n\tcreateContext<AssessmentToolkitShellContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.shellContext\"),\n\t);\n\nexport interface AssessmentToolkitRegionScopeContext {\n\tscopeElement: HTMLElement | null;\n}\n\nexport const assessmentToolkitRegionScopeContext =\n\tcreateContext<AssessmentToolkitRegionScopeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.regionScopeContext\"),\n\t);\n"]}
|
|
@@ -11,4 +11,3 @@ export declare function connectAssessmentToolkitRuntimeContext(host: HTMLElement
|
|
|
11
11
|
export declare function connectAssessmentToolkitHostRuntimeContext(host: HTMLElement, onValue: HostRuntimeContextListener): () => void;
|
|
12
12
|
export declare function connectAssessmentToolkitShellContext(host: HTMLElement, onValue: ShellContextListener): () => void;
|
|
13
13
|
export declare function connectAssessmentToolkitRegionScopeContext(host: HTMLElement, onValue: RegionScopeContextListener): () => void;
|
|
14
|
-
//# sourceMappingURL=runtime-context-consumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-context-consumer.js","sourceRoot":"","sources":["../../src/context/runtime-context-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,6BAA6B,EAC7B,+BAA+B,GAK/B,MAAM,iCAAiC,CAAC;AAmBzC,SAAS,gCAAgC,CACxC,IAAiB,EACjB,OAAU,EACV,OAAiC;IAEjC,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE;QAC1C,OAAO;QACP,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;KACD,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC;IAEnB,MAAM,iBAAiB,GAAG,CAAC,KAA+B,EAAE,EAAE;QAC7D,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO;YAAE,OAAO;QACtC,QAAQ,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC,CAAC;IACF,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IAE7D,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,WAAW,GAAG,GAAG,CAAC;IACxB,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE;QAC9C,IAAI,QAAQ,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;YACzC,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACrC,OAAO;QACR,CAAC;QACD,QAAQ,IAAI,CAAC,CAAC;QACd,QAAQ,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,GAAG,EAAE;QACX,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;QAChE,QAAQ,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sCAAsC,CACrD,IAAiB,EACjB,OAA+B;IAE/B,OAAO,gCAAgC,CACtC,IAAI,EACJ,+BAA+B,EAC/B,OAAmC,CACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0CAA0C,CACzD,IAAiB,EACjB,OAAmC;IAEnC,OAAO,gCAAgC,CACtC,IAAI,EACJ,mCAAmC,EACnC,OAAmC,CACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oCAAoC,CACnD,IAAiB,EACjB,OAA6B;IAE7B,OAAO,gCAAgC,CACtC,IAAI,EACJ,6BAA6B,EAC7B,OAAmC,CACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0CAA0C,CACzD,IAAiB,EACjB,OAAmC;IAEnC,OAAO,gCAAgC,CACtC,IAAI,EACJ,mCAAmC,EACnC,OAAmC,CACnC,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"runtime-context-consumer.js","sourceRoot":"","sources":["../../src/context/runtime-context-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,6BAA6B,EAC7B,+BAA+B,GAK/B,MAAM,iCAAiC,CAAC;AAmBzC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O,gCAAgC,CACtC,IAAI,EACJ,+BAA+B,EAC/B,OAAmC,CACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0CAA0C,CACzD,IAAiB,EACjB,OAAmC;IAEnC,OAAO,gCAAgC,CACtC,IAAI,EACJ,mCAAmC,EACnC,OAAmC,CACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oCAAoC,CACnD,IAAiB,EACjB,OAA6B;IAE7B,OAAO,gCAAgC,CACtC,IAAI,EACJ,6BAA6B,EAC7B,OAAmC,CACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0CAA0C,CACzD,IAAiB,EACjB,OAAmC;IAEnC,OAAO,gCAAgC,CACtC,IAAI,EACJ,mCAAmC,EACnC,OAAmC,CACnC,CAAC;AACH,CAAC","sourcesContent":["import { ContextConsumer } from \"@pie-players/pie-context\";\nimport type { UnknownContext } from \"@pie-players/pie-context\";\nimport {\n\tassessmentToolkitHostRuntimeContext,\n\tassessmentToolkitRegionScopeContext,\n\tassessmentToolkitShellContext,\n\tassessmentToolkitRuntimeContext,\n\ttype AssessmentToolkitHostRuntimeContext,\n\ttype AssessmentToolkitRegionScopeContext,\n\ttype AssessmentToolkitShellContext,\n\ttype AssessmentToolkitRuntimeContext,\n} from \"./assessment-toolkit-context.js\";\n\nexport type RuntimeContextListener = (\n\tvalue: AssessmentToolkitRuntimeContext,\n) => void;\nexport type HostRuntimeContextListener = (\n\tvalue: AssessmentToolkitHostRuntimeContext,\n) => void;\nexport type ShellContextListener = (\n\tvalue: AssessmentToolkitShellContext,\n) => void;\nexport type RegionScopeContextListener = (\n\tvalue: AssessmentToolkitRegionScopeContext,\n) => void;\n\ntype ContextProviderLikeEvent = Event & {\n\tcontext?: unknown;\n};\n\nfunction connectConsumerWithProviderRetry<T extends UnknownContext>(\n\thost: HTMLElement,\n\tcontext: T,\n\tonValue: (value: unknown) => void,\n): () => void {\n\tlet hasValue = false;\n\tconst consumer = new ContextConsumer(host, {\n\t\tcontext,\n\t\tsubscribe: true,\n\t\tonValue: (value) => {\n\t\t\thasValue = true;\n\t\t\tonValue(value);\n\t\t},\n\t});\n\tconsumer.connect();\n\n\tconst onContextProvider = (event: ContextProviderLikeEvent) => {\n\t\tif (event.context !== context) return;\n\t\tconsumer.requestValue();\n\t};\n\thost.addEventListener(\"context-provider\", onContextProvider);\n\n\tlet attempts = 0;\n\tconst maxAttempts = 200;\n\tconst retryTimer = globalThis.setInterval(() => {\n\t\tif (hasValue || attempts >= maxAttempts) {\n\t\t\tglobalThis.clearInterval(retryTimer);\n\t\t\treturn;\n\t\t}\n\t\tattempts += 1;\n\t\tconsumer.requestValue();\n\t}, 50);\n\n\treturn () => {\n\t\tglobalThis.clearInterval(retryTimer);\n\t\thost.removeEventListener(\"context-provider\", onContextProvider);\n\t\tconsumer.disconnect();\n\t};\n}\n\n/**\n * Connect a DOM host element to the shared assessment toolkit runtime context.\n * Returns a cleanup function that disconnects the underlying consumer.\n */\nexport function connectAssessmentToolkitRuntimeContext(\n\thost: HTMLElement,\n\tonValue: RuntimeContextListener,\n): () => void {\n\treturn connectConsumerWithProviderRetry(\n\t\thost,\n\t\tassessmentToolkitRuntimeContext,\n\t\tonValue as (value: unknown) => void,\n\t);\n}\n\nexport function connectAssessmentToolkitHostRuntimeContext(\n\thost: HTMLElement,\n\tonValue: HostRuntimeContextListener,\n): () => void {\n\treturn connectConsumerWithProviderRetry(\n\t\thost,\n\t\tassessmentToolkitHostRuntimeContext,\n\t\tonValue as (value: unknown) => void,\n\t);\n}\n\nexport function connectAssessmentToolkitShellContext(\n\thost: HTMLElement,\n\tonValue: ShellContextListener,\n): () => void {\n\treturn connectConsumerWithProviderRetry(\n\t\thost,\n\t\tassessmentToolkitShellContext,\n\t\tonValue as (value: unknown) => void,\n\t);\n}\n\nexport function connectAssessmentToolkitRegionScopeContext(\n\thost: HTMLElement,\n\tonValue: RegionScopeContextListener,\n): () => void {\n\treturn connectConsumerWithProviderRetry(\n\t\thost,\n\t\tassessmentToolkitRegionScopeContext,\n\t\tonValue as (value: unknown) => void,\n\t);\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -70,4 +70,3 @@ export type { AssessmentSession, AssessmentSectionSessionState, AssessmentSessio
|
|
|
70
70
|
export { createNewAssessmentSession, getAssessmentSessionStorageKey, loadAssessmentSession, saveAssessmentSession, setCurrentSectionPosition, upsertSectionSession, } from "./attempt/AssessmentSession.js";
|
|
71
71
|
export type { ActivitySessionPatchPayload, MapActivityToTestAttemptSessionArgs, PieBackendActivityDefinition, PieBackendActivityItemRef, PieBackendActivitySession, } from "./attempt/adapters/activity-to-test-attempt-session.js";
|
|
72
72
|
export { buildActivitySessionItemUpdate, buildActivitySessionPatchFromTestAttemptSession, mapActivityToTestAttemptSession, toItemSessionsRecord, } from "./attempt/adapters/activity-to-test-attempt-session.js";
|
|
73
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,+BAA+B,EAC/B,6BAA6B,GAC7B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACN,0CAA0C,EAC1C,0CAA0C,EAC1C,sCAAsC,EACtC,oCAAoC,GACpC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,iCAAiC,EACjC,uCAAuC,EACvC,oCAAoC,EACpC,8BAA8B,EAC9B,kBAAkB,EAClB,oBAAoB,GAOpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,6BAA6B,EAC7B,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,GACrB,MAAM,iCAAiC,CAAC;AA6BzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,wDAAwD;AACxD,OAAO,EAAE,oBAAoB,EAAE,M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EAClB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,GACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,sCAAsC,EACtC,+BAA+B,GAC/B,MAAM,sCAAsC,CAAC;AAK9C,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GACf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACN,6BAA6B,GAE7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAMxE,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,GACzB,MAAM,kCAAkC,CAAC;AAmB1C,OAAO,EACN,qBAAqB,EACrB,cAAc,EACd,aAAa,GACb,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EACN,mBAAmB,EACnB,kCAAkC,EAClC,2BAA2B,EAC3B,sBAAsB,EACtB,4BAA4B,EAC5B,+BAA+B,EAC/B,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,qCAAqC,EACrC,iBAAiB,GACjB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,gCAAgC,CAAC;AAQxC,OAAO,EACN,8BAA8B,EAC9B,+CAA+C,EAC/C,+BAA+B,EAC/B,oBAAoB,GACpB,MAAM,wDAAwD,CAAC;AAEhE,qEAAqE;AAErE,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,4FAA4F;AAC5F,8FAA8F;AAC9F,qGAAqG","sourcesContent":["/**\n * PIE Assessment Toolkit\n *\n * Independent, composable services for coordinating tools, accommodations,\n * and item players in assessment applications.\n *\n * @packageDocumentation\n */\n\n// ============================================================================\n// Core Infrastructure\n// ============================================================================\n\nexport type {\n\tAssessmentToolkitHostRuntimeContext,\n\tAssessmentToolkitRegionScopeContext,\n\tAssessmentToolkitRuntimeContext,\n\tAssessmentToolkitShellContext,\n\tItemPlayerConfig,\n\tItemPlayerType,\n\tShellContextKind,\n} from \"./context/assessment-toolkit-context.js\";\nexport {\n\tassessmentToolkitHostRuntimeContext,\n\tassessmentToolkitRegionScopeContext,\n\tassessmentToolkitRuntimeContext,\n\tassessmentToolkitShellContext,\n} from \"./context/assessment-toolkit-context.js\";\nexport {\n\tconnectAssessmentToolkitHostRuntimeContext,\n\tconnectAssessmentToolkitRegionScopeContext,\n\tconnectAssessmentToolkitRuntimeContext,\n\tconnectAssessmentToolkitShellContext,\n} from \"./context/runtime-context-consumer.js\";\nexport {\n\tPIE_INTERNAL_CONTENT_LOADED_EVENT,\n\tPIE_INTERNAL_ITEM_SESSION_CHANGED_EVENT,\n\tPIE_INTERNAL_ITEM_PLAYER_ERROR_EVENT,\n\tPIE_ITEM_SESSION_CHANGED_EVENT,\n\tPIE_REGISTER_EVENT,\n\tPIE_UNREGISTER_EVENT,\n\ttype InternalContentLoadedDetail,\n\ttype InternalItemSessionChangedDetail,\n\ttype InternalItemPlayerErrorDetail,\n\ttype ItemSessionChangedDetail,\n\ttype RuntimeRegistrationDetail,\n\ttype RuntimeRegistrationKind,\n} from \"./runtime/registration-events.js\";\nexport {\n\tconnectToolRegionScopeContext,\n\tconnectToolRuntimeContext,\n\tconnectToolShellContext,\n\tcreateCrossBoundaryEvent,\n\tdispatchCrossBoundaryEvent,\n\tisContextValueDefined,\n} from \"./runtime/tool-host-contract.js\";\n\n// ============================================================================\n// Service Interfaces\n// ============================================================================\n\nexport type {\n\tAccessibilityCatalogResolverApi,\n\tElementToolStateStoreApi,\n\tHighlightCoordinatorApi,\n\tI18nServiceApi,\n\tThemeProviderApi,\n\tToolCoordinatorApi,\n\tToolkitCoordinatorApi,\n\tTtsServiceApi,\n\tToolState,\n} from \"./services/interfaces.js\";\n\n// ============================================================================\n// Toolkit Services\n// ============================================================================\n\n// Accessibility Catalog Resolver (QTI 3.0 Accessibility Catalogs)\nexport type {\n\tCatalogLookupOptions,\n\tCatalogStatistics,\n\tCatalogType,\n\tResolvedCatalog,\n} from \"./services/AccessibilityCatalogResolver.js\";\nexport { AccessibilityCatalogResolver } from \"./services/AccessibilityCatalogResolver.js\";\n// Context Variable Store (QTI 3.0 Context Declarations)\nexport { ContextVariableStore } from \"./services/ContextVariableStore.js\";\n// Element Tool State Store (Element-level ephemeral tool state)\nexport { ElementToolStateStore } from \"./services/ElementToolStateStore.js\";\n// Highlight Coordinator\nexport type { Annotation } from \"./services/HighlightCoordinator.js\";\nexport {\n\tHighlightColor,\n\tHighlightCoordinator,\n\tHighlightType,\n} from \"./services/HighlightCoordinator.js\";\n// Range Serializer (for annotation persistence)\nexport type { SerializedRange } from \"./services/RangeSerializer.js\";\nexport { RangeSerializer } from \"./services/RangeSerializer.js\";\n// I18n Service\nexport type {\n\tI18nConfig,\n\tPluralTranslation,\n\tTranslationBundle,\n} from \"./services/I18nService.js\";\nexport { I18nService } from \"./services/I18nService.js\";\n// Tool Registry (Registry-based tool system)\nexport type {\n\tResolvedToolContext,\n\tToolbarContext,\n\tToolContextResolver,\n\tToolContextResolverContext,\n\tToolContextResolverMap,\n\tToolContextResolverResult,\n\tToolModuleLoader,\n\tToolToolbarButtonDefinition,\n\tToolToolbarRenderResult,\n\tToolRegistration,\n} from \"./services/ToolRegistry.js\";\nexport { ToolRegistry } from \"./services/ToolRegistry.js\";\nexport type {\n\tAssessmentToolContext,\n\tBaseToolContext,\n\tElementToolContext,\n\tItemToolContext,\n\tPassageToolContext,\n\tRubricToolContext,\n\tSectionToolContext,\n\tToolContext,\n\tToolLevel,\n} from \"./services/tool-context.js\";\nexport {\n\textractTextContent,\n\thasChoiceInteraction,\n\thasMathContent,\n\thasReadableText,\n\tisAssessmentContext,\n\tisElementContext,\n\tisItemContext,\n\tisPassageContext,\n\tisRubricContext,\n\tisSectionContext,\n} from \"./services/tool-context.js\";\nexport {\n\tDEFAULT_TOOL_PLACEMENT,\n\tDEFAULT_TOOL_ORDER,\n\tcreatePackagedToolRegistry,\n\tPACKAGED_TOOL_PLACEMENT,\n\tregisterPackagedTools,\n} from \"./services/createDefaultToolRegistry.js\";\nexport type { CreateToolsConfigArgs } from \"./services/create-tools-config.js\";\nexport { createToolsConfig } from \"./services/create-tools-config.js\";\nexport {\n\tDEFAULT_PERSONAL_NEEDS_PROFILE,\n\tcreateDefaultPersonalNeedsProfile,\n} from \"./services/defaultPersonalNeedsProfile.js\";\nexport type {\n\tToolComponentFactory,\n\tToolComponentFactoryMap,\n\tToolComponentOverrides,\n\tToolTagMap,\n} from \"./tools/tool-tag-map.js\";\nexport {\n\tcreateToolElement,\n\tDEFAULT_TOOL_TAG_MAP,\n\tresolveToolTag,\n\ttoToolIdFromTag,\n} from \"./tools/tool-tag-map.js\";\n// PNP Tool Resolution (QTI 3.0 Native)\nexport type {\n\tResolvedToolConfig,\n\tToolResolutionResult,\n} from \"./services/PNPToolResolver.js\";\nexport { PnpToolResolver } from \"./services/PNPToolResolver.js\";\n// PNP Provenance Tracking\nexport type {\n\tFeatureResolutionTrail,\n\tPnpResolutionProvenance,\n\tResolutionDecision,\n} from \"./services/pnp-provenance.js\";\nexport {\n\tformatProvenanceAsJSON,\n\tformatProvenanceAsMarkdown,\n\tgetFeatureExplanation,\n\tPnpProvenanceBuilder,\n} from \"./services/pnp-provenance.js\";\n// QTI 3.0 Standard Access Features\nexport {\n\tALL_STANDARD_ACCESS_FEATURES,\n\tEXAMPLE_PNP_CONFIGURATIONS,\n\tgetFeatureCategory,\n\tgetFeaturesInCategory,\n\tisStandardAccessFeature,\n\tQTI_STANDARD_ACCESS_FEATURES,\n} from \"./services/pnp-standard-features.js\";\n// SSML Extractor (Auto-generates catalogs from embedded SSML)\nexport type { ExtractionResult } from \"./services/SSMLExtractor.js\";\nexport { SSMLExtractor } from \"./services/SSMLExtractor.js\";\n// Theme Provider\nexport type { FontSize, ThemeConfig } from \"./services/ThemeProvider.js\";\nexport { ThemeProvider } from \"./services/ThemeProvider.js\";\n// Tool Coordinator\nexport { ToolCoordinator, ZIndexLayer } from \"./services/ToolCoordinator.js\";\n// Toolkit Coordinator (Centralized service management)\nexport type {\n\tAnswerEliminatorToolConfig,\n\tProviderLifecycleContext,\n\tSectionControllerContext,\n\tSectionControllerEvent,\n\tSectionControllerEventType,\n\tSectionItemEvent,\n\tSectionItemEventType,\n\tSectionControllerFactoryDefaults,\n\tSectionControllerHandle,\n\tSectionControllerKey,\n\tSectionScopedEvent,\n\tSectionScopedEventType,\n\tSectionSessionPersistenceConfig,\n\tSectionItemEventSubscriptionArgs,\n\tSectionScopedEventSubscriptionArgs,\n\tSectionEventSubscriptionArgs,\n\tSectionSessionPersistenceStrategy,\n\tSectionControllerLoadedRenderable,\n\tSectionControllerRuntimeState,\n\tSectionControllerSessionState,\n\tSectionPersistenceFactoryDefaults,\n\tToolConfig,\n\tToolkitCoordinatorConfig,\n\tToolkitCoordinatorHooks,\n\tToolkitErrorContext,\n\tToolkitInitStatus,\n\tToolkitServiceBundle,\n\tToolkitToolsConfig,\n\tTTSToolConfig,\n} from \"./services/ToolkitCoordinator.js\";\nexport { ToolkitCoordinator } from \"./services/ToolkitCoordinator.js\";\nexport type {\n\tCanonicalToolsConfig,\n\tToolPlacementConfig,\n\tToolPlacementLevel,\n\tToolPolicyConfig,\n\tToolProvidersConfig,\n} from \"./services/tools-config-normalizer.js\";\nexport type {\n\tFrameworkErrorKind,\n\tFrameworkErrorModel,\n\tFrameworkErrorSeverity,\n} from \"./services/framework-error.js\";\nexport {\n\tformatFrameworkErrorForConsole,\n\tframeworkErrorFromToolConfigDiagnostics,\n\tframeworkErrorFromUnknown,\n\ttoFrameworkErrorModel,\n} from \"./services/framework-error.js\";\nexport type {\n\tFrameworkErrorListener,\n} from \"./services/framework-error-bus.js\";\nexport type {\n\tToolConfigDiagnostic,\n\tToolConfigDiagnosticSeverity,\n\tToolConfigStrictness,\n\tToolConfigValidationOptions,\n\tToolConfigValidationResult,\n} from \"./services/tool-config-validation.js\";\nexport type {\n\tToolbarButtonItem,\n\tToolbarItem,\n\tToolbarItemBase,\n\tToolbarLinkItem,\n} from \"./services/toolbar-items.js\";\nexport {\n\tisExternalIconUrl,\n\tisInlineSvgIcon,\n\tisToolbarLinkItem,\n\tisValidToolbarItemShape,\n} from \"./services/toolbar-items.js\";\nexport {\n\tnormalizeToolsConfig,\n\tnormalizeToolAlias,\n\tnormalizeToolList,\n\tparseToolList,\n\tresolveToolsForLevel,\n} from \"./services/tools-config-normalizer.js\";\nexport {\n\tframeworkErrorFromToolConfigValidation,\n\tnormalizeAndValidateToolsConfig,\n} from \"./services/tool-config-validation.js\";\nexport type {\n\tParsedToolInstanceId,\n\tToolScopeLevel,\n} from \"./services/tool-instance-id.js\";\nexport {\n\tcreateScopedToolId,\n\tparseScopedToolId,\n\ttoOverlayToolId,\n} from \"./services/tool-instance-id.js\";\n// Text-to-Speech Service\nexport type { TTSConfig } from \"./services/TTSService.js\";\nexport { PlaybackState, TTSService } from \"./services/TTSService.js\";\nexport {\n\tPIE_TTS_CONTROL_HANDOFF_EVENT,\n\ttype TTSControlHandoffDetail,\n} from \"./services/tts-control-events.js\";\nexport { BrowserTTSProvider } from \"./services/tts/browser-provider.js\";\nexport type {\n\tTTSHostToolbarLayout,\n\tTTSLayoutMode,\n\tTTSRuntimeSettings,\n} from \"./services/tts-runtime-config.js\";\nexport {\n\tDEFAULT_TTS_SPEED_OPTIONS,\n\tformatTTSSpeedOptionsAsText,\n\tnormalizeTTSLayoutMode,\n\tnormalizeTTSSpeedOptions,\n\tparseTTSSpeedOptionsFromText,\n\tresolveTTSHostToolbarLayout,\n\tresolveTTSLayoutMode,\n\tresolveTTSRuntimeSettings,\n} from \"./services/tts-runtime-config.js\";\n// TTS Provider System\nexport type {\n\tITTSProvider,\n\tITTSProviderImplementation,\n\tTTSSpeechSegment,\n\tTTSFeature,\n\tTTSProviderCapabilities,\n} from \"@pie-players/pie-tts\";\n\n// ============================================================================\n// Item loading (client-resolvable default; optional backend hook)\n// ============================================================================\n\nexport type {\n\tCreateLoadItemOptions,\n\tLoadItem,\n\tLoadItemOptions,\n} from \"./item-loader.js\";\nexport {\n\tcreateFetchItemLoader,\n\tcreateLoadItem,\n\tItemLoadError,\n} from \"./item-loader.js\";\n\n// ============================================================================\n// Attempt Session\n// ============================================================================\n\nexport type {\n\tStorageLike,\n\tTestAttemptItemSession,\n\tTestAttemptSession,\n\tTestAttemptSessionNavigationState,\n\tTestAttemptSessionRealization,\n} from \"./attempt/TestSession.js\";\nexport {\n\tcreateMemoryStorage,\n\tcreateTestAttemptSessionIdentifier,\n\tcreateNewTestAttemptSession,\n\tgetBrowserLocalStorage,\n\tgetOrCreateAnonymousDeviceId,\n\tgetTestAttemptSessionStorageKey,\n\tloadTestAttemptSession,\n\tsaveTestAttemptSession,\n\tsetCurrentPosition,\n\tupsertItemSessionFromPieSessionChange,\n\tupsertVisitedItem,\n} from \"./attempt/TestSession.js\";\nexport type {\n\tAssessmentSession,\n\tAssessmentSectionSessionState,\n\tAssessmentSessionNavigationState,\n\tAssessmentSessionRealization,\n} from \"./attempt/AssessmentSession.js\";\nexport {\n\tcreateNewAssessmentSession,\n\tgetAssessmentSessionStorageKey,\n\tloadAssessmentSession,\n\tsaveAssessmentSession,\n\tsetCurrentSectionPosition,\n\tupsertSectionSession,\n} from \"./attempt/AssessmentSession.js\";\nexport type {\n\tActivitySessionPatchPayload,\n\tMapActivityToTestAttemptSessionArgs,\n\tPieBackendActivityDefinition,\n\tPieBackendActivityItemRef,\n\tPieBackendActivitySession,\n} from \"./attempt/adapters/activity-to-test-attempt-session.js\";\nexport {\n\tbuildActivitySessionItemUpdate,\n\tbuildActivitySessionPatchFromTestAttemptSession,\n\tmapActivityToTestAttemptSession,\n\ttoItemSessionsRecord,\n} from \"./attempt/adapters/activity-to-test-attempt-session.js\";\n\n// Section Player - Use @pie-players/pie-section-player web component\n\n// ============================================================================\n// Shared Components\n// ============================================================================\n\n// ItemToolBar custom element registration helper is exported via package.json exports field\n// Import using: import '@pie-players/pie-assessment-toolkit/components/item-toolbar-element';\n// PieAssessmentToolkit custom element registration helper is exported via package.json exports field\n"]}
|
package/dist/item-loader.d.ts
CHANGED
package/dist/item-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-loader.js","sourceRoot":"","sources":["../src/item-loader.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC9B,IAAI,CAIK;IAElB,YAAY,IAA2B,EAAE,OAAe;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD;AA8BD,SAAS,mBAAmB,CAAC,OAAe,EAAE,IAAsB;IACnE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,aAAa,OAAO,EAAE,EAAE,6BAA6B,CAAC,CAAC;IAC3E,IAAI,IAAI,EAAE,cAAc;QACvB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC7D,OAAO,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAIrC;IACA,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC,KAAK,CAAC;IACrD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,aAAa,CACtB,qBAAqB,EACrB,uDAAuD,CACvD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;QAClC,MAAM,eAAe,GACpB,OAAO,IAAI,CAA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,EAAE,QAAQ,EAAE,EAAE;QAClC,IAAI,QAAQ,EAAE,CAAC,OAAO,CAAC;YAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;QAElD,IAAI,WAAW;YAAE,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE7D,IAAI,YAAY,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;YACrD,MAAM,IAAI,aAAa,CACtB,qBAAqB,EACrB,iEAAiE,CACjE,CAAC;QACH,CAAC;QAED,MAAM,IAAI,aAAa,CACtB,8BAA8B,EAC9B,mEAAmE,CACnE,CAAC;IACH,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type { ItemEntity } from \"@pie-players/pie-players-shared\";\n\nexport type LoadItemOptions = {\n\torganizationId?: string | null;\n};\n\nexport type LoadItem = (\n\titemVId: string,\n\topts?: LoadItemOptions,\n) => Promise<ItemEntity>;\n\nexport class ItemLoadError extends Error {\n\treadonly code:\n\t\t| \"ITEM_NOT_FOUND\"\n\t\t| \"NO_ITEM_BANK_OR_FETCH_CONFIG\"\n\t\t| \"FETCH_NOT_AVAILABLE\"\n\t\t| \"FETCH_FAILED\";\n\n\tconstructor(code: ItemLoadError[\"code\"], message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"ItemLoadError\";\n\t\tthis.code = code;\n\t}\n}\n\nexport type CreateLoadItemOptions = {\n\t/**\n\t * Optional in-memory item bank. Keys are itemVId.\n\t * This enables a no-backend default for demos/tests.\n\t */\n\titemBank?: Record<string, ItemEntity>;\n\n\t/**\n\t * Optional base URL for an item API. If set, `createLoadItem` will fetch when\n\t * an item is not present in `itemBank`.\n\t *\n\t * Example: `https://host.example.com`\n\t */\n\tfetchBaseUrl?: string;\n\n\t/**\n\t * Optional endpoint builder.\n\t * Defaults to `/api/item/:itemVId` (and appends `?organizationId=...` if provided).\n\t */\n\titemEndpoint?: string | ((itemVId: string, opts?: LoadItemOptions) => string);\n\n\t/**\n\t * Custom fetch implementation (useful for tests or hosts).\n\t * Defaults to `globalThis.fetch`.\n\t */\n\tfetchImpl?: typeof fetch;\n};\n\nfunction defaultItemEndpoint(itemVId: string, opts?: LoadItemOptions) {\n\tconst url = new URL(`/api/item/${itemVId}`, \"https://placeholder.invalid\");\n\tif (opts?.organizationId)\n\t\turl.searchParams.set(\"organizationId\", opts.organizationId);\n\treturn url.pathname + url.search;\n}\n\nexport function createFetchItemLoader(opts: {\n\tbaseUrl: string;\n\titemEndpoint?: CreateLoadItemOptions[\"itemEndpoint\"];\n\tfetchImpl?: typeof fetch;\n}): LoadItem {\n\tconst fetchImpl = opts.fetchImpl ?? globalThis.fetch;\n\tif (!fetchImpl) {\n\t\tthrow new ItemLoadError(\n\t\t\t\"FETCH_NOT_AVAILABLE\",\n\t\t\t\"globalThis.fetch is not available in this environment\",\n\t\t);\n\t}\n\n\treturn async (itemVId, loadOpts) => {\n\t\tconst endpointBuilder =\n\t\t\ttypeof opts.itemEndpoint === \"function\"\n\t\t\t\t? opts.itemEndpoint\n\t\t\t\t: typeof opts.itemEndpoint === \"string\"\n\t\t\t\t\t? () => opts.itemEndpoint as string\n\t\t\t\t\t: defaultItemEndpoint;\n\n\t\tconst endpoint = endpointBuilder(itemVId, loadOpts);\n\t\tconst url = new URL(endpoint, opts.baseUrl);\n\n\t\tconst res = await fetchImpl(url.toString());\n\t\tif (!res.ok) {\n\t\t\tthrow new ItemLoadError(\n\t\t\t\t\"FETCH_FAILED\",\n\t\t\t\t`Failed to load item ${itemVId}: ${res.status} ${res.statusText}`,\n\t\t\t);\n\t\t}\n\t\treturn (await res.json()) as ItemEntity;\n\t};\n}\n\n/**\n * Client-resolvable default loader:\n * - resolve from `itemBank` first (no backend required)\n * - optionally fallback to fetch (encouraged backend hook)\n */\nexport function createLoadItem(opts: CreateLoadItemOptions): LoadItem {\n\tconst itemBank = opts.itemBank;\n\tconst fetchBaseUrl = opts.fetchBaseUrl;\n\n\tconst fetchImpl =\n\t\topts.fetchImpl ?? (globalThis.fetch as typeof fetch | undefined);\n\tconst fetchLoader =\n\t\tfetchBaseUrl && typeof fetchImpl === \"function\"\n\t\t\t? createFetchItemLoader({\n\t\t\t\t\tbaseUrl: fetchBaseUrl,\n\t\t\t\t\titemEndpoint: opts.itemEndpoint,\n\t\t\t\t\tfetchImpl,\n\t\t\t\t})\n\t\t\t: null;\n\n\treturn async (itemVId, loadOpts) => {\n\t\tif (itemBank?.[itemVId]) return itemBank[itemVId];\n\n\t\tif (fetchLoader) return await fetchLoader(itemVId, loadOpts);\n\n\t\tif (fetchBaseUrl && typeof fetchImpl !== \"function\") {\n\t\t\tthrow new ItemLoadError(\n\t\t\t\t\"FETCH_NOT_AVAILABLE\",\n\t\t\t\t\"fetchBaseUrl was provided but globalThis.fetch is not available\",\n\t\t\t);\n\t\t}\n\n\t\tthrow new ItemLoadError(\n\t\t\t\"NO_ITEM_BANK_OR_FETCH_CONFIG\",\n\t\t\t\"No itemBank entry and no fetchBaseUrl configured for item loading\",\n\t\t);\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicySource.js","sourceRoot":"","sources":["../../../src/policy/core/PolicySource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
1
|
+
{"version":3,"file":"PolicySource.js","sourceRoot":"","sources":["../../../src/policy/core/PolicySource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/**\n * Custom `PolicySource` extension point (M8 — see\n * `.cursor/plans/m8-design.md` § 5).\n *\n * Custom sources run in step 6 of the composition pipeline — *after*\n * placement membership, provider veto, host policy, and PNP/profile gates.\n * That ordering is deliberate: custom rules can only further *narrow*\n * the candidate set or add advisory provenance entries; they cannot\n * promote a tool that the host already removed.\n *\n * Sources MUST be pure with respect to `decide(...)`: given the same\n * `(candidates, context)` input they should produce the same\n * `(refinedCandidates, decisions)` output. Side-effects are reserved\n * for the engine's own subscription bus (`onPolicyChange`).\n */\n\nimport type { ToolPolicyDecisionRequest } from \"./decision-types.js\";\nimport type {\n\tToolPolicyDecisionRule,\n\tToolPolicyResolutionDecision,\n\tToolPolicySourceType,\n} from \"./provenance.js\";\n\nexport interface PolicySourceDecisionContext {\n\trequest: ToolPolicyDecisionRequest;\n\t/**\n\t * Snapshot of the candidate set as it enters this source. Sources\n\t * SHOULD treat this as read-only and return a fresh array via\n\t * `result.refinedCandidates`. Mutating `candidates` in place is\n\t * not supported and will be flagged in tests.\n\t */\n\tcandidates: readonly string[];\n}\n\nexport interface PolicySourceProvenanceEntry {\n\trule: ToolPolicyDecisionRule;\n\tfeatureId: string;\n\taction: ToolPolicyResolutionDecision[\"action\"];\n\tsourceType: ToolPolicySourceType;\n\treason: string;\n\tvalue?: unknown;\n\t/**\n\t * Custom precedence value used for the decision log. Defaults to\n\t * `100 + sourceIndex` (engine-assigned) when `undefined`. Sources\n\t * MAY override only if they know what they are doing — overriding\n\t * to a value `<= 6` lets the source masquerade as a PNP/profile rule and\n\t * is generally a bug.\n\t */\n\tprecedence?: number;\n}\n\nexport interface PolicySourceResult {\n\t/**\n\t * Refined candidate set. MUST be a subset of `context.candidates`.\n\t * Returning a superset is unsupported and will be normalized away\n\t * by the engine (with an `tool-policy.placementMissing` diagnostic\n\t * for any added IDs).\n\t */\n\trefinedCandidates: string[];\n\t/**\n\t * Provenance entries to append to the decision log. Each entry is\n\t * recorded under `featureId` whether or not it survives — sources\n\t * MAY emit advisory entries for blocked tools to document why.\n\t */\n\tdecisions?: PolicySourceProvenanceEntry[];\n}\n\nexport interface PolicySource {\n\t/** Stable identifier — used for `custom.${id}` source tags. */\n\treadonly id: string;\n\n\trefine(context: PolicySourceDecisionContext): PolicySourceResult;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolPolicyEngine.js","sourceRoot":"","sources":["../../../src/policy/core/ToolPolicyEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,OAA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AC;QACrB,IAAI,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE;SAC7B,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,CAAC;IAEO,cAAc;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;IAEO,IAAI,CAAC,KAA4B;QACxC,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC;gBACJ,QAAQ,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;YAAC,MAAM,CAAC;gBACR,0DAA0D;gBAC1D,mDAAmD;YACpD,CAAC;QACF,CAAC;IACF,CAAC;IAEO,iBAAiB;QACxB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;CACD","sourcesContent":["/**\n * Tool Policy Engine — facade class (M8 — see\n * `.cursor/plans/m8-design.md` § 2).\n *\n * Wraps `composeDecision(...)` with engine-instance state:\n * - bound inputs (`tools`, `assessment`, `currentItemRef`, ...)\n * - registered custom `PolicySource`s\n * - `onPolicyChange` subscriber bus\n * - `dispose()` clean-up\n *\n * The class has no DOM dependency and no Svelte runes. It is safe to\n * instantiate inside a worker, in a Node test, or inside a CE\n * connectedCallback. The Svelte context glue (`TOOL_POLICY_ENGINE_KEY`)\n * lives in `engine-context.ts`.\n *\n * PR 1 ships the engine *without callers*. PR 2 wires it into\n * `ToolkitCoordinator`. PR 3 switches `<pie-item-toolbar>` over.\n */\n\nimport type {\n\tAssessmentEntity,\n\tAssessmentItemRef,\n} from \"@pie-players/pie-players-shared/types\";\n\nimport type {\n\tCanonicalToolsConfig,\n\tToolPlacementLevel,\n} from \"../../services/tools-config-normalizer.js\";\nimport { normalizeToolsConfig } from \"../../services/tools-config-normalizer.js\";\nimport type { ToolRegistry } from \"../../services/ToolRegistry.js\";\n\nimport type {\n\tToolPolicyDecision,\n\tToolPolicyDecisionRequest,\n} from \"./decision-types.js\";\nimport type { PolicySource } from \"./PolicySource.js\";\nimport { composeDecision } from \"./compose-decision.js\";\nimport { resolveDefaultPnpEnforcement } from \"./pnp-policy-inputs.js\";\nimport { PnpPolicySource } from \"../sources/PnpPolicySource.js\";\n\nexport type PnpEnforcementMode = \"on\" | \"off\";\n\nexport interface ToolPolicyEngineInputs {\n\ttools?: CanonicalToolsConfig | null;\n\tassessment?: AssessmentEntity | null;\n\tcurrentItemRef?: AssessmentItemRef | null;\n\t/**\n\t * Explicit PNP/profile override. When omitted (or `undefined`), the engine\n\t * defaults to {@link resolveDefaultPnpEnforcement} over the bound\n\t * `assessment` and `currentItemRef`: `\"on\"` if they carry any\n\t * PNP/profile policy material (PNP, district policy, test\n\t * administration, item-level required/restricted/parameters),\n\t * `\"off\"` otherwise. See `.cursor/plans/m8-design.md` F2.\n\t *\n\t * Hosts that want to force a mode pass `\"on\"` or `\"off\"`\n\t * explicitly. Embedded under `<pie-section-player-*>` the preferred\n\t * override flows through `runtime.tools.pnpEnforcement`.\n\t */\n\tpnpEnforcement?: PnpEnforcementMode;\n}\n\nexport interface ToolPolicyEngineArgs {\n\ttoolRegistry: ToolRegistry;\n\tinputs?: ToolPolicyEngineInputs;\n\tcustomSources?: readonly PolicySource[];\n\t/** Stable context label used in provenance trails. Defaults to \"tool-policy\". */\n\tcontextId?: string;\n}\n\nexport interface ToolPolicyChangeEvent {\n\t/** What changed in this update. */\n\treason:\n\t\t| \"inputs\"\n\t\t| \"policy-source-added\"\n\t\t| \"policy-source-removed\"\n\t\t| \"pnp-enforcement\"\n\t\t| \"disposed\";\n\t/** Snapshot of the engine's inputs after the change. */\n\tinputs: Readonly<ResolvedEngineInputs>;\n}\n\nexport interface ResolvedEngineInputs {\n\ttools: CanonicalToolsConfig;\n\tassessment: AssessmentEntity | null;\n\tcurrentItemRef: AssessmentItemRef | null;\n\tpnpEnforcement: PnpEnforcementMode;\n}\n\nexport type ToolPolicyChangeListener = (event: ToolPolicyChangeEvent) => void;\n\nconst DEFAULT_TOOLS: CanonicalToolsConfig = normalizeToolsConfig({\n\tpolicy: { allowed: [], blocked: [] },\n\tplacement: { section: [], item: [], passage: [] },\n\tproviders: {},\n});\n\nexport class ToolPolicyEngine {\n\tprivate readonly toolRegistry: ToolRegistry;\n\tprivate readonly contextId: string;\n\tprivate readonly pnpPolicySource: PnpPolicySource;\n\tprivate readonly customSources: PolicySource[];\n\tprivate readonly listeners = new Set<ToolPolicyChangeListener>();\n\n\tprivate tools: CanonicalToolsConfig;\n\tprivate assessment: AssessmentEntity | null;\n\tprivate currentItemRef: AssessmentItemRef | null;\n\tprivate pnpEnforcement: PnpEnforcementMode;\n\tprivate disposed = false;\n\n\tconstructor(args: ToolPolicyEngineArgs) {\n\t\tthis.toolRegistry = args.toolRegistry;\n\t\tthis.contextId = args.contextId ?? \"tool-policy\";\n\t\tthis.pnpPolicySource = new PnpPolicySource(this.toolRegistry);\n\t\tthis.customSources = args.customSources ? [...args.customSources] : [];\n\n\t\tconst inputs = args.inputs ?? {};\n\t\tthis.tools = inputs.tools ?? DEFAULT_TOOLS;\n\t\tthis.assessment = inputs.assessment ?? null;\n\t\tthis.currentItemRef = inputs.currentItemRef ?? null;\n\t\tthis.pnpEnforcement =\n\t\t\tinputs.pnpEnforcement ??\n\t\t\tresolveDefaultPnpEnforcement({\n\t\t\t\tassessment: this.assessment,\n\t\t\t\tcurrentItemRef: this.currentItemRef,\n\t\t\t});\n\t}\n\n\t/**\n\t * Resolve the visible tool set for a given placement level and\n\t * scope.\n\t *\n\t * `visibleTools` and `diagnostics` are deterministic with respect\n\t * to the engine's currently-bound inputs — calling `decide(...)`\n\t * twice with identical inputs returns structurally equal\n\t * `visibleTools` and `diagnostics`. The returned `provenance`\n\t * carries call-time `evaluatedAt` timestamps generated by\n\t * `ToolPolicyProvenanceBuilder` (one per `decide(...)`); two\n\t * back-to-back calls therefore produce different `evaluatedAt`\n\t * values even though the policy decision itself is identical.\n\t * Hosts that want timestamp-stable provenance should reuse a\n\t * cached `ToolPolicyDecision` rather than re-call `decide(...)`.\n\t */\n\tdecide(request: ToolPolicyDecisionRequest): ToolPolicyDecision {\n\t\tthis.assertNotDisposed();\n\t\tconst requestContextId = request.scope.scopeId\n\t\t\t? `${this.contextId}:${request.level}:${request.scope.scopeId}`\n\t\t\t: `${this.contextId}:${request.level}`;\n\t\treturn composeDecision({\n\t\t\trequest,\n\t\t\ttools: this.tools,\n\t\t\tpnpPolicy: {\n\t\t\t\tsource: this.pnpPolicySource,\n\t\t\t\tassessment: this.assessment ?? undefined,\n\t\t\t\tcurrentItemRef: this.currentItemRef ?? undefined,\n\t\t\t\tenforcement: this.pnpEnforcement,\n\t\t\t},\n\t\t\tcustomSources: this.customSources,\n\t\t\tcontextId: requestContextId,\n\t\t});\n\t}\n\n\t/**\n\t * Convenience wrapper for hosts that just want the visible tool\n\t * IDs. Equivalent to `decide(...).visibleTools.map(e => e.toolId)`.\n\t */\n\tgetVisibleToolIds(level: ToolPlacementLevel, scopeId: string): string[] {\n\t\treturn this.decide({\n\t\t\tlevel,\n\t\t\tscope: { level, scopeId },\n\t\t}).visibleTools.map((entry) => entry.toolId);\n\t}\n\n\t/**\n\t * Apply a partial input update.\n\t *\n\t * Each key is value-diffed via `Object.is` before storing, so callers\n\t * may safely re-push the same reference (e.g. on Svelte effect\n\t * re-runs caused by unrelated tracked reads): no-op patches do not\n\t * fire `onPolicyChange` listeners. This contract is relied on by\n\t * `PieAssessmentToolkit.svelte`'s prop-forwarding effect and by the\n\t * coordinator's `getFloatingTools()` / `decideToolPolicy()` lockstep\n\t * tests.\n\t *\n\t * `pnpEnforcement` is stored on its own field and always emits with\n\t * a distinct `\"pnp-enforcement\"` reason when no other key changed,\n\t * so PR 4's auto-on flip can target that reason without a separate\n\t * event channel.\n\t */\n\tupdateInputs(patch: Partial<ToolPolicyEngineInputs>): void {\n\t\tthis.assertNotDisposed();\n\t\tlet changed = false;\n\t\tlet pnpChanged = false;\n\t\tif (\"tools\" in patch) {\n\t\t\tconst next = patch.tools ?? DEFAULT_TOOLS;\n\t\t\tif (!Object.is(this.tools, next)) {\n\t\t\t\tthis.tools = next;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\t\tif (\"assessment\" in patch) {\n\t\t\tconst next = patch.assessment ?? null;\n\t\t\tif (!Object.is(this.assessment, next)) {\n\t\t\t\tthis.assessment = next;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\t\tif (\"currentItemRef\" in patch) {\n\t\t\tconst next = patch.currentItemRef ?? null;\n\t\t\tif (!Object.is(this.currentItemRef, next)) {\n\t\t\t\tthis.currentItemRef = next;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\t\tif (\"pnpEnforcement\" in patch && patch.pnpEnforcement) {\n\t\t\tif (this.pnpEnforcement !== patch.pnpEnforcement) {\n\t\t\t\tthis.pnpEnforcement = patch.pnpEnforcement;\n\t\t\t\tpnpChanged = true;\n\t\t\t}\n\t\t}\n\t\tif (changed || pnpChanged) {\n\t\t\tthis.emit({\n\t\t\t\treason: pnpChanged && !changed ? \"pnp-enforcement\" : \"inputs\",\n\t\t\t\tinputs: this.snapshotInputs(),\n\t\t\t});\n\t\t}\n\t}\n\n\tregisterPolicySource(source: PolicySource): () => void {\n\t\tthis.assertNotDisposed();\n\t\tthis.customSources.push(source);\n\t\tthis.emit({\n\t\t\treason: \"policy-source-added\",\n\t\t\tinputs: this.snapshotInputs(),\n\t\t});\n\t\treturn () => {\n\t\t\tconst idx = this.customSources.indexOf(source);\n\t\t\tif (idx !== -1) {\n\t\t\t\tthis.customSources.splice(idx, 1);\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.emit({\n\t\t\t\t\t\treason: \"policy-source-removed\",\n\t\t\t\t\t\tinputs: this.snapshotInputs(),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tonPolicyChange(listener: ToolPolicyChangeListener): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tgetInputs(): Readonly<ResolvedEngineInputs> {\n\t\treturn this.snapshotInputs();\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tthis.emit({\n\t\t\treason: \"disposed\",\n\t\t\tinputs: this.snapshotInputs(),\n\t\t});\n\t\tthis.listeners.clear();\n\t\tthis.customSources.length = 0;\n\t}\n\n\tprivate snapshotInputs(): Readonly<ResolvedEngineInputs> {\n\t\treturn Object.freeze({\n\t\t\ttools: this.tools,\n\t\t\tassessment: this.assessment,\n\t\t\tcurrentItemRef: this.currentItemRef,\n\t\t\tpnpEnforcement: this.pnpEnforcement,\n\t\t});\n\t}\n\n\tprivate emit(event: ToolPolicyChangeEvent): void {\n\t\tfor (const listener of Array.from(this.listeners)) {\n\t\t\ttry {\n\t\t\t\tlistener(event);\n\t\t\t} catch {\n\t\t\t\t// Subscriber errors must not break the engine. Hosts that\n\t\t\t\t// want error telemetry should wrap their listener.\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthrow new Error(\"ToolPolicyEngine has been disposed.\");\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-decision.js","sourceRoot":"","sources":["../../../src/policy/core/compose-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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;IAC9D,kEAAkE;IAClE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * Compose-decision pipeline (M8 — see `.cursor/plans/m8-design.md` § 3).\n *\n * Pure function: given a decision request, the host's tools config,\n * an optional PNP policy source, and the registered custom sources, returns\n * a `ToolPolicyDecision`. The function performs no I/O, holds no\n * mutable state, and never reaches into Svelte / DOM — that is the\n * `ToolPolicyEngine` class's job.\n *\n * The six steps below mirror the design doc exactly. The tests in\n * `tests/policy/compose-decision.test.ts` lock the orchestration in.\n */\n\nimport type {\n\tAssessmentEntity,\n\tAssessmentItemRef,\n} from \"@pie-players/pie-players-shared/types\";\n\nimport {\n\ttype CanonicalToolsConfig,\n\tnormalizeToolList,\n} from \"../../services/tools-config-normalizer.js\";\nimport type {\n\tRequiredToolBlockedDetails,\n\tToolPolicyDecision,\n\tToolPolicyDecisionRequest,\n\tToolPolicyDiagnostic,\n\tToolPolicyEntry,\n\tToolPolicyHostGate,\n} from \"./decision-types.js\";\nimport type { PolicySource } from \"./PolicySource.js\";\nimport type { PolicySourceTag } from \"./policy-source-tag.js\";\nimport { ToolPolicyProvenanceBuilder } from \"./provenance.js\";\nimport type { PnpPolicySource } from \"../sources/PnpPolicySource.js\";\n\nexport interface ComposeDecisionInputs {\n\trequest: ToolPolicyDecisionRequest;\n\ttools: CanonicalToolsConfig;\n\tpnpPolicy: {\n\t\tsource: PnpPolicySource | null;\n\t\tassessment?: AssessmentEntity;\n\t\tcurrentItemRef?: AssessmentItemRef;\n\t\t/**\n\t\t * \"on\" applies the PNP/profile precedence rules; \"off\" skips step 5\n\t\t * entirely. Defaults to \"on\" when an assessment is present\n\t\t * and the source is non-null (see M8 design Q5).\n\t\t */\n\t\tenforcement: \"on\" | \"off\";\n\t};\n\tcustomSources: readonly PolicySource[];\n\t/** Stable identifier used as the provenance `contextId`. */\n\tcontextId: string;\n}\n\nexport function composeDecision(\n\tinputs: ComposeDecisionInputs,\n): ToolPolicyDecision {\n\tconst { request, tools, pnpPolicy, customSources, contextId } = inputs;\n\tconst builder = new ToolPolicyProvenanceBuilder(contextId);\n\n\tbuilder.addSource(\"host\", {\n\t\tid: request.scope.scopeId,\n\t\tname: `${request.level}:${request.scope.scopeId}`,\n\t\tconfig: {\n\t\t\tplacement: tools.placement,\n\t\t\tpolicy: tools.policy,\n\t\t},\n\t});\n\n\tconst placement = normalizeToolList(tools.placement[request.level]);\n\tconst allowed = normalizeToolList(tools.policy.allowed);\n\tconst blocked = new Set(normalizeToolList(tools.policy.blocked));\n\n\t// Step 1 — Membership filter.\n\t//\n\t// Logged with `action: \"skip\"` rather than `\"enable\"` because a\n\t// placement-membership entry is the pipeline's starting point, not\n\t// a winning decision. Subsequent steps may block the tool at the\n\t// same precedence (0); the builder's `decision.precedence <\n\t// winning.precedence` rule would otherwise let the placement entry\n\t// win equality and mask later blocks. Surviving tools are flipped\n\t// to `enabled` by `builder.reconcileFinalStates(...)` at the end of\n\t// the pipeline once the final candidate set is known.\n\tlet candidates: string[] = [];\n\tfor (const toolId of placement) {\n\t\tcandidates.push(toolId);\n\t\tbuilder.addDecision({\n\t\t\tprecedence: 0,\n\t\t\trule: \"placement-membership\",\n\t\t\tfeatureId: toolId,\n\t\t\taction: \"skip\",\n\t\t\tsourceType: \"host\",\n\t\t\treason: `Listed in tools.placement.${request.level}`,\n\t\t});\n\t}\n\n\t// Step 2 — Provider veto.\n\tcandidates = candidates.filter((toolId) => {\n\t\tconst providerEnabled = tools.providers?.[toolId]?.enabled;\n\t\tif (providerEnabled === false) {\n\t\t\tbuilder.addDecision({\n\t\t\t\tprecedence: 0,\n\t\t\t\trule: \"provider-disabled\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"host\",\n\t\t\t\treason: `tools.providers.${toolId}.enabled === false`,\n\t\t\t\tvalue: false,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Step 3 — Host whitelist (only when non-empty).\n\tif (allowed.length > 0) {\n\t\tconst allowedSet = new Set(allowed);\n\t\tcandidates = candidates.filter((toolId) => {\n\t\t\tif (!allowedSet.has(toolId)) {\n\t\t\t\tbuilder.addDecision({\n\t\t\t\t\tprecedence: 0,\n\t\t\t\t\trule: \"host-allowlist\",\n\t\t\t\t\tfeatureId: toolId,\n\t\t\t\t\taction: \"block\",\n\t\t\t\t\tsourceType: \"host\",\n\t\t\t\t\treason: \"Not present in tools.policy.allowed\",\n\t\t\t\t\tvalue: allowed,\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t}\n\n\t// Step 4 — Host blocklist (absolute).\n\tcandidates = candidates.filter((toolId) => {\n\t\tif (blocked.has(toolId)) {\n\t\t\tbuilder.addDecision({\n\t\t\t\tprecedence: 0,\n\t\t\t\trule: \"host-blocked\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"host\",\n\t\t\t\treason: \"Listed in tools.policy.blocked\",\n\t\t\t\tvalue: tools.policy.blocked,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Step 5 — PNP/profile policy gates.\n\tconst diagnostics: ToolPolicyDiagnostic[] = [];\n\tconst sourcesByTool = new Map<string, PolicySourceTag[]>();\n\tfor (const toolId of candidates) {\n\t\tsourcesByTool.set(toolId, [\"placement\"]);\n\t}\n\n\t// Snapshot the post-host candidate set so step 5b can distinguish\n\t// \"host removed a required tool\" (requiredToolBlocked fires)\n\t// from \"profile policy's own precedence removed a required tool\" (fix\n\t// per M8 PR 1 R1 S1 — multi-rule conflict on the same tool must\n\t// not blame the host).\n\tconst postHostCandidates = new Set(candidates);\n\n\tlet pnpPolicyResult: ReturnType<PnpPolicySource[\"apply\"]> | null = null;\n\tif (\n\t\tpnpPolicy.enforcement === \"on\" &&\n\t\tpnpPolicy.source &&\n\t\t(pnpPolicy.assessment || pnpPolicy.currentItemRef)\n\t) {\n\t\tpnpPolicyResult = pnpPolicy.source.apply({\n\t\t\tassessment: pnpPolicy.assessment,\n\t\t\tcurrentItemRef: pnpPolicy.currentItemRef,\n\t\t});\n\n\t\tif (pnpPolicyResult.sources.assessment) {\n\t\t\tbuilder.addSource(\"assessment\", pnpPolicyResult.sources.assessment);\n\t\t}\n\t\tif (pnpPolicyResult.sources.student) {\n\t\t\tbuilder.addSource(\"student\", pnpPolicyResult.sources.student);\n\t\t}\n\t\tif (pnpPolicyResult.sources.item) {\n\t\t\tbuilder.addSource(\"item\", pnpPolicyResult.sources.item);\n\t\t}\n\n\t\tfor (const decision of pnpPolicyResult.decisions) {\n\t\t\tbuilder.addDecision({\n\t\t\t\tprecedence: decision.precedence,\n\t\t\t\trule: decision.rule,\n\t\t\t\tfeatureId: decision.featureId,\n\t\t\t\taction: decision.action,\n\t\t\t\tsourceType: decision.sourceType,\n\t\t\t\treason: decision.reason,\n\t\t\t\tvalue: decision.value,\n\t\t\t});\n\t\t}\n\n\t\t// 5a — remove PNP/profile-blocked tools from the candidate set.\n\t\tcandidates = candidates.filter((toolId) => {\n\t\t\treturn !pnpPolicyResult!.blockedToolIds.has(toolId);\n\t\t});\n\t\tfor (const toolId of Array.from(sourcesByTool.keys())) {\n\t\t\tif (pnpPolicyResult.blockedToolIds.has(toolId)) {\n\t\t\t\tsourcesByTool.delete(toolId);\n\t\t\t}\n\t\t}\n\n\t\t// 5b — surface requiredToolBlocked diagnostics ONLY for\n\t\t// PNP/profile-mandated tools that the host removed (i.e., the tool was\n\t\t// NOT in `postHostCandidates`). Mandated tools removed by\n\t\t// profile policy's own higher-precedence rule (e.g. `restrictedTools`\n\t\t// blocking a `requiredTools` mandate) are an internal policy\n\t\t// resolution and must not be reported as a host conflict — the\n\t\t// loser's `block` decision is already in the trail with full\n\t\t// provenance.\n\t\t//\n\t\t// `details` carries `{ rule, hostRule, hostValue }` so consumers\n\t\t// can render the conflict as a single sentence without\n\t\t// re-deriving the host gate from `provenance.features`. See\n\t\t// `RequiredToolBlockedDetails` for the typed shape.\n\t\tfor (const mandatedToolId of pnpPolicyResult.mandatedToolIds) {\n\t\t\tconst removedByHost = !postHostCandidates.has(mandatedToolId);\n\t\t\tif (!removedByHost) continue;\n\t\t\tconst flag = pnpPolicyResult.perToolFlags.get(mandatedToolId);\n\t\t\tconst ruleName = flag?.rule ?? \"required-tool\";\n\t\t\tconst hostGate = detectHostRemovalGate(mandatedToolId, {\n\t\t\t\tplacement,\n\t\t\t\tallowed,\n\t\t\t\tblocked,\n\t\t\t\tproviders: tools.providers,\n\t\t\t});\n\t\t\tconst details: RequiredToolBlockedDetails = {\n\t\t\t\trule: ruleName,\n\t\t\t\thostRule: hostGate.hostRule,\n\t\t\t\thostValue: hostGate.hostValue,\n\t\t\t};\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"tool-policy.requiredToolBlocked\",\n\t\t\t\tlevel: request.level,\n\t\t\t\ttoolId: mandatedToolId,\n\t\t\t\tmessage: `Profile policy mandates \"${mandatedToolId}\" (${ruleName}) but host policy removed it from level \"${request.level}\" via ${hostGate.hostRule}.`,\n\t\t\t\tdetails,\n\t\t\t});\n\t\t\tbuilder.addDecision({\n\t\t\t\tprecedence: 0,\n\t\t\t\trule: \"required-tool-blocked\",\n\t\t\t\tfeatureId: mandatedToolId,\n\t\t\t\taction: \"advisory\",\n\t\t\t\tsourceType: \"host\",\n\t\t\t\treason: `Host removed required tool \"${mandatedToolId}\" via ${hostGate.hostRule}`,\n\t\t\t\tvalue: details,\n\t\t\t});\n\t\t}\n\n\t\t// 5c — attach PNP policy source tags to surviving entries.\n\t\tfor (const toolId of candidates) {\n\t\t\tconst flag = pnpPolicyResult.perToolFlags.get(toolId);\n\t\t\tif (flag) {\n\t\t\t\tconst tags = sourcesByTool.get(toolId) ?? [];\n\t\t\t\ttags.push(`pnp.${flag.rule}` satisfies PolicySourceTag);\n\t\t\t\tsourcesByTool.set(toolId, tags);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Step 6 — Custom PolicySources.\n\tfor (let i = 0; i < customSources.length; i++) {\n\t\tconst source = customSources[i];\n\t\tconst before = candidates.slice();\n\t\tconst result = source.refine({\n\t\t\trequest,\n\t\t\tcandidates: before,\n\t\t});\n\t\tconst refinedSet = new Set(result.refinedCandidates);\n\t\t// Reject any superset additions (custom sources can only narrow).\n\t\tfor (const toolId of result.refinedCandidates) {\n\t\t\tif (!before.includes(toolId)) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"tool-policy.placementMissing\",\n\t\t\t\t\tlevel: request.level,\n\t\t\t\t\ttoolId,\n\t\t\t\t\tmessage: `Custom source \"${source.id}\" tried to add tool \"${toolId}\" that was not in candidates; ignored.`,\n\t\t\t\t\tsource: `custom.${source.id}` satisfies PolicySourceTag,\n\t\t\t\t});\n\t\t\t\trefinedSet.delete(toolId);\n\t\t\t}\n\t\t}\n\t\tcandidates = before.filter((id) => refinedSet.has(id));\n\n\t\t// Index the source's emitted block decisions by featureId so we\n\t\t// can detect \"silent removals\" — tools the source dropped from\n\t\t// the candidate set without logging an explicit block. Without\n\t\t// this auto-log, the provenance trail for a silently-removed\n\t\t// tool would show only the prior `enable` decisions and the\n\t\t// final-state reconciliation would have no evidence to mark it\n\t\t// `blocked` (M8 PR 1 R2 S1 / M1 case B).\n\t\tconst explicitBlocks = new Set<string>();\n\t\tif (result.decisions) {\n\t\t\tfor (const event of result.decisions) {\n\t\t\t\tbuilder.addDecision({\n\t\t\t\t\tprecedence: event.precedence ?? 100 + i,\n\t\t\t\t\trule: event.rule,\n\t\t\t\t\tfeatureId: event.featureId,\n\t\t\t\t\taction: event.action,\n\t\t\t\t\tsourceType: event.sourceType,\n\t\t\t\t\treason: event.reason,\n\t\t\t\t\tvalue: event.value,\n\t\t\t\t});\n\t\t\t\tif (event.action === \"block\") {\n\t\t\t\t\texplicitBlocks.add(event.featureId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Auto-log a `custom-source / block` decision for silent removals.\n\t\tfor (const toolId of before) {\n\t\t\tif (refinedSet.has(toolId)) continue;\n\t\t\tif (explicitBlocks.has(toolId)) continue;\n\t\t\tbuilder.addDecision({\n\t\t\t\tprecedence: 100 + i,\n\t\t\t\trule: \"custom-source\",\n\t\t\t\tfeatureId: toolId,\n\t\t\t\taction: \"block\",\n\t\t\t\tsourceType: \"custom\",\n\t\t\t\treason: `Custom policy source \"${source.id}\" removed tool \"${toolId}\" from candidates without emitting a decision; auto-logged for trail completeness.`,\n\t\t\t\tvalue: { customSourceId: source.id },\n\t\t\t});\n\t\t}\n\n\t\t// Annotate surviving entries with `custom.<id>` so hosts can see\n\t\t// which custom source kept them in.\n\t\tfor (const toolId of candidates) {\n\t\t\tconst tags = sourcesByTool.get(toolId) ?? [\"placement\"];\n\t\t\ttags.push(`custom.${source.id}` satisfies PolicySourceTag);\n\t\t\tsourcesByTool.set(toolId, tags);\n\t\t}\n\t\t// And drop attribution for IDs the source removed.\n\t\tfor (const toolId of before) {\n\t\t\tif (!refinedSet.has(toolId)) {\n\t\t\t\tsourcesByTool.delete(toolId);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst survivingIds = new Set(candidates);\n\tconst visibleTools: ToolPolicyEntry[] = candidates.map((toolId) => {\n\t\tconst flag = pnpPolicyResult?.perToolFlags.get(toolId);\n\t\treturn {\n\t\t\ttoolId,\n\t\t\trequired: flag?.required ?? false,\n\t\t\talwaysAvailable: flag?.alwaysAvailable ?? false,\n\t\t\tsettings: flag?.settings,\n\t\t\tsources: sourcesByTool.get(toolId) ?? [\"placement\"],\n\t\t};\n\t});\n\n\tbuilder.reconcileFinalStates(survivingIds);\n\n\treturn {\n\t\tvisibleTools,\n\t\tdiagnostics,\n\t\tprovenance: builder.build(),\n\t};\n}\n\n/**\n * Identify which step-1-through-4 host gate removed a tool. Used by\n * step 5b to enrich `tool-policy.requiredToolBlocked` diagnostics. The\n * checks mirror the pipeline order — step 1 (placement) first, step 4\n * (blocklist) last — so the FIRST gate that would have matched wins,\n * which is the gate the pipeline actually invoked. Subsequent gates\n * never get to evaluate a tool that an earlier step already removed.\n */\nfunction detectHostRemovalGate(\n\ttoolId: string,\n\targs: {\n\t\tplacement: string[];\n\t\tallowed: string[];\n\t\tblocked: Set<string>;\n\t\tproviders: CanonicalToolsConfig[\"providers\"];\n\t},\n): { hostRule: ToolPolicyHostGate; hostValue: unknown } {\n\tif (!args.placement.includes(toolId)) {\n\t\treturn { hostRule: \"placement-missing\", hostValue: args.placement };\n\t}\n\tif (args.providers?.[toolId]?.enabled === false) {\n\t\treturn { hostRule: \"provider-disabled\", hostValue: false };\n\t}\n\tif (args.allowed.length > 0 && !args.allowed.includes(toolId)) {\n\t\treturn { hostRule: \"host-allowlist\", hostValue: args.allowed };\n\t}\n\tif (args.blocked.has(toolId)) {\n\t\treturn {\n\t\t\thostRule: \"host-blocked\",\n\t\t\thostValue: Array.from(args.blocked),\n\t\t};\n\t}\n\t// Defensive: `removedByHost` is true at the call site (the tool is\n\t// in `mandatedToolIds` but not in `postHostCandidates`), so one of\n\t// the four gates above MUST have fired. If none did, the host\n\t// pipeline has a bug; surface a best-effort rather than throwing.\n\treturn { hostRule: \"placement-missing\", hostValue: args.placement };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-types.js","sourceRoot":"","sources":["../../../src/policy/core/decision-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
1
|
+
{"version":3,"file":"decision-types.js","sourceRoot":"","sources":["../../../src/policy/core/decision-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG","sourcesContent":["/**\n * Tool Policy Engine — decision input/output types.\n *\n * These types describe the *request/response* contract for\n * `ToolPolicyEngine.decide(...)`. The engine itself, plus the\n * composition pipeline that produces the response, lives in sibling\n * modules.\n *\n * See `.cursor/plans/m8-design.md` § 2 for the engine shape, § 3 for\n * the composition rule, and § 4 for the provenance contract.\n */\n\nimport type { ToolPlacementLevel } from \"../../services/tools-config-normalizer.js\";\nimport type { ToolContext, ToolLevel } from \"../../services/tool-context.js\";\nimport type { PolicySourceTag } from \"./policy-source-tag.js\";\nimport type { ToolPolicyProvenance } from \"./provenance.js\";\n\n/**\n * Scope identifier for a `decide(...)` request. The engine uses\n * `level` to pick which placement bucket to read; `scopeId` is opaque\n * to the engine (it is round-tripped into provenance for human-readable\n * trails) and is typically the section-id, item-id, or passage-id of\n * the surface asking the question. `contentKind` mirrors the\n * `ToolbarContext.scope.contentKind` field already in use by\n * `<pie-item-toolbar>` Pass-2 visibility.\n */\nexport interface ToolScope {\n\tlevel: ToolLevel;\n\tscopeId: string;\n\tassessmentId?: string;\n\tsectionId?: string;\n\titemId?: string;\n\tcanonicalItemId?: string;\n\tcontentKind?: string;\n}\n\nexport interface ToolPolicyDecisionRequest {\n\t/**\n\t * Placement bucket the engine reads from\n\t * (`tools.placement[level]`). Stays narrow (`section | item |\n\t * passage`) — broader `ToolLevel` values from `tool-context.ts`\n\t * are surfaced through `scope.level` only.\n\t */\n\tlevel: ToolPlacementLevel;\n\tscope: ToolScope;\n\t/**\n\t * Optional Pass-2 context. The engine itself does NOT call\n\t * `isVisibleInContext(...)`; that gate is intentionally applied\n\t * at the toolbar boundary (Pass-2 = relevance, Pass-1 = the\n\t * engine's job). The context is forwarded to custom\n\t * `PolicySource` instances so they can refine the candidate set\n\t * if they need to.\n\t */\n\tcontext?: ToolContext;\n}\n\n/**\n * Diagnostic codes the engine may emit alongside a decision. The\n * canonical case in M8 is `tool-policy.requiredToolBlocked` — fired\n * when a host policy gate (`policy.blocked`, missing-from-`placement`,\n * provider veto) removed a tool that profile policy `requiredTools` /\n * `district.requiredTools` mandates.\n *\n * `tool-policy.placementMissing` fires when a custom `PolicySource`\n * references a tool ID that is not present in `tools.placement[level]`\n * for the resolved level. The host-side `ToolConfigDiagnostic` channel\n * (already used by `tool-config-validation.ts`) covers config-time\n * misconfiguration; this channel covers per-decision conflicts.\n */\nexport type ToolPolicyDiagnosticCode =\n\t| \"tool-policy.requiredToolBlocked\"\n\t| \"tool-policy.placementMissing\";\n\n/**\n * Which host gate removed a profile-mandated tool. Surfaced inside\n * `ToolPolicyDiagnostic.details` for `tool-policy.requiredToolBlocked`\n * so consumers can render a single human-readable explanation\n * (\"the proctor blocked the calculator that this student's IEP\n * requires\") without re-deriving the host gate from\n * `provenance.features[toolId].allDecisions`.\n *\n * The four values mirror steps 1–4 of `composeDecision`:\n * - `placement-missing` — tool is not in `tools.placement[level]`\n * - `provider-disabled` — `tools.providers[id].enabled === false`\n * - `host-allowlist` — non-empty `tools.policy.allowed` excludes the id\n * - `host-blocked` — `tools.policy.blocked` lists the id\n */\nexport type ToolPolicyHostGate =\n\t| \"placement-missing\"\n\t| \"provider-disabled\"\n\t| \"host-allowlist\"\n\t| \"host-blocked\";\n\n/**\n * Strongly-typed payload for `tool-policy.requiredToolBlocked`\n * diagnostics. The diagnostic's `details` field still types as\n * `Record<string, unknown>` for forward compatibility, but engines\n * always populate this exact shape today and consumers can safely\n * cast.\n */\nexport interface RequiredToolBlockedDetails extends Record<string, unknown> {\n\t/** The profile policy rule that mandated the tool (e.g. `district-requirement`). */\n\trule: string;\n\t/** Which host gate removed the tool. */\n\thostRule: ToolPolicyHostGate;\n\t/** The host configuration value that triggered the gate (best-effort, may be omitted). */\n\thostValue?: unknown;\n}\n\nexport interface ToolPolicyDiagnostic {\n\tcode: ToolPolicyDiagnosticCode;\n\tlevel: ToolPlacementLevel;\n\ttoolId: string;\n\tmessage: string;\n\tsource?: PolicySourceTag;\n\tdetails?: Record<string, unknown>;\n}\n\nexport interface ToolPolicyEntry {\n\ttoolId: string;\n\t/**\n\t * `true` when PNP/profile policy mandates this tool (item or district\n\t * `requiredTools`, or PNP support without prohibition). Advisory\n\t * mandates that the host blocked do *not* surface here — they\n\t * appear in `diagnostics` instead. Hosts that need to know about\n\t * those should listen on the diagnostic channel.\n\t */\n\trequired: boolean;\n\t/**\n\t * `true` for PNP `supports` — UI-level signal that the host\n\t * cannot toggle this tool off in user preferences. Does NOT\n\t * override host blocks (they would have removed the entry\n\t * before this flag is read).\n\t */\n\talwaysAvailable: boolean;\n\t/**\n\t * Tool-specific settings resolved from the assessment / item\n\t * settings via the PNP policy source. Hosts that want to read these\n\t * directly should use `entry.settings` rather than peeking into\n\t * the assessment entity from above the engine.\n\t */\n\tsettings?: unknown;\n\t/**\n\t * Every contributor that helped this entry survive the\n\t * composition pipeline. Always non-empty — at minimum\n\t * `[\"placement\"]` for any entry that came from\n\t * `tools.placement[level]`.\n\t */\n\tsources: PolicySourceTag[];\n}\n\nexport interface ToolPolicyDecision {\n\tvisibleTools: ToolPolicyEntry[];\n\tdiagnostics: ToolPolicyDiagnostic[];\n\tprovenance: ToolPolicyProvenance;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context.js","sourceRoot":"","sources":["../../../src/policy/core/engine-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAkB,MAAM,CAC1D,iCAAiC,CACjC,CAAC"}
|
|
1
|
+
{"version":3,"file":"engine-context.js","sourceRoot":"","sources":["../../../src/policy/core/engine-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAkB,MAAM,CAC1D,iCAAiC,CACjC,CAAC","sourcesContent":["/**\n * Svelte context key for the tool policy engine (M8 PR 1).\n *\n * Components inside an assessment toolkit subtree consume the engine\n * through Svelte's native `getContext(TOOL_POLICY_ENGINE_KEY)`. The\n * canonical provider is the `ToolkitCoordinator` wiring (M8 PR 2):\n * the toolkit CE constructs a `ToolPolicyEngine`, attaches it to the\n * coordinator, and exposes it to descendants via\n * `setContext(TOOL_POLICY_ENGINE_KEY, engine)`.\n *\n * Mirrors the M7 `SECTION_RUNTIME_ENGINE_KEY` pattern. As with the\n * runtime engine, the key is a `Symbol` so it cannot collide with\n * userland context keys and so descendants are forced to import this\n * module rather than guess a string id.\n *\n * **No cross-CE bridge.** Unlike the runtime engine, there is no\n * `connectToolPolicyEngineHostContext` helper — see M8 design Q8.\n * Every CE in the tree gets its engine from its own coordinator\n * (the toolkit element). This avoids subscription-bridge overhead\n * for a function-style engine that hosts can simply re-call after\n * an input swap.\n *\n * **Stability.** This export is part of the stable `policy/engine`\n * surface; renaming or replacing the symbol is a major breaking\n * change.\n */\n\nimport type { ToolPolicyEngine } from \"./ToolPolicyEngine.js\";\n\nexport const TOOL_POLICY_ENGINE_KEY: unique symbol = Symbol(\n\t\"@pie-players/tool-policy-engine\",\n);\n\nexport type ToolPolicyEngineContext = ToolPolicyEngine;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnp-policy-inputs.js","sourceRoot":"","sources":["../../../src/policy/core/pnp-policy-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAC3C,UAA+C;IAE/C,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9B,MAAM,GAAG,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAC5C,IAAI,GAAG,EAAE,CAAC;QACT,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACxE,IACC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;YACrC,GAAG,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAChC,CAAC;YACF,OAAO,IAAI,CAAC;QACb,CAAC;QACD,IACC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;YACjC,GAAG,CA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ACD,IACC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;QACvC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAClC,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IACC,QAAQ,CAAC,cAAc;QACvB,OAAO,QAAQ,CAAC,cAAc,KAAK,QAAQ;QAC3C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,MAAM,GAAG,CAAC,EAC9C,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAG5C;IACA,IAAI,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/D,IAAI,yBAAyB,CAAC,IAAI,CAAC,cAAc,CAAC;QAAE,OAAO,IAAI,CAAC;IAChE,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/**\n * PNP/profile policy input detection (M8 PR 4 — see `.cursor/plans/m8-design.md` F2 and\n * `.cursor/plans/m8-implementation-plan.md` § PR 4).\n *\n * Pure helpers that decide whether the inputs the engine has been given\n * actually carry PNP/profile policy material. Used by:\n *\n * - {@link ToolPolicyEngine}'s constructor as the auto-default for\n * `pnpEnforcement` when the host did not pass an explicit `\"on\"` /\n * `\"off\"`.\n * - {@link ToolkitCoordinator.resolveEffectivePnpEnforcement} as the\n * auto-mode rule. PR 2 used a coarse \"any non-null assessment → on\"\n * placeholder; PR 4 narrows it to \"assessment OR currentItemRef\n * carries profile policy material.\"\n *\n * The rule is intentionally narrow. Hosts that bind a bare assessment\n * record (only `id` / `name`, no PNP and no settings) get the legacy\n * floating-tools behavior — PNP/profile gates do not engage. The flip happens\n * the moment the assessment carries any of:\n *\n * - `personalNeedsProfile` (any `supports`, `prohibitedSupports`, or\n * `activateAtInit`),\n * - `settings.districtPolicy` (any `blockedTools`, `requiredTools`,\n * or `policies`),\n * - `settings.testAdministration` (any populated key — `mode`,\n * `toolOverrides`, etc.),\n * - or the bound `currentItemRef.settings` carries\n * `requiredTools` / `restrictedTools` / `toolParameters`.\n *\n * Hosts opt out of the auto-on behavior by passing\n * `pnpEnforcement: \"off\"` explicitly (engine input or\n * `ToolkitCoordinator.setPnpEnforcement(\"off\")`).\n */\n\nimport type {\n\tAssessmentEntity,\n\tAssessmentItemRef,\n} from \"@pie-players/pie-players-shared/types\";\n\n/**\n * Return `true` when the assessment carries any PNP/profile policy\n * material that the engine's `PnpPolicySource` would consume.\n *\n * The check is structural — the presence of a non-empty PNP, district\n * policy, or test administration block is enough; the content does not\n * have to validate against any specific rule.\n */\nexport function assessmentHasPnpPolicyInputs(\n\tassessment: AssessmentEntity | null | undefined,\n): boolean {\n\tif (!assessment) return false;\n\tconst pnp = assessment.personalNeedsProfile;\n\tif (pnp) {\n\t\tif (Array.isArray(pnp.supports) && pnp.supports.length > 0) return true;\n\t\tif (\n\t\t\tArray.isArray(pnp.prohibitedSupports) &&\n\t\t\tpnp.prohibitedSupports.length > 0\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\tif (\n\t\t\tArray.isArray(pnp.activateAtInit) &&\n\t\t\tpnp.activateAtInit.length > 0\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\tconst settings = assessment.settings;\n\tif (settings) {\n\t\tconst district = settings.districtPolicy;\n\t\tif (district) {\n\t\t\tif (\n\t\t\t\tArray.isArray(district.blockedTools) &&\n\t\t\t\tdistrict.blockedTools.length > 0\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tArray.isArray(district.requiredTools) &&\n\t\t\t\tdistrict.requiredTools.length > 0\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tdistrict.policies &&\n\t\t\t\ttypeof district.policies === \"object\" &&\n\t\t\t\tObject.keys(district.policies).length > 0\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tconst admin = settings.testAdministration;\n\t\tif (admin && typeof admin === \"object\") {\n\t\t\tfor (const key of Object.keys(admin)) {\n\t\t\t\tconst value = (admin as Record<string, unknown>)[key];\n\t\t\t\tif (value === undefined || value === null) continue;\n\t\t\t\tif (Array.isArray(value) && value.length === 0) continue;\n\t\t\t\tif (\n\t\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t\t!Array.isArray(value) &&\n\t\t\t\t\tObject.keys(value as Record<string, unknown>).length === 0\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Return `true` when the bound item reference carries item-level profile policy\n * material (`requiredTools`, `restrictedTools`, or `toolParameters`).\n *\n * Used in addition to {@link assessmentHasPnpPolicyInputs} so a host that\n * navigates to an item with profile-relevant settings — without a parent\n * assessment carrying its own PNP/district/test-admin block — still\n * gets PNP/profile gates engaged for that item.\n */\nexport function itemRefHasPnpPolicyInputs(\n\titemRef: AssessmentItemRef | null | undefined,\n): boolean {\n\tconst settings = itemRef?.settings;\n\tif (!settings) return false;\n\tif (\n\t\tArray.isArray(settings.requiredTools) &&\n\t\tsettings.requiredTools.length > 0\n\t) {\n\t\treturn true;\n\t}\n\tif (\n\t\tArray.isArray(settings.restrictedTools) &&\n\t\tsettings.restrictedTools.length > 0\n\t) {\n\t\treturn true;\n\t}\n\tif (\n\t\tsettings.toolParameters &&\n\t\ttypeof settings.toolParameters === \"object\" &&\n\t\tObject.keys(settings.toolParameters).length > 0\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Resolve the default `pnpEnforcement` mode given the bound inputs.\n *\n * Returns `\"on\"` when {@link assessmentHasPnpPolicyInputs} or\n * {@link itemRefHasPnpPolicyInputs} reports any profile policy material; otherwise\n * `\"off\"`. Hosts override the default by passing an explicit\n * `pnpEnforcement` value (engine input) or by calling\n * `ToolkitCoordinator.setPnpEnforcement(\"on\" | \"off\")`.\n */\nexport function resolveDefaultPnpEnforcement(args: {\n\tassessment?: AssessmentEntity | null;\n\tcurrentItemRef?: AssessmentItemRef | null;\n}): \"on\" | \"off\" {\n\tif (assessmentHasPnpPolicyInputs(args.assessment)) return \"on\";\n\tif (itemRefHasPnpPolicyInputs(args.currentItemRef)) return \"on\";\n\treturn \"off\";\n}\n"]}
|
|
@@ -29,4 +29,3 @@ export type PnpPolicySourceRule = "district-block" | "test-admin-override" | "it
|
|
|
29
29
|
export type PnpPolicySourceTag = `pnp.${PnpPolicySourceRule}`;
|
|
30
30
|
export type CustomPolicySourceTag = `custom.${string}`;
|
|
31
31
|
export type PolicySourceTag = "placement" | "policy" | "provider" | PnpPolicySourceTag | CustomPolicySourceTag;
|
|
32
|
-
//# sourceMappingURL=policy-source-tag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-source-tag.js","sourceRoot":"","sources":["../../../src/policy/core/policy-source-tag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}
|
|
1
|
+
{"version":3,"file":"policy-source-tag.js","sourceRoot":"","sources":["../../../src/policy/core/policy-source-tag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG","sourcesContent":["/**\n * Policy source tag — attribution for `ToolPolicyEntry.sources`.\n *\n * The engine attaches a `PolicySourceTag` to every `ToolPolicyEntry` it\n * emits, capturing every step from `compose-decision.ts` that contributed\n * to the entry being kept (or, in the case of `required-tool-blocked`,\n * the step that surfaced the conflict).\n *\n * Tag vocabulary maps onto the six composition steps in\n * `m8-design.md` § 3:\n *\n * 1. Membership filter → `\"placement\"`\n * 2. Provider veto → `\"provider\"` (negative; only present when\n * the entry survived a\n * non-`enabled: false` check)\n * 3. Host whitelist → `\"policy\"`\n * 4. Host blocklist → `\"policy\"` (negative)\n * 5. PNP/profile gates → `\"pnp.${rule}\"` (e.g. `\"pnp.pnp-support\"`,\n * `\"pnp.item-requirement\"`)\n * 6. Custom PolicySources → `\"custom.${source.id}\"`\n *\n * Negative tags do not appear on surviving entries — they are reflected\n * only in `ToolPolicyProvenance` decisions. The tag union therefore\n * tracks contributors that *kept* a tool, not contributors that\n * *removed* one. Diagnostic surfacing of removals is the\n * provenance/diagnostic channel's job.\n */\n\nexport type PnpPolicySourceRule =\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\nexport type PnpPolicySourceTag = `pnp.${PnpPolicySourceRule}`;\n\nexport type CustomPolicySourceTag = `custom.${string}`;\n\nexport type PolicySourceTag =\n\t| \"placement\"\n\t| \"policy\"\n\t| \"provider\"\n\t| PnpPolicySourceTag\n\t| CustomPolicySourceTag;\n"]}
|
|
@@ -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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CAAC,IAAI;QACxB,CAAC,CAAC,MAAM,KAAK,MAAM;QACnB,CAAC,CAAC,MAAM,KAAK,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 — generalization of `PnpResolutionProvenance`\n * (M8 — see `.cursor/plans/m8-design.md` § 4).\n *\n * Today's `PnpResolutionProvenance` (in `services/pnp-provenance.ts`)\n * tracks decisions made by `PnpToolResolver` only. M8 generalizes the\n * shape to track decisions from every Pass-1 contributor — host\n * placement, host policy, provider veto, PNP/profile gates, and custom policy\n * sources — without losing PNP debugger compatibility.\n *\n * **Compatibility posture.** This module is the new home of the shape;\n * the legacy `pnp-provenance.ts` module remains untouched in PR 1 and\n * is deleted in PR 5 (the rip-out PR) once every consumer has migrated\n * to the engine. The shape stays structurally compatible: existing\n * fields (`contextId`, `resolvedAt`, `sources`, `features`,\n * `decisionLog`, `summary`) are preserved verbatim. The rule\n * vocabulary expands, and `ResolutionDecision.precedence` widens from\n * `1 | 2 | 3 | 4 | 5 | 6` to a `number` so non-profile rules can fit\n * (the PNP/profile rules continue to use `1`–`6` exactly as before).\n */\n\n/**\n * Expanded rule vocabulary for `ResolutionDecision.rule` in M8.\n *\n * The first six values map 1:1 onto `PnpResolutionProvenance`'s\n * existing rule names (the PNP/profile precedence ladder). The remaining\n * values capture the new contributors the M8 engine surfaces:\n * placement membership (step 1), provider veto (step 2), host policy\n * (steps 3 / 4), the required-tool conflict diagnostic (`required-tool-blocked`),\n * custom sources (step 6), and the catch-all `system-default` for the\n * \"not configured at any level\" fallback.\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` exactly as in today's\n\t * `PnpResolutionProvenance`. Non-profile rules use `0` (host-side\n\t * gates that always fire before PNP/profile policy) or `7+` (custom sources that\n\t * fire 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 mirroring `PnpProvenanceBuilder` but emitting the expanded\n * `ToolPolicyProvenance` shape. Identical API where the field names\n * overlap so an `M8 PR 5` rename of the legacy builder is a near-pure\n * import-path swap.\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PnpPolicySource.js","sourceRoot":"","sources":["../../../src/policy/sources/PnpPolicySource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAoGH,MAAM,OAAO,eAAe;IAClB,EAAE,GAAG,KAAK,CAAC;IACH,YAAY,CAAe;IAE5C,YAAY,YAA0B;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,IAAwB;QAC7B,MAAM,EAAE,UAAU,EA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MAAM;YACd,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,YAAY,SAAS,+BAA+B;YAC5D,KAAK,EAAE,EAAE,SAAS,EAAE;SACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;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;;;;;;;;;;;;;OAaG;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 — refactor of `PnpToolResolver` 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 used by today's\n * `PnpToolResolver` but exposes them 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 * **Why this lives next to the legacy resolver instead of replacing\n * it.** PR 1 introduces the engine without callers; the legacy\n * `PnpToolResolver` is still in active use by `<pie-item-toolbar>`\n * and by external tests. PR 5 deletes the legacy class once the\n * toolbar (PR 3) and the PNP default flip (PR 4) have landed and the\n * caller list is empty. Until then this source is the *canonical*\n * implementation and the legacy class is the deprecated mirror.\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 * The legacy `PnpToolResolver.resolveTool` had the same behavior;\n\t * see `tests/policy/PnpPolicySource.test.ts` for the regression\n\t * lock.\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) rather than the legacy resolver's\n\t * `||`. 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.\" This is a deliberate behavior delta from the legacy\n\t * `PnpToolResolver` (M8 PR 1).\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"]}
|