@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.
- package/dist/index.js +11918 -0
- package/dist/types/ecommerce/src/attribute-buckets.d.ts +79 -0
- package/dist/types/ecommerce/src/base-attributes.d.ts +42 -0
- package/dist/types/ecommerce/src/bucket-labels.d.ts +37 -0
- package/dist/types/ecommerce/src/cart-line-selections.d.ts +24 -0
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +1813 -0
- package/dist/types/ecommerce/src/format-variant-value.d.ts +1 -0
- package/dist/types/ecommerce/src/index.d.ts +13 -0
- package/dist/types/ecommerce/src/locale.d.ts +31 -0
- package/dist/types/ecommerce/src/optimistic-cart-line.d.ts +38 -0
- package/dist/types/ecommerce/src/pdp-companions.d.ts +21 -0
- package/dist/types/ecommerce/src/pick-product-card-action.d.ts +38 -0
- package/dist/types/ecommerce/src/product-lookup.d.ts +34 -0
- package/dist/types/ecommerce/src/projection-spec.d.ts +38 -0
- package/dist/types/ecommerce/src/review-schemas.d.ts +425 -0
- package/dist/types/sdk/src/analytics/consent.d.ts +52 -0
- package/dist/types/sdk/src/analytics/drops.d.ts +98 -0
- package/dist/types/sdk/src/analytics/emitting-scope.d.ts +2 -0
- package/dist/types/sdk/src/analytics/index.d.ts +12 -0
- package/dist/types/sdk/src/analytics/inert-scope.d.ts +2 -0
- package/dist/types/sdk/src/analytics/notify.d.ts +41 -0
- package/dist/types/sdk/src/analytics/outbox.d.ts +118 -0
- package/dist/types/sdk/src/analytics/scope-context.d.ts +24 -0
- package/dist/types/sdk/src/analytics/scope.d.ts +149 -0
- package/dist/types/sdk/src/analytics/surface.d.ts +77 -0
- package/dist/types/sdk/src/analytics/transport.d.ts +91 -0
- package/dist/types/sdk/src/animation/index.d.ts +2 -0
- package/dist/types/sdk/src/animation/useListTransition.d.ts +16 -0
- package/dist/types/sdk/src/animation/useUpdateTransition.d.ts +16 -0
- package/dist/types/sdk/src/canvas/ElementIdContext.d.ts +13 -0
- package/dist/types/sdk/src/canvas/GenerationStyleContext.d.ts +13 -0
- package/dist/types/sdk/src/canvas/ShimmerSweep.d.ts +18 -0
- package/dist/types/sdk/src/canvas/TransitionContext.d.ts +52 -0
- package/dist/types/sdk/src/canvas/canvas-arrangement.d.ts +20 -0
- package/dist/types/sdk/src/canvas/canvas-motion-style.d.ts +18 -0
- package/dist/types/sdk/src/canvas/canvas-outlet.d.ts +14 -0
- package/dist/types/sdk/src/canvas/canvas-tail.d.ts +31 -0
- package/dist/types/sdk/src/canvas/dom-targets.d.ts +140 -0
- package/dist/types/sdk/src/canvas/generation-entrance.d.ts +26 -0
- package/dist/types/sdk/src/canvas/generation-style.d.ts +62 -0
- package/dist/types/sdk/src/canvas/index.d.ts +21 -0
- package/dist/types/sdk/src/canvas/item-motion/ItemTransitionGroup.d.ts +72 -0
- package/dist/types/sdk/src/canvas/item-motion/classify-items.d.ts +24 -0
- package/dist/types/sdk/src/canvas/item-motion/index.d.ts +5 -0
- package/dist/types/sdk/src/canvas/item-motion/plugins/wipe.d.ts +11 -0
- package/dist/types/sdk/src/canvas/item-motion/profile.d.ts +77 -0
- package/dist/types/sdk/src/canvas/item-motion/wipe.d.ts +57 -0
- package/dist/types/sdk/src/canvas/nav-direction.d.ts +22 -0
- package/dist/types/sdk/src/canvas/runtime-context.d.ts +15 -0
- package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +106 -0
- package/dist/types/sdk/src/canvas/runtime-types.d.ts +183 -0
- package/dist/types/sdk/src/canvas/scroll-event-target.d.ts +21 -0
- package/dist/types/sdk/src/canvas/turn-change-anchor.d.ts +34 -0
- package/dist/types/sdk/src/canvas/turn-edit.d.ts +8 -0
- package/dist/types/sdk/src/canvas/use-canvas-actions.d.ts +41 -0
- package/dist/types/sdk/src/canvas/use-fourty-layout.d.ts +19 -0
- package/dist/types/sdk/src/catalog/CatalogContext.d.ts +7 -0
- package/dist/types/sdk/src/catalog/DebugContext.d.ts +5 -0
- package/dist/types/sdk/src/catalog/HydrationStateContext.d.ts +45 -0
- package/dist/types/sdk/src/catalog/HydratorContext.d.ts +7 -0
- package/dist/types/sdk/src/catalog/component-library.d.ts +32 -0
- package/dist/types/sdk/src/catalog/define.d.ts +149 -0
- package/dist/types/sdk/src/catalog/hydrator-registry.d.ts +91 -0
- package/dist/types/sdk/src/catalog/index.d.ts +14 -0
- package/dist/types/sdk/src/catalog/interaction-contract.d.ts +78 -0
- package/dist/types/sdk/src/catalog/normalize-components.d.ts +17 -0
- package/dist/types/sdk/src/catalog/prose-value.d.ts +22 -0
- package/dist/types/sdk/src/catalog/registration/index.d.ts +4 -0
- package/dist/types/sdk/src/catalog/registration/register-component.d.ts +35 -0
- package/dist/types/sdk/src/catalog/registration/registry.d.ts +27 -0
- package/dist/types/sdk/src/catalog/registration/types.d.ts +83 -0
- package/dist/types/sdk/src/catalog/registry.d.ts +22 -0
- package/dist/types/sdk/src/catalog/render-inline.d.ts +39 -0
- package/dist/types/sdk/src/catalog/resolve-hydrators.d.ts +27 -0
- package/dist/types/sdk/src/chat/chat-context.d.ts +40 -0
- package/dist/types/sdk/src/chat/index.d.ts +1 -0
- package/dist/types/sdk/src/client-state/index.d.ts +2 -0
- package/dist/types/sdk/src/client-state/server-store.d.ts +38 -0
- package/dist/types/sdk/src/client-state/store.d.ts +20 -0
- package/dist/types/sdk/src/commerce/commerce-context.d.ts +62 -0
- package/dist/types/sdk/src/commerce/commerce-shapes.d.ts +170 -0
- package/dist/types/sdk/src/commerce/ecommerce/agentic-overlay.d.ts +27 -0
- package/dist/types/sdk/src/commerce/ecommerce/buy-now-exit.d.ts +36 -0
- package/dist/types/sdk/src/commerce/ecommerce/cart-action-failures.d.ts +54 -0
- package/dist/types/sdk/src/commerce/ecommerce/cart-drawer-store.d.ts +18 -0
- package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-reasons.d.ts +54 -0
- package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-shape.d.ts +73 -0
- package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-store.d.ts +39 -0
- package/dist/types/sdk/src/commerce/ecommerce/comparison-rows.d.ts +30 -0
- package/dist/types/sdk/src/commerce/ecommerce/index.d.ts +21 -0
- package/dist/types/sdk/src/commerce/ecommerce/normalize-collection.d.ts +17 -0
- package/dist/types/sdk/src/commerce/ecommerce/preselect-from-facts.d.ts +25 -0
- package/dist/types/sdk/src/commerce/ecommerce/product-filters.d.ts +40 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-buy-now.d.ts +33 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-cart-drawer.d.ts +35 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-cart-line-row.d.ts +30 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-comparison-table.d.ts +22 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-look-card.d.ts +80 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-card.d.ts +62 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-carousel-scroll.d.ts +13 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-detail.d.ts +48 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-grid-filter.d.ts +17 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-selected-variants-state.d.ts +8 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-wishlist-drawer.d.ts +34 -0
- package/dist/types/sdk/src/commerce/ecommerce/variant-option-axes.d.ts +56 -0
- package/dist/types/sdk/src/commerce/ecommerce/variant-resolution.d.ts +83 -0
- package/dist/types/sdk/src/commerce/ecommerce/variant-selection.d.ts +22 -0
- package/dist/types/sdk/src/commerce/external-navigation.d.ts +41 -0
- package/dist/types/sdk/src/commerce/index.d.ts +9 -0
- package/dist/types/sdk/src/commerce/option-selection-store.d.ts +8 -0
- package/dist/types/sdk/src/commerce/pending-variant-choice-store.d.ts +20 -0
- package/dist/types/sdk/src/commerce/variant-selection-store.d.ts +7 -0
- package/dist/types/sdk/src/content/index.d.ts +2 -0
- package/dist/types/sdk/src/content/use-faq-accordion.d.ts +11 -0
- package/dist/types/sdk/src/content/use-newsletter-form.d.ts +16 -0
- package/dist/types/sdk/src/host/Spacefront.d.ts +11 -0
- package/dist/types/sdk/src/host/engine-loader.d.ts +14 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +5833 -0
- package/dist/types/sdk/src/host/index.d.ts +4 -0
- package/dist/types/sdk/src/host/types.d.ts +52 -0
- package/dist/types/sdk/src/index.d.ts +21 -0
- package/dist/types/sdk/src/interaction/haptics.d.ts +8 -0
- package/dist/types/sdk/src/interaction/index.d.ts +3 -0
- package/dist/types/sdk/src/interaction/normalize-signals.d.ts +8 -0
- package/dist/types/sdk/src/interaction/withInteractionTracking.d.ts +48 -0
- package/dist/types/sdk/src/npm.d.ts +3 -0
- package/dist/types/sdk/src/projection/ProjectionSignalBridge.d.ts +5 -0
- package/dist/types/sdk/src/projection/index.d.ts +1 -0
- package/dist/types/sdk/src/projection/preferences.d.ts +12 -0
- package/dist/types/sdk/src/projection/transform.d.ts +7 -0
- package/dist/types/sdk/src/provider/AgentAsk.d.ts +16 -0
- package/dist/types/sdk/src/provider/index.d.ts +4 -0
- package/dist/types/sdk/src/provider/providers/handler-registry.d.ts +11 -0
- package/dist/types/sdk/src/provider/use-clamp-toggle.d.ts +22 -0
- package/dist/types/sdk/src/provider/use-timed-flag.d.ts +16 -0
- package/dist/types/sdk/src/rendering/index.d.ts +1 -0
- package/dist/types/sdk/src/rendering/post-hydration.d.ts +37 -0
- package/dist/types/sdk/src/session/FourtySessionContext.d.ts +228 -0
- package/dist/types/sdk/src/session/clear-registry.d.ts +6 -0
- package/dist/types/sdk/src/session/index.d.ts +4 -0
- package/dist/types/sdk/src/session/use-action.d.ts +25 -0
- package/dist/types/sdk/src/session/visitor-locale.d.ts +2 -0
- package/dist/types/sdk/src/shared/index.d.ts +2 -0
- package/dist/types/sdk/src/shared/use-expandable.d.ts +9 -0
- package/dist/types/sdk/src/shared/use-image-hover.d.ts +13 -0
- package/dist/types/sdk/src/shell/ScrollContainerContext.d.ts +25 -0
- package/dist/types/sdk/src/shell/ShellRegistry.d.ts +25 -0
- package/dist/types/sdk/src/shell/ShellRootContext.d.ts +15 -0
- package/dist/types/sdk/src/shell/dock-persistence.d.ts +49 -0
- package/dist/types/sdk/src/shell/exclusive-overlay.d.ts +16 -0
- package/dist/types/sdk/src/shell/index.d.ts +12 -0
- package/dist/types/sdk/src/shell/thread-scroll/ThreadHeadroom.d.ts +11 -0
- package/dist/types/sdk/src/shell/thread-scroll/headroom.d.ts +4 -0
- package/dist/types/sdk/src/shell/thread-scroll/index.d.ts +6 -0
- package/dist/types/sdk/src/shell/thread-scroll/pin-turn-head.d.ts +12 -0
- package/dist/types/sdk/src/shell/thread-scroll/settle-thread-row.d.ts +23 -0
- package/dist/types/sdk/src/shell/thread-scroll/thread-geometry.d.ts +27 -0
- package/dist/types/sdk/src/shell/thread-scroll/thread-row-attr.d.ts +4 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-pin-turn-to-top.d.ts +22 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-scroll-has-more-below.d.ts +19 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-thread-jump-marks.d.ts +28 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-thread-landing.d.ts +1 -0
- package/dist/types/sdk/src/shell/use-composer-chip-select.d.ts +21 -0
- package/dist/types/sdk/src/shell/use-go-home.d.ts +11 -0
- package/dist/types/sdk/src/shell/use-hydrated.d.ts +19 -0
- package/dist/types/sdk/src/shell/use-menu-item-select.d.ts +13 -0
- package/dist/types/sdk/src/shell/use-overridable-toggle.d.ts +24 -0
- package/dist/types/sdk/src/shell/use-thread-rows.d.ts +41 -0
- package/dist/types/sdk/src/social/index.d.ts +2 -0
- package/dist/types/sdk/src/social/use-review-helpful.d.ts +10 -0
- package/dist/types/sdk/src/social/use-testimonials-carousel.d.ts +15 -0
- package/dist/types/sdk/src/utils/core-utils/format-distance.d.ts +6 -0
- package/dist/types/sdk/src/utils/core-utils/format-price.d.ts +7 -0
- package/dist/types/sdk/src/utils/core-utils/index.d.ts +10 -0
- package/dist/types/sdk/src/utils/core-utils/inject-google-fonts.d.ts +17 -0
- package/dist/types/sdk/src/utils/core-utils/is-on-sale.d.ts +6 -0
- package/dist/types/sdk/src/utils/core-utils/is-video-url.d.ts +6 -0
- package/dist/types/sdk/src/utils/core-utils/maps-directions-url.d.ts +5 -0
- package/dist/types/sdk/src/utils/core-utils/mint-id.d.ts +10 -0
- package/dist/types/sdk/src/utils/core-utils/resolve-swatch-color.d.ts +2 -0
- package/dist/types/sdk/src/utils/core-utils/validate-all.d.ts +13 -0
- package/dist/types/sdk/src/utils/index.d.ts +10 -0
- package/dist/types/sdk/src/utils/storage.d.ts +9 -0
- package/dist/types/sdk/src/utils/use-document-visible.d.ts +9 -0
- package/dist/types/sdk/src/utils/use-form-factor.d.ts +24 -0
- package/dist/types/sdk/src/utils/use-inline-completion.d.ts +48 -0
- package/dist/types/sdk/src/utils/use-interval.d.ts +7 -0
- package/dist/types/sdk/src/utils/use-success-flash.d.ts +35 -0
- package/dist/types/sdk/src/utils/use-wake-lock.d.ts +15 -0
- package/dist/types/sdk/src/utils/viewport-window.d.ts +39 -0
- package/dist/types/sdk/src/voice/index.d.ts +2 -0
- package/dist/types/sdk/src/voice/use-dictation.d.ts +80 -0
- package/dist/types/sdk/src/voice/use-voice-capture.d.ts +65 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/fact-form-registry.d.ts +43 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/fact-shape.d.ts +70 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/form-registry.d.ts +28 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/knowledge.d.ts +18 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/presence-restore.d.ts +13 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/presence-stream.d.ts +64 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/source-form-registry.d.ts +129 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/standing-signal-store.d.ts +19 -0
- package/dist/types/sdk/src/widgets/presence/flows/flow-store.d.ts +22 -0
- package/dist/types/sdk/src/widgets/presence/index.d.ts +17 -0
- package/dist/types/sdk/src/widgets/presence/runtime-context.d.ts +109 -0
- package/dist/types/sdk/src/widgets/presence/use-layout-entity-ids.d.ts +12 -0
- package/dist/types/sdk/src/widgets/presence/use-optimistic-facts.d.ts +43 -0
- package/dist/types/sdk/src/widgets/presence/use-optimistic-flow-set.d.ts +24 -0
- package/dist/types/sdk/src/widgets/presence/use-presence-notch.d.ts +75 -0
- package/dist/types/sdk/src/widgets/presence/use-presence.d.ts +45 -0
- package/dist/types/sdk/src/widgets/presence/use-standing-signal.d.ts +12 -0
- package/dist/types/spacestation/src/analytics/catalog.d.ts +89 -0
- package/dist/types/spacestation/src/analytics/ecommerce/events.d.ts +183 -0
- package/dist/types/spacestation/src/analytics/ecommerce/funnel.d.ts +22 -0
- package/dist/types/spacestation/src/analytics/ecommerce/index.d.ts +14 -0
- package/dist/types/spacestation/src/analytics/ecommerce/surfacing.d.ts +42 -0
- package/dist/types/spacestation/src/analytics/envelope.d.ts +222 -0
- package/dist/types/spacestation/src/analytics/index.d.ts +28 -0
- package/dist/types/spacestation/src/analytics/kind.d.ts +155 -0
- package/dist/types/spacestation/src/analytics/session.d.ts +35 -0
- package/dist/types/spacestation/src/attachment/attachment.d.ts +83 -0
- package/dist/types/spacestation/src/catalog/attribute-registry.d.ts +148 -0
- package/dist/types/spacestation/src/catalog/attribute-scope.d.ts +41 -0
- package/dist/types/spacestation/src/catalog/canvas-arrangement.d.ts +43 -0
- package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +264 -0
- package/dist/types/spacestation/src/catalog/config.d.ts +13 -0
- package/dist/types/spacestation/src/catalog/derive-props-doc.d.ts +11 -0
- package/dist/types/spacestation/src/catalog/element-filled.d.ts +77 -0
- package/dist/types/spacestation/src/catalog/entity-refs.d.ts +14 -0
- package/dist/types/spacestation/src/catalog/function-props.d.ts +23 -0
- package/dist/types/spacestation/src/catalog/hydration-paths.d.ts +19 -0
- package/dist/types/spacestation/src/catalog/prose.d.ts +60 -0
- package/dist/types/spacestation/src/catalog/ref-sites.d.ts +45 -0
- package/dist/types/spacestation/src/catalog/required-props.d.ts +31 -0
- package/dist/types/spacestation/src/catalog/resolved.d.ts +145 -0
- package/dist/types/spacestation/src/catalog/structural-baseline.d.ts +7 -0
- package/dist/types/spacestation/src/catalog/wire/catalog-wire.d.ts +191 -0
- package/dist/types/spacestation/src/catalog/wire/index.d.ts +5 -0
- package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +351 -0
- package/dist/types/spacestation/src/catalog/wire/schema-from-wire.d.ts +7 -0
- package/dist/types/spacestation/src/catalog/wire/schema-to-wire.d.ts +8 -0
- package/dist/types/spacestation/src/catalog/wire/wire-schema.d.ts +78 -0
- package/dist/types/spacestation/src/commerce/cart-add-signal.d.ts +125 -0
- package/dist/types/spacestation/src/commerce/cart-state.d.ts +87 -0
- package/dist/types/spacestation/src/commerce/cart-verb-signals.d.ts +80 -0
- package/dist/types/spacestation/src/commerce/page-kinds.d.ts +40 -0
- package/dist/types/spacestation/src/commerce/selection-signal.d.ts +25 -0
- package/dist/types/spacestation/src/contracts/entry-context.d.ts +35 -0
- package/dist/types/spacestation/src/contracts/knowledge/index.d.ts +12 -0
- package/dist/types/spacestation/src/contracts/knowledge/types.d.ts +238 -0
- package/dist/types/spacestation/src/contracts/retrieval/core/knowledge-source.d.ts +36 -0
- package/dist/types/spacestation/src/contracts/retrieval/core/platform-connector.d.ts +49 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/articles/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/articles/types.d.ts +29 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/client.d.ts +238 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/collections/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/collections/types.d.ts +23 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/connector.d.ts +11 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/domains.d.ts +27 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/faq/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/faq/types.d.ts +21 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/option-values.d.ts +71 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/policies/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/policies/types.d.ts +18 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/products/source.d.ts +5 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/products/types.d.ts +47 -0
- package/dist/types/spacestation/src/contracts/retrieval/index.d.ts +25 -0
- package/dist/types/spacestation/src/contracts/session-arrival-params.d.ts +32 -0
- package/dist/types/spacestation/src/contracts/session-arrival.d.ts +215 -0
- package/dist/types/spacestation/src/contracts/tools/definitions.d.ts +139 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +135 -0
- package/dist/types/spacestation/src/contracts/tools/index.d.ts +9 -0
- package/dist/types/spacestation/src/contracts/tools/types.d.ts +163 -0
- package/dist/types/spacestation/src/focus/focus.d.ts +12 -0
- package/dist/types/spacestation/src/hydration/hydration.d.ts +46 -0
- package/dist/types/spacestation/src/index.d.ts +71 -0
- package/dist/types/spacestation/src/layout/apply-patch.d.ts +17 -0
- package/dist/types/spacestation/src/layout/conversation.d.ts +136 -0
- package/dist/types/spacestation/src/layout/layout-diff.d.ts +17 -0
- package/dist/types/spacestation/src/layout/layout.d.ts +275 -0
- package/dist/types/spacestation/src/layout/page.d.ts +244 -0
- package/dist/types/spacestation/src/layout/patch.d.ts +92 -0
- package/dist/types/spacestation/src/layout/reduce-patch.d.ts +19 -0
- package/dist/types/spacestation/src/layout/reserved-ids.d.ts +13 -0
- package/dist/types/spacestation/src/projection/projection.d.ts +249 -0
- package/dist/types/spacestation/src/shell/shell.d.ts +109 -0
- package/dist/types/spacestation/src/signal/agent-signals.d.ts +539 -0
- package/dist/types/spacestation/src/space/connector.d.ts +61 -0
- package/dist/types/spacestation/src/space/generation-job.d.ts +4 -0
- package/dist/types/spacestation/src/space/hosting.d.ts +36 -0
- package/dist/types/spacestation/src/space/manifest.d.ts +8 -0
- package/dist/types/spacestation/src/space/package-version.d.ts +18 -0
- package/dist/types/spacestation/src/space/package.d.ts +35 -0
- package/dist/types/spacestation/src/space/prompt-config.d.ts +17 -0
- package/dist/types/spacestation/src/space/session-activity.d.ts +71 -0
- package/dist/types/spacestation/src/space/session-queue.d.ts +2147 -0
- package/dist/types/spacestation/src/space/space-config.d.ts +96 -0
- package/dist/types/spacestation/src/space/space-otp.d.ts +18 -0
- package/dist/types/spacestation/src/space/space.d.ts +104 -0
- package/dist/types/spacestation/src/space/tool-manifest.d.ts +8 -0
- package/dist/types/spacestation/src/space/trace.d.ts +555 -0
- package/dist/types/spacestation/src/space/workspace-catalog.d.ts +112 -0
- package/dist/types/spacestation/src/tool-compression/compress.d.ts +88 -0
- package/dist/types/spacestation/src/tool-compression/index.d.ts +11 -0
- package/dist/types/spacestation/src/tool-compression/scoring.d.ts +38 -0
- package/dist/types/spacestation/src/tool-compression/tokenize.d.ts +29 -0
- package/dist/types/spacestation/src/trace/trace-data.d.ts +126 -0
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +224 -0
- package/dist/types/spacestation/src/trace/trace-envelopes.d.ts +144 -0
- package/dist/types/spacestation/src/trace/trace-events.d.ts +450 -0
- package/dist/types/spacestation/src/types.d.ts +253 -0
- package/dist/types/spacestation/src/view/continuation.d.ts +45 -0
- package/dist/types/spacestation/src/widgets/presence/element.d.ts +241 -0
- package/dist/types/spacestation/src/widgets/presence/frame.d.ts +56 -0
- package/dist/types/spacestation/src/widgets/presence/index.d.ts +4 -0
- package/dist/types/spacestation/src/widgets/presence/profile.d.ts +75 -0
- package/dist/types/spacestation/src/widgets/presence/scan.d.ts +45 -0
- package/package.json +43 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* SESSION ARRIVAL — how a visitor got here, captured once at session create and
|
|
4
|
+
* promoted to COLUMNS on `sessions` rather than left inside the blob.
|
|
5
|
+
*
|
|
6
|
+
* ── Why this exists as its own contract, next to `EntryContext` ──────────────
|
|
7
|
+
*
|
|
8
|
+
* `EntryContext` is deliberately vocabulary-free: "namespace → flat string map",
|
|
9
|
+
* carried verbatim into the prompt so the agent can weigh how someone arrived.
|
|
10
|
+
* It is the right shape for that job and the wrong shape for this one. Reporting
|
|
11
|
+
* needs the opposite properties:
|
|
12
|
+
*
|
|
13
|
+
* 1. A FIXED vocabulary. `traffic_bucket` cannot be derived from a bag whose
|
|
14
|
+
* keys are whatever the host felt like naming.
|
|
15
|
+
* 2. SURVIVAL past 30 days. `supabase/migrations/20260730034247_prune_sessions.sql`
|
|
16
|
+
* replaces the whole blob with `{"pruned": true}` at the space's retention
|
|
17
|
+
* window, and `entryContext` lives inside it — so today the platform loses a
|
|
18
|
+
* day of attribution history every day, and month-over-month comparisons for
|
|
19
|
+
* arrivals older than the window are already impossible. Columns outside the
|
|
20
|
+
* blob are what stop that.
|
|
21
|
+
* 3. A CLOSED set the server can refuse. A prompt block can carry an unknown
|
|
22
|
+
* namespace harmlessly; a dashboard cannot carry an unknown traffic bucket.
|
|
23
|
+
*
|
|
24
|
+
* Both contracts stay. A host reads the entry URL once and produces both: the
|
|
25
|
+
* loose namespaces the agent reads, and the typed arrival the reporting plane
|
|
26
|
+
* reads.
|
|
27
|
+
*
|
|
28
|
+
* ── Why `organic` is not the residual ───────────────────────────────────────
|
|
29
|
+
*
|
|
30
|
+
* Google and Meta auto-tagging is ON by default and emits a click id (`gclid`,
|
|
31
|
+
* `fbclid`, …) with NO utm parameters at all. A classifier whose final `else` is
|
|
32
|
+
* `organic` therefore books every auto-tagged paid click as organic, and the
|
|
33
|
+
* space owner reads "your paid spend produced nothing". That is not a missing
|
|
34
|
+
* feature; it is a wrong number someone will cut a budget on. So `organic` and
|
|
35
|
+
* `unknown` are separate outcomes here, and both are rendered — see
|
|
36
|
+
* `docs/analytics/metric-dictionary.md` §5b.
|
|
37
|
+
*
|
|
38
|
+
* ── Universal layer (§VIII.1) ───────────────────────────────────────────────
|
|
39
|
+
*
|
|
40
|
+
* UTM parameters, ad-network click ids and a referring host are WEB-arrival
|
|
41
|
+
* vocabulary, not ecommerce vocabulary: a recipe space, a real-estate space and a
|
|
42
|
+
* storefront all acquire visitors the same way. Nothing below names a product, a
|
|
43
|
+
* cart or a platform.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Where the assistant was running when the session was created.
|
|
47
|
+
*
|
|
48
|
+
* A dimension rather than a filter someone remembers to write. The console's
|
|
49
|
+
* spacefront preview mints indistinguishable sessions through the same public
|
|
50
|
+
* routes and `packages/stresstest` drives synthetic ones at real slugs, so
|
|
51
|
+
* without this column our own QA lands inside a space owner's numbers. Every
|
|
52
|
+
* owner-facing query defaults to the first three and renders the excluded count.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately NOT `environment`: `apps/api/src/lib/deployment-env.ts:11-15` says
|
|
55
|
+
* that value "names the DEPLOYMENT, not the database — two deploys can both say
|
|
56
|
+
* 'production' while reading different projects", so an `environment` predicate
|
|
57
|
+
* on a preview pointed at prod silently drops real rows. Surfaces are co-tenant
|
|
58
|
+
* inside one database; deployments are not.
|
|
59
|
+
*
|
|
60
|
+
* ── `internal`, and why `playground` is still accepted ────────────────────
|
|
61
|
+
*
|
|
62
|
+
* This value covers ALL of our own traffic: the console's preview iframe AND a
|
|
63
|
+
* signed-in operator browsing the live `/{slug}`. It used to be called
|
|
64
|
+
* `playground`, which named one console screen while meaning both — and the
|
|
65
|
+
* screen it named is now `spacefront`. A dimension whose value describes one
|
|
66
|
+
* producer is a dimension that will be read wrong, which is exactly what
|
|
67
|
+
* happened one line downstream of it. `internal` is what the read layer already
|
|
68
|
+
* calls these rows (`coverage.internalSessionsHidden`).
|
|
69
|
+
*
|
|
70
|
+
* `playground` stays in the enum, DEPRECATED, for one release. Removing it in
|
|
71
|
+
* the same change would refuse arrivals from any browser still running the
|
|
72
|
+
* previous bundle for the length of the deploy window — and would make
|
|
73
|
+
* "promote the previous Vercel deployment" a rollback into a wall. It is
|
|
74
|
+
* accepted, never emitted;
|
|
75
|
+
* `20260821084937_sessions_surface_playground_becomes_internal.sql` backfills
|
|
76
|
+
* the rows that carry it and widens the CHECK to admit both.
|
|
77
|
+
*/
|
|
78
|
+
export declare const SURFACES: readonly ["spacefront", "embed", "headless", "internal", "playground", "automation"];
|
|
79
|
+
export declare const SurfaceSchema: z.ZodEnum<["spacefront", "embed", "headless", "internal", "playground", "automation"]>;
|
|
80
|
+
export type Surface = z.infer<typeof SurfaceSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* The ad-network click identifier a paid arrival carries.
|
|
83
|
+
*
|
|
84
|
+
* Stored as (kind, value) rather than one column per network so adding a network
|
|
85
|
+
* is a value, never a migration. The kind is what the traffic bucket is derived
|
|
86
|
+
* from; the value is what an offline conversion upload would later need.
|
|
87
|
+
*/
|
|
88
|
+
export declare const CLICK_ID_KINDS: readonly ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
89
|
+
export declare const ClickIdKindSchema: z.ZodEnum<["gclid", "fbclid", "msclkid", "wbraid", "gbraid"]>;
|
|
90
|
+
export type ClickIdKind = z.infer<typeof ClickIdKindSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* How much the visitor id this session was created with is actually worth.
|
|
93
|
+
*
|
|
94
|
+
* "Unique visitors" is only a person-count to the extent the id outlives the
|
|
95
|
+
* page. An id minted fresh on every mount makes the metric a synonym for
|
|
96
|
+
* "sessions"; an id supplied by an embedding host means whatever that host's
|
|
97
|
+
* identity model means. Counting all three together without saying so is how the
|
|
98
|
+
* same headline number means two different things depending on how the space was
|
|
99
|
+
* deployed. Carried so the unrecognisable share is PRINTED rather than hidden.
|
|
100
|
+
*
|
|
101
|
+
* persisted — read back from per-space browser storage; survives reloads.
|
|
102
|
+
* ephemeral — minted for this mount only (incognito, storage denied, or a
|
|
103
|
+
* surface that does not persist). Counts as a visit, not a person.
|
|
104
|
+
* host_supplied — the embedding host handed us the id; its lifetime is theirs.
|
|
105
|
+
*/
|
|
106
|
+
export declare const VISITOR_ID_DURABILITIES: readonly ["persisted", "ephemeral", "host_supplied"];
|
|
107
|
+
export declare const VisitorIdDurabilitySchema: z.ZodEnum<["persisted", "ephemeral", "host_supplied"]>;
|
|
108
|
+
export type VisitorIdDurability = z.infer<typeof VisitorIdDurabilitySchema>;
|
|
109
|
+
/**
|
|
110
|
+
* The acquisition bucket a session is reported under.
|
|
111
|
+
*
|
|
112
|
+
* SERVER-DERIVED AND STORED at write time, never asserted by a client and never
|
|
113
|
+
* recomputed at read time: a bucket recomputed later would silently re-book last
|
|
114
|
+
* quarter's revenue when the rule changes, and a bucket a browser can assert is a
|
|
115
|
+
* bucket an affiliate can inflate.
|
|
116
|
+
*
|
|
117
|
+
* `organic` is never a residual: folding untagged traffic into it is the
|
|
118
|
+
* specific mistake that tells an owner their paid spend does nothing. The
|
|
119
|
+
* untagged arrivals get NAMED instead — `social`, `referral`, `own_site` (the
|
|
120
|
+
* owner's own site linking in) and `direct` (no evidence at all). `unknown` is
|
|
121
|
+
* only a hand-written tag nobody can interpret.
|
|
122
|
+
*/
|
|
123
|
+
export declare const TRAFFIC_BUCKETS: readonly ["paid_google", "paid_meta", "paid_other", "organic", "social", "referral", "own_site", "direct", "unknown"];
|
|
124
|
+
export declare const TrafficBucketSchema: z.ZodEnum<["paid_google", "paid_meta", "paid_other", "organic", "social", "referral", "own_site", "direct", "unknown"]>;
|
|
125
|
+
export type TrafficBucket = z.infer<typeof TrafficBucketSchema>;
|
|
126
|
+
/** Per-value ceiling. A campaign name is a label, not an essay, and every one of
|
|
127
|
+
* these lands in a column an owner groups by. */
|
|
128
|
+
export declare const ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
129
|
+
/**
|
|
130
|
+
* What a CLIENT may assert about its own arrival.
|
|
131
|
+
*
|
|
132
|
+
* Everything here is a claim, because everything here is only observable in the
|
|
133
|
+
* browser: an embed's `document.referrer` is the host page and the `Referer`
|
|
134
|
+
* header on the create request is the page that mounted the assistant, not the
|
|
135
|
+
* site that sent the visitor. So the server does not pretend to prove these — it
|
|
136
|
+
* validates, bounds, normalises, and derives the one field that must not be a
|
|
137
|
+
* claim (`trafficBucket`, absent from this schema by construction).
|
|
138
|
+
*
|
|
139
|
+
* `.strict()` rather than passthrough: an unrecognised arrival key is a producer
|
|
140
|
+
* that thinks it is writing a column and is not, and it should fail at the
|
|
141
|
+
* boundary rather than land nowhere.
|
|
142
|
+
*/
|
|
143
|
+
export declare const SessionArrivalSchema: z.ZodEffects<z.ZodObject<{
|
|
144
|
+
utmSource: z.ZodOptional<z.ZodString>;
|
|
145
|
+
utmMedium: z.ZodOptional<z.ZodString>;
|
|
146
|
+
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
147
|
+
utmContent: z.ZodOptional<z.ZodString>;
|
|
148
|
+
utmTerm: z.ZodOptional<z.ZodString>;
|
|
149
|
+
/** Set as a pair or not at all — a kind with no value classifies nothing, and
|
|
150
|
+
* a value with no kind cannot be attributed to a network. Enforced below. */
|
|
151
|
+
clickIdKind: z.ZodOptional<z.ZodEnum<["gclid", "fbclid", "msclkid", "wbraid", "gbraid"]>>;
|
|
152
|
+
clickId: z.ZodOptional<z.ZodString>;
|
|
153
|
+
/** Host only — never a full URL. A path carries query strings, and query
|
|
154
|
+
* strings carry emails and order ids. Normalised server-side. */
|
|
155
|
+
referrerHost: z.ZodOptional<z.ZodString>;
|
|
156
|
+
surface: z.ZodOptional<z.ZodEnum<["spacefront", "embed", "headless", "internal", "playground", "automation"]>>;
|
|
157
|
+
visitorIdDurability: z.ZodOptional<z.ZodEnum<["persisted", "ephemeral", "host_supplied"]>>;
|
|
158
|
+
}, "strict", z.ZodTypeAny, {
|
|
159
|
+
surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
|
|
160
|
+
utmSource?: string | undefined;
|
|
161
|
+
utmMedium?: string | undefined;
|
|
162
|
+
utmCampaign?: string | undefined;
|
|
163
|
+
utmContent?: string | undefined;
|
|
164
|
+
utmTerm?: string | undefined;
|
|
165
|
+
clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
|
|
166
|
+
clickId?: string | undefined;
|
|
167
|
+
referrerHost?: string | undefined;
|
|
168
|
+
visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
|
|
171
|
+
utmSource?: string | undefined;
|
|
172
|
+
utmMedium?: string | undefined;
|
|
173
|
+
utmCampaign?: string | undefined;
|
|
174
|
+
utmContent?: string | undefined;
|
|
175
|
+
utmTerm?: string | undefined;
|
|
176
|
+
clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
|
|
177
|
+
clickId?: string | undefined;
|
|
178
|
+
referrerHost?: string | undefined;
|
|
179
|
+
visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
|
|
180
|
+
}>, {
|
|
181
|
+
surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
|
|
182
|
+
utmSource?: string | undefined;
|
|
183
|
+
utmMedium?: string | undefined;
|
|
184
|
+
utmCampaign?: string | undefined;
|
|
185
|
+
utmContent?: string | undefined;
|
|
186
|
+
utmTerm?: string | undefined;
|
|
187
|
+
clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
|
|
188
|
+
clickId?: string | undefined;
|
|
189
|
+
referrerHost?: string | undefined;
|
|
190
|
+
visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
|
|
191
|
+
}, {
|
|
192
|
+
surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
|
|
193
|
+
utmSource?: string | undefined;
|
|
194
|
+
utmMedium?: string | undefined;
|
|
195
|
+
utmCampaign?: string | undefined;
|
|
196
|
+
utmContent?: string | undefined;
|
|
197
|
+
utmTerm?: string | undefined;
|
|
198
|
+
clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
|
|
199
|
+
clickId?: string | undefined;
|
|
200
|
+
referrerHost?: string | undefined;
|
|
201
|
+
visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
|
|
202
|
+
}>;
|
|
203
|
+
export type SessionArrival = z.infer<typeof SessionArrivalSchema>;
|
|
204
|
+
/**
|
|
205
|
+
* Arrival as it is RECORDED — the client's claims plus the one field the server
|
|
206
|
+
* owns outright.
|
|
207
|
+
*
|
|
208
|
+
* Separate from `SessionArrival` so the type system, not a code review, is what
|
|
209
|
+
* stops a client-supplied `trafficBucket` from ever reaching a column. The
|
|
210
|
+
* create route parses `SessionArrivalSchema`; only the server's resolver can
|
|
211
|
+
* produce this shape.
|
|
212
|
+
*/
|
|
213
|
+
export interface RecordedSessionArrival extends SessionArrival {
|
|
214
|
+
trafficBucket: TrafficBucket;
|
|
215
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { ZodTypeAny } from 'zod';
|
|
2
|
+
import type { ToolExecutionContext } from './execution-context';
|
|
3
|
+
/**
|
|
4
|
+
* MCP-compatible tool descriptor (maps 1:1 to MCP tools/list response).
|
|
5
|
+
*/
|
|
6
|
+
export interface McpToolDescriptor {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Open tool-category slug — used for grouping in the admin UI. Today's
|
|
13
|
+
* conventions include `'catalog'`, `'policy'`, `'memory'`, `'loyalty'`,
|
|
14
|
+
* `'reviews'`, `'inventory'`, `'crm'`, `'payments'`, `'shipping'`,
|
|
15
|
+
* `'analytics'`, `'custom'`. The wire doesn't enforce a closed set so
|
|
16
|
+
* new verticals (recipes, fitness, real-estate) can tag with whatever
|
|
17
|
+
* group label their UI surface needs.
|
|
18
|
+
*/
|
|
19
|
+
export type ToolCategory = string;
|
|
20
|
+
/**
|
|
21
|
+
* Backend a tool's `execute()` routes to — surfaced in the admin Tools
|
|
22
|
+
* Explorer so operators see WHERE a tool goes, and so tools in a
|
|
23
|
+
* multi-backend package (Shopify spans Global MCP / Storefront MCP /
|
|
24
|
+
* Storefront API / client signals) aren't conflated under one endpoint.
|
|
25
|
+
*
|
|
26
|
+
* Architecture invariant §III.2 ("endpoint is a tool-call attribute, not
|
|
27
|
+
* a derivation"): `transport.endpoint` is the per-tool override the wire
|
|
28
|
+
* `tool_call.endpoint` event reads, ahead of the package-level
|
|
29
|
+
* `manifest.mcpEndpoint`. A tool that declares a `transport` owns its
|
|
30
|
+
* endpoint truth — including "none" for in-process transports.
|
|
31
|
+
*/
|
|
32
|
+
export interface ToolTransport {
|
|
33
|
+
/** Backend kind — the Explorer groups tools by this. Open string;
|
|
34
|
+
* conventions: `'mcp'`, `'graphql'`, `'rest'`, `'signal'`. */
|
|
35
|
+
kind: string;
|
|
36
|
+
/** Human-readable backend name, shown as the group header — e.g.
|
|
37
|
+
* `'Shopify Global MCP'`, `'Shopify Storefront API'`. */
|
|
38
|
+
label: string;
|
|
39
|
+
/** Endpoint URL. May be a `{shop}`-templated host for per-merchant
|
|
40
|
+
* backends — descriptor-mode builds keep the template, execute-mode
|
|
41
|
+
* builds carry the resolved URL. Absent for in-process transports
|
|
42
|
+
* (client signals). */
|
|
43
|
+
endpoint?: string;
|
|
44
|
+
/** Wire protocol — e.g. `'JSON-RPC 2.0'`, `'GraphQL'`, `'REST'`. */
|
|
45
|
+
protocol?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Browser-safe descriptor for a tool — everything the admin UI / docs
|
|
49
|
+
* surface needs to display a tool, with NO runtime closures or Zod
|
|
50
|
+
* instances. Serializable end-to-end. Use this in any code that crosses
|
|
51
|
+
* the server/client boundary (REST payloads, RSC props).
|
|
52
|
+
*
|
|
53
|
+
* `FourtyToolDef` extends this with the runtime fields (`execute`, Zod
|
|
54
|
+
* `parameters`) that only the server has.
|
|
55
|
+
*/
|
|
56
|
+
export interface FourtyToolDefDescriptor {
|
|
57
|
+
/** MCP-compatible descriptor (name, description, input schema) */
|
|
58
|
+
descriptor: McpToolDescriptor;
|
|
59
|
+
/** Tool category for grouping in UI */
|
|
60
|
+
category: ToolCategory;
|
|
61
|
+
/** Tags for search/filtering in Tool Studio */
|
|
62
|
+
tags?: string[];
|
|
63
|
+
/** If true, tool is always available to the LLM regardless of admin toggles */
|
|
64
|
+
required?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the tool is enabled by default when no DB `ToolManifest` row
|
|
67
|
+
* overrides it. Absent = `true` (enabled). Set `false` to ship a tool
|
|
68
|
+
* "supported but off": it is registered, browsable in the admin Tools
|
|
69
|
+
* Explorer, and test-runnable, but the LLM does not see it in its
|
|
70
|
+
* ToolSet until an operator enables it per-recipe. `required` (always
|
|
71
|
+
* on) takes precedence.
|
|
72
|
+
*/
|
|
73
|
+
defaultEnabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Declarative absorb shape — when present, the agent's per-session
|
|
76
|
+
* entity registry harvests entries from this tool's result without
|
|
77
|
+
* the runner needing a tool-name switch.
|
|
78
|
+
*
|
|
79
|
+
* Adding a new entity-returning tool (recipes, songs, …) = ship its
|
|
80
|
+
* `entityKind` + `recordsKey` + the `facets` worth lifting onto
|
|
81
|
+
* `EntityRegistryEntry.meta`. The agent code stays vertical-
|
|
82
|
+
* agnostic.
|
|
83
|
+
*/
|
|
84
|
+
resultShape?: {
|
|
85
|
+
/** What kind of entity this tool returns. Open string — verticals
|
|
86
|
+
* ship their own kinds (`product`, `recipe`, `song`, `property`). */
|
|
87
|
+
entityKind: string;
|
|
88
|
+
/** Top-level field on the tool result that carries the array of
|
|
89
|
+
* records (e.g. `'products'`, `'articles'`, `'recipes'`). */
|
|
90
|
+
recordsKey: string;
|
|
91
|
+
/** Per-record field names to lift onto `EntityRegistryEntry.meta`.
|
|
92
|
+
* Universal entry fields (`id`, `title`, `url`, `description`)
|
|
93
|
+
* land on the entry root automatically when present on the
|
|
94
|
+
* record. */
|
|
95
|
+
facets?: string[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Visitor-facing reasoning labels for this tool. Agent infra calls
|
|
99
|
+
* these around tool execution and emits the returned text as a
|
|
100
|
+
* `reasoning_update` beat. Infra owns the EVENT, the tool def
|
|
101
|
+
* (vertical-coupled — Shopify package, custom package, etc.) owns
|
|
102
|
+
* the TEXT — keeps the universal layer free of hardcoded labels.
|
|
103
|
+
*
|
|
104
|
+
* Both functions are optional. Return `null` to skip the beat.
|
|
105
|
+
*
|
|
106
|
+
* running: called the moment the tool starts (input known).
|
|
107
|
+
* done: called when the tool returns (input + result known).
|
|
108
|
+
*/
|
|
109
|
+
reasoning?: {
|
|
110
|
+
running?: (input: unknown) => string | null;
|
|
111
|
+
done?: (input: unknown, result: unknown) => string | null;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Backend this tool routes to — see `ToolTransport`. Replaces the
|
|
115
|
+
* former bare `endpoint?: string`: a tool in a multi-backend package
|
|
116
|
+
* (Shopify spans Global MCP / Storefront MCP / Storefront API / client
|
|
117
|
+
* signals) declares its own transport so the admin Tools Explorer can
|
|
118
|
+
* group + document it, and so the wire `tool_call.endpoint` event
|
|
119
|
+
* stays accurate per tool rather than inheriting one package default.
|
|
120
|
+
*/
|
|
121
|
+
transport?: ToolTransport;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Core tool definition — mirrors FourtyComponentDef pattern.
|
|
125
|
+
* Combines an MCP descriptor with a Zod schema and execution logic.
|
|
126
|
+
*
|
|
127
|
+
* Intent-routing hints (`whenToUse`, `dontUseWhen`, `examples`) ship with
|
|
128
|
+
* the code-defined tool and are the default seed for the `ToolManifest`
|
|
129
|
+
* the intent extractor sees. A DB `ToolManifest` row, when present,
|
|
130
|
+
* overrides them per-recipe. Keeping them on the tool def is what
|
|
131
|
+
* lets the tool author own its own routing few-shots instead of pushing
|
|
132
|
+
* them into a global prompt file.
|
|
133
|
+
*/
|
|
134
|
+
export interface FourtyToolDef extends FourtyToolDefDescriptor {
|
|
135
|
+
/** Zod schema for parameters (source of truth — descriptor.inputSchema derived from this) */
|
|
136
|
+
parameters: ZodTypeAny;
|
|
137
|
+
/** Execute the tool with validated params and runtime context */
|
|
138
|
+
execute: (params: unknown, context: ToolExecutionContext) => Promise<unknown>;
|
|
139
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { EmitFn } from '../../trace/trace-events';
|
|
2
|
+
import type { VisitorLocation, EntityKind } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Runtime context passed to tool execute() functions.
|
|
5
|
+
*
|
|
6
|
+
* `emit` is the same agent-event channel the strategy uses to push
|
|
7
|
+
* SSE events to the client. When a tool calls
|
|
8
|
+
* `context.emit({ type: 'signal', signal: { type: 'cart.add', ... } })`
|
|
9
|
+
* the SDK auto-dispatches it through the registered `signalHandlers`,
|
|
10
|
+
* letting the agent execute side effects (cart, wishlist, navigate,
|
|
11
|
+
* brand-custom verbs) directly during its turn rather than emitting
|
|
12
|
+
* chips for the visitor to click.
|
|
13
|
+
*
|
|
14
|
+
* `emit` is undefined when tools are exercised outside an active
|
|
15
|
+
* agent run (e.g. preflight cache warmup, eval harnesses) — tools
|
|
16
|
+
* that need the channel must guard with `if (context.emit) ...`.
|
|
17
|
+
*/
|
|
18
|
+
export interface ToolExecutionContext {
|
|
19
|
+
visitorId: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
/** Server-resolved space scope. Absent in unscoped tool runners; tools that
|
|
22
|
+
* read space-owned knowledge must refuse retrieval without it. Never take
|
|
23
|
+
* this value from model parameters or infer it from a store domain. */
|
|
24
|
+
spaceId?: string;
|
|
25
|
+
/** Generic data-source domain / origin — mirrors
|
|
26
|
+
* `DataSourceConfig.domain`. Platform-specific tools (Shopify
|
|
27
|
+
* Storefront client, Woo REST client, etc.) interpret it per
|
|
28
|
+
* their convention. */
|
|
29
|
+
domain?: string;
|
|
30
|
+
emit?: EmitFn;
|
|
31
|
+
/**
|
|
32
|
+
* Bounded wait for a FRESH client live-state snapshot (`<namespace>.
|
|
33
|
+
* snapshot`) arriving AFTER this call — the confirmation channel for
|
|
34
|
+
* action tools (`ActionDefinition.confirm`). `resolve` judges each fresh
|
|
35
|
+
* snapshot: `true`/`false` settles the wait with that verdict + the
|
|
36
|
+
* snapshot; `undefined` keeps waiting. Resolves `null` on timeout or
|
|
37
|
+
* session teardown. Bound by the session runtime (same lifecycle as
|
|
38
|
+
* `emit`); absent outside an active session (warmup, evals) — tools
|
|
39
|
+
* must degrade to fire-and-forget when it's missing.
|
|
40
|
+
*/
|
|
41
|
+
awaitStateSnapshot?: (namespace: string, opts: {
|
|
42
|
+
timeoutMs: number;
|
|
43
|
+
/** Judges each fresh snapshot; `baseline` is the namespace's last
|
|
44
|
+
* snapshot from BEFORE the wait began (delta-shaped effects — a
|
|
45
|
+
* quantity bump on an already-present cart line — need it). */
|
|
46
|
+
resolve: (snapshot: Record<string, unknown>, baseline: Record<string, unknown> | undefined) => boolean | undefined;
|
|
47
|
+
}) => Promise<{
|
|
48
|
+
confirmed: boolean;
|
|
49
|
+
snapshot: Record<string, unknown>;
|
|
50
|
+
} | null>;
|
|
51
|
+
/**
|
|
52
|
+
* The client's live state for a namespace AS IT STANDS RIGHT NOW, read
|
|
53
|
+
* synchronously BEFORE any dispatch. The counterpart to
|
|
54
|
+
* `awaitStateSnapshot`, which deliberately ignores stored state because
|
|
55
|
+
* CONFIRMATION must be evidence produced after the write.
|
|
56
|
+
*
|
|
57
|
+
* A PRECONDITION is the opposite problem: it can only be judged against
|
|
58
|
+
* what is already true. Without this an action tool could not tell that the
|
|
59
|
+
* product it is about to add is already in the visitor's cart, so
|
|
60
|
+
* "don't silently double their quantity" could only ever be prompt advice —
|
|
61
|
+
* and it was, in `cart.add`'s own description, while the agent added a
|
|
62
|
+
* second pair anyway. Refusing after the write is not an option: that
|
|
63
|
+
* mutates and then complains.
|
|
64
|
+
*
|
|
65
|
+
* Absent outside an active session (warmup, evals); guards degrade to
|
|
66
|
+
* allowing the action, never to blocking it.
|
|
67
|
+
*/
|
|
68
|
+
readStateSnapshot?: (namespace: string) => Record<string, unknown> | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Hand the client entities this call just resolved, as `ref → entity`, under
|
|
71
|
+
* the `resolverKey` a catalog declares via `resolved()`. The client's
|
|
72
|
+
* hydration pass reads them BEFORE reaching for a hydrator, so a surface
|
|
73
|
+
* whose data this call already fetched costs no round trip at all.
|
|
74
|
+
*
|
|
75
|
+
* Generic by construction: the runtime knows nothing about what any key
|
|
76
|
+
* MEANS. A tool primes what it retrieved, in the shape the entity schema
|
|
77
|
+
* declares; anything the hydrator registry can resolve, a tool can prime.
|
|
78
|
+
* Entities are still schema-validated client-side — priming shortcuts the
|
|
79
|
+
* FETCH, never the contract.
|
|
80
|
+
*
|
|
81
|
+
* Absent outside an active session (warmup, evals) — tools must treat it as
|
|
82
|
+
* an optimisation and stay correct without it.
|
|
83
|
+
*/
|
|
84
|
+
primeEntities?: (resolverKey: string, byRef: Record<string, unknown>) => void;
|
|
85
|
+
/** Coarse IP-derived geolocation captured at session bind. Available
|
|
86
|
+
* to location-aware tools (storeLocator, nearest-pickup, regional
|
|
87
|
+
* policy). Absent when the route had no IP or geoip returned no
|
|
88
|
+
* match — tools must guard before using. */
|
|
89
|
+
visitorLocation?: VisitorLocation;
|
|
90
|
+
/** Known entity refs the session has seen, EACH WITH ITS KIND — gids
|
|
91
|
+
* returned by prior tool calls, gids in the active layout, gids in the
|
|
92
|
+
* entity index. Tools that take entity-id input (any
|
|
93
|
+
* `search_catalog{ids:[...]}` shape) check input refs against this map
|
|
94
|
+
* BEFORE firing upstream — an unknown ref is the LLM hallucinating a gid
|
|
95
|
+
* (Flash drifts on bare-deictic compare prompts: "compare 2 bags" →
|
|
96
|
+
* invented 13-digit numbers). Failing fast with a clear error lets the
|
|
97
|
+
* turn re-plan with real refs instead of round-tripping garbage to the
|
|
98
|
+
* connector and getting HTTP 422.
|
|
99
|
+
*
|
|
100
|
+
* IT CARRIES KIND, not just membership, because a real id of the WRONG
|
|
101
|
+
* KIND passes every membership check and still resolves to the wrong
|
|
102
|
+
* thing. Measured: `cart.set_quantity` was called with a COLLECTION gid
|
|
103
|
+
* as its `productId` — a genuine id the model had seen — producing a
|
|
104
|
+
* phantom cart line titled "WOMEN'S - HEELS" that the next turn then
|
|
105
|
+
* narrated as the visitor's selection. `core.md` already states the rule
|
|
106
|
+
* ("an id's entity kind is fixed by what fetched it"); a kind-blind
|
|
107
|
+
* `Set<string>` made it unenforceable, so it was prose only.
|
|
108
|
+
*
|
|
109
|
+
* Optional — older callers may not populate it. Tools without
|
|
110
|
+
* entity-id inputs ignore it entirely. */
|
|
111
|
+
knownEntityRefs?: ReadonlyMap<string, EntityKind>;
|
|
112
|
+
/**
|
|
113
|
+
* The session's per-entity FACET bag for one id — `EntityRegistryEntry.meta`,
|
|
114
|
+
* read by id. The universal layer stays vertical-neutral: it hands over the
|
|
115
|
+
* open bag and the reader interprets whichever facets its own vertical
|
|
116
|
+
* declared (§VIII.1), exactly as `ActionDefinition.guard` / `confirm` own the
|
|
117
|
+
* interpretation of a client-state namespace.
|
|
118
|
+
*
|
|
119
|
+
* It exists because a PRECONDITION can need facts about the ENTITIES a payload
|
|
120
|
+
* names, not only the client's live state. `cart.add` must not carry a stated
|
|
121
|
+
* option value ("size 9") to a product whose reported axes don't have it, and
|
|
122
|
+
* must not count an item that cannot take that value as one the visitor might
|
|
123
|
+
* have meant — both are judgements about the entity, and without them the
|
|
124
|
+
* boundary could only ask the model nicely. It asked: measured 2026-08-05, a
|
|
125
|
+
* plain "add to cart im size 9" over a three-piece look listed the handbag and
|
|
126
|
+
* the one-size sunglasses as candidates beside the loafer, so the add refused
|
|
127
|
+
* as ambiguous and the visitor was asked to choose between two items with no
|
|
128
|
+
* size 9 between them.
|
|
129
|
+
*
|
|
130
|
+
* Returns undefined when the id is unknown or carried no facets, and the
|
|
131
|
+
* reader itself is absent outside an active session (warmup, evals) — guards
|
|
132
|
+
* degrade to allowing, never to blocking.
|
|
133
|
+
*/
|
|
134
|
+
entityFacets?: (id: string) => Record<string, unknown> | undefined;
|
|
135
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool package contracts — the type surface a tool package must satisfy.
|
|
3
|
+
*
|
|
4
|
+
* Lives in `@fourty/spacestation` so a tool package can implement it WITHOUT
|
|
5
|
+
* depending on `@fourty/agent`. Agent's `tools/types.ts` re-exports these
|
|
6
|
+
* as shims; runtime-coupled tool types (`ResolvedToolSet`, `ToolManifest`,
|
|
7
|
+
* `ValidationResult`) stay in `@fourty/agent`.
|
|
8
|
+
*/
|
|
9
|
+
export type { McpToolDescriptor, ToolCategory, ToolTransport, FourtyToolDefDescriptor, FourtyToolDef, ToolExecutionContext, FourtyToolPackageManifest, FourtyToolPackageDescriptor, FourtyToolPackage, ToolPackageProvider, DefineToolOptions, } from './types';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool package contracts — the type surface a tool package (first- or
|
|
3
|
+
* third-party) must satisfy.
|
|
4
|
+
*
|
|
5
|
+
* These live in `@fourty/spacestation` (the neutral contract layer) so a tool
|
|
6
|
+
* package can implement them WITHOUT depending on `@fourty/agent`. The
|
|
7
|
+
* agent's `tools/types.ts` re-exports these as thin shims, so
|
|
8
|
+
* agent-internal imports are unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Runtime-coupled tool types stay in `@fourty/agent`:
|
|
11
|
+
* - `ResolvedToolSet` (pairs `ai`'s ToolSet with manifests)
|
|
12
|
+
* - `ToolManifest`, `ValidationResult`
|
|
13
|
+
* `@fourty/spacestation` peer-deps `zod` only — pulling `ai` in here would break
|
|
14
|
+
* that, so `ResolvedToolSet` is not part of the wire contract surface.
|
|
15
|
+
*/
|
|
16
|
+
import type { ZodTypeAny } from 'zod';
|
|
17
|
+
import type { FourtyToolDef, FourtyToolDefDescriptor, ToolCategory } from './definitions';
|
|
18
|
+
import type { ToolExecutionContext } from './execution-context';
|
|
19
|
+
export type { McpToolDescriptor, ToolCategory, ToolTransport, FourtyToolDefDescriptor, FourtyToolDef } from './definitions';
|
|
20
|
+
export type { ToolExecutionContext } from './execution-context';
|
|
21
|
+
/**
|
|
22
|
+
* Tool package manifest — metadata about who ships this tool collection.
|
|
23
|
+
* Mirrors FourtyPackageManifest.
|
|
24
|
+
*/
|
|
25
|
+
export interface FourtyToolPackageManifest {
|
|
26
|
+
/** npm package name (e.g. "@fourty/mock-tools") */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Semver version string */
|
|
29
|
+
version: string;
|
|
30
|
+
/** Human-readable display name */
|
|
31
|
+
displayName: string;
|
|
32
|
+
/** Short description of the tool package */
|
|
33
|
+
description: string;
|
|
34
|
+
/** Package author or organization */
|
|
35
|
+
author: string;
|
|
36
|
+
/** @fourty/sdk version this package targets */
|
|
37
|
+
fourtySchemaVersion: string;
|
|
38
|
+
/** Optional icon URL or data URI */
|
|
39
|
+
icon?: string;
|
|
40
|
+
/** Optional package homepage URL */
|
|
41
|
+
url?: string;
|
|
42
|
+
/** If wrapping an MCP server, the endpoint URL */
|
|
43
|
+
mcpEndpoint?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Markdown README describing how the package's tools relate — the
|
|
46
|
+
* cross-tool routing logic, when each one wins, the verbs that map
|
|
47
|
+
* to each ("pair with" → get_collections, named entity → search_*,
|
|
48
|
+
* etc). Rendered into the slim tool-planning system prefix so the
|
|
49
|
+
* planner LLM sees one coherent block per package instead of
|
|
50
|
+
* isolated per-tool descriptions that drift out of sync. Per-tool
|
|
51
|
+
* `descriptor.description` stays as the one-line summary; routing
|
|
52
|
+
* lives here.
|
|
53
|
+
*
|
|
54
|
+
* **Two forms:**
|
|
55
|
+
* - `string` — static README. Use for packages where the routing
|
|
56
|
+
* doesn't depend on which tools are enabled.
|
|
57
|
+
* - `(enabledTools) => string` — dynamic README. The registry calls
|
|
58
|
+
* the function with the SET of enabled tool names (after
|
|
59
|
+
* `enabled`/`required`/`disabledTools` resolution). Use when the
|
|
60
|
+
* package has cross-tool routing that must change shape when a
|
|
61
|
+
* tool is disabled — otherwise the README would tell the planner
|
|
62
|
+
* to call a tool it can't see. The Shopify package uses this
|
|
63
|
+
* form to drop sections for off-by-default tools.
|
|
64
|
+
*
|
|
65
|
+
* Absent on packages that need no cross-tool routing (single-tool
|
|
66
|
+
* packages, signal-only packages). Empty / absent READMEs are
|
|
67
|
+
* dropped from the prefix without ceremony.
|
|
68
|
+
*/
|
|
69
|
+
agentReadme?: string | ((enabledTools: ReadonlySet<string>) => string);
|
|
70
|
+
/**
|
|
71
|
+
* Operator-selectable backend providers this package's tools can
|
|
72
|
+
* route to. Empty / absent = the package has a single hardcoded
|
|
73
|
+
* backend (the common case). Multi-provider packages declare their
|
|
74
|
+
* alternatives here so the admin UI renders a provider selector
|
|
75
|
+
* AUTOMATICALLY — no per-package UI code.
|
|
76
|
+
*
|
|
77
|
+
* Selection is **per-tool, per-space** — each tool independently
|
|
78
|
+
* picks its provider. Stored in
|
|
79
|
+
* `space_config.toolConfig.tools[toolName].provider`. Passed to the
|
|
80
|
+
* package factory at execute time as `opts.<registryKey>.toolProviders`
|
|
81
|
+
* (a `Record<toolName, providerName>` map).
|
|
82
|
+
*
|
|
83
|
+
* Example: `@fourty/shopify-tools` ships
|
|
84
|
+
* `[{name:'storefront',…}, {name:'global',…}]`. The space's
|
|
85
|
+
* `search_catalog` can route to `global` while its `get_collections`
|
|
86
|
+
* routes to `storefront` — entirely independently.
|
|
87
|
+
*
|
|
88
|
+
* Generic — any platform (Woo, Magento, …) joins by shipping its
|
|
89
|
+
* own providers list. No admin-UI changes required.
|
|
90
|
+
*/
|
|
91
|
+
availableProviders?: ToolPackageProvider[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Operator-selectable backend provider for a tool package. Declared on
|
|
95
|
+
* the package manifest's `availableProviders`; rendered by the admin
|
|
96
|
+
* settings UI as a per-tool radio selector.
|
|
97
|
+
*/
|
|
98
|
+
export interface ToolPackageProvider {
|
|
99
|
+
/** Wire name persisted into space config + passed to the factory. */
|
|
100
|
+
name: string;
|
|
101
|
+
/** Human label rendered in the admin selector. */
|
|
102
|
+
displayName: string;
|
|
103
|
+
/** One-line explanation of when to pick this provider. */
|
|
104
|
+
description: string;
|
|
105
|
+
/** Whether this provider is the default when no per-tool selection
|
|
106
|
+
* is set. Exactly one provider should be marked `default: true`. */
|
|
107
|
+
default?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Browser-safe descriptor for a tool package — manifest + per-tool
|
|
111
|
+
* descriptors only, no runtime closures or Zod instances. Safe to ship
|
|
112
|
+
* across the server/client boundary (REST responses, RSC props).
|
|
113
|
+
*
|
|
114
|
+
* `FourtyToolPackage` extends this with the executable runtime fields.
|
|
115
|
+
*/
|
|
116
|
+
export interface FourtyToolPackageDescriptor {
|
|
117
|
+
/** Package metadata */
|
|
118
|
+
manifest: FourtyToolPackageManifest;
|
|
119
|
+
/** Tool descriptors keyed by tool name */
|
|
120
|
+
tools: Record<string, FourtyToolDefDescriptor>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A FourtyToolPackage is the unit of tool distribution.
|
|
124
|
+
* Third parties implement this interface to ship tool collections.
|
|
125
|
+
*/
|
|
126
|
+
export interface FourtyToolPackage extends FourtyToolPackageDescriptor {
|
|
127
|
+
/** Tool definitions keyed by tool name (runtime narrowing of the
|
|
128
|
+
* descriptor surface — adds `execute` and Zod `parameters`). */
|
|
129
|
+
tools: Record<string, FourtyToolDef>;
|
|
130
|
+
/** Best-effort hook to open + reserve any persistent transport this
|
|
131
|
+
* package's tools rely on (HTTP keep-alive pool, MCP TLS connection,
|
|
132
|
+
* etc.) so the first real tool call doesn't pay the handshake cost.
|
|
133
|
+
* Callers (session-warmup) invoke fire-and-forget on session create.
|
|
134
|
+
* A failed warmup must not throw — implementations log and return. */
|
|
135
|
+
warmup?(): Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
/** Options for defining a single tool. */
|
|
138
|
+
export interface DefineToolOptions {
|
|
139
|
+
/** Human-readable description (shown to LLM and in Tool Studio) */
|
|
140
|
+
description: string;
|
|
141
|
+
/** Zod schema for parameters */
|
|
142
|
+
parameters: ZodTypeAny;
|
|
143
|
+
/** Execute the tool */
|
|
144
|
+
execute: (params: unknown, context: ToolExecutionContext) => Promise<unknown>;
|
|
145
|
+
/** Tool category for grouping */
|
|
146
|
+
category: ToolCategory;
|
|
147
|
+
/** Tags for search/filtering */
|
|
148
|
+
tags?: string[];
|
|
149
|
+
/** If true, always available to LLM */
|
|
150
|
+
required?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Declarative absorb shape — same field as `FourtyToolDef.resultShape`,
|
|
153
|
+
* forwarded verbatim by `defineTool`.
|
|
154
|
+
*
|
|
155
|
+
* It is repeated here rather than omitted because `defineTool` builds the
|
|
156
|
+
* whole def: a field the helper cannot accept is a field a tool declared
|
|
157
|
+
* through the helper cannot HAVE. Every tool that ships one today is a
|
|
158
|
+
* hand-written descriptor, so the gap stayed invisible until a
|
|
159
|
+
* `defineTool`-built tool needed presence to know what kind of thing it
|
|
160
|
+
* reads — and then the only symptom was a lookup that never appeared.
|
|
161
|
+
*/
|
|
162
|
+
resultShape?: FourtyToolDef['resultShape'];
|
|
163
|
+
}
|