@40rty/ams-sdk 0.5.21 → 0.5.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/index.js +909 -654
  2. package/dist/types/ecommerce/src/buyer-sign-in.d.ts +2 -0
  3. package/dist/types/ecommerce/src/index.d.ts +1 -0
  4. package/dist/types/ecommerce/src/product-sections.d.ts +41 -0
  5. package/dist/types/sdk/src/canvas/index.d.ts +1 -1
  6. package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +4 -0
  7. package/dist/types/sdk/src/canvas/runtime-types.d.ts +3 -0
  8. package/dist/types/sdk/src/client-state/index.d.ts +1 -1
  9. package/dist/types/sdk/src/client-state/server-store.d.ts +3 -0
  10. package/dist/types/sdk/src/host/host-modules.d.ts +466 -26
  11. package/dist/types/sdk/src/session/FourtySessionContext.d.ts +7 -1
  12. package/dist/types/sdk/src/session/index.d.ts +2 -0
  13. package/dist/types/sdk/src/session/use-board.d.ts +19 -0
  14. package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +4 -9
  15. package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +6 -0
  16. package/dist/types/sdk/src/verticals/commerce/index.d.ts +3 -2
  17. package/dist/types/sdk/src/verticals/commerce/product-data-hooks.d.ts +12 -0
  18. package/dist/types/spacestation/src/analytics/ecommerce/funnel.d.ts +6 -2
  19. package/dist/types/spacestation/src/board/board.d.ts +427 -0
  20. package/dist/types/spacestation/src/contracts/session-arrival-params.d.ts +6 -0
  21. package/dist/types/spacestation/src/contracts/session-arrival.d.ts +9 -0
  22. package/dist/types/spacestation/src/contracts/wire-protocol.d.ts +7 -0
  23. package/dist/types/spacestation/src/index.d.ts +6 -4
  24. package/dist/types/spacestation/src/signal/agent-signals.d.ts +3 -0
  25. package/dist/types/spacestation/src/space/session-queue.d.ts +33 -18
  26. package/dist/types/spacestation/src/space/trace.d.ts +56 -4
  27. package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +14 -0
  28. package/dist/types/spacestation/src/widgets/presence/profile.d.ts +2 -2
  29. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { InteractionSignal, SuggestionAction, SuggestionActions, AgentSignal, PhaseProgress, ChatMessage, ConversationSummary, AttachmentRef } from '../../../spacestation/src/index';
1
+ import type { InteractionSignal, SuggestionAction, SuggestionActions, AgentSignal, PhaseProgress, ChatMessage, ConversationSummary, AttachmentRef, BoardCall, BoardState } from '../../../spacestation/src/index';
2
2
  export interface FourtySessionContextValue {
3
3
  sessionId: string | null;
4
4
  /**
@@ -141,6 +141,12 @@ export interface FourtySessionContextValue {
141
141
  * be a separate, weaker token minted server-side.
142
142
  */
143
143
  shareCanvas: () => Promise<string | null>;
144
+ /**
145
+ * One shared-board call for this session — share the hunt, edit the board,
146
+ * leave it. Resolves to the board as this member now sees it (also live via
147
+ * `useBoard`), or null when it could not be made.
148
+ */
149
+ board: (call: BoardCall) => Promise<BoardState | null>;
144
150
  /**
145
151
  * The visitor's recent conversations (most-recent-first), LOCAL to this
146
152
  * browser. Includes the current one once it has a message. Drives the
@@ -4,3 +4,5 @@ export { withSignalTurn } from './turn-attributed-session';
4
4
  export { getVisitorLocale, commerceLocaleOf } from './visitor-locale';
5
5
  export { SpaceLocaleProvider, useSpaceLocale, useTextDirection } from './space-locale-context';
6
6
  export { registerSessionScopedClear, runSessionScopedClearHandlers } from './clear-registry';
7
+ export { useBoard, type BoardApi } from './use-board';
8
+ export type { BoardProjection, BoardEdit, BoardShare, BoardFact, BoardItem, BoardMember } from '../../../spacestation/src/index';
@@ -0,0 +1,19 @@
1
+ import { type BoardEdit, type BoardProjection, type BoardShare } from '../../../spacestation/src/index';
2
+ export interface BoardApi {
3
+ /** The shared board this session is on, or null. Live: every member's edit lands here. */
4
+ board: BoardProjection | null;
5
+ /** Share this session's hunt — the facts and items the visitor chose — and resolve to the link to send, or null. */
6
+ share: (share: BoardShare, name?: string) => Promise<string | null>;
7
+ /** Change one shared fact or item. Shows at once; the board puts it right if the server refuses. */
8
+ edit: (edit: BoardEdit) => void;
9
+ /** Take this session off the board. */
10
+ leave: () => void;
11
+ /** The link that opens this board, or null when on none. */
12
+ link: string | null;
13
+ }
14
+ /**
15
+ * The shared board — a hunt several visitors shape together (docs/shared-boards.md).
16
+ * Each keeps their own session and thread with the agent; what the board holds (agreed facts, collected items) is
17
+ * everyone's, and this hook re-renders when anyone changes it.
18
+ */
19
+ export declare function useBoard(): BoardApi;
@@ -1,6 +1,6 @@
1
1
  import type { InstallmentOffer, Money, Product } from '../../../../ecommerce/src/index';
2
- export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ProductFieldApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
3
- import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ProductFieldApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
2
+ export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ProductFieldApi, ProductSectionApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
3
+ import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ProductFieldApi, ProductSectionApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
4
4
  /**
5
5
  * FourtyCommerceRuntime — the commerce-hook surface the catalog
6
6
  * consumes. Same dependency-inversion pattern as `FourtyRuntime`: these
@@ -39,6 +39,8 @@ export interface FourtyCommerceRuntime {
39
39
  useStoreArticles: (productIds: ReadonlyArray<string>, topic: string) => StoreArticlesApi;
40
40
  /** One store product field the brand declared, read on the server. */
41
41
  useProductField: (productId: string | undefined, namespace: string, key: string) => ProductFieldApi;
42
+ /** One section of a product's store page the brand declared, fetched on the server. */
43
+ useProductSection: (productId: string | undefined, sectionId: string) => ProductSectionApi;
42
44
  /** The whole bag in ONE checkout through Shop, across its stores. */
43
45
  useShopCheckout: () => ShopCheckoutApi;
44
46
  /** One page of the space's catalog search. */
@@ -96,13 +98,6 @@ export declare function useAskStore(): AskStoreApi;
96
98
  * to `topic`. Not available (empty) on a single store's space or without a
97
99
  * `<CommerceProvider>`. */
98
100
  export declare function useStoreArticles(productIds: ReadonlyArray<string>, topic: string): StoreArticlesApi;
99
- /** One product field the store keeps off its public storefront API (a Shopify
100
- * metafield with storefront access off), read on the server with the space's
101
- * own store access. Only a field the brand DECLARES in its `BrandDefinition.config`
102
- * (`buildProductFieldsConfig`) is read — any other comes back `error`. `loading`
103
- * while `productId` is undefined or the read is in flight; `value` is undefined
104
- * when the product has no such field. */
105
- export declare function useProductField(productId: string | undefined, namespace: string, key: string): ProductFieldApi;
106
101
  /** The whole bag in ONE checkout through Shop, even across several stores
107
102
  * (`combined`), or each store separately with the reason (`separate`). Not
108
103
  * available (and `create` rejects) on a single-store backend, without a bag,
@@ -231,6 +231,12 @@ export interface ProductFieldApi {
231
231
  value: string | undefined;
232
232
  status: 'loading' | 'ready' | 'error';
233
233
  }
234
+ /** Return shape of `useProductSection`: one declared section of a product's store page. */
235
+ export interface ProductSectionApi {
236
+ /** The section's markup as the store renders it; undefined until `ready`, or when the product has no such section. */
237
+ body: string | undefined;
238
+ status: 'loading' | 'ready' | 'error';
239
+ }
234
240
  /** What `useProductSearch` asks for: one page of a catalog search. Prices are major units. */
235
241
  export interface ProductSearchOptions {
236
242
  limit?: number;
@@ -1,6 +1,7 @@
1
1
  import './chip-relevance';
2
- export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useInstallmentOffer, useStoreCheckouts, useAskStore, useStoreArticles, useProductField, useShopCheckout, useProductSearch, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
- export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ProductFieldApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
2
+ export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useInstallmentOffer, useStoreCheckouts, useAskStore, useStoreArticles, useShopCheckout, useProductSearch, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
+ export { useProductField, useProductSection } from './product-data-hooks';
4
+ export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ProductFieldApi, ProductSectionApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
4
5
  export { navigateToExternalCommerceUrl } from './checkout/external-navigation';
5
6
  export type { ExternalNavigationResult } from './checkout/external-navigation';
6
7
  export { recordVariantSelection, getVariantSelection, useVariantSelections, } from './variant/variant-selection-store';
@@ -0,0 +1,12 @@
1
+ import type { ProductFieldApi, ProductSectionApi } from './commerce-shapes';
2
+ /** One product field the store keeps off its public storefront API (a Shopify
3
+ * metafield with storefront access off), read on the server with the space's
4
+ * own store access. `loading` while `productId` is undefined or the read is in
5
+ * flight; `value` is undefined when the product has no such field. */
6
+ export declare function useProductField(productId: string | undefined, namespace: string, key: string): ProductFieldApi;
7
+ /** One section of the product's page on the store's own site, rendered by the
8
+ * store's theme (Shopify: the Section Rendering API, `?section_id=`) and
9
+ * fetched on the server, since the browser cannot read the store's page
10
+ * cross-origin. `loading` while `productId` is undefined or the read is in
11
+ * flight; `body` is undefined when the product has no page or no such section. */
12
+ export declare function useProductSection(productId: string | undefined, sectionId: string): ProductSectionApi;
@@ -10,7 +10,7 @@
10
10
  * vertical calls them the same way it prints an event kind verbatim
11
11
  * (architecture-invariants §XIII.4).
12
12
  */
13
- export declare const FUNNEL_STEPS: readonly ["started", "engaged", "surfaced", "cart", "handoff"];
13
+ export declare const FUNNEL_STEPS: readonly ["started", "browsed", "engaged", "surfaced", "cart", "handoff"];
14
14
  export type FunnelStep = (typeof FUNNEL_STEPS)[number];
15
15
  /**
16
16
  * Each step's STAGE name — the furthest stage a session got to, and the name of
@@ -18,8 +18,12 @@ export type FunnelStep = (typeof FUNNEL_STEPS)[number];
18
18
  * session log's tabs, the log's Stage column and the session header, so the
19
19
  * surfaces cannot disagree about what a step is called.
20
20
  *
21
- * started Landed arrived; no message, nothing added
21
+ * started Landed arrived — every session
22
+ * browsed Browsed did not bounce: interacted, typed or added
22
23
  * engaged Chatted sent at least one message
24
+ *
25
+ * `engaged` meant "not bounced" until 20261122134918 split it; that meaning is
26
+ * `browsed` now, and an old `reached=engaged` link reads as Chatted.
23
27
  * surfaced Viewed products the agent showed them products
24
28
  * cart Added to cart added something
25
29
  * handoff Started checkout clicked through to checkout — NOT a purchase
@@ -0,0 +1,427 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A BOARD — the shared half of a session (docs/shared-boards.md).
4
+ *
5
+ * Several visitors each keep their own session and thread; what they share, live, is the board: the facts they
6
+ * agreed on (who it is for, budget, style) and the items they collected. The vocabulary is vertical-neutral on
7
+ * purpose: an item is an opaque entity ref (§IV.4) — a product to a commerce space, a listing to another — and the
8
+ * commerce engine is what reads them as a wishlist.
9
+ *
10
+ * The board reaches a member's client as the `server-leads` namespace below (docs/session-state-agreement.md); the
11
+ * member's edits travel back as events (`BoardEditSchema`) to the leader, never as competing writes.
12
+ */
13
+ export declare const BOARD_NAMESPACE = "board";
14
+ /** Bounds a board's growth: a board is a shortlist, not a catalog. */
15
+ export declare const BOARD_MAX_FACTS = 12;
16
+ export declare const BOARD_MAX_ITEMS = 60;
17
+ export declare const BOARD_LABEL_MAX = 40;
18
+ export declare const BOARD_VALUE_MAX = 80;
19
+ export declare const BOARD_REF_MAX = 200;
20
+ export declare const BOARD_TITLE_MAX = 80;
21
+ export declare const BOARD_NAME_MAX = 40;
22
+ /** One agreed fact. `by` is the member who set it, as the board shows them (their name, or null when unnamed);
23
+ * `mine` is whether that member is the viewer. */
24
+ export declare const BoardFactSchema: z.ZodObject<{
25
+ label: z.ZodString;
26
+ value: z.ZodString;
27
+ by: z.ZodNullable<z.ZodString>;
28
+ mine: z.ZodBoolean;
29
+ at: z.ZodNumber;
30
+ }, "strip", z.ZodTypeAny, {
31
+ value: string;
32
+ at: number;
33
+ label: string;
34
+ by: string | null;
35
+ mine: boolean;
36
+ }, {
37
+ value: string;
38
+ at: number;
39
+ label: string;
40
+ by: string | null;
41
+ mine: boolean;
42
+ }>;
43
+ export type BoardFact = z.infer<typeof BoardFactSchema>;
44
+ /** One collected item. */
45
+ export declare const BoardItemSchema: z.ZodObject<{
46
+ ref: z.ZodString;
47
+ by: z.ZodNullable<z.ZodString>;
48
+ mine: z.ZodBoolean;
49
+ at: z.ZodNumber;
50
+ }, "strip", z.ZodTypeAny, {
51
+ at: number;
52
+ ref: string;
53
+ by: string | null;
54
+ mine: boolean;
55
+ }, {
56
+ at: number;
57
+ ref: string;
58
+ by: string | null;
59
+ mine: boolean;
60
+ }>;
61
+ export type BoardItem = z.infer<typeof BoardItemSchema>;
62
+ export declare const BoardMemberSchema: z.ZodObject<{
63
+ name: z.ZodNullable<z.ZodString>;
64
+ owner: z.ZodBoolean;
65
+ you: z.ZodBoolean;
66
+ }, "strip", z.ZodTypeAny, {
67
+ name: string | null;
68
+ owner: boolean;
69
+ you: boolean;
70
+ }, {
71
+ name: string | null;
72
+ owner: boolean;
73
+ you: boolean;
74
+ }>;
75
+ export type BoardMember = z.infer<typeof BoardMemberSchema>;
76
+ /**
77
+ * What a member's client holds for the board it is on. `invite` is the link's code: every member may pass the hunt
78
+ * on, so every member holds it. Nothing here names another member's session or visitor id.
79
+ */
80
+ export declare const BoardProjectionSchema: z.ZodObject<{
81
+ title: z.ZodString;
82
+ invite: z.ZodString;
83
+ facts: z.ZodArray<z.ZodObject<{
84
+ label: z.ZodString;
85
+ value: z.ZodString;
86
+ by: z.ZodNullable<z.ZodString>;
87
+ mine: z.ZodBoolean;
88
+ at: z.ZodNumber;
89
+ }, "strip", z.ZodTypeAny, {
90
+ value: string;
91
+ at: number;
92
+ label: string;
93
+ by: string | null;
94
+ mine: boolean;
95
+ }, {
96
+ value: string;
97
+ at: number;
98
+ label: string;
99
+ by: string | null;
100
+ mine: boolean;
101
+ }>, "many">;
102
+ items: z.ZodArray<z.ZodObject<{
103
+ ref: z.ZodString;
104
+ by: z.ZodNullable<z.ZodString>;
105
+ mine: z.ZodBoolean;
106
+ at: z.ZodNumber;
107
+ }, "strip", z.ZodTypeAny, {
108
+ at: number;
109
+ ref: string;
110
+ by: string | null;
111
+ mine: boolean;
112
+ }, {
113
+ at: number;
114
+ ref: string;
115
+ by: string | null;
116
+ mine: boolean;
117
+ }>, "many">;
118
+ members: z.ZodArray<z.ZodObject<{
119
+ name: z.ZodNullable<z.ZodString>;
120
+ owner: z.ZodBoolean;
121
+ you: z.ZodBoolean;
122
+ }, "strip", z.ZodTypeAny, {
123
+ name: string | null;
124
+ owner: boolean;
125
+ you: boolean;
126
+ }, {
127
+ name: string | null;
128
+ owner: boolean;
129
+ you: boolean;
130
+ }>, "many">;
131
+ version: z.ZodNumber;
132
+ }, "strip", z.ZodTypeAny, {
133
+ title: string;
134
+ items: {
135
+ at: number;
136
+ ref: string;
137
+ by: string | null;
138
+ mine: boolean;
139
+ }[];
140
+ version: number;
141
+ invite: string;
142
+ facts: {
143
+ value: string;
144
+ at: number;
145
+ label: string;
146
+ by: string | null;
147
+ mine: boolean;
148
+ }[];
149
+ members: {
150
+ name: string | null;
151
+ owner: boolean;
152
+ you: boolean;
153
+ }[];
154
+ }, {
155
+ title: string;
156
+ items: {
157
+ at: number;
158
+ ref: string;
159
+ by: string | null;
160
+ mine: boolean;
161
+ }[];
162
+ version: number;
163
+ invite: string;
164
+ facts: {
165
+ value: string;
166
+ at: number;
167
+ label: string;
168
+ by: string | null;
169
+ mine: boolean;
170
+ }[];
171
+ members: {
172
+ name: string | null;
173
+ owner: boolean;
174
+ you: boolean;
175
+ }[];
176
+ }>;
177
+ export type BoardProjection = z.infer<typeof BoardProjectionSchema>;
178
+ /** The namespace payload: on a board, or not (left, or never joined). */
179
+ export declare const BoardStateSchema: z.ZodUnion<[z.ZodObject<{
180
+ joined: z.ZodLiteral<true>;
181
+ board: z.ZodObject<{
182
+ title: z.ZodString;
183
+ invite: z.ZodString;
184
+ facts: z.ZodArray<z.ZodObject<{
185
+ label: z.ZodString;
186
+ value: z.ZodString;
187
+ by: z.ZodNullable<z.ZodString>;
188
+ mine: z.ZodBoolean;
189
+ at: z.ZodNumber;
190
+ }, "strip", z.ZodTypeAny, {
191
+ value: string;
192
+ at: number;
193
+ label: string;
194
+ by: string | null;
195
+ mine: boolean;
196
+ }, {
197
+ value: string;
198
+ at: number;
199
+ label: string;
200
+ by: string | null;
201
+ mine: boolean;
202
+ }>, "many">;
203
+ items: z.ZodArray<z.ZodObject<{
204
+ ref: z.ZodString;
205
+ by: z.ZodNullable<z.ZodString>;
206
+ mine: z.ZodBoolean;
207
+ at: z.ZodNumber;
208
+ }, "strip", z.ZodTypeAny, {
209
+ at: number;
210
+ ref: string;
211
+ by: string | null;
212
+ mine: boolean;
213
+ }, {
214
+ at: number;
215
+ ref: string;
216
+ by: string | null;
217
+ mine: boolean;
218
+ }>, "many">;
219
+ members: z.ZodArray<z.ZodObject<{
220
+ name: z.ZodNullable<z.ZodString>;
221
+ owner: z.ZodBoolean;
222
+ you: z.ZodBoolean;
223
+ }, "strip", z.ZodTypeAny, {
224
+ name: string | null;
225
+ owner: boolean;
226
+ you: boolean;
227
+ }, {
228
+ name: string | null;
229
+ owner: boolean;
230
+ you: boolean;
231
+ }>, "many">;
232
+ version: z.ZodNumber;
233
+ }, "strip", z.ZodTypeAny, {
234
+ title: string;
235
+ items: {
236
+ at: number;
237
+ ref: string;
238
+ by: string | null;
239
+ mine: boolean;
240
+ }[];
241
+ version: number;
242
+ invite: string;
243
+ facts: {
244
+ value: string;
245
+ at: number;
246
+ label: string;
247
+ by: string | null;
248
+ mine: boolean;
249
+ }[];
250
+ members: {
251
+ name: string | null;
252
+ owner: boolean;
253
+ you: boolean;
254
+ }[];
255
+ }, {
256
+ title: string;
257
+ items: {
258
+ at: number;
259
+ ref: string;
260
+ by: string | null;
261
+ mine: boolean;
262
+ }[];
263
+ version: number;
264
+ invite: string;
265
+ facts: {
266
+ value: string;
267
+ at: number;
268
+ label: string;
269
+ by: string | null;
270
+ mine: boolean;
271
+ }[];
272
+ members: {
273
+ name: string | null;
274
+ owner: boolean;
275
+ you: boolean;
276
+ }[];
277
+ }>;
278
+ }, "strip", z.ZodTypeAny, {
279
+ board: {
280
+ title: string;
281
+ items: {
282
+ at: number;
283
+ ref: string;
284
+ by: string | null;
285
+ mine: boolean;
286
+ }[];
287
+ version: number;
288
+ invite: string;
289
+ facts: {
290
+ value: string;
291
+ at: number;
292
+ label: string;
293
+ by: string | null;
294
+ mine: boolean;
295
+ }[];
296
+ members: {
297
+ name: string | null;
298
+ owner: boolean;
299
+ you: boolean;
300
+ }[];
301
+ };
302
+ joined: true;
303
+ }, {
304
+ board: {
305
+ title: string;
306
+ items: {
307
+ at: number;
308
+ ref: string;
309
+ by: string | null;
310
+ mine: boolean;
311
+ }[];
312
+ version: number;
313
+ invite: string;
314
+ facts: {
315
+ value: string;
316
+ at: number;
317
+ label: string;
318
+ by: string | null;
319
+ mine: boolean;
320
+ }[];
321
+ members: {
322
+ name: string | null;
323
+ owner: boolean;
324
+ you: boolean;
325
+ }[];
326
+ };
327
+ joined: true;
328
+ }>, z.ZodObject<{
329
+ joined: z.ZodLiteral<false>;
330
+ }, "strip", z.ZodTypeAny, {
331
+ joined: false;
332
+ }, {
333
+ joined: false;
334
+ }>]>;
335
+ export type BoardState = z.infer<typeof BoardStateSchema>;
336
+ /** One edit a member makes. Each fact and each item is its own entry, so two members' edits never conflict. */
337
+ export declare const BoardEditSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
338
+ op: z.ZodLiteral<"fact.set">;
339
+ label: z.ZodString;
340
+ value: z.ZodString;
341
+ }, "strip", z.ZodTypeAny, {
342
+ value: string;
343
+ op: "fact.set";
344
+ label: string;
345
+ }, {
346
+ value: string;
347
+ op: "fact.set";
348
+ label: string;
349
+ }>, z.ZodObject<{
350
+ op: z.ZodLiteral<"fact.clear">;
351
+ label: z.ZodString;
352
+ }, "strip", z.ZodTypeAny, {
353
+ op: "fact.clear";
354
+ label: string;
355
+ }, {
356
+ op: "fact.clear";
357
+ label: string;
358
+ }>, z.ZodObject<{
359
+ op: z.ZodLiteral<"item.add">;
360
+ ref: z.ZodString;
361
+ }, "strip", z.ZodTypeAny, {
362
+ op: "item.add";
363
+ ref: string;
364
+ }, {
365
+ op: "item.add";
366
+ ref: string;
367
+ }>, z.ZodObject<{
368
+ op: z.ZodLiteral<"item.remove">;
369
+ ref: z.ZodString;
370
+ }, "strip", z.ZodTypeAny, {
371
+ op: "item.remove";
372
+ ref: string;
373
+ }, {
374
+ op: "item.remove";
375
+ ref: string;
376
+ }>]>;
377
+ export type BoardEdit = z.infer<typeof BoardEditSchema>;
378
+ /** What the sharer chooses to put on the board when they share: only these facts and items leave their session. */
379
+ export declare const BoardShareSchema: z.ZodObject<{
380
+ title: z.ZodString;
381
+ facts: z.ZodArray<z.ZodObject<{
382
+ label: z.ZodString;
383
+ value: z.ZodString;
384
+ }, "strip", z.ZodTypeAny, {
385
+ value: string;
386
+ label: string;
387
+ }, {
388
+ value: string;
389
+ label: string;
390
+ }>, "many">;
391
+ items: z.ZodArray<z.ZodString, "many">;
392
+ }, "strip", z.ZodTypeAny, {
393
+ title: string;
394
+ items: string[];
395
+ facts: {
396
+ value: string;
397
+ label: string;
398
+ }[];
399
+ }, {
400
+ title: string;
401
+ items: string[];
402
+ facts: {
403
+ value: string;
404
+ label: string;
405
+ }[];
406
+ }>;
407
+ export type BoardShare = z.infer<typeof BoardShareSchema>;
408
+ /** What a member can do to the board they are on, or to the hunt they are about to share. */
409
+ export type BoardCall = {
410
+ kind: 'share';
411
+ share: BoardShare;
412
+ name?: string;
413
+ } | {
414
+ kind: 'edit';
415
+ edit: BoardEdit;
416
+ } | {
417
+ kind: 'leave';
418
+ };
419
+ /** Facts compare by label, case- and space-insensitively: "Budget" and "budget " are one slot. */
420
+ export declare function boardLabelKey(l: string): string;
421
+ /**
422
+ * What a member's own edit does to the board they see, BEFORE the server answers — so a heart fills and a chip goes
423
+ * the moment it is tapped. The server's answer (and every later push) replaces this; it is a preview, never the truth.
424
+ * The board-side rule it previews is the api's `applyEdit`; limits are not previewed (the server refuses, the next push
425
+ * puts the board back).
426
+ */
427
+ export declare function previewBoardEdit(board: BoardProjection, edit: BoardEdit, now: number): BoardProjection;
@@ -2,6 +2,9 @@ import { type SessionArrival, type Surface, type VisitorIdDurability } from './s
2
2
  /** The referring host. Not a landing-URL param — the browser knows it from
3
3
  * `document.referrer` — so it only ever appears on a socket URL. */
4
4
  export declare const REFERRER_HOST_PARAM = "referrer_host";
5
+ /** The landing PATH. Not a landing-URL param either — it is the URL's path — so
6
+ * like the referrer it only ever appears on a socket URL. */
7
+ export declare const LANDING_PATH_PARAM = "landing_path";
5
8
  /** Every LANDING-URL param that is arrival evidence — exported so the host's
6
9
  * strip pass and the boot dial's forwarder cannot disagree with this reader. */
7
10
  export declare const ARRIVAL_PARAMS: readonly string[];
@@ -11,6 +14,9 @@ export interface ArrivalEvidence {
11
14
  /** The referring HOST, already reduced from `document.referrer` with
12
15
  * same-host navigation dropped. Undefined for none. */
13
16
  readonly referrerHost: string | undefined;
17
+ /** The landing path, on a page the spacefront owns. Undefined for none — an
18
+ * embed never supplies one (see `SessionArrivalSchema.landingPath`). */
19
+ readonly landingPath: string | undefined;
14
20
  /** Where the assistant is running. Required — see `readSessionArrival`. */
15
21
  readonly surface: Surface;
16
22
  /** Undefined when the producer cannot know it (the inline boot dial); the
@@ -153,6 +153,11 @@ export declare const SessionArrivalSchema: z.ZodEffects<z.ZodObject<{
153
153
  /** Host only — never a full URL. A path carries query strings, and query
154
154
  * strings carry emails and order ids. Normalised server-side. */
155
155
  referrerHost: z.ZodOptional<z.ZodString>;
156
+ /** The PATH the visitor landed on (`/products/<handle>`), on a page the
157
+ * spacefront owns — never its query, and never an embed's host page,
158
+ * whose paths are the merchant's (and can carry order ids). Normalised
159
+ * server-side. */
160
+ landingPath: z.ZodOptional<z.ZodString>;
156
161
  surface: z.ZodOptional<z.ZodEnum<["spacefront", "embed", "headless", "internal", "playground", "automation"]>>;
157
162
  visitorIdDurability: z.ZodOptional<z.ZodEnum<["persisted", "ephemeral", "host_supplied"]>>;
158
163
  }, "strict", z.ZodTypeAny, {
@@ -165,6 +170,7 @@ export declare const SessionArrivalSchema: z.ZodEffects<z.ZodObject<{
165
170
  clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
166
171
  clickId?: string | undefined;
167
172
  referrerHost?: string | undefined;
173
+ landingPath?: string | undefined;
168
174
  visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
169
175
  }, {
170
176
  surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
@@ -176,6 +182,7 @@ export declare const SessionArrivalSchema: z.ZodEffects<z.ZodObject<{
176
182
  clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
177
183
  clickId?: string | undefined;
178
184
  referrerHost?: string | undefined;
185
+ landingPath?: string | undefined;
179
186
  visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
180
187
  }>, {
181
188
  surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
@@ -187,6 +194,7 @@ export declare const SessionArrivalSchema: z.ZodEffects<z.ZodObject<{
187
194
  clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
188
195
  clickId?: string | undefined;
189
196
  referrerHost?: string | undefined;
197
+ landingPath?: string | undefined;
190
198
  visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
191
199
  }, {
192
200
  surface?: "spacefront" | "embed" | "headless" | "internal" | "playground" | "automation" | undefined;
@@ -198,6 +206,7 @@ export declare const SessionArrivalSchema: z.ZodEffects<z.ZodObject<{
198
206
  clickIdKind?: "gclid" | "fbclid" | "msclkid" | "wbraid" | "gbraid" | undefined;
199
207
  clickId?: string | undefined;
200
208
  referrerHost?: string | undefined;
209
+ landingPath?: string | undefined;
201
210
  visitorIdDurability?: "persisted" | "ephemeral" | "host_supplied" | undefined;
202
211
  }>;
203
212
  export type SessionArrival = z.infer<typeof SessionArrivalSchema>;
@@ -23,3 +23,10 @@ export declare const WIRE_PROTOCOL_PARAM = "protocol";
23
23
  * The close reason says which versions the api accepts.
24
24
  */
25
25
  export declare const WIRE_PROTOCOL_UNSUPPORTED_CLOSE = 4426;
26
+ /**
27
+ * The close code for a socket addressed to a session the api cannot attach
28
+ * (gone, or it failed to start). Terminal: redialling the same id can only get
29
+ * the same answer, so a client must not reconnect on it — one console tab that
30
+ * did redialled a dead session ~1,500 times in 75 minutes (2026-11-25).
31
+ */
32
+ export declare const SESSION_UNAVAILABLE_CLOSE = 4404;