@cosmicdrift/kumiko-samples 0.413.1 → 0.415.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 (479) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +16 -1
  3. package/packages/bundled-features/src/admin-shell/changes.json +6 -0
  4. package/packages/bundled-features/src/admin-shell/feature.ts +8 -7
  5. package/packages/bundled-features/src/agent-tools/agent-doc-lint.ts +5 -1
  6. package/packages/bundled-features/src/agent-tools/agent-manifest.ts +36 -27
  7. package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +8 -1
  8. package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +3 -2
  9. package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +6 -0
  10. package/packages/bundled-features/src/agent-tools/api-docs/index.ts +1 -0
  11. package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +38 -1
  12. package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +1 -0
  13. package/packages/bundled-features/src/agent-tools/api-docs/resolve-config.ts +17 -0
  14. package/packages/bundled-features/src/agent-tools/api-docs/scope-slug-collisions.ts +17 -0
  15. package/packages/bundled-features/src/agent-tools/api-docs/translation-gaps.ts +42 -0
  16. package/packages/bundled-features/src/agent-tools/api-docs/webhook-example-problems.ts +30 -0
  17. package/packages/bundled-features/src/agent-tools/changes.json +12 -0
  18. package/packages/bundled-features/src/agent-tools/index.ts +1 -0
  19. package/packages/bundled-features/src/agent-tools/labels.ts +19 -6
  20. package/packages/bundled-features/src/agent-tools/tool-catalog.ts +18 -7
  21. package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +14 -1
  22. package/packages/bundled-features/src/agent-tools/types.ts +4 -0
  23. package/packages/bundled-features/src/audit/event-classification.ts +6 -0
  24. package/packages/bundled-features/src/audit/web/i18n.ts +1 -0
  25. package/packages/bundled-features/src/auth-email-password/changes.json +18 -0
  26. package/packages/bundled-features/src/auth-email-password/errors.ts +0 -13
  27. package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +147 -121
  28. package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -1
  29. package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
  30. package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +0 -1
  31. package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +0 -1
  32. package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
  33. package/packages/bundled-features/src/auth-email-password/reset-token.ts +0 -2
  34. package/packages/bundled-features/src/auth-email-password/seeding.ts +39 -7
  35. package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +2 -3
  36. package/packages/bundled-features/src/auth-email-password/unlock-token.ts +0 -2
  37. package/packages/bundled-features/src/auth-email-password/verification-token.ts +0 -2
  38. package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +2 -2
  39. package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +2 -2
  40. package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +5 -0
  41. package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +1 -6
  42. package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +1 -1
  43. package/packages/bundled-features/src/auth-email-password/web/return-path.ts +2 -1
  44. package/packages/bundled-features/src/auth-email-password/web/session.tsx +12 -13
  45. package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +1 -6
  46. package/packages/bundled-features/src/auth-email-password/web/static-account.ts +6 -1
  47. package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +1 -1
  48. package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +4 -5
  49. package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +1 -1
  50. package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
  51. package/packages/bundled-features/src/auth-mfa/web/mfa-code-or-recovery-field.tsx +17 -1
  52. package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -1
  53. package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -1
  54. package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +1 -1
  55. package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +16 -47
  56. package/packages/bundled-features/src/auth-mfa-user-data/index.ts +5 -6
  57. package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +0 -4
  58. package/packages/bundled-features/src/billing-foundation/changes.json +61 -0
  59. package/packages/bundled-features/src/billing-foundation/checkout-core.ts +19 -1
  60. package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +67 -0
  61. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +2 -1
  62. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +49 -2
  63. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +5 -0
  64. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-timeout.ts +23 -0
  65. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +12 -7
  66. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +1 -1
  67. package/packages/bundled-features/src/billing-foundation/events.ts +51 -10
  68. package/packages/bundled-features/src/billing-foundation/feature.ts +15 -1
  69. package/packages/bundled-features/src/billing-foundation/handlers/billing-plans.query.ts +47 -14
  70. package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +9 -1
  71. package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +183 -17
  72. package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +35 -10
  73. package/packages/bundled-features/src/billing-foundation/handlers/record-checkout-opened.write.ts +25 -0
  74. package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +9 -1
  75. package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +16 -4
  76. package/packages/bundled-features/src/billing-foundation/i18n.ts +3 -0
  77. package/packages/bundled-features/src/billing-foundation/pending-plan-switch.ts +80 -0
  78. package/packages/bundled-features/src/billing-foundation/scrub-raw-payload-headers.ts +50 -0
  79. package/packages/bundled-features/src/billing-foundation/types.ts +47 -30
  80. package/packages/bundled-features/src/billing-foundation/validate-options.ts +18 -0
  81. package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +10 -5
  82. package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -1
  83. package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -1
  84. package/packages/bundled-features/src/billing-foundation/web/constants.ts +5 -2
  85. package/packages/bundled-features/src/billing-foundation/web/plan-switch-confirm-dialog.tsx +1 -1
  86. package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +65 -17
  87. package/packages/bundled-features/src/cap-counter/aggregate-id.ts +0 -2
  88. package/packages/bundled-features/src/cap-counter/changes.json +6 -0
  89. package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +19 -4
  90. package/packages/bundled-features/src/cap-overview/changes.json +6 -0
  91. package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +22 -6
  92. package/packages/bundled-features/src/cap-overview/i18n.ts +1 -0
  93. package/packages/bundled-features/src/cap-overview/index.ts +1 -0
  94. package/packages/bundled-features/src/cap-overview/types.ts +11 -1
  95. package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +6 -2
  96. package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +10 -1
  97. package/packages/bundled-features/src/cap-overview/web/usage-math.ts +5 -0
  98. package/packages/bundled-features/src/channel-in-app/changes.json +6 -0
  99. package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +2 -2
  100. package/packages/bundled-features/src/channel-whatsapp/aggregate-id.ts +29 -0
  101. package/packages/bundled-features/src/channel-whatsapp/changes.json +32 -0
  102. package/packages/bundled-features/src/channel-whatsapp/constants.ts +46 -0
  103. package/packages/bundled-features/src/channel-whatsapp/events.ts +94 -0
  104. package/packages/bundled-features/src/channel-whatsapp/feature.ts +72 -0
  105. package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +398 -0
  106. package/packages/bundled-features/src/channel-whatsapp/in-memory-meta.ts +300 -0
  107. package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +210 -0
  108. package/packages/bundled-features/src/channel-whatsapp/index.ts +66 -0
  109. package/packages/bundled-features/src/channel-whatsapp/meta-signature.ts +26 -0
  110. package/packages/bundled-features/src/channel-whatsapp/options.ts +149 -0
  111. package/packages/bundled-features/src/channel-whatsapp/pii.ts +109 -0
  112. package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +247 -0
  113. package/packages/bundled-features/src/channel-whatsapp/webhook-routes.ts +185 -0
  114. package/packages/bundled-features/src/compliance-profiles/changes.json +5 -0
  115. package/packages/bundled-features/src/compliance-profiles/handlers/set-profile.write.ts +2 -0
  116. package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +1 -1
  117. package/packages/bundled-features/src/config/changes.json +12 -0
  118. package/packages/bundled-features/src/config/handlers/set.write.ts +7 -0
  119. package/packages/bundled-features/src/config/handlers/values.query.ts +8 -1
  120. package/packages/bundled-features/src/config/index.ts +1 -0
  121. package/packages/bundled-features/src/config/read-redaction.ts +6 -3
  122. package/packages/bundled-features/src/config/table.ts +1 -0
  123. package/packages/bundled-features/src/config/write-helpers.ts +3 -2
  124. package/packages/bundled-features/src/crypto-shredding/changes.json +18 -0
  125. package/packages/bundled-features/src/crypto-shredding/constants.ts +2 -0
  126. package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +38 -18
  127. package/packages/bundled-features/src/crypto-shredding/index.ts +4 -0
  128. package/packages/bundled-features/src/crypto-shredding/subject-forget-after-delete-hook.ts +49 -0
  129. package/packages/bundled-features/src/custom-fields/aggregate-id.ts +0 -1
  130. package/packages/bundled-features/src/custom-fields/entity.ts +1 -0
  131. package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +0 -1
  132. package/packages/bundled-features/src/data-retention/changes.json +12 -0
  133. package/packages/bundled-features/src/data-retention/erase-notes-of-deleted-row.ts +23 -0
  134. package/packages/bundled-features/src/data-retention/feature.ts +2 -5
  135. package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +38 -18
  136. package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +9 -0
  137. package/packages/bundled-features/src/delivery/attempt-log-factory.ts +11 -0
  138. package/packages/bundled-features/src/delivery/attempt-log.ts +3 -3
  139. package/packages/bundled-features/src/delivery/changes.json +12 -0
  140. package/packages/bundled-features/src/delivery/channel-context.ts +6 -3
  141. package/packages/bundled-features/src/delivery/db/queries/preferences.ts +0 -1
  142. package/packages/bundled-features/src/delivery/delivery-service.ts +3 -0
  143. package/packages/bundled-features/src/delivery/feature.ts +4 -13
  144. package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +54 -0
  145. package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +2 -20
  146. package/packages/bundled-features/src/delivery/handlers/resubscribe-user.write.ts +2 -25
  147. package/packages/bundled-features/src/delivery/handlers/unsubscribe-page-chrome.query.ts +2 -0
  148. package/packages/bundled-features/src/delivery/handlers/unsubscribe-user.write.ts +2 -27
  149. package/packages/bundled-features/src/delivery/index.ts +3 -1
  150. package/packages/bundled-features/src/delivery/options.ts +11 -0
  151. package/packages/bundled-features/src/delivery/preference-rows.ts +33 -0
  152. package/packages/bundled-features/src/delivery/set-preference-enabled.ts +40 -0
  153. package/packages/bundled-features/src/delivery/testing.ts +3 -1
  154. package/packages/bundled-features/src/delivery/types.ts +1 -0
  155. package/packages/bundled-features/src/delivery/unsubscribe-page.ts +7 -1
  156. package/packages/bundled-features/src/delivery/upsert-preference.ts +0 -1
  157. package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
  158. package/packages/bundled-features/src/derivatives-sharp/render.ts +9 -9
  159. package/packages/bundled-features/src/document-ingest-foundation/aggregate-id.ts +0 -1
  160. package/packages/bundled-features/src/document-ingest-foundation/append-missing-extract-event.ts +37 -25
  161. package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
  162. package/packages/bundled-features/src/document-ingest-foundation/feature.ts +1 -0
  163. package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +34 -14
  164. package/packages/bundled-features/src/documents/aggregate-id.ts +0 -2
  165. package/packages/bundled-features/src/documents/changes.json +24 -0
  166. package/packages/bundled-features/src/documents/constants.ts +10 -2
  167. package/packages/bundled-features/src/documents/ensure-link.ts +3 -4
  168. package/packages/bundled-features/src/documents/feature.ts +33 -6
  169. package/packages/bundled-features/src/documents/handlers/import.write.ts +2 -2
  170. package/packages/bundled-features/src/documents/queries/expiry-overview.query.ts +2 -1
  171. package/packages/bundled-features/src/documents/queries/for-record.query.ts +3 -4
  172. package/packages/bundled-features/src/documents/queries/list-page.ts +11 -3
  173. package/packages/bundled-features/src/documents/queries/overview.query.ts +2 -2
  174. package/packages/bundled-features/src/documents/screens.ts +8 -3
  175. package/packages/bundled-features/src/documents/tab.ts +1 -1
  176. package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +6 -3
  177. package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
  178. package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
  179. package/packages/bundled-features/src/file-foundation/probe.ts +9 -3
  180. package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +24 -11
  181. package/packages/bundled-features/src/file-provider-inmemory/feature.ts +1 -1
  182. package/packages/bundled-features/src/file-provider-s3/changes.json +14 -0
  183. package/packages/bundled-features/src/file-provider-s3/env-feature.ts +1 -1
  184. package/packages/bundled-features/src/file-provider-s3/env-named-feature.ts +1 -1
  185. package/packages/bundled-features/src/file-provider-s3/env-schema.ts +24 -7
  186. package/packages/bundled-features/src/file-provider-s3/feature.ts +1 -1
  187. package/packages/bundled-features/src/file-provider-s3/index.ts +7 -1
  188. package/packages/bundled-features/src/file-provider-s3/lib/env-helper.ts +21 -13
  189. package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +8 -1
  190. package/packages/bundled-features/src/files/changes.json +7 -0
  191. package/packages/bundled-features/src/folders/aggregate-id.ts +0 -1
  192. package/packages/bundled-features/src/folders/web/folder-manager.tsx +6 -6
  193. package/packages/bundled-features/src/folders-user-data/index.ts +12 -14
  194. package/packages/bundled-features/src/form-draft/feature.ts +1 -0
  195. package/packages/bundled-features/src/helpdesk/changes.json +56 -0
  196. package/packages/bundled-features/src/helpdesk/entity.ts +4 -1
  197. package/packages/bundled-features/src/helpdesk/feature.ts +42 -0
  198. package/packages/bundled-features/src/helpdesk/handlers/access.ts +0 -10
  199. package/packages/bundled-features/src/helpdesk/handlers/attempts.ts +7 -14
  200. package/packages/bundled-features/src/helpdesk/handlers/challenge.query.ts +1 -2
  201. package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +5 -12
  202. package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +4 -10
  203. package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +5 -12
  204. package/packages/bundled-features/src/helpdesk/index.ts +1 -0
  205. package/packages/bundled-features/src/helpdesk/legacy-contact-config.ts +61 -0
  206. package/packages/bundled-features/src/helpdesk/legacy-contact-erasure.ts +45 -0
  207. package/packages/bundled-features/src/helpdesk/legacy-contact-retention.ts +65 -0
  208. package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +187 -0
  209. package/packages/bundled-features/src/helpdesk/legacy-contact-user-data.ts +84 -0
  210. package/packages/bundled-features/src/helpdesk/lib.ts +55 -37
  211. package/packages/bundled-features/src/helpdesk/user-data-hooks.ts +89 -48
  212. package/packages/bundled-features/src/helpdesk/web/constants.ts +0 -1
  213. package/packages/bundled-features/src/inbound-mail-foundation/account-health.ts +1 -1
  214. package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +9 -2
  215. package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +0 -2
  216. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +54 -0
  217. package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +6 -0
  218. package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +23 -2
  219. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +73 -15
  220. package/packages/bundled-features/src/inbound-mail-foundation/events.ts +24 -16
  221. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +3 -1
  222. package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-address.ts +16 -2
  223. package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +10 -3
  224. package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +23 -9
  225. package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +79 -0
  226. package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message-schema.ts +18 -5
  227. package/packages/bundled-features/src/inbound-mail-foundation/i18n.ts +3 -0
  228. package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -0
  229. package/packages/bundled-features/src/inbound-mail-foundation/normalize-inbound-message.ts +22 -8
  230. package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +1 -1
  231. package/packages/bundled-features/src/inbound-mail-foundation/outbound-mail.ts +2 -0
  232. package/packages/bundled-features/src/inbound-mail-foundation/personal-address.ts +20 -0
  233. package/packages/bundled-features/src/inbound-mail-foundation/purge-messages.ts +54 -0
  234. package/packages/bundled-features/src/inbound-mail-foundation/quarantine.ts +15 -5
  235. package/packages/bundled-features/src/inbound-mail-foundation/retention-job.ts +1 -5
  236. package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +21 -34
  237. package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +2 -5
  238. package/packages/bundled-features/src/inbound-mail-foundation/send-from-account.ts +9 -1
  239. package/packages/bundled-features/src/inbound-mail-foundation/supervisor-ingest.ts +7 -1
  240. package/packages/bundled-features/src/inbound-mail-foundation/sync-account-now.ts +1 -1
  241. package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -17
  242. package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
  243. package/packages/bundled-features/src/inbound-provider-imap/byte-budget.ts +80 -0
  244. package/packages/bundled-features/src/inbound-provider-imap/changes.json +13 -0
  245. package/packages/bundled-features/src/inbound-provider-imap/connect-mailbox.ts +8 -4
  246. package/packages/bundled-features/src/inbound-provider-imap/connect-my-mailbox.ts +23 -6
  247. package/packages/bundled-features/src/inbound-provider-imap/connect-target-rate-limit.ts +46 -0
  248. package/packages/bundled-features/src/inbound-provider-imap/download-batch.ts +47 -10
  249. package/packages/bundled-features/src/inbound-provider-imap/feature.ts +7 -4
  250. package/packages/bundled-features/src/inbound-provider-imap/fetch-content.ts +43 -29
  251. package/packages/bundled-features/src/inbound-provider-imap/i18n.ts +2 -2
  252. package/packages/bundled-features/src/inbound-provider-imap/parse-message.ts +14 -0
  253. package/packages/bundled-features/src/inbound-provider-imap/reconnect-mailbox.ts +5 -4
  254. package/packages/bundled-features/src/inbound-provider-imap/send-mail.ts +39 -7
  255. package/packages/bundled-features/src/inbound-provider-imap/smtp-client.ts +19 -4
  256. package/packages/bundled-features/src/inbound-provider-imap/watch-mailbox.ts +8 -23
  257. package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +1 -1
  258. package/packages/bundled-features/src/jobs/events.ts +10 -0
  259. package/packages/bundled-features/src/jobs/feature.ts +2 -0
  260. package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +41 -16
  261. package/packages/bundled-features/src/jobs/web/constants.ts +4 -0
  262. package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
  263. package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +1 -1
  264. package/packages/bundled-features/src/mail-transport-smtp/feature.ts +3 -2
  265. package/packages/bundled-features/src/managed-pages/changes.json +12 -0
  266. package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
  267. package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
  268. package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
  269. package/packages/bundled-features/src/managed-pages/render-page-body.ts +18 -10
  270. package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +18 -38
  271. package/packages/bundled-features/src/managed-pages/table.ts +1 -0
  272. package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +8 -6
  273. package/packages/bundled-features/src/managed-pages/web/constants.ts +8 -1
  274. package/packages/bundled-features/src/managed-pages/web/i18n.ts +11 -3
  275. package/packages/bundled-features/src/managed-pages/web/markdown-to-document.ts +1 -1
  276. package/packages/bundled-features/src/managed-pages/web/page-edit-draft.ts +108 -0
  277. package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +204 -0
  278. package/packages/bundled-features/src/managed-pages/web/page-settings-rail.tsx +117 -0
  279. package/packages/bundled-features/src/notes-history-user-data/index.ts +8 -14
  280. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +5 -0
  281. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +0 -1
  282. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -5
  283. package/packages/bundled-features/src/presence/changes.json +6 -0
  284. package/packages/bundled-features/src/presence/handlers/list.query.ts +28 -11
  285. package/packages/bundled-features/src/presence/room.ts +21 -7
  286. package/packages/bundled-features/src/presence/store.ts +79 -21
  287. package/packages/bundled-features/src/readiness/changes.json +25 -0
  288. package/packages/bundled-features/src/readiness/handlers/latest-summary.query.ts +11 -6
  289. package/packages/bundled-features/src/readiness/handlers/run-probes.write.ts +35 -5
  290. package/packages/bundled-features/src/readiness/handlers/run-tone.ts +3 -2
  291. package/packages/bundled-features/src/readiness/handlers/status.query.ts +15 -1
  292. package/packages/bundled-features/src/readiness/probe-context.ts +11 -10
  293. package/packages/bundled-features/src/readiness/screens.ts +4 -4
  294. package/packages/bundled-features/src/readiness/visible-results.ts +5 -3
  295. package/packages/bundled-features/src/renderer-foundation/api.ts +6 -13
  296. package/packages/bundled-features/src/renderer-foundation/types.ts +2 -2
  297. package/packages/bundled-features/src/secrets/changes.json +7 -0
  298. package/packages/bundled-features/src/secrets/db/queries/read.ts +18 -4
  299. package/packages/bundled-features/src/secrets/handlers/list.query.ts +8 -2
  300. package/packages/bundled-features/src/secrets/secret-scope.ts +2 -3
  301. package/packages/bundled-features/src/secrets/secrets-context.ts +6 -4
  302. package/packages/bundled-features/src/secrets/write-gate.ts +4 -2
  303. package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
  304. package/packages/bundled-features/src/shared/acknowledged-system-db.ts +20 -0
  305. package/packages/bundled-features/src/shared/assert-billing-live.ts +9 -2
  306. package/packages/bundled-features/src/shared/changes.json +12 -0
  307. package/packages/bundled-features/src/shared/hmac-signature.ts +4 -2
  308. package/packages/bundled-features/src/shared/index.ts +7 -1
  309. package/packages/bundled-features/src/shared/normalize-email.ts +3 -0
  310. package/packages/bundled-features/src/shared/parent-visibility.ts +25 -1
  311. package/packages/bundled-features/src/shared/password-hashing.ts +0 -1
  312. package/packages/bundled-features/src/shared/price-env-shape.ts +1 -4
  313. package/packages/bundled-features/src/shared/register-user-data-hooks.ts +29 -0
  314. package/packages/bundled-features/src/shared/require-bootstrap-extension.ts +26 -0
  315. package/packages/bundled-features/src/shared/send-best-effort.ts +29 -0
  316. package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +22 -1
  317. package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +31 -1
  318. package/packages/bundled-features/src/step-dispatcher/changes.json +18 -0
  319. package/packages/bundled-features/src/step-dispatcher/constants.ts +13 -0
  320. package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +50 -2
  321. package/packages/bundled-features/src/step-dispatcher/feature.ts +42 -1
  322. package/packages/bundled-features/src/step-dispatcher/mail-runner.ts +0 -1
  323. package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +61 -0
  324. package/packages/bundled-features/src/subscription-mollie/changes.json +7 -0
  325. package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +5 -3
  326. package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +5 -5
  327. package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +161 -0
  328. package/packages/bundled-features/src/subscription-paddle/changes.json +19 -0
  329. package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
  330. package/packages/bundled-features/src/subscription-paddle/checkout-methods.ts +2 -8
  331. package/packages/bundled-features/src/subscription-paddle/constants.ts +1 -2
  332. package/packages/bundled-features/src/subscription-paddle/feature.ts +26 -24
  333. package/packages/bundled-features/src/subscription-paddle/ledger-backfill-marker.ts +70 -0
  334. package/packages/bundled-features/src/subscription-paddle/plan-switch-methods.ts +2 -8
  335. package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +57 -0
  336. package/packages/bundled-features/src/subscription-paddle/runtime.ts +13 -24
  337. package/packages/bundled-features/src/subscription-paddle/subscription-state.ts +1 -0
  338. package/packages/bundled-features/src/subscription-paddle/webhook-events.ts +68 -21
  339. package/packages/bundled-features/src/subscription-stripe/changes.json +13 -0
  340. package/packages/bundled-features/src/subscription-stripe/feature.ts +5 -0
  341. package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +6 -6
  342. package/packages/bundled-features/src/subscription-stripe/runtime.ts +8 -7
  343. package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +38 -6
  344. package/packages/bundled-features/src/tags/aggregate-id.ts +0 -1
  345. package/packages/bundled-features/src/tags/web/tag-chip.tsx +4 -5
  346. package/packages/bundled-features/src/tags/web/tag-manager.tsx +2 -1
  347. package/packages/bundled-features/src/template-resolver/api.ts +6 -13
  348. package/packages/bundled-features/src/template-resolver/changes.json +48 -0
  349. package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +25 -0
  350. package/packages/bundled-features/src/template-resolver/feature.ts +2 -0
  351. package/packages/bundled-features/src/template-resolver/handlers/body-preview.query.ts +41 -0
  352. package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
  353. package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -1
  354. package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +5 -11
  355. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +3 -2
  356. package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +37 -8
  357. package/packages/bundled-features/src/template-resolver/linked-resources.ts +2 -5
  358. package/packages/bundled-features/src/template-resolver/seeding.ts +107 -0
  359. package/packages/bundled-features/src/template-resolver/table.ts +1 -0
  360. package/packages/bundled-features/src/template-resolver/template-draft.ts +2 -1
  361. package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -3
  362. package/packages/bundled-features/src/template-resolver/testing.ts +0 -2
  363. package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +3 -0
  364. package/packages/bundled-features/src/template-resolver/web/collection-entry-create-form.tsx +33 -33
  365. package/packages/bundled-features/src/template-resolver/web/constants.ts +7 -0
  366. package/packages/bundled-features/src/template-resolver/web/content-tree-provider.ts +0 -1
  367. package/packages/bundled-features/src/template-resolver/web/content-workbench.tsx +142 -0
  368. package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +3 -8
  369. package/packages/bundled-features/src/template-resolver/web/document-link-policy.ts +58 -0
  370. package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -57
  371. package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +2 -4
  372. package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +4 -5
  373. package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +2 -2
  374. package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +6 -3
  375. package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +2 -3
  376. package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -0
  377. package/packages/bundled-features/src/template-resolver/web/fill-document-variables.ts +24 -0
  378. package/packages/bundled-features/src/template-resolver/web/i18n.ts +14 -0
  379. package/packages/bundled-features/src/template-resolver/web/index.ts +3 -0
  380. package/packages/bundled-features/src/template-resolver/web/preview-targets.ts +25 -0
  381. package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +1 -0
  382. package/packages/bundled-features/src/template-resolver/web/snippet-preview-renderer.tsx +24 -0
  383. package/packages/bundled-features/src/template-resolver/web/string-values.ts +7 -0
  384. package/packages/bundled-features/src/template-resolver/web/text-block-editor.tsx +38 -50
  385. package/packages/bundled-features/src/template-resolver/web/use-collection-entry-create.ts +7 -0
  386. package/packages/bundled-features/src/template-resolver/web/use-content-write.ts +1 -3
  387. package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +1 -2
  388. package/packages/bundled-features/src/template-resolver/web/use-text-block-editor.ts +28 -7
  389. package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +132 -0
  390. package/packages/bundled-features/src/template-resolver-user-data/index.ts +11 -10
  391. package/packages/bundled-features/src/tenant/changes.json +6 -0
  392. package/packages/bundled-features/src/tenant/handlers/create.write.ts +7 -8
  393. package/packages/bundled-features/src/tenant/handlers/list.query.ts +7 -9
  394. package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +10 -4
  395. package/packages/bundled-features/src/tenant/handlers/toggle-enabled.write.ts +1 -1
  396. package/packages/bundled-features/src/tenant/invited-membership.ts +10 -1
  397. package/packages/bundled-features/src/tenant/seeding.ts +4 -2
  398. package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +5 -1
  399. package/packages/bundled-features/src/tenant/testing.ts +1 -1
  400. package/packages/bundled-features/src/tenant-inactivity/changes.json +6 -0
  401. package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +36 -17
  402. package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -2
  403. package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +7 -2
  404. package/packages/bundled-features/src/tenant-inactivity/state-store.ts +22 -2
  405. package/packages/bundled-features/src/tenant-lifecycle/changes.json +24 -0
  406. package/packages/bundled-features/src/tenant-lifecycle/constants.ts +4 -0
  407. package/packages/bundled-features/src/tenant-lifecycle/feature.ts +1 -0
  408. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +43 -6
  409. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +15 -2
  410. package/packages/bundled-features/src/tier-engine/aggregate-id.ts +0 -1
  411. package/packages/bundled-features/src/tier-engine/changes.json +6 -0
  412. package/packages/bundled-features/src/tier-engine/feature.ts +8 -2
  413. package/packages/bundled-features/src/user/changes.json +6 -0
  414. package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +2 -1
  415. package/packages/bundled-features/src/user/handlers/me.query.ts +3 -1
  416. package/packages/bundled-features/src/user/index.ts +1 -0
  417. package/packages/bundled-features/src/user/resolve-verified-user-email.ts +17 -0
  418. package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +0 -1
  419. package/packages/bundled-features/src/user-data-rights/feature.ts +1 -0
  420. package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
  421. package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
  422. package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +1 -1
  423. package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +0 -2
  424. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +3 -3
  425. package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +3 -2
  426. package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +1 -1
  427. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
  428. package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +1 -1
  429. package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +5 -5
  430. package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts +17 -0
  431. package/packages/bundled-features/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +5 -5
  432. package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -1
  433. package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +5 -5
  434. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +0 -1
  435. package/packages/bundled-features/src/waitlist/changes.json +6 -0
  436. package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
  437. package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +5 -29
  438. package/packages/bundled-features/src/waitlist/import.ts +2 -1
  439. package/packages/bundled-features/src/waitlist/lib.ts +2 -11
  440. package/packages/bundled-features/src/waitlist/link-on-signup.ts +2 -2
  441. package/packages/bundled-features/src/waitlist/user-data-hooks.ts +6 -19
  442. package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +0 -1
  443. package/packages/bundled-features/src/workflow-runner/changes.json +6 -0
  444. package/packages/bundled-features/src/workflow-runner/event-trigger.ts +6 -2
  445. package/packages/bundled-features/src/workflow-runner/feature.ts +1 -5
  446. package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +7 -4
  447. package/packages/bundled-features/src/workflow-runner/runner.ts +2 -0
  448. package/samples/apps/admin-console/src/app/shell.tsx +1 -0
  449. package/samples/apps/showcase/src/features/demos/web/pages/dialog.tsx +0 -1
  450. package/samples/apps/showcase/src/features/demos/web/pages/layout.tsx +1 -1
  451. package/samples/apps/showcase/src/features/demos/web/pages/sidebar-panel.tsx +0 -1
  452. package/samples/apps/styleguide/src/features/gallery/web/Gallery.tsx +1 -4
  453. package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +6 -2
  454. package/samples/apps/use-all-bundled/e2e-billing-gallery/gallery-features.ts +12 -14
  455. package/samples/apps/use-all-bundled/feature-manifest.json +60 -29
  456. package/samples/apps/use-all-bundled/playwright.billing-docs.config.ts +1 -1
  457. package/samples/apps/use-all-bundled/playwright.config.ts +1 -0
  458. package/samples/apps/use-all-bundled/src/app/seed.ts +1 -1
  459. package/samples/apps/use-all-bundled/src/run-config.ts +2 -1
  460. package/samples/recipes/auth-mfa/src/web/confirmation-code-step.tsx +32 -10
  461. package/samples/recipes/chat-channels/README.md +2 -0
  462. package/samples/recipes/crypto-shredding-hr/README.md +11 -0
  463. package/samples/recipes/crypto-shredding-hr/src/feature.ts +27 -0
  464. package/samples/recipes/currencies-global/src/entities/currency.ts +1 -0
  465. package/samples/recipes/managed-pages/README.md +5 -1
  466. package/samples/recipes/managed-pages/package.json +3 -2
  467. package/samples/recipes/managed-pages/src/web/branded-preview.tsx +21 -0
  468. package/samples/recipes/managed-pages/tsconfig.json +8 -0
  469. package/samples/recipes/pwa-shell/README.md +52 -0
  470. package/samples/recipes/pwa-shell/bin/server.ts +12 -0
  471. package/samples/recipes/pwa-shell/package.json +13 -0
  472. package/samples/recipes/pwa-shell/src/app.ts +34 -0
  473. package/samples/recipes/rate-limiting/README.md +3 -3
  474. package/samples/recipes/record-detail-layout/README.md +33 -0
  475. package/samples/recipes/record-detail-layout/src/feature.ts +556 -44
  476. package/samples/recipes/record-detail-layout/src/order-board.ts +529 -0
  477. package/packages/bundled-features/src/managed-pages/web/page-body-section.tsx +0 -72
  478. package/packages/bundled-features/src/subscription-paddle/tenant-binding.ts +0 -34
  479. package/packages/bundled-features/src/template-resolver/web/content-field.tsx +0 -61
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-samples",
3
- "version": "0.413.1",
3
+ "version": "0.415.0",
4
4
  "description": "Source trees of the Kumiko sample recipes, sample apps and bundled features in repo layout, for tooling such as few-shot corpus builds.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.413.1",
3
+ "version": "0.415.0",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -121,6 +121,7 @@
121
121
  "./shared/stream-tenant-backfill": "./src/shared/stream-tenant-backfill.ts",
122
122
  "./shared/row-bound-grant": "./src/shared/row-bound-grant.ts",
123
123
  "./shared/mail-template-body": "./src/shared/mail-template-body.ts",
124
+ "./shared/acknowledged-system-db": "./src/shared/acknowledged-system-db.ts",
124
125
  "./delivery": "./src/delivery/index.ts",
125
126
  "./documents": "./src/documents/index.ts",
126
127
  "./delivery/web": "./src/delivery/web/index.ts",
@@ -130,6 +131,7 @@
130
131
  "./channel-slack": "./src/channel-slack/index.ts",
131
132
  "./channel-discord": "./src/channel-discord/index.ts",
132
133
  "./channel-teams": "./src/channel-teams/index.ts",
134
+ "./channel-whatsapp": "./src/channel-whatsapp/index.ts",
133
135
  "./channel-telegram": "./src/channel-telegram/index.ts",
134
136
  "./renderer-pdf": "./src/renderer-pdf/index.ts",
135
137
  "./rate-limiting": "./src/rate-limiting/index.ts",
@@ -146,6 +148,7 @@
146
148
  "./feature-toggles": "./src/feature-toggles/index.ts",
147
149
  "./feature-toggles/web": "./src/feature-toggles/web/index.ts",
148
150
  "./template-resolver": "./src/template-resolver/index.ts",
151
+ "./template-resolver/document-link-policy": "./src/template-resolver/web/document-link-policy.ts",
149
152
  "./template-resolver/document-schema": "./src/template-resolver/web/document-schema.ts",
150
153
  "./template-resolver/seeding": "./src/template-resolver/seeding.ts",
151
154
  "./template-resolver/testing": "./src/template-resolver/testing.ts",
@@ -603,6 +606,10 @@
603
606
  "types": "./dist/shared/mail-template-body.d.ts",
604
607
  "default": "./dist/shared/mail-template-body.js"
605
608
  },
609
+ "./shared/acknowledged-system-db": {
610
+ "types": "./dist/shared/acknowledged-system-db.d.ts",
611
+ "default": "./dist/shared/acknowledged-system-db.js"
612
+ },
606
613
  "./delivery": {
607
614
  "types": "./dist/delivery/index.d.ts",
608
615
  "default": "./dist/delivery/index.js"
@@ -643,6 +650,10 @@
643
650
  "types": "./dist/channel-telegram/index.d.ts",
644
651
  "default": "./dist/channel-telegram/index.js"
645
652
  },
653
+ "./channel-whatsapp": {
654
+ "types": "./dist/channel-whatsapp/index.d.ts",
655
+ "default": "./dist/channel-whatsapp/index.js"
656
+ },
646
657
  "./renderer-pdf": {
647
658
  "types": "./dist/renderer-pdf/index.d.ts",
648
659
  "default": "./dist/renderer-pdf/index.js"
@@ -703,6 +714,10 @@
703
714
  "types": "./dist/template-resolver/index.d.ts",
704
715
  "default": "./dist/template-resolver/index.js"
705
716
  },
717
+ "./template-resolver/document-link-policy": {
718
+ "types": "./dist/template-resolver/web/document-link-policy.d.ts",
719
+ "default": "./dist/template-resolver/web/document-link-policy.js"
720
+ },
706
721
  "./template-resolver/document-schema": {
707
722
  "types": "./dist/template-resolver/web/document-schema.d.ts",
708
723
  "default": "./dist/template-resolver/web/document-schema.js"
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.414.0",
4
+ "type": "fix",
5
+ "title": "Nav option types split per workspace",
6
+ "detail": "Admin-shell nav option types are split per workspace with required booleans."
7
+ },
2
8
  {
3
9
  "version": "0.409.0",
4
10
  "type": "improvement",
@@ -53,16 +53,17 @@ export type CreateAdminShellOptions = {
53
53
  readonly extraPlatformPanels?: readonly DashboardPanelDefinition[];
54
54
  };
55
55
 
56
- type NavIdOptions = {
57
- readonly includeTenantOverview?: boolean;
58
- readonly includeTierAdmin?: boolean;
56
+ type SharedNavIdOptions = {
59
57
  readonly includeCapOverview: boolean;
60
58
  readonly includeDocumentDesigner: boolean;
61
59
  };
62
60
 
63
- function tenantWorkspaceNavIds(options: NavIdOptions): string[] {
61
+ type TenantNavIdOptions = SharedNavIdOptions & { readonly includeTenantOverview: boolean };
62
+ type PlatformNavIdOptions = SharedNavIdOptions & { readonly includeTierAdmin: boolean };
63
+
64
+ function tenantWorkspaceNavIds(options: TenantNavIdOptions): string[] {
64
65
  return [
65
- ...(options.includeTenantOverview === true ? ["admin-shell:nav:tenant-overview"] : []),
66
+ ...(options.includeTenantOverview ? ["admin-shell:nav:tenant-overview"] : []),
66
67
  "tenant:nav:members",
67
68
  "audit:nav:audit-log",
68
69
  ...(options.includeCapOverview ? ["admin-shell:nav:my-caps"] : []),
@@ -70,7 +71,7 @@ function tenantWorkspaceNavIds(options: NavIdOptions): string[] {
70
71
  ];
71
72
  }
72
73
 
73
- function platformWorkspaceNavIds(options: NavIdOptions): string[] {
74
+ function platformWorkspaceNavIds(options: PlatformNavIdOptions): string[] {
74
75
  return [
75
76
  "admin-shell:nav:platform-overview",
76
77
  "admin-shell:nav:tenants",
@@ -78,7 +79,7 @@ function platformWorkspaceNavIds(options: NavIdOptions): string[] {
78
79
  "audit:nav:audit-log-all-tenants",
79
80
  "jobs:nav:job-runs",
80
81
  ...(options.includeDocumentDesigner ? ["document-designer:nav:platform-templates"] : []),
81
- ...(options.includeTierAdmin === true ? ["admin-shell:nav:tier-admin"] : []),
82
+ ...(options.includeTierAdmin ? ["admin-shell:nav:tier-admin"] : []),
82
83
  ];
83
84
  }
84
85
 
@@ -273,7 +273,11 @@ export function findDescriptionTranslationGaps(
273
273
  for (const handlerQn of options.handlerQns) {
274
274
  const labels = localizedLabels(translations, handlerDescriptionKey(handlerQn));
275
275
  for (const locale of options.locales) {
276
- if (locale === DESCRIPTION_FALLBACK_LOCALE || labels[locale] !== undefined) continue;
276
+ if (
277
+ locale === DESCRIPTION_FALLBACK_LOCALE ||
278
+ (labels[locale] !== undefined && labels[locale] !== "")
279
+ )
280
+ continue;
277
281
  gaps.push({
278
282
  qn: handlerQn,
279
283
  feature: handlerQn.split(":")[0] ?? handlerQn,
@@ -24,7 +24,7 @@ import {
24
24
  screenTitleLabels,
25
25
  } from "./labels.ts";
26
26
  import { recordManifestDenyQns } from "./manifest-deny-qns.ts";
27
- import { isExplicitlyAgentHidden } from "./tool-catalog.ts";
27
+ import { reachableQueryEntity } from "./tool-catalog.ts";
28
28
  import type {
29
29
  AgentManifest,
30
30
  AgentManifestEntity,
@@ -137,16 +137,27 @@ function buildEntities(
137
137
 
138
138
  const FEATURE_DESCRIPTION_MAX_CHARS = 300;
139
139
 
140
- // Only ". " before a capital ends the sentence, so "e.g. the" and "Art. 15" stay whole.
141
- const SENTENCE_END = /\.\s+(?=\p{Lu})/u;
140
+ // A sentence ends at ./!/? plus a capital; a capital with its own period ("B." in "z. B.")
141
+ // continues the abbreviation, and a known abbreviation before the period is no end either.
142
+ const SENTENCE_END = /[.!?]\s+(?=\p{Lu})(?!\p{Lu}\.)/gu;
143
+ const ABBREVIATION_BEFORE_END = /(?:^|[^\p{L}])(?:e\.g|i\.e|z\. ?B|d\. ?h|u\. ?a|Dr|Art|Nr|vs)\.$/u;
144
+ const TRUNCATION_MARK = "…";
145
+
146
+ function firstSentence(text: string): string {
147
+ for (const end of text.matchAll(SENTENCE_END)) {
148
+ const candidate = text.slice(0, end.index + 1);
149
+ if (!ABBREVIATION_BEFORE_END.test(candidate)) return candidate;
150
+ }
151
+ return text;
152
+ }
142
153
 
143
154
  /** The manifest is prompt payload; the full text stays in `FeatureDefinition.description`
144
- * for the docs generators. */
155
+ * for the docs generators. Cut by code point so no surrogate pair is split. */
145
156
  function leadSentence(description: string): string {
146
- const text = description.replace(/\s+/g, " ").trim();
147
- const end = SENTENCE_END.exec(text);
148
- const sentence = end === null ? text : text.slice(0, end.index + 1);
149
- return sentence.slice(0, FEATURE_DESCRIPTION_MAX_CHARS);
157
+ const sentence = firstSentence(description.replace(/\s+/g, " ").trim());
158
+ const codePoints = Array.from(sentence);
159
+ if (codePoints.length <= FEATURE_DESCRIPTION_MAX_CHARS) return sentence;
160
+ return codePoints.slice(0, FEATURE_DESCRIPTION_MAX_CHARS - 1).join("") + TRUNCATION_MARK;
150
161
  }
151
162
 
152
163
  function buildFeatures(
@@ -277,22 +288,20 @@ function withoutOrphanedNavs(navs: readonly AgentManifestNav[]): readonly AgentM
277
288
  }
278
289
  }
279
290
 
280
- // Qualified handler, screen and nav ids all start with the owning feature name.
281
- function featureNameOf(qualifiedId: string): string {
282
- const idx = qualifiedId.indexOf(":");
283
- return idx === -1 ? qualifiedId : qualifiedId.slice(0, idx);
284
- }
285
-
286
291
  function visibleFeatureNamesOf(
292
+ registry: RegistryManifestView,
287
293
  handlers: readonly AgentManifestHandler[],
288
294
  screens: readonly AgentManifestScreen[],
289
295
  navs: readonly AgentManifestNav[],
296
+ workspaces: readonly AgentManifestWorkspace[],
290
297
  ): ReadonlySet<string> {
291
- return new Set(
292
- [...handlers.map((h) => h.qn), ...screens.map((s) => s.id), ...navs.map((n) => n.id)].map(
293
- featureNameOf,
294
- ),
295
- );
298
+ const owners = [
299
+ ...handlers.map((h) => registry.getHandlerFeature(h.qn)),
300
+ ...screens.map((s) => registry.getScreenFeature(s.id)),
301
+ ...navs.map((n) => registry.getNavFeature(n.id)),
302
+ ...workspaces.map((w) => registry.getWorkspaceFeature(w.id)),
303
+ ];
304
+ return new Set(owners.filter((owner): owner is string => owner !== undefined));
296
305
  }
297
306
 
298
307
  function entitiesOfQueryToolsFor(
@@ -300,13 +309,10 @@ function entitiesOfQueryToolsFor(
300
309
  roles: readonly string[],
301
310
  denyQns: ReadonlySet<string>,
302
311
  ): readonly string[] {
303
- const names: string[] = [];
304
- for (const [qn, def] of registry.getAllQueryHandlers()) {
305
- const entityName = registry.getHandlerEntity(qn);
306
- if (entityName === undefined || denyQns.has(qn) || isExplicitlyAgentHidden(def)) continue;
307
- if (hasAccess({ roles }, def.access)) names.push(entityName);
308
- }
309
- return names;
312
+ return [...registry.getAllQueryHandlers()].flatMap(([qn, def]) => {
313
+ const entityName = reachableQueryEntity(registry, qn, def, { roles }, denyQns);
314
+ return entityName === undefined ? [] : [entityName];
315
+ });
310
316
  }
311
317
 
312
318
  // A reference target is "entity" or "<feature>:entity"; registry entity keys are the bare name.
@@ -472,7 +478,10 @@ export function buildAgentManifest(
472
478
  options.locale,
473
479
  );
474
480
  const workspaces = buildWorkspaces(workspaceMap, translations, roles, options.locale);
475
- const features = buildFeatures(registry.features, visibleFeatureNamesOf(handlers, screens, navs));
481
+ const features = buildFeatures(
482
+ registry.features,
483
+ visibleFeatureNamesOf(registry, handlers, screens, navs, workspaces),
484
+ );
476
485
  const entities = buildEntities(
477
486
  registry.getAllEntities(),
478
487
  translations,
@@ -68,6 +68,13 @@ function fieldLabelsByRow(
68
68
  );
69
69
  }
70
70
 
71
+ function exampleForVersion(
72
+ example: WebhookExampleFile | undefined,
73
+ version: number,
74
+ ): WebhookExampleFile | undefined {
75
+ return example?.version === version ? example : undefined;
76
+ }
77
+
71
78
  function buildEvent(
72
79
  registry: RegistryManifestView,
73
80
  contract: WebhookEventContract,
@@ -111,7 +118,7 @@ function buildEvent(
111
118
  fieldLabels: fieldLabelsByRow(translations, contract, payloadSchema, locales),
112
119
  payloadSchema,
113
120
  domains,
114
- example: options.examples.get(contract.qn),
121
+ example: exampleForVersion(options.examples.get(contract.qn), contract.version),
115
122
  };
116
123
  }
117
124
 
@@ -11,6 +11,7 @@ import {
11
11
  } from "@cosmicdrift/kumiko-framework/engine";
12
12
  import {
13
13
  expandScopes,
14
+ PAT_FEATURE,
14
15
  type PatScopeConfig,
15
16
  patRateLimitFromFeature,
16
17
  patScopesFromFeature,
@@ -34,7 +35,7 @@ import { isSystemOnlyHandler } from "./system-only.ts";
34
35
 
35
36
  export function findPatFeature(registry: RegistryManifestView): FeatureDefinition | undefined {
36
37
  return [...registry.features.values()].find(
37
- (feature) => patScopesFromFeature(feature) !== undefined,
38
+ (feature) => feature.name === PAT_FEATURE && patScopesFromFeature(feature) !== undefined,
38
39
  );
39
40
  }
40
41
 
@@ -76,7 +77,7 @@ function buildHandler(
76
77
  const labels =
77
78
  Object.keys(own).length > 0 || entity === undefined
78
79
  ? own
79
- : entityFieldLabels(translations, entity, field);
80
+ : entityFieldLabels(translations, entity, field, qn.split(":")[0]);
80
81
  return [field, perLocale(locales, (locale) => pickLabel(labels, locale))];
81
82
  }),
82
83
  );
@@ -17,8 +17,11 @@ import { renderOpenApi } from "./render-openapi.ts";
17
17
  import { renderOverview } from "./render-overview.ts";
18
18
  import { renderReferencePage } from "./render-reference.ts";
19
19
  import { renderTokens } from "./render-tokens.ts";
20
+ import { scopeSlugCollisionProblems } from "./scope-slug-collisions.ts";
20
21
  import { isApiDocsLocale, resolveApiDocsTexts } from "./texts/index.ts";
22
+ import { findTitleAndFieldLabelProblems } from "./translation-gaps.ts";
21
23
  import { uiWriteProblems } from "./ui-writes.ts";
24
+ import { webhookExampleProblems } from "./webhook-example-problems.ts";
22
25
 
23
26
  export const OPENAPI_FILE = "openapi.json";
24
27
 
@@ -164,7 +167,10 @@ export function generateApiDocs(input: ApiDocsInput): ApiDocsResult {
164
167
  ? []
165
168
  : [{ kind: "descriptionTranslationMissing", qn: gap.qn, locale: gap.locale }],
166
169
  ),
170
+ ...findTitleAndFieldLabelProblems(registry, model, locales),
167
171
  ...uiWriteProblems(registry, model, config.uiOnlyWrites ?? []),
172
+ ...scopeSlugCollisionProblems(model.scopes),
173
+ ...webhookExampleProblems(input.webhookExamples ?? [], model.events),
168
174
  ...model.events.flatMap((event) =>
169
175
  event.untranslatedLocales.map(
170
176
  (locale): ApiDocsProblem => ({
@@ -17,5 +17,6 @@ export {
17
17
  export { INDEX_FILE } from "./index-json.ts";
18
18
  export type { ApiDocsSource, ResolvedApiDocsConfig } from "./model.ts";
19
19
  export { type ApiDocsProblem, formatApiDocsProblem } from "./problems.ts";
20
+ export { resolveApiDocsConfig } from "./resolve-config.ts";
20
21
  export type { ApiDocsLocale, ApiDocsTexts } from "./texts/index.ts";
21
22
  export { apiDocsLocales, formatApiDocsText, isApiDocsLocale } from "./texts/index.ts";
@@ -1,4 +1,8 @@
1
- import { webhookEventDescriptionKey } from "@cosmicdrift/kumiko-framework/engine";
1
+ import {
2
+ handlerFieldLabelKey,
3
+ handlerTitleKey,
4
+ webhookEventDescriptionKey,
5
+ } from "@cosmicdrift/kumiko-framework/engine";
2
6
  import type { AgentDocGap } from "../agent-doc-lint.ts";
3
7
  import { formatAgentDocGap } from "../agent-doc-lint.ts";
4
8
 
@@ -10,6 +14,17 @@ export type ApiDocsProblem =
10
14
  readonly qn: string;
11
15
  readonly locale: string;
12
16
  }
17
+ | {
18
+ readonly kind: "titleTranslationMissing";
19
+ readonly qn: string;
20
+ readonly locale: string;
21
+ }
22
+ | {
23
+ readonly kind: "fieldLabelMissing";
24
+ readonly qn: string;
25
+ readonly field: string;
26
+ readonly locale: string;
27
+ }
13
28
  | {
14
29
  readonly kind: "uiWriteOutsideScopes";
15
30
  readonly qn: string;
@@ -22,6 +37,18 @@ export type ApiDocsProblem =
22
37
  readonly qn: string;
23
38
  readonly locale: string;
24
39
  }
40
+ | {
41
+ readonly kind: "webhookExampleVersionMismatch";
42
+ readonly qn: string;
43
+ readonly fileVersion: number;
44
+ readonly contractVersion: number;
45
+ }
46
+ | { readonly kind: "unusedWebhookExample"; readonly fileName: string }
47
+ | {
48
+ readonly kind: "scopeSlugCollision";
49
+ readonly slug: string;
50
+ readonly domains: readonly string[];
51
+ }
25
52
  | {
26
53
  readonly kind: "invalidTextOverride";
27
54
  readonly locale: string;
@@ -37,6 +64,10 @@ export function formatApiDocsProblem(problem: ApiDocsProblem): string {
37
64
  return `[docGap] ${formatAgentDocGap(problem.gap)}`;
38
65
  case "descriptionTranslationMissing":
39
66
  return `[descriptionTranslationMissing] ${problem.qn} has no \`${problem.locale}\` description translation.`;
67
+ case "titleTranslationMissing":
68
+ return `[titleTranslationMissing] ${problem.qn} has no \`${problem.locale}\` title translation (key ${handlerTitleKey(problem.qn)}).`;
69
+ case "fieldLabelMissing":
70
+ return `[fieldLabelMissing] ${problem.qn} field "${problem.field}" has no \`${problem.locale}\` label (key ${handlerFieldLabelKey(problem.qn, problem.field)}).`;
40
71
  case "uiWriteOutsideScopes":
41
72
  return `[uiWriteOutsideScopes] ${problem.qn} is used by ${problem.screens.join(", ")} but no token scope grants it. Add it to a scope or list it under apiDocs.uiOnlyWrites.`;
42
73
  case "unusedUiOnlyWrite":
@@ -45,6 +76,12 @@ export function formatApiDocsProblem(problem: ApiDocsProblem): string {
45
76
  return `[webhookDeliveryTextMissing] Webhook events are public but apiDocs.webhookDelivery has no \`${problem.locale}\` text.`;
46
77
  case "webhookEventWithoutDescriptionTranslation":
47
78
  return `[webhookEventWithoutDescriptionTranslation] ${problem.qn} has no \`${problem.locale}\` description translation (key ${webhookEventDescriptionKey(problem.qn)}).`;
79
+ case "webhookExampleVersionMismatch":
80
+ return `[webhookExampleVersionMismatch] The recorded example for ${problem.qn} is version ${problem.fileVersion}, the contract is version ${problem.contractVersion}, so the example is not shown.`;
81
+ case "unusedWebhookExample":
82
+ return `[unusedWebhookExample] The webhook example ${problem.fileName} names no event that a token scope lists.`;
83
+ case "scopeSlugCollision":
84
+ return `[scopeSlugCollision] The scopes ${problem.domains.join(", ")} share the reference page slug "${problem.slug}". Rename one of them.`;
48
85
  case "invalidTextOverride":
49
86
  return `[invalidTextOverride] apiDocs.texts.${problem.locale}["${problem.key}"]: ${problem.cause}`;
50
87
  }
@@ -30,6 +30,7 @@ function embedSchema(schema: Json, name: string, hoisted: Record<string, unknown
30
30
  Object.entries(node)
31
31
  .filter(([key]) => key !== "$schema" && key !== "$defs")
32
32
  .map(([key, value]) => {
33
+ if (key === "$ref" && value === "#") return [key, `${SCHEMAS}/${name}`];
33
34
  if (key === "$ref" && typeof value === "string" && value.startsWith("#/$defs/")) {
34
35
  return [key, `${SCHEMAS}/${name}.${value.slice("#/$defs/".length)}`];
35
36
  }
@@ -0,0 +1,17 @@
1
+ import type { AppApiDocsConfig } from "@cosmicdrift/kumiko-framework/config";
2
+ import type { ResolvedApiDocsConfig } from "./model.ts";
3
+
4
+ /** The one place that fills the config defaults, so `kumiko api-docs` and the recipe golden
5
+ * test generate from the same settings. A missing `baseUrl` stays empty: the CLI refuses it
6
+ * before it gets here. */
7
+ export function resolveApiDocsConfig(
8
+ apiDocs: AppApiDocsConfig,
9
+ options: { readonly appName: string; readonly locales?: readonly string[] },
10
+ ): ResolvedApiDocsConfig {
11
+ return {
12
+ ...apiDocs,
13
+ locales: options.locales ?? apiDocs.locales ?? ["en"],
14
+ baseUrl: apiDocs.baseUrl ?? "",
15
+ appName: apiDocs.appName ?? options.appName,
16
+ };
17
+ }
@@ -0,0 +1,17 @@
1
+ import { slugify } from "./anchors.ts";
2
+ import type { ApiDocsScope } from "./model.ts";
3
+ import type { ApiDocsProblem } from "./problems.ts";
4
+
5
+ /** Scopes whose domains slugify alike would write the same reference page. */
6
+ export function scopeSlugCollisionProblems(
7
+ scopes: readonly Pick<ApiDocsScope, "domain">[],
8
+ ): readonly ApiDocsProblem[] {
9
+ const domainsBySlug = new Map<string, string[]>();
10
+ for (const { domain } of scopes) {
11
+ const slug = slugify(domain);
12
+ domainsBySlug.set(slug, [...(domainsBySlug.get(slug) ?? []), domain]);
13
+ }
14
+ return [...domainsBySlug].flatMap(([slug, domains]): ApiDocsProblem[] =>
15
+ domains.length > 1 ? [{ kind: "scopeSlugCollision", slug, domains }] : [],
16
+ );
17
+ }
@@ -0,0 +1,42 @@
1
+ import { handlerFieldLabelKey, handlerTitleKey } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { entityFieldLabels, localizedLabels } from "../labels.ts";
3
+ import type { RegistryManifestView } from "../types.ts";
4
+ import type { ApiDocsModel } from "./model.ts";
5
+ import type { ApiDocsProblem } from "./problems.ts";
6
+ import { fieldRows } from "./schema-fields.ts";
7
+
8
+ // "en" is skipped like for descriptions: the English page may fall back to the handler's own
9
+ // text, while a German page that shows English titles or empty field cells is a visible gap.
10
+ const FALLBACK_LOCALE = "en";
11
+
12
+ export function findTitleAndFieldLabelProblems(
13
+ registry: Pick<RegistryManifestView, "getAllTranslations" | "getHandlerEntity">,
14
+ model: Pick<ApiDocsModel, "handlers">,
15
+ locales: readonly string[],
16
+ ): readonly ApiDocsProblem[] {
17
+ const translations = registry.getAllTranslations();
18
+ const checkedLocales = locales.filter((locale) => locale !== FALLBACK_LOCALE);
19
+ return model.handlers.flatMap((handler) => {
20
+ const titleLabels = localizedLabels(translations, handlerTitleKey(handler.qn));
21
+ const entity = registry.getHandlerEntity(handler.qn);
22
+ const titleProblems = checkedLocales.flatMap((locale): ApiDocsProblem[] =>
23
+ titleLabels[locale] === undefined
24
+ ? [{ kind: "titleTranslationMissing", qn: handler.qn, locale }]
25
+ : [],
26
+ );
27
+ const fieldProblems = fieldRows(handler.inputSchema).flatMap(({ name: field }) => {
28
+ const own = localizedLabels(translations, handlerFieldLabelKey(handler.qn, field));
29
+ const labels =
30
+ Object.keys(own).length > 0 || entity === undefined
31
+ ? own
32
+ : entityFieldLabels(translations, entity, field, handler.qn.split(":")[0]);
33
+ if (Object.keys(labels).length === 0) return [];
34
+ return checkedLocales.flatMap((locale): ApiDocsProblem[] =>
35
+ labels[locale] === undefined
36
+ ? [{ kind: "fieldLabelMissing", qn: handler.qn, field, locale }]
37
+ : [],
38
+ );
39
+ });
40
+ return [...titleProblems, ...fieldProblems];
41
+ });
42
+ }
@@ -0,0 +1,30 @@
1
+ import { compareIds } from "../labels.ts";
2
+ import type { NamedWebhookExample } from "./examples.ts";
3
+ import type { ApiDocsEvent } from "./model.ts";
4
+ import type { ApiDocsProblem } from "./problems.ts";
5
+
6
+ /** Recordings that never reach the events page: for an event no scope lists, or recorded
7
+ * against another contract version than the current one. */
8
+ export function webhookExampleProblems(
9
+ examples: readonly NamedWebhookExample[],
10
+ events: readonly ApiDocsEvent[],
11
+ ): readonly ApiDocsProblem[] {
12
+ const eventByQn = new Map(events.map((event) => [event.qn, event]));
13
+ const reported = new Set<string>();
14
+ return [...examples]
15
+ .sort((a, b) => compareIds(a.fileName, b.fileName))
16
+ .flatMap(({ fileName, file }): ApiDocsProblem[] => {
17
+ const event = eventByQn.get(file.event);
18
+ if (event === undefined) return [{ kind: "unusedWebhookExample", fileName }];
19
+ if (event.example !== undefined || reported.has(event.qn)) return [];
20
+ reported.add(event.qn);
21
+ return [
22
+ {
23
+ kind: "webhookExampleVersionMismatch",
24
+ qn: event.qn,
25
+ fileVersion: file.version,
26
+ contractVersion: event.version,
27
+ },
28
+ ];
29
+ });
30
+ }
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "version": "0.414.0",
4
+ "type": "fix",
5
+ "title": "agent manifest, tool dispatch and api-docs review fixes",
6
+ "detail": "The manifest takes feature ownership from the registry instead of qualified-id prefixes, keeps features that only contribute a visible workspace, shares the entity reachability rule with the tool catalog (`isExplicitlyAgentHidden` is no longer exported), splits feature descriptions at ./!/? while keeping abbreviations whole, and cuts long ones by code point with a trailing ellipsis. A write tool without a detail handler to read its version from is now a logged internal error instead of `invalid_tool_call`. API docs: root `$ref: \"#\"` in input schemas points at the payload schema, only the real token feature is documented, empty translations count as gaps, entity labels stay boundary- and feature-aware, webhook examples must match the contract version (new problems `webhookExampleVersionMismatch`, `unusedWebhookExample`, `scopeSlugCollision`), and `resolveApiDocsConfig` gives the CLI and the recipe golden test one config resolution."
7
+ },
8
+ {
9
+ "version": "0.414.0",
10
+ "type": "fix",
11
+ "title": "agent manifest labels resolve regional locales",
12
+ "detail": "`pickLabel` only matched the exact locale key, so a caller passing `de-DE` got English labels for every entity, field, nav and screen. It now tries the base language (`de`) before the English fallback."
13
+ },
2
14
  {
3
15
  "version": "0.412.0",
4
16
  "type": "improvement",
@@ -28,6 +28,7 @@ export {
28
28
  type NamedWebhookExample,
29
29
  OPENAPI_FILE,
30
30
  type ResolvedApiDocsConfig,
31
+ resolveApiDocsConfig,
31
32
  WebhookExampleFileSchema,
32
33
  } from "./api-docs/index.ts";
33
34
  export { AGENT_TOOLS_FEATURE_NAME, createAgentToolsFeature } from "./feature.ts";
@@ -20,8 +20,10 @@ export function pickLabel(
20
20
  const firstLocale = Object.keys(labels)
21
21
  .sort(compareIds)
22
22
  .find((key) => nonEmpty(labels[key]));
23
+ const baseLanguage = locale.split("-")[0]?.toLowerCase();
23
24
  return (
24
25
  nonEmpty(labels[locale]) ??
26
+ (baseLanguage !== undefined ? nonEmpty(labels[baseLanguage]) : undefined) ??
25
27
  nonEmpty(labels[FALLBACK_LOCALE]) ??
26
28
  (firstLocale !== undefined ? labels[firstLocale] : undefined)
27
29
  );
@@ -126,6 +128,13 @@ export function localizedLabels(
126
128
  return merged;
127
129
  }
128
130
 
131
+ function endsAtKeyBoundary(key: string, suffix: string): boolean {
132
+ if (!key.endsWith(suffix)) return false;
133
+ if (key.length === suffix.length || suffix.startsWith(":") || suffix.startsWith(".")) return true;
134
+ const before = key[key.length - suffix.length - 1];
135
+ return before === ":" || before === ".";
136
+ }
137
+
129
138
  /** `labelsForSuffix` with the locale-package completion of `localizedLabels`: the owner
130
139
  * key behind the suffix is preferred over a locale package key that ends the same way. */
131
140
  export function localizedLabelsForSuffix(
@@ -135,21 +144,25 @@ export function localizedLabelsForSuffix(
135
144
  const match = suffixMatch(translations, suffix);
136
145
  if (match === undefined) return {};
137
146
  const owner = Object.keys(translations).find(
138
- (key) => !key.startsWith(LOCALE_PACKAGE_PREFIX) && key.endsWith(suffix),
147
+ (key) => !key.startsWith(LOCALE_PACKAGE_PREFIX) && endsAtKeyBoundary(key, suffix),
139
148
  );
140
149
  return localizedLabels(translations, owner ?? match.key);
141
150
  }
142
151
 
143
- /** Entity field label per locale; `field` may be a dotted path, only its last segment names the field. */
152
+ /** Entity field label per locale; `field` may be a dotted path, only its last segment names the field.
153
+ * With `ownerFeature` that feature's own key wins over a same-named entity of another feature. */
144
154
  export function entityFieldLabels(
145
155
  translations: TranslationKeys,
146
156
  entity: string,
147
157
  field: string,
158
+ ownerFeature?: string,
148
159
  ): Readonly<Record<string, string>> {
149
- return localizedLabelsForSuffix(
150
- translations,
151
- `:entity:${entity}:field:${field.slice(field.lastIndexOf(".") + 1)}`,
152
- );
160
+ const tail = `entity:${entity}:field:${field.slice(field.lastIndexOf(".") + 1)}`;
161
+ if (ownerFeature !== undefined) {
162
+ const own = localizedLabels(translations, `${ownerFeature}:${tail}`);
163
+ if (Object.keys(own).length > 0) return own;
164
+ }
165
+ return localizedLabelsForSuffix(translations, `:${tail}`);
153
166
  }
154
167
 
155
168
  function lastSegmentOf(qualifiedId: string): string {