@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,88 @@
1
+ /**
2
+ * Generic LLM-facing compression primitives.
3
+ *
4
+ * Two responsibilities, both pure / sync / allocation-light:
5
+ * - `compressString` — sentence-rank a string against a `Scorer`,
6
+ * keep top-K relevant sentences.
7
+ * - `compressArray` — filter an array against a `Scorer`,
8
+ * keep top-K relevant entries.
9
+ *
10
+ * Verbs compose these with their own row-walking + ranking. A verb
11
+ * owns its result shape — search_catalog knows "I return rows with a
12
+ * meta bag"; search_policies knows "I return a single text blob". The
13
+ * compressor here doesn't decide; it provides the primitives.
14
+ *
15
+ * The `Scorer` is pluggable (see `scoring.ts`). Default is token-overlap;
16
+ * tomorrow an embedding-similarity or LLM-judge scorer can slot in.
17
+ */
18
+ import type { Scorer } from './scoring';
19
+ export interface CompressStringOpts {
20
+ /** Top-K sentences kept. Three is enough to carry the attribute
21
+ * claim + one corroborating sentence + one fallback. */
22
+ maxSentences: number;
23
+ /** Hard char cap after sentence selection. Safety net — keeps a
24
+ * single long sentence from blowing the verb's budget. */
25
+ maxChars: number;
26
+ /**
27
+ * What to do when no sentence scores > 0:
28
+ * - `'drop'`: return empty (verb omits the field).
29
+ * - `'head'`: keep a short prefix (~120 chars) so the LLM has some
30
+ * authentic merchant voice even when the body doesn't echo the
31
+ * query.
32
+ */
33
+ noMatch: 'drop' | 'head';
34
+ }
35
+ export interface CompressStringResult {
36
+ /** Compressed text, joined with spaces. Empty when nothing survived. */
37
+ text: string;
38
+ /** Sum of scores from kept sentences. Verb-level row ranking uses
39
+ * this as one signal among many. */
40
+ score: number;
41
+ /** Audit trail — every compression decision is reported, never
42
+ * hidden. Verbs aggregate these into a single per-call summary so
43
+ * operators can see exactly what was dropped from a tool result. */
44
+ audit: {
45
+ /** Total sentences in the input. */
46
+ sentencesIn: number;
47
+ /** Sentences that survived to the output. */
48
+ sentencesKept: number;
49
+ /** Chars in the input before compression. */
50
+ charsIn: number;
51
+ /** Chars after compression (= `text.length`). */
52
+ charsOut: number;
53
+ /** When true, the input had no sentence with score > 0 and the
54
+ * `noMatch` strategy was applied. Operator can distinguish
55
+ * "compressed normally" from "fell back to head/drop". */
56
+ noMatchFallback: boolean;
57
+ };
58
+ }
59
+ export declare function compressString(text: string, scorer: Scorer, opts: CompressStringOpts): CompressStringResult;
60
+ export interface CompressArrayOpts {
61
+ /** Top-N entries kept after scoring. */
62
+ maxEntries: number;
63
+ /**
64
+ * What to do when no entry scores > 0:
65
+ * - `'drop'`: return empty (verb omits the field).
66
+ * - `'keep'`: pass entries through, capped at `maxEntries`. Use when
67
+ * the array is structurally important regardless of query
68
+ * relevance (e.g. variant axes the model needs to render).
69
+ */
70
+ noMatch: 'drop' | 'keep';
71
+ }
72
+ export interface CompressArrayResult<T> {
73
+ /** Entries that survived, ordered by original index for natural
74
+ * reading. Empty when the noMatch policy is `'drop'` and nothing
75
+ * scored. */
76
+ entries: T[];
77
+ /** Sum of scores from kept entries. */
78
+ score: number;
79
+ /** Audit trail — mirrors `CompressStringResult.audit`. Verbs
80
+ * aggregate these into a per-call summary; nothing is dropped
81
+ * silently. */
82
+ audit: {
83
+ entriesIn: number;
84
+ entriesKept: number;
85
+ noMatchFallback: boolean;
86
+ };
87
+ }
88
+ export declare function compressArray<T>(arr: ReadonlyArray<T>, scorer: Scorer, opts: CompressArrayOpts): CompressArrayResult<T>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Compression primitives — pure, sync, scorer-pluggable.
3
+ *
4
+ * Verbs compose these to produce LLM-ready output from raw provider
5
+ * responses. Each verb owns its result shape and its compression rules;
6
+ * the compressor doesn't decide what to keep, just provides the
7
+ * primitives to keep things.
8
+ */
9
+ export { tokenize, splitSentences } from './tokenize';
10
+ export { createTokenOverlapScorer, type Scorer, type ScorerFactoryContext, } from './scoring';
11
+ export { compressString, compressArray, type CompressStringOpts, type CompressStringResult, type CompressArrayOpts, type CompressArrayResult, } from './compress';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `Scorer` — the abstraction the compressor uses to rank candidate
3
+ * spans (sentences, array entries, whole rows) against the visitor's
4
+ * intent.
5
+ *
6
+ * Today's default is token overlap: count words in the candidate that
7
+ * also appear in `(query + context)`. Cheap, deterministic, zero
8
+ * dependencies. Tomorrow we may want:
9
+ * - an embedding-similarity scorer (vector dot product vs a cached
10
+ * embedding of `query`)
11
+ * - an LLM-judge scorer (one rerank call across all candidates)
12
+ *
13
+ * Both slot in behind this interface — the compressor doesn't care.
14
+ */
15
+ /**
16
+ * Score one candidate string. Higher = more relevant. Returns `0` when
17
+ * the candidate carries no signal — the compressor treats that as
18
+ * "drop unless safety-floor applies".
19
+ *
20
+ * Pure (no I/O, no async) so the compressor can stay sync. An async
21
+ * scorer (LLM-judge) would need a different compressor entry point —
22
+ * keep the sync path for the hot loop.
23
+ */
24
+ export type Scorer = (candidate: string) => number;
25
+ export interface ScorerFactoryContext {
26
+ /** The verb's primary query — the strongest signal we have for
27
+ * "what attribute matters on this row". */
28
+ query: string;
29
+ /** Buyer-intent context (occasion, recipient). Secondary signal;
30
+ * folded into the same comparable token set. */
31
+ context: string;
32
+ }
33
+ /**
34
+ * Build a token-overlap scorer for one query/context pair. The query
35
+ * tokens are computed ONCE and closed over; the returned function is a
36
+ * tight inner loop suitable for thousands of candidates per turn.
37
+ */
38
+ export declare function createTokenOverlapScorer(ctx: ScorerFactoryContext, minTokenLength?: number): Scorer;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Token + sentence primitives used by the default token-overlap scorer.
3
+ *
4
+ * Kept in a leaf module — the only operations here are pure, allocation-
5
+ * light, and reusable by any future scorer that wants the same notion
6
+ * of "what is a word". Heavier strategies (embeddings, LLM-judge) won't
7
+ * use these; they go in their own scorer.
8
+ */
9
+ /**
10
+ * Lowercase + split on non-alphanumeric. Returns the unique words ≥
11
+ * `minLength`. Set membership tests run O(1) at scoring time.
12
+ *
13
+ * `minLength` is a coarse stop-word filter: 3 drops "a", "to", "the",
14
+ * "of", "is", "in", "on" — the function-word noise that would
15
+ * otherwise inflate every score uniformly. A real stop-word list is
16
+ * locale-specific and not worth the bytes at this layer.
17
+ */
18
+ export declare function tokenize(text: string, minLength: number): Set<string>;
19
+ /**
20
+ * Split product copy into sentence fragments. Two-level split:
21
+ * 1. on newlines — preserves bullet structure that `htmlToText`
22
+ * produced from <li>/<br>/</p> tags.
23
+ * 2. within each line, on terminator + whitespace — `(?<=[.!?])\s+`
24
+ * keeps the terminator on the left fragment for readability.
25
+ *
26
+ * Empty fragments dropped. A single sentence with no terminator
27
+ * survives whole.
28
+ */
29
+ export declare function splitSentences(text: string): string[];
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Trace data + observability shapes — the engine-owned span/run format
3
+ * the inspector consumes.
4
+ */
5
+ import type { StepConfig, TraceEvent, TraceStartInfo } from './trace-events';
6
+ import type { InteractionSignal, TimingInfo, UsageInfo } from '../types';
7
+ import type { JsonPatchOp } from '../layout/layout';
8
+ export interface TraceSpanData {
9
+ id: string;
10
+ title: string;
11
+ step: string;
12
+ startTime: number;
13
+ endTime?: number;
14
+ durationMs?: number;
15
+ status: 'pending' | 'running' | 'done' | 'error';
16
+ summary?: string;
17
+ config?: StepConfig;
18
+ meta?: {
19
+ model?: string;
20
+ input_tokens?: number;
21
+ output_tokens?: number;
22
+ /** Actual, post-provider-clamp values this call ran with — see
23
+ * `trace-events.ts`'s `step_done.meta` (this shape mirrors it). */
24
+ temperature?: number;
25
+ maxTokens?: number;
26
+ /** Resolved thinking tier this call ran with — see `StepConfig.thinking`
27
+ * in `trace-events.ts` (this shape mirrors that event's `meta`). */
28
+ thinking?: string;
29
+ promptCache?: {
30
+ enabled: boolean;
31
+ status: 'hit' | 'write' | 'miss' | 'disabled';
32
+ reason?: string;
33
+ cacheReadTokens?: number;
34
+ cacheWriteTokens?: number;
35
+ staticPromptChars?: number;
36
+ };
37
+ };
38
+ input?: string;
39
+ output?: string;
40
+ /**
41
+ * Tool-call-specific projection, present only on spans synthesized from
42
+ * a `tool_call` event. Sourced from the wire `tool_call` variant's
43
+ * `endpoint` + `error` fields (see III.2 in architecture-invariants:
44
+ * endpoint is a wire attribute set from the tool package manifest).
45
+ * Surfaced in the inspector so operators can see WHERE a call landed
46
+ * and WHY it failed without cross-referencing the manifest.
47
+ */
48
+ tool?: {
49
+ endpoint?: string;
50
+ error?: string;
51
+ callId?: string;
52
+ /** Full, untruncated tool result (capped — see trace-tracker.ts's
53
+ * `TOOL_OUTPUT_FULL_MAX_CHARS`). Distinct from the span-level `output`
54
+ * above, which for tool spans is the pre-truncated `outputSummary`
55
+ * built for compact display. */
56
+ outputFull?: string;
57
+ };
58
+ children?: TraceSpanData[];
59
+ }
60
+ export interface TraceData {
61
+ id: string;
62
+ name: string;
63
+ startTime: number;
64
+ durationMs: number;
65
+ totalTokens?: number;
66
+ spans: TraceSpanData[];
67
+ }
68
+ export interface TraceLatency {
69
+ firstTextMs?: number;
70
+ firstPatchMs?: number;
71
+ /**
72
+ * Wall clock from run start to the `main_done` event — the visitor's
73
+ * "layout visible" time. Distinct from the terminal `done` timing,
74
+ * which adds the chip-gen second pass on top.
75
+ */
76
+ mainDoneMs?: number;
77
+ }
78
+ /** Timestamped agent event for the raw event log */
79
+ export interface TraceEventLogEntry {
80
+ timestamp: number;
81
+ event: TraceEvent;
82
+ }
83
+ export interface Trace {
84
+ id: number;
85
+ /** Server-assigned id for the persisted agent_runs row (set by the
86
+ * `agent_run_saved` event). Used to reference this run from the
87
+ * Optimizer's critique flow. */
88
+ persistedRunId?: string;
89
+ timestamp: Date;
90
+ triggers: InteractionSignal[];
91
+ status: 'running' | 'done' | 'error';
92
+ /** Lane this run belongs to. `'interact'` is the visitor's actual turn
93
+ * — the one that produces patches + prose the chat surface renders.
94
+ * `'prefetch'` is the speculative phase_a + tool exec that runs on
95
+ * debounced keystrokes; it deliberately emits NO patches and NO prose,
96
+ * so without this tag the playground inspector renders it as a
97
+ * zero-patch "failed" turn. `'extend'` is the view-continuation faculty's
98
+ * run (scroll-driven append) — it has no chip-gen second pass, so it closes
99
+ * on `main_done` rather than `done`. Default `'interact'` keeps existing
100
+ * consumers behaving identically. */
101
+ kind?: 'interact' | 'prefetch' | 'extend';
102
+ /** The agent-run turnId that opened this run (from `trace_start`, stamped by
103
+ * `withTurnId`). Lets a `trace_saved` event attach `persistedRunId` to the
104
+ * run it actually belongs to — matched by turnId, not by array position — so
105
+ * a concurrent speculative/faculty run can't be mislabeled with another
106
+ * turn's persisted id. Absent on legacy/unstamped runs (eval, warmup). */
107
+ turnId?: string;
108
+ trace?: TraceData;
109
+ responseText?: string;
110
+ reasoningText?: string;
111
+ latency?: TraceLatency;
112
+ timingBreakdown?: TimingInfo;
113
+ agentInfo?: TraceStartInfo;
114
+ eventLog?: TraceEventLogEntry[];
115
+ errorMessage?: string;
116
+ /** Per-model token usage accumulated from step_done meta events */
117
+ usageByModel?: Record<string, UsageInfo>;
118
+ }
119
+ export interface LayoutChangeEntry {
120
+ id: number;
121
+ timestamp: Date;
122
+ trigger: InteractionSignal[];
123
+ patch: JsonPatchOp;
124
+ agentRunId: number;
125
+ latencyMs?: number;
126
+ }
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Agent diagnostics — structured signals for architectural faults.
3
+ * Defined in @fourty/spacestation (not @fourty/agent) to avoid an sdk -> agent
4
+ * import cycle.
5
+ */
6
+ export type TraceDiagnostic = {
7
+ kind: 'yaml_fence_malformed';
8
+ stage: 'layout_generation';
9
+ leakedBytes: number;
10
+ sample: string;
11
+ } | {
12
+ kind: 'zero_patches_produced';
13
+ stage: 'layout_generation';
14
+ hadFenceAttempt: boolean;
15
+ }
16
+ /** Zero visible output. `providerError` carries the underlying stream error
17
+ * when there was one — a REJECTED request (bad param, quota, model refusal)
18
+ * reads identically to a thinking-only collapse otherwise: usage and
19
+ * finishReason both reject, so the counters below are all zero and the
20
+ * operator sees "the model produced nothing" for what was a 400. */
21
+ | {
22
+ kind: 'model_underproduced';
23
+ stage: 'layout_generation';
24
+ inputTokens: number;
25
+ outputTokens: number;
26
+ responseChars: number;
27
+ reasoningChars: number;
28
+ responseSample: string;
29
+ reasoningSample: string;
30
+ finishReason?: string;
31
+ providerError?: string;
32
+ } | {
33
+ kind: 'layout_fence_truncated';
34
+ stage: 'layout_generation';
35
+ partialBytes: number;
36
+ } | {
37
+ kind: 'tool_call_extracted_none';
38
+ stage: 'tool_planning';
39
+ prompt: string;
40
+ } | {
41
+ kind: 'tool_returned_empty';
42
+ stage: 'tool_execution';
43
+ tool: string;
44
+ } | {
45
+ kind: 'tool_execution_error';
46
+ stage: 'tool_execution';
47
+ tool: string;
48
+ error: string;
49
+ } | {
50
+ kind: 'component_not_in_catalog';
51
+ stage: 'layout_generation';
52
+ type: string;
53
+ }
54
+ /** The agent patched a prop the component's catalog schema does not declare.
55
+ * Its sibling `component_not_in_catalog` catches a bad TYPE; this catches a
56
+ * bad PROP, which until now was completely silent: `replace` on a missing
57
+ * key behaves as `add`, so the patch applies and creates a junk key, while
58
+ * the real prop is untouched and the surface re-renders IDENTICALLY. Zod
59
+ * then strips the junk before persist, erasing the evidence. Observed live
60
+ * (a "swap the first 2 items" turn wrote `/props/refs` on a productGrid
61
+ * whose array is `products`): four consecutive turns reported success and
62
+ * changed nothing. Every other prop-level diagnostic is keyed on a prop the
63
+ * catalog ALREADY declares, so an undeclared one is outside all of them by
64
+ * construction — this is the only signal for it. */
65
+ | {
66
+ kind: 'prop_not_in_catalog';
67
+ stage: 'layout_generation';
68
+ element: string;
69
+ elementType: string;
70
+ prop: string;
71
+ } | {
72
+ kind: 'signal_patch_malformed';
73
+ stage: 'layout_generation';
74
+ reason: string;
75
+ } | {
76
+ kind: 'follow_up_absent';
77
+ stage: 'layout_generation';
78
+ } | {
79
+ kind: 'data_binding_missing';
80
+ stage: 'layout_generation';
81
+ path: string;
82
+ prop: string;
83
+ } | {
84
+ kind: 'entity_id_invented';
85
+ stage: 'layout_generation';
86
+ element: string;
87
+ elementType: string;
88
+ prop: string;
89
+ id: string;
90
+ resolverKey: string;
91
+ } | {
92
+ kind: 'zero_resolved_entities';
93
+ stage: 'layout_generation';
94
+ element: string;
95
+ elementType: string;
96
+ prop: string;
97
+ resolverKey: string;
98
+ strippedCount: number;
99
+ } | {
100
+ kind: 'resolved_below_min';
101
+ stage: 'layout_generation';
102
+ element: string;
103
+ elementType: string;
104
+ prop: string;
105
+ resolverKey: string;
106
+ received: number;
107
+ min: number;
108
+ } | {
109
+ kind: 'resolved_duplicate_refs';
110
+ stage: 'layout_generation';
111
+ element: string;
112
+ elementType: string;
113
+ prop: string;
114
+ resolverKey: string;
115
+ removed: number;
116
+ kept: number;
117
+ }
118
+ /** A `derivedFrom` (self-fetch) resolved field shipped EMPTY while the
119
+ * sibling prop that would fill it was left unset — half of the two-part
120
+ * self-fetch contract. The element can never acquire data, so it renders
121
+ * as nothing and the runtime drops it. A real model fault (contrast
122
+ * `data_binding_missing`, which stays soft): below-min cannot catch it,
123
+ * because a self-fetch field is declared `min: 0` so the PAIRED case
124
+ * stays legal. Sibling of `resolved_below_min` — same seam, same
125
+ * drop-the-element remedy. */
126
+ | {
127
+ kind: 'resolved_derived_unpaired';
128
+ stage: 'layout_generation';
129
+ element: string;
130
+ elementType: string;
131
+ prop: string;
132
+ resolverKey: string;
133
+ derivedFrom: string;
134
+ }
135
+ /** The turn finalized to a layout that renders NOTHING while the standing
136
+ * view did render, so the blank-guard kept the prior view: the visitor got
137
+ * prose against an unchanged canvas. */
138
+ | {
139
+ kind: 'blank_guard_retained_prior';
140
+ stage: 'layout_generation';
141
+ elements: number;
142
+ seedReplace: boolean;
143
+ withheldOps: number;
144
+ }
145
+ /** The turn composed a layout that DOES render, but not one op reached the
146
+ * client — on a seed-replace turn the withhold swallowed every op and its
147
+ * swap never fired, so the server finalized an answer the visitor never saw.
148
+ *
149
+ * Its sibling above is the OPPOSITE fault with an IDENTICAL wire shape: both
150
+ * ship `layout_patch{patches: []}` + `layout_committed{opCount: 0}`, and both
151
+ * were server `logger.warn` lines only — invisible in prod (background logs
152
+ * do not surface) and indistinguishable from each other once they land. One
153
+ * means "there was no answer to show", the other means "there was an answer
154
+ * and it was lost"; `withheldOps` is what separates them. */
155
+ | {
156
+ kind: 'stranded_turn_snapshot';
157
+ stage: 'layout_generation';
158
+ elements: number;
159
+ seedReplace: boolean;
160
+ withheldOps: number;
161
+ } | {
162
+ kind: 'catalog_resolution_failed';
163
+ stage: 'hydration';
164
+ path: string;
165
+ entityId: string;
166
+ } | {
167
+ kind: 'stream_deadline_hit';
168
+ stage: 'layout_generation';
169
+ deadlineMs: number;
170
+ patches: number;
171
+ responseChars: number;
172
+ } | {
173
+ kind: 'degenerate_emission';
174
+ stage: 'layout_generation';
175
+ linesParsed: number;
176
+ patchesEmitted: number;
177
+ noOpDedups: number;
178
+ } | {
179
+ kind: 'orphan_elements_linked';
180
+ stage: 'layout_generation';
181
+ rootKey: string;
182
+ orphans: string[];
183
+ }
184
+ /** Housekeeping GC, NOT a model violation. After a subject swap
185
+ * (`page.c` wholesale replace) a prior-turn top-level element loses
186
+ * its only reference and becomes unreachable; the runtime prunes it
187
+ * from the persisted Spec so state doesn't accumulate unboundedly.
188
+ * The visitor never saw it (unreachable = never rendered). Sibling of
189
+ * `orphan_elements_linked` — informational telemetry on a successful
190
+ * auto-fix, deliberately kept OUT of the critical-banner set and the
191
+ * optimizer's violation signal (contrast `render_sanitized`, which
192
+ * flags real model faults: unknown/empty component types). */
193
+ | {
194
+ kind: 'unreachable_pruned';
195
+ stage: 'layout_generation';
196
+ element: string;
197
+ } | {
198
+ kind: 'render_sanitized';
199
+ stage: 'layout_generation';
200
+ element: string;
201
+ reason: string;
202
+ value?: string;
203
+ slot?: string;
204
+ }
205
+ /** Chip-gen dropped a candidate chip during validation. Pure
206
+ * observability — the chip was never shown to the visitor, so the
207
+ * client has nothing to act on. Stages:
208
+ * - `grounding` — chip referenced an unknown / unavailable tool
209
+ * - `entity-grounding` — chip pivoted to an entity not on the current canvas
210
+ * - `category-grounding`— chip pivoted to a category not on the current canvas
211
+ * - `warmer` — chip's pre-flight tool call returned no results
212
+ * Lives here (not on the AgentSignal bus) because chip drops are an
213
+ * AGENT-SIDE event with no client behavior; routing through `signal`
214
+ * forced the SDK to register a no-op handler just to suppress the
215
+ * unhandled-signal warning. */
216
+ | {
217
+ kind: 'chip_dropped';
218
+ stage: 'chip_gen';
219
+ chipId: string;
220
+ reason: string;
221
+ chipStage: 'grounding' | 'entity-grounding' | 'category-grounding' | 'warmer';
222
+ };
223
+ export type DiagnosticKind = TraceDiagnostic['kind'];
224
+ export type TraceStage = TraceDiagnostic['stage'];
@@ -0,0 +1,144 @@
1
+ /**
2
+ * session-init replay envelopes — bare {type}-tagged WebSocket frames
3
+ * (NOT TraceEvent union members) that rehydrate inspector state on
4
+ * (re)connect without re-running the turn.
5
+ */
6
+ import type { SystemPromptSnapshot } from './trace-events';
7
+ import type { Spec } from '../layout/layout';
8
+ import type { SuggestionActions } from '../signal/agent-signals';
9
+ export interface TraceSnapshotEnvelope {
10
+ type: 'trace_snapshot';
11
+ sessionId: string;
12
+ /** Serialized `TraceTracker.exportState()` — a JSON string. */
13
+ state: string;
14
+ }
15
+ export interface SystemPromptSnapshotEnvelope {
16
+ type: 'system_prompt_snapshot';
17
+ sessionId: string;
18
+ snapshot: SystemPromptSnapshot;
19
+ }
20
+ export interface LayoutSnapshotEnvelope {
21
+ type: 'layout_snapshot';
22
+ sessionId: string;
23
+ layout: Spec;
24
+ }
25
+ /**
26
+ * Persisted suggestion chips replayed on WS (re)connect. Matches the
27
+ * `layout_snapshot` pattern: the persistent agent stream is self-sufficient,
28
+ * a fresh consumer no longer needs the REST GET to populate the chip rail.
29
+ * Sent only when the session has chips on record (bootstrap or a prior turn);
30
+ * omitted on truly empty sessions to let live `signal{chip.show}` events flow.
31
+ */
32
+ export interface SuggestionsSnapshotEnvelope {
33
+ type: 'suggestions_snapshot';
34
+ sessionId: string;
35
+ suggestions: SuggestionActions;
36
+ }
37
+ /**
38
+ * The session's IN-FLIGHT visitor turn, sent on VISITOR WS (re)connect while a
39
+ * prompt-shaped turn is running or queued (derived from the turn-recovery
40
+ * pending-turn slot — set at ack time, cleared at the turn's terminal).
41
+ *
42
+ * This is what makes turn identity a CONNECT-TIME server-owned fact instead of
43
+ * an ack-or-never event: a client that missed `agent_ack` (provider remount
44
+ * mid-turn, reconnect race, a second tab joining) adopts `turnId` into its
45
+ * stale-turn gate so the turn's stamped prose/terminal attribute correctly,
46
+ * and rebuilds the pending chat bubble from `prompt`. Without it, a stamped
47
+ * stream after identity loss is silently dropped while layout events (exempt
48
+ * from turn gating by design) keep painting — the frozen-bubble failure.
49
+ *
50
+ * Omitted entirely when no turn is in flight — absence carries no meaning
51
+ * (the committed-outcome replay path in turn-recovery owns that case).
52
+ */
53
+ export interface TurnSnapshotEnvelope {
54
+ type: 'turn_snapshot';
55
+ sessionId: string;
56
+ turn: {
57
+ /** The running turn's id — same value `withTurnId` stamps on its events. */
58
+ turnId: string;
59
+ /** Client-minted message identity (equals turnId for prompt turns). */
60
+ messageId: string;
61
+ /** The visitor's prompt text — rebuilds the pending bubble's user row. */
62
+ prompt: string;
63
+ /** Epoch ms the server accepted the prompt. */
64
+ startedAt: number;
65
+ };
66
+ }
67
+ /**
68
+ * Structured rendering of the agent's prompt INGREDIENTS — what gets
69
+ * folded into the system prompt at assembly time, but as data the
70
+ * inspector can render as a list/table instead of a raw text dump.
71
+ *
72
+ * Sent on session-init so the Context window has content before any
73
+ * turn fires. Distinct from `system_prompt_snapshot` (assembled-output
74
+ * after a turn).
75
+ */
76
+ export interface AssemblyInputComponent {
77
+ /** Catalog type (e.g. "productGrid"). */
78
+ type: string;
79
+ /** Manifest-sourced LLM description. */
80
+ description: string;
81
+ /** When-to-use guidance from the manifest. */
82
+ whenToUse?: string;
83
+ /** When-not-to-use guidance. */
84
+ dontUseWhen?: string;
85
+ /** Derived prop docs (name → human-readable type/description). */
86
+ props: Record<string, string>;
87
+ /** Category (ecommerce/saas/editorial/portfolio) when set. */
88
+ category?: string;
89
+ /** True for layout primitives (page/stack/grid/section). */
90
+ alwaysInclude?: boolean;
91
+ /** Source package id that contributed this component — e.g. '@fourty/ui'
92
+ * (baseline) or '@fourty/stevemadden' (brand). Lets the inspector group the
93
+ * catalog by package. Observability only. */
94
+ source?: string;
95
+ /** Render provenance: the package id whose React component actually renders
96
+ * this type — a layer id, like `source`. Differs from `source` when a layer
97
+ * reuses another's component (or overrides it) — the "what's actually
98
+ * happening" axis. Observability only. */
99
+ renderedBy?: string;
100
+ }
101
+ export interface AssemblyInputTool {
102
+ name: string;
103
+ description: string;
104
+ /** Param doc rendered from the tool's Zod inputSchema (when available). */
105
+ params?: Record<string, string>;
106
+ }
107
+ /**
108
+ * Infra prompts — the recipe-side text the agent ALWAYS reads,
109
+ * shipped as discrete named files so the inspector can render each
110
+ * as its own subsection instead of one concat'd persona blob.
111
+ *
112
+ * `key` is the file's path slug (e.g. "output/03-entity-hydration",
113
+ * "souls/ecommerce", "layout-composition/ecommerce", "preflight/tool-planning"),
114
+ * which lets the inspector group + label them.
115
+ */
116
+ export interface AssemblyInputPrompt {
117
+ key: string;
118
+ /** Human-readable label rendered at the section header. */
119
+ label: string;
120
+ /** Raw markdown content. */
121
+ content: string;
122
+ }
123
+ export interface AssemblyInputsEnvelope {
124
+ type: 'assembly_inputs';
125
+ sessionId: string;
126
+ /** UI catalog as structured component cards. */
127
+ uiCatalog: AssemblyInputComponent[];
128
+ /** Tools attached for this session. */
129
+ tools: AssemblyInputTool[];
130
+ /**
131
+ * Infra prompts grouped by source category — output (wire format
132
+ * rules), voice (soul), layoutComposition (composition rules),
133
+ * preflight (tool-planning). Each entry's `content` is the raw
134
+ * markdown; inspector renders each as its own subsection.
135
+ */
136
+ system: {
137
+ output: AssemblyInputPrompt[];
138
+ voice: AssemblyInputPrompt[];
139
+ layoutComposition: AssemblyInputPrompt[];
140
+ preflight: AssemblyInputPrompt[];
141
+ };
142
+ /** Space-authored brand prompt (spaceManifest). Empty string when unset. */
143
+ spaceManifest: string;
144
+ }