@pie-players/pie-assessment-toolkit 0.3.74 → 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.
- package/README.md +658 -714
- package/custom-elements.json +1315 -0
- package/dist/attempt/TestSession.d.ts +1 -21
- package/dist/attempt/TestSession.js +16 -102
- package/dist/components/ItemScope.custom-element.d.ts +1 -0
- package/dist/components/ItemScope.custom-element.js +1 -0
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +14 -14
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-3zrc4p3d.js +4 -0
- package/dist/components/chunks/ItemToolBar-66hcwmfw.js +2 -0
- package/dist/components/chunks/ItemToolBar-9gqhfxtn.js +40 -0
- package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +2 -0
- package/dist/components/chunks/{ItemToolBar-gmrryv2v.js → ItemToolBar-kkj69ptr.js} +1 -1
- package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
- package/dist/components/chunks/sre-engine-bj997w4b.js +1 -0
- package/dist/components/item-scope-element.d.ts +2 -0
- package/dist/components/item-scope-element.js +2 -0
- package/dist/context/assessment-toolkit-context.d.ts +33 -6
- package/dist/index.d.ts +25 -50
- package/dist/index.js +15 -45
- package/dist/policy/core/PolicySource.d.ts +2 -2
- package/dist/policy/core/ToolPolicyEngine.d.ts +118 -34
- package/dist/policy/core/ToolPolicyEngine.js +203 -56
- package/dist/policy/core/compose-decision.d.ts +28 -7
- package/dist/policy/core/compose-decision.js +95 -74
- package/dist/policy/core/decision-types.d.ts +98 -55
- package/dist/policy/core/feature-decision.d.ts +28 -19
- package/dist/policy/core/feature-decision.js +15 -11
- package/dist/policy/core/pnp-policy-inputs.d.ts +29 -35
- package/dist/policy/core/pnp-policy-inputs.js +40 -88
- package/dist/policy/core/provenance.d.ts +10 -5
- package/dist/policy/core/provenance.js +1 -1
- package/dist/policy/core/tool-parameters.d.ts +11 -0
- package/dist/policy/core/tool-parameters.js +15 -0
- package/dist/policy/engine.d.ts +7 -23
- package/dist/policy/engine.js +5 -20
- package/dist/policy/sources/PnpPolicySource.d.ts +43 -68
- package/dist/policy/sources/PnpPolicySource.js +133 -132
- package/dist/runtime/SectionControllerBinding.d.ts +283 -0
- package/dist/runtime/SectionControllerBinding.js +456 -0
- package/dist/runtime/SectionRuntimeEngine.d.ts +26 -289
- package/dist/runtime/SectionRuntimeEngine.js +30 -372
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts +19 -80
- package/dist/runtime/adapter/SectionEngineAdapter.js +19 -92
- package/dist/runtime/adapter/dom-event-bridge.d.ts +15 -30
- package/dist/runtime/adapter/dom-event-bridge.js +17 -44
- package/dist/runtime/adapter/subscriber-fanout.d.ts +1 -3
- package/dist/runtime/adapter/subscriber-fanout.js +2 -6
- package/dist/runtime/catalog-context.d.ts +19 -0
- package/dist/runtime/catalog-context.js +28 -0
- package/dist/runtime/composition-emit-scheduler.d.ts +12 -18
- package/dist/runtime/composition-emit-scheduler.js +10 -16
- package/dist/runtime/content-language.d.ts +32 -0
- package/dist/runtime/content-language.js +46 -0
- package/dist/runtime/content-region.d.ts +13 -0
- package/dist/runtime/content-region.js +29 -0
- package/dist/runtime/content-registration.d.ts +13 -0
- package/dist/runtime/content-registration.js +25 -0
- package/dist/runtime/core/SectionEngineCore.d.ts +2 -4
- package/dist/runtime/core/SectionEngineCore.js +2 -6
- package/dist/runtime/core/cohort.d.ts +1 -6
- package/dist/runtime/core/cohort.js +1 -10
- package/dist/runtime/core/engine-input.d.ts +18 -30
- package/dist/runtime/core/engine-input.js +11 -12
- package/dist/runtime/core/engine-output.d.ts +17 -40
- package/dist/runtime/core/engine-output.js +9 -21
- package/dist/runtime/core/engine-readiness.d.ts +5 -37
- package/dist/runtime/core/engine-readiness.js +8 -41
- package/dist/runtime/core/engine-resolver.d.ts +46 -74
- package/dist/runtime/core/engine-resolver.js +18 -43
- package/dist/runtime/core/engine-state.d.ts +28 -36
- package/dist/runtime/core/engine-state.js +18 -21
- package/dist/runtime/core/engine-transition.d.ts +14 -19
- package/dist/runtime/core/engine-transition.js +74 -53
- package/dist/runtime/engine.d.ts +16 -19
- package/dist/runtime/engine.js +12 -19
- package/dist/runtime/page-warnings.d.ts +13 -0
- package/dist/runtime/page-warnings.js +22 -0
- package/dist/runtime/policy-input-forwarding.d.ts +25 -0
- package/dist/runtime/policy-input-forwarding.js +25 -0
- package/dist/runtime/registration-events.d.ts +22 -14
- package/dist/runtime/runtime-event-claim.d.ts +8 -0
- package/dist/runtime/runtime-event-claim.js +15 -0
- package/dist/runtime/runtime-id.d.ts +1 -1
- package/dist/runtime/runtime-id.js +1 -1
- package/dist/runtime/shell-event-bridge.d.ts +45 -0
- package/dist/runtime/shell-event-bridge.js +127 -0
- package/dist/runtime/shell-registration.d.ts +73 -0
- package/dist/runtime/shell-registration.js +95 -0
- package/dist/runtime/shell-scope.d.ts +68 -0
- package/dist/runtime/shell-scope.js +194 -0
- package/dist/runtime/tool-host-contract.d.ts +8 -14
- package/dist/runtime/tool-host-contract.js +12 -12
- package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
- package/dist/runtime/unclaimed-registration-watch.js +23 -0
- package/dist/services/AccessibilityCatalogResolver.d.ts +21 -31
- package/dist/services/AccessibilityCatalogResolver.js +29 -42
- package/dist/services/ElementToolStateStore.d.ts +42 -67
- package/dist/services/ElementToolStateStore.js +65 -71
- package/dist/services/HighlightCoordinator.d.ts +28 -40
- package/dist/services/HighlightCoordinator.js +459 -381
- package/dist/services/RangeSerializer.d.ts +11 -33
- package/dist/services/RangeSerializer.js +88 -59
- package/dist/services/SSMLExtractor.d.ts +8 -31
- package/dist/services/SSMLExtractor.js +18 -40
- package/dist/services/TTSService.d.ts +159 -119
- package/dist/services/TTSService.js +937 -822
- package/dist/services/ToolCoordinator.d.ts +42 -102
- package/dist/services/ToolCoordinator.js +178 -256
- package/dist/services/ToolRegistry.d.ts +152 -133
- package/dist/services/ToolRegistry.js +192 -178
- package/dist/services/ToolkitCoordinator.d.ts +233 -237
- package/dist/services/ToolkitCoordinator.js +615 -557
- package/dist/services/audio-handoff.d.ts +6 -7
- package/dist/services/audio-handoff.js +20 -14
- package/dist/services/catalog-owner.d.ts +0 -1
- package/dist/services/framework-error-bus.d.ts +3 -6
- package/dist/services/framework-error-bus.js +3 -6
- package/dist/services/framework-error.d.ts +51 -13
- package/dist/services/framework-error.js +19 -20
- package/dist/services/interfaces.d.ts +189 -184
- package/dist/services/section-controller-types.d.ts +7 -7
- package/dist/services/section-session-assignment.d.ts +21 -0
- package/dist/services/section-session-assignment.js +80 -0
- package/dist/services/spoken-audio-cards.d.ts +2 -6
- package/dist/services/spoken-audio-cards.js +2 -6
- package/dist/services/tool-config-defaults.d.ts +3 -3
- package/dist/services/tool-config-defaults.js +3 -3
- package/dist/services/tool-config-validation.d.ts +9 -12
- package/dist/services/tool-config-validation.js +47 -87
- package/dist/services/tool-context.d.ts +7 -31
- package/dist/services/tool-context.js +99 -65
- package/dist/services/tool-failure.d.ts +30 -0
- package/dist/services/tool-failure.js +11 -0
- package/dist/services/tool-icons.d.ts +5 -5
- package/dist/services/tool-icons.js +6 -5
- package/dist/services/tool-instance-id.d.ts +8 -7
- package/dist/services/tool-instance-id.js +12 -24
- package/dist/services/tool-providers/TTSToolProvider.d.ts +20 -58
- package/dist/services/tool-providers/TTSToolProvider.js +32 -85
- package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -11
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +29 -60
- package/dist/services/tool-providers/ToolProviderRegistry.js +128 -144
- package/dist/services/tool-request.d.ts +31 -12
- package/dist/services/tool-request.js +31 -16
- package/dist/services/toolbar-decided-tools.d.ts +16 -0
- package/dist/services/toolbar-decided-tools.js +29 -0
- package/dist/services/toolbar-items.js +2 -5
- package/dist/services/tools-config-normalizer.d.ts +33 -29
- package/dist/services/tools-config-normalizer.js +26 -28
- package/dist/services/tts/browser-provider.d.ts +39 -6
- package/dist/services/tts/browser-provider.js +280 -160
- package/dist/services/tts/catalog-span-alignment.js +14 -7
- package/dist/services/tts/flat-tree.d.ts +64 -0
- package/dist/services/tts/flat-tree.js +269 -0
- package/dist/services/tts/generated-speech/assemble-plan.d.ts +3 -1
- package/dist/services/tts/generated-speech/assemble-plan.js +3 -1
- package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +2 -0
- package/dist/services/tts/generated-speech/dom/build-dom-plan.js +1 -1
- 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/math-speech-cache.d.ts +3 -1
- package/dist/services/tts/generated-speech/math-speech-cache.js +5 -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 +22 -16
- package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +6 -4
- package/dist/services/tts/highlight-pipeline/readable-region.js +3 -2
- package/dist/services/tts/highlight-pipeline/types.d.ts +5 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +12 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.js +73 -7
- package/dist/services/tts/highlight-target-resolver.d.ts +12 -0
- package/dist/services/tts/math-aware-text-processing.d.ts +5 -1
- package/dist/services/tts/math-aware-text-processing.js +42 -47
- package/dist/services/tts/math-control-names.d.ts +21 -0
- package/dist/services/tts/math-control-names.js +142 -0
- package/dist/services/tts/math-speech.d.ts +12 -1
- package/dist/services/tts/math-speech.js +54 -18
- 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 +52 -0
- package/dist/services/tts/provider-options.js +1 -0
- package/dist/services/tts/ssml/spoken-text.d.ts +2 -26
- package/dist/services/tts/ssml/spoken-text.js +29 -0
- package/dist/services/tts/start-failure.d.ts +4 -0
- package/dist/services/tts/start-failure.js +19 -0
- package/dist/services/tts/text-processing.d.ts +9 -0
- package/dist/services/tts/text-processing.js +46 -33
- package/dist/services/tts/text-segmentation.d.ts +12 -0
- package/dist/services/tts/text-segmentation.js +60 -10
- package/dist/services/tts-runtime-config.d.ts +54 -26
- package/dist/services/tts-runtime-config.js +27 -112
- package/dist/tools/content-capability-resolution.d.ts +9 -11
- package/dist/tools/content-capability-resolution.js +8 -45
- package/dist/tools/registration.d.ts +59 -0
- package/dist/tools/registration.js +55 -0
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts +6 -0
- package/dist/tools/registrations/toolbar-registration-helpers.js +8 -2
- package/dist/tools/tool-surface-host.d.ts +6 -10
- package/dist/tools/tool-surface-host.js +45 -50
- package/dist/tools/tool-tag-map.d.ts +5 -15
- package/dist/tools/tool-tag-map.js +6 -20
- package/dist/utils/structural-equality.d.ts +11 -0
- package/dist/utils/structural-equality.js +47 -0
- package/package.json +15 -29
- package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -49
- package/dist/attempt/adapters/activity-to-test-attempt-session.js +0 -138
- package/dist/components/chunks/ItemToolBar-b9dz5jvd.js +0 -40
- package/dist/components/chunks/ItemToolBar-h4xap0t0.js +0 -4
- package/dist/components/chunks/ItemToolBar-wr2myaah.js +0 -2
- package/dist/components/chunks/sre-engine-wf9s43gg.js +0 -1
- package/dist/context/runtime-context-consumer.d.ts +0 -13
- package/dist/context/runtime-context-consumer.js +0 -18
- package/dist/item-loader.d.ts +0 -44
- package/dist/item-loader.js +0 -61
- package/dist/policy/core/engine-context.d.ts +0 -29
- package/dist/policy/core/engine-context.js +0 -27
- package/dist/policy/core/policy-source-tag.d.ts +0 -31
- package/dist/policy/core/policy-source-tag.js +0 -28
- package/dist/policy/internal.d.ts +0 -25
- package/dist/policy/internal.js +0 -25
- package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -92
- package/dist/runtime/adapter/coordinator-bridge.js +0 -126
- package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -36
- package/dist/runtime/adapter/framework-error-bridge.js +0 -46
- package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -31
- package/dist/runtime/adapter/instrumentation-bridge.js +0 -38
- package/dist/runtime/core/engine-stage-derivation.d.ts +0 -18
- package/dist/runtime/core/engine-stage-derivation.js +0 -29
- package/dist/runtime/engine-context.d.ts +0 -39
- package/dist/runtime/engine-context.js +0 -31
- package/dist/runtime/internal.d.ts +0 -43
- package/dist/runtime/internal.js +0 -45
- package/dist/runtime/section-runtime-engine-host-context.d.ts +0 -74
- package/dist/runtime/section-runtime-engine-host-context.js +0 -57
- package/dist/runtime/stage-emit-gate.d.ts +0 -92
- package/dist/runtime/stage-emit-gate.js +0 -82
- package/dist/services/ContextVariableStore.d.ts +0 -113
- package/dist/services/ContextVariableStore.js +0 -206
- package/dist/services/I18nService.d.ts +0 -47
- package/dist/services/I18nService.js +0 -84
- package/dist/services/ThemeProvider.d.ts +0 -95
- package/dist/services/ThemeProvider.js +0 -334
- package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -21
- package/dist/services/defaultPersonalNeedsProfile.js +0 -26
- package/dist/services/pnp-standard-features.d.ts +0 -238
- package/dist/services/pnp-standard-features.js +0 -338
- package/dist/services/tts-control-events.d.ts +0 -13
- package/dist/services/tts-control-events.js +0 -7
- package/dist/tools/client.d.ts +0 -10
- package/dist/tools/client.js +0 -10
- package/dist/tools/internal.d.ts +0 -44
- package/dist/tools/internal.js +0 -39
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.js +0 -10
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine resolver
|
|
2
|
+
* Section runtime engine resolver.
|
|
3
3
|
*
|
|
4
4
|
* Canonical home of `resolveRuntime`, `resolveToolsConfig`, and their
|
|
5
|
-
* supporting helpers/types
|
|
6
|
-
*
|
|
7
|
-
* have been deleted; section-player now consumes these helpers via
|
|
8
|
-
* `@pie-players/pie-assessment-toolkit/runtime/internal`.
|
|
5
|
+
* supporting helpers/types; section-player consumes them through
|
|
6
|
+
* `@pie-players/pie-assessment-toolkit/runtime/engine`.
|
|
9
7
|
*
|
|
10
8
|
* What is NOT absorbed in this module:
|
|
11
9
|
* - `resolvePlayerRuntime` stays in section-player because it depends on
|
|
@@ -18,22 +16,26 @@
|
|
|
18
16
|
* `packages/section-player/src/components/shared/section-player-host-runtime.ts`)
|
|
19
17
|
* hands its local implementation in.
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Each input has one tier. `assessmentId`, the tools and player config and the
|
|
20
|
+
* `on*` callbacks arrive on `runtime`. The primitive inputs (`nds-icons`,
|
|
21
|
+
* `locale`, `tool-config-strictness`) are element attributes; the resolver takes
|
|
22
|
+
* `toolConfigStrictness` beside `runtime`.
|
|
23
23
|
*/
|
|
24
24
|
import type { LoaderConfig } from "@pie-players/pie-players-shared/loader-config";
|
|
25
25
|
import type { LoadingCompleteDetail, StageChangeDetail } from "@pie-players/pie-players-shared/pie";
|
|
26
26
|
import type { FrameworkErrorModel } from "../../services/framework-error.js";
|
|
27
27
|
import type { ToolConfigStrictness } from "../../services/tool-config-validation.js";
|
|
28
|
-
export declare const DEFAULT_ASSESSMENT_ID = "section-demo-direct";
|
|
29
28
|
export declare const DEFAULT_PLAYER_TYPE = "iife";
|
|
30
|
-
export declare const DEFAULT_LAZY_INIT =
|
|
29
|
+
export declare const DEFAULT_LAZY_INIT = false;
|
|
31
30
|
export declare const DEFAULT_ISOLATION = "inherit";
|
|
32
31
|
export declare const DEFAULT_ENV: Record<string, unknown>;
|
|
33
32
|
export type PlayerOverrides = {
|
|
33
|
+
/** The host has already loaded the item bundles; the player loads none. */
|
|
34
|
+
hosted?: boolean;
|
|
34
35
|
loaderConfig?: LoaderConfig;
|
|
35
36
|
loaderOptions?: Record<string, unknown>;
|
|
36
|
-
|
|
37
|
+
/** The item player's `backend` config, passed through unread. */
|
|
38
|
+
backend?: Record<string, unknown> | null;
|
|
37
39
|
};
|
|
38
40
|
export type FrameworkErrorHandler = (model: FrameworkErrorModel) => void;
|
|
39
41
|
export type StageChangeHandler = (detail: StageChangeDetail) => void;
|
|
@@ -61,48 +63,34 @@ export type RuntimeConfig = {
|
|
|
61
63
|
isolation?: string;
|
|
62
64
|
env?: Record<string, unknown>;
|
|
63
65
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* markup (the default). Purely visual — no engine effect.
|
|
69
|
-
*/
|
|
70
|
-
ndsIcons?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Interface locale: a BCP-47 tag naming the language the player renders its own
|
|
73
|
-
* UI in. Purely presentational — no engine effect.
|
|
74
|
-
*
|
|
75
|
-
* Distinct from content language, which describes the authored item and
|
|
76
|
-
* travels on `env`. QTI 3's implementation guide states the independence
|
|
77
|
-
* directly: a candidate may choose an interface language which may or may not
|
|
78
|
-
* also be the language of the content.
|
|
66
|
+
* Content language: a BCP-47 tag naming the language the authored content is
|
|
67
|
+
* written in, which read-aloud speaks it in and catalog lookups select
|
|
68
|
+
* alternates by. A `lang` in the content's markup wins over it. Purely
|
|
69
|
+
* presentational — no engine effect.
|
|
79
70
|
*
|
|
80
|
-
* Unset
|
|
71
|
+
* Unset reads as `en-US` wherever the markup names no language.
|
|
81
72
|
*/
|
|
82
|
-
|
|
83
|
-
toolConfigStrictness?: ToolConfigStrictness;
|
|
73
|
+
contentLanguage?: string;
|
|
84
74
|
onFrameworkError?: FrameworkErrorHandler;
|
|
75
|
+
/** Called with each `pie-stage-change` detail. */
|
|
85
76
|
onStageChange?: StageChangeHandler;
|
|
77
|
+
/** Called with each `pie-loading-complete` detail. */
|
|
86
78
|
onLoadingComplete?: LoadingCompleteHandler;
|
|
87
79
|
};
|
|
88
80
|
export type RuntimeInputs = {
|
|
89
|
-
assessmentId?: string;
|
|
90
|
-
toolConfigStrictness?: ToolConfigStrictness;
|
|
91
|
-
onFrameworkError?: FrameworkErrorHandler;
|
|
92
|
-
onStageChange?: StageChangeHandler;
|
|
93
|
-
onLoadingComplete?: LoadingCompleteHandler;
|
|
94
81
|
runtime: RuntimeConfig | null;
|
|
82
|
+
toolConfigStrictness?: ToolConfigStrictness;
|
|
95
83
|
};
|
|
96
84
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* this so every entry point converges on the same handler.
|
|
85
|
+
* The id a section runs under: the host's `section-id`, else the section's own
|
|
86
|
+
* `identifier`, else one named after the assessment. The toolkit keys the
|
|
87
|
+
* section's controller by it, and the layout kernel its stage cohort.
|
|
101
88
|
*/
|
|
102
|
-
export declare function
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
89
|
+
export declare function resolveSectionId(args: {
|
|
90
|
+
sectionId?: string | null;
|
|
91
|
+
section?: unknown;
|
|
92
|
+
assessmentId?: string | null;
|
|
93
|
+
}): string;
|
|
106
94
|
export declare function resolveToolsConfig(args: {
|
|
107
95
|
runtime: RuntimeConfig | null;
|
|
108
96
|
}): {
|
|
@@ -111,20 +99,18 @@ export declare function resolveToolsConfig(args: {
|
|
|
111
99
|
};
|
|
112
100
|
};
|
|
113
101
|
export declare function resolveRuntime(args: {
|
|
114
|
-
assessmentId: string;
|
|
115
102
|
runtime: RuntimeConfig | null;
|
|
116
103
|
effectiveToolsConfig: unknown;
|
|
117
104
|
toolConfigStrictness?: ToolConfigStrictness;
|
|
118
|
-
onFrameworkError?: FrameworkErrorHandler;
|
|
119
|
-
onStageChange?: StageChangeHandler;
|
|
120
|
-
onLoadingComplete?: LoadingCompleteHandler;
|
|
121
105
|
}): {
|
|
122
|
-
assessmentId: string | undefined;
|
|
123
106
|
playerType: string;
|
|
124
107
|
player: {
|
|
125
|
-
|
|
108
|
+
/** The host has already loaded the item bundles; the player loads none. */
|
|
109
|
+
hosted?: boolean;
|
|
126
110
|
loaderConfig?: LoaderConfig;
|
|
127
111
|
loaderOptions?: Record<string, unknown>;
|
|
112
|
+
/** The item player's `backend` config, passed through unread. */
|
|
113
|
+
backend?: Record<string, unknown> | null;
|
|
128
114
|
} | null;
|
|
129
115
|
lazyInit: boolean;
|
|
130
116
|
accessibility: Record<string, unknown> | null;
|
|
@@ -132,39 +118,25 @@ export declare function resolveRuntime(args: {
|
|
|
132
118
|
createSectionController: unknown;
|
|
133
119
|
isolation: string;
|
|
134
120
|
env: Record<string, unknown>;
|
|
135
|
-
toolConfigStrictness:
|
|
136
|
-
onFrameworkError: FrameworkErrorHandler | undefined;
|
|
137
|
-
onStageChange: StageChangeHandler | undefined;
|
|
138
|
-
onLoadingComplete: LoadingCompleteHandler | undefined;
|
|
121
|
+
toolConfigStrictness: ToolConfigStrictness;
|
|
139
122
|
tools: unknown;
|
|
123
|
+
assessmentId?: string;
|
|
140
124
|
toolContextResolvers?: Record<string, unknown> | null;
|
|
141
125
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* markup (the default). Purely visual — no engine effect.
|
|
147
|
-
*/
|
|
148
|
-
ndsIcons?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Interface locale: a BCP-47 tag naming the language the player renders its own
|
|
151
|
-
* UI in. Purely presentational — no engine effect.
|
|
126
|
+
* Content language: a BCP-47 tag naming the language the authored content is
|
|
127
|
+
* written in, which read-aloud speaks it in and catalog lookups select
|
|
128
|
+
* alternates by. A `lang` in the content's markup wins over it. Purely
|
|
129
|
+
* presentational — no engine effect.
|
|
152
130
|
*
|
|
153
|
-
*
|
|
154
|
-
* travels on `env`. QTI 3's implementation guide states the independence
|
|
155
|
-
* directly: a candidate may choose an interface language which may or may not
|
|
156
|
-
* also be the language of the content.
|
|
157
|
-
*
|
|
158
|
-
* Unset renders `en-US`. POSIX (`nl_NL`) and bare (`nl`) forms both resolve.
|
|
131
|
+
* Unset reads as `en-US` wherever the markup names no language.
|
|
159
132
|
*/
|
|
160
|
-
|
|
133
|
+
contentLanguage?: string;
|
|
134
|
+
onFrameworkError?: FrameworkErrorHandler;
|
|
135
|
+
/** Called with each `pie-stage-change` detail. */
|
|
136
|
+
onStageChange?: StageChangeHandler;
|
|
137
|
+
/** Called with each `pie-loading-complete` detail. */
|
|
138
|
+
onLoadingComplete?: LoadingCompleteHandler;
|
|
161
139
|
};
|
|
162
|
-
/**
|
|
163
|
-
* Effective runtime returned by `resolveRuntime`. The shape is exposed
|
|
164
|
-
* as `unknown` at the public boundary because consumers spread it into
|
|
165
|
-
* arbitrary host props; downstream call sites narrow with the specific
|
|
166
|
-
* keys they need.
|
|
167
|
-
*/
|
|
168
140
|
export type EffectiveRuntime = ReturnType<typeof resolveRuntime>;
|
|
169
141
|
/**
|
|
170
142
|
* Engine-side orchestrator that powers `resolveSectionPlayerRuntimeState`
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine resolver
|
|
2
|
+
* Section runtime engine resolver.
|
|
3
3
|
*
|
|
4
4
|
* Canonical home of `resolveRuntime`, `resolveToolsConfig`, and their
|
|
5
|
-
* supporting helpers/types
|
|
6
|
-
*
|
|
7
|
-
* have been deleted; section-player now consumes these helpers via
|
|
8
|
-
* `@pie-players/pie-assessment-toolkit/runtime/internal`.
|
|
5
|
+
* supporting helpers/types; section-player consumes them through
|
|
6
|
+
* `@pie-players/pie-assessment-toolkit/runtime/engine`.
|
|
9
7
|
*
|
|
10
8
|
* What is NOT absorbed in this module:
|
|
11
9
|
* - `resolvePlayerRuntime` stays in section-player because it depends on
|
|
@@ -18,33 +16,26 @@
|
|
|
18
16
|
* `packages/section-player/src/components/shared/section-player-host-runtime.ts`)
|
|
19
17
|
* hands its local implementation in.
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Each input has one tier. `assessmentId`, the tools and player config and the
|
|
20
|
+
* `on*` callbacks arrive on `runtime`. The primitive inputs (`nds-icons`,
|
|
21
|
+
* `locale`, `tool-config-strictness`) are element attributes; the resolver takes
|
|
22
|
+
* `toolConfigStrictness` beside `runtime`.
|
|
23
23
|
*/
|
|
24
|
-
export const DEFAULT_ASSESSMENT_ID = "section-demo-direct";
|
|
25
24
|
export const DEFAULT_PLAYER_TYPE = "iife";
|
|
26
|
-
export const DEFAULT_LAZY_INIT =
|
|
25
|
+
export const DEFAULT_LAZY_INIT = false;
|
|
27
26
|
export const DEFAULT_ISOLATION = "inherit";
|
|
28
27
|
export const DEFAULT_ENV = { mode: "gather", role: "student" };
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* The id a section runs under: the host's `section-id`, else the section's own
|
|
30
|
+
* `identifier`, else one named after the assessment. The toolkit keys the
|
|
31
|
+
* section's controller by it, and the layout kernel its stage cohort.
|
|
33
32
|
*/
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* then top-level `onFrameworkError`. Layout CEs and the kernel call
|
|
41
|
-
* this so every entry point converges on the same handler.
|
|
42
|
-
*/
|
|
43
|
-
export function resolveOnFrameworkError(args) {
|
|
44
|
-
const r = args.runtime ?? {};
|
|
45
|
-
if (r.onFrameworkError !== undefined)
|
|
46
|
-
return r.onFrameworkError;
|
|
47
|
-
return args.onFrameworkError;
|
|
33
|
+
export function resolveSectionId(args) {
|
|
34
|
+
const identifier = args.section
|
|
35
|
+
?.identifier;
|
|
36
|
+
return (args.sectionId ||
|
|
37
|
+
(typeof identifier === "string" ? identifier : "") ||
|
|
38
|
+
`section-${args.assessmentId || "default"}`);
|
|
48
39
|
}
|
|
49
40
|
export function resolveToolsConfig(args) {
|
|
50
41
|
const runtimeTools = (args.runtime?.tools || {});
|
|
@@ -58,7 +49,6 @@ export function resolveRuntime(args) {
|
|
|
58
49
|
const runtimePlayer = r.player ? { ...r.player } : null;
|
|
59
50
|
return {
|
|
60
51
|
...r,
|
|
61
|
-
assessmentId: pick(r.assessmentId, args.assessmentId),
|
|
62
52
|
playerType: r.playerType ?? DEFAULT_PLAYER_TYPE,
|
|
63
53
|
player: runtimePlayer,
|
|
64
54
|
lazyInit: r.lazyInit ?? DEFAULT_LAZY_INIT,
|
|
@@ -67,17 +57,7 @@ export function resolveRuntime(args) {
|
|
|
67
57
|
createSectionController: r.createSectionController,
|
|
68
58
|
isolation: r.isolation ?? DEFAULT_ISOLATION,
|
|
69
59
|
env: r.env ?? DEFAULT_ENV,
|
|
70
|
-
toolConfigStrictness:
|
|
71
|
-
// Runtime callback wins; top-level callback remains a layout CE event
|
|
72
|
-
// convenience for hosts that do not use DOM listeners.
|
|
73
|
-
onFrameworkError: resolveOnFrameworkError({
|
|
74
|
-
runtime: args.runtime,
|
|
75
|
-
onFrameworkError: args.onFrameworkError,
|
|
76
|
-
}),
|
|
77
|
-
// Runtime callback wins over the top-level callback prop.
|
|
78
|
-
onStageChange: pick(r.onStageChange, args.onStageChange),
|
|
79
|
-
// Runtime callback wins over the top-level callback prop.
|
|
80
|
-
onLoadingComplete: pick(r.onLoadingComplete, args.onLoadingComplete),
|
|
60
|
+
toolConfigStrictness: args.toolConfigStrictness ?? "error",
|
|
81
61
|
tools: args.effectiveToolsConfig,
|
|
82
62
|
};
|
|
83
63
|
}
|
|
@@ -88,18 +68,13 @@ export function resolveRuntime(args) {
|
|
|
88
68
|
* stays free of host-coupled defaults (`DEFAULT_PLAYER_DEFINITIONS`).
|
|
89
69
|
*/
|
|
90
70
|
export function resolveSectionEngineRuntimeState(args, deps) {
|
|
91
|
-
const assessmentId = args.assessmentId ?? DEFAULT_ASSESSMENT_ID;
|
|
92
71
|
const effectiveToolsConfig = resolveToolsConfig({
|
|
93
72
|
runtime: args.runtime,
|
|
94
73
|
});
|
|
95
74
|
const effectiveRuntime = resolveRuntime({
|
|
96
|
-
assessmentId,
|
|
97
75
|
runtime: args.runtime,
|
|
98
76
|
effectiveToolsConfig,
|
|
99
77
|
toolConfigStrictness: args.toolConfigStrictness,
|
|
100
|
-
onFrameworkError: args.onFrameworkError,
|
|
101
|
-
onStageChange: args.onStageChange,
|
|
102
|
-
onLoadingComplete: args.onLoadingComplete,
|
|
103
78
|
});
|
|
104
79
|
const playerRuntime = deps.resolvePlayerRuntime({
|
|
105
80
|
effectiveRuntime: effectiveRuntime,
|
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine state
|
|
2
|
+
* Section runtime engine state.
|
|
3
3
|
*
|
|
4
|
-
* The state object is the single source of truth for stage, cohort
|
|
5
|
-
* readiness signals
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
* PR 2) reads the state via `SectionEngineCore.getState()` and emits
|
|
9
|
-
* the bundled `SectionEngineOutput[]` to its bridges.
|
|
4
|
+
* The state object is the single source of truth for stage, cohort and
|
|
5
|
+
* readiness signals across one engine instance. The transition function in
|
|
6
|
+
* `engine-transition.ts` is its only mutator; the adapter reads it through
|
|
7
|
+
* `SectionEngineCore.getState()`.
|
|
10
8
|
*
|
|
11
|
-
* Phases
|
|
12
|
-
* this list to four phases that map 1:1 onto the M6 canonical stages:
|
|
9
|
+
* Phases map onto the canonical stages:
|
|
13
10
|
*
|
|
14
|
-
* `idle` → no cohort yet
|
|
15
|
-
* `booting-section` → cohort known, controller
|
|
16
|
-
* `engine-ready` → controller resolved.
|
|
17
|
-
* `interactive` → readiness gate satisfied.
|
|
18
|
-
* `
|
|
11
|
+
* `idle` → no cohort yet. No stage.
|
|
12
|
+
* `booting-section` → cohort known, controller pending. Stage `composed`.
|
|
13
|
+
* `engine-ready` → controller resolved. Stage `engine-ready`.
|
|
14
|
+
* `interactive` → readiness gate satisfied. Stage `interactive`.
|
|
15
|
+
* `failed` → a runtime error ended the cohort's chain before
|
|
16
|
+
* `interactive`. No stage of its own: the transition
|
|
17
|
+
* records the stages it did not reach as `failed` and
|
|
18
|
+
* `skipped`.
|
|
19
|
+
* `disposed` → engine torn down. Stage `disposed`.
|
|
19
20
|
*
|
|
20
|
-
* `loading-complete` is
|
|
21
|
-
*
|
|
22
|
-
* readiness signals satisfy `allLoadingComplete`. See
|
|
23
|
-
* `engine-output.ts` for the output shape and the implementation
|
|
24
|
-
* plan's Adjustment A2 fence.
|
|
21
|
+
* `loading-complete` is an output, emitted once per cohort when the readiness
|
|
22
|
+
* signals report every item loaded.
|
|
25
23
|
*/
|
|
26
24
|
import type { CohortKey } from "./cohort.js";
|
|
27
25
|
import type { EffectiveRuntime } from "./engine-resolver.js";
|
|
28
26
|
import type { EngineReadinessSignals } from "./engine-readiness.js";
|
|
29
|
-
|
|
30
|
-
export type SectionEnginePhase = "idle" | "booting-section" | "engine-ready" | "interactive" | "disposed";
|
|
27
|
+
export type SectionEnginePhase = "idle" | "booting-section" | "engine-ready" | "interactive" | "failed" | "disposed";
|
|
31
28
|
export type SectionEngineState = {
|
|
32
29
|
/** Current FSM phase. The single source of truth for stage derivation. */
|
|
33
30
|
phase: SectionEnginePhase;
|
|
@@ -45,13 +42,17 @@ export type SectionEngineState = {
|
|
|
45
42
|
*/
|
|
46
43
|
controllerResolved: boolean;
|
|
47
44
|
/**
|
|
48
|
-
* Readiness signal snapshot
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* applied at derivation time via `createReadinessDetail`, not by
|
|
52
|
-
* mutating the signals.
|
|
45
|
+
* Readiness signal snapshot, replaced by each `update-readiness-signals`
|
|
46
|
+
* input from the host. Strict-mode gating is applied at derivation time
|
|
47
|
+
* through `resolveReadinessGates`.
|
|
53
48
|
*/
|
|
54
49
|
readinessSignals: EngineReadinessSignals;
|
|
50
|
+
/**
|
|
51
|
+
* Readiness mode of the last `update-readiness-signals` input. Kept with
|
|
52
|
+
* the signals so `section-controller-resolved` can apply a snapshot that
|
|
53
|
+
* arrived while the controller was pending.
|
|
54
|
+
*/
|
|
55
|
+
readinessMode: "progressive" | "strict";
|
|
55
56
|
/** Last resolved effective runtime (output of `resolveRuntime`). */
|
|
56
57
|
effectiveRuntime: EffectiveRuntime | null;
|
|
57
58
|
/** Last resolved tools config. */
|
|
@@ -63,17 +64,8 @@ export type SectionEngineState = {
|
|
|
63
64
|
* preserved by gating emission on this flag in the transition.
|
|
64
65
|
*/
|
|
65
66
|
loadingCompleteEmitted: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Most recent framework error, if any. The engine routes errors
|
|
68
|
-
* through outputs, not through state — this field is kept so
|
|
69
|
-
* subscribers asking for the latest snapshot (e.g. error banners)
|
|
70
|
-
* can read it without replaying the output stream.
|
|
71
|
-
*/
|
|
72
|
-
lastFrameworkError: FrameworkErrorModel | null;
|
|
73
|
-
/** Number of items the host has registered for the current cohort. */
|
|
67
|
+
/** Number of items in the current cohort's composition. */
|
|
74
68
|
itemCount: number;
|
|
75
|
-
/** Number of items reported as loaded. */
|
|
76
|
-
loadedCount: number;
|
|
77
69
|
};
|
|
78
70
|
/**
|
|
79
71
|
* Initial state. Kept as a function so callers cannot mutate a shared
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine state
|
|
2
|
+
* Section runtime engine state.
|
|
3
3
|
*
|
|
4
|
-
* The state object is the single source of truth for stage, cohort
|
|
5
|
-
* readiness signals
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
* PR 2) reads the state via `SectionEngineCore.getState()` and emits
|
|
9
|
-
* the bundled `SectionEngineOutput[]` to its bridges.
|
|
4
|
+
* The state object is the single source of truth for stage, cohort and
|
|
5
|
+
* readiness signals across one engine instance. The transition function in
|
|
6
|
+
* `engine-transition.ts` is its only mutator; the adapter reads it through
|
|
7
|
+
* `SectionEngineCore.getState()`.
|
|
10
8
|
*
|
|
11
|
-
* Phases
|
|
12
|
-
* this list to four phases that map 1:1 onto the M6 canonical stages:
|
|
9
|
+
* Phases map onto the canonical stages:
|
|
13
10
|
*
|
|
14
|
-
* `idle` → no cohort yet
|
|
15
|
-
* `booting-section` → cohort known, controller
|
|
16
|
-
* `engine-ready` → controller resolved.
|
|
17
|
-
* `interactive` → readiness gate satisfied.
|
|
18
|
-
* `
|
|
11
|
+
* `idle` → no cohort yet. No stage.
|
|
12
|
+
* `booting-section` → cohort known, controller pending. Stage `composed`.
|
|
13
|
+
* `engine-ready` → controller resolved. Stage `engine-ready`.
|
|
14
|
+
* `interactive` → readiness gate satisfied. Stage `interactive`.
|
|
15
|
+
* `failed` → a runtime error ended the cohort's chain before
|
|
16
|
+
* `interactive`. No stage of its own: the transition
|
|
17
|
+
* records the stages it did not reach as `failed` and
|
|
18
|
+
* `skipped`.
|
|
19
|
+
* `disposed` → engine torn down. Stage `disposed`.
|
|
19
20
|
*
|
|
20
|
-
* `loading-complete` is
|
|
21
|
-
*
|
|
22
|
-
* readiness signals satisfy `allLoadingComplete`. See
|
|
23
|
-
* `engine-output.ts` for the output shape and the implementation
|
|
24
|
-
* plan's Adjustment A2 fence.
|
|
21
|
+
* `loading-complete` is an output, emitted once per cohort when the readiness
|
|
22
|
+
* signals report every item loaded.
|
|
25
23
|
*/
|
|
26
24
|
/**
|
|
27
25
|
* Initial state. Kept as a function so callers cannot mutate a shared
|
|
@@ -38,11 +36,10 @@ export function createInitialEngineState() {
|
|
|
38
36
|
allLoadingComplete: false,
|
|
39
37
|
runtimeError: false,
|
|
40
38
|
},
|
|
39
|
+
readinessMode: "progressive",
|
|
41
40
|
effectiveRuntime: null,
|
|
42
41
|
effectiveToolsConfig: null,
|
|
43
42
|
loadingCompleteEmitted: false,
|
|
44
|
-
lastFrameworkError: null,
|
|
45
43
|
itemCount: 0,
|
|
46
|
-
loadedCount: 0,
|
|
47
44
|
};
|
|
48
45
|
}
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pure transition function for the section runtime engine
|
|
3
|
-
* C, layered core).
|
|
2
|
+
* Pure transition function for the section runtime engine.
|
|
4
3
|
*
|
|
5
4
|
* `transition(state, input)` is total over `(state, input)` pairs and
|
|
6
5
|
* returns:
|
|
7
|
-
* - the next `SectionEngineState` (
|
|
8
|
-
*
|
|
9
|
-
* - the ordered list of `SectionEngineOutput`s the adapter
|
|
10
|
-
* dispatch (DOM events, framework-error fan-out, etc.).
|
|
6
|
+
* - the next `SectionEngineState` (the input state object is never
|
|
7
|
+
* mutated);
|
|
8
|
+
* - the ordered list of `SectionEngineOutput`s the adapter dispatches.
|
|
11
9
|
*
|
|
12
|
-
* The function imports nothing from Svelte, the DOM, or the
|
|
13
|
-
*
|
|
14
|
-
* step in the M7 implementation plan.
|
|
10
|
+
* The function imports nothing from Svelte, the DOM, or the coordinator;
|
|
11
|
+
* `scripts/check-engine-core-purity.mjs` enforces that.
|
|
15
12
|
*
|
|
16
13
|
* Phase machine (per `engine-state.ts`):
|
|
17
14
|
* idle → booting-section → engine-ready → interactive → disposed
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* booting-section | engine-ready → failed → disposed
|
|
16
|
+
* (cohort-change emits `disposed` for the outgoing cohort and restarts at
|
|
17
|
+
* booting-section for the new one)
|
|
18
|
+
*
|
|
19
|
+
* A readiness update that reports `runtimeError` before `interactive` ends the
|
|
20
|
+
* chain: the first stage the cohort did not reach is recorded as `failed` and
|
|
21
|
+
* any after it as `skipped`, so a host waiting on `engine-ready` or
|
|
22
|
+
* `interactive` always hears an answer.
|
|
20
23
|
*
|
|
21
24
|
* Output ordering invariants:
|
|
22
25
|
* 1. `stage-change` for stage advancement fires before any
|
|
23
26
|
* `loading-complete` triggered by the same input.
|
|
24
27
|
* 2. `loading-complete` fires once per cohort, gated on
|
|
25
28
|
* `state.loadingCompleteEmitted`.
|
|
26
|
-
* 3. `framework-error` outputs are independent of the stage chain
|
|
27
|
-
* and do not move the phase.
|
|
28
|
-
*
|
|
29
|
-
* Readiness alias output kinds (`readiness-change`,
|
|
30
|
-
* `interaction-ready`, `ready`) and their DOM-event bridge were
|
|
31
|
-
* removed in the broad architecture review compat sweep. Hosts that
|
|
32
|
-
* need the readiness detail read it via the kernel's `selectReadiness`
|
|
33
|
-
* / `getSnapshot` selectors or via `SectionEngineCore.getState()`.
|
|
34
29
|
*/
|
|
35
30
|
import type { SectionEngineInput } from "./engine-input.js";
|
|
36
31
|
import type { SectionEngineOutput } from "./engine-output.js";
|