@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.
Files changed (228) hide show
  1. package/README.md +349 -313
  2. package/dist/attempt/TestSession.d.ts +1 -20
  3. package/dist/attempt/TestSession.js +8 -99
  4. package/dist/components/ItemScope.custom-element.d.ts +1 -0
  5. package/dist/components/ItemScope.custom-element.js +1 -0
  6. package/dist/components/ItemToolBar.custom-element.js +1 -1
  7. package/dist/components/PieAssessmentToolkit.custom-element.js +14 -14
  8. package/dist/components/SectionToolBar.custom-element.js +1 -1
  9. package/dist/components/chunks/ItemToolBar-7tt7v2xp.js +4 -0
  10. package/dist/components/chunks/{ItemToolBar-gmrryv2v.js → ItemToolBar-97hx60z4.js} +1 -1
  11. package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +2 -0
  12. package/dist/components/chunks/ItemToolBar-jx38w99s.js +2 -0
  13. package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +40 -0
  14. package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
  15. package/dist/components/chunks/sre-engine-jd8cc08x.js +1 -0
  16. package/dist/components/item-scope-element.d.ts +2 -0
  17. package/dist/components/item-scope-element.js +2 -0
  18. package/dist/context/assessment-toolkit-context.d.ts +27 -6
  19. package/dist/index.d.ts +22 -47
  20. package/dist/index.js +12 -36
  21. package/dist/policy/core/PolicySource.d.ts +1 -1
  22. package/dist/policy/core/ToolPolicyEngine.d.ts +77 -32
  23. package/dist/policy/core/ToolPolicyEngine.js +136 -46
  24. package/dist/policy/core/compose-decision.d.ts +28 -7
  25. package/dist/policy/core/compose-decision.js +75 -54
  26. package/dist/policy/core/decision-types.d.ts +65 -34
  27. package/dist/policy/core/feature-decision.d.ts +16 -9
  28. package/dist/policy/core/feature-decision.js +14 -8
  29. package/dist/policy/core/pnp-policy-inputs.d.ts +24 -33
  30. package/dist/policy/core/pnp-policy-inputs.js +28 -56
  31. package/dist/policy/core/provenance.d.ts +9 -4
  32. package/dist/policy/core/provenance.js +1 -1
  33. package/dist/policy/engine.d.ts +7 -23
  34. package/dist/policy/engine.js +5 -20
  35. package/dist/policy/sources/PnpPolicySource.d.ts +44 -61
  36. package/dist/policy/sources/PnpPolicySource.js +117 -118
  37. package/dist/runtime/SectionControllerBinding.d.ts +279 -0
  38. package/dist/runtime/SectionControllerBinding.js +450 -0
  39. package/dist/runtime/SectionRuntimeEngine.d.ts +26 -289
  40. package/dist/runtime/SectionRuntimeEngine.js +30 -372
  41. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +19 -80
  42. package/dist/runtime/adapter/SectionEngineAdapter.js +19 -92
  43. package/dist/runtime/adapter/dom-event-bridge.d.ts +15 -30
  44. package/dist/runtime/adapter/dom-event-bridge.js +17 -44
  45. package/dist/runtime/adapter/subscriber-fanout.d.ts +1 -2
  46. package/dist/runtime/adapter/subscriber-fanout.js +1 -2
  47. package/dist/runtime/catalog-context.d.ts +19 -0
  48. package/dist/runtime/catalog-context.js +28 -0
  49. package/dist/runtime/composition-emit-scheduler.d.ts +9 -15
  50. package/dist/runtime/composition-emit-scheduler.js +9 -15
  51. package/dist/runtime/content-language.d.ts +32 -0
  52. package/dist/runtime/content-language.js +46 -0
  53. package/dist/runtime/content-region.d.ts +17 -0
  54. package/dist/runtime/content-region.js +29 -0
  55. package/dist/runtime/content-registration.d.ts +13 -0
  56. package/dist/runtime/content-registration.js +25 -0
  57. package/dist/runtime/core/SectionEngineCore.d.ts +2 -2
  58. package/dist/runtime/core/SectionEngineCore.js +2 -2
  59. package/dist/runtime/core/cohort.d.ts +1 -1
  60. package/dist/runtime/core/cohort.js +1 -1
  61. package/dist/runtime/core/engine-input.d.ts +18 -30
  62. package/dist/runtime/core/engine-input.js +11 -12
  63. package/dist/runtime/core/engine-output.d.ts +16 -40
  64. package/dist/runtime/core/engine-output.js +9 -21
  65. package/dist/runtime/core/engine-readiness.d.ts +5 -37
  66. package/dist/runtime/core/engine-readiness.js +8 -41
  67. package/dist/runtime/core/engine-resolver.d.ts +46 -74
  68. package/dist/runtime/core/engine-resolver.js +18 -43
  69. package/dist/runtime/core/engine-state.d.ts +28 -36
  70. package/dist/runtime/core/engine-state.js +18 -21
  71. package/dist/runtime/core/engine-transition.d.ts +14 -19
  72. package/dist/runtime/core/engine-transition.js +71 -51
  73. package/dist/runtime/engine.d.ts +16 -19
  74. package/dist/runtime/engine.js +12 -19
  75. package/dist/runtime/page-warnings.d.ts +13 -0
  76. package/dist/runtime/page-warnings.js +22 -0
  77. package/dist/runtime/policy-input-forwarding.d.ts +25 -0
  78. package/dist/runtime/policy-input-forwarding.js +25 -0
  79. package/dist/runtime/registration-events.d.ts +11 -0
  80. package/dist/runtime/runtime-event-claim.d.ts +8 -0
  81. package/dist/runtime/runtime-event-claim.js +15 -0
  82. package/dist/runtime/shell-event-bridge.d.ts +45 -0
  83. package/dist/runtime/shell-event-bridge.js +127 -0
  84. package/dist/runtime/shell-registration.d.ts +73 -0
  85. package/dist/runtime/shell-registration.js +95 -0
  86. package/dist/runtime/shell-scope.d.ts +68 -0
  87. package/dist/runtime/shell-scope.js +188 -0
  88. package/dist/runtime/tool-host-contract.d.ts +8 -10
  89. package/dist/runtime/tool-host-contract.js +11 -11
  90. package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
  91. package/dist/runtime/unclaimed-registration-watch.js +23 -0
  92. package/dist/services/ElementToolStateStore.d.ts +14 -10
  93. package/dist/services/ElementToolStateStore.js +37 -13
  94. package/dist/services/HighlightCoordinator.d.ts +21 -21
  95. package/dist/services/HighlightCoordinator.js +431 -325
  96. package/dist/services/RangeSerializer.d.ts +10 -1
  97. package/dist/services/RangeSerializer.js +87 -14
  98. package/dist/services/TTSService.d.ts +117 -70
  99. package/dist/services/TTSService.js +668 -578
  100. package/dist/services/ToolCoordinator.d.ts +43 -60
  101. package/dist/services/ToolCoordinator.js +164 -206
  102. package/dist/services/ToolRegistry.d.ts +74 -57
  103. package/dist/services/ToolRegistry.js +104 -114
  104. package/dist/services/ToolkitCoordinator.d.ts +183 -189
  105. package/dist/services/ToolkitCoordinator.js +477 -431
  106. package/dist/services/audio-handoff.d.ts +6 -7
  107. package/dist/services/audio-handoff.js +20 -14
  108. package/dist/services/catalog-owner.d.ts +0 -1
  109. package/dist/services/framework-error-bus.d.ts +3 -6
  110. package/dist/services/framework-error-bus.js +3 -6
  111. package/dist/services/framework-error.d.ts +22 -7
  112. package/dist/services/framework-error.js +9 -7
  113. package/dist/services/interfaces.d.ts +158 -129
  114. package/dist/services/section-session-assignment.d.ts +21 -0
  115. package/dist/services/section-session-assignment.js +82 -0
  116. package/dist/services/spoken-audio-cards.d.ts +0 -2
  117. package/dist/services/spoken-audio-cards.js +0 -2
  118. package/dist/services/tool-config-defaults.d.ts +3 -3
  119. package/dist/services/tool-config-defaults.js +3 -3
  120. package/dist/services/tool-config-validation.d.ts +4 -5
  121. package/dist/services/tool-config-validation.js +36 -61
  122. package/dist/services/tool-context.d.ts +0 -8
  123. package/dist/services/tool-context.js +0 -12
  124. package/dist/services/tool-icons.d.ts +4 -3
  125. package/dist/services/tool-icons.js +4 -3
  126. package/dist/services/tool-instance-id.d.ts +0 -1
  127. package/dist/services/tool-instance-id.js +0 -6
  128. package/dist/services/tool-providers/TTSToolProvider.d.ts +18 -19
  129. package/dist/services/tool-providers/TTSToolProvider.js +37 -34
  130. package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -4
  131. package/dist/services/tool-providers/ToolProviderRegistry.d.ts +30 -26
  132. package/dist/services/tool-providers/ToolProviderRegistry.js +119 -93
  133. package/dist/services/tool-request.d.ts +27 -12
  134. package/dist/services/tool-request.js +24 -14
  135. package/dist/services/toolbar-decided-tools.d.ts +15 -0
  136. package/dist/services/toolbar-decided-tools.js +28 -0
  137. package/dist/services/tools-config-normalizer.d.ts +17 -22
  138. package/dist/services/tools-config-normalizer.js +2 -10
  139. package/dist/services/tts/browser-provider.d.ts +38 -2
  140. package/dist/services/tts/browser-provider.js +276 -140
  141. package/dist/services/tts/flat-tree.d.ts +71 -0
  142. package/dist/services/tts/flat-tree.js +269 -0
  143. package/dist/services/tts/generated-speech/assemble-plan.d.ts +3 -1
  144. package/dist/services/tts/generated-speech/assemble-plan.js +3 -1
  145. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +2 -0
  146. package/dist/services/tts/generated-speech/dom/build-dom-plan.js +1 -1
  147. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +3 -1
  148. package/dist/services/tts/generated-speech/math-speech-cache.js +5 -1
  149. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +12 -4
  150. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +6 -4
  151. package/dist/services/tts/highlight-pipeline/readable-region.js +3 -2
  152. package/dist/services/tts/highlight-pipeline/types.d.ts +5 -0
  153. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +12 -0
  154. package/dist/services/tts/highlight-pipeline/visible-map-range.js +73 -7
  155. package/dist/services/tts/math-aware-text-processing.d.ts +5 -1
  156. package/dist/services/tts/math-aware-text-processing.js +32 -18
  157. package/dist/services/tts/math-control-names.d.ts +21 -0
  158. package/dist/services/tts/math-control-names.js +142 -0
  159. package/dist/services/tts/math-speech.d.ts +11 -0
  160. package/dist/services/tts/math-speech.js +51 -18
  161. package/dist/services/tts/provider-options.d.ts +41 -0
  162. package/dist/services/tts/provider-options.js +1 -0
  163. package/dist/services/tts/ssml/spoken-text.d.ts +2 -26
  164. package/dist/services/tts/ssml/spoken-text.js +29 -0
  165. package/dist/services/tts/start-failure.d.ts +11 -0
  166. package/dist/services/tts/start-failure.js +19 -0
  167. package/dist/services/tts/text-processing.d.ts +9 -0
  168. package/dist/services/tts/text-processing.js +46 -33
  169. package/dist/services/tts/text-segmentation.d.ts +7 -0
  170. package/dist/services/tts/text-segmentation.js +47 -0
  171. package/dist/services/tts-runtime-config.d.ts +25 -17
  172. package/dist/services/tts-runtime-config.js +16 -95
  173. package/dist/tools/content-capability-resolution.d.ts +7 -9
  174. package/dist/tools/content-capability-resolution.js +8 -45
  175. package/dist/tools/registration.d.ts +58 -0
  176. package/dist/tools/registration.js +54 -0
  177. package/dist/tools/registrations/toolbar-registration-helpers.js +2 -2
  178. package/dist/tools/tool-surface-host.d.ts +6 -10
  179. package/dist/tools/tool-surface-host.js +44 -42
  180. package/dist/tools/tool-tag-map.d.ts +5 -15
  181. package/dist/tools/tool-tag-map.js +6 -20
  182. package/dist/utils/structural-equality.d.ts +11 -0
  183. package/dist/utils/structural-equality.js +47 -0
  184. package/package.json +13 -29
  185. package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -49
  186. package/dist/attempt/adapters/activity-to-test-attempt-session.js +0 -138
  187. package/dist/components/chunks/ItemToolBar-b9dz5jvd.js +0 -40
  188. package/dist/components/chunks/ItemToolBar-h4xap0t0.js +0 -4
  189. package/dist/components/chunks/ItemToolBar-wr2myaah.js +0 -2
  190. package/dist/components/chunks/sre-engine-wf9s43gg.js +0 -1
  191. package/dist/context/runtime-context-consumer.d.ts +0 -13
  192. package/dist/context/runtime-context-consumer.js +0 -18
  193. package/dist/item-loader.d.ts +0 -44
  194. package/dist/item-loader.js +0 -61
  195. package/dist/policy/core/engine-context.d.ts +0 -29
  196. package/dist/policy/core/engine-context.js +0 -27
  197. package/dist/policy/core/policy-source-tag.d.ts +0 -31
  198. package/dist/policy/core/policy-source-tag.js +0 -28
  199. package/dist/policy/internal.d.ts +0 -25
  200. package/dist/policy/internal.js +0 -25
  201. package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -92
  202. package/dist/runtime/adapter/coordinator-bridge.js +0 -126
  203. package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -36
  204. package/dist/runtime/adapter/framework-error-bridge.js +0 -46
  205. package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -31
  206. package/dist/runtime/adapter/instrumentation-bridge.js +0 -38
  207. package/dist/runtime/core/engine-stage-derivation.d.ts +0 -18
  208. package/dist/runtime/core/engine-stage-derivation.js +0 -29
  209. package/dist/runtime/engine-context.d.ts +0 -39
  210. package/dist/runtime/engine-context.js +0 -31
  211. package/dist/runtime/internal.d.ts +0 -43
  212. package/dist/runtime/internal.js +0 -45
  213. package/dist/runtime/section-runtime-engine-host-context.d.ts +0 -74
  214. package/dist/runtime/section-runtime-engine-host-context.js +0 -57
  215. package/dist/runtime/stage-emit-gate.d.ts +0 -92
  216. package/dist/runtime/stage-emit-gate.js +0 -82
  217. package/dist/services/I18nService.d.ts +0 -47
  218. package/dist/services/I18nService.js +0 -84
  219. package/dist/services/ThemeProvider.d.ts +0 -95
  220. package/dist/services/ThemeProvider.js +0 -334
  221. package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -21
  222. package/dist/services/defaultPersonalNeedsProfile.js +0 -26
  223. package/dist/services/pnp-standard-features.d.ts +0 -238
  224. package/dist/services/pnp-standard-features.js +0 -338
  225. package/dist/tools/client.d.ts +0 -10
  226. package/dist/tools/client.js +0 -10
  227. package/dist/tools/internal.d.ts +0 -44
  228. package/dist/tools/internal.js +0 -39
@@ -13,8 +13,8 @@
13
13
  *
14
14
  * Part of PIE Assessment Toolkit.
15
15
  */
16
- import type { AccessibilityCatalog, AssessmentEntity, AssessmentItemRef } from "@pie-players/pie-players-shared/types";
17
- import { type CanonicalToolsConfig, type ToolPlacementConfig, type ToolPlacementLevel, type ToolPolicyConfig, type TextToSpeechToolProviderConfig, type ToolProviderConfig, type ToolProvidersConfig, type ToolsConfigInput } from "./tools-config-normalizer.js";
16
+ import type { AccessibilityCatalog, AssessmentEntity, ItemSettings } from "@pie-players/pie-players-shared/types";
17
+ import { type CanonicalToolsConfig, type ToolPlacementConfig, type ToolPolicyConfig, type TextToSpeechToolProviderConfig, type ToolProviderConfig, type ToolProvidersConfig, type ToolsConfigInput } from "./tools-config-normalizer.js";
18
18
  import { type ToolConfigStrictness } from "./tool-config-validation.js";
19
19
  import { AccessibilityCatalogResolver } from "./AccessibilityCatalogResolver.js";
20
20
  import type { CatalogChangeListener } from "./AccessibilityCatalogResolver.js";
@@ -24,53 +24,15 @@ import { FrameworkErrorBus, type FrameworkErrorListener } from "./framework-erro
24
24
  import { HighlightCoordinator } from "./HighlightCoordinator.js";
25
25
  import { ToolCoordinator } from "./ToolCoordinator.js";
26
26
  import { TTSService } from "./TTSService.js";
27
- import { type TTSRuntimeSettings } from "./tts-runtime-config.js";
28
- import type { SREMathSpeechOptions } from "./tts/math-speech.js";
29
27
  import { ToolProviderRegistry } from "./tool-providers/index.js";
30
28
  import type { ToolProviderApi } from "./tool-providers/ToolProviderApi.js";
31
29
  import { ToolRegistry } from "./ToolRegistry.js";
32
- import type { ResolvedToolContext, ToolContextResolver, ToolContextResolverContext, ToolContextResolverMap } from "./ToolRegistry.js";
30
+ import type { ResolvedToolContext, ToolContextResolverContext, ToolContextResolverMap } from "./ToolRegistry.js";
33
31
  import type { ToolOpenRequest, ToolRequestTarget } from "./tool-request.js";
34
- import { type FeaturePolicyDecision, type PnpEnforcementMode, type PolicySource, type ResolvedEngineInputs, type ToolPolicyChangeListener, type ToolPolicyDecision, type ToolPolicyDecisionRequest } from "../policy/engine.js";
35
- import type { SectionControllerContext, SectionControllerEvent, SectionControllerEventType, SectionControllerFactoryDefaults, SectionControllerHandle, SectionControllerKey, SectionSessionPersistenceStrategy, SectionPersistenceFactoryDefaults } from "./section-controller-types.js";
32
+ import { type FeaturePolicyDecision, type PnpEnforcementMode, type PolicySource, type ResolvedEngineInputs, type ToolPolicyChangeListener, type ToolPolicyDecision, type ToolPolicyDecisionRequest, type ToolScope } from "../policy/engine.js";
33
+ import type { SectionControllerContext, SectionControllerEvent, SectionControllerEventType, SectionControllerFactoryDefaults, SectionControllerHandle, SectionControllerKey, SectionControllerSessionState, SectionSessionPersistenceStrategy, SectionPersistenceFactoryDefaults } from "./section-controller-types.js";
36
34
  export type { SectionControllerContext, SectionControllerEvent, SectionControllerEventType, SectionControllerFactoryDefaults, SectionControllerHandle, SectionControllerKey, SectionControllerLoadedRenderable, SectionSessionPersistenceConfig, SectionSessionPersistenceStrategy, SectionControllerRuntimeState, SectionControllerSessionState, SectionPersistenceFactoryDefaults, } from "./section-controller-types.js";
37
35
  export type { FeaturePolicyDecision, PnpEnforcementMode, ResolvedEngineInputs, ToolPolicyChangeListener, ToolPolicyDecision, ToolPolicyDecisionRequest, } from "../policy/engine.js";
38
- /**
39
- * Generic tool configuration
40
- */
41
- export interface ToolConfig {
42
- enabled?: boolean;
43
- provider?: unknown;
44
- settings?: Record<string, unknown>;
45
- [key: string]: unknown;
46
- }
47
- /**
48
- * TTS configuration as a host writes it.
49
- *
50
- * The field set is `TTSRuntimeSettings`, which the runtime resolver owns: the two
51
- * were declared separately and had already drifted in both directions, so a field
52
- * the runtime honoured could not be named here. What this adds is the one thing
53
- * only a host-facing config has — a place to stash unrecognised keys, which the
54
- * resolved runtime settings do not carry.
55
- *
56
- * `provider` is typed from the `textToSpeech` tools-config entry instead: a host
57
- * gives either a server provider id or a runtime provider object, whose
58
- * `runtime.authFetcher` the TTS registration reads, and `TTSRuntimeSettings`
59
- * names only the id. The entry is therefore assignable to this type, which is
60
- * what `getToolConfig("textToSpeech")` returns.
61
- */
62
- export type TTSToolConfig = ToolConfig & Omit<TTSRuntimeSettings, "provider"> & {
63
- provider?: TextToSpeechToolProviderConfig["provider"];
64
- settings?: Record<string, unknown> & {
65
- mathSpeech?: SREMathSpeechOptions;
66
- };
67
- };
68
- /**
69
- * Answer eliminator tool configuration
70
- */
71
- export interface AnswerEliminatorToolConfig extends ToolConfig {
72
- strategy?: "strikethrough" | "hide";
73
- }
74
36
  export interface ToolkitToolsConfig extends CanonicalToolsConfig {
75
37
  policy: ToolPolicyConfig;
76
38
  placement: Required<ToolPlacementConfig>;
@@ -86,8 +48,8 @@ export interface ToolkitCoordinatorConfig {
86
48
  */
87
49
  assessmentId: string;
88
50
  /**
89
- * Tool availability and configuration.
90
- * Defaults: all tools enabled with default settings.
51
+ * Tool availability and configuration. The default placement is empty: a tool
52
+ * shows only where placement puts it, and a grant does not place one.
91
53
  */
92
54
  tools?: ToolsConfigInput;
93
55
  /**
@@ -129,12 +91,21 @@ export interface ToolkitCoordinatorConfig {
129
91
  */
130
92
  hooks?: ToolkitCoordinatorHooks;
131
93
  /**
132
- * Lazy initialization mode.
133
- * When true, async service/provider initialization is deferred until ensure methods are called.
94
+ * Start text-to-speech at its first use rather than as part of readiness.
95
+ * `waitUntilReady()` then settles without it, unless policy grants the tool,
96
+ * so a granted read-aloud still fails before the learner starts.
134
97
  *
135
98
  * @default false
136
99
  */
137
100
  lazyInit?: boolean;
101
+ /**
102
+ * Start initializing at construction. `<pie-assessment-toolkit>` passes false
103
+ * for the coordinator it builds, and starts initialization once its section
104
+ * composes.
105
+ *
106
+ * @default !lazyInit
107
+ */
108
+ eagerInit?: boolean;
138
109
  /**
139
110
  * Internal bootstrap escape hatch used by framework-owned hosts.
140
111
  * When true, constructor skips throwing validation and expects caller
@@ -166,20 +137,15 @@ export interface ToolkitCoordinatorConfig {
166
137
  frameworkErrorBus?: FrameworkErrorBus;
167
138
  }
168
139
  export interface ToolkitErrorContext {
169
- phase: "coordinator-ready" | "state-load" | "state-save" | "provider-register" | "provider-init" | "tts-init" | "section-controller-init" | "section-controller-dispose";
170
- providerId?: string;
140
+ phase: "coordinator-ready" | "state-load" | "state-save" | "provider-register" | "provider-init" | "tts-init" | "section-controller-init" | "section-controller-dispose" | "tool-module-load";
141
+ /** The tool whose provider failed. */
142
+ toolId?: string;
171
143
  details?: Record<string, unknown>;
144
+ recoverable?: boolean;
172
145
  }
173
146
  export interface ProviderLifecycleContext {
174
- providerId: string;
175
147
  providerName?: string;
176
148
  }
177
- export interface ToolkitInitStatus {
178
- tts: boolean;
179
- stateLoaded: boolean;
180
- coordinator: boolean;
181
- providers: Record<string, boolean>;
182
- }
183
149
  export interface SectionControllerLifecycleEvent {
184
150
  type: "ready" | "disposed";
185
151
  key: SectionControllerKey;
@@ -249,9 +215,9 @@ export interface ToolkitCoordinatorHooks {
249
215
  onBeforeTTSInit?: (context: ToolkitErrorContext) => void | Promise<void>;
250
216
  onTTSReady?: () => void | Promise<void>;
251
217
  onCoordinatorReady?: (coordinator: ToolkitCoordinator) => void | Promise<void>;
252
- onProviderRegistered?: (providerId: string, meta: ProviderLifecycleContext) => void | Promise<void>;
253
- onProviderInitStart?: (providerId: string, meta: ProviderLifecycleContext) => void | Promise<void>;
254
- onProviderReady?: (providerId: string, meta: ProviderLifecycleContext) => void | Promise<void>;
218
+ onProviderRegistered?: (toolId: string, meta: ProviderLifecycleContext) => void | Promise<void>;
219
+ onProviderInitStart?: (toolId: string, meta: ProviderLifecycleContext) => void | Promise<void>;
220
+ onProviderReady?: (toolId: string, meta: ProviderLifecycleContext) => void | Promise<void>;
255
221
  onTelemetry?: (eventName: string, payload?: Record<string, unknown>) => void | Promise<void>;
256
222
  loadToolState?: () => Record<string, Record<string, unknown>> | Promise<Record<string, Record<string, unknown>> | null | undefined> | null | undefined;
257
223
  saveToolState?: (state: Record<string, Record<string, unknown>>) => void | Promise<void>;
@@ -269,24 +235,15 @@ export type ToolkitTelemetryListener = (args: {
269
235
  eventName: string;
270
236
  payload?: Record<string, unknown>;
271
237
  }) => void;
272
- /**
273
- * Service bundle returned by getServiceBundle()
274
- */
275
- export interface ToolkitServiceBundle {
276
- ttsService: TTSService;
277
- toolCoordinator: ToolCoordinator;
278
- highlightCoordinator: HighlightCoordinator;
279
- elementToolStateStore: ElementToolStateStore;
280
- catalogResolver: AccessibilityCatalogResolver;
281
- toolProviderRegistry: ToolProviderRegistry;
282
- }
283
238
  /**
284
239
  * ToolkitCoordinator - Orchestrates all assessment toolkit services
285
240
  *
286
241
  * @example
287
242
  * ```typescript
288
- * // createPackagedToolRegistry is exported by @pie-players/pie-default-tool-loaders
289
- * const toolRegistry = createPackagedToolRegistry();
243
+ * // Both are exported by @pie-players/pie-default-tool-loaders
244
+ * const toolRegistry = createPackagedToolRegistry({
245
+ * toolModuleLoaders: DEFAULT_TOOL_MODULE_LOADERS,
246
+ * });
290
247
  *
291
248
  * // Create coordinator with configuration
292
249
  * const coordinator = new ToolkitCoordinator({
@@ -295,7 +252,7 @@ export interface ToolkitServiceBundle {
295
252
  * tools: {
296
253
  * providers: {
297
254
  * textToSpeech: { enabled: true, backend: 'browser' },
298
- * answerEliminator: { enabled: true, strategy: 'strikethrough' }
255
+ * answerEliminator: { enabled: true }
299
256
  * },
300
257
  * placement: {
301
258
  * item: ['textToSpeech', 'answerEliminator']
@@ -327,22 +284,43 @@ export declare class ToolkitCoordinator {
327
284
  readonly lazyInit: boolean;
328
285
  /** Track TTS initialization state */
329
286
  private ttsInitialized;
287
+ /** Text-to-speech failed to start and policy does not grant it. */
288
+ private ttsDegraded;
330
289
  private ttsInitPromise?;
331
290
  private ttsReconfigurePromise?;
332
291
  private stateLoaded;
292
+ /**
293
+ * The loader ran, whether or not it returned state. A failed load is
294
+ * reported once and the coordinator runs without saved tool state.
295
+ */
296
+ private stateLoadSettled;
333
297
  private stateLoadPromise?;
334
298
  private coordinatorReadyPromise?;
335
299
  private coordinatorReadyNotified;
336
300
  private readonly providerInitPromises;
301
+ /**
302
+ * Recoverable failures, by tool. A policy change that grants one of these
303
+ * tools reports its failure again as fatal.
304
+ */
305
+ private readonly degradedTools;
306
+ /** Tools a toolbar reported a module failure for, each reported once. */
307
+ private readonly toolModuleFailures;
308
+ private readonly readyChangeListeners;
309
+ private readonly eagerInit;
337
310
  private toolRegistry;
338
311
  /** Whether the host passed `toolRegistry`, which then always stands. */
339
312
  private readonly toolRegistrySupplied;
340
313
  /**
341
314
  * Whether the registry is final: supplied at construction, or adopted from
342
- * the toolkit this coordinator is bound to. Until then the empty placeholder
343
- * reports no missing registry, since the toolkit will supply one.
315
+ * the toolkit this coordinator is bound to.
344
316
  */
345
317
  private toolRegistrySettled;
318
+ /**
319
+ * Whether a bound toolkit reported having no registry. Until then, or until a
320
+ * registry settles, the empty placeholder reports no missing registry, since
321
+ * the toolkit may supply one.
322
+ */
323
+ private toolRegistryAbsent;
346
324
  private readonly toolContextResolvers;
347
325
  private readonly toolContextResolverChangeListeners;
348
326
  private readonly toolRequests;
@@ -369,14 +347,16 @@ export declare class ToolkitCoordinator {
369
347
  * Phase D: map key of the section controller currently treated as
370
348
  * the *active cohort*. Set by `getOrCreateSectionController` (both
371
349
  * the create-new and resolve-existing paths) and cleared when the
372
- * matching controller is disposed. `null` while no cohort exists,
373
- * which is the only state where `subscribeSectionEvents` throws.
350
+ * matching controller is disposed, and `null` while the next requested
351
+ * cohort is still starting.
374
352
  */
375
353
  private activeCohortMapKey;
376
354
  /**
377
355
  * Latest requested active cohort. Async controller initialization can
378
356
  * resolve out of order; only the most recent request may migrate active
379
357
  * subscriptions. Older completions still populate the controller cache.
358
+ * `null` until the first request, which is the only state where
359
+ * `subscribeSectionEvents` throws.
380
360
  */
381
361
  private latestRequestedActiveCohortMapKey;
382
362
  private readonly telemetryListeners;
@@ -392,32 +372,20 @@ export declare class ToolkitCoordinator {
392
372
  */
393
373
  private readonly policyEngine;
394
374
  /**
395
- * Host-set override for PNP/profile enforcement. `null` (the default) means
396
- * "auto" — the coordinator infers the effective mode from the
397
- * PNP/profile policy inputs the bound `AssessmentEntity` and `AssessmentItemRef`
398
- * actually carry (see {@link resolveEffectivePnpEnforcement}).
375
+ * Host-set override for PNP/profile enforcement, passed to the engine.
376
+ * `null` (the default) is auto-mode, which the engine resolves per decision
377
+ * from the policy material the bound assessment and the decision's item carry.
399
378
  * `"on"` / `"off"` are explicit host opt-in / opt-out and stick
400
- * across subsequent assessment / item swaps until the host clears
379
+ * across subsequent assessment swaps until the host clears
401
380
  * the override by calling `setPnpEnforcement(null)`.
402
381
  */
403
382
  private pnpEnforcementOverride;
404
383
  /**
405
- * Last assessment passed to {@link updateAssessment}. Read by
406
- * {@link resolveEffectivePnpEnforcement} to compute auto-mode.
407
- * The engine's own copy is the canonical record for decisions;
408
- * this mirror exists only so the auto-mode helper does not need
409
- * to round-trip through {@link policyEngine}'s frozen snapshot.
410
- */
411
- private boundAssessment;
412
- /**
413
- * Last item reference passed to {@link updateCurrentItemRef}.
414
- * Mirrored alongside {@link boundAssessment} so
415
- * {@link resolveEffectivePnpEnforcement} can detect item-level
416
- * profile policy inputs (`requiredTools` / `restrictedTools` /
417
- * `toolParameters`) without round-tripping through the engine's
418
- * frozen snapshot.
384
+ * Policy diagnostics already logged, keyed by code, tool id and, for
385
+ * `tool-policy.itemSettingNotApplied`, item id; see
386
+ * {@link warnPolicyDiagnostics}.
419
387
  */
420
- private boundCurrentItemRef;
388
+ private readonly warnedPolicyDiagnostics;
421
389
  /**
422
390
  * Whether {@link decideFeaturePolicy} has already reported serving a decision
423
391
  * with no assessment bound.
@@ -431,7 +399,7 @@ export declare class ToolkitCoordinator {
431
399
  private reportedUnboundFeaturePolicy;
432
400
  /**
433
401
  * Whether {@link _initializeTTS} has already reported a non-browser backend
434
- * falling back to browser speech because no `tts` provider is registered.
402
+ * falling back to browser speech because no text-to-speech provider is registered.
435
403
  * Once per coordinator: a text-to-speech config change re-runs
436
404
  * initialization, and the missing provider is the same gap each time.
437
405
  */
@@ -490,7 +458,39 @@ export declare class ToolkitCoordinator {
490
458
  */
491
459
  private emitTelemetry;
492
460
  private emitSectionControllerLifecycle;
461
+ /**
462
+ * Every report site states whether the coordinator carries on after the
463
+ * failure; one that takes down only its section passes `scope: "cohort"`.
464
+ */
493
465
  private handleError;
466
+ /**
467
+ * Whether policy grants `toolId` as an accommodation on some surface: a
468
+ * test-administration override, a mounted item's or a district requirement,
469
+ * or profile support. Read without the unbound-assessment warning.
470
+ */
471
+ private isToolGranted;
472
+ /**
473
+ * Reports a tool's start failure: recoverable, so the tool reports itself
474
+ * unavailable and the assessment goes on, unless policy grants the tool.
475
+ * `fallbackFollows` marks a failure another path absorbs, which is recoverable
476
+ * whatever the policy.
477
+ */
478
+ private reportToolFailure;
479
+ /**
480
+ * Report that a toolbar could not load a tool's module. The failure follows
481
+ * the start-failure policy: the tool degrades, so the toolbar withholds it,
482
+ * unless policy grants it. Reported once per tool however many toolbars fail
483
+ * to load it. Every report re-announces the request targets, since the
484
+ * reporting toolbar no longer hosts the tool.
485
+ */
486
+ reportToolModuleFailure(toolId: string, error: unknown): void;
487
+ private reportNewlyGrantedFailures;
488
+ /**
489
+ * Subscribe to changes of {@link isReady}: state loading, text-to-speech
490
+ * starting, failing or reconfiguring. The listener reads the status itself.
491
+ */
492
+ onReadyChange(listener: () => void): () => void;
493
+ private notifyReadyChange;
494
494
  /**
495
495
  * Subscribe to framework-error events emitted by this coordinator.
496
496
  *
@@ -521,14 +521,17 @@ export declare class ToolkitCoordinator {
521
521
  private resolveSectionPersistence;
522
522
  private setupStatePersistenceHooks;
523
523
  private ensureStateLoaded;
524
+ /** Whether the toolkit this coordinator binds to may still supply a registry. */
525
+ private toolRegistryPending;
524
526
  private reportMissingTTSProvider;
525
527
  /**
526
528
  * Take the registry of the toolkit this coordinator is bound to, when the host
527
529
  * constructed it without one: the config is validated against it, its
528
530
  * providers register, and text-to-speech re-initializes through it if it
529
- * already started. The toolkit elements call this on binding. A registry
530
- * passed at construction stands, and the first call wins; `null` records a
531
- * toolkit without one, which reports the registry as missing.
531
+ * already started. The toolkit elements call this on binding, and again when
532
+ * their registry changes. A registry passed at construction stands, and the
533
+ * first registry adopted wins; `null` records a toolkit without one, which
534
+ * reports the registry as missing and still adopts one that arrives later.
532
535
  *
533
536
  * @returns Whether `registry` was adopted.
534
537
  */
@@ -540,19 +543,22 @@ export declare class ToolkitCoordinator {
540
543
  private getProviderDescriptorTools;
541
544
  /**
542
545
  * Register the provider `tool`'s descriptor creates for the tool's current
543
- * config, unless the tool is disabled or that provider id is registered. A
544
- * descriptor that throws is reported the way a failed registration is.
546
+ * config under the tool's id, unless the tool is disabled or, without
547
+ * `replace`, a provider is registered under that id. A descriptor that throws
548
+ * is reported the way a failed registration is.
545
549
  */
546
550
  private registerProviderFromTool;
547
551
  private createToolTelemetryForwarder;
548
552
  private addToolTelemetryReporter;
549
553
  private registerProvider;
550
554
  /**
551
- * A console warning and a `provider-register` framework error. `providerId`
552
- * is null when resolving it is what failed; the warning names the tool then.
555
+ * A console warning and a `provider-register` framework error, under the
556
+ * start-failure policy every other tool failure follows.
553
557
  */
554
558
  private reportProviderRegisterFailure;
555
- ensureProviderReady(providerId: string): Promise<ToolProviderApi>;
559
+ ensureProviderReady(toolId: string): Promise<ToolProviderApi>;
560
+ /** `fallbackFollows`: the caller recovers from a failure on its own. */
561
+ private initializeProvider;
556
562
  setHooks(hooks: ToolkitCoordinatorHooks): void;
557
563
  subscribeTelemetry(listener: ToolkitTelemetryListener): () => void;
558
564
  getSectionController(args: {
@@ -636,17 +642,31 @@ export declare class ToolkitCoordinator {
636
642
  attemptId?: string;
637
643
  input?: unknown;
638
644
  updateExisting?: boolean;
645
+ initialSession?: SectionControllerSessionState | null;
639
646
  createDefaultController: () => SectionControllerHandle | Promise<SectionControllerHandle>;
640
647
  }): Promise<SectionControllerHandle>;
641
648
  private resolveExistingSectionController;
642
649
  private createSectionControllerContext;
643
650
  private initializeNewSectionController;
651
+ /**
652
+ * Apply a host-supplied session to a controller that is already published,
653
+ * under the rules `resolveSectionSessionAssignment` sets: an equal session is a
654
+ * no-op and recorded responses are not replaced by response-free ones.
655
+ */
656
+ private assignSessionToPublishedController;
644
657
  private createSectionControllerRetirementError;
645
658
  private retireUnpublishedSectionControllerIfNeeded;
646
659
  private cleanupUnpublishedSectionController;
647
660
  private retirePublishedSectionControllerIfNeeded;
648
661
  private finalizeSectionControllerReady;
649
662
  private handleSectionControllerInitError;
663
+ /**
664
+ * A section that fails to start has no controller of its own to emit its
665
+ * `section-error`, and the host's subscriptions are already off the outgoing
666
+ * section, so the coordinator delivers the error to them while that section
667
+ * is still the one requested.
668
+ */
669
+ private deliverSectionStartError;
650
670
  disposeSectionController(args: {
651
671
  sectionId: string;
652
672
  attemptId?: string;
@@ -668,47 +688,41 @@ export declare class ToolkitCoordinator {
668
688
  /**
669
689
  * Initialize TTS service with provider
670
690
  */
671
- ensureTTSReady(config?: TTSToolConfig): Promise<void>;
691
+ ensureTTSReady(config?: TextToSpeechToolProviderConfig): Promise<void>;
672
692
  private waitForPendingTTSReconfigure;
673
693
  private _initializeTTS;
674
694
  private resolveTTSToolConfig;
675
695
  private initializeTTSService;
676
- private ensureBrowserVoicesReady;
696
+ waitUntilReady(): Promise<void>;
697
+ isReady(): boolean;
677
698
  /**
678
- * Get all services as a bundle for section player convenience.
679
- * Section player can extract and pass services to child components.
699
+ * Readiness waits for text-to-speech when it is enabled and either starts
700
+ * eagerly or is granted: a granted read-aloud fails before the learner starts.
680
701
  */
681
- getServiceBundle(): ToolkitServiceBundle;
702
+ private ttsRequiredForReadiness;
682
703
  /**
683
- * Get a tool provider from the registry
684
- *
685
- * @param providerId Provider identifier
686
- * @returns Tool provider instance
704
+ * Starts text-to-speech for readiness. A failure policy does not grant leaves
705
+ * the tool degraded, reporting itself unavailable, and readiness settles; a
706
+ * granted tool's failure rejects.
687
707
  */
688
- getToolProvider(providerId: string): Promise<ToolProviderApi<any, any>>;
689
- waitUntilReady(): Promise<void>;
690
- isReady(): boolean;
691
- getInitStatus(): ToolkitInitStatus;
708
+ private startTTSForReadiness;
692
709
  private getTTSConfigFromProviders;
693
710
  private assertCanonicalToolId;
694
711
  private installToolContextResolvers;
695
- setToolContextResolvers(resolvers: ToolContextResolverMap | null | undefined): void;
696
- private notifyToolContextResolverChange;
697
712
  /**
698
- * Check if a tool is enabled.
699
- * Tools are enabled by default unless explicitly disabled.
700
- *
701
- * @param toolId Tool identifier (e.g., 'textToSpeech', 'answerEliminator')
702
- * @returns True if tool is enabled
713
+ * Replace all host-owned render-context resolvers. The toolkit element
714
+ * calls this from `runtime.toolContextResolvers`; it is not on
715
+ * `ToolkitCoordinatorApi`.
703
716
  */
704
- isToolEnabled(toolId: string): boolean;
717
+ setToolContextResolvers(resolvers: ToolContextResolverMap | null | undefined): void;
718
+ private notifyToolContextResolverChange;
705
719
  /**
706
720
  * Get tool configuration.
707
721
  *
708
722
  * @param toolId Tool identifier
709
723
  * @returns Tool configuration or null if not configured
710
724
  */
711
- getToolConfig(toolId: "textToSpeech"): TTSToolConfig | null;
725
+ getToolConfig(toolId: "textToSpeech"): TextToSpeechToolProviderConfig | null;
712
726
  getToolConfig(toolId: string): ToolProviderConfig | null;
713
727
  /**
714
728
  * Update tool configuration.
@@ -717,27 +731,38 @@ export declare class ToolkitCoordinator {
717
731
  * @param toolId Tool identifier
718
732
  * @param updates Partial configuration updates
719
733
  */
720
- updateToolConfig(toolId: "textToSpeech", updates: Partial<TTSToolConfig>): void;
734
+ updateToolConfig(toolId: "textToSpeech", updates: Partial<TextToSpeechToolProviderConfig>): void;
721
735
  updateToolConfig(toolId: string, updates: Partial<ToolProviderConfig>): void;
722
736
  /**
723
- * Update the enabled tool list for one placement level.
737
+ * Patch one or more placement levels in the canonical tools config.
724
738
  *
725
739
  * This is the generic placement companion to {@link updateToolConfig}:
726
740
  * it validates the next canonical tools config, keeps the policy
727
741
  * engine in lockstep, and emits the same policy-change event used by
728
742
  * live toolbars/debug panels.
729
743
  */
730
- updateToolPlacement(level: ToolPlacementLevel, toolIds: string[]): void;
731
- /**
732
- * Patch one or more placement levels in the canonical tools config.
733
- */
734
744
  updateToolsPlacement(partial: ToolPlacementConfig): void;
735
745
  /**
736
746
  * Resolve the visible tool set for a given placement level + scope.
737
747
  *
738
- * Thin shim over the owned tool-policy engine.
748
+ * Delegates to the owned tool-policy engine and logs the decision's
749
+ * diagnostics through {@link warnPolicyDiagnostics}.
739
750
  */
740
751
  decideToolPolicy(request: ToolPolicyDecisionRequest): ToolPolicyDecision;
752
+ /**
753
+ * Log each policy diagnostic as a console warning, once per code and tool
754
+ * id, and per item for `tool-policy.itemSettingNotApplied`. Decisions re-run
755
+ * on every input change, so a conflict would otherwise repeat on each.
756
+ */
757
+ private warnPolicyDiagnostics;
758
+ /**
759
+ * File a mounted item's policy settings (`requiredTools`, `restrictedTools`,
760
+ * `toolParameters`) under its canonical id. They govern the decisions scoped
761
+ * to that item: its own item-level toolbar, and the feature decisions its
762
+ * content asks with the item's scope. `pie-item-scope` registers them from
763
+ * its `settings` property; the returned function withdraws them.
764
+ */
765
+ registerItemSettings(itemId: string, settings: ItemSettings): () => void;
741
766
  /**
742
767
  * Resolve eligibility for one PNP/AfA feature id, independent of toolbar
743
768
  * placement.
@@ -756,14 +781,18 @@ export declare class ToolkitCoordinator {
756
781
  * enforcement is explicitly `"on"`. Its toolkit binds whatever assessment the
757
782
  * host gave, usually none, and a host that passes no profile and leaves
758
783
  * enforcement unset or `"off"` has asked for no accommodation.
784
+ *
785
+ * `scope` is the surface asking; an item's scope brings in that item's
786
+ * registered settings ({@link registerItemSettings}).
759
787
  */
760
- decideFeaturePolicy(featureId: string): FeaturePolicyDecision;
788
+ decideFeaturePolicy(featureId: string, scope?: ToolScope): FeaturePolicyDecision;
761
789
  /**
762
790
  * Subscribe to policy-engine change events. Fires whenever the
763
791
  * coordinator's bound inputs change (`updateToolConfig`,
764
- * `updateToolPlacement`, `updateAssessment`, `updateCurrentItemRef`,
765
- * `setPnpEnforcement`) or a custom `PolicySource` is registered /
766
- * removed via {@link registerPolicySource}.
792
+ * `updateToolsPlacement`, `updateAssessment`, `setPnpEnforcement`), an
793
+ * item's settings are registered or withdrawn ({@link registerItemSettings}),
794
+ * or a custom `PolicySource` is registered / removed via
795
+ * {@link registerPolicySource}.
767
796
  *
768
797
  * The listener receives a `ToolPolicyChangeEvent` with the event
769
798
  * `reason` and a frozen snapshot of the engine inputs. Listeners
@@ -789,31 +818,20 @@ export declare class ToolkitCoordinator {
789
818
  /**
790
819
  * Bind (or clear) the active assessment for PNP/profile policy decisions.
791
820
  *
792
- * Under auto-mode (no host override via {@link setPnpEnforcement}),
793
- * the coordinator promotes the engine to `pnpEnforcement: "on"`
794
- * iff the assessment carries any profile precedence material
795
- * (`personalNeedsProfile`, `settings.districtPolicy`,
796
- * `settings.testAdministration`) or the currently-bound item ref
797
- * carries item-level profile policy inputs. A bare assessment record (just
821
+ * Under auto-mode (no host override via {@link setPnpEnforcement}), a
822
+ * decision enforces PNP/profile policy iff the assessment carries profile
823
+ * precedence material (`personalNeedsProfile`, `settings.districtPolicy`,
824
+ * `settings.testAdministration`), or the decision is scoped to an item whose
825
+ * settings carry item-level policy inputs. A bare assessment record (just
798
826
  * `id` / `name`, no PNP, no settings) keeps `"off"`.
799
827
  *
800
828
  * The host override set via {@link setPnpEnforcement} is sticky
801
- * across assessment swaps; calling with `null` clears the binding
802
- * and re-runs the auto-mode helper.
829
+ * across assessment swaps.
803
830
  */
804
831
  updateAssessment(assessment: AssessmentEntity | null): void;
805
832
  /**
806
- * Bind (or clear) the current item reference for policy decisions.
807
- *
808
- * Used by item-level profile gates (item `requiredTools` /
809
- * `restrictedTools` / `toolParameters`). Item-level profile material
810
- * also feeds {@link resolveEffectivePnpEnforcement} — navigating
811
- * to an item with profile settings can flip auto-mode to `"on"` even
812
- * when the parent assessment carries no profile block of its own.
813
- */
814
- updateCurrentItemRef(itemRef: AssessmentItemRef | null): void;
815
- /**
816
- * Override the auto-mode PNP/profile enforcement decision.
833
+ * Override the auto-mode PNP/profile enforcement decision; `null` returns
834
+ * to auto-mode.
817
835
  */
818
836
  setPnpEnforcement(mode: PnpEnforcementMode | null): void;
819
837
  /**
@@ -834,19 +852,10 @@ export declare class ToolkitCoordinator {
834
852
  * compose with the built-in PNP policy source).
835
853
  */
836
854
  registerPolicySource(source: PolicySource): () => void;
837
- /**
838
- * Register a host-owned resolver for one tool's render context.
839
- *
840
- * Resolvers are evaluated only for tools that already survived the
841
- * framework policy pipeline. They can hide the tool for the current
842
- * scope or attach render params consumed by the packaged registration;
843
- * they cannot re-enable tools blocked by placement, provider config,
844
- * host policy, or PNP/profile rules.
845
- */
846
- registerToolContextResolver(toolId: string, resolver: ToolContextResolver): () => void;
847
855
  hasToolContextResolver(toolId: string): boolean;
848
856
  resolveToolContext(context: ToolContextResolverContext): ResolvedToolContext | null;
849
857
  onToolContextResolverChange(listener: () => void): () => void;
858
+ getToolRegistry(): ToolRegistry;
850
859
  /**
851
860
  * Claim requests for one placement level. Called by a toolbar on mount.
852
861
  */
@@ -865,37 +874,22 @@ export declare class ToolkitCoordinator {
865
874
  * surface, and a host that swapped the registry for one without the tool would
866
875
  * otherwise lose the whole surface to an exception over an absent action.
867
876
  */
868
- canRequestTool(toolId: string, level?: ToolOpenRequest["level"]): boolean;
877
+ canRequestTool(toolId: string, level?: ToolOpenRequest["level"], scopeId?: string): boolean;
869
878
  onToolRequestTargetsChange(listener: () => void): () => void;
870
- /**
871
- * Compute the effective PNP/profile enforcement mode given the explicit
872
- * host override and the auto-mode helper.
873
- *
874
- * Auto-mode (no override) defers to
875
- * {@link resolveDefaultPnpEnforcement}, which returns `"on"`
876
- * exactly when the bound assessment or current item ref carries
877
- * profile precedence material (PNP, district policy, test
878
- * administration, item-level required/restricted/parameters), and
879
- * `"off"` otherwise. Profile gates engage the moment profile material
880
- * is present.
881
- */
882
- private resolveEffectivePnpEnforcement;
883
879
  private resolveConfiguredPnpEnforcement;
884
880
  /**
885
881
  * Apply tool configuration changes to underlying services.
886
- * Called after updateToolConfig() with the tool's config before the update.
882
+ * Called after updateToolConfig().
887
883
  */
888
884
  private _applyToolConfigChange;
889
885
  /**
890
- * Register the provider a tool's updated config names, and unregister the
891
- * one its previous config named when the provider id changed, as
892
- * {@link _reconfigureTTSProvider} does for `tts`. Registration completes
893
- * before this returns, so a check on the policy change the update dispatched
894
- * finds the new provider.
886
+ * Register the provider a tool's updated config builds, replacing the one
887
+ * registered under the tool's id. Registration completes before this returns,
888
+ * so a check on the policy change the update dispatched finds the new provider.
895
889
  */
896
890
  private _registerChangedToolProvider;
897
891
  /**
898
- * Re-register the `tts` provider for the current config and registry, then
892
+ * Re-register the text-to-speech provider for the current config and registry, then
899
893
  * re-initialize unless initialization is lazy. An initialization already
900
894
  * running finishes first: it would otherwise mark its provider ready after
901
895
  * the reset.