@tokenoftrust/storefront-runner 1.4.2-rc.0 → 2.0.1

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 (370) hide show
  1. package/apps/storefront/astro.config.mjs +3 -3
  2. package/apps/storefront/dev-plugins/tenant-hot-reload.mjs +8 -3
  3. package/apps/storefront/env.d.ts +54 -5
  4. package/apps/storefront/integrations/materialize-guard.mjs +12 -14
  5. package/apps/storefront/migrations-apps/0004_deep_morph.sql +36 -0
  6. package/apps/storefront/migrations-apps/0005_common_mystique.sql +23 -0
  7. package/apps/storefront/migrations-apps/0006_broad_microchip.sql +16 -0
  8. package/apps/storefront/migrations-apps/0007_brave_outlaw_kid.sql +15 -0
  9. package/apps/storefront/migrations-apps/0008_blue_dazzler.sql +11 -0
  10. package/apps/storefront/migrations-apps/0009_bored_shinobi_shaw.sql +15 -0
  11. package/apps/storefront/migrations-apps/0010_ws4_verified_provider_measurement.sql +35 -0
  12. package/apps/storefront/migrations-apps/meta/0004_snapshot.json +1474 -0
  13. package/apps/storefront/migrations-apps/meta/0005_snapshot.json +1617 -0
  14. package/apps/storefront/migrations-apps/meta/0006_snapshot.json +1716 -0
  15. package/apps/storefront/migrations-apps/meta/0007_snapshot.json +1812 -0
  16. package/apps/storefront/migrations-apps/meta/0008_snapshot.json +1881 -0
  17. package/apps/storefront/migrations-apps/meta/0009_snapshot.json +1979 -0
  18. package/apps/storefront/migrations-apps/meta/_journal.json +42 -0
  19. package/apps/storefront/public/apps/tot.demo.analytics/0.1.0/entry.js +42 -0
  20. package/apps/storefront/public/platform/amplitude-http/v1/entry.mjs +19 -0
  21. package/apps/storefront/public/platform/google-measurement/v1/entry.mjs +19 -0
  22. package/apps/storefront/public/shared/commerce-chrome.css +20 -2
  23. package/apps/storefront/scripts/build-v84-clean-clone-standalone.mjs +68 -0
  24. package/apps/storefront/scripts/deny-v84-clean-clone-standalone-capabilities.mjs +111 -0
  25. package/apps/storefront/scripts/deny-v84-dogfood-capabilities.mjs +2 -0
  26. package/apps/storefront/scripts/deny-v84-lifecycle-capabilities.mjs +247 -0
  27. package/apps/storefront/scripts/dogfood-v84-nonportable-routes.ts +73 -0
  28. package/apps/storefront/scripts/fixed-v84-native-install-producer.ts +79 -0
  29. package/apps/storefront/scripts/generated/v84-clean-clone-replay.bundle.mjs +10982 -0
  30. package/apps/storefront/scripts/import-v84-through-ws2.ts +38 -0
  31. package/apps/storefront/scripts/initialize-v84-lifecycle-tooling-dependency.ts +2 -0
  32. package/apps/storefront/scripts/initialize-v84-lifecycle-tooling.ts +4 -0
  33. package/apps/storefront/scripts/install-v84-native-through-ws1.ts +185 -0
  34. package/apps/storefront/scripts/prove-clone-isolation.ts +506 -0
  35. package/apps/storefront/scripts/replay-v84-clean-clone-pass.ts +148 -0
  36. package/apps/storefront/scripts/replay-v84-clean-clone-standalone.ts +35 -0
  37. package/apps/storefront/scripts/replay-v84-clean-clone.ts +214 -0
  38. package/apps/storefront/scripts/run-fixed-v84-native-install-producer.mjs +18 -0
  39. package/apps/storefront/scripts/run-v84-clone-isolation-proof.mjs +18 -0
  40. package/apps/storefront/scripts/run-v84-clone-lifecycle-proof.mjs +18 -0
  41. package/apps/storefront/scripts/run-v84-import-through-ws2-proof.mjs +17 -0
  42. package/apps/storefront/scripts/run-v84-nonportable-route-dogfood.mjs +15 -0
  43. package/apps/storefront/scripts/sanitize-v84-proof-environment.mjs +21 -0
  44. package/apps/storefront/scripts/v84CleanCloneGraphPin.ts +42 -0
  45. package/apps/storefront/scripts/v84CleanCloneSourceGraph.ts +145 -0
  46. package/apps/storefront/scripts/validate-v84-clone-lifecycle.ts +18 -0
  47. package/apps/storefront/src/components/Img.astro +1 -1
  48. package/apps/storefront/src/components/admin/AdminBlogTab.astro +19 -16
  49. package/apps/storefront/src/components/admin/AdminIntegrationsTab.astro +105 -0
  50. package/apps/storefront/src/components/admin/AdminPublishTab.astro +1057 -412
  51. package/apps/storefront/src/components/admin/AdminSettingsTab.astro +2 -2
  52. package/apps/storefront/src/components/admin/orders/OrdersWorkspace.astro +5 -5
  53. package/apps/storefront/src/components/chrome/NavDropdown.astro +12 -0
  54. package/apps/storefront/src/components/chrome/SiteFooter.astro +7 -2
  55. package/apps/storefront/src/components/chrome/SiteHeader.astro +46 -10
  56. package/apps/storefront/src/components/compliance/AdultSignatureNotice.astro +1 -1
  57. package/apps/storefront/src/components/compliance/ComplianceNotice.astro +1 -2
  58. package/apps/storefront/src/components/compliance/ExciseTaxNotice.astro +1 -2
  59. package/apps/storefront/src/components/compliance/PactActNotice.astro +1 -1
  60. package/apps/storefront/src/components/compliance/Prop65Warning.astro +1 -2
  61. package/apps/storefront/src/components/compliance/PurchaseLimitNotice.astro +2 -3
  62. package/apps/storefront/src/components/compliance/ShippingRestrictionNotice.astro +2 -2
  63. package/apps/storefront/src/components/compliance/StateEligibilityNotice.astro +2 -3
  64. package/apps/storefront/src/components/content/TrustStrip.astro +4 -4
  65. package/apps/storefront/src/components/islands/MobileNav.tsx +26 -1
  66. package/apps/storefront/src/components/islands/VariantSelector.tsx +27 -2
  67. package/apps/storefront/src/components/islands/useCheckoutHandoffCorrelation.ts +75 -0
  68. package/apps/storefront/src/components/membership/IllustrativeLabel.astro +1 -2
  69. package/apps/storefront/src/components/membership/TierCards.astro +2 -2
  70. package/apps/storefront/src/components/membership/TierComparisonTable.astro +2 -2
  71. package/apps/storefront/src/components/subscription/SavingsExplainer.astro +2 -2
  72. package/apps/storefront/src/config/adminTenantLookup.ts +35 -0
  73. package/apps/storefront/src/config/devTenantSeed.ts +9 -9
  74. package/apps/storefront/src/config/resolver.ts +18 -10
  75. package/apps/storefront/src/layouts/Layout.astro +100 -20
  76. package/apps/storefront/src/lib/activity/candidateSubmitLease.ts +87 -0
  77. package/apps/storefront/src/lib/activity/changeActorAttribution.ts +86 -6
  78. package/apps/storefront/src/lib/activity/deployVersion.ts +1 -1
  79. package/apps/storefront/src/lib/admin/adminShell.ts +2 -0
  80. package/apps/storefront/src/lib/admin/envelope.ts +1 -2
  81. package/apps/storefront/src/lib/apps/adminService.ts +10 -0
  82. package/apps/storefront/src/lib/apps/adminSession.ts +1 -1
  83. package/apps/storefront/src/lib/apps/appVersionStore.ts +281 -0
  84. package/apps/storefront/src/lib/apps/consentConfigStore.ts +228 -0
  85. package/apps/storefront/src/lib/apps/gtmMigrationInstall.ts +447 -0
  86. package/apps/storefront/src/lib/apps/gtmMigrationReport.ts +367 -0
  87. package/apps/storefront/src/lib/apps/gtmMigrationTab.ts +315 -0
  88. package/apps/storefront/src/lib/apps/integrationLifecycle.ts +614 -0
  89. package/apps/storefront/src/lib/apps/integrationLifecycleController.ts +125 -0
  90. package/apps/storefront/src/lib/apps/integrationReadModel.ts +563 -0
  91. package/apps/storefront/src/lib/apps/integrationsTab.ts +547 -0
  92. package/apps/storefront/src/lib/apps/integrationsView.ts +106 -0
  93. package/apps/storefront/src/lib/apps/managedAnalyticsService.ts +599 -0
  94. package/apps/storefront/src/lib/apps/orders/orderConversionD1.ts +150 -0
  95. package/apps/storefront/src/lib/apps/orders/orderForwardReceiver.ts +8 -0
  96. package/apps/storefront/src/lib/apps/orders/ordersStore.ts +1 -1
  97. package/apps/storefront/src/lib/apps/orders/verifiedProviderMeasurement.ts +117 -0
  98. package/apps/storefront/src/lib/apps/registryService.ts +264 -10
  99. package/apps/storefront/src/lib/apps/tenantIntegrationMaterialization.ts +170 -0
  100. package/apps/storefront/src/lib/apps/v84CleanCloneReplayContext.ts +16 -0
  101. package/apps/storefront/src/lib/apps/v84CloneLifecycleCacheEvidence.ts +105 -0
  102. package/apps/storefront/src/lib/apps/v84CloneLifecycleEvidence.ts +177 -0
  103. package/apps/storefront/src/lib/apps/v84CloneLifecycleMaterialization.ts +251 -0
  104. package/apps/storefront/src/lib/apps/v84CloneLifecycleSemantics.ts +241 -0
  105. package/apps/storefront/src/lib/apps/v84CloneMigrationEvidence.ts +211 -0
  106. package/apps/storefront/src/lib/apps/v84CloneNativeInstallEvidence.ts +409 -0
  107. package/apps/storefront/src/lib/apps/v84NonportableCodeCoaching.ts +368 -0
  108. package/apps/storefront/src/lib/apps/v84NonportableRouteContract.ts +188 -0
  109. package/apps/storefront/src/lib/apps/v84NonportableRouteDogfood.ts +291 -0
  110. package/apps/storefront/src/lib/apps/ws1ManagedAnalyticsClient.ts +95 -0
  111. package/apps/storefront/src/lib/auth/adminApiGuard.ts +66 -0
  112. package/apps/storefront/src/lib/auth/adminEntry.ts +2 -2
  113. package/apps/storefront/src/lib/auth/adminLanding.ts +88 -0
  114. package/apps/storefront/src/lib/blog/collection.ts +114 -17
  115. package/apps/storefront/src/lib/blog/markdown.ts +1 -1
  116. package/apps/storefront/src/lib/blog/provider.ts +76 -9
  117. package/apps/storefront/src/lib/blog/types.ts +9 -9
  118. package/apps/storefront/src/lib/chrome/examples/tokenoftrust.chrome-assignments.example.json +6 -0
  119. package/apps/storefront/src/lib/chrome/examples/tokenoftrust.chrome.example.json +79 -0
  120. package/apps/storefront/src/lib/chrome/model.ts +48 -253
  121. package/apps/storefront/src/lib/chrome/navCurrent.ts +29 -0
  122. package/apps/storefront/src/lib/chrome/parseConfig.ts +18 -32
  123. package/apps/storefront/src/lib/chrome/variant.ts +39 -0
  124. package/apps/storefront/src/lib/commerce/checkoutHandoffCorrelation.ts +105 -0
  125. package/apps/storefront/src/lib/compliance/tamper-sentinel-boot.ts +152 -0
  126. package/apps/storefront/src/lib/compliance/tamper-sentinel.ts +327 -0
  127. package/apps/storefront/src/lib/content/index.ts +5 -5
  128. package/apps/storefront/src/lib/content-edit/applyDiff.ts +1 -1
  129. package/apps/storefront/src/lib/content-edit/route.ts +1 -1
  130. package/apps/storefront/src/lib/d1/catalog.ts +12 -0
  131. package/apps/storefront/src/lib/d1/schema-apps.ts +276 -0
  132. package/apps/storefront/src/lib/dev/cockpit/ask.ts +49 -0
  133. package/apps/storefront/src/lib/dev/cockpit/clickToSource.ts +71 -0
  134. package/apps/storefront/src/lib/dev/cockpit/copyCommand.ts +227 -0
  135. package/apps/storefront/src/lib/dev/cockpit/files.ts +249 -0
  136. package/apps/storefront/src/lib/dev/cockpit/hostedActivity.ts +500 -0
  137. package/apps/storefront/src/lib/dev/cockpit/infoPopover.ts +12 -0
  138. package/apps/storefront/src/lib/dev/cockpit/mcpCopy.ts +34 -0
  139. package/apps/storefront/src/lib/dev/cockpit/monitor.ts +107 -0
  140. package/apps/storefront/src/lib/dev/cockpit/stepper.ts +116 -0
  141. package/apps/storefront/src/lib/dev/cockpit/themeToggle.ts +23 -0
  142. package/apps/storefront/src/lib/dev/runtimeStore.ts +1 -1
  143. package/apps/storefront/src/lib/edgeCache.ts +18 -6
  144. package/apps/storefront/src/lib/email/candidateConflictEmail.ts +80 -0
  145. package/apps/storefront/src/lib/integration/browserEnvironment.ts +137 -0
  146. package/apps/storefront/src/lib/integration/managedInstallDeclarations.ts +72 -0
  147. package/apps/storefront/src/lib/integration/nonceStamp.ts +49 -0
  148. package/apps/storefront/src/lib/integration/tenantDeclarations.ts +116 -0
  149. package/apps/storefront/src/lib/membership/eligibility.ts +1 -1
  150. package/apps/storefront/src/lib/membership/model.ts +1 -2
  151. package/apps/storefront/src/lib/newsletter/confirmationEmail.ts +2 -2
  152. package/apps/storefront/src/lib/newsletter/consent.ts +2 -2
  153. package/apps/storefront/src/lib/newsletter/send.ts +3 -3
  154. package/apps/storefront/src/lib/previewReload.ts +57 -1
  155. package/apps/storefront/src/lib/publish/adminPublishTab.ts +1775 -669
  156. package/apps/storefront/src/lib/publish/buildStream.ts +269 -0
  157. package/apps/storefront/src/lib/publish/collapsePersistence.ts +72 -0
  158. package/apps/storefront/src/lib/publish/lifecycleState.ts +369 -0
  159. package/apps/storefront/src/lib/publish/liveReleaseSummary.ts +29 -0
  160. package/apps/storefront/src/lib/publish/mergeDoctorOnFailure.ts +78 -0
  161. package/apps/storefront/src/lib/publish/mergeHealthBanner.ts +62 -0
  162. package/apps/storefront/src/lib/publish/mergeRowFindings.ts +124 -0
  163. package/apps/storefront/src/lib/publish/mergeSupportEscalation.ts +75 -0
  164. package/apps/storefront/src/lib/publish/publish-guard.ts +88 -0
  165. package/apps/storefront/src/lib/publish/publishFormat.ts +165 -0
  166. package/apps/storefront/src/lib/publish/publishHero.ts +177 -0
  167. package/apps/storefront/src/lib/publish/reviewRelease/changeState.ts +66 -0
  168. package/apps/storefront/src/lib/publish/reviewRelease/copy.ts +141 -0
  169. package/apps/storefront/src/lib/publish/reviewRelease/index.ts +41 -0
  170. package/apps/storefront/src/lib/publish/reviewRelease/permissions.ts +47 -0
  171. package/apps/storefront/src/lib/publish/reviewRelease/releaseState.ts +42 -0
  172. package/apps/storefront/src/lib/publish/reviewRelease/types.ts +59 -0
  173. package/apps/storefront/src/lib/publish/reviewRelease/viewModel.ts +440 -0
  174. package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/actions.ts +161 -0
  175. package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/controller.ts +325 -0
  176. package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/render.ts +241 -0
  177. package/apps/storefront/src/lib/publish/shipWorkspace.ts +22 -3
  178. package/apps/storefront/src/lib/publish/sseRoute.ts +119 -0
  179. package/apps/storefront/src/lib/publish/streamLogConsole.ts +142 -0
  180. package/apps/storefront/src/lib/publish/versionNumber.ts +52 -0
  181. package/apps/storefront/src/lib/rawChrome.ts +125 -47
  182. package/apps/storefront/src/lib/rawMarketingHtml.ts +74 -3
  183. package/apps/storefront/src/lib/seo/alternates.ts +1 -1
  184. package/apps/storefront/src/lib/social/notify.ts +4 -4
  185. package/apps/storefront/src/lib/storyblok/content-model.ts +7 -33
  186. package/apps/storefront/src/lib/storyblok/provider.ts +203 -69
  187. package/apps/storefront/src/lib/subscription/model.ts +4 -4
  188. package/apps/storefront/src/lib/the-build/provider.ts +9 -4
  189. package/apps/storefront/src/middleware/index.ts +273 -51
  190. package/apps/storefront/src/pages/[...slug].astro +9 -4
  191. package/apps/storefront/src/pages/admin/review-release.astro +265 -0
  192. package/apps/storefront/src/pages/admin/select.astro +96 -0
  193. package/apps/storefront/src/pages/admin.astro +16 -2
  194. package/apps/storefront/src/pages/api/activity.ts +8 -8
  195. package/apps/storefront/src/pages/api/admin/activity-alerts.ts +5 -20
  196. package/apps/storefront/src/pages/api/admin/orders/[id].ts +7 -2
  197. package/apps/storefront/src/pages/api/admin/orders.ts +8 -2
  198. package/apps/storefront/src/pages/api/apps/admin/gtm-migration-install.ts +174 -0
  199. package/apps/storefront/src/pages/api/apps/admin/gtm-migration.ts +96 -0
  200. package/apps/storefront/src/pages/api/apps/admin/integration-lifecycle.ts +118 -0
  201. package/apps/storefront/src/pages/api/apps/admin/integrations.ts +89 -0
  202. package/apps/storefront/src/pages/api/apps/admin/platform-adapters.ts +85 -0
  203. package/apps/storefront/src/pages/api/apps/internal/order-forward.ts +74 -2
  204. package/apps/storefront/src/pages/api/commerce/checkout-handoff.ts +77 -0
  205. package/apps/storefront/src/pages/api/compliance/tamper.ts +88 -0
  206. package/apps/storefront/src/pages/api/integrations/v1/[operation].ts +108 -0
  207. package/apps/storefront/src/pages/api/rum/vitals.ts +1 -2
  208. package/apps/storefront/src/pages/blog/[slug].astro +5 -5
  209. package/apps/storefront/src/pages/blog/author/[author].astro +3 -3
  210. package/apps/storefront/src/pages/blog/category/[category].astro +2 -2
  211. package/apps/storefront/src/pages/blog/index.astro +2 -2
  212. package/apps/storefront/src/pages/blog/tag/[tag].astro +2 -2
  213. package/apps/storefront/src/pages/cockpit.astro +61 -1362
  214. package/apps/storefront/src/pages/index.astro +10 -5
  215. package/apps/storefront/src/pages/llms.txt.ts +1 -1
  216. package/apps/storefront/src/pages/products/[handle].astro +7 -6
  217. package/apps/storefront/src/pages/sitemap.xml.ts +2 -2
  218. package/apps/storefront/src/pages/style-guide/[tenant]/[theme].astro +42 -31
  219. package/apps/storefront/src/pages/style-guide/[tenant]/chrome/[theme].astro +8 -3
  220. package/apps/storefront/src/pages/style-guide/[tenant]/guide/[theme].astro +6 -2
  221. package/apps/storefront/src/pages/style-guide/[tenant]/index.astro +6 -2
  222. package/apps/storefront/src/pages/style-guide/index.astro +19 -5
  223. package/apps/storefront/src/pages/tenants/[id]/[...path].ts +38 -2
  224. package/apps/storefront/src/pages/the-build/[slug].astro +4 -4
  225. package/apps/storefront/src/pages/the-build/index.astro +2 -2
  226. package/apps/storefront/src/pages/the-build/rss.xml.ts +2 -2
  227. package/apps/storefront/src/styles/admin.css +27 -1
  228. package/apps/storefront/src/themes/tenants/index.ts +19 -7
  229. package/apps/storefront/tsconfig.json +1 -1
  230. package/package.json +1 -1
  231. package/packages/public-runtime/package.json +2 -1
  232. package/packages/public-runtime/schemas/managed-analytics/v1/adapter-definition.schema.json +427 -0
  233. package/packages/public-runtime/schemas/managed-analytics/v1/create-integration-install-request.schema.json +161 -0
  234. package/packages/public-runtime/schemas/managed-analytics/v1/create-migration-draft-request.schema.json +157 -0
  235. package/packages/public-runtime/schemas/managed-analytics/v1/delete-integration-install-request.schema.json +84 -0
  236. package/packages/public-runtime/schemas/managed-analytics/v1/delete-migration-draft-request.schema.json +84 -0
  237. package/packages/public-runtime/schemas/managed-analytics/v1/error-envelope.schema.json +180 -0
  238. package/packages/public-runtime/schemas/managed-analytics/v1/get-adapter-definition-request.schema.json +52 -0
  239. package/packages/public-runtime/schemas/managed-analytics/v1/get-integration-install-request.schema.json +52 -0
  240. package/packages/public-runtime/schemas/managed-analytics/v1/get-integration-revision-request.schema.json +79 -0
  241. package/packages/public-runtime/schemas/managed-analytics/v1/get-migration-draft-request.schema.json +52 -0
  242. package/packages/public-runtime/schemas/managed-analytics/v1/integration-install.schema.json +167 -0
  243. package/packages/public-runtime/schemas/managed-analytics/v1/integration-revision.schema.json +208 -0
  244. package/packages/public-runtime/schemas/managed-analytics/v1/list-adapter-definitions-request.schema.json +53 -0
  245. package/packages/public-runtime/schemas/managed-analytics/v1/list-integration-installs-request.schema.json +53 -0
  246. package/packages/public-runtime/schemas/managed-analytics/v1/list-integration-revisions-request.schema.json +82 -0
  247. package/packages/public-runtime/schemas/managed-analytics/v1/migration-draft.schema.json +218 -0
  248. package/packages/public-runtime/schemas/managed-analytics/v1/mutation-request.schema.json +52 -0
  249. package/packages/public-runtime/schemas/managed-analytics/v1/mutation-success-envelope.schema.json +49 -0
  250. package/packages/public-runtime/schemas/managed-analytics/v1/read-request.schema.json +20 -0
  251. package/packages/public-runtime/schemas/managed-analytics/v1/read-success-envelope.schema.json +45 -0
  252. package/packages/public-runtime/schemas/managed-analytics/v1/revise-integration-install-request.schema.json +156 -0
  253. package/packages/public-runtime/schemas/managed-analytics/v1/set-integration-install-status-request.schema.json +92 -0
  254. package/packages/public-runtime/schemas/managed-analytics/v1/update-migration-draft-request.schema.json +184 -0
  255. package/packages/public-runtime/scripts/generate-managed-analytics-api-v1-schemas.mjs +13 -0
  256. package/packages/public-runtime/src/activity/catalog.ts +41 -37
  257. package/packages/public-runtime/src/activity/event.ts +6 -6
  258. package/packages/public-runtime/src/activity/index.ts +2 -2
  259. package/packages/public-runtime/src/activity/redaction.ts +4 -4
  260. package/packages/public-runtime/src/candidate-index.ts +42 -8
  261. package/packages/public-runtime/src/checkout-orders.ts +2 -2
  262. package/packages/public-runtime/src/checkout-style-publish.ts +2 -2
  263. package/packages/public-runtime/src/checkout-style.ts +7 -7
  264. package/packages/public-runtime/src/checkout.ts +3 -3
  265. package/packages/public-runtime/src/chrome.ts +777 -0
  266. package/packages/public-runtime/src/compliance-obligations.ts +310 -0
  267. package/packages/public-runtime/src/csp.ts +99 -0
  268. package/packages/public-runtime/src/customization-runtime.ts +32 -1
  269. package/packages/public-runtime/src/destination-webhook/contract.ts +353 -0
  270. package/packages/public-runtime/src/embed-catalog.d.mts +9 -0
  271. package/packages/public-runtime/src/embed-catalog.mjs +40 -0
  272. package/packages/public-runtime/src/evidence.ts +288 -0
  273. package/packages/public-runtime/src/gtm-migration/bounds.ts +138 -0
  274. package/packages/public-runtime/src/gtm-migration/disposition-rules.ts +361 -0
  275. package/packages/public-runtime/src/gtm-migration/dispositions.ts +181 -0
  276. package/packages/public-runtime/src/gtm-migration/draft-generator.ts +400 -0
  277. package/packages/public-runtime/src/gtm-migration/graph.ts +468 -0
  278. package/packages/public-runtime/src/gtm-migration/index.ts +95 -0
  279. package/packages/public-runtime/src/gtm-migration/parse.ts +410 -0
  280. package/packages/public-runtime/src/gtm-migration/references.ts +266 -0
  281. package/packages/public-runtime/src/gtm-migration/types.ts +86 -0
  282. package/packages/public-runtime/src/index.ts +16 -1
  283. package/packages/public-runtime/src/integration/assurance-decision.ts +259 -0
  284. package/packages/public-runtime/src/integration/assurance.ts +228 -0
  285. package/packages/public-runtime/src/integration/candidate-evidence.ts +377 -0
  286. package/packages/public-runtime/src/integration/commerce-broker.ts +497 -0
  287. package/packages/public-runtime/src/integration/consent-broker.ts +337 -0
  288. package/packages/public-runtime/src/integration/consent-cmp-demand.ts +115 -0
  289. package/packages/public-runtime/src/integration/consent-config.ts +260 -0
  290. package/packages/public-runtime/src/integration/consent-preview.ts +125 -0
  291. package/packages/public-runtime/src/integration/correlation-token.ts +444 -0
  292. package/packages/public-runtime/src/integration/csp-compiler.ts +267 -0
  293. package/packages/public-runtime/src/integration/csp.ts +105 -0
  294. package/packages/public-runtime/src/integration/digest.ts +43 -0
  295. package/packages/public-runtime/src/integration/environment.ts +228 -0
  296. package/packages/public-runtime/src/integration/events-catalog.ts +186 -0
  297. package/packages/public-runtime/src/integration/events.ts +701 -0
  298. package/packages/public-runtime/src/integration/g2-action-boundary.ts +106 -0
  299. package/packages/public-runtime/src/integration/index.ts +90 -0
  300. package/packages/public-runtime/src/integration/interim-bridge.ts +138 -0
  301. package/packages/public-runtime/src/integration/lifecycle-boot.ts +317 -0
  302. package/packages/public-runtime/src/integration/lifecycle-runtime.ts +393 -0
  303. package/packages/public-runtime/src/integration/lifecycle.ts +94 -0
  304. package/packages/public-runtime/src/integration/managed-analytics-api-v1-safety.d.mts +2 -0
  305. package/packages/public-runtime/src/integration/managed-analytics-api-v1-safety.mjs +10 -0
  306. package/packages/public-runtime/src/integration/managed-analytics-api-v1.schemas.ts +382 -0
  307. package/packages/public-runtime/src/integration/managed-analytics-api-v1.ts +684 -0
  308. package/packages/public-runtime/src/integration/managed-analytics-bridge.ts +383 -0
  309. package/packages/public-runtime/src/integration/managed-analytics-value-safety.ts +14 -0
  310. package/packages/public-runtime/src/integration/managed-analytics.ts +277 -0
  311. package/packages/public-runtime/src/integration/manifest.ts +470 -0
  312. package/packages/public-runtime/src/integration/native-amplitude.ts +362 -0
  313. package/packages/public-runtime/src/integration/native-ga4.ts +352 -0
  314. package/packages/public-runtime/src/integration/observability.ts +451 -0
  315. package/packages/public-runtime/src/integration/order-conversion.ts +0 -0
  316. package/packages/public-runtime/src/integration/phases.ts +182 -0
  317. package/packages/public-runtime/src/integration/plan.ts +112 -0
  318. package/packages/public-runtime/src/integration/platform-adapter-runtime.ts +146 -0
  319. package/packages/public-runtime/src/integration/platform-adapters.ts +671 -0
  320. package/packages/public-runtime/src/integration/promotion-gate.ts +451 -0
  321. package/packages/public-runtime/src/integration/provider-checkout-extension.ts +425 -0
  322. package/packages/public-runtime/src/integration/receipt-measurement.ts +370 -0
  323. package/packages/public-runtime/src/integration/regulated-parent-cert.ts +311 -0
  324. package/packages/public-runtime/src/integration/render-phases.ts +267 -0
  325. package/packages/public-runtime/src/integration/resolve.ts +465 -0
  326. package/packages/public-runtime/src/integration/result.ts +239 -0
  327. package/packages/public-runtime/src/integration/secrets.ts +92 -0
  328. package/packages/public-runtime/src/integration/tamper-evidence.ts +205 -0
  329. package/packages/public-runtime/src/integration/tamper-recovery.ts +127 -0
  330. package/packages/public-runtime/src/integration/version.ts +92 -0
  331. package/packages/public-runtime/src/integration-capabilities.ts +520 -0
  332. package/packages/public-runtime/src/membership.ts +2 -2
  333. package/packages/public-runtime/src/raw-html-policy.ts +2 -4
  334. package/packages/public-runtime/src/regulated-commerce/broker/consent-dedupe.ts +144 -0
  335. package/packages/public-runtime/src/regulated-commerce/correlation/contract.ts +177 -0
  336. package/packages/public-runtime/src/regulated-commerce/diagnostics/local-dispatch.ts +24 -0
  337. package/packages/public-runtime/src/regulated-commerce/diagnostics/read-model.ts +69 -0
  338. package/packages/public-runtime/src/regulated-commerce/dispatch/core.ts +134 -0
  339. package/packages/public-runtime/src/regulated-commerce/events/contract.ts +113 -0
  340. package/packages/public-runtime/src/regulated-commerce/ledger/core.ts +81 -0
  341. package/packages/public-runtime/src/regulated-commerce/mappings/ga4-ads.ts +87 -0
  342. package/packages/public-runtime/src/regulated-commerce/provider-order/bridge.ts +52 -0
  343. package/packages/public-runtime/src/regulated-commerce/purchase-truth/contract.ts +252 -0
  344. package/packages/public-runtime/src/regulated-commerce/sources/accepted-browser-operation.ts +67 -0
  345. package/packages/public-runtime/src/regulated-commerce/testing/fake-destination.ts +93 -0
  346. package/packages/public-runtime/src/static-bundle.ts +5 -5
  347. package/packages/public-runtime/src/tenant-assets.ts +143 -4
  348. package/packages/public-runtime/src/tenant.ts +136 -9
  349. package/packages/public-runtime/tests/fixtures/integration/browser-environment.example.json +8 -0
  350. package/packages/public-runtime/tests/fixtures/integration/commerce-event.example.json +44 -0
  351. package/packages/public-runtime/tests/fixtures/integration/commerce-order-event.example.json +44 -0
  352. package/packages/public-runtime/tests/fixtures/integration/compliance-assurance-record.example.json +50 -0
  353. package/packages/public-runtime/tests/fixtures/integration/integration-manifest-v2.example.json +120 -0
  354. package/packages/public-runtime/tests/fixtures/integration/managed-analytics-v1/fake-adapter-catalog.json +35 -0
  355. package/packages/public-runtime/tests/fixtures/integration/tenant-action-registry.example.json +11 -0
  356. package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/README.md +22 -0
  357. package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/entry.js +30 -0
  358. package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/manifest.json +75 -0
  359. package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/public-config.json +3 -0
  360. package/packages/public-runtime/tests/fixtures/regulated-commerce/fake-destinations.ts +38 -0
  361. package/packages/public-runtime/tests/gtm-migration/fixtures/gtm-sample-container-v84.provenance.json +29 -0
  362. package/packages/public-runtime/tests/gtm-migration/fixtures/gtm-sample-container-v84.redacted.json +3397 -0
  363. package/scripts/build/copy-tenant-assets.mjs +12 -5
  364. package/scripts/dev/ai-edit.mjs +2 -1
  365. package/scripts/dev/file-browser.mjs +2 -2
  366. package/scripts/dev/file-writer.mjs +2 -2
  367. package/scripts/dev/integration-guardrails.mjs +498 -0
  368. package/scripts/dev/safe-path.mjs +2 -2
  369. package/scripts/dev/tenant-source-root.mjs +3 -2
  370. package/scripts/tot-dev.mjs +5 -4
@@ -1,5 +1,5 @@
1
1
  // ─────────────────────────────────────────────────────────────────────────────
2
- // Action catalog — the ALLOWLISTED registry of actionKeys (card D0).
2
+ // Action catalog — the ALLOWLISTED registry of actionKeys.
3
3
  //
4
4
  // The `action` field of an ActivityEvent is NEVER a free string. It is one of
5
5
  // the keys below, and each key ships a spec: which actor kinds may emit it,
@@ -7,22 +7,22 @@
7
7
  // default-DENY allowlist of payload fields that survive redaction for it.
8
8
  //
9
9
  // WHY A FIXED CATALOG. Free-string actions make the downstream query/alert
10
- // surface (D5/D6/D7) intractable: you cannot build a dashboard, an alert rule,
10
+ // surface intractable: you cannot build a dashboard, an alert rule,
11
11
  // or a redaction allowlist against an open vocabulary. Adding a NEW action is a
12
12
  // deliberate edit HERE (plus, for the CLI, the JS mirror + its keep-in-step
13
13
  // test — see the module README), not an ad-hoc string at a call site.
14
14
  //
15
15
  // GROUNDING. These keys were reverse-engineered from the activity surfaces that
16
- // already exist informally in this repo, so D1–D3 map onto them 1:1 rather than
17
- // inventing new vocab:
16
+ // already exist informally in this repo, so those surfaces map onto them 1:1
17
+ // rather than inventing new vocab:
18
18
  // • CLI command dispatch + ~/.tot/activity.log → cli.command.*
19
19
  // • obstacle beacon (obstacle-beacon.cjs) → cli.obstacle.reported
20
20
  // • local→hosted dev bridge (dev/activityStore, runtimeStore, obstacleStore)
21
21
  // → dev.*
22
22
  // • preview serve / reconcile / Gitea webhook → preview.* / reconcile.* / webhook.*
23
- // • deploy version observed (provenance, D2) → deploy.version_observed
23
+ // • deploy version observed (provenance) → deploy.version_observed
24
24
  // • ShipLoop CHANGE_STATES + admin routes
25
- // (accept/reject/ship/revert/rollback/integrate/publish/invite/retire)
25
+ // (accept/reject/ship/revert/rollback/integrate/publish/invite)
26
26
  // → change.* / content.* / grant.* / preview.*
27
27
  // • app installs (STOREFRONT_APPS_DB) → app.*
28
28
  // • agent cohort (later) → agent.*
@@ -154,7 +154,7 @@ export const ACTION_CATALOG = {
154
154
  desc: "A preview build finished (result: ok|failed).",
155
155
  },
156
156
  "preview.override": {
157
- // D9: an AUTHENTICATED operator accepted the risk of a blocking-safety finding for a
157
+ // An AUTHENTICATED operator accepted the risk of a blocking-safety finding for a
158
158
  // specific commit (/api/preview/override), letting the reconcile materialize past it.
159
159
  // Cockpit-gated (signed-in real developer capability + session tenant), so the acting
160
160
  // cohort is owner→merchant, staff→admin, or a signed-in developer→dev. The required
@@ -166,7 +166,7 @@ export const ACTION_CATALOG = {
166
166
  "webhook.reconcile.received": {
167
167
  // Gitea candidate-reconcile webhook (api/changes/candidate-reconcile.ts). Low
168
168
  // volume (one per PR push, NOT per request) and the lifecycle PARTNER of
169
- // `reconcile.terminal` — timelined so D7's reconcile-hang watchdog can correlate
169
+ // `reconcile.terminal` — timelined so the reconcile-hang watchdog can correlate
170
170
  // "received" against "terminal" for the same changeId and detect an ABSENCE.
171
171
  actors: ["system"], source: "server", sinks: LIFECYCLE,
172
172
  argsAllow: ["repo", "action", "branch", "changeId"], renderedAllow: [],
@@ -174,9 +174,9 @@ export const ACTION_CATALOG = {
174
174
  },
175
175
  "reconcile.terminal": {
176
176
  // A reconcile reached a terminal state (reconciled|blocked|failed). Low
177
- // volume, high value → timelined for the ops UI (D5).
177
+ // volume, high value → timelined for the ops UI.
178
178
  actors: ["system"], source: "server", sinks: LIFECYCLE,
179
- argsAllow: ["changeId", "result", "evidenceStatus"], renderedAllow: [],
179
+ argsAllow: ["changeId", "result", "evidenceStatus", "evidencePushError"], renderedAllow: [],
180
180
  desc: "A candidate reconcile reached a terminal state.",
181
181
  },
182
182
  "candidate.closed": {
@@ -189,7 +189,7 @@ export const ACTION_CATALOG = {
189
189
  desc: "A merged/closed PR webhook transitioned a candidate to a terminal state.",
190
190
  },
191
191
  "prebuild.dispatched": {
192
- // T1 background pre-build (docs/epics/proposed/storefront-instant-static-rollback.md
192
+ // Background pre-build (docs/epics/proposed/storefront-instant-static-rollback.md
193
193
  // Addendum §B): a successful candidate reconcile fired (or failed to fire) the
194
194
  // materialize+validate+STAGE-ONLY repository_dispatch for a static-publish
195
195
  // tenant (candidate-reconcile.ts). Fail-open by design — this never gates the
@@ -200,7 +200,7 @@ export const ACTION_CATALOG = {
200
200
  desc: "A candidate's background static-prebuild dispatch (stage-only) succeeded or failed.",
201
201
  },
202
202
 
203
- // ── Deploy provenance (source: server or cli) — card D2 ────────────────────
203
+ // ── Deploy provenance (source: server or cli) ────────────────────
204
204
  "deploy.version_observed": {
205
205
  actors: ["system", "dev"], source: "server", sinks: PROVENANCE,
206
206
  argsAllow: ["version", "commit", "env", "observedFrom"], renderedAllow: [],
@@ -234,7 +234,7 @@ export const ACTION_CATALOG = {
234
234
  desc: "A change was rejected (reason required).",
235
235
  },
236
236
  "change.resolve": {
237
- // u3 (tot-merge-conflict-resolution-ux): one-click conflict resolution via
237
+ // One-click conflict resolution via
238
238
  // candidate_refresh. Same admission ladder as change.reject (resolveShipSession
239
239
  // → ship-on-behalf floor), so the same actor cohort. `strategy` is a
240
240
  // low-cardinality enum (ours|theirs|merge), safe to render.
@@ -243,7 +243,7 @@ export const ACTION_CATALOG = {
243
243
  desc: "A not-mergeable change was resolved by rebuilding it from the base tip under a strategy.",
244
244
  },
245
245
  "change.ship": {
246
- // D6: the admin/cockpit "Publish" (go-live) handler admits the store OWNER
246
+ // The admin/cockpit "Publish" (go-live) handler admits the store OWNER
247
247
  // (merchant), ToT staff (admin), a ship-on-behalf developer (dev), AND the
248
248
  // headless Bearer/CLI operator (agent) — the actor list reflects who actually
249
249
  // reaches POST /api/changes/ship, not a placeholder subset.
@@ -252,7 +252,7 @@ export const ACTION_CATALOG = {
252
252
  desc: "A change was shipped to the live channel.",
253
253
  },
254
254
  "change.revert": {
255
- // D9: same admission ladder as change.ship/rollback (resolveShipSession) — owner
255
+ // Same admission ladder as change.ship/rollback (resolveShipSession) — owner
256
256
  // (merchant), staff (admin), ship-on-behalf dev, headless operator (agent). The
257
257
  // `/api/changes/revert` route gates on the SAME seam, so the emitter cohort matches.
258
258
  actors: ["admin", "merchant", "dev", "agent"], source: "ui", sinks: LIFECYCLE,
@@ -260,7 +260,7 @@ export const ACTION_CATALOG = {
260
260
  desc: "A change was reverted.",
261
261
  },
262
262
  "change.hotfix": {
263
- // D9: the owner-only emergency HOTFIX lane (/api/changes/hotfix) — a DISTINCT verb
263
+ // The owner-only emergency HOTFIX lane (/api/changes/hotfix) — a DISTINCT verb
264
264
  // from change.ship (never a `--base main` flag): a bypass-normal-flow live promote
265
265
  // from `main` while `preview` holds other unshipped work. Same resolveShipSession
266
266
  // ladder as ship/rollback (owner ⊇ ship-on-behalf), so the same cohort set.
@@ -269,20 +269,20 @@ export const ACTION_CATALOG = {
269
269
  desc: "An emergency hotfix was released to the live channel (bypassing unshipped preview work).",
270
270
  },
271
271
  "change.rollback": {
272
- // D6: same admission ladder as change.ship (resolveShipSession) — owner
272
+ // Same admission ladder as change.ship (resolveShipSession) — owner
273
273
  // (merchant), staff (admin), ship-on-behalf dev, headless operator (agent).
274
274
  actors: ["admin", "merchant", "dev", "agent"], source: "ui", sinks: LIFECYCLE,
275
275
  argsAllow: ["changeId", "toVersion"], renderedAllow: ["reason"],
276
276
  desc: "The live channel was rolled back to a prior version.",
277
277
  },
278
278
  "change.integrate": {
279
- // D6: accept/integrate (resolveShipSession) admits the same cohort set.
279
+ // Accept/integrate (resolveShipSession) admits the same cohort set.
280
280
  actors: ["admin", "merchant", "dev", "agent"], source: "ui", sinks: LIFECYCLE,
281
281
  argsAllow: ["changeId"], renderedAllow: [],
282
282
  desc: "A change was integrated into the shared preview.",
283
283
  },
284
284
  "change.rebuild": {
285
- // u15: retry a dead aggregate rebuild without a new merge (/api/changes/rebuild).
285
+ // Retry a dead aggregate rebuild without a new merge (/api/changes/rebuild).
286
286
  // Same admission ladder as change.integrate/revert (resolveShipSession) — the
287
287
  // route gates on the SAME seam, so the emitter cohort matches. No changeId: a
288
288
  // rebuild retries the tenant's most recent integration attempt, not one candidate.
@@ -291,7 +291,7 @@ export const ACTION_CATALOG = {
291
291
  desc: "A dead aggregate rebuild was retried without a new merge.",
292
292
  },
293
293
  "change.resync": {
294
- // u12: advance the shared preview aggregate to an out-of-band branch tip
294
+ // Advance the shared preview aggregate to an out-of-band branch tip
295
295
  // without a candidate/<changeId> PR (/api/changes/resync). Same admission
296
296
  // ladder as change.integrate/rebuild (resolveShipSession). No changeId: a
297
297
  // resync pins an operator-supplied branch/sha, not one candidate.
@@ -314,7 +314,7 @@ export const ACTION_CATALOG = {
314
314
  desc: "Tenant customization/content was published to a version.",
315
315
  },
316
316
  "content.checkout_style.saved": {
317
- // NEW (D10): a tenant's checkout styling was saved to a versioned test artifact
317
+ // NEW: a tenant's checkout styling was saved to a versioned test artifact
318
318
  // (Settings → Checkout styling → publishToTest spine). A persistent tenant
319
319
  // customization — low volume, high value → timelined. Actor cohort mirrors the
320
320
  // route's own auth (resolveOwnerSession): a merchant saving their own tenant, or
@@ -324,7 +324,7 @@ export const ACTION_CATALOG = {
324
324
  desc: "A tenant's checkout styling was saved to a version.",
325
325
  },
326
326
  "change.go_live": {
327
- // D9: renamed from the orphaned, un-namespaced `go_live` (the ONE key that broke the
327
+ // Renamed from the orphaned, un-namespaced `go_live` (the ONE key that broke the
328
328
  // domain-prefix rule). The snake_case suffix is kept (the `deploy.version_observed`
329
329
  // precedent) — only the missing `change.` domain prefix is added. Wired into
330
330
  // /api/preview/promote (promote the current preview snapshot to live).
@@ -337,9 +337,9 @@ export const ACTION_CATALOG = {
337
337
  // Invitee identity is PII → DROPPED by allowlist; only the role/resource +
338
338
  // an opaque hashed invitee ref (rendered) survive.
339
339
  "grant.invite": {
340
- // D6: the self-serve "Invite a Developer" handler admits an owner (merchant) or
340
+ // The self-serve "Invite a Developer" handler admits an owner (merchant) or
341
341
  // staff (admin) session, and the headless operator (agent) via the Bearer seam.
342
- // D11: the SECOND invite path (grants/team-invite.ts) is session-authed by vendor
342
+ // The SECOND invite path (grants/team-invite.ts) is session-authed by vendor
343
343
  // MEMBERSHIP — a signed-in team member who is neither owner nor staff classifies as
344
344
  // "dev" (see uiActor.classifyActorKind), so `dev` joins the admission set.
345
345
  actors: ["admin", "merchant", "dev", "agent"], source: "ui", sinks: LIFECYCLE,
@@ -347,14 +347,14 @@ export const ACTION_CATALOG = {
347
347
  desc: "A developer/team invite was issued.",
348
348
  },
349
349
  "grant.approve": {
350
- // D6: the browserless CLI sign-in approval is taken by whoever is signed in
350
+ // The browserless CLI sign-in approval is taken by whoever is signed in
351
351
  // (owner→merchant, staff→admin, or a signed-in developer→dev).
352
352
  actors: ["admin", "merchant", "dev"], source: "ui", sinks: LIFECYCLE,
353
353
  argsAllow: ["role", "resource"], renderedAllow: [],
354
354
  desc: "A pending access request / CLI sign-in was approved.",
355
355
  },
356
356
  "grant.revoke": {
357
- // D9: the self-serve "remove a developer from my team" handler (/api/grants/revoke),
357
+ // The self-serve "remove a developer from my team" handler (/api/grants/revoke),
358
358
  // the inverse of grant.invite — same resolveOwnerSession seam, so the same cohort
359
359
  // (owner→merchant, staff→admin, headless operator→agent). The revoked developer's
360
360
  // identity is PII → DROPPED by the allowlist; only an opaque hashed ref survives.
@@ -372,10 +372,14 @@ export const ACTION_CATALOG = {
372
372
  argsAllow: ["changeId"], renderedAllow: ["inviteeRef"],
373
373
  desc: "A reviewer/developer was invited to a preview.",
374
374
  },
375
- "preview.retire": {
376
- actors: ["admin", "merchant"], source: "ui", sinks: LIFECYCLE,
377
- argsAllow: ["changeId"], renderedAllow: [],
378
- desc: "A preview environment was retired.",
375
+ "preview.evidence.retry": {
376
+ // An operator retried the change_report_evidence push for an already-`ready`
377
+ // candidate whose evidence.pushFailed was set (candidate-evidence-retry.ts) —
378
+ // the manual recovery for fb-1787938036559-ppmu4e when the automatic retry in
379
+ // reportPreviewEvidence still didn't land.
380
+ actors: ["admin", "merchant", "dev", "system"], source: "server", sinks: LIFECYCLE,
381
+ argsAllow: ["changeId", "versionId", "pushed"], renderedAllow: [],
382
+ desc: "An operator retried a candidate's evidence push to MCP after it failed.",
379
383
  },
380
384
  "store.connect": {
381
385
  actors: ["merchant", "admin"], source: "ui", sinks: LIFECYCLE,
@@ -429,8 +433,8 @@ export const ACTION_CATALOG = {
429
433
 
430
434
  // ── Agent cohort (source: server/cli) — later ──────────────────────────────
431
435
  // Placeholder spine so the agent cohort (a later card) has stable keys to emit
432
- // against without reopening D0. Args are deliberately empty until that card
433
- // defines what an agent action is allowed to record.
436
+ // against without reopening the action catalog. Args are deliberately empty until
437
+ // that card defines what an agent action is allowed to record.
434
438
  "agent.action.invoked": {
435
439
  actors: ["agent"], source: "server", sinks: HIGH_VOLUME,
436
440
  argsAllow: ["tool"], renderedAllow: [],
@@ -442,9 +446,9 @@ export const ACTION_CATALOG = {
442
446
  desc: "An automated agent action finished.",
443
447
  },
444
448
 
445
- // ── D11: remaining grant/staff-ops gaps + machine/agent-driven mutations ─────
446
- // Follow-on to D0–D8: wires the invite/grant paths, staff-impersonation, cache,
447
- // and machine-authed (signature/idempotency/app-JWT) mutations that D6 left out.
449
+ // ── Remaining grant/staff-ops gaps + machine/agent-driven mutations ─────
450
+ // Wires the invite/grant paths, staff-impersonation, cache,
451
+ // and machine-authed (signature/idempotency/app-JWT) mutations the earlier catalog entries left out.
448
452
  // Grant/staff actions are low-volume lifecycle → timelined; the machine cohort's
449
453
  // high-volume streams (order-forward, attribution) are analytics-only.
450
454
  "grant.issue": {
@@ -485,7 +489,7 @@ export const ACTION_CATALOG = {
485
489
  },
486
490
  "store.connect.completed": {
487
491
  // domain/callback.ts — the CI completion callback for the www-domain job, the
488
- // machine-side terminal PARTNER of D6's `store.connect`. Signature-authed, one per
492
+ // machine-side terminal PARTNER of `store.connect`. Signature-authed, one per
489
493
  // connect run (rare) → low-volume lifecycle terminal, timelined like reconcile.terminal.
490
494
  actors: ["system"], source: "server", sinks: LIFECYCLE,
491
495
  argsAllow: ["status", "state", "action"], renderedAllow: [],
@@ -521,7 +525,7 @@ export const ACTION_CATALOG = {
521
525
 
522
526
  // ── Meta (source: server) ──────────────────────────────────────────────────
523
527
  "system.ingest.rejected": {
524
- // The ingest endpoint (D4) rejected an event (unknown action, actor
528
+ // The ingest endpoint rejected an event (unknown action, actor
525
529
  // mismatch, canary tripped). Self-telemetry so a leak attempt is visible.
526
530
  actors: ["system"], source: "server", sinks: HIGH_VOLUME,
527
531
  argsAllow: ["reason", "attemptedAction"], renderedAllow: [],
@@ -1,12 +1,12 @@
1
1
  // ─────────────────────────────────────────────────────────────────────────────
2
- // ActivityEvent — the versioned actor×action telemetry envelope (card D0).
2
+ // ActivityEvent — the versioned actor×action telemetry envelope.
3
3
  //
4
4
  // One event = "an ACTOR performed an ACTION, here is the OUTCOME." It is the
5
5
  // single shape every operational-activity emitter produces and every sink
6
6
  // stores, across the whole storefront platform (dev/CLI first, then merchant/
7
- // admin/agent). Downstream cards import this directly:
8
- // D1 server recordActivity() · D2 deploy provenance · D3 CLI emitActivity
9
- // D4 ingest+store · D5 query/timeline UI · D6/D7 alerts.
7
+ // admin/agent). Downstream consumers import this directly: server
8
+ // recordActivity() · deploy provenance · CLI emitActivity · ingest+store ·
9
+ // the query/timeline UI · alerts.
10
10
  //
11
11
  // TWO ZONES, and the split is load-bearing:
12
12
  // 1. CORE fields (everything except `payload`) — always safe to store. They
@@ -86,9 +86,9 @@ export interface ActivityScope {
86
86
  */
87
87
  traceId?: string;
88
88
  /**
89
- * BUILD PROVENANCE (card D2). The git commit SHA the running server/edge build
89
+ * BUILD PROVENANCE. The git commit SHA the running server/edge build
90
90
  * was cut from — stamped by the emitter onto every SERVER-sourced event so the
91
- * query surface (D5) can derive **deploy skew**: is the build that produced this
91
+ * query surface can derive **deploy skew**: is the build that produced this
92
92
  * event == the pushed umbrella tip, or is a stale worker still serving? Core,
93
93
  * non-secret by construction (a 40-hex git sha, never PII/free-text), so it is
94
94
  * never redacted. Absent on `cli`/`ui`-sourced events and on any build with no
@@ -1,7 +1,7 @@
1
1
  // ─────────────────────────────────────────────────────────────────────────────
2
2
  // @tot/public-runtime/activity — the operational activity telemetry contract.
3
3
  //
4
- // Card D0: the actor×action ActivityEvent envelope, the allowlisted action
4
+ // The actor×action ActivityEvent envelope, the allowlisted action
5
5
  // catalog, and the default-deny redaction contract. This is the FOUNDATION the
6
6
  // downstream cards import directly — nothing here does I/O or picks a store; it
7
7
  // is pure types + pure functions so server, edge, and the CLI's JS mirror can
@@ -9,7 +9,7 @@
9
9
  // DECISIONS.md §8; the per-action routing lives on each catalog entry (sinks).
10
10
  //
11
11
  // See ./README.md for the envelope shape, catalog rules, redaction contract,
12
- // and the CLI-mirror keep-in-step obligation for card D3.
12
+ // and the CLI-mirror keep-in-step obligation.
13
13
  // ─────────────────────────────────────────────────────────────────────────────
14
14
  export * from "./event.js";
15
15
  export * from "./catalog.js";
@@ -1,7 +1,7 @@
1
1
  // ─────────────────────────────────────────────────────────────────────────────
2
- // Redaction contract for the activity payload zone (card D0).
2
+ // Redaction contract for the activity payload zone.
3
3
  //
4
- // This is the surface card D8 (adversarial PII/secret-leak review) will attack,
4
+ // This is the surface the adversarial PII/secret-leak review will attack,
5
5
  // so the posture is deliberately conservative. Three layers, in order:
6
6
  //
7
7
  // 1. DEFAULT-DENY ALLOWLIST. For a given action, ONLY the top-level payload
@@ -20,12 +20,12 @@
20
20
  // shapes (JWTs, bearer tokens, API keys, private keys, emails, card/phone
21
21
  // numbers) AND secret-looking KEY NAMES. A hit replaces the value with a
22
22
  // redaction marker and is REPORTED (the fact of the hit, never the value) so
23
- // D6/D7 can alert and D8 can audit. A secret-named key is dropped outright.
23
+ // alerting can flag it and auditing can review it. A secret-named key is dropped outright.
24
24
  //
25
25
  // The safe constructor createActivityEvent() runs all three before an event is
26
26
  // ever returned — you cannot build an event whose payload skipped redaction.
27
27
  //
28
- // OPEN QUESTION (owned by D1/D4): the canonical actor-id pseudonymization salt.
28
+ // OPEN QUESTION: the canonical actor-id pseudonymization salt.
29
29
  // This module scrubs PII that leaks into the PAYLOAD, but actor.id in the CORE
30
30
  // zone is the emitter's responsibility to pseudonymize. A shared, salted,
31
31
  // non-reversible hash helper (with the salt as a Worker secret) should land with
@@ -52,6 +52,38 @@ export interface ReviewEnvironmentEvidence {
52
52
  /** Derived upstream: every `REQUIRED_FOR_PROMOTE` check is `pass`. */
53
53
  promotable: boolean;
54
54
  generatedAt: string;
55
+ /**
56
+ * True when this verdict was computed locally but the `change_report_evidence`
57
+ * push to MCP did NOT land (even after retry) — MCP has no evidence (or a stale
58
+ * one) for this commit, so `preview_status`/`change_ready` can disagree with
59
+ * `promotable` above (fb-1787938036559-ppmu4e). Absent/false ⇒ the push
60
+ * succeeded, this verdict is the same one MCP is serving. A UI/CLI should
61
+ * treat `true` as "evidence missing upstream — offer a retry", not as a
62
+ * failed verdict.
63
+ */
64
+ pushFailed?: boolean;
65
+ /** The push failure's error message, when `pushFailed` is true. */
66
+ pushError?: string;
67
+ }
68
+
69
+ /** Durable, reviewer-facing progress for one bounded candidate reconcile. */
70
+ export interface CandidateReconcileLifecycle {
71
+ phase:
72
+ | "queued"
73
+ | "archive-requested"
74
+ | "archive-downloading"
75
+ | "archive-validating"
76
+ | "archive-ingesting"
77
+ | "evidence-reporting"
78
+ | "ready"
79
+ | "blocked";
80
+ correlationId: string;
81
+ startedAt: string;
82
+ lastUpdatedAt: string;
83
+ elapsedMs: number;
84
+ bytes?: number;
85
+ files?: number;
86
+ terminalError?: { code: string; message: string; correlationId: string; elapsedMs: number } | null;
55
87
  }
56
88
 
57
89
  /**
@@ -110,11 +142,13 @@ export interface ReviewEnvironment {
110
142
  * dead/unregistered webhook shows as "queued since <submittedAt>, never
111
143
  * picked up" instead of no record at all). Additive + optional: every OTHER
112
144
  * writer of this projection (`reconcileCandidate`, `acceptCandidateAtomic`,
113
- * retire/GC) predates this field and simply carries it forward unset/
145
+ * terminal cleanup) simply carries it forward unset/
114
146
  * untouched — only the submit-ack path ever sets it. Deliberately distinct
115
147
  * from `updatedAt`, which every writer bumps on any recompute for any reason.
116
148
  */
117
149
  submittedAt?: string;
150
+ /** Bounded reconcile progress and terminal reason, if this candidate has run. */
151
+ reconcileLifecycle?: CandidateReconcileLifecycle;
118
152
  }
119
153
 
120
154
  /** KV key for one tenant-change `ReviewEnvironment` projection. */
@@ -136,10 +170,10 @@ export interface CandidateKv {
136
170
  }
137
171
 
138
172
  /**
139
- * A {@link CandidateKv} that can also DELETE a key — the eviction surface the
140
- * retire/GC path (unit U7) needs. Kept separate from `CandidateKv` so the many
173
+ * A {@link CandidateKv} that can also DELETE a key — the terminal candidate
174
+ * cleanup surface. Kept separate from `CandidateKv` so the many
141
175
  * write-only `{ get, put }` adapters (the webhook reconcile, build-on-demand,
142
- * accept) are unaffected: only the retire endpoint constructs a delete-capable
176
+ * accept) are unaffected: only terminal cleanup constructs a delete-capable
143
177
  * adapter. A real Cloudflare KV namespace satisfies this structurally.
144
178
  */
145
179
  export interface CandidateKvDeletable extends CandidateKv {
@@ -266,17 +300,17 @@ export async function writeReviewEnvironment(
266
300
 
267
301
  /**
268
302
  * Evict one `ReviewEnvironment` record AND remove its `changeId` from the tenant
269
- * index — the KV half of retire/GC (unit U7). The per-record key is deleted
303
+ * index. The per-record key is deleted
270
304
  * outright; the tenant index is updated by the SAME serialized read-modify-write
271
- * `writeReviewEnvironment` uses (see {@link serializeIndexWrite}), so a retire that
305
+ * `writeReviewEnvironment` uses (see {@link serializeIndexWrite}), so a deletion that
272
306
  * races a concurrent write for a DIFFERENT candidate never resurrects a dropped
273
307
  * entry or leaves a dangling index id (the corruption risk this helper exists to
274
308
  * prevent — the mirror-image of `writeReviewEnvironment`'s append).
275
309
  *
276
310
  * IDEMPOTENT by contract: deleting an already-absent candidate is a clean no-op.
277
311
  * Returns whether anything was actually removed (`true` iff the record existed OR
278
- * the index carried the id), so the caller can report `evicted` honestly while a
279
- * repeat retire still succeeds.
312
+ * the index carried the id), so the caller can report cleanup honestly while a
313
+ * repeat deletion still succeeds.
280
314
  */
281
315
  export async function deleteReviewEnvironment(
282
316
  kv: CandidateKvDeletable,
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Order READ DTO — the FROZEN v1 contract shape the storefront consumes from
3
- * the checkout order API's `GET /commerce/orders[/:orderId]` (card 8585 / U1). Kept in
3
+ * the checkout order API's `GET /commerce/orders[/:orderId]` (card 8585). Kept in
4
4
  * `@tot/public-runtime` (types only, no secrets, edge-safe) so the server-side
5
- * order client (U2), the Orders admin route (U2), and the view-model mapping (U3)
5
+ * order client, the Orders admin route, and the view-model mapping
6
6
  * all code against one source of truth.
7
7
  *
8
8
  * Authoritative API shape lives with the checkout order service; this file
@@ -10,7 +10,7 @@
10
10
  * HMAC-SHA256 of `JSON.stringify(body)` keyed by the STORE'S ToT SECRET KEY —
11
11
  * byte-identical to the commerce service's webhook-signature verifier. That
12
12
  * secret is the storefront's `TOT_SECRET_KEY`; this is independent of the
13
- * provider API credentials (see decision `u11b-not-blocked-by-u7`).
13
+ * provider API credentials.
14
14
  *
15
15
  * Edge-safe + node-free (WebCrypto HMAC); the network call is injected so the
16
16
  * flow is fully unit-testable offline. The caller (the checkout-styling promote
@@ -190,7 +190,7 @@ export async function publishCheckoutTheme(
190
190
  /**
191
191
  * Convenience: the env → checkout service base URL for this workstream's targets.
192
192
  * qa/test use the non-prod proxy; live uses the prod proxy. Kept here so the
193
- * promote hook (U13) resolves one place.
193
+ * promote hook resolves one place.
194
194
  */
195
195
  export function checkoutServiceBaseUrl(env: CustomizationEnv): string {
196
196
  // "test" is the qa target's env; "live" is prod.
@@ -2,7 +2,7 @@
2
2
  * Checkout-styling data model + published-artifact read plumbing.
3
3
  *
4
4
  * The hosted checkout is styled by CSS pushed through the commerce service's theme
5
- * endpoint (U11). This module owns the *source of truth* for that styling: a
5
+ * endpoint. This module owns the *source of truth* for that styling: a
6
6
  * small, structured, tenant-editable descriptor that later units render into
7
7
  * ASCII-safe CSS. It sits on the SAME versioned publish spine as theme/content
8
8
  * (D1VersionStore + KV pointers) — resolution is per-environment via
@@ -12,11 +12,11 @@
12
12
  * Two colocated artifacts under `tenants/<id>/`:
13
13
  * - `checkout-style.json` — the structured `CheckoutStyle` descriptor (below).
14
14
  * - `checkout.css` — an optional raw-CSS escape hatch a merchant edits
15
- * directly; hosted + pushed to checkout as-is (U11).
15
+ * directly; hosted + pushed to checkout as-is.
16
16
  *
17
17
  * Pure + dependency-free (node-free, edge-safe): the caller injects the same
18
18
  * `KvGet` used for theme/content, keeping this unit-testable and storage-agnostic.
19
- * No UI here — that's U12.
19
+ * No UI here — that lives elsewhere.
20
20
  */
21
21
  import type { CustomizationEnv } from "./customization-preview.js";
22
22
  import type { DeepPartial, ThemeTokens } from "./tenant.js";
@@ -64,7 +64,7 @@ export interface CheckoutStyleButton {
64
64
 
65
65
  /**
66
66
  * The structured checkout-styling descriptor — the `checkout-style.json`
67
- * artifact. This is the model a merchant edits (U12) and that U11 renders into
67
+ * artifact. This is the model a merchant edits and the renderer turns into
68
68
  * the CSS pushed to checkout. A published artifact is a `DeepPartial` of this
69
69
  * (a merchant may set one field without restating the rest); `resolveCheckout
70
70
  * Style` merges it over `DEFAULT_CHECKOUT_STYLE` so the resolved value is always
@@ -105,7 +105,7 @@ export const DEFAULT_CHECKOUT_STYLE: CheckoutStyle = {
105
105
  * Derive a checkout style FROM a tenant's brand `ThemeTokens`, so the checkout is
106
106
  * consistent with the look/feel the merchant already chose for the storefront
107
107
  * instead of a neutral default. This is the "from theme" seam: the settings editor
108
- * (U12) seeds a merchant's starting style from it, and a tenant that ships a brand
108
+ * seeds a merchant's starting style from it, and a tenant that ships a brand
109
109
  * theme gets an in-brand checkout with no hand-authoring.
110
110
  *
111
111
  * It maps the small, opinionated checkout surface onto the full theme palette:
@@ -289,13 +289,13 @@ export async function resolveCheckoutStyleCss(
289
289
  }
290
290
 
291
291
  // ---------------------------------------------------------------------------
292
- // CSS serialization (the artifact pushed to checkout) — U11
292
+ // CSS serialization (the artifact pushed to checkout)
293
293
  // ---------------------------------------------------------------------------
294
294
 
295
295
  /**
296
296
  * True iff every character is 7-bit ASCII (code point < 128). The checkout
297
297
  * template cache pass is NOT Unicode-safe — a non-ASCII byte in the cached
298
- * checkout content yields a BLANK page. So the publisher (U11) MUST gate both
298
+ * checkout content yields a BLANK page. So the publisher MUST gate both
299
299
  * the generated token CSS and any raw override through this before pushing a
300
300
  * `content_url` to `/theme/foxy`. We reject rather than transliterate, so a
301
301
  * merchant is told to fix their input instead of getting silently-mangled CSS.
@@ -97,7 +97,7 @@ export interface BuildVariantCartPayloadOptions {
97
97
  secret?: string;
98
98
  purchaseOption?: ProductPurchaseOption;
99
99
  /**
100
- * The member-adjusted EFFECTIVE price to sign (F11b), computed server-side via
100
+ * The member-adjusted EFFECTIVE price to sign, computed server-side via
101
101
  * membership.ts `priceForPurchaseOption` for the shopper's resolved eligibility.
102
102
  * When set it REPLACES the list/subscription price as the single signed source
103
103
  * of truth, so a given price is only ever valid for the member context it was
@@ -189,7 +189,7 @@ export function cartFieldsForVariant(
189
189
 
190
190
  /**
191
191
  * Validate a caller-supplied EFFECTIVE price before it becomes the signed source
192
- * of truth (F11b). The member-adjusted price (membership.ts
192
+ * of truth. The member-adjusted price (membership.ts
193
193
  * `priceForPurchaseOption`) is computed server-side and threaded in so the SIGNED
194
194
  * price reflects the shopper's resolved eligibility. It must be a finite,
195
195
  * non-negative amount no greater than the list price — an effective price is
@@ -325,7 +325,7 @@ export async function buildVariantCartPayload(
325
325
  variant: CatalogVariant,
326
326
  opts: BuildVariantCartPayloadOptions,
327
327
  ): Promise<VariantCartPayload> {
328
- // Hide-at-launch guard (F11b): refuse to SIGN a subscription option while
328
+ // Hide-at-launch guard: refuse to SIGN a subscription option while
329
329
  // Autopilot is disabled. `visiblePurchaseOptions` removes subscription options
330
330
  // for such tenants, so one reaching the signer means the visibility filter was
331
331
  // bypassed (e.g. a crafted request) — signing it would mint a valid subscription