@pie-players/pie-assessment-toolkit 0.3.65 → 0.3.67

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 (48) hide show
  1. package/README.md +36 -16
  2. package/dist/components/ItemToolBar.custom-element.js +1 -1
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +9 -8
  4. package/dist/components/SectionToolBar.custom-element.js +1 -1
  5. package/dist/components/chunks/{ItemToolBar-cckwpz6c.js → ItemToolBar-8jgdz50p.js} +9 -9
  6. package/dist/components/chunks/ItemToolBar-cvs646j3.js +36 -0
  7. package/dist/index.d.ts +4 -3
  8. package/dist/index.js +2 -1
  9. package/dist/policy/core/PolicySource.d.ts +2 -2
  10. package/dist/policy/core/PolicySource.js +2 -2
  11. package/dist/policy/core/ToolPolicyEngine.d.ts +19 -3
  12. package/dist/policy/core/ToolPolicyEngine.js +39 -5
  13. package/dist/policy/core/compose-decision.d.ts +3 -2
  14. package/dist/policy/core/compose-decision.js +3 -2
  15. package/dist/policy/core/decision-types.d.ts +2 -2
  16. package/dist/policy/core/decision-types.js +2 -2
  17. package/dist/policy/core/feature-decision.d.ts +56 -3
  18. package/dist/policy/core/feature-decision.js +60 -3
  19. package/dist/policy/core/pnp-policy-inputs.d.ts +2 -2
  20. package/dist/policy/core/pnp-policy-inputs.js +2 -2
  21. package/dist/policy/core/provenance.d.ts +4 -1
  22. package/dist/policy/core/provenance.js +4 -1
  23. package/dist/policy/engine.d.ts +1 -1
  24. package/dist/policy/engine.js +1 -0
  25. package/dist/policy/sources/PnpPolicySource.d.ts +2 -1
  26. package/dist/policy/sources/PnpPolicySource.js +2 -1
  27. package/dist/runtime/core/engine-transition.js +3 -1
  28. package/dist/services/AccessibilityCatalogResolver.d.ts +49 -10
  29. package/dist/services/AccessibilityCatalogResolver.js +180 -11
  30. package/dist/services/TTSService.d.ts +11 -0
  31. package/dist/services/TTSService.js +220 -32
  32. package/dist/services/ToolRegistry.d.ts +55 -14
  33. package/dist/services/ToolRegistry.js +57 -3
  34. package/dist/services/ToolkitCoordinator.d.ts +18 -1
  35. package/dist/services/ToolkitCoordinator.js +24 -2
  36. package/dist/services/catalog-owner.d.ts +71 -0
  37. package/dist/services/catalog-owner.js +64 -0
  38. package/dist/services/framework-error.d.ts +1 -1
  39. package/dist/services/interfaces.d.ts +15 -3
  40. package/dist/services/tts/browser-provider.js +189 -23
  41. package/dist/tools/content-capability-resolution.d.ts +106 -0
  42. package/dist/tools/content-capability-resolution.js +136 -0
  43. package/dist/tools/internal.d.ts +3 -0
  44. package/dist/tools/internal.js +1 -0
  45. package/package.json +13 -9
  46. package/dist/components/chunks/ItemToolBar-pryf0rtz.js +0 -22
  47. package/dist/runtime/catalog-registration.d.ts +0 -67
  48. package/dist/runtime/catalog-registration.js +0 -86
package/README.md CHANGED
@@ -235,7 +235,7 @@ const coordinator = new ToolkitCoordinator({
235
235
  assessmentId: 'demo-assessment',
236
236
  tools: {
237
237
  providers: {
238
- textToSpeech: { enabled: true, backend: 'browser', defaultVoice: 'en-US' },
238
+ textToSpeech: { enabled: true, backend: 'browser' },
239
239
  calculator: { enabled: true }
240
240
  },
241
241
  placement: {
@@ -418,7 +418,7 @@ tools: {
418
418
  },
419
419
  providers: {
420
420
  calculator: { authFetcher: async () => ({ apiKey: '...' }) },
421
- textToSpeech: { enabled: true, backend: 'browser', defaultVoice: 'en-US' }
421
+ textToSpeech: { enabled: true, backend: 'browser' }
422
422
  }
423
423
  }
424
424
  ```
@@ -1053,34 +1053,42 @@ Consumers select by type and then validate the form they expect; a card with no
1053
1053
  string form is not text content, and treating it as such would speak or render an
1054
1054
  empty string.
1055
1055
 
1056
- Catalogs registered for a rendered item or passage are filed under a
1057
- `CatalogOwnerContext`, which the resolver matches field by field. Build lookup
1058
- contexts with `catalogOwnerContextFor` rather than as a literal it is the same
1059
- function the runtime registers with, so the two cannot drift:
1056
+ Catalogs carried by a rendered item or passage are registered as one owner-level
1057
+ transaction. The resolver owns the walk over entity-root,
1058
+ `config.extractedCatalogs`, and model catalogs, along with their registration
1059
+ precedence and change notification:
1060
1060
 
1061
1061
  ```typescript
1062
1062
  import {
1063
1063
  catalogOwnerContextFor,
1064
- collectEntityCatalogRegistrations,
1065
1064
  } from '@pie-players/pie-assessment-toolkit';
1066
1065
 
1067
- const context = catalogOwnerContextFor({
1066
+ const owner = {
1068
1067
  kind: 'item',
1069
1068
  itemId: item.id,
1070
1069
  canonicalItemId,
1071
1070
  assessmentId,
1072
1071
  sectionId,
1073
- });
1072
+ } as const;
1074
1073
 
1075
- // Every catalog an entity carries, paired with the scope it belongs in:
1076
- // entity-level `accessibilityCatalogs`, `config.extractedCatalogs`, and each
1077
- // model's own catalogs (filed under that `modelId`).
1078
- const registrations = collectEntityCatalogRegistrations(item, {
1079
- kind: 'item',
1080
- itemId: item.id,
1074
+ const unregister = resolver.registerOwner({ owner, entity: item });
1075
+ const ownerView = resolver.forOwner(catalogOwnerContextFor(owner));
1076
+
1077
+ const stopObserving = ownerView.onChange(() => {
1078
+ const snapshot = ownerView.snapshot();
1079
+ // Interpret only the card types your capability owns.
1081
1080
  });
1081
+
1082
+ stopObserving();
1083
+ unregister();
1082
1084
  ```
1083
1085
 
1086
+ `CatalogOwnerSnapshot` is immutable and deterministic. A content capability
1087
+ receives it as `ToolContentDependencyContext.catalogs`; it does not receive the
1088
+ raw entity, resolver, or separately assembled lookup context. Direct consumers
1089
+ such as TTS may still call `getAlternative(...)` with a context built by
1090
+ `catalogOwnerContextFor`.
1091
+
1084
1092
  ### SSMLExtractor
1085
1093
 
1086
1094
  ```typescript
@@ -1134,6 +1142,16 @@ membership as eligibility tier — registration means "policy-addressable", not
1134
1142
  "universal, on by default" — and had to be corrected with a compile-time list of
1135
1143
  ids to exclude that a host could not extend for its own accommodation.
1136
1144
 
1145
+ ### Live registry changes
1146
+
1147
+ `ToolRegistry.onRegistryChange(listener)` observes successful `register`,
1148
+ `override`, `unregister`, `clear`, component-override, and module-loader
1149
+ changes synchronously. Invalid and no-op mutations do not emit, listener
1150
+ failures do not interrupt other listeners, and unsubscribe is idempotent.
1151
+ Section-player subscribes internally, so a capability registered after mount
1152
+ appears without a host-forced rerender; unregister and clear destroy their
1153
+ mounted surface elements immediately.
1154
+
1137
1155
  ## Integration with Section Player
1138
1156
 
1139
1157
  The section player provides automatic ToolkitCoordinator integration:
@@ -1275,7 +1293,9 @@ Notes:
1275
1293
  `ToolkitCoordinator.subscribeFrameworkErrors(listener)`. The callback
1276
1294
  prop fires exactly once per error, regardless of wrapper depth. Filter
1277
1295
  by `model.kind` (e.g. `"tts-init"`, `"provider-init"`,
1278
- `"provider-register"`) for tool- or provider-specific handling.
1296
+ `"provider-register"`, `"tool-surface"`) for tool- or provider-specific
1297
+ handling. Recoverable warnings remain observable but do not move section
1298
+ readiness to `error`.
1279
1299
  - See `docs/tools-and-accomodations/framework-owned-error-handling.md` for event payload and error-kind mapping details.
1280
1300
 
1281
1301
  ## Section Runtime Engine (advanced)
@@ -1 +1 @@
1
- import{a}from"./chunks/ItemToolBar-pryf0rtz.js";import"./chunks/ItemToolBar-cckwpz6c.js";export{a as default};
1
+ import{a}from"./chunks/ItemToolBar-cvs646j3.js";import"./chunks/ItemToolBar-8jgdz50p.js";export{a as default};