@pie-players/pie-assessment-toolkit 0.3.75 → 1.0.0-beta.1
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/README.md +451 -541
- package/custom-elements.json +1315 -0
- package/dist/attempt/TestSession.d.ts +0 -1
- package/dist/attempt/TestSession.js +10 -5
- package/dist/components/ItemScope.custom-element.js +1 -1
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +8 -8
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/{ItemToolBar-7tt7v2xp.js → ItemToolBar-3zrc4p3d.js} +4 -4
- package/dist/components/chunks/{ItemToolBar-jx38w99s.js → ItemToolBar-66hcwmfw.js} +2 -2
- package/dist/components/chunks/ItemToolBar-asenkvx6.js +40 -0
- package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +2 -0
- package/dist/components/chunks/{ItemToolBar-97hx60z4.js → ItemToolBar-kkj69ptr.js} +1 -1
- package/dist/components/chunks/sre-engine-bj997w4b.js +1 -0
- package/dist/context/assessment-toolkit-context.d.ts +6 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -10
- package/dist/policy/core/PolicySource.d.ts +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +46 -7
- package/dist/policy/core/ToolPolicyEngine.js +73 -16
- package/dist/policy/core/compose-decision.d.ts +3 -3
- package/dist/policy/core/compose-decision.js +32 -30
- package/dist/policy/core/decision-types.d.ts +51 -34
- package/dist/policy/core/feature-decision.d.ts +17 -15
- package/dist/policy/core/feature-decision.js +11 -13
- package/dist/policy/core/pnp-policy-inputs.d.ts +7 -3
- package/dist/policy/core/pnp-policy-inputs.js +17 -33
- package/dist/policy/core/provenance.d.ts +2 -2
- package/dist/policy/core/tool-parameters.d.ts +12 -0
- package/dist/policy/core/tool-parameters.js +27 -0
- package/dist/policy/engine.d.ts +1 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +18 -24
- package/dist/policy/sources/PnpPolicySource.js +57 -29
- package/dist/runtime/SectionControllerBinding.d.ts +6 -2
- package/dist/runtime/SectionControllerBinding.js +21 -15
- package/dist/runtime/adapter/subscriber-fanout.d.ts +0 -1
- package/dist/runtime/adapter/subscriber-fanout.js +1 -4
- package/dist/runtime/composition-emit-scheduler.d.ts +3 -3
- package/dist/runtime/composition-emit-scheduler.js +1 -1
- package/dist/runtime/content-region.d.ts +0 -4
- package/dist/runtime/content-region.js +2 -2
- package/dist/runtime/core/SectionEngineCore.d.ts +0 -2
- package/dist/runtime/core/SectionEngineCore.js +0 -4
- package/dist/runtime/core/cohort.d.ts +0 -5
- package/dist/runtime/core/cohort.js +0 -9
- package/dist/runtime/core/engine-output.d.ts +3 -2
- package/dist/runtime/core/engine-transition.js +3 -2
- package/dist/runtime/registration-events.d.ts +11 -14
- package/dist/runtime/runtime-id.d.ts +1 -1
- package/dist/runtime/runtime-id.js +1 -1
- package/dist/runtime/shell-scope.d.ts +4 -4
- package/dist/runtime/shell-scope.js +15 -9
- package/dist/runtime/tool-host-contract.d.ts +0 -4
- package/dist/runtime/tool-host-contract.js +1 -1
- package/dist/services/AccessibilityCatalogResolver.d.ts +21 -31
- package/dist/services/AccessibilityCatalogResolver.js +29 -42
- package/dist/services/ElementToolStateStore.d.ts +32 -61
- package/dist/services/ElementToolStateStore.js +37 -67
- package/dist/services/HighlightCoordinator.d.ts +9 -21
- package/dist/services/HighlightCoordinator.js +52 -80
- package/dist/services/RangeSerializer.d.ts +4 -35
- package/dist/services/RangeSerializer.js +4 -48
- package/dist/services/SSMLExtractor.d.ts +8 -31
- package/dist/services/SSMLExtractor.js +18 -40
- package/dist/services/TTSService.d.ts +51 -57
- package/dist/services/TTSService.js +323 -284
- package/dist/services/ToolCoordinator.d.ts +6 -49
- package/dist/services/ToolCoordinator.js +25 -61
- package/dist/services/ToolRegistry.d.ts +83 -80
- package/dist/services/ToolRegistry.js +91 -67
- package/dist/services/ToolkitCoordinator.d.ts +83 -81
- package/dist/services/ToolkitCoordinator.js +186 -174
- package/dist/services/framework-error.d.ts +30 -7
- package/dist/services/framework-error.js +10 -13
- package/dist/services/interfaces.d.ts +51 -71
- package/dist/services/section-controller-types.d.ts +7 -7
- package/dist/services/section-session-assignment.js +6 -8
- package/dist/services/spoken-audio-cards.d.ts +2 -4
- package/dist/services/spoken-audio-cards.js +2 -4
- package/dist/services/tool-config-validation.d.ts +5 -7
- package/dist/services/tool-config-validation.js +11 -26
- package/dist/services/tool-context.d.ts +39 -24
- package/dist/services/tool-context.js +158 -92
- package/dist/services/tool-failure.d.ts +30 -0
- package/dist/services/tool-failure.js +11 -0
- package/dist/services/tool-icons.d.ts +1 -2
- package/dist/services/tool-icons.js +2 -2
- package/dist/services/tool-instance-id.d.ts +8 -6
- package/dist/services/tool-instance-id.js +12 -18
- package/dist/services/tool-providers/TTSToolProvider.d.ts +6 -43
- package/dist/services/tool-providers/TTSToolProvider.js +7 -63
- package/dist/services/tool-providers/ToolProviderApi.d.ts +0 -7
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +7 -42
- package/dist/services/tool-providers/ToolProviderRegistry.js +21 -63
- package/dist/services/tool-request.d.ts +4 -0
- package/dist/services/tool-request.js +7 -2
- package/dist/services/toolbar-decided-tools.d.ts +2 -0
- package/dist/services/toolbar-decided-tools.js +2 -0
- package/dist/services/toolbar-items.js +2 -5
- package/dist/services/tools-config-normalizer.d.ts +18 -9
- package/dist/services/tools-config-normalizer.js +25 -19
- package/dist/services/tts/browser-provider.d.ts +2 -5
- package/dist/services/tts/browser-provider.js +13 -22
- package/dist/services/tts/catalog-span-alignment.js +14 -7
- package/dist/services/tts/flat-tree.d.ts +0 -7
- package/dist/services/tts/flat-tree.js +2 -2
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +2 -2
- package/dist/services/tts/generated-speech/index.d.ts +1 -1
- package/dist/services/tts/generated-speech/index.js +1 -1
- package/dist/services/tts/generated-speech/types.d.ts +1 -1
- package/dist/services/tts/generated-speech/types.js +1 -1
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +10 -12
- package/dist/services/tts/highlight-target-resolver.d.ts +12 -0
- package/dist/services/tts/math-aware-text-processing.js +10 -29
- package/dist/services/tts/math-speech.d.ts +1 -1
- package/dist/services/tts/math-speech.js +3 -0
- package/dist/services/tts/mathml-sanitization.d.ts +7 -0
- package/dist/services/tts/mathml-sanitization.js +9 -1
- package/dist/services/tts/provider-options.d.ts +12 -1
- package/dist/services/tts/ssml/spoken-text.js +1 -1
- package/dist/services/tts/start-failure.d.ts +0 -7
- package/dist/services/tts/start-failure.js +1 -1
- package/dist/services/tts/text-segmentation.d.ts +5 -0
- package/dist/services/tts/text-segmentation.js +13 -10
- package/dist/services/tts-runtime-config.d.ts +32 -12
- package/dist/services/tts-runtime-config.js +14 -20
- package/dist/tools/content-capability-resolution.d.ts +2 -2
- package/dist/tools/registration.d.ts +7 -6
- package/dist/tools/registration.js +10 -9
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts +6 -0
- package/dist/tools/registrations/toolbar-registration-helpers.js +6 -0
- package/dist/tools/tool-surface-host.js +1 -8
- package/package.json +8 -6
- package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +0 -2
- package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +0 -40
- package/dist/components/chunks/sre-engine-jd8cc08x.js +0 -1
- package/dist/services/ContextVariableStore.d.ts +0 -113
- package/dist/services/ContextVariableStore.js +0 -206
- package/dist/services/tts-control-events.d.ts +0 -13
- package/dist/services/tts-control-events.js +0 -7
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.js +0 -10
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TTSService
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* and integrates with HighlightCoordinator for word highlighting.
|
|
4
|
+
* Owns one read-aloud session: the installed provider, playback state, and the
|
|
5
|
+
* word and sentence highlights painted through HighlightCoordinator.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
7
|
+
* Layout:
|
|
8
|
+
* - Provider and host wiring: initialize, setCatalogResolver, the highlight
|
|
9
|
+
* target resolver and math-speech sources.
|
|
10
|
+
* - Content resolution: catalog spoken card, then catalog-composed chunks
|
|
11
|
+
* (script and/or recording with a plain fallback), then generated speech.
|
|
12
|
+
* - Speech plan: structural pauses, seek segments, sentence segments and the
|
|
13
|
+
* normalized-to-DOM position map.
|
|
14
|
+
* - Playback: speakContent → executeSpeakPlayback, the run guard (speakRunId,
|
|
15
|
+
* runOwner), the pause hold and the playback-start barrier.
|
|
16
|
+
* - Highlight painting: boundary handling, the host resolver remap, catalog
|
|
17
|
+
* highlight plans.
|
|
18
|
+
* - Controls and state: pause/resume/stop/seek/rate, setState and listeners.
|
|
17
19
|
*/
|
|
18
|
-
import type { ITTSProvider, TTSConfig
|
|
20
|
+
import type { ITTSProvider, TTSConfig } from "@pie-players/pie-tts";
|
|
19
21
|
import type { AccessibilityCatalogResolver } from "./AccessibilityCatalogResolver.js";
|
|
20
22
|
import type { HighlightCoordinatorApi, SpeakOptions } from "./interfaces.js";
|
|
21
23
|
import type { TTSHighlightTargetResolverProvider } from "./tts/highlight-target-resolver.js";
|
|
22
24
|
import { type SREMathSpeechOptions } from "./tts/math-speech.js";
|
|
23
|
-
|
|
25
|
+
import type { ToolkitTTSConfig } from "./tts/provider-options.js";
|
|
24
26
|
/**
|
|
25
27
|
* Playback state
|
|
26
28
|
*/
|
|
@@ -32,8 +34,6 @@ export declare enum PlaybackState {
|
|
|
32
34
|
ERROR = "error"
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
|
-
* TTSService
|
|
36
|
-
*
|
|
37
37
|
* Instantiable service for text-to-speech functionality.
|
|
38
38
|
* Each instance manages its own playback state.
|
|
39
39
|
*/
|
|
@@ -57,6 +57,7 @@ export declare class TTSService {
|
|
|
57
57
|
private listeners;
|
|
58
58
|
private lastError;
|
|
59
59
|
private speakRunId;
|
|
60
|
+
private runOwner;
|
|
60
61
|
private currentBoundaryOffset;
|
|
61
62
|
private activeWordBoundaryOffset;
|
|
62
63
|
private seekSegments;
|
|
@@ -74,12 +75,24 @@ export declare class TTSService {
|
|
|
74
75
|
private pendingPlaybackRateRequest;
|
|
75
76
|
private activePlaybackRate;
|
|
76
77
|
private activeHighlightMode;
|
|
78
|
+
private wordlessPartHighlight;
|
|
77
79
|
private lastRenderedRegionTarget;
|
|
78
80
|
private telemetryReporter;
|
|
79
81
|
private readonly generatedMathSpeechResolver;
|
|
80
|
-
constructor();
|
|
81
82
|
private clearPlaybackStartBarrier;
|
|
82
83
|
private notifyPlaybackStarted;
|
|
84
|
+
/**
|
|
85
|
+
* A word-mode part whose playback sends no boundaries, such as a server
|
|
86
|
+
* response without speech marks, highlights as a sentence-mode read does.
|
|
87
|
+
* Catalog chunks and a single speak highlight the same in both modes.
|
|
88
|
+
*/
|
|
89
|
+
private highlightWordlessPlayback;
|
|
90
|
+
/**
|
|
91
|
+
* Defers marking the run playing, and the highlights queued through
|
|
92
|
+
* runWhenPlaybackStarts, until the provider or the recording signals that
|
|
93
|
+
* audio started. Returns the barrier's cleanup, or null when nothing will
|
|
94
|
+
* signal a start, in which case the caller marks the run playing itself.
|
|
95
|
+
*/
|
|
83
96
|
private installPlaybackStartBarrier;
|
|
84
97
|
private runWhenPlaybackStarts;
|
|
85
98
|
/** Resolves when run `runId` may start its next part: at once unless paused. */
|
|
@@ -105,13 +118,11 @@ export declare class TTSService {
|
|
|
105
118
|
private emitTelemetry;
|
|
106
119
|
/**
|
|
107
120
|
* Initialize TTS service with a provider
|
|
108
|
-
*
|
|
109
|
-
* @param provider TTS provider instance
|
|
110
|
-
* @param config Provider configuration
|
|
111
121
|
*/
|
|
112
|
-
initialize(provider: ITTSProvider, config?: Partial<
|
|
122
|
+
initialize(provider: ITTSProvider, config?: Partial<ToolkitTTSConfig>): Promise<void>;
|
|
113
123
|
/**
|
|
114
|
-
* Update rate, pitch, voice or provider options without
|
|
124
|
+
* Update rate, pitch, volume, voice or provider options without
|
|
125
|
+
* reinitializing.
|
|
115
126
|
* `providerOptions` merge over the ones already configured.
|
|
116
127
|
*/
|
|
117
128
|
updateSettings(settings: Partial<TTSConfig>): Promise<void>;
|
|
@@ -153,8 +164,6 @@ export declare class TTSService {
|
|
|
153
164
|
*
|
|
154
165
|
* When set, the speak() method will check for pre-authored spoken
|
|
155
166
|
* content in catalogs before falling back to generated TTS.
|
|
156
|
-
*
|
|
157
|
-
* @param resolver AccessibilityCatalogResolver instance
|
|
158
167
|
*/
|
|
159
168
|
setCatalogResolver(resolver: AccessibilityCatalogResolver): void;
|
|
160
169
|
private getHighlightResolverRuntime;
|
|
@@ -171,10 +180,6 @@ export declare class TTSService {
|
|
|
171
180
|
*/
|
|
172
181
|
private paintTTSWord;
|
|
173
182
|
private paintTTSSentenceRanges;
|
|
174
|
-
/**
|
|
175
|
-
* Get provider capabilities
|
|
176
|
-
*/
|
|
177
|
-
getCapabilities(): TTSProviderCapabilities | null;
|
|
178
183
|
private providerOptions;
|
|
179
184
|
/** The longest text the provider accepts in one speak, when it declares one. */
|
|
180
185
|
private maxTextLength;
|
|
@@ -187,8 +192,8 @@ export declare class TTSService {
|
|
|
187
192
|
/** Segments no longer than the provider's `maxTextLength`, offsets kept. */
|
|
188
193
|
private segmentsWithinLimit;
|
|
189
194
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
195
|
+
* Text-collection options for `locale`, with the provider's boundary-spacing
|
|
196
|
+
* mode when it names a known one.
|
|
192
197
|
*/
|
|
193
198
|
private getTextProcessingOptions;
|
|
194
199
|
/**
|
|
@@ -203,12 +208,15 @@ export declare class TTSService {
|
|
|
203
208
|
* this service was initialized with.
|
|
204
209
|
*/
|
|
205
210
|
getMathSpeechOptions(): SREMathSpeechOptions | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Rebuilds normalizedToDOM from `element`'s visible text; traced runs also
|
|
213
|
+
* log how it differs from `spokenText`.
|
|
214
|
+
*/
|
|
206
215
|
private buildPositionMap;
|
|
207
216
|
private getStructuralPauseProfile;
|
|
208
217
|
private resolvePauseMsFromUnits;
|
|
209
218
|
private resolveHighlightMode;
|
|
210
219
|
private hasExplicitBreakSemantics;
|
|
211
|
-
private isElementHidden;
|
|
212
220
|
private getBoundaryStrength;
|
|
213
221
|
private getBoundaryAnchor;
|
|
214
222
|
/**
|
|
@@ -246,12 +254,19 @@ export declare class TTSService {
|
|
|
246
254
|
* running continues.
|
|
247
255
|
*/
|
|
248
256
|
speak(target: Range | Element, options?: SpeakOptions): Promise<void>;
|
|
257
|
+
/**
|
|
258
|
+
* Sets the rate, pitch and volume a run starts at, after any rate write in
|
|
259
|
+
* flight. The run has no playback yet, so nothing restarts.
|
|
260
|
+
*/
|
|
261
|
+
private applyRunSettings;
|
|
249
262
|
/**
|
|
250
263
|
* Suppression is read from the live ancestors of what is read, because the
|
|
251
264
|
* element carrying it may sit above the content root.
|
|
252
265
|
*/
|
|
253
266
|
private isSuppressedTarget;
|
|
254
267
|
private resolveElementTarget;
|
|
268
|
+
/** Whether the root's card, or a card of a node inside it, would be read. */
|
|
269
|
+
private holdsSpokenCard;
|
|
255
270
|
private resolveRangeTarget;
|
|
256
271
|
private speakContent;
|
|
257
272
|
/**
|
|
@@ -327,7 +342,8 @@ export declare class TTSService {
|
|
|
327
342
|
seekForward(units?: number): Promise<void>;
|
|
328
343
|
seekBackward(units?: number): Promise<void>;
|
|
329
344
|
/**
|
|
330
|
-
* Stop playback
|
|
345
|
+
* Stop playback and release the run owner. A run that ends on its own keeps
|
|
346
|
+
* its owner, so the owning control can replay it.
|
|
331
347
|
*/
|
|
332
348
|
stop(): void;
|
|
333
349
|
/**
|
|
@@ -340,41 +356,19 @@ export declare class TTSService {
|
|
|
340
356
|
* A disposed service cannot speak or be initialized again.
|
|
341
357
|
*/
|
|
342
358
|
dispose(): void;
|
|
343
|
-
/**
|
|
344
|
-
* Request UI-level TTS controls to hand off/deactivate.
|
|
345
|
-
*
|
|
346
|
-
* This is intentionally separate from playback controls so hosts can orchestrate
|
|
347
|
-
* control handoff explicitly (for example: stop playback, then dismiss controls).
|
|
348
|
-
*/
|
|
349
|
-
requestControlHandoff(): void;
|
|
350
|
-
/**
|
|
351
|
-
* Check if currently playing
|
|
352
|
-
*/
|
|
353
|
-
isPlaying(): boolean;
|
|
354
|
-
/**
|
|
355
|
-
* Check if paused
|
|
356
|
-
*/
|
|
357
|
-
isPaused(): boolean;
|
|
358
359
|
/**
|
|
359
360
|
* Get current state
|
|
360
361
|
*/
|
|
361
362
|
getState(): PlaybackState;
|
|
362
|
-
|
|
363
|
-
* Get current text being spoken
|
|
364
|
-
*/
|
|
365
|
-
getCurrentText(): string | null;
|
|
366
|
-
/**
|
|
367
|
-
* Get the last error message
|
|
368
|
-
* Returns null if no error has occurred
|
|
369
|
-
*/
|
|
370
|
-
getLastError(): string | null;
|
|
363
|
+
getRunOwner(): string | null;
|
|
371
364
|
/**
|
|
372
365
|
* Subscribe to playback state changes. The returned function unsubscribes;
|
|
373
366
|
* each subscription is its own, so the same callback can be subscribed twice.
|
|
374
367
|
*/
|
|
375
368
|
onStateChange(callback: (state: PlaybackState) => void): () => void;
|
|
376
369
|
/**
|
|
377
|
-
* Set state and notify listeners
|
|
370
|
+
* Set state and notify listeners. `announceUnchanged` notifies listeners even
|
|
371
|
+
* when the state does not change; telemetry fires only on a change.
|
|
378
372
|
*/
|
|
379
373
|
private setState;
|
|
380
374
|
}
|