@pie-players/pie-assessment-toolkit 0.3.30 → 0.3.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +289 -5
  2. package/dist/components/ItemToolBar.custom-element.js +165 -92
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +604 -107
  4. package/dist/components/SectionToolBar.custom-element.js +0 -36
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/policy/core/PolicySource.d.ts +64 -0
  9. package/dist/policy/core/PolicySource.d.ts.map +1 -0
  10. package/dist/policy/core/PolicySource.js +17 -0
  11. package/dist/policy/core/PolicySource.js.map +1 -0
  12. package/dist/policy/core/ToolPolicyEngine.d.ts +123 -0
  13. package/dist/policy/core/ToolPolicyEngine.d.ts.map +1 -0
  14. package/dist/policy/core/ToolPolicyEngine.js +217 -0
  15. package/dist/policy/core/ToolPolicyEngine.js.map +1 -0
  16. package/dist/policy/core/compose-decision.d.ts +37 -0
  17. package/dist/policy/core/compose-decision.d.ts.map +1 -0
  18. package/dist/policy/core/compose-decision.js +332 -0
  19. package/dist/policy/core/compose-decision.js.map +1 -0
  20. package/dist/policy/core/decision-types.d.ts +142 -0
  21. package/dist/policy/core/decision-types.d.ts.map +1 -0
  22. package/dist/policy/core/decision-types.js +13 -0
  23. package/dist/policy/core/decision-types.js.map +1 -0
  24. package/dist/policy/core/engine-context.d.ts +30 -0
  25. package/dist/policy/core/engine-context.d.ts.map +1 -0
  26. package/dist/policy/core/engine-context.js +28 -0
  27. package/dist/policy/core/engine-context.js.map +1 -0
  28. package/dist/policy/core/policy-source-tag.d.ts +32 -0
  29. package/dist/policy/core/policy-source-tag.d.ts.map +1 -0
  30. package/dist/policy/core/policy-source-tag.js +29 -0
  31. package/dist/policy/core/policy-source-tag.js.map +1 -0
  32. package/dist/policy/core/provenance.d.ts +163 -0
  33. package/dist/policy/core/provenance.d.ts.map +1 -0
  34. package/dist/policy/core/provenance.js +232 -0
  35. package/dist/policy/core/provenance.js.map +1 -0
  36. package/dist/policy/core/qti-inputs.d.ts +67 -0
  37. package/dist/policy/core/qti-inputs.d.ts.map +1 -0
  38. package/dist/policy/core/qti-inputs.js +139 -0
  39. package/dist/policy/core/qti-inputs.js.map +1 -0
  40. package/dist/policy/engine.d.ts +28 -0
  41. package/dist/policy/engine.d.ts.map +1 -0
  42. package/dist/policy/engine.js +24 -0
  43. package/dist/policy/engine.js.map +1 -0
  44. package/dist/policy/internal.d.ts +26 -0
  45. package/dist/policy/internal.d.ts.map +1 -0
  46. package/dist/policy/internal.js +26 -0
  47. package/dist/policy/internal.js.map +1 -0
  48. package/dist/policy/sources/QtiPolicySource.d.ts +146 -0
  49. package/dist/policy/sources/QtiPolicySource.d.ts.map +1 -0
  50. package/dist/policy/sources/QtiPolicySource.js +270 -0
  51. package/dist/policy/sources/QtiPolicySource.js.map +1 -0
  52. package/dist/runtime/SectionRuntimeEngine.d.ts +145 -0
  53. package/dist/runtime/SectionRuntimeEngine.d.ts.map +1 -1
  54. package/dist/runtime/SectionRuntimeEngine.js +164 -3
  55. package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
  56. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +144 -0
  57. package/dist/runtime/adapter/SectionEngineAdapter.d.ts.map +1 -0
  58. package/dist/runtime/adapter/SectionEngineAdapter.js +183 -0
  59. package/dist/runtime/adapter/SectionEngineAdapter.js.map +1 -0
  60. package/dist/runtime/adapter/coordinator-bridge.d.ts +93 -0
  61. package/dist/runtime/adapter/coordinator-bridge.d.ts.map +1 -0
  62. package/dist/runtime/adapter/coordinator-bridge.js +127 -0
  63. package/dist/runtime/adapter/coordinator-bridge.js.map +1 -0
  64. package/dist/runtime/adapter/dom-event-bridge.d.ts +63 -0
  65. package/dist/runtime/adapter/dom-event-bridge.d.ts.map +1 -0
  66. package/dist/runtime/adapter/dom-event-bridge.js +95 -0
  67. package/dist/runtime/adapter/dom-event-bridge.js.map +1 -0
  68. package/dist/runtime/adapter/framework-error-bridge.d.ts +37 -0
  69. package/dist/runtime/adapter/framework-error-bridge.d.ts.map +1 -0
  70. package/dist/runtime/adapter/framework-error-bridge.js +47 -0
  71. package/dist/runtime/adapter/framework-error-bridge.js.map +1 -0
  72. package/dist/runtime/adapter/instrumentation-bridge.d.ts +32 -0
  73. package/dist/runtime/adapter/instrumentation-bridge.d.ts.map +1 -0
  74. package/dist/runtime/adapter/instrumentation-bridge.js +39 -0
  75. package/dist/runtime/adapter/instrumentation-bridge.js.map +1 -0
  76. package/dist/runtime/adapter/subscriber-fanout.d.ts +35 -0
  77. package/dist/runtime/adapter/subscriber-fanout.d.ts.map +1 -0
  78. package/dist/runtime/adapter/subscriber-fanout.js +60 -0
  79. package/dist/runtime/adapter/subscriber-fanout.js.map +1 -0
  80. package/dist/runtime/core/SectionEngineCore.d.ts +52 -0
  81. package/dist/runtime/core/SectionEngineCore.d.ts.map +1 -0
  82. package/dist/runtime/core/SectionEngineCore.js +81 -0
  83. package/dist/runtime/core/SectionEngineCore.js.map +1 -0
  84. package/dist/runtime/core/cohort.d.ts +40 -0
  85. package/dist/runtime/core/cohort.d.ts.map +1 -0
  86. package/dist/runtime/core/cohort.js +49 -0
  87. package/dist/runtime/core/cohort.js.map +1 -0
  88. package/dist/runtime/core/engine-input.d.ts +114 -0
  89. package/dist/runtime/core/engine-input.d.ts.map +1 -0
  90. package/dist/runtime/core/engine-input.js +19 -0
  91. package/dist/runtime/core/engine-input.js.map +1 -0
  92. package/dist/runtime/core/engine-output.d.ts +62 -0
  93. package/dist/runtime/core/engine-output.d.ts.map +1 -0
  94. package/dist/runtime/core/engine-output.js +27 -0
  95. package/dist/runtime/core/engine-output.js.map +1 -0
  96. package/dist/runtime/core/engine-readiness.d.ts +49 -0
  97. package/dist/runtime/core/engine-readiness.d.ts.map +1 -0
  98. package/dist/runtime/core/engine-readiness.js +47 -0
  99. package/dist/runtime/core/engine-readiness.js.map +1 -0
  100. package/dist/runtime/core/engine-resolver.d.ts +172 -0
  101. package/dist/runtime/core/engine-resolver.d.ts.map +1 -0
  102. package/dist/runtime/core/engine-resolver.js +170 -0
  103. package/dist/runtime/core/engine-resolver.js.map +1 -0
  104. package/dist/runtime/core/engine-stage-derivation.d.ts +19 -0
  105. package/dist/runtime/core/engine-stage-derivation.d.ts.map +1 -0
  106. package/dist/runtime/core/engine-stage-derivation.js +30 -0
  107. package/dist/runtime/core/engine-stage-derivation.js.map +1 -0
  108. package/dist/runtime/core/engine-state.d.ts +83 -0
  109. package/dist/runtime/core/engine-state.d.ts.map +1 -0
  110. package/dist/runtime/core/engine-state.js +49 -0
  111. package/dist/runtime/core/engine-state.js.map +1 -0
  112. package/dist/runtime/core/engine-transition.d.ts +49 -0
  113. package/dist/runtime/core/engine-transition.d.ts.map +1 -0
  114. package/dist/runtime/core/engine-transition.js +261 -0
  115. package/dist/runtime/core/engine-transition.js.map +1 -0
  116. package/dist/runtime/engine-context.d.ts +40 -0
  117. package/dist/runtime/engine-context.d.ts.map +1 -0
  118. package/dist/runtime/engine-context.js +32 -0
  119. package/dist/runtime/engine-context.js.map +1 -0
  120. package/dist/runtime/engine.d.ts +24 -0
  121. package/dist/runtime/engine.d.ts.map +1 -0
  122. package/dist/runtime/engine.js +24 -0
  123. package/dist/runtime/engine.js.map +1 -0
  124. package/dist/runtime/internal.d.ts +44 -0
  125. package/dist/runtime/internal.d.ts.map +1 -0
  126. package/dist/runtime/internal.js +46 -0
  127. package/dist/runtime/internal.js.map +1 -0
  128. package/dist/runtime/runtime-id.d.ts +8 -0
  129. package/dist/runtime/runtime-id.d.ts.map +1 -0
  130. package/dist/runtime/runtime-id.js +10 -0
  131. package/dist/runtime/runtime-id.js.map +1 -0
  132. package/dist/runtime/section-runtime-engine-host-context.d.ts +74 -0
  133. package/dist/runtime/section-runtime-engine-host-context.d.ts.map +1 -0
  134. package/dist/runtime/section-runtime-engine-host-context.js +96 -0
  135. package/dist/runtime/section-runtime-engine-host-context.js.map +1 -0
  136. package/dist/runtime/stage-emit-gate.d.ts +93 -0
  137. package/dist/runtime/stage-emit-gate.d.ts.map +1 -0
  138. package/dist/runtime/stage-emit-gate.js +83 -0
  139. package/dist/runtime/stage-emit-gate.js.map +1 -0
  140. package/dist/services/ToolkitCoordinator.d.ts +280 -7
  141. package/dist/services/ToolkitCoordinator.d.ts.map +1 -1
  142. package/dist/services/ToolkitCoordinator.js +412 -32
  143. package/dist/services/ToolkitCoordinator.js.map +1 -1
  144. package/dist/services/framework-error-bus.d.ts +73 -0
  145. package/dist/services/framework-error-bus.d.ts.map +1 -0
  146. package/dist/services/framework-error-bus.js +68 -0
  147. package/dist/services/framework-error-bus.js.map +1 -0
  148. package/dist/services/framework-error.d.ts +36 -1
  149. package/dist/services/framework-error.d.ts.map +1 -1
  150. package/dist/services/framework-error.js +37 -0
  151. package/dist/services/framework-error.js.map +1 -1
  152. package/dist/services/interfaces.d.ts +78 -0
  153. package/dist/services/interfaces.d.ts.map +1 -1
  154. package/dist/services/interfaces.js.map +1 -1
  155. package/dist/services/section-controller-types.d.ts +20 -0
  156. package/dist/services/section-controller-types.d.ts.map +1 -1
  157. package/dist/services/tools-config-normalizer.d.ts +23 -0
  158. package/dist/services/tools-config-normalizer.d.ts.map +1 -1
  159. package/dist/services/tools-config-normalizer.js +13 -1
  160. package/dist/services/tools-config-normalizer.js.map +1 -1
  161. package/dist/tools/client.d.ts +0 -1
  162. package/dist/tools/client.d.ts.map +1 -1
  163. package/dist/tools/client.js +0 -2
  164. package/dist/tools/client.js.map +1 -1
  165. package/dist/tools/types.d.ts +0 -26
  166. package/dist/tools/types.d.ts.map +1 -1
  167. package/package.json +23 -7
  168. package/dist/runtime/runtime-event-guards.d.ts +0 -2
  169. package/dist/runtime/runtime-event-guards.d.ts.map +0 -1
  170. package/dist/runtime/runtime-event-guards.js +0 -4
  171. package/dist/runtime/runtime-event-guards.js.map +0 -1
  172. package/dist/tools/tool-coordinator.d.ts +0 -72
  173. package/dist/tools/tool-coordinator.d.ts.map +0 -1
  174. package/dist/tools/tool-coordinator.js +0 -194
  175. package/dist/tools/tool-coordinator.js.map +0 -1
  176. package/dist/types/events.d.ts +0 -157
  177. package/dist/types/events.d.ts.map +0 -1
  178. package/dist/types/events.js +0 -11
  179. package/dist/types/events.js.map +0 -1
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Tool policy engine — facade entry point (M8 PR 1).
3
+ *
4
+ * Narrow, stable public surface for hosts that want to instantiate or
5
+ * consume a `ToolPolicyEngine`. Re-exports the engine class, its
6
+ * decision request/response types, the Svelte context key, and the
7
+ * minimal `PolicySource` extension contract.
8
+ *
9
+ * **Pairing.** This module is the stable counterpart to
10
+ * `./policy/internal`, which exposes the wider, evolving surface
11
+ * (composition pipeline, provenance builder, QTI source). Consumers
12
+ * that only need to drive an engine and read its decisions should
13
+ * import from here. Consumers that need to reach past the facade
14
+ * (e.g. test the composition pipeline directly, build a custom QTI
15
+ * source variant, instrument provenance generation) should import
16
+ * from `./policy/internal` and accept the documented stability
17
+ * disclaimer there.
18
+ *
19
+ * Mirrors the M7 `runtime/engine` / `runtime/internal` split — see
20
+ * the same rationale in `src/runtime/engine.ts`.
21
+ */
22
+ export { ToolPolicyEngine, } from "./core/ToolPolicyEngine.js";
23
+ export { TOOL_POLICY_ENGINE_KEY, } from "./core/engine-context.js";
24
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +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"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Tool policy engine — **internal** entry point (M8 PR 1).
3
+ *
4
+ * Re-exports the composition pipeline, the QTI source, and the
5
+ * provenance builder for advanced hosts that want to drive the engine
6
+ * components directly, and for the engine's own tests.
7
+ *
8
+ * **Stability posture.** This module is **not** part of the stable
9
+ * public API. Symbols here are subject to change between minor
10
+ * versions with only a changeset note. Hosts that need long-term
11
+ * stability should depend on the facade (`ToolPolicyEngine` exported
12
+ * from `./policy/engine`) instead.
13
+ *
14
+ * The split is intentional:
15
+ * - `./policy/engine` — narrow, stable facade for common host
16
+ * wiring and Svelte context.
17
+ * - `./policy/internal` — wide, evolving surface for the
18
+ * composition pipeline, QTI source, and
19
+ * any host that wants to reach past the
20
+ * facade.
21
+ */
22
+ export { composeDecision, type ComposeDecisionInputs, } from "./core/compose-decision.js";
23
+ export { QtiPolicySource, type QtiPolicyApplyArgs, type QtiPolicyDecisionEvent, type QtiPolicyResult, type QtiToolFlags, } from "./sources/QtiPolicySource.js";
24
+ export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
25
+ export { assessmentHasQtiInputs, itemRefHasQtiInputs, resolveDefaultQtiEnforcement, } from "./core/qti-inputs.js";
26
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/policy/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,eAAe,EACf,KAAK,qBAAqB,GAC1B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,YAAY,GACjB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,GAC5B,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Tool policy engine — **internal** entry point (M8 PR 1).
3
+ *
4
+ * Re-exports the composition pipeline, the QTI source, and the
5
+ * provenance builder for advanced hosts that want to drive the engine
6
+ * components directly, and for the engine's own tests.
7
+ *
8
+ * **Stability posture.** This module is **not** part of the stable
9
+ * public API. Symbols here are subject to change between minor
10
+ * versions with only a changeset note. Hosts that need long-term
11
+ * stability should depend on the facade (`ToolPolicyEngine` exported
12
+ * from `./policy/engine`) instead.
13
+ *
14
+ * The split is intentional:
15
+ * - `./policy/engine` — narrow, stable facade for common host
16
+ * wiring and Svelte context.
17
+ * - `./policy/internal` — wide, evolving surface for the
18
+ * composition pipeline, QTI source, and
19
+ * any host that wants to reach past the
20
+ * facade.
21
+ */
22
+ export { composeDecision, } from "./core/compose-decision.js";
23
+ export { QtiPolicySource, } from "./sources/QtiPolicySource.js";
24
+ export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
25
+ export { assessmentHasQtiInputs, itemRefHasQtiInputs, resolveDefaultQtiEnforcement, } from "./core/qti-inputs.js";
26
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +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,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,GAC5B,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * QTI Policy Source — refactor of `PnpToolResolver` for the M8 engine
3
+ * (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5 §).
4
+ *
5
+ * This source applies the QTI 6-level precedence rules used by today's
6
+ * `PnpToolResolver` but exposes them as a `(candidates, qtiInputs) →
7
+ * (refinedCandidates, perToolFlags, mandates, decisions)` function the
8
+ * engine can call once per `decide(...)` request, with all results
9
+ * routed through the unified `ToolPolicyProvenanceBuilder`.
10
+ *
11
+ * **Why this lives next to the legacy resolver instead of replacing
12
+ * it.** PR 1 introduces the engine without callers; the legacy
13
+ * `PnpToolResolver` is still in active use by `<pie-item-toolbar>`
14
+ * and by external tests. PR 5 deletes the legacy class once the
15
+ * toolbar (PR 3) and the QTI default flip (PR 4) have landed and the
16
+ * caller list is empty. Until then this source is the *canonical*
17
+ * implementation and the legacy class is the deprecated mirror.
18
+ */
19
+ import type { AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-players-shared/types";
20
+ import type { ToolRegistry } from "../../services/ToolRegistry.js";
21
+ import type { ToolPolicyResolutionDecision, ToolPolicySourceType } from "../core/provenance.js";
22
+ import type { QtiPolicySourceRule } from "../core/policy-source-tag.js";
23
+ /** Per-tool flags QTI may attach to a surviving entry. */
24
+ export interface QtiToolFlags {
25
+ /** QTI mandates this tool (item or district `requiredTools`). */
26
+ required: boolean;
27
+ /** QTI marks this tool as a PNP support (host UI cannot toggle off). */
28
+ alwaysAvailable: boolean;
29
+ /** Tool-specific settings derived from item / assessment settings. */
30
+ settings?: unknown;
31
+ /** Which QTI rule contributed the surviving verdict. */
32
+ rule: QtiPolicySourceRule;
33
+ /** Source attribution for `ToolPolicyEntry.sources`. */
34
+ sourceType: ToolPolicySourceType;
35
+ }
36
+ export interface QtiPolicyApplyArgs {
37
+ assessment: AssessmentEntity;
38
+ currentItemRef?: AssessmentItemRef;
39
+ }
40
+ /**
41
+ * Provenance event the engine should append to its builder. Pre-baked
42
+ * here so the source has a single allocation pattern and the engine
43
+ * keeps a uniform `addDecision(...)` shape.
44
+ */
45
+ export interface QtiPolicyDecisionEvent {
46
+ precedence: 1 | 2 | 3 | 4 | 5 | 6;
47
+ rule: "district-block" | "test-admin-override" | "item-restriction" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-prohibited";
48
+ featureId: string;
49
+ action: ToolPolicyResolutionDecision["action"];
50
+ sourceType: ToolPolicySourceType;
51
+ reason: string;
52
+ value?: unknown;
53
+ }
54
+ export interface QtiPolicyResult {
55
+ /**
56
+ * Tool IDs QTI explicitly blocked. Engine removes these from the
57
+ * candidate set in step 5.
58
+ */
59
+ blockedToolIds: Set<string>;
60
+ /**
61
+ * Tool IDs QTI mandates (item or district `requiredTools`). Used
62
+ * by the engine to detect `tool-policy.qtiRequiredBlocked`
63
+ * diagnostics for tools removed by host policy.
64
+ */
65
+ mandatedToolIds: Set<string>;
66
+ /**
67
+ * Per-tool flags merged into surviving `ToolPolicyEntry`s.
68
+ */
69
+ perToolFlags: Map<string, QtiToolFlags>;
70
+ /**
71
+ * Decision log entries the engine must record. Order matches the
72
+ * order rules fired internally (highest precedence first per
73
+ * support id).
74
+ */
75
+ decisions: QtiPolicyDecisionEvent[];
76
+ /** Configuration sources the engine should attach to its provenance. */
77
+ sources: {
78
+ assessment?: {
79
+ id: string;
80
+ name: string;
81
+ config?: unknown;
82
+ };
83
+ student?: {
84
+ id: string;
85
+ name: string;
86
+ config?: unknown;
87
+ };
88
+ item?: {
89
+ id: string;
90
+ name: string;
91
+ config?: unknown;
92
+ };
93
+ };
94
+ }
95
+ export declare class QtiPolicySource {
96
+ readonly id = "qti";
97
+ private readonly toolRegistry;
98
+ constructor(toolRegistry: ToolRegistry);
99
+ apply(args: QtiPolicyApplyArgs): QtiPolicyResult;
100
+ private resolveSupport;
101
+ /**
102
+ * Map a QTI / PNP support id (e.g. `"calculator-basic"`) to the
103
+ * registered tool id that owns it.
104
+ *
105
+ * Resolution rules:
106
+ *
107
+ * 1. **Multiple tools register the same support id:** the
108
+ * *first-registered* tool wins. `ToolRegistry.getToolsByPNPSupport`
109
+ * returns a `Set<string>` whose iteration order matches the
110
+ * `register(...)` insertion order, so the result is
111
+ * deterministic across runs but order-sensitive at registration
112
+ * time. This is an unusual configuration — the typical case is
113
+ * one tool per support id — but it is reachable when an
114
+ * integrator overrides a default tool with a replacement that
115
+ * claims the same `pnpSupportIds`. In that case the integrator
116
+ * should `unregister(...)` the default before registering the
117
+ * replacement.
118
+ *
119
+ * 2. **No tool registers the support id:** the support id is
120
+ * returned verbatim as the `featureId` for provenance trails
121
+ * and `ToolPolicyEntry.toolId`. This lets hosts use raw QTI
122
+ * strings for tools the registry does not (yet) carry without
123
+ * losing them in policy evaluation.
124
+ *
125
+ * The legacy `PnpToolResolver.resolveTool` had the same behavior;
126
+ * see `tests/policy/QtiPolicySource.test.ts` for the regression
127
+ * lock.
128
+ */
129
+ private mapSupportToToolId;
130
+ /**
131
+ * Resolve tool-specific settings, item-level taking precedence over
132
+ * assessment-level.
133
+ *
134
+ * Uses `??` (nullish-coalescing) rather than the legacy resolver's
135
+ * `||`. Tool config values are typed `unknown` and may legitimately
136
+ * be `false` / `0` / `""` (e.g. a tool whose canonical "off" config
137
+ * is the literal `false`). `||` would treat those as missing and
138
+ * silently fall through to the assessment-level config, masking the
139
+ * authored item-level intent. `??` only falls through on
140
+ * `null`/`undefined`, which matches the semantic of "value not
141
+ * provided." This is a deliberate behavior delta from the legacy
142
+ * `PnpToolResolver` (M8 PR 1).
143
+ */
144
+ private resolveToolSettings;
145
+ }
146
+ //# sourceMappingURL=QtiPolicySource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QtiPolicySource.d.ts","sourceRoot":"","sources":["../../../src/policy/sources/QtiPolicySource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,iBAAiB,EAIjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACX,4BAA4B,EAC5B,oBAAoB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC5B,iEAAiE;IACjE,QAAQ,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,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AC;YAAC,MAAM,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;QACzD,IAAI,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KACtD,CAAC;CACF;AAcD,qBAAa,eAAe;IAC3B,QAAQ,CAAC,EAAE,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;gBAEhC,YAAY,EAAE,YAAY;IAItC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,eAAe;IA0DhD,OAAO,CAAC,cAAc;IAwJtB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,mBAAmB;CAS3B"}
@@ -0,0 +1,270 @@
1
+ /**
2
+ * QTI Policy Source — refactor of `PnpToolResolver` for the M8 engine
3
+ * (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5 §).
4
+ *
5
+ * This source applies the QTI 6-level precedence rules used by today's
6
+ * `PnpToolResolver` but exposes them as a `(candidates, qtiInputs) →
7
+ * (refinedCandidates, perToolFlags, mandates, decisions)` function the
8
+ * engine can call once per `decide(...)` request, with all results
9
+ * routed through the unified `ToolPolicyProvenanceBuilder`.
10
+ *
11
+ * **Why this lives next to the legacy resolver instead of replacing
12
+ * it.** PR 1 introduces the engine without callers; the legacy
13
+ * `PnpToolResolver` is still in active use by `<pie-item-toolbar>`
14
+ * and by external tests. PR 5 deletes the legacy class once the
15
+ * toolbar (PR 3) and the QTI default flip (PR 4) have landed and the
16
+ * caller list is empty. Until then this source is the *canonical*
17
+ * implementation and the legacy class is the deprecated mirror.
18
+ */
19
+ export class QtiPolicySource {
20
+ id = "qti";
21
+ toolRegistry;
22
+ constructor(toolRegistry) {
23
+ this.toolRegistry = toolRegistry;
24
+ }
25
+ apply(args) {
26
+ const { assessment, currentItemRef } = args;
27
+ const pnp = assessment.personalNeedsProfile;
28
+ const settings = assessment.settings;
29
+ const itemSettings = currentItemRef?.settings;
30
+ const result = {
31
+ blockedToolIds: new Set(),
32
+ mandatedToolIds: new Set(),
33
+ perToolFlags: new Map(),
34
+ decisions: [],
35
+ sources: {},
36
+ };
37
+ if (settings?.districtPolicy || settings?.testAdministration) {
38
+ result.sources.assessment = {
39
+ id: assessment.id || "unknown",
40
+ name: assessment.name || assessment.id || "Assessment",
41
+ config: settings,
42
+ };
43
+ }
44
+ if (pnp) {
45
+ result.sources.student = {
46
+ id: "student",
47
+ name: "Student PNP Profile",
48
+ config: pnp,
49
+ };
50
+ }
51
+ if (currentItemRef && itemSettings) {
52
+ result.sources.item = {
53
+ id: currentItemRef.identifier,
54
+ name: currentItemRef.identifier,
55
+ config: itemSettings,
56
+ };
57
+ }
58
+ const allSupports = new Set();
59
+ pnp?.supports?.forEach((s) => allSupports.add(s));
60
+ settings?.districtPolicy?.blockedTools?.forEach((s) => allSupports.add(s));
61
+ settings?.districtPolicy?.requiredTools?.forEach((s) => allSupports.add(s));
62
+ itemSettings?.requiredTools?.forEach((s) => allSupports.add(s));
63
+ itemSettings?.restrictedTools?.forEach((s) => allSupports.add(s));
64
+ const ctx = {
65
+ pnp,
66
+ districtPolicy: settings?.districtPolicy,
67
+ testAdmin: settings?.testAdministration,
68
+ itemSettings,
69
+ toolConfigs: settings?.toolConfigs,
70
+ };
71
+ for (const supportId of allSupports) {
72
+ this.resolveSupport(supportId, ctx, result);
73
+ }
74
+ return result;
75
+ }
76
+ resolveSupport(supportId, ctx, out) {
77
+ // 1. District block (absolute veto)
78
+ if (ctx.districtPolicy?.blockedTools?.includes(supportId)) {
79
+ const toolId = this.mapSupportToToolId(supportId);
80
+ out.blockedToolIds.add(toolId);
81
+ out.decisions.push({
82
+ precedence: 1,
83
+ rule: "district-block",
84
+ featureId: toolId,
85
+ action: "block",
86
+ sourceType: "assessment",
87
+ reason: `District policy blocks "${supportId}" for all assessments`,
88
+ value: ctx.districtPolicy.blockedTools,
89
+ });
90
+ return;
91
+ }
92
+ // 2. Test administration override
93
+ if (ctx.testAdmin?.toolOverrides?.[supportId] === false) {
94
+ const toolId = this.mapSupportToToolId(supportId);
95
+ out.blockedToolIds.add(toolId);
96
+ out.decisions.push({
97
+ precedence: 2,
98
+ rule: "test-admin-override",
99
+ featureId: toolId,
100
+ action: "block",
101
+ sourceType: "assessment",
102
+ reason: `Test administrator disabled "${supportId}" for this session`,
103
+ value: ctx.testAdmin.toolOverrides,
104
+ });
105
+ return;
106
+ }
107
+ // 3. Item restriction (per-item block)
108
+ if (ctx.itemSettings?.restrictedTools?.includes(supportId)) {
109
+ const toolId = this.mapSupportToToolId(supportId);
110
+ out.blockedToolIds.add(toolId);
111
+ out.decisions.push({
112
+ precedence: 3,
113
+ rule: "item-restriction",
114
+ featureId: toolId,
115
+ action: "block",
116
+ sourceType: "item",
117
+ reason: `Item restricts "${supportId}" (e.g., mental math question blocks calculator)`,
118
+ value: ctx.itemSettings.restrictedTools,
119
+ });
120
+ return;
121
+ }
122
+ // 4. Item requirement (forces enable)
123
+ if (ctx.itemSettings?.requiredTools?.includes(supportId)) {
124
+ const toolId = this.mapSupportToToolId(supportId);
125
+ out.mandatedToolIds.add(toolId);
126
+ out.perToolFlags.set(toolId, {
127
+ required: true,
128
+ alwaysAvailable: false,
129
+ settings: this.resolveToolSettings(supportId, ctx),
130
+ rule: "item-requirement",
131
+ sourceType: "item",
132
+ });
133
+ out.decisions.push({
134
+ precedence: 4,
135
+ rule: "item-requirement",
136
+ featureId: toolId,
137
+ action: "enable",
138
+ sourceType: "item",
139
+ reason: `Item requires "${supportId}" for this question`,
140
+ value: ctx.itemSettings.requiredTools,
141
+ });
142
+ return;
143
+ }
144
+ // 5. District requirement
145
+ if (ctx.districtPolicy?.requiredTools?.includes(supportId)) {
146
+ const toolId = this.mapSupportToToolId(supportId);
147
+ out.mandatedToolIds.add(toolId);
148
+ out.perToolFlags.set(toolId, {
149
+ required: true,
150
+ alwaysAvailable: false,
151
+ settings: this.resolveToolSettings(supportId, ctx),
152
+ rule: "district-requirement",
153
+ sourceType: "assessment",
154
+ });
155
+ out.decisions.push({
156
+ precedence: 5,
157
+ rule: "district-requirement",
158
+ featureId: toolId,
159
+ action: "enable",
160
+ sourceType: "assessment",
161
+ reason: `District policy requires "${supportId}" for all assessments`,
162
+ value: ctx.districtPolicy.requiredTools,
163
+ });
164
+ return;
165
+ }
166
+ // 6. PNP supports (student needs)
167
+ if (ctx.pnp?.supports?.includes(supportId)) {
168
+ const toolId = this.mapSupportToToolId(supportId);
169
+ const isProhibited = ctx.pnp.prohibitedSupports?.includes(supportId);
170
+ if (isProhibited) {
171
+ out.blockedToolIds.add(toolId);
172
+ out.decisions.push({
173
+ precedence: 6,
174
+ rule: "pnp-prohibited",
175
+ featureId: toolId,
176
+ action: "block",
177
+ sourceType: "student",
178
+ reason: `Student PNP profile prohibits "${supportId}"`,
179
+ value: ctx.pnp.prohibitedSupports,
180
+ });
181
+ return;
182
+ }
183
+ out.perToolFlags.set(toolId, {
184
+ required: false,
185
+ alwaysAvailable: true,
186
+ settings: this.resolveToolSettings(supportId, ctx),
187
+ rule: "pnp-support",
188
+ sourceType: "student",
189
+ });
190
+ out.decisions.push({
191
+ precedence: 6,
192
+ rule: "pnp-support",
193
+ featureId: toolId,
194
+ action: "enable",
195
+ sourceType: "student",
196
+ reason: `Student PNP profile requests "${supportId}"`,
197
+ value: ctx.pnp.supports,
198
+ });
199
+ return;
200
+ }
201
+ // 6 (skip): support-id mentioned somewhere but no rule fired.
202
+ // Use the mapped tool id as `featureId` so the trail is keyed
203
+ // the same way as every other branch — PR 5's debugger surfaces
204
+ // index provenance trails by tool id and would otherwise show
205
+ // orphaned support-id entries here (M8 PR 1 R3 S1).
206
+ const toolId = this.mapSupportToToolId(supportId);
207
+ out.decisions.push({
208
+ precedence: 6,
209
+ rule: "pnp-support",
210
+ featureId: toolId,
211
+ action: "skip",
212
+ sourceType: "system",
213
+ reason: `Feature "${supportId}" not configured at any level`,
214
+ value: { supportId },
215
+ });
216
+ }
217
+ /**
218
+ * Map a QTI / PNP support id (e.g. `"calculator-basic"`) to the
219
+ * registered tool id that owns it.
220
+ *
221
+ * Resolution rules:
222
+ *
223
+ * 1. **Multiple tools register the same support id:** the
224
+ * *first-registered* tool wins. `ToolRegistry.getToolsByPNPSupport`
225
+ * returns a `Set<string>` whose iteration order matches the
226
+ * `register(...)` insertion order, so the result is
227
+ * deterministic across runs but order-sensitive at registration
228
+ * time. This is an unusual configuration — the typical case is
229
+ * one tool per support id — but it is reachable when an
230
+ * integrator overrides a default tool with a replacement that
231
+ * claims the same `pnpSupportIds`. In that case the integrator
232
+ * should `unregister(...)` the default before registering the
233
+ * replacement.
234
+ *
235
+ * 2. **No tool registers the support id:** the support id is
236
+ * returned verbatim as the `featureId` for provenance trails
237
+ * and `ToolPolicyEntry.toolId`. This lets hosts use raw QTI
238
+ * strings for tools the registry does not (yet) carry without
239
+ * losing them in policy evaluation.
240
+ *
241
+ * The legacy `PnpToolResolver.resolveTool` had the same behavior;
242
+ * see `tests/policy/QtiPolicySource.test.ts` for the regression
243
+ * lock.
244
+ */
245
+ mapSupportToToolId(supportId) {
246
+ const toolIds = this.toolRegistry.getToolsByPNPSupport(supportId);
247
+ if (toolIds.size === 0)
248
+ return supportId;
249
+ return Array.from(toolIds)[0];
250
+ }
251
+ /**
252
+ * Resolve tool-specific settings, item-level taking precedence over
253
+ * assessment-level.
254
+ *
255
+ * Uses `??` (nullish-coalescing) rather than the legacy resolver's
256
+ * `||`. Tool config values are typed `unknown` and may legitimately
257
+ * be `false` / `0` / `""` (e.g. a tool whose canonical "off" config
258
+ * is the literal `false`). `||` would treat those as missing and
259
+ * silently fall through to the assessment-level config, masking the
260
+ * authored item-level intent. `??` only falls through on
261
+ * `null`/`undefined`, which matches the semantic of "value not
262
+ * provided." This is a deliberate behavior delta from the legacy
263
+ * `PnpToolResolver` (M8 PR 1).
264
+ */
265
+ resolveToolSettings(supportId, ctx) {
266
+ return (ctx.itemSettings?.toolParameters?.[supportId] ??
267
+ ctx.toolConfigs?.[supportId]);
268
+ }
269
+ }
270
+ //# sourceMappingURL=QtiPolicySource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QtiPolicySource.js","sourceRoot":"","sources":["../../../src/policy/sources/QtiPolicySource.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,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAC5C,MAAM,GAAG,GAAG,UAAU,CAAC,oBAAoB,CAAC;QAC5C,MAAM,QAAQ,GAAG,UAAU,CAAC,QAA0C,CAAC;QACvE,MAAM,YAAY,GAAG,cAAc,EAAE,QAAoC,CAAC;QAE1E,MAAM,MAAM,GAAoB;YAC/B,cAAc,EAAE,IAAI,GAAG,EAAE;YACzB,eAAe,EAAE,IAAI,GAAG,EAAE;YAC1B,YAAY,EAAE,IAAI,GAAG,EAAE;YACvB,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACX,CAAC;QAEF,IAAI,QAAQ,EAAE,cAAc,IAAI,QAAQ,EAAE,kBAAkB,EAAE,CAAC;YAC9D,MAAM,CAAC,OAAO,CAAC,UAAU,GAAG;gBAC3B,EAAE,EAAE,UAAU,CAAC,EAAE,IAAI,SAAS;gBAC9B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,EAAE,IAAI,YAAY;gBACtD,MAAM,EAAE,QAAQ;aAChB,CAAC;QACH,CAAC;QACD,IAAI,GAAG,EAAE,CAAC;YACT,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG;gBACxB,EAAE,EAAE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