@40rty/ams-sdk 0.5.1 → 0.5.2
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 +583 -458
- package/dist/types/sdk/src/analytics/index.d.ts +1 -1
- package/dist/types/sdk/src/analytics/outbox.d.ts +2 -0
- package/dist/types/sdk/src/analytics/scope-context.d.ts +2 -0
- package/dist/types/sdk/src/analytics/scope.d.ts +7 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +234 -36
- package/dist/types/spacestation/src/analytics/envelope.d.ts +24 -0
- package/dist/types/spacestation/src/catalog/element-filled.d.ts +2 -2
- package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +10 -0
- package/dist/types/spacestation/src/index.d.ts +2 -0
- package/dist/types/spacestation/src/space/agent-directive.d.ts +239 -0
- package/dist/types/spacestation/src/space/session-queue.d.ts +24 -24
- package/dist/types/spacestation/src/space/trace.d.ts +12 -12
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,6 +14,10 @@ __export(src_exports3, {
|
|
|
14
14
|
ACTIVE_PANEL_ATTR: () => ACTIVE_PANEL_ATTR,
|
|
15
15
|
ACTIVE_PANEL_SELECTOR: () => ACTIVE_PANEL_SELECTOR,
|
|
16
16
|
AGENT_ASK_SIGNAL: () => AGENT_ASK_SIGNAL,
|
|
17
|
+
AGENT_DIRECTIVE_KINDS: () => AGENT_DIRECTIVE_KINDS,
|
|
18
|
+
AGENT_DIRECTIVE_SEVERITIES: () => AGENT_DIRECTIVE_SEVERITIES,
|
|
19
|
+
AGENT_DIRECTIVE_SOURCES: () => AGENT_DIRECTIVE_SOURCES,
|
|
20
|
+
AGENT_DIRECTIVE_STATUSES: () => AGENT_DIRECTIVE_STATUSES,
|
|
17
21
|
ALLOWED_ATTACHMENT_TYPES: () => ALLOWED_ATTACHMENT_TYPES,
|
|
18
22
|
ANALYTICS_CONSENTS: () => ANALYTICS_CONSENTS,
|
|
19
23
|
ANALYTICS_MAX_QUEUED: () => ANALYTICS_MAX_QUEUED,
|
|
@@ -21,6 +25,7 @@ __export(src_exports3, {
|
|
|
21
25
|
ARRIVAL_MAX_VALUE_CHARS: () => ARRIVAL_MAX_VALUE_CHARS,
|
|
22
26
|
ARRIVAL_PARAMS: () => ARRIVAL_PARAMS,
|
|
23
27
|
ATTACHMENT_ACCEPT: () => ATTACHMENT_ACCEPT,
|
|
28
|
+
AgentDirectiveSchema: () => AgentDirectiveSchema,
|
|
24
29
|
AgentOutputSchema: () => AgentOutputSchema,
|
|
25
30
|
AgentSessionSummarySchema: () => AgentSessionSummarySchema,
|
|
26
31
|
AgentSignalSchema: () => AgentSignalSchema,
|
|
@@ -147,6 +152,7 @@ __export(src_exports3, {
|
|
|
147
152
|
LlmSessionsDailySchema: () => LlmSessionsDailySchema,
|
|
148
153
|
LlmUsageBySessionSchema: () => LlmUsageBySessionSchema,
|
|
149
154
|
LlmUsageDailySchema: () => LlmUsageDailySchema,
|
|
155
|
+
MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
|
|
150
156
|
MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
|
|
151
157
|
MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
|
|
152
158
|
MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
|
|
@@ -190,6 +196,7 @@ __export(src_exports3, {
|
|
|
190
196
|
RecordVerdictInputSchema: () => RecordVerdictInputSchema,
|
|
191
197
|
RecordableVerdictSchema: () => RecordableVerdictSchema,
|
|
192
198
|
RegistryProvider: () => RegistryProvider,
|
|
199
|
+
ReorderAgentDirectivesInputSchema: () => ReorderAgentDirectivesInputSchema,
|
|
193
200
|
ReviewAggregateSchema: () => ReviewAggregateSchema,
|
|
194
201
|
ReviewSchema: () => ReviewSchema,
|
|
195
202
|
SCANNING_FORM: () => SCANNING_FORM,
|
|
@@ -228,6 +235,8 @@ __export(src_exports3, {
|
|
|
228
235
|
ShellRootContext: () => ShellRootContext,
|
|
229
236
|
ShimmerSweep: () => ShimmerSweep,
|
|
230
237
|
SiblingProductSchema: () => SiblingProductSchema,
|
|
238
|
+
SpaceAgentDirectiveListItemSchema: () => SpaceAgentDirectiveListItemSchema,
|
|
239
|
+
SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
|
|
231
240
|
SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
|
|
232
241
|
SpaceBugSchema: () => SpaceBugSchema,
|
|
233
242
|
SpacefrontCanvas: () => SpacefrontCanvas,
|
|
@@ -249,8 +258,10 @@ __export(src_exports3, {
|
|
|
249
258
|
TransitionProvider: () => TransitionProvider,
|
|
250
259
|
TurnAskPlacementProvider: () => TurnAskPlacementProvider,
|
|
251
260
|
TurnAskSchema: () => TurnAskSchema,
|
|
261
|
+
TurnScopeProvider: () => TurnScopeProvider,
|
|
252
262
|
UIElementSchema: () => UIElementSchema,
|
|
253
263
|
UnsupportedSchemaError: () => UnsupportedSchemaError,
|
|
264
|
+
UpdateAgentDirectiveInputSchema: () => UpdateAgentDirectiveInputSchema,
|
|
254
265
|
UpdateCommentInputSchema: () => UpdateCommentInputSchema,
|
|
255
266
|
VARIANT_SELECTED_OBSERVATION: () => VARIANT_SELECTED_OBSERVATION,
|
|
256
267
|
VIEW_EXHAUSTED_SIGNAL: () => VIEW_EXHAUSTED_SIGNAL,
|
|
@@ -680,6 +691,7 @@ __export(analytics_exports2, {
|
|
|
680
691
|
CONSENT_DISPOSITION: () => CONSENT_DISPOSITION,
|
|
681
692
|
DROP_REASONS: () => DROP_REASONS,
|
|
682
693
|
SURFACE_DISPOSITION: () => SURFACE_DISPOSITION,
|
|
694
|
+
TurnScopeProvider: () => TurnScopeProvider,
|
|
683
695
|
consentDisposition: () => consentDisposition,
|
|
684
696
|
createAnalyticsScope: () => createAnalyticsScope,
|
|
685
697
|
defineEventKind: () => defineEventKind,
|
|
@@ -822,7 +834,16 @@ var AnalyticsWireEventSchema = z3.object({
|
|
|
822
834
|
*/
|
|
823
835
|
sessionId: z3.string().min(1).max(128),
|
|
824
836
|
kind: z3.string().min(1).max(128),
|
|
825
|
-
payload: z3.record(z3.unknown())
|
|
837
|
+
payload: z3.record(z3.unknown()),
|
|
838
|
+
/**
|
|
839
|
+
* The agent turn whose canvas the event came from — stamped by the scope
|
|
840
|
+
* from the element the emit ran inside, never by the emit site; `null` when
|
|
841
|
+
* it ran outside any turn (the cart drawer, a root bridge). OPTIONAL because
|
|
842
|
+
* a bundle older than this field omits it, and the envelope's strip posture
|
|
843
|
+
* (header) is what keeps that bundle's batch alive. Lands in the typed
|
|
844
|
+
* `client_events.turn_id` column — the join to `agent_runs.turn_id`.
|
|
845
|
+
*/
|
|
846
|
+
turnId: z3.string().min(1).max(128).nullable().optional()
|
|
826
847
|
});
|
|
827
848
|
var AnalyticsBatchSchema = z3.object({
|
|
828
849
|
/** One mount's whole life. Lets the server see a mount's batches as one
|
|
@@ -961,7 +982,8 @@ var Outbox = class {
|
|
|
961
982
|
occurredAt: event.occurredAt,
|
|
962
983
|
kind: event.kind,
|
|
963
984
|
payload: event.payload,
|
|
964
|
-
sessionId: event.sessionId
|
|
985
|
+
sessionId: event.sessionId,
|
|
986
|
+
turnId: event.turnId === void 0 ? null : event.turnId
|
|
965
987
|
}));
|
|
966
988
|
this.rows.unshift(...restored);
|
|
967
989
|
if (this.rows.length <= this.maxQueued) return;
|
|
@@ -989,7 +1011,8 @@ var Outbox = class {
|
|
|
989
1011
|
occurredAt: row.occurredAt,
|
|
990
1012
|
kind: row.kind,
|
|
991
1013
|
payload: row.payload,
|
|
992
|
-
sessionId
|
|
1014
|
+
sessionId,
|
|
1015
|
+
turnId: row.turnId
|
|
993
1016
|
};
|
|
994
1017
|
stamped += 1;
|
|
995
1018
|
}
|
|
@@ -1010,7 +1033,8 @@ var Outbox = class {
|
|
|
1010
1033
|
occurredAt: row.occurredAt,
|
|
1011
1034
|
sessionId: row.sessionId,
|
|
1012
1035
|
kind: row.kind,
|
|
1013
|
-
payload: row.payload
|
|
1036
|
+
payload: row.payload,
|
|
1037
|
+
turnId: row.turnId
|
|
1014
1038
|
});
|
|
1015
1039
|
}
|
|
1016
1040
|
this.rows.length = 0;
|
|
@@ -1077,40 +1101,54 @@ function createEmittingScope(foundation) {
|
|
|
1077
1101
|
events
|
|
1078
1102
|
};
|
|
1079
1103
|
}
|
|
1104
|
+
function record2(turnId, kindName, payload) {
|
|
1105
|
+
try {
|
|
1106
|
+
if (closed) {
|
|
1107
|
+
ledger.record("scope-closed", 1, "an event arrived while the scope was closed");
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
const disposition = consentDisposition(consent);
|
|
1111
|
+
if (disposition.mode === "refuse") {
|
|
1112
|
+
ledger.record("consent-withheld", 1, disposition.because);
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
if (!isWirePayload(payload)) {
|
|
1116
|
+
throw new Error(`payload for "${kindName}" is not an object`);
|
|
1117
|
+
}
|
|
1118
|
+
const row = {
|
|
1119
|
+
eventId: config.newEventId(),
|
|
1120
|
+
// Stamped at EMIT, never at flush: this row may sit here for the
|
|
1121
|
+
// session boot's whole ~94s retry budget.
|
|
1122
|
+
occurredAt: config.now(),
|
|
1123
|
+
kind: kindName,
|
|
1124
|
+
payload,
|
|
1125
|
+
sessionId,
|
|
1126
|
+
turnId
|
|
1127
|
+
};
|
|
1128
|
+
if (disposition.mode === "hold") consentHold.append(row);
|
|
1129
|
+
else outbox.append(row);
|
|
1130
|
+
} catch (err) {
|
|
1131
|
+
ledger.record("emit-threw", 1, err instanceof Error ? err.message : String(err));
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
function sinkForTurn(turnId) {
|
|
1135
|
+
return {
|
|
1136
|
+
emit(kind, payload, ...guard) {
|
|
1137
|
+
void guard;
|
|
1138
|
+
record2(turnId, kind.name, payload);
|
|
1139
|
+
},
|
|
1140
|
+
forTurn: sinkForTurn
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1080
1143
|
return {
|
|
1081
1144
|
scopeId,
|
|
1082
1145
|
surface: config.surface,
|
|
1083
1146
|
spaceSlug: config.spaceSlug,
|
|
1084
1147
|
emit(kind, payload, ...guard) {
|
|
1085
1148
|
void guard;
|
|
1086
|
-
|
|
1087
|
-
if (closed) {
|
|
1088
|
-
ledger.record("scope-closed", 1, "an event arrived while the scope was closed");
|
|
1089
|
-
return;
|
|
1090
|
-
}
|
|
1091
|
-
const disposition = consentDisposition(consent);
|
|
1092
|
-
if (disposition.mode === "refuse") {
|
|
1093
|
-
ledger.record("consent-withheld", 1, disposition.because);
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
if (!isWirePayload(payload)) {
|
|
1097
|
-
throw new Error(`payload for "${kind.name}" is not an object`);
|
|
1098
|
-
}
|
|
1099
|
-
const row = {
|
|
1100
|
-
eventId: config.newEventId(),
|
|
1101
|
-
// Stamped at EMIT, never at flush: this row may sit here for the
|
|
1102
|
-
// session boot's whole ~94s retry budget.
|
|
1103
|
-
occurredAt: config.now(),
|
|
1104
|
-
kind: kind.name,
|
|
1105
|
-
payload,
|
|
1106
|
-
sessionId
|
|
1107
|
-
};
|
|
1108
|
-
if (disposition.mode === "hold") consentHold.append(row);
|
|
1109
|
-
else outbox.append(row);
|
|
1110
|
-
} catch (err) {
|
|
1111
|
-
ledger.record("emit-threw", 1, err instanceof Error ? err.message : String(err));
|
|
1112
|
-
}
|
|
1149
|
+
record2(null, kind.name, payload);
|
|
1113
1150
|
},
|
|
1151
|
+
forTurn: sinkForTurn,
|
|
1114
1152
|
bindSession(nextSessionId) {
|
|
1115
1153
|
if (nextSessionId.length === 0) {
|
|
1116
1154
|
throw new Error("[fourty/analytics] bindSession requires a non-empty session id");
|
|
@@ -1227,6 +1265,11 @@ function createInertScope(foundation, because) {
|
|
|
1227
1265
|
void guard;
|
|
1228
1266
|
ledger.record("surface-suppressed", 1, because);
|
|
1229
1267
|
},
|
|
1268
|
+
/** Suppressed either way — a turn changes nothing about a surface that
|
|
1269
|
+
* records nothing. */
|
|
1270
|
+
forTurn() {
|
|
1271
|
+
return this;
|
|
1272
|
+
},
|
|
1230
1273
|
/** Nothing is held, so there is nothing to attribute. The mount calls this
|
|
1231
1274
|
* on every surface; making it a no-op here is what keeps the mount free of
|
|
1232
1275
|
* a surface branch. */
|
|
@@ -1344,11 +1387,17 @@ function createAnalyticsScope(config) {
|
|
|
1344
1387
|
}
|
|
1345
1388
|
|
|
1346
1389
|
// src/analytics/scope-context.tsx
|
|
1347
|
-
import { createContext, useContext } from "react";
|
|
1390
|
+
import { createContext, useContext, useMemo } from "react";
|
|
1348
1391
|
var AnalyticsSinkContext = createContext(null);
|
|
1349
1392
|
var AnalyticsSinkProvider = AnalyticsSinkContext.Provider;
|
|
1393
|
+
var TurnScopeContext = createContext(null);
|
|
1394
|
+
var TurnScopeProvider = TurnScopeContext.Provider;
|
|
1395
|
+
function useTurnAttributed(sink) {
|
|
1396
|
+
const turnId = useContext(TurnScopeContext);
|
|
1397
|
+
return useMemo(() => sink === null || turnId === null ? sink : sink.forTurn(turnId), [sink, turnId]);
|
|
1398
|
+
}
|
|
1350
1399
|
function useAnalyticsSink() {
|
|
1351
|
-
const sink = useContext(AnalyticsSinkContext);
|
|
1400
|
+
const sink = useTurnAttributed(useContext(AnalyticsSinkContext));
|
|
1352
1401
|
if (sink === null) {
|
|
1353
1402
|
throw new Error(
|
|
1354
1403
|
"useAnalyticsSink must be used within <AnalyticsScopeMount> (inside <FourtyProvider>)"
|
|
@@ -1358,7 +1407,7 @@ function useAnalyticsSink() {
|
|
|
1358
1407
|
}
|
|
1359
1408
|
var warnedMissingSink = false;
|
|
1360
1409
|
function useOptionalAnalyticsSink() {
|
|
1361
|
-
const sink = useContext(AnalyticsSinkContext);
|
|
1410
|
+
const sink = useTurnAttributed(useContext(AnalyticsSinkContext));
|
|
1362
1411
|
if (sink === null && !warnedMissingSink && typeof window !== "undefined") {
|
|
1363
1412
|
warnedMissingSink = true;
|
|
1364
1413
|
console.warn(
|
|
@@ -1408,9 +1457,14 @@ import { useCallback } from "react";
|
|
|
1408
1457
|
// ../spacestation/src/index.ts
|
|
1409
1458
|
var src_exports = {};
|
|
1410
1459
|
__export(src_exports, {
|
|
1460
|
+
AGENT_DIRECTIVE_KINDS: () => AGENT_DIRECTIVE_KINDS,
|
|
1461
|
+
AGENT_DIRECTIVE_SEVERITIES: () => AGENT_DIRECTIVE_SEVERITIES,
|
|
1462
|
+
AGENT_DIRECTIVE_SOURCES: () => AGENT_DIRECTIVE_SOURCES,
|
|
1463
|
+
AGENT_DIRECTIVE_STATUSES: () => AGENT_DIRECTIVE_STATUSES,
|
|
1411
1464
|
ALLOWED_ATTACHMENT_TYPES: () => ALLOWED_ATTACHMENT_TYPES,
|
|
1412
1465
|
ARRIVAL_MAX_VALUE_CHARS: () => ARRIVAL_MAX_VALUE_CHARS,
|
|
1413
1466
|
ARRIVAL_PARAMS: () => ARRIVAL_PARAMS,
|
|
1467
|
+
AgentDirectiveSchema: () => AgentDirectiveSchema,
|
|
1414
1468
|
AgentOutputSchema: () => AgentOutputSchema,
|
|
1415
1469
|
AgentSessionSummarySchema: () => AgentSessionSummarySchema,
|
|
1416
1470
|
AgentSignalSchema: () => AgentSignalSchema,
|
|
@@ -1476,6 +1530,7 @@ __export(src_exports, {
|
|
|
1476
1530
|
LlmSessionsDailySchema: () => LlmSessionsDailySchema,
|
|
1477
1531
|
LlmUsageBySessionSchema: () => LlmUsageBySessionSchema,
|
|
1478
1532
|
LlmUsageDailySchema: () => LlmUsageDailySchema,
|
|
1533
|
+
MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
|
|
1479
1534
|
MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
|
|
1480
1535
|
MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
|
|
1481
1536
|
MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
|
|
@@ -1501,6 +1556,7 @@ __export(src_exports, {
|
|
|
1501
1556
|
RESERVED_ID_SET: () => RESERVED_ID_SET,
|
|
1502
1557
|
RecordVerdictInputSchema: () => RecordVerdictInputSchema,
|
|
1503
1558
|
RecordableVerdictSchema: () => RecordableVerdictSchema,
|
|
1559
|
+
ReorderAgentDirectivesInputSchema: () => ReorderAgentDirectivesInputSchema,
|
|
1504
1560
|
SDK_SHIMS: () => SDK_SHIMS,
|
|
1505
1561
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
1506
1562
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
@@ -1529,6 +1585,8 @@ __export(src_exports, {
|
|
|
1529
1585
|
SessionVerdictSchema: () => SessionVerdictSchema,
|
|
1530
1586
|
ShellConfigSchema: () => ShellConfigSchema,
|
|
1531
1587
|
ShellMenuItemSchema: () => ShellMenuItemSchema,
|
|
1588
|
+
SpaceAgentDirectiveListItemSchema: () => SpaceAgentDirectiveListItemSchema,
|
|
1589
|
+
SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
|
|
1532
1590
|
SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
|
|
1533
1591
|
SpaceBugSchema: () => SpaceBugSchema,
|
|
1534
1592
|
SpecSchema: () => SpecSchema,
|
|
@@ -1546,6 +1604,7 @@ __export(src_exports, {
|
|
|
1546
1604
|
TurnAskSchema: () => TurnAskSchema,
|
|
1547
1605
|
UIElementSchema: () => UIElementSchema,
|
|
1548
1606
|
UnsupportedSchemaError: () => UnsupportedSchemaError,
|
|
1607
|
+
UpdateAgentDirectiveInputSchema: () => UpdateAgentDirectiveInputSchema,
|
|
1549
1608
|
UpdateCommentInputSchema: () => UpdateCommentInputSchema,
|
|
1550
1609
|
VARIANT_SELECTED_OBSERVATION: () => VARIANT_SELECTED_OBSERVATION,
|
|
1551
1610
|
VIEW_EXHAUSTED_SIGNAL: () => VIEW_EXHAUSTED_SIGNAL,
|
|
@@ -2798,6 +2857,8 @@ function isElementUnfilled(element, catalog, aliases, options) {
|
|
|
2798
2857
|
const props = element.props;
|
|
2799
2858
|
for (const { path, meta } of getResolvedPaths(entry.propsSchema)) {
|
|
2800
2859
|
if (options?.requireMaterialized !== true && derivedSourceFilled(meta, props)) continue;
|
|
2860
|
+
const top = path[0];
|
|
2861
|
+
if (typeof top === "string" && isOptionalTopLevelProp(entry.propsSchema, top)) continue;
|
|
2801
2862
|
const expansions = Array.from(expandPath(props, path));
|
|
2802
2863
|
if (expansions.length === 0) return true;
|
|
2803
2864
|
for (const { value } of expansions) {
|
|
@@ -3461,6 +3522,14 @@ var PackageReleaseSchema = z27.object({
|
|
|
3461
3522
|
* markdown the agent reads, gated on the capabilities it names (`requires`).
|
|
3462
3523
|
*/
|
|
3463
3524
|
promptSections: z27.array(z27.object({ id: z27.string().regex(/^[a-z0-9-]+$/), order: z27.number().int(), content: z27.string().min(1).max(2e4), requires: z27.array(z27.string()) }).strict()).max(10).optional(),
|
|
3525
|
+
/**
|
|
3526
|
+
* The brand's SPACE prompt — its `prompts/space.md`, verbatim: sections split
|
|
3527
|
+
* by `<!-- section:<id> -->` markers, the same format as the platform's
|
|
3528
|
+
* `prompts/spaces/<slug>.md`, which it replaces for any space bound to this
|
|
3529
|
+
* package. How the brand speaks, what it sells and what it never claims ship
|
|
3530
|
+
* with the brand, and a release changes them with no platform deploy.
|
|
3531
|
+
*/
|
|
3532
|
+
spacePrompt: z27.string().min(1).max(2e5).optional(),
|
|
3464
3533
|
/**
|
|
3465
3534
|
* Opaque per-vertical extension data (`BrandDefinition.config`): the
|
|
3466
3535
|
* platform stays vertical-agnostic and the vertical's own code reads its keys.
|
|
@@ -3817,6 +3886,51 @@ function scopeOfAttributeKey(config, key) {
|
|
|
3817
3886
|
return match;
|
|
3818
3887
|
}
|
|
3819
3888
|
|
|
3889
|
+
// ../spacestation/src/space/agent-directive.ts
|
|
3890
|
+
import { z as z36 } from "zod";
|
|
3891
|
+
var MAX_ACTIVE_AGENT_DIRECTIVES = 12;
|
|
3892
|
+
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
3893
|
+
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
3894
|
+
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
3895
|
+
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
3896
|
+
var AgentDirectiveSchema = z36.object({
|
|
3897
|
+
name: z36.string().trim().min(1).max(80),
|
|
3898
|
+
kind: z36.enum(AGENT_DIRECTIVE_KINDS),
|
|
3899
|
+
severity: z36.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
3900
|
+
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
3901
|
+
* product name. */
|
|
3902
|
+
text: z36.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
3903
|
+
}).strict();
|
|
3904
|
+
var SpaceAgentDirectiveSchema = z36.object({
|
|
3905
|
+
id: z36.string(),
|
|
3906
|
+
position: z36.number().int(),
|
|
3907
|
+
name: z36.string(),
|
|
3908
|
+
kind: z36.enum(AGENT_DIRECTIVE_KINDS),
|
|
3909
|
+
severity: z36.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
3910
|
+
text: z36.string(),
|
|
3911
|
+
source: z36.enum(AGENT_DIRECTIVE_SOURCES),
|
|
3912
|
+
status: z36.enum(AGENT_DIRECTIVE_STATUSES),
|
|
3913
|
+
/** Who wrote it; null for a lesson the system proposed. */
|
|
3914
|
+
createdBy: z36.string().nullable(),
|
|
3915
|
+
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
3916
|
+
evidence: z36.record(z36.unknown()).nullable(),
|
|
3917
|
+
decidedBy: z36.string().nullable(),
|
|
3918
|
+
decidedAt: z36.string().nullable(),
|
|
3919
|
+
createdAt: z36.string()
|
|
3920
|
+
});
|
|
3921
|
+
var OutcomeTallySchema = z36.object({ turns: z36.number().int(), acted: z36.number().int() });
|
|
3922
|
+
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
3923
|
+
impact: z36.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
3924
|
+
});
|
|
3925
|
+
var UpdateAgentDirectiveInputSchema = z36.object({
|
|
3926
|
+
name: AgentDirectiveSchema.shape.name.optional(),
|
|
3927
|
+
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
3928
|
+
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
3929
|
+
text: AgentDirectiveSchema.shape.text.optional(),
|
|
3930
|
+
status: z36.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
3931
|
+
}).strict();
|
|
3932
|
+
var ReorderAgentDirectivesInputSchema = z36.object({ ids: z36.array(z36.string()).min(1) }).strict();
|
|
3933
|
+
|
|
3820
3934
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
3821
3935
|
var COMPONENT_SOURCE = {
|
|
3822
3936
|
ui: "@fourty/ui"
|
|
@@ -3879,30 +3993,30 @@ function hostingAllows(hosting, surface) {
|
|
|
3879
3993
|
}
|
|
3880
3994
|
|
|
3881
3995
|
// ../spacestation/src/space/trace.ts
|
|
3882
|
-
import { z as
|
|
3883
|
-
var RunTokenUsageSchema =
|
|
3884
|
-
input_tokens:
|
|
3885
|
-
output_tokens:
|
|
3886
|
-
cache_read_tokens:
|
|
3996
|
+
import { z as z37 } from "zod";
|
|
3997
|
+
var RunTokenUsageSchema = z37.object({
|
|
3998
|
+
input_tokens: z37.number().optional(),
|
|
3999
|
+
output_tokens: z37.number().optional(),
|
|
4000
|
+
cache_read_tokens: z37.number().optional()
|
|
3887
4001
|
});
|
|
3888
|
-
var TraceRecordSchema =
|
|
3889
|
-
id:
|
|
3890
|
-
spaceId:
|
|
3891
|
-
sessionId:
|
|
4002
|
+
var TraceRecordSchema = z37.object({
|
|
4003
|
+
id: z37.string().uuid(),
|
|
4004
|
+
spaceId: z37.string().uuid().nullable(),
|
|
4005
|
+
sessionId: z37.string(),
|
|
3892
4006
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
3893
4007
|
* for an unlocked space / anonymous unlock. */
|
|
3894
|
-
visitorEmail:
|
|
3895
|
-
userPrompt:
|
|
3896
|
-
branch:
|
|
3897
|
-
responseText:
|
|
3898
|
-
layout:
|
|
3899
|
-
phaseTimings:
|
|
3900
|
-
tokensByModel:
|
|
3901
|
-
toolCalls:
|
|
3902
|
-
diagnostics:
|
|
3903
|
-
latencyFirstText:
|
|
3904
|
-
latencyFirstPatch:
|
|
3905
|
-
latencyTotal:
|
|
4008
|
+
visitorEmail: z37.string().nullable(),
|
|
4009
|
+
userPrompt: z37.string(),
|
|
4010
|
+
branch: z37.string().nullable(),
|
|
4011
|
+
responseText: z37.string().nullable(),
|
|
4012
|
+
layout: z37.unknown().nullable(),
|
|
4013
|
+
phaseTimings: z37.record(z37.number()).nullable(),
|
|
4014
|
+
tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
|
|
4015
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
4016
|
+
diagnostics: z37.array(z37.unknown()).nullable(),
|
|
4017
|
+
latencyFirstText: z37.number().int().nullable(),
|
|
4018
|
+
latencyFirstPatch: z37.number().int().nullable(),
|
|
4019
|
+
latencyTotal: z37.number().int().nullable(),
|
|
3906
4020
|
/**
|
|
3907
4021
|
* The CLIENT's turn id for this run, or `null`.
|
|
3908
4022
|
*
|
|
@@ -3918,29 +4032,29 @@ var TraceRecordSchema = z36.object({
|
|
|
3918
4032
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
3919
4033
|
* visitor asked something and got nothing.
|
|
3920
4034
|
*/
|
|
3921
|
-
turnId:
|
|
4035
|
+
turnId: z37.string().nullable(),
|
|
3922
4036
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
3923
4037
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
3924
|
-
trackerState:
|
|
3925
|
-
createdAt:
|
|
4038
|
+
trackerState: z37.unknown().nullable(),
|
|
4039
|
+
createdAt: z37.string()
|
|
3926
4040
|
});
|
|
3927
|
-
var MillisecondsSchema =
|
|
3928
|
-
var CreateTraceInputSchema =
|
|
3929
|
-
spaceId:
|
|
3930
|
-
sessionId:
|
|
3931
|
-
visitorEmail:
|
|
3932
|
-
userPrompt:
|
|
3933
|
-
branch:
|
|
3934
|
-
responseText:
|
|
3935
|
-
layout:
|
|
3936
|
-
phaseTimings:
|
|
3937
|
-
tokensByModel:
|
|
3938
|
-
toolCalls:
|
|
3939
|
-
diagnostics:
|
|
4041
|
+
var MillisecondsSchema = z37.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
4042
|
+
var CreateTraceInputSchema = z37.object({
|
|
4043
|
+
spaceId: z37.string().uuid().nullable(),
|
|
4044
|
+
sessionId: z37.string(),
|
|
4045
|
+
visitorEmail: z37.string().nullable(),
|
|
4046
|
+
userPrompt: z37.string(),
|
|
4047
|
+
branch: z37.string().nullable(),
|
|
4048
|
+
responseText: z37.string().nullable(),
|
|
4049
|
+
layout: z37.unknown().nullable(),
|
|
4050
|
+
phaseTimings: z37.record(z37.number()).nullable(),
|
|
4051
|
+
tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
|
|
4052
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
4053
|
+
diagnostics: z37.array(z37.unknown()).nullable(),
|
|
3940
4054
|
latencyFirstText: MillisecondsSchema,
|
|
3941
4055
|
latencyFirstPatch: MillisecondsSchema,
|
|
3942
4056
|
latencyTotal: MillisecondsSchema,
|
|
3943
|
-
trackerState:
|
|
4057
|
+
trackerState: z37.unknown().nullable(),
|
|
3944
4058
|
/**
|
|
3945
4059
|
* The CLIENT's turn id for this run, or `null`.
|
|
3946
4060
|
*
|
|
@@ -3956,37 +4070,37 @@ var CreateTraceInputSchema = z36.object({
|
|
|
3956
4070
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
3957
4071
|
* visitor asked something and got nothing.
|
|
3958
4072
|
*/
|
|
3959
|
-
turnId:
|
|
4073
|
+
turnId: z37.string().nullable()
|
|
3960
4074
|
});
|
|
3961
|
-
var AgentSessionSummarySchema =
|
|
3962
|
-
sessionId:
|
|
4075
|
+
var AgentSessionSummarySchema = z37.object({
|
|
4076
|
+
sessionId: z37.string(),
|
|
3963
4077
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
3964
|
-
turnCount:
|
|
4078
|
+
turnCount: z37.number().int(),
|
|
3965
4079
|
/** The session's opening prompt — titles the row in the UI. */
|
|
3966
|
-
firstPrompt:
|
|
3967
|
-
startedAt:
|
|
3968
|
-
lastRunAt:
|
|
4080
|
+
firstPrompt: z37.string(),
|
|
4081
|
+
startedAt: z37.string(),
|
|
4082
|
+
lastRunAt: z37.string(),
|
|
3969
4083
|
/** Summed `latency_total` across the session's turns. */
|
|
3970
|
-
totalLatencyMs:
|
|
4084
|
+
totalLatencyMs: z37.number().int()
|
|
3971
4085
|
});
|
|
3972
|
-
var SessionTurnSchema =
|
|
3973
|
-
id:
|
|
3974
|
-
userPrompt:
|
|
3975
|
-
responseText:
|
|
4086
|
+
var SessionTurnSchema = z37.object({
|
|
4087
|
+
id: z37.string().uuid(),
|
|
4088
|
+
userPrompt: z37.string(),
|
|
4089
|
+
responseText: z37.string().nullable(),
|
|
3976
4090
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
3977
|
-
layout:
|
|
3978
|
-
createdAt:
|
|
3979
|
-
latencyTotal:
|
|
3980
|
-
phaseTimings:
|
|
3981
|
-
tokensByModel:
|
|
3982
|
-
input_tokens:
|
|
3983
|
-
output_tokens:
|
|
4091
|
+
layout: z37.unknown().nullable(),
|
|
4092
|
+
createdAt: z37.string(),
|
|
4093
|
+
latencyTotal: z37.number().int().nullable(),
|
|
4094
|
+
phaseTimings: z37.record(z37.number()).nullable(),
|
|
4095
|
+
tokensByModel: z37.record(z37.object({
|
|
4096
|
+
input_tokens: z37.number().optional(),
|
|
4097
|
+
output_tokens: z37.number().optional()
|
|
3984
4098
|
})).nullable(),
|
|
3985
|
-
toolCalls:
|
|
3986
|
-
diagnostics:
|
|
4099
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
4100
|
+
diagnostics: z37.array(z37.unknown()).nullable()
|
|
3987
4101
|
});
|
|
3988
|
-
var SessionReplaySchema =
|
|
3989
|
-
turns:
|
|
4102
|
+
var SessionReplaySchema = z37.object({
|
|
4103
|
+
turns: z37.array(SessionTurnSchema),
|
|
3990
4104
|
/**
|
|
3991
4105
|
* The session's own last-committed layout, read straight off the durable
|
|
3992
4106
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -3997,20 +4111,20 @@ var SessionReplaySchema = z36.object({
|
|
|
3997
4111
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
3998
4112
|
* when the durable session row itself could not be read.
|
|
3999
4113
|
*/
|
|
4000
|
-
sessionLayout:
|
|
4114
|
+
sessionLayout: z37.record(z37.string(), z37.unknown()).nullable()
|
|
4001
4115
|
});
|
|
4002
|
-
var SessionTraceSchema =
|
|
4003
|
-
trackerState:
|
|
4116
|
+
var SessionTraceSchema = z37.object({
|
|
4117
|
+
trackerState: z37.string().nullable()
|
|
4004
4118
|
});
|
|
4005
|
-
var LlmUsageDailySchema =
|
|
4006
|
-
day:
|
|
4119
|
+
var LlmUsageDailySchema = z37.object({
|
|
4120
|
+
day: z37.string(),
|
|
4007
4121
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
4008
|
-
environment:
|
|
4009
|
-
feature:
|
|
4010
|
-
model:
|
|
4011
|
-
provider:
|
|
4122
|
+
environment: z37.string(),
|
|
4123
|
+
feature: z37.string(),
|
|
4124
|
+
model: z37.string(),
|
|
4125
|
+
provider: z37.string(),
|
|
4012
4126
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
4013
|
-
keyFingerprint:
|
|
4127
|
+
keyFingerprint: z37.string().nullable(),
|
|
4014
4128
|
/**
|
|
4015
4129
|
* The space the call served, or null when it served none.
|
|
4016
4130
|
*
|
|
@@ -4019,91 +4133,91 @@ var LlmUsageDailySchema = z36.object({
|
|
|
4019
4133
|
* report that share rather than dropping it, or a per-space total reads as
|
|
4020
4134
|
* the platform total.
|
|
4021
4135
|
*/
|
|
4022
|
-
spaceId:
|
|
4136
|
+
spaceId: z37.string().nullable(),
|
|
4023
4137
|
/**
|
|
4024
4138
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
4025
4139
|
* when it served no session or the session predates surface recording.
|
|
4026
4140
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
4027
4141
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
4028
4142
|
*/
|
|
4029
|
-
surface:
|
|
4030
|
-
inputTokens:
|
|
4031
|
-
outputTokens:
|
|
4143
|
+
surface: z37.string().nullable(),
|
|
4144
|
+
inputTokens: z37.number(),
|
|
4145
|
+
outputTokens: z37.number(),
|
|
4032
4146
|
/** Subset of inputTokens, never additional to it. */
|
|
4033
|
-
cachedInputTokens:
|
|
4034
|
-
reasoningTokens:
|
|
4035
|
-
callCount:
|
|
4036
|
-
errorCount:
|
|
4037
|
-
estimatedCostUsd:
|
|
4147
|
+
cachedInputTokens: z37.number(),
|
|
4148
|
+
reasoningTokens: z37.number(),
|
|
4149
|
+
callCount: z37.number(),
|
|
4150
|
+
errorCount: z37.number(),
|
|
4151
|
+
estimatedCostUsd: z37.number().nullable()
|
|
4038
4152
|
});
|
|
4039
|
-
var LlmUsageBySessionSchema =
|
|
4040
|
-
sessionId:
|
|
4041
|
-
environment:
|
|
4042
|
-
model:
|
|
4153
|
+
var LlmUsageBySessionSchema = z37.object({
|
|
4154
|
+
sessionId: z37.string(),
|
|
4155
|
+
environment: z37.string(),
|
|
4156
|
+
model: z37.string(),
|
|
4043
4157
|
/** The space this session belongs to, or null for a session with no space. */
|
|
4044
|
-
spaceId:
|
|
4158
|
+
spaceId: z37.string().nullable(),
|
|
4045
4159
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
4046
|
-
surface:
|
|
4160
|
+
surface: z37.string().nullable(),
|
|
4047
4161
|
/** Label only — the first feature seen in the session. */
|
|
4048
|
-
firstFeature:
|
|
4049
|
-
startedAt:
|
|
4050
|
-
endedAt:
|
|
4051
|
-
inputTokens:
|
|
4052
|
-
outputTokens:
|
|
4053
|
-
cachedInputTokens:
|
|
4054
|
-
reasoningTokens:
|
|
4055
|
-
callCount:
|
|
4056
|
-
errorCount:
|
|
4162
|
+
firstFeature: z37.string(),
|
|
4163
|
+
startedAt: z37.string(),
|
|
4164
|
+
endedAt: z37.string(),
|
|
4165
|
+
inputTokens: z37.number(),
|
|
4166
|
+
outputTokens: z37.number(),
|
|
4167
|
+
cachedInputTokens: z37.number(),
|
|
4168
|
+
reasoningTokens: z37.number(),
|
|
4169
|
+
callCount: z37.number(),
|
|
4170
|
+
errorCount: z37.number(),
|
|
4057
4171
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
4058
4172
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
4059
4173
|
* the model is unpriced; never 0, which would read as free. */
|
|
4060
|
-
estimatedCostUsd:
|
|
4174
|
+
estimatedCostUsd: z37.number().nullable()
|
|
4061
4175
|
});
|
|
4062
|
-
var LlmSessionsDailySchema =
|
|
4063
|
-
day:
|
|
4064
|
-
environment:
|
|
4065
|
-
sessionCount:
|
|
4176
|
+
var LlmSessionsDailySchema = z37.object({
|
|
4177
|
+
day: z37.string(),
|
|
4178
|
+
environment: z37.string(),
|
|
4179
|
+
sessionCount: z37.number()
|
|
4066
4180
|
});
|
|
4067
4181
|
|
|
4068
4182
|
// ../spacestation/src/space/session-queue.ts
|
|
4069
|
-
import { z as
|
|
4183
|
+
import { z as z39 } from "zod";
|
|
4070
4184
|
|
|
4071
4185
|
// ../spacestation/src/space/session-activity.ts
|
|
4072
|
-
import { z as
|
|
4073
|
-
var SessionActivityEventSchema =
|
|
4074
|
-
id:
|
|
4075
|
-
kind:
|
|
4076
|
-
occurredAt:
|
|
4077
|
-
source:
|
|
4078
|
-
surface:
|
|
4079
|
-
payload:
|
|
4186
|
+
import { z as z38 } from "zod";
|
|
4187
|
+
var SessionActivityEventSchema = z38.object({
|
|
4188
|
+
id: z38.string(),
|
|
4189
|
+
kind: z38.string(),
|
|
4190
|
+
occurredAt: z38.string(),
|
|
4191
|
+
source: z38.string(),
|
|
4192
|
+
surface: z38.string(),
|
|
4193
|
+
payload: z38.record(z38.unknown())
|
|
4080
4194
|
});
|
|
4081
|
-
var SessionActivitySchema =
|
|
4082
|
-
events:
|
|
4083
|
-
hasMore:
|
|
4195
|
+
var SessionActivitySchema = z38.object({
|
|
4196
|
+
events: z38.array(SessionActivityEventSchema),
|
|
4197
|
+
hasMore: z38.boolean()
|
|
4084
4198
|
});
|
|
4085
4199
|
|
|
4086
4200
|
// ../spacestation/src/space/session-queue.ts
|
|
4087
|
-
var SessionVerdictSchema =
|
|
4088
|
-
var RecordableVerdictSchema =
|
|
4089
|
-
var SessionReviewEventSchema =
|
|
4090
|
-
id:
|
|
4201
|
+
var SessionVerdictSchema = z39.enum(["unreviewed", "viewed", "bug"]);
|
|
4202
|
+
var RecordableVerdictSchema = z39.enum(["viewed", "bug"]);
|
|
4203
|
+
var SessionReviewEventSchema = z39.object({
|
|
4204
|
+
id: z39.string().uuid(),
|
|
4091
4205
|
verdict: RecordableVerdictSchema,
|
|
4092
4206
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
4093
4207
|
* log is append-only rather than a mutable current-state row. */
|
|
4094
|
-
reviewer:
|
|
4095
|
-
note:
|
|
4096
|
-
createdAt:
|
|
4208
|
+
reviewer: z39.string(),
|
|
4209
|
+
note: z39.string().nullable(),
|
|
4210
|
+
createdAt: z39.string()
|
|
4097
4211
|
});
|
|
4098
|
-
var BugSeveritySchema =
|
|
4099
|
-
var BugLocationSchema =
|
|
4100
|
-
elementId:
|
|
4212
|
+
var BugSeveritySchema = z39.enum(["high", "medium", "low"]);
|
|
4213
|
+
var BugLocationSchema = z39.object({
|
|
4214
|
+
elementId: z39.string().nullable(),
|
|
4101
4215
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
4102
4216
|
* alongside a null `elementId`. */
|
|
4103
|
-
elementType:
|
|
4217
|
+
elementType: z39.string().nullable(),
|
|
4104
4218
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
4105
|
-
offsetXPct:
|
|
4106
|
-
offsetYPct:
|
|
4219
|
+
offsetXPct: z39.number().min(0).max(100).nullable(),
|
|
4220
|
+
offsetYPct: z39.number().min(0).max(100).nullable(),
|
|
4107
4221
|
/**
|
|
4108
4222
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
4109
4223
|
* element anchor.
|
|
@@ -4114,8 +4228,8 @@ var BugLocationSchema = z38.object({
|
|
|
4114
4228
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
4115
4229
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
4116
4230
|
*/
|
|
4117
|
-
pageX:
|
|
4118
|
-
pageY:
|
|
4231
|
+
pageX: z39.number().nullable(),
|
|
4232
|
+
pageY: z39.number().nullable()
|
|
4119
4233
|
}).refine(
|
|
4120
4234
|
(loc) => {
|
|
4121
4235
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -4129,24 +4243,24 @@ var BugLocationSchema = z38.object({
|
|
|
4129
4243
|
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)"
|
|
4130
4244
|
}
|
|
4131
4245
|
);
|
|
4132
|
-
var SessionBugSchema =
|
|
4133
|
-
id:
|
|
4246
|
+
var SessionBugSchema = z39.object({
|
|
4247
|
+
id: z39.string().uuid(),
|
|
4134
4248
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
4135
|
-
turnIndex:
|
|
4249
|
+
turnIndex: z39.number().int().nullable(),
|
|
4136
4250
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
4137
4251
|
* without pinning a spot. */
|
|
4138
4252
|
location: BugLocationSchema.nullable(),
|
|
4139
|
-
provider:
|
|
4140
|
-
issueKey:
|
|
4141
|
-
issueUrl:
|
|
4253
|
+
provider: z39.string(),
|
|
4254
|
+
issueKey: z39.string().nullable(),
|
|
4255
|
+
issueUrl: z39.string().nullable(),
|
|
4142
4256
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
4143
4257
|
* open text. Null until first synced. */
|
|
4144
|
-
issueState:
|
|
4145
|
-
title:
|
|
4146
|
-
body:
|
|
4258
|
+
issueState: z39.string().nullable(),
|
|
4259
|
+
title: z39.string(),
|
|
4260
|
+
body: z39.string(),
|
|
4147
4261
|
severity: BugSeveritySchema,
|
|
4148
|
-
createdBy:
|
|
4149
|
-
createdAt:
|
|
4262
|
+
createdBy: z39.string(),
|
|
4263
|
+
createdAt: z39.string(),
|
|
4150
4264
|
/**
|
|
4151
4265
|
* When this bug was resolved from the console; null means still OPEN.
|
|
4152
4266
|
*
|
|
@@ -4155,60 +4269,60 @@ var SessionBugSchema = z38.object({
|
|
|
4155
4269
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
4156
4270
|
* no boolean can contradict it.
|
|
4157
4271
|
*/
|
|
4158
|
-
resolvedAt:
|
|
4159
|
-
resolvedBy:
|
|
4272
|
+
resolvedAt: z39.string().nullable(),
|
|
4273
|
+
resolvedBy: z39.string().nullable()
|
|
4160
4274
|
});
|
|
4161
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
4162
|
-
var SessionCommentSchema =
|
|
4163
|
-
id:
|
|
4275
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z39.string() });
|
|
4276
|
+
var SessionCommentSchema = z39.object({
|
|
4277
|
+
id: z39.string().uuid(),
|
|
4164
4278
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
4165
|
-
bugId:
|
|
4279
|
+
bugId: z39.string().uuid().nullable(),
|
|
4166
4280
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
4167
4281
|
* parent bug's turn). */
|
|
4168
|
-
turnIndex:
|
|
4282
|
+
turnIndex: z39.number().int().nullable(),
|
|
4169
4283
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
4170
4284
|
location: BugLocationSchema.nullable(),
|
|
4171
|
-
body:
|
|
4172
|
-
createdBy:
|
|
4173
|
-
createdAt:
|
|
4285
|
+
body: z39.string(),
|
|
4286
|
+
createdBy: z39.string(),
|
|
4287
|
+
createdAt: z39.string()
|
|
4174
4288
|
});
|
|
4175
|
-
var CreateCommentInputSchema =
|
|
4176
|
-
bugId:
|
|
4177
|
-
turnIndex:
|
|
4289
|
+
var CreateCommentInputSchema = z39.object({
|
|
4290
|
+
bugId: z39.string().uuid().nullable(),
|
|
4291
|
+
turnIndex: z39.number().int().positive().nullable(),
|
|
4178
4292
|
location: BugLocationSchema.nullable(),
|
|
4179
4293
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
4180
4294
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
4181
|
-
body:
|
|
4295
|
+
body: z39.string().trim().min(1)
|
|
4182
4296
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
4183
4297
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
4184
4298
|
});
|
|
4185
|
-
var UpdateCommentInputSchema =
|
|
4186
|
-
body:
|
|
4187
|
-
bugId:
|
|
4299
|
+
var UpdateCommentInputSchema = z39.object({
|
|
4300
|
+
body: z39.string().trim().min(1).optional(),
|
|
4301
|
+
bugId: z39.string().uuid().nullable().optional(),
|
|
4188
4302
|
location: BugLocationSchema.nullable().optional()
|
|
4189
4303
|
});
|
|
4190
4304
|
var MOBILE_VIEWPORT_MAX = 720;
|
|
4191
|
-
var SessionFormFactorSchema =
|
|
4305
|
+
var SessionFormFactorSchema = z39.enum(["mobile", "desktop"]).nullable();
|
|
4192
4306
|
function formFactorFromViewport(width) {
|
|
4193
4307
|
if (width === null) return null;
|
|
4194
4308
|
return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
|
|
4195
4309
|
}
|
|
4196
|
-
var SessionSummarySchema =
|
|
4197
|
-
sessionId:
|
|
4310
|
+
var SessionSummarySchema = z39.object({
|
|
4311
|
+
sessionId: z39.string(),
|
|
4198
4312
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
4199
4313
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
4200
|
-
visitorId:
|
|
4314
|
+
visitorId: z39.string().nullable(),
|
|
4201
4315
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
4202
4316
|
* identified themselves. Both null together means "not identified yet". */
|
|
4203
|
-
identityProvider:
|
|
4204
|
-
identityKey:
|
|
4317
|
+
identityProvider: z39.string().nullable(),
|
|
4318
|
+
identityKey: z39.string().nullable(),
|
|
4205
4319
|
/** Team/test traffic. The queue hides these by default. */
|
|
4206
|
-
isInternal:
|
|
4320
|
+
isInternal: z39.boolean(),
|
|
4207
4321
|
/** Build that served the session. Null = not captured; a version filter must
|
|
4208
4322
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
4209
|
-
clientVersion:
|
|
4323
|
+
clientVersion: z39.string().nullable(),
|
|
4210
4324
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
4211
|
-
signalCounts:
|
|
4325
|
+
signalCounts: z39.record(z39.number()),
|
|
4212
4326
|
/**
|
|
4213
4327
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
4214
4328
|
*
|
|
@@ -4225,7 +4339,7 @@ var SessionSummarySchema = z38.object({
|
|
|
4225
4339
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
4226
4340
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
4227
4341
|
*/
|
|
4228
|
-
conversionAttempts:
|
|
4342
|
+
conversionAttempts: z39.number().int().nullable(),
|
|
4229
4343
|
/**
|
|
4230
4344
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
4231
4345
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -4241,7 +4355,7 @@ var SessionSummarySchema = z38.object({
|
|
|
4241
4355
|
* kinds together, and one attempt id appearing under both would be counted
|
|
4242
4356
|
* once there and twice here.
|
|
4243
4357
|
*/
|
|
4244
|
-
conversionKinds:
|
|
4358
|
+
conversionKinds: z39.record(z39.number()),
|
|
4245
4359
|
/**
|
|
4246
4360
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
4247
4361
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -4249,20 +4363,20 @@ var SessionSummarySchema = z38.object({
|
|
|
4249
4363
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
4250
4364
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
4251
4365
|
*/
|
|
4252
|
-
funnelSteps:
|
|
4366
|
+
funnelSteps: z39.array(z39.string()),
|
|
4253
4367
|
/**
|
|
4254
4368
|
* The connector's opaque handle for what this session produced in its back
|
|
4255
4369
|
* office — present only once a checkout actually reached the platform. The
|
|
4256
4370
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
4257
4371
|
*/
|
|
4258
|
-
backOfficeRef:
|
|
4372
|
+
backOfficeRef: z39.string().nullable(),
|
|
4259
4373
|
/**
|
|
4260
4374
|
* The order this session produced, when the connector's back office reported
|
|
4261
4375
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
4262
4376
|
* Both null when no order is known — the cart handle above is then the door.
|
|
4263
4377
|
*/
|
|
4264
|
-
orderRef:
|
|
4265
|
-
orderLabel:
|
|
4378
|
+
orderRef: z39.string().nullable(),
|
|
4379
|
+
orderLabel: z39.string().nullable(),
|
|
4266
4380
|
/**
|
|
4267
4381
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
4268
4382
|
* needs.
|
|
@@ -4275,12 +4389,12 @@ var SessionSummarySchema = z38.object({
|
|
|
4275
4389
|
* on a desktop are not the same session.
|
|
4276
4390
|
*/
|
|
4277
4391
|
formFactor: SessionFormFactorSchema,
|
|
4278
|
-
turnCount:
|
|
4392
|
+
turnCount: z39.number().int(),
|
|
4279
4393
|
/** The visitor's opening message — the single most informative field for
|
|
4280
4394
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
4281
|
-
firstPrompt:
|
|
4282
|
-
startedAt:
|
|
4283
|
-
lastRunAt:
|
|
4395
|
+
firstPrompt: z39.string(),
|
|
4396
|
+
startedAt: z39.string(),
|
|
4397
|
+
lastRunAt: z39.string(),
|
|
4284
4398
|
/**
|
|
4285
4399
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
4286
4400
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -4308,7 +4422,7 @@ var SessionSummarySchema = z38.object({
|
|
|
4308
4422
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
4309
4423
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
4310
4424
|
*/
|
|
4311
|
-
visitorTimeZone:
|
|
4425
|
+
visitorTimeZone: z39.string().nullable(),
|
|
4312
4426
|
/**
|
|
4313
4427
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
4314
4428
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -4316,31 +4430,31 @@ var SessionSummarySchema = z38.object({
|
|
|
4316
4430
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
4317
4431
|
* already reading. Null when no turn in the session recorded a patch.
|
|
4318
4432
|
*/
|
|
4319
|
-
avgTtftMs:
|
|
4433
|
+
avgTtftMs: z39.number().int().nullable(),
|
|
4320
4434
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
4321
4435
|
* a budget: null on sessions older than the mark's recording. */
|
|
4322
|
-
avgMainDoneMs:
|
|
4436
|
+
avgMainDoneMs: z39.number().int().nullable(),
|
|
4323
4437
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
4324
4438
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
4325
|
-
avgChipGenMs:
|
|
4326
|
-
totalLatencyMs:
|
|
4327
|
-
durationMs:
|
|
4439
|
+
avgChipGenMs: z39.number().int().nullable(),
|
|
4440
|
+
totalLatencyMs: z39.number().int(),
|
|
4441
|
+
durationMs: z39.number().int(),
|
|
4328
4442
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
4329
4443
|
* live session streams and cannot be given a verdict until it ends. */
|
|
4330
|
-
isLive:
|
|
4444
|
+
isLive: z39.boolean(),
|
|
4331
4445
|
verdict: SessionVerdictSchema,
|
|
4332
|
-
reviewedBy:
|
|
4333
|
-
reviewedAt:
|
|
4446
|
+
reviewedBy: z39.string().nullable(),
|
|
4447
|
+
reviewedAt: z39.string().nullable(),
|
|
4334
4448
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
4335
4449
|
* state without a second request. */
|
|
4336
|
-
bugIssueKey:
|
|
4337
|
-
bugIssueUrl:
|
|
4338
|
-
bugIssueState:
|
|
4450
|
+
bugIssueKey: z39.string().nullable(),
|
|
4451
|
+
bugIssueUrl: z39.string().nullable(),
|
|
4452
|
+
bugIssueState: z39.string().nullable()
|
|
4339
4453
|
});
|
|
4340
|
-
var SessionQueuePageSchema =
|
|
4341
|
-
sessions:
|
|
4342
|
-
totalCount:
|
|
4343
|
-
hiddenInternalCount:
|
|
4454
|
+
var SessionQueuePageSchema = z39.object({
|
|
4455
|
+
sessions: z39.array(SessionSummarySchema),
|
|
4456
|
+
totalCount: z39.number().int(),
|
|
4457
|
+
hiddenInternalCount: z39.number().int(),
|
|
4344
4458
|
/**
|
|
4345
4459
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
4346
4460
|
*
|
|
@@ -4350,61 +4464,61 @@ var SessionQueuePageSchema = z38.object({
|
|
|
4350
4464
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
4351
4465
|
* analytics dashboard's bounce over the same window.
|
|
4352
4466
|
*/
|
|
4353
|
-
hiddenBouncedCount:
|
|
4467
|
+
hiddenBouncedCount: z39.number().int()
|
|
4354
4468
|
});
|
|
4355
|
-
var SessionQueueFacetsSchema =
|
|
4356
|
-
review:
|
|
4357
|
-
version:
|
|
4358
|
-
turns:
|
|
4359
|
-
durationS:
|
|
4469
|
+
var SessionQueueFacetsSchema = z39.object({
|
|
4470
|
+
review: z39.record(z39.number()),
|
|
4471
|
+
version: z39.record(z39.number()),
|
|
4472
|
+
turns: z39.record(z39.number()),
|
|
4473
|
+
durationS: z39.record(z39.number()),
|
|
4360
4474
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
4361
|
-
funnel:
|
|
4475
|
+
funnel: z39.record(z39.number())
|
|
4362
4476
|
});
|
|
4363
|
-
var SessionCaptureSchema =
|
|
4364
|
-
viewportWidth:
|
|
4365
|
-
viewportHeight:
|
|
4366
|
-
userAgent:
|
|
4367
|
-
locale:
|
|
4477
|
+
var SessionCaptureSchema = z39.object({
|
|
4478
|
+
viewportWidth: z39.number().int().nullable(),
|
|
4479
|
+
viewportHeight: z39.number().int().nullable(),
|
|
4480
|
+
userAgent: z39.string().nullable(),
|
|
4481
|
+
locale: z39.string().nullable(),
|
|
4368
4482
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
4369
|
-
referrer:
|
|
4483
|
+
referrer: z39.string().nullable()
|
|
4370
4484
|
});
|
|
4371
|
-
var SessionCaptureInputSchema =
|
|
4372
|
-
viewportWidth:
|
|
4373
|
-
viewportHeight:
|
|
4374
|
-
userAgent:
|
|
4375
|
-
locale:
|
|
4485
|
+
var SessionCaptureInputSchema = z39.object({
|
|
4486
|
+
viewportWidth: z39.number().int().positive().max(2e4).optional(),
|
|
4487
|
+
viewportHeight: z39.number().int().positive().max(2e4).optional(),
|
|
4488
|
+
userAgent: z39.string().max(1e3).optional(),
|
|
4489
|
+
locale: z39.string().max(35).optional(),
|
|
4376
4490
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
4377
4491
|
* the zone database grows, and refusing a name this build has not heard of
|
|
4378
4492
|
* would drop a real session's capture over a table that is out of date. */
|
|
4379
|
-
timeZone:
|
|
4380
|
-
referrer:
|
|
4381
|
-
clientVersion:
|
|
4382
|
-
isInternal:
|
|
4493
|
+
timeZone: z39.string().max(64).optional(),
|
|
4494
|
+
referrer: z39.string().max(2048).optional(),
|
|
4495
|
+
clientVersion: z39.string().max(100).optional(),
|
|
4496
|
+
isInternal: z39.boolean().optional()
|
|
4383
4497
|
});
|
|
4384
|
-
var SessionDetailSchema =
|
|
4498
|
+
var SessionDetailSchema = z39.object({
|
|
4385
4499
|
session: SessionSummarySchema,
|
|
4386
4500
|
capture: SessionCaptureSchema,
|
|
4387
4501
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
4388
4502
|
* re-judged after a fix is the evidence the fix worked. */
|
|
4389
|
-
reviews:
|
|
4390
|
-
bugs:
|
|
4391
|
-
comments:
|
|
4503
|
+
reviews: z39.array(SessionReviewEventSchema),
|
|
4504
|
+
bugs: z39.array(SessionBugSchema),
|
|
4505
|
+
comments: z39.array(SessionCommentSchema),
|
|
4392
4506
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
4393
4507
|
* not evidence of zero visitor activity. */
|
|
4394
4508
|
activity: SessionActivitySchema.optional()
|
|
4395
4509
|
});
|
|
4396
|
-
var RecordVerdictInputSchema =
|
|
4510
|
+
var RecordVerdictInputSchema = z39.object({
|
|
4397
4511
|
verdict: RecordableVerdictSchema,
|
|
4398
|
-
note:
|
|
4512
|
+
note: z39.string().max(2e3).optional()
|
|
4399
4513
|
});
|
|
4400
|
-
var FileBugInputSchema =
|
|
4401
|
-
turnIndex:
|
|
4514
|
+
var FileBugInputSchema = z39.object({
|
|
4515
|
+
turnIndex: z39.number().int().positive().nullable(),
|
|
4402
4516
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
4403
4517
|
location: BugLocationSchema.nullable().optional(),
|
|
4404
|
-
title:
|
|
4405
|
-
body:
|
|
4518
|
+
title: z39.string().min(1).max(300),
|
|
4519
|
+
body: z39.string().min(1),
|
|
4406
4520
|
severity: BugSeveritySchema,
|
|
4407
|
-
payload:
|
|
4521
|
+
payload: z39.record(z39.unknown())
|
|
4408
4522
|
});
|
|
4409
4523
|
|
|
4410
4524
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
@@ -4684,60 +4798,60 @@ __export(src_exports2, {
|
|
|
4684
4798
|
});
|
|
4685
4799
|
|
|
4686
4800
|
// ../ecommerce/src/commerce-schemas.ts
|
|
4687
|
-
import { z as
|
|
4688
|
-
var MoneySchema =
|
|
4689
|
-
amount:
|
|
4690
|
-
currencyCode:
|
|
4801
|
+
import { z as z40 } from "zod";
|
|
4802
|
+
var MoneySchema = z40.object({
|
|
4803
|
+
amount: z40.number(),
|
|
4804
|
+
currencyCode: z40.string()
|
|
4691
4805
|
});
|
|
4692
|
-
var ImageSchema =
|
|
4693
|
-
url:
|
|
4694
|
-
altText:
|
|
4695
|
-
width:
|
|
4696
|
-
height:
|
|
4806
|
+
var ImageSchema = z40.object({
|
|
4807
|
+
url: z40.string(),
|
|
4808
|
+
altText: z40.string(),
|
|
4809
|
+
width: z40.number().optional(),
|
|
4810
|
+
height: z40.number().optional(),
|
|
4697
4811
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
4698
4812
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
4699
4813
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
4700
|
-
srcSet:
|
|
4814
|
+
srcSet: z40.string().optional()
|
|
4701
4815
|
});
|
|
4702
|
-
var AssetSchema =
|
|
4816
|
+
var AssetSchema = z40.object({
|
|
4703
4817
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
4704
|
-
id:
|
|
4705
|
-
url:
|
|
4706
|
-
altText:
|
|
4707
|
-
srcSet:
|
|
4818
|
+
id: z40.string(),
|
|
4819
|
+
url: z40.string(),
|
|
4820
|
+
altText: z40.string(),
|
|
4821
|
+
srcSet: z40.string().optional()
|
|
4708
4822
|
});
|
|
4709
|
-
var SelectedOptionSchema =
|
|
4710
|
-
name:
|
|
4711
|
-
value:
|
|
4823
|
+
var SelectedOptionSchema = z40.object({
|
|
4824
|
+
name: z40.string(),
|
|
4825
|
+
value: z40.string()
|
|
4712
4826
|
});
|
|
4713
|
-
var VideoSourceSchema =
|
|
4714
|
-
url:
|
|
4715
|
-
mimeType:
|
|
4716
|
-
width:
|
|
4717
|
-
height:
|
|
4827
|
+
var VideoSourceSchema = z40.object({
|
|
4828
|
+
url: z40.string(),
|
|
4829
|
+
mimeType: z40.string(),
|
|
4830
|
+
width: z40.number().optional(),
|
|
4831
|
+
height: z40.number().optional()
|
|
4718
4832
|
});
|
|
4719
|
-
var ProductVideoSchema =
|
|
4720
|
-
kind:
|
|
4833
|
+
var ProductVideoSchema = z40.object({
|
|
4834
|
+
kind: z40.enum(["hosted", "external"]),
|
|
4721
4835
|
previewImage: ImageSchema.optional(),
|
|
4722
|
-
altText:
|
|
4836
|
+
altText: z40.string().default(""),
|
|
4723
4837
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
4724
|
-
sources:
|
|
4838
|
+
sources: z40.array(VideoSourceSchema).default([]),
|
|
4725
4839
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
4726
|
-
embedUrl:
|
|
4840
|
+
embedUrl: z40.string().optional(),
|
|
4727
4841
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
4728
|
-
host:
|
|
4842
|
+
host: z40.string().optional()
|
|
4729
4843
|
});
|
|
4730
|
-
var AvailabilityStatusSchema =
|
|
4844
|
+
var AvailabilityStatusSchema = z40.enum([
|
|
4731
4845
|
"in_stock",
|
|
4732
4846
|
"backorder",
|
|
4733
4847
|
"preorder",
|
|
4734
4848
|
"out_of_stock",
|
|
4735
4849
|
"discontinued"
|
|
4736
4850
|
]);
|
|
4737
|
-
var ProductVariantSchema =
|
|
4738
|
-
id:
|
|
4739
|
-
title:
|
|
4740
|
-
available:
|
|
4851
|
+
var ProductVariantSchema = z40.object({
|
|
4852
|
+
id: z40.string(),
|
|
4853
|
+
title: z40.string(),
|
|
4854
|
+
available: z40.boolean(),
|
|
4741
4855
|
/**
|
|
4742
4856
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
4743
4857
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -4752,7 +4866,7 @@ var ProductVariantSchema = z39.object({
|
|
|
4752
4866
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
4753
4867
|
price: MoneySchema,
|
|
4754
4868
|
compareAtPrice: MoneySchema.optional(),
|
|
4755
|
-
selectedOptions:
|
|
4869
|
+
selectedOptions: z40.array(SelectedOptionSchema).optional(),
|
|
4756
4870
|
image: ImageSchema.optional()
|
|
4757
4871
|
});
|
|
4758
4872
|
var MP4_MIME = "video/mp4";
|
|
@@ -4763,34 +4877,34 @@ function orderedVideoSources(video) {
|
|
|
4763
4877
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
4764
4878
|
return [...mp4, ...hls];
|
|
4765
4879
|
}
|
|
4766
|
-
var SiblingProductSchema =
|
|
4767
|
-
id:
|
|
4768
|
-
handle:
|
|
4769
|
-
title:
|
|
4880
|
+
var SiblingProductSchema = z40.object({
|
|
4881
|
+
id: z40.string(),
|
|
4882
|
+
handle: z40.string(),
|
|
4883
|
+
title: z40.string(),
|
|
4770
4884
|
/** The differentiating value across siblings — typically the color
|
|
4771
4885
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
4772
|
-
color:
|
|
4886
|
+
color: z40.string(),
|
|
4773
4887
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
4774
4888
|
* first image; renderers crop / fit to the swatch tile. */
|
|
4775
4889
|
swatchImage: ImageSchema.optional(),
|
|
4776
|
-
available:
|
|
4890
|
+
available: z40.boolean().default(true),
|
|
4777
4891
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
4778
4892
|
* picker uses this to highlight the active swatch without an
|
|
4779
4893
|
* external id comparison. */
|
|
4780
|
-
current:
|
|
4894
|
+
current: z40.boolean().default(false)
|
|
4781
4895
|
});
|
|
4782
|
-
var ProductSchema =
|
|
4783
|
-
id:
|
|
4784
|
-
handle:
|
|
4785
|
-
title:
|
|
4786
|
-
description:
|
|
4787
|
-
descriptionHtml:
|
|
4788
|
-
vendor:
|
|
4789
|
-
productType:
|
|
4790
|
-
tags:
|
|
4896
|
+
var ProductSchema = z40.object({
|
|
4897
|
+
id: z40.string(),
|
|
4898
|
+
handle: z40.string().default(""),
|
|
4899
|
+
title: z40.string(),
|
|
4900
|
+
description: z40.string().default(""),
|
|
4901
|
+
descriptionHtml: z40.string().optional(),
|
|
4902
|
+
vendor: z40.string().default(""),
|
|
4903
|
+
productType: z40.string().optional(),
|
|
4904
|
+
tags: z40.array(z40.string()).default([]),
|
|
4791
4905
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
4792
4906
|
compareAtPrice: MoneySchema.optional(),
|
|
4793
|
-
images:
|
|
4907
|
+
images: z40.array(ImageSchema).default([]),
|
|
4794
4908
|
/**
|
|
4795
4909
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
4796
4910
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -4798,21 +4912,21 @@ var ProductSchema = z39.object({
|
|
|
4798
4912
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
4799
4913
|
* presence guard.
|
|
4800
4914
|
*/
|
|
4801
|
-
videos:
|
|
4802
|
-
variants:
|
|
4803
|
-
availableForSale:
|
|
4804
|
-
options:
|
|
4805
|
-
name:
|
|
4806
|
-
values:
|
|
4915
|
+
videos: z40.array(ProductVideoSchema).default([]),
|
|
4916
|
+
variants: z40.array(ProductVariantSchema).default([]),
|
|
4917
|
+
availableForSale: z40.boolean().default(true),
|
|
4918
|
+
options: z40.array(z40.object({
|
|
4919
|
+
name: z40.string(),
|
|
4920
|
+
values: z40.array(z40.string())
|
|
4807
4921
|
})).optional(),
|
|
4808
|
-
collections:
|
|
4922
|
+
collections: z40.array(z40.string()).optional(),
|
|
4809
4923
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
4810
4924
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
4811
4925
|
* presence guard. */
|
|
4812
|
-
colorVariants:
|
|
4813
|
-
rating:
|
|
4814
|
-
value:
|
|
4815
|
-
count:
|
|
4926
|
+
colorVariants: z40.array(SiblingProductSchema).default([]),
|
|
4927
|
+
rating: z40.object({
|
|
4928
|
+
value: z40.number(),
|
|
4929
|
+
count: z40.number()
|
|
4816
4930
|
}).optional(),
|
|
4817
4931
|
/**
|
|
4818
4932
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -4821,12 +4935,12 @@ var ProductSchema = z39.object({
|
|
|
4821
4935
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
4822
4936
|
* etc.) consume directly.
|
|
4823
4937
|
*/
|
|
4824
|
-
reviews:
|
|
4825
|
-
author:
|
|
4826
|
-
rating:
|
|
4827
|
-
content:
|
|
4828
|
-
date:
|
|
4829
|
-
verified:
|
|
4938
|
+
reviews: z40.array(z40.object({
|
|
4939
|
+
author: z40.string(),
|
|
4940
|
+
rating: z40.number(),
|
|
4941
|
+
content: z40.string(),
|
|
4942
|
+
date: z40.string(),
|
|
4943
|
+
verified: z40.boolean().optional()
|
|
4830
4944
|
})).optional(),
|
|
4831
4945
|
/**
|
|
4832
4946
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -4838,7 +4952,7 @@ var ProductSchema = z39.object({
|
|
|
4838
4952
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
4839
4953
|
* Storefront mapper.
|
|
4840
4954
|
*/
|
|
4841
|
-
unavailable:
|
|
4955
|
+
unavailable: z40.boolean().default(false)
|
|
4842
4956
|
});
|
|
4843
4957
|
function createUnavailableProduct(gid) {
|
|
4844
4958
|
return {
|
|
@@ -4860,68 +4974,68 @@ function createUnavailableProduct(gid) {
|
|
|
4860
4974
|
function isGhostEntity(value) {
|
|
4861
4975
|
return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
|
|
4862
4976
|
}
|
|
4863
|
-
var ReviewSchema =
|
|
4864
|
-
id:
|
|
4865
|
-
productId:
|
|
4866
|
-
author:
|
|
4867
|
-
rating:
|
|
4868
|
-
text:
|
|
4869
|
-
date:
|
|
4870
|
-
verified:
|
|
4977
|
+
var ReviewSchema = z40.object({
|
|
4978
|
+
id: z40.string(),
|
|
4979
|
+
productId: z40.string(),
|
|
4980
|
+
author: z40.string(),
|
|
4981
|
+
rating: z40.number(),
|
|
4982
|
+
text: z40.string(),
|
|
4983
|
+
date: z40.string(),
|
|
4984
|
+
verified: z40.boolean()
|
|
4871
4985
|
});
|
|
4872
|
-
var ArticleSchema =
|
|
4873
|
-
id:
|
|
4874
|
-
handle:
|
|
4875
|
-
title:
|
|
4876
|
-
excerpt:
|
|
4877
|
-
content:
|
|
4878
|
-
contentHtml:
|
|
4879
|
-
author:
|
|
4880
|
-
publishedAt:
|
|
4986
|
+
var ArticleSchema = z40.object({
|
|
4987
|
+
id: z40.string(),
|
|
4988
|
+
handle: z40.string().default(""),
|
|
4989
|
+
title: z40.string(),
|
|
4990
|
+
excerpt: z40.string().default(""),
|
|
4991
|
+
content: z40.string().default(""),
|
|
4992
|
+
contentHtml: z40.string().optional(),
|
|
4993
|
+
author: z40.string().default(""),
|
|
4994
|
+
publishedAt: z40.string().default(""),
|
|
4881
4995
|
image: ImageSchema.optional(),
|
|
4882
|
-
blogHandle:
|
|
4883
|
-
tags:
|
|
4996
|
+
blogHandle: z40.string().default(""),
|
|
4997
|
+
tags: z40.array(z40.string()).default([])
|
|
4884
4998
|
});
|
|
4885
|
-
var CmsPageSchema =
|
|
4886
|
-
id:
|
|
4887
|
-
handle:
|
|
4888
|
-
title:
|
|
4889
|
-
body:
|
|
4890
|
-
bodyHtml:
|
|
4891
|
-
bodySummary:
|
|
4892
|
-
updatedAt:
|
|
4893
|
-
seoTitle:
|
|
4894
|
-
seoDescription:
|
|
4999
|
+
var CmsPageSchema = z40.object({
|
|
5000
|
+
id: z40.string(),
|
|
5001
|
+
handle: z40.string().default(""),
|
|
5002
|
+
title: z40.string(),
|
|
5003
|
+
body: z40.string().default(""),
|
|
5004
|
+
bodyHtml: z40.string().optional(),
|
|
5005
|
+
bodySummary: z40.string().default(""),
|
|
5006
|
+
updatedAt: z40.string().default(""),
|
|
5007
|
+
seoTitle: z40.string().optional(),
|
|
5008
|
+
seoDescription: z40.string().optional()
|
|
4895
5009
|
});
|
|
4896
|
-
var CmsPolicySchema =
|
|
4897
|
-
id:
|
|
5010
|
+
var CmsPolicySchema = z40.object({
|
|
5011
|
+
id: z40.string(),
|
|
4898
5012
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
4899
5013
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
4900
5014
|
* platforms with custom policy types can extend. */
|
|
4901
|
-
kind:
|
|
5015
|
+
kind: z40.string(),
|
|
4902
5016
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
4903
5017
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
4904
5018
|
* surface one. */
|
|
4905
|
-
handle:
|
|
4906
|
-
title:
|
|
4907
|
-
body:
|
|
4908
|
-
bodyHtml:
|
|
4909
|
-
url:
|
|
5019
|
+
handle: z40.string().default(""),
|
|
5020
|
+
title: z40.string(),
|
|
5021
|
+
body: z40.string().default(""),
|
|
5022
|
+
bodyHtml: z40.string().optional(),
|
|
5023
|
+
url: z40.string().default("")
|
|
4910
5024
|
});
|
|
4911
|
-
var CollectionSchema =
|
|
4912
|
-
id:
|
|
4913
|
-
handle:
|
|
4914
|
-
title:
|
|
4915
|
-
description:
|
|
5025
|
+
var CollectionSchema = z40.object({
|
|
5026
|
+
id: z40.string(),
|
|
5027
|
+
handle: z40.string().default(""),
|
|
5028
|
+
title: z40.string(),
|
|
5029
|
+
description: z40.string().default(""),
|
|
4916
5030
|
image: ImageSchema.optional(),
|
|
4917
|
-
productCount:
|
|
5031
|
+
productCount: z40.number().int().nonnegative().optional()
|
|
4918
5032
|
});
|
|
4919
|
-
var CartLineSchema =
|
|
4920
|
-
id:
|
|
4921
|
-
merchandiseId:
|
|
4922
|
-
productId:
|
|
4923
|
-
title:
|
|
4924
|
-
variantTitle:
|
|
5033
|
+
var CartLineSchema = z40.object({
|
|
5034
|
+
id: z40.string(),
|
|
5035
|
+
merchandiseId: z40.string(),
|
|
5036
|
+
productId: z40.string(),
|
|
5037
|
+
title: z40.string(),
|
|
5038
|
+
variantTitle: z40.string().optional(),
|
|
4925
5039
|
/**
|
|
4926
5040
|
* The variant's option axes as structured pairs (e.g.
|
|
4927
5041
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -4930,10 +5044,10 @@ var CartLineSchema = z39.object({
|
|
|
4930
5044
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
4931
5045
|
* is normalized away at the adapter boundary).
|
|
4932
5046
|
*/
|
|
4933
|
-
selectedOptions:
|
|
4934
|
-
vendor:
|
|
4935
|
-
sku:
|
|
4936
|
-
quantity:
|
|
5047
|
+
selectedOptions: z40.array(SelectedOptionSchema).optional(),
|
|
5048
|
+
vendor: z40.string().optional(),
|
|
5049
|
+
sku: z40.string().optional(),
|
|
5050
|
+
quantity: z40.number().int().positive(),
|
|
4937
5051
|
unitPrice: MoneySchema,
|
|
4938
5052
|
totalPrice: MoneySchema,
|
|
4939
5053
|
image: ImageSchema.optional(),
|
|
@@ -4953,26 +5067,26 @@ var CartLineSchema = z39.object({
|
|
|
4953
5067
|
* client-minted id the backend rejects, line-tap navigation is
|
|
4954
5068
|
* suppressed, and the money never folds into a settled-looking total.
|
|
4955
5069
|
*/
|
|
4956
|
-
pending:
|
|
5070
|
+
pending: z40.boolean().optional()
|
|
4957
5071
|
});
|
|
4958
5072
|
function isPendingCartLine(line) {
|
|
4959
5073
|
return line.pending === true;
|
|
4960
5074
|
}
|
|
4961
|
-
var CartDiscountCodeSchema =
|
|
4962
|
-
code:
|
|
4963
|
-
applicable:
|
|
5075
|
+
var CartDiscountCodeSchema = z40.object({
|
|
5076
|
+
code: z40.string(),
|
|
5077
|
+
applicable: z40.boolean()
|
|
4964
5078
|
});
|
|
4965
|
-
var CartMessageSchema =
|
|
4966
|
-
kind:
|
|
5079
|
+
var CartMessageSchema = z40.object({
|
|
5080
|
+
kind: z40.enum(["error", "warning", "info"]),
|
|
4967
5081
|
/** Machine code for branching; opaque and backend-defined. */
|
|
4968
|
-
code:
|
|
5082
|
+
code: z40.string(),
|
|
4969
5083
|
/** Human-readable text, meant to be shown as-is. */
|
|
4970
|
-
content:
|
|
5084
|
+
content: z40.string()
|
|
4971
5085
|
});
|
|
4972
|
-
var CartSchema =
|
|
4973
|
-
id:
|
|
4974
|
-
lines:
|
|
4975
|
-
totalQuantity:
|
|
5086
|
+
var CartSchema = z40.object({
|
|
5087
|
+
id: z40.string(),
|
|
5088
|
+
lines: z40.array(CartLineSchema),
|
|
5089
|
+
totalQuantity: z40.number().int().nonnegative(),
|
|
4976
5090
|
subtotal: MoneySchema,
|
|
4977
5091
|
/**
|
|
4978
5092
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -4982,11 +5096,11 @@ var CartSchema = z39.object({
|
|
|
4982
5096
|
*/
|
|
4983
5097
|
total: MoneySchema.optional(),
|
|
4984
5098
|
/** Discount codes currently attached to the cart. */
|
|
4985
|
-
discountCodes:
|
|
5099
|
+
discountCodes: z40.array(CartDiscountCodeSchema).default([]),
|
|
4986
5100
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
4987
5101
|
* Empty when the backend said nothing or does not report them. */
|
|
4988
|
-
messages:
|
|
4989
|
-
checkoutUrl:
|
|
5102
|
+
messages: z40.array(CartMessageSchema).default([]),
|
|
5103
|
+
checkoutUrl: z40.string().optional(),
|
|
4990
5104
|
/**
|
|
4991
5105
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
4992
5106
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -4999,14 +5113,14 @@ var CartSchema = z39.object({
|
|
|
4999
5113
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5000
5114
|
* client's optimistic paint and its id is client-minted.
|
|
5001
5115
|
*/
|
|
5002
|
-
backOfficeRef:
|
|
5116
|
+
backOfficeRef: z40.string().optional(),
|
|
5003
5117
|
/**
|
|
5004
5118
|
* URL that recreates this cart on the merchant's own store website
|
|
5005
5119
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5006
5120
|
* there). Populated by platform adapters that support it; absent when
|
|
5007
5121
|
* the cart is empty or the URL cannot be built.
|
|
5008
5122
|
*/
|
|
5009
|
-
storeCartUrl:
|
|
5123
|
+
storeCartUrl: z40.string().optional(),
|
|
5010
5124
|
/**
|
|
5011
5125
|
* True while this cart exists only in the client's optimistic paint —
|
|
5012
5126
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5014,7 +5128,7 @@ var CartSchema = z39.object({
|
|
|
5014
5128
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5015
5129
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5016
5130
|
*/
|
|
5017
|
-
pending:
|
|
5131
|
+
pending: z40.boolean().optional()
|
|
5018
5132
|
});
|
|
5019
5133
|
function settledCart(cart) {
|
|
5020
5134
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5022,27 +5136,27 @@ function settledCart(cart) {
|
|
|
5022
5136
|
}
|
|
5023
5137
|
|
|
5024
5138
|
// ../ecommerce/src/review-schemas.ts
|
|
5025
|
-
import { z as
|
|
5139
|
+
import { z as z41 } from "zod";
|
|
5026
5140
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5027
|
-
var ProductReviewItemSchema =
|
|
5028
|
-
author:
|
|
5029
|
-
rating:
|
|
5141
|
+
var ProductReviewItemSchema = z41.object({
|
|
5142
|
+
author: z41.string(),
|
|
5143
|
+
rating: z41.number(),
|
|
5030
5144
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5031
|
-
title:
|
|
5032
|
-
content:
|
|
5033
|
-
date:
|
|
5034
|
-
verified:
|
|
5145
|
+
title: z41.string().optional(),
|
|
5146
|
+
content: z41.string(),
|
|
5147
|
+
date: z41.string(),
|
|
5148
|
+
verified: z41.boolean().optional(),
|
|
5035
5149
|
/**
|
|
5036
5150
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5037
5151
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5038
5152
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5039
5153
|
*/
|
|
5040
|
-
writtenFor:
|
|
5154
|
+
writtenFor: z41.string().optional()
|
|
5041
5155
|
});
|
|
5042
5156
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5043
5157
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5044
5158
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5045
|
-
highlight:
|
|
5159
|
+
highlight: z41.string().optional(),
|
|
5046
5160
|
/**
|
|
5047
5161
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5048
5162
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5057,29 +5171,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5057
5171
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5058
5172
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5059
5173
|
*/
|
|
5060
|
-
mark:
|
|
5174
|
+
mark: z41.string().optional()
|
|
5061
5175
|
});
|
|
5062
|
-
var ReviewAggregateSchema =
|
|
5063
|
-
value:
|
|
5064
|
-
count:
|
|
5176
|
+
var ReviewAggregateSchema = z41.object({
|
|
5177
|
+
value: z41.number(),
|
|
5178
|
+
count: z41.number()
|
|
5065
5179
|
});
|
|
5066
|
-
var ProductReviewDataSchema =
|
|
5067
|
-
id:
|
|
5180
|
+
var ProductReviewDataSchema = z41.object({
|
|
5181
|
+
id: z41.string(),
|
|
5068
5182
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5069
|
-
reviews:
|
|
5183
|
+
reviews: z41.array(ProductReviewItemSchema).default([]),
|
|
5070
5184
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5071
5185
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5072
|
-
distribution:
|
|
5186
|
+
distribution: z41.array(z41.number()).default([]),
|
|
5073
5187
|
/**
|
|
5074
5188
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5075
5189
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5076
5190
|
*/
|
|
5077
|
-
highlights:
|
|
5191
|
+
highlights: z41.array(ProductReviewHighlightSchema).default([]),
|
|
5078
5192
|
/**
|
|
5079
5193
|
* True when the review provider could not be read and nothing is indexed —
|
|
5080
5194
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5081
5195
|
*/
|
|
5082
|
-
unavailable:
|
|
5196
|
+
unavailable: z41.boolean().optional()
|
|
5083
5197
|
});
|
|
5084
5198
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5085
5199
|
|
|
@@ -5373,9 +5487,9 @@ function readPdpCompanions(config) {
|
|
|
5373
5487
|
}
|
|
5374
5488
|
|
|
5375
5489
|
// ../ecommerce/src/base-attributes.ts
|
|
5376
|
-
import { z as
|
|
5490
|
+
import { z as z42 } from "zod";
|
|
5377
5491
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
5378
|
-
var BaseAttributesRecordSchema =
|
|
5492
|
+
var BaseAttributesRecordSchema = z42.record(z42.string(), AttributeDefSchema);
|
|
5379
5493
|
function buildBaseAttributesConfig(attributes) {
|
|
5380
5494
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
5381
5495
|
}
|
|
@@ -5386,9 +5500,9 @@ function readBaseAttributesConfig(config) {
|
|
|
5386
5500
|
}
|
|
5387
5501
|
|
|
5388
5502
|
// ../ecommerce/src/bucket-labels.ts
|
|
5389
|
-
import { z as
|
|
5503
|
+
import { z as z43 } from "zod";
|
|
5390
5504
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
5391
|
-
var BucketLabelsRecordSchema =
|
|
5505
|
+
var BucketLabelsRecordSchema = z43.record(z43.string(), z43.string());
|
|
5392
5506
|
function buildBucketLabelsConfig(labels) {
|
|
5393
5507
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
5394
5508
|
}
|
|
@@ -6562,8 +6676,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
6562
6676
|
};
|
|
6563
6677
|
|
|
6564
6678
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
6565
|
-
import { z as
|
|
6566
|
-
var PresenceProfileSchema =
|
|
6679
|
+
import { z as z44 } from "zod";
|
|
6680
|
+
var PresenceProfileSchema = z44.object({
|
|
6567
6681
|
/**
|
|
6568
6682
|
* How much the agent SPEAKS in presence.
|
|
6569
6683
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -6573,14 +6687,14 @@ var PresenceProfileSchema = z43.object({
|
|
|
6573
6687
|
* - 'terse' one lead line per turn. The default — see below.
|
|
6574
6688
|
* - 'full' a lead line plus asides beside individual elements.
|
|
6575
6689
|
*/
|
|
6576
|
-
voice:
|
|
6690
|
+
voice: z44.enum(["off", "terse", "full"]),
|
|
6577
6691
|
/**
|
|
6578
6692
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
6579
6693
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
6580
6694
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
6581
6695
|
* without the tool having to lie about what it is.
|
|
6582
6696
|
*/
|
|
6583
|
-
sources:
|
|
6697
|
+
sources: z44.union([z44.array(z44.string()), z44.literal("all")]),
|
|
6584
6698
|
/**
|
|
6585
6699
|
* Which facts render.
|
|
6586
6700
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -6589,7 +6703,7 @@ var PresenceProfileSchema = z43.object({
|
|
|
6589
6703
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
6590
6704
|
* back is itself the product (intake, configuration).
|
|
6591
6705
|
*/
|
|
6592
|
-
facts:
|
|
6706
|
+
facts: z44.enum(["inferred-only", "all"])
|
|
6593
6707
|
});
|
|
6594
6708
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
6595
6709
|
voice: "terse",
|
|
@@ -6773,7 +6887,7 @@ function useAgentPresenceFresh(flowId = PRESENCE_FLOW) {
|
|
|
6773
6887
|
}
|
|
6774
6888
|
|
|
6775
6889
|
// src/widgets/presence/use-layout-entity-ids.ts
|
|
6776
|
-
import { useMemo as
|
|
6890
|
+
import { useMemo as useMemo4 } from "react";
|
|
6777
6891
|
|
|
6778
6892
|
// src/catalog/CatalogContext.tsx
|
|
6779
6893
|
import { createContext as createContext8, useContext as useContext8 } from "react";
|
|
@@ -6803,7 +6917,7 @@ function collectLayoutGids(layout, catalog) {
|
|
|
6803
6917
|
function useLayoutEntityIds() {
|
|
6804
6918
|
const layout = useLayout();
|
|
6805
6919
|
const catalog = useComponentCatalog();
|
|
6806
|
-
return
|
|
6920
|
+
return useMemo4(() => [...collectLayoutGids(layout, catalog)], [layout, catalog]);
|
|
6807
6921
|
}
|
|
6808
6922
|
|
|
6809
6923
|
// src/widgets/presence/use-presence.ts
|
|
@@ -8519,22 +8633,22 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
8519
8633
|
}
|
|
8520
8634
|
|
|
8521
8635
|
// src/catalog/define.ts
|
|
8522
|
-
import { z as
|
|
8636
|
+
import { z as z45 } from "zod";
|
|
8523
8637
|
function entity(resolverKey, opts) {
|
|
8524
|
-
return resolved(
|
|
8638
|
+
return resolved(z45.string(), resolverKey, opts);
|
|
8525
8639
|
}
|
|
8526
|
-
var text = prose(
|
|
8640
|
+
var text = prose(z45.string());
|
|
8527
8641
|
function plain() {
|
|
8528
|
-
return
|
|
8642
|
+
return z45.string();
|
|
8529
8643
|
}
|
|
8530
8644
|
function token(values) {
|
|
8531
|
-
return
|
|
8645
|
+
return z45.enum(values);
|
|
8532
8646
|
}
|
|
8533
8647
|
function catalogComponent(meta, render) {
|
|
8534
8648
|
const { props, requires, ...rest } = meta;
|
|
8535
8649
|
return {
|
|
8536
8650
|
...rest,
|
|
8537
|
-
propsSchema:
|
|
8651
|
+
propsSchema: z45.object(props),
|
|
8538
8652
|
...requires !== void 0 ? { requires } : {},
|
|
8539
8653
|
component: adaptComponent(render)
|
|
8540
8654
|
};
|
|
@@ -8760,7 +8874,7 @@ __export(presence_exports2, {
|
|
|
8760
8874
|
});
|
|
8761
8875
|
|
|
8762
8876
|
// src/widgets/presence/use-standing-signal.ts
|
|
8763
|
-
import { useMemo as
|
|
8877
|
+
import { useMemo as useMemo8 } from "react";
|
|
8764
8878
|
|
|
8765
8879
|
// src/widgets/presence/core-presence/standing-signal-store.ts
|
|
8766
8880
|
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
@@ -8844,7 +8958,7 @@ function useConsumeStandingSignal(type) {
|
|
|
8844
8958
|
const session = useFourtySession();
|
|
8845
8959
|
const scope2 = session.sessionId === null ? void 0 : session.sessionId;
|
|
8846
8960
|
useRegisterSignalHandlers(
|
|
8847
|
-
|
|
8961
|
+
useMemo8(
|
|
8848
8962
|
() => ({
|
|
8849
8963
|
[type]: (payload) => {
|
|
8850
8964
|
const id = typeof payload.id === "string" && payload.id.length > 0 ? payload.id : type;
|
|
@@ -8855,7 +8969,7 @@ function useConsumeStandingSignal(type) {
|
|
|
8855
8969
|
)
|
|
8856
8970
|
);
|
|
8857
8971
|
const standing = useStandingOfType(type);
|
|
8858
|
-
return
|
|
8972
|
+
return useMemo8(() => {
|
|
8859
8973
|
if (standing === null) return null;
|
|
8860
8974
|
const id = standing.id;
|
|
8861
8975
|
return {
|
|
@@ -9329,7 +9443,7 @@ function usePostHydrationTransforms() {
|
|
|
9329
9443
|
}
|
|
9330
9444
|
|
|
9331
9445
|
// src/projection/transform.ts
|
|
9332
|
-
import { useMemo as
|
|
9446
|
+
import { useMemo as useMemo10 } from "react";
|
|
9333
9447
|
|
|
9334
9448
|
// src/projection/preferences.ts
|
|
9335
9449
|
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
@@ -9457,7 +9571,7 @@ var projectionTransform = {
|
|
|
9457
9571
|
use: () => {
|
|
9458
9572
|
const preferences2 = useProjectionPreferences();
|
|
9459
9573
|
const facts = useFacts();
|
|
9460
|
-
return
|
|
9574
|
+
return useMemo10(() => {
|
|
9461
9575
|
if (Object.keys(preferences2).length === 0) return null;
|
|
9462
9576
|
return buildTransform(preferences2, facts);
|
|
9463
9577
|
}, [preferences2, facts]);
|
|
@@ -9719,14 +9833,14 @@ function useFormFactor() {
|
|
|
9719
9833
|
}
|
|
9720
9834
|
|
|
9721
9835
|
// src/utils/use-inline-completion.ts
|
|
9722
|
-
import { useCallback as useCallback15, useMemo as
|
|
9836
|
+
import { useCallback as useCallback15, useMemo as useMemo11, useState as useState8 } from "react";
|
|
9723
9837
|
function useInlineCompletion(opts) {
|
|
9724
9838
|
const { value, candidates } = opts;
|
|
9725
9839
|
const minChars = opts.minChars !== void 0 ? opts.minChars : 2;
|
|
9726
9840
|
const enabled = opts.enabled !== void 0 ? opts.enabled : true;
|
|
9727
9841
|
const [dismissedValue, setDismissedValue] = useState8(null);
|
|
9728
9842
|
const dismiss = useCallback15(() => setDismissedValue(value), [value]);
|
|
9729
|
-
return
|
|
9843
|
+
return useMemo11(() => {
|
|
9730
9844
|
if (!enabled || value.length < minChars || dismissedValue === value) {
|
|
9731
9845
|
return { completion: "", ghost: "", active: false, dismiss };
|
|
9732
9846
|
}
|
|
@@ -10570,18 +10684,18 @@ __export(ecommerce_exports, {
|
|
|
10570
10684
|
});
|
|
10571
10685
|
|
|
10572
10686
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
10573
|
-
import { z as
|
|
10687
|
+
import { z as z46 } from "zod";
|
|
10574
10688
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
10575
10689
|
"commerce.products_surfaced",
|
|
10576
10690
|
"client",
|
|
10577
|
-
|
|
10691
|
+
z46.object({
|
|
10578
10692
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
10579
10693
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
10580
10694
|
* surfacing up against the prompt that asked for it. */
|
|
10581
|
-
turnId:
|
|
10695
|
+
turnId: z46.string().min(1).max(128),
|
|
10582
10696
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
10583
10697
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
10584
|
-
productCount:
|
|
10698
|
+
productCount: z46.number().int().nonnegative()
|
|
10585
10699
|
}).strict()
|
|
10586
10700
|
);
|
|
10587
10701
|
|
|
@@ -10603,14 +10717,14 @@ function isFunnelStep(value) {
|
|
|
10603
10717
|
}
|
|
10604
10718
|
|
|
10605
10719
|
// src/verticals/commerce/product/use-product-grid-filter.ts
|
|
10606
|
-
import { useCallback as useCallback17, useMemo as
|
|
10720
|
+
import { useCallback as useCallback17, useMemo as useMemo13, useState as useState11 } from "react";
|
|
10607
10721
|
function useProductGridFilter(chips) {
|
|
10608
|
-
const labelKey =
|
|
10722
|
+
const labelKey = useMemo13(() => chips.map((c) => c.label).join("|"), [chips]);
|
|
10609
10723
|
const first = chips[0];
|
|
10610
10724
|
const [activeLabel, setActiveLabel] = useState11(
|
|
10611
10725
|
first !== void 0 ? first.label : null
|
|
10612
10726
|
);
|
|
10613
|
-
const activeFromKey =
|
|
10727
|
+
const activeFromKey = useMemo13(() => {
|
|
10614
10728
|
void labelKey;
|
|
10615
10729
|
if (first === void 0) return null;
|
|
10616
10730
|
const found = chips.find((c) => c.label === activeLabel);
|
|
@@ -10623,7 +10737,7 @@ function useProductGridFilter(chips) {
|
|
|
10623
10737
|
}
|
|
10624
10738
|
|
|
10625
10739
|
// src/verticals/commerce/product/use-product-detail.ts
|
|
10626
|
-
import { useCallback as useCallback19, useMemo as
|
|
10740
|
+
import { useCallback as useCallback19, useMemo as useMemo14, useRef as useRef13, useState as useState14 } from "react";
|
|
10627
10741
|
|
|
10628
10742
|
// src/verticals/commerce/checkout/use-buy-now.ts
|
|
10629
10743
|
import { useCallback as useCallback18, useEffect as useEffect16, useState as useState12 } from "react";
|
|
@@ -10918,15 +11032,15 @@ function useProductDetail(product) {
|
|
|
10918
11032
|
}
|
|
10919
11033
|
const { selectedVariants, setSelectedVariants, markTouched } = useSelectedVariantsState(product, facts);
|
|
10920
11034
|
const desc = useExpandable(false);
|
|
10921
|
-
const variantGroups =
|
|
11035
|
+
const variantGroups = useMemo14(
|
|
10922
11036
|
() => deriveVariantGroups(product),
|
|
10923
11037
|
[product]
|
|
10924
11038
|
);
|
|
10925
|
-
const allSelected =
|
|
11039
|
+
const allSelected = useMemo14(
|
|
10926
11040
|
() => variantGroups.every((g) => selectedVariants[g.name] !== void 0),
|
|
10927
11041
|
[variantGroups, selectedVariants]
|
|
10928
11042
|
);
|
|
10929
|
-
const missingGroup =
|
|
11043
|
+
const missingGroup = useMemo14(
|
|
10930
11044
|
() => variantGroups.find((g) => selectedVariants[g.name] === void 0),
|
|
10931
11045
|
[variantGroups, selectedVariants]
|
|
10932
11046
|
);
|
|
@@ -11235,7 +11349,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11235
11349
|
}
|
|
11236
11350
|
|
|
11237
11351
|
// src/verticals/commerce/cart/cart-action-failures.ts
|
|
11238
|
-
import { useMemo as
|
|
11352
|
+
import { useMemo as useMemo15, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
11239
11353
|
var FAILURE_TTL_MS = 2 * 6e4;
|
|
11240
11354
|
var FAILURE_CAP = 5;
|
|
11241
11355
|
var failures = [];
|
|
@@ -11287,7 +11401,7 @@ function useCartActionFailures() {
|
|
|
11287
11401
|
function useCartActionFailuresFor(productIdsInCart) {
|
|
11288
11402
|
const all = useCartActionFailures();
|
|
11289
11403
|
const key = productIdsInCart.join("\0");
|
|
11290
|
-
return
|
|
11404
|
+
return useMemo15(() => {
|
|
11291
11405
|
const present = new Set(key.length === 0 ? [] : key.split("\0"));
|
|
11292
11406
|
return all.filter((f) => f.productId !== void 0 && !present.has(f.productId));
|
|
11293
11407
|
}, [all, key]);
|
|
@@ -12081,7 +12195,7 @@ function useContentActions() {
|
|
|
12081
12195
|
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
12082
12196
|
|
|
12083
12197
|
// package.json
|
|
12084
|
-
var version = "0.5.
|
|
12198
|
+
var version = "0.5.2";
|
|
12085
12199
|
|
|
12086
12200
|
// src/host/host-modules.ts
|
|
12087
12201
|
import * as react from "react";
|
|
@@ -12168,12 +12282,16 @@ function Spacefront(props) {
|
|
|
12168
12282
|
}
|
|
12169
12283
|
|
|
12170
12284
|
// src/npm.ts
|
|
12171
|
-
import { z as
|
|
12285
|
+
import { z as z48 } from "zod";
|
|
12172
12286
|
export {
|
|
12173
12287
|
ACQUISITION_KIND_LABELS,
|
|
12174
12288
|
ACTIVE_PANEL_ATTR,
|
|
12175
12289
|
ACTIVE_PANEL_SELECTOR,
|
|
12176
12290
|
AGENT_ASK_SIGNAL,
|
|
12291
|
+
AGENT_DIRECTIVE_KINDS,
|
|
12292
|
+
AGENT_DIRECTIVE_SEVERITIES,
|
|
12293
|
+
AGENT_DIRECTIVE_SOURCES,
|
|
12294
|
+
AGENT_DIRECTIVE_STATUSES,
|
|
12177
12295
|
ALLOWED_ATTACHMENT_TYPES,
|
|
12178
12296
|
ANALYTICS_CONSENTS,
|
|
12179
12297
|
ANALYTICS_MAX_QUEUED,
|
|
@@ -12181,6 +12299,7 @@ export {
|
|
|
12181
12299
|
ARRIVAL_MAX_VALUE_CHARS,
|
|
12182
12300
|
ARRIVAL_PARAMS,
|
|
12183
12301
|
ATTACHMENT_ACCEPT,
|
|
12302
|
+
AgentDirectiveSchema,
|
|
12184
12303
|
AgentOutputSchema,
|
|
12185
12304
|
AgentSessionSummarySchema,
|
|
12186
12305
|
AgentSignalSchema,
|
|
@@ -12309,6 +12428,7 @@ export {
|
|
|
12309
12428
|
LlmSessionsDailySchema,
|
|
12310
12429
|
LlmUsageBySessionSchema,
|
|
12311
12430
|
LlmUsageDailySchema,
|
|
12431
|
+
MAX_ACTIVE_AGENT_DIRECTIVES,
|
|
12312
12432
|
MAX_ATTACHMENT_BYTES,
|
|
12313
12433
|
MAX_VISITOR_PROMPT_CHARS,
|
|
12314
12434
|
MIN_WIRE_PROTOCOL_VERSION,
|
|
@@ -12352,6 +12472,7 @@ export {
|
|
|
12352
12472
|
RecordVerdictInputSchema,
|
|
12353
12473
|
RecordableVerdictSchema,
|
|
12354
12474
|
RegistryProvider,
|
|
12475
|
+
ReorderAgentDirectivesInputSchema,
|
|
12355
12476
|
ReviewAggregateSchema,
|
|
12356
12477
|
ReviewSchema,
|
|
12357
12478
|
SCANNING_FORM,
|
|
@@ -12390,6 +12511,8 @@ export {
|
|
|
12390
12511
|
ShellRootContext,
|
|
12391
12512
|
ShimmerSweep,
|
|
12392
12513
|
SiblingProductSchema,
|
|
12514
|
+
SpaceAgentDirectiveListItemSchema,
|
|
12515
|
+
SpaceAgentDirectiveSchema,
|
|
12393
12516
|
SpaceBrandMarkSchema,
|
|
12394
12517
|
SpaceBugSchema,
|
|
12395
12518
|
Spacefront,
|
|
@@ -12412,8 +12535,10 @@ export {
|
|
|
12412
12535
|
TransitionProvider,
|
|
12413
12536
|
TurnAskPlacementProvider,
|
|
12414
12537
|
TurnAskSchema,
|
|
12538
|
+
TurnScopeProvider,
|
|
12415
12539
|
UIElementSchema,
|
|
12416
12540
|
UnsupportedSchemaError,
|
|
12541
|
+
UpdateAgentDirectiveInputSchema,
|
|
12417
12542
|
UpdateCommentInputSchema,
|
|
12418
12543
|
VARIANT_SELECTED_OBSERVATION,
|
|
12419
12544
|
VIEW_EXHAUSTED_SIGNAL,
|
|
@@ -12832,5 +12957,5 @@ export {
|
|
|
12832
12957
|
wipeProfile,
|
|
12833
12958
|
withCartActorOrigin,
|
|
12834
12959
|
withInteractionTracking,
|
|
12835
|
-
|
|
12960
|
+
z48 as z
|
|
12836
12961
|
};
|