@40rty/ams-sdk 0.5.3 → 0.5.5
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 +598 -516
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +17 -17
- package/dist/types/sdk/src/catalog/define.d.ts +0 -20
- package/dist/types/sdk/src/host/host-modules.d.ts +48 -17
- package/dist/types/sdk/src/session/index.d.ts +1 -0
- package/dist/types/sdk/src/session/turn-attributed-session.d.ts +5 -0
- package/dist/types/sdk/src/shell/conversation/index.d.ts +1 -0
- package/dist/types/spacestation/src/commerce/cart-add-signal.d.ts +2 -1
- package/dist/types/spacestation/src/commerce/page-kinds.d.ts +7 -0
- package/dist/types/spacestation/src/host/host-page.d.ts +62 -0
- package/dist/types/spacestation/src/index.d.ts +2 -1
- package/dist/types/spacestation/src/layout/page.d.ts +11 -1
- package/dist/types/spacestation/src/space/connector.d.ts +16 -1
- package/dist/types/spacestation/src/space/space.d.ts +7 -0
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -137,7 +137,10 @@ __export(src_exports3, {
|
|
|
137
137
|
GENERATION_EASE: () => GENERATION_EASE,
|
|
138
138
|
GenerationStyleContext: () => GenerationStyleContext,
|
|
139
139
|
GenerationStyleProvider: () => GenerationStyleProvider,
|
|
140
|
+
HOST_CLEARED: () => HOST_CLEARED,
|
|
140
141
|
HandlerRegistryContext: () => HandlerRegistryContext,
|
|
142
|
+
HostClearedSchema: () => HostClearedSchema,
|
|
143
|
+
HostPayloadSchema: () => HostPayloadSchema,
|
|
141
144
|
HydrationStateContext: () => HydrationStateContext,
|
|
142
145
|
HydratorProvider: () => HydratorProvider,
|
|
143
146
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
@@ -162,6 +165,7 @@ __export(src_exports3, {
|
|
|
162
165
|
NavigatePayloadSchema: () => NavigatePayloadSchema,
|
|
163
166
|
NullComponent: () => NullComponent,
|
|
164
167
|
OLDEST_SUPPORTED_SDK: () => OLDEST_SUPPORTED_SDK,
|
|
168
|
+
PAGELESS_HOST_PLACE: () => PAGELESS_HOST_PLACE,
|
|
165
169
|
PRESENCE_CANVAS_REFRESH_SIGNAL: () => PRESENCE_CANVAS_REFRESH_SIGNAL,
|
|
166
170
|
PRESENCE_FACT_DISMISS_SIGNAL: () => PRESENCE_FACT_DISMISS_SIGNAL,
|
|
167
171
|
PRESENCE_FLOW: () => PRESENCE_FLOW,
|
|
@@ -267,6 +271,7 @@ __export(src_exports3, {
|
|
|
267
271
|
VIEW_EXHAUSTED_SIGNAL: () => VIEW_EXHAUSTED_SIGNAL,
|
|
268
272
|
VIEW_EXTEND_SIGNAL: () => VIEW_EXTEND_SIGNAL,
|
|
269
273
|
VIEW_FOCUS_ELEMENT_SIGNAL: () => VIEW_FOCUS_ELEMENT_SIGNAL,
|
|
274
|
+
VIEW_HOST_SIGNAL: () => VIEW_HOST_SIGNAL,
|
|
270
275
|
VISITOR_ACCESS: () => VISITOR_ACCESS,
|
|
271
276
|
VISITOR_CONTEXT_SIGNAL: () => VISITOR_CONTEXT_SIGNAL,
|
|
272
277
|
VISITOR_ID_DURABILITIES: () => VISITOR_ID_DURABILITIES,
|
|
@@ -378,6 +383,8 @@ __export(src_exports3, {
|
|
|
378
383
|
getVisitorLocale: () => getVisitorLocale,
|
|
379
384
|
hapticCue: () => hapticCue,
|
|
380
385
|
hasProse: () => hasProse,
|
|
386
|
+
hostFillsPage: () => hostFillsPage,
|
|
387
|
+
hostPlace: () => hostPlace,
|
|
381
388
|
hostingAllows: () => hostingAllows,
|
|
382
389
|
injectGoogleFonts: () => injectGoogleFonts,
|
|
383
390
|
isActiveDirective: () => isActiveDirective,
|
|
@@ -414,6 +421,8 @@ __export(src_exports3, {
|
|
|
414
421
|
openCartDrawerFocusedOn: () => openCartDrawerFocusedOn,
|
|
415
422
|
orderedVideoSources: () => orderedVideoSources,
|
|
416
423
|
packRows: () => packRows,
|
|
424
|
+
pageIdentityKey: () => pageIdentityKey,
|
|
425
|
+
pagePlace: () => pagePlace,
|
|
417
426
|
parseBcp47Locale: () => parseBcp47Locale,
|
|
418
427
|
parseReleasePreview: () => parseReleasePreview,
|
|
419
428
|
pickCartAddAction: () => pickCartAddAction,
|
|
@@ -567,6 +576,7 @@ __export(src_exports3, {
|
|
|
567
576
|
useContentActions: () => useContentActions,
|
|
568
577
|
useConversationMessages: () => useConversationMessages,
|
|
569
578
|
useConversationPage: () => useConversationPage,
|
|
579
|
+
useConversationPresence: () => useConversationPresence,
|
|
570
580
|
useConversationState: () => useConversationState,
|
|
571
581
|
useConversations: () => useConversations,
|
|
572
582
|
useCurrentMessageIndex: () => useCurrentMessageIndex,
|
|
@@ -679,7 +689,8 @@ __export(src_exports3, {
|
|
|
679
689
|
wipePhases: () => wipePhases,
|
|
680
690
|
wipeProfile: () => wipeProfile,
|
|
681
691
|
withCartActorOrigin: () => withCartActorOrigin,
|
|
682
|
-
withInteractionTracking: () => withInteractionTracking
|
|
692
|
+
withInteractionTracking: () => withInteractionTracking,
|
|
693
|
+
withSignalTurn: () => withSignalTurn
|
|
683
694
|
});
|
|
684
695
|
|
|
685
696
|
// src/analytics/index.ts
|
|
@@ -1432,7 +1443,8 @@ __export(session_exports, {
|
|
|
1432
1443
|
useAction: () => useAction,
|
|
1433
1444
|
useComposerDraft: () => useComposerDraft,
|
|
1434
1445
|
useFourtySession: () => useFourtySession,
|
|
1435
|
-
useOptionalFourtySession: () => useOptionalFourtySession
|
|
1446
|
+
useOptionalFourtySession: () => useOptionalFourtySession,
|
|
1447
|
+
withSignalTurn: () => withSignalTurn
|
|
1436
1448
|
});
|
|
1437
1449
|
|
|
1438
1450
|
// src/session/FourtySessionContext.tsx
|
|
@@ -1510,6 +1522,9 @@ __export(src_exports, {
|
|
|
1510
1522
|
FLOW_OUTPUT_SIGNAL: () => FLOW_OUTPUT_SIGNAL,
|
|
1511
1523
|
FileBugInputSchema: () => FileBugInputSchema,
|
|
1512
1524
|
FocusElementPayloadSchema: () => FocusElementPayloadSchema,
|
|
1525
|
+
HOST_CLEARED: () => HOST_CLEARED,
|
|
1526
|
+
HostClearedSchema: () => HostClearedSchema,
|
|
1527
|
+
HostPayloadSchema: () => HostPayloadSchema,
|
|
1513
1528
|
InteractionSignalSchema: () => InteractionSignalSchema,
|
|
1514
1529
|
JSON_PATCH_OPS: () => JSON_PATCH_OPS,
|
|
1515
1530
|
JsonPatchOpSchema: () => JsonPatchOpSchema,
|
|
@@ -1525,6 +1540,7 @@ __export(src_exports, {
|
|
|
1525
1540
|
NAVIGATE_SIGNAL: () => NAVIGATE_SIGNAL,
|
|
1526
1541
|
NavigatePayloadSchema: () => NavigatePayloadSchema,
|
|
1527
1542
|
OLDEST_SUPPORTED_SDK: () => OLDEST_SUPPORTED_SDK,
|
|
1543
|
+
PAGELESS_HOST_PLACE: () => PAGELESS_HOST_PLACE,
|
|
1528
1544
|
PRESENCE_CANVAS_REFRESH_SIGNAL: () => PRESENCE_CANVAS_REFRESH_SIGNAL,
|
|
1529
1545
|
PRESENCE_FACT_DISMISS_SIGNAL: () => PRESENCE_FACT_DISMISS_SIGNAL,
|
|
1530
1546
|
PRESENCE_FLOW: () => PRESENCE_FLOW,
|
|
@@ -1597,6 +1613,7 @@ __export(src_exports, {
|
|
|
1597
1613
|
VIEW_EXHAUSTED_SIGNAL: () => VIEW_EXHAUSTED_SIGNAL,
|
|
1598
1614
|
VIEW_EXTEND_SIGNAL: () => VIEW_EXTEND_SIGNAL,
|
|
1599
1615
|
VIEW_FOCUS_ELEMENT_SIGNAL: () => VIEW_FOCUS_ELEMENT_SIGNAL,
|
|
1616
|
+
VIEW_HOST_SIGNAL: () => VIEW_HOST_SIGNAL,
|
|
1600
1617
|
VISITOR_ACCESS: () => VISITOR_ACCESS,
|
|
1601
1618
|
VISITOR_CONTEXT_SIGNAL: () => VISITOR_CONTEXT_SIGNAL,
|
|
1602
1619
|
VISITOR_ID_DURABILITIES: () => VISITOR_ID_DURABILITIES,
|
|
@@ -1637,6 +1654,8 @@ __export(src_exports, {
|
|
|
1637
1654
|
formFactorFromViewport: () => formFactorFromViewport,
|
|
1638
1655
|
getProsePaths: () => getProsePaths,
|
|
1639
1656
|
getResolvedPaths: () => getResolvedPaths,
|
|
1657
|
+
hostFillsPage: () => hostFillsPage,
|
|
1658
|
+
hostPlace: () => hostPlace,
|
|
1640
1659
|
hostingAllows: () => hostingAllows,
|
|
1641
1660
|
isActiveDirective: () => isActiveDirective,
|
|
1642
1661
|
isAllowedAttachmentType: () => isAllowedAttachmentType,
|
|
@@ -1652,6 +1671,8 @@ __export(src_exports, {
|
|
|
1652
1671
|
normalizeAttributeField: () => normalizeAttributeField,
|
|
1653
1672
|
normalizeRefs: () => normalizeRefs,
|
|
1654
1673
|
packRows: () => packRows,
|
|
1674
|
+
pageIdentityKey: () => pageIdentityKey,
|
|
1675
|
+
pagePlace: () => pagePlace,
|
|
1655
1676
|
parseReleasePreview: () => parseReleasePreview,
|
|
1656
1677
|
placeBlocks: () => placeBlocks,
|
|
1657
1678
|
placedEntityRefsOf: () => placedEntityRefsOf,
|
|
@@ -1921,8 +1942,10 @@ var EMPTY_SHELL = {};
|
|
|
1921
1942
|
|
|
1922
1943
|
// ../spacestation/src/layout/page.ts
|
|
1923
1944
|
var pageKindSchemas = /* @__PURE__ */ new Map();
|
|
1924
|
-
|
|
1945
|
+
var pageKindIdentityOmit = /* @__PURE__ */ new Map();
|
|
1946
|
+
function registerPageKindSchema(kind, schema, options = {}) {
|
|
1925
1947
|
pageKindSchemas.set(kind, schema);
|
|
1948
|
+
if (options.identityOmit !== void 0) pageKindIdentityOmit.set(kind, new Set(options.identityOmit));
|
|
1926
1949
|
}
|
|
1927
1950
|
function registeredPageKinds() {
|
|
1928
1951
|
return [...pageKindSchemas.keys()];
|
|
@@ -1934,7 +1957,8 @@ registerPageKindSchema(
|
|
|
1934
1957
|
kind: z8.literal("message"),
|
|
1935
1958
|
messageIndex: z8.number().int().nonnegative(),
|
|
1936
1959
|
messageId: z8.string().min(1).optional()
|
|
1937
|
-
})
|
|
1960
|
+
}),
|
|
1961
|
+
{ identityOmit: ["messageId"] }
|
|
1938
1962
|
);
|
|
1939
1963
|
registerPageKindSchema(
|
|
1940
1964
|
"answer",
|
|
@@ -1942,7 +1966,8 @@ registerPageKindSchema(
|
|
|
1942
1966
|
kind: z8.literal("answer"),
|
|
1943
1967
|
messageIndex: z8.number().int().nonnegative(),
|
|
1944
1968
|
messageId: z8.string().min(1).optional()
|
|
1945
|
-
})
|
|
1969
|
+
}),
|
|
1970
|
+
{ identityOmit: ["messageId"] }
|
|
1946
1971
|
);
|
|
1947
1972
|
function lookupPageKindSchema(val) {
|
|
1948
1973
|
if (typeof val !== "object" || val === null || Array.isArray(val)) return null;
|
|
@@ -1974,6 +1999,15 @@ var ViewSchema = z8.object({
|
|
|
1974
1999
|
layout: SpecSchema,
|
|
1975
2000
|
shell: ShellConfigSchema
|
|
1976
2001
|
});
|
|
2002
|
+
var PAGE_IDENTITY_OMIT = /* @__PURE__ */ new Set(["title"]);
|
|
2003
|
+
function kindOmits(kind, key) {
|
|
2004
|
+
const omit = pageKindIdentityOmit.get(kind);
|
|
2005
|
+
return omit !== void 0 && omit.has(key);
|
|
2006
|
+
}
|
|
2007
|
+
function pageIdentityKey(page) {
|
|
2008
|
+
const parts2 = Object.entries(page).filter(([key, value]) => key !== "kind" && value !== void 0 && !PAGE_IDENTITY_OMIT.has(key) && !kindOmits(page.kind, key)).map(([key, value]) => [key, String(value)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value]) => `${key}=${value}`);
|
|
2009
|
+
return parts2.length === 0 ? page.kind : `${page.kind}:${parts2.join(",")}`;
|
|
2010
|
+
}
|
|
1977
2011
|
|
|
1978
2012
|
// ../spacestation/src/commerce/page-kinds.ts
|
|
1979
2013
|
import { z as z9 } from "zod";
|
|
@@ -1982,8 +2016,10 @@ registerPageKindSchema(
|
|
|
1982
2016
|
z9.object({
|
|
1983
2017
|
kind: z9.literal("product"),
|
|
1984
2018
|
id: z9.string().min(1),
|
|
1985
|
-
morph: z9.boolean().optional()
|
|
1986
|
-
|
|
2019
|
+
morph: z9.boolean().optional(),
|
|
2020
|
+
title: z9.string().optional()
|
|
2021
|
+
}),
|
|
2022
|
+
{ identityOmit: ["morph"] }
|
|
1987
2023
|
);
|
|
1988
2024
|
registerPageKindSchema(
|
|
1989
2025
|
"collection",
|
|
@@ -1992,7 +2028,8 @@ registerPageKindSchema(
|
|
|
1992
2028
|
handle: z9.string().min(1),
|
|
1993
2029
|
products: z9.array(z9.string()).optional(),
|
|
1994
2030
|
title: z9.string().optional()
|
|
1995
|
-
})
|
|
2031
|
+
}),
|
|
2032
|
+
{ identityOmit: ["products"] }
|
|
1996
2033
|
);
|
|
1997
2034
|
registerPageKindSchema(
|
|
1998
2035
|
"search",
|
|
@@ -2000,7 +2037,8 @@ registerPageKindSchema(
|
|
|
2000
2037
|
kind: z9.literal("search"),
|
|
2001
2038
|
query: z9.string(),
|
|
2002
2039
|
products: z9.array(z9.string()).optional()
|
|
2003
|
-
})
|
|
2040
|
+
}),
|
|
2041
|
+
{ identityOmit: ["products"] }
|
|
2004
2042
|
);
|
|
2005
2043
|
registerPageKindSchema("article", z9.object({ kind: z9.literal("article"), id: z9.string().min(1) }));
|
|
2006
2044
|
registerPageKindSchema("cms", z9.object({ kind: z9.literal("cms"), handle: z9.string().min(1) }));
|
|
@@ -2205,7 +2243,8 @@ var CartAddSignalPayloadSchema = z13.object({
|
|
|
2205
2243
|
/**
|
|
2206
2244
|
* The agent turn whose canvas element the add came from — stamped by the sdk
|
|
2207
2245
|
* session hooks for a producer inside a turn (`turn-attributed-session.ts`),
|
|
2208
|
-
*
|
|
2246
|
+
* stamped with the live turn for the agent's own add (`FourtyProvider`),
|
|
2247
|
+
* absent for one outside any (the header cart, WebMCP).
|
|
2209
2248
|
* Carried for the same reason as `origin`: the handler that emits the outcome
|
|
2210
2249
|
* sees only this payload.
|
|
2211
2250
|
*/
|
|
@@ -3628,24 +3667,45 @@ function isActiveDirective(directive) {
|
|
|
3628
3667
|
return hasIsolate || directive.isolateToFacts === true || directive.availableOnly === true || directive.limit !== void 0;
|
|
3629
3668
|
}
|
|
3630
3669
|
|
|
3631
|
-
// ../spacestation/src/
|
|
3670
|
+
// ../spacestation/src/host/host-page.ts
|
|
3632
3671
|
import { z as z30 } from "zod";
|
|
3672
|
+
var VIEW_HOST_SIGNAL = "view.host";
|
|
3673
|
+
var HostPayloadSchema = z30.object({
|
|
3674
|
+
page: PageSchema.nullable(),
|
|
3675
|
+
maxSections: z30.number().int().positive().nullable(),
|
|
3676
|
+
surface: z30.enum(["page", "slot"])
|
|
3677
|
+
});
|
|
3678
|
+
var HostClearedSchema = z30.object({ cleared: z30.literal(true) });
|
|
3679
|
+
var HOST_CLEARED = { cleared: true };
|
|
3680
|
+
function hostFillsPage(host) {
|
|
3681
|
+
return host.surface === "page";
|
|
3682
|
+
}
|
|
3683
|
+
var PAGELESS_HOST_PLACE = "host";
|
|
3684
|
+
function hostPlace(host) {
|
|
3685
|
+
return pagePlace(host.page);
|
|
3686
|
+
}
|
|
3687
|
+
function pagePlace(page) {
|
|
3688
|
+
return page === null ? PAGELESS_HOST_PLACE : pageIdentityKey(page);
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
// ../spacestation/src/focus/focus.ts
|
|
3692
|
+
import { z as z31 } from "zod";
|
|
3633
3693
|
var VIEW_FOCUS_ELEMENT_SIGNAL = "view.focus.element";
|
|
3634
|
-
var FocusElementPayloadSchema =
|
|
3635
|
-
elementId:
|
|
3694
|
+
var FocusElementPayloadSchema = z31.object({
|
|
3695
|
+
elementId: z31.string().min(1)
|
|
3636
3696
|
});
|
|
3637
3697
|
|
|
3638
3698
|
// ../spacestation/src/view/continuation.ts
|
|
3639
|
-
import { z as
|
|
3699
|
+
import { z as z32 } from "zod";
|
|
3640
3700
|
var VIEW_EXTEND_SIGNAL = "view.extend";
|
|
3641
|
-
var ViewExtendPayloadSchema =
|
|
3642
|
-
reason:
|
|
3701
|
+
var ViewExtendPayloadSchema = z32.object({
|
|
3702
|
+
reason: z32.enum(["scroll_near_bottom"])
|
|
3643
3703
|
});
|
|
3644
3704
|
var VIEW_EXHAUSTED_SIGNAL = "view.exhausted";
|
|
3645
3705
|
var CONTINUATION_ENABLED = false;
|
|
3646
3706
|
|
|
3647
3707
|
// ../spacestation/src/attachment/attachment.ts
|
|
3648
|
-
import { z as
|
|
3708
|
+
import { z as z33 } from "zod";
|
|
3649
3709
|
var ALLOWED_ATTACHMENT_TYPES = [
|
|
3650
3710
|
"image/jpeg",
|
|
3651
3711
|
"image/png",
|
|
@@ -3660,36 +3720,36 @@ function isAllowedAttachmentType(mime) {
|
|
|
3660
3720
|
function isImageAttachment(mime) {
|
|
3661
3721
|
return mime.startsWith("image/");
|
|
3662
3722
|
}
|
|
3663
|
-
var AttachmentRefSchema =
|
|
3723
|
+
var AttachmentRefSchema = z33.object({
|
|
3664
3724
|
// A UUID, as `storeAttachment` mints it: the id becomes a storage path segment,
|
|
3665
3725
|
// so nothing else — no `/`, no `..` — may reach that lookup.
|
|
3666
|
-
id:
|
|
3667
|
-
mimeType:
|
|
3726
|
+
id: z33.string().uuid(),
|
|
3727
|
+
mimeType: z33.string().refine(isAllowedAttachmentType, {
|
|
3668
3728
|
message: "mimeType not on the attachment allow-list"
|
|
3669
3729
|
}),
|
|
3670
|
-
name:
|
|
3671
|
-
size:
|
|
3672
|
-
url:
|
|
3730
|
+
name: z33.string().min(1),
|
|
3731
|
+
size: z33.number().int().positive().max(MAX_ATTACHMENT_BYTES),
|
|
3732
|
+
url: z33.string().min(1)
|
|
3673
3733
|
});
|
|
3674
|
-
var AttachmentRefsSchema =
|
|
3734
|
+
var AttachmentRefsSchema = z33.array(AttachmentRefSchema);
|
|
3675
3735
|
|
|
3676
3736
|
// ../spacestation/src/contracts/entry-context.ts
|
|
3677
|
-
import { z as
|
|
3737
|
+
import { z as z34 } from "zod";
|
|
3678
3738
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
3679
3739
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
3680
3740
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
3681
3741
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
3682
|
-
var EntryContextValueSchema =
|
|
3683
|
-
var EntryContextNameSchema =
|
|
3684
|
-
var EntryContextNamespaceSchema =
|
|
3742
|
+
var EntryContextValueSchema = z34.string().trim().min(1).max(ENTRY_CONTEXT_MAX_VALUE_CHARS);
|
|
3743
|
+
var EntryContextNameSchema = z34.string().trim().min(1).max(ENTRY_CONTEXT_MAX_NAME_CHARS);
|
|
3744
|
+
var EntryContextNamespaceSchema = z34.record(EntryContextNameSchema, EntryContextValueSchema).refine((entries3) => Object.keys(entries3).length <= ENTRY_CONTEXT_MAX_KEYS, {
|
|
3685
3745
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
3686
3746
|
});
|
|
3687
|
-
var EntryContextSchema =
|
|
3747
|
+
var EntryContextSchema = z34.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
3688
3748
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
3689
3749
|
});
|
|
3690
3750
|
|
|
3691
3751
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
3692
|
-
import { z as
|
|
3752
|
+
import { z as z35 } from "zod";
|
|
3693
3753
|
var SURFACES = [
|
|
3694
3754
|
"spacefront",
|
|
3695
3755
|
"embed",
|
|
@@ -3699,11 +3759,11 @@ var SURFACES = [
|
|
|
3699
3759
|
"playground",
|
|
3700
3760
|
"automation"
|
|
3701
3761
|
];
|
|
3702
|
-
var SurfaceSchema =
|
|
3762
|
+
var SurfaceSchema = z35.enum(SURFACES);
|
|
3703
3763
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
3704
|
-
var ClickIdKindSchema =
|
|
3764
|
+
var ClickIdKindSchema = z35.enum(CLICK_ID_KINDS);
|
|
3705
3765
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
3706
|
-
var VisitorIdDurabilitySchema =
|
|
3766
|
+
var VisitorIdDurabilitySchema = z35.enum(VISITOR_ID_DURABILITIES);
|
|
3707
3767
|
var TRAFFIC_BUCKETS = [
|
|
3708
3768
|
"paid_google",
|
|
3709
3769
|
"paid_meta",
|
|
@@ -3715,10 +3775,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
3715
3775
|
"direct",
|
|
3716
3776
|
"unknown"
|
|
3717
3777
|
];
|
|
3718
|
-
var TrafficBucketSchema =
|
|
3778
|
+
var TrafficBucketSchema = z35.enum(TRAFFIC_BUCKETS);
|
|
3719
3779
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
3720
|
-
var ArrivalValueSchema =
|
|
3721
|
-
var SessionArrivalSchema =
|
|
3780
|
+
var ArrivalValueSchema = z35.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
3781
|
+
var SessionArrivalSchema = z35.object({
|
|
3722
3782
|
utmSource: ArrivalValueSchema.optional(),
|
|
3723
3783
|
utmMedium: ArrivalValueSchema.optional(),
|
|
3724
3784
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -3814,36 +3874,36 @@ var WIRE_PROTOCOL_PARAM = "protocol";
|
|
|
3814
3874
|
var WIRE_PROTOCOL_UNSUPPORTED_CLOSE = 4426;
|
|
3815
3875
|
|
|
3816
3876
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
3817
|
-
import { z as
|
|
3818
|
-
var AttributeScopeBucketSchema =
|
|
3819
|
-
scope:
|
|
3820
|
-
needles:
|
|
3821
|
-
label:
|
|
3877
|
+
import { z as z36 } from "zod";
|
|
3878
|
+
var AttributeScopeBucketSchema = z36.object({
|
|
3879
|
+
scope: z36.string(),
|
|
3880
|
+
needles: z36.array(z36.string()).readonly(),
|
|
3881
|
+
label: z36.string().optional()
|
|
3822
3882
|
});
|
|
3823
|
-
var AttributeScopeConfigSchema =
|
|
3824
|
-
facet:
|
|
3825
|
-
buckets:
|
|
3826
|
-
emptyScope:
|
|
3827
|
-
noMatchScope:
|
|
3828
|
-
ignoreValues:
|
|
3829
|
-
emptyScopeLabel:
|
|
3830
|
-
noMatchScopeLabel:
|
|
3883
|
+
var AttributeScopeConfigSchema = z36.object({
|
|
3884
|
+
facet: z36.string(),
|
|
3885
|
+
buckets: z36.array(AttributeScopeBucketSchema).readonly(),
|
|
3886
|
+
emptyScope: z36.string(),
|
|
3887
|
+
noMatchScope: z36.string(),
|
|
3888
|
+
ignoreValues: z36.array(z36.string()).readonly(),
|
|
3889
|
+
emptyScopeLabel: z36.string().optional(),
|
|
3890
|
+
noMatchScopeLabel: z36.string().optional()
|
|
3831
3891
|
});
|
|
3832
|
-
var AttributeDefBaseSchema =
|
|
3833
|
-
description:
|
|
3834
|
-
durable:
|
|
3835
|
-
label:
|
|
3892
|
+
var AttributeDefBaseSchema = z36.object({
|
|
3893
|
+
description: z36.string().optional(),
|
|
3894
|
+
durable: z36.boolean().optional(),
|
|
3895
|
+
label: z36.string().optional()
|
|
3836
3896
|
});
|
|
3837
|
-
var AttributeDefSchema =
|
|
3838
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
3839
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
3840
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
3841
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
3897
|
+
var AttributeDefSchema = z36.discriminatedUnion("kind", [
|
|
3898
|
+
AttributeDefBaseSchema.extend({ kind: z36.literal("enum"), values: z36.array(z36.string()) }),
|
|
3899
|
+
AttributeDefBaseSchema.extend({ kind: z36.literal("free_text") }),
|
|
3900
|
+
AttributeDefBaseSchema.extend({ kind: z36.literal("date_or_season") }),
|
|
3901
|
+
AttributeDefBaseSchema.extend({ kind: z36.literal("money_or_band") }),
|
|
3842
3902
|
AttributeDefBaseSchema.extend({
|
|
3843
|
-
kind:
|
|
3844
|
-
min:
|
|
3845
|
-
max:
|
|
3846
|
-
unit:
|
|
3903
|
+
kind: z36.literal("number"),
|
|
3904
|
+
min: z36.number().optional(),
|
|
3905
|
+
max: z36.number().optional(),
|
|
3906
|
+
unit: z36.string().optional()
|
|
3847
3907
|
})
|
|
3848
3908
|
]);
|
|
3849
3909
|
var EXTRAS_PREFIX = "extras.";
|
|
@@ -3882,49 +3942,49 @@ function scopeOfAttributeKey(config, key) {
|
|
|
3882
3942
|
}
|
|
3883
3943
|
|
|
3884
3944
|
// ../spacestation/src/space/agent-directive.ts
|
|
3885
|
-
import { z as
|
|
3945
|
+
import { z as z37 } from "zod";
|
|
3886
3946
|
var MAX_ACTIVE_AGENT_DIRECTIVES = 12;
|
|
3887
3947
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
3888
3948
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
3889
3949
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
3890
3950
|
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
3891
|
-
var AgentDirectiveSchema =
|
|
3892
|
-
name:
|
|
3893
|
-
kind:
|
|
3894
|
-
severity:
|
|
3951
|
+
var AgentDirectiveSchema = z37.object({
|
|
3952
|
+
name: z37.string().trim().min(1).max(80),
|
|
3953
|
+
kind: z37.enum(AGENT_DIRECTIVE_KINDS),
|
|
3954
|
+
severity: z37.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
3895
3955
|
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
3896
3956
|
* product name. */
|
|
3897
|
-
text:
|
|
3957
|
+
text: z37.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
3898
3958
|
}).strict();
|
|
3899
|
-
var SpaceAgentDirectiveSchema =
|
|
3900
|
-
id:
|
|
3901
|
-
position:
|
|
3902
|
-
name:
|
|
3903
|
-
kind:
|
|
3904
|
-
severity:
|
|
3905
|
-
text:
|
|
3906
|
-
source:
|
|
3907
|
-
status:
|
|
3959
|
+
var SpaceAgentDirectiveSchema = z37.object({
|
|
3960
|
+
id: z37.string(),
|
|
3961
|
+
position: z37.number().int(),
|
|
3962
|
+
name: z37.string(),
|
|
3963
|
+
kind: z37.enum(AGENT_DIRECTIVE_KINDS),
|
|
3964
|
+
severity: z37.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
3965
|
+
text: z37.string(),
|
|
3966
|
+
source: z37.enum(AGENT_DIRECTIVE_SOURCES),
|
|
3967
|
+
status: z37.enum(AGENT_DIRECTIVE_STATUSES),
|
|
3908
3968
|
/** Who wrote it; null for a lesson the system proposed. */
|
|
3909
|
-
createdBy:
|
|
3969
|
+
createdBy: z37.string().nullable(),
|
|
3910
3970
|
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
3911
|
-
evidence:
|
|
3912
|
-
decidedBy:
|
|
3913
|
-
decidedAt:
|
|
3914
|
-
createdAt:
|
|
3971
|
+
evidence: z37.record(z37.unknown()).nullable(),
|
|
3972
|
+
decidedBy: z37.string().nullable(),
|
|
3973
|
+
decidedAt: z37.string().nullable(),
|
|
3974
|
+
createdAt: z37.string()
|
|
3915
3975
|
});
|
|
3916
|
-
var OutcomeTallySchema =
|
|
3976
|
+
var OutcomeTallySchema = z37.object({ turns: z37.number().int(), acted: z37.number().int() });
|
|
3917
3977
|
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
3918
|
-
impact:
|
|
3978
|
+
impact: z37.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
3919
3979
|
});
|
|
3920
|
-
var UpdateAgentDirectiveInputSchema =
|
|
3980
|
+
var UpdateAgentDirectiveInputSchema = z37.object({
|
|
3921
3981
|
name: AgentDirectiveSchema.shape.name.optional(),
|
|
3922
3982
|
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
3923
3983
|
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
3924
3984
|
text: AgentDirectiveSchema.shape.text.optional(),
|
|
3925
|
-
status:
|
|
3985
|
+
status: z37.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
3926
3986
|
}).strict();
|
|
3927
|
-
var ReorderAgentDirectivesInputSchema =
|
|
3987
|
+
var ReorderAgentDirectivesInputSchema = z37.object({ ids: z37.array(z37.string()).min(1) }).strict();
|
|
3928
3988
|
|
|
3929
3989
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
3930
3990
|
var COMPONENT_SOURCE = {
|
|
@@ -3988,30 +4048,30 @@ function hostingAllows(hosting, surface) {
|
|
|
3988
4048
|
}
|
|
3989
4049
|
|
|
3990
4050
|
// ../spacestation/src/space/trace.ts
|
|
3991
|
-
import { z as
|
|
3992
|
-
var RunTokenUsageSchema =
|
|
3993
|
-
input_tokens:
|
|
3994
|
-
output_tokens:
|
|
3995
|
-
cache_read_tokens:
|
|
4051
|
+
import { z as z38 } from "zod";
|
|
4052
|
+
var RunTokenUsageSchema = z38.object({
|
|
4053
|
+
input_tokens: z38.number().optional(),
|
|
4054
|
+
output_tokens: z38.number().optional(),
|
|
4055
|
+
cache_read_tokens: z38.number().optional()
|
|
3996
4056
|
});
|
|
3997
|
-
var TraceRecordSchema =
|
|
3998
|
-
id:
|
|
3999
|
-
spaceId:
|
|
4000
|
-
sessionId:
|
|
4057
|
+
var TraceRecordSchema = z38.object({
|
|
4058
|
+
id: z38.string().uuid(),
|
|
4059
|
+
spaceId: z38.string().uuid().nullable(),
|
|
4060
|
+
sessionId: z38.string(),
|
|
4001
4061
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
4002
4062
|
* for an unlocked space / anonymous unlock. */
|
|
4003
|
-
visitorEmail:
|
|
4004
|
-
userPrompt:
|
|
4005
|
-
branch:
|
|
4006
|
-
responseText:
|
|
4007
|
-
layout:
|
|
4008
|
-
phaseTimings:
|
|
4009
|
-
tokensByModel:
|
|
4010
|
-
toolCalls:
|
|
4011
|
-
diagnostics:
|
|
4012
|
-
latencyFirstText:
|
|
4013
|
-
latencyFirstPatch:
|
|
4014
|
-
latencyTotal:
|
|
4063
|
+
visitorEmail: z38.string().nullable(),
|
|
4064
|
+
userPrompt: z38.string(),
|
|
4065
|
+
branch: z38.string().nullable(),
|
|
4066
|
+
responseText: z38.string().nullable(),
|
|
4067
|
+
layout: z38.unknown().nullable(),
|
|
4068
|
+
phaseTimings: z38.record(z38.number()).nullable(),
|
|
4069
|
+
tokensByModel: z38.record(RunTokenUsageSchema).nullable(),
|
|
4070
|
+
toolCalls: z38.array(z38.unknown()).nullable(),
|
|
4071
|
+
diagnostics: z38.array(z38.unknown()).nullable(),
|
|
4072
|
+
latencyFirstText: z38.number().int().nullable(),
|
|
4073
|
+
latencyFirstPatch: z38.number().int().nullable(),
|
|
4074
|
+
latencyTotal: z38.number().int().nullable(),
|
|
4015
4075
|
/**
|
|
4016
4076
|
* The CLIENT's turn id for this run, or `null`.
|
|
4017
4077
|
*
|
|
@@ -4027,29 +4087,29 @@ var TraceRecordSchema = z37.object({
|
|
|
4027
4087
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4028
4088
|
* visitor asked something and got nothing.
|
|
4029
4089
|
*/
|
|
4030
|
-
turnId:
|
|
4090
|
+
turnId: z38.string().nullable(),
|
|
4031
4091
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
4032
4092
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
4033
|
-
trackerState:
|
|
4034
|
-
createdAt:
|
|
4093
|
+
trackerState: z38.unknown().nullable(),
|
|
4094
|
+
createdAt: z38.string()
|
|
4035
4095
|
});
|
|
4036
|
-
var MillisecondsSchema =
|
|
4037
|
-
var CreateTraceInputSchema =
|
|
4038
|
-
spaceId:
|
|
4039
|
-
sessionId:
|
|
4040
|
-
visitorEmail:
|
|
4041
|
-
userPrompt:
|
|
4042
|
-
branch:
|
|
4043
|
-
responseText:
|
|
4044
|
-
layout:
|
|
4045
|
-
phaseTimings:
|
|
4046
|
-
tokensByModel:
|
|
4047
|
-
toolCalls:
|
|
4048
|
-
diagnostics:
|
|
4096
|
+
var MillisecondsSchema = z38.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
4097
|
+
var CreateTraceInputSchema = z38.object({
|
|
4098
|
+
spaceId: z38.string().uuid().nullable(),
|
|
4099
|
+
sessionId: z38.string(),
|
|
4100
|
+
visitorEmail: z38.string().nullable(),
|
|
4101
|
+
userPrompt: z38.string(),
|
|
4102
|
+
branch: z38.string().nullable(),
|
|
4103
|
+
responseText: z38.string().nullable(),
|
|
4104
|
+
layout: z38.unknown().nullable(),
|
|
4105
|
+
phaseTimings: z38.record(z38.number()).nullable(),
|
|
4106
|
+
tokensByModel: z38.record(RunTokenUsageSchema).nullable(),
|
|
4107
|
+
toolCalls: z38.array(z38.unknown()).nullable(),
|
|
4108
|
+
diagnostics: z38.array(z38.unknown()).nullable(),
|
|
4049
4109
|
latencyFirstText: MillisecondsSchema,
|
|
4050
4110
|
latencyFirstPatch: MillisecondsSchema,
|
|
4051
4111
|
latencyTotal: MillisecondsSchema,
|
|
4052
|
-
trackerState:
|
|
4112
|
+
trackerState: z38.unknown().nullable(),
|
|
4053
4113
|
/**
|
|
4054
4114
|
* The CLIENT's turn id for this run, or `null`.
|
|
4055
4115
|
*
|
|
@@ -4065,37 +4125,37 @@ var CreateTraceInputSchema = z37.object({
|
|
|
4065
4125
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4066
4126
|
* visitor asked something and got nothing.
|
|
4067
4127
|
*/
|
|
4068
|
-
turnId:
|
|
4128
|
+
turnId: z38.string().nullable()
|
|
4069
4129
|
});
|
|
4070
|
-
var AgentSessionSummarySchema =
|
|
4071
|
-
sessionId:
|
|
4130
|
+
var AgentSessionSummarySchema = z38.object({
|
|
4131
|
+
sessionId: z38.string(),
|
|
4072
4132
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
4073
|
-
turnCount:
|
|
4133
|
+
turnCount: z38.number().int(),
|
|
4074
4134
|
/** The session's opening prompt — titles the row in the UI. */
|
|
4075
|
-
firstPrompt:
|
|
4076
|
-
startedAt:
|
|
4077
|
-
lastRunAt:
|
|
4135
|
+
firstPrompt: z38.string(),
|
|
4136
|
+
startedAt: z38.string(),
|
|
4137
|
+
lastRunAt: z38.string(),
|
|
4078
4138
|
/** Summed `latency_total` across the session's turns. */
|
|
4079
|
-
totalLatencyMs:
|
|
4139
|
+
totalLatencyMs: z38.number().int()
|
|
4080
4140
|
});
|
|
4081
|
-
var SessionTurnSchema =
|
|
4082
|
-
id:
|
|
4083
|
-
userPrompt:
|
|
4084
|
-
responseText:
|
|
4141
|
+
var SessionTurnSchema = z38.object({
|
|
4142
|
+
id: z38.string().uuid(),
|
|
4143
|
+
userPrompt: z38.string(),
|
|
4144
|
+
responseText: z38.string().nullable(),
|
|
4085
4145
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4086
|
-
layout:
|
|
4087
|
-
createdAt:
|
|
4088
|
-
latencyTotal:
|
|
4089
|
-
phaseTimings:
|
|
4090
|
-
tokensByModel:
|
|
4091
|
-
input_tokens:
|
|
4092
|
-
output_tokens:
|
|
4146
|
+
layout: z38.unknown().nullable(),
|
|
4147
|
+
createdAt: z38.string(),
|
|
4148
|
+
latencyTotal: z38.number().int().nullable(),
|
|
4149
|
+
phaseTimings: z38.record(z38.number()).nullable(),
|
|
4150
|
+
tokensByModel: z38.record(z38.object({
|
|
4151
|
+
input_tokens: z38.number().optional(),
|
|
4152
|
+
output_tokens: z38.number().optional()
|
|
4093
4153
|
})).nullable(),
|
|
4094
|
-
toolCalls:
|
|
4095
|
-
diagnostics:
|
|
4154
|
+
toolCalls: z38.array(z38.unknown()).nullable(),
|
|
4155
|
+
diagnostics: z38.array(z38.unknown()).nullable()
|
|
4096
4156
|
});
|
|
4097
|
-
var SessionReplaySchema =
|
|
4098
|
-
turns:
|
|
4157
|
+
var SessionReplaySchema = z38.object({
|
|
4158
|
+
turns: z38.array(SessionTurnSchema),
|
|
4099
4159
|
/**
|
|
4100
4160
|
* The session's own last-committed layout, read straight off the durable
|
|
4101
4161
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -4106,20 +4166,20 @@ var SessionReplaySchema = z37.object({
|
|
|
4106
4166
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
4107
4167
|
* when the durable session row itself could not be read.
|
|
4108
4168
|
*/
|
|
4109
|
-
sessionLayout:
|
|
4169
|
+
sessionLayout: z38.record(z38.string(), z38.unknown()).nullable()
|
|
4110
4170
|
});
|
|
4111
|
-
var SessionTraceSchema =
|
|
4112
|
-
trackerState:
|
|
4171
|
+
var SessionTraceSchema = z38.object({
|
|
4172
|
+
trackerState: z38.string().nullable()
|
|
4113
4173
|
});
|
|
4114
|
-
var LlmUsageDailySchema =
|
|
4115
|
-
day:
|
|
4174
|
+
var LlmUsageDailySchema = z38.object({
|
|
4175
|
+
day: z38.string(),
|
|
4116
4176
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
4117
|
-
environment:
|
|
4118
|
-
feature:
|
|
4119
|
-
model:
|
|
4120
|
-
provider:
|
|
4177
|
+
environment: z38.string(),
|
|
4178
|
+
feature: z38.string(),
|
|
4179
|
+
model: z38.string(),
|
|
4180
|
+
provider: z38.string(),
|
|
4121
4181
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
4122
|
-
keyFingerprint:
|
|
4182
|
+
keyFingerprint: z38.string().nullable(),
|
|
4123
4183
|
/**
|
|
4124
4184
|
* The space the call served, or null when it served none.
|
|
4125
4185
|
*
|
|
@@ -4128,91 +4188,91 @@ var LlmUsageDailySchema = z37.object({
|
|
|
4128
4188
|
* report that share rather than dropping it, or a per-space total reads as
|
|
4129
4189
|
* the platform total.
|
|
4130
4190
|
*/
|
|
4131
|
-
spaceId:
|
|
4191
|
+
spaceId: z38.string().nullable(),
|
|
4132
4192
|
/**
|
|
4133
4193
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
4134
4194
|
* when it served no session or the session predates surface recording.
|
|
4135
4195
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
4136
4196
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
4137
4197
|
*/
|
|
4138
|
-
surface:
|
|
4139
|
-
inputTokens:
|
|
4140
|
-
outputTokens:
|
|
4198
|
+
surface: z38.string().nullable(),
|
|
4199
|
+
inputTokens: z38.number(),
|
|
4200
|
+
outputTokens: z38.number(),
|
|
4141
4201
|
/** Subset of inputTokens, never additional to it. */
|
|
4142
|
-
cachedInputTokens:
|
|
4143
|
-
reasoningTokens:
|
|
4144
|
-
callCount:
|
|
4145
|
-
errorCount:
|
|
4146
|
-
estimatedCostUsd:
|
|
4202
|
+
cachedInputTokens: z38.number(),
|
|
4203
|
+
reasoningTokens: z38.number(),
|
|
4204
|
+
callCount: z38.number(),
|
|
4205
|
+
errorCount: z38.number(),
|
|
4206
|
+
estimatedCostUsd: z38.number().nullable()
|
|
4147
4207
|
});
|
|
4148
|
-
var LlmUsageBySessionSchema =
|
|
4149
|
-
sessionId:
|
|
4150
|
-
environment:
|
|
4151
|
-
model:
|
|
4208
|
+
var LlmUsageBySessionSchema = z38.object({
|
|
4209
|
+
sessionId: z38.string(),
|
|
4210
|
+
environment: z38.string(),
|
|
4211
|
+
model: z38.string(),
|
|
4152
4212
|
/** The space this session belongs to, or null for a session with no space. */
|
|
4153
|
-
spaceId:
|
|
4213
|
+
spaceId: z38.string().nullable(),
|
|
4154
4214
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
4155
|
-
surface:
|
|
4215
|
+
surface: z38.string().nullable(),
|
|
4156
4216
|
/** Label only — the first feature seen in the session. */
|
|
4157
|
-
firstFeature:
|
|
4158
|
-
startedAt:
|
|
4159
|
-
endedAt:
|
|
4160
|
-
inputTokens:
|
|
4161
|
-
outputTokens:
|
|
4162
|
-
cachedInputTokens:
|
|
4163
|
-
reasoningTokens:
|
|
4164
|
-
callCount:
|
|
4165
|
-
errorCount:
|
|
4217
|
+
firstFeature: z38.string(),
|
|
4218
|
+
startedAt: z38.string(),
|
|
4219
|
+
endedAt: z38.string(),
|
|
4220
|
+
inputTokens: z38.number(),
|
|
4221
|
+
outputTokens: z38.number(),
|
|
4222
|
+
cachedInputTokens: z38.number(),
|
|
4223
|
+
reasoningTokens: z38.number(),
|
|
4224
|
+
callCount: z38.number(),
|
|
4225
|
+
errorCount: z38.number(),
|
|
4166
4226
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
4167
4227
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
4168
4228
|
* the model is unpriced; never 0, which would read as free. */
|
|
4169
|
-
estimatedCostUsd:
|
|
4229
|
+
estimatedCostUsd: z38.number().nullable()
|
|
4170
4230
|
});
|
|
4171
|
-
var LlmSessionsDailySchema =
|
|
4172
|
-
day:
|
|
4173
|
-
environment:
|
|
4174
|
-
sessionCount:
|
|
4231
|
+
var LlmSessionsDailySchema = z38.object({
|
|
4232
|
+
day: z38.string(),
|
|
4233
|
+
environment: z38.string(),
|
|
4234
|
+
sessionCount: z38.number()
|
|
4175
4235
|
});
|
|
4176
4236
|
|
|
4177
4237
|
// ../spacestation/src/space/session-queue.ts
|
|
4178
|
-
import { z as
|
|
4238
|
+
import { z as z40 } from "zod";
|
|
4179
4239
|
|
|
4180
4240
|
// ../spacestation/src/space/session-activity.ts
|
|
4181
|
-
import { z as
|
|
4182
|
-
var SessionActivityEventSchema =
|
|
4183
|
-
id:
|
|
4184
|
-
kind:
|
|
4185
|
-
occurredAt:
|
|
4186
|
-
source:
|
|
4187
|
-
surface:
|
|
4188
|
-
payload:
|
|
4241
|
+
import { z as z39 } from "zod";
|
|
4242
|
+
var SessionActivityEventSchema = z39.object({
|
|
4243
|
+
id: z39.string(),
|
|
4244
|
+
kind: z39.string(),
|
|
4245
|
+
occurredAt: z39.string(),
|
|
4246
|
+
source: z39.string(),
|
|
4247
|
+
surface: z39.string(),
|
|
4248
|
+
payload: z39.record(z39.unknown())
|
|
4189
4249
|
});
|
|
4190
|
-
var SessionActivitySchema =
|
|
4191
|
-
events:
|
|
4192
|
-
hasMore:
|
|
4250
|
+
var SessionActivitySchema = z39.object({
|
|
4251
|
+
events: z39.array(SessionActivityEventSchema),
|
|
4252
|
+
hasMore: z39.boolean()
|
|
4193
4253
|
});
|
|
4194
4254
|
|
|
4195
4255
|
// ../spacestation/src/space/session-queue.ts
|
|
4196
|
-
var SessionVerdictSchema =
|
|
4197
|
-
var RecordableVerdictSchema =
|
|
4198
|
-
var SessionReviewEventSchema =
|
|
4199
|
-
id:
|
|
4256
|
+
var SessionVerdictSchema = z40.enum(["unreviewed", "viewed", "bug"]);
|
|
4257
|
+
var RecordableVerdictSchema = z40.enum(["viewed", "bug"]);
|
|
4258
|
+
var SessionReviewEventSchema = z40.object({
|
|
4259
|
+
id: z40.string().uuid(),
|
|
4200
4260
|
verdict: RecordableVerdictSchema,
|
|
4201
4261
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
4202
4262
|
* log is append-only rather than a mutable current-state row. */
|
|
4203
|
-
reviewer:
|
|
4204
|
-
note:
|
|
4205
|
-
createdAt:
|
|
4263
|
+
reviewer: z40.string(),
|
|
4264
|
+
note: z40.string().nullable(),
|
|
4265
|
+
createdAt: z40.string()
|
|
4206
4266
|
});
|
|
4207
|
-
var BugSeveritySchema =
|
|
4208
|
-
var BugLocationSchema =
|
|
4209
|
-
elementId:
|
|
4267
|
+
var BugSeveritySchema = z40.enum(["high", "medium", "low"]);
|
|
4268
|
+
var BugLocationSchema = z40.object({
|
|
4269
|
+
elementId: z40.string().nullable(),
|
|
4210
4270
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
4211
4271
|
* alongside a null `elementId`. */
|
|
4212
|
-
elementType:
|
|
4272
|
+
elementType: z40.string().nullable(),
|
|
4213
4273
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
4214
|
-
offsetXPct:
|
|
4215
|
-
offsetYPct:
|
|
4274
|
+
offsetXPct: z40.number().min(0).max(100).nullable(),
|
|
4275
|
+
offsetYPct: z40.number().min(0).max(100).nullable(),
|
|
4216
4276
|
/**
|
|
4217
4277
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
4218
4278
|
* element anchor.
|
|
@@ -4223,8 +4283,8 @@ var BugLocationSchema = z39.object({
|
|
|
4223
4283
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
4224
4284
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
4225
4285
|
*/
|
|
4226
|
-
pageX:
|
|
4227
|
-
pageY:
|
|
4286
|
+
pageX: z40.number().nullable(),
|
|
4287
|
+
pageY: z40.number().nullable()
|
|
4228
4288
|
}).refine(
|
|
4229
4289
|
(loc) => {
|
|
4230
4290
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -4238,24 +4298,24 @@ var BugLocationSchema = z39.object({
|
|
|
4238
4298
|
message: "location must be one complete anchor: an element (elementId + elementType + both offsets), a page position (pageX + pageY), or a legacy page fraction (both offsets)"
|
|
4239
4299
|
}
|
|
4240
4300
|
);
|
|
4241
|
-
var SessionBugSchema =
|
|
4242
|
-
id:
|
|
4301
|
+
var SessionBugSchema = z40.object({
|
|
4302
|
+
id: z40.string().uuid(),
|
|
4243
4303
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
4244
|
-
turnIndex:
|
|
4304
|
+
turnIndex: z40.number().int().nullable(),
|
|
4245
4305
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
4246
4306
|
* without pinning a spot. */
|
|
4247
4307
|
location: BugLocationSchema.nullable(),
|
|
4248
|
-
provider:
|
|
4249
|
-
issueKey:
|
|
4250
|
-
issueUrl:
|
|
4308
|
+
provider: z40.string(),
|
|
4309
|
+
issueKey: z40.string().nullable(),
|
|
4310
|
+
issueUrl: z40.string().nullable(),
|
|
4251
4311
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
4252
4312
|
* open text. Null until first synced. */
|
|
4253
|
-
issueState:
|
|
4254
|
-
title:
|
|
4255
|
-
body:
|
|
4313
|
+
issueState: z40.string().nullable(),
|
|
4314
|
+
title: z40.string(),
|
|
4315
|
+
body: z40.string(),
|
|
4256
4316
|
severity: BugSeveritySchema,
|
|
4257
|
-
createdBy:
|
|
4258
|
-
createdAt:
|
|
4317
|
+
createdBy: z40.string(),
|
|
4318
|
+
createdAt: z40.string(),
|
|
4259
4319
|
/**
|
|
4260
4320
|
* When this bug was resolved from the console; null means still OPEN.
|
|
4261
4321
|
*
|
|
@@ -4264,60 +4324,60 @@ var SessionBugSchema = z39.object({
|
|
|
4264
4324
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
4265
4325
|
* no boolean can contradict it.
|
|
4266
4326
|
*/
|
|
4267
|
-
resolvedAt:
|
|
4268
|
-
resolvedBy:
|
|
4327
|
+
resolvedAt: z40.string().nullable(),
|
|
4328
|
+
resolvedBy: z40.string().nullable()
|
|
4269
4329
|
});
|
|
4270
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
4271
|
-
var SessionCommentSchema =
|
|
4272
|
-
id:
|
|
4330
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z40.string() });
|
|
4331
|
+
var SessionCommentSchema = z40.object({
|
|
4332
|
+
id: z40.string().uuid(),
|
|
4273
4333
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
4274
|
-
bugId:
|
|
4334
|
+
bugId: z40.string().uuid().nullable(),
|
|
4275
4335
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
4276
4336
|
* parent bug's turn). */
|
|
4277
|
-
turnIndex:
|
|
4337
|
+
turnIndex: z40.number().int().nullable(),
|
|
4278
4338
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
4279
4339
|
location: BugLocationSchema.nullable(),
|
|
4280
|
-
body:
|
|
4281
|
-
createdBy:
|
|
4282
|
-
createdAt:
|
|
4340
|
+
body: z40.string(),
|
|
4341
|
+
createdBy: z40.string(),
|
|
4342
|
+
createdAt: z40.string()
|
|
4283
4343
|
});
|
|
4284
|
-
var CreateCommentInputSchema =
|
|
4285
|
-
bugId:
|
|
4286
|
-
turnIndex:
|
|
4344
|
+
var CreateCommentInputSchema = z40.object({
|
|
4345
|
+
bugId: z40.string().uuid().nullable(),
|
|
4346
|
+
turnIndex: z40.number().int().positive().nullable(),
|
|
4287
4347
|
location: BugLocationSchema.nullable(),
|
|
4288
4348
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
4289
4349
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
4290
|
-
body:
|
|
4350
|
+
body: z40.string().trim().min(1)
|
|
4291
4351
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
4292
4352
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
4293
4353
|
});
|
|
4294
|
-
var UpdateCommentInputSchema =
|
|
4295
|
-
body:
|
|
4296
|
-
bugId:
|
|
4354
|
+
var UpdateCommentInputSchema = z40.object({
|
|
4355
|
+
body: z40.string().trim().min(1).optional(),
|
|
4356
|
+
bugId: z40.string().uuid().nullable().optional(),
|
|
4297
4357
|
location: BugLocationSchema.nullable().optional()
|
|
4298
4358
|
});
|
|
4299
4359
|
var MOBILE_VIEWPORT_MAX = 720;
|
|
4300
|
-
var SessionFormFactorSchema =
|
|
4360
|
+
var SessionFormFactorSchema = z40.enum(["mobile", "desktop"]).nullable();
|
|
4301
4361
|
function formFactorFromViewport(width) {
|
|
4302
4362
|
if (width === null) return null;
|
|
4303
4363
|
return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
|
|
4304
4364
|
}
|
|
4305
|
-
var SessionSummarySchema =
|
|
4306
|
-
sessionId:
|
|
4365
|
+
var SessionSummarySchema = z40.object({
|
|
4366
|
+
sessionId: z40.string(),
|
|
4307
4367
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
4308
4368
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
4309
|
-
visitorId:
|
|
4369
|
+
visitorId: z40.string().nullable(),
|
|
4310
4370
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
4311
4371
|
* identified themselves. Both null together means "not identified yet". */
|
|
4312
|
-
identityProvider:
|
|
4313
|
-
identityKey:
|
|
4372
|
+
identityProvider: z40.string().nullable(),
|
|
4373
|
+
identityKey: z40.string().nullable(),
|
|
4314
4374
|
/** Team/test traffic. The queue hides these by default. */
|
|
4315
|
-
isInternal:
|
|
4375
|
+
isInternal: z40.boolean(),
|
|
4316
4376
|
/** Build that served the session. Null = not captured; a version filter must
|
|
4317
4377
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
4318
|
-
clientVersion:
|
|
4378
|
+
clientVersion: z40.string().nullable(),
|
|
4319
4379
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
4320
|
-
signalCounts:
|
|
4380
|
+
signalCounts: z40.record(z40.number()),
|
|
4321
4381
|
/**
|
|
4322
4382
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
4323
4383
|
*
|
|
@@ -4334,7 +4394,7 @@ var SessionSummarySchema = z39.object({
|
|
|
4334
4394
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
4335
4395
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
4336
4396
|
*/
|
|
4337
|
-
conversionAttempts:
|
|
4397
|
+
conversionAttempts: z40.number().int().nullable(),
|
|
4338
4398
|
/**
|
|
4339
4399
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
4340
4400
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -4350,7 +4410,7 @@ var SessionSummarySchema = z39.object({
|
|
|
4350
4410
|
* kinds together, and one attempt id appearing under both would be counted
|
|
4351
4411
|
* once there and twice here.
|
|
4352
4412
|
*/
|
|
4353
|
-
conversionKinds:
|
|
4413
|
+
conversionKinds: z40.record(z40.number()),
|
|
4354
4414
|
/**
|
|
4355
4415
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
4356
4416
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -4358,20 +4418,20 @@ var SessionSummarySchema = z39.object({
|
|
|
4358
4418
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
4359
4419
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
4360
4420
|
*/
|
|
4361
|
-
funnelSteps:
|
|
4421
|
+
funnelSteps: z40.array(z40.string()),
|
|
4362
4422
|
/**
|
|
4363
4423
|
* The connector's opaque handle for what this session produced in its back
|
|
4364
4424
|
* office — present only once a checkout actually reached the platform. The
|
|
4365
4425
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
4366
4426
|
*/
|
|
4367
|
-
backOfficeRef:
|
|
4427
|
+
backOfficeRef: z40.string().nullable(),
|
|
4368
4428
|
/**
|
|
4369
4429
|
* The order this session produced, when the connector's back office reported
|
|
4370
4430
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
4371
4431
|
* Both null when no order is known — the cart handle above is then the door.
|
|
4372
4432
|
*/
|
|
4373
|
-
orderRef:
|
|
4374
|
-
orderLabel:
|
|
4433
|
+
orderRef: z40.string().nullable(),
|
|
4434
|
+
orderLabel: z40.string().nullable(),
|
|
4375
4435
|
/**
|
|
4376
4436
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
4377
4437
|
* needs.
|
|
@@ -4384,12 +4444,12 @@ var SessionSummarySchema = z39.object({
|
|
|
4384
4444
|
* on a desktop are not the same session.
|
|
4385
4445
|
*/
|
|
4386
4446
|
formFactor: SessionFormFactorSchema,
|
|
4387
|
-
turnCount:
|
|
4447
|
+
turnCount: z40.number().int(),
|
|
4388
4448
|
/** The visitor's opening message — the single most informative field for
|
|
4389
4449
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
4390
|
-
firstPrompt:
|
|
4391
|
-
startedAt:
|
|
4392
|
-
lastRunAt:
|
|
4450
|
+
firstPrompt: z40.string(),
|
|
4451
|
+
startedAt: z40.string(),
|
|
4452
|
+
lastRunAt: z40.string(),
|
|
4393
4453
|
/**
|
|
4394
4454
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
4395
4455
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -4417,7 +4477,7 @@ var SessionSummarySchema = z39.object({
|
|
|
4417
4477
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
4418
4478
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
4419
4479
|
*/
|
|
4420
|
-
visitorTimeZone:
|
|
4480
|
+
visitorTimeZone: z40.string().nullable(),
|
|
4421
4481
|
/**
|
|
4422
4482
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
4423
4483
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -4425,31 +4485,31 @@ var SessionSummarySchema = z39.object({
|
|
|
4425
4485
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
4426
4486
|
* already reading. Null when no turn in the session recorded a patch.
|
|
4427
4487
|
*/
|
|
4428
|
-
avgTtftMs:
|
|
4488
|
+
avgTtftMs: z40.number().int().nullable(),
|
|
4429
4489
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
4430
4490
|
* a budget: null on sessions older than the mark's recording. */
|
|
4431
|
-
avgMainDoneMs:
|
|
4491
|
+
avgMainDoneMs: z40.number().int().nullable(),
|
|
4432
4492
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
4433
4493
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
4434
|
-
avgChipGenMs:
|
|
4435
|
-
totalLatencyMs:
|
|
4436
|
-
durationMs:
|
|
4494
|
+
avgChipGenMs: z40.number().int().nullable(),
|
|
4495
|
+
totalLatencyMs: z40.number().int(),
|
|
4496
|
+
durationMs: z40.number().int(),
|
|
4437
4497
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
4438
4498
|
* live session streams and cannot be given a verdict until it ends. */
|
|
4439
|
-
isLive:
|
|
4499
|
+
isLive: z40.boolean(),
|
|
4440
4500
|
verdict: SessionVerdictSchema,
|
|
4441
|
-
reviewedBy:
|
|
4442
|
-
reviewedAt:
|
|
4501
|
+
reviewedBy: z40.string().nullable(),
|
|
4502
|
+
reviewedAt: z40.string().nullable(),
|
|
4443
4503
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
4444
4504
|
* state without a second request. */
|
|
4445
|
-
bugIssueKey:
|
|
4446
|
-
bugIssueUrl:
|
|
4447
|
-
bugIssueState:
|
|
4505
|
+
bugIssueKey: z40.string().nullable(),
|
|
4506
|
+
bugIssueUrl: z40.string().nullable(),
|
|
4507
|
+
bugIssueState: z40.string().nullable()
|
|
4448
4508
|
});
|
|
4449
|
-
var SessionQueuePageSchema =
|
|
4450
|
-
sessions:
|
|
4451
|
-
totalCount:
|
|
4452
|
-
hiddenInternalCount:
|
|
4509
|
+
var SessionQueuePageSchema = z40.object({
|
|
4510
|
+
sessions: z40.array(SessionSummarySchema),
|
|
4511
|
+
totalCount: z40.number().int(),
|
|
4512
|
+
hiddenInternalCount: z40.number().int(),
|
|
4453
4513
|
/**
|
|
4454
4514
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
4455
4515
|
*
|
|
@@ -4459,61 +4519,61 @@ var SessionQueuePageSchema = z39.object({
|
|
|
4459
4519
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
4460
4520
|
* analytics dashboard's bounce over the same window.
|
|
4461
4521
|
*/
|
|
4462
|
-
hiddenBouncedCount:
|
|
4522
|
+
hiddenBouncedCount: z40.number().int()
|
|
4463
4523
|
});
|
|
4464
|
-
var SessionQueueFacetsSchema =
|
|
4465
|
-
review:
|
|
4466
|
-
version:
|
|
4467
|
-
turns:
|
|
4468
|
-
durationS:
|
|
4524
|
+
var SessionQueueFacetsSchema = z40.object({
|
|
4525
|
+
review: z40.record(z40.number()),
|
|
4526
|
+
version: z40.record(z40.number()),
|
|
4527
|
+
turns: z40.record(z40.number()),
|
|
4528
|
+
durationS: z40.record(z40.number()),
|
|
4469
4529
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
4470
|
-
funnel:
|
|
4530
|
+
funnel: z40.record(z40.number())
|
|
4471
4531
|
});
|
|
4472
|
-
var SessionCaptureSchema =
|
|
4473
|
-
viewportWidth:
|
|
4474
|
-
viewportHeight:
|
|
4475
|
-
userAgent:
|
|
4476
|
-
locale:
|
|
4532
|
+
var SessionCaptureSchema = z40.object({
|
|
4533
|
+
viewportWidth: z40.number().int().nullable(),
|
|
4534
|
+
viewportHeight: z40.number().int().nullable(),
|
|
4535
|
+
userAgent: z40.string().nullable(),
|
|
4536
|
+
locale: z40.string().nullable(),
|
|
4477
4537
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
4478
|
-
referrer:
|
|
4538
|
+
referrer: z40.string().nullable()
|
|
4479
4539
|
});
|
|
4480
|
-
var SessionCaptureInputSchema =
|
|
4481
|
-
viewportWidth:
|
|
4482
|
-
viewportHeight:
|
|
4483
|
-
userAgent:
|
|
4484
|
-
locale:
|
|
4540
|
+
var SessionCaptureInputSchema = z40.object({
|
|
4541
|
+
viewportWidth: z40.number().int().positive().max(2e4).optional(),
|
|
4542
|
+
viewportHeight: z40.number().int().positive().max(2e4).optional(),
|
|
4543
|
+
userAgent: z40.string().max(1e3).optional(),
|
|
4544
|
+
locale: z40.string().max(35).optional(),
|
|
4485
4545
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
4486
4546
|
* the zone database grows, and refusing a name this build has not heard of
|
|
4487
4547
|
* would drop a real session's capture over a table that is out of date. */
|
|
4488
|
-
timeZone:
|
|
4489
|
-
referrer:
|
|
4490
|
-
clientVersion:
|
|
4491
|
-
isInternal:
|
|
4548
|
+
timeZone: z40.string().max(64).optional(),
|
|
4549
|
+
referrer: z40.string().max(2048).optional(),
|
|
4550
|
+
clientVersion: z40.string().max(100).optional(),
|
|
4551
|
+
isInternal: z40.boolean().optional()
|
|
4492
4552
|
});
|
|
4493
|
-
var SessionDetailSchema =
|
|
4553
|
+
var SessionDetailSchema = z40.object({
|
|
4494
4554
|
session: SessionSummarySchema,
|
|
4495
4555
|
capture: SessionCaptureSchema,
|
|
4496
4556
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
4497
4557
|
* re-judged after a fix is the evidence the fix worked. */
|
|
4498
|
-
reviews:
|
|
4499
|
-
bugs:
|
|
4500
|
-
comments:
|
|
4558
|
+
reviews: z40.array(SessionReviewEventSchema),
|
|
4559
|
+
bugs: z40.array(SessionBugSchema),
|
|
4560
|
+
comments: z40.array(SessionCommentSchema),
|
|
4501
4561
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
4502
4562
|
* not evidence of zero visitor activity. */
|
|
4503
4563
|
activity: SessionActivitySchema.optional()
|
|
4504
4564
|
});
|
|
4505
|
-
var RecordVerdictInputSchema =
|
|
4565
|
+
var RecordVerdictInputSchema = z40.object({
|
|
4506
4566
|
verdict: RecordableVerdictSchema,
|
|
4507
|
-
note:
|
|
4567
|
+
note: z40.string().max(2e3).optional()
|
|
4508
4568
|
});
|
|
4509
|
-
var FileBugInputSchema =
|
|
4510
|
-
turnIndex:
|
|
4569
|
+
var FileBugInputSchema = z40.object({
|
|
4570
|
+
turnIndex: z40.number().int().positive().nullable(),
|
|
4511
4571
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
4512
4572
|
location: BugLocationSchema.nullable().optional(),
|
|
4513
|
-
title:
|
|
4514
|
-
body:
|
|
4573
|
+
title: z40.string().min(1).max(300),
|
|
4574
|
+
body: z40.string().min(1),
|
|
4515
4575
|
severity: BugSeveritySchema,
|
|
4516
|
-
payload:
|
|
4576
|
+
payload: z40.record(z40.unknown())
|
|
4517
4577
|
});
|
|
4518
4578
|
|
|
4519
4579
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
@@ -4698,7 +4758,7 @@ function stringifyForScoring(v) {
|
|
|
4698
4758
|
|
|
4699
4759
|
// src/session/turn-attributed-session.ts
|
|
4700
4760
|
var TURN_ATTRIBUTED_SIGNALS = /* @__PURE__ */ new Set([CART_ADD_SIGNAL]);
|
|
4701
|
-
function
|
|
4761
|
+
function withSignalTurn(signal, turnId) {
|
|
4702
4762
|
if (!TURN_ATTRIBUTED_SIGNALS.has(signal.type) || "turnId" in signal.payload) return signal;
|
|
4703
4763
|
return { ...signal, payload: { ...signal.payload, turnId } };
|
|
4704
4764
|
}
|
|
@@ -4708,8 +4768,8 @@ function useTurnAttributedSession(session) {
|
|
|
4708
4768
|
if (session === null || turnId === null) return session;
|
|
4709
4769
|
return {
|
|
4710
4770
|
...session,
|
|
4711
|
-
dispatchSignal: (signal) => session.dispatchSignal(
|
|
4712
|
-
dispatchSuggestionAction: (action) => session.dispatchSuggestionAction(
|
|
4771
|
+
dispatchSignal: (signal) => session.dispatchSignal(withSignalTurn(signal, turnId)),
|
|
4772
|
+
dispatchSuggestionAction: (action) => session.dispatchSuggestionAction(withSignalTurn(action, turnId))
|
|
4713
4773
|
};
|
|
4714
4774
|
}, [session, turnId]);
|
|
4715
4775
|
}
|
|
@@ -4832,60 +4892,60 @@ __export(src_exports2, {
|
|
|
4832
4892
|
});
|
|
4833
4893
|
|
|
4834
4894
|
// ../ecommerce/src/commerce-schemas.ts
|
|
4835
|
-
import { z as
|
|
4836
|
-
var MoneySchema =
|
|
4837
|
-
amount:
|
|
4838
|
-
currencyCode:
|
|
4895
|
+
import { z as z41 } from "zod";
|
|
4896
|
+
var MoneySchema = z41.object({
|
|
4897
|
+
amount: z41.number(),
|
|
4898
|
+
currencyCode: z41.string()
|
|
4839
4899
|
});
|
|
4840
|
-
var ImageSchema =
|
|
4841
|
-
url:
|
|
4842
|
-
altText:
|
|
4843
|
-
width:
|
|
4844
|
-
height:
|
|
4900
|
+
var ImageSchema = z41.object({
|
|
4901
|
+
url: z41.string(),
|
|
4902
|
+
altText: z41.string(),
|
|
4903
|
+
width: z41.number().optional(),
|
|
4904
|
+
height: z41.number().optional(),
|
|
4845
4905
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
4846
4906
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
4847
4907
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
4848
|
-
srcSet:
|
|
4908
|
+
srcSet: z41.string().optional()
|
|
4849
4909
|
});
|
|
4850
|
-
var AssetSchema =
|
|
4910
|
+
var AssetSchema = z41.object({
|
|
4851
4911
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
4852
|
-
id:
|
|
4853
|
-
url:
|
|
4854
|
-
altText:
|
|
4855
|
-
srcSet:
|
|
4912
|
+
id: z41.string(),
|
|
4913
|
+
url: z41.string(),
|
|
4914
|
+
altText: z41.string(),
|
|
4915
|
+
srcSet: z41.string().optional()
|
|
4856
4916
|
});
|
|
4857
|
-
var SelectedOptionSchema =
|
|
4858
|
-
name:
|
|
4859
|
-
value:
|
|
4917
|
+
var SelectedOptionSchema = z41.object({
|
|
4918
|
+
name: z41.string(),
|
|
4919
|
+
value: z41.string()
|
|
4860
4920
|
});
|
|
4861
|
-
var VideoSourceSchema =
|
|
4862
|
-
url:
|
|
4863
|
-
mimeType:
|
|
4864
|
-
width:
|
|
4865
|
-
height:
|
|
4921
|
+
var VideoSourceSchema = z41.object({
|
|
4922
|
+
url: z41.string(),
|
|
4923
|
+
mimeType: z41.string(),
|
|
4924
|
+
width: z41.number().optional(),
|
|
4925
|
+
height: z41.number().optional()
|
|
4866
4926
|
});
|
|
4867
|
-
var ProductVideoSchema =
|
|
4868
|
-
kind:
|
|
4927
|
+
var ProductVideoSchema = z41.object({
|
|
4928
|
+
kind: z41.enum(["hosted", "external"]),
|
|
4869
4929
|
previewImage: ImageSchema.optional(),
|
|
4870
|
-
altText:
|
|
4930
|
+
altText: z41.string().default(""),
|
|
4871
4931
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
4872
|
-
sources:
|
|
4932
|
+
sources: z41.array(VideoSourceSchema).default([]),
|
|
4873
4933
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
4874
|
-
embedUrl:
|
|
4934
|
+
embedUrl: z41.string().optional(),
|
|
4875
4935
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
4876
|
-
host:
|
|
4936
|
+
host: z41.string().optional()
|
|
4877
4937
|
});
|
|
4878
|
-
var AvailabilityStatusSchema =
|
|
4938
|
+
var AvailabilityStatusSchema = z41.enum([
|
|
4879
4939
|
"in_stock",
|
|
4880
4940
|
"backorder",
|
|
4881
4941
|
"preorder",
|
|
4882
4942
|
"out_of_stock",
|
|
4883
4943
|
"discontinued"
|
|
4884
4944
|
]);
|
|
4885
|
-
var ProductVariantSchema =
|
|
4886
|
-
id:
|
|
4887
|
-
title:
|
|
4888
|
-
available:
|
|
4945
|
+
var ProductVariantSchema = z41.object({
|
|
4946
|
+
id: z41.string(),
|
|
4947
|
+
title: z41.string(),
|
|
4948
|
+
available: z41.boolean(),
|
|
4889
4949
|
/**
|
|
4890
4950
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
4891
4951
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -4900,7 +4960,7 @@ var ProductVariantSchema = z40.object({
|
|
|
4900
4960
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
4901
4961
|
price: MoneySchema,
|
|
4902
4962
|
compareAtPrice: MoneySchema.optional(),
|
|
4903
|
-
selectedOptions:
|
|
4963
|
+
selectedOptions: z41.array(SelectedOptionSchema).optional(),
|
|
4904
4964
|
image: ImageSchema.optional()
|
|
4905
4965
|
});
|
|
4906
4966
|
var MP4_MIME = "video/mp4";
|
|
@@ -4911,34 +4971,34 @@ function orderedVideoSources(video) {
|
|
|
4911
4971
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
4912
4972
|
return [...mp4, ...hls];
|
|
4913
4973
|
}
|
|
4914
|
-
var SiblingProductSchema =
|
|
4915
|
-
id:
|
|
4916
|
-
handle:
|
|
4917
|
-
title:
|
|
4974
|
+
var SiblingProductSchema = z41.object({
|
|
4975
|
+
id: z41.string(),
|
|
4976
|
+
handle: z41.string(),
|
|
4977
|
+
title: z41.string(),
|
|
4918
4978
|
/** The differentiating value across siblings — typically the color
|
|
4919
4979
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
4920
|
-
color:
|
|
4980
|
+
color: z41.string(),
|
|
4921
4981
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
4922
4982
|
* first image; renderers crop / fit to the swatch tile. */
|
|
4923
4983
|
swatchImage: ImageSchema.optional(),
|
|
4924
|
-
available:
|
|
4984
|
+
available: z41.boolean().default(true),
|
|
4925
4985
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
4926
4986
|
* picker uses this to highlight the active swatch without an
|
|
4927
4987
|
* external id comparison. */
|
|
4928
|
-
current:
|
|
4988
|
+
current: z41.boolean().default(false)
|
|
4929
4989
|
});
|
|
4930
|
-
var ProductSchema =
|
|
4931
|
-
id:
|
|
4932
|
-
handle:
|
|
4933
|
-
title:
|
|
4934
|
-
description:
|
|
4935
|
-
descriptionHtml:
|
|
4936
|
-
vendor:
|
|
4937
|
-
productType:
|
|
4938
|
-
tags:
|
|
4990
|
+
var ProductSchema = z41.object({
|
|
4991
|
+
id: z41.string(),
|
|
4992
|
+
handle: z41.string().default(""),
|
|
4993
|
+
title: z41.string(),
|
|
4994
|
+
description: z41.string().default(""),
|
|
4995
|
+
descriptionHtml: z41.string().optional(),
|
|
4996
|
+
vendor: z41.string().default(""),
|
|
4997
|
+
productType: z41.string().optional(),
|
|
4998
|
+
tags: z41.array(z41.string()).default([]),
|
|
4939
4999
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
4940
5000
|
compareAtPrice: MoneySchema.optional(),
|
|
4941
|
-
images:
|
|
5001
|
+
images: z41.array(ImageSchema).default([]),
|
|
4942
5002
|
/**
|
|
4943
5003
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
4944
5004
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -4946,21 +5006,21 @@ var ProductSchema = z40.object({
|
|
|
4946
5006
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
4947
5007
|
* presence guard.
|
|
4948
5008
|
*/
|
|
4949
|
-
videos:
|
|
4950
|
-
variants:
|
|
4951
|
-
availableForSale:
|
|
4952
|
-
options:
|
|
4953
|
-
name:
|
|
4954
|
-
values:
|
|
5009
|
+
videos: z41.array(ProductVideoSchema).default([]),
|
|
5010
|
+
variants: z41.array(ProductVariantSchema).default([]),
|
|
5011
|
+
availableForSale: z41.boolean().default(true),
|
|
5012
|
+
options: z41.array(z41.object({
|
|
5013
|
+
name: z41.string(),
|
|
5014
|
+
values: z41.array(z41.string())
|
|
4955
5015
|
})).optional(),
|
|
4956
|
-
collections:
|
|
5016
|
+
collections: z41.array(z41.string()).optional(),
|
|
4957
5017
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
4958
5018
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
4959
5019
|
* presence guard. */
|
|
4960
|
-
colorVariants:
|
|
4961
|
-
rating:
|
|
4962
|
-
value:
|
|
4963
|
-
count:
|
|
5020
|
+
colorVariants: z41.array(SiblingProductSchema).default([]),
|
|
5021
|
+
rating: z41.object({
|
|
5022
|
+
value: z41.number(),
|
|
5023
|
+
count: z41.number()
|
|
4964
5024
|
}).optional(),
|
|
4965
5025
|
/**
|
|
4966
5026
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -4969,12 +5029,12 @@ var ProductSchema = z40.object({
|
|
|
4969
5029
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
4970
5030
|
* etc.) consume directly.
|
|
4971
5031
|
*/
|
|
4972
|
-
reviews:
|
|
4973
|
-
author:
|
|
4974
|
-
rating:
|
|
4975
|
-
content:
|
|
4976
|
-
date:
|
|
4977
|
-
verified:
|
|
5032
|
+
reviews: z41.array(z41.object({
|
|
5033
|
+
author: z41.string(),
|
|
5034
|
+
rating: z41.number(),
|
|
5035
|
+
content: z41.string(),
|
|
5036
|
+
date: z41.string(),
|
|
5037
|
+
verified: z41.boolean().optional()
|
|
4978
5038
|
})).optional(),
|
|
4979
5039
|
/**
|
|
4980
5040
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -4986,7 +5046,7 @@ var ProductSchema = z40.object({
|
|
|
4986
5046
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
4987
5047
|
* Storefront mapper.
|
|
4988
5048
|
*/
|
|
4989
|
-
unavailable:
|
|
5049
|
+
unavailable: z41.boolean().default(false)
|
|
4990
5050
|
});
|
|
4991
5051
|
function createUnavailableProduct(gid) {
|
|
4992
5052
|
return {
|
|
@@ -5008,68 +5068,68 @@ function createUnavailableProduct(gid) {
|
|
|
5008
5068
|
function isGhostEntity(value) {
|
|
5009
5069
|
return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
|
|
5010
5070
|
}
|
|
5011
|
-
var ReviewSchema =
|
|
5012
|
-
id:
|
|
5013
|
-
productId:
|
|
5014
|
-
author:
|
|
5015
|
-
rating:
|
|
5016
|
-
text:
|
|
5017
|
-
date:
|
|
5018
|
-
verified:
|
|
5071
|
+
var ReviewSchema = z41.object({
|
|
5072
|
+
id: z41.string(),
|
|
5073
|
+
productId: z41.string(),
|
|
5074
|
+
author: z41.string(),
|
|
5075
|
+
rating: z41.number(),
|
|
5076
|
+
text: z41.string(),
|
|
5077
|
+
date: z41.string(),
|
|
5078
|
+
verified: z41.boolean()
|
|
5019
5079
|
});
|
|
5020
|
-
var ArticleSchema =
|
|
5021
|
-
id:
|
|
5022
|
-
handle:
|
|
5023
|
-
title:
|
|
5024
|
-
excerpt:
|
|
5025
|
-
content:
|
|
5026
|
-
contentHtml:
|
|
5027
|
-
author:
|
|
5028
|
-
publishedAt:
|
|
5080
|
+
var ArticleSchema = z41.object({
|
|
5081
|
+
id: z41.string(),
|
|
5082
|
+
handle: z41.string().default(""),
|
|
5083
|
+
title: z41.string(),
|
|
5084
|
+
excerpt: z41.string().default(""),
|
|
5085
|
+
content: z41.string().default(""),
|
|
5086
|
+
contentHtml: z41.string().optional(),
|
|
5087
|
+
author: z41.string().default(""),
|
|
5088
|
+
publishedAt: z41.string().default(""),
|
|
5029
5089
|
image: ImageSchema.optional(),
|
|
5030
|
-
blogHandle:
|
|
5031
|
-
tags:
|
|
5090
|
+
blogHandle: z41.string().default(""),
|
|
5091
|
+
tags: z41.array(z41.string()).default([])
|
|
5032
5092
|
});
|
|
5033
|
-
var CmsPageSchema =
|
|
5034
|
-
id:
|
|
5035
|
-
handle:
|
|
5036
|
-
title:
|
|
5037
|
-
body:
|
|
5038
|
-
bodyHtml:
|
|
5039
|
-
bodySummary:
|
|
5040
|
-
updatedAt:
|
|
5041
|
-
seoTitle:
|
|
5042
|
-
seoDescription:
|
|
5093
|
+
var CmsPageSchema = z41.object({
|
|
5094
|
+
id: z41.string(),
|
|
5095
|
+
handle: z41.string().default(""),
|
|
5096
|
+
title: z41.string(),
|
|
5097
|
+
body: z41.string().default(""),
|
|
5098
|
+
bodyHtml: z41.string().optional(),
|
|
5099
|
+
bodySummary: z41.string().default(""),
|
|
5100
|
+
updatedAt: z41.string().default(""),
|
|
5101
|
+
seoTitle: z41.string().optional(),
|
|
5102
|
+
seoDescription: z41.string().optional()
|
|
5043
5103
|
});
|
|
5044
|
-
var CmsPolicySchema =
|
|
5045
|
-
id:
|
|
5104
|
+
var CmsPolicySchema = z41.object({
|
|
5105
|
+
id: z41.string(),
|
|
5046
5106
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5047
5107
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5048
5108
|
* platforms with custom policy types can extend. */
|
|
5049
|
-
kind:
|
|
5109
|
+
kind: z41.string(),
|
|
5050
5110
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5051
5111
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5052
5112
|
* surface one. */
|
|
5053
|
-
handle:
|
|
5054
|
-
title:
|
|
5055
|
-
body:
|
|
5056
|
-
bodyHtml:
|
|
5057
|
-
url:
|
|
5113
|
+
handle: z41.string().default(""),
|
|
5114
|
+
title: z41.string(),
|
|
5115
|
+
body: z41.string().default(""),
|
|
5116
|
+
bodyHtml: z41.string().optional(),
|
|
5117
|
+
url: z41.string().default("")
|
|
5058
5118
|
});
|
|
5059
|
-
var CollectionSchema =
|
|
5060
|
-
id:
|
|
5061
|
-
handle:
|
|
5062
|
-
title:
|
|
5063
|
-
description:
|
|
5119
|
+
var CollectionSchema = z41.object({
|
|
5120
|
+
id: z41.string(),
|
|
5121
|
+
handle: z41.string().default(""),
|
|
5122
|
+
title: z41.string(),
|
|
5123
|
+
description: z41.string().default(""),
|
|
5064
5124
|
image: ImageSchema.optional(),
|
|
5065
|
-
productCount:
|
|
5125
|
+
productCount: z41.number().int().nonnegative().optional()
|
|
5066
5126
|
});
|
|
5067
|
-
var CartLineSchema =
|
|
5068
|
-
id:
|
|
5069
|
-
merchandiseId:
|
|
5070
|
-
productId:
|
|
5071
|
-
title:
|
|
5072
|
-
variantTitle:
|
|
5127
|
+
var CartLineSchema = z41.object({
|
|
5128
|
+
id: z41.string(),
|
|
5129
|
+
merchandiseId: z41.string(),
|
|
5130
|
+
productId: z41.string(),
|
|
5131
|
+
title: z41.string(),
|
|
5132
|
+
variantTitle: z41.string().optional(),
|
|
5073
5133
|
/**
|
|
5074
5134
|
* The variant's option axes as structured pairs (e.g.
|
|
5075
5135
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5078,10 +5138,10 @@ var CartLineSchema = z40.object({
|
|
|
5078
5138
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5079
5139
|
* is normalized away at the adapter boundary).
|
|
5080
5140
|
*/
|
|
5081
|
-
selectedOptions:
|
|
5082
|
-
vendor:
|
|
5083
|
-
sku:
|
|
5084
|
-
quantity:
|
|
5141
|
+
selectedOptions: z41.array(SelectedOptionSchema).optional(),
|
|
5142
|
+
vendor: z41.string().optional(),
|
|
5143
|
+
sku: z41.string().optional(),
|
|
5144
|
+
quantity: z41.number().int().positive(),
|
|
5085
5145
|
unitPrice: MoneySchema,
|
|
5086
5146
|
totalPrice: MoneySchema,
|
|
5087
5147
|
image: ImageSchema.optional(),
|
|
@@ -5101,26 +5161,26 @@ var CartLineSchema = z40.object({
|
|
|
5101
5161
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5102
5162
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5103
5163
|
*/
|
|
5104
|
-
pending:
|
|
5164
|
+
pending: z41.boolean().optional()
|
|
5105
5165
|
});
|
|
5106
5166
|
function isPendingCartLine(line) {
|
|
5107
5167
|
return line.pending === true;
|
|
5108
5168
|
}
|
|
5109
|
-
var CartDiscountCodeSchema =
|
|
5110
|
-
code:
|
|
5111
|
-
applicable:
|
|
5169
|
+
var CartDiscountCodeSchema = z41.object({
|
|
5170
|
+
code: z41.string(),
|
|
5171
|
+
applicable: z41.boolean()
|
|
5112
5172
|
});
|
|
5113
|
-
var CartMessageSchema =
|
|
5114
|
-
kind:
|
|
5173
|
+
var CartMessageSchema = z41.object({
|
|
5174
|
+
kind: z41.enum(["error", "warning", "info"]),
|
|
5115
5175
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5116
|
-
code:
|
|
5176
|
+
code: z41.string(),
|
|
5117
5177
|
/** Human-readable text, meant to be shown as-is. */
|
|
5118
|
-
content:
|
|
5178
|
+
content: z41.string()
|
|
5119
5179
|
});
|
|
5120
|
-
var CartSchema =
|
|
5121
|
-
id:
|
|
5122
|
-
lines:
|
|
5123
|
-
totalQuantity:
|
|
5180
|
+
var CartSchema = z41.object({
|
|
5181
|
+
id: z41.string(),
|
|
5182
|
+
lines: z41.array(CartLineSchema),
|
|
5183
|
+
totalQuantity: z41.number().int().nonnegative(),
|
|
5124
5184
|
subtotal: MoneySchema,
|
|
5125
5185
|
/**
|
|
5126
5186
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5130,11 +5190,11 @@ var CartSchema = z40.object({
|
|
|
5130
5190
|
*/
|
|
5131
5191
|
total: MoneySchema.optional(),
|
|
5132
5192
|
/** Discount codes currently attached to the cart. */
|
|
5133
|
-
discountCodes:
|
|
5193
|
+
discountCodes: z41.array(CartDiscountCodeSchema).default([]),
|
|
5134
5194
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5135
5195
|
* Empty when the backend said nothing or does not report them. */
|
|
5136
|
-
messages:
|
|
5137
|
-
checkoutUrl:
|
|
5196
|
+
messages: z41.array(CartMessageSchema).default([]),
|
|
5197
|
+
checkoutUrl: z41.string().optional(),
|
|
5138
5198
|
/**
|
|
5139
5199
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5140
5200
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5147,14 +5207,14 @@ var CartSchema = z40.object({
|
|
|
5147
5207
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5148
5208
|
* client's optimistic paint and its id is client-minted.
|
|
5149
5209
|
*/
|
|
5150
|
-
backOfficeRef:
|
|
5210
|
+
backOfficeRef: z41.string().optional(),
|
|
5151
5211
|
/**
|
|
5152
5212
|
* URL that recreates this cart on the merchant's own store website
|
|
5153
5213
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5154
5214
|
* there). Populated by platform adapters that support it; absent when
|
|
5155
5215
|
* the cart is empty or the URL cannot be built.
|
|
5156
5216
|
*/
|
|
5157
|
-
storeCartUrl:
|
|
5217
|
+
storeCartUrl: z41.string().optional(),
|
|
5158
5218
|
/**
|
|
5159
5219
|
* True while this cart exists only in the client's optimistic paint —
|
|
5160
5220
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5162,7 +5222,7 @@ var CartSchema = z40.object({
|
|
|
5162
5222
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5163
5223
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5164
5224
|
*/
|
|
5165
|
-
pending:
|
|
5225
|
+
pending: z41.boolean().optional()
|
|
5166
5226
|
});
|
|
5167
5227
|
function settledCart(cart) {
|
|
5168
5228
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5170,27 +5230,27 @@ function settledCart(cart) {
|
|
|
5170
5230
|
}
|
|
5171
5231
|
|
|
5172
5232
|
// ../ecommerce/src/review-schemas.ts
|
|
5173
|
-
import { z as
|
|
5233
|
+
import { z as z42 } from "zod";
|
|
5174
5234
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5175
|
-
var ProductReviewItemSchema =
|
|
5176
|
-
author:
|
|
5177
|
-
rating:
|
|
5235
|
+
var ProductReviewItemSchema = z42.object({
|
|
5236
|
+
author: z42.string(),
|
|
5237
|
+
rating: z42.number(),
|
|
5178
5238
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5179
|
-
title:
|
|
5180
|
-
content:
|
|
5181
|
-
date:
|
|
5182
|
-
verified:
|
|
5239
|
+
title: z42.string().optional(),
|
|
5240
|
+
content: z42.string(),
|
|
5241
|
+
date: z42.string(),
|
|
5242
|
+
verified: z42.boolean().optional(),
|
|
5183
5243
|
/**
|
|
5184
5244
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5185
5245
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5186
5246
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5187
5247
|
*/
|
|
5188
|
-
writtenFor:
|
|
5248
|
+
writtenFor: z42.string().optional()
|
|
5189
5249
|
});
|
|
5190
5250
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5191
5251
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5192
5252
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5193
|
-
highlight:
|
|
5253
|
+
highlight: z42.string().optional(),
|
|
5194
5254
|
/**
|
|
5195
5255
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5196
5256
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5205,29 +5265,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5205
5265
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5206
5266
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5207
5267
|
*/
|
|
5208
|
-
mark:
|
|
5268
|
+
mark: z42.string().optional()
|
|
5209
5269
|
});
|
|
5210
|
-
var ReviewAggregateSchema =
|
|
5211
|
-
value:
|
|
5212
|
-
count:
|
|
5270
|
+
var ReviewAggregateSchema = z42.object({
|
|
5271
|
+
value: z42.number(),
|
|
5272
|
+
count: z42.number()
|
|
5213
5273
|
});
|
|
5214
|
-
var ProductReviewDataSchema =
|
|
5215
|
-
id:
|
|
5274
|
+
var ProductReviewDataSchema = z42.object({
|
|
5275
|
+
id: z42.string(),
|
|
5216
5276
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5217
|
-
reviews:
|
|
5277
|
+
reviews: z42.array(ProductReviewItemSchema).default([]),
|
|
5218
5278
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5219
5279
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5220
|
-
distribution:
|
|
5280
|
+
distribution: z42.array(z42.number()).default([]),
|
|
5221
5281
|
/**
|
|
5222
5282
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5223
5283
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5224
5284
|
*/
|
|
5225
|
-
highlights:
|
|
5285
|
+
highlights: z42.array(ProductReviewHighlightSchema).default([]),
|
|
5226
5286
|
/**
|
|
5227
5287
|
* True when the review provider could not be read and nothing is indexed —
|
|
5228
5288
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5229
5289
|
*/
|
|
5230
|
-
unavailable:
|
|
5290
|
+
unavailable: z42.boolean().optional()
|
|
5231
5291
|
});
|
|
5232
5292
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5233
5293
|
|
|
@@ -5521,9 +5581,9 @@ function readPdpCompanions(config) {
|
|
|
5521
5581
|
}
|
|
5522
5582
|
|
|
5523
5583
|
// ../ecommerce/src/base-attributes.ts
|
|
5524
|
-
import { z as
|
|
5584
|
+
import { z as z43 } from "zod";
|
|
5525
5585
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
5526
|
-
var BaseAttributesRecordSchema =
|
|
5586
|
+
var BaseAttributesRecordSchema = z43.record(z43.string(), AttributeDefSchema);
|
|
5527
5587
|
function buildBaseAttributesConfig(attributes) {
|
|
5528
5588
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
5529
5589
|
}
|
|
@@ -5534,9 +5594,9 @@ function readBaseAttributesConfig(config) {
|
|
|
5534
5594
|
}
|
|
5535
5595
|
|
|
5536
5596
|
// ../ecommerce/src/bucket-labels.ts
|
|
5537
|
-
import { z as
|
|
5597
|
+
import { z as z44 } from "zod";
|
|
5538
5598
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
5539
|
-
var BucketLabelsRecordSchema =
|
|
5599
|
+
var BucketLabelsRecordSchema = z44.record(z44.string(), z44.string());
|
|
5540
5600
|
function buildBucketLabelsConfig(labels) {
|
|
5541
5601
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
5542
5602
|
}
|
|
@@ -5607,6 +5667,7 @@ __export(shell_exports, {
|
|
|
5607
5667
|
useComposerAttachments: () => useComposerAttachments,
|
|
5608
5668
|
useComposerChipSelect: () => useComposerChipSelect,
|
|
5609
5669
|
useConversationPage: () => useConversationPage,
|
|
5670
|
+
useConversationPresence: () => useConversationPresence,
|
|
5610
5671
|
useDockPersistence: () => useDockPersistence,
|
|
5611
5672
|
useDockState: () => useDockState,
|
|
5612
5673
|
useExclusiveOverlay: () => useExclusiveOverlay,
|
|
@@ -6710,8 +6771,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
6710
6771
|
};
|
|
6711
6772
|
|
|
6712
6773
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
6713
|
-
import { z as
|
|
6714
|
-
var PresenceProfileSchema =
|
|
6774
|
+
import { z as z45 } from "zod";
|
|
6775
|
+
var PresenceProfileSchema = z45.object({
|
|
6715
6776
|
/**
|
|
6716
6777
|
* How much the agent SPEAKS in presence.
|
|
6717
6778
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -6721,14 +6782,14 @@ var PresenceProfileSchema = z44.object({
|
|
|
6721
6782
|
* - 'terse' one lead line per turn. The default — see below.
|
|
6722
6783
|
* - 'full' a lead line plus asides beside individual elements.
|
|
6723
6784
|
*/
|
|
6724
|
-
voice:
|
|
6785
|
+
voice: z45.enum(["off", "terse", "full"]),
|
|
6725
6786
|
/**
|
|
6726
6787
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
6727
6788
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
6728
6789
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
6729
6790
|
* without the tool having to lie about what it is.
|
|
6730
6791
|
*/
|
|
6731
|
-
sources:
|
|
6792
|
+
sources: z45.union([z45.array(z45.string()), z45.literal("all")]),
|
|
6732
6793
|
/**
|
|
6733
6794
|
* Which facts render.
|
|
6734
6795
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -6737,7 +6798,7 @@ var PresenceProfileSchema = z44.object({
|
|
|
6737
6798
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
6738
6799
|
* back is itself the product (intake, configuration).
|
|
6739
6800
|
*/
|
|
6740
|
-
facts:
|
|
6801
|
+
facts: z45.enum(["inferred-only", "all"])
|
|
6741
6802
|
});
|
|
6742
6803
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
6743
6804
|
voice: "terse",
|
|
@@ -6776,37 +6837,46 @@ function usePresenceLiveTurn() {
|
|
|
6776
6837
|
import { useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
6777
6838
|
|
|
6778
6839
|
// src/utils/storage.ts
|
|
6779
|
-
|
|
6840
|
+
var opened = /* @__PURE__ */ new Map();
|
|
6841
|
+
function openWebStorage(kind) {
|
|
6842
|
+
const existing = opened.get(kind);
|
|
6843
|
+
if (existing !== void 0) return existing;
|
|
6844
|
+
let adapter;
|
|
6845
|
+
try {
|
|
6846
|
+
const storage3 = window[kind];
|
|
6847
|
+
adapter = {
|
|
6848
|
+
get: (key) => storage3.getItem(key),
|
|
6849
|
+
set: (key, value) => storage3.setItem(key, value),
|
|
6850
|
+
remove: (key) => storage3.removeItem(key)
|
|
6851
|
+
};
|
|
6852
|
+
} catch (err) {
|
|
6853
|
+
console.warn(`[fourty] ${kind} is blocked by the browser; keeping it in memory for this page:`, err);
|
|
6854
|
+
adapter = createMemoryStorageAdapter();
|
|
6855
|
+
}
|
|
6856
|
+
opened.set(kind, adapter);
|
|
6857
|
+
return adapter;
|
|
6858
|
+
}
|
|
6859
|
+
function createWebStorageAdapter(kind) {
|
|
6780
6860
|
return {
|
|
6781
6861
|
get(key) {
|
|
6782
6862
|
if (typeof window === "undefined") return null;
|
|
6783
|
-
return
|
|
6863
|
+
return openWebStorage(kind).get(key);
|
|
6784
6864
|
},
|
|
6785
6865
|
set(key, value) {
|
|
6786
6866
|
if (typeof window === "undefined") return;
|
|
6787
|
-
|
|
6867
|
+
openWebStorage(kind).set(key, value);
|
|
6788
6868
|
},
|
|
6789
6869
|
remove(key) {
|
|
6790
6870
|
if (typeof window === "undefined") return;
|
|
6791
|
-
|
|
6871
|
+
openWebStorage(kind).remove(key);
|
|
6792
6872
|
}
|
|
6793
6873
|
};
|
|
6794
6874
|
}
|
|
6875
|
+
function createSessionStorageAdapter() {
|
|
6876
|
+
return createWebStorageAdapter("sessionStorage");
|
|
6877
|
+
}
|
|
6795
6878
|
function createLocalStorageAdapter() {
|
|
6796
|
-
return
|
|
6797
|
-
get(key) {
|
|
6798
|
-
if (typeof window === "undefined") return null;
|
|
6799
|
-
return localStorage.getItem(key);
|
|
6800
|
-
},
|
|
6801
|
-
set(key, value) {
|
|
6802
|
-
if (typeof window === "undefined") return;
|
|
6803
|
-
localStorage.setItem(key, value);
|
|
6804
|
-
},
|
|
6805
|
-
remove(key) {
|
|
6806
|
-
if (typeof window === "undefined") return;
|
|
6807
|
-
localStorage.removeItem(key);
|
|
6808
|
-
}
|
|
6809
|
-
};
|
|
6879
|
+
return createWebStorageAdapter("localStorage");
|
|
6810
6880
|
}
|
|
6811
6881
|
function createMemoryStorageAdapter() {
|
|
6812
6882
|
const store = /* @__PURE__ */ new Map();
|
|
@@ -8667,22 +8737,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
8667
8737
|
}
|
|
8668
8738
|
|
|
8669
8739
|
// src/catalog/define.ts
|
|
8670
|
-
import { z as
|
|
8740
|
+
import { z as z46 } from "zod";
|
|
8741
|
+
var HYDRATED_ENTITY = z46.object({}).passthrough();
|
|
8671
8742
|
function entity(resolverKey, opts) {
|
|
8672
|
-
return resolved(
|
|
8743
|
+
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
8673
8744
|
}
|
|
8674
|
-
var text = prose(
|
|
8745
|
+
var text = prose(z46.string());
|
|
8675
8746
|
function plain() {
|
|
8676
|
-
return
|
|
8747
|
+
return z46.string();
|
|
8677
8748
|
}
|
|
8678
8749
|
function token(values) {
|
|
8679
|
-
return
|
|
8750
|
+
return z46.enum(values);
|
|
8680
8751
|
}
|
|
8681
8752
|
function catalogComponent(meta, render) {
|
|
8682
8753
|
const { props, requires, ...rest } = meta;
|
|
8683
8754
|
return {
|
|
8684
8755
|
...rest,
|
|
8685
|
-
propsSchema:
|
|
8756
|
+
propsSchema: z46.object(props),
|
|
8686
8757
|
...requires !== void 0 ? { requires } : {},
|
|
8687
8758
|
component: adaptComponent(render)
|
|
8688
8759
|
};
|
|
@@ -10577,8 +10648,8 @@ function navigateToExternalCommerceUrl(url) {
|
|
|
10577
10648
|
isFramed = true;
|
|
10578
10649
|
}
|
|
10579
10650
|
if (isFramed) {
|
|
10580
|
-
const
|
|
10581
|
-
if (
|
|
10651
|
+
const opened2 = window.open(url, "_blank", "noopener,noreferrer");
|
|
10652
|
+
if (opened2 === null) {
|
|
10582
10653
|
console.warn("[navigateToExternalCommerceUrl] the browser blocked the new tab \u2014 the visitor did not leave", url);
|
|
10583
10654
|
return "blocked";
|
|
10584
10655
|
}
|
|
@@ -10718,18 +10789,18 @@ __export(ecommerce_exports, {
|
|
|
10718
10789
|
});
|
|
10719
10790
|
|
|
10720
10791
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
10721
|
-
import { z as
|
|
10792
|
+
import { z as z47 } from "zod";
|
|
10722
10793
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
10723
10794
|
"commerce.products_surfaced",
|
|
10724
10795
|
"client",
|
|
10725
|
-
|
|
10796
|
+
z47.object({
|
|
10726
10797
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
10727
10798
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
10728
10799
|
* surfacing up against the prompt that asked for it. */
|
|
10729
|
-
turnId:
|
|
10800
|
+
turnId: z47.string().min(1).max(128),
|
|
10730
10801
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
10731
10802
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
10732
|
-
productCount:
|
|
10803
|
+
productCount: z47.number().int().nonnegative()
|
|
10733
10804
|
}).strict()
|
|
10734
10805
|
);
|
|
10735
10806
|
|
|
@@ -12229,7 +12300,7 @@ function useContentActions() {
|
|
|
12229
12300
|
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
12230
12301
|
|
|
12231
12302
|
// package.json
|
|
12232
|
-
var version = "0.5.
|
|
12303
|
+
var version = "0.5.5";
|
|
12233
12304
|
|
|
12234
12305
|
// src/host/host-modules.ts
|
|
12235
12306
|
import * as react from "react";
|
|
@@ -12316,7 +12387,7 @@ function Spacefront(props) {
|
|
|
12316
12387
|
}
|
|
12317
12388
|
|
|
12318
12389
|
// src/npm.ts
|
|
12319
|
-
import { z as
|
|
12390
|
+
import { z as z49 } from "zod";
|
|
12320
12391
|
export {
|
|
12321
12392
|
ACQUISITION_KIND_LABELS,
|
|
12322
12393
|
ACTIVE_PANEL_ATTR,
|
|
@@ -12445,9 +12516,12 @@ export {
|
|
|
12445
12516
|
GENERATION_EASE,
|
|
12446
12517
|
GenerationStyleContext,
|
|
12447
12518
|
GenerationStyleProvider,
|
|
12519
|
+
HOST_CLEARED,
|
|
12448
12520
|
HOST_MODULES,
|
|
12449
12521
|
HOST_MODULE_SPECIFIERS,
|
|
12450
12522
|
HandlerRegistryContext,
|
|
12523
|
+
HostClearedSchema,
|
|
12524
|
+
HostPayloadSchema,
|
|
12451
12525
|
HydrationStateContext,
|
|
12452
12526
|
HydratorProvider,
|
|
12453
12527
|
INITIAL_NAV_PRESENTATION,
|
|
@@ -12472,6 +12546,7 @@ export {
|
|
|
12472
12546
|
NavigatePayloadSchema,
|
|
12473
12547
|
NullComponent,
|
|
12474
12548
|
OLDEST_SUPPORTED_SDK,
|
|
12549
|
+
PAGELESS_HOST_PLACE,
|
|
12475
12550
|
PRESENCE_CANVAS_REFRESH_SIGNAL,
|
|
12476
12551
|
PRESENCE_FACT_DISMISS_SIGNAL,
|
|
12477
12552
|
PRESENCE_FLOW,
|
|
@@ -12578,6 +12653,7 @@ export {
|
|
|
12578
12653
|
VIEW_EXHAUSTED_SIGNAL,
|
|
12579
12654
|
VIEW_EXTEND_SIGNAL,
|
|
12580
12655
|
VIEW_FOCUS_ELEMENT_SIGNAL,
|
|
12656
|
+
VIEW_HOST_SIGNAL,
|
|
12581
12657
|
VISITOR_ACCESS,
|
|
12582
12658
|
VISITOR_CONTEXT_SIGNAL,
|
|
12583
12659
|
VISITOR_ID_DURABILITIES,
|
|
@@ -12689,6 +12765,8 @@ export {
|
|
|
12689
12765
|
getVisitorLocale,
|
|
12690
12766
|
hapticCue,
|
|
12691
12767
|
hasProse,
|
|
12768
|
+
hostFillsPage,
|
|
12769
|
+
hostPlace,
|
|
12692
12770
|
hostingAllows,
|
|
12693
12771
|
injectGoogleFonts,
|
|
12694
12772
|
isActiveDirective,
|
|
@@ -12726,6 +12804,8 @@ export {
|
|
|
12726
12804
|
openCartDrawerFocusedOn,
|
|
12727
12805
|
orderedVideoSources,
|
|
12728
12806
|
packRows,
|
|
12807
|
+
pageIdentityKey,
|
|
12808
|
+
pagePlace,
|
|
12729
12809
|
parseBcp47Locale,
|
|
12730
12810
|
parseReleasePreview,
|
|
12731
12811
|
pickCartAddAction,
|
|
@@ -12879,6 +12959,7 @@ export {
|
|
|
12879
12959
|
useContentActions,
|
|
12880
12960
|
useConversationMessages,
|
|
12881
12961
|
useConversationPage,
|
|
12962
|
+
useConversationPresence,
|
|
12882
12963
|
useConversationState,
|
|
12883
12964
|
useConversations,
|
|
12884
12965
|
useCurrentMessageIndex,
|
|
@@ -12992,5 +13073,6 @@ export {
|
|
|
12992
13073
|
wipeProfile,
|
|
12993
13074
|
withCartActorOrigin,
|
|
12994
13075
|
withInteractionTracking,
|
|
12995
|
-
|
|
13076
|
+
withSignalTurn,
|
|
13077
|
+
z49 as z
|
|
12996
13078
|
};
|