@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,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cart verbs BESIDE `cart.add` — named, and given the actor field the one
|
|
3
|
+
* that needed it was missing.
|
|
4
|
+
*
|
|
5
|
+
* ── WHY THE CONSTANTS EXIST ────────────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* `cart.add` has had a named constant and a parsed payload since the actor work
|
|
8
|
+
* (`cart-add-signal.ts`); its siblings were string literals repeated at each
|
|
9
|
+
* producer and each handler. Survivable while every one of them had exactly ONE
|
|
10
|
+
* producer, which is precisely what stopped being true.
|
|
11
|
+
*
|
|
12
|
+
* ── WHY ONLY `cart.remove` GAINED AN ORIGIN ────────────────────────────────
|
|
13
|
+
*
|
|
14
|
+
* `origin` exists to answer one question — which surface earned this change? —
|
|
15
|
+
* and it is carried only where something downstream actually records the answer:
|
|
16
|
+
*
|
|
17
|
+
* - `cart.remove` emits `CART_LINE_REMOVED` through `removeLine(id, origin)`.
|
|
18
|
+
* It used to bind the literal `'agent'`, justified by having exactly one
|
|
19
|
+
* producer: the site agent's own verb. The WebMCP tool surface makes that
|
|
20
|
+
* false — an external client now dispatches it too — so the literal would
|
|
21
|
+
* book that client's removal as the site agent's. That is the same silent
|
|
22
|
+
* provenance lie `cart.add`'s origin exists to prevent.
|
|
23
|
+
*
|
|
24
|
+
* - `cart.set_quantity` records NO actor anywhere: `updateLine(id, quantity)`
|
|
25
|
+
* takes none and emits no cart-line event. Adding an origin here would be a
|
|
26
|
+
* field nothing reads, which is its own kind of lie — it would imply the
|
|
27
|
+
* rail can answer a question it cannot.
|
|
28
|
+
*
|
|
29
|
+
* - `checkout.begin` books as `'agent'` for a WebMCP-driven arm ON PURPOSE.
|
|
30
|
+
* `CheckoutOrigin` is `visitor | agent`, deliberately NOT `CartOrigin`,
|
|
31
|
+
* because the exit is performed by the agent's own handoff path; the two
|
|
32
|
+
* unions do not line up, are not made to line up, and the metric dictionary
|
|
33
|
+
* carries that as a row. So this file names the signal and stops there.
|
|
34
|
+
*
|
|
35
|
+
* The actor is stamped by the PRODUCER — the only frame where it is still known,
|
|
36
|
+
* since `dispatchCore` hands the handler the payload and nothing else — and
|
|
37
|
+
* parsed by the handler. No default anywhere in the chain: a defaulted origin
|
|
38
|
+
* does not mean "we are not sure", it silently answers the question the field
|
|
39
|
+
* exists to answer.
|
|
40
|
+
*
|
|
41
|
+
* Not `.strict()`, for the same reason `CartAddSignalPayloadSchema` is not: a
|
|
42
|
+
* signal payload legitimately carries extras the handler ignores, and Zod's
|
|
43
|
+
* default strip is right here.
|
|
44
|
+
*/
|
|
45
|
+
import { z } from 'zod';
|
|
46
|
+
/** Remove every cart line matching a product (narrowed by `selections`). */
|
|
47
|
+
export declare const CART_REMOVE_SIGNAL = "cart.remove";
|
|
48
|
+
/** Set a line's ABSOLUTE quantity — never a delta. */
|
|
49
|
+
export declare const CART_SET_QUANTITY_SIGNAL = "cart.set_quantity";
|
|
50
|
+
/** Arm the one exit to the brand's secure checkout. */
|
|
51
|
+
export declare const CHECKOUT_BEGIN_SIGNAL = "checkout.begin";
|
|
52
|
+
/**
|
|
53
|
+
* How both line verbs address a cart line: a product id plus an optional
|
|
54
|
+
* `{axis: value}` constraint. NEVER a cart-line or variant id — those are
|
|
55
|
+
* unstable across the optimistic-write window, so a caller holding one is
|
|
56
|
+
* aiming at a line that may already have been replaced (§III.4.2). The handler
|
|
57
|
+
* binds this description to concrete ids at execution time against live state,
|
|
58
|
+
* so a stale reference can only miss.
|
|
59
|
+
*/
|
|
60
|
+
export declare const CartRemoveSignalPayloadSchema: z.ZodObject<{
|
|
61
|
+
origin: z.ZodEnum<["visitor", "agent", "webmcp"]>;
|
|
62
|
+
productId: z.ZodString;
|
|
63
|
+
selections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
productId: string;
|
|
66
|
+
origin: "visitor" | "agent" | "webmcp";
|
|
67
|
+
selections?: Record<string, string> | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
productId: string;
|
|
70
|
+
origin: "visitor" | "agent" | "webmcp";
|
|
71
|
+
selections?: Record<string, string> | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
export type CartRemoveSignalPayload = z.infer<typeof CartRemoveSignalPayloadSchema>;
|
|
74
|
+
/**
|
|
75
|
+
* What the visitor is told when a `cart.remove` arrives without a usable
|
|
76
|
+
* `origin`. Rendered VERBATIM in the drawer by `commerce-state-report-bridge`,
|
|
77
|
+
* which is why it is a sentence and not a Zod dump — the machine detail goes to
|
|
78
|
+
* the `console.warn` beside it. Mirrors `CART_ADD_MALFORMED_REASON`.
|
|
79
|
+
*/
|
|
80
|
+
export declare const CART_REMOVE_MALFORMED_REASON = "that request was missing something \u2014 nothing was removed";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare module '../layout/page' {
|
|
2
|
+
interface PageKindRegistry {
|
|
3
|
+
product: {
|
|
4
|
+
id: string;
|
|
5
|
+
/**
|
|
6
|
+
* True ONLY for a colour-sibling swap (same product family, different
|
|
7
|
+
* variant) — tells the canvas to morph the live PDP in place (keep
|
|
8
|
+
* scroll, no history push) instead of treating this as a genuine
|
|
9
|
+
* new-page navigation. Every OTHER product click (a comparison-table
|
|
10
|
+
* card, a related-products carousel, a wishlist/cart line) must leave
|
|
11
|
+
* this unset so it navigates normally.
|
|
12
|
+
*/
|
|
13
|
+
morph?: boolean;
|
|
14
|
+
};
|
|
15
|
+
collection: {
|
|
16
|
+
handle: string;
|
|
17
|
+
products?: string[];
|
|
18
|
+
title?: string;
|
|
19
|
+
};
|
|
20
|
+
search: {
|
|
21
|
+
query: string;
|
|
22
|
+
products?: string[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Editorial / blog detail. Lives here, not in core: "article" names a
|
|
26
|
+
* SUBJECT MATTER, so it is a vertical's kind however generic the word
|
|
27
|
+
* sounds — a storefront's editorial surface, same as the platform's
|
|
28
|
+
* article resource that `@fourty/ecommerce`'s `ArticleSchema` models.
|
|
29
|
+
*/
|
|
30
|
+
article: {
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
/** Static CMS page (about / shipping / policy) — the storefront's
|
|
34
|
+
* non-catalog content surface. Vertical for the same reason as `article`. */
|
|
35
|
+
cms: {
|
|
36
|
+
handle: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one signal any surface emits when an option/variant is picked on a
|
|
3
|
+
* product — the visitor tapping the PDP picker, confirming the ambiguous-add
|
|
4
|
+
* modal, or the agent's `product.select_option` verb. There is exactly ONE
|
|
5
|
+
* consumer (the commerce `product.select_option` handler), which fans the pick
|
|
6
|
+
* out to every derived consequence: the shared option-selection store (the
|
|
7
|
+
* `selection` state-report namespace), the resolved exact-variant pin, and —
|
|
8
|
+
* for VISITOR picks only — the `variant.selected` knowledge observation.
|
|
9
|
+
*
|
|
10
|
+
* Dumb surfaces therefore write NOTHING directly: they dispatch this one
|
|
11
|
+
* signal and let the boundary derive the rest. `origin` is the single piece of
|
|
12
|
+
* provenance the boundary needs — a visitor pick is a persistable observation
|
|
13
|
+
* (the agent's slot extractor judges the fact); an agent pick is not (the agent
|
|
14
|
+
* already knows, and re-observing would promote a guess into a stored fact).
|
|
15
|
+
*/
|
|
16
|
+
/** Signal type dispatched by any option/variant pick surface. */
|
|
17
|
+
export declare const PRODUCT_SELECT_OPTION_SIGNAL = "product.select_option";
|
|
18
|
+
/** Payload key carrying provenance — set by visitor-facing surfaces, absent on
|
|
19
|
+
* the agent verb (so the boundary observes visitor picks and only those). */
|
|
20
|
+
export type SelectionOrigin = 'visitor';
|
|
21
|
+
/** The provenance value visitor-facing surfaces stamp on the pick. */
|
|
22
|
+
export declare const SELECTION_ORIGIN_VISITOR: SelectionOrigin;
|
|
23
|
+
/** The out-of-band observation the boundary synthesizes from a VISITOR pick,
|
|
24
|
+
* fed to the agent's slot extractor. Named here so producer + consumer agree. */
|
|
25
|
+
export declare const VARIANT_SELECTED_OBSERVATION = "variant.selected";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* ENTRY CONTEXT — namespaced facts a visitor ARRIVED with, captured once at
|
|
4
|
+
* session create and durable for the session's lifetime.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately vertical- AND capability-neutral (§VIII.1): core knows only
|
|
7
|
+
* "namespace → flat string map" and never what a namespace MEANS. Marketing
|
|
8
|
+
* campaign metadata (`utm_*` → the `campaign` namespace) is the first
|
|
9
|
+
* producer; an affiliate id, a referrer, a partner handle, a kiosk id are all
|
|
10
|
+
* the same shape and need ZERO changes here or in `packages/agent` to ride
|
|
11
|
+
* along. Whoever reads the URL names the namespace and its keys; infra only
|
|
12
|
+
* carries and bounds them.
|
|
13
|
+
*
|
|
14
|
+
* Why FLAT STRINGS rather than `Record<string, unknown>` like
|
|
15
|
+
* `AgentRequest.liveState`: live-state payloads are arbitrarily nested, so
|
|
16
|
+
* they need a registered per-namespace formatter to become prose. Entry
|
|
17
|
+
* context comes off a URL, so it is flat by construction — which lets the
|
|
18
|
+
* prompt block render ANY namespace faithfully with no registry and no
|
|
19
|
+
* capability knowledge. The constraint IS the extension point.
|
|
20
|
+
*/
|
|
21
|
+
/** Per-value ceiling. Infra bounds SIZE; it never judges meaning. */
|
|
22
|
+
export declare const ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
23
|
+
/** Per-namespace key ceiling — one producer can't flood the prompt. */
|
|
24
|
+
export declare const ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
25
|
+
/** Total namespace ceiling across all producers. */
|
|
26
|
+
export declare const ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
27
|
+
/** Key/namespace name ceiling — these render as prompt labels. */
|
|
28
|
+
export declare const ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
29
|
+
/** One entry value — trimmed, non-empty, bounded. */
|
|
30
|
+
export declare const EntryContextValueSchema: z.ZodString;
|
|
31
|
+
/** One namespace's flat entries, e.g. `{ source: 'instagram', campaign: 'summer-sale' }`. */
|
|
32
|
+
export declare const EntryContextNamespaceSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
|
|
33
|
+
/** The whole bag, e.g. `{ campaign: { source: 'instagram' } }`. */
|
|
34
|
+
export declare const EntryContextSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>, Record<string, Record<string, string>>, Record<string, Record<string, string>>>;
|
|
35
|
+
export type EntryContext = z.infer<typeof EntryContextSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge layer contracts — pure type surface.
|
|
3
|
+
*
|
|
4
|
+
* Lives in `@fourty/spacestation` so a source pack can implement it WITHOUT
|
|
5
|
+
* depending on `@fourty/agent`. Agent's `knowledge/types.ts` re-exports
|
|
6
|
+
* these as shims; runtime helpers (`parseKind`, `formatKind`, error
|
|
7
|
+
* classes) and `digestData` stay in `@fourty/agent`.
|
|
8
|
+
*
|
|
9
|
+
* `KnowledgeFetchOptions` is named to avoid colliding with the
|
|
10
|
+
* retrieval-contract `FetchOptions` already in wire's root export.
|
|
11
|
+
*/
|
|
12
|
+
export type { Kind, KindId, KindDef, PromptKbFormatter, EntityRecord, KindCapability, Source, KnowledgeFetchOptions, QueryOptions, KnowledgeStore, UpsertResult, ProjectionKind, ProjectionQuery, ProjectionRequest, ProjectionArtifact, ProjectionComposer, ComposeInput, SpaceKindConfig, KindRegistry, } from './types';
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge layer contracts — generic entity model.
|
|
3
|
+
*
|
|
4
|
+
* Pure type surface only. These live in `@fourty/spacestation` (the neutral
|
|
5
|
+
* contract layer) so a source pack can implement them WITHOUT depending
|
|
6
|
+
* on `@fourty/agent`. The agent's `knowledge/types.ts` re-exports these
|
|
7
|
+
* as shims, and keeps the runtime helpers (`parseKind`, `formatKind`,
|
|
8
|
+
* error classes) — those stay in `@fourty/agent`.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: `FetchOptions` here is exported as `KnowledgeFetchOptions` to
|
|
11
|
+
* avoid colliding with the retrieval-contract `FetchOptions` already in
|
|
12
|
+
* wire's root export. The agent shim re-exports it back as `FetchOptions`
|
|
13
|
+
* so knowledge-internal names are unchanged.
|
|
14
|
+
*
|
|
15
|
+
* Core invariant: this module knows nothing about products, collections,
|
|
16
|
+
* or any specific business entity. Concrete entity kinds (e.g.
|
|
17
|
+
* `shopify.product`) are declared by source packs and registered
|
|
18
|
+
* per-space at config time.
|
|
19
|
+
*/
|
|
20
|
+
import type { z } from 'zod';
|
|
21
|
+
/**
|
|
22
|
+
* A namespaced kind identifier. Always prefixed with the source pack id to
|
|
23
|
+
* avoid collisions when a space mixes kinds from multiple sources (e.g.
|
|
24
|
+
* `shopify.product` vs `stripe.product`).
|
|
25
|
+
*
|
|
26
|
+
* Format: `{sourcePackId}.{localName}` — both segments lowercase, kebab-case.
|
|
27
|
+
*/
|
|
28
|
+
export type Kind = string;
|
|
29
|
+
export interface KindId {
|
|
30
|
+
sourcePack: string;
|
|
31
|
+
localName: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A KindDef bundles the schema for a kind plus its default formatter (used by
|
|
35
|
+
* the prompt_kb projection) and embedder (used by the embeddings projection).
|
|
36
|
+
*
|
|
37
|
+
* Source packs publish KindDefs. Spaces opt in via knowledge_config; an opt-in
|
|
38
|
+
* may override the default formatter/embedder.
|
|
39
|
+
*/
|
|
40
|
+
export interface KindDef<S extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
41
|
+
kind: Kind;
|
|
42
|
+
/** Schema validating the `data` field of every EntityRecord<this kind>. */
|
|
43
|
+
schema: S;
|
|
44
|
+
/** Optional human-readable label for UIs / agent introspection. */
|
|
45
|
+
label?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Formatter for the prompt_kb projection. Returns the prompt-ready string
|
|
48
|
+
* for a single entity. The composer concatenates per-kind blocks; this fn
|
|
49
|
+
* just shapes one record. Pure: given identical input, identical output.
|
|
50
|
+
*/
|
|
51
|
+
formatter?: PromptKbFormatter<z.infer<S>>;
|
|
52
|
+
/**
|
|
53
|
+
* Future: embedder for the embeddings projection. Returns the text that
|
|
54
|
+
* should be vector-encoded. If absent, embeddings projection skips this kind.
|
|
55
|
+
*/
|
|
56
|
+
embedder?: (record: EntityRecord<z.infer<S>>) => string;
|
|
57
|
+
}
|
|
58
|
+
export type PromptKbFormatter<Data> = (record: EntityRecord<Data>) => string;
|
|
59
|
+
/**
|
|
60
|
+
* A single fetched entity. The Store rejects upserts whose `data` does not
|
|
61
|
+
* validate against the declared kind's schema.
|
|
62
|
+
*/
|
|
63
|
+
export interface EntityRecord<Data = unknown> {
|
|
64
|
+
spaceId: string;
|
|
65
|
+
kind: Kind;
|
|
66
|
+
/** Source-stable identity. Stable across refreshes. */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Monotonically increasing per (spaceId, kind, id). Bumped on data change. */
|
|
69
|
+
version: number;
|
|
70
|
+
/** Validated against KindDef.schema. */
|
|
71
|
+
data: Data;
|
|
72
|
+
/** Which Source pulled this record. */
|
|
73
|
+
sourceId: string;
|
|
74
|
+
/**
|
|
75
|
+
* Stable hash of `data` (canonicalized JSON). Drives projection
|
|
76
|
+
* invalidation: a projection is stale iff any included record's digest
|
|
77
|
+
* changed since the projection was built.
|
|
78
|
+
*/
|
|
79
|
+
digest: string;
|
|
80
|
+
fetchedAt: string;
|
|
81
|
+
}
|
|
82
|
+
/** Description of a kind a source pack can produce, for capability advertising. */
|
|
83
|
+
export interface KindCapability {
|
|
84
|
+
kind: Kind;
|
|
85
|
+
/** Indicative max records a single fetch can produce. UI hint. */
|
|
86
|
+
fetchLimit?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A Source pulls EntityRecords from an external system. One Source instance
|
|
90
|
+
* is bound to one (sourcePack, sourceConfig) — e.g. one Shopify store. Its
|
|
91
|
+
* `id` is the binding key persisted on records (so we know who fetched what).
|
|
92
|
+
*
|
|
93
|
+
* Sources are passive: they don't know about projections or runtime caching.
|
|
94
|
+
* They just normalize external data into the EntityRecord shape.
|
|
95
|
+
*/
|
|
96
|
+
export interface Source {
|
|
97
|
+
/** Stable id for this source binding (e.g. 'shopify:tuki-storefront'). */
|
|
98
|
+
readonly id: string;
|
|
99
|
+
/** Which kinds this source can produce. Static metadata. */
|
|
100
|
+
readonly capabilities: ReadonlyArray<KindCapability>;
|
|
101
|
+
/**
|
|
102
|
+
* Fetch records for one declared kind. AsyncIterable so large catalogs can
|
|
103
|
+
* stream without buffering — store can persist as records arrive.
|
|
104
|
+
*/
|
|
105
|
+
fetch(kind: Kind, opts: KnowledgeFetchOptions): AsyncIterable<EntityRecord<unknown>>;
|
|
106
|
+
}
|
|
107
|
+
export interface KnowledgeFetchOptions {
|
|
108
|
+
spaceId: string;
|
|
109
|
+
/** Soft cap on records this fetch should yield. Source may yield fewer. */
|
|
110
|
+
limit?: number;
|
|
111
|
+
/** Optional filter — interpretation is source-specific (best effort). */
|
|
112
|
+
filter?: Record<string, unknown>;
|
|
113
|
+
/** Pulled at this moment; used for fetchedAt. Allows deterministic tests. */
|
|
114
|
+
now?: () => string;
|
|
115
|
+
}
|
|
116
|
+
export interface QueryOptions {
|
|
117
|
+
/** Source-agnostic field filters (e.g. `{ status: 'ACTIVE' }`). Best effort. */
|
|
118
|
+
filter?: Record<string, unknown>;
|
|
119
|
+
/** Cap on returned records. */
|
|
120
|
+
limit?: number;
|
|
121
|
+
/** Stable order key (e.g. 'fetchedAt:desc' or 'data.title:asc'). */
|
|
122
|
+
orderBy?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Persistence interface for EntityRecords. Implementations: in-memory (tests),
|
|
126
|
+
* Postgres (production). The interface is intentionally narrow — projections
|
|
127
|
+
* and access policy live above this layer.
|
|
128
|
+
*/
|
|
129
|
+
export interface KnowledgeStore {
|
|
130
|
+
/** Validates each record's data against the registered KindDef.schema before persisting. */
|
|
131
|
+
upsert<Data>(records: ReadonlyArray<EntityRecord<Data>>): Promise<UpsertResult>;
|
|
132
|
+
query<Data>(spaceId: string, kind: Kind, opts?: QueryOptions): Promise<EntityRecord<Data>[]>;
|
|
133
|
+
delete(spaceId: string, kind: Kind, ids: ReadonlyArray<string>): Promise<{
|
|
134
|
+
deleted: number;
|
|
135
|
+
}>;
|
|
136
|
+
/** List the kinds that have at least one record persisted for this space. */
|
|
137
|
+
listKinds(spaceId: string): Promise<Kind[]>;
|
|
138
|
+
}
|
|
139
|
+
export interface UpsertResult {
|
|
140
|
+
inserted: number;
|
|
141
|
+
updated: number;
|
|
142
|
+
unchanged: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Projection identifier — a string namespace. Built-ins: 'prompt_kb',
|
|
146
|
+
* 'embeddings', 'search_index'. Custom projections register their own.
|
|
147
|
+
*/
|
|
148
|
+
export type ProjectionKind = string;
|
|
149
|
+
/**
|
|
150
|
+
* A description of which records to feed into a projection.
|
|
151
|
+
*/
|
|
152
|
+
export interface ProjectionQuery {
|
|
153
|
+
kind: Kind;
|
|
154
|
+
filter?: Record<string, unknown>;
|
|
155
|
+
limit?: number;
|
|
156
|
+
orderBy?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface ProjectionRequest {
|
|
159
|
+
spaceId: string;
|
|
160
|
+
projection: ProjectionKind;
|
|
161
|
+
queries: ReadonlyArray<ProjectionQuery>;
|
|
162
|
+
/** Token budget across all queries combined. Composer prunes to fit. */
|
|
163
|
+
budgetTokens?: number;
|
|
164
|
+
/** Optional per-kind sub-budget; sum should be ≤ budgetTokens. */
|
|
165
|
+
budgetPerKind?: Partial<Record<Kind, number>>;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The composed result. Stored in kb_projections as a cache. Carries lineage
|
|
169
|
+
* so cascaded invalidation can detect "this projection includes record X
|
|
170
|
+
* which has changed, mark stale".
|
|
171
|
+
*/
|
|
172
|
+
export interface ProjectionArtifact {
|
|
173
|
+
spaceId: string;
|
|
174
|
+
projection: ProjectionKind;
|
|
175
|
+
/** Hash of the request — primary cache key. */
|
|
176
|
+
artifactKey: string;
|
|
177
|
+
/**
|
|
178
|
+
* The actual composed payload. Type depends on projection. Binary
|
|
179
|
+
* payloads use `Uint8Array` (not Node's `Buffer`) so this contract
|
|
180
|
+
* stays node-free — `Buffer` is assignable to `Uint8Array`.
|
|
181
|
+
*/
|
|
182
|
+
artifact: string | Uint8Array | Record<string, unknown>;
|
|
183
|
+
/** { kind: { id: version } } — cascade-invalidation hint. */
|
|
184
|
+
entityVersionSet: Record<Kind, Record<string, number>>;
|
|
185
|
+
tokenCount?: number;
|
|
186
|
+
builtAt: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Composer is generic over projection. Each projection registers a `compose`
|
|
190
|
+
* fn that takes the resolved EntityRecords for the request and produces an
|
|
191
|
+
* artifact.
|
|
192
|
+
*/
|
|
193
|
+
export interface ProjectionComposer<Out extends ProjectionArtifact['artifact']> {
|
|
194
|
+
projection: ProjectionKind;
|
|
195
|
+
/**
|
|
196
|
+
* Given the records resolved for each query (in declaration order), produce
|
|
197
|
+
* the projection artifact. The composer above this layer handles record
|
|
198
|
+
* fetching + budget enforcement; this fn is pure formatting/aggregation.
|
|
199
|
+
*/
|
|
200
|
+
compose(input: ComposeInput): Promise<{
|
|
201
|
+
artifact: Out;
|
|
202
|
+
tokenCount?: number;
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
export interface ComposeInput {
|
|
206
|
+
spaceId: string;
|
|
207
|
+
/**
|
|
208
|
+
* Record sets per query, parallel-indexed with the request's queries array.
|
|
209
|
+
* Already trimmed to per-kind budget by the composer harness.
|
|
210
|
+
*/
|
|
211
|
+
perQuery: ReadonlyArray<{
|
|
212
|
+
query: ProjectionQuery;
|
|
213
|
+
records: ReadonlyArray<EntityRecord<unknown>>;
|
|
214
|
+
kindDef: KindDef;
|
|
215
|
+
}>;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Per-space configuration: which kinds the space cares about, where to source
|
|
219
|
+
* them from, optional formatter/embedder overrides.
|
|
220
|
+
*/
|
|
221
|
+
export interface SpaceKindConfig {
|
|
222
|
+
kind: Kind;
|
|
223
|
+
/** Source instance id binding (e.g. 'shopify:tuki-storefront'). */
|
|
224
|
+
sourceId: string;
|
|
225
|
+
/** Override the default formatter from the KindDef. */
|
|
226
|
+
formatterOverride?: PromptKbFormatter<unknown>;
|
|
227
|
+
}
|
|
228
|
+
export interface KindRegistry {
|
|
229
|
+
/** All kinds publically advertised by installed source packs. */
|
|
230
|
+
listAvailableKinds(): KindDef[];
|
|
231
|
+
/** Kinds the given space has opted into. */
|
|
232
|
+
listSpaceKinds(spaceId: string): SpaceKindConfig[];
|
|
233
|
+
/** Resolve a single kind for a space; throws if not configured. */
|
|
234
|
+
resolveKind(spaceId: string, kind: Kind): {
|
|
235
|
+
kindDef: KindDef;
|
|
236
|
+
spaceConfig: SpaceKindConfig;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KnowledgeSource — the per-domain fetcher abstraction.
|
|
3
|
+
*
|
|
4
|
+
* One source per (platform × domain). Implementations live under
|
|
5
|
+
* `connectors/<vertical>/<platform>/sources/`. Each platform connector
|
|
6
|
+
* picks which sources it implements; missing sources are simply omitted
|
|
7
|
+
* from the connector's `sources` record (typed `Partial`).
|
|
8
|
+
*
|
|
9
|
+
* `fetchSince` is optional — when the upstream platform exposes a
|
|
10
|
+
* cursor / webhook delta API, the orchestrator's L5 freshness pipeline
|
|
11
|
+
* uses it; absent => fall back to TTL-based full refetch.
|
|
12
|
+
*/
|
|
13
|
+
export interface FetchOptions {
|
|
14
|
+
/** Page size for paginated sources. Source picks a sensible default. */
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
/** Hard cap on pages fetched. Source flags `truncated: true` when hit. */
|
|
17
|
+
maxPages?: number;
|
|
18
|
+
/** Cooperative abort signal — connectors should pass to fetch(). */
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
export interface FetchResult<T> {
|
|
22
|
+
records: T[];
|
|
23
|
+
/** True when the page cap was hit before the source was exhausted. */
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
/** Opaque resume token for `fetchSince`. Optional. */
|
|
26
|
+
cursor?: string;
|
|
27
|
+
/** Wall-clock ms when the fetch completed — used for cache age. */
|
|
28
|
+
fetchedAt: number;
|
|
29
|
+
}
|
|
30
|
+
export interface KnowledgeSource<T> {
|
|
31
|
+
/** Stable identifier for telemetry: `${platform}.${domain}`. */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
fetchAll(opts?: FetchOptions): Promise<FetchResult<T>>;
|
|
34
|
+
/** Optional: fetch records changed since the given cursor. */
|
|
35
|
+
fetchSince?(cursor: string, opts?: FetchOptions): Promise<FetchResult<T>>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { EntityRegistryEntry } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Platform connector — bundles all the KnowledgeSources a single
|
|
4
|
+
* platform exposes for a single vertical.
|
|
5
|
+
*
|
|
6
|
+
* `TDomains` is the vertical's domain manifest (e.g. `EcommerceDomains`
|
|
7
|
+
* declared in `retrieval/ecommerce/domains.ts`). The connector's
|
|
8
|
+
* `sources` map is `Partial<TDomains>` because not every platform
|
|
9
|
+
* supports every domain — a platform that lacks reviews simply omits
|
|
10
|
+
* the `reviews` key.
|
|
11
|
+
*
|
|
12
|
+
* `TDomains` is intentionally NOT constrained to `Record<string,
|
|
13
|
+
* KnowledgeSource<unknown>>` — that constraint would reject named
|
|
14
|
+
* interfaces (which lack the implicit string index signature). The
|
|
15
|
+
* registry/factory glue widens to `unknown` and verticals narrow back
|
|
16
|
+
* to their concrete domain manifest at the access boundary via type
|
|
17
|
+
* predicates.
|
|
18
|
+
*
|
|
19
|
+
* Adding a new platform = ship `createXConnector(opts):
|
|
20
|
+
* PlatformConnector<V>` and register via `connectors/registry.ts`.
|
|
21
|
+
*/
|
|
22
|
+
export interface PlatformConnector<TDomains = unknown> {
|
|
23
|
+
/** e.g. 'shopify' | 'woo' | 'custom'. Stable, lowercase. */
|
|
24
|
+
readonly platform: string;
|
|
25
|
+
/** e.g. 'ecommerce' | 'docs' | 'listings'. Matches the vertical
|
|
26
|
+
* whose `TDomains` shape is satisfied by `sources`. */
|
|
27
|
+
readonly vertical: string;
|
|
28
|
+
/** Per-domain source map. Each entry optional; missing = unsupported. */
|
|
29
|
+
readonly sources: Partial<TDomains>;
|
|
30
|
+
/**
|
|
31
|
+
* Vertical-agnostic on-demand entity lookup. Given an array of ids
|
|
32
|
+
* the agent encountered on the canvas without metadata (title,
|
|
33
|
+
* description, vertical-specific facets), return a Map of those ids
|
|
34
|
+
* to fully-shaped `EntityRegistryEntry` records.
|
|
35
|
+
* Missing/inaccessible ids are absent from the result rather than
|
|
36
|
+
* throwing.
|
|
37
|
+
*
|
|
38
|
+
* Called by the agent runner during prompt-assembly when the layout
|
|
39
|
+
* carries ids that aren't in the per-session entity registry. The
|
|
40
|
+
* connector decides how to resolve them (single batch fetch per
|
|
41
|
+
* platform, parallel per-kind, etc.) and returns the metadata the
|
|
42
|
+
* runner needs to render entity-aware prompt blocks.
|
|
43
|
+
*
|
|
44
|
+
* Optional — connectors that don't need on-demand resolution (e.g.
|
|
45
|
+
* verticals where every entity is fetched up-front) can omit it.
|
|
46
|
+
* The runner falls back to "no enrichment" silently.
|
|
47
|
+
*/
|
|
48
|
+
resolveEntities?(ids: ReadonlyArray<string>): Promise<ReadonlyMap<string, EntityRegistryEntry>>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vertical-agnostic, platform-agnostic article record.
|
|
3
|
+
*
|
|
4
|
+
* Lingua franca for editorial / blog content. Shopify articles, Woo
|
|
5
|
+
* posts, headless CMS entries (Contentful / Sanity / etc.) all
|
|
6
|
+
* normalize to this. Indexes treat `id` as opaque + `parentId` /
|
|
7
|
+
* `parentHandle` as optional grouping (blog id / handle on Shopify).
|
|
8
|
+
*/
|
|
9
|
+
export interface CatalogArticle {
|
|
10
|
+
id: string;
|
|
11
|
+
platform: string;
|
|
12
|
+
title: string;
|
|
13
|
+
/** URL slug for the article. */
|
|
14
|
+
handle: string;
|
|
15
|
+
excerpt: string;
|
|
16
|
+
/** Full article body. May contain HTML; chunker treats `\n\n+`
|
|
17
|
+
* as paragraph boundaries regardless. */
|
|
18
|
+
content: string;
|
|
19
|
+
author: string;
|
|
20
|
+
/** ISO-8601 wall-clock timestamp. */
|
|
21
|
+
publishedAt: string;
|
|
22
|
+
imageUrl: string;
|
|
23
|
+
imageAlt: string;
|
|
24
|
+
tags: string[];
|
|
25
|
+
/** Parent group id (e.g. Shopify blog id). Optional. */
|
|
26
|
+
parentId?: string;
|
|
27
|
+
/** Parent group slug. Optional. */
|
|
28
|
+
parentHandle?: string;
|
|
29
|
+
}
|