@pie-players/pie-assessment-toolkit 0.3.37 → 0.3.39
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/components/ItemToolBar.custom-element.js +8939 -1870
- package/dist/components/PieAssessmentToolkit.custom-element.js +13519 -1745
- package/dist/components/SectionToolBar.custom-element.js +13119 -142
- package/dist/policy/core/PolicySource.d.ts +2 -2
- package/dist/policy/core/PolicySource.js +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +15 -17
- package/dist/policy/core/ToolPolicyEngine.d.ts.map +1 -1
- package/dist/policy/core/ToolPolicyEngine.js +21 -21
- package/dist/policy/core/ToolPolicyEngine.js.map +1 -1
- package/dist/policy/core/compose-decision.d.ts +5 -5
- package/dist/policy/core/compose-decision.d.ts.map +1 -1
- package/dist/policy/core/compose-decision.js +40 -38
- package/dist/policy/core/compose-decision.js.map +1 -1
- package/dist/policy/core/decision-types.d.ts +10 -10
- package/dist/policy/core/decision-types.d.ts.map +1 -1
- package/dist/policy/core/{qti-inputs.d.ts → pnp-policy-inputs.d.ts} +23 -23
- package/dist/policy/core/pnp-policy-inputs.d.ts.map +1 -0
- package/dist/policy/core/{qti-inputs.js → pnp-policy-inputs.js} +25 -25
- package/dist/policy/core/pnp-policy-inputs.js.map +1 -0
- package/dist/policy/core/policy-source-tag.d.ts +6 -6
- package/dist/policy/core/policy-source-tag.js +3 -3
- package/dist/policy/core/provenance.d.ts +11 -11
- package/dist/policy/core/provenance.d.ts.map +1 -1
- package/dist/policy/core/provenance.js +4 -4
- package/dist/policy/engine.d.ts +5 -5
- package/dist/policy/engine.d.ts.map +1 -1
- package/dist/policy/engine.js +2 -2
- package/dist/policy/internal.d.ts +4 -4
- package/dist/policy/internal.d.ts.map +1 -1
- package/dist/policy/internal.js +4 -4
- package/dist/policy/internal.js.map +1 -1
- package/dist/policy/sources/{QtiPolicySource.d.ts → PnpPolicySource.d.ts} +25 -25
- package/dist/policy/sources/PnpPolicySource.d.ts.map +1 -0
- package/dist/policy/sources/{QtiPolicySource.js → PnpPolicySource.js} +28 -27
- package/dist/policy/sources/PnpPolicySource.js.map +1 -0
- package/dist/services/PNPToolResolver.d.ts.map +1 -1
- package/dist/services/PNPToolResolver.js +14 -15
- package/dist/services/PNPToolResolver.js.map +1 -1
- package/dist/services/ToolkitCoordinator.d.ts +55 -50
- package/dist/services/ToolkitCoordinator.d.ts.map +1 -1
- package/dist/services/ToolkitCoordinator.js +92 -72
- package/dist/services/ToolkitCoordinator.js.map +1 -1
- package/dist/services/interfaces.d.ts +24 -16
- package/dist/services/interfaces.d.ts.map +1 -1
- package/dist/services/interfaces.js.map +1 -1
- package/dist/services/pnp-provenance.d.ts +1 -1
- package/dist/services/pnp-provenance.d.ts.map +1 -1
- package/dist/services/pnp-provenance.js +1 -0
- package/dist/services/pnp-provenance.js.map +1 -1
- package/dist/services/tools-config-normalizer.d.ts +14 -15
- package/dist/services/tools-config-normalizer.d.ts.map +1 -1
- package/dist/services/tools-config-normalizer.js +5 -5
- package/dist/services/tools-config-normalizer.js.map +1 -1
- package/package.json +8 -8
- package/dist/policy/core/qti-inputs.d.ts.map +0 -1
- package/dist/policy/core/qti-inputs.js.map +0 -1
- package/dist/policy/sources/QtiPolicySource.d.ts.map +0 -1
- package/dist/policy/sources/QtiPolicySource.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `.cursor/plans/m8-design.md` § 5).
|
|
4
4
|
*
|
|
5
5
|
* Custom sources run in step 6 of the composition pipeline — *after*
|
|
6
|
-
* placement membership, provider veto, host policy, and
|
|
6
|
+
* placement membership, provider veto, host policy, and PNP/profile gates.
|
|
7
7
|
* That ordering is deliberate: custom rules can only further *narrow*
|
|
8
8
|
* the candidate set or add advisory provenance entries; they cannot
|
|
9
9
|
* promote a tool that the host already removed.
|
|
@@ -36,7 +36,7 @@ export interface PolicySourceProvenanceEntry {
|
|
|
36
36
|
* Custom precedence value used for the decision log. Defaults to
|
|
37
37
|
* `100 + sourceIndex` (engine-assigned) when `undefined`. Sources
|
|
38
38
|
* MAY override only if they know what they are doing — overriding
|
|
39
|
-
* to a value `<= 6` lets the source masquerade as a
|
|
39
|
+
* to a value `<= 6` lets the source masquerade as a PNP/profile rule and
|
|
40
40
|
* is generally a bug.
|
|
41
41
|
*/
|
|
42
42
|
precedence?: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `.cursor/plans/m8-design.md` § 5).
|
|
4
4
|
*
|
|
5
5
|
* Custom sources run in step 6 of the composition pipeline — *after*
|
|
6
|
-
* placement membership, provider veto, host policy, and
|
|
6
|
+
* placement membership, provider veto, host policy, and PNP/profile gates.
|
|
7
7
|
* That ordering is deliberate: custom rules can only further *narrow*
|
|
8
8
|
* the candidate set or add advisory provenance entries; they cannot
|
|
9
9
|
* promote a tool that the host already removed.
|
|
@@ -21,26 +21,24 @@ import type { CanonicalToolsConfig, ToolPlacementLevel } from "../../services/to
|
|
|
21
21
|
import type { ToolRegistry } from "../../services/ToolRegistry.js";
|
|
22
22
|
import type { ToolPolicyDecision, ToolPolicyDecisionRequest } from "./decision-types.js";
|
|
23
23
|
import type { PolicySource } from "./PolicySource.js";
|
|
24
|
-
export type
|
|
24
|
+
export type PnpEnforcementMode = "on" | "off";
|
|
25
25
|
export interface ToolPolicyEngineInputs {
|
|
26
26
|
tools?: CanonicalToolsConfig | null;
|
|
27
27
|
assessment?: AssessmentEntity | null;
|
|
28
28
|
currentItemRef?: AssessmentItemRef | null;
|
|
29
29
|
/**
|
|
30
|
-
* Explicit override. When omitted (or `undefined`), the engine
|
|
31
|
-
* defaults to {@link
|
|
32
|
-
* `assessment` and `currentItemRef`: `"on"` if they carry any
|
|
33
|
-
*
|
|
30
|
+
* Explicit PNP/profile override. When omitted (or `undefined`), the engine
|
|
31
|
+
* defaults to {@link resolveDefaultPnpEnforcement} over the bound
|
|
32
|
+
* `assessment` and `currentItemRef`: `"on"` if they carry any
|
|
33
|
+
* PNP/profile policy material (PNP, district policy, test
|
|
34
34
|
* administration, item-level required/restricted/parameters),
|
|
35
35
|
* `"off"` otherwise. See `.cursor/plans/m8-design.md` F2.
|
|
36
36
|
*
|
|
37
|
-
* Hosts that want to force a mode
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* override flows through `runtime.tools.qtiEnforcement` (see the
|
|
41
|
-
* M5 mirror rule).
|
|
37
|
+
* Hosts that want to force a mode pass `"on"` or `"off"`
|
|
38
|
+
* explicitly. Embedded under `<pie-section-player-*>` the preferred
|
|
39
|
+
* override flows through `runtime.tools.pnpEnforcement`.
|
|
42
40
|
*/
|
|
43
|
-
|
|
41
|
+
pnpEnforcement?: PnpEnforcementMode;
|
|
44
42
|
}
|
|
45
43
|
export interface ToolPolicyEngineArgs {
|
|
46
44
|
toolRegistry: ToolRegistry;
|
|
@@ -51,7 +49,7 @@ export interface ToolPolicyEngineArgs {
|
|
|
51
49
|
}
|
|
52
50
|
export interface ToolPolicyChangeEvent {
|
|
53
51
|
/** What changed in this update. */
|
|
54
|
-
reason: "inputs" | "policy-source-added" | "policy-source-removed" | "
|
|
52
|
+
reason: "inputs" | "policy-source-added" | "policy-source-removed" | "pnp-enforcement" | "disposed";
|
|
55
53
|
/** Snapshot of the engine's inputs after the change. */
|
|
56
54
|
inputs: Readonly<ResolvedEngineInputs>;
|
|
57
55
|
}
|
|
@@ -59,19 +57,19 @@ export interface ResolvedEngineInputs {
|
|
|
59
57
|
tools: CanonicalToolsConfig;
|
|
60
58
|
assessment: AssessmentEntity | null;
|
|
61
59
|
currentItemRef: AssessmentItemRef | null;
|
|
62
|
-
|
|
60
|
+
pnpEnforcement: PnpEnforcementMode;
|
|
63
61
|
}
|
|
64
62
|
export type ToolPolicyChangeListener = (event: ToolPolicyChangeEvent) => void;
|
|
65
63
|
export declare class ToolPolicyEngine {
|
|
66
64
|
private readonly toolRegistry;
|
|
67
65
|
private readonly contextId;
|
|
68
|
-
private readonly
|
|
66
|
+
private readonly pnpPolicySource;
|
|
69
67
|
private readonly customSources;
|
|
70
68
|
private readonly listeners;
|
|
71
69
|
private tools;
|
|
72
70
|
private assessment;
|
|
73
71
|
private currentItemRef;
|
|
74
|
-
private
|
|
72
|
+
private pnpEnforcement;
|
|
75
73
|
private disposed;
|
|
76
74
|
constructor(args: ToolPolicyEngineArgs);
|
|
77
75
|
/**
|
|
@@ -106,8 +104,8 @@ export declare class ToolPolicyEngine {
|
|
|
106
104
|
* coordinator's `getFloatingTools()` / `decideToolPolicy()` lockstep
|
|
107
105
|
* tests.
|
|
108
106
|
*
|
|
109
|
-
* `
|
|
110
|
-
* a distinct `"
|
|
107
|
+
* `pnpEnforcement` is stored on its own field and always emits with
|
|
108
|
+
* a distinct `"pnp-enforcement"` reason when no other key changed,
|
|
111
109
|
* so PR 4's auto-on flip can target that reason without a separate
|
|
112
110
|
* event channel.
|
|
113
111
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolPolicyEngine.d.ts","sourceRoot":"","sources":["../../../src/policy/core/ToolPolicyEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EACX,oBAAoB,EACpB,kBAAkB,EAClB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,KAAK,CAAC;AAE9C,MAAM,WAAW,sBAAsB;IACtC,KAAK,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrC,cAAc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B"}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { normalizeToolsConfig } from "../../services/tools-config-normalizer.js";
|
|
20
20
|
import { composeDecision } from "./compose-decision.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
21
|
+
import { resolveDefaultPnpEnforcement } from "./pnp-policy-inputs.js";
|
|
22
|
+
import { PnpPolicySource } from "../sources/PnpPolicySource.js";
|
|
23
23
|
const DEFAULT_TOOLS = normalizeToolsConfig({
|
|
24
24
|
policy: { allowed: [], blocked: [] },
|
|
25
25
|
placement: { section: [], item: [], passage: [] },
|
|
@@ -28,26 +28,26 @@ const DEFAULT_TOOLS = normalizeToolsConfig({
|
|
|
28
28
|
export class ToolPolicyEngine {
|
|
29
29
|
toolRegistry;
|
|
30
30
|
contextId;
|
|
31
|
-
|
|
31
|
+
pnpPolicySource;
|
|
32
32
|
customSources;
|
|
33
33
|
listeners = new Set();
|
|
34
34
|
tools;
|
|
35
35
|
assessment;
|
|
36
36
|
currentItemRef;
|
|
37
|
-
|
|
37
|
+
pnpEnforcement;
|
|
38
38
|
disposed = false;
|
|
39
39
|
constructor(args) {
|
|
40
40
|
this.toolRegistry = args.toolRegistry;
|
|
41
41
|
this.contextId = args.contextId ?? "tool-policy";
|
|
42
|
-
this.
|
|
42
|
+
this.pnpPolicySource = new PnpPolicySource(this.toolRegistry);
|
|
43
43
|
this.customSources = args.customSources ? [...args.customSources] : [];
|
|
44
44
|
const inputs = args.inputs ?? {};
|
|
45
45
|
this.tools = inputs.tools ?? DEFAULT_TOOLS;
|
|
46
46
|
this.assessment = inputs.assessment ?? null;
|
|
47
47
|
this.currentItemRef = inputs.currentItemRef ?? null;
|
|
48
|
-
this.
|
|
49
|
-
inputs.
|
|
50
|
-
|
|
48
|
+
this.pnpEnforcement =
|
|
49
|
+
inputs.pnpEnforcement ??
|
|
50
|
+
resolveDefaultPnpEnforcement({
|
|
51
51
|
assessment: this.assessment,
|
|
52
52
|
currentItemRef: this.currentItemRef,
|
|
53
53
|
});
|
|
@@ -75,11 +75,11 @@ export class ToolPolicyEngine {
|
|
|
75
75
|
return composeDecision({
|
|
76
76
|
request,
|
|
77
77
|
tools: this.tools,
|
|
78
|
-
|
|
79
|
-
source: this.
|
|
78
|
+
pnpPolicy: {
|
|
79
|
+
source: this.pnpPolicySource,
|
|
80
80
|
assessment: this.assessment ?? undefined,
|
|
81
81
|
currentItemRef: this.currentItemRef ?? undefined,
|
|
82
|
-
enforcement: this.
|
|
82
|
+
enforcement: this.pnpEnforcement,
|
|
83
83
|
},
|
|
84
84
|
customSources: this.customSources,
|
|
85
85
|
contextId: requestContextId,
|
|
@@ -106,15 +106,15 @@ export class ToolPolicyEngine {
|
|
|
106
106
|
* coordinator's `getFloatingTools()` / `decideToolPolicy()` lockstep
|
|
107
107
|
* tests.
|
|
108
108
|
*
|
|
109
|
-
* `
|
|
110
|
-
* a distinct `"
|
|
109
|
+
* `pnpEnforcement` is stored on its own field and always emits with
|
|
110
|
+
* a distinct `"pnp-enforcement"` reason when no other key changed,
|
|
111
111
|
* so PR 4's auto-on flip can target that reason without a separate
|
|
112
112
|
* event channel.
|
|
113
113
|
*/
|
|
114
114
|
updateInputs(patch) {
|
|
115
115
|
this.assertNotDisposed();
|
|
116
116
|
let changed = false;
|
|
117
|
-
let
|
|
117
|
+
let pnpChanged = false;
|
|
118
118
|
if ("tools" in patch) {
|
|
119
119
|
const next = patch.tools ?? DEFAULT_TOOLS;
|
|
120
120
|
if (!Object.is(this.tools, next)) {
|
|
@@ -136,15 +136,15 @@ export class ToolPolicyEngine {
|
|
|
136
136
|
changed = true;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
if ("
|
|
140
|
-
if (this.
|
|
141
|
-
this.
|
|
142
|
-
|
|
139
|
+
if ("pnpEnforcement" in patch && patch.pnpEnforcement) {
|
|
140
|
+
if (this.pnpEnforcement !== patch.pnpEnforcement) {
|
|
141
|
+
this.pnpEnforcement = patch.pnpEnforcement;
|
|
142
|
+
pnpChanged = true;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
if (changed ||
|
|
145
|
+
if (changed || pnpChanged) {
|
|
146
146
|
this.emit({
|
|
147
|
-
reason:
|
|
147
|
+
reason: pnpChanged && !changed ? "pnp-enforcement" : "inputs",
|
|
148
148
|
inputs: this.snapshotInputs(),
|
|
149
149
|
});
|
|
150
150
|
}
|
|
@@ -194,7 +194,7 @@ export class ToolPolicyEngine {
|
|
|
194
194
|
tools: this.tools,
|
|
195
195
|
assessment: this.assessment,
|
|
196
196
|
currentItemRef: this.currentItemRef,
|
|
197
|
-
|
|
197
|
+
pnpEnforcement: this.pnpEnforcement,
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
emit(event) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolPolicyEngine.js","sourceRoot":"","sources":["../../../src/policy/core/ToolPolicyEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAQjF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ToolPolicyEngine.js","sourceRoot":"","sources":["../../../src/policy/core/ToolPolicyEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAQjF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAoDhE,MAAM,aAAa,GAAyB,oBAAoB,CAAC;IAChE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpC,SAAS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AC,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"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Compose-decision pipeline (M8 — see `.cursor/plans/m8-design.md` § 3).
|
|
3
3
|
*
|
|
4
4
|
* Pure function: given a decision request, the host's tools config,
|
|
5
|
-
* an optional
|
|
5
|
+
* an optional PNP policy source, and the registered custom sources, returns
|
|
6
6
|
* a `ToolPolicyDecision`. The function performs no I/O, holds no
|
|
7
7
|
* mutable state, and never reaches into Svelte / DOM — that is the
|
|
8
8
|
* `ToolPolicyEngine` class's job.
|
|
@@ -14,16 +14,16 @@ import type { AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-playe
|
|
|
14
14
|
import { type CanonicalToolsConfig } from "../../services/tools-config-normalizer.js";
|
|
15
15
|
import type { ToolPolicyDecision, ToolPolicyDecisionRequest } from "./decision-types.js";
|
|
16
16
|
import type { PolicySource } from "./PolicySource.js";
|
|
17
|
-
import type {
|
|
17
|
+
import type { PnpPolicySource } from "../sources/PnpPolicySource.js";
|
|
18
18
|
export interface ComposeDecisionInputs {
|
|
19
19
|
request: ToolPolicyDecisionRequest;
|
|
20
20
|
tools: CanonicalToolsConfig;
|
|
21
|
-
|
|
22
|
-
source:
|
|
21
|
+
pnpPolicy: {
|
|
22
|
+
source: PnpPolicySource | null;
|
|
23
23
|
assessment?: AssessmentEntity;
|
|
24
24
|
currentItemRef?: AssessmentItemRef;
|
|
25
25
|
/**
|
|
26
|
-
* "on" applies the
|
|
26
|
+
* "on" applies the PNP/profile precedence rules; "off" skips step 5
|
|
27
27
|
* entirely. Defaults to "on" when an assessment is present
|
|
28
28
|
* and the source is non-null (see M8 design Q5).
|
|
29
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-decision.d.ts","sourceRoot":"","sources":["../../../src/policy/core/compose-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACN,KAAK,oBAAoB,EAEzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAEX,kBAAkB,EAClB,yBAAyB,EAIzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,yBAAyB,CAAC;IACnC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,
|
|
1
|
+
{"version":3,"file":"compose-decision.d.ts","sourceRoot":"","sources":["../../../src/policy/core/compose-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACN,KAAK,oBAAoB,EAEzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAEX,kBAAkB,EAClB,yBAAyB,EAIzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,yBAAyB,CAAC;IACnC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,SAAS,EAAE;QACV,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;QAC9B,cAAc,CAAC,EAAE,iBAAiB,CAAC;QACnC;;;;WAIG;QACH,WAAW,EAAE,IAAI,GAAG,KAAK,CAAC;KAC1B,CAAC;IACF,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,eAAe,CAC9B,MAAM,EAAE,qBAAqB,GAC3B,kBAAkB,CAoTpB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Compose-decision pipeline (M8 — see `.cursor/plans/m8-design.md` § 3).
|
|
3
3
|
*
|
|
4
4
|
* Pure function: given a decision request, the host's tools config,
|
|
5
|
-
* an optional
|
|
5
|
+
* an optional PNP policy source, and the registered custom sources, returns
|
|
6
6
|
* a `ToolPolicyDecision`. The function performs no I/O, holds no
|
|
7
7
|
* mutable state, and never reaches into Svelte / DOM — that is the
|
|
8
8
|
* `ToolPolicyEngine` class's job.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { normalizeToolList, } from "../../services/tools-config-normalizer.js";
|
|
14
14
|
import { ToolPolicyProvenanceBuilder } from "./provenance.js";
|
|
15
15
|
export function composeDecision(inputs) {
|
|
16
|
-
const { request, tools,
|
|
16
|
+
const { request, tools, pnpPolicy, customSources, contextId } = inputs;
|
|
17
17
|
const builder = new ToolPolicyProvenanceBuilder(contextId);
|
|
18
18
|
builder.addSource("host", {
|
|
19
19
|
id: request.scope.scopeId,
|
|
@@ -100,34 +100,36 @@ export function composeDecision(inputs) {
|
|
|
100
100
|
}
|
|
101
101
|
return true;
|
|
102
102
|
});
|
|
103
|
-
// Step 5 —
|
|
103
|
+
// Step 5 — PNP/profile policy gates.
|
|
104
104
|
const diagnostics = [];
|
|
105
105
|
const sourcesByTool = new Map();
|
|
106
106
|
for (const toolId of candidates) {
|
|
107
107
|
sourcesByTool.set(toolId, ["placement"]);
|
|
108
108
|
}
|
|
109
109
|
// Snapshot the post-host candidate set so step 5b can distinguish
|
|
110
|
-
// "host removed a
|
|
111
|
-
// from "
|
|
110
|
+
// "host removed a required tool" (requiredToolBlocked fires)
|
|
111
|
+
// from "profile policy's own precedence removed a required tool" (fix
|
|
112
112
|
// per M8 PR 1 R1 S1 — multi-rule conflict on the same tool must
|
|
113
113
|
// not blame the host).
|
|
114
114
|
const postHostCandidates = new Set(candidates);
|
|
115
|
-
let
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
let pnpPolicyResult = null;
|
|
116
|
+
if (pnpPolicy.enforcement === "on" &&
|
|
117
|
+
pnpPolicy.source &&
|
|
118
|
+
(pnpPolicy.assessment || pnpPolicy.currentItemRef)) {
|
|
119
|
+
pnpPolicyResult = pnpPolicy.source.apply({
|
|
120
|
+
assessment: pnpPolicy.assessment,
|
|
121
|
+
currentItemRef: pnpPolicy.currentItemRef,
|
|
120
122
|
});
|
|
121
|
-
if (
|
|
122
|
-
builder.addSource("assessment",
|
|
123
|
+
if (pnpPolicyResult.sources.assessment) {
|
|
124
|
+
builder.addSource("assessment", pnpPolicyResult.sources.assessment);
|
|
123
125
|
}
|
|
124
|
-
if (
|
|
125
|
-
builder.addSource("student",
|
|
126
|
+
if (pnpPolicyResult.sources.student) {
|
|
127
|
+
builder.addSource("student", pnpPolicyResult.sources.student);
|
|
126
128
|
}
|
|
127
|
-
if (
|
|
128
|
-
builder.addSource("item",
|
|
129
|
+
if (pnpPolicyResult.sources.item) {
|
|
130
|
+
builder.addSource("item", pnpPolicyResult.sources.item);
|
|
129
131
|
}
|
|
130
|
-
for (const decision of
|
|
132
|
+
for (const decision of pnpPolicyResult.decisions) {
|
|
131
133
|
builder.addDecision({
|
|
132
134
|
precedence: decision.precedence,
|
|
133
135
|
rule: decision.rule,
|
|
@@ -138,34 +140,34 @@ export function composeDecision(inputs) {
|
|
|
138
140
|
value: decision.value,
|
|
139
141
|
});
|
|
140
142
|
}
|
|
141
|
-
// 5a — remove
|
|
143
|
+
// 5a — remove PNP/profile-blocked tools from the candidate set.
|
|
142
144
|
candidates = candidates.filter((toolId) => {
|
|
143
|
-
return !
|
|
145
|
+
return !pnpPolicyResult.blockedToolIds.has(toolId);
|
|
144
146
|
});
|
|
145
147
|
for (const toolId of Array.from(sourcesByTool.keys())) {
|
|
146
|
-
if (
|
|
148
|
+
if (pnpPolicyResult.blockedToolIds.has(toolId)) {
|
|
147
149
|
sourcesByTool.delete(toolId);
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
|
-
// 5b — surface
|
|
151
|
-
//
|
|
152
|
+
// 5b — surface requiredToolBlocked diagnostics ONLY for
|
|
153
|
+
// PNP/profile-mandated tools that the host removed (i.e., the tool was
|
|
152
154
|
// NOT in `postHostCandidates`). Mandated tools removed by
|
|
153
|
-
//
|
|
154
|
-
// blocking a `requiredTools` mandate) are an internal
|
|
155
|
+
// profile policy's own higher-precedence rule (e.g. `restrictedTools`
|
|
156
|
+
// blocking a `requiredTools` mandate) are an internal policy
|
|
155
157
|
// resolution and must not be reported as a host conflict — the
|
|
156
158
|
// loser's `block` decision is already in the trail with full
|
|
157
|
-
//
|
|
159
|
+
// provenance.
|
|
158
160
|
//
|
|
159
161
|
// `details` carries `{ rule, hostRule, hostValue }` so consumers
|
|
160
162
|
// can render the conflict as a single sentence without
|
|
161
163
|
// re-deriving the host gate from `provenance.features`. See
|
|
162
|
-
// `
|
|
163
|
-
for (const mandatedToolId of
|
|
164
|
+
// `RequiredToolBlockedDetails` for the typed shape.
|
|
165
|
+
for (const mandatedToolId of pnpPolicyResult.mandatedToolIds) {
|
|
164
166
|
const removedByHost = !postHostCandidates.has(mandatedToolId);
|
|
165
167
|
if (!removedByHost)
|
|
166
168
|
continue;
|
|
167
|
-
const flag =
|
|
168
|
-
const ruleName = flag?.rule ?? "
|
|
169
|
+
const flag = pnpPolicyResult.perToolFlags.get(mandatedToolId);
|
|
170
|
+
const ruleName = flag?.rule ?? "required-tool";
|
|
169
171
|
const hostGate = detectHostRemovalGate(mandatedToolId, {
|
|
170
172
|
placement,
|
|
171
173
|
allowed,
|
|
@@ -178,28 +180,28 @@ export function composeDecision(inputs) {
|
|
|
178
180
|
hostValue: hostGate.hostValue,
|
|
179
181
|
};
|
|
180
182
|
diagnostics.push({
|
|
181
|
-
code: "tool-policy.
|
|
183
|
+
code: "tool-policy.requiredToolBlocked",
|
|
182
184
|
level: request.level,
|
|
183
185
|
toolId: mandatedToolId,
|
|
184
|
-
message: `
|
|
186
|
+
message: `Profile policy mandates "${mandatedToolId}" (${ruleName}) but host policy removed it from level "${request.level}" via ${hostGate.hostRule}.`,
|
|
185
187
|
details,
|
|
186
188
|
});
|
|
187
189
|
builder.addDecision({
|
|
188
190
|
precedence: 0,
|
|
189
|
-
rule: "
|
|
191
|
+
rule: "required-tool-blocked",
|
|
190
192
|
featureId: mandatedToolId,
|
|
191
193
|
action: "advisory",
|
|
192
194
|
sourceType: "host",
|
|
193
|
-
reason: `Host removed
|
|
195
|
+
reason: `Host removed required tool "${mandatedToolId}" via ${hostGate.hostRule}`,
|
|
194
196
|
value: details,
|
|
195
197
|
});
|
|
196
198
|
}
|
|
197
|
-
// 5c — attach
|
|
199
|
+
// 5c — attach PNP policy source tags to surviving entries.
|
|
198
200
|
for (const toolId of candidates) {
|
|
199
|
-
const flag =
|
|
201
|
+
const flag = pnpPolicyResult.perToolFlags.get(toolId);
|
|
200
202
|
if (flag) {
|
|
201
203
|
const tags = sourcesByTool.get(toolId) ?? [];
|
|
202
|
-
tags.push(`
|
|
204
|
+
tags.push(`pnp.${flag.rule}`);
|
|
203
205
|
sourcesByTool.set(toolId, tags);
|
|
204
206
|
}
|
|
205
207
|
}
|
|
@@ -283,7 +285,7 @@ export function composeDecision(inputs) {
|
|
|
283
285
|
}
|
|
284
286
|
const survivingIds = new Set(candidates);
|
|
285
287
|
const visibleTools = candidates.map((toolId) => {
|
|
286
|
-
const flag =
|
|
288
|
+
const flag = pnpPolicyResult?.perToolFlags.get(toolId);
|
|
287
289
|
return {
|
|
288
290
|
toolId,
|
|
289
291
|
required: flag?.required ?? false,
|
|
@@ -301,7 +303,7 @@ export function composeDecision(inputs) {
|
|
|
301
303
|
}
|
|
302
304
|
/**
|
|
303
305
|
* Identify which step-1-through-4 host gate removed a tool. Used by
|
|
304
|
-
* step 5b to enrich `tool-policy.
|
|
306
|
+
* step 5b to enrich `tool-policy.requiredToolBlocked` diagnostics. The
|
|
305
307
|
* checks mirror the pipeline order — step 1 (placement) first, step 4
|
|
306
308
|
* (blocklist) last — so the FIRST gate that would have matched wins,
|
|
307
309
|
* which is the gate the pipeline actually invoked. Subsequent gates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-decision.js","sourceRoot":"","sources":["../../../src/policy/core/compose-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAEN,iBAAiB,GACjB,MAAM,2CAA2C,CAAC;AAWnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAsB9D,MAAM,UAAU,eAAe,CAC9B,MAA6B;IAE7B,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"compose-decision.js","sourceRoot":"","sources":["../../../src/policy/core/compose-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAEN,iBAAiB,GACjB,MAAM,2CAA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est {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Diagnostic codes the engine may emit alongside a decision. The
|
|
55
|
-
* canonical case in M8 is `tool-policy.
|
|
55
|
+
* canonical case in M8 is `tool-policy.requiredToolBlocked` — fired
|
|
56
56
|
* when a host policy gate (`policy.blocked`, missing-from-`placement`,
|
|
57
|
-
* provider veto) removed a tool that
|
|
57
|
+
* provider veto) removed a tool that profile policy `requiredTools` /
|
|
58
58
|
* `district.requiredTools` mandates.
|
|
59
59
|
*
|
|
60
60
|
* `tool-policy.placementMissing` fires when a custom `PolicySource`
|
|
@@ -63,10 +63,10 @@ export interface ToolPolicyDecisionRequest {
|
|
|
63
63
|
* (already used by `tool-config-validation.ts`) covers config-time
|
|
64
64
|
* misconfiguration; this channel covers per-decision conflicts.
|
|
65
65
|
*/
|
|
66
|
-
export type ToolPolicyDiagnosticCode = "tool-policy.
|
|
66
|
+
export type ToolPolicyDiagnosticCode = "tool-policy.requiredToolBlocked" | "tool-policy.placementMissing";
|
|
67
67
|
/**
|
|
68
|
-
* Which host gate removed a
|
|
69
|
-
* `ToolPolicyDiagnostic.details` for `tool-policy.
|
|
68
|
+
* Which host gate removed a profile-mandated tool. Surfaced inside
|
|
69
|
+
* `ToolPolicyDiagnostic.details` for `tool-policy.requiredToolBlocked`
|
|
70
70
|
* so consumers can render a single human-readable explanation
|
|
71
71
|
* ("the proctor blocked the calculator that this student's IEP
|
|
72
72
|
* requires") without re-deriving the host gate from
|
|
@@ -80,14 +80,14 @@ export type ToolPolicyDiagnosticCode = "tool-policy.qtiRequiredBlocked" | "tool-
|
|
|
80
80
|
*/
|
|
81
81
|
export type ToolPolicyHostGate = "placement-missing" | "provider-disabled" | "host-allowlist" | "host-blocked";
|
|
82
82
|
/**
|
|
83
|
-
* Strongly-typed payload for `tool-policy.
|
|
83
|
+
* Strongly-typed payload for `tool-policy.requiredToolBlocked`
|
|
84
84
|
* diagnostics. The diagnostic's `details` field still types as
|
|
85
85
|
* `Record<string, unknown>` for forward compatibility, but engines
|
|
86
86
|
* always populate this exact shape today and consumers can safely
|
|
87
87
|
* cast.
|
|
88
88
|
*/
|
|
89
|
-
export interface
|
|
90
|
-
/** The
|
|
89
|
+
export interface RequiredToolBlockedDetails extends Record<string, unknown> {
|
|
90
|
+
/** The profile policy rule that mandated the tool (e.g. `district-requirement`). */
|
|
91
91
|
rule: string;
|
|
92
92
|
/** Which host gate removed the tool. */
|
|
93
93
|
hostRule: ToolPolicyHostGate;
|
|
@@ -105,7 +105,7 @@ export interface ToolPolicyDiagnostic {
|
|
|
105
105
|
export interface ToolPolicyEntry {
|
|
106
106
|
toolId: string;
|
|
107
107
|
/**
|
|
108
|
-
* `true` when
|
|
108
|
+
* `true` when PNP/profile policy mandates this tool (item or district
|
|
109
109
|
* `requiredTools`, or PNP support without prohibition). Advisory
|
|
110
110
|
* mandates that the host blocked do *not* surface here — they
|
|
111
111
|
* appear in `diagnostics` instead. Hosts that need to know about
|
|
@@ -121,7 +121,7 @@ export interface ToolPolicyEntry {
|
|
|
121
121
|
alwaysAvailable: boolean;
|
|
122
122
|
/**
|
|
123
123
|
* Tool-specific settings resolved from the assessment / item
|
|
124
|
-
* settings via the
|
|
124
|
+
* settings via the PNP policy source. Hosts that want to read these
|
|
125
125
|
* directly should use `entry.settings` rather than peeking into
|
|
126
126
|
* the assessment entity from above the engine.
|
|
127
127
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-types.d.ts","sourceRoot":"","sources":["../../../src/policy/core/decision-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,wBAAwB,GACjC,
|
|
1
|
+
{"version":3,"file":"decision-types.d.ts","sourceRoot":"","sources":["../../../src/policy/core/decision-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,KAAK,EAAE,kBAAkB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