@pie-players/pie-assessment-toolkit 0.3.75 → 1.0.0-beta.0

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 (142) hide show
  1. package/README.md +449 -541
  2. package/custom-elements.json +1315 -0
  3. package/dist/attempt/TestSession.d.ts +0 -1
  4. package/dist/attempt/TestSession.js +10 -5
  5. package/dist/components/ItemScope.custom-element.js +1 -1
  6. package/dist/components/ItemToolBar.custom-element.js +1 -1
  7. package/dist/components/PieAssessmentToolkit.custom-element.js +8 -8
  8. package/dist/components/SectionToolBar.custom-element.js +1 -1
  9. package/dist/components/chunks/{ItemToolBar-7tt7v2xp.js → ItemToolBar-3zrc4p3d.js} +4 -4
  10. package/dist/components/chunks/{ItemToolBar-jx38w99s.js → ItemToolBar-66hcwmfw.js} +2 -2
  11. package/dist/components/chunks/ItemToolBar-9gqhfxtn.js +40 -0
  12. package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +2 -0
  13. package/dist/components/chunks/{ItemToolBar-97hx60z4.js → ItemToolBar-kkj69ptr.js} +1 -1
  14. package/dist/components/chunks/sre-engine-bj997w4b.js +1 -0
  15. package/dist/context/assessment-toolkit-context.d.ts +6 -0
  16. package/dist/index.d.ts +7 -7
  17. package/dist/index.js +4 -10
  18. package/dist/policy/core/PolicySource.d.ts +1 -1
  19. package/dist/policy/core/ToolPolicyEngine.d.ts +46 -7
  20. package/dist/policy/core/ToolPolicyEngine.js +73 -16
  21. package/dist/policy/core/compose-decision.d.ts +3 -3
  22. package/dist/policy/core/compose-decision.js +30 -30
  23. package/dist/policy/core/decision-types.d.ts +44 -32
  24. package/dist/policy/core/feature-decision.d.ts +17 -15
  25. package/dist/policy/core/feature-decision.js +11 -13
  26. package/dist/policy/core/pnp-policy-inputs.d.ts +5 -2
  27. package/dist/policy/core/pnp-policy-inputs.js +12 -32
  28. package/dist/policy/core/provenance.d.ts +1 -1
  29. package/dist/policy/core/tool-parameters.d.ts +11 -0
  30. package/dist/policy/core/tool-parameters.js +15 -0
  31. package/dist/policy/engine.d.ts +1 -1
  32. package/dist/policy/sources/PnpPolicySource.d.ts +14 -22
  33. package/dist/policy/sources/PnpPolicySource.js +30 -28
  34. package/dist/runtime/SectionControllerBinding.d.ts +6 -2
  35. package/dist/runtime/SectionControllerBinding.js +21 -15
  36. package/dist/runtime/adapter/subscriber-fanout.d.ts +0 -1
  37. package/dist/runtime/adapter/subscriber-fanout.js +1 -4
  38. package/dist/runtime/composition-emit-scheduler.d.ts +3 -3
  39. package/dist/runtime/composition-emit-scheduler.js +1 -1
  40. package/dist/runtime/content-region.d.ts +0 -4
  41. package/dist/runtime/content-region.js +2 -2
  42. package/dist/runtime/core/SectionEngineCore.d.ts +0 -2
  43. package/dist/runtime/core/SectionEngineCore.js +0 -4
  44. package/dist/runtime/core/cohort.d.ts +0 -5
  45. package/dist/runtime/core/cohort.js +0 -9
  46. package/dist/runtime/core/engine-output.d.ts +3 -2
  47. package/dist/runtime/core/engine-transition.js +3 -2
  48. package/dist/runtime/registration-events.d.ts +11 -14
  49. package/dist/runtime/runtime-id.d.ts +1 -1
  50. package/dist/runtime/runtime-id.js +1 -1
  51. package/dist/runtime/shell-scope.d.ts +4 -4
  52. package/dist/runtime/shell-scope.js +15 -9
  53. package/dist/runtime/tool-host-contract.d.ts +0 -4
  54. package/dist/runtime/tool-host-contract.js +1 -1
  55. package/dist/services/AccessibilityCatalogResolver.d.ts +21 -31
  56. package/dist/services/AccessibilityCatalogResolver.js +29 -42
  57. package/dist/services/ElementToolStateStore.d.ts +32 -61
  58. package/dist/services/ElementToolStateStore.js +37 -67
  59. package/dist/services/HighlightCoordinator.d.ts +9 -21
  60. package/dist/services/HighlightCoordinator.js +52 -80
  61. package/dist/services/RangeSerializer.d.ts +4 -35
  62. package/dist/services/RangeSerializer.js +4 -48
  63. package/dist/services/SSMLExtractor.d.ts +8 -31
  64. package/dist/services/SSMLExtractor.js +18 -40
  65. package/dist/services/TTSService.d.ts +49 -56
  66. package/dist/services/TTSService.js +308 -283
  67. package/dist/services/ToolCoordinator.d.ts +6 -49
  68. package/dist/services/ToolCoordinator.js +25 -61
  69. package/dist/services/ToolRegistry.d.ts +82 -80
  70. package/dist/services/ToolRegistry.js +91 -67
  71. package/dist/services/ToolkitCoordinator.d.ts +83 -81
  72. package/dist/services/ToolkitCoordinator.js +186 -174
  73. package/dist/services/framework-error.d.ts +30 -7
  74. package/dist/services/framework-error.js +10 -13
  75. package/dist/services/interfaces.d.ts +47 -71
  76. package/dist/services/section-controller-types.d.ts +7 -7
  77. package/dist/services/section-session-assignment.js +6 -8
  78. package/dist/services/spoken-audio-cards.d.ts +2 -4
  79. package/dist/services/spoken-audio-cards.js +2 -4
  80. package/dist/services/tool-config-validation.d.ts +5 -7
  81. package/dist/services/tool-config-validation.js +11 -26
  82. package/dist/services/tool-context.d.ts +7 -23
  83. package/dist/services/tool-context.js +99 -53
  84. package/dist/services/tool-failure.d.ts +30 -0
  85. package/dist/services/tool-failure.js +11 -0
  86. package/dist/services/tool-icons.d.ts +1 -2
  87. package/dist/services/tool-icons.js +2 -2
  88. package/dist/services/tool-instance-id.d.ts +8 -6
  89. package/dist/services/tool-instance-id.js +12 -18
  90. package/dist/services/tool-providers/TTSToolProvider.d.ts +6 -43
  91. package/dist/services/tool-providers/TTSToolProvider.js +7 -63
  92. package/dist/services/tool-providers/ToolProviderApi.d.ts +0 -7
  93. package/dist/services/tool-providers/ToolProviderRegistry.d.ts +7 -42
  94. package/dist/services/tool-providers/ToolProviderRegistry.js +21 -63
  95. package/dist/services/tool-request.d.ts +4 -0
  96. package/dist/services/tool-request.js +7 -2
  97. package/dist/services/toolbar-decided-tools.d.ts +1 -0
  98. package/dist/services/toolbar-decided-tools.js +1 -0
  99. package/dist/services/toolbar-items.js +2 -5
  100. package/dist/services/tools-config-normalizer.d.ts +18 -9
  101. package/dist/services/tools-config-normalizer.js +25 -19
  102. package/dist/services/tts/browser-provider.d.ts +2 -5
  103. package/dist/services/tts/browser-provider.js +4 -20
  104. package/dist/services/tts/catalog-span-alignment.js +14 -7
  105. package/dist/services/tts/flat-tree.d.ts +0 -7
  106. package/dist/services/tts/flat-tree.js +2 -2
  107. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +2 -2
  108. package/dist/services/tts/generated-speech/index.d.ts +1 -1
  109. package/dist/services/tts/generated-speech/index.js +1 -1
  110. package/dist/services/tts/generated-speech/types.d.ts +1 -1
  111. package/dist/services/tts/generated-speech/types.js +1 -1
  112. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +10 -12
  113. package/dist/services/tts/highlight-target-resolver.d.ts +12 -0
  114. package/dist/services/tts/math-aware-text-processing.js +10 -29
  115. package/dist/services/tts/math-speech.d.ts +1 -1
  116. package/dist/services/tts/math-speech.js +3 -0
  117. package/dist/services/tts/mathml-sanitization.d.ts +7 -0
  118. package/dist/services/tts/mathml-sanitization.js +9 -1
  119. package/dist/services/tts/provider-options.d.ts +12 -1
  120. package/dist/services/tts/ssml/spoken-text.js +1 -1
  121. package/dist/services/tts/start-failure.d.ts +0 -7
  122. package/dist/services/tts/start-failure.js +1 -1
  123. package/dist/services/tts/text-segmentation.d.ts +5 -0
  124. package/dist/services/tts/text-segmentation.js +13 -10
  125. package/dist/services/tts-runtime-config.d.ts +32 -12
  126. package/dist/services/tts-runtime-config.js +14 -20
  127. package/dist/tools/content-capability-resolution.d.ts +2 -2
  128. package/dist/tools/registration.d.ts +6 -5
  129. package/dist/tools/registration.js +10 -9
  130. package/dist/tools/registrations/toolbar-registration-helpers.d.ts +6 -0
  131. package/dist/tools/registrations/toolbar-registration-helpers.js +6 -0
  132. package/dist/tools/tool-surface-host.js +1 -8
  133. package/package.json +8 -6
  134. package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +0 -2
  135. package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +0 -40
  136. package/dist/components/chunks/sre-engine-jd8cc08x.js +0 -1
  137. package/dist/services/ContextVariableStore.d.ts +0 -113
  138. package/dist/services/ContextVariableStore.js +0 -206
  139. package/dist/services/tts-control-events.d.ts +0 -13
  140. package/dist/services/tts-control-events.js +0 -7
  141. package/dist/utils/logger.d.ts +0 -6
  142. package/dist/utils/logger.js +0 -10
@@ -1 +0,0 @@
1
- import{na as v}from"./ItemToolBar-jx38w99s.js";import"./ItemToolBar-97hx60z4.js";import*as q from"speech-rule-engine";var x=q.default??q;x.setupEngine(v());var B=x;export{B as default};
@@ -1,113 +0,0 @@
1
- /**
2
- * Context Variable Store
3
- *
4
- * Standalone service for managing QTI 3.0 context variables.
5
- * Context variables are global assessment-level variables that can be
6
- * shared across items.
7
- *
8
- * Can be used independently by any assessment player without requiring
9
- * the full AssessmentPlayer.
10
- *
11
- * Part of PIE Assessment Toolkit.
12
- */
13
- import type { ContextDeclaration } from "@pie-players/pie-players-shared/types";
14
- /**
15
- * Standalone service for managing QTI 3.0 context variables.
16
- *
17
- * Context variables are global assessment-level variables that can be
18
- * shared across items. Can be used independently by any assessment player.
19
- *
20
- * @example
21
- * ```typescript
22
- * // Initialize with declarations
23
- * const store = new ContextVariableStore(declarations);
24
- *
25
- * // Get/set variables
26
- * const seed = store.get('RANDOM_SEED');
27
- * store.set('DIFFICULTY_LEVEL', 'hard');
28
- *
29
- * // Pass to items
30
- * const context = store.toObject();
31
- * await renderItem(item, session, context);
32
- *
33
- * // Persist in session
34
- * session.contextVariables = store.toObject();
35
- * ```
36
- */
37
- export declare class ContextVariableStore {
38
- private variables;
39
- private declarations;
40
- /**
41
- * Initialize store with context declarations from assessment
42
- *
43
- * @param declarations QTI 3.0 context declarations
44
- */
45
- constructor(declarations?: ContextDeclaration[]);
46
- /**
47
- * Initialize context variables from declarations
48
- *
49
- * Sets each variable to its defaultValue or type-appropriate default.
50
- */
51
- initialize(declarations: ContextDeclaration[]): void;
52
- /**
53
- * Get context variable value
54
- *
55
- * @param identifier Variable identifier
56
- * @returns Variable value or undefined if not found
57
- */
58
- get(identifier: string): any;
59
- /**
60
- * Set context variable value
61
- *
62
- * @param identifier Variable identifier
63
- * @param value New value
64
- */
65
- set(identifier: string, value: any): void;
66
- /**
67
- * Check if variable exists
68
- */
69
- has(identifier: string): boolean;
70
- /**
71
- * Get all variable names
72
- */
73
- getIdentifiers(): string[];
74
- /**
75
- * Get all variables as object (for passing to PIE elements)
76
- *
77
- * @returns Plain object with all context variables
78
- */
79
- toObject(): Record<string, any>;
80
- /**
81
- * Load state from serialized object (for session restore)
82
- *
83
- * @param state Object containing context variable values
84
- */
85
- fromObject(state: Record<string, any>): void;
86
- /**
87
- * Clear all variables (reset to defaults)
88
- */
89
- reset(): void;
90
- /**
91
- * Get declaration for variable
92
- *
93
- * @param identifier Variable identifier
94
- * @returns Declaration or undefined if not found
95
- */
96
- getDeclaration(identifier: string): ContextDeclaration | undefined;
97
- /**
98
- * Get all declarations
99
- */
100
- getDeclarations(): ContextDeclaration[];
101
- /**
102
- * Get default value for QTI base type
103
- *
104
- * @private
105
- */
106
- private getDefaultValueForType;
107
- /**
108
- * Validate value matches declared type (basic validation)
109
- *
110
- * @private
111
- */
112
- private validateValue;
113
- }
@@ -1,206 +0,0 @@
1
- /**
2
- * Context Variable Store
3
- *
4
- * Standalone service for managing QTI 3.0 context variables.
5
- * Context variables are global assessment-level variables that can be
6
- * shared across items.
7
- *
8
- * Can be used independently by any assessment player without requiring
9
- * the full AssessmentPlayer.
10
- *
11
- * Part of PIE Assessment Toolkit.
12
- */
13
- /**
14
- * Standalone service for managing QTI 3.0 context variables.
15
- *
16
- * Context variables are global assessment-level variables that can be
17
- * shared across items. Can be used independently by any assessment player.
18
- *
19
- * @example
20
- * ```typescript
21
- * // Initialize with declarations
22
- * const store = new ContextVariableStore(declarations);
23
- *
24
- * // Get/set variables
25
- * const seed = store.get('RANDOM_SEED');
26
- * store.set('DIFFICULTY_LEVEL', 'hard');
27
- *
28
- * // Pass to items
29
- * const context = store.toObject();
30
- * await renderItem(item, session, context);
31
- *
32
- * // Persist in session
33
- * session.contextVariables = store.toObject();
34
- * ```
35
- */
36
- export class ContextVariableStore {
37
- variables = new Map();
38
- declarations = new Map();
39
- /**
40
- * Initialize store with context declarations from assessment
41
- *
42
- * @param declarations QTI 3.0 context declarations
43
- */
44
- constructor(declarations) {
45
- if (declarations) {
46
- this.initialize(declarations);
47
- }
48
- }
49
- /**
50
- * Initialize context variables from declarations
51
- *
52
- * Sets each variable to its defaultValue or type-appropriate default.
53
- */
54
- initialize(declarations) {
55
- this.declarations.clear();
56
- this.variables.clear();
57
- for (const decl of declarations) {
58
- this.declarations.set(decl.identifier, decl);
59
- const value = decl.defaultValue ??
60
- this.getDefaultValueForType(decl.baseType, decl.cardinality);
61
- this.variables.set(decl.identifier, value);
62
- }
63
- console.debug(`ContextVariableStore: Initialized ${declarations.length} context variables:`, Array.from(this.variables.keys()));
64
- }
65
- /**
66
- * Get context variable value
67
- *
68
- * @param identifier Variable identifier
69
- * @returns Variable value or undefined if not found
70
- */
71
- get(identifier) {
72
- return this.variables.get(identifier);
73
- }
74
- /**
75
- * Set context variable value
76
- *
77
- * @param identifier Variable identifier
78
- * @param value New value
79
- */
80
- set(identifier, value) {
81
- if (!this.declarations.has(identifier)) {
82
- console.warn(`ContextVariableStore: Setting undeclared context variable: ${identifier}`, "Consider declaring it in contextDeclarations");
83
- }
84
- // Type validation (optional but recommended)
85
- const decl = this.declarations.get(identifier);
86
- if (decl) {
87
- this.validateValue(decl, value);
88
- }
89
- this.variables.set(identifier, value);
90
- }
91
- /**
92
- * Check if variable exists
93
- */
94
- has(identifier) {
95
- return this.variables.has(identifier);
96
- }
97
- /**
98
- * Get all variable names
99
- */
100
- getIdentifiers() {
101
- return Array.from(this.variables.keys());
102
- }
103
- /**
104
- * Get all variables as object (for passing to PIE elements)
105
- *
106
- * @returns Plain object with all context variables
107
- */
108
- toObject() {
109
- return Object.fromEntries(this.variables);
110
- }
111
- /**
112
- * Load state from serialized object (for session restore)
113
- *
114
- * @param state Object containing context variable values
115
- */
116
- fromObject(state) {
117
- for (const [key, value] of Object.entries(state)) {
118
- this.variables.set(key, value);
119
- }
120
- }
121
- /**
122
- * Clear all variables (reset to defaults)
123
- */
124
- reset() {
125
- for (const [identifier, decl] of this.declarations) {
126
- const value = decl.defaultValue ??
127
- this.getDefaultValueForType(decl.baseType, decl.cardinality);
128
- this.variables.set(identifier, value);
129
- }
130
- console.debug("ContextVariableStore: Reset to default values");
131
- }
132
- /**
133
- * Get declaration for variable
134
- *
135
- * @param identifier Variable identifier
136
- * @returns Declaration or undefined if not found
137
- */
138
- getDeclaration(identifier) {
139
- return this.declarations.get(identifier);
140
- }
141
- /**
142
- * Get all declarations
143
- */
144
- getDeclarations() {
145
- return Array.from(this.declarations.values());
146
- }
147
- /**
148
- * Get default value for QTI base type
149
- *
150
- * @private
151
- */
152
- getDefaultValueForType(baseType, cardinality) {
153
- if (cardinality === "multiple" || cardinality === "ordered") {
154
- return [];
155
- }
156
- if (cardinality === "record") {
157
- return {};
158
- }
159
- // Single cardinality defaults
160
- switch (baseType) {
161
- case "boolean":
162
- return false;
163
- case "integer":
164
- return 0;
165
- case "float":
166
- return 0.0;
167
- case "string":
168
- case "identifier":
169
- case "uri":
170
- return "";
171
- case "point":
172
- return [0, 0];
173
- case "pair":
174
- return ["", ""];
175
- case "directedPair":
176
- return ["", ""];
177
- case "duration":
178
- return 0;
179
- case "file":
180
- return null;
181
- default:
182
- return null;
183
- }
184
- }
185
- /**
186
- * Validate value matches declared type (basic validation)
187
- *
188
- * @private
189
- */
190
- validateValue(decl, value) {
191
- // Basic type checking - can be extended
192
- if (decl.baseType === "integer" && !Number.isInteger(value)) {
193
- console.warn(`ContextVariableStore: Variable ${decl.identifier} expects integer, got:`, typeof value);
194
- }
195
- if (decl.baseType === "float" && typeof value !== "number") {
196
- console.warn(`ContextVariableStore: Variable ${decl.identifier} expects float, got:`, typeof value);
197
- }
198
- if (decl.baseType === "boolean" && typeof value !== "boolean") {
199
- console.warn(`ContextVariableStore: Variable ${decl.identifier} expects boolean, got:`, typeof value);
200
- }
201
- if ((decl.cardinality === "multiple" || decl.cardinality === "ordered") &&
202
- !Array.isArray(value)) {
203
- console.warn(`ContextVariableStore: Variable ${decl.identifier} expects array (cardinality: ${decl.cardinality}), got:`, typeof value);
204
- }
205
- }
206
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Shared orchestration events for TTS tool UI controls.
3
- *
4
- * These events are intentionally UI-level coordination hints. They do not replace
5
- * playback controls such as stop/pause/resume.
6
- */
7
- export declare const PIE_TTS_CONTROL_HANDOFF_EVENT = "pie-tts-control-handoff";
8
- export type TTSControlHandoffDetail = {
9
- /**
10
- * Optional source identifier for host-orchestrated handoff tracing.
11
- */
12
- source?: "host";
13
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Shared orchestration events for TTS tool UI controls.
3
- *
4
- * These events are intentionally UI-level coordination hints. They do not replace
5
- * playback controls such as stop/pause/resume.
6
- */
7
- export const PIE_TTS_CONTROL_HANDOFF_EVENT = "pie-tts-control-handoff";
@@ -1,6 +0,0 @@
1
- export type Logger = (...args: unknown[]) => void;
2
- /**
3
- * Minimal logger helper (replacement for PIEOneer’s internal debug logger).
4
- * We intentionally keep this lightweight and browser-safe.
5
- */
6
- export declare function createLogger(namespace: string): Logger;
@@ -1,10 +0,0 @@
1
- /**
2
- * Minimal logger helper (replacement for PIEOneer’s internal debug logger).
3
- * We intentionally keep this lightweight and browser-safe.
4
- */
5
- export function createLogger(namespace) {
6
- return (...args) => {
7
- // eslint-disable-next-line no-console
8
- console.debug(`[${namespace}]`, ...args);
9
- };
10
- }