@pie-players/pie-assessment-toolkit 0.3.73 → 0.3.74
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 +171 -56
- package/dist/attempt/AssessmentSession.d.ts +1 -5
- package/dist/attempt/AssessmentSession.js +0 -29
- package/dist/components/ItemToolBar.custom-element.d.ts +1 -0
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.d.ts +1 -0
- package/dist/components/PieAssessmentToolkit.custom-element.js +14 -14
- package/dist/components/SectionToolBar.custom-element.d.ts +1 -0
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-b9dz5jvd.js +40 -0
- package/dist/components/chunks/ItemToolBar-gmrryv2v.js +2 -0
- package/dist/components/chunks/ItemToolBar-h4xap0t0.js +4 -0
- package/dist/components/chunks/ItemToolBar-wr2myaah.js +2 -0
- package/dist/components/chunks/sre-engine-wf9s43gg.js +1 -0
- package/dist/context/assessment-toolkit-context.d.ts +5 -0
- package/dist/context/runtime-context-consumer.js +5 -38
- package/dist/index.d.ts +6 -6
- package/dist/index.js +8 -9
- package/dist/policy/core/ToolPolicyEngine.d.ts +8 -2
- package/dist/policy/core/ToolPolicyEngine.js +12 -0
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts +3 -3
- package/dist/runtime/adapter/SectionEngineAdapter.js +3 -3
- package/dist/runtime/registration-events.d.ts +3 -0
- package/dist/runtime/section-runtime-engine-host-context.d.ts +3 -9
- package/dist/runtime/section-runtime-engine-host-context.js +5 -43
- package/dist/runtime/tool-host-contract.d.ts +20 -0
- package/dist/runtime/tool-host-contract.js +21 -0
- package/dist/services/HighlightCoordinator.d.ts +1 -7
- package/dist/services/HighlightCoordinator.js +1 -3
- package/dist/services/TTSService.d.ts +15 -1
- package/dist/services/TTSService.js +88 -35
- package/dist/services/ToolCoordinator.d.ts +1 -7
- package/dist/services/ToolCoordinator.js +1 -3
- package/dist/services/ToolRegistry.d.ts +13 -6
- package/dist/services/ToolRegistry.js +19 -7
- package/dist/services/ToolkitCoordinator.d.ts +110 -18
- package/dist/services/ToolkitCoordinator.js +273 -85
- package/dist/services/catalog-owner.d.ts +11 -0
- package/dist/services/catalog-owner.js +25 -0
- package/dist/services/create-tools-config.d.ts +2 -2
- package/dist/services/framework-error.d.ts +8 -1
- package/dist/services/interfaces.d.ts +9 -9
- package/dist/services/pnp-standard-features.d.ts +1 -1
- package/dist/services/section-controller-types.d.ts +15 -0
- package/dist/services/spoken-audio-cards.js +1 -1
- package/dist/services/tool-config-validation.d.ts +13 -2
- package/dist/services/tool-config-validation.js +33 -16
- package/dist/services/tool-context.js +29 -13
- package/dist/services/tool-providers/TTSToolProvider.d.ts +27 -65
- package/dist/services/tool-providers/TTSToolProvider.js +47 -9
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +4 -4
- package/dist/services/tool-providers/ToolProviderRegistry.js +4 -16
- package/dist/services/tool-providers/index.d.ts +0 -9
- package/dist/services/tool-providers/index.js +2 -4
- package/dist/services/tools-config-normalizer.d.ts +20 -1
- package/dist/services/tts/catalog-span-alignment.d.ts +2 -17
- package/dist/services/tts/catalog-span-alignment.js +17 -142
- package/dist/services/tts/generated-speech/types.d.ts +0 -12
- package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +12 -62
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +26 -1
- package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +3 -6
- package/dist/services/tts/math-alignment/index.d.ts +0 -5
- package/dist/services/tts/math-alignment/index.js +5 -25
- package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +9 -1
- package/dist/services/tts/math-alignment/speech-tokenizer.js +38 -36
- package/dist/services/tts/math-alignment/types.d.ts +4 -2
- package/dist/services/tts/math-aware-text-processing.js +44 -2
- package/dist/services/tts/math-speech.d.ts +5 -1
- package/dist/services/tts/math-speech.js +9 -6
- package/dist/services/tts/sre-engine.d.ts +7 -0
- package/dist/services/tts/sre-engine.js +11 -0
- package/dist/services/tts/sre-locales.d.ts +14 -0
- package/dist/services/tts/sre-locales.js +57 -0
- package/dist/services/tts/text-processing.d.ts +0 -1
- package/dist/services/tts/text-processing.js +0 -1
- package/dist/services/tts-runtime-config.d.ts +21 -3
- package/dist/services/tts-runtime-config.js +11 -3
- package/dist/tools/client.d.ts +1 -3
- package/dist/tools/client.js +1 -5
- package/dist/tools/internal.d.ts +6 -5
- package/dist/tools/internal.js +6 -8
- package/package.json +17 -36
- package/dist/components/chunks/ItemToolBar-byq80z42.js +0 -40
- package/dist/components/chunks/ItemToolBar-d36g3aw4.js +0 -49
- package/dist/services/ToolConfigResolver.d.ts +0 -161
- package/dist/services/ToolConfigResolver.js +0 -229
- package/dist/services/catalog-media.d.ts +0 -56
- package/dist/services/catalog-media.js +0 -190
- package/dist/services/createDefaultToolRegistry.d.ts +0 -53
- package/dist/services/createDefaultToolRegistry.js +0 -45
- package/dist/services/tool-providers/CortexToolProvider.d.ts +0 -13
- package/dist/services/tool-providers/CortexToolProvider.js +0 -32
- package/dist/services/tool-providers/DesmosToolProvider.d.ts +0 -14
- package/dist/services/tool-providers/DesmosToolProvider.js +0 -32
- package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +0 -16
- package/dist/services/tool-providers/GeoGebraToolProvider.js +0 -32
- package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +0 -35
- package/dist/services/tool-providers/LazyCalculatorToolProvider.js +0 -95
- package/dist/services/tts/visual-line-ranges.d.ts +0 -18
- package/dist/services/tts/visual-line-ranges.js +0 -226
- package/dist/tools/index.d.ts +0 -8
- package/dist/tools/index.js +0 -10
- package/dist/tools/response-discovery.d.ts +0 -61
- package/dist/tools/response-discovery.js +0 -113
- package/dist/tools/types.d.ts +0 -337
- package/dist/tools/types.js +0 -12
- package/dist/tools/variant-resolver.d.ts +0 -41
- package/dist/tools/variant-resolver.js +0 -207
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Part of PIE Assessment Toolkit.
|
|
15
15
|
*/
|
|
16
16
|
import type { AccessibilityCatalog, AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-players-shared/types";
|
|
17
|
-
import { type CanonicalToolsConfig, type ToolPlacementConfig, type ToolPlacementLevel, type ToolPolicyConfig, type ToolProviderConfig, type ToolProvidersConfig } from "./tools-config-normalizer.js";
|
|
17
|
+
import { type CanonicalToolsConfig, type ToolPlacementConfig, type ToolPlacementLevel, type ToolPolicyConfig, type TextToSpeechToolProviderConfig, type ToolProviderConfig, type ToolProvidersConfig, type ToolsConfigInput } from "./tools-config-normalizer.js";
|
|
18
18
|
import { type ToolConfigStrictness } from "./tool-config-validation.js";
|
|
19
19
|
import { AccessibilityCatalogResolver } from "./AccessibilityCatalogResolver.js";
|
|
20
20
|
import type { CatalogChangeListener } from "./AccessibilityCatalogResolver.js";
|
|
@@ -28,7 +28,6 @@ import { type TTSRuntimeSettings } from "./tts-runtime-config.js";
|
|
|
28
28
|
import type { SREMathSpeechOptions } from "./tts/math-speech.js";
|
|
29
29
|
import { ToolProviderRegistry } from "./tool-providers/index.js";
|
|
30
30
|
import type { ToolProviderApi } from "./tool-providers/ToolProviderApi.js";
|
|
31
|
-
import type { TTSToolProviderConfig } from "./tool-providers/index.js";
|
|
32
31
|
import { ToolRegistry } from "./ToolRegistry.js";
|
|
33
32
|
import type { ResolvedToolContext, ToolContextResolver, ToolContextResolverContext, ToolContextResolverMap } from "./ToolRegistry.js";
|
|
34
33
|
import type { ToolOpenRequest, ToolRequestTarget } from "./tool-request.js";
|
|
@@ -50,20 +49,21 @@ export interface ToolConfig {
|
|
|
50
49
|
*
|
|
51
50
|
* The field set is `TTSRuntimeSettings`, which the runtime resolver owns: the two
|
|
52
51
|
* were declared separately and had already drifted in both directions, so a field
|
|
53
|
-
* the runtime honoured could not be named here. What this adds is the
|
|
54
|
-
* only a host-facing config has — a place to stash unrecognised keys,
|
|
55
|
-
*
|
|
56
|
-
* runtime settings carry.
|
|
52
|
+
* the runtime honoured could not be named here. What this adds is the one thing
|
|
53
|
+
* only a host-facing config has — a place to stash unrecognised keys, which the
|
|
54
|
+
* resolved runtime settings do not carry.
|
|
57
55
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
56
|
+
* `provider` is typed from the `textToSpeech` tools-config entry instead: a host
|
|
57
|
+
* gives either a server provider id or a runtime provider object, whose
|
|
58
|
+
* `runtime.authFetcher` the TTS registration reads, and `TTSRuntimeSettings`
|
|
59
|
+
* names only the id. The entry is therefore assignable to this type, which is
|
|
60
|
+
* what `getToolConfig("textToSpeech")` returns.
|
|
61
61
|
*/
|
|
62
|
-
export type TTSToolConfig = ToolConfig & TTSRuntimeSettings & {
|
|
62
|
+
export type TTSToolConfig = ToolConfig & Omit<TTSRuntimeSettings, "provider"> & {
|
|
63
|
+
provider?: TextToSpeechToolProviderConfig["provider"];
|
|
63
64
|
settings?: Record<string, unknown> & {
|
|
64
65
|
mathSpeech?: SREMathSpeechOptions;
|
|
65
66
|
};
|
|
66
|
-
authFetcher?: () => Promise<Partial<TTSToolProviderConfig>>;
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Answer eliminator tool configuration
|
|
@@ -89,7 +89,7 @@ export interface ToolkitCoordinatorConfig {
|
|
|
89
89
|
* Tool availability and configuration.
|
|
90
90
|
* Defaults: all tools enabled with default settings.
|
|
91
91
|
*/
|
|
92
|
-
tools?:
|
|
92
|
+
tools?: ToolsConfigInput;
|
|
93
93
|
/**
|
|
94
94
|
* Validation strictness for tool config contracts.
|
|
95
95
|
* - off: keep diagnostics internal (no warnings or throws)
|
|
@@ -100,8 +100,12 @@ export interface ToolkitCoordinatorConfig {
|
|
|
100
100
|
*/
|
|
101
101
|
toolConfigStrictness?: ToolConfigStrictness;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* Registry used for tool-config validation and the only source of tool
|
|
104
|
+
* providers: the coordinator registers one per registration that carries a
|
|
105
|
+
* provider descriptor. Omitted, the coordinator takes the registry of the
|
|
106
|
+
* toolkit it is bound to — the section player's, under a section player — and
|
|
107
|
+
* until then validates nothing and registers no provider. A registry passed
|
|
108
|
+
* here is never replaced.
|
|
105
109
|
*/
|
|
106
110
|
toolRegistry?: ToolRegistry | null;
|
|
107
111
|
/**
|
|
@@ -139,6 +143,15 @@ export interface ToolkitCoordinatorConfig {
|
|
|
139
143
|
* @internal
|
|
140
144
|
*/
|
|
141
145
|
deferToolConfigValidation?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Set by `<pie-assessment-toolkit>` on the coordinator it builds for itself.
|
|
148
|
+
* That toolkit binds only the `assessment` its host passes, and a section
|
|
149
|
+
* player passes none, so feature policy reports an unbound assessment only
|
|
150
|
+
* while PNP enforcement is explicitly `"on"`.
|
|
151
|
+
*
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
assessmentOptional?: boolean;
|
|
142
155
|
/**
|
|
143
156
|
* Optional pre-constructed framework-error bus.
|
|
144
157
|
*
|
|
@@ -272,9 +285,13 @@ export interface ToolkitServiceBundle {
|
|
|
272
285
|
*
|
|
273
286
|
* @example
|
|
274
287
|
* ```typescript
|
|
288
|
+
* // createPackagedToolRegistry is exported by @pie-players/pie-default-tool-loaders
|
|
289
|
+
* const toolRegistry = createPackagedToolRegistry();
|
|
290
|
+
*
|
|
275
291
|
* // Create coordinator with configuration
|
|
276
292
|
* const coordinator = new ToolkitCoordinator({
|
|
277
293
|
* assessmentId: 'demo-three-questions',
|
|
294
|
+
* toolRegistry,
|
|
278
295
|
* tools: {
|
|
279
296
|
* providers: {
|
|
280
297
|
* textToSpeech: { enabled: true, backend: 'browser' },
|
|
@@ -287,7 +304,7 @@ export interface ToolkitServiceBundle {
|
|
|
287
304
|
* });
|
|
288
305
|
*
|
|
289
306
|
* // Pass to section player
|
|
290
|
-
* player.
|
|
307
|
+
* player.runtime = { ...(player.runtime ?? {}), coordinator };
|
|
291
308
|
*
|
|
292
309
|
* // Access services directly
|
|
293
310
|
* const ttsService = coordinator.ttsService;
|
|
@@ -317,7 +334,15 @@ export declare class ToolkitCoordinator {
|
|
|
317
334
|
private coordinatorReadyPromise?;
|
|
318
335
|
private coordinatorReadyNotified;
|
|
319
336
|
private readonly providerInitPromises;
|
|
320
|
-
private
|
|
337
|
+
private toolRegistry;
|
|
338
|
+
/** Whether the host passed `toolRegistry`, which then always stands. */
|
|
339
|
+
private readonly toolRegistrySupplied;
|
|
340
|
+
/**
|
|
341
|
+
* Whether the registry is final: supplied at construction, or adopted from
|
|
342
|
+
* the toolkit this coordinator is bound to. Until then the empty placeholder
|
|
343
|
+
* reports no missing registry, since the toolkit will supply one.
|
|
344
|
+
*/
|
|
345
|
+
private toolRegistrySettled;
|
|
321
346
|
private readonly toolContextResolvers;
|
|
322
347
|
private readonly toolContextResolverChangeListeners;
|
|
323
348
|
private readonly toolRequests;
|
|
@@ -404,7 +429,31 @@ export declare class ToolkitCoordinator {
|
|
|
404
429
|
* lifetime for no new information.
|
|
405
430
|
*/
|
|
406
431
|
private reportedUnboundFeaturePolicy;
|
|
407
|
-
|
|
432
|
+
/**
|
|
433
|
+
* Whether {@link _initializeTTS} has already reported a non-browser backend
|
|
434
|
+
* falling back to browser speech because no `tts` provider is registered.
|
|
435
|
+
* Once per coordinator: a text-to-speech config change re-runs
|
|
436
|
+
* initialization, and the missing provider is the same gap each time.
|
|
437
|
+
*/
|
|
438
|
+
private reportedMissingTTSProvider;
|
|
439
|
+
/**
|
|
440
|
+
* The backend of a fallback {@link reportMissingTTSProvider} held back while
|
|
441
|
+
* the registry was unsettled, reported if the bound toolkit has no registry.
|
|
442
|
+
*/
|
|
443
|
+
private heldMissingTTSProviderBackend;
|
|
444
|
+
/**
|
|
445
|
+
* Whether {@link validateToolsConfig} has already reported validating with
|
|
446
|
+
* no registry (`tools.registryUnavailable`). Once per coordinator: every
|
|
447
|
+
* {@link updateToolConfig} and {@link updateToolsPlacement} re-validates, and
|
|
448
|
+
* the missing registry is the same gap each time.
|
|
449
|
+
*/
|
|
450
|
+
private reportedRegistryUnavailable;
|
|
451
|
+
private resolveConfig;
|
|
452
|
+
/**
|
|
453
|
+
* `normalizeAndValidateToolsConfig`, except that `tools.registryUnavailable`
|
|
454
|
+
* is reported once per coordinator, whichever call validates.
|
|
455
|
+
*/
|
|
456
|
+
private validateToolsConfig;
|
|
408
457
|
constructor(config: ToolkitCoordinatorConfig);
|
|
409
458
|
private assertNotDisposed;
|
|
410
459
|
/**
|
|
@@ -472,15 +521,37 @@ export declare class ToolkitCoordinator {
|
|
|
472
521
|
private resolveSectionPersistence;
|
|
473
522
|
private setupStatePersistenceHooks;
|
|
474
523
|
private ensureStateLoaded;
|
|
524
|
+
private reportMissingTTSProvider;
|
|
525
|
+
/**
|
|
526
|
+
* Take the registry of the toolkit this coordinator is bound to, when the host
|
|
527
|
+
* constructed it without one: the config is validated against it, its
|
|
528
|
+
* providers register, and text-to-speech re-initializes through it if it
|
|
529
|
+
* already started. The toolkit elements call this on binding. A registry
|
|
530
|
+
* passed at construction stands, and the first call wins; `null` records a
|
|
531
|
+
* toolkit without one, which reports the registry as missing.
|
|
532
|
+
*
|
|
533
|
+
* @returns Whether `registry` was adopted.
|
|
534
|
+
*/
|
|
535
|
+
adoptToolRegistry(registry: ToolRegistry | null): boolean;
|
|
475
536
|
/**
|
|
476
537
|
* Register tool providers in the registry
|
|
477
538
|
*/
|
|
478
539
|
private _registerToolProviders;
|
|
479
540
|
private getProviderDescriptorTools;
|
|
541
|
+
/**
|
|
542
|
+
* Register the provider `tool`'s descriptor creates for the tool's current
|
|
543
|
+
* config, unless the tool is disabled or that provider id is registered. A
|
|
544
|
+
* descriptor that throws is reported the way a failed registration is.
|
|
545
|
+
*/
|
|
480
546
|
private registerProviderFromTool;
|
|
481
547
|
private createToolTelemetryForwarder;
|
|
482
548
|
private addToolTelemetryReporter;
|
|
483
549
|
private registerProvider;
|
|
550
|
+
/**
|
|
551
|
+
* A console warning and a `provider-register` framework error. `providerId`
|
|
552
|
+
* is null when resolving it is what failed; the warning names the tool then.
|
|
553
|
+
*/
|
|
554
|
+
private reportProviderRegisterFailure;
|
|
484
555
|
ensureProviderReady(providerId: string): Promise<ToolProviderApi>;
|
|
485
556
|
setHooks(hooks: ToolkitCoordinatorHooks): void;
|
|
486
557
|
subscribeTelemetry(listener: ToolkitTelemetryListener): () => void;
|
|
@@ -637,6 +708,7 @@ export declare class ToolkitCoordinator {
|
|
|
637
708
|
* @param toolId Tool identifier
|
|
638
709
|
* @returns Tool configuration or null if not configured
|
|
639
710
|
*/
|
|
711
|
+
getToolConfig(toolId: "textToSpeech"): TTSToolConfig | null;
|
|
640
712
|
getToolConfig(toolId: string): ToolProviderConfig | null;
|
|
641
713
|
/**
|
|
642
714
|
* Update tool configuration.
|
|
@@ -679,6 +751,11 @@ export declare class ToolkitCoordinator {
|
|
|
679
751
|
* capability it asks about, which is indistinguishable from a student who was
|
|
680
752
|
* properly declined — so without this, forgetting {@link updateAssessment}
|
|
681
753
|
* presents as an accommodation that silently never appears.
|
|
754
|
+
*
|
|
755
|
+
* A coordinator built with `assessmentOptional` reports only while PNP
|
|
756
|
+
* enforcement is explicitly `"on"`. Its toolkit binds whatever assessment the
|
|
757
|
+
* host gave, usually none, and a host that passes no profile and leaves
|
|
758
|
+
* enforcement unset or `"off"` has asked for no accommodation.
|
|
682
759
|
*/
|
|
683
760
|
decideFeaturePolicy(featureId: string): FeaturePolicyDecision;
|
|
684
761
|
/**
|
|
@@ -806,8 +883,23 @@ export declare class ToolkitCoordinator {
|
|
|
806
883
|
private resolveConfiguredPnpEnforcement;
|
|
807
884
|
/**
|
|
808
885
|
* Apply tool configuration changes to underlying services.
|
|
809
|
-
* Called after updateToolConfig().
|
|
886
|
+
* Called after updateToolConfig() with the tool's config before the update.
|
|
810
887
|
*/
|
|
811
888
|
private _applyToolConfigChange;
|
|
889
|
+
/**
|
|
890
|
+
* Register the provider a tool's updated config names, and unregister the
|
|
891
|
+
* one its previous config named when the provider id changed, as
|
|
892
|
+
* {@link _reconfigureTTSProvider} does for `tts`. Registration completes
|
|
893
|
+
* before this returns, so a check on the policy change the update dispatched
|
|
894
|
+
* finds the new provider.
|
|
895
|
+
*/
|
|
896
|
+
private _registerChangedToolProvider;
|
|
897
|
+
/**
|
|
898
|
+
* Re-register the `tts` provider for the current config and registry, then
|
|
899
|
+
* re-initialize unless initialization is lazy. An initialization already
|
|
900
|
+
* running finishes first: it would otherwise mark its provider ready after
|
|
901
|
+
* the reset.
|
|
902
|
+
*/
|
|
903
|
+
private scheduleTTSReconfigure;
|
|
812
904
|
private _reconfigureTTSProvider;
|
|
813
905
|
}
|