@pie-players/pie-assessment-toolkit 0.3.74 → 0.3.75
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 +349 -313
- package/dist/attempt/TestSession.d.ts +1 -20
- package/dist/attempt/TestSession.js +8 -99
- 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-7tt7v2xp.js +4 -0
- package/dist/components/chunks/{ItemToolBar-gmrryv2v.js → ItemToolBar-97hx60z4.js} +1 -1
- package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +2 -0
- package/dist/components/chunks/ItemToolBar-jx38w99s.js +2 -0
- package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +40 -0
- package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
- package/dist/components/chunks/sre-engine-jd8cc08x.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 +27 -6
- package/dist/index.d.ts +22 -47
- package/dist/index.js +12 -36
- package/dist/policy/core/PolicySource.d.ts +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +77 -32
- package/dist/policy/core/ToolPolicyEngine.js +136 -46
- package/dist/policy/core/compose-decision.d.ts +28 -7
- package/dist/policy/core/compose-decision.js +75 -54
- package/dist/policy/core/decision-types.d.ts +65 -34
- package/dist/policy/core/feature-decision.d.ts +16 -9
- package/dist/policy/core/feature-decision.js +14 -8
- package/dist/policy/core/pnp-policy-inputs.d.ts +24 -33
- package/dist/policy/core/pnp-policy-inputs.js +28 -56
- package/dist/policy/core/provenance.d.ts +9 -4
- package/dist/policy/core/provenance.js +1 -1
- package/dist/policy/engine.d.ts +7 -23
- package/dist/policy/engine.js +5 -20
- package/dist/policy/sources/PnpPolicySource.d.ts +44 -61
- package/dist/policy/sources/PnpPolicySource.js +117 -118
- package/dist/runtime/SectionControllerBinding.d.ts +279 -0
- package/dist/runtime/SectionControllerBinding.js +450 -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 -2
- package/dist/runtime/adapter/subscriber-fanout.js +1 -2
- 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 +9 -15
- package/dist/runtime/composition-emit-scheduler.js +9 -15
- package/dist/runtime/content-language.d.ts +32 -0
- package/dist/runtime/content-language.js +46 -0
- package/dist/runtime/content-region.d.ts +17 -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 -2
- package/dist/runtime/core/SectionEngineCore.js +2 -2
- package/dist/runtime/core/cohort.d.ts +1 -1
- package/dist/runtime/core/cohort.js +1 -1
- 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 +16 -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 +71 -51
- 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 +11 -0
- package/dist/runtime/runtime-event-claim.d.ts +8 -0
- package/dist/runtime/runtime-event-claim.js +15 -0
- 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 +188 -0
- package/dist/runtime/tool-host-contract.d.ts +8 -10
- package/dist/runtime/tool-host-contract.js +11 -11
- package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
- package/dist/runtime/unclaimed-registration-watch.js +23 -0
- package/dist/services/ElementToolStateStore.d.ts +14 -10
- package/dist/services/ElementToolStateStore.js +37 -13
- package/dist/services/HighlightCoordinator.d.ts +21 -21
- package/dist/services/HighlightCoordinator.js +431 -325
- package/dist/services/RangeSerializer.d.ts +10 -1
- package/dist/services/RangeSerializer.js +87 -14
- package/dist/services/TTSService.d.ts +117 -70
- package/dist/services/TTSService.js +668 -578
- package/dist/services/ToolCoordinator.d.ts +43 -60
- package/dist/services/ToolCoordinator.js +164 -206
- package/dist/services/ToolRegistry.d.ts +74 -57
- package/dist/services/ToolRegistry.js +104 -114
- package/dist/services/ToolkitCoordinator.d.ts +183 -189
- package/dist/services/ToolkitCoordinator.js +477 -431
- 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 +22 -7
- package/dist/services/framework-error.js +9 -7
- package/dist/services/interfaces.d.ts +158 -129
- package/dist/services/section-session-assignment.d.ts +21 -0
- package/dist/services/section-session-assignment.js +82 -0
- package/dist/services/spoken-audio-cards.d.ts +0 -2
- package/dist/services/spoken-audio-cards.js +0 -2
- 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 +4 -5
- package/dist/services/tool-config-validation.js +36 -61
- package/dist/services/tool-context.d.ts +0 -8
- package/dist/services/tool-context.js +0 -12
- package/dist/services/tool-icons.d.ts +4 -3
- package/dist/services/tool-icons.js +4 -3
- package/dist/services/tool-instance-id.d.ts +0 -1
- package/dist/services/tool-instance-id.js +0 -6
- package/dist/services/tool-providers/TTSToolProvider.d.ts +18 -19
- package/dist/services/tool-providers/TTSToolProvider.js +37 -34
- package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -4
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +30 -26
- package/dist/services/tool-providers/ToolProviderRegistry.js +119 -93
- package/dist/services/tool-request.d.ts +27 -12
- package/dist/services/tool-request.js +24 -14
- package/dist/services/toolbar-decided-tools.d.ts +15 -0
- package/dist/services/toolbar-decided-tools.js +28 -0
- package/dist/services/tools-config-normalizer.d.ts +17 -22
- package/dist/services/tools-config-normalizer.js +2 -10
- package/dist/services/tts/browser-provider.d.ts +38 -2
- package/dist/services/tts/browser-provider.js +276 -140
- package/dist/services/tts/flat-tree.d.ts +71 -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/math-speech-cache.d.ts +3 -1
- package/dist/services/tts/generated-speech/math-speech-cache.js +5 -1
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +12 -4
- 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/math-aware-text-processing.d.ts +5 -1
- package/dist/services/tts/math-aware-text-processing.js +32 -18
- 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 +11 -0
- package/dist/services/tts/math-speech.js +51 -18
- package/dist/services/tts/provider-options.d.ts +41 -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 +11 -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 +7 -0
- package/dist/services/tts/text-segmentation.js +47 -0
- package/dist/services/tts-runtime-config.d.ts +25 -17
- package/dist/services/tts-runtime-config.js +16 -95
- package/dist/tools/content-capability-resolution.d.ts +7 -9
- package/dist/tools/content-capability-resolution.js +8 -45
- package/dist/tools/registration.d.ts +58 -0
- package/dist/tools/registration.js +54 -0
- package/dist/tools/registrations/toolbar-registration-helpers.js +2 -2
- package/dist/tools/tool-surface-host.d.ts +6 -10
- package/dist/tools/tool-surface-host.js +44 -42
- 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 +13 -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/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/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
|
@@ -1,197 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine —
|
|
2
|
+
* Section runtime engine — the section player's stage chain.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The section player's layout kernel owns one per layout element and drives it
|
|
5
|
+
* with `dispatchInput`: the cohort it shows (`initialize`, `cohort-change`,
|
|
6
|
+
* `update-runtime`), the controller resolving (`section-controller-resolved`),
|
|
7
|
+
* and the readiness signals it derives (`update-readiness-signals`). The pure
|
|
8
|
+
* FSM core turns those into `pie-stage-change` and `pie-loading-complete`,
|
|
9
|
+
* which the adapter dispatches on the layout element, bubbling and composed;
|
|
10
|
+
* `subscribe` receives the same outputs in batches.
|
|
7
11
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* bus, instrumentation hook, and host subscribers;
|
|
13
|
-
* - the **resolver** (`resolveSectionEngineRuntimeState`) — the
|
|
14
|
-
* toolkit-side resolution helper that produces the effective
|
|
15
|
-
* runtime + tools snapshot a host feeds to the FSM core.
|
|
12
|
+
* The engine is the only stage emitter. It holds no controller and no
|
|
13
|
+
* registry: the toolkit's `SectionControllerBinding` owns those. The kernel
|
|
14
|
+
* learns that the controller resolved from the toolkit's `section-ready`, whose
|
|
15
|
+
* detail carries the controller and its cohort.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* controller commands:
|
|
20
|
-
*
|
|
21
|
-
* 1. The **engine-side** surface (`attachHost`, `dispatchInput`,
|
|
22
|
-
* `subscribe`, `getState`, `getEffectiveRuntime`,
|
|
23
|
-
* `setInstrumentationHook`). This is what the kernel and the
|
|
24
|
-
* `pie-assessment-toolkit` CE will switch onto in M7 PR 5 and
|
|
25
|
-
* PR 6. Construction is lazy: `attachHost(...)` builds the
|
|
26
|
-
* adapter on first call, with the supplied host element,
|
|
27
|
-
* framework-error bus, and (optional) coordinator. After
|
|
28
|
-
* construction, host re-attachments (e.g. cohort change with a
|
|
29
|
-
* new layout shell) update the adapter's host element via
|
|
30
|
-
* `setHost(...)`.
|
|
31
|
-
*
|
|
32
|
-
* 2. The **controller-side** surface (`initialize`,
|
|
33
|
-
* `register`, `unregister`, `handleContent*`, `updateItemSession`,
|
|
34
|
-
* `navigateToItem`, `persist`, `hydrate`, `dispose`). The
|
|
35
|
-
* `PieAssessmentToolkit.svelte` CE drives section-controller and
|
|
36
|
-
* item-shell events through this surface.
|
|
37
|
-
*
|
|
38
|
-
* The two surfaces share `RuntimeRegistry` and the resolved
|
|
39
|
-
* `SectionControllerHandle`.
|
|
17
|
+
* `attachHost(...)` builds the adapter on first call; a later call moves it to
|
|
18
|
+
* a new host element.
|
|
40
19
|
*/
|
|
41
|
-
import type { ToolkitCoordinator } from "../services/ToolkitCoordinator.js";
|
|
42
|
-
import type { FrameworkErrorReporter } from "../services/framework-error-bus.js";
|
|
43
|
-
import type { SectionControllerEvent, SectionControllerHandle } from "../services/section-controller-types.js";
|
|
44
|
-
import { type SectionEngineAdapterOptions } from "./adapter/SectionEngineAdapter.js";
|
|
45
|
-
import type { InstrumentationHook } from "./adapter/instrumentation-bridge.js";
|
|
46
20
|
import type { EngineOutputListener } from "./adapter/subscriber-fanout.js";
|
|
47
21
|
import type { SectionEngineInput } from "./core/engine-input.js";
|
|
48
22
|
import type { SectionEngineOutput } from "./core/engine-output.js";
|
|
49
|
-
import { type EffectiveRuntime, type RuntimeInputs } from "./core/engine-resolver.js";
|
|
50
23
|
import { type SectionEngineState } from "./core/engine-state.js";
|
|
51
|
-
|
|
52
|
-
import type { RuntimeRegistrationDetail } from "./registration-events.js";
|
|
53
|
-
import { RuntimeRegistry } from "./RuntimeRegistry.js";
|
|
54
|
-
/**
|
|
55
|
-
* Structural view of the resolved section controller, widened with the
|
|
56
|
-
* extra methods the toolkit's runtime CE calls directly. Optional so
|
|
57
|
-
* stub controllers used in tests do not need every entry point.
|
|
58
|
-
*/
|
|
59
|
-
interface RuntimeController extends SectionControllerHandle {
|
|
60
|
-
getCompositionModel?: () => unknown;
|
|
61
|
-
getCanonicalItemId?: (itemId: string) => string;
|
|
62
|
-
handleContentLoaded?: (args: {
|
|
63
|
-
itemId: string;
|
|
64
|
-
canonicalItemId?: string;
|
|
65
|
-
contentKind?: string;
|
|
66
|
-
detail?: unknown;
|
|
67
|
-
timestamp?: number;
|
|
68
|
-
}) => void;
|
|
69
|
-
handleContentRegistered?: (args: {
|
|
70
|
-
itemId: string;
|
|
71
|
-
canonicalItemId?: string;
|
|
72
|
-
contentKind?: string;
|
|
73
|
-
}) => void;
|
|
74
|
-
handleContentUnregistered?: (args: {
|
|
75
|
-
itemId: string;
|
|
76
|
-
canonicalItemId?: string;
|
|
77
|
-
contentKind?: string;
|
|
78
|
-
}) => void;
|
|
79
|
-
handleItemPlayerError?: (args: {
|
|
80
|
-
itemId: string;
|
|
81
|
-
canonicalItemId?: string;
|
|
82
|
-
contentKind?: string;
|
|
83
|
-
error: unknown;
|
|
84
|
-
timestamp?: number;
|
|
85
|
-
}) => void;
|
|
86
|
-
reportSectionError?: (args: {
|
|
87
|
-
source: "item-player" | "section-runtime" | "toolkit" | "controller";
|
|
88
|
-
error: unknown;
|
|
89
|
-
itemId?: string;
|
|
90
|
-
canonicalItemId?: string;
|
|
91
|
-
contentKind?: string;
|
|
92
|
-
timestamp?: number;
|
|
93
|
-
}) => void;
|
|
94
|
-
updateItemSession?: (itemId: string, sessionDetail: unknown) => {
|
|
95
|
-
eventDetail?: unknown;
|
|
96
|
-
} | null;
|
|
97
|
-
subscribe?: (listener: (event: SectionControllerEvent) => void) => () => void;
|
|
98
|
-
navigateToItem?: (index: number) => unknown;
|
|
99
|
-
attachMediaTimeSource?: (source: MediaTimeSource, options?: {
|
|
100
|
-
origin?: "native-adapter" | "host";
|
|
101
|
-
renderableId?: string;
|
|
102
|
-
}) => void;
|
|
103
|
-
detachMediaTimeSource?: (options?: {
|
|
104
|
-
origin?: "native-adapter" | "host";
|
|
105
|
-
}) => void;
|
|
106
|
-
pauseMediaForCompetingAudio?: () => boolean;
|
|
107
|
-
}
|
|
108
|
-
/** What a media-time-source registration reaching the engine has to say. */
|
|
109
|
-
export interface SectionRuntimeMediaTimeSourceAction {
|
|
110
|
-
renderableId: string;
|
|
111
|
-
action: "attach" | "detach";
|
|
112
|
-
source?: MediaTimeSource;
|
|
113
|
-
origin?: "native-adapter" | "host";
|
|
114
|
-
}
|
|
115
|
-
/** What a formative action reaching the engine has to say. */
|
|
116
|
-
export interface SectionRuntimeFormativeAction {
|
|
117
|
-
itemId: string;
|
|
118
|
-
action: "check" | "retry";
|
|
119
|
-
outcomes?: unknown[];
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Initialize args used by the toolkit CE to resolve the coordinator-backed
|
|
123
|
-
* section controller.
|
|
124
|
-
*/
|
|
125
|
-
interface EngineInitArgs {
|
|
126
|
-
coordinator: ToolkitCoordinator;
|
|
127
|
-
section: unknown;
|
|
128
|
-
sectionId: string;
|
|
129
|
-
assessmentId: string;
|
|
130
|
-
view: string;
|
|
131
|
-
attemptId?: string;
|
|
132
|
-
createDefaultController: () => Promise<RuntimeController> | RuntimeController;
|
|
133
|
-
onCompositionChanged?: (composition: unknown) => void;
|
|
134
|
-
/**
|
|
135
|
-
* The controller event that caused a republish, for the few events the toolkit
|
|
136
|
-
* has to act on rather than merely propagate — a timed-media policy that cannot
|
|
137
|
-
* be enforced becomes a framework warning, and malformed cue data becomes a
|
|
138
|
-
* framework error. Every other event reaches hosts through the composition
|
|
139
|
-
* republish and the coordinator's own subscriptions.
|
|
140
|
-
*/
|
|
141
|
-
onControllerEvent?: (event: SectionControllerEvent) => void;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Engine-side `attachHost` args. The host element, framework-error bus,
|
|
145
|
-
* and `sourceCe` together let the adapter dispatch DOM events and bus
|
|
146
|
-
* fan-outs consistently with the kernel emit chain.
|
|
147
|
-
*/
|
|
24
|
+
/** `attachHost` args: the element events are dispatched on, and its tag. */
|
|
148
25
|
export interface SectionRuntimeEngineHostArgs {
|
|
149
26
|
host: EventTarget;
|
|
150
27
|
sourceCe: string;
|
|
151
|
-
frameworkErrorBus: FrameworkErrorReporter;
|
|
152
|
-
coordinator?: SectionEngineAdapterOptions["coordinator"];
|
|
153
|
-
instrumentationHook?: InstrumentationHook;
|
|
154
28
|
now?: () => string;
|
|
155
29
|
}
|
|
156
30
|
export declare class SectionRuntimeEngine {
|
|
157
|
-
private readonly registry;
|
|
158
31
|
private readonly runtimeId;
|
|
159
32
|
private adapter;
|
|
160
|
-
private controller;
|
|
161
|
-
private coordinator;
|
|
162
|
-
private sectionId;
|
|
163
|
-
private attemptId;
|
|
164
|
-
private unsubscribeController;
|
|
165
|
-
private activeInitToken;
|
|
166
|
-
/**
|
|
167
|
-
* Tracks which `(canonicalItemId, contentKind)` pairs have already
|
|
168
|
-
* fired `handleContentLoaded` on this engine. Mirrored alongside
|
|
169
|
-
* `RuntimeRegistry`'s registered set so a cohort handoff can
|
|
170
|
-
* replay the persistent shells' loaded state into the new
|
|
171
|
-
* controller — see `replayRegisteredShellsIntoController` and the
|
|
172
|
-
* PIE-512 Phase B regression test.
|
|
173
|
-
*
|
|
174
|
-
* Cleared in lockstep with `handleContentUnregistered` and on
|
|
175
|
-
* `dispose`. Not exposed publicly: the registry alone is the
|
|
176
|
-
* external surface; the loaded set exists only to seed cohort B's
|
|
177
|
-
* controller with the live state cohort A's shells produced.
|
|
178
|
-
*/
|
|
179
|
-
private readonly loadedRenderableKeys;
|
|
180
33
|
/**
|
|
181
|
-
* Attach the host element
|
|
182
|
-
*
|
|
183
|
-
*
|
|
34
|
+
* Attach the host element and `sourceCe` the adapter dispatches DOM events
|
|
35
|
+
* with. Required before `dispatchInput` / `subscribe` produce observable
|
|
36
|
+
* effects.
|
|
184
37
|
*
|
|
185
|
-
* Constructs the adapter on the first call. Subsequent calls keep
|
|
186
|
-
*
|
|
187
|
-
* (used by layout-shell rollovers and instrumentation reconfig).
|
|
38
|
+
* Constructs the adapter on the first call. Subsequent calls keep the
|
|
39
|
+
* adapter and update its host element.
|
|
188
40
|
*/
|
|
189
41
|
attachHost(args: SectionRuntimeEngineHostArgs): void;
|
|
190
42
|
/**
|
|
191
43
|
* Forward a host-constructed input to the FSM core via the adapter.
|
|
192
44
|
* Returns the outputs the transition produced (subscribers and the
|
|
193
|
-
* DOM
|
|
194
|
-
* received them).
|
|
45
|
+
* DOM bridge have already received them).
|
|
195
46
|
*
|
|
196
47
|
* No-op (returns `[]`) before `attachHost(...)` so callers that
|
|
197
48
|
* dispatch optimistically during teardown do not throw.
|
|
@@ -211,127 +62,13 @@ export declare class SectionRuntimeEngine {
|
|
|
211
62
|
*/
|
|
212
63
|
getState(): Readonly<SectionEngineState>;
|
|
213
64
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* does not depend on adapter state — so callers can use it both
|
|
217
|
-
* pre- and post-`attachHost`. The kernel uses it to seed
|
|
218
|
-
* `dispatchInput({ kind: "initialize", effectiveRuntime, ... })`.
|
|
219
|
-
*/
|
|
220
|
-
getEffectiveRuntime<P>(args: RuntimeInputs, deps: {
|
|
221
|
-
resolvePlayerRuntime: (resolverArgs: {
|
|
222
|
-
effectiveRuntime: Record<string, unknown>;
|
|
223
|
-
playerType: string;
|
|
224
|
-
env: Record<string, unknown> | null;
|
|
225
|
-
}) => P;
|
|
226
|
-
}): EffectiveRuntime;
|
|
227
|
-
/**
|
|
228
|
-
* Update the adapter's instrumentation hook. No-op pre-attach.
|
|
229
|
-
* Hosts that always want a hook should pass it via `attachHost`.
|
|
230
|
-
*/
|
|
231
|
-
setInstrumentationHook(hook: InstrumentationHook | undefined): void;
|
|
232
|
-
/**
|
|
233
|
-
* Stable per-engine runtime id used to scope DOM-event details and
|
|
234
|
-
* registry telemetry. Exposed so tests and instrumentation can pin
|
|
235
|
-
* the value the bridges emit.
|
|
65
|
+
* Stable per-engine runtime id, the `runtimeId` of every event detail the
|
|
66
|
+
* engine dispatches.
|
|
236
67
|
*/
|
|
237
68
|
getRuntimeId(): string;
|
|
238
|
-
initialize(args: EngineInitArgs): Promise<void>;
|
|
239
69
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* EVERY initialize, both cohort-flip-resolves-fresh-controller
|
|
243
|
-
* and same-cohort-resolves-existing-controller cases. Phase C
|
|
244
|
-
* dropped the `resolved !== previousController` gate; see the
|
|
245
|
-
* comment at the call site for why.
|
|
246
|
-
*
|
|
247
|
-
* Two-pass order — register every shell in document order, then
|
|
248
|
-
* issue `handleContentLoaded` for each shell whose load already
|
|
249
|
-
* fired on this engine. The two-pass shape prevents
|
|
250
|
-
* `evaluateSectionLoadingState` from flapping
|
|
251
|
-
* `section-loading-complete` `false→true→false→…` while replay is
|
|
252
|
-
* mid-walk: any subscriber wired before the engine's own
|
|
253
|
-
* `controller.subscribe` (no such caller today, but cheap defense
|
|
254
|
-
* for future wiring) sees one clean `false→true` transition.
|
|
255
|
-
*
|
|
256
|
-
* Idempotent on the controller side — Phase C makes
|
|
257
|
-
* `SectionController.handleContentRegistered` and
|
|
258
|
-
* `handleContentLoaded` early-return on duplicates so re-feeding
|
|
259
|
-
* the same shells into a controller that already tracks them is
|
|
260
|
-
* a true no-op (no spurious re-emits, no re-evaluation of
|
|
261
|
-
* `section-loading-complete`). At the call site no listener is
|
|
262
|
-
* attached during the replay window, so `emitChange` side effects
|
|
263
|
-
* fire into a void on this pass anyway, but the controller-side
|
|
264
|
-
* idempotence is what makes the replay safe to run on every
|
|
265
|
-
* initialize regardless of whether the controller is fresh.
|
|
266
|
-
*/
|
|
267
|
-
private replayRegisteredShellsIntoController;
|
|
268
|
-
/**
|
|
269
|
-
* Stable key for the engine's `loadedRenderableKeys` set. Mirrors
|
|
270
|
-
* the `(canonicalItemId, contentKind)` shape `SectionController`
|
|
271
|
-
* uses internally (see `getRenderableKey`); we only need
|
|
272
|
-
* consistent add/check semantics on this side, not byte-identical
|
|
273
|
-
* normalization with the controller.
|
|
274
|
-
*/
|
|
275
|
-
private getLoadedKey;
|
|
276
|
-
register(detail: RuntimeRegistrationDetail): boolean;
|
|
277
|
-
unregister(element: HTMLElement): boolean;
|
|
278
|
-
getCompositionModel(): unknown;
|
|
279
|
-
getCanonicalItemId(itemId: string): string;
|
|
280
|
-
handleContentRegistered(detail: RuntimeRegistrationDetail): void;
|
|
281
|
-
handleContentUnregistered(detail: RuntimeRegistrationDetail): void;
|
|
282
|
-
handleContentLoaded(args: {
|
|
283
|
-
itemId: string;
|
|
284
|
-
canonicalItemId?: string;
|
|
285
|
-
contentKind?: string;
|
|
286
|
-
detail?: unknown;
|
|
287
|
-
timestamp?: number;
|
|
288
|
-
}): void;
|
|
289
|
-
handleItemPlayerError(args: {
|
|
290
|
-
itemId: string;
|
|
291
|
-
canonicalItemId?: string;
|
|
292
|
-
contentKind?: string;
|
|
293
|
-
error: unknown;
|
|
294
|
-
timestamp?: number;
|
|
295
|
-
}): void;
|
|
296
|
-
reportSectionError(args: {
|
|
297
|
-
source: "item-player" | "section-runtime" | "toolkit" | "controller";
|
|
298
|
-
error: unknown;
|
|
299
|
-
itemId?: string;
|
|
300
|
-
canonicalItemId?: string;
|
|
301
|
-
contentKind?: string;
|
|
302
|
-
timestamp?: number;
|
|
303
|
-
}): void;
|
|
304
|
-
updateItemSession(itemId: string, session: unknown): unknown;
|
|
305
|
-
navigateToItem(index: number): unknown;
|
|
306
|
-
/**
|
|
307
|
-
* Route a learner's formative action to the controller.
|
|
308
|
-
*
|
|
309
|
-
* Canonicalized here for the same reason `updateItemSession` is: the runtime
|
|
310
|
-
* id a card dispatches with is not necessarily the identifier the controller
|
|
311
|
-
* keys state by.
|
|
312
|
-
*/
|
|
313
|
-
handleFormativeAction(action: SectionRuntimeFormativeAction): void;
|
|
314
|
-
/**
|
|
315
|
-
* Bind or release the section's Media Time Source.
|
|
316
|
-
*
|
|
317
|
-
* A pass-through, like `handleFormativeAction`: the engine routes, the
|
|
318
|
-
* controller decides. `renderableId` travels with the attach because whether the
|
|
319
|
-
* registering renderable is the one `stimulusRef` names is the controller's call
|
|
320
|
-
* — it validated `stimulusRef` in the first place.
|
|
321
|
-
*/
|
|
322
|
-
handleMediaTimeSource(action: SectionRuntimeMediaTimeSourceAction): void;
|
|
323
|
-
/**
|
|
324
|
-
* Silence media audio because something else is about to speak.
|
|
325
|
-
*
|
|
326
|
-
* A pass-through like `handleMediaTimeSource`, and for the same reason: which
|
|
327
|
-
* source is authoritative and whether it reports `canPause` are the controller's
|
|
328
|
-
* to know. Returns whether media audio is now silent, or `true` where there is
|
|
329
|
-
* no timed-media controller to ask — nothing is playing.
|
|
70
|
+
* Emit `disposed` for the active cohort and detach. Idempotent; inputs
|
|
71
|
+
* after it are ignored.
|
|
330
72
|
*/
|
|
331
|
-
|
|
332
|
-
persist(): Promise<void>;
|
|
333
|
-
hydrate(): Promise<void>;
|
|
334
|
-
getRegistry(): RuntimeRegistry;
|
|
335
|
-
dispose(): Promise<void>;
|
|
73
|
+
dispose(): void;
|
|
336
74
|
}
|
|
337
|
-
export {};
|