@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
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PNP/profile policy input detection (M8 PR 4 — see `.cursor/plans/m8-design.md` F2 and
|
|
3
3
|
* `.cursor/plans/m8-implementation-plan.md` § PR 4).
|
|
4
4
|
*
|
|
5
5
|
* Pure helpers that decide whether the inputs the engine has been given
|
|
6
|
-
* actually carry
|
|
6
|
+
* actually carry PNP/profile policy material. Used by:
|
|
7
7
|
*
|
|
8
8
|
* - {@link ToolPolicyEngine}'s constructor as the auto-default for
|
|
9
|
-
* `
|
|
9
|
+
* `pnpEnforcement` when the host did not pass an explicit `"on"` /
|
|
10
10
|
* `"off"`.
|
|
11
|
-
* - {@link ToolkitCoordinator.
|
|
11
|
+
* - {@link ToolkitCoordinator.resolveEffectivePnpEnforcement} as the
|
|
12
12
|
* auto-mode rule. PR 2 used a coarse "any non-null assessment → on"
|
|
13
13
|
* placeholder; PR 4 narrows it to "assessment OR currentItemRef
|
|
14
|
-
* carries
|
|
14
|
+
* carries profile policy material."
|
|
15
15
|
*
|
|
16
16
|
* The rule is intentionally narrow. Hosts that bind a bare assessment
|
|
17
17
|
* record (only `id` / `name`, no PNP and no settings) get the legacy
|
|
18
|
-
* floating-tools behavior —
|
|
18
|
+
* floating-tools behavior — PNP/profile gates do not engage. The flip happens
|
|
19
19
|
* the moment the assessment carries any of:
|
|
20
20
|
*
|
|
21
21
|
* - `personalNeedsProfile` (any `supports`, `prohibitedSupports`, or
|
|
@@ -28,40 +28,40 @@
|
|
|
28
28
|
* `requiredTools` / `restrictedTools` / `toolParameters`.
|
|
29
29
|
*
|
|
30
30
|
* Hosts opt out of the auto-on behavior by passing
|
|
31
|
-
* `
|
|
32
|
-
* `ToolkitCoordinator.
|
|
31
|
+
* `pnpEnforcement: "off"` explicitly (engine input or
|
|
32
|
+
* `ToolkitCoordinator.setPnpEnforcement("off")`).
|
|
33
33
|
*/
|
|
34
34
|
import type { AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-players-shared/types";
|
|
35
35
|
/**
|
|
36
|
-
* Return `true` when the assessment carries any
|
|
37
|
-
* material that the engine's `
|
|
36
|
+
* Return `true` when the assessment carries any PNP/profile policy
|
|
37
|
+
* material that the engine's `PnpPolicySource` would consume.
|
|
38
38
|
*
|
|
39
39
|
* The check is structural — the presence of a non-empty PNP, district
|
|
40
40
|
* policy, or test administration block is enough; the content does not
|
|
41
41
|
* have to validate against any specific rule.
|
|
42
42
|
*/
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function assessmentHasPnpPolicyInputs(assessment: AssessmentEntity | null | undefined): boolean;
|
|
44
44
|
/**
|
|
45
|
-
* Return `true` when the bound item reference carries item-level
|
|
45
|
+
* Return `true` when the bound item reference carries item-level profile policy
|
|
46
46
|
* material (`requiredTools`, `restrictedTools`, or `toolParameters`).
|
|
47
47
|
*
|
|
48
|
-
* Used in addition to {@link
|
|
49
|
-
* navigates to an item with
|
|
48
|
+
* Used in addition to {@link assessmentHasPnpPolicyInputs} so a host that
|
|
49
|
+
* navigates to an item with profile-relevant settings — without a parent
|
|
50
50
|
* assessment carrying its own PNP/district/test-admin block — still
|
|
51
|
-
* gets
|
|
51
|
+
* gets PNP/profile gates engaged for that item.
|
|
52
52
|
*/
|
|
53
|
-
export declare function
|
|
53
|
+
export declare function itemRefHasPnpPolicyInputs(itemRef: AssessmentItemRef | null | undefined): boolean;
|
|
54
54
|
/**
|
|
55
|
-
* Resolve the default `
|
|
55
|
+
* Resolve the default `pnpEnforcement` mode given the bound inputs.
|
|
56
56
|
*
|
|
57
|
-
* Returns `"on"` when {@link
|
|
58
|
-
* {@link
|
|
57
|
+
* Returns `"on"` when {@link assessmentHasPnpPolicyInputs} or
|
|
58
|
+
* {@link itemRefHasPnpPolicyInputs} reports any profile policy material; otherwise
|
|
59
59
|
* `"off"`. Hosts override the default by passing an explicit
|
|
60
|
-
* `
|
|
61
|
-
* `ToolkitCoordinator.
|
|
60
|
+
* `pnpEnforcement` value (engine input) or by calling
|
|
61
|
+
* `ToolkitCoordinator.setPnpEnforcement("on" | "off")`.
|
|
62
62
|
*/
|
|
63
|
-
export declare function
|
|
63
|
+
export declare function resolveDefaultPnpEnforcement(args: {
|
|
64
64
|
assessment?: AssessmentEntity | null;
|
|
65
65
|
currentItemRef?: AssessmentItemRef | null;
|
|
66
66
|
}): "on" | "off";
|
|
67
|
-
//# sourceMappingURL=
|
|
67
|
+
//# sourceMappingURL=pnp-policy-inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnp-policy-inputs.d.ts","sourceRoot":"","sources":["../../../src/policy/core/pnp-policy-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC3C,UAAU,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC7C,OAAO,CA4DT;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC3C,OAAO,CAuBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IAClD,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrC,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC1C,GAAG,IAAI,GAAG,KAAK,CAIf"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PNP/profile policy input detection (M8 PR 4 — see `.cursor/plans/m8-design.md` F2 and
|
|
3
3
|
* `.cursor/plans/m8-implementation-plan.md` § PR 4).
|
|
4
4
|
*
|
|
5
5
|
* Pure helpers that decide whether the inputs the engine has been given
|
|
6
|
-
* actually carry
|
|
6
|
+
* actually carry PNP/profile policy material. Used by:
|
|
7
7
|
*
|
|
8
8
|
* - {@link ToolPolicyEngine}'s constructor as the auto-default for
|
|
9
|
-
* `
|
|
9
|
+
* `pnpEnforcement` when the host did not pass an explicit `"on"` /
|
|
10
10
|
* `"off"`.
|
|
11
|
-
* - {@link ToolkitCoordinator.
|
|
11
|
+
* - {@link ToolkitCoordinator.resolveEffectivePnpEnforcement} as the
|
|
12
12
|
* auto-mode rule. PR 2 used a coarse "any non-null assessment → on"
|
|
13
13
|
* placeholder; PR 4 narrows it to "assessment OR currentItemRef
|
|
14
|
-
* carries
|
|
14
|
+
* carries profile policy material."
|
|
15
15
|
*
|
|
16
16
|
* The rule is intentionally narrow. Hosts that bind a bare assessment
|
|
17
17
|
* record (only `id` / `name`, no PNP and no settings) get the legacy
|
|
18
|
-
* floating-tools behavior —
|
|
18
|
+
* floating-tools behavior — PNP/profile gates do not engage. The flip happens
|
|
19
19
|
* the moment the assessment carries any of:
|
|
20
20
|
*
|
|
21
21
|
* - `personalNeedsProfile` (any `supports`, `prohibitedSupports`, or
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
* `requiredTools` / `restrictedTools` / `toolParameters`.
|
|
29
29
|
*
|
|
30
30
|
* Hosts opt out of the auto-on behavior by passing
|
|
31
|
-
* `
|
|
32
|
-
* `ToolkitCoordinator.
|
|
31
|
+
* `pnpEnforcement: "off"` explicitly (engine input or
|
|
32
|
+
* `ToolkitCoordinator.setPnpEnforcement("off")`).
|
|
33
33
|
*/
|
|
34
34
|
/**
|
|
35
|
-
* Return `true` when the assessment carries any
|
|
36
|
-
* material that the engine's `
|
|
35
|
+
* Return `true` when the assessment carries any PNP/profile policy
|
|
36
|
+
* material that the engine's `PnpPolicySource` would consume.
|
|
37
37
|
*
|
|
38
38
|
* The check is structural — the presence of a non-empty PNP, district
|
|
39
39
|
* policy, or test administration block is enough; the content does not
|
|
40
40
|
* have to validate against any specific rule.
|
|
41
41
|
*/
|
|
42
|
-
export function
|
|
42
|
+
export function assessmentHasPnpPolicyInputs(assessment) {
|
|
43
43
|
if (!assessment)
|
|
44
44
|
return false;
|
|
45
45
|
const pnp = assessment.personalNeedsProfile;
|
|
@@ -93,15 +93,15 @@ export function assessmentHasQtiInputs(assessment) {
|
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Return `true` when the bound item reference carries item-level
|
|
96
|
+
* Return `true` when the bound item reference carries item-level profile policy
|
|
97
97
|
* material (`requiredTools`, `restrictedTools`, or `toolParameters`).
|
|
98
98
|
*
|
|
99
|
-
* Used in addition to {@link
|
|
100
|
-
* navigates to an item with
|
|
99
|
+
* Used in addition to {@link assessmentHasPnpPolicyInputs} so a host that
|
|
100
|
+
* navigates to an item with profile-relevant settings — without a parent
|
|
101
101
|
* assessment carrying its own PNP/district/test-admin block — still
|
|
102
|
-
* gets
|
|
102
|
+
* gets PNP/profile gates engaged for that item.
|
|
103
103
|
*/
|
|
104
|
-
export function
|
|
104
|
+
export function itemRefHasPnpPolicyInputs(itemRef) {
|
|
105
105
|
const settings = itemRef?.settings;
|
|
106
106
|
if (!settings)
|
|
107
107
|
return false;
|
|
@@ -121,19 +121,19 @@ export function itemRefHasQtiInputs(itemRef) {
|
|
|
121
121
|
return false;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Resolve the default `
|
|
124
|
+
* Resolve the default `pnpEnforcement` mode given the bound inputs.
|
|
125
125
|
*
|
|
126
|
-
* Returns `"on"` when {@link
|
|
127
|
-
* {@link
|
|
126
|
+
* Returns `"on"` when {@link assessmentHasPnpPolicyInputs} or
|
|
127
|
+
* {@link itemRefHasPnpPolicyInputs} reports any profile policy material; otherwise
|
|
128
128
|
* `"off"`. Hosts override the default by passing an explicit
|
|
129
|
-
* `
|
|
130
|
-
* `ToolkitCoordinator.
|
|
129
|
+
* `pnpEnforcement` value (engine input) or by calling
|
|
130
|
+
* `ToolkitCoordinator.setPnpEnforcement("on" | "off")`.
|
|
131
131
|
*/
|
|
132
|
-
export function
|
|
133
|
-
if (
|
|
132
|
+
export function resolveDefaultPnpEnforcement(args) {
|
|
133
|
+
if (assessmentHasPnpPolicyInputs(args.assessment))
|
|
134
134
|
return "on";
|
|
135
|
-
if (
|
|
135
|
+
if (itemRefHasPnpPolicyInputs(args.currentItemRef))
|
|
136
136
|
return "on";
|
|
137
137
|
return "off";
|
|
138
138
|
}
|
|
139
|
-
//# sourceMappingURL=
|
|
139
|
+
//# sourceMappingURL=pnp-policy-inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnp-policy-inputs.js","sourceRoot":"","sources":["../../../src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O,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"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The engine attaches a `PolicySourceTag` to every `ToolPolicyEntry` it
|
|
5
5
|
* emits, capturing every step from `compose-decision.ts` that contributed
|
|
6
|
-
* to the entry being kept (or, in the case of `
|
|
6
|
+
* to the entry being kept (or, in the case of `required-tool-blocked`,
|
|
7
7
|
* the step that surfaced the conflict).
|
|
8
8
|
*
|
|
9
9
|
* Tag vocabulary maps onto the six composition steps in
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* non-`enabled: false` check)
|
|
16
16
|
* 3. Host whitelist → `"policy"`
|
|
17
17
|
* 4. Host blocklist → `"policy"` (negative)
|
|
18
|
-
* 5.
|
|
19
|
-
* `"
|
|
18
|
+
* 5. PNP/profile gates → `"pnp.${rule}"` (e.g. `"pnp.pnp-support"`,
|
|
19
|
+
* `"pnp.item-requirement"`)
|
|
20
20
|
* 6. Custom PolicySources → `"custom.${source.id}"`
|
|
21
21
|
*
|
|
22
22
|
* Negative tags do not appear on surviving entries — they are reflected
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* *removed* one. Diagnostic surfacing of removals is the
|
|
26
26
|
* provenance/diagnostic channel's job.
|
|
27
27
|
*/
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
28
|
+
export type PnpPolicySourceRule = "district-block" | "test-admin-override" | "item-restriction" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-prohibited";
|
|
29
|
+
export type PnpPolicySourceTag = `pnp.${PnpPolicySourceRule}`;
|
|
30
30
|
export type CustomPolicySourceTag = `custom.${string}`;
|
|
31
|
-
export type PolicySourceTag = "placement" | "policy" | "provider" |
|
|
31
|
+
export type PolicySourceTag = "placement" | "policy" | "provider" | PnpPolicySourceTag | CustomPolicySourceTag;
|
|
32
32
|
//# sourceMappingURL=policy-source-tag.d.ts.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The engine attaches a `PolicySourceTag` to every `ToolPolicyEntry` it
|
|
5
5
|
* emits, capturing every step from `compose-decision.ts` that contributed
|
|
6
|
-
* to the entry being kept (or, in the case of `
|
|
6
|
+
* to the entry being kept (or, in the case of `required-tool-blocked`,
|
|
7
7
|
* the step that surfaced the conflict).
|
|
8
8
|
*
|
|
9
9
|
* Tag vocabulary maps onto the six composition steps in
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* non-`enabled: false` check)
|
|
16
16
|
* 3. Host whitelist → `"policy"`
|
|
17
17
|
* 4. Host blocklist → `"policy"` (negative)
|
|
18
|
-
* 5.
|
|
19
|
-
* `"
|
|
18
|
+
* 5. PNP/profile gates → `"pnp.${rule}"` (e.g. `"pnp.pnp-support"`,
|
|
19
|
+
* `"pnp.item-requirement"`)
|
|
20
20
|
* 6. Custom PolicySources → `"custom.${source.id}"`
|
|
21
21
|
*
|
|
22
22
|
* Negative tags do not appear on surviving entries — they are reflected
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Today's `PnpResolutionProvenance` (in `services/pnp-provenance.ts`)
|
|
6
6
|
* tracks decisions made by `PnpToolResolver` only. M8 generalizes the
|
|
7
7
|
* shape to track decisions from every Pass-1 contributor — host
|
|
8
|
-
* placement, host policy, provider veto,
|
|
8
|
+
* placement, host policy, provider veto, PNP/profile gates, and custom policy
|
|
9
9
|
* sources — without losing PNP debugger compatibility.
|
|
10
10
|
*
|
|
11
11
|
* **Compatibility posture.** This module is the new home of the shape;
|
|
@@ -15,30 +15,30 @@
|
|
|
15
15
|
* fields (`contextId`, `resolvedAt`, `sources`, `features`,
|
|
16
16
|
* `decisionLog`, `summary`) are preserved verbatim. The rule
|
|
17
17
|
* vocabulary expands, and `ResolutionDecision.precedence` widens from
|
|
18
|
-
* `1 | 2 | 3 | 4 | 5 | 6` to a `number` so non-
|
|
19
|
-
* (the
|
|
18
|
+
* `1 | 2 | 3 | 4 | 5 | 6` to a `number` so non-profile rules can fit
|
|
19
|
+
* (the PNP/profile rules continue to use `1`–`6` exactly as before).
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* Expanded rule vocabulary for `ResolutionDecision.rule` in M8.
|
|
23
23
|
*
|
|
24
24
|
* The first six values map 1:1 onto `PnpResolutionProvenance`'s
|
|
25
|
-
* existing rule names (the
|
|
25
|
+
* existing rule names (the PNP/profile precedence ladder). The remaining
|
|
26
26
|
* values capture the new contributors the M8 engine surfaces:
|
|
27
27
|
* placement membership (step 1), provider veto (step 2), host policy
|
|
28
|
-
* (steps 3 / 4), the
|
|
28
|
+
* (steps 3 / 4), the required-tool conflict diagnostic (`required-tool-blocked`),
|
|
29
29
|
* custom sources (step 6), and the catch-all `system-default` for the
|
|
30
30
|
* "not configured at any level" fallback.
|
|
31
31
|
*/
|
|
32
|
-
export type ToolPolicyDecisionRule = "district-block" | "test-admin-override" | "item-restriction" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-prohibited" | "placement-membership" | "provider-disabled" | "host-allowlist" | "host-blocked" | "
|
|
32
|
+
export type ToolPolicyDecisionRule = "district-block" | "test-admin-override" | "item-restriction" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-prohibited" | "placement-membership" | "provider-disabled" | "host-allowlist" | "host-blocked" | "required-tool-blocked" | "custom-source" | "system-default";
|
|
33
33
|
export type ToolPolicySourceType = "organization" | "assessment" | "section" | "item" | "student" | "system" | "host" | "custom";
|
|
34
34
|
export interface ToolPolicyResolutionDecision {
|
|
35
35
|
/** Monotonic step index across the entire decision log. */
|
|
36
36
|
step: number;
|
|
37
37
|
/**
|
|
38
|
-
* Precedence level.
|
|
39
|
-
* `PnpResolutionProvenance`. Non-
|
|
40
|
-
* gates that always fire before
|
|
41
|
-
* fire after
|
|
38
|
+
* Precedence level. PNP/profile rules use `1`–`6` exactly as in today's
|
|
39
|
+
* `PnpResolutionProvenance`. Non-profile rules use `0` (host-side
|
|
40
|
+
* gates that always fire before PNP/profile policy) or `7+` (custom sources that
|
|
41
|
+
* fire after PNP/profile policy).
|
|
42
42
|
*/
|
|
43
43
|
precedence: number;
|
|
44
44
|
rule: ToolPolicyDecisionRule;
|
|
@@ -140,7 +140,7 @@ export declare class ToolPolicyProvenanceBuilder {
|
|
|
140
140
|
* highest-precedence non-skip decision per feature, but a tool's
|
|
141
141
|
* *actual* visibility is only known after step 6 of the
|
|
142
142
|
* composition pipeline — earlier decisions can be reversed by
|
|
143
|
-
* later host gates,
|
|
143
|
+
* later host gates, PNP/profile gates, or custom sources. This method
|
|
144
144
|
* walks every feature trail and rewrites `finalState` from the
|
|
145
145
|
* final candidate set so callers can rely on
|
|
146
146
|
* `provenance.features.get(toolId)?.finalState` as the canonical
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../../src/policy/core/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,sBAAsB,GAC/B,gBAAgB,GAChB,qBAAqB,GACrB,kBA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AC;QACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,CAAC;CACF;AAED,UAAU,iBAAiB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IAC/C,UAAU,EAAE,oBAAoB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,qBAAa,2BAA2B;IACvC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,WAAW,CAAK;gBAEZ,SAAS,EAAE,MAAM;IAkB7B,SAAS,CACR,IAAI,EAAE,MAAM,oBAAoB,CAAC,SAAS,CAAC,EAC3C,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GACnD,IAAI;IAkCP,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAuD5C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAAoB,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI;IAmC7D,KAAK,IAAI,oBAAoB;CAgB7B"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Today's `PnpResolutionProvenance` (in `services/pnp-provenance.ts`)
|
|
6
6
|
* tracks decisions made by `PnpToolResolver` only. M8 generalizes the
|
|
7
7
|
* shape to track decisions from every Pass-1 contributor — host
|
|
8
|
-
* placement, host policy, provider veto,
|
|
8
|
+
* placement, host policy, provider veto, PNP/profile gates, and custom policy
|
|
9
9
|
* sources — without losing PNP debugger compatibility.
|
|
10
10
|
*
|
|
11
11
|
* **Compatibility posture.** This module is the new home of the shape;
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* fields (`contextId`, `resolvedAt`, `sources`, `features`,
|
|
16
16
|
* `decisionLog`, `summary`) are preserved verbatim. The rule
|
|
17
17
|
* vocabulary expands, and `ResolutionDecision.precedence` widens from
|
|
18
|
-
* `1 | 2 | 3 | 4 | 5 | 6` to a `number` so non-
|
|
19
|
-
* (the
|
|
18
|
+
* `1 | 2 | 3 | 4 | 5 | 6` to a `number` so non-profile rules can fit
|
|
19
|
+
* (the PNP/profile rules continue to use `1`–`6` exactly as before).
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* Builder mirroring `PnpProvenanceBuilder` but emitting the expanded
|
|
@@ -134,7 +134,7 @@ export class ToolPolicyProvenanceBuilder {
|
|
|
134
134
|
* highest-precedence non-skip decision per feature, but a tool's
|
|
135
135
|
* *actual* visibility is only known after step 6 of the
|
|
136
136
|
* composition pipeline — earlier decisions can be reversed by
|
|
137
|
-
* later host gates,
|
|
137
|
+
* later host gates, PNP/profile gates, or custom sources. This method
|
|
138
138
|
* walks every feature trail and rewrites `finalState` from the
|
|
139
139
|
* final candidate set so callers can rely on
|
|
140
140
|
* `provenance.features.get(toolId)?.finalState` as the canonical
|
package/dist/policy/engine.d.ts
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* **Pairing.** This module is the stable counterpart to
|
|
10
10
|
* `./policy/internal`, which exposes the wider, evolving surface
|
|
11
|
-
* (composition pipeline, provenance builder,
|
|
11
|
+
* (composition pipeline, provenance builder, PNP policy source). Consumers
|
|
12
12
|
* that only need to drive an engine and read its decisions should
|
|
13
13
|
* import from here. Consumers that need to reach past the facade
|
|
14
|
-
* (e.g. test the composition pipeline directly, build a custom
|
|
14
|
+
* (e.g. test the composition pipeline directly, build a custom PNP policy
|
|
15
15
|
* source variant, instrument provenance generation) should import
|
|
16
16
|
* from `./policy/internal` and accept the documented stability
|
|
17
17
|
* disclaimer there.
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* Mirrors the M7 `runtime/engine` / `runtime/internal` split — see
|
|
20
20
|
* the same rationale in `src/runtime/engine.ts`.
|
|
21
21
|
*/
|
|
22
|
-
export { ToolPolicyEngine, type
|
|
22
|
+
export { ToolPolicyEngine, type PnpEnforcementMode, type ResolvedEngineInputs, type ToolPolicyChangeEvent, type ToolPolicyChangeListener, type ToolPolicyEngineArgs, type ToolPolicyEngineInputs, } from "./core/ToolPolicyEngine.js";
|
|
23
23
|
export { TOOL_POLICY_ENGINE_KEY, type ToolPolicyEngineContext, } from "./core/engine-context.js";
|
|
24
|
-
export type {
|
|
24
|
+
export type { RequiredToolBlockedDetails, ToolPolicyDecision, ToolPolicyDecisionRequest, ToolPolicyDiagnostic, ToolPolicyDiagnosticCode, ToolPolicyEntry, ToolPolicyHostGate, ToolScope, } from "./core/decision-types.js";
|
|
25
25
|
export type { PolicySource, PolicySourceDecisionContext, PolicySourceProvenanceEntry, PolicySourceResult, } from "./core/PolicySource.js";
|
|
26
|
-
export type { PolicySourceTag,
|
|
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
28
|
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,sBAAsB,EACtB,KAAK,uBAAuB,GAC5B,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACX,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,sBAAsB,EACtB,KAAK,uBAAuB,GAC5B,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACX,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAClB,SAAS,GACT,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACX,YAAY,EACZ,2BAA2B,EAC3B,2BAA2B,EAC3B,kBAAkB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACX,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,GACrB,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACX,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,GACpB,MAAM,sBAAsB,CAAC"}
|
package/dist/policy/engine.js
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* **Pairing.** This module is the stable counterpart to
|
|
10
10
|
* `./policy/internal`, which exposes the wider, evolving surface
|
|
11
|
-
* (composition pipeline, provenance builder,
|
|
11
|
+
* (composition pipeline, provenance builder, PNP policy source). Consumers
|
|
12
12
|
* that only need to drive an engine and read its decisions should
|
|
13
13
|
* import from here. Consumers that need to reach past the facade
|
|
14
|
-
* (e.g. test the composition pipeline directly, build a custom
|
|
14
|
+
* (e.g. test the composition pipeline directly, build a custom PNP policy
|
|
15
15
|
* source variant, instrument provenance generation) should import
|
|
16
16
|
* from `./policy/internal` and accept the documented stability
|
|
17
17
|
* disclaimer there.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool policy engine — **internal** entry point (M8 PR 1).
|
|
3
3
|
*
|
|
4
|
-
* Re-exports the composition pipeline, the
|
|
4
|
+
* Re-exports the composition pipeline, the PNP policy source, and the
|
|
5
5
|
* provenance builder for advanced hosts that want to drive the engine
|
|
6
6
|
* components directly, and for the engine's own tests.
|
|
7
7
|
*
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* - `./policy/engine` — narrow, stable facade for common host
|
|
16
16
|
* wiring and Svelte context.
|
|
17
17
|
* - `./policy/internal` — wide, evolving surface for the
|
|
18
|
-
* composition pipeline,
|
|
18
|
+
* composition pipeline, PNP policy source, and
|
|
19
19
|
* any host that wants to reach past the
|
|
20
20
|
* facade.
|
|
21
21
|
*/
|
|
22
22
|
export { composeDecision, type ComposeDecisionInputs, } from "./core/compose-decision.js";
|
|
23
|
-
export {
|
|
23
|
+
export { PnpPolicySource, type PnpPolicyApplyArgs, type PnpPolicyDecisionEvent, type PnpPolicyResult, type PnpPolicyToolFlags, } from "./sources/PnpPolicySource.js";
|
|
24
24
|
export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
|
|
25
|
-
export {
|
|
25
|
+
export { assessmentHasPnpPolicyInputs, itemRefHasPnpPolicyInputs, resolveDefaultPnpEnforcement, } from "./core/pnp-policy-inputs.js";
|
|
26
26
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +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,
|
|
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,kBAAkB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EACN,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC"}
|
package/dist/policy/internal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool policy engine — **internal** entry point (M8 PR 1).
|
|
3
3
|
*
|
|
4
|
-
* Re-exports the composition pipeline, the
|
|
4
|
+
* Re-exports the composition pipeline, the PNP policy source, and the
|
|
5
5
|
* provenance builder for advanced hosts that want to drive the engine
|
|
6
6
|
* components directly, and for the engine's own tests.
|
|
7
7
|
*
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* - `./policy/engine` — narrow, stable facade for common host
|
|
16
16
|
* wiring and Svelte context.
|
|
17
17
|
* - `./policy/internal` — wide, evolving surface for the
|
|
18
|
-
* composition pipeline,
|
|
18
|
+
* composition pipeline, PNP policy source, and
|
|
19
19
|
* any host that wants to reach past the
|
|
20
20
|
* facade.
|
|
21
21
|
*/
|
|
22
22
|
export { composeDecision, } from "./core/compose-decision.js";
|
|
23
|
-
export {
|
|
23
|
+
export { PnpPolicySource, } from "./sources/PnpPolicySource.js";
|
|
24
24
|
export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
|
|
25
|
-
export {
|
|
25
|
+
export { assessmentHasPnpPolicyInputs, itemRefHasPnpPolicyInputs, resolveDefaultPnpEnforcement, } from "./core/pnp-policy-inputs.js";
|
|
26
26
|
//# sourceMappingURL=internal.js.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,
|
|
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,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PNP Policy Source — refactor of `PnpToolResolver` for the M8 engine
|
|
3
3
|
* (see `.cursor/plans/m8-design.md` § 3 step 5 and § 5 §).
|
|
4
4
|
*
|
|
5
|
-
* This source applies the
|
|
6
|
-
* `PnpToolResolver` but exposes them as a `(candidates,
|
|
5
|
+
* This source applies the PNP/profile precedence rules used by today's
|
|
6
|
+
* `PnpToolResolver` but exposes them as a `(candidates, pnpPolicyInputs) →
|
|
7
7
|
* (refinedCandidates, perToolFlags, mandates, decisions)` function the
|
|
8
8
|
* engine can call once per `decide(...)` request, with all results
|
|
9
9
|
* routed through the unified `ToolPolicyProvenanceBuilder`.
|
|
@@ -12,29 +12,29 @@
|
|
|
12
12
|
* it.** PR 1 introduces the engine without callers; the legacy
|
|
13
13
|
* `PnpToolResolver` is still in active use by `<pie-item-toolbar>`
|
|
14
14
|
* and by external tests. PR 5 deletes the legacy class once the
|
|
15
|
-
* toolbar (PR 3) and the
|
|
15
|
+
* toolbar (PR 3) and the PNP default flip (PR 4) have landed and the
|
|
16
16
|
* caller list is empty. Until then this source is the *canonical*
|
|
17
17
|
* implementation and the legacy class is the deprecated mirror.
|
|
18
18
|
*/
|
|
19
19
|
import type { AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-players-shared/types";
|
|
20
20
|
import type { ToolRegistry } from "../../services/ToolRegistry.js";
|
|
21
21
|
import type { ToolPolicyResolutionDecision, ToolPolicySourceType } from "../core/provenance.js";
|
|
22
|
-
import type {
|
|
23
|
-
/** Per-tool flags
|
|
24
|
-
export interface
|
|
25
|
-
/**
|
|
22
|
+
import type { PnpPolicySourceRule } from "../core/policy-source-tag.js";
|
|
23
|
+
/** Per-tool flags PNP/profile policy may attach to a surviving entry. */
|
|
24
|
+
export interface PnpPolicyToolFlags {
|
|
25
|
+
/** PNP/profile policy mandates this tool (item or district `requiredTools`). */
|
|
26
26
|
required: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/** Student PNP marks this tool as a support (host UI cannot toggle off). */
|
|
28
28
|
alwaysAvailable: boolean;
|
|
29
29
|
/** Tool-specific settings derived from item / assessment settings. */
|
|
30
30
|
settings?: unknown;
|
|
31
|
-
/** Which
|
|
32
|
-
rule:
|
|
31
|
+
/** Which PNP/profile rule contributed the surviving verdict. */
|
|
32
|
+
rule: PnpPolicySourceRule;
|
|
33
33
|
/** Source attribution for `ToolPolicyEntry.sources`. */
|
|
34
34
|
sourceType: ToolPolicySourceType;
|
|
35
35
|
}
|
|
36
|
-
export interface
|
|
37
|
-
assessment
|
|
36
|
+
export interface PnpPolicyApplyArgs {
|
|
37
|
+
assessment?: AssessmentEntity | null;
|
|
38
38
|
currentItemRef?: AssessmentItemRef;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -42,7 +42,7 @@ export interface QtiPolicyApplyArgs {
|
|
|
42
42
|
* here so the source has a single allocation pattern and the engine
|
|
43
43
|
* keeps a uniform `addDecision(...)` shape.
|
|
44
44
|
*/
|
|
45
|
-
export interface
|
|
45
|
+
export interface PnpPolicyDecisionEvent {
|
|
46
46
|
precedence: 1 | 2 | 3 | 4 | 5 | 6;
|
|
47
47
|
rule: "district-block" | "test-admin-override" | "item-restriction" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-prohibited";
|
|
48
48
|
featureId: string;
|
|
@@ -51,28 +51,28 @@ export interface QtiPolicyDecisionEvent {
|
|
|
51
51
|
reason: string;
|
|
52
52
|
value?: unknown;
|
|
53
53
|
}
|
|
54
|
-
export interface
|
|
54
|
+
export interface PnpPolicyResult {
|
|
55
55
|
/**
|
|
56
|
-
* Tool IDs
|
|
56
|
+
* Tool IDs PNP/profile policy explicitly blocked. Engine removes these from the
|
|
57
57
|
* candidate set in step 5.
|
|
58
58
|
*/
|
|
59
59
|
blockedToolIds: Set<string>;
|
|
60
60
|
/**
|
|
61
|
-
* Tool IDs
|
|
62
|
-
* by the engine to detect `tool-policy.
|
|
61
|
+
* Tool IDs PNP/profile policy mandates (item or district `requiredTools`). Used
|
|
62
|
+
* by the engine to detect `tool-policy.requiredToolBlocked`
|
|
63
63
|
* diagnostics for tools removed by host policy.
|
|
64
64
|
*/
|
|
65
65
|
mandatedToolIds: Set<string>;
|
|
66
66
|
/**
|
|
67
67
|
* Per-tool flags merged into surviving `ToolPolicyEntry`s.
|
|
68
68
|
*/
|
|
69
|
-
perToolFlags: Map<string,
|
|
69
|
+
perToolFlags: Map<string, PnpPolicyToolFlags>;
|
|
70
70
|
/**
|
|
71
71
|
* Decision log entries the engine must record. Order matches the
|
|
72
72
|
* order rules fired internally (highest precedence first per
|
|
73
73
|
* support id).
|
|
74
74
|
*/
|
|
75
|
-
decisions:
|
|
75
|
+
decisions: PnpPolicyDecisionEvent[];
|
|
76
76
|
/** Configuration sources the engine should attach to its provenance. */
|
|
77
77
|
sources: {
|
|
78
78
|
assessment?: {
|
|
@@ -92,11 +92,11 @@ export interface QtiPolicyResult {
|
|
|
92
92
|
};
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
export declare class
|
|
96
|
-
readonly id = "
|
|
95
|
+
export declare class PnpPolicySource {
|
|
96
|
+
readonly id = "pnp";
|
|
97
97
|
private readonly toolRegistry;
|
|
98
98
|
constructor(toolRegistry: ToolRegistry);
|
|
99
|
-
apply(args:
|
|
99
|
+
apply(args: PnpPolicyApplyArgs): PnpPolicyResult;
|
|
100
100
|
private resolveSupport;
|
|
101
101
|
/**
|
|
102
102
|
* Map a QTI / PNP support id (e.g. `"calculator-basic"`) to the
|
|
@@ -123,7 +123,7 @@ export declare class QtiPolicySource {
|
|
|
123
123
|
* losing them in policy evaluation.
|
|
124
124
|
*
|
|
125
125
|
* The legacy `PnpToolResolver.resolveTool` had the same behavior;
|
|
126
|
-
* see `tests/policy/
|
|
126
|
+
* see `tests/policy/PnpPolicySource.test.ts` for the regression
|
|
127
127
|
* lock.
|
|
128
128
|
*/
|
|
129
129
|
private mapSupportToToolId;
|
|
@@ -143,4 +143,4 @@ export declare class QtiPolicySource {
|
|
|
143
143
|
*/
|
|
144
144
|
private resolveToolSettings;
|
|
145
145
|
}
|
|
146
|
-
//# sourceMappingURL=
|
|
146
|
+
//# sourceMappingURL=PnpPolicySource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PnpPolicySource.d.ts","sourceRoot":"","sources":["../../../src/policy/sources/PnpPolicySource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,K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