@pie-players/pie-default-tool-loaders 0.3.74 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +116 -107
  2. package/dist/calculator-providers/CortexToolProvider.d.ts +0 -3
  3. package/dist/calculator-providers/CortexToolProvider.js +0 -14
  4. package/dist/calculator-providers/DesmosToolProvider.d.ts +0 -3
  5. package/dist/calculator-providers/DesmosToolProvider.js +0 -14
  6. package/dist/calculator-providers/GeoGebraToolProvider.d.ts +0 -3
  7. package/dist/calculator-providers/GeoGebraToolProvider.js +0 -14
  8. package/dist/calculator-providers/LazyCalculatorToolProvider.d.ts +3 -5
  9. package/dist/calculator-providers/LazyCalculatorToolProvider.js +1 -1
  10. package/dist/content-alternates.d.ts +1 -1
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +2 -2
  13. package/dist/packaged-capability-composition.d.ts +22 -50
  14. package/dist/packaged-capability-composition.js +61 -266
  15. package/dist/registrations/accessibility-tools.d.ts +1 -5
  16. package/dist/registrations/accessibility-tools.js +11 -49
  17. package/dist/registrations/audio-transcript.d.ts +8 -7
  18. package/dist/registrations/audio-transcript.js +12 -8
  19. package/dist/registrations/calculator.d.ts +2 -6
  20. package/dist/registrations/calculator.js +17 -39
  21. package/dist/registrations/dictionary-tools.d.ts +6 -5
  22. package/dist/registrations/dictionary-tools.js +21 -26
  23. package/dist/registrations/interaction-tools.d.ts +1 -7
  24. package/dist/registrations/interaction-tools.js +22 -30
  25. package/dist/registrations/measurement-tools.d.ts +1 -5
  26. package/dist/registrations/measurement-tools.js +1 -17
  27. package/dist/registrations/overlay-element-cache.d.ts +3 -1
  28. package/dist/registrations/overlay-element-cache.js +2 -1
  29. package/dist/registrations/overlay-toolbar-render.d.ts +9 -19
  30. package/dist/registrations/overlay-toolbar-render.js +9 -16
  31. package/dist/registrations/selection-actions.d.ts +1 -1
  32. package/dist/registrations/selection-actions.js +1 -1
  33. package/dist/registrations/subject-specific-tools.d.ts +1 -5
  34. package/dist/registrations/subject-specific-tools.js +1 -15
  35. package/dist/registrations/tts.d.ts +2 -8
  36. package/dist/registrations/tts.js +28 -99
  37. package/package.json +22 -23
package/README.md CHANGED
@@ -1,105 +1,98 @@
1
1
  # PIE Default Tool Loaders
2
2
 
3
- Composition layer for the packaged PIE assessment tools: which capabilities exist
4
- in a deployment, and how a program tiers them.
3
+ The packaged PIE assessment tools: which capabilities exist in a deployment, how
4
+ they load, and which of them a program grants to everyone. This README is for
5
+ host integrators choosing a tool set and a calculator, and for contributors
6
+ adding a packaged capability.
5
7
 
6
- It owns the concrete `pie-tool-*` dependencies and the calculator engines
7
- (`pie-calculator-cortex`, `-desmos` and `-geogebra`) so toolkit core can stay
8
- dependency-light and cycle-safe, and it is the layer above core — core knows
9
- `featureId`, placement levels, activation kinds and precedence rules, and knows
10
- no capability ids.
11
-
12
- It owns five things, all answers to "which capabilities does this deployment have
13
- and how does the program tier them":
8
+ The package owns the concrete `pie-tool-*` dependencies and the calculator
9
+ engines (`pie-calculator-cortex`, `-desmos` and `-geogebra`), so toolkit core
10
+ stays dependency-light and cycle-safe. Core knows the concepts — support ids,
11
+ placement levels, activation kinds and precedence rules — and no concrete
12
+ capability id. A support id is the tool id a profile grants.
14
13
 
15
14
  | Export | What it decides |
16
15
  | --- | --- |
17
- | `PACKAGED_TOOL_REGISTRATIONS`, `createPackagedToolRegistry`, `registerPackagedTools` | Which capabilities exist, and their toolbar and surface contracts |
16
+ | `PACKAGED_TOOL_REGISTRATIONS`, `createPackagedToolRegistry` | Which capabilities exist, and their toolbar and surface contracts |
18
17
  | `PACKAGED_TOOL_TAG_MAP` | Which custom element each one renders as |
19
- | `PACKAGED_TOOL_PLACEMENT`, `SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT`, `PACKAGED_TOOL_ORDER` | Where they appear and in what order |
20
- | `UNIVERSAL_SUPPORTS_PRESET`, `createUniversalPersonalNeedsProfile` | Which of their support ids the program grants to everyone |
21
- | `DEFAULT_TOOL_MODULE_LOADERS`, `createDefaultToolModuleLoaders`, `registerSectionToolModuleLoaders` | When each one's bundle loads |
22
-
23
- The individual registrations are exported too, so a host can compose its own set
24
- rather than take the packaged one whole.
25
-
26
- These exports are projections of one internal **Packaged Capability
27
- Composition**. Each packaged capability is authored once with its registration,
28
- element delivery, loader bootstrap sets, placement/order membership and explicit
29
- universal-support policy. The package build rejects contradictory PIE-owned data
30
- — for example, a region capability with a toolbar tag, or a universal support
31
- id its registration does not declare — so release tests find a missing facet
32
- instead of a learner finding a dead affordance. The browser does not repeat that
33
- strict gate at import time: a PIE authoring defect must block publication, not an
34
- otherwise usable assessment.
35
-
36
- That invariant boundary does not make host input stricter. The existing public
37
- factory and constants are unchanged: lazy module loading remains opt-in,
38
- registration/tag/factory overrides retain precedence, an empty `toolIds` array
39
- still selects the full packaged set, and unknown selected ids are ignored while
40
- known ids continue to register.
18
+ | `SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT` | Where they appear and in what order |
19
+ | `createUniversalPersonalNeedsProfile`, `createEmptyPersonalNeedsProfile` | Which of them the program grants to everyone, or to no one |
20
+ | `DEFAULT_TOOL_MODULE_LOADERS` | When each one's bundle loads |
21
+ | `CONTENT_ALTERNATE_REGISTRATIONS` | Which of them carry an authored alternate that renders as a region; the print player mounts these |
22
+
23
+ The individual registrations are exported too, so a host can compose its own
24
+ set ([Custom sets](#custom-sets)).
41
25
 
42
26
  ## Usage
43
27
 
44
28
  ```ts
45
- import {
46
- createPackagedToolRegistry,
47
- DEFAULT_TOOL_MODULE_LOADERS,
48
- } from "@pie-players/pie-default-tool-loaders";
29
+ import { createPackagedToolRegistry } from "@pie-players/pie-default-tool-loaders";
49
30
 
50
31
  // The packaged capability set, lazily loaded.
51
- const registry = createPackagedToolRegistry({
52
- toolModuleLoaders: DEFAULT_TOOL_MODULE_LOADERS,
53
- });
32
+ const registry = createPackagedToolRegistry();
33
+
34
+ // The same registrations for a host that defines the tool elements itself.
35
+ const preloaded = createPackagedToolRegistry({ toolModuleLoaders: {} });
54
36
  ```
55
37
 
56
- Desmos remains the calculator delivery when no provider is configured. To use
57
- GeoGebra or the fully bundled open-source Cortex implementation, pass the same
58
- calculator configuration to both the toolkit and the
59
- packaged composition. The composition then owns the matching element tag and
60
- module loader; hosts do not hand-maintain a second vendor map.
38
+ One loader set serves every host shape. `DEFAULT_TOOL_MODULE_LOADERS` holds a
39
+ loader per packaged capability and is what `createPackagedToolRegistry`
40
+ installs unless `toolModuleLoaders` replaces it. A registry loads a module only
41
+ when a tool first renders, so an item player, a section player and an
42
+ assessment player share the set and load only the tools they place.
43
+
44
+ `createPackagedToolRegistry` is lenient with host input. Registration, tag-map
45
+ and component-factory overrides take precedence over the packaged data. An
46
+ empty `toolIds` array selects the full packaged set, and unknown ids in it are
47
+ ignored while the known ones register.
48
+
49
+ ## Calculator providers
50
+
51
+ The calculator is one element, `<pie-tool-calculator>`, for every provider. The
52
+ toolkit picks the provider from `tools.providers.calculator` when the element
53
+ mounts, and an open calculator remounts on the new provider when a tool-config
54
+ update replaces it.
55
+
56
+ Desmos is the provider when none is configured, and it needs an API key: pass
57
+ it through `provider.runtime.authFetcher`, a `provider.init.proxyEndpoint` that
58
+ returns it, or `provider.init.apiKey` in development
59
+ ([Calculator with host auth](../../docs/tools-and-accomodations/tool_provider_system.md#calculator-with-host-auth)).
60
+ Without one the calculator fails to load. For a keyless, offline-capable
61
+ calculator with no runtime CDN, use `provider.id: "calculator-cortex"`. Its
62
+ `settings` take the `CortexCalculatorSettings` type that
63
+ `@pie-players/pie-calculator-cortex` exports: `angleMode`,
64
+ `calculationPrecision`, `displayPrecision`, `historyLimit`,
65
+ `evaluationTimeLimitMs`, `allowedFunctions`, `allowClipboard`, `messages`,
66
+ `direction` and `graph`. Clipboard blocking follows `restrictedMode`;
67
+ `allowClipboard` alone blocks nothing. The [Cortex README](../calculator-cortex/README.md)
68
+ covers localization, message overrides and the keypad.
61
69
 
62
70
  ```ts
63
- import {
64
- createDefaultToolModuleLoaders,
65
- createPackagedToolRegistry,
66
- } from "@pie-players/pie-default-tool-loaders";
67
-
68
- const calculatorProviderConfig = {
69
- provider: {
70
- id: "calculator-geogebra",
71
- init: { appletTimeoutMs: 20_000 },
72
- },
73
- settings: { showResetIcon: true },
74
- };
75
-
76
- const registry = createPackagedToolRegistry({
77
- calculatorProviderConfig,
78
- toolModuleLoaders: createDefaultToolModuleLoaders({
79
- calculatorProviderConfig,
80
- }),
81
- });
82
-
83
71
  const tools = {
84
- providers: { calculator: calculatorProviderConfig },
72
+ providers: {
73
+ calculator: {
74
+ provider: {
75
+ id: "calculator-geogebra",
76
+ init: { appletTimeoutMs: 20_000 },
77
+ },
78
+ settings: { showResetIcon: true },
79
+ },
80
+ },
85
81
  };
86
82
  ```
87
83
 
88
- For an offline-capable calculator with no API key or runtime CDN, use
89
- `provider.id: "calculator-cortex"`. Its `settings` accept angle mode, precision,
90
- history, evaluation limit, allowed functions, clipboard policy, and graph
91
- viewport options documented by `@pie-players/pie-calculator-cortex`.
84
+ ## Custom sets
92
85
 
93
- The toolkit's `ToolRegistry` is the other end of that choice: it starts empty,
94
- and a host composing its own set registers into it and installs the tag map its
95
- registrations create elements from.
86
+ A host composing its own set starts from the toolkit's empty `ToolRegistry`,
87
+ registers into it, and installs the tag map its registrations create elements
88
+ from.
96
89
 
97
90
  ```ts
98
91
  import { ToolRegistry } from "@pie-players/pie-assessment-toolkit";
99
92
  import {
100
93
  calculatorToolRegistration,
94
+ DEFAULT_TOOL_MODULE_LOADERS,
101
95
  PACKAGED_TOOL_TAG_MAP,
102
- registerDefaultToolModuleLoaders,
103
96
  ttsToolRegistration,
104
97
  } from "@pie-players/pie-default-tool-loaders";
105
98
 
@@ -107,27 +100,28 @@ const registry = new ToolRegistry();
107
100
  registry.register(calculatorToolRegistration);
108
101
  registry.register(ttsToolRegistration);
109
102
  registry.setComponentOverrides({ toolTagMap: PACKAGED_TOOL_TAG_MAP });
110
- registerDefaultToolModuleLoaders(registry);
103
+ registry.setToolModuleLoaders(DEFAULT_TOOL_MODULE_LOADERS);
111
104
  ```
112
105
 
113
- `registerDefaultToolModuleLoaders` installs a loader for every packaged tool.
114
- `registerSectionToolModuleLoaders` installs only the section-bootstrap subset,
115
- which has no text-to-speech loader, so a registry that places item-level text to
116
- speech needs the full set.
106
+ A later `setToolModuleLoaders` call adds or replaces entries. A replacement
107
+ registered after a tool's module has loaded is ignored with a warning, since the
108
+ elements it defines are already in place.
117
109
 
118
- ## Content-dependent capabilities require an explicit packaging decision
110
+ ## Content-dependent capabilities
119
111
 
120
- A content-dependent capability is never inferred into
121
- `UNIVERSAL_SUPPORTS_PRESET`. It may ship in `PACKAGED_TOOL_REGISTRATIONS` only
122
- when it has a useful presentation path without a grant and declares
123
- `resolvesWithoutGrant`. Audio transcript is the shipped example: an authored
124
- `visibility: "always"` transcript reaches every player, while its accommodation
125
- path remains policy-gated and `transcript` stays out of the universal preset.
112
+ A content-dependent capability declares `requiresAuthoredContent`: it renders
113
+ only where the content carries what it needs, and
114
+ `createUniversalPersonalNeedsProfile()` never grants one. It ships in
115
+ `PACKAGED_TOOL_REGISTRATIONS` only when it has a useful presentation path
116
+ without a grant and declares `resolvesWithoutGrant`. Audio transcript is the
117
+ shipped example: an authored `visibility: "always"` transcript reaches every
118
+ player, while its accommodation path stays policy-gated and `transcript` stays
119
+ out of the universal profile.
126
120
 
127
- A content-dependent capability with no presentation path remains an explicit
128
- deployment choice. Signing is the shipped example: install
129
- `@pie-players/pie-tool-sign-language` and register it, which is the same two
130
- lines a host writes for a capability of its own.
121
+ A content-dependent capability with no such path is an explicit deployment
122
+ choice. Signing is the shipped example: install
123
+ `@pie-players/pie-tool-sign-language` and register it, the same two lines a
124
+ host writes for a capability of its own.
131
125
 
132
126
  ```ts
133
127
  import { signLanguageRegistration } from "@pie-players/pie-tool-sign-language";
@@ -135,29 +129,44 @@ import { signLanguageRegistration } from "@pie-players/pie-tool-sign-language";
135
129
  registry.register(signLanguageRegistration);
136
130
  ```
137
131
 
138
- ## Universal supports preset
132
+ ## Universal and empty profiles
139
133
 
140
- `createUniversalPersonalNeedsProfile()` builds a `PersonalNeedsProfile` granting
141
- `UNIVERSAL_SUPPORTS_PRESET` — the support ids the packaged tool set treats as
142
- universal features.
134
+ `createUniversalPersonalNeedsProfile()` builds a fresh `PersonalNeedsProfile`
135
+ granting the tool ids of the capabilities the packaged set treats as universal
136
+ features. Tool policy reads the profile from the assessment entity, so set it
137
+ there: on the player's `assessment` property, or through
138
+ `coordinator.updateAssessment(...)` on a coordinator you pass. A
139
+ `section.personalNeedsProfile` is ignored with a console warning.
143
140
 
144
141
  ```ts
145
142
  import { createUniversalPersonalNeedsProfile } from "@pie-players/pie-default-tool-loaders";
146
143
 
147
- const section = {
148
- ...authoredSection,
144
+ sectionPlayer.assessment = {
145
+ ...authoredAssessment,
149
146
  personalNeedsProfile: createUniversalPersonalNeedsProfile(),
150
147
  };
151
148
  ```
152
149
 
153
- The core ships no populated default — `createEmptyPersonalNeedsProfile()` in
154
- `@pie-players/pie-assessment-toolkit` grants nothing. Which capabilities a
155
- deployment grants by default is a property of the program, not of a capability:
156
- TTS is a universal feature in one program and a documented accommodation in
157
- another. So the preset is data to adopt, extend or replace alongside the district
158
- and test-administration configuration, and it deliberately excludes any
159
- capability that declares a content dependency.
160
-
161
- A section carrying no profile is left alone. `pnpEnforcement` auto-detection
162
- engages on real host policy material, so supplying no profile means placement
163
- alone decides which tools appear.
150
+ The toolkit ships no populated default, and `createEmptyPersonalNeedsProfile()`
151
+ builds a profile granting nothing. Which capabilities a deployment grants by
152
+ default is a property of the program: TTS is a universal feature in one program
153
+ and a documented accommodation in another. The universal profile is data to
154
+ adopt, extend or replace alongside the district and test-administration
155
+ configuration, and it excludes every capability that declares a content
156
+ dependency.
157
+
158
+ An assessment carrying no profile is left alone. `pnpEnforcement`
159
+ auto-detection engages only on host policy material, so with no profile,
160
+ placement alone decides which tools appear.
161
+
162
+ ## Packaged capability composition
163
+
164
+ The exports are projections of one internal composition. Each packaged
165
+ capability is authored once with its registration, element delivery, module
166
+ loader, preferred placement and explicit universal-support flag.
167
+
168
+ The package build rejects contradictory PIE-owned data, such as a region
169
+ capability with a toolbar tag or a content-dependent capability marked
170
+ universal, so release tests catch a missing facet before it ships. The browser
171
+ skips that strict check at import time: a PIE authoring defect blocks
172
+ publication and never an otherwise usable assessment.
@@ -1,13 +1,10 @@
1
1
  /** Fully bundled open-source calculator adapter for the tool-provider registry. */
2
2
  import type { CalculatorToolProviderInitConfig, LazyCalculatorProviderDefinition } from "./LazyCalculatorToolProvider.js";
3
3
  import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
4
- import type { ToolProviderCapabilities } from "@pie-players/pie-assessment-toolkit/tools/internal";
5
4
  export type CortexToolProviderConfig = CalculatorToolProviderInitConfig;
6
5
  export declare class CortexToolProvider extends LazyCalculatorToolProvider<CortexToolProviderConfig> {
7
- readonly providerId = "cortex-calculator";
8
6
  readonly providerName = "PIE Open-Source Calculator";
9
7
  readonly version = "1";
10
8
  readonly requiresAuth = false;
11
9
  protected getDefinition(): LazyCalculatorProviderDefinition<CortexToolProviderConfig>;
12
- getCapabilities(): ToolProviderCapabilities;
13
10
  }
@@ -1,7 +1,6 @@
1
1
  /** Fully bundled open-source calculator adapter for the tool-provider registry. */
2
2
  import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
3
3
  export class CortexToolProvider extends LazyCalculatorToolProvider {
4
- providerId = "cortex-calculator";
5
4
  providerName = "PIE Open-Source Calculator";
6
5
  version = "1";
7
6
  requiresAuth = false;
@@ -16,17 +15,4 @@ export class CortexToolProvider extends LazyCalculatorToolProvider {
16
15
  initializationErrorMessage: "Failed to initialize the PIE open-source calculator provider. Confirm that this browser supports module workers and that the bundled worker assets are available.",
17
16
  };
18
17
  }
19
- getCapabilities() {
20
- return {
21
- supportsOffline: true,
22
- requiresAuth: false,
23
- maxInstances: null,
24
- features: {
25
- basic: true,
26
- scientific: true,
27
- graphing: true,
28
- fourFunction: true,
29
- },
30
- };
31
- }
32
18
  }
@@ -1,14 +1,11 @@
1
1
  /** Desmos calculator adapter for the generic tool-provider registry. */
2
2
  import type { CalculatorProviderInit } from "@pie-players/pie-calculator";
3
3
  import { LazyCalculatorToolProvider, type LazyCalculatorProviderDefinition } from "./LazyCalculatorToolProvider.js";
4
- import type { ToolProviderCapabilities } from "@pie-players/pie-assessment-toolkit/tools/internal";
5
4
  /** Provider initialization is the provider-neutral calculator contract. */
6
5
  export type DesmosToolProviderConfig = CalculatorProviderInit;
7
6
  export declare class DesmosToolProvider extends LazyCalculatorToolProvider<DesmosToolProviderConfig> {
8
- readonly providerId = "desmos-calculator";
9
7
  readonly providerName = "Desmos Calculator";
10
8
  readonly version = "1.12";
11
9
  readonly requiresAuth = true;
12
10
  protected getDefinition(): LazyCalculatorProviderDefinition<DesmosToolProviderConfig>;
13
- getCapabilities(): ToolProviderCapabilities;
14
11
  }
@@ -1,7 +1,6 @@
1
1
  /** Desmos calculator adapter for the generic tool-provider registry. */
2
2
  import { LazyCalculatorToolProvider, } from "./LazyCalculatorToolProvider.js";
3
3
  export class DesmosToolProvider extends LazyCalculatorToolProvider {
4
- providerId = "desmos-calculator";
5
4
  providerName = "Desmos Calculator";
6
5
  version = "1.12";
7
6
  requiresAuth = true;
@@ -16,17 +15,4 @@ export class DesmosToolProvider extends LazyCalculatorToolProvider {
16
15
  initializationErrorMessage: "Failed to initialize Desmos calculator provider. Check the application key, preloaded API, runtime endpoint, or network access.",
17
16
  };
18
17
  }
19
- getCapabilities() {
20
- return {
21
- supportsOffline: false,
22
- requiresAuth: true,
23
- maxInstances: null,
24
- features: {
25
- basic: true,
26
- scientific: true,
27
- graphing: true,
28
- fourFunction: true,
29
- },
30
- };
31
- }
32
18
  }
@@ -1,16 +1,13 @@
1
1
  /** GeoGebra calculator adapter for the generic tool-provider registry. */
2
2
  import type { CalculatorToolProviderInitConfig, LazyCalculatorProviderDefinition } from "./LazyCalculatorToolProvider.js";
3
3
  import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
4
- import type { ToolProviderCapabilities } from "@pie-players/pie-assessment-toolkit/tools/internal";
5
4
  export interface GeoGebraToolProviderConfig extends CalculatorToolProviderInitConfig {
6
5
  scriptUrl?: string;
7
6
  appletTimeoutMs?: number;
8
7
  }
9
8
  export declare class GeoGebraToolProvider extends LazyCalculatorToolProvider<GeoGebraToolProviderConfig> {
10
- readonly providerId = "geogebra-calculator";
11
9
  readonly providerName = "GeoGebra Calculator";
12
10
  readonly version = "6";
13
11
  readonly requiresAuth = false;
14
12
  protected getDefinition(): LazyCalculatorProviderDefinition<GeoGebraToolProviderConfig>;
15
- getCapabilities(): ToolProviderCapabilities;
16
13
  }
@@ -1,7 +1,6 @@
1
1
  /** GeoGebra calculator adapter for the generic tool-provider registry. */
2
2
  import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
3
3
  export class GeoGebraToolProvider extends LazyCalculatorToolProvider {
4
- providerId = "geogebra-calculator";
5
4
  providerName = "GeoGebra Calculator";
6
5
  version = "6";
7
6
  requiresAuth = false;
@@ -16,17 +15,4 @@ export class GeoGebraToolProvider extends LazyCalculatorToolProvider {
16
15
  initializationErrorMessage: "Failed to initialize GeoGebra calculator provider. Confirm that the deployment may load GeoGebra and that its script URL is reachable.",
17
16
  };
18
17
  }
19
- getCapabilities() {
20
- return {
21
- supportsOffline: false,
22
- requiresAuth: false,
23
- maxInstances: null,
24
- features: {
25
- basic: true,
26
- scientific: true,
27
- graphing: true,
28
- fourFunction: false,
29
- },
30
- };
31
- }
32
18
  }
@@ -1,5 +1,5 @@
1
1
  import type { CalculatorProvider, CalculatorProviderInit } from "@pie-players/pie-calculator";
2
- import type { ToolProviderApi, ToolProviderCapabilities } from "@pie-players/pie-assessment-toolkit/tools/internal";
2
+ import type { ToolProviderApi } from "@pie-players/pie-assessment-toolkit/tools/registration";
3
3
  export type CalculatorToolProviderInitConfig = Pick<CalculatorProviderInit, "onTelemetry">;
4
4
  type InitializableCalculatorProvider<TConfig> = CalculatorProvider & {
5
5
  initialize(config: TConfig): Promise<void>;
@@ -12,16 +12,14 @@ export interface LazyCalculatorProviderDefinition<TConfig> {
12
12
  }
13
13
  /**
14
14
  * Shared lazy-module and lifecycle implementation for calculator tool adapters.
15
- * Concrete adapters own only their metadata, capabilities and provider import.
15
+ * Concrete adapters own only their metadata and provider import.
16
16
  */
17
- export declare abstract class LazyCalculatorToolProvider<TConfig extends CalculatorToolProviderInitConfig> implements ToolProviderApi<TConfig, CalculatorProvider> {
18
- abstract readonly providerId: string;
17
+ export declare abstract class LazyCalculatorToolProvider<TConfig extends CalculatorToolProviderInitConfig> implements ToolProviderApi<CalculatorProvider> {
19
18
  abstract readonly providerName: string;
20
19
  readonly category: "calculator";
21
20
  abstract readonly version: string;
22
21
  abstract readonly requiresAuth: boolean;
23
22
  protected abstract getDefinition(): LazyCalculatorProviderDefinition<TConfig>;
24
- abstract getCapabilities(): ToolProviderCapabilities;
25
23
  private calculatorProvider;
26
24
  private initializationPromise;
27
25
  private lifecycleGeneration;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Shared lazy-module and lifecycle implementation for calculator tool adapters.
3
- * Concrete adapters own only their metadata, capabilities and provider import.
3
+ * Concrete adapters own only their metadata and provider import.
4
4
  */
5
5
  export class LazyCalculatorToolProvider {
6
6
  category = "calculator";
@@ -16,5 +16,5 @@
16
16
  * `tests/content-alternates.test.ts` pins this against the composition set in both
17
17
  * directions, so a capability added there cannot quietly fail to reach print.
18
18
  */
19
- import type { ToolRegistration } from "@pie-players/pie-assessment-toolkit/tools/internal";
19
+ import type { ToolRegistration } from "@pie-players/pie-assessment-toolkit/tools/registration";
20
20
  export declare const CONTENT_ALTERNATE_REGISTRATIONS: readonly ToolRegistration[];
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export type { PackagedCalculatorCompositionOptions, PackagedToolRegistryOptions, RegisterDefaultToolModuleLoadersOptions, RegisterPackagedToolsOptions, ToolModuleLoader, ToolRegistryLike, } from "./packaged-capability-composition.js";
2
- export { createPackagedToolRegistry, createDefaultToolModuleLoaders, createSectionToolModuleLoaders, createUniversalPersonalNeedsProfile, DEFAULT_TOOL_MODULE_LOADERS, ITEM_TOOL_MODULE_LOADERS, PACKAGED_TOOL_ORDER, PACKAGED_TOOL_PLACEMENT, PACKAGED_TOOL_REGISTRATIONS, PACKAGED_TOOL_TAG_MAP, registerDefaultToolModuleLoaders, registerPackagedTools, registerSectionToolModuleLoaders, SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT, SECTION_TOOL_MODULE_LOADERS, UNIVERSAL_SUPPORTS_PRESET, } from "./packaged-capability-composition.js";
1
+ export type { PackagedToolRegistryOptions } from "./packaged-capability-composition.js";
2
+ export { createEmptyPersonalNeedsProfile, createPackagedToolRegistry, createUniversalPersonalNeedsProfile, DEFAULT_TOOL_MODULE_LOADERS, PACKAGED_TOOL_REGISTRATIONS, PACKAGED_TOOL_TAG_MAP, SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT, } from "./packaged-capability-composition.js";
3
3
  export { CONTENT_ALTERNATE_REGISTRATIONS } from "./content-alternates.js";
4
4
  export { annotationToolbarRegistration, lineReaderToolRegistration, themeToolRegistration, } from "./registrations/accessibility-tools.js";
5
- export { AUDIO_TRANSCRIPT_FEATURE_ID, AUDIO_TRANSCRIPT_REGION_CLASS, AUDIO_TRANSCRIPT_REGION_LABEL, audioTranscriptRegistration, resolveAudioTranscript, type ResolvedAudioTranscript, } from "./registrations/audio-transcript.js";
5
+ export { AUDIO_TRANSCRIPT_FEATURE_ID, AUDIO_TRANSCRIPT_REGION_CLASS, AUDIO_TRANSCRIPT_REGION_LABEL, audioTranscriptRegistration, CONTENT_LEAD_SURFACE, resolveAudioTranscript, type ResolvedAudioTranscript, } from "./registrations/audio-transcript.js";
6
6
  export { calculatorToolRegistration } from "./registrations/calculator.js";
7
7
  export { createDictionaryToolRegistration, createPictureDictionaryToolRegistration, dictionaryToolRegistration, type DictionaryVariantOptions, pictureDictionaryToolRegistration, spanishDictionaryToolRegistration, spanishPictureDictionaryToolRegistration, } from "./registrations/dictionary-tools.js";
8
8
  export { answerEliminatorToolRegistration } from "./registrations/interaction-tools.js";
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- export { createPackagedToolRegistry, createDefaultToolModuleLoaders, createSectionToolModuleLoaders, createUniversalPersonalNeedsProfile, DEFAULT_TOOL_MODULE_LOADERS, ITEM_TOOL_MODULE_LOADERS, PACKAGED_TOOL_ORDER, PACKAGED_TOOL_PLACEMENT, PACKAGED_TOOL_REGISTRATIONS, PACKAGED_TOOL_TAG_MAP, registerDefaultToolModuleLoaders, registerPackagedTools, registerSectionToolModuleLoaders, SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT, SECTION_TOOL_MODULE_LOADERS, UNIVERSAL_SUPPORTS_PRESET, } from "./packaged-capability-composition.js";
1
+ export { createEmptyPersonalNeedsProfile, createPackagedToolRegistry, createUniversalPersonalNeedsProfile, DEFAULT_TOOL_MODULE_LOADERS, PACKAGED_TOOL_REGISTRATIONS, PACKAGED_TOOL_TAG_MAP, SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT, } from "./packaged-capability-composition.js";
2
2
  // The authored-alternate subset, for a renderer that shows alternates and no
3
3
  // toolbar — importable without the packaged composition's tool loaders.
4
4
  export { CONTENT_ALTERNATE_REGISTRATIONS } from "./content-alternates.js";
5
5
  // Individual registrations, for a host composing a subset rather than the whole
6
6
  // packaged set.
7
7
  export { annotationToolbarRegistration, lineReaderToolRegistration, themeToolRegistration, } from "./registrations/accessibility-tools.js";
8
- export { AUDIO_TRANSCRIPT_FEATURE_ID, AUDIO_TRANSCRIPT_REGION_CLASS, AUDIO_TRANSCRIPT_REGION_LABEL, audioTranscriptRegistration, resolveAudioTranscript, } from "./registrations/audio-transcript.js";
8
+ export { AUDIO_TRANSCRIPT_FEATURE_ID, AUDIO_TRANSCRIPT_REGION_CLASS, AUDIO_TRANSCRIPT_REGION_LABEL, audioTranscriptRegistration, CONTENT_LEAD_SURFACE, resolveAudioTranscript, } from "./registrations/audio-transcript.js";
9
9
  export { calculatorToolRegistration } from "./registrations/calculator.js";
10
10
  export { createDictionaryToolRegistration, createPictureDictionaryToolRegistration, dictionaryToolRegistration, pictureDictionaryToolRegistration, spanishDictionaryToolRegistration, spanishPictureDictionaryToolRegistration, } from "./registrations/dictionary-tools.js";
11
11
  export { answerEliminatorToolRegistration } from "./registrations/interaction-tools.js";
@@ -2,45 +2,29 @@
2
2
  * The one authored description of PIE's packaged capability composition.
3
3
  *
4
4
  * Registrations describe what a capability can do. This module owns the
5
- * deployment decisions around them: element tags, lazy module bootstrap sets,
6
- * placement presets, toolbar order and the explicit universal-support policy.
5
+ * deployment decisions around them: element tags, lazy module loaders, the
6
+ * section-player placement preset and the explicit universal-support policy.
7
7
  * Public constants are projections of this composition so adding a capability
8
8
  * cannot leave a second hand-maintained catalogue silently behind.
9
9
  */
10
- import { ToolRegistry, type CalculatorToolProviderConfig, type ToolComponentFactory, type ToolComponentFactoryMap, type ToolRegistration, type ToolTagMap } from "@pie-players/pie-assessment-toolkit/tools/internal";
10
+ import { ToolRegistry, type ToolComponentFactoryMap, type ToolModuleLoader, type ToolRegistration, type ToolTagMap } from "@pie-players/pie-assessment-toolkit/tools/registration";
11
11
  import type { PersonalNeedsProfile } from "@pie-players/pie-players-shared/types";
12
- export type ToolModuleLoader = () => Promise<unknown>;
13
- export interface ToolRegistryLike {
14
- setToolModuleLoaders(loaders: Partial<Record<string, ToolModuleLoader>>): void;
15
- }
16
- export interface PackagedCalculatorCompositionOptions {
17
- /**
18
- * The same calculator config supplied at `tools.providers.calculator`.
19
- * Selects the matching packaged element and default loader. Omit it to retain
20
- * the existing Desmos delivery.
21
- */
22
- calculatorProviderConfig?: CalculatorToolProviderConfig;
23
- }
24
- export interface PackagedToolRegistryOptions extends PackagedCalculatorCompositionOptions {
12
+ export interface PackagedToolRegistryOptions {
25
13
  /** Override packaged registrations by toolId. */
26
14
  overrides?: Partial<Record<string, ToolRegistration>>;
27
15
  /** Override or extend the packaged element tag mapping. */
28
16
  toolTagMap?: Partial<ToolTagMap>;
29
- /** Override the component factory globally or per tool. */
30
- toolComponentFactory?: ToolComponentFactory;
17
+ /** Override the component factory per tool. */
31
18
  toolComponentFactories?: Partial<ToolComponentFactoryMap>;
32
- /** Lazy module loaders keyed by toolId. */
19
+ /**
20
+ * Module loaders keyed by toolId, each loading its tool's element on first
21
+ * render. Defaults to `DEFAULT_TOOL_MODULE_LOADERS`; a map replaces it, so a
22
+ * host that defines its tool elements itself passes `{}`.
23
+ */
33
24
  toolModuleLoaders?: Partial<Record<string, ToolModuleLoader>>;
34
25
  /** Restrict registration to specific packaged tool ids. */
35
26
  toolIds?: string[];
36
27
  }
37
- export interface RegisterPackagedToolsOptions {
38
- toolIds?: string[];
39
- applyOverrides?: (registration: ToolRegistration) => ToolRegistration;
40
- }
41
- export interface RegisterDefaultToolModuleLoadersOptions extends PackagedCalculatorCompositionOptions {
42
- loaders?: Partial<Record<string, ToolModuleLoader>>;
43
- }
44
28
  /**
45
29
  * Release/build gate for PIE-authored composition data.
46
30
  *
@@ -49,37 +33,25 @@ export interface RegisterDefaultToolModuleLoadersOptions extends PackagedCalcula
49
33
  * that prevents an otherwise usable assessment from rendering.
50
34
  */
51
35
  export declare function assertPackagedCapabilityComposition(): void;
52
- export declare const PACKAGED_TOOL_REGISTRATIONS: readonly [ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration, ToolRegistration];
36
+ export declare const PACKAGED_TOOL_REGISTRATIONS: readonly ToolRegistration[];
53
37
  export declare const PACKAGED_TOOL_TAG_MAP: ToolTagMap;
54
- export declare const ITEM_TOOL_MODULE_LOADERS: Record<string, ToolModuleLoader>;
55
- export declare const SECTION_TOOL_MODULE_LOADERS: Record<string, ToolModuleLoader>;
56
38
  export declare const DEFAULT_TOOL_MODULE_LOADERS: Record<string, ToolModuleLoader>;
57
- /** Build the packaged loader map for a selected calculator provider. */
58
- export declare function createDefaultToolModuleLoaders(options?: PackagedCalculatorCompositionOptions): Record<string, ToolModuleLoader>;
59
- /** Build the section-bootstrap loader subset for a selected calculator provider. */
60
- export declare function createSectionToolModuleLoaders(options?: PackagedCalculatorCompositionOptions): Record<string, ToolModuleLoader>;
61
- export declare const PACKAGED_TOOL_PLACEMENT: {
62
- readonly assessment: readonly ["theme"];
63
- readonly section: readonly ["theme"];
64
- readonly item: readonly ["textToSpeech", "annotationToolbar", "graph", "periodicTable", "dictionary", "pictureDictionary", "dictionarySpanish", "pictureDictionarySpanish"];
65
- readonly passage: readonly ["textToSpeech", "annotationToolbar", "lineReader"];
66
- readonly rubric: readonly ["textToSpeech", "annotationToolbar", "lineReader"];
67
- readonly element: readonly ["calculator", "answerEliminator", "textToSpeech", "ruler", "protractor", "annotationToolbar", "graph", "periodicTable", "dictionary", "pictureDictionary", "dictionarySpanish", "pictureDictionarySpanish"];
68
- };
69
39
  export declare const SECTION_PLAYER_PREFERRED_TOOL_PLACEMENT: {
70
40
  section: string[];
71
41
  item: string[];
72
42
  passage: string[];
73
43
  };
74
- export declare const PACKAGED_TOOL_ORDER: readonly ["theme", "calculator", "textToSpeech", "lineReader", "annotationToolbar", "answerEliminator", "ruler", "protractor", "graph", "periodicTable", "dictionary", "pictureDictionary", "dictionarySpanish", "pictureDictionarySpanish"];
75
- export declare const UNIVERSAL_SUPPORTS_PRESET: readonly string[];
76
- /** Register packaged PIE capabilities onto an existing registry. */
77
- export declare function registerPackagedTools(registry: ToolRegistry, options?: RegisterPackagedToolsOptions): void;
78
44
  /** Create a registry holding the packaged PIE capabilities. */
79
45
  export declare function createPackagedToolRegistry(options?: PackagedToolRegistryOptions): ToolRegistry;
80
- /** Build a fresh profile granting the explicit universal-support preset. */
46
+ /**
47
+ * A fresh profile granting the packaged set's universal capabilities, sorted by
48
+ * tool id. Which capabilities are universal is program policy declared on each
49
+ * definition; registry membership never implies it.
50
+ */
81
51
  export declare function createUniversalPersonalNeedsProfile(): PersonalNeedsProfile;
82
- /** Register packaged lazy module loaders, followed by host overrides. */
83
- export declare function registerDefaultToolModuleLoaders(registry: ToolRegistryLike, options?: RegisterDefaultToolModuleLoadersOptions): void;
84
- /** Register only the section-bootstrap loader subset, then host overrides. */
85
- export declare function registerSectionToolModuleLoaders(registry: ToolRegistryLike, options?: RegisterDefaultToolModuleLoadersOptions): void;
52
+ /**
53
+ * A fresh profile granting and prohibiting nothing. The toolkit ships no
54
+ * populated default: a deployment's universal set is program policy, which
55
+ * `createUniversalPersonalNeedsProfile` carries as data for hosts that adopt it.
56
+ */
57
+ export declare function createEmptyPersonalNeedsProfile(): PersonalNeedsProfile;