@40rty/ams-sdk 0.1.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 (317) hide show
  1. package/dist/index.js +11918 -0
  2. package/dist/types/ecommerce/src/attribute-buckets.d.ts +79 -0
  3. package/dist/types/ecommerce/src/base-attributes.d.ts +42 -0
  4. package/dist/types/ecommerce/src/bucket-labels.d.ts +37 -0
  5. package/dist/types/ecommerce/src/cart-line-selections.d.ts +24 -0
  6. package/dist/types/ecommerce/src/commerce-schemas.d.ts +1813 -0
  7. package/dist/types/ecommerce/src/format-variant-value.d.ts +1 -0
  8. package/dist/types/ecommerce/src/index.d.ts +13 -0
  9. package/dist/types/ecommerce/src/locale.d.ts +31 -0
  10. package/dist/types/ecommerce/src/optimistic-cart-line.d.ts +38 -0
  11. package/dist/types/ecommerce/src/pdp-companions.d.ts +21 -0
  12. package/dist/types/ecommerce/src/pick-product-card-action.d.ts +38 -0
  13. package/dist/types/ecommerce/src/product-lookup.d.ts +34 -0
  14. package/dist/types/ecommerce/src/projection-spec.d.ts +38 -0
  15. package/dist/types/ecommerce/src/review-schemas.d.ts +425 -0
  16. package/dist/types/sdk/src/analytics/consent.d.ts +52 -0
  17. package/dist/types/sdk/src/analytics/drops.d.ts +98 -0
  18. package/dist/types/sdk/src/analytics/emitting-scope.d.ts +2 -0
  19. package/dist/types/sdk/src/analytics/index.d.ts +12 -0
  20. package/dist/types/sdk/src/analytics/inert-scope.d.ts +2 -0
  21. package/dist/types/sdk/src/analytics/notify.d.ts +41 -0
  22. package/dist/types/sdk/src/analytics/outbox.d.ts +118 -0
  23. package/dist/types/sdk/src/analytics/scope-context.d.ts +24 -0
  24. package/dist/types/sdk/src/analytics/scope.d.ts +149 -0
  25. package/dist/types/sdk/src/analytics/surface.d.ts +77 -0
  26. package/dist/types/sdk/src/analytics/transport.d.ts +91 -0
  27. package/dist/types/sdk/src/animation/index.d.ts +2 -0
  28. package/dist/types/sdk/src/animation/useListTransition.d.ts +16 -0
  29. package/dist/types/sdk/src/animation/useUpdateTransition.d.ts +16 -0
  30. package/dist/types/sdk/src/canvas/ElementIdContext.d.ts +13 -0
  31. package/dist/types/sdk/src/canvas/GenerationStyleContext.d.ts +13 -0
  32. package/dist/types/sdk/src/canvas/ShimmerSweep.d.ts +18 -0
  33. package/dist/types/sdk/src/canvas/TransitionContext.d.ts +52 -0
  34. package/dist/types/sdk/src/canvas/canvas-arrangement.d.ts +20 -0
  35. package/dist/types/sdk/src/canvas/canvas-motion-style.d.ts +18 -0
  36. package/dist/types/sdk/src/canvas/canvas-outlet.d.ts +14 -0
  37. package/dist/types/sdk/src/canvas/canvas-tail.d.ts +31 -0
  38. package/dist/types/sdk/src/canvas/dom-targets.d.ts +140 -0
  39. package/dist/types/sdk/src/canvas/generation-entrance.d.ts +26 -0
  40. package/dist/types/sdk/src/canvas/generation-style.d.ts +62 -0
  41. package/dist/types/sdk/src/canvas/index.d.ts +21 -0
  42. package/dist/types/sdk/src/canvas/item-motion/ItemTransitionGroup.d.ts +72 -0
  43. package/dist/types/sdk/src/canvas/item-motion/classify-items.d.ts +24 -0
  44. package/dist/types/sdk/src/canvas/item-motion/index.d.ts +5 -0
  45. package/dist/types/sdk/src/canvas/item-motion/plugins/wipe.d.ts +11 -0
  46. package/dist/types/sdk/src/canvas/item-motion/profile.d.ts +77 -0
  47. package/dist/types/sdk/src/canvas/item-motion/wipe.d.ts +57 -0
  48. package/dist/types/sdk/src/canvas/nav-direction.d.ts +22 -0
  49. package/dist/types/sdk/src/canvas/runtime-context.d.ts +15 -0
  50. package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +106 -0
  51. package/dist/types/sdk/src/canvas/runtime-types.d.ts +183 -0
  52. package/dist/types/sdk/src/canvas/scroll-event-target.d.ts +21 -0
  53. package/dist/types/sdk/src/canvas/turn-change-anchor.d.ts +34 -0
  54. package/dist/types/sdk/src/canvas/turn-edit.d.ts +8 -0
  55. package/dist/types/sdk/src/canvas/use-canvas-actions.d.ts +41 -0
  56. package/dist/types/sdk/src/canvas/use-fourty-layout.d.ts +19 -0
  57. package/dist/types/sdk/src/catalog/CatalogContext.d.ts +7 -0
  58. package/dist/types/sdk/src/catalog/DebugContext.d.ts +5 -0
  59. package/dist/types/sdk/src/catalog/HydrationStateContext.d.ts +45 -0
  60. package/dist/types/sdk/src/catalog/HydratorContext.d.ts +7 -0
  61. package/dist/types/sdk/src/catalog/component-library.d.ts +32 -0
  62. package/dist/types/sdk/src/catalog/define.d.ts +149 -0
  63. package/dist/types/sdk/src/catalog/hydrator-registry.d.ts +91 -0
  64. package/dist/types/sdk/src/catalog/index.d.ts +14 -0
  65. package/dist/types/sdk/src/catalog/interaction-contract.d.ts +78 -0
  66. package/dist/types/sdk/src/catalog/normalize-components.d.ts +17 -0
  67. package/dist/types/sdk/src/catalog/prose-value.d.ts +22 -0
  68. package/dist/types/sdk/src/catalog/registration/index.d.ts +4 -0
  69. package/dist/types/sdk/src/catalog/registration/register-component.d.ts +35 -0
  70. package/dist/types/sdk/src/catalog/registration/registry.d.ts +27 -0
  71. package/dist/types/sdk/src/catalog/registration/types.d.ts +83 -0
  72. package/dist/types/sdk/src/catalog/registry.d.ts +22 -0
  73. package/dist/types/sdk/src/catalog/render-inline.d.ts +39 -0
  74. package/dist/types/sdk/src/catalog/resolve-hydrators.d.ts +27 -0
  75. package/dist/types/sdk/src/chat/chat-context.d.ts +40 -0
  76. package/dist/types/sdk/src/chat/index.d.ts +1 -0
  77. package/dist/types/sdk/src/client-state/index.d.ts +2 -0
  78. package/dist/types/sdk/src/client-state/server-store.d.ts +38 -0
  79. package/dist/types/sdk/src/client-state/store.d.ts +20 -0
  80. package/dist/types/sdk/src/commerce/commerce-context.d.ts +62 -0
  81. package/dist/types/sdk/src/commerce/commerce-shapes.d.ts +170 -0
  82. package/dist/types/sdk/src/commerce/ecommerce/agentic-overlay.d.ts +27 -0
  83. package/dist/types/sdk/src/commerce/ecommerce/buy-now-exit.d.ts +36 -0
  84. package/dist/types/sdk/src/commerce/ecommerce/cart-action-failures.d.ts +54 -0
  85. package/dist/types/sdk/src/commerce/ecommerce/cart-drawer-store.d.ts +18 -0
  86. package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-reasons.d.ts +54 -0
  87. package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-shape.d.ts +73 -0
  88. package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-store.d.ts +39 -0
  89. package/dist/types/sdk/src/commerce/ecommerce/comparison-rows.d.ts +30 -0
  90. package/dist/types/sdk/src/commerce/ecommerce/index.d.ts +21 -0
  91. package/dist/types/sdk/src/commerce/ecommerce/normalize-collection.d.ts +17 -0
  92. package/dist/types/sdk/src/commerce/ecommerce/preselect-from-facts.d.ts +25 -0
  93. package/dist/types/sdk/src/commerce/ecommerce/product-filters.d.ts +40 -0
  94. package/dist/types/sdk/src/commerce/ecommerce/use-buy-now.d.ts +33 -0
  95. package/dist/types/sdk/src/commerce/ecommerce/use-cart-drawer.d.ts +35 -0
  96. package/dist/types/sdk/src/commerce/ecommerce/use-cart-line-row.d.ts +30 -0
  97. package/dist/types/sdk/src/commerce/ecommerce/use-comparison-table.d.ts +22 -0
  98. package/dist/types/sdk/src/commerce/ecommerce/use-look-card.d.ts +80 -0
  99. package/dist/types/sdk/src/commerce/ecommerce/use-product-card.d.ts +62 -0
  100. package/dist/types/sdk/src/commerce/ecommerce/use-product-carousel-scroll.d.ts +13 -0
  101. package/dist/types/sdk/src/commerce/ecommerce/use-product-detail.d.ts +48 -0
  102. package/dist/types/sdk/src/commerce/ecommerce/use-product-grid-filter.d.ts +17 -0
  103. package/dist/types/sdk/src/commerce/ecommerce/use-selected-variants-state.d.ts +8 -0
  104. package/dist/types/sdk/src/commerce/ecommerce/use-wishlist-drawer.d.ts +34 -0
  105. package/dist/types/sdk/src/commerce/ecommerce/variant-option-axes.d.ts +56 -0
  106. package/dist/types/sdk/src/commerce/ecommerce/variant-resolution.d.ts +83 -0
  107. package/dist/types/sdk/src/commerce/ecommerce/variant-selection.d.ts +22 -0
  108. package/dist/types/sdk/src/commerce/external-navigation.d.ts +41 -0
  109. package/dist/types/sdk/src/commerce/index.d.ts +9 -0
  110. package/dist/types/sdk/src/commerce/option-selection-store.d.ts +8 -0
  111. package/dist/types/sdk/src/commerce/pending-variant-choice-store.d.ts +20 -0
  112. package/dist/types/sdk/src/commerce/variant-selection-store.d.ts +7 -0
  113. package/dist/types/sdk/src/content/index.d.ts +2 -0
  114. package/dist/types/sdk/src/content/use-faq-accordion.d.ts +11 -0
  115. package/dist/types/sdk/src/content/use-newsletter-form.d.ts +16 -0
  116. package/dist/types/sdk/src/host/Spacefront.d.ts +11 -0
  117. package/dist/types/sdk/src/host/engine-loader.d.ts +14 -0
  118. package/dist/types/sdk/src/host/host-modules.d.ts +5833 -0
  119. package/dist/types/sdk/src/host/index.d.ts +4 -0
  120. package/dist/types/sdk/src/host/types.d.ts +52 -0
  121. package/dist/types/sdk/src/index.d.ts +21 -0
  122. package/dist/types/sdk/src/interaction/haptics.d.ts +8 -0
  123. package/dist/types/sdk/src/interaction/index.d.ts +3 -0
  124. package/dist/types/sdk/src/interaction/normalize-signals.d.ts +8 -0
  125. package/dist/types/sdk/src/interaction/withInteractionTracking.d.ts +48 -0
  126. package/dist/types/sdk/src/npm.d.ts +3 -0
  127. package/dist/types/sdk/src/projection/ProjectionSignalBridge.d.ts +5 -0
  128. package/dist/types/sdk/src/projection/index.d.ts +1 -0
  129. package/dist/types/sdk/src/projection/preferences.d.ts +12 -0
  130. package/dist/types/sdk/src/projection/transform.d.ts +7 -0
  131. package/dist/types/sdk/src/provider/AgentAsk.d.ts +16 -0
  132. package/dist/types/sdk/src/provider/index.d.ts +4 -0
  133. package/dist/types/sdk/src/provider/providers/handler-registry.d.ts +11 -0
  134. package/dist/types/sdk/src/provider/use-clamp-toggle.d.ts +22 -0
  135. package/dist/types/sdk/src/provider/use-timed-flag.d.ts +16 -0
  136. package/dist/types/sdk/src/rendering/index.d.ts +1 -0
  137. package/dist/types/sdk/src/rendering/post-hydration.d.ts +37 -0
  138. package/dist/types/sdk/src/session/FourtySessionContext.d.ts +228 -0
  139. package/dist/types/sdk/src/session/clear-registry.d.ts +6 -0
  140. package/dist/types/sdk/src/session/index.d.ts +4 -0
  141. package/dist/types/sdk/src/session/use-action.d.ts +25 -0
  142. package/dist/types/sdk/src/session/visitor-locale.d.ts +2 -0
  143. package/dist/types/sdk/src/shared/index.d.ts +2 -0
  144. package/dist/types/sdk/src/shared/use-expandable.d.ts +9 -0
  145. package/dist/types/sdk/src/shared/use-image-hover.d.ts +13 -0
  146. package/dist/types/sdk/src/shell/ScrollContainerContext.d.ts +25 -0
  147. package/dist/types/sdk/src/shell/ShellRegistry.d.ts +25 -0
  148. package/dist/types/sdk/src/shell/ShellRootContext.d.ts +15 -0
  149. package/dist/types/sdk/src/shell/dock-persistence.d.ts +49 -0
  150. package/dist/types/sdk/src/shell/exclusive-overlay.d.ts +16 -0
  151. package/dist/types/sdk/src/shell/index.d.ts +12 -0
  152. package/dist/types/sdk/src/shell/thread-scroll/ThreadHeadroom.d.ts +11 -0
  153. package/dist/types/sdk/src/shell/thread-scroll/headroom.d.ts +4 -0
  154. package/dist/types/sdk/src/shell/thread-scroll/index.d.ts +6 -0
  155. package/dist/types/sdk/src/shell/thread-scroll/pin-turn-head.d.ts +12 -0
  156. package/dist/types/sdk/src/shell/thread-scroll/settle-thread-row.d.ts +23 -0
  157. package/dist/types/sdk/src/shell/thread-scroll/thread-geometry.d.ts +27 -0
  158. package/dist/types/sdk/src/shell/thread-scroll/thread-row-attr.d.ts +4 -0
  159. package/dist/types/sdk/src/shell/thread-scroll/use-pin-turn-to-top.d.ts +22 -0
  160. package/dist/types/sdk/src/shell/thread-scroll/use-scroll-has-more-below.d.ts +19 -0
  161. package/dist/types/sdk/src/shell/thread-scroll/use-thread-jump-marks.d.ts +28 -0
  162. package/dist/types/sdk/src/shell/thread-scroll/use-thread-landing.d.ts +1 -0
  163. package/dist/types/sdk/src/shell/use-composer-chip-select.d.ts +21 -0
  164. package/dist/types/sdk/src/shell/use-go-home.d.ts +11 -0
  165. package/dist/types/sdk/src/shell/use-hydrated.d.ts +19 -0
  166. package/dist/types/sdk/src/shell/use-menu-item-select.d.ts +13 -0
  167. package/dist/types/sdk/src/shell/use-overridable-toggle.d.ts +24 -0
  168. package/dist/types/sdk/src/shell/use-thread-rows.d.ts +41 -0
  169. package/dist/types/sdk/src/social/index.d.ts +2 -0
  170. package/dist/types/sdk/src/social/use-review-helpful.d.ts +10 -0
  171. package/dist/types/sdk/src/social/use-testimonials-carousel.d.ts +15 -0
  172. package/dist/types/sdk/src/utils/core-utils/format-distance.d.ts +6 -0
  173. package/dist/types/sdk/src/utils/core-utils/format-price.d.ts +7 -0
  174. package/dist/types/sdk/src/utils/core-utils/index.d.ts +10 -0
  175. package/dist/types/sdk/src/utils/core-utils/inject-google-fonts.d.ts +17 -0
  176. package/dist/types/sdk/src/utils/core-utils/is-on-sale.d.ts +6 -0
  177. package/dist/types/sdk/src/utils/core-utils/is-video-url.d.ts +6 -0
  178. package/dist/types/sdk/src/utils/core-utils/maps-directions-url.d.ts +5 -0
  179. package/dist/types/sdk/src/utils/core-utils/mint-id.d.ts +10 -0
  180. package/dist/types/sdk/src/utils/core-utils/resolve-swatch-color.d.ts +2 -0
  181. package/dist/types/sdk/src/utils/core-utils/validate-all.d.ts +13 -0
  182. package/dist/types/sdk/src/utils/index.d.ts +10 -0
  183. package/dist/types/sdk/src/utils/storage.d.ts +9 -0
  184. package/dist/types/sdk/src/utils/use-document-visible.d.ts +9 -0
  185. package/dist/types/sdk/src/utils/use-form-factor.d.ts +24 -0
  186. package/dist/types/sdk/src/utils/use-inline-completion.d.ts +48 -0
  187. package/dist/types/sdk/src/utils/use-interval.d.ts +7 -0
  188. package/dist/types/sdk/src/utils/use-success-flash.d.ts +35 -0
  189. package/dist/types/sdk/src/utils/use-wake-lock.d.ts +15 -0
  190. package/dist/types/sdk/src/utils/viewport-window.d.ts +39 -0
  191. package/dist/types/sdk/src/voice/index.d.ts +2 -0
  192. package/dist/types/sdk/src/voice/use-dictation.d.ts +80 -0
  193. package/dist/types/sdk/src/voice/use-voice-capture.d.ts +65 -0
  194. package/dist/types/sdk/src/widgets/presence/core-presence/fact-form-registry.d.ts +43 -0
  195. package/dist/types/sdk/src/widgets/presence/core-presence/fact-shape.d.ts +70 -0
  196. package/dist/types/sdk/src/widgets/presence/core-presence/form-registry.d.ts +28 -0
  197. package/dist/types/sdk/src/widgets/presence/core-presence/knowledge.d.ts +18 -0
  198. package/dist/types/sdk/src/widgets/presence/core-presence/presence-restore.d.ts +13 -0
  199. package/dist/types/sdk/src/widgets/presence/core-presence/presence-stream.d.ts +64 -0
  200. package/dist/types/sdk/src/widgets/presence/core-presence/source-form-registry.d.ts +129 -0
  201. package/dist/types/sdk/src/widgets/presence/core-presence/standing-signal-store.d.ts +19 -0
  202. package/dist/types/sdk/src/widgets/presence/flows/flow-store.d.ts +22 -0
  203. package/dist/types/sdk/src/widgets/presence/index.d.ts +17 -0
  204. package/dist/types/sdk/src/widgets/presence/runtime-context.d.ts +109 -0
  205. package/dist/types/sdk/src/widgets/presence/use-layout-entity-ids.d.ts +12 -0
  206. package/dist/types/sdk/src/widgets/presence/use-optimistic-facts.d.ts +43 -0
  207. package/dist/types/sdk/src/widgets/presence/use-optimistic-flow-set.d.ts +24 -0
  208. package/dist/types/sdk/src/widgets/presence/use-presence-notch.d.ts +75 -0
  209. package/dist/types/sdk/src/widgets/presence/use-presence.d.ts +45 -0
  210. package/dist/types/sdk/src/widgets/presence/use-standing-signal.d.ts +12 -0
  211. package/dist/types/spacestation/src/analytics/catalog.d.ts +89 -0
  212. package/dist/types/spacestation/src/analytics/ecommerce/events.d.ts +183 -0
  213. package/dist/types/spacestation/src/analytics/ecommerce/funnel.d.ts +22 -0
  214. package/dist/types/spacestation/src/analytics/ecommerce/index.d.ts +14 -0
  215. package/dist/types/spacestation/src/analytics/ecommerce/surfacing.d.ts +42 -0
  216. package/dist/types/spacestation/src/analytics/envelope.d.ts +222 -0
  217. package/dist/types/spacestation/src/analytics/index.d.ts +28 -0
  218. package/dist/types/spacestation/src/analytics/kind.d.ts +155 -0
  219. package/dist/types/spacestation/src/analytics/session.d.ts +35 -0
  220. package/dist/types/spacestation/src/attachment/attachment.d.ts +83 -0
  221. package/dist/types/spacestation/src/catalog/attribute-registry.d.ts +148 -0
  222. package/dist/types/spacestation/src/catalog/attribute-scope.d.ts +41 -0
  223. package/dist/types/spacestation/src/catalog/canvas-arrangement.d.ts +43 -0
  224. package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +264 -0
  225. package/dist/types/spacestation/src/catalog/config.d.ts +13 -0
  226. package/dist/types/spacestation/src/catalog/derive-props-doc.d.ts +11 -0
  227. package/dist/types/spacestation/src/catalog/element-filled.d.ts +77 -0
  228. package/dist/types/spacestation/src/catalog/entity-refs.d.ts +14 -0
  229. package/dist/types/spacestation/src/catalog/function-props.d.ts +23 -0
  230. package/dist/types/spacestation/src/catalog/hydration-paths.d.ts +19 -0
  231. package/dist/types/spacestation/src/catalog/prose.d.ts +60 -0
  232. package/dist/types/spacestation/src/catalog/ref-sites.d.ts +45 -0
  233. package/dist/types/spacestation/src/catalog/required-props.d.ts +31 -0
  234. package/dist/types/spacestation/src/catalog/resolved.d.ts +145 -0
  235. package/dist/types/spacestation/src/catalog/structural-baseline.d.ts +7 -0
  236. package/dist/types/spacestation/src/catalog/wire/catalog-wire.d.ts +191 -0
  237. package/dist/types/spacestation/src/catalog/wire/index.d.ts +5 -0
  238. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +351 -0
  239. package/dist/types/spacestation/src/catalog/wire/schema-from-wire.d.ts +7 -0
  240. package/dist/types/spacestation/src/catalog/wire/schema-to-wire.d.ts +8 -0
  241. package/dist/types/spacestation/src/catalog/wire/wire-schema.d.ts +78 -0
  242. package/dist/types/spacestation/src/commerce/cart-add-signal.d.ts +125 -0
  243. package/dist/types/spacestation/src/commerce/cart-state.d.ts +87 -0
  244. package/dist/types/spacestation/src/commerce/cart-verb-signals.d.ts +80 -0
  245. package/dist/types/spacestation/src/commerce/page-kinds.d.ts +40 -0
  246. package/dist/types/spacestation/src/commerce/selection-signal.d.ts +25 -0
  247. package/dist/types/spacestation/src/contracts/entry-context.d.ts +35 -0
  248. package/dist/types/spacestation/src/contracts/knowledge/index.d.ts +12 -0
  249. package/dist/types/spacestation/src/contracts/knowledge/types.d.ts +238 -0
  250. package/dist/types/spacestation/src/contracts/retrieval/core/knowledge-source.d.ts +36 -0
  251. package/dist/types/spacestation/src/contracts/retrieval/core/platform-connector.d.ts +49 -0
  252. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/articles/source.d.ts +3 -0
  253. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/articles/types.d.ts +29 -0
  254. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/client.d.ts +238 -0
  255. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/collections/source.d.ts +3 -0
  256. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/collections/types.d.ts +23 -0
  257. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/connector.d.ts +11 -0
  258. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/domains.d.ts +27 -0
  259. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/faq/source.d.ts +3 -0
  260. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/faq/types.d.ts +21 -0
  261. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/option-values.d.ts +71 -0
  262. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/policies/source.d.ts +3 -0
  263. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/policies/types.d.ts +18 -0
  264. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/products/source.d.ts +5 -0
  265. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/products/types.d.ts +47 -0
  266. package/dist/types/spacestation/src/contracts/retrieval/index.d.ts +25 -0
  267. package/dist/types/spacestation/src/contracts/session-arrival-params.d.ts +32 -0
  268. package/dist/types/spacestation/src/contracts/session-arrival.d.ts +215 -0
  269. package/dist/types/spacestation/src/contracts/tools/definitions.d.ts +139 -0
  270. package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +135 -0
  271. package/dist/types/spacestation/src/contracts/tools/index.d.ts +9 -0
  272. package/dist/types/spacestation/src/contracts/tools/types.d.ts +163 -0
  273. package/dist/types/spacestation/src/focus/focus.d.ts +12 -0
  274. package/dist/types/spacestation/src/hydration/hydration.d.ts +46 -0
  275. package/dist/types/spacestation/src/index.d.ts +71 -0
  276. package/dist/types/spacestation/src/layout/apply-patch.d.ts +17 -0
  277. package/dist/types/spacestation/src/layout/conversation.d.ts +136 -0
  278. package/dist/types/spacestation/src/layout/layout-diff.d.ts +17 -0
  279. package/dist/types/spacestation/src/layout/layout.d.ts +275 -0
  280. package/dist/types/spacestation/src/layout/page.d.ts +244 -0
  281. package/dist/types/spacestation/src/layout/patch.d.ts +92 -0
  282. package/dist/types/spacestation/src/layout/reduce-patch.d.ts +19 -0
  283. package/dist/types/spacestation/src/layout/reserved-ids.d.ts +13 -0
  284. package/dist/types/spacestation/src/projection/projection.d.ts +249 -0
  285. package/dist/types/spacestation/src/shell/shell.d.ts +109 -0
  286. package/dist/types/spacestation/src/signal/agent-signals.d.ts +539 -0
  287. package/dist/types/spacestation/src/space/connector.d.ts +61 -0
  288. package/dist/types/spacestation/src/space/generation-job.d.ts +4 -0
  289. package/dist/types/spacestation/src/space/hosting.d.ts +36 -0
  290. package/dist/types/spacestation/src/space/manifest.d.ts +8 -0
  291. package/dist/types/spacestation/src/space/package-version.d.ts +18 -0
  292. package/dist/types/spacestation/src/space/package.d.ts +35 -0
  293. package/dist/types/spacestation/src/space/prompt-config.d.ts +17 -0
  294. package/dist/types/spacestation/src/space/session-activity.d.ts +71 -0
  295. package/dist/types/spacestation/src/space/session-queue.d.ts +2147 -0
  296. package/dist/types/spacestation/src/space/space-config.d.ts +96 -0
  297. package/dist/types/spacestation/src/space/space-otp.d.ts +18 -0
  298. package/dist/types/spacestation/src/space/space.d.ts +104 -0
  299. package/dist/types/spacestation/src/space/tool-manifest.d.ts +8 -0
  300. package/dist/types/spacestation/src/space/trace.d.ts +555 -0
  301. package/dist/types/spacestation/src/space/workspace-catalog.d.ts +112 -0
  302. package/dist/types/spacestation/src/tool-compression/compress.d.ts +88 -0
  303. package/dist/types/spacestation/src/tool-compression/index.d.ts +11 -0
  304. package/dist/types/spacestation/src/tool-compression/scoring.d.ts +38 -0
  305. package/dist/types/spacestation/src/tool-compression/tokenize.d.ts +29 -0
  306. package/dist/types/spacestation/src/trace/trace-data.d.ts +126 -0
  307. package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +224 -0
  308. package/dist/types/spacestation/src/trace/trace-envelopes.d.ts +144 -0
  309. package/dist/types/spacestation/src/trace/trace-events.d.ts +450 -0
  310. package/dist/types/spacestation/src/types.d.ts +253 -0
  311. package/dist/types/spacestation/src/view/continuation.d.ts +45 -0
  312. package/dist/types/spacestation/src/widgets/presence/element.d.ts +241 -0
  313. package/dist/types/spacestation/src/widgets/presence/frame.d.ts +56 -0
  314. package/dist/types/spacestation/src/widgets/presence/index.d.ts +4 -0
  315. package/dist/types/spacestation/src/widgets/presence/profile.d.ts +75 -0
  316. package/dist/types/spacestation/src/widgets/presence/scan.d.ts +45 -0
  317. package/package.json +43 -0
@@ -0,0 +1,155 @@
1
+ /**
2
+ * An event kind is a VALUE, not a string.
3
+ *
4
+ * `defineEventKind(name, trust, schema)` returns a token whose payload type is
5
+ * INFERRED from its Zod schema. A call site imports the token and gets its
6
+ * payload checked by the compiler with no lookup table, no `declare module`, no
7
+ * module-load registration, and no global mutable map. `emit(KIND, payload)`
8
+ * therefore rejects a wrong payload, and a bare string is not a kind at all.
9
+ *
10
+ * ── WHY A TOKEN AND NOT DECLARATION MERGING ────────────────────────────────
11
+ *
12
+ * `layout/page.ts:58-65` is the repo's best prior art for an open set with full
13
+ * payload inference, and it was built and compiled for this contract before
14
+ * being rejected. Two hazards tokens do not have:
15
+ *
16
+ * 1. THE UNION IS PROGRAM-DEPENDENT. The identical handler compiles clean
17
+ * when a brand's augmentation file is out of the program and fails when it
18
+ * is in. `packages/sdk`'s own typecheck would see a different emittable
19
+ * union than `apps/api`'s, and an exhaustive switch that is exhaustive in
20
+ * one package and not in another is not a contract.
21
+ * 2. AUGMENTATION IS GLOBAL, SO BRANDS LEAK INTO EACH OTHER. A brand file
22
+ * importing only the contract could name another brand's kind with full
23
+ * type safety. Under tokens the same code cannot name it (TS2345).
24
+ *
25
+ * Merging also needs a module-load side-effect registry, which is the exposure
26
+ * `packages/sdk/src/catalog/hydrator-registry.ts:15-35` documents (Turbopack
27
+ * evaluates a module more than once per process) and whose fix there needed a
28
+ * `globalThis as unknown as` cast. A browser looks nothing up here.
29
+ *
30
+ * `docs/architecture-invariants.md:226-231` carves out "open-extension
31
+ * CONTRACTS for verticals" from the closed-union rule. An open SET of names,
32
+ * each with a CLOSED payload, is that carve-out — not a violation of it — and
33
+ * it adds no tenth registry to §IX: the server's catalog is a value passed to a
34
+ * function, assembled explicitly like `apps/api/src/lib/register-catalogs.ts`.
35
+ *
36
+ * ── WHY PAYLOADS ARE FLAT, STRICT OBJECTS ──────────────────────────────────
37
+ *
38
+ * This is a RULE of the contract, enforced three ways below, not a habit. Three
39
+ * measured reasons:
40
+ *
41
+ * (a) `.strict()` is TOP-LEVEL ONLY in zod 3 (verified on this repo's
42
+ * 3.25.76): a nested non-strict object lets `{ meta: { SECRET } }` ride
43
+ * through untouched, into a `jsonb` column, on a PUBLIC endpoint.
44
+ * (b) Because a strict parse REJECTS an unknown key rather than stripping it,
45
+ * a successful parse of a flat strict object proves the parsed value and
46
+ * the bytes the browser sent are the same value. That is what lets
47
+ * `catalogEventSchema` narrow with `z.custom` — which passes its input
48
+ * through unstripped — without that becoming a hole (see `catalog.ts`).
49
+ * (c) An OPTIONAL field is banned as a side effect, and deliberately: a
50
+ * `productId?: string` can be forgotten at a call site, while a required
51
+ * `productId: string | null` forces the site to DECIDE. The whole reason
52
+ * `origin` exists is that an absent actor silently reads as "the agent
53
+ * contributed zero".
54
+ */
55
+ import { z } from 'zod';
56
+ /**
57
+ * Who is permitted to ASSERT this event.
58
+ *
59
+ * `client` — a browser may emit it; ingest accepts it from a public session
60
+ * credential and stores it with `source = 'client'`.
61
+ * `server` — only server-side code may assert it (a webhook, a job, a
62
+ * post-checkout reconciliation). A browser call site cannot NAME one: the
63
+ * emit surface accepts `ClientEventKind` and a `'server'` token is not
64
+ * assignable to it, so the refusal is a compile error and never a runtime
65
+ * check that someone forgets to write.
66
+ */
67
+ export type EventTrust = 'client' | 'server';
68
+ export interface EventKind<Name extends string, Payload, Trust extends EventTrust> {
69
+ readonly name: Name;
70
+ readonly trust: Trust;
71
+ /**
72
+ * Input is `unknown` because the input IS the wire — an arbitrary JSON value
73
+ * off a public endpoint. Output is this kind's payload.
74
+ */
75
+ readonly schema: z.ZodType<Payload, z.ZodTypeDef, unknown>;
76
+ }
77
+ /** Any kind, whoever may assert it. The wide type the server's catalog stores. */
78
+ export type AnyEventKind = EventKind<string, unknown, EventTrust>;
79
+ /** The subset a browser may assert. The SDK's `emit` accepts only these. */
80
+ export type ClientEventKind = EventKind<string, unknown, 'client'>;
81
+ export type PayloadOf<Kind extends AnyEventKind> = Kind extends EventKind<string, infer Payload, EventTrust> ? Payload : never;
82
+ export type NameOf<Kind extends AnyEventKind> = Kind extends EventKind<infer Name, unknown, EventTrust> ? Name : never;
83
+ /**
84
+ * INVARIANT type equality. Assignability alone is not enough here: a
85
+ * `.default()` field makes a schema's INPUT merely a supertype of its OUTPUT,
86
+ * which passes every variance check while quietly meaning two different shapes.
87
+ */
88
+ export type Identical<Left, Right> = (<T>() => T extends Left ? 1 : 2) extends <T>() => T extends Right ? 1 : 2 ? true : false;
89
+ /**
90
+ * A payload value, flat. Every field is a scalar the wire can carry verbatim
91
+ * and a `jsonb` column can hold without nesting.
92
+ *
93
+ * `undefined` is deliberately absent, which is what makes an OPTIONAL field a
94
+ * compile error: `{ productId?: string }` has property type `string | undefined`
95
+ * and does not extend this. Required-and-nullable is the only way to express
96
+ * "this call site may not know" — and it is one the reviewer can see.
97
+ */
98
+ type FlatPayload = Record<string, string | number | boolean | null>;
99
+ /** The two refusals the `guard` rest-parameter can raise, as literal strings so
100
+ * the compiler prints the reason at the call site rather than "expected 4
101
+ * arguments, got 3" with nothing to read. */
102
+ type TransformRefusal = [error: 'A wire payload schema must not transform, default or coerce its input'];
103
+ type OptionalRefusal = [error: 'A wire payload field must not be OPTIONAL: use .nullable() so the call site has to decide'];
104
+ type NestingRefusal = [error: 'A wire payload schema must be FLAT: every field a string, number, boolean or null'];
105
+ /**
106
+ * The compile-time proof obligations for a payload schema, evaluated in order:
107
+ * a schema that rewrites its input is not worth a shape complaint, and a shape
108
+ * complaint about a field that is merely optional would point at the wrong
109
+ * problem.
110
+ *
111
+ * The optionality check is `Identical<Out, Required<Out>>` rather than a
112
+ * property walk because `{ productId?: string }` DOES satisfy
113
+ * `Record<string, string | number | boolean | null>` — verified on this repo's
114
+ * tsc: an optional property's `undefined` is ignored when a type literal's
115
+ * implicit index signature is checked. So flatness alone lets an optional field
116
+ * through, and the rule that matters most here would have been the one silently
117
+ * unenforced.
118
+ *
119
+ * EXPORTED so the obligations are ASSERTABLE rather than merely enforced: the
120
+ * type tests pin `PayloadGuard<legal> = []` and `PayloadGuard<illegal> ≠ []`
121
+ * for each refusal. Without that, a future edit that widens this type back to
122
+ * `[]` disables every line of defence and nothing fails.
123
+ */
124
+ export type PayloadGuard<Object extends z.ZodTypeAny> = Identical<z.input<Object>, z.output<Object>> extends true ? Identical<z.output<Object>, Required<z.output<Object>>> extends true ? z.output<Object> extends FlatPayload ? [] : NestingRefusal : OptionalRefusal : TransformRefusal;
125
+ /**
126
+ * Define an event kind.
127
+ *
128
+ * THREE lines of defence, because one is not enough — and the FIRST is the TYPE
129
+ * OF THE `schema` PARAMETER, not a guard and not a CI grep.
130
+ *
131
+ * 1. `z.ZodObject<Shape, 'strict'>` makes "a flat strict object" a COMPILE
132
+ * requirement at the definition site. A non-strict object, a union, an
133
+ * effect-wrapped schema and a coerced schema are all rejected right here.
134
+ * This is what retires the `.strict()` grep an earlier draft relied on: a
135
+ * grep can only find what it is pointed at, and a brand's kinds live outside
136
+ * every `analytics/` directory.
137
+ * 2. The `guard` rest-parameter is EMPTY for a legal schema and demands an
138
+ * impossible argument otherwise. A wire payload schema must be a pure CHECK:
139
+ * what the browser sent is what the row stores. `.transform()`, `.default()`
140
+ * and `.catch()` all make INPUT differ from OUTPUT, and ingest validates
141
+ * without re-deriving the payload, so a transform would silently do nothing.
142
+ * 3. The same guard proves the payload is FLAT and has no optional field, which
143
+ * is what makes reason (a) and reason (c) in this file's header real rather
144
+ * than reviewed.
145
+ *
146
+ * MEASURED LIMIT OF LINE 2, stated because an earlier draft overclaimed it: an
147
+ * IDENTITY-TYPED `.transform()` sails through, because `Identical` only sees the
148
+ * TYPE change. A type-changing transform, a `.default()` and a `.catch()` all
149
+ * fail with TS2554 as intended. `.transform(` and `z.coerce` are therefore ALSO
150
+ * banned by a CI grep over payload files — and note that `ZodObject` above means
151
+ * neither can appear without an explicit cast to something that is not a
152
+ * `ZodObject`, which the house `as` ban forbids expressing.
153
+ */
154
+ export declare function defineEventKind<Name extends string, Shape extends z.ZodRawShape, Trust extends EventTrust>(name: Name, trust: Trust, schema: z.ZodObject<Shape, 'strict'>, ...guard: PayloadGuard<z.ZodObject<Shape, 'strict'>>): EventKind<Name, z.output<z.ZodObject<Shape, 'strict'>>, Trust>;
155
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The visitor engaged with the space, and WHICH signal proved it.
3
+ *
4
+ * `reason` exists so the two halves of the definition stay separable after the
5
+ * fact. They answer different questions about a space — a surface whose
6
+ * engagement is nearly all `dwell` is one people read and never touch, and that
7
+ * is a composition finding, not a bounce-rate one — and once they are merged
8
+ * into a bare boolean, no query can pull them apart again.
9
+ *
10
+ * `dwell` — the page was VISIBLE for the engagement threshold. Visible, not
11
+ * merely open: a tab left in the background for an hour is not attention,
12
+ * and counting it would make the rate a measure of how many tabs people
13
+ * leave open.
14
+ * `click` — the visitor pressed something inside the space. It short-circuits
15
+ * the clock, exactly as the standard definition does: acting on a layout in
16
+ * two seconds is engagement, and waiting out a timer adds nothing.
17
+ *
18
+ * A typed turn is NOT a reason here, and deliberately: the prompt leg is
19
+ * already recorded, at turn grain, by `agent_runs.user_prompt`. Re-asserting it
20
+ * from the browser would put the same fact on two rails that can disagree.
21
+ */
22
+ /**
23
+ * How long the page must be VISIBLE before dwell alone counts as engagement.
24
+ *
25
+ * Ten seconds, the number the analytics industry settled on and the number a
26
+ * merchant comparing this screen to their store reports will assume. It lives
27
+ * on the contract rather than in the emitter because it is the definition of a
28
+ * metric, not a tuning knob: moving it moves every space's bounce rate, and the
29
+ * value belongs where a reader of the contract can see what they are being
30
+ * told.
31
+ */
32
+ export declare const ENGAGEMENT_DWELL_MS = 10000;
33
+ export declare const SESSION_ENGAGED: import("./kind").EventKind<"session.engaged", {
34
+ reason: "dwell" | "click";
35
+ }, "client">;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Attachment contract — the wire shape for a visitor-supplied file the agent
3
+ * consumes as a multimodal message part (paste or attach an image).
4
+ *
5
+ * Transport: upload-on-attach → reference. The bytes are uploaded to storage
6
+ * the moment the visitor attaches the file; only this lightweight `AttachmentRef`
7
+ * rides the `prompt` signal, so send-time / TTFT stays clean. The agent resolves
8
+ * the bytes at turn start and inlines them as image/file parts.
9
+ *
10
+ * One home for the allow-list: both the composer (accept attribute + client
11
+ * pre-check), the upload endpoint (server validation), and any agent-side guard
12
+ * import these constants — never an inline MIME literal.
13
+ */
14
+ import { z } from 'zod';
15
+ /** MIME types the platform accepts as composer attachments — images only.
16
+ * Widen here (e.g. re-add 'application/pdf') to accept more. */
17
+ export declare const ALLOWED_ATTACHMENT_TYPES: readonly ["image/jpeg", "image/png", "image/webp", "image/gif", "image/heic"];
18
+ export type AllowedAttachmentType = (typeof ALLOWED_ATTACHMENT_TYPES)[number];
19
+ /** Hard ceiling per file. 10 MiB. */
20
+ export declare const MAX_ATTACHMENT_BYTES: number;
21
+ /** True when `mime` is on the allow-list. */
22
+ export declare function isAllowedAttachmentType(mime: string): mime is AllowedAttachmentType;
23
+ /** True when `mime` is an image the composer can render as a thumbnail. */
24
+ export declare function isImageAttachment(mime: string): boolean;
25
+ /**
26
+ * A stored attachment, returned by `POST /sessions/:id/attachments` and carried
27
+ * on the `prompt` signal payload (`attachments: AttachmentRef[]`).
28
+ *
29
+ * `url` is a fetchable location for the bytes (Supabase Storage). The agent
30
+ * fetches it at turn start; the composer never renders `url` for image previews
31
+ * (it shows the local object URL it already holds).
32
+ */
33
+ export interface AttachmentRef {
34
+ /** Server-minted id, unique within the session. */
35
+ id: string;
36
+ /** Validated MIME type — always one of `ALLOWED_ATTACHMENT_TYPES`. */
37
+ mimeType: string;
38
+ /** Original filename, for display + the file part's name. */
39
+ name: string;
40
+ /** Byte length — within `MAX_ATTACHMENT_BYTES`. */
41
+ size: number;
42
+ /** Fetchable bytes location (Supabase Storage public/signed URL). */
43
+ url: string;
44
+ }
45
+ export declare const AttachmentRefSchema: z.ZodObject<{
46
+ id: z.ZodString;
47
+ mimeType: z.ZodEffects<z.ZodString, "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "image/heic", string>;
48
+ name: z.ZodString;
49
+ size: z.ZodNumber;
50
+ url: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ id: string;
53
+ name: string;
54
+ mimeType: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "image/heic";
55
+ size: number;
56
+ url: string;
57
+ }, {
58
+ id: string;
59
+ name: string;
60
+ mimeType: string;
61
+ size: number;
62
+ url: string;
63
+ }>;
64
+ /** Boundary parser for the `prompt` signal's `attachments` field. */
65
+ export declare const AttachmentRefsSchema: z.ZodArray<z.ZodObject<{
66
+ id: z.ZodString;
67
+ mimeType: z.ZodEffects<z.ZodString, "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "image/heic", string>;
68
+ name: z.ZodString;
69
+ size: z.ZodNumber;
70
+ url: z.ZodString;
71
+ }, "strip", z.ZodTypeAny, {
72
+ id: string;
73
+ name: string;
74
+ mimeType: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "image/heic";
75
+ size: number;
76
+ url: string;
77
+ }, {
78
+ id: string;
79
+ name: string;
80
+ mimeType: string;
81
+ size: number;
82
+ url: string;
83
+ }>, "many">;
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Attribute registry — wire-level types.
3
+ *
4
+ * Each space declares its own closed-core list of attribute names plus an
5
+ * optional free-form `extras` bucket. Loaded at session init; consumed
6
+ * by the foreground agent prompt and by the knowledge-store validator.
7
+ *
8
+ * No runtime here. Validator implementation lives in
9
+ * `@fourty/agent/attribute-registry`.
10
+ *
11
+ * See CONSTITUTION.md §2 (Attribute registry) and the narrative-engine
12
+ * design doc §2.1.
13
+ */
14
+ import { z } from 'zod';
15
+ /**
16
+ * Attribute-scope config — the vertical-agnostic recipe for turning an entity
17
+ * facet into a scoped attribute key. The agent core NEVER hardcodes a vertical's
18
+ * bucketing (§VIII); the active vertical supplies this config and the agent
19
+ * applies it generically. Example: ecommerce maps the `productType` facet to
20
+ * shoes/bags/apparel so a "size 8" shoe fact doesn't collide with a dress.
21
+ *
22
+ * facet — which entity `meta` field scopes the attribute ('productType')
23
+ * buckets — ordered; the first bucket whose needle is a substring of
24
+ * the lowercased facet value wins
25
+ * emptyScope — scope used when the facet value is missing/empty
26
+ * noMatchScope — scope used when no bucket needle matches
27
+ * ignoreValues — option values too generic to persist (lowercased)
28
+ *
29
+ * `label` (per bucket) / `emptyScopeLabel` / `noMatchScopeLabel` — the
30
+ * human-facing noun this bucket reads as ("Shoe", "Bag"), used to prefix an
31
+ * auto-derived slot's DISPLAY label ("Shoe Size", not the raw Shopify option
32
+ * name "Size" a merchant used identically across every category). Optional:
33
+ * a bucket that declares none falls back to the bare option name, which is
34
+ * the entire slot's behavior before this field existed — no regression for a
35
+ * scope config that doesn't bother. The KEY stays scoped either way
36
+ * (`shoes_size` never collides with `bags_size`); this only fixes what a
37
+ * VISITOR reads, since "Size: 9" with no category is exactly as ambiguous to
38
+ * a person as it would be to the storage layer without the key scoping.
39
+ */
40
+ export declare const AttributeScopeBucketSchema: z.ZodObject<{
41
+ scope: z.ZodString;
42
+ needles: z.ZodReadonly<z.ZodArray<z.ZodString, "many">>;
43
+ label: z.ZodOptional<z.ZodString>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ scope: string;
46
+ needles: readonly string[];
47
+ label?: string | undefined;
48
+ }, {
49
+ scope: string;
50
+ needles: readonly string[];
51
+ label?: string | undefined;
52
+ }>;
53
+ export declare const AttributeScopeConfigSchema: z.ZodObject<{
54
+ facet: z.ZodString;
55
+ buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
56
+ scope: z.ZodString;
57
+ needles: z.ZodReadonly<z.ZodArray<z.ZodString, "many">>;
58
+ label: z.ZodOptional<z.ZodString>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ scope: string;
61
+ needles: readonly string[];
62
+ label?: string | undefined;
63
+ }, {
64
+ scope: string;
65
+ needles: readonly string[];
66
+ label?: string | undefined;
67
+ }>, "many">>;
68
+ emptyScope: z.ZodString;
69
+ noMatchScope: z.ZodString;
70
+ ignoreValues: z.ZodReadonly<z.ZodArray<z.ZodString, "many">>;
71
+ emptyScopeLabel: z.ZodOptional<z.ZodString>;
72
+ noMatchScopeLabel: z.ZodOptional<z.ZodString>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ facet: string;
75
+ buckets: readonly {
76
+ scope: string;
77
+ needles: readonly string[];
78
+ label?: string | undefined;
79
+ }[];
80
+ emptyScope: string;
81
+ noMatchScope: string;
82
+ ignoreValues: readonly string[];
83
+ emptyScopeLabel?: string | undefined;
84
+ noMatchScopeLabel?: string | undefined;
85
+ }, {
86
+ facet: string;
87
+ buckets: readonly {
88
+ scope: string;
89
+ needles: readonly string[];
90
+ label?: string | undefined;
91
+ }[];
92
+ emptyScope: string;
93
+ noMatchScope: string;
94
+ ignoreValues: readonly string[];
95
+ emptyScopeLabel?: string | undefined;
96
+ noMatchScopeLabel?: string | undefined;
97
+ }>;
98
+ export type AttributeScopeBucket = z.infer<typeof AttributeScopeBucketSchema>;
99
+ export type AttributeScopeConfig = z.infer<typeof AttributeScopeConfigSchema>;
100
+ /**
101
+ * Per-attribute metadata shared by every def kind. `durable` marks the slot
102
+ * as IDENTITY knowledge — still true about this visitor next month (a size,
103
+ * a standing style lean) — as opposed to situational context (the occasion
104
+ * they're shopping for today). The dossier renders durable slots as
105
+ * profile-tier memory the moment they're confirmed, without waiting for a
106
+ * session boundary to prove they carry. Declared per-slot by the space /
107
+ * vertical registry — the platform never hardcodes which slots are
108
+ * identity (§VIII: config as data).
109
+ */
110
+ type AttributeDefBase = {
111
+ description?: string;
112
+ durable?: boolean;
113
+ /**
114
+ * The words this slot is CALLED — its display label.
115
+ *
116
+ * The key is scoped (`shoes.color`), so humanising it yields "shoes color":
117
+ * words nobody used, which never match what a model writes for the same idea
118
+ * ("Color"). Declaring the label keeps the slot recognisable by the name it
119
+ * already has. Absent means "not declared" and readers fall back to the
120
+ * derived form, which is what every slot did before this existed.
121
+ */
122
+ label?: string;
123
+ };
124
+ export type AttributeDef = ({
125
+ kind: 'enum';
126
+ values: readonly string[];
127
+ } & AttributeDefBase) | ({
128
+ kind: 'free_text';
129
+ } & AttributeDefBase) | ({
130
+ kind: 'date_or_season';
131
+ } & AttributeDefBase) | ({
132
+ kind: 'money_or_band';
133
+ } & AttributeDefBase) | ({
134
+ kind: 'number';
135
+ min?: number;
136
+ max?: number;
137
+ unit?: string;
138
+ } & AttributeDefBase);
139
+ export declare const AttributeDefSchema: z.ZodType<AttributeDef>;
140
+ export type AttributeRegistry = {
141
+ space_id: string;
142
+ attributes: Record<string, AttributeDef>;
143
+ extras_allowed: boolean;
144
+ updated_at: string;
145
+ };
146
+ /** Convention: free-form attribute keys live under this prefix. */
147
+ export declare const EXTRAS_PREFIX = "extras.";
148
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Attribute-scope resolver — the vertical-agnostic runtime that turns an
3
+ * `AttributeScopeConfig` (declared by the active vertical, threaded in by the
4
+ * composition layer) into a scoped attribute key.
5
+ *
6
+ * The agent core NEVER hardcodes a vertical's bucketing (`docs/architecture-
7
+ * invariants.md` §VIII): it receives the config as DATA and applies it through
8
+ * these pure helpers. The config form lives in the vertical package (e.g.
9
+ * `ECOMMERCE_ATTRIBUTE_SCOPE` in `@fourty/ecommerce`); this file holds only the
10
+ * generic mechanics, so it carries no `shoes`/`bags`/`apparel` vocabulary.
11
+ *
12
+ * Both writers (the agent's attribute-registry auto-builder + click-path
13
+ * observer) and the vertical-side readers compose keys through the same
14
+ * `scopedAttributeKey`, so a "size 8" fact written on a PDP click resolves to
15
+ * the same key the registry enumerates.
16
+ */
17
+ import type { AttributeScopeConfig } from './attribute-registry';
18
+ /**
19
+ * Resolve a facet value (e.g. a product's `productType`) to its scope label
20
+ * per the config's ordered needle rules. Empty/missing facet → `emptyScope`;
21
+ * no needle match → `noMatchScope`. The first bucket whose needle is a
22
+ * substring of the lowercased facet value wins (order matters in the config).
23
+ */
24
+ export declare function resolveScope(config: AttributeScopeConfig, facetValue: string | undefined | null): string;
25
+ /**
26
+ * Canonicalize an option name to a snake_case attribute field
27
+ * (`Shoe Size` → `shoe_size`, `Color/Pattern` → `color_pattern`). Empty
28
+ * after normalization (e.g. `---`) returns `''` so callers can drop it.
29
+ */
30
+ export declare function normalizeAttributeField(name: string): string;
31
+ /** Compose a scoped attribute key from a scope label + option name. */
32
+ export declare function scopedAttributeKey(scope: string, optionName: string): string;
33
+ /**
34
+ * Inverse of `scopedAttributeKey`'s prefixing: which scope bucket does an
35
+ * attribute KEY belong to? Matches the key's leading `<scope>_` against the
36
+ * config's declared scopes (buckets + the empty/no-match labels) — longest
37
+ * scope wins so an underscore-bearing scope can't be shadowed by a shorter
38
+ * one. `undefined` = the key carries no scope (a universal fact like
39
+ * `budget` or `event_type`, relevant in every context).
40
+ */
41
+ export declare function scopeOfAttributeKey(config: AttributeScopeConfig, key: string): string | undefined;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Canvas arrangement — how the engine lays the agent's top-level blocks out.
3
+ *
4
+ * The agent composes a flat, ordered block list (the wire never carries
5
+ * placement). A brand chooses how that list is ARRANGED:
6
+ * - 'stack' (default) — one block per row, as every space renders today.
7
+ * - 'bento' — a 12-column grid; each block's catalog `size` decides its
8
+ * share of a row and `packRows` fills rows in order.
9
+ *
10
+ * Placement is derived, never authored, so it costs the agent nothing and
11
+ * cannot drift between turns.
12
+ */
13
+ export declare const CANVAS_BLOCK_SIZES: readonly ["full", "wide", "half", "narrow"];
14
+ export type CanvasBlockSize = (typeof CANVAS_BLOCK_SIZES)[number];
15
+ export declare const CANVAS_ARRANGEMENTS: readonly ["stack", "bento"];
16
+ export type CanvasArrangement = (typeof CANVAS_ARRANGEMENTS)[number];
17
+ export declare const CANVAS_GRID_COLUMNS = 12;
18
+ /** Where one block sits: its CSS `grid-column`. */
19
+ export interface BlockPlacement {
20
+ column: string;
21
+ }
22
+ /**
23
+ * Column span per block, in order, on a plain bento (no rail). Rows fill left
24
+ * to right; a block that does not fit closes the row.
25
+ *
26
+ * The last row stretches too, even while the list is still streaming: a lone
27
+ * block fills its row from the frame it lands, and its width changes only
28
+ * when a partner arrives to share the row — at an arrival the eye is already
29
+ * on. Holding the row at natural spans for a partner that may never come
30
+ * instead moved the block when the next block or the end of the turn
31
+ * stretched it, with nothing arriving to explain the change.
32
+ */
33
+ export declare function packRows(sizes: readonly CanvasBlockSize[]): number[];
34
+ /** Where every block goes, as grid placements (see `packRows`). */
35
+ export declare function placeBlocks(sizes: readonly CanvasBlockSize[]): BlockPlacement[];
36
+ /**
37
+ * How many leading blocks have a DECIDED row while the list is still
38
+ * streaming. A trailing row with columns to spare may yet take a partner, and
39
+ * a partner changes its blocks' widths — so those blocks wait, and land with
40
+ * their partner (or alone, once the next block or the end of the list shows
41
+ * none is coming) at the width they keep. A full row is decided as it lands.
42
+ */
43
+ export declare function settledBlocks(sizes: readonly CanvasBlockSize[]): number;