@pie-players/pie-assessment-toolkit 0.3.73 → 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 +469 -318
- package/dist/attempt/AssessmentSession.d.ts +1 -5
- package/dist/attempt/AssessmentSession.js +0 -29
- 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.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 +13 -13
- package/dist/components/SectionToolBar.custom-element.d.ts +1 -0
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-7tt7v2xp.js +4 -0
- package/dist/components/chunks/ItemToolBar-97hx60z4.js +2 -0
- 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 +32 -6
- package/dist/index.d.ts +23 -48
- package/dist/index.js +12 -37
- package/dist/policy/core/PolicySource.d.ts +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +85 -34
- package/dist/policy/core/ToolPolicyEngine.js +148 -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 +14 -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 +28 -10
- package/dist/runtime/tool-host-contract.js +31 -10
- 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 +22 -28
- package/dist/services/HighlightCoordinator.js +431 -327
- package/dist/services/RangeSerializer.d.ts +10 -1
- package/dist/services/RangeSerializer.js +87 -14
- package/dist/services/TTSService.d.ts +130 -69
- package/dist/services/TTSService.js +713 -570
- package/dist/services/ToolCoordinator.d.ts +43 -66
- package/dist/services/ToolCoordinator.js +164 -208
- package/dist/services/ToolRegistry.d.ts +78 -54
- package/dist/services/ToolRegistry.js +107 -105
- package/dist/services/ToolkitCoordinator.d.ts +261 -175
- package/dist/services/ToolkitCoordinator.js +667 -433
- package/dist/services/audio-handoff.d.ts +6 -7
- package/dist/services/audio-handoff.js +20 -14
- package/dist/services/catalog-owner.d.ts +11 -1
- package/dist/services/catalog-owner.js +25 -0
- package/dist/services/create-tools-config.d.ts +2 -2
- 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 +30 -8
- package/dist/services/framework-error.js +9 -7
- package/dist/services/interfaces.d.ts +158 -129
- package/dist/services/section-controller-types.d.ts +15 -0
- 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 +1 -3
- 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 +14 -4
- package/dist/services/tool-config-validation.js +63 -71
- package/dist/services/tool-context.d.ts +0 -8
- package/dist/services/tool-context.js +29 -25
- 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 +41 -80
- package/dist/services/tool-providers/TTSToolProvider.js +81 -40
- package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -4
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +32 -28
- package/dist/services/tool-providers/ToolProviderRegistry.js +121 -107
- package/dist/services/tool-providers/index.d.ts +0 -9
- package/dist/services/tool-providers/index.js +2 -4
- 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 +37 -23
- 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/catalog-span-alignment.d.ts +2 -17
- package/dist/services/tts/catalog-span-alignment.js +17 -142
- 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/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 +38 -5
- package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +3 -6
- 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-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.d.ts +5 -1
- package/dist/services/tts/math-aware-text-processing.js +74 -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 +16 -1
- package/dist/services/tts/math-speech.js +55 -19
- package/dist/services/tts/provider-options.d.ts +41 -0
- package/dist/services/tts/provider-options.js +1 -0
- 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/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 -1
- package/dist/services/tts/text-processing.js +46 -34
- 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 +44 -18
- package/dist/services/tts-runtime-config.js +22 -93
- 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 +24 -59
- 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-byq80z42.js +0 -40
- package/dist/components/chunks/ItemToolBar-d36g3aw4.js +0 -49
- package/dist/context/runtime-context-consumer.d.ts +0 -13
- package/dist/context/runtime-context-consumer.js +0 -51
- 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 -80
- package/dist/runtime/section-runtime-engine-host-context.js +0 -95
- 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/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/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/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/client.d.ts +0 -12
- package/dist/tools/client.js +0 -14
- package/dist/tools/index.d.ts +0 -8
- package/dist/tools/index.js +0 -10
- package/dist/tools/internal.d.ts +0 -43
- package/dist/tools/internal.js +0 -41
- 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
|
@@ -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";
|
|
@@ -1,41 +1,51 @@
|
|
|
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 { cohortsEqual } from "./cohort.js";
|
|
36
|
-
import {
|
|
37
|
-
import { phaseToStage } from "./engine-stage-derivation.js";
|
|
31
|
+
import { resolveReadinessGates, } from "./engine-readiness.js";
|
|
38
32
|
import { createInitialEngineState, } from "./engine-state.js";
|
|
33
|
+
/** `idle` and `failed` have no stage of their own. */
|
|
34
|
+
function phaseToStage(phase) {
|
|
35
|
+
switch (phase) {
|
|
36
|
+
case "idle":
|
|
37
|
+
case "failed":
|
|
38
|
+
return null;
|
|
39
|
+
case "booting-section":
|
|
40
|
+
return "composed";
|
|
41
|
+
case "engine-ready":
|
|
42
|
+
return "engine-ready";
|
|
43
|
+
case "interactive":
|
|
44
|
+
return "interactive";
|
|
45
|
+
case "disposed":
|
|
46
|
+
return "disposed";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
39
49
|
function emitStageChange(outputs, phase, cohort, status = "entered") {
|
|
40
50
|
const stage = phaseToStage(phase);
|
|
41
51
|
if (!stage)
|
|
@@ -52,6 +62,7 @@ function startCohort(args) {
|
|
|
52
62
|
...createInitialEngineState(),
|
|
53
63
|
phase: "booting-section",
|
|
54
64
|
cohort: args.cohort,
|
|
65
|
+
readinessMode: args.state.readinessMode,
|
|
55
66
|
effectiveRuntime: args.effectiveRuntime,
|
|
56
67
|
effectiveToolsConfig: args.effectiveToolsConfig,
|
|
57
68
|
itemCount: args.itemCount,
|
|
@@ -60,26 +71,42 @@ function startCohort(args) {
|
|
|
60
71
|
emitStageChange(outputs, "booting-section", args.cohort);
|
|
61
72
|
return { state: next, outputs };
|
|
62
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* End the chain of a cohort that has not reached `interactive`. Returns the
|
|
76
|
+
* `failed` phase after recording the stages it will not reach.
|
|
77
|
+
*/
|
|
78
|
+
function failChain(outputs, phase, cohort) {
|
|
79
|
+
if (phase === "booting-section") {
|
|
80
|
+
emitStageChange(outputs, "engine-ready", cohort, "failed");
|
|
81
|
+
emitStageChange(outputs, "interactive", cohort, "skipped");
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
emitStageChange(outputs, "interactive", cohort, "failed");
|
|
85
|
+
}
|
|
86
|
+
return "failed";
|
|
87
|
+
}
|
|
63
88
|
/**
|
|
64
89
|
* Apply a readiness update: store new signals, derive the detail in
|
|
65
|
-
* the requested mode,
|
|
66
|
-
*
|
|
90
|
+
* the requested mode, end the chain on a runtime error before
|
|
91
|
+
* `interactive`, advance the phase to `interactive` when gated, and emit
|
|
92
|
+
* `loading-complete` once per cohort.
|
|
67
93
|
*/
|
|
68
94
|
function applyReadinessUpdate(state, args) {
|
|
69
95
|
if (state.phase === "idle" || state.phase === "disposed") {
|
|
70
96
|
// No cohort to update; ignore.
|
|
71
97
|
return { state, outputs: [] };
|
|
72
98
|
}
|
|
73
|
-
const detail =
|
|
74
|
-
mode: args.mode,
|
|
75
|
-
signals: args.signals,
|
|
76
|
-
});
|
|
99
|
+
const detail = resolveReadinessGates(args.mode, args.signals);
|
|
77
100
|
const outputs = [];
|
|
78
101
|
let phase = state.phase;
|
|
79
102
|
let loadingCompleteEmitted = state.loadingCompleteEmitted;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
if (args.signals.runtimeError &&
|
|
104
|
+
(phase === "booting-section" || phase === "engine-ready")) {
|
|
105
|
+
phase = failChain(outputs, phase, state.cohort);
|
|
106
|
+
}
|
|
107
|
+
else if (phase === "engine-ready" && detail.interactionReady) {
|
|
108
|
+
// engine-ready → interactive when readiness satisfies
|
|
109
|
+
// `interactionReady` (mode-aware via `resolveReadinessGates`).
|
|
83
110
|
phase = "interactive";
|
|
84
111
|
emitStageChange(outputs, phase, state.cohort);
|
|
85
112
|
}
|
|
@@ -92,14 +119,13 @@ function applyReadinessUpdate(state, args) {
|
|
|
92
119
|
kind: "loading-complete",
|
|
93
120
|
cohort: state.cohort,
|
|
94
121
|
itemCount: args.itemCount,
|
|
95
|
-
loadedCount: args.loadedCount,
|
|
96
122
|
});
|
|
97
123
|
}
|
|
98
124
|
const nextState = {
|
|
99
125
|
...state,
|
|
100
126
|
phase,
|
|
101
127
|
readinessSignals: args.signals,
|
|
102
|
-
|
|
128
|
+
readinessMode: args.mode,
|
|
103
129
|
itemCount: args.itemCount,
|
|
104
130
|
loadingCompleteEmitted,
|
|
105
131
|
};
|
|
@@ -194,8 +220,8 @@ export function transition(state, input) {
|
|
|
194
220
|
}
|
|
195
221
|
case "section-controller-resolved": {
|
|
196
222
|
if (state.phase !== "booting-section") {
|
|
197
|
-
// Either too early (idle), too late (interactive /
|
|
198
|
-
// or a duplicate notification; the FSM is monotonic.
|
|
223
|
+
// Either too early (idle), too late (interactive / failed /
|
|
224
|
+
// disposed), or a duplicate notification; the FSM is monotonic.
|
|
199
225
|
return {
|
|
200
226
|
state: { ...state, controllerResolved: true },
|
|
201
227
|
outputs: [],
|
|
@@ -203,10 +229,20 @@ export function transition(state, input) {
|
|
|
203
229
|
}
|
|
204
230
|
const outputs = [];
|
|
205
231
|
emitStageChange(outputs, "engine-ready", state.cohort);
|
|
232
|
+
// Readiness can be satisfied before the controller resolves: with
|
|
233
|
+
// preloaded elements the items load in the same flush as the
|
|
234
|
+
// composition. No later signal change would move the cohort on, so
|
|
235
|
+
// the stored snapshot gates `interactive` here.
|
|
236
|
+
let phase = "engine-ready";
|
|
237
|
+
if (resolveReadinessGates(state.readinessMode, state.readinessSignals)
|
|
238
|
+
.interactionReady) {
|
|
239
|
+
phase = "interactive";
|
|
240
|
+
emitStageChange(outputs, phase, state.cohort);
|
|
241
|
+
}
|
|
206
242
|
return {
|
|
207
243
|
state: {
|
|
208
244
|
...state,
|
|
209
|
-
phase
|
|
245
|
+
phase,
|
|
210
246
|
controllerResolved: true,
|
|
211
247
|
},
|
|
212
248
|
outputs,
|
|
@@ -216,25 +252,9 @@ export function transition(state, input) {
|
|
|
216
252
|
return applyReadinessUpdate(state, {
|
|
217
253
|
signals: input.signals,
|
|
218
254
|
mode: input.mode,
|
|
219
|
-
loadedCount: input.loadedCount,
|
|
220
255
|
itemCount: input.itemCount,
|
|
221
256
|
});
|
|
222
257
|
}
|
|
223
|
-
case "framework-error": {
|
|
224
|
-
return {
|
|
225
|
-
state: {
|
|
226
|
-
...state,
|
|
227
|
-
lastFrameworkError: input.error,
|
|
228
|
-
readinessSignals: {
|
|
229
|
-
...state.readinessSignals,
|
|
230
|
-
runtimeError: input.error.recoverable === true
|
|
231
|
-
? state.readinessSignals.runtimeError
|
|
232
|
-
: true,
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
outputs: [{ kind: "framework-error", error: input.error }],
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
258
|
case "dispose": {
|
|
239
259
|
if (state.phase === "disposed") {
|
|
240
260
|
return { state, outputs: [] };
|
package/dist/runtime/engine.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine —
|
|
2
|
+
* Section runtime engine — the stable entry for a host that drives a section's
|
|
3
|
+
* stage chain.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* mount + drive a section runtime should import from here. Consumers
|
|
13
|
-
* that need to reach past the facade (e.g. construct an adapter
|
|
14
|
-
* manually, inspect FSM state types, build alternate fan-out paths)
|
|
15
|
-
* should import from `./runtime/internal` and accept the documented
|
|
16
|
-
* stability disclaimer there.
|
|
17
|
-
*
|
|
18
|
-
* The package's `exports` map adds `./runtime/engine` in M7 PR 3
|
|
19
|
-
* alongside the facade refactor.
|
|
5
|
+
* Besides the `SectionRuntimeEngine` facade it carries the vocabulary of the
|
|
6
|
+
* facade's own surface: the inputs `dispatchInput` takes and the outputs
|
|
7
|
+
* `subscribe` delivers, the state `getState` returns, the runtime config and its
|
|
8
|
+
* resolution, the id a section runs under, the cohort an `initialize` or
|
|
9
|
+
* `cohort-change` input names, and the
|
|
10
|
+
* readiness signals. The section player's layout kernel is the host
|
|
11
|
+
* this was cut for. The engine's core, adapter and bridges stay behind the
|
|
12
|
+
* facade, with no entry of their own.
|
|
20
13
|
*/
|
|
21
14
|
export { SectionRuntimeEngine, type SectionRuntimeEngineHostArgs, } from "./SectionRuntimeEngine.js";
|
|
22
|
-
export {
|
|
23
|
-
export
|
|
15
|
+
export type { SectionEngineInput } from "./core/engine-input.js";
|
|
16
|
+
export type { SectionEngineOutput } from "./core/engine-output.js";
|
|
17
|
+
export type { SectionEnginePhase, SectionEngineState, } from "./core/engine-state.js";
|
|
18
|
+
export { DEFAULT_ENV, DEFAULT_ISOLATION, DEFAULT_PLAYER_TYPE, resolveSectionEngineRuntimeState, resolveSectionId, type FrameworkErrorHandler, type LoadingCompleteHandler, type PlayerOverrides, type RuntimeConfig, type RuntimeInputs, type StageChangeHandler, } from "./core/engine-resolver.js";
|
|
19
|
+
export { cohortsEqual, makeCohort, type CohortKey } from "./core/cohort.js";
|
|
20
|
+
export type { EngineReadinessSignals } from "./core/engine-readiness.js";
|
package/dist/runtime/engine.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Section runtime engine —
|
|
2
|
+
* Section runtime engine — the stable entry for a host that drives a section's
|
|
3
|
+
* stage chain.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* mount + drive a section runtime should import from here. Consumers
|
|
13
|
-
* that need to reach past the facade (e.g. construct an adapter
|
|
14
|
-
* manually, inspect FSM state types, build alternate fan-out paths)
|
|
15
|
-
* should import from `./runtime/internal` and accept the documented
|
|
16
|
-
* stability disclaimer there.
|
|
17
|
-
*
|
|
18
|
-
* The package's `exports` map adds `./runtime/engine` in M7 PR 3
|
|
19
|
-
* alongside the facade refactor.
|
|
5
|
+
* Besides the `SectionRuntimeEngine` facade it carries the vocabulary of the
|
|
6
|
+
* facade's own surface: the inputs `dispatchInput` takes and the outputs
|
|
7
|
+
* `subscribe` delivers, the state `getState` returns, the runtime config and its
|
|
8
|
+
* resolution, the id a section runs under, the cohort an `initialize` or
|
|
9
|
+
* `cohort-change` input names, and the
|
|
10
|
+
* readiness signals. The section player's layout kernel is the host
|
|
11
|
+
* this was cut for. The engine's core, adapter and bridges stay behind the
|
|
12
|
+
* facade, with no entry of their own.
|
|
20
13
|
*/
|
|
21
14
|
export { SectionRuntimeEngine, } from "./SectionRuntimeEngine.js";
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
15
|
+
export { DEFAULT_ENV, DEFAULT_ISOLATION, DEFAULT_PLAYER_TYPE, resolveSectionEngineRuntimeState, resolveSectionId, } from "./core/engine-resolver.js";
|
|
16
|
+
export { cohortsEqual, makeCohort } from "./core/cohort.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long a warning about a missing input waits when a host may still be
|
|
3
|
+
* supplying it, such as a toolkit or a registry loaded after mount.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PENDING_INPUT_WARNING_DELAY_MS = 10000;
|
|
6
|
+
/**
|
|
7
|
+
* Warns about a setup mistake once per document, across every copy of the
|
|
8
|
+
* toolkit loaded into it: the latch is a `Symbol.for` slot on the document, so
|
|
9
|
+
* the custom-element bundle and the modules a host imports share it. Not
|
|
10
|
+
* development-only, because the custom-element build compiles those branches
|
|
11
|
+
* out, and a host misconfigures in production as readily as anywhere.
|
|
12
|
+
*/
|
|
13
|
+
export declare function warnOncePerDocument(doc: Document | null | undefined, key: string, message: string): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long a warning about a missing input waits when a host may still be
|
|
3
|
+
* supplying it, such as a toolkit or a registry loaded after mount.
|
|
4
|
+
*/
|
|
5
|
+
export const PENDING_INPUT_WARNING_DELAY_MS = 10_000;
|
|
6
|
+
/**
|
|
7
|
+
* Warns about a setup mistake once per document, across every copy of the
|
|
8
|
+
* toolkit loaded into it: the latch is a `Symbol.for` slot on the document, so
|
|
9
|
+
* the custom-element bundle and the modules a host imports share it. Not
|
|
10
|
+
* development-only, because the custom-element build compiles those branches
|
|
11
|
+
* out, and a host misconfigures in production as readily as anywhere.
|
|
12
|
+
*/
|
|
13
|
+
export function warnOncePerDocument(doc, key, message) {
|
|
14
|
+
if (!doc)
|
|
15
|
+
return;
|
|
16
|
+
const slot = Symbol.for(`pie.assessmentToolkit.warned.${key}`);
|
|
17
|
+
const latches = doc;
|
|
18
|
+
if (latches[slot])
|
|
19
|
+
return;
|
|
20
|
+
latches[slot] = true;
|
|
21
|
+
console.warn(message);
|
|
22
|
+
}
|