@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
|
@@ -13,27 +13,26 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { TtsServiceApi } from "./interfaces.js";
|
|
15
15
|
/** Only what a handoff needs, so a host passing a partial service still works. */
|
|
16
|
-
type TtsHandoffSubscriber = Pick<TtsServiceApi, "onStateChange"
|
|
17
|
-
type TtsHandoffPlayback = Pick<TtsServiceApi, "
|
|
16
|
+
type TtsHandoffSubscriber = Pick<TtsServiceApi, "onStateChange">;
|
|
17
|
+
type TtsHandoffPlayback = Pick<TtsServiceApi, "getState" | "pause">;
|
|
18
18
|
/**
|
|
19
19
|
* Silence a media surface whenever read-aloud starts speaking.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Silenced on loading, so the pause lands before the first word rather than a
|
|
22
|
+
* provider round-trip after it. A load that then fails leaves media paused,
|
|
23
|
+
* which costs the learner one press of play.
|
|
24
24
|
*
|
|
25
25
|
* Returns the teardown, including where there was nothing to bind.
|
|
26
26
|
*/
|
|
27
27
|
export declare function bindTtsAudioHandoff(args: {
|
|
28
28
|
ttsService: Partial<TtsHandoffSubscriber> | null | undefined;
|
|
29
|
-
/** Unique per surface: the service keys its listener sets by this. */
|
|
30
|
-
listenerId: string;
|
|
31
29
|
silence: () => void;
|
|
32
30
|
}): () => void;
|
|
33
31
|
/**
|
|
34
32
|
* The other half: media audio has started, so read-aloud yields.
|
|
35
33
|
*
|
|
36
34
|
* Paused rather than stopped, so the learner keeps their place in the passage.
|
|
35
|
+
* A read still loading pauses too, and holds until the learner resumes it.
|
|
37
36
|
*/
|
|
38
37
|
export declare function pauseTtsForMediaAudio(ttsService: Partial<TtsHandoffPlayback> | null | undefined): void;
|
|
39
38
|
export {};
|
|
@@ -13,29 +13,34 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { PlaybackState } from "./TTSService.js";
|
|
15
15
|
const NOOP = () => { };
|
|
16
|
+
/**
|
|
17
|
+
* Read-aloud counts as speaking from the moment a read starts loading. A
|
|
18
|
+
* loading read sounds as soon as its audio arrives, so both halves treat it as
|
|
19
|
+
* a playing one.
|
|
20
|
+
*/
|
|
21
|
+
function isSpeaking(state) {
|
|
22
|
+
return state === PlaybackState.PLAYING || state === PlaybackState.LOADING;
|
|
23
|
+
}
|
|
16
24
|
/**
|
|
17
25
|
* Silence a media surface whenever read-aloud starts speaking.
|
|
18
26
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
27
|
+
* Silenced on loading, so the pause lands before the first word rather than a
|
|
28
|
+
* provider round-trip after it. A load that then fails leaves media paused,
|
|
29
|
+
* which costs the learner one press of play.
|
|
22
30
|
*
|
|
23
31
|
* Returns the teardown, including where there was nothing to bind.
|
|
24
32
|
*/
|
|
25
33
|
export function bindTtsAudioHandoff(args) {
|
|
26
|
-
const { ttsService,
|
|
34
|
+
const { ttsService, silence } = args;
|
|
27
35
|
if (typeof ttsService?.onStateChange !== "function")
|
|
28
36
|
return NOOP;
|
|
29
|
-
const
|
|
30
|
-
if (state
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
silence();
|
|
34
|
-
};
|
|
35
|
-
ttsService.onStateChange(listenerId, onTtsState);
|
|
37
|
+
const unsubscribe = ttsService.onStateChange((state) => {
|
|
38
|
+
if (isSpeaking(state))
|
|
39
|
+
silence();
|
|
40
|
+
});
|
|
36
41
|
return () => {
|
|
37
42
|
try {
|
|
38
|
-
|
|
43
|
+
unsubscribe();
|
|
39
44
|
}
|
|
40
45
|
catch {
|
|
41
46
|
// A torn-down service is not a failure to detach from.
|
|
@@ -46,11 +51,12 @@ export function bindTtsAudioHandoff(args) {
|
|
|
46
51
|
* The other half: media audio has started, so read-aloud yields.
|
|
47
52
|
*
|
|
48
53
|
* Paused rather than stopped, so the learner keeps their place in the passage.
|
|
54
|
+
* A read still loading pauses too, and holds until the learner resumes it.
|
|
49
55
|
*/
|
|
50
56
|
export function pauseTtsForMediaAudio(ttsService) {
|
|
51
57
|
try {
|
|
52
|
-
if (ttsService?.
|
|
53
|
-
ttsService
|
|
58
|
+
if (isSpeaking(ttsService?.getState?.()))
|
|
59
|
+
ttsService?.pause?.();
|
|
54
60
|
}
|
|
55
61
|
catch {
|
|
56
62
|
// A torn-down or uninitialized TTS service must not break playback.
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* adapter, while keeping the entity walk private to the resolver package.
|
|
7
7
|
*/
|
|
8
8
|
import type { AccessibilityCatalog } from "@pie-players/pie-players-shared/types";
|
|
9
|
-
export type CatalogOwnerKind = "global" | "passage" | "itemModel";
|
|
10
9
|
interface CatalogOwnerScopeContext {
|
|
11
10
|
assessmentId?: string;
|
|
12
11
|
sectionId?: string;
|
|
@@ -48,12 +48,9 @@ export interface FrameworkErrorReporter {
|
|
|
48
48
|
* before constructing the coordinator so the `coordinator-init`
|
|
49
49
|
* failure path emits through the same bus.
|
|
50
50
|
*
|
|
51
|
-
* **
|
|
52
|
-
*
|
|
53
|
-
* `
|
|
54
|
-
* `ToolkitCoordinatorApi.subscribeFrameworkErrors`, never via the bus
|
|
55
|
-
* class itself. Keeping the class package-internal lets us iterate on
|
|
56
|
-
* its shape without a public-API change.
|
|
51
|
+
* **Where it is constructed.** The toolkit CE (`PieAssessmentToolkit.svelte`)
|
|
52
|
+
* builds one and passes it into `ToolkitCoordinator`; hosts subscribe via
|
|
53
|
+
* `ToolkitCoordinatorApi.subscribeFrameworkErrors`.
|
|
57
54
|
*/
|
|
58
55
|
export declare class FrameworkErrorBus implements FrameworkErrorPort, FrameworkErrorReporter {
|
|
59
56
|
private readonly listeners;
|
|
@@ -20,12 +20,9 @@
|
|
|
20
20
|
* before constructing the coordinator so the `coordinator-init`
|
|
21
21
|
* failure path emits through the same bus.
|
|
22
22
|
*
|
|
23
|
-
* **
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
26
|
-
* `ToolkitCoordinatorApi.subscribeFrameworkErrors`, never via the bus
|
|
27
|
-
* class itself. Keeping the class package-internal lets us iterate on
|
|
28
|
-
* its shape without a public-API change.
|
|
23
|
+
* **Where it is constructed.** The toolkit CE (`PieAssessmentToolkit.svelte`)
|
|
24
|
+
* builds one and passes it into `ToolkitCoordinator`; hosts subscribe via
|
|
25
|
+
* `ToolkitCoordinatorApi.subscribeFrameworkErrors`.
|
|
29
26
|
*/
|
|
30
27
|
export class FrameworkErrorBus {
|
|
31
28
|
listeners = new Set();
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ToolConfigDiagnostic } from "./tool-config-validation.js";
|
|
2
2
|
export type FrameworkErrorKind = "tool-config" | "runtime-init" | "runtime-dispose" | "coordinator-init" | "provider-init" | "provider-register" | "tts-init" | "tool-state-load" | "tool-state-save" | "section-controller-init" | "section-controller-dispose" | "tool-surface"
|
|
3
|
+
/**
|
|
4
|
+
* A toolbar could not load a tool's module. Recoverable unless policy grants
|
|
5
|
+
* the tool: the toolbar withholds the tool and the assessment goes on.
|
|
6
|
+
*/
|
|
7
|
+
| "tool-module-load"
|
|
3
8
|
/**
|
|
4
9
|
* A timed-media section could not deliver a policy as authored: a media time
|
|
5
10
|
* source missing `canPause` / `canRestrictSeeking` (recoverable — cues still
|
|
@@ -22,6 +27,13 @@ export type FrameworkErrorKind = "tool-config" | "runtime-init" | "runtime-dispo
|
|
|
22
27
|
*/
|
|
23
28
|
| "element-preload" | "unknown";
|
|
24
29
|
export type FrameworkErrorSeverity = "warning" | "error";
|
|
30
|
+
/**
|
|
31
|
+
* What a non-recoverable error takes down. `cohort`: the section it was reported
|
|
32
|
+
* for, so the section player's readiness recovers when the learner moves to
|
|
33
|
+
* another section. `runtime`: the coordinator or one of its tools, which every
|
|
34
|
+
* later section runs on, so readiness stays failed. Set by the report site.
|
|
35
|
+
*/
|
|
36
|
+
export type FrameworkErrorScope = "cohort" | "runtime";
|
|
25
37
|
export interface FrameworkErrorModel {
|
|
26
38
|
kind: FrameworkErrorKind;
|
|
27
39
|
severity: FrameworkErrorSeverity;
|
|
@@ -29,6 +41,7 @@ export interface FrameworkErrorModel {
|
|
|
29
41
|
message: string;
|
|
30
42
|
details: string[];
|
|
31
43
|
recoverable: boolean;
|
|
44
|
+
scope: FrameworkErrorScope;
|
|
32
45
|
cause?: unknown;
|
|
33
46
|
}
|
|
34
47
|
export declare function toFrameworkErrorModel(args: {
|
|
@@ -38,6 +51,8 @@ export declare function toFrameworkErrorModel(args: {
|
|
|
38
51
|
message: string;
|
|
39
52
|
details?: string[];
|
|
40
53
|
recoverable?: boolean;
|
|
54
|
+
/** Defaults to `runtime`. */
|
|
55
|
+
scope?: FrameworkErrorScope;
|
|
41
56
|
cause?: unknown;
|
|
42
57
|
}): FrameworkErrorModel;
|
|
43
58
|
export declare function frameworkErrorFromUnknown(args: {
|
|
@@ -45,6 +60,7 @@ export declare function frameworkErrorFromUnknown(args: {
|
|
|
45
60
|
source: string;
|
|
46
61
|
error: unknown;
|
|
47
62
|
recoverable?: boolean;
|
|
63
|
+
scope?: FrameworkErrorScope;
|
|
48
64
|
}): FrameworkErrorModel;
|
|
49
65
|
/**
|
|
50
66
|
* Coordinator-side error context shape consumed by
|
|
@@ -57,8 +73,8 @@ export declare function frameworkErrorFromUnknown(args: {
|
|
|
57
73
|
* truth for coordinator code; values of that type satisfy this shape.
|
|
58
74
|
*/
|
|
59
75
|
export interface FrameworkErrorCoordinatorContext {
|
|
60
|
-
phase: "coordinator-ready" | "state-load" | "state-save" | "provider-register" | "provider-init" | "tts-init" | "section-controller-init" | "section-controller-dispose";
|
|
61
|
-
|
|
76
|
+
phase: "coordinator-ready" | "state-load" | "state-save" | "provider-register" | "provider-init" | "tts-init" | "section-controller-init" | "section-controller-dispose" | "tool-module-load";
|
|
77
|
+
toolId?: string;
|
|
62
78
|
details?: Record<string, unknown>;
|
|
63
79
|
}
|
|
64
80
|
/**
|
|
@@ -66,20 +82,19 @@ export interface FrameworkErrorCoordinatorContext {
|
|
|
66
82
|
* context pair.
|
|
67
83
|
*
|
|
68
84
|
* Maps `context.phase` to the canonical {@link FrameworkErrorKind} and
|
|
69
|
-
* synthesizes a `source` from `context.
|
|
70
|
-
* (`pie-toolkit-coordinator/<
|
|
85
|
+
* synthesizes a `source` from `context.toolId` when present
|
|
86
|
+
* (`pie-toolkit-coordinator/<toolId>`); falls back to a phase-tagged
|
|
71
87
|
* source (`pie-toolkit-coordinator:<phase>`) otherwise. Forwards the
|
|
72
88
|
* original `error` as `cause` so hosts that care about the underlying
|
|
73
89
|
* `Error` keep getting it.
|
|
74
90
|
*
|
|
75
|
-
*
|
|
76
|
-
* not auto-recovered today). Override with `recoverable: true` for the
|
|
77
|
-
* phases where the coordinator continues operating after the failure.
|
|
91
|
+
* `recoverable` defaults to `false` and `scope` to `runtime`.
|
|
78
92
|
*/
|
|
79
93
|
export declare function frameworkErrorFromCoordinatorContext(args: {
|
|
80
94
|
error: unknown;
|
|
81
95
|
context: FrameworkErrorCoordinatorContext;
|
|
82
96
|
recoverable?: boolean;
|
|
97
|
+
scope?: FrameworkErrorScope;
|
|
83
98
|
}): FrameworkErrorModel;
|
|
84
99
|
export declare function frameworkErrorFromToolConfigDiagnostics(args: {
|
|
85
100
|
source: string;
|
|
@@ -6,6 +6,7 @@ export function toFrameworkErrorModel(args) {
|
|
|
6
6
|
message: args.message,
|
|
7
7
|
details: [...(args.details || [])],
|
|
8
8
|
recoverable: args.recoverable === true,
|
|
9
|
+
scope: args.scope ?? "runtime",
|
|
9
10
|
cause: args.cause,
|
|
10
11
|
};
|
|
11
12
|
}
|
|
@@ -18,6 +19,7 @@ export function frameworkErrorFromUnknown(args) {
|
|
|
18
19
|
source: args.source,
|
|
19
20
|
message,
|
|
20
21
|
recoverable: args.recoverable,
|
|
22
|
+
scope: args.scope,
|
|
21
23
|
cause: args.error,
|
|
22
24
|
});
|
|
23
25
|
}
|
|
@@ -30,32 +32,32 @@ const COORDINATOR_PHASE_TO_KIND = {
|
|
|
30
32
|
"tts-init": "tts-init",
|
|
31
33
|
"section-controller-init": "section-controller-init",
|
|
32
34
|
"section-controller-dispose": "section-controller-dispose",
|
|
35
|
+
"tool-module-load": "tool-module-load",
|
|
33
36
|
};
|
|
34
37
|
/**
|
|
35
38
|
* Build a {@link FrameworkErrorModel} from a coordinator-side error +
|
|
36
39
|
* context pair.
|
|
37
40
|
*
|
|
38
41
|
* Maps `context.phase` to the canonical {@link FrameworkErrorKind} and
|
|
39
|
-
* synthesizes a `source` from `context.
|
|
40
|
-
* (`pie-toolkit-coordinator/<
|
|
42
|
+
* synthesizes a `source` from `context.toolId` when present
|
|
43
|
+
* (`pie-toolkit-coordinator/<toolId>`); falls back to a phase-tagged
|
|
41
44
|
* source (`pie-toolkit-coordinator:<phase>`) otherwise. Forwards the
|
|
42
45
|
* original `error` as `cause` so hosts that care about the underlying
|
|
43
46
|
* `Error` keep getting it.
|
|
44
47
|
*
|
|
45
|
-
*
|
|
46
|
-
* not auto-recovered today). Override with `recoverable: true` for the
|
|
47
|
-
* phases where the coordinator continues operating after the failure.
|
|
48
|
+
* `recoverable` defaults to `false` and `scope` to `runtime`.
|
|
48
49
|
*/
|
|
49
50
|
export function frameworkErrorFromCoordinatorContext(args) {
|
|
50
51
|
const kind = COORDINATOR_PHASE_TO_KIND[args.context.phase];
|
|
51
|
-
const source = args.context.
|
|
52
|
-
? `pie-toolkit-coordinator/${args.context.
|
|
52
|
+
const source = args.context.toolId
|
|
53
|
+
? `pie-toolkit-coordinator/${args.context.toolId}`
|
|
53
54
|
: `pie-toolkit-coordinator:${args.context.phase}`;
|
|
54
55
|
return frameworkErrorFromUnknown({
|
|
55
56
|
kind,
|
|
56
57
|
source,
|
|
57
58
|
error: args.error,
|
|
58
59
|
recoverable: args.recoverable,
|
|
60
|
+
scope: args.scope,
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
export function frameworkErrorFromToolConfigDiagnostics(args) {
|