@40rty/ams-sdk 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/index.js +639 -479
  2. package/dist/types/ecommerce/src/attribute-buckets.d.ts +2 -2
  3. package/dist/types/ecommerce/src/base-attributes.d.ts +3 -3
  4. package/dist/types/ecommerce/src/commerce-schemas.d.ts +1 -1
  5. package/dist/types/sdk/src/analytics/index.d.ts +1 -1
  6. package/dist/types/sdk/src/analytics/outbox.d.ts +2 -0
  7. package/dist/types/sdk/src/analytics/scope-context.d.ts +6 -0
  8. package/dist/types/sdk/src/analytics/scope.d.ts +7 -0
  9. package/dist/types/sdk/src/host/host-modules.d.ts +238 -36
  10. package/dist/types/sdk/src/session/turn-attributed-session.d.ts +4 -0
  11. package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +3 -0
  12. package/dist/types/sdk/src/widgets/presence/core-presence/fact-shape.d.ts +1 -1
  13. package/dist/types/sdk/src/widgets/presence/core-presence/standing-signal-store.d.ts +1 -1
  14. package/dist/types/spacestation/src/analytics/envelope.d.ts +24 -0
  15. package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +1 -1
  16. package/dist/types/spacestation/src/catalog/element-filled.d.ts +2 -2
  17. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +10 -0
  18. package/dist/types/spacestation/src/commerce/cart-add-signal.d.ts +10 -0
  19. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/option-values.d.ts +1 -1
  20. package/dist/types/spacestation/src/index.d.ts +2 -0
  21. package/dist/types/spacestation/src/layout/layout.d.ts +3 -3
  22. package/dist/types/spacestation/src/space/agent-directive.d.ts +239 -0
  23. package/dist/types/spacestation/src/space/session-queue.d.ts +24 -24
  24. package/dist/types/spacestation/src/space/space-config.d.ts +1 -1
  25. package/dist/types/spacestation/src/space/trace.d.ts +12 -12
  26. package/dist/types/spacestation/src/space/workspace-catalog.d.ts +4 -4
  27. package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +8 -0
  28. package/dist/types/spacestation/src/trace/trace-envelopes.d.ts +1 -1
  29. package/dist/types/spacestation/src/trace/trace-events.d.ts +1 -1
  30. 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,
@@ -651,6 +662,7 @@ __export(src_exports3, {
651
662
  useTurnAsk: () => useTurnAsk,
652
663
  useTurnAskPlacement: () => useTurnAskPlacement,
653
664
  useTurnAskReply: () => useTurnAskReply,
665
+ useTurnScope: () => useTurnScope,
654
666
  useUndismissedFacts: () => useUndismissedFacts,
655
667
  useVariantSelections: () => useVariantSelections,
656
668
  useViewportWindow: () => useViewportWindow,
@@ -680,6 +692,7 @@ __export(analytics_exports2, {
680
692
  CONSENT_DISPOSITION: () => CONSENT_DISPOSITION,
681
693
  DROP_REASONS: () => DROP_REASONS,
682
694
  SURFACE_DISPOSITION: () => SURFACE_DISPOSITION,
695
+ TurnScopeProvider: () => TurnScopeProvider,
683
696
  consentDisposition: () => consentDisposition,
684
697
  createAnalyticsScope: () => createAnalyticsScope,
685
698
  defineEventKind: () => defineEventKind,
@@ -687,7 +700,8 @@ __export(analytics_exports2, {
687
700
  surfaceEmits: () => surfaceEmits,
688
701
  surfaceSuppressionReason: () => surfaceSuppressionReason,
689
702
  useAnalyticsSink: () => useAnalyticsSink,
690
- useOptionalAnalyticsSink: () => useOptionalAnalyticsSink
703
+ useOptionalAnalyticsSink: () => useOptionalAnalyticsSink,
704
+ useTurnScope: () => useTurnScope
691
705
  });
692
706
 
693
707
  // ../spacestation/src/analytics/index.ts
@@ -822,7 +836,16 @@ var AnalyticsWireEventSchema = z3.object({
822
836
  */
823
837
  sessionId: z3.string().min(1).max(128),
824
838
  kind: z3.string().min(1).max(128),
825
- payload: z3.record(z3.unknown())
839
+ payload: z3.record(z3.unknown()),
840
+ /**
841
+ * The agent turn whose canvas the event came from — stamped by the scope
842
+ * from the element the emit ran inside, never by the emit site; `null` when
843
+ * it ran outside any turn (the cart drawer, a root bridge). OPTIONAL because
844
+ * a bundle older than this field omits it, and the envelope's strip posture
845
+ * (header) is what keeps that bundle's batch alive. Lands in the typed
846
+ * `client_events.turn_id` column — the join to `agent_runs.turn_id`.
847
+ */
848
+ turnId: z3.string().min(1).max(128).nullable().optional()
826
849
  });
827
850
  var AnalyticsBatchSchema = z3.object({
828
851
  /** One mount's whole life. Lets the server see a mount's batches as one
@@ -961,7 +984,8 @@ var Outbox = class {
961
984
  occurredAt: event.occurredAt,
962
985
  kind: event.kind,
963
986
  payload: event.payload,
964
- sessionId: event.sessionId
987
+ sessionId: event.sessionId,
988
+ turnId: event.turnId === void 0 ? null : event.turnId
965
989
  }));
966
990
  this.rows.unshift(...restored);
967
991
  if (this.rows.length <= this.maxQueued) return;
@@ -989,7 +1013,8 @@ var Outbox = class {
989
1013
  occurredAt: row.occurredAt,
990
1014
  kind: row.kind,
991
1015
  payload: row.payload,
992
- sessionId
1016
+ sessionId,
1017
+ turnId: row.turnId
993
1018
  };
994
1019
  stamped += 1;
995
1020
  }
@@ -1010,7 +1035,8 @@ var Outbox = class {
1010
1035
  occurredAt: row.occurredAt,
1011
1036
  sessionId: row.sessionId,
1012
1037
  kind: row.kind,
1013
- payload: row.payload
1038
+ payload: row.payload,
1039
+ turnId: row.turnId
1014
1040
  });
1015
1041
  }
1016
1042
  this.rows.length = 0;
@@ -1077,40 +1103,54 @@ function createEmittingScope(foundation) {
1077
1103
  events
1078
1104
  };
1079
1105
  }
1106
+ function record2(turnId, kindName, payload) {
1107
+ try {
1108
+ if (closed) {
1109
+ ledger.record("scope-closed", 1, "an event arrived while the scope was closed");
1110
+ return;
1111
+ }
1112
+ const disposition = consentDisposition(consent);
1113
+ if (disposition.mode === "refuse") {
1114
+ ledger.record("consent-withheld", 1, disposition.because);
1115
+ return;
1116
+ }
1117
+ if (!isWirePayload(payload)) {
1118
+ throw new Error(`payload for "${kindName}" is not an object`);
1119
+ }
1120
+ const row = {
1121
+ eventId: config.newEventId(),
1122
+ // Stamped at EMIT, never at flush: this row may sit here for the
1123
+ // session boot's whole ~94s retry budget.
1124
+ occurredAt: config.now(),
1125
+ kind: kindName,
1126
+ payload,
1127
+ sessionId,
1128
+ turnId
1129
+ };
1130
+ if (disposition.mode === "hold") consentHold.append(row);
1131
+ else outbox.append(row);
1132
+ } catch (err) {
1133
+ ledger.record("emit-threw", 1, err instanceof Error ? err.message : String(err));
1134
+ }
1135
+ }
1136
+ function sinkForTurn(turnId) {
1137
+ return {
1138
+ emit(kind, payload, ...guard) {
1139
+ void guard;
1140
+ record2(turnId, kind.name, payload);
1141
+ },
1142
+ forTurn: sinkForTurn
1143
+ };
1144
+ }
1080
1145
  return {
1081
1146
  scopeId,
1082
1147
  surface: config.surface,
1083
1148
  spaceSlug: config.spaceSlug,
1084
1149
  emit(kind, payload, ...guard) {
1085
1150
  void guard;
1086
- try {
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
- }
1151
+ record2(null, kind.name, payload);
1113
1152
  },
1153
+ forTurn: sinkForTurn,
1114
1154
  bindSession(nextSessionId) {
1115
1155
  if (nextSessionId.length === 0) {
1116
1156
  throw new Error("[fourty/analytics] bindSession requires a non-empty session id");
@@ -1227,6 +1267,11 @@ function createInertScope(foundation, because) {
1227
1267
  void guard;
1228
1268
  ledger.record("surface-suppressed", 1, because);
1229
1269
  },
1270
+ /** Suppressed either way — a turn changes nothing about a surface that
1271
+ * records nothing. */
1272
+ forTurn() {
1273
+ return this;
1274
+ },
1230
1275
  /** Nothing is held, so there is nothing to attribute. The mount calls this
1231
1276
  * on every surface; making it a no-op here is what keeps the mount free of
1232
1277
  * a surface branch. */
@@ -1344,11 +1389,20 @@ function createAnalyticsScope(config) {
1344
1389
  }
1345
1390
 
1346
1391
  // src/analytics/scope-context.tsx
1347
- import { createContext, useContext } from "react";
1392
+ import { createContext, useContext, useMemo } from "react";
1348
1393
  var AnalyticsSinkContext = createContext(null);
1349
1394
  var AnalyticsSinkProvider = AnalyticsSinkContext.Provider;
1395
+ var TurnScopeContext = createContext(null);
1396
+ var TurnScopeProvider = TurnScopeContext.Provider;
1397
+ function useTurnScope() {
1398
+ return useContext(TurnScopeContext);
1399
+ }
1400
+ function useTurnAttributed(sink) {
1401
+ const turnId = useContext(TurnScopeContext);
1402
+ return useMemo(() => sink === null || turnId === null ? sink : sink.forTurn(turnId), [sink, turnId]);
1403
+ }
1350
1404
  function useAnalyticsSink() {
1351
- const sink = useContext(AnalyticsSinkContext);
1405
+ const sink = useTurnAttributed(useContext(AnalyticsSinkContext));
1352
1406
  if (sink === null) {
1353
1407
  throw new Error(
1354
1408
  "useAnalyticsSink must be used within <AnalyticsScopeMount> (inside <FourtyProvider>)"
@@ -1358,7 +1412,7 @@ function useAnalyticsSink() {
1358
1412
  }
1359
1413
  var warnedMissingSink = false;
1360
1414
  function useOptionalAnalyticsSink() {
1361
- const sink = useContext(AnalyticsSinkContext);
1415
+ const sink = useTurnAttributed(useContext(AnalyticsSinkContext));
1362
1416
  if (sink === null && !warnedMissingSink && typeof window !== "undefined") {
1363
1417
  warnedMissingSink = true;
1364
1418
  console.warn(
@@ -1383,34 +1437,21 @@ __export(session_exports, {
1383
1437
 
1384
1438
  // src/session/FourtySessionContext.tsx
1385
1439
  import { createContext as createContext2, useContext as useContext2, useSyncExternalStore } from "react";
1386
- var FourtySessionContext = createContext2(null);
1387
- function useFourtySession() {
1388
- const ctx = useContext2(FourtySessionContext);
1389
- if (!ctx) throw new Error("useFourtySession must be used within a <FourtyProvider>");
1390
- return ctx;
1391
- }
1392
- function useOptionalFourtySession() {
1393
- return useContext2(FourtySessionContext);
1394
- }
1395
- function useComposerDraft() {
1396
- const { composerDraftStore, setComposerDraft } = useFourtySession();
1397
- const value = useSyncExternalStore(
1398
- composerDraftStore.subscribe,
1399
- composerDraftStore.get,
1400
- composerDraftStore.get
1401
- );
1402
- return [value, setComposerDraft];
1403
- }
1404
1440
 
1405
- // src/session/use-action.ts
1406
- import { useCallback } from "react";
1441
+ // src/session/turn-attributed-session.ts
1442
+ import { useMemo as useMemo2 } from "react";
1407
1443
 
1408
1444
  // ../spacestation/src/index.ts
1409
1445
  var src_exports = {};
1410
1446
  __export(src_exports, {
1447
+ AGENT_DIRECTIVE_KINDS: () => AGENT_DIRECTIVE_KINDS,
1448
+ AGENT_DIRECTIVE_SEVERITIES: () => AGENT_DIRECTIVE_SEVERITIES,
1449
+ AGENT_DIRECTIVE_SOURCES: () => AGENT_DIRECTIVE_SOURCES,
1450
+ AGENT_DIRECTIVE_STATUSES: () => AGENT_DIRECTIVE_STATUSES,
1411
1451
  ALLOWED_ATTACHMENT_TYPES: () => ALLOWED_ATTACHMENT_TYPES,
1412
1452
  ARRIVAL_MAX_VALUE_CHARS: () => ARRIVAL_MAX_VALUE_CHARS,
1413
1453
  ARRIVAL_PARAMS: () => ARRIVAL_PARAMS,
1454
+ AgentDirectiveSchema: () => AgentDirectiveSchema,
1414
1455
  AgentOutputSchema: () => AgentOutputSchema,
1415
1456
  AgentSessionSummarySchema: () => AgentSessionSummarySchema,
1416
1457
  AgentSignalSchema: () => AgentSignalSchema,
@@ -1476,6 +1517,7 @@ __export(src_exports, {
1476
1517
  LlmSessionsDailySchema: () => LlmSessionsDailySchema,
1477
1518
  LlmUsageBySessionSchema: () => LlmUsageBySessionSchema,
1478
1519
  LlmUsageDailySchema: () => LlmUsageDailySchema,
1520
+ MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
1479
1521
  MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
1480
1522
  MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
1481
1523
  MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
@@ -1501,6 +1543,7 @@ __export(src_exports, {
1501
1543
  RESERVED_ID_SET: () => RESERVED_ID_SET,
1502
1544
  RecordVerdictInputSchema: () => RecordVerdictInputSchema,
1503
1545
  RecordableVerdictSchema: () => RecordableVerdictSchema,
1546
+ ReorderAgentDirectivesInputSchema: () => ReorderAgentDirectivesInputSchema,
1504
1547
  SDK_SHIMS: () => SDK_SHIMS,
1505
1548
  SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
1506
1549
  SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
@@ -1529,6 +1572,8 @@ __export(src_exports, {
1529
1572
  SessionVerdictSchema: () => SessionVerdictSchema,
1530
1573
  ShellConfigSchema: () => ShellConfigSchema,
1531
1574
  ShellMenuItemSchema: () => ShellMenuItemSchema,
1575
+ SpaceAgentDirectiveListItemSchema: () => SpaceAgentDirectiveListItemSchema,
1576
+ SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
1532
1577
  SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
1533
1578
  SpaceBugSchema: () => SpaceBugSchema,
1534
1579
  SpecSchema: () => SpecSchema,
@@ -1546,6 +1591,7 @@ __export(src_exports, {
1546
1591
  TurnAskSchema: () => TurnAskSchema,
1547
1592
  UIElementSchema: () => UIElementSchema,
1548
1593
  UnsupportedSchemaError: () => UnsupportedSchemaError,
1594
+ UpdateAgentDirectiveInputSchema: () => UpdateAgentDirectiveInputSchema,
1549
1595
  UpdateCommentInputSchema: () => UpdateCommentInputSchema,
1550
1596
  VARIANT_SELECTED_OBSERVATION: () => VARIANT_SELECTED_OBSERVATION,
1551
1597
  VIEW_EXHAUSTED_SIGNAL: () => VIEW_EXHAUSTED_SIGNAL,
@@ -2156,6 +2202,14 @@ var CartAddSignalPayloadSchema = z13.object({
2156
2202
  quantity: z13.number().optional(),
2157
2203
  selections: z13.record(z13.string()).optional(),
2158
2204
  optimisticLine: z13.unknown().optional(),
2205
+ /**
2206
+ * The agent turn whose canvas element the add came from — stamped by the sdk
2207
+ * session hooks for a producer inside a turn (`turn-attributed-session.ts`),
2208
+ * absent for one outside any (the agent's own add, the header cart, WebMCP).
2209
+ * Carried for the same reason as `origin`: the handler that emits the outcome
2210
+ * sees only this payload.
2211
+ */
2212
+ turnId: z13.string().min(1).optional(),
2159
2213
  /**
2160
2214
  * Whether a LANDED add announces itself by opening the cart drawer on the
2161
2215
  * changed line. Absent means yes, which is every existing producer's
@@ -2798,6 +2852,8 @@ function isElementUnfilled(element, catalog, aliases, options) {
2798
2852
  const props = element.props;
2799
2853
  for (const { path, meta } of getResolvedPaths(entry.propsSchema)) {
2800
2854
  if (options?.requireMaterialized !== true && derivedSourceFilled(meta, props)) continue;
2855
+ const top = path[0];
2856
+ if (typeof top === "string" && isOptionalTopLevelProp(entry.propsSchema, top)) continue;
2801
2857
  const expansions = Array.from(expandPath(props, path));
2802
2858
  if (expansions.length === 0) return true;
2803
2859
  for (const { value } of expansions) {
@@ -3461,6 +3517,14 @@ var PackageReleaseSchema = z27.object({
3461
3517
  * markdown the agent reads, gated on the capabilities it names (`requires`).
3462
3518
  */
3463
3519
  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(),
3520
+ /**
3521
+ * The brand's SPACE prompt — its `prompts/space.md`, verbatim: sections split
3522
+ * by `<!-- section:<id> -->` markers, the same format as the platform's
3523
+ * `prompts/spaces/<slug>.md`, which it replaces for any space bound to this
3524
+ * package. How the brand speaks, what it sells and what it never claims ship
3525
+ * with the brand, and a release changes them with no platform deploy.
3526
+ */
3527
+ spacePrompt: z27.string().min(1).max(2e5).optional(),
3464
3528
  /**
3465
3529
  * Opaque per-vertical extension data (`BrandDefinition.config`): the
3466
3530
  * platform stays vertical-agnostic and the vertical's own code reads its keys.
@@ -3817,6 +3881,51 @@ function scopeOfAttributeKey(config, key) {
3817
3881
  return match;
3818
3882
  }
3819
3883
 
3884
+ // ../spacestation/src/space/agent-directive.ts
3885
+ import { z as z36 } from "zod";
3886
+ var MAX_ACTIVE_AGENT_DIRECTIVES = 12;
3887
+ var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
3888
+ var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
3889
+ var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
3890
+ var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
3891
+ var AgentDirectiveSchema = z36.object({
3892
+ name: z36.string().trim().min(1).max(80),
3893
+ kind: z36.enum(AGENT_DIRECTIVE_KINDS),
3894
+ severity: z36.enum(AGENT_DIRECTIVE_SEVERITIES),
3895
+ /** No bare URL: a URL is a hallucination surface, and a handle is not a
3896
+ * product name. */
3897
+ text: z36.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
3898
+ }).strict();
3899
+ var SpaceAgentDirectiveSchema = z36.object({
3900
+ id: z36.string(),
3901
+ position: z36.number().int(),
3902
+ name: z36.string(),
3903
+ kind: z36.enum(AGENT_DIRECTIVE_KINDS),
3904
+ severity: z36.enum(AGENT_DIRECTIVE_SEVERITIES),
3905
+ text: z36.string(),
3906
+ source: z36.enum(AGENT_DIRECTIVE_SOURCES),
3907
+ status: z36.enum(AGENT_DIRECTIVE_STATUSES),
3908
+ /** Who wrote it; null for a lesson the system proposed. */
3909
+ createdBy: z36.string().nullable(),
3910
+ /** Why a mined lesson was proposed; null for a directive a person wrote. */
3911
+ evidence: z36.record(z36.unknown()).nullable(),
3912
+ decidedBy: z36.string().nullable(),
3913
+ decidedAt: z36.string().nullable(),
3914
+ createdAt: z36.string()
3915
+ });
3916
+ var OutcomeTallySchema = z36.object({ turns: z36.number().int(), acted: z36.number().int() });
3917
+ var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
3918
+ impact: z36.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
3919
+ });
3920
+ var UpdateAgentDirectiveInputSchema = z36.object({
3921
+ name: AgentDirectiveSchema.shape.name.optional(),
3922
+ kind: AgentDirectiveSchema.shape.kind.optional(),
3923
+ severity: AgentDirectiveSchema.shape.severity.optional(),
3924
+ text: AgentDirectiveSchema.shape.text.optional(),
3925
+ status: z36.enum(AGENT_DIRECTIVE_STATUSES).optional()
3926
+ }).strict();
3927
+ var ReorderAgentDirectivesInputSchema = z36.object({ ids: z36.array(z36.string()).min(1) }).strict();
3928
+
3820
3929
  // ../spacestation/src/space/workspace-catalog.ts
3821
3930
  var COMPONENT_SOURCE = {
3822
3931
  ui: "@fourty/ui"
@@ -3879,30 +3988,30 @@ function hostingAllows(hosting, surface) {
3879
3988
  }
3880
3989
 
3881
3990
  // ../spacestation/src/space/trace.ts
3882
- import { z as z36 } from "zod";
3883
- var RunTokenUsageSchema = z36.object({
3884
- input_tokens: z36.number().optional(),
3885
- output_tokens: z36.number().optional(),
3886
- cache_read_tokens: z36.number().optional()
3991
+ import { z as z37 } from "zod";
3992
+ var RunTokenUsageSchema = z37.object({
3993
+ input_tokens: z37.number().optional(),
3994
+ output_tokens: z37.number().optional(),
3995
+ cache_read_tokens: z37.number().optional()
3887
3996
  });
3888
- var TraceRecordSchema = z36.object({
3889
- id: z36.string().uuid(),
3890
- spaceId: z36.string().uuid().nullable(),
3891
- sessionId: z36.string(),
3997
+ var TraceRecordSchema = z37.object({
3998
+ id: z37.string().uuid(),
3999
+ spaceId: z37.string().uuid().nullable(),
4000
+ sessionId: z37.string(),
3892
4001
  /** OTP-verified visitor email the session was unlocked with, or `null`
3893
4002
  * for an unlocked space / anonymous unlock. */
3894
- visitorEmail: z36.string().nullable(),
3895
- userPrompt: z36.string(),
3896
- branch: z36.string().nullable(),
3897
- responseText: z36.string().nullable(),
3898
- layout: z36.unknown().nullable(),
3899
- phaseTimings: z36.record(z36.number()).nullable(),
3900
- tokensByModel: z36.record(RunTokenUsageSchema).nullable(),
3901
- toolCalls: z36.array(z36.unknown()).nullable(),
3902
- diagnostics: z36.array(z36.unknown()).nullable(),
3903
- latencyFirstText: z36.number().int().nullable(),
3904
- latencyFirstPatch: z36.number().int().nullable(),
3905
- latencyTotal: z36.number().int().nullable(),
4003
+ visitorEmail: z37.string().nullable(),
4004
+ userPrompt: z37.string(),
4005
+ branch: z37.string().nullable(),
4006
+ responseText: z37.string().nullable(),
4007
+ layout: z37.unknown().nullable(),
4008
+ phaseTimings: z37.record(z37.number()).nullable(),
4009
+ tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
4010
+ toolCalls: z37.array(z37.unknown()).nullable(),
4011
+ diagnostics: z37.array(z37.unknown()).nullable(),
4012
+ latencyFirstText: z37.number().int().nullable(),
4013
+ latencyFirstPatch: z37.number().int().nullable(),
4014
+ latencyTotal: z37.number().int().nullable(),
3906
4015
  /**
3907
4016
  * The CLIENT's turn id for this run, or `null`.
3908
4017
  *
@@ -3918,29 +4027,29 @@ var TraceRecordSchema = z36.object({
3918
4027
  * a turn whose ack the client never saw — none of which is evidence that a
3919
4028
  * visitor asked something and got nothing.
3920
4029
  */
3921
- turnId: z36.string().nullable(),
4030
+ turnId: z37.string().nullable(),
3922
4031
  /** Serialized `TraceTracker.exportState()` payload (parsed object) —
3923
4032
  * lets the inspector rehydrate this run verbatim after a reload. */
3924
- trackerState: z36.unknown().nullable(),
3925
- createdAt: z36.string()
4033
+ trackerState: z37.unknown().nullable(),
4034
+ createdAt: z37.string()
3926
4035
  });
3927
- var MillisecondsSchema = z36.number().nullable().transform((v) => v === null ? null : Math.round(v));
3928
- var CreateTraceInputSchema = z36.object({
3929
- spaceId: z36.string().uuid().nullable(),
3930
- sessionId: z36.string(),
3931
- visitorEmail: z36.string().nullable(),
3932
- userPrompt: z36.string(),
3933
- branch: z36.string().nullable(),
3934
- responseText: z36.string().nullable(),
3935
- layout: z36.unknown().nullable(),
3936
- phaseTimings: z36.record(z36.number()).nullable(),
3937
- tokensByModel: z36.record(RunTokenUsageSchema).nullable(),
3938
- toolCalls: z36.array(z36.unknown()).nullable(),
3939
- diagnostics: z36.array(z36.unknown()).nullable(),
4036
+ var MillisecondsSchema = z37.number().nullable().transform((v) => v === null ? null : Math.round(v));
4037
+ var CreateTraceInputSchema = z37.object({
4038
+ spaceId: z37.string().uuid().nullable(),
4039
+ sessionId: z37.string(),
4040
+ visitorEmail: z37.string().nullable(),
4041
+ userPrompt: z37.string(),
4042
+ branch: z37.string().nullable(),
4043
+ responseText: z37.string().nullable(),
4044
+ layout: z37.unknown().nullable(),
4045
+ phaseTimings: z37.record(z37.number()).nullable(),
4046
+ tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
4047
+ toolCalls: z37.array(z37.unknown()).nullable(),
4048
+ diagnostics: z37.array(z37.unknown()).nullable(),
3940
4049
  latencyFirstText: MillisecondsSchema,
3941
4050
  latencyFirstPatch: MillisecondsSchema,
3942
4051
  latencyTotal: MillisecondsSchema,
3943
- trackerState: z36.unknown().nullable(),
4052
+ trackerState: z37.unknown().nullable(),
3944
4053
  /**
3945
4054
  * The CLIENT's turn id for this run, or `null`.
3946
4055
  *
@@ -3956,37 +4065,37 @@ var CreateTraceInputSchema = z36.object({
3956
4065
  * a turn whose ack the client never saw — none of which is evidence that a
3957
4066
  * visitor asked something and got nothing.
3958
4067
  */
3959
- turnId: z36.string().nullable()
4068
+ turnId: z37.string().nullable()
3960
4069
  });
3961
- var AgentSessionSummarySchema = z36.object({
3962
- sessionId: z36.string(),
4070
+ var AgentSessionSummarySchema = z37.object({
4071
+ sessionId: z37.string(),
3963
4072
  /** Turn rows only; background/secondary runs are excluded by the aggregate. */
3964
- turnCount: z36.number().int(),
4073
+ turnCount: z37.number().int(),
3965
4074
  /** The session's opening prompt — titles the row in the UI. */
3966
- firstPrompt: z36.string(),
3967
- startedAt: z36.string(),
3968
- lastRunAt: z36.string(),
4075
+ firstPrompt: z37.string(),
4076
+ startedAt: z37.string(),
4077
+ lastRunAt: z37.string(),
3969
4078
  /** Summed `latency_total` across the session's turns. */
3970
- totalLatencyMs: z36.number().int()
4079
+ totalLatencyMs: z37.number().int()
3971
4080
  });
3972
- var SessionTurnSchema = z36.object({
3973
- id: z36.string().uuid(),
3974
- userPrompt: z36.string(),
3975
- responseText: z36.string().nullable(),
4081
+ var SessionTurnSchema = z37.object({
4082
+ id: z37.string().uuid(),
4083
+ userPrompt: z37.string(),
4084
+ responseText: z37.string().nullable(),
3976
4085
  /** Full cumulative Spec committed by this turn — never a patch delta. */
3977
- layout: z36.unknown().nullable(),
3978
- createdAt: z36.string(),
3979
- latencyTotal: z36.number().int().nullable(),
3980
- phaseTimings: z36.record(z36.number()).nullable(),
3981
- tokensByModel: z36.record(z36.object({
3982
- input_tokens: z36.number().optional(),
3983
- output_tokens: z36.number().optional()
4086
+ layout: z37.unknown().nullable(),
4087
+ createdAt: z37.string(),
4088
+ latencyTotal: z37.number().int().nullable(),
4089
+ phaseTimings: z37.record(z37.number()).nullable(),
4090
+ tokensByModel: z37.record(z37.object({
4091
+ input_tokens: z37.number().optional(),
4092
+ output_tokens: z37.number().optional()
3984
4093
  })).nullable(),
3985
- toolCalls: z36.array(z36.unknown()).nullable(),
3986
- diagnostics: z36.array(z36.unknown()).nullable()
4094
+ toolCalls: z37.array(z37.unknown()).nullable(),
4095
+ diagnostics: z37.array(z37.unknown()).nullable()
3987
4096
  });
3988
- var SessionReplaySchema = z36.object({
3989
- turns: z36.array(SessionTurnSchema),
4097
+ var SessionReplaySchema = z37.object({
4098
+ turns: z37.array(SessionTurnSchema),
3990
4099
  /**
3991
4100
  * The session's own last-committed layout, read straight off the durable
3992
4101
  * session record (`sessions.blob.layout`) rather than derived from `turns`.
@@ -3997,20 +4106,20 @@ var SessionReplaySchema = z36.object({
3997
4106
  * a perfectly real layout; only this field can show it. Null exclusively
3998
4107
  * when the durable session row itself could not be read.
3999
4108
  */
4000
- sessionLayout: z36.record(z36.string(), z36.unknown()).nullable()
4109
+ sessionLayout: z37.record(z37.string(), z37.unknown()).nullable()
4001
4110
  });
4002
- var SessionTraceSchema = z36.object({
4003
- trackerState: z36.string().nullable()
4111
+ var SessionTraceSchema = z37.object({
4112
+ trackerState: z37.string().nullable()
4004
4113
  });
4005
- var LlmUsageDailySchema = z36.object({
4006
- day: z36.string(),
4114
+ var LlmUsageDailySchema = z37.object({
4115
+ day: z37.string(),
4007
4116
  /** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
4008
- environment: z36.string(),
4009
- feature: z36.string(),
4010
- model: z36.string(),
4011
- provider: z36.string(),
4117
+ environment: z37.string(),
4118
+ feature: z37.string(),
4119
+ model: z37.string(),
4120
+ provider: z37.string(),
4012
4121
  /** Masked tail of the key actually billed, or null when unknown/non-Google. */
4013
- keyFingerprint: z36.string().nullable(),
4122
+ keyFingerprint: z37.string().nullable(),
4014
4123
  /**
4015
4124
  * The space the call served, or null when it served none.
4016
4125
  *
@@ -4019,91 +4128,91 @@ var LlmUsageDailySchema = z36.object({
4019
4128
  * report that share rather than dropping it, or a per-space total reads as
4020
4129
  * the platform total.
4021
4130
  */
4022
- spaceId: z36.string().nullable(),
4131
+ spaceId: z37.string().nullable(),
4023
4132
  /**
4024
4133
  * The surface of the session the call served (`sessions.surface`), or null
4025
4134
  * when it served no session or the session predates surface recording.
4026
4135
  * `automation` is the eval harness — the signal that files an ordinary
4027
4136
  * `agent-turn` as testing spend rather than as a visitor's.
4028
4137
  */
4029
- surface: z36.string().nullable(),
4030
- inputTokens: z36.number(),
4031
- outputTokens: z36.number(),
4138
+ surface: z37.string().nullable(),
4139
+ inputTokens: z37.number(),
4140
+ outputTokens: z37.number(),
4032
4141
  /** Subset of inputTokens, never additional to it. */
4033
- cachedInputTokens: z36.number(),
4034
- reasoningTokens: z36.number(),
4035
- callCount: z36.number(),
4036
- errorCount: z36.number(),
4037
- estimatedCostUsd: z36.number().nullable()
4142
+ cachedInputTokens: z37.number(),
4143
+ reasoningTokens: z37.number(),
4144
+ callCount: z37.number(),
4145
+ errorCount: z37.number(),
4146
+ estimatedCostUsd: z37.number().nullable()
4038
4147
  });
4039
- var LlmUsageBySessionSchema = z36.object({
4040
- sessionId: z36.string(),
4041
- environment: z36.string(),
4042
- model: z36.string(),
4148
+ var LlmUsageBySessionSchema = z37.object({
4149
+ sessionId: z37.string(),
4150
+ environment: z37.string(),
4151
+ model: z37.string(),
4043
4152
  /** The space this session belongs to, or null for a session with no space. */
4044
- spaceId: z36.string().nullable(),
4153
+ spaceId: z37.string().nullable(),
4045
4154
  /** The session's surface — see `LlmUsageDailySchema.surface`. */
4046
- surface: z36.string().nullable(),
4155
+ surface: z37.string().nullable(),
4047
4156
  /** Label only — the first feature seen in the session. */
4048
- firstFeature: z36.string(),
4049
- startedAt: z36.string(),
4050
- endedAt: z36.string(),
4051
- inputTokens: z36.number(),
4052
- outputTokens: z36.number(),
4053
- cachedInputTokens: z36.number(),
4054
- reasoningTokens: z36.number(),
4055
- callCount: z36.number(),
4056
- errorCount: z36.number(),
4157
+ firstFeature: z37.string(),
4158
+ startedAt: z37.string(),
4159
+ endedAt: z37.string(),
4160
+ inputTokens: z37.number(),
4161
+ outputTokens: z37.number(),
4162
+ cachedInputTokens: z37.number(),
4163
+ reasoningTokens: z37.number(),
4164
+ callCount: z37.number(),
4165
+ errorCount: z37.number(),
4057
4166
  /** Priced server-side, like the daily rollup — the browser never carries a
4058
4167
  * rate table, so there is exactly one place a price can be wrong. Null when
4059
4168
  * the model is unpriced; never 0, which would read as free. */
4060
- estimatedCostUsd: z36.number().nullable()
4169
+ estimatedCostUsd: z37.number().nullable()
4061
4170
  });
4062
- var LlmSessionsDailySchema = z36.object({
4063
- day: z36.string(),
4064
- environment: z36.string(),
4065
- sessionCount: z36.number()
4171
+ var LlmSessionsDailySchema = z37.object({
4172
+ day: z37.string(),
4173
+ environment: z37.string(),
4174
+ sessionCount: z37.number()
4066
4175
  });
4067
4176
 
4068
4177
  // ../spacestation/src/space/session-queue.ts
4069
- import { z as z38 } from "zod";
4178
+ import { z as z39 } from "zod";
4070
4179
 
4071
4180
  // ../spacestation/src/space/session-activity.ts
4072
- import { z as z37 } from "zod";
4073
- var SessionActivityEventSchema = z37.object({
4074
- id: z37.string(),
4075
- kind: z37.string(),
4076
- occurredAt: z37.string(),
4077
- source: z37.string(),
4078
- surface: z37.string(),
4079
- payload: z37.record(z37.unknown())
4181
+ import { z as z38 } from "zod";
4182
+ var SessionActivityEventSchema = z38.object({
4183
+ id: z38.string(),
4184
+ kind: z38.string(),
4185
+ occurredAt: z38.string(),
4186
+ source: z38.string(),
4187
+ surface: z38.string(),
4188
+ payload: z38.record(z38.unknown())
4080
4189
  });
4081
- var SessionActivitySchema = z37.object({
4082
- events: z37.array(SessionActivityEventSchema),
4083
- hasMore: z37.boolean()
4190
+ var SessionActivitySchema = z38.object({
4191
+ events: z38.array(SessionActivityEventSchema),
4192
+ hasMore: z38.boolean()
4084
4193
  });
4085
4194
 
4086
4195
  // ../spacestation/src/space/session-queue.ts
4087
- var SessionVerdictSchema = z38.enum(["unreviewed", "viewed", "bug"]);
4088
- var RecordableVerdictSchema = z38.enum(["viewed", "bug"]);
4089
- var SessionReviewEventSchema = z38.object({
4090
- id: z38.string().uuid(),
4196
+ var SessionVerdictSchema = z39.enum(["unreviewed", "viewed", "bug"]);
4197
+ var RecordableVerdictSchema = z39.enum(["viewed", "bug"]);
4198
+ var SessionReviewEventSchema = z39.object({
4199
+ id: z39.string().uuid(),
4091
4200
  verdict: RecordableVerdictSchema,
4092
4201
  /** Account email of the operator who judged it. Attribution is the reason the
4093
4202
  * log is append-only rather than a mutable current-state row. */
4094
- reviewer: z38.string(),
4095
- note: z38.string().nullable(),
4096
- createdAt: z38.string()
4203
+ reviewer: z39.string(),
4204
+ note: z39.string().nullable(),
4205
+ createdAt: z39.string()
4097
4206
  });
4098
- var BugSeveritySchema = z38.enum(["high", "medium", "low"]);
4099
- var BugLocationSchema = z38.object({
4100
- elementId: z38.string().nullable(),
4207
+ var BugSeveritySchema = z39.enum(["high", "medium", "low"]);
4208
+ var BugLocationSchema = z39.object({
4209
+ elementId: z39.string().nullable(),
4101
4210
  /** Display only — the catalog component type, e.g. "productGrid". Null
4102
4211
  * alongside a null `elementId`. */
4103
- elementType: z38.string().nullable(),
4212
+ elementType: z39.string().nullable(),
4104
4213
  /** Fraction of the ELEMENT's own box. Null for a page anchor. */
4105
- offsetXPct: z38.number().min(0).max(100).nullable(),
4106
- offsetYPct: z38.number().min(0).max(100).nullable(),
4214
+ offsetXPct: z39.number().min(0).max(100).nullable(),
4215
+ offsetYPct: z39.number().min(0).max(100).nullable(),
4107
4216
  /**
4108
4217
  * ABSOLUTE document pixels, for a pin with no element under it. Null for an
4109
4218
  * element anchor.
@@ -4114,8 +4223,8 @@ var BugLocationSchema = z38.object({
4114
4223
  * on the page with it. Measured before this was fixed: growing the page 9%
4115
4224
  * slid a pin 32px, so a pin ran away from the cursor reaching for it.
4116
4225
  */
4117
- pageX: z38.number().nullable(),
4118
- pageY: z38.number().nullable()
4226
+ pageX: z39.number().nullable(),
4227
+ pageY: z39.number().nullable()
4119
4228
  }).refine(
4120
4229
  (loc) => {
4121
4230
  const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
@@ -4129,24 +4238,24 @@ var BugLocationSchema = z38.object({
4129
4238
  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
4239
  }
4131
4240
  );
4132
- var SessionBugSchema = z38.object({
4133
- id: z38.string().uuid(),
4241
+ var SessionBugSchema = z39.object({
4242
+ id: z39.string().uuid(),
4134
4243
  /** 1-based turn the fault was observed on; null when the fault is session-wide. */
4135
- turnIndex: z38.number().int().nullable(),
4244
+ turnIndex: z39.number().int().nullable(),
4136
4245
  /** Where on that turn's canvas the pin was dropped; null for a bug filed
4137
4246
  * without pinning a spot. */
4138
4247
  location: BugLocationSchema.nullable(),
4139
- provider: z38.string(),
4140
- issueKey: z38.string().nullable(),
4141
- issueUrl: z38.string().nullable(),
4248
+ provider: z39.string(),
4249
+ issueKey: z39.string().nullable(),
4250
+ issueUrl: z39.string().nullable(),
4142
4251
  /** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
4143
4252
  * open text. Null until first synced. */
4144
- issueState: z38.string().nullable(),
4145
- title: z38.string(),
4146
- body: z38.string(),
4253
+ issueState: z39.string().nullable(),
4254
+ title: z39.string(),
4255
+ body: z39.string(),
4147
4256
  severity: BugSeveritySchema,
4148
- createdBy: z38.string(),
4149
- createdAt: z38.string(),
4257
+ createdBy: z39.string(),
4258
+ createdAt: z39.string(),
4150
4259
  /**
4151
4260
  * When this bug was resolved from the console; null means still OPEN.
4152
4261
  *
@@ -4155,60 +4264,60 @@ var SessionBugSchema = z38.object({
4155
4264
  * whether a particular fault is still live. The timestamp IS the state, so
4156
4265
  * no boolean can contradict it.
4157
4266
  */
4158
- resolvedAt: z38.string().nullable(),
4159
- resolvedBy: z38.string().nullable()
4267
+ resolvedAt: z39.string().nullable(),
4268
+ resolvedBy: z39.string().nullable()
4160
4269
  });
4161
- var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z38.string() });
4162
- var SessionCommentSchema = z38.object({
4163
- id: z38.string().uuid(),
4270
+ var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z39.string() });
4271
+ var SessionCommentSchema = z39.object({
4272
+ id: z39.string().uuid(),
4164
4273
  /** Set = a reply in that bug's thread. Null = a standalone comment pin. */
4165
- bugId: z38.string().uuid().nullable(),
4274
+ bugId: z39.string().uuid().nullable(),
4166
4275
  /** 1-based turn the comment was left on; null for a reply (it reads its
4167
4276
  * parent bug's turn). */
4168
- turnIndex: z38.number().int().nullable(),
4277
+ turnIndex: z39.number().int().nullable(),
4169
4278
  /** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
4170
4279
  location: BugLocationSchema.nullable(),
4171
- body: z38.string(),
4172
- createdBy: z38.string(),
4173
- createdAt: z38.string()
4280
+ body: z39.string(),
4281
+ createdBy: z39.string(),
4282
+ createdAt: z39.string()
4174
4283
  });
4175
- var CreateCommentInputSchema = z38.object({
4176
- bugId: z38.string().uuid().nullable(),
4177
- turnIndex: z38.number().int().positive().nullable(),
4284
+ var CreateCommentInputSchema = z39.object({
4285
+ bugId: z39.string().uuid().nullable(),
4286
+ turnIndex: z39.number().int().positive().nullable(),
4178
4287
  location: BugLocationSchema.nullable(),
4179
4288
  // Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
4180
4289
  // of three spaces, which renders as an empty bubble nobody can interpret.
4181
- body: z38.string().trim().min(1)
4290
+ body: z39.string().trim().min(1)
4182
4291
  }).refine((input) => input.bugId === null !== (input.location === null), {
4183
4292
  message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
4184
4293
  });
4185
- var UpdateCommentInputSchema = z38.object({
4186
- body: z38.string().trim().min(1).optional(),
4187
- bugId: z38.string().uuid().nullable().optional(),
4294
+ var UpdateCommentInputSchema = z39.object({
4295
+ body: z39.string().trim().min(1).optional(),
4296
+ bugId: z39.string().uuid().nullable().optional(),
4188
4297
  location: BugLocationSchema.nullable().optional()
4189
4298
  });
4190
4299
  var MOBILE_VIEWPORT_MAX = 720;
4191
- var SessionFormFactorSchema = z38.enum(["mobile", "desktop"]).nullable();
4300
+ var SessionFormFactorSchema = z39.enum(["mobile", "desktop"]).nullable();
4192
4301
  function formFactorFromViewport(width) {
4193
4302
  if (width === null) return null;
4194
4303
  return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
4195
4304
  }
4196
- var SessionSummarySchema = z38.object({
4197
- sessionId: z38.string(),
4305
+ var SessionSummarySchema = z39.object({
4306
+ sessionId: z39.string(),
4198
4307
  /** Stable per-browser id — the join key across a visitor's sessions. Null when
4199
4308
  * the session row is gone (pruned) or predates the `sessions` table. */
4200
- visitorId: z38.string().nullable(),
4309
+ visitorId: z39.string().nullable(),
4201
4310
  /** Provider-qualified identity anchor, present only once the visitor
4202
4311
  * identified themselves. Both null together means "not identified yet". */
4203
- identityProvider: z38.string().nullable(),
4204
- identityKey: z38.string().nullable(),
4312
+ identityProvider: z39.string().nullable(),
4313
+ identityKey: z39.string().nullable(),
4205
4314
  /** Team/test traffic. The queue hides these by default. */
4206
- isInternal: z38.boolean(),
4315
+ isInternal: z39.boolean(),
4207
4316
  /** Build that served the session. Null = not captured; a version filter must
4208
4317
  * therefore EXCLUDE it rather than let it match an arbitrary bucket. */
4209
- clientVersion: z38.string().nullable(),
4318
+ clientVersion: z39.string().nullable(),
4210
4319
  /** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
4211
- signalCounts: z38.record(z38.number()),
4320
+ signalCounts: z39.record(z39.number()),
4212
4321
  /**
4213
4322
  * Did this conversation ACQUIRE anything, and how many times?
4214
4323
  *
@@ -4225,7 +4334,7 @@ var SessionSummarySchema = z38.object({
4225
4334
  * predates the column — and renders as no mark at all. It never means zero:
4226
4335
  * zero is a real, recorded answer and the rail reports it as one.
4227
4336
  */
4228
- conversionAttempts: z38.number().int().nullable(),
4337
+ conversionAttempts: z39.number().int().nullable(),
4229
4338
  /**
4230
4339
  * The same attempts split by EVENT KIND, keyed by the kind's own name
4231
4340
  * (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
@@ -4241,7 +4350,7 @@ var SessionSummarySchema = z38.object({
4241
4350
  * kinds together, and one attempt id appearing under both would be counted
4242
4351
  * once there and twice here.
4243
4352
  */
4244
- conversionKinds: z38.record(z38.number()),
4353
+ conversionKinds: z39.record(z39.number()),
4245
4354
  /**
4246
4355
  * Every analytics funnel step this session reached, in funnel order — the
4247
4356
  * dashboard's own step ids, read by the same per-step predicates, so a queue
@@ -4249,20 +4358,20 @@ var SessionSummarySchema = z38.object({
4249
4358
  * set of strings for the reason `conversionKinds` is: the contract does not
4250
4359
  * learn what a step means. Empty only when read from a pre-column database.
4251
4360
  */
4252
- funnelSteps: z38.array(z38.string()),
4361
+ funnelSteps: z39.array(z39.string()),
4253
4362
  /**
4254
4363
  * The connector's opaque handle for what this session produced in its back
4255
4364
  * office — present only once a checkout actually reached the platform. The
4256
4365
  * console hands it to the back-office link registry; nothing else reads it.
4257
4366
  */
4258
- backOfficeRef: z38.string().nullable(),
4367
+ backOfficeRef: z39.string().nullable(),
4259
4368
  /**
4260
4369
  * The order this session produced, when the connector's back office reported
4261
4370
  * it (`session_orders`): its opaque id and the back office's own name for it.
4262
4371
  * Both null when no order is known — the cart handle above is then the door.
4263
4372
  */
4264
- orderRef: z38.string().nullable(),
4265
- orderLabel: z38.string().nullable(),
4373
+ orderRef: z39.string().nullable(),
4374
+ orderLabel: z39.string().nullable(),
4266
4375
  /**
4267
4376
  * Which shell this session rendered — the one thing about the CAPTURE a list
4268
4377
  * needs.
@@ -4275,12 +4384,12 @@ var SessionSummarySchema = z38.object({
4275
4384
  * on a desktop are not the same session.
4276
4385
  */
4277
4386
  formFactor: SessionFormFactorSchema,
4278
- turnCount: z38.number().int(),
4387
+ turnCount: z39.number().int(),
4279
4388
  /** The visitor's opening message — the single most informative field for
4280
4389
  * deciding whether a session is worth opening, hence the widest column. */
4281
- firstPrompt: z38.string(),
4282
- startedAt: z38.string(),
4283
- lastRunAt: z38.string(),
4390
+ firstPrompt: z39.string(),
4391
+ startedAt: z39.string(),
4392
+ lastRunAt: z39.string(),
4284
4393
  /**
4285
4394
  * The VISITOR's own IANA zone (`America/New_York`), read from their browser
4286
4395
  * at session create — what the two timestamps above should be read in.
@@ -4308,7 +4417,7 @@ var SessionSummarySchema = z38.object({
4308
4417
  * Client-asserted and never validated against a zone table, so every consumer
4309
4418
  * must tolerate an unknown name: `Intl` throws a RangeError on one.
4310
4419
  */
4311
- visitorTimeZone: z38.string().nullable(),
4420
+ visitorTimeZone: z39.string().nullable(),
4312
4421
  /**
4313
4422
  * Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
4314
4423
  * layout op reaching the visitor, and THE latency the project is managed on.
@@ -4316,31 +4425,31 @@ var SessionSummarySchema = z38.object({
4316
4425
  * `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
4317
4426
  * already reading. Null when no turn in the session recorded a patch.
4318
4427
  */
4319
- avgTtftMs: z38.number().int().nullable(),
4428
+ avgTtftMs: z39.number().int().nullable(),
4320
4429
  /** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
4321
4430
  * a budget: null on sessions older than the mark's recording. */
4322
- avgMainDoneMs: z38.number().int().nullable(),
4431
+ avgMainDoneMs: z39.number().int().nullable(),
4323
4432
  /** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
4324
4433
  * budget. On the row only to explain the gap to `totalLatencyMs`. */
4325
- avgChipGenMs: z38.number().int().nullable(),
4326
- totalLatencyMs: z38.number().int(),
4327
- durationMs: z38.number().int(),
4434
+ avgChipGenMs: z39.number().int().nullable(),
4435
+ totalLatencyMs: z39.number().int(),
4436
+ durationMs: z39.number().int(),
4328
4437
  /** Inferred from recent activity — nothing writes a session-end marker. A
4329
4438
  * live session streams and cannot be given a verdict until it ends. */
4330
- isLive: z38.boolean(),
4439
+ isLive: z39.boolean(),
4331
4440
  verdict: SessionVerdictSchema,
4332
- reviewedBy: z38.string().nullable(),
4333
- reviewedAt: z38.string().nullable(),
4441
+ reviewedBy: z39.string().nullable(),
4442
+ reviewedAt: z39.string().nullable(),
4334
4443
  /** Latest filed bug, flattened onto the row so the queue can show its live
4335
4444
  * state without a second request. */
4336
- bugIssueKey: z38.string().nullable(),
4337
- bugIssueUrl: z38.string().nullable(),
4338
- bugIssueState: z38.string().nullable()
4445
+ bugIssueKey: z39.string().nullable(),
4446
+ bugIssueUrl: z39.string().nullable(),
4447
+ bugIssueState: z39.string().nullable()
4339
4448
  });
4340
- var SessionQueuePageSchema = z38.object({
4341
- sessions: z38.array(SessionSummarySchema),
4342
- totalCount: z38.number().int(),
4343
- hiddenInternalCount: z38.number().int(),
4449
+ var SessionQueuePageSchema = z39.object({
4450
+ sessions: z39.array(SessionSummarySchema),
4451
+ totalCount: z39.number().int(),
4452
+ hiddenInternalCount: z39.number().int(),
4344
4453
  /**
4345
4454
  * Bounced sessions the queue left out — no turn and no add, the default.
4346
4455
  *
@@ -4350,61 +4459,61 @@ var SessionQueuePageSchema = z38.object({
4350
4459
  * `totalCount + hiddenBouncedCount` is that population, and this count is the
4351
4460
  * analytics dashboard's bounce over the same window.
4352
4461
  */
4353
- hiddenBouncedCount: z38.number().int()
4462
+ hiddenBouncedCount: z39.number().int()
4354
4463
  });
4355
- var SessionQueueFacetsSchema = z38.object({
4356
- review: z38.record(z38.number()),
4357
- version: z38.record(z38.number()),
4358
- turns: z38.record(z38.number()),
4359
- durationS: z38.record(z38.number()),
4464
+ var SessionQueueFacetsSchema = z39.object({
4465
+ review: z39.record(z39.number()),
4466
+ version: z39.record(z39.number()),
4467
+ turns: z39.record(z39.number()),
4468
+ durationS: z39.record(z39.number()),
4360
4469
  /** Sessions per funnel step reached — a session counts under every step it reached. */
4361
- funnel: z38.record(z38.number())
4470
+ funnel: z39.record(z39.number())
4362
4471
  });
4363
- var SessionCaptureSchema = z38.object({
4364
- viewportWidth: z38.number().int().nullable(),
4365
- viewportHeight: z38.number().int().nullable(),
4366
- userAgent: z38.string().nullable(),
4367
- locale: z38.string().nullable(),
4472
+ var SessionCaptureSchema = z39.object({
4473
+ viewportWidth: z39.number().int().nullable(),
4474
+ viewportHeight: z39.number().int().nullable(),
4475
+ userAgent: z39.string().nullable(),
4476
+ locale: z39.string().nullable(),
4368
4477
  /** Referrer at session create — separates agentic traffic from organic. */
4369
- referrer: z38.string().nullable()
4478
+ referrer: z39.string().nullable()
4370
4479
  });
4371
- var SessionCaptureInputSchema = z38.object({
4372
- viewportWidth: z38.number().int().positive().max(2e4).optional(),
4373
- viewportHeight: z38.number().int().positive().max(2e4).optional(),
4374
- userAgent: z38.string().max(1e3).optional(),
4375
- locale: z38.string().max(35).optional(),
4480
+ var SessionCaptureInputSchema = z39.object({
4481
+ viewportWidth: z39.number().int().positive().max(2e4).optional(),
4482
+ viewportHeight: z39.number().int().positive().max(2e4).optional(),
4483
+ userAgent: z39.string().max(1e3).optional(),
4484
+ locale: z39.string().max(35).optional(),
4376
4485
  /** IANA zone name from the visitor's browser. Bounded rather than validated:
4377
4486
  * the zone database grows, and refusing a name this build has not heard of
4378
4487
  * would drop a real session's capture over a table that is out of date. */
4379
- timeZone: z38.string().max(64).optional(),
4380
- referrer: z38.string().max(2048).optional(),
4381
- clientVersion: z38.string().max(100).optional(),
4382
- isInternal: z38.boolean().optional()
4488
+ timeZone: z39.string().max(64).optional(),
4489
+ referrer: z39.string().max(2048).optional(),
4490
+ clientVersion: z39.string().max(100).optional(),
4491
+ isInternal: z39.boolean().optional()
4383
4492
  });
4384
- var SessionDetailSchema = z38.object({
4493
+ var SessionDetailSchema = z39.object({
4385
4494
  session: SessionSummarySchema,
4386
4495
  capture: SessionCaptureSchema,
4387
4496
  /** Full verdict history, newest first. Verdicts are revisable, and a session
4388
4497
  * re-judged after a fix is the evidence the fix worked. */
4389
- reviews: z38.array(SessionReviewEventSchema),
4390
- bugs: z38.array(SessionBugSchema),
4391
- comments: z38.array(SessionCommentSchema),
4498
+ reviews: z39.array(SessionReviewEventSchema),
4499
+ bugs: z39.array(SessionBugSchema),
4500
+ comments: z39.array(SessionCommentSchema),
4392
4501
  /** Optional during API/console rolling deployment. Absent is unavailable,
4393
4502
  * not evidence of zero visitor activity. */
4394
4503
  activity: SessionActivitySchema.optional()
4395
4504
  });
4396
- var RecordVerdictInputSchema = z38.object({
4505
+ var RecordVerdictInputSchema = z39.object({
4397
4506
  verdict: RecordableVerdictSchema,
4398
- note: z38.string().max(2e3).optional()
4507
+ note: z39.string().max(2e3).optional()
4399
4508
  });
4400
- var FileBugInputSchema = z38.object({
4401
- turnIndex: z38.number().int().positive().nullable(),
4509
+ var FileBugInputSchema = z39.object({
4510
+ turnIndex: z39.number().int().positive().nullable(),
4402
4511
  /** Optional — a bug filed without dropping a pin has no location. */
4403
4512
  location: BugLocationSchema.nullable().optional(),
4404
- title: z38.string().min(1).max(300),
4405
- body: z38.string().min(1),
4513
+ title: z39.string().min(1).max(300),
4514
+ body: z39.string().min(1),
4406
4515
  severity: BugSeveritySchema,
4407
- payload: z38.record(z38.unknown())
4516
+ payload: z39.record(z39.unknown())
4408
4517
  });
4409
4518
 
4410
4519
  // ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
@@ -4587,7 +4696,46 @@ function stringifyForScoring(v) {
4587
4696
  }
4588
4697
  }
4589
4698
 
4699
+ // src/session/turn-attributed-session.ts
4700
+ var TURN_ATTRIBUTED_SIGNALS = /* @__PURE__ */ new Set([CART_ADD_SIGNAL]);
4701
+ function withTurn(signal, turnId) {
4702
+ if (!TURN_ATTRIBUTED_SIGNALS.has(signal.type) || "turnId" in signal.payload) return signal;
4703
+ return { ...signal, payload: { ...signal.payload, turnId } };
4704
+ }
4705
+ function useTurnAttributedSession(session) {
4706
+ const turnId = useTurnScope();
4707
+ return useMemo2(() => {
4708
+ if (session === null || turnId === null) return session;
4709
+ return {
4710
+ ...session,
4711
+ dispatchSignal: (signal) => session.dispatchSignal(withTurn(signal, turnId)),
4712
+ dispatchSuggestionAction: (action) => session.dispatchSuggestionAction(withTurn(action, turnId))
4713
+ };
4714
+ }, [session, turnId]);
4715
+ }
4716
+
4717
+ // src/session/FourtySessionContext.tsx
4718
+ var FourtySessionContext = createContext2(null);
4719
+ function useFourtySession() {
4720
+ const ctx = useTurnAttributedSession(useContext2(FourtySessionContext));
4721
+ if (!ctx) throw new Error("useFourtySession must be used within a <FourtyProvider>");
4722
+ return ctx;
4723
+ }
4724
+ function useOptionalFourtySession() {
4725
+ return useTurnAttributedSession(useContext2(FourtySessionContext));
4726
+ }
4727
+ function useComposerDraft() {
4728
+ const { composerDraftStore, setComposerDraft } = useFourtySession();
4729
+ const value = useSyncExternalStore(
4730
+ composerDraftStore.subscribe,
4731
+ composerDraftStore.get,
4732
+ composerDraftStore.get
4733
+ );
4734
+ return [value, setComposerDraft];
4735
+ }
4736
+
4590
4737
  // src/session/use-action.ts
4738
+ import { useCallback } from "react";
4591
4739
  function useAction(label, action) {
4592
4740
  const session = useOptionalFourtySession();
4593
4741
  return useCallback(() => {
@@ -4684,60 +4832,60 @@ __export(src_exports2, {
4684
4832
  });
4685
4833
 
4686
4834
  // ../ecommerce/src/commerce-schemas.ts
4687
- import { z as z39 } from "zod";
4688
- var MoneySchema = z39.object({
4689
- amount: z39.number(),
4690
- currencyCode: z39.string()
4835
+ import { z as z40 } from "zod";
4836
+ var MoneySchema = z40.object({
4837
+ amount: z40.number(),
4838
+ currencyCode: z40.string()
4691
4839
  });
4692
- var ImageSchema = z39.object({
4693
- url: z39.string(),
4694
- altText: z39.string(),
4695
- width: z39.number().optional(),
4696
- height: z39.number().optional(),
4840
+ var ImageSchema = z40.object({
4841
+ url: z40.string(),
4842
+ altText: z40.string(),
4843
+ width: z40.number().optional(),
4844
+ height: z40.number().optional(),
4697
4845
  /** Responsive candidate set, resolved at the commerce-adapter boundary —
4698
4846
  * never computed in a component. Renderers use it as `<img srcSet>` paired
4699
4847
  * with a layout `sizes`. Absent for non-CDN / unsizable images. */
4700
- srcSet: z39.string().optional()
4848
+ srcSet: z40.string().optional()
4701
4849
  });
4702
- var AssetSchema = z39.object({
4850
+ var AssetSchema = z40.object({
4703
4851
  /** Opaque asset id — the `resolved()` ref the agent emitted. */
4704
- id: z39.string(),
4705
- url: z39.string(),
4706
- altText: z39.string(),
4707
- srcSet: z39.string().optional()
4852
+ id: z40.string(),
4853
+ url: z40.string(),
4854
+ altText: z40.string(),
4855
+ srcSet: z40.string().optional()
4708
4856
  });
4709
- var SelectedOptionSchema = z39.object({
4710
- name: z39.string(),
4711
- value: z39.string()
4857
+ var SelectedOptionSchema = z40.object({
4858
+ name: z40.string(),
4859
+ value: z40.string()
4712
4860
  });
4713
- var VideoSourceSchema = z39.object({
4714
- url: z39.string(),
4715
- mimeType: z39.string(),
4716
- width: z39.number().optional(),
4717
- height: z39.number().optional()
4861
+ var VideoSourceSchema = z40.object({
4862
+ url: z40.string(),
4863
+ mimeType: z40.string(),
4864
+ width: z40.number().optional(),
4865
+ height: z40.number().optional()
4718
4866
  });
4719
- var ProductVideoSchema = z39.object({
4720
- kind: z39.enum(["hosted", "external"]),
4867
+ var ProductVideoSchema = z40.object({
4868
+ kind: z40.enum(["hosted", "external"]),
4721
4869
  previewImage: ImageSchema.optional(),
4722
- altText: z39.string().default(""),
4870
+ altText: z40.string().default(""),
4723
4871
  /** `kind: 'hosted'` only — empty for external embeds. */
4724
- sources: z39.array(VideoSourceSchema).default([]),
4872
+ sources: z40.array(VideoSourceSchema).default([]),
4725
4873
  /** `kind: 'external'` only — iframe embed URL. */
4726
- embedUrl: z39.string().optional(),
4874
+ embedUrl: z40.string().optional(),
4727
4875
  /** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
4728
- host: z39.string().optional()
4876
+ host: z40.string().optional()
4729
4877
  });
4730
- var AvailabilityStatusSchema = z39.enum([
4878
+ var AvailabilityStatusSchema = z40.enum([
4731
4879
  "in_stock",
4732
4880
  "backorder",
4733
4881
  "preorder",
4734
4882
  "out_of_stock",
4735
4883
  "discontinued"
4736
4884
  ]);
4737
- var ProductVariantSchema = z39.object({
4738
- id: z39.string(),
4739
- title: z39.string(),
4740
- available: z39.boolean(),
4885
+ var ProductVariantSchema = z40.object({
4886
+ id: z40.string(),
4887
+ title: z40.string(),
4888
+ available: z40.boolean(),
4741
4889
  /**
4742
4890
  * Qualifies `available` with the fulfillment state behind it. Absent means
4743
4891
  * the backend did not say — which is NOT the same as in stock, and must not
@@ -4752,7 +4900,7 @@ var ProductVariantSchema = z39.object({
4752
4900
  availabilityStatus: AvailabilityStatusSchema.optional(),
4753
4901
  price: MoneySchema,
4754
4902
  compareAtPrice: MoneySchema.optional(),
4755
- selectedOptions: z39.array(SelectedOptionSchema).optional(),
4903
+ selectedOptions: z40.array(SelectedOptionSchema).optional(),
4756
4904
  image: ImageSchema.optional()
4757
4905
  });
4758
4906
  var MP4_MIME = "video/mp4";
@@ -4763,34 +4911,34 @@ function orderedVideoSources(video) {
4763
4911
  const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
4764
4912
  return [...mp4, ...hls];
4765
4913
  }
4766
- var SiblingProductSchema = z39.object({
4767
- id: z39.string(),
4768
- handle: z39.string(),
4769
- title: z39.string(),
4914
+ var SiblingProductSchema = z40.object({
4915
+ id: z40.string(),
4916
+ handle: z40.string(),
4917
+ title: z40.string(),
4770
4918
  /** The differentiating value across siblings — typically the color
4771
4919
  * label ("OLIVE", "STONE"). Rendered next to the swatch row. */
4772
- color: z39.string(),
4920
+ color: z40.string(),
4773
4921
  /** Swatch artwork. Hydrators populate from the sibling product's
4774
4922
  * first image; renderers crop / fit to the swatch tile. */
4775
4923
  swatchImage: ImageSchema.optional(),
4776
- available: z39.boolean().default(true),
4924
+ available: z40.boolean().default(true),
4777
4925
  /** Marks the sibling that IS the currently-rendered product. The
4778
4926
  * picker uses this to highlight the active swatch without an
4779
4927
  * external id comparison. */
4780
- current: z39.boolean().default(false)
4928
+ current: z40.boolean().default(false)
4781
4929
  });
4782
- var ProductSchema = z39.object({
4783
- id: z39.string(),
4784
- handle: z39.string().default(""),
4785
- title: z39.string(),
4786
- description: z39.string().default(""),
4787
- descriptionHtml: z39.string().optional(),
4788
- vendor: z39.string().default(""),
4789
- productType: z39.string().optional(),
4790
- tags: z39.array(z39.string()).default([]),
4930
+ var ProductSchema = z40.object({
4931
+ id: z40.string(),
4932
+ handle: z40.string().default(""),
4933
+ title: z40.string(),
4934
+ description: z40.string().default(""),
4935
+ descriptionHtml: z40.string().optional(),
4936
+ vendor: z40.string().default(""),
4937
+ productType: z40.string().optional(),
4938
+ tags: z40.array(z40.string()).default([]),
4791
4939
  price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
4792
4940
  compareAtPrice: MoneySchema.optional(),
4793
- images: z39.array(ImageSchema).default([]),
4941
+ images: z40.array(ImageSchema).default([]),
4794
4942
  /**
4795
4943
  * Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
4796
4944
  * catalog drops video media — it only surfaces through the Storefront
@@ -4798,21 +4946,21 @@ var ProductSchema = z39.object({
4798
4946
  * boundary. Default `[]` so renderers gate on `length > 0` without a
4799
4947
  * presence guard.
4800
4948
  */
4801
- videos: z39.array(ProductVideoSchema).default([]),
4802
- variants: z39.array(ProductVariantSchema).default([]),
4803
- availableForSale: z39.boolean().default(true),
4804
- options: z39.array(z39.object({
4805
- name: z39.string(),
4806
- values: z39.array(z39.string())
4949
+ videos: z40.array(ProductVideoSchema).default([]),
4950
+ variants: z40.array(ProductVariantSchema).default([]),
4951
+ availableForSale: z40.boolean().default(true),
4952
+ options: z40.array(z40.object({
4953
+ name: z40.string(),
4954
+ values: z40.array(z40.string())
4807
4955
  })).optional(),
4808
- collections: z39.array(z39.string()).optional(),
4956
+ collections: z40.array(z40.string()).optional(),
4809
4957
  /** See `SiblingProductSchema`. Default `[]` so renderers can check
4810
4958
  * `length > 1` to decide whether to draw the swatch row without a
4811
4959
  * presence guard. */
4812
- colorVariants: z39.array(SiblingProductSchema).default([]),
4813
- rating: z39.object({
4814
- value: z39.number(),
4815
- count: z39.number()
4960
+ colorVariants: z40.array(SiblingProductSchema).default([]),
4961
+ rating: z40.object({
4962
+ value: z40.number(),
4963
+ count: z40.number()
4816
4964
  }).optional(),
4817
4965
  /**
4818
4966
  * Product reviews surfaced from the brand's review store. SDK
@@ -4821,12 +4969,12 @@ var ProductSchema = z39.object({
4821
4969
  * review bodies. Renderers (`Reviews` component, `ProductDetail`,
4822
4970
  * etc.) consume directly.
4823
4971
  */
4824
- reviews: z39.array(z39.object({
4825
- author: z39.string(),
4826
- rating: z39.number(),
4827
- content: z39.string(),
4828
- date: z39.string(),
4829
- verified: z39.boolean().optional()
4972
+ reviews: z40.array(z40.object({
4973
+ author: z40.string(),
4974
+ rating: z40.number(),
4975
+ content: z40.string(),
4976
+ date: z40.string(),
4977
+ verified: z40.boolean().optional()
4830
4978
  })).optional(),
4831
4979
  /**
4832
4980
  * Ghost-entity flag — `true` when the Storefront API could not hydrate
@@ -4838,7 +4986,7 @@ var ProductSchema = z39.object({
4838
4986
  * Set exclusively by `createUnavailableProduct()` — never by the
4839
4987
  * Storefront mapper.
4840
4988
  */
4841
- unavailable: z39.boolean().default(false)
4989
+ unavailable: z40.boolean().default(false)
4842
4990
  });
4843
4991
  function createUnavailableProduct(gid) {
4844
4992
  return {
@@ -4860,68 +5008,68 @@ function createUnavailableProduct(gid) {
4860
5008
  function isGhostEntity(value) {
4861
5009
  return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
4862
5010
  }
4863
- var ReviewSchema = z39.object({
4864
- id: z39.string(),
4865
- productId: z39.string(),
4866
- author: z39.string(),
4867
- rating: z39.number(),
4868
- text: z39.string(),
4869
- date: z39.string(),
4870
- verified: z39.boolean()
5011
+ var ReviewSchema = z40.object({
5012
+ id: z40.string(),
5013
+ productId: z40.string(),
5014
+ author: z40.string(),
5015
+ rating: z40.number(),
5016
+ text: z40.string(),
5017
+ date: z40.string(),
5018
+ verified: z40.boolean()
4871
5019
  });
4872
- var ArticleSchema = z39.object({
4873
- id: z39.string(),
4874
- handle: z39.string().default(""),
4875
- title: z39.string(),
4876
- excerpt: z39.string().default(""),
4877
- content: z39.string().default(""),
4878
- contentHtml: z39.string().optional(),
4879
- author: z39.string().default(""),
4880
- publishedAt: z39.string().default(""),
5020
+ var ArticleSchema = z40.object({
5021
+ id: z40.string(),
5022
+ handle: z40.string().default(""),
5023
+ title: z40.string(),
5024
+ excerpt: z40.string().default(""),
5025
+ content: z40.string().default(""),
5026
+ contentHtml: z40.string().optional(),
5027
+ author: z40.string().default(""),
5028
+ publishedAt: z40.string().default(""),
4881
5029
  image: ImageSchema.optional(),
4882
- blogHandle: z39.string().default(""),
4883
- tags: z39.array(z39.string()).default([])
5030
+ blogHandle: z40.string().default(""),
5031
+ tags: z40.array(z40.string()).default([])
4884
5032
  });
4885
- var CmsPageSchema = z39.object({
4886
- id: z39.string(),
4887
- handle: z39.string().default(""),
4888
- title: z39.string(),
4889
- body: z39.string().default(""),
4890
- bodyHtml: z39.string().optional(),
4891
- bodySummary: z39.string().default(""),
4892
- updatedAt: z39.string().default(""),
4893
- seoTitle: z39.string().optional(),
4894
- seoDescription: z39.string().optional()
5033
+ var CmsPageSchema = z40.object({
5034
+ id: z40.string(),
5035
+ handle: z40.string().default(""),
5036
+ title: z40.string(),
5037
+ body: z40.string().default(""),
5038
+ bodyHtml: z40.string().optional(),
5039
+ bodySummary: z40.string().default(""),
5040
+ updatedAt: z40.string().default(""),
5041
+ seoTitle: z40.string().optional(),
5042
+ seoDescription: z40.string().optional()
4895
5043
  });
4896
- var CmsPolicySchema = z39.object({
4897
- id: z39.string(),
5044
+ var CmsPolicySchema = z40.object({
5045
+ id: z40.string(),
4898
5046
  /** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
4899
5047
  * 'shipping' | 'subscription' | 'warranty' | custom string. Open so
4900
5048
  * platforms with custom policy types can extend. */
4901
- kind: z39.string(),
5049
+ kind: z40.string(),
4902
5050
  /** Slug-shaped handle the platform exposes for storefront URLs
4903
5051
  * (e.g. `refund-policy`). Empty string when the backend doesn't
4904
5052
  * surface one. */
4905
- handle: z39.string().default(""),
4906
- title: z39.string(),
4907
- body: z39.string().default(""),
4908
- bodyHtml: z39.string().optional(),
4909
- url: z39.string().default("")
5053
+ handle: z40.string().default(""),
5054
+ title: z40.string(),
5055
+ body: z40.string().default(""),
5056
+ bodyHtml: z40.string().optional(),
5057
+ url: z40.string().default("")
4910
5058
  });
4911
- var CollectionSchema = z39.object({
4912
- id: z39.string(),
4913
- handle: z39.string().default(""),
4914
- title: z39.string(),
4915
- description: z39.string().default(""),
5059
+ var CollectionSchema = z40.object({
5060
+ id: z40.string(),
5061
+ handle: z40.string().default(""),
5062
+ title: z40.string(),
5063
+ description: z40.string().default(""),
4916
5064
  image: ImageSchema.optional(),
4917
- productCount: z39.number().int().nonnegative().optional()
5065
+ productCount: z40.number().int().nonnegative().optional()
4918
5066
  });
4919
- var CartLineSchema = z39.object({
4920
- id: z39.string(),
4921
- merchandiseId: z39.string(),
4922
- productId: z39.string(),
4923
- title: z39.string(),
4924
- variantTitle: z39.string().optional(),
5067
+ var CartLineSchema = z40.object({
5068
+ id: z40.string(),
5069
+ merchandiseId: z40.string(),
5070
+ productId: z40.string(),
5071
+ title: z40.string(),
5072
+ variantTitle: z40.string().optional(),
4925
5073
  /**
4926
5074
  * The variant's option axes as structured pairs (e.g.
4927
5075
  * `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
@@ -4930,10 +5078,10 @@ var CartLineSchema = z39.object({
4930
5078
  * single-variant products (the degenerate `Title: Default Title` axis
4931
5079
  * is normalized away at the adapter boundary).
4932
5080
  */
4933
- selectedOptions: z39.array(SelectedOptionSchema).optional(),
4934
- vendor: z39.string().optional(),
4935
- sku: z39.string().optional(),
4936
- quantity: z39.number().int().positive(),
5081
+ selectedOptions: z40.array(SelectedOptionSchema).optional(),
5082
+ vendor: z40.string().optional(),
5083
+ sku: z40.string().optional(),
5084
+ quantity: z40.number().int().positive(),
4937
5085
  unitPrice: MoneySchema,
4938
5086
  totalPrice: MoneySchema,
4939
5087
  image: ImageSchema.optional(),
@@ -4953,26 +5101,26 @@ var CartLineSchema = z39.object({
4953
5101
  * client-minted id the backend rejects, line-tap navigation is
4954
5102
  * suppressed, and the money never folds into a settled-looking total.
4955
5103
  */
4956
- pending: z39.boolean().optional()
5104
+ pending: z40.boolean().optional()
4957
5105
  });
4958
5106
  function isPendingCartLine(line) {
4959
5107
  return line.pending === true;
4960
5108
  }
4961
- var CartDiscountCodeSchema = z39.object({
4962
- code: z39.string(),
4963
- applicable: z39.boolean()
5109
+ var CartDiscountCodeSchema = z40.object({
5110
+ code: z40.string(),
5111
+ applicable: z40.boolean()
4964
5112
  });
4965
- var CartMessageSchema = z39.object({
4966
- kind: z39.enum(["error", "warning", "info"]),
5113
+ var CartMessageSchema = z40.object({
5114
+ kind: z40.enum(["error", "warning", "info"]),
4967
5115
  /** Machine code for branching; opaque and backend-defined. */
4968
- code: z39.string(),
5116
+ code: z40.string(),
4969
5117
  /** Human-readable text, meant to be shown as-is. */
4970
- content: z39.string()
5118
+ content: z40.string()
4971
5119
  });
4972
- var CartSchema = z39.object({
4973
- id: z39.string(),
4974
- lines: z39.array(CartLineSchema),
4975
- totalQuantity: z39.number().int().nonnegative(),
5120
+ var CartSchema = z40.object({
5121
+ id: z40.string(),
5122
+ lines: z40.array(CartLineSchema),
5123
+ totalQuantity: z40.number().int().nonnegative(),
4976
5124
  subtotal: MoneySchema,
4977
5125
  /**
4978
5126
  * Cart total after discounts (pre-shipping/tax). Absent when the
@@ -4982,11 +5130,11 @@ var CartSchema = z39.object({
4982
5130
  */
4983
5131
  total: MoneySchema.optional(),
4984
5132
  /** Discount codes currently attached to the cart. */
4985
- discountCodes: z39.array(CartDiscountCodeSchema).default([]),
5133
+ discountCodes: z40.array(CartDiscountCodeSchema).default([]),
4986
5134
  /** Notices the backend attached to this cart — see `CartMessageSchema`.
4987
5135
  * Empty when the backend said nothing or does not report them. */
4988
- messages: z39.array(CartMessageSchema).default([]),
4989
- checkoutUrl: z39.string().optional(),
5136
+ messages: z40.array(CartMessageSchema).default([]),
5137
+ checkoutUrl: z40.string().optional(),
4990
5138
  /**
4991
5139
  * Opaque handle this cart is known by in the connector's BACK OFFICE — the
4992
5140
  * value a space owner searches there to find the order this cart became.
@@ -4999,14 +5147,14 @@ var CartSchema = z39.object({
4999
5147
  * Absent when the platform has no such handle, or while the cart is still the
5000
5148
  * client's optimistic paint and its id is client-minted.
5001
5149
  */
5002
- backOfficeRef: z39.string().optional(),
5150
+ backOfficeRef: z40.string().optional(),
5003
5151
  /**
5004
5152
  * URL that recreates this cart on the merchant's own store website
5005
5153
  * (replace semantics — overwrites any cart the visitor already has
5006
5154
  * there). Populated by platform adapters that support it; absent when
5007
5155
  * the cart is empty or the URL cannot be built.
5008
5156
  */
5009
- storeCartUrl: z39.string().optional(),
5157
+ storeCartUrl: z40.string().optional(),
5010
5158
  /**
5011
5159
  * True while this cart exists only in the client's optimistic paint —
5012
5160
  * no backend cart has been created yet, so its `id` is client-minted and
@@ -5014,7 +5162,7 @@ var CartSchema = z39.object({
5014
5162
  * `CartLineSchema.pending`: the adapter never sets it, and callers that
5015
5163
  * need a real cart id read THIS rather than sniffing the id's shape.
5016
5164
  */
5017
- pending: z39.boolean().optional()
5165
+ pending: z40.boolean().optional()
5018
5166
  });
5019
5167
  function settledCart(cart) {
5020
5168
  if (cart === null || cart === void 0) return null;
@@ -5022,27 +5170,27 @@ function settledCart(cart) {
5022
5170
  }
5023
5171
 
5024
5172
  // ../ecommerce/src/review-schemas.ts
5025
- import { z as z40 } from "zod";
5173
+ import { z as z41 } from "zod";
5026
5174
  var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
5027
- var ProductReviewItemSchema = z40.object({
5028
- author: z40.string(),
5029
- rating: z40.number(),
5175
+ var ProductReviewItemSchema = z41.object({
5176
+ author: z41.string(),
5177
+ rating: z41.number(),
5030
5178
  /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
5031
- title: z40.string().optional(),
5032
- content: z40.string(),
5033
- date: z40.string(),
5034
- verified: z40.boolean().optional(),
5179
+ title: z41.string().optional(),
5180
+ content: z41.string(),
5181
+ date: z41.string(),
5182
+ verified: z41.boolean().optional(),
5035
5183
  /**
5036
5184
  * Non-empty when the review was written for a grouped SIBLING product rather
5037
5185
  * than this one (brands pool reviews across a product line). A surface can
5038
5186
  * attribute it; empty / absent ⇒ the product's own review.
5039
5187
  */
5040
- writtenFor: z40.string().optional()
5188
+ writtenFor: z41.string().optional()
5041
5189
  });
5042
5190
  var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
5043
5191
  /** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
5044
5192
  * scored, NOT necessarily text that occurs in `content`. */
5045
- highlight: z40.string().optional(),
5193
+ highlight: z41.string().optional(),
5046
5194
  /**
5047
5195
  * `highlight` resolved back into `content` as a VERBATIM substring, so a
5048
5196
  * surface can mark it with a plain `indexOf` and no matcher of its own.
@@ -5057,29 +5205,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
5057
5205
  * Absent when the passage genuinely has no home in the body (one cut from the
5058
5206
  * title). A surface then marks NOTHING rather than guessing at a span.
5059
5207
  */
5060
- mark: z40.string().optional()
5208
+ mark: z41.string().optional()
5061
5209
  });
5062
- var ReviewAggregateSchema = z40.object({
5063
- value: z40.number(),
5064
- count: z40.number()
5210
+ var ReviewAggregateSchema = z41.object({
5211
+ value: z41.number(),
5212
+ count: z41.number()
5065
5213
  });
5066
- var ProductReviewDataSchema = z40.object({
5067
- id: z40.string(),
5214
+ var ProductReviewDataSchema = z41.object({
5215
+ id: z41.string(),
5068
5216
  /** The product's FULL retrieved set — what a filterable list renders. */
5069
- reviews: z40.array(ProductReviewItemSchema).default([]),
5217
+ reviews: z41.array(ProductReviewItemSchema).default([]),
5070
5218
  aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
5071
5219
  /** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
5072
- distribution: z40.array(z40.number()).default([]),
5220
+ distribution: z41.array(z41.number()).default([]),
5073
5221
  /**
5074
5222
  * The reviews that ANSWER the surface's intent, best first. Empty when no
5075
5223
  * intent was asked for — never a silent copy of `reviews`.
5076
5224
  */
5077
- highlights: z40.array(ProductReviewHighlightSchema).default([]),
5225
+ highlights: z41.array(ProductReviewHighlightSchema).default([]),
5078
5226
  /**
5079
5227
  * True when the review provider could not be read and nothing is indexed —
5080
5228
  * the empty lists mean "not loaded", NOT "this product has no reviews".
5081
5229
  */
5082
- unavailable: z40.boolean().optional()
5230
+ unavailable: z41.boolean().optional()
5083
5231
  });
5084
5232
  var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
5085
5233
 
@@ -5373,9 +5521,9 @@ function readPdpCompanions(config) {
5373
5521
  }
5374
5522
 
5375
5523
  // ../ecommerce/src/base-attributes.ts
5376
- import { z as z41 } from "zod";
5524
+ import { z as z42 } from "zod";
5377
5525
  var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
5378
- var BaseAttributesRecordSchema = z41.record(z41.string(), AttributeDefSchema);
5526
+ var BaseAttributesRecordSchema = z42.record(z42.string(), AttributeDefSchema);
5379
5527
  function buildBaseAttributesConfig(attributes) {
5380
5528
  return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
5381
5529
  }
@@ -5386,9 +5534,9 @@ function readBaseAttributesConfig(config) {
5386
5534
  }
5387
5535
 
5388
5536
  // ../ecommerce/src/bucket-labels.ts
5389
- import { z as z42 } from "zod";
5537
+ import { z as z43 } from "zod";
5390
5538
  var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
5391
- var BucketLabelsRecordSchema = z42.record(z42.string(), z42.string());
5539
+ var BucketLabelsRecordSchema = z43.record(z43.string(), z43.string());
5392
5540
  function buildBucketLabelsConfig(labels) {
5393
5541
  return { [BUCKET_LABELS_CONFIG_KEY]: labels };
5394
5542
  }
@@ -6562,8 +6710,8 @@ var PRESENCE_LIFECYCLE = {
6562
6710
  };
6563
6711
 
6564
6712
  // ../spacestation/src/widgets/presence/profile.ts
6565
- import { z as z43 } from "zod";
6566
- var PresenceProfileSchema = z43.object({
6713
+ import { z as z44 } from "zod";
6714
+ var PresenceProfileSchema = z44.object({
6567
6715
  /**
6568
6716
  * How much the agent SPEAKS in presence.
6569
6717
  * - 'off' the faculty generates no prose at all. Zero tokens, and
@@ -6573,14 +6721,14 @@ var PresenceProfileSchema = z43.object({
6573
6721
  * - 'terse' one lead line per turn. The default — see below.
6574
6722
  * - 'full' a lead line plus asides beside individual elements.
6575
6723
  */
6576
- voice: z43.enum(["off", "terse", "full"]),
6724
+ voice: z44.enum(["off", "terse", "full"]),
6577
6725
  /**
6578
6726
  * Which source kinds this space surfaces. 'all' = every tool that declares a
6579
6727
  * `sourceKind`. An explicit list lets a space stay quiet about lookups its
6580
6728
  * visitors would find uninteresting (policy checks on a fashion space)
6581
6729
  * without the tool having to lie about what it is.
6582
6730
  */
6583
- sources: z43.union([z43.array(z43.string()), z43.literal("all")]),
6731
+ sources: z44.union([z44.array(z44.string()), z44.literal("all")]),
6584
6732
  /**
6585
6733
  * Which facts render.
6586
6734
  * - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
@@ -6589,7 +6737,7 @@ var PresenceProfileSchema = z43.object({
6589
6737
  * - 'all' shows stated facts too — for spaces where confirming the brief
6590
6738
  * back is itself the product (intake, configuration).
6591
6739
  */
6592
- facts: z43.enum(["inferred-only", "all"])
6740
+ facts: z44.enum(["inferred-only", "all"])
6593
6741
  });
6594
6742
  var DEFAULT_PRESENCE_PROFILE = {
6595
6743
  voice: "terse",
@@ -6773,7 +6921,7 @@ function useAgentPresenceFresh(flowId = PRESENCE_FLOW) {
6773
6921
  }
6774
6922
 
6775
6923
  // src/widgets/presence/use-layout-entity-ids.ts
6776
- import { useMemo as useMemo3 } from "react";
6924
+ import { useMemo as useMemo5 } from "react";
6777
6925
 
6778
6926
  // src/catalog/CatalogContext.tsx
6779
6927
  import { createContext as createContext8, useContext as useContext8 } from "react";
@@ -6803,7 +6951,7 @@ function collectLayoutGids(layout, catalog) {
6803
6951
  function useLayoutEntityIds() {
6804
6952
  const layout = useLayout();
6805
6953
  const catalog = useComponentCatalog();
6806
- return useMemo3(() => [...collectLayoutGids(layout, catalog)], [layout, catalog]);
6954
+ return useMemo5(() => [...collectLayoutGids(layout, catalog)], [layout, catalog]);
6807
6955
  }
6808
6956
 
6809
6957
  // src/widgets/presence/use-presence.ts
@@ -8519,22 +8667,22 @@ function buildComponentLibrary(catalog, componentMap) {
8519
8667
  }
8520
8668
 
8521
8669
  // src/catalog/define.ts
8522
- import { z as z44 } from "zod";
8670
+ import { z as z45 } from "zod";
8523
8671
  function entity(resolverKey, opts) {
8524
- return resolved(z44.string(), resolverKey, opts);
8672
+ return resolved(z45.string(), resolverKey, opts);
8525
8673
  }
8526
- var text = prose(z44.string());
8674
+ var text = prose(z45.string());
8527
8675
  function plain() {
8528
- return z44.string();
8676
+ return z45.string();
8529
8677
  }
8530
8678
  function token(values) {
8531
- return z44.enum(values);
8679
+ return z45.enum(values);
8532
8680
  }
8533
8681
  function catalogComponent(meta, render) {
8534
8682
  const { props, requires, ...rest } = meta;
8535
8683
  return {
8536
8684
  ...rest,
8537
- propsSchema: z44.object(props),
8685
+ propsSchema: z45.object(props),
8538
8686
  ...requires !== void 0 ? { requires } : {},
8539
8687
  component: adaptComponent(render)
8540
8688
  };
@@ -8760,7 +8908,7 @@ __export(presence_exports2, {
8760
8908
  });
8761
8909
 
8762
8910
  // src/widgets/presence/use-standing-signal.ts
8763
- import { useMemo as useMemo7 } from "react";
8911
+ import { useMemo as useMemo9 } from "react";
8764
8912
 
8765
8913
  // src/widgets/presence/core-presence/standing-signal-store.ts
8766
8914
  import { useSyncExternalStore as useSyncExternalStore3 } from "react";
@@ -8844,7 +8992,7 @@ function useConsumeStandingSignal(type) {
8844
8992
  const session = useFourtySession();
8845
8993
  const scope2 = session.sessionId === null ? void 0 : session.sessionId;
8846
8994
  useRegisterSignalHandlers(
8847
- useMemo7(
8995
+ useMemo9(
8848
8996
  () => ({
8849
8997
  [type]: (payload) => {
8850
8998
  const id = typeof payload.id === "string" && payload.id.length > 0 ? payload.id : type;
@@ -8855,7 +9003,7 @@ function useConsumeStandingSignal(type) {
8855
9003
  )
8856
9004
  );
8857
9005
  const standing = useStandingOfType(type);
8858
- return useMemo7(() => {
9006
+ return useMemo9(() => {
8859
9007
  if (standing === null) return null;
8860
9008
  const id = standing.id;
8861
9009
  return {
@@ -9329,7 +9477,7 @@ function usePostHydrationTransforms() {
9329
9477
  }
9330
9478
 
9331
9479
  // src/projection/transform.ts
9332
- import { useMemo as useMemo9 } from "react";
9480
+ import { useMemo as useMemo11 } from "react";
9333
9481
 
9334
9482
  // src/projection/preferences.ts
9335
9483
  import { useSyncExternalStore as useSyncExternalStore4 } from "react";
@@ -9457,7 +9605,7 @@ var projectionTransform = {
9457
9605
  use: () => {
9458
9606
  const preferences2 = useProjectionPreferences();
9459
9607
  const facts = useFacts();
9460
- return useMemo9(() => {
9608
+ return useMemo11(() => {
9461
9609
  if (Object.keys(preferences2).length === 0) return null;
9462
9610
  return buildTransform(preferences2, facts);
9463
9611
  }, [preferences2, facts]);
@@ -9719,14 +9867,14 @@ function useFormFactor() {
9719
9867
  }
9720
9868
 
9721
9869
  // src/utils/use-inline-completion.ts
9722
- import { useCallback as useCallback15, useMemo as useMemo10, useState as useState8 } from "react";
9870
+ import { useCallback as useCallback15, useMemo as useMemo12, useState as useState8 } from "react";
9723
9871
  function useInlineCompletion(opts) {
9724
9872
  const { value, candidates } = opts;
9725
9873
  const minChars = opts.minChars !== void 0 ? opts.minChars : 2;
9726
9874
  const enabled = opts.enabled !== void 0 ? opts.enabled : true;
9727
9875
  const [dismissedValue, setDismissedValue] = useState8(null);
9728
9876
  const dismiss = useCallback15(() => setDismissedValue(value), [value]);
9729
- return useMemo10(() => {
9877
+ return useMemo12(() => {
9730
9878
  if (!enabled || value.length < minChars || dismissedValue === value) {
9731
9879
  return { completion: "", ghost: "", active: false, dismiss };
9732
9880
  }
@@ -10570,18 +10718,18 @@ __export(ecommerce_exports, {
10570
10718
  });
10571
10719
 
10572
10720
  // ../spacestation/src/analytics/ecommerce/surfacing.ts
10573
- import { z as z45 } from "zod";
10721
+ import { z as z46 } from "zod";
10574
10722
  var PRODUCTS_SURFACED = defineEventKind(
10575
10723
  "commerce.products_surfaced",
10576
10724
  "client",
10577
- z45.object({
10725
+ z46.object({
10578
10726
  /** The turn whose commit this describes. Minted where the prompt signal
10579
10727
  * is built and shared with `agent_runs`, so the read layer can line a
10580
10728
  * surfacing up against the prompt that asked for it. */
10581
- turnId: z45.string().min(1).max(128),
10729
+ turnId: z46.string().min(1).max(128),
10582
10730
  /** Distinct entity refs this turn placed that were not on the canvas
10583
10731
  * before it. ZERO IS A REAL VALUE — see the header. */
10584
- productCount: z45.number().int().nonnegative()
10732
+ productCount: z46.number().int().nonnegative()
10585
10733
  }).strict()
10586
10734
  );
10587
10735
 
@@ -10603,14 +10751,14 @@ function isFunnelStep(value) {
10603
10751
  }
10604
10752
 
10605
10753
  // src/verticals/commerce/product/use-product-grid-filter.ts
10606
- import { useCallback as useCallback17, useMemo as useMemo12, useState as useState11 } from "react";
10754
+ import { useCallback as useCallback17, useMemo as useMemo14, useState as useState11 } from "react";
10607
10755
  function useProductGridFilter(chips) {
10608
- const labelKey = useMemo12(() => chips.map((c) => c.label).join("|"), [chips]);
10756
+ const labelKey = useMemo14(() => chips.map((c) => c.label).join("|"), [chips]);
10609
10757
  const first = chips[0];
10610
10758
  const [activeLabel, setActiveLabel] = useState11(
10611
10759
  first !== void 0 ? first.label : null
10612
10760
  );
10613
- const activeFromKey = useMemo12(() => {
10761
+ const activeFromKey = useMemo14(() => {
10614
10762
  void labelKey;
10615
10763
  if (first === void 0) return null;
10616
10764
  const found = chips.find((c) => c.label === activeLabel);
@@ -10623,7 +10771,7 @@ function useProductGridFilter(chips) {
10623
10771
  }
10624
10772
 
10625
10773
  // src/verticals/commerce/product/use-product-detail.ts
10626
- import { useCallback as useCallback19, useMemo as useMemo13, useRef as useRef13, useState as useState14 } from "react";
10774
+ import { useCallback as useCallback19, useMemo as useMemo15, useRef as useRef13, useState as useState14 } from "react";
10627
10775
 
10628
10776
  // src/verticals/commerce/checkout/use-buy-now.ts
10629
10777
  import { useCallback as useCallback18, useEffect as useEffect16, useState as useState12 } from "react";
@@ -10918,15 +11066,15 @@ function useProductDetail(product) {
10918
11066
  }
10919
11067
  const { selectedVariants, setSelectedVariants, markTouched } = useSelectedVariantsState(product, facts);
10920
11068
  const desc = useExpandable(false);
10921
- const variantGroups = useMemo13(
11069
+ const variantGroups = useMemo15(
10922
11070
  () => deriveVariantGroups(product),
10923
11071
  [product]
10924
11072
  );
10925
- const allSelected = useMemo13(
11073
+ const allSelected = useMemo15(
10926
11074
  () => variantGroups.every((g) => selectedVariants[g.name] !== void 0),
10927
11075
  [variantGroups, selectedVariants]
10928
11076
  );
10929
- const missingGroup = useMemo13(
11077
+ const missingGroup = useMemo15(
10930
11078
  () => variantGroups.find((g) => selectedVariants[g.name] === void 0),
10931
11079
  [variantGroups, selectedVariants]
10932
11080
  );
@@ -11235,7 +11383,7 @@ function useCartView(cart, onCheckout) {
11235
11383
  }
11236
11384
 
11237
11385
  // src/verticals/commerce/cart/cart-action-failures.ts
11238
- import { useMemo as useMemo14, useSyncExternalStore as useSyncExternalStore11 } from "react";
11386
+ import { useMemo as useMemo16, useSyncExternalStore as useSyncExternalStore11 } from "react";
11239
11387
  var FAILURE_TTL_MS = 2 * 6e4;
11240
11388
  var FAILURE_CAP = 5;
11241
11389
  var failures = [];
@@ -11287,7 +11435,7 @@ function useCartActionFailures() {
11287
11435
  function useCartActionFailuresFor(productIdsInCart) {
11288
11436
  const all = useCartActionFailures();
11289
11437
  const key = productIdsInCart.join("\0");
11290
- return useMemo14(() => {
11438
+ return useMemo16(() => {
11291
11439
  const present = new Set(key.length === 0 ? [] : key.split("\0"));
11292
11440
  return all.filter((f) => f.productId !== void 0 && !present.has(f.productId));
11293
11441
  }, [all, key]);
@@ -12081,7 +12229,7 @@ function useContentActions() {
12081
12229
  import { useEffect as useEffect19, useState as useState18 } from "react";
12082
12230
 
12083
12231
  // package.json
12084
- var version = "0.5.1";
12232
+ var version = "0.5.3";
12085
12233
 
12086
12234
  // src/host/host-modules.ts
12087
12235
  import * as react from "react";
@@ -12168,12 +12316,16 @@ function Spacefront(props) {
12168
12316
  }
12169
12317
 
12170
12318
  // src/npm.ts
12171
- import { z as z47 } from "zod";
12319
+ import { z as z48 } from "zod";
12172
12320
  export {
12173
12321
  ACQUISITION_KIND_LABELS,
12174
12322
  ACTIVE_PANEL_ATTR,
12175
12323
  ACTIVE_PANEL_SELECTOR,
12176
12324
  AGENT_ASK_SIGNAL,
12325
+ AGENT_DIRECTIVE_KINDS,
12326
+ AGENT_DIRECTIVE_SEVERITIES,
12327
+ AGENT_DIRECTIVE_SOURCES,
12328
+ AGENT_DIRECTIVE_STATUSES,
12177
12329
  ALLOWED_ATTACHMENT_TYPES,
12178
12330
  ANALYTICS_CONSENTS,
12179
12331
  ANALYTICS_MAX_QUEUED,
@@ -12181,6 +12333,7 @@ export {
12181
12333
  ARRIVAL_MAX_VALUE_CHARS,
12182
12334
  ARRIVAL_PARAMS,
12183
12335
  ATTACHMENT_ACCEPT,
12336
+ AgentDirectiveSchema,
12184
12337
  AgentOutputSchema,
12185
12338
  AgentSessionSummarySchema,
12186
12339
  AgentSignalSchema,
@@ -12309,6 +12462,7 @@ export {
12309
12462
  LlmSessionsDailySchema,
12310
12463
  LlmUsageBySessionSchema,
12311
12464
  LlmUsageDailySchema,
12465
+ MAX_ACTIVE_AGENT_DIRECTIVES,
12312
12466
  MAX_ATTACHMENT_BYTES,
12313
12467
  MAX_VISITOR_PROMPT_CHARS,
12314
12468
  MIN_WIRE_PROTOCOL_VERSION,
@@ -12352,6 +12506,7 @@ export {
12352
12506
  RecordVerdictInputSchema,
12353
12507
  RecordableVerdictSchema,
12354
12508
  RegistryProvider,
12509
+ ReorderAgentDirectivesInputSchema,
12355
12510
  ReviewAggregateSchema,
12356
12511
  ReviewSchema,
12357
12512
  SCANNING_FORM,
@@ -12390,6 +12545,8 @@ export {
12390
12545
  ShellRootContext,
12391
12546
  ShimmerSweep,
12392
12547
  SiblingProductSchema,
12548
+ SpaceAgentDirectiveListItemSchema,
12549
+ SpaceAgentDirectiveSchema,
12393
12550
  SpaceBrandMarkSchema,
12394
12551
  SpaceBugSchema,
12395
12552
  Spacefront,
@@ -12412,8 +12569,10 @@ export {
12412
12569
  TransitionProvider,
12413
12570
  TurnAskPlacementProvider,
12414
12571
  TurnAskSchema,
12572
+ TurnScopeProvider,
12415
12573
  UIElementSchema,
12416
12574
  UnsupportedSchemaError,
12575
+ UpdateAgentDirectiveInputSchema,
12417
12576
  UpdateCommentInputSchema,
12418
12577
  VARIANT_SELECTED_OBSERVATION,
12419
12578
  VIEW_EXHAUSTED_SIGNAL,
@@ -12815,6 +12974,7 @@ export {
12815
12974
  useTurnAsk,
12816
12975
  useTurnAskPlacement,
12817
12976
  useTurnAskReply,
12977
+ useTurnScope,
12818
12978
  useUndismissedFacts,
12819
12979
  useVariantSelections,
12820
12980
  useViewportWindow,
@@ -12832,5 +12992,5 @@ export {
12832
12992
  wipeProfile,
12833
12993
  withCartActorOrigin,
12834
12994
  withInteractionTracking,
12835
- z47 as z
12995
+ z48 as z
12836
12996
  };