@40rty/ams-sdk 0.5.5 → 0.5.7

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 (26) hide show
  1. package/dist/index.js +872 -694
  2. package/dist/types/ecommerce/src/code-discounts.d.ts +47 -0
  3. package/dist/types/ecommerce/src/commerce-schemas.d.ts +16 -6
  4. package/dist/types/ecommerce/src/index.d.ts +1 -0
  5. package/dist/types/sdk/src/canvas/hydration-notice.d.ts +23 -0
  6. package/dist/types/sdk/src/canvas/index.d.ts +1 -0
  7. package/dist/types/sdk/src/catalog/registration/types.d.ts +4 -3
  8. package/dist/types/sdk/src/host/host-modules.d.ts +43 -14
  9. package/dist/types/sdk/src/session/index.d.ts +2 -1
  10. package/dist/types/sdk/src/session/space-locale-context.d.ts +10 -0
  11. package/dist/types/sdk/src/session/visitor-locale.d.ts +15 -0
  12. package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +4 -3
  13. package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +6 -2
  14. package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +16 -0
  15. package/dist/types/sdk/src/verticals/commerce/comparison/comparison-rows.d.ts +11 -2
  16. package/dist/types/sdk/src/verticals/commerce/index.d.ts +3 -3
  17. package/dist/types/sdk/src/verticals/commerce/price/format-price.d.ts +3 -2
  18. package/dist/types/spacestation/src/attachment/attachment-failure.d.ts +32 -0
  19. package/dist/types/spacestation/src/contracts/tools/definitions.d.ts +9 -0
  20. package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
  21. package/dist/types/spacestation/src/index.d.ts +4 -1
  22. package/dist/types/spacestation/src/signal/agent-signals.d.ts +36 -0
  23. package/dist/types/spacestation/src/space/session-queue.d.ts +8 -8
  24. package/dist/types/spacestation/src/space/space-config.d.ts +4 -0
  25. package/dist/types/spacestation/src/space/space-locale.d.ts +46 -0
  26. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ __export(src_exports3, {
34
34
  AssetSchema: () => AssetSchema,
35
35
  AttachmentRefSchema: () => AttachmentRefSchema,
36
36
  AttachmentRefsSchema: () => AttachmentRefsSchema,
37
+ AttachmentUploadError: () => AttachmentUploadError,
37
38
  AttributeDefSchema: () => AttributeDefSchema,
38
39
  AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
39
40
  AttributeScopeConfigSchema: () => AttributeScopeConfigSchema,
@@ -101,6 +102,7 @@ __export(src_exports3, {
101
102
  DEFAULT_HOSTING: () => DEFAULT_HOSTING,
102
103
  DEFAULT_PRESENCE_PROFILE: () => DEFAULT_PRESENCE_PROFILE,
103
104
  DEFAULT_SPACE_CONFIG: () => DEFAULT_SPACE_CONFIG,
105
+ DEFAULT_SPACE_LOCALE: () => DEFAULT_SPACE_LOCALE,
104
106
  DEFAULT_VISITOR_ACCESS: () => DEFAULT_VISITOR_ACCESS,
105
107
  DIRECTION_FLOW: () => DIRECTION_FLOW,
106
108
  DROP_REASONS: () => DROP_REASONS,
@@ -141,6 +143,7 @@ __export(src_exports3, {
141
143
  HandlerRegistryContext: () => HandlerRegistryContext,
142
144
  HostClearedSchema: () => HostClearedSchema,
143
145
  HostPayloadSchema: () => HostPayloadSchema,
146
+ HydrationNoticeProvider: () => HydrationNoticeProvider,
144
147
  HydrationStateContext: () => HydrationStateContext,
145
148
  HydratorProvider: () => HydratorProvider,
146
149
  INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
@@ -157,6 +160,7 @@ __export(src_exports3, {
157
160
  LlmUsageDailySchema: () => LlmUsageDailySchema,
158
161
  MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
159
162
  MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
163
+ MAX_ATTACHMENT_MB: () => MAX_ATTACHMENT_MB,
160
164
  MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
161
165
  MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
162
166
  MOBILE_VIEWPORT_MAX: () => MOBILE_VIEWPORT_MAX,
@@ -211,6 +215,7 @@ __export(src_exports3, {
211
215
  SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
212
216
  STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
213
217
  STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
218
+ SUPPORTED_SPACE_LOCALES: () => SUPPORTED_SPACE_LOCALES,
214
219
  SURFACES: () => SURFACES,
215
220
  SURFACE_DISPOSITION: () => SURFACE_DISPOSITION,
216
221
  ScrollContainerProvider: () => ScrollContainerProvider,
@@ -243,6 +248,8 @@ __export(src_exports3, {
243
248
  SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
244
249
  SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
245
250
  SpaceBugSchema: () => SpaceBugSchema,
251
+ SpaceLocaleProvider: () => SpaceLocaleProvider,
252
+ SpaceLocaleSchema: () => SpaceLocaleSchema,
246
253
  SpacefrontCanvas: () => SpacefrontCanvas,
247
254
  SpacefrontPreviewProvider: () => SpacefrontPreviewProvider,
248
255
  SpecSchema: () => SpecSchema,
@@ -300,6 +307,7 @@ __export(src_exports3, {
300
307
  arraysEqual: () => arraysEqual,
301
308
  arrivalFromParams: () => arrivalFromParams,
302
309
  arrivalToParams: () => arrivalToParams,
310
+ attachmentFailureOfStatus: () => attachmentFailureOfStatus,
303
311
  bareComponentType: () => bareComponentType,
304
312
  buildBaseAttributesConfig: () => buildBaseAttributesConfig,
305
313
  buildBucketLabelsConfig: () => buildBucketLabelsConfig,
@@ -324,6 +332,7 @@ __export(src_exports3, {
324
332
  classifyItemChange: () => classifyItemChange,
325
333
  clearAgentPresence: () => clearAgentPresence,
326
334
  clearCartActionFailures: () => clearCartActionFailures,
335
+ clearCodeDiscountSources: () => clearCodeDiscountSources,
327
336
  clearProductNameLookups: () => clearProductNameLookups,
328
337
  clearVariantChoice: () => clearVariantChoice,
329
338
  clientStateEntries: () => clientStateEntries,
@@ -333,6 +342,7 @@ __export(src_exports3, {
333
342
  collectLayoutGids: () => collectLayoutGids,
334
343
  collectPlacedEntityRefs: () => collectPlacedEntityRefs,
335
344
  colorHexOf: () => colorHexOf,
345
+ commerceLocaleOf: () => commerceLocaleOf,
336
346
  compareSdkVersions: () => compareSdkVersions,
337
347
  compressArray: () => compressArray,
338
348
  compressString: () => compressString,
@@ -347,6 +357,7 @@ __export(src_exports3, {
347
357
  createSessionStorageAdapter: () => createSessionStorageAdapter,
348
358
  createTokenOverlapScorer: () => createTokenOverlapScorer,
349
359
  createUnavailableProduct: () => createUnavailableProduct,
360
+ declaredSpaceLocaleOf: () => declaredSpaceLocaleOf,
350
361
  defineEventKind: () => defineEventKind,
351
362
  derivePropsDoc: () => derivePropsDoc,
352
363
  deriveSourceElement: () => deriveSourceElement,
@@ -405,6 +416,8 @@ __export(src_exports3, {
405
416
  isPresenceStreamArtifact: () => isPresenceStreamArtifact,
406
417
  isReservedId: () => isReservedId,
407
418
  isVideoUrl: () => isVideoUrl,
419
+ languageNameOf: () => languageNameOf,
420
+ languageOf: () => languageOf,
408
421
  layoutTopWithin: () => layoutTopWithin,
409
422
  listRegisteredPlatforms: () => listRegisteredPlatforms,
410
423
  listRegisteredServices: () => listRegisteredServices,
@@ -457,6 +470,7 @@ __export(src_exports3, {
457
470
  reducePatch: () => reducePatch,
458
471
  refuseCheckoutHandoff: () => refuseCheckoutHandoff,
459
472
  registerChipRelevanceRule: () => registerChipRelevanceRule,
473
+ registerCodeDiscountSource: () => registerCodeDiscountSource,
460
474
  registerComponent: () => registerComponent,
461
475
  registerEntityPageKind: () => registerEntityPageKind,
462
476
  registerExclusiveOverlay: () => registerExclusiveOverlay,
@@ -481,6 +495,7 @@ __export(src_exports3, {
481
495
  requestVariantChoice: () => requestVariantChoice,
482
496
  requiredTopLevelProps: () => requiredTopLevelProps,
483
497
  resetServerState: () => resetServerState,
498
+ resolveCodeDiscountSource: () => resolveCodeDiscountSource,
484
499
  resolveHydrators: () => resolveHydrators,
485
500
  resolvePresenceFactForm: () => resolvePresenceFactForm,
486
501
  resolvePresenceForm: () => resolvePresenceForm,
@@ -516,6 +531,7 @@ __export(src_exports3, {
516
531
  settleArmedCheckoutHandoff: () => settleArmedCheckoutHandoff,
517
532
  settledBlocks: () => settledBlocks,
518
533
  settledCart: () => settledCart,
534
+ spaceLocaleOf: () => spaceLocaleOf,
519
535
  splitAnswer: () => splitAnswer,
520
536
  splitSentences: () => splitSentences,
521
537
  stateSnapshotSignal: () => stateSnapshotSignal,
@@ -526,6 +542,7 @@ __export(src_exports3, {
526
542
  surfaceEmits: () => surfaceEmits,
527
543
  surfaceSuppressionReason: () => surfaceSuppressionReason,
528
544
  text: () => text,
545
+ textDirectionOf: () => textDirectionOf,
529
546
  threadRowAttrs: () => threadRowAttrs,
530
547
  toggleCartDrawer: () => toggleCartDrawer,
531
548
  token: () => token,
@@ -580,6 +597,7 @@ __export(src_exports3, {
580
597
  useConversationState: () => useConversationState,
581
598
  useConversations: () => useConversations,
582
599
  useCurrentMessageIndex: () => useCurrentMessageIndex,
600
+ useCustomerAccount: () => useCustomerAccount,
583
601
  useDebug: () => useDebug,
584
602
  useDictation: () => useDictation,
585
603
  useDismissedLabels: () => useDismissedLabels,
@@ -605,6 +623,7 @@ __export(src_exports3, {
605
623
  useHasLeftSeedHome: () => useHasLeftSeedHome,
606
624
  useHistoryNav: () => useHistoryNav,
607
625
  useHydrated: () => useHydrated,
626
+ useHydrationNotice: () => useHydrationNotice,
608
627
  useHydrationState: () => useHydrationState,
609
628
  useHydrators: () => useHydrators,
610
629
  useInlineCompletion: () => useInlineCompletion,
@@ -659,10 +678,12 @@ __export(src_exports3, {
659
678
  useSessionState: () => useSessionState,
660
679
  useShellRegistry: () => useShellRegistry,
661
680
  useShellRoot: () => useShellRoot,
681
+ useSpaceLocale: () => useSpaceLocale,
662
682
  useStandingOfType: () => useStandingOfType,
663
683
  useStream: () => useStream,
664
684
  useSuccessFlash: () => useSuccessFlash,
665
685
  useSuggestionsWithDefaults: () => useSuggestionsWithDefaults,
686
+ useTextDirection: () => useTextDirection,
666
687
  useThreadJumpMarks: () => useThreadJumpMarks,
667
688
  useThreadLanding: () => useThreadLanding,
668
689
  useThreadRows: () => useThreadRows,
@@ -1437,6 +1458,8 @@ function useOptionalAnalyticsSink() {
1437
1458
  var session_exports = {};
1438
1459
  __export(session_exports, {
1439
1460
  FourtySessionContext: () => FourtySessionContext,
1461
+ SpaceLocaleProvider: () => SpaceLocaleProvider,
1462
+ commerceLocaleOf: () => commerceLocaleOf,
1440
1463
  getVisitorLocale: () => getVisitorLocale,
1441
1464
  registerSessionScopedClear: () => registerSessionScopedClear,
1442
1465
  runSessionScopedClearHandlers: () => runSessionScopedClearHandlers,
@@ -1444,6 +1467,8 @@ __export(session_exports, {
1444
1467
  useComposerDraft: () => useComposerDraft,
1445
1468
  useFourtySession: () => useFourtySession,
1446
1469
  useOptionalFourtySession: () => useOptionalFourtySession,
1470
+ useSpaceLocale: () => useSpaceLocale,
1471
+ useTextDirection: () => useTextDirection,
1447
1472
  withSignalTurn: () => withSignalTurn
1448
1473
  });
1449
1474
 
@@ -1469,6 +1494,7 @@ __export(src_exports, {
1469
1494
  AgentSignalSchema: () => AgentSignalSchema,
1470
1495
  AttachmentRefSchema: () => AttachmentRefSchema,
1471
1496
  AttachmentRefsSchema: () => AttachmentRefsSchema,
1497
+ AttachmentUploadError: () => AttachmentUploadError,
1472
1498
  AttributeDefSchema: () => AttributeDefSchema,
1473
1499
  AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
1474
1500
  AttributeScopeConfigSchema: () => AttributeScopeConfigSchema,
@@ -1503,6 +1529,7 @@ __export(src_exports, {
1503
1529
  CreateTraceInputSchema: () => CreateTraceInputSchema,
1504
1530
  DEFAULT_HOSTING: () => DEFAULT_HOSTING,
1505
1531
  DEFAULT_SPACE_CONFIG: () => DEFAULT_SPACE_CONFIG,
1532
+ DEFAULT_SPACE_LOCALE: () => DEFAULT_SPACE_LOCALE,
1506
1533
  DEFAULT_VISITOR_ACCESS: () => DEFAULT_VISITOR_ACCESS,
1507
1534
  DIRECTION_FLOW: () => DIRECTION_FLOW,
1508
1535
  DirectiveValueSchema: () => DirectiveValueSchema,
@@ -1534,6 +1561,7 @@ __export(src_exports, {
1534
1561
  LlmUsageDailySchema: () => LlmUsageDailySchema,
1535
1562
  MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
1536
1563
  MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
1564
+ MAX_ATTACHMENT_MB: () => MAX_ATTACHMENT_MB,
1537
1565
  MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
1538
1566
  MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
1539
1567
  MOBILE_VIEWPORT_MAX: () => MOBILE_VIEWPORT_MAX,
@@ -1567,6 +1595,7 @@ __export(src_exports, {
1567
1595
  SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
1568
1596
  STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
1569
1597
  STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
1598
+ SUPPORTED_SPACE_LOCALES: () => SUPPORTED_SPACE_LOCALES,
1570
1599
  SURFACES: () => SURFACES,
1571
1600
  SdkVersionSchema: () => SdkVersionSchema,
1572
1601
  SessionActivityEventSchema: () => SessionActivityEventSchema,
@@ -1592,6 +1621,7 @@ __export(src_exports, {
1592
1621
  SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
1593
1622
  SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
1594
1623
  SpaceBugSchema: () => SpaceBugSchema,
1624
+ SpaceLocaleSchema: () => SpaceLocaleSchema,
1595
1625
  SpecSchema: () => SpecSchema,
1596
1626
  StateSnapshotFrameSchema: () => StateSnapshotFrameSchema,
1597
1627
  SuggestionActionSchema: () => SuggestionActionSchema,
@@ -1633,6 +1663,7 @@ __export(src_exports, {
1633
1663
  applySinglePatch: () => applySinglePatch,
1634
1664
  arrivalFromParams: () => arrivalFromParams,
1635
1665
  arrivalToParams: () => arrivalToParams,
1666
+ attachmentFailureOfStatus: () => attachmentFailureOfStatus,
1636
1667
  bareComponentType: () => bareComponentType,
1637
1668
  canonicalOptionValue: () => canonicalOptionValue,
1638
1669
  carriesShapeToken: () => carriesShapeToken,
@@ -1644,6 +1675,7 @@ __export(src_exports, {
1644
1675
  compressArray: () => compressArray,
1645
1676
  compressString: () => compressString,
1646
1677
  createTokenOverlapScorer: () => createTokenOverlapScorer,
1678
+ declaredSpaceLocaleOf: () => declaredSpaceLocaleOf,
1647
1679
  derivePropsDoc: () => derivePropsDoc,
1648
1680
  derivedSourceFilled: () => derivedSourceFilled,
1649
1681
  diffLayouts: () => diffLayouts,
@@ -1667,6 +1699,8 @@ __export(src_exports, {
1667
1699
  isLateBound: () => isLateBound,
1668
1700
  isOptionalTopLevelProp: () => isOptionalTopLevelProp,
1669
1701
  isReservedId: () => isReservedId,
1702
+ languageNameOf: () => languageNameOf,
1703
+ languageOf: () => languageOf,
1670
1704
  namespaceFromSnapshotSignal: () => namespaceFromSnapshotSignal,
1671
1705
  normalizeAttributeField: () => normalizeAttributeField,
1672
1706
  normalizeRefs: () => normalizeRefs,
@@ -1698,9 +1732,11 @@ __export(src_exports, {
1698
1732
  sdkShimsFor: () => sdkShimsFor,
1699
1733
  sdkWindowProblem: () => sdkWindowProblem,
1700
1734
  settledBlocks: () => settledBlocks,
1735
+ spaceLocaleOf: () => spaceLocaleOf,
1701
1736
  splitSentences: () => splitSentences,
1702
1737
  stateSnapshotSignal: () => stateSnapshotSignal,
1703
1738
  statedValueVerdict: () => statedValueVerdict,
1739
+ textDirectionOf: () => textDirectionOf,
1704
1740
  tokenize: () => tokenize,
1705
1741
  turnAskAnswers: () => turnAskAnswers,
1706
1742
  turnAskFromSignal: () => turnAskFromSignal,
@@ -3733,6 +3769,22 @@ var AttachmentRefSchema = z33.object({
3733
3769
  });
3734
3770
  var AttachmentRefsSchema = z33.array(AttachmentRefSchema);
3735
3771
 
3772
+ // ../spacestation/src/attachment/attachment-failure.ts
3773
+ var MAX_ATTACHMENT_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
3774
+ var AttachmentUploadError = class extends Error {
3775
+ constructor(failure, detail) {
3776
+ super(detail);
3777
+ this.failure = failure;
3778
+ this.name = "AttachmentUploadError";
3779
+ }
3780
+ };
3781
+ function attachmentFailureOfStatus(status, mimeType) {
3782
+ if (status === 400) return { kind: "empty" };
3783
+ if (status === 413) return { kind: "too_large", maxMb: MAX_ATTACHMENT_MB };
3784
+ if (status === 415) return { kind: "unsupported_type", mimeType };
3785
+ return { kind: "upload_failed" };
3786
+ }
3787
+
3736
3788
  // ../spacestation/src/contracts/entry-context.ts
3737
3789
  import { z as z34 } from "zod";
3738
3790
  var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
@@ -3986,6 +4038,45 @@ var UpdateAgentDirectiveInputSchema = z37.object({
3986
4038
  }).strict();
3987
4039
  var ReorderAgentDirectivesInputSchema = z37.object({ ids: z37.array(z37.string()).min(1) }).strict();
3988
4040
 
4041
+ // ../spacestation/src/space/space-locale.ts
4042
+ import { z as z38 } from "zod";
4043
+ var DEFAULT_SPACE_LOCALE = "en-US";
4044
+ function isBcp47(tag) {
4045
+ try {
4046
+ return new Intl.Locale(tag).language.length > 0;
4047
+ } catch (err) {
4048
+ if (err instanceof RangeError) return false;
4049
+ throw err;
4050
+ }
4051
+ }
4052
+ var SpaceLocaleSchema = z38.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
4053
+ var RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Nkoo", "Adlm", "Rohg", "Mand", "Samr"]);
4054
+ var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb", "syr"]);
4055
+ function textDirectionOf(locale) {
4056
+ const parsed = new Intl.Locale(locale);
4057
+ if (parsed.script !== void 0) return RTL_SCRIPTS.has(parsed.script) ? "rtl" : "ltr";
4058
+ return RTL_LANGUAGES.has(parsed.language) ? "rtl" : "ltr";
4059
+ }
4060
+ function languageOf(locale) {
4061
+ return new Intl.Locale(locale).language;
4062
+ }
4063
+ function languageNameOf(locale) {
4064
+ const name = new Intl.DisplayNames(["en"], { type: "language" }).of(languageOf(locale));
4065
+ if (name === void 0) throw new Error(`no display name for locale ${locale}`);
4066
+ return name;
4067
+ }
4068
+ var SUPPORTED_SPACE_LOCALES = ["en-US", "he-IL"];
4069
+ function declaredSpaceLocaleOf(config) {
4070
+ if (config === null || config === void 0) return void 0;
4071
+ const raw = config.locale;
4072
+ if (raw === void 0) return void 0;
4073
+ return SpaceLocaleSchema.parse(raw);
4074
+ }
4075
+ function spaceLocaleOf(config) {
4076
+ const declared = declaredSpaceLocaleOf(config);
4077
+ return declared === void 0 ? DEFAULT_SPACE_LOCALE : declared;
4078
+ }
4079
+
3989
4080
  // ../spacestation/src/space/workspace-catalog.ts
3990
4081
  var COMPONENT_SOURCE = {
3991
4082
  ui: "@fourty/ui"
@@ -4048,30 +4139,30 @@ function hostingAllows(hosting, surface) {
4048
4139
  }
4049
4140
 
4050
4141
  // ../spacestation/src/space/trace.ts
4051
- import { z as z38 } from "zod";
4052
- var RunTokenUsageSchema = z38.object({
4053
- input_tokens: z38.number().optional(),
4054
- output_tokens: z38.number().optional(),
4055
- cache_read_tokens: z38.number().optional()
4142
+ import { z as z39 } from "zod";
4143
+ var RunTokenUsageSchema = z39.object({
4144
+ input_tokens: z39.number().optional(),
4145
+ output_tokens: z39.number().optional(),
4146
+ cache_read_tokens: z39.number().optional()
4056
4147
  });
4057
- var TraceRecordSchema = z38.object({
4058
- id: z38.string().uuid(),
4059
- spaceId: z38.string().uuid().nullable(),
4060
- sessionId: z38.string(),
4148
+ var TraceRecordSchema = z39.object({
4149
+ id: z39.string().uuid(),
4150
+ spaceId: z39.string().uuid().nullable(),
4151
+ sessionId: z39.string(),
4061
4152
  /** OTP-verified visitor email the session was unlocked with, or `null`
4062
4153
  * for an unlocked space / anonymous unlock. */
4063
- visitorEmail: z38.string().nullable(),
4064
- userPrompt: z38.string(),
4065
- branch: z38.string().nullable(),
4066
- responseText: z38.string().nullable(),
4067
- layout: z38.unknown().nullable(),
4068
- phaseTimings: z38.record(z38.number()).nullable(),
4069
- tokensByModel: z38.record(RunTokenUsageSchema).nullable(),
4070
- toolCalls: z38.array(z38.unknown()).nullable(),
4071
- diagnostics: z38.array(z38.unknown()).nullable(),
4072
- latencyFirstText: z38.number().int().nullable(),
4073
- latencyFirstPatch: z38.number().int().nullable(),
4074
- latencyTotal: z38.number().int().nullable(),
4154
+ visitorEmail: z39.string().nullable(),
4155
+ userPrompt: z39.string(),
4156
+ branch: z39.string().nullable(),
4157
+ responseText: z39.string().nullable(),
4158
+ layout: z39.unknown().nullable(),
4159
+ phaseTimings: z39.record(z39.number()).nullable(),
4160
+ tokensByModel: z39.record(RunTokenUsageSchema).nullable(),
4161
+ toolCalls: z39.array(z39.unknown()).nullable(),
4162
+ diagnostics: z39.array(z39.unknown()).nullable(),
4163
+ latencyFirstText: z39.number().int().nullable(),
4164
+ latencyFirstPatch: z39.number().int().nullable(),
4165
+ latencyTotal: z39.number().int().nullable(),
4075
4166
  /**
4076
4167
  * The CLIENT's turn id for this run, or `null`.
4077
4168
  *
@@ -4087,29 +4178,29 @@ var TraceRecordSchema = z38.object({
4087
4178
  * a turn whose ack the client never saw — none of which is evidence that a
4088
4179
  * visitor asked something and got nothing.
4089
4180
  */
4090
- turnId: z38.string().nullable(),
4181
+ turnId: z39.string().nullable(),
4091
4182
  /** Serialized `TraceTracker.exportState()` payload (parsed object) —
4092
4183
  * lets the inspector rehydrate this run verbatim after a reload. */
4093
- trackerState: z38.unknown().nullable(),
4094
- createdAt: z38.string()
4184
+ trackerState: z39.unknown().nullable(),
4185
+ createdAt: z39.string()
4095
4186
  });
4096
- var MillisecondsSchema = z38.number().nullable().transform((v) => v === null ? null : Math.round(v));
4097
- var CreateTraceInputSchema = z38.object({
4098
- spaceId: z38.string().uuid().nullable(),
4099
- sessionId: z38.string(),
4100
- visitorEmail: z38.string().nullable(),
4101
- userPrompt: z38.string(),
4102
- branch: z38.string().nullable(),
4103
- responseText: z38.string().nullable(),
4104
- layout: z38.unknown().nullable(),
4105
- phaseTimings: z38.record(z38.number()).nullable(),
4106
- tokensByModel: z38.record(RunTokenUsageSchema).nullable(),
4107
- toolCalls: z38.array(z38.unknown()).nullable(),
4108
- diagnostics: z38.array(z38.unknown()).nullable(),
4187
+ var MillisecondsSchema = z39.number().nullable().transform((v) => v === null ? null : Math.round(v));
4188
+ var CreateTraceInputSchema = z39.object({
4189
+ spaceId: z39.string().uuid().nullable(),
4190
+ sessionId: z39.string(),
4191
+ visitorEmail: z39.string().nullable(),
4192
+ userPrompt: z39.string(),
4193
+ branch: z39.string().nullable(),
4194
+ responseText: z39.string().nullable(),
4195
+ layout: z39.unknown().nullable(),
4196
+ phaseTimings: z39.record(z39.number()).nullable(),
4197
+ tokensByModel: z39.record(RunTokenUsageSchema).nullable(),
4198
+ toolCalls: z39.array(z39.unknown()).nullable(),
4199
+ diagnostics: z39.array(z39.unknown()).nullable(),
4109
4200
  latencyFirstText: MillisecondsSchema,
4110
4201
  latencyFirstPatch: MillisecondsSchema,
4111
4202
  latencyTotal: MillisecondsSchema,
4112
- trackerState: z38.unknown().nullable(),
4203
+ trackerState: z39.unknown().nullable(),
4113
4204
  /**
4114
4205
  * The CLIENT's turn id for this run, or `null`.
4115
4206
  *
@@ -4125,37 +4216,37 @@ var CreateTraceInputSchema = z38.object({
4125
4216
  * a turn whose ack the client never saw — none of which is evidence that a
4126
4217
  * visitor asked something and got nothing.
4127
4218
  */
4128
- turnId: z38.string().nullable()
4219
+ turnId: z39.string().nullable()
4129
4220
  });
4130
- var AgentSessionSummarySchema = z38.object({
4131
- sessionId: z38.string(),
4221
+ var AgentSessionSummarySchema = z39.object({
4222
+ sessionId: z39.string(),
4132
4223
  /** Turn rows only; background/secondary runs are excluded by the aggregate. */
4133
- turnCount: z38.number().int(),
4224
+ turnCount: z39.number().int(),
4134
4225
  /** The session's opening prompt — titles the row in the UI. */
4135
- firstPrompt: z38.string(),
4136
- startedAt: z38.string(),
4137
- lastRunAt: z38.string(),
4226
+ firstPrompt: z39.string(),
4227
+ startedAt: z39.string(),
4228
+ lastRunAt: z39.string(),
4138
4229
  /** Summed `latency_total` across the session's turns. */
4139
- totalLatencyMs: z38.number().int()
4230
+ totalLatencyMs: z39.number().int()
4140
4231
  });
4141
- var SessionTurnSchema = z38.object({
4142
- id: z38.string().uuid(),
4143
- userPrompt: z38.string(),
4144
- responseText: z38.string().nullable(),
4232
+ var SessionTurnSchema = z39.object({
4233
+ id: z39.string().uuid(),
4234
+ userPrompt: z39.string(),
4235
+ responseText: z39.string().nullable(),
4145
4236
  /** Full cumulative Spec committed by this turn — never a patch delta. */
4146
- layout: z38.unknown().nullable(),
4147
- createdAt: z38.string(),
4148
- latencyTotal: z38.number().int().nullable(),
4149
- phaseTimings: z38.record(z38.number()).nullable(),
4150
- tokensByModel: z38.record(z38.object({
4151
- input_tokens: z38.number().optional(),
4152
- output_tokens: z38.number().optional()
4237
+ layout: z39.unknown().nullable(),
4238
+ createdAt: z39.string(),
4239
+ latencyTotal: z39.number().int().nullable(),
4240
+ phaseTimings: z39.record(z39.number()).nullable(),
4241
+ tokensByModel: z39.record(z39.object({
4242
+ input_tokens: z39.number().optional(),
4243
+ output_tokens: z39.number().optional()
4153
4244
  })).nullable(),
4154
- toolCalls: z38.array(z38.unknown()).nullable(),
4155
- diagnostics: z38.array(z38.unknown()).nullable()
4245
+ toolCalls: z39.array(z39.unknown()).nullable(),
4246
+ diagnostics: z39.array(z39.unknown()).nullable()
4156
4247
  });
4157
- var SessionReplaySchema = z38.object({
4158
- turns: z38.array(SessionTurnSchema),
4248
+ var SessionReplaySchema = z39.object({
4249
+ turns: z39.array(SessionTurnSchema),
4159
4250
  /**
4160
4251
  * The session's own last-committed layout, read straight off the durable
4161
4252
  * session record (`sessions.blob.layout`) rather than derived from `turns`.
@@ -4166,20 +4257,20 @@ var SessionReplaySchema = z38.object({
4166
4257
  * a perfectly real layout; only this field can show it. Null exclusively
4167
4258
  * when the durable session row itself could not be read.
4168
4259
  */
4169
- sessionLayout: z38.record(z38.string(), z38.unknown()).nullable()
4260
+ sessionLayout: z39.record(z39.string(), z39.unknown()).nullable()
4170
4261
  });
4171
- var SessionTraceSchema = z38.object({
4172
- trackerState: z38.string().nullable()
4262
+ var SessionTraceSchema = z39.object({
4263
+ trackerState: z39.string().nullable()
4173
4264
  });
4174
- var LlmUsageDailySchema = z38.object({
4175
- day: z38.string(),
4265
+ var LlmUsageDailySchema = z39.object({
4266
+ day: z39.string(),
4176
4267
  /** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
4177
- environment: z38.string(),
4178
- feature: z38.string(),
4179
- model: z38.string(),
4180
- provider: z38.string(),
4268
+ environment: z39.string(),
4269
+ feature: z39.string(),
4270
+ model: z39.string(),
4271
+ provider: z39.string(),
4181
4272
  /** Masked tail of the key actually billed, or null when unknown/non-Google. */
4182
- keyFingerprint: z38.string().nullable(),
4273
+ keyFingerprint: z39.string().nullable(),
4183
4274
  /**
4184
4275
  * The space the call served, or null when it served none.
4185
4276
  *
@@ -4188,91 +4279,91 @@ var LlmUsageDailySchema = z38.object({
4188
4279
  * report that share rather than dropping it, or a per-space total reads as
4189
4280
  * the platform total.
4190
4281
  */
4191
- spaceId: z38.string().nullable(),
4282
+ spaceId: z39.string().nullable(),
4192
4283
  /**
4193
4284
  * The surface of the session the call served (`sessions.surface`), or null
4194
4285
  * when it served no session or the session predates surface recording.
4195
4286
  * `automation` is the eval harness — the signal that files an ordinary
4196
4287
  * `agent-turn` as testing spend rather than as a visitor's.
4197
4288
  */
4198
- surface: z38.string().nullable(),
4199
- inputTokens: z38.number(),
4200
- outputTokens: z38.number(),
4289
+ surface: z39.string().nullable(),
4290
+ inputTokens: z39.number(),
4291
+ outputTokens: z39.number(),
4201
4292
  /** Subset of inputTokens, never additional to it. */
4202
- cachedInputTokens: z38.number(),
4203
- reasoningTokens: z38.number(),
4204
- callCount: z38.number(),
4205
- errorCount: z38.number(),
4206
- estimatedCostUsd: z38.number().nullable()
4293
+ cachedInputTokens: z39.number(),
4294
+ reasoningTokens: z39.number(),
4295
+ callCount: z39.number(),
4296
+ errorCount: z39.number(),
4297
+ estimatedCostUsd: z39.number().nullable()
4207
4298
  });
4208
- var LlmUsageBySessionSchema = z38.object({
4209
- sessionId: z38.string(),
4210
- environment: z38.string(),
4211
- model: z38.string(),
4299
+ var LlmUsageBySessionSchema = z39.object({
4300
+ sessionId: z39.string(),
4301
+ environment: z39.string(),
4302
+ model: z39.string(),
4212
4303
  /** The space this session belongs to, or null for a session with no space. */
4213
- spaceId: z38.string().nullable(),
4304
+ spaceId: z39.string().nullable(),
4214
4305
  /** The session's surface — see `LlmUsageDailySchema.surface`. */
4215
- surface: z38.string().nullable(),
4306
+ surface: z39.string().nullable(),
4216
4307
  /** Label only — the first feature seen in the session. */
4217
- firstFeature: z38.string(),
4218
- startedAt: z38.string(),
4219
- endedAt: z38.string(),
4220
- inputTokens: z38.number(),
4221
- outputTokens: z38.number(),
4222
- cachedInputTokens: z38.number(),
4223
- reasoningTokens: z38.number(),
4224
- callCount: z38.number(),
4225
- errorCount: z38.number(),
4308
+ firstFeature: z39.string(),
4309
+ startedAt: z39.string(),
4310
+ endedAt: z39.string(),
4311
+ inputTokens: z39.number(),
4312
+ outputTokens: z39.number(),
4313
+ cachedInputTokens: z39.number(),
4314
+ reasoningTokens: z39.number(),
4315
+ callCount: z39.number(),
4316
+ errorCount: z39.number(),
4226
4317
  /** Priced server-side, like the daily rollup — the browser never carries a
4227
4318
  * rate table, so there is exactly one place a price can be wrong. Null when
4228
4319
  * the model is unpriced; never 0, which would read as free. */
4229
- estimatedCostUsd: z38.number().nullable()
4320
+ estimatedCostUsd: z39.number().nullable()
4230
4321
  });
4231
- var LlmSessionsDailySchema = z38.object({
4232
- day: z38.string(),
4233
- environment: z38.string(),
4234
- sessionCount: z38.number()
4322
+ var LlmSessionsDailySchema = z39.object({
4323
+ day: z39.string(),
4324
+ environment: z39.string(),
4325
+ sessionCount: z39.number()
4235
4326
  });
4236
4327
 
4237
4328
  // ../spacestation/src/space/session-queue.ts
4238
- import { z as z40 } from "zod";
4329
+ import { z as z41 } from "zod";
4239
4330
 
4240
4331
  // ../spacestation/src/space/session-activity.ts
4241
- import { z as z39 } from "zod";
4242
- var SessionActivityEventSchema = z39.object({
4243
- id: z39.string(),
4244
- kind: z39.string(),
4245
- occurredAt: z39.string(),
4246
- source: z39.string(),
4247
- surface: z39.string(),
4248
- payload: z39.record(z39.unknown())
4332
+ import { z as z40 } from "zod";
4333
+ var SessionActivityEventSchema = z40.object({
4334
+ id: z40.string(),
4335
+ kind: z40.string(),
4336
+ occurredAt: z40.string(),
4337
+ source: z40.string(),
4338
+ surface: z40.string(),
4339
+ payload: z40.record(z40.unknown())
4249
4340
  });
4250
- var SessionActivitySchema = z39.object({
4251
- events: z39.array(SessionActivityEventSchema),
4252
- hasMore: z39.boolean()
4341
+ var SessionActivitySchema = z40.object({
4342
+ events: z40.array(SessionActivityEventSchema),
4343
+ hasMore: z40.boolean()
4253
4344
  });
4254
4345
 
4255
4346
  // ../spacestation/src/space/session-queue.ts
4256
- var SessionVerdictSchema = z40.enum(["unreviewed", "viewed", "bug"]);
4257
- var RecordableVerdictSchema = z40.enum(["viewed", "bug"]);
4258
- var SessionReviewEventSchema = z40.object({
4259
- id: z40.string().uuid(),
4347
+ var SessionVerdictSchema = z41.enum(["unreviewed", "viewed", "bug"]);
4348
+ var RecordableVerdictSchema = z41.enum(["viewed", "bug"]);
4349
+ var SessionReviewEventSchema = z41.object({
4350
+ id: z41.string().uuid(),
4260
4351
  verdict: RecordableVerdictSchema,
4261
4352
  /** Account email of the operator who judged it. Attribution is the reason the
4262
4353
  * log is append-only rather than a mutable current-state row. */
4263
- reviewer: z40.string(),
4264
- note: z40.string().nullable(),
4265
- createdAt: z40.string()
4354
+ reviewer: z41.string(),
4355
+ note: z41.string().nullable(),
4356
+ createdAt: z41.string()
4266
4357
  });
4267
- var BugSeveritySchema = z40.enum(["high", "medium", "low"]);
4268
- var BugLocationSchema = z40.object({
4269
- elementId: z40.string().nullable(),
4358
+ var BugSeveritySchema = z41.enum(["high", "medium", "low"]);
4359
+ var BugLocationSchema = z41.object({
4360
+ elementId: z41.string().nullable(),
4270
4361
  /** Display only — the catalog component type, e.g. "productGrid". Null
4271
4362
  * alongside a null `elementId`. */
4272
- elementType: z40.string().nullable(),
4363
+ elementType: z41.string().nullable(),
4273
4364
  /** Fraction of the ELEMENT's own box. Null for a page anchor. */
4274
- offsetXPct: z40.number().min(0).max(100).nullable(),
4275
- offsetYPct: z40.number().min(0).max(100).nullable(),
4365
+ offsetXPct: z41.number().min(0).max(100).nullable(),
4366
+ offsetYPct: z41.number().min(0).max(100).nullable(),
4276
4367
  /**
4277
4368
  * ABSOLUTE document pixels, for a pin with no element under it. Null for an
4278
4369
  * element anchor.
@@ -4283,8 +4374,8 @@ var BugLocationSchema = z40.object({
4283
4374
  * on the page with it. Measured before this was fixed: growing the page 9%
4284
4375
  * slid a pin 32px, so a pin ran away from the cursor reaching for it.
4285
4376
  */
4286
- pageX: z40.number().nullable(),
4287
- pageY: z40.number().nullable()
4377
+ pageX: z41.number().nullable(),
4378
+ pageY: z41.number().nullable()
4288
4379
  }).refine(
4289
4380
  (loc) => {
4290
4381
  const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
@@ -4298,24 +4389,24 @@ var BugLocationSchema = z40.object({
4298
4389
  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)"
4299
4390
  }
4300
4391
  );
4301
- var SessionBugSchema = z40.object({
4302
- id: z40.string().uuid(),
4392
+ var SessionBugSchema = z41.object({
4393
+ id: z41.string().uuid(),
4303
4394
  /** 1-based turn the fault was observed on; null when the fault is session-wide. */
4304
- turnIndex: z40.number().int().nullable(),
4395
+ turnIndex: z41.number().int().nullable(),
4305
4396
  /** Where on that turn's canvas the pin was dropped; null for a bug filed
4306
4397
  * without pinning a spot. */
4307
4398
  location: BugLocationSchema.nullable(),
4308
- provider: z40.string(),
4309
- issueKey: z40.string().nullable(),
4310
- issueUrl: z40.string().nullable(),
4399
+ provider: z41.string(),
4400
+ issueKey: z41.string().nullable(),
4401
+ issueUrl: z41.string().nullable(),
4311
4402
  /** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
4312
4403
  * open text. Null until first synced. */
4313
- issueState: z40.string().nullable(),
4314
- title: z40.string(),
4315
- body: z40.string(),
4404
+ issueState: z41.string().nullable(),
4405
+ title: z41.string(),
4406
+ body: z41.string(),
4316
4407
  severity: BugSeveritySchema,
4317
- createdBy: z40.string(),
4318
- createdAt: z40.string(),
4408
+ createdBy: z41.string(),
4409
+ createdAt: z41.string(),
4319
4410
  /**
4320
4411
  * When this bug was resolved from the console; null means still OPEN.
4321
4412
  *
@@ -4324,60 +4415,60 @@ var SessionBugSchema = z40.object({
4324
4415
  * whether a particular fault is still live. The timestamp IS the state, so
4325
4416
  * no boolean can contradict it.
4326
4417
  */
4327
- resolvedAt: z40.string().nullable(),
4328
- resolvedBy: z40.string().nullable()
4418
+ resolvedAt: z41.string().nullable(),
4419
+ resolvedBy: z41.string().nullable()
4329
4420
  });
4330
- var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z40.string() });
4331
- var SessionCommentSchema = z40.object({
4332
- id: z40.string().uuid(),
4421
+ var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z41.string() });
4422
+ var SessionCommentSchema = z41.object({
4423
+ id: z41.string().uuid(),
4333
4424
  /** Set = a reply in that bug's thread. Null = a standalone comment pin. */
4334
- bugId: z40.string().uuid().nullable(),
4425
+ bugId: z41.string().uuid().nullable(),
4335
4426
  /** 1-based turn the comment was left on; null for a reply (it reads its
4336
4427
  * parent bug's turn). */
4337
- turnIndex: z40.number().int().nullable(),
4428
+ turnIndex: z41.number().int().nullable(),
4338
4429
  /** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
4339
4430
  location: BugLocationSchema.nullable(),
4340
- body: z40.string(),
4341
- createdBy: z40.string(),
4342
- createdAt: z40.string()
4431
+ body: z41.string(),
4432
+ createdBy: z41.string(),
4433
+ createdAt: z41.string()
4343
4434
  });
4344
- var CreateCommentInputSchema = z40.object({
4345
- bugId: z40.string().uuid().nullable(),
4346
- turnIndex: z40.number().int().positive().nullable(),
4435
+ var CreateCommentInputSchema = z41.object({
4436
+ bugId: z41.string().uuid().nullable(),
4437
+ turnIndex: z41.number().int().positive().nullable(),
4347
4438
  location: BugLocationSchema.nullable(),
4348
4439
  // Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
4349
4440
  // of three spaces, which renders as an empty bubble nobody can interpret.
4350
- body: z40.string().trim().min(1)
4441
+ body: z41.string().trim().min(1)
4351
4442
  }).refine((input) => input.bugId === null !== (input.location === null), {
4352
4443
  message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
4353
4444
  });
4354
- var UpdateCommentInputSchema = z40.object({
4355
- body: z40.string().trim().min(1).optional(),
4356
- bugId: z40.string().uuid().nullable().optional(),
4445
+ var UpdateCommentInputSchema = z41.object({
4446
+ body: z41.string().trim().min(1).optional(),
4447
+ bugId: z41.string().uuid().nullable().optional(),
4357
4448
  location: BugLocationSchema.nullable().optional()
4358
4449
  });
4359
4450
  var MOBILE_VIEWPORT_MAX = 720;
4360
- var SessionFormFactorSchema = z40.enum(["mobile", "desktop"]).nullable();
4451
+ var SessionFormFactorSchema = z41.enum(["mobile", "desktop"]).nullable();
4361
4452
  function formFactorFromViewport(width) {
4362
4453
  if (width === null) return null;
4363
4454
  return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
4364
4455
  }
4365
- var SessionSummarySchema = z40.object({
4366
- sessionId: z40.string(),
4456
+ var SessionSummarySchema = z41.object({
4457
+ sessionId: z41.string(),
4367
4458
  /** Stable per-browser id — the join key across a visitor's sessions. Null when
4368
4459
  * the session row is gone (pruned) or predates the `sessions` table. */
4369
- visitorId: z40.string().nullable(),
4460
+ visitorId: z41.string().nullable(),
4370
4461
  /** Provider-qualified identity anchor, present only once the visitor
4371
4462
  * identified themselves. Both null together means "not identified yet". */
4372
- identityProvider: z40.string().nullable(),
4373
- identityKey: z40.string().nullable(),
4463
+ identityProvider: z41.string().nullable(),
4464
+ identityKey: z41.string().nullable(),
4374
4465
  /** Team/test traffic. The queue hides these by default. */
4375
- isInternal: z40.boolean(),
4466
+ isInternal: z41.boolean(),
4376
4467
  /** Build that served the session. Null = not captured; a version filter must
4377
4468
  * therefore EXCLUDE it rather than let it match an arbitrary bucket. */
4378
- clientVersion: z40.string().nullable(),
4469
+ clientVersion: z41.string().nullable(),
4379
4470
  /** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
4380
- signalCounts: z40.record(z40.number()),
4471
+ signalCounts: z41.record(z41.number()),
4381
4472
  /**
4382
4473
  * Did this conversation ACQUIRE anything, and how many times?
4383
4474
  *
@@ -4394,7 +4485,7 @@ var SessionSummarySchema = z40.object({
4394
4485
  * predates the column — and renders as no mark at all. It never means zero:
4395
4486
  * zero is a real, recorded answer and the rail reports it as one.
4396
4487
  */
4397
- conversionAttempts: z40.number().int().nullable(),
4488
+ conversionAttempts: z41.number().int().nullable(),
4398
4489
  /**
4399
4490
  * The same attempts split by EVENT KIND, keyed by the kind's own name
4400
4491
  * (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
@@ -4410,7 +4501,7 @@ var SessionSummarySchema = z40.object({
4410
4501
  * kinds together, and one attempt id appearing under both would be counted
4411
4502
  * once there and twice here.
4412
4503
  */
4413
- conversionKinds: z40.record(z40.number()),
4504
+ conversionKinds: z41.record(z41.number()),
4414
4505
  /**
4415
4506
  * Every analytics funnel step this session reached, in funnel order — the
4416
4507
  * dashboard's own step ids, read by the same per-step predicates, so a queue
@@ -4418,20 +4509,20 @@ var SessionSummarySchema = z40.object({
4418
4509
  * set of strings for the reason `conversionKinds` is: the contract does not
4419
4510
  * learn what a step means. Empty only when read from a pre-column database.
4420
4511
  */
4421
- funnelSteps: z40.array(z40.string()),
4512
+ funnelSteps: z41.array(z41.string()),
4422
4513
  /**
4423
4514
  * The connector's opaque handle for what this session produced in its back
4424
4515
  * office — present only once a checkout actually reached the platform. The
4425
4516
  * console hands it to the back-office link registry; nothing else reads it.
4426
4517
  */
4427
- backOfficeRef: z40.string().nullable(),
4518
+ backOfficeRef: z41.string().nullable(),
4428
4519
  /**
4429
4520
  * The order this session produced, when the connector's back office reported
4430
4521
  * it (`session_orders`): its opaque id and the back office's own name for it.
4431
4522
  * Both null when no order is known — the cart handle above is then the door.
4432
4523
  */
4433
- orderRef: z40.string().nullable(),
4434
- orderLabel: z40.string().nullable(),
4524
+ orderRef: z41.string().nullable(),
4525
+ orderLabel: z41.string().nullable(),
4435
4526
  /**
4436
4527
  * Which shell this session rendered — the one thing about the CAPTURE a list
4437
4528
  * needs.
@@ -4444,12 +4535,12 @@ var SessionSummarySchema = z40.object({
4444
4535
  * on a desktop are not the same session.
4445
4536
  */
4446
4537
  formFactor: SessionFormFactorSchema,
4447
- turnCount: z40.number().int(),
4538
+ turnCount: z41.number().int(),
4448
4539
  /** The visitor's opening message — the single most informative field for
4449
4540
  * deciding whether a session is worth opening, hence the widest column. */
4450
- firstPrompt: z40.string(),
4451
- startedAt: z40.string(),
4452
- lastRunAt: z40.string(),
4541
+ firstPrompt: z41.string(),
4542
+ startedAt: z41.string(),
4543
+ lastRunAt: z41.string(),
4453
4544
  /**
4454
4545
  * The VISITOR's own IANA zone (`America/New_York`), read from their browser
4455
4546
  * at session create — what the two timestamps above should be read in.
@@ -4477,7 +4568,7 @@ var SessionSummarySchema = z40.object({
4477
4568
  * Client-asserted and never validated against a zone table, so every consumer
4478
4569
  * must tolerate an unknown name: `Intl` throws a RangeError on one.
4479
4570
  */
4480
- visitorTimeZone: z40.string().nullable(),
4571
+ visitorTimeZone: z41.string().nullable(),
4481
4572
  /**
4482
4573
  * Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
4483
4574
  * layout op reaching the visitor, and THE latency the project is managed on.
@@ -4485,31 +4576,31 @@ var SessionSummarySchema = z40.object({
4485
4576
  * `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
4486
4577
  * already reading. Null when no turn in the session recorded a patch.
4487
4578
  */
4488
- avgTtftMs: z40.number().int().nullable(),
4579
+ avgTtftMs: z41.number().int().nullable(),
4489
4580
  /** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
4490
4581
  * a budget: null on sessions older than the mark's recording. */
4491
- avgMainDoneMs: z40.number().int().nullable(),
4582
+ avgMainDoneMs: z41.number().int().nullable(),
4492
4583
  /** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
4493
4584
  * budget. On the row only to explain the gap to `totalLatencyMs`. */
4494
- avgChipGenMs: z40.number().int().nullable(),
4495
- totalLatencyMs: z40.number().int(),
4496
- durationMs: z40.number().int(),
4585
+ avgChipGenMs: z41.number().int().nullable(),
4586
+ totalLatencyMs: z41.number().int(),
4587
+ durationMs: z41.number().int(),
4497
4588
  /** Inferred from recent activity — nothing writes a session-end marker. A
4498
4589
  * live session streams and cannot be given a verdict until it ends. */
4499
- isLive: z40.boolean(),
4590
+ isLive: z41.boolean(),
4500
4591
  verdict: SessionVerdictSchema,
4501
- reviewedBy: z40.string().nullable(),
4502
- reviewedAt: z40.string().nullable(),
4592
+ reviewedBy: z41.string().nullable(),
4593
+ reviewedAt: z41.string().nullable(),
4503
4594
  /** Latest filed bug, flattened onto the row so the queue can show its live
4504
4595
  * state without a second request. */
4505
- bugIssueKey: z40.string().nullable(),
4506
- bugIssueUrl: z40.string().nullable(),
4507
- bugIssueState: z40.string().nullable()
4596
+ bugIssueKey: z41.string().nullable(),
4597
+ bugIssueUrl: z41.string().nullable(),
4598
+ bugIssueState: z41.string().nullable()
4508
4599
  });
4509
- var SessionQueuePageSchema = z40.object({
4510
- sessions: z40.array(SessionSummarySchema),
4511
- totalCount: z40.number().int(),
4512
- hiddenInternalCount: z40.number().int(),
4600
+ var SessionQueuePageSchema = z41.object({
4601
+ sessions: z41.array(SessionSummarySchema),
4602
+ totalCount: z41.number().int(),
4603
+ hiddenInternalCount: z41.number().int(),
4513
4604
  /**
4514
4605
  * Bounced sessions the queue left out — no turn and no add, the default.
4515
4606
  *
@@ -4519,61 +4610,61 @@ var SessionQueuePageSchema = z40.object({
4519
4610
  * `totalCount + hiddenBouncedCount` is that population, and this count is the
4520
4611
  * analytics dashboard's bounce over the same window.
4521
4612
  */
4522
- hiddenBouncedCount: z40.number().int()
4613
+ hiddenBouncedCount: z41.number().int()
4523
4614
  });
4524
- var SessionQueueFacetsSchema = z40.object({
4525
- review: z40.record(z40.number()),
4526
- version: z40.record(z40.number()),
4527
- turns: z40.record(z40.number()),
4528
- durationS: z40.record(z40.number()),
4615
+ var SessionQueueFacetsSchema = z41.object({
4616
+ review: z41.record(z41.number()),
4617
+ version: z41.record(z41.number()),
4618
+ turns: z41.record(z41.number()),
4619
+ durationS: z41.record(z41.number()),
4529
4620
  /** Sessions per funnel step reached — a session counts under every step it reached. */
4530
- funnel: z40.record(z40.number())
4621
+ funnel: z41.record(z41.number())
4531
4622
  });
4532
- var SessionCaptureSchema = z40.object({
4533
- viewportWidth: z40.number().int().nullable(),
4534
- viewportHeight: z40.number().int().nullable(),
4535
- userAgent: z40.string().nullable(),
4536
- locale: z40.string().nullable(),
4623
+ var SessionCaptureSchema = z41.object({
4624
+ viewportWidth: z41.number().int().nullable(),
4625
+ viewportHeight: z41.number().int().nullable(),
4626
+ userAgent: z41.string().nullable(),
4627
+ locale: z41.string().nullable(),
4537
4628
  /** Referrer at session create — separates agentic traffic from organic. */
4538
- referrer: z40.string().nullable()
4629
+ referrer: z41.string().nullable()
4539
4630
  });
4540
- var SessionCaptureInputSchema = z40.object({
4541
- viewportWidth: z40.number().int().positive().max(2e4).optional(),
4542
- viewportHeight: z40.number().int().positive().max(2e4).optional(),
4543
- userAgent: z40.string().max(1e3).optional(),
4544
- locale: z40.string().max(35).optional(),
4631
+ var SessionCaptureInputSchema = z41.object({
4632
+ viewportWidth: z41.number().int().positive().max(2e4).optional(),
4633
+ viewportHeight: z41.number().int().positive().max(2e4).optional(),
4634
+ userAgent: z41.string().max(1e3).optional(),
4635
+ locale: z41.string().max(35).optional(),
4545
4636
  /** IANA zone name from the visitor's browser. Bounded rather than validated:
4546
4637
  * the zone database grows, and refusing a name this build has not heard of
4547
4638
  * would drop a real session's capture over a table that is out of date. */
4548
- timeZone: z40.string().max(64).optional(),
4549
- referrer: z40.string().max(2048).optional(),
4550
- clientVersion: z40.string().max(100).optional(),
4551
- isInternal: z40.boolean().optional()
4639
+ timeZone: z41.string().max(64).optional(),
4640
+ referrer: z41.string().max(2048).optional(),
4641
+ clientVersion: z41.string().max(100).optional(),
4642
+ isInternal: z41.boolean().optional()
4552
4643
  });
4553
- var SessionDetailSchema = z40.object({
4644
+ var SessionDetailSchema = z41.object({
4554
4645
  session: SessionSummarySchema,
4555
4646
  capture: SessionCaptureSchema,
4556
4647
  /** Full verdict history, newest first. Verdicts are revisable, and a session
4557
4648
  * re-judged after a fix is the evidence the fix worked. */
4558
- reviews: z40.array(SessionReviewEventSchema),
4559
- bugs: z40.array(SessionBugSchema),
4560
- comments: z40.array(SessionCommentSchema),
4649
+ reviews: z41.array(SessionReviewEventSchema),
4650
+ bugs: z41.array(SessionBugSchema),
4651
+ comments: z41.array(SessionCommentSchema),
4561
4652
  /** Optional during API/console rolling deployment. Absent is unavailable,
4562
4653
  * not evidence of zero visitor activity. */
4563
4654
  activity: SessionActivitySchema.optional()
4564
4655
  });
4565
- var RecordVerdictInputSchema = z40.object({
4656
+ var RecordVerdictInputSchema = z41.object({
4566
4657
  verdict: RecordableVerdictSchema,
4567
- note: z40.string().max(2e3).optional()
4658
+ note: z41.string().max(2e3).optional()
4568
4659
  });
4569
- var FileBugInputSchema = z40.object({
4570
- turnIndex: z40.number().int().positive().nullable(),
4660
+ var FileBugInputSchema = z41.object({
4661
+ turnIndex: z41.number().int().positive().nullable(),
4571
4662
  /** Optional — a bug filed without dropping a pin has no location. */
4572
4663
  location: BugLocationSchema.nullable().optional(),
4573
- title: z40.string().min(1).max(300),
4574
- body: z40.string().min(1),
4664
+ title: z41.string().min(1).max(300),
4665
+ body: z41.string().min(1),
4575
4666
  severity: BugSeveritySchema,
4576
- payload: z40.record(z40.unknown())
4667
+ payload: z41.record(z41.unknown())
4577
4668
  });
4578
4669
 
4579
4670
  // ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
@@ -4867,6 +4958,7 @@ __export(src_exports2, {
4867
4958
  buildPdpCompanionsConfig: () => buildPdpCompanionsConfig,
4868
4959
  cartLineMatchesSelections: () => cartLineMatchesSelections,
4869
4960
  cartLinesForProduct: () => cartLinesForProduct,
4961
+ clearCodeDiscountSources: () => clearCodeDiscountSources,
4870
4962
  clearProductNameLookups: () => clearProductNameLookups,
4871
4963
  createUnavailableProduct: () => createUnavailableProduct,
4872
4964
  entityProjections: () => entityProjections,
@@ -4884,7 +4976,9 @@ __export(src_exports2, {
4884
4976
  readBaseAttributesConfig: () => readBaseAttributesConfig,
4885
4977
  readBucketLabelsConfig: () => readBucketLabelsConfig,
4886
4978
  readPdpCompanions: () => readPdpCompanions,
4979
+ registerCodeDiscountSource: () => registerCodeDiscountSource,
4887
4980
  registerProductNameLookup: () => registerProductNameLookup,
4981
+ resolveCodeDiscountSource: () => resolveCodeDiscountSource,
4888
4982
  resolveProductNameLookup: () => resolveProductNameLookup,
4889
4983
  scopedAttributeKey: () => scopedAttributeKey,
4890
4984
  selectedOptionsToRecord: () => selectedOptionsToRecord,
@@ -4892,60 +4986,60 @@ __export(src_exports2, {
4892
4986
  });
4893
4987
 
4894
4988
  // ../ecommerce/src/commerce-schemas.ts
4895
- import { z as z41 } from "zod";
4896
- var MoneySchema = z41.object({
4897
- amount: z41.number(),
4898
- currencyCode: z41.string()
4989
+ import { z as z42 } from "zod";
4990
+ var MoneySchema = z42.object({
4991
+ amount: z42.number(),
4992
+ currencyCode: z42.string()
4899
4993
  });
4900
- var ImageSchema = z41.object({
4901
- url: z41.string(),
4902
- altText: z41.string(),
4903
- width: z41.number().optional(),
4904
- height: z41.number().optional(),
4994
+ var ImageSchema = z42.object({
4995
+ url: z42.string(),
4996
+ altText: z42.string(),
4997
+ width: z42.number().optional(),
4998
+ height: z42.number().optional(),
4905
4999
  /** Responsive candidate set, resolved at the commerce-adapter boundary —
4906
5000
  * never computed in a component. Renderers use it as `<img srcSet>` paired
4907
5001
  * with a layout `sizes`. Absent for non-CDN / unsizable images. */
4908
- srcSet: z41.string().optional()
5002
+ srcSet: z42.string().optional()
4909
5003
  });
4910
- var AssetSchema = z41.object({
5004
+ var AssetSchema = z42.object({
4911
5005
  /** Opaque asset id — the `resolved()` ref the agent emitted. */
4912
- id: z41.string(),
4913
- url: z41.string(),
4914
- altText: z41.string(),
4915
- srcSet: z41.string().optional()
5006
+ id: z42.string(),
5007
+ url: z42.string(),
5008
+ altText: z42.string(),
5009
+ srcSet: z42.string().optional()
4916
5010
  });
4917
- var SelectedOptionSchema = z41.object({
4918
- name: z41.string(),
4919
- value: z41.string()
5011
+ var SelectedOptionSchema = z42.object({
5012
+ name: z42.string(),
5013
+ value: z42.string()
4920
5014
  });
4921
- var VideoSourceSchema = z41.object({
4922
- url: z41.string(),
4923
- mimeType: z41.string(),
4924
- width: z41.number().optional(),
4925
- height: z41.number().optional()
5015
+ var VideoSourceSchema = z42.object({
5016
+ url: z42.string(),
5017
+ mimeType: z42.string(),
5018
+ width: z42.number().optional(),
5019
+ height: z42.number().optional()
4926
5020
  });
4927
- var ProductVideoSchema = z41.object({
4928
- kind: z41.enum(["hosted", "external"]),
5021
+ var ProductVideoSchema = z42.object({
5022
+ kind: z42.enum(["hosted", "external"]),
4929
5023
  previewImage: ImageSchema.optional(),
4930
- altText: z41.string().default(""),
5024
+ altText: z42.string().default(""),
4931
5025
  /** `kind: 'hosted'` only — empty for external embeds. */
4932
- sources: z41.array(VideoSourceSchema).default([]),
5026
+ sources: z42.array(VideoSourceSchema).default([]),
4933
5027
  /** `kind: 'external'` only — iframe embed URL. */
4934
- embedUrl: z41.string().optional(),
5028
+ embedUrl: z42.string().optional(),
4935
5029
  /** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
4936
- host: z41.string().optional()
5030
+ host: z42.string().optional()
4937
5031
  });
4938
- var AvailabilityStatusSchema = z41.enum([
5032
+ var AvailabilityStatusSchema = z42.enum([
4939
5033
  "in_stock",
4940
5034
  "backorder",
4941
5035
  "preorder",
4942
5036
  "out_of_stock",
4943
5037
  "discontinued"
4944
5038
  ]);
4945
- var ProductVariantSchema = z41.object({
4946
- id: z41.string(),
4947
- title: z41.string(),
4948
- available: z41.boolean(),
5039
+ var ProductVariantSchema = z42.object({
5040
+ id: z42.string(),
5041
+ title: z42.string(),
5042
+ available: z42.boolean(),
4949
5043
  /**
4950
5044
  * Qualifies `available` with the fulfillment state behind it. Absent means
4951
5045
  * the backend did not say — which is NOT the same as in stock, and must not
@@ -4960,8 +5054,10 @@ var ProductVariantSchema = z41.object({
4960
5054
  availabilityStatus: AvailabilityStatusSchema.optional(),
4961
5055
  price: MoneySchema,
4962
5056
  compareAtPrice: MoneySchema.optional(),
4963
- selectedOptions: z41.array(SelectedOptionSchema).optional(),
4964
- image: ImageSchema.optional()
5057
+ selectedOptions: z42.array(SelectedOptionSchema).optional(),
5058
+ image: ImageSchema.optional(),
5059
+ /** The merchant's stock-keeping code. Absent when the backend has none. */
5060
+ sku: z42.string().optional()
4965
5061
  });
4966
5062
  var MP4_MIME = "video/mp4";
4967
5063
  var HLS_MIME = "application/x-mpegURL";
@@ -4971,34 +5067,34 @@ function orderedVideoSources(video) {
4971
5067
  const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
4972
5068
  return [...mp4, ...hls];
4973
5069
  }
4974
- var SiblingProductSchema = z41.object({
4975
- id: z41.string(),
4976
- handle: z41.string(),
4977
- title: z41.string(),
5070
+ var SiblingProductSchema = z42.object({
5071
+ id: z42.string(),
5072
+ handle: z42.string(),
5073
+ title: z42.string(),
4978
5074
  /** The differentiating value across siblings — typically the color
4979
5075
  * label ("OLIVE", "STONE"). Rendered next to the swatch row. */
4980
- color: z41.string(),
5076
+ color: z42.string(),
4981
5077
  /** Swatch artwork. Hydrators populate from the sibling product's
4982
5078
  * first image; renderers crop / fit to the swatch tile. */
4983
5079
  swatchImage: ImageSchema.optional(),
4984
- available: z41.boolean().default(true),
5080
+ available: z42.boolean().default(true),
4985
5081
  /** Marks the sibling that IS the currently-rendered product. The
4986
5082
  * picker uses this to highlight the active swatch without an
4987
5083
  * external id comparison. */
4988
- current: z41.boolean().default(false)
5084
+ current: z42.boolean().default(false)
4989
5085
  });
4990
- var ProductSchema = z41.object({
4991
- id: z41.string(),
4992
- handle: z41.string().default(""),
4993
- title: z41.string(),
4994
- description: z41.string().default(""),
4995
- descriptionHtml: z41.string().optional(),
4996
- vendor: z41.string().default(""),
4997
- productType: z41.string().optional(),
4998
- tags: z41.array(z41.string()).default([]),
5086
+ var ProductSchema = z42.object({
5087
+ id: z42.string(),
5088
+ handle: z42.string().default(""),
5089
+ title: z42.string(),
5090
+ description: z42.string().default(""),
5091
+ descriptionHtml: z42.string().optional(),
5092
+ vendor: z42.string().default(""),
5093
+ productType: z42.string().optional(),
5094
+ tags: z42.array(z42.string()).default([]),
4999
5095
  price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
5000
5096
  compareAtPrice: MoneySchema.optional(),
5001
- images: z41.array(ImageSchema).default([]),
5097
+ images: z42.array(ImageSchema).default([]),
5002
5098
  /**
5003
5099
  * Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
5004
5100
  * catalog drops video media — it only surfaces through the Storefront
@@ -5006,21 +5102,21 @@ var ProductSchema = z41.object({
5006
5102
  * boundary. Default `[]` so renderers gate on `length > 0` without a
5007
5103
  * presence guard.
5008
5104
  */
5009
- videos: z41.array(ProductVideoSchema).default([]),
5010
- variants: z41.array(ProductVariantSchema).default([]),
5011
- availableForSale: z41.boolean().default(true),
5012
- options: z41.array(z41.object({
5013
- name: z41.string(),
5014
- values: z41.array(z41.string())
5105
+ videos: z42.array(ProductVideoSchema).default([]),
5106
+ variants: z42.array(ProductVariantSchema).default([]),
5107
+ availableForSale: z42.boolean().default(true),
5108
+ options: z42.array(z42.object({
5109
+ name: z42.string(),
5110
+ values: z42.array(z42.string())
5015
5111
  })).optional(),
5016
- collections: z41.array(z41.string()).optional(),
5112
+ collections: z42.array(z42.string()).optional(),
5017
5113
  /** See `SiblingProductSchema`. Default `[]` so renderers can check
5018
5114
  * `length > 1` to decide whether to draw the swatch row without a
5019
5115
  * presence guard. */
5020
- colorVariants: z41.array(SiblingProductSchema).default([]),
5021
- rating: z41.object({
5022
- value: z41.number(),
5023
- count: z41.number()
5116
+ colorVariants: z42.array(SiblingProductSchema).default([]),
5117
+ rating: z42.object({
5118
+ value: z42.number(),
5119
+ count: z42.number()
5024
5120
  }).optional(),
5025
5121
  /**
5026
5122
  * Product reviews surfaced from the brand's review store. SDK
@@ -5029,12 +5125,12 @@ var ProductSchema = z41.object({
5029
5125
  * review bodies. Renderers (`Reviews` component, `ProductDetail`,
5030
5126
  * etc.) consume directly.
5031
5127
  */
5032
- reviews: z41.array(z41.object({
5033
- author: z41.string(),
5034
- rating: z41.number(),
5035
- content: z41.string(),
5036
- date: z41.string(),
5037
- verified: z41.boolean().optional()
5128
+ reviews: z42.array(z42.object({
5129
+ author: z42.string(),
5130
+ rating: z42.number(),
5131
+ content: z42.string(),
5132
+ date: z42.string(),
5133
+ verified: z42.boolean().optional()
5038
5134
  })).optional(),
5039
5135
  /**
5040
5136
  * Ghost-entity flag — `true` when the Storefront API could not hydrate
@@ -5046,7 +5142,7 @@ var ProductSchema = z41.object({
5046
5142
  * Set exclusively by `createUnavailableProduct()` — never by the
5047
5143
  * Storefront mapper.
5048
5144
  */
5049
- unavailable: z41.boolean().default(false)
5145
+ unavailable: z42.boolean().default(false)
5050
5146
  });
5051
5147
  function createUnavailableProduct(gid) {
5052
5148
  return {
@@ -5068,68 +5164,68 @@ function createUnavailableProduct(gid) {
5068
5164
  function isGhostEntity(value) {
5069
5165
  return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
5070
5166
  }
5071
- var ReviewSchema = z41.object({
5072
- id: z41.string(),
5073
- productId: z41.string(),
5074
- author: z41.string(),
5075
- rating: z41.number(),
5076
- text: z41.string(),
5077
- date: z41.string(),
5078
- verified: z41.boolean()
5167
+ var ReviewSchema = z42.object({
5168
+ id: z42.string(),
5169
+ productId: z42.string(),
5170
+ author: z42.string(),
5171
+ rating: z42.number(),
5172
+ text: z42.string(),
5173
+ date: z42.string(),
5174
+ verified: z42.boolean()
5079
5175
  });
5080
- var ArticleSchema = z41.object({
5081
- id: z41.string(),
5082
- handle: z41.string().default(""),
5083
- title: z41.string(),
5084
- excerpt: z41.string().default(""),
5085
- content: z41.string().default(""),
5086
- contentHtml: z41.string().optional(),
5087
- author: z41.string().default(""),
5088
- publishedAt: z41.string().default(""),
5176
+ var ArticleSchema = z42.object({
5177
+ id: z42.string(),
5178
+ handle: z42.string().default(""),
5179
+ title: z42.string(),
5180
+ excerpt: z42.string().default(""),
5181
+ content: z42.string().default(""),
5182
+ contentHtml: z42.string().optional(),
5183
+ author: z42.string().default(""),
5184
+ publishedAt: z42.string().default(""),
5089
5185
  image: ImageSchema.optional(),
5090
- blogHandle: z41.string().default(""),
5091
- tags: z41.array(z41.string()).default([])
5186
+ blogHandle: z42.string().default(""),
5187
+ tags: z42.array(z42.string()).default([])
5092
5188
  });
5093
- var CmsPageSchema = z41.object({
5094
- id: z41.string(),
5095
- handle: z41.string().default(""),
5096
- title: z41.string(),
5097
- body: z41.string().default(""),
5098
- bodyHtml: z41.string().optional(),
5099
- bodySummary: z41.string().default(""),
5100
- updatedAt: z41.string().default(""),
5101
- seoTitle: z41.string().optional(),
5102
- seoDescription: z41.string().optional()
5189
+ var CmsPageSchema = z42.object({
5190
+ id: z42.string(),
5191
+ handle: z42.string().default(""),
5192
+ title: z42.string(),
5193
+ body: z42.string().default(""),
5194
+ bodyHtml: z42.string().optional(),
5195
+ bodySummary: z42.string().default(""),
5196
+ updatedAt: z42.string().default(""),
5197
+ seoTitle: z42.string().optional(),
5198
+ seoDescription: z42.string().optional()
5103
5199
  });
5104
- var CmsPolicySchema = z41.object({
5105
- id: z41.string(),
5200
+ var CmsPolicySchema = z42.object({
5201
+ id: z42.string(),
5106
5202
  /** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
5107
5203
  * 'shipping' | 'subscription' | 'warranty' | custom string. Open so
5108
5204
  * platforms with custom policy types can extend. */
5109
- kind: z41.string(),
5205
+ kind: z42.string(),
5110
5206
  /** Slug-shaped handle the platform exposes for storefront URLs
5111
5207
  * (e.g. `refund-policy`). Empty string when the backend doesn't
5112
5208
  * surface one. */
5113
- handle: z41.string().default(""),
5114
- title: z41.string(),
5115
- body: z41.string().default(""),
5116
- bodyHtml: z41.string().optional(),
5117
- url: z41.string().default("")
5209
+ handle: z42.string().default(""),
5210
+ title: z42.string(),
5211
+ body: z42.string().default(""),
5212
+ bodyHtml: z42.string().optional(),
5213
+ url: z42.string().default("")
5118
5214
  });
5119
- var CollectionSchema = z41.object({
5120
- id: z41.string(),
5121
- handle: z41.string().default(""),
5122
- title: z41.string(),
5123
- description: z41.string().default(""),
5215
+ var CollectionSchema = z42.object({
5216
+ id: z42.string(),
5217
+ handle: z42.string().default(""),
5218
+ title: z42.string(),
5219
+ description: z42.string().default(""),
5124
5220
  image: ImageSchema.optional(),
5125
- productCount: z41.number().int().nonnegative().optional()
5221
+ productCount: z42.number().int().nonnegative().optional()
5126
5222
  });
5127
- var CartLineSchema = z41.object({
5128
- id: z41.string(),
5129
- merchandiseId: z41.string(),
5130
- productId: z41.string(),
5131
- title: z41.string(),
5132
- variantTitle: z41.string().optional(),
5223
+ var CartLineSchema = z42.object({
5224
+ id: z42.string(),
5225
+ merchandiseId: z42.string(),
5226
+ productId: z42.string(),
5227
+ title: z42.string(),
5228
+ variantTitle: z42.string().optional(),
5133
5229
  /**
5134
5230
  * The variant's option axes as structured pairs (e.g.
5135
5231
  * `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
@@ -5138,10 +5234,10 @@ var CartLineSchema = z41.object({
5138
5234
  * single-variant products (the degenerate `Title: Default Title` axis
5139
5235
  * is normalized away at the adapter boundary).
5140
5236
  */
5141
- selectedOptions: z41.array(SelectedOptionSchema).optional(),
5142
- vendor: z41.string().optional(),
5143
- sku: z41.string().optional(),
5144
- quantity: z41.number().int().positive(),
5237
+ selectedOptions: z42.array(SelectedOptionSchema).optional(),
5238
+ vendor: z42.string().optional(),
5239
+ sku: z42.string().optional(),
5240
+ quantity: z42.number().int().positive(),
5145
5241
  unitPrice: MoneySchema,
5146
5242
  totalPrice: MoneySchema,
5147
5243
  image: ImageSchema.optional(),
@@ -5161,26 +5257,26 @@ var CartLineSchema = z41.object({
5161
5257
  * client-minted id the backend rejects, line-tap navigation is
5162
5258
  * suppressed, and the money never folds into a settled-looking total.
5163
5259
  */
5164
- pending: z41.boolean().optional()
5260
+ pending: z42.boolean().optional()
5165
5261
  });
5166
5262
  function isPendingCartLine(line) {
5167
5263
  return line.pending === true;
5168
5264
  }
5169
- var CartDiscountCodeSchema = z41.object({
5170
- code: z41.string(),
5171
- applicable: z41.boolean()
5265
+ var CartDiscountCodeSchema = z42.object({
5266
+ code: z42.string(),
5267
+ applicable: z42.boolean()
5172
5268
  });
5173
- var CartMessageSchema = z41.object({
5174
- kind: z41.enum(["error", "warning", "info"]),
5269
+ var CartMessageSchema = z42.object({
5270
+ kind: z42.enum(["error", "warning", "info"]),
5175
5271
  /** Machine code for branching; opaque and backend-defined. */
5176
- code: z41.string(),
5272
+ code: z42.string(),
5177
5273
  /** Human-readable text, meant to be shown as-is. */
5178
- content: z41.string()
5274
+ content: z42.string()
5179
5275
  });
5180
- var CartSchema = z41.object({
5181
- id: z41.string(),
5182
- lines: z41.array(CartLineSchema),
5183
- totalQuantity: z41.number().int().nonnegative(),
5276
+ var CartSchema = z42.object({
5277
+ id: z42.string(),
5278
+ lines: z42.array(CartLineSchema),
5279
+ totalQuantity: z42.number().int().nonnegative(),
5184
5280
  subtotal: MoneySchema,
5185
5281
  /**
5186
5282
  * Cart total after discounts (pre-shipping/tax). Absent when the
@@ -5190,11 +5286,11 @@ var CartSchema = z41.object({
5190
5286
  */
5191
5287
  total: MoneySchema.optional(),
5192
5288
  /** Discount codes currently attached to the cart. */
5193
- discountCodes: z41.array(CartDiscountCodeSchema).default([]),
5289
+ discountCodes: z42.array(CartDiscountCodeSchema).default([]),
5194
5290
  /** Notices the backend attached to this cart — see `CartMessageSchema`.
5195
5291
  * Empty when the backend said nothing or does not report them. */
5196
- messages: z41.array(CartMessageSchema).default([]),
5197
- checkoutUrl: z41.string().optional(),
5292
+ messages: z42.array(CartMessageSchema).default([]),
5293
+ checkoutUrl: z42.string().optional(),
5198
5294
  /**
5199
5295
  * Opaque handle this cart is known by in the connector's BACK OFFICE — the
5200
5296
  * value a space owner searches there to find the order this cart became.
@@ -5207,14 +5303,14 @@ var CartSchema = z41.object({
5207
5303
  * Absent when the platform has no such handle, or while the cart is still the
5208
5304
  * client's optimistic paint and its id is client-minted.
5209
5305
  */
5210
- backOfficeRef: z41.string().optional(),
5306
+ backOfficeRef: z42.string().optional(),
5211
5307
  /**
5212
5308
  * URL that recreates this cart on the merchant's own store website
5213
5309
  * (replace semantics — overwrites any cart the visitor already has
5214
5310
  * there). Populated by platform adapters that support it; absent when
5215
5311
  * the cart is empty or the URL cannot be built.
5216
5312
  */
5217
- storeCartUrl: z41.string().optional(),
5313
+ storeCartUrl: z42.string().optional(),
5218
5314
  /**
5219
5315
  * True while this cart exists only in the client's optimistic paint —
5220
5316
  * no backend cart has been created yet, so its `id` is client-minted and
@@ -5222,7 +5318,7 @@ var CartSchema = z41.object({
5222
5318
  * `CartLineSchema.pending`: the adapter never sets it, and callers that
5223
5319
  * need a real cart id read THIS rather than sniffing the id's shape.
5224
5320
  */
5225
- pending: z41.boolean().optional()
5321
+ pending: z42.boolean().optional()
5226
5322
  });
5227
5323
  function settledCart(cart) {
5228
5324
  if (cart === null || cart === void 0) return null;
@@ -5230,27 +5326,27 @@ function settledCart(cart) {
5230
5326
  }
5231
5327
 
5232
5328
  // ../ecommerce/src/review-schemas.ts
5233
- import { z as z42 } from "zod";
5329
+ import { z as z43 } from "zod";
5234
5330
  var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
5235
- var ProductReviewItemSchema = z42.object({
5236
- author: z42.string(),
5237
- rating: z42.number(),
5331
+ var ProductReviewItemSchema = z43.object({
5332
+ author: z43.string(),
5333
+ rating: z43.number(),
5238
5334
  /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
5239
- title: z42.string().optional(),
5240
- content: z42.string(),
5241
- date: z42.string(),
5242
- verified: z42.boolean().optional(),
5335
+ title: z43.string().optional(),
5336
+ content: z43.string(),
5337
+ date: z43.string(),
5338
+ verified: z43.boolean().optional(),
5243
5339
  /**
5244
5340
  * Non-empty when the review was written for a grouped SIBLING product rather
5245
5341
  * than this one (brands pool reviews across a product line). A surface can
5246
5342
  * attribute it; empty / absent ⇒ the product's own review.
5247
5343
  */
5248
- writtenFor: z42.string().optional()
5344
+ writtenFor: z43.string().optional()
5249
5345
  });
5250
5346
  var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
5251
5347
  /** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
5252
5348
  * scored, NOT necessarily text that occurs in `content`. */
5253
- highlight: z42.string().optional(),
5349
+ highlight: z43.string().optional(),
5254
5350
  /**
5255
5351
  * `highlight` resolved back into `content` as a VERBATIM substring, so a
5256
5352
  * surface can mark it with a plain `indexOf` and no matcher of its own.
@@ -5265,29 +5361,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
5265
5361
  * Absent when the passage genuinely has no home in the body (one cut from the
5266
5362
  * title). A surface then marks NOTHING rather than guessing at a span.
5267
5363
  */
5268
- mark: z42.string().optional()
5364
+ mark: z43.string().optional()
5269
5365
  });
5270
- var ReviewAggregateSchema = z42.object({
5271
- value: z42.number(),
5272
- count: z42.number()
5366
+ var ReviewAggregateSchema = z43.object({
5367
+ value: z43.number(),
5368
+ count: z43.number()
5273
5369
  });
5274
- var ProductReviewDataSchema = z42.object({
5275
- id: z42.string(),
5370
+ var ProductReviewDataSchema = z43.object({
5371
+ id: z43.string(),
5276
5372
  /** The product's FULL retrieved set — what a filterable list renders. */
5277
- reviews: z42.array(ProductReviewItemSchema).default([]),
5373
+ reviews: z43.array(ProductReviewItemSchema).default([]),
5278
5374
  aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
5279
5375
  /** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
5280
- distribution: z42.array(z42.number()).default([]),
5376
+ distribution: z43.array(z43.number()).default([]),
5281
5377
  /**
5282
5378
  * The reviews that ANSWER the surface's intent, best first. Empty when no
5283
5379
  * intent was asked for — never a silent copy of `reviews`.
5284
5380
  */
5285
- highlights: z42.array(ProductReviewHighlightSchema).default([]),
5381
+ highlights: z43.array(ProductReviewHighlightSchema).default([]),
5286
5382
  /**
5287
5383
  * True when the review provider could not be read and nothing is indexed —
5288
5384
  * the empty lists mean "not loaded", NOT "this product has no reviews".
5289
5385
  */
5290
- unavailable: z42.boolean().optional()
5386
+ unavailable: z43.boolean().optional()
5291
5387
  });
5292
5388
  var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
5293
5389
 
@@ -5581,9 +5677,9 @@ function readPdpCompanions(config) {
5581
5677
  }
5582
5678
 
5583
5679
  // ../ecommerce/src/base-attributes.ts
5584
- import { z as z43 } from "zod";
5680
+ import { z as z44 } from "zod";
5585
5681
  var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
5586
- var BaseAttributesRecordSchema = z43.record(z43.string(), AttributeDefSchema);
5682
+ var BaseAttributesRecordSchema = z44.record(z44.string(), AttributeDefSchema);
5587
5683
  function buildBaseAttributesConfig(attributes) {
5588
5684
  return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
5589
5685
  }
@@ -5594,9 +5690,9 @@ function readBaseAttributesConfig(config) {
5594
5690
  }
5595
5691
 
5596
5692
  // ../ecommerce/src/bucket-labels.ts
5597
- import { z as z44 } from "zod";
5693
+ import { z as z45 } from "zod";
5598
5694
  var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
5599
- var BucketLabelsRecordSchema = z44.record(z44.string(), z44.string());
5695
+ var BucketLabelsRecordSchema = z45.record(z45.string(), z45.string());
5600
5696
  function buildBucketLabelsConfig(labels) {
5601
5697
  return { [BUCKET_LABELS_CONFIG_KEY]: labels };
5602
5698
  }
@@ -5622,6 +5718,22 @@ function clearProductNameLookups() {
5622
5718
  factories.length = 0;
5623
5719
  }
5624
5720
 
5721
+ // ../ecommerce/src/code-discounts.ts
5722
+ var factories2 = [];
5723
+ function registerCodeDiscountSource(factory) {
5724
+ factories2.push(factory);
5725
+ }
5726
+ function resolveCodeDiscountSource(options) {
5727
+ for (const factory of factories2) {
5728
+ const source = factory(options);
5729
+ if (source !== void 0) return source;
5730
+ }
5731
+ return void 0;
5732
+ }
5733
+ function clearCodeDiscountSources() {
5734
+ factories2.length = 0;
5735
+ }
5736
+
5625
5737
  // src/session/visitor-locale.ts
5626
5738
  var cached = null;
5627
5739
  function getVisitorLocale() {
@@ -5630,6 +5742,30 @@ function getVisitorLocale() {
5630
5742
  cached = parseBcp47Locale(navigator.language);
5631
5743
  return cached;
5632
5744
  }
5745
+ function commerceLocaleOf(spaceLocale) {
5746
+ const visitor = getVisitorLocale();
5747
+ if (spaceLocale === void 0) return visitor;
5748
+ const space = parseBcp47Locale(spaceLocale);
5749
+ const out = {};
5750
+ if (space.language !== void 0) out.language = space.language;
5751
+ const country = space.country !== void 0 ? space.country : visitor.country;
5752
+ if (country !== void 0) out.country = country;
5753
+ return out;
5754
+ }
5755
+
5756
+ // src/session/space-locale-context.tsx
5757
+ import * as React from "react";
5758
+ import { jsx } from "react/jsx-runtime";
5759
+ var SpaceLocaleContext = React.createContext(DEFAULT_SPACE_LOCALE);
5760
+ function SpaceLocaleProvider({ locale, children }) {
5761
+ return /* @__PURE__ */ jsx(SpaceLocaleContext.Provider, { value: locale, children });
5762
+ }
5763
+ function useSpaceLocale() {
5764
+ return React.useContext(SpaceLocaleContext);
5765
+ }
5766
+ function useTextDirection() {
5767
+ return textDirectionOf(useSpaceLocale());
5768
+ }
5633
5769
 
5634
5770
  // src/session/clear-registry.ts
5635
5771
  var sessionScopedClearHandlers = /* @__PURE__ */ new Set();
@@ -5689,17 +5825,17 @@ __export(shell_exports, {
5689
5825
  });
5690
5826
 
5691
5827
  // src/shell/ScrollContainerContext.tsx
5692
- import React from "react";
5693
- import { jsx } from "react/jsx-runtime";
5694
- var ScrollContainerContext = React.createContext(null);
5828
+ import React2 from "react";
5829
+ import { jsx as jsx2 } from "react/jsx-runtime";
5830
+ var ScrollContainerContext = React2.createContext(null);
5695
5831
  function ScrollContainerProvider({
5696
5832
  value,
5697
5833
  children
5698
5834
  }) {
5699
- return /* @__PURE__ */ jsx(ScrollContainerContext.Provider, { value, children });
5835
+ return /* @__PURE__ */ jsx2(ScrollContainerContext.Provider, { value, children });
5700
5836
  }
5701
5837
  function useScrollContainerRef() {
5702
- const ref = React.useContext(ScrollContainerContext);
5838
+ const ref = React2.useContext(ScrollContainerContext);
5703
5839
  if (!ref) {
5704
5840
  throw new Error(
5705
5841
  "useScrollContainerRef must be used inside <ScrollContainerProvider> (mounted by FourtyProvider)."
@@ -5709,31 +5845,31 @@ function useScrollContainerRef() {
5709
5845
  }
5710
5846
 
5711
5847
  // src/shell/ShellRegistry.tsx
5712
- import { createContext as createContext3, useContext as useContext3 } from "react";
5713
- import { jsx as jsx2 } from "react/jsx-runtime";
5714
- var ShellRegistryContext = createContext3({});
5848
+ import { createContext as createContext4, useContext as useContext4 } from "react";
5849
+ import { jsx as jsx3 } from "react/jsx-runtime";
5850
+ var ShellRegistryContext = createContext4({});
5715
5851
  function ShellRegistryProvider({
5716
5852
  registry: registry2,
5717
5853
  children
5718
5854
  }) {
5719
- return /* @__PURE__ */ jsx2(ShellRegistryContext.Provider, { value: registry2, children });
5855
+ return /* @__PURE__ */ jsx3(ShellRegistryContext.Provider, { value: registry2, children });
5720
5856
  }
5721
5857
  function useShellRegistry() {
5722
- return useContext3(ShellRegistryContext);
5858
+ return useContext4(ShellRegistryContext);
5723
5859
  }
5724
5860
 
5725
5861
  // src/shell/ShellRootContext.tsx
5726
- import { createContext as createContext4, useContext as useContext4 } from "react";
5727
- var ShellRootContext = createContext4(null);
5862
+ import { createContext as createContext5, useContext as useContext5 } from "react";
5863
+ var ShellRootContext = createContext5(null);
5728
5864
  function useShellRoot() {
5729
- const ref = useContext4(ShellRootContext);
5865
+ const ref = useContext5(ShellRootContext);
5730
5866
  return ref ? ref.current : null;
5731
5867
  }
5732
5868
 
5733
5869
  // src/shell/dock-persistence.tsx
5734
- import React3 from "react";
5735
- import { jsx as jsx3 } from "react/jsx-runtime";
5736
- var DockPersistenceContext = React3.createContext({
5870
+ import React4 from "react";
5871
+ import { jsx as jsx4 } from "react/jsx-runtime";
5872
+ var DockPersistenceContext = React4.createContext({
5737
5873
  initialOpen: null,
5738
5874
  onOpenChange: () => {
5739
5875
  }
@@ -5742,28 +5878,28 @@ function DockPersistenceProvider({
5742
5878
  value,
5743
5879
  children
5744
5880
  }) {
5745
- return /* @__PURE__ */ jsx3(DockPersistenceContext.Provider, { value, children });
5881
+ return /* @__PURE__ */ jsx4(DockPersistenceContext.Provider, { value, children });
5746
5882
  }
5747
5883
  function useDockPersistence() {
5748
- return React3.useContext(DockPersistenceContext);
5884
+ return React4.useContext(DockPersistenceContext);
5749
5885
  }
5750
5886
 
5751
5887
  // src/shell/use-dock-state.ts
5752
- import React6 from "react";
5888
+ import React7 from "react";
5753
5889
 
5754
5890
  // src/canvas/runtime-context.tsx
5755
- import { createContext as createContext5, useContext as useContext5 } from "react";
5756
- var FourtyRuntimeContext = createContext5(null);
5891
+ import { createContext as createContext6, useContext as useContext6 } from "react";
5892
+ var FourtyRuntimeContext = createContext6(null);
5757
5893
  var FourtyRuntimeProvider = FourtyRuntimeContext.Provider;
5758
5894
  function useFourtyRuntime() {
5759
- const runtime = useContext5(FourtyRuntimeContext);
5895
+ const runtime = useContext6(FourtyRuntimeContext);
5760
5896
  if (!runtime) {
5761
5897
  throw new Error("useFourtyRuntime must be used within a <FourtyProvider>");
5762
5898
  }
5763
5899
  return runtime;
5764
5900
  }
5765
5901
  function useOptionalFourtyRuntime() {
5766
- return useContext5(FourtyRuntimeContext);
5902
+ return useContext6(FourtyRuntimeContext);
5767
5903
  }
5768
5904
 
5769
5905
  // src/canvas/runtime-hooks.ts
@@ -5862,21 +5998,21 @@ function useHasLeftSeedHome() {
5862
5998
  }
5863
5999
 
5864
6000
  // src/shell/use-hydrated.ts
5865
- import React4 from "react";
6001
+ import React5 from "react";
5866
6002
  function useHydrated() {
5867
- const [hydrated, setHydrated] = React4.useState(false);
5868
- React4.useEffect(() => {
6003
+ const [hydrated, setHydrated] = React5.useState(false);
6004
+ React5.useEffect(() => {
5869
6005
  setHydrated(true);
5870
6006
  }, []);
5871
6007
  return hydrated;
5872
6008
  }
5873
6009
 
5874
6010
  // src/shell/use-overridable-toggle.ts
5875
- import React5 from "react";
6011
+ import React6 from "react";
5876
6012
  function useOverridableToggle(defaultValue) {
5877
- const [override, setOverride] = React5.useState(null);
6013
+ const [override, setOverride] = React6.useState(null);
5878
6014
  const value = override === null ? defaultValue : override;
5879
- const set = React5.useCallback((next) => {
6015
+ const set = React6.useCallback((next) => {
5880
6016
  setOverride(next);
5881
6017
  }, []);
5882
6018
  const toggle = () => {
@@ -5893,9 +6029,9 @@ function useDockState(reopenOnMessage, autoOpen) {
5893
6029
  const hasLeftHome = useHasLeftSeedHome();
5894
6030
  const agentDriven = useAgentDriven();
5895
6031
  const settled = sessionId !== null;
5896
- const settledRef = React6.useRef(false);
5897
- const engagedWhenSettledRef = React6.useRef(false);
5898
- const hasEngagedRef = React6.useRef(initialOpen === true);
6032
+ const settledRef = React7.useRef(false);
6033
+ const engagedWhenSettledRef = React7.useRef(false);
6034
+ const hasEngagedRef = React7.useRef(initialOpen === true);
5899
6035
  const historyIsAccountedFor = initialOpen !== null;
5900
6036
  const engagementIsNew = historyIsAccountedFor ? settledRef.current && !engagedWhenSettledRef.current : true;
5901
6037
  if (hasLeftHome && engagementIsNew && !agentDriven) hasEngagedRef.current = true;
@@ -5903,8 +6039,8 @@ function useDockState(reopenOnMessage, autoOpen) {
5903
6039
  const openDefault = agentDriven || !autoOpen ? false : hydrated ? hasEngagedRef.current : initialOpen === true;
5904
6040
  const toggle = useOverridableToggle(openDefault);
5905
6041
  const userTurns = messages.reduce((n, m) => m.role === "user" ? n + 1 : n, 0);
5906
- const prevUserTurns = React6.useRef(userTurns);
5907
- React6.useEffect(() => {
6042
+ const prevUserTurns = React7.useRef(userTurns);
6043
+ React7.useEffect(() => {
5908
6044
  if (!settledRef.current) {
5909
6045
  if (!settled) return;
5910
6046
  settledRef.current = true;
@@ -5915,7 +6051,7 @@ function useDockState(reopenOnMessage, autoOpen) {
5915
6051
  if (reopenOnMessage && autoOpen && !agentDriven && userTurns > prevUserTurns.current) toggle.set(true);
5916
6052
  prevUserTurns.current = userTurns;
5917
6053
  }, [userTurns, settled, hasLeftHome, reopenOnMessage, autoOpen, agentDriven, toggle.set]);
5918
- React6.useEffect(() => {
6054
+ React7.useEffect(() => {
5919
6055
  onOpenChange(toggle.value);
5920
6056
  }, [toggle.value, onOpenChange]);
5921
6057
  return { open: toggle.value, toggle: toggle.toggle };
@@ -5947,7 +6083,7 @@ function useExclusiveOverlay(id, open, close) {
5947
6083
  }
5948
6084
 
5949
6085
  // src/shell/composer-attachments/use-composer-attachments.ts
5950
- import * as React7 from "react";
6086
+ import * as React8 from "react";
5951
6087
 
5952
6088
  // src/utils/core-utils/mint-id.ts
5953
6089
  function mintId(prefix) {
@@ -5976,27 +6112,29 @@ async function heicToJpeg(file) {
5976
6112
 
5977
6113
  // src/shell/composer-attachments/use-composer-attachments.ts
5978
6114
  var ATTACHMENT_ACCEPT = ALLOWED_ATTACHMENT_TYPES.join(",");
5979
- var MAX_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
5980
6115
  function validate(file) {
5981
- if (file.size === 0) return "File is empty.";
5982
- if (!isAllowedAttachmentType(file.type)) {
5983
- return file.type.length > 0 ? `${file.type} isn't supported.` : "This file type isn't supported.";
5984
- }
5985
- if (file.size > MAX_ATTACHMENT_BYTES) return `File is larger than ${MAX_MB}MB.`;
6116
+ if (file.size === 0) return { kind: "empty" };
6117
+ if (!isAllowedAttachmentType(file.type)) return { kind: "unsupported_type", mimeType: file.type };
6118
+ if (file.size > MAX_ATTACHMENT_BYTES) return { kind: "too_large", maxMb: MAX_ATTACHMENT_MB };
5986
6119
  return null;
5987
6120
  }
6121
+ function failureOf(err) {
6122
+ if (err instanceof AttachmentUploadError) return err.failure;
6123
+ console.warn("[attachments] upload rejected without a reason:", err);
6124
+ return { kind: "upload_failed" };
6125
+ }
5988
6126
  function useComposerAttachments() {
5989
6127
  const session = useFourtySession();
5990
- const [attachments, setAttachments] = React7.useState([]);
5991
- const createdUrls = React7.useRef(/* @__PURE__ */ new Set());
5992
- const update2 = React7.useCallback((localId, patch) => {
6128
+ const [attachments, setAttachments] = React8.useState([]);
6129
+ const createdUrls = React8.useRef(/* @__PURE__ */ new Set());
6130
+ const update2 = React8.useCallback((localId, patch) => {
5993
6131
  setAttachments((prev) => prev.map((a) => a.localId === localId ? { ...a, ...patch } : a));
5994
6132
  }, []);
5995
- const startUpload = React7.useCallback(
6133
+ const startUpload = React8.useCallback(
5996
6134
  (localId, file) => {
5997
- const error = validate(file);
5998
- if (error !== null) {
5999
- update2(localId, { status: "error", error, name: file.name, mimeType: file.type, size: file.size });
6135
+ const failure = validate(file);
6136
+ if (failure !== null) {
6137
+ update2(localId, { status: "error", failure, name: file.name, mimeType: file.type, size: file.size });
6000
6138
  return;
6001
6139
  }
6002
6140
  const previewUrl = isImageAttachment(file.type) ? URL.createObjectURL(file) : null;
@@ -6007,19 +6145,16 @@ function useComposerAttachments() {
6007
6145
  mimeType: file.type,
6008
6146
  size: file.size,
6009
6147
  previewUrl,
6010
- error: null
6148
+ failure: null
6011
6149
  });
6012
6150
  session.uploadAttachment(file).then(
6013
6151
  (ref) => update2(localId, { status: "ready", ref }),
6014
- (err) => update2(localId, {
6015
- status: "error",
6016
- error: err instanceof Error ? err.message : "Upload failed."
6017
- })
6152
+ (err) => update2(localId, { status: "error", failure: failureOf(err) })
6018
6153
  );
6019
6154
  },
6020
6155
  [session, update2]
6021
6156
  );
6022
- const addFiles = React7.useCallback(
6157
+ const addFiles = React8.useCallback(
6023
6158
  (files) => {
6024
6159
  const list2 = Array.from(files);
6025
6160
  for (const file of list2) {
@@ -6034,7 +6169,7 @@ function useComposerAttachments() {
6034
6169
  previewUrl: null,
6035
6170
  status: "uploading",
6036
6171
  ref: null,
6037
- error: null
6172
+ failure: null
6038
6173
  }
6039
6174
  ]);
6040
6175
  if (isHeic(file)) {
@@ -6052,13 +6187,13 @@ function useComposerAttachments() {
6052
6187
  },
6053
6188
  [startUpload]
6054
6189
  );
6055
- const revoke = React7.useCallback((url) => {
6190
+ const revoke = React8.useCallback((url) => {
6056
6191
  if (url !== null && createdUrls.current.has(url)) {
6057
6192
  URL.revokeObjectURL(url);
6058
6193
  createdUrls.current.delete(url);
6059
6194
  }
6060
6195
  }, []);
6061
- const remove2 = React7.useCallback(
6196
+ const remove2 = React8.useCallback(
6062
6197
  (localId) => {
6063
6198
  setAttachments((prev) => {
6064
6199
  const target = prev.find((a) => a.localId === localId);
@@ -6068,12 +6203,12 @@ function useComposerAttachments() {
6068
6203
  },
6069
6204
  [revoke]
6070
6205
  );
6071
- const clear = React7.useCallback(() => {
6206
+ const clear = React8.useCallback(() => {
6072
6207
  for (const url of createdUrls.current) URL.revokeObjectURL(url);
6073
6208
  createdUrls.current.clear();
6074
6209
  setAttachments([]);
6075
6210
  }, []);
6076
- React7.useEffect(
6211
+ React8.useEffect(
6077
6212
  () => () => {
6078
6213
  for (const url of createdUrls.current) URL.revokeObjectURL(url);
6079
6214
  createdUrls.current.clear();
@@ -6081,7 +6216,7 @@ function useComposerAttachments() {
6081
6216
  []
6082
6217
  );
6083
6218
  const hasPending = attachments.some((a) => a.status === "uploading");
6084
- const readyRefs = React7.useMemo(
6219
+ const readyRefs = React8.useMemo(
6085
6220
  () => attachments.filter((a) => a.ref !== null).map((a) => a.ref),
6086
6221
  [attachments]
6087
6222
  );
@@ -6089,7 +6224,7 @@ function useComposerAttachments() {
6089
6224
  }
6090
6225
 
6091
6226
  // src/shell/use-prompt-composer.ts
6092
- import * as React8 from "react";
6227
+ import * as React9 from "react";
6093
6228
 
6094
6229
  // src/voice/use-voice-capture.ts
6095
6230
  import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
@@ -6361,26 +6496,26 @@ function usePromptComposer(options = {}) {
6361
6496
  const internalAttach = useComposerAttachments();
6362
6497
  const attach = attachmentsController !== void 0 ? attachmentsController : internalAttach;
6363
6498
  const [value, setValue] = useComposerDraft();
6364
- const dictationBaseRef = React8.useRef("");
6365
- const handleDictationResult = React8.useCallback((transcript) => {
6499
+ const dictationBaseRef = React9.useRef("");
6500
+ const handleDictationResult = React9.useCallback((transcript) => {
6366
6501
  const base = dictationBaseRef.current;
6367
6502
  setValue(base.length > 0 ? `${base} ${transcript}` : transcript);
6368
6503
  }, [setValue]);
6369
- const submitRef = React8.useRef(() => {
6504
+ const submitRef = React9.useRef(() => {
6370
6505
  });
6371
6506
  const voiceCapture = useVoiceCapture({
6372
6507
  onResult: handleDictationResult,
6373
6508
  onCommit: () => submitRef.current()
6374
6509
  });
6375
- const valueRef = React8.useRef(value);
6510
+ const valueRef = React9.useRef(value);
6376
6511
  valueRef.current = value;
6377
- const toggleDictation = React8.useCallback(() => {
6512
+ const toggleDictation = React9.useCallback(() => {
6378
6513
  if (voiceCapture.state !== "listening") {
6379
6514
  dictationBaseRef.current = valueRef.current;
6380
6515
  }
6381
6516
  voiceCapture.toggle();
6382
6517
  }, [voiceCapture]);
6383
- const onPaste = React8.useCallback(
6518
+ const onPaste = React9.useCallback(
6384
6519
  (e) => {
6385
6520
  const files = e.clipboardData.files;
6386
6521
  if (files.length > 0) {
@@ -6391,7 +6526,7 @@ function usePromptComposer(options = {}) {
6391
6526
  [attach]
6392
6527
  );
6393
6528
  const canSend = (value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending;
6394
- const submit = React8.useCallback(() => {
6529
+ const submit = React9.useCallback(() => {
6395
6530
  if (!((value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending)) return;
6396
6531
  voiceCapture.cancel();
6397
6532
  session.sendMessage(
@@ -6418,10 +6553,10 @@ function usePromptComposer(options = {}) {
6418
6553
  }
6419
6554
 
6420
6555
  // src/shell/use-composer-chip-select.ts
6421
- import * as React9 from "react";
6556
+ import * as React10 from "react";
6422
6557
  function useComposerChipSelect() {
6423
6558
  const session = useFourtySession();
6424
- return React9.useCallback(
6559
+ return React10.useCallback(
6425
6560
  (action) => {
6426
6561
  session.dispatchSuggestionAction({
6427
6562
  id: action.id,
@@ -6435,10 +6570,10 @@ function useComposerChipSelect() {
6435
6570
  }
6436
6571
 
6437
6572
  // src/shell/use-turn-ask-reply.ts
6438
- import * as React10 from "react";
6573
+ import * as React11 from "react";
6439
6574
  function useTurnAskReply() {
6440
6575
  const session = useFourtySession();
6441
- return React10.useCallback(
6576
+ return React11.useCallback(
6442
6577
  (answer) => {
6443
6578
  session.dispatchSuggestionAction({ id: `ask-${answer}`, label: answer, type: "message", payload: { text: answer, followUp: true } });
6444
6579
  },
@@ -6447,14 +6582,14 @@ function useTurnAskReply() {
6447
6582
  }
6448
6583
 
6449
6584
  // src/shell/turn-ask-placement.tsx
6450
- import * as React11 from "react";
6451
- import { jsx as jsx4 } from "react/jsx-runtime";
6452
- var TurnAskPlacementContext = React11.createContext("prose");
6585
+ import * as React12 from "react";
6586
+ import { jsx as jsx5 } from "react/jsx-runtime";
6587
+ var TurnAskPlacementContext = React12.createContext("prose");
6453
6588
  function TurnAskPlacementProvider({ placement, children }) {
6454
- return /* @__PURE__ */ jsx4(TurnAskPlacementContext.Provider, { value: placement, children });
6589
+ return /* @__PURE__ */ jsx5(TurnAskPlacementContext.Provider, { value: placement, children });
6455
6590
  }
6456
6591
  function useTurnAskPlacement() {
6457
- return React11.useContext(TurnAskPlacementContext);
6592
+ return React12.useContext(TurnAskPlacementContext);
6458
6593
  }
6459
6594
 
6460
6595
  // src/shell/use-go-home.ts
@@ -6471,10 +6606,10 @@ function useGoHome() {
6471
6606
  }
6472
6607
 
6473
6608
  // src/shell/use-menu-item-select.ts
6474
- import * as React12 from "react";
6609
+ import * as React13 from "react";
6475
6610
  function useMenuItemSelect() {
6476
6611
  const session = useFourtySession();
6477
- return React12.useCallback(
6612
+ return React13.useCallback(
6478
6613
  (item) => {
6479
6614
  const payload = item.action.payload === void 0 ? {} : item.action.payload;
6480
6615
  session.dispatchSuggestionAction({
@@ -6527,15 +6662,15 @@ function useThreadRows() {
6527
6662
  }
6528
6663
 
6529
6664
  // src/shell/conversation/use-conversation-page.ts
6530
- import * as React16 from "react";
6665
+ import * as React17 from "react";
6531
6666
 
6532
6667
  // src/canvas/use-is-seed-home.ts
6533
- import * as React13 from "react";
6668
+ import * as React14 from "react";
6534
6669
  function useIsSeedHome() {
6535
6670
  const layout = useDisplayedLayout();
6536
6671
  const turn = useTurn();
6537
6672
  const sessionState = useSessionState();
6538
- return React13.useMemo(() => {
6673
+ return React14.useMemo(() => {
6539
6674
  if (sessionState.seedLayout === null) return false;
6540
6675
  if (turn.index !== 0) return false;
6541
6676
  if (turn.userMessage !== "") return false;
@@ -6771,8 +6906,8 @@ var PRESENCE_LIFECYCLE = {
6771
6906
  };
6772
6907
 
6773
6908
  // ../spacestation/src/widgets/presence/profile.ts
6774
- import { z as z45 } from "zod";
6775
- var PresenceProfileSchema = z45.object({
6909
+ import { z as z46 } from "zod";
6910
+ var PresenceProfileSchema = z46.object({
6776
6911
  /**
6777
6912
  * How much the agent SPEAKS in presence.
6778
6913
  * - 'off' the faculty generates no prose at all. Zero tokens, and
@@ -6782,14 +6917,14 @@ var PresenceProfileSchema = z45.object({
6782
6917
  * - 'terse' one lead line per turn. The default — see below.
6783
6918
  * - 'full' a lead line plus asides beside individual elements.
6784
6919
  */
6785
- voice: z45.enum(["off", "terse", "full"]),
6920
+ voice: z46.enum(["off", "terse", "full"]),
6786
6921
  /**
6787
6922
  * Which source kinds this space surfaces. 'all' = every tool that declares a
6788
6923
  * `sourceKind`. An explicit list lets a space stay quiet about lookups its
6789
6924
  * visitors would find uninteresting (policy checks on a fashion space)
6790
6925
  * without the tool having to lie about what it is.
6791
6926
  */
6792
- sources: z45.union([z45.array(z45.string()), z45.literal("all")]),
6927
+ sources: z46.union([z46.array(z46.string()), z46.literal("all")]),
6793
6928
  /**
6794
6929
  * Which facts render.
6795
6930
  * - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
@@ -6798,7 +6933,7 @@ var PresenceProfileSchema = z45.object({
6798
6933
  * - 'all' shows stated facts too — for spaces where confirming the brief
6799
6934
  * back is itself the product (intake, configuration).
6800
6935
  */
6801
- facts: z45.enum(["inferred-only", "all"])
6936
+ facts: z46.enum(["inferred-only", "all"])
6802
6937
  });
6803
6938
  var DEFAULT_PRESENCE_PROFILE = {
6804
6939
  voice: "terse",
@@ -6807,18 +6942,18 @@ var DEFAULT_PRESENCE_PROFILE = {
6807
6942
  };
6808
6943
 
6809
6944
  // src/widgets/presence/runtime-context.tsx
6810
- import { createContext as createContext7, useContext as useContext7 } from "react";
6811
- var PresenceRuntimeContext = createContext7(null);
6945
+ import { createContext as createContext8, useContext as useContext8 } from "react";
6946
+ var PresenceRuntimeContext = createContext8(null);
6812
6947
  var PresenceRuntimeProvider = PresenceRuntimeContext.Provider;
6813
6948
  function usePresenceRuntime() {
6814
- const runtime = useContext7(PresenceRuntimeContext);
6949
+ const runtime = useContext8(PresenceRuntimeContext);
6815
6950
  if (!runtime) {
6816
6951
  throw new Error("usePresenceRuntime must be used within a <FourtyProvider>");
6817
6952
  }
6818
6953
  return runtime;
6819
6954
  }
6820
6955
  function useOptionalPresenceRuntime() {
6821
- return useContext7(PresenceRuntimeContext);
6956
+ return useContext8(PresenceRuntimeContext);
6822
6957
  }
6823
6958
  function useScanning() {
6824
6959
  return usePresenceRuntime().useScanning();
@@ -6994,17 +7129,17 @@ function useAgentPresenceFresh(flowId = PRESENCE_FLOW) {
6994
7129
  import { useMemo as useMemo5 } from "react";
6995
7130
 
6996
7131
  // src/catalog/CatalogContext.tsx
6997
- import { createContext as createContext8, useContext as useContext8 } from "react";
6998
- import { jsx as jsx5 } from "react/jsx-runtime";
6999
- var CatalogContext = createContext8({});
7132
+ import { createContext as createContext9, useContext as useContext9 } from "react";
7133
+ import { jsx as jsx6 } from "react/jsx-runtime";
7134
+ var CatalogContext = createContext9({});
7000
7135
  function CatalogProvider({
7001
7136
  catalog,
7002
7137
  children
7003
7138
  }) {
7004
- return /* @__PURE__ */ jsx5(CatalogContext.Provider, { value: catalog, children });
7139
+ return /* @__PURE__ */ jsx6(CatalogContext.Provider, { value: catalog, children });
7005
7140
  }
7006
7141
  function useComponentCatalog() {
7007
- return useContext8(CatalogContext);
7142
+ return useContext9(CatalogContext);
7008
7143
  }
7009
7144
 
7010
7145
  // src/canvas/layout-entity-refs.ts
@@ -7064,10 +7199,10 @@ function useAgentPresence(flowId = PRESENCE_FLOW) {
7064
7199
  }
7065
7200
 
7066
7201
  // src/widgets/presence/use-forget-fact.ts
7067
- import * as React15 from "react";
7202
+ import * as React16 from "react";
7068
7203
 
7069
7204
  // src/widgets/presence/use-optimistic-flow-set.ts
7070
- import * as React14 from "react";
7205
+ import * as React15 from "react";
7071
7206
  function readKeys(data) {
7072
7207
  if (typeof data !== "object" || data === null || !("keys" in data)) return [];
7073
7208
  const raw = data.keys;
@@ -7076,8 +7211,8 @@ function readKeys(data) {
7076
7211
  function useOptimisticFlowSet(flowId) {
7077
7212
  const keys = readKeys(useAgentFlow(flowId));
7078
7213
  const joined = keys.join("\0");
7079
- const set = React14.useMemo(() => new Set(keys), [joined]);
7080
- return React14.useMemo(
7214
+ const set = React15.useMemo(() => new Set(keys), [joined]);
7215
+ return React15.useMemo(
7081
7216
  () => ({
7082
7217
  has: (key) => set.has(key),
7083
7218
  add: (key) => {
@@ -7093,7 +7228,7 @@ function useOptimisticFlowSet(flowId) {
7093
7228
  function useReconcileFlowSet(flowId, presentKeys) {
7094
7229
  const data = useAgentFlow(flowId);
7095
7230
  const presentJoined = presentKeys === null ? null : [...presentKeys].join("\0");
7096
- React14.useEffect(() => {
7231
+ React15.useEffect(() => {
7097
7232
  if (presentKeys === null) return;
7098
7233
  const keys = readKeys(data);
7099
7234
  if (keys.length === 0) return;
@@ -7115,7 +7250,7 @@ var useUndismissedFacts = useVisibleFactList;
7115
7250
  function useForgetFact() {
7116
7251
  const { sendImmediateSignal } = useFourtySession();
7117
7252
  const dismissed = useOptimisticFlowSet(DISMISSED_FLOW);
7118
- const forget = React15.useCallback(
7253
+ const forget = React16.useCallback(
7119
7254
  (f) => {
7120
7255
  dismissed.add(f.label);
7121
7256
  sendImmediateSignal({ type: PRESENCE_FACT_DISMISS_SIGNAL, payload: { label: f.label, value: f.value } });
@@ -7166,7 +7301,7 @@ function useConversationPage() {
7166
7301
  const presence = useConversationPresence();
7167
7302
  const suggestions = useSuggestionsWithDefaults();
7168
7303
  const followUp = useComposerChipSelect();
7169
- const onWelcomePage = React16.useMemo(
7304
+ const onWelcomePage = React17.useMemo(
7170
7305
  () => seedLayout !== null && JSON.stringify(layout) === JSON.stringify(seedLayout),
7171
7306
  [layout, seedLayout]
7172
7307
  );
@@ -7234,14 +7369,14 @@ function findThreadHeadroom(scroller) {
7234
7369
  }
7235
7370
 
7236
7371
  // src/shell/thread-scroll/ThreadHeadroom.tsx
7237
- import { jsx as jsx6 } from "react/jsx-runtime";
7372
+ import { jsx as jsx7 } from "react/jsx-runtime";
7238
7373
  var HEADROOM_STYLE = { height: 0, flexShrink: 0 };
7239
7374
  function ThreadHeadroom() {
7240
- return /* @__PURE__ */ jsx6("div", { ...{ [THREAD_HEADROOM_ATTR]: "" }, "aria-hidden": true, style: HEADROOM_STYLE });
7375
+ return /* @__PURE__ */ jsx7("div", { ...{ [THREAD_HEADROOM_ATTR]: "" }, "aria-hidden": true, style: HEADROOM_STYLE });
7241
7376
  }
7242
7377
 
7243
7378
  // src/shell/thread-scroll/use-pin-turn-to-top.ts
7244
- import * as React17 from "react";
7379
+ import * as React18 from "react";
7245
7380
 
7246
7381
  // src/canvas/dom-targets.ts
7247
7382
  var ACTIVE_PANEL_ATTR = "data-fourty-panel-active";
@@ -7418,7 +7553,7 @@ function pinTurnHead(scroller, row, options) {
7418
7553
 
7419
7554
  // src/shell/thread-scroll/use-pin-turn-to-top.ts
7420
7555
  function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
7421
- React17.useEffect(() => {
7556
+ React18.useEffect(() => {
7422
7557
  if (turnId === null) return;
7423
7558
  const scroller = scrollerRef.current;
7424
7559
  const row = turnRef.current;
@@ -7439,10 +7574,10 @@ function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
7439
7574
  }
7440
7575
 
7441
7576
  // src/shell/thread-scroll/use-scroll-has-more-below.ts
7442
- import * as React18 from "react";
7577
+ import * as React19 from "react";
7443
7578
  function useScrollHasMoreBelow(scroller, thresholdPx = 16) {
7444
- const [hasMore, setHasMore] = React18.useState(false);
7445
- React18.useEffect(() => {
7579
+ const [hasMore, setHasMore] = React19.useState(false);
7580
+ React19.useEffect(() => {
7446
7581
  if (scroller === null) return;
7447
7582
  const view = scroller.ownerDocument.defaultView;
7448
7583
  if (view === null) return;
@@ -7482,9 +7617,9 @@ function threadRowAttrs(key) {
7482
7617
  }
7483
7618
 
7484
7619
  // src/shell/thread-scroll/use-thread-jump-marks.ts
7485
- import * as React19 from "react";
7620
+ import * as React20 from "react";
7486
7621
  function useThreadJumpMarks(rows) {
7487
- return React19.useMemo(
7622
+ return React20.useMemo(
7488
7623
  () => rows.filter((row) => row.visitorText.length > 0).map((row) => ({
7489
7624
  key: row.key,
7490
7625
  label: row.visitorText,
@@ -7498,7 +7633,7 @@ function useThreadJumpMarks(rows) {
7498
7633
  }
7499
7634
 
7500
7635
  // src/shell/thread-scroll/use-thread-landing.ts
7501
- import * as React20 from "react";
7636
+ import * as React21 from "react";
7502
7637
 
7503
7638
  // src/shell/thread-scroll/settle-thread-row.ts
7504
7639
  var SETTLE_MS = 1200;
@@ -7562,11 +7697,11 @@ function settleThreadRow(scroller, rowKey, behavior = "smooth") {
7562
7697
  }
7563
7698
 
7564
7699
  // src/shell/thread-scroll/use-thread-landing.ts
7565
- var useIsomorphicLayoutEffect = typeof window === "undefined" ? React20.useEffect : React20.useLayoutEffect;
7700
+ var useIsomorphicLayoutEffect = typeof window === "undefined" ? React21.useEffect : React21.useLayoutEffect;
7566
7701
  function useThreadLanding(scroller, relandKey = 0) {
7567
7702
  const { turnId, seq } = useExplicitTurnSelection();
7568
- const openedWith = React20.useRef({ turnId, seq });
7569
- const landedRef = React20.useRef(null);
7703
+ const openedWith = React21.useRef({ turnId, seq });
7704
+ const landedRef = React21.useRef(null);
7570
7705
  useIsomorphicLayoutEffect(() => {
7571
7706
  if (scroller === null) return;
7572
7707
  if (turnId !== null) {
@@ -7607,10 +7742,10 @@ function settleToHead(scroller) {
7607
7742
  }
7608
7743
 
7609
7744
  // src/provider/providers/handler-registry.ts
7610
- import { createContext as createContext9, useContext as useContext9, useEffect as useEffect9 } from "react";
7611
- var HandlerRegistryContext = createContext9(null);
7745
+ import { createContext as createContext10, useContext as useContext10, useEffect as useEffect9 } from "react";
7746
+ var HandlerRegistryContext = createContext10(null);
7612
7747
  function useRegisterSignalHandlers(handlers) {
7613
- const registry2 = useContext9(HandlerRegistryContext);
7748
+ const registry2 = useContext10(HandlerRegistryContext);
7614
7749
  useEffect9(() => {
7615
7750
  if (!registry2) return;
7616
7751
  return registry2.register(handlers);
@@ -7621,7 +7756,7 @@ function useRegisterSignalHandlers(handlers) {
7621
7756
  var AGENT_ASK_SIGNAL = "agent_ask";
7622
7757
 
7623
7758
  // src/provider/use-clamp-toggle.ts
7624
- import React21 from "react";
7759
+ import React22 from "react";
7625
7760
 
7626
7761
  // src/shared/use-expandable.ts
7627
7762
  import { useCallback as useCallback10, useState as useState5 } from "react";
@@ -7634,9 +7769,9 @@ function useExpandable(initial = false) {
7634
7769
  // src/provider/use-clamp-toggle.ts
7635
7770
  function useClampToggle(contentKey) {
7636
7771
  const { expanded, toggle } = useExpandable(false);
7637
- const [overflowing, setOverflowing] = React21.useState(false);
7638
- const ref = React21.useRef(null);
7639
- React21.useEffect(() => {
7772
+ const [overflowing, setOverflowing] = React22.useState(false);
7773
+ const ref = React22.useRef(null);
7774
+ React22.useEffect(() => {
7640
7775
  const el = ref.current;
7641
7776
  if (el === null) return;
7642
7777
  if (expanded) return;
@@ -7652,16 +7787,16 @@ function useClampToggle(contentKey) {
7652
7787
  }
7653
7788
 
7654
7789
  // src/provider/use-timed-flag.ts
7655
- import React22 from "react";
7790
+ import React23 from "react";
7656
7791
  function useTimedFlag(durationMs) {
7657
- const [flag, setFlag] = React22.useState(false);
7658
- const timerRef = React22.useRef(null);
7659
- React22.useEffect(() => {
7792
+ const [flag, setFlag] = React23.useState(false);
7793
+ const timerRef = React23.useRef(null);
7794
+ React23.useEffect(() => {
7660
7795
  return () => {
7661
7796
  if (timerRef.current !== null) window.clearTimeout(timerRef.current);
7662
7797
  };
7663
7798
  }, []);
7664
- const trigger = React22.useCallback(() => {
7799
+ const trigger = React23.useCallback(() => {
7665
7800
  if (timerRef.current !== null) window.clearTimeout(timerRef.current);
7666
7801
  setFlag(true);
7667
7802
  timerRef.current = window.setTimeout(() => {
@@ -7690,6 +7825,7 @@ __export(canvas_exports, {
7690
7825
  GENERATION_EASE: () => GENERATION_EASE,
7691
7826
  GenerationStyleContext: () => GenerationStyleContext,
7692
7827
  GenerationStyleProvider: () => GenerationStyleProvider,
7828
+ HydrationNoticeProvider: () => HydrationNoticeProvider,
7693
7829
  INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
7694
7830
  ITEM_IDENTITY_ATTR: () => ITEM_IDENTITY_ATTR,
7695
7831
  ItemTransitionGroup: () => ItemTransitionGroup,
@@ -7749,6 +7885,7 @@ __export(canvas_exports, {
7749
7885
  useGenerationStyle: () => useGenerationStyle,
7750
7886
  useHasLeftSeedHome: () => useHasLeftSeedHome,
7751
7887
  useHistoryNav: () => useHistoryNav,
7888
+ useHydrationNotice: () => useHydrationNotice,
7752
7889
  useInteraction: () => useInteraction,
7753
7890
  useIsSeedHome: () => useIsSeedHome,
7754
7891
  useLayout: () => useLayout,
@@ -7772,28 +7909,39 @@ __export(canvas_exports, {
7772
7909
  });
7773
7910
 
7774
7911
  // src/canvas/canvas-tail.tsx
7775
- import * as React23 from "react";
7776
- import { jsx as jsx7 } from "react/jsx-runtime";
7777
- var CanvasTailContext = React23.createContext(null);
7912
+ import * as React24 from "react";
7913
+ import { jsx as jsx8 } from "react/jsx-runtime";
7914
+ var CanvasTailContext = React24.createContext(null);
7778
7915
  function CanvasTailProvider({
7779
7916
  tail,
7780
7917
  children
7781
7918
  }) {
7782
- return /* @__PURE__ */ jsx7(CanvasTailContext.Provider, { value: tail, children });
7919
+ return /* @__PURE__ */ jsx8(CanvasTailContext.Provider, { value: tail, children });
7783
7920
  }
7784
7921
  function useCanvasTail() {
7785
- return React23.useContext(CanvasTailContext);
7922
+ return React24.useContext(CanvasTailContext);
7786
7923
  }
7787
7924
  function CanvasTailMount({
7788
7925
  isActive
7789
7926
  }) {
7790
7927
  const Tail = useCanvasTail();
7791
7928
  if (!isActive || Tail === null) return null;
7792
- return /* @__PURE__ */ jsx7(Tail, {});
7929
+ return /* @__PURE__ */ jsx8(Tail, {});
7930
+ }
7931
+
7932
+ // src/canvas/hydration-notice.tsx
7933
+ import * as React25 from "react";
7934
+ import { jsx as jsx9 } from "react/jsx-runtime";
7935
+ var HydrationNoticeContext = React25.createContext(null);
7936
+ function HydrationNoticeProvider({ notice, children }) {
7937
+ return /* @__PURE__ */ jsx9(HydrationNoticeContext.Provider, { value: notice, children });
7938
+ }
7939
+ function useHydrationNotice() {
7940
+ return React25.useContext(HydrationNoticeContext);
7793
7941
  }
7794
7942
 
7795
7943
  // src/canvas/GenerationStyleContext.tsx
7796
- import { createContext as createContext11, useContext as useContext11 } from "react";
7944
+ import { createContext as createContext13, useContext as useContext13 } from "react";
7797
7945
 
7798
7946
  // src/canvas/generation-style.ts
7799
7947
  var DEFAULT_GENERATION_TIMINGS = {
@@ -7819,19 +7967,19 @@ var DEFAULT_GENERATION_STYLE = {
7819
7967
  var GENERATION_EASE = [0.76, 0, 0.24, 1];
7820
7968
 
7821
7969
  // src/canvas/GenerationStyleContext.tsx
7822
- var GenerationStyleContext = createContext11(DEFAULT_GENERATION_STYLE);
7970
+ var GenerationStyleContext = createContext13(DEFAULT_GENERATION_STYLE);
7823
7971
  var GenerationStyleProvider = GenerationStyleContext.Provider;
7824
7972
  function useGenerationStyle() {
7825
- return useContext11(GenerationStyleContext);
7973
+ return useContext13(GenerationStyleContext);
7826
7974
  }
7827
7975
 
7828
7976
  // src/canvas/ShimmerSweep.tsx
7829
7977
  import { motion, useReducedMotion } from "framer-motion";
7830
- import { jsx as jsx8 } from "react/jsx-runtime";
7978
+ import { jsx as jsx10 } from "react/jsx-runtime";
7831
7979
  function ShimmerSweep({ durationS }) {
7832
7980
  const reduce = useReducedMotion();
7833
7981
  if (reduce === true) return null;
7834
- return /* @__PURE__ */ jsx8(
7982
+ return /* @__PURE__ */ jsx10(
7835
7983
  motion.div,
7836
7984
  {
7837
7985
  "aria-hidden": true,
@@ -7849,14 +7997,14 @@ function ShimmerSweep({ durationS }) {
7849
7997
  }
7850
7998
 
7851
7999
  // src/canvas/TransitionContext.tsx
7852
- import React24, { createContext as createContext12, useContext as useContext12 } from "react";
8000
+ import React26, { createContext as createContext14, useContext as useContext14 } from "react";
7853
8001
  import { AnimatePresence, motion as motion2 } from "framer-motion";
7854
- import { jsx as jsx9 } from "react/jsx-runtime";
8002
+ import { jsx as jsx11 } from "react/jsx-runtime";
7855
8003
  function FadeGroup({ children }) {
7856
- return /* @__PURE__ */ jsx9(AnimatePresence, { mode: "popLayout", initial: false, children });
8004
+ return /* @__PURE__ */ jsx11(AnimatePresence, { mode: "popLayout", initial: false, children });
7857
8005
  }
7858
- var FadeItem = React24.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
7859
- return /* @__PURE__ */ jsx9(
8006
+ var FadeItem = React26.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
8007
+ return /* @__PURE__ */ jsx11(
7860
8008
  motion2.div,
7861
8009
  {
7862
8010
  ref,
@@ -7871,49 +8019,49 @@ var FadeTransition = {
7871
8019
  Group: FadeGroup,
7872
8020
  Item: FadeItem
7873
8021
  };
7874
- var TransitionContext = createContext12(FadeTransition);
8022
+ var TransitionContext = createContext14(FadeTransition);
7875
8023
  function TransitionProvider({
7876
8024
  transition,
7877
8025
  children
7878
8026
  }) {
7879
- return /* @__PURE__ */ jsx9(TransitionContext.Provider, { value: transition, children });
8027
+ return /* @__PURE__ */ jsx11(TransitionContext.Provider, { value: transition, children });
7880
8028
  }
7881
8029
  function useLayoutTransition() {
7882
- return useContext12(TransitionContext);
8030
+ return useContext14(TransitionContext);
7883
8031
  }
7884
8032
 
7885
8033
  // src/canvas/canvas-arrangement.tsx
7886
- import React25, { createContext as createContext13, useContext as useContext13 } from "react";
7887
- import { jsx as jsx10 } from "react/jsx-runtime";
7888
- var CanvasArrangementContext = createContext13({ arrangement: "stack", turnPages: false });
8034
+ import React27, { createContext as createContext15, useContext as useContext15 } from "react";
8035
+ import { jsx as jsx12 } from "react/jsx-runtime";
8036
+ var CanvasArrangementContext = createContext15({ arrangement: "stack", turnPages: false });
7889
8037
  function CanvasArrangementProvider({
7890
8038
  arrangement,
7891
8039
  turnPages = false,
7892
8040
  children
7893
8041
  }) {
7894
- const value = React25.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
7895
- return /* @__PURE__ */ jsx10(CanvasArrangementContext.Provider, { value, children });
8042
+ const value = React27.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
8043
+ return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value, children });
7896
8044
  }
7897
8045
  function useCanvasArrangement() {
7898
- return useContext13(CanvasArrangementContext);
8046
+ return useContext15(CanvasArrangementContext);
7899
8047
  }
7900
8048
 
7901
8049
  // src/canvas/canvas-motion-style.tsx
7902
- import { createContext as createContext14, useContext as useContext14 } from "react";
7903
- import { jsx as jsx11 } from "react/jsx-runtime";
7904
- var CanvasMotionStyleContext = createContext14(null);
8050
+ import { createContext as createContext16, useContext as useContext16 } from "react";
8051
+ import { jsx as jsx13 } from "react/jsx-runtime";
8052
+ var CanvasMotionStyleContext = createContext16(null);
7905
8053
  function CanvasMotionStyleProvider({ style, children }) {
7906
- return /* @__PURE__ */ jsx11(CanvasMotionStyleContext.Provider, { value: style, children });
8054
+ return /* @__PURE__ */ jsx13(CanvasMotionStyleContext.Provider, { value: style, children });
7907
8055
  }
7908
8056
  function useCanvasMotionStyle() {
7909
- return useContext14(CanvasMotionStyleContext);
8057
+ return useContext16(CanvasMotionStyleContext);
7910
8058
  }
7911
8059
 
7912
8060
  // src/canvas/ElementIdContext.ts
7913
- import { createContext as createContext15, useContext as useContext15 } from "react";
7914
- var ElementIdContext = createContext15(null);
8061
+ import { createContext as createContext17, useContext as useContext17 } from "react";
8062
+ var ElementIdContext = createContext17(null);
7915
8063
  function useElementId() {
7916
- return useContext15(ElementIdContext);
8064
+ return useContext17(ElementIdContext);
7917
8065
  }
7918
8066
 
7919
8067
  // src/canvas/generation-entrance.ts
@@ -8173,22 +8321,22 @@ function deriveTurnChangeAnchor(prev, next) {
8173
8321
  }
8174
8322
 
8175
8323
  // src/canvas/canvas-outlet.tsx
8176
- import { createContext as createContext16, useContext as useContext16 } from "react";
8177
- import { jsx as jsx12 } from "react/jsx-runtime";
8178
- var CanvasOutletContext = createContext16(null);
8324
+ import { createContext as createContext18, useContext as useContext18 } from "react";
8325
+ import { jsx as jsx14 } from "react/jsx-runtime";
8326
+ var CanvasOutletContext = createContext18(null);
8179
8327
  function CanvasOutletProvider({ canvas, children }) {
8180
- return /* @__PURE__ */ jsx12(CanvasOutletContext.Provider, { value: canvas, children });
8328
+ return /* @__PURE__ */ jsx14(CanvasOutletContext.Provider, { value: canvas, children });
8181
8329
  }
8182
8330
  function SpacefrontCanvas() {
8183
- const Canvas = useContext16(CanvasOutletContext);
8331
+ const Canvas = useContext18(CanvasOutletContext);
8184
8332
  if (Canvas === null) {
8185
8333
  throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
8186
8334
  }
8187
- return /* @__PURE__ */ jsx12(Canvas, {});
8335
+ return /* @__PURE__ */ jsx14(Canvas, {});
8188
8336
  }
8189
8337
 
8190
8338
  // src/canvas/item-motion/ItemTransitionGroup.tsx
8191
- import React27 from "react";
8339
+ import React29 from "react";
8192
8340
  import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
8193
8341
 
8194
8342
  // src/canvas/item-motion/classify-items.ts
@@ -8407,7 +8555,7 @@ function getActiveProfile() {
8407
8555
  }
8408
8556
 
8409
8557
  // src/canvas/item-motion/ItemTransitionGroup.tsx
8410
- import { jsx as jsx13 } from "react/jsx-runtime";
8558
+ import { jsx as jsx15 } from "react/jsx-runtime";
8411
8559
  var ITEM_IDENTITY_ATTR = "data-flip-id";
8412
8560
  function ItemTransitionGroup({
8413
8561
  items,
@@ -8422,14 +8570,14 @@ function ItemTransitionGroup({
8422
8570
  const profile = getActiveProfile();
8423
8571
  const animated = reduce !== true;
8424
8572
  const ids = items.map(getId);
8425
- const prevIdsRef = React27.useRef(null);
8426
- const lastChangeRef = React27.useRef(null);
8573
+ const prevIdsRef = React29.useRef(null);
8574
+ const lastChangeRef = React29.useRef(null);
8427
8575
  const prevIds = prevIdsRef.current;
8428
8576
  const freshChange = prevIds === null ? null : classifyItemChange(prevIds, ids);
8429
8577
  if (freshChange !== null) {
8430
8578
  lastChangeRef.current = freshChange;
8431
8579
  }
8432
- React27.useEffect(() => {
8580
+ React29.useEffect(() => {
8433
8581
  prevIdsRef.current = ids;
8434
8582
  });
8435
8583
  const activeChange = lastChangeRef.current;
@@ -8442,7 +8590,7 @@ function ItemTransitionGroup({
8442
8590
  const isGrid = itemClassName === void 0;
8443
8591
  const outerClassName = isGrid ? "h-full" : itemClassName;
8444
8592
  const innerClassName = isGrid ? "h-full" : void 0;
8445
- return /* @__PURE__ */ jsx13("div", { className, style, children: /* @__PURE__ */ jsx13(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
8593
+ return /* @__PURE__ */ jsx15("div", { className, style, children: /* @__PURE__ */ jsx15(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
8446
8594
  const id = getId(item);
8447
8595
  const identityAttr = { [ITEM_IDENTITY_ATTR]: id };
8448
8596
  const isEntering = activeChange !== null && activeChange.entered.includes(id);
@@ -8452,7 +8600,7 @@ function ItemTransitionGroup({
8452
8600
  // `itemClassName`/`itemStyle` size the wrapper for flex/snap
8453
8601
  // layouts (carousel); grid layouts leave them unset and get
8454
8602
  // `h-full` so the cell height reaches the card.
8455
- /* @__PURE__ */ jsx13(
8603
+ /* @__PURE__ */ jsx15(
8456
8604
  motion3.div,
8457
8605
  {
8458
8606
  ...identityAttr,
@@ -8461,7 +8609,7 @@ function ItemTransitionGroup({
8461
8609
  layout: animated ? "position" : void 0,
8462
8610
  layoutDependency,
8463
8611
  transition: animated ? layoutTransition : void 0,
8464
- children: /* @__PURE__ */ jsx13(
8612
+ children: /* @__PURE__ */ jsx15(
8465
8613
  motion3.div,
8466
8614
  {
8467
8615
  className: innerClassName,
@@ -8541,21 +8689,21 @@ __export(catalog_exports, {
8541
8689
  });
8542
8690
 
8543
8691
  // src/catalog/DebugContext.tsx
8544
- import { createContext as createContext17, useContext as useContext17 } from "react";
8545
- import { jsx as jsx14 } from "react/jsx-runtime";
8546
- var DebugContext = createContext17(false);
8692
+ import { createContext as createContext19, useContext as useContext19 } from "react";
8693
+ import { jsx as jsx16 } from "react/jsx-runtime";
8694
+ var DebugContext = createContext19(false);
8547
8695
  function DebugProvider({
8548
8696
  debug,
8549
8697
  children
8550
8698
  }) {
8551
- return /* @__PURE__ */ jsx14(DebugContext.Provider, { value: debug, children });
8699
+ return /* @__PURE__ */ jsx16(DebugContext.Provider, { value: debug, children });
8552
8700
  }
8553
8701
  function useDebug() {
8554
- return useContext17(DebugContext);
8702
+ return useContext19(DebugContext);
8555
8703
  }
8556
8704
 
8557
8705
  // src/catalog/HydrationStateContext.tsx
8558
- import { createContext as createContext18, useContext as useContext18 } from "react";
8706
+ import { createContext as createContext20, useContext as useContext20 } from "react";
8559
8707
  var DEFAULT_STATE = {
8560
8708
  hasResolvedFields: false,
8561
8709
  hydrating: false,
@@ -8565,47 +8713,47 @@ var DEFAULT_STATE = {
8565
8713
  pendingCount: 0,
8566
8714
  errors: []
8567
8715
  };
8568
- var HydrationStateContext = createContext18(DEFAULT_STATE);
8716
+ var HydrationStateContext = createContext20(DEFAULT_STATE);
8569
8717
  function useHydrationState() {
8570
- return useContext18(HydrationStateContext);
8718
+ return useContext20(HydrationStateContext);
8571
8719
  }
8572
8720
 
8573
8721
  // src/catalog/HydratorContext.tsx
8574
- import { createContext as createContext19, useContext as useContext19 } from "react";
8575
- import { jsx as jsx15 } from "react/jsx-runtime";
8576
- var HydratorContext = createContext19({});
8722
+ import { createContext as createContext21, useContext as useContext21 } from "react";
8723
+ import { jsx as jsx17 } from "react/jsx-runtime";
8724
+ var HydratorContext = createContext21({});
8577
8725
  function HydratorProvider({
8578
8726
  hydrators,
8579
8727
  children
8580
8728
  }) {
8581
- return /* @__PURE__ */ jsx15(HydratorContext.Provider, { value: hydrators, children });
8729
+ return /* @__PURE__ */ jsx17(HydratorContext.Provider, { value: hydrators, children });
8582
8730
  }
8583
8731
  function useHydrators() {
8584
- return useContext19(HydratorContext);
8732
+ return useContext21(HydratorContext);
8585
8733
  }
8586
8734
 
8587
8735
  // src/catalog/registry.tsx
8588
- import { createContext as createContext20, useContext as useContext20 } from "react";
8589
- import { jsx as jsx16 } from "react/jsx-runtime";
8590
- var RegistryContext = createContext20({});
8736
+ import { createContext as createContext22, useContext as useContext22 } from "react";
8737
+ import { jsx as jsx18 } from "react/jsx-runtime";
8738
+ var RegistryContext = createContext22({});
8591
8739
  function RegistryProvider({
8592
8740
  registry: registry2,
8593
8741
  children
8594
8742
  }) {
8595
- return /* @__PURE__ */ jsx16(RegistryContext.Provider, { value: registry2, children });
8743
+ return /* @__PURE__ */ jsx18(RegistryContext.Provider, { value: registry2, children });
8596
8744
  }
8597
8745
  function useRegistry() {
8598
- return useContext20(RegistryContext);
8746
+ return useContext22(RegistryContext);
8599
8747
  }
8600
- var PackageLookupContext = createContext20(null);
8748
+ var PackageLookupContext = createContext22(null);
8601
8749
  function PackageLookupProvider({
8602
8750
  lookup,
8603
8751
  children
8604
8752
  }) {
8605
- return /* @__PURE__ */ jsx16(PackageLookupContext.Provider, { value: lookup, children });
8753
+ return /* @__PURE__ */ jsx18(PackageLookupContext.Provider, { value: lookup, children });
8606
8754
  }
8607
8755
  function usePackageLookup() {
8608
- return useContext20(PackageLookupContext);
8756
+ return useContext22(PackageLookupContext);
8609
8757
  }
8610
8758
  function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
8611
8759
  return new Proxy(baseRegistry, {
@@ -8636,9 +8784,9 @@ function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
8636
8784
  }
8637
8785
 
8638
8786
  // src/catalog/render-inline.tsx
8639
- import React30 from "react";
8640
- import { jsx as jsx17 } from "react/jsx-runtime";
8641
- var linkRenderer = (href, key) => /* @__PURE__ */ jsx17(
8787
+ import React32 from "react";
8788
+ import { jsx as jsx19 } from "react/jsx-runtime";
8789
+ var linkRenderer = (href, key) => /* @__PURE__ */ jsx19(
8642
8790
  "a",
8643
8791
  {
8644
8792
  className: "fourty-inline-link",
@@ -8658,14 +8806,14 @@ function linkifyText(text2, keyPrefix) {
8658
8806
  URL_RE.lastIndex = 0;
8659
8807
  while ((match = URL_RE.exec(text2)) !== null) {
8660
8808
  if (match.index > last) {
8661
- out.push(/* @__PURE__ */ jsx17(React30.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
8809
+ out.push(/* @__PURE__ */ jsx19(React32.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
8662
8810
  }
8663
8811
  const href = match[0];
8664
8812
  out.push(linkRenderer(href, `${keyPrefix}-lk-${i++}`));
8665
8813
  last = match.index + href.length;
8666
8814
  }
8667
8815
  if (last < text2.length) {
8668
- out.push(/* @__PURE__ */ jsx17(React30.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
8816
+ out.push(/* @__PURE__ */ jsx19(React32.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
8669
8817
  }
8670
8818
  return out;
8671
8819
  }
@@ -8678,8 +8826,8 @@ function renderInline(text2, keyPrefix) {
8678
8826
  while ((match = re.exec(text2)) !== null) {
8679
8827
  if (match.index > last) out.push(...linkifyText(text2.slice(last, match.index), `${keyPrefix}-t-${i++}`));
8680
8828
  const bold = match[1];
8681
- if (bold !== void 0) out.push(/* @__PURE__ */ jsx17("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
8682
- else out.push(/* @__PURE__ */ jsx17("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
8829
+ if (bold !== void 0) out.push(/* @__PURE__ */ jsx19("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
8830
+ else out.push(/* @__PURE__ */ jsx19("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
8683
8831
  last = match.index + match[0].length;
8684
8832
  }
8685
8833
  if (last < text2.length) out.push(...linkifyText(text2.slice(last), `${keyPrefix}-t-${i++}`));
@@ -8687,7 +8835,7 @@ function renderInline(text2, keyPrefix) {
8687
8835
  }
8688
8836
 
8689
8837
  // src/catalog/component-library.ts
8690
- import * as React31 from "react";
8838
+ import * as React33 from "react";
8691
8839
  function displayNameOf(Inner) {
8692
8840
  if (typeof Inner === "string") return Inner;
8693
8841
  if (typeof Inner.displayName === "string" && Inner.displayName.length > 0) return Inner.displayName;
@@ -8696,7 +8844,7 @@ function displayNameOf(Inner) {
8696
8844
  }
8697
8845
  function adaptComponent(Inner) {
8698
8846
  function Adapted(props) {
8699
- return React31.createElement(Inner, props);
8847
+ return React33.createElement(Inner, props);
8700
8848
  }
8701
8849
  Adapted.displayName = displayNameOf(Inner);
8702
8850
  return Adapted;
@@ -8737,23 +8885,23 @@ function buildComponentLibrary(catalog, componentMap) {
8737
8885
  }
8738
8886
 
8739
8887
  // src/catalog/define.ts
8740
- import { z as z46 } from "zod";
8741
- var HYDRATED_ENTITY = z46.object({}).passthrough();
8888
+ import { z as z47 } from "zod";
8889
+ var HYDRATED_ENTITY = z47.object({}).passthrough();
8742
8890
  function entity(resolverKey, opts) {
8743
8891
  return resolved(HYDRATED_ENTITY, resolverKey, opts);
8744
8892
  }
8745
- var text = prose(z46.string());
8893
+ var text = prose(z47.string());
8746
8894
  function plain() {
8747
- return z46.string();
8895
+ return z47.string();
8748
8896
  }
8749
8897
  function token(values) {
8750
- return z46.enum(values);
8898
+ return z47.enum(values);
8751
8899
  }
8752
8900
  function catalogComponent(meta, render) {
8753
8901
  const { props, requires, ...rest } = meta;
8754
8902
  return {
8755
8903
  ...rest,
8756
- propsSchema: z46.object(props),
8904
+ propsSchema: z47.object(props),
8757
8905
  ...requires !== void 0 ? { requires } : {},
8758
8906
  component: adaptComponent(render)
8759
8907
  };
@@ -9093,7 +9241,7 @@ function useConsumeStandingSignal(type) {
9093
9241
  }
9094
9242
 
9095
9243
  // src/widgets/presence/use-presence-notch.ts
9096
- import * as React32 from "react";
9244
+ import * as React34 from "react";
9097
9245
  var SETTLE_DWELL_MS = 4e3;
9098
9246
  var HOVER_CLOSE_MS = 240;
9099
9247
  var HOVER_BOUNCE_WINDOW_MS = 800;
@@ -9101,21 +9249,21 @@ var BOUNCE_PX = 2;
9101
9249
  function usePresenceNotch(widgets) {
9102
9250
  const askStanding = useStandingOfType(AGENT_ASK_SIGNAL) !== null;
9103
9251
  const { isRunning } = useAgentPresence();
9104
- const [hovered, setHovered] = React32.useState(false);
9105
- const [openDrawerId, setOpenDrawerId] = React32.useState(null);
9106
- const rootRef = React32.useRef(null);
9107
- const toggleDrawer = React32.useCallback((id) => {
9252
+ const [hovered, setHovered] = React34.useState(false);
9253
+ const [openDrawerId, setOpenDrawerId] = React34.useState(null);
9254
+ const rootRef = React34.useRef(null);
9255
+ const toggleDrawer = React34.useCallback((id) => {
9108
9256
  setOpenDrawerId((current2) => current2 === id ? null : id);
9109
9257
  }, []);
9110
- const closeTimer = React32.useRef(null);
9111
- const cancelClose = React32.useCallback(() => {
9258
+ const closeTimer = React34.useRef(null);
9259
+ const cancelClose = React34.useCallback(() => {
9112
9260
  if (closeTimer.current !== null) {
9113
9261
  clearTimeout(closeTimer.current);
9114
9262
  closeTimer.current = null;
9115
9263
  }
9116
9264
  }, []);
9117
- const lastLeaveRef = React32.useRef(null);
9118
- const openHover = React32.useCallback((e) => {
9265
+ const lastLeaveRef = React34.useRef(null);
9266
+ const openHover = React34.useCallback((e) => {
9119
9267
  const last = lastLeaveRef.current;
9120
9268
  if (last !== null && Date.now() - last.t < HOVER_BOUNCE_WINDOW_MS && Math.abs(e.clientX - last.x) <= BOUNCE_PX && Math.abs(e.clientY - last.y) <= BOUNCE_PX) {
9121
9269
  return;
@@ -9123,7 +9271,7 @@ function usePresenceNotch(widgets) {
9123
9271
  cancelClose();
9124
9272
  setHovered(true);
9125
9273
  }, [cancelClose]);
9126
- const scheduleClose = React32.useCallback((e) => {
9274
+ const scheduleClose = React34.useCallback((e) => {
9127
9275
  lastLeaveRef.current = { x: e.clientX, y: e.clientY, t: Date.now() };
9128
9276
  cancelClose();
9129
9277
  closeTimer.current = setTimeout(() => {
@@ -9131,8 +9279,8 @@ function usePresenceNotch(widgets) {
9131
9279
  setHovered(false);
9132
9280
  }, HOVER_CLOSE_MS);
9133
9281
  }, [cancelClose]);
9134
- React32.useEffect(() => cancelClose, [cancelClose]);
9135
- React32.useEffect(() => {
9282
+ React34.useEffect(() => cancelClose, [cancelClose]);
9283
+ React34.useEffect(() => {
9136
9284
  if (openDrawerId === null) return;
9137
9285
  const onKey = (e) => {
9138
9286
  if (e.key === "Escape") setOpenDrawerId(null);
@@ -9140,7 +9288,7 @@ function usePresenceNotch(widgets) {
9140
9288
  window.addEventListener("keydown", onKey);
9141
9289
  return () => window.removeEventListener("keydown", onKey);
9142
9290
  }, [openDrawerId]);
9143
- React32.useEffect(() => {
9291
+ React34.useEffect(() => {
9144
9292
  if (openDrawerId === null) return;
9145
9293
  const onDown = (e) => {
9146
9294
  const root = rootRef.current;
@@ -9152,8 +9300,8 @@ function usePresenceNotch(widgets) {
9152
9300
  document.addEventListener("pointerdown", onDown);
9153
9301
  return () => document.removeEventListener("pointerdown", onDown);
9154
9302
  }, [openDrawerId]);
9155
- const [active, setActive] = React32.useState(false);
9156
- React32.useEffect(() => {
9303
+ const [active, setActive] = React34.useState(false);
9304
+ React34.useEffect(() => {
9157
9305
  if (isRunning) {
9158
9306
  setActive(true);
9159
9307
  return;
@@ -9313,7 +9461,7 @@ function presenceFactShape(fact) {
9313
9461
  }
9314
9462
 
9315
9463
  // src/widgets/presence/use-optimistic-facts.ts
9316
- import * as React33 from "react";
9464
+ import * as React35 from "react";
9317
9465
  function readEntries(data) {
9318
9466
  if (typeof data !== "object" || data === null || !("entries" in data)) return [];
9319
9467
  const raw = data.entries;
@@ -9332,7 +9480,7 @@ function writeOptimisticFact(entries3, fact) {
9332
9480
  }
9333
9481
  function useOptimisticFactOverlay(flowId) {
9334
9482
  const entries3 = readEntries(useAgentFlow(flowId));
9335
- return React33.useMemo(
9483
+ return React35.useMemo(
9336
9484
  () => ({
9337
9485
  entries: entries3,
9338
9486
  add: (fact) => setFlowOutput(flowId, { entries: writeOptimisticFact(entries3, fact) })
@@ -9341,8 +9489,8 @@ function useOptimisticFactOverlay(flowId) {
9341
9489
  );
9342
9490
  }
9343
9491
  function useReconcileOptimisticFacts(flowId, readIdentity) {
9344
- const seenRef = React33.useRef(null);
9345
- React33.useEffect(() => {
9492
+ const seenRef = React35.useRef(null);
9493
+ React35.useEffect(() => {
9346
9494
  if (readIdentity === null) return;
9347
9495
  if (seenRef.current === null) {
9348
9496
  seenRef.current = readIdentity;
@@ -9514,10 +9662,10 @@ __export(chat_exports, {
9514
9662
  });
9515
9663
 
9516
9664
  // src/chat/chat-context.ts
9517
- import { createContext as createContext21, useContext as useContext21 } from "react";
9518
- var FourtyChatContext = createContext21(null);
9665
+ import { createContext as createContext23, useContext as useContext23 } from "react";
9666
+ var FourtyChatContext = createContext23(null);
9519
9667
  function useFourtyChat() {
9520
- const ctx = useContext21(FourtyChatContext);
9668
+ const ctx = useContext23(FourtyChatContext);
9521
9669
  if (!ctx) throw new Error("useFourtyChat must be used inside <FourtyChatProvider>");
9522
9670
  return ctx;
9523
9671
  }
@@ -9754,34 +9902,34 @@ __export(interaction_exports, {
9754
9902
  });
9755
9903
 
9756
9904
  // src/interaction/withInteractionTracking.tsx
9757
- import React34, { createContext as createContext22, useContext as useContext22 } from "react";
9758
- import { jsx as jsx18, jsxs } from "react/jsx-runtime";
9759
- var InteractionContext = createContext22(null);
9905
+ import React36, { createContext as createContext24, useContext as useContext24 } from "react";
9906
+ import { jsx as jsx20, jsxs } from "react/jsx-runtime";
9907
+ var InteractionContext = createContext24(null);
9760
9908
  function InteractionProvider({
9761
9909
  onInteraction,
9762
9910
  children
9763
9911
  }) {
9764
- return /* @__PURE__ */ jsx18(InteractionContext.Provider, { value: onInteraction, children });
9912
+ return /* @__PURE__ */ jsx20(InteractionContext.Provider, { value: onInteraction, children });
9765
9913
  }
9766
9914
  function useInteraction2() {
9767
- return useContext22(InteractionContext);
9915
+ return useContext24(InteractionContext);
9768
9916
  }
9769
9917
  function withInteractionTracking(WrappedComponent, meta) {
9770
9918
  function TrackedComponent(props) {
9771
- return /* @__PURE__ */ jsx18(
9919
+ return /* @__PURE__ */ jsx20(
9772
9920
  "div",
9773
9921
  {
9774
9922
  "data-tracked-component": meta.componentId,
9775
9923
  "data-tracked-component-type": meta.componentType,
9776
9924
  style: { display: "contents" },
9777
- children: /* @__PURE__ */ jsx18(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx18(WrappedComponent, { ...props }) })
9925
+ children: /* @__PURE__ */ jsx20(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx20(WrappedComponent, { ...props }) })
9778
9926
  }
9779
9927
  );
9780
9928
  }
9781
9929
  TrackedComponent.displayName = `Tracked(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
9782
9930
  return TrackedComponent;
9783
9931
  }
9784
- var ComponentErrorBoundary = class extends React34.Component {
9932
+ var ComponentErrorBoundary = class extends React36.Component {
9785
9933
  constructor() {
9786
9934
  super(...arguments);
9787
9935
  __publicField(this, "state", { error: null });
@@ -9795,7 +9943,7 @@ var ComponentErrorBoundary = class extends React34.Component {
9795
9943
  render() {
9796
9944
  if (this.state.error) {
9797
9945
  return /* @__PURE__ */ jsxs("div", { className: "fourty-component-error", role: "alert", "data-component-id": this.props.componentId, children: [
9798
- /* @__PURE__ */ jsx18("strong", { children: this.props.componentId }),
9946
+ /* @__PURE__ */ jsx20("strong", { children: this.props.componentId }),
9799
9947
  ": ",
9800
9948
  this.state.error.message
9801
9949
  ] });
@@ -9855,14 +10003,14 @@ __export(utils_exports, {
9855
10003
  import { useSyncExternalStore as useSyncExternalStore5 } from "react";
9856
10004
 
9857
10005
  // src/utils/viewport-window.tsx
9858
- import { createContext as createContext23, useContext as useContext23 } from "react";
9859
- import { jsx as jsx19 } from "react/jsx-runtime";
9860
- var ViewportWindowContext = createContext23(null);
10006
+ import { createContext as createContext25, useContext as useContext25 } from "react";
10007
+ import { jsx as jsx21 } from "react/jsx-runtime";
10008
+ var ViewportWindowContext = createContext25(null);
9861
10009
  function canAnswer(win) {
9862
10010
  return win !== null && typeof win.matchMedia === "function";
9863
10011
  }
9864
10012
  function useViewportWindow() {
9865
- const provided = useContext23(ViewportWindowContext);
10013
+ const provided = useContext25(ViewportWindowContext);
9866
10014
  if (provided !== null) return canAnswer(provided) ? provided : null;
9867
10015
  const global = globalThis;
9868
10016
  return canAnswer(global) ? global : null;
@@ -9871,7 +10019,7 @@ function ViewportWindowProvider({
9871
10019
  value,
9872
10020
  children
9873
10021
  }) {
9874
- return /* @__PURE__ */ jsx19(ViewportWindowContext.Provider, { value, children });
10022
+ return /* @__PURE__ */ jsx21(ViewportWindowContext.Provider, { value, children });
9875
10023
  }
9876
10024
 
9877
10025
  // src/utils/use-form-factor.ts
@@ -9962,7 +10110,7 @@ function useInlineCompletion(opts) {
9962
10110
  }
9963
10111
 
9964
10112
  // src/utils/use-document-visible.ts
9965
- import React35 from "react";
10113
+ import React37 from "react";
9966
10114
  function subscribe3(onChange) {
9967
10115
  document.addEventListener("visibilitychange", onChange);
9968
10116
  return () => document.removeEventListener("visibilitychange", onChange);
@@ -9974,15 +10122,15 @@ function getServerSnapshot() {
9974
10122
  return true;
9975
10123
  }
9976
10124
  function useDocumentVisible() {
9977
- return React35.useSyncExternalStore(subscribe3, getSnapshot, getServerSnapshot);
10125
+ return React37.useSyncExternalStore(subscribe3, getSnapshot, getServerSnapshot);
9978
10126
  }
9979
10127
 
9980
10128
  // src/utils/use-interval.ts
9981
- import React36 from "react";
10129
+ import React38 from "react";
9982
10130
  function useInterval(callback, ms, active = true) {
9983
- const cbRef = React36.useRef(callback);
10131
+ const cbRef = React38.useRef(callback);
9984
10132
  cbRef.current = callback;
9985
- React36.useEffect(() => {
10133
+ React38.useEffect(() => {
9986
10134
  if (!active) return;
9987
10135
  const id = window.setInterval(() => cbRef.current(), ms);
9988
10136
  return () => window.clearInterval(id);
@@ -10194,15 +10342,15 @@ function primedEntitiesFor(resolverKey) {
10194
10342
  }
10195
10343
 
10196
10344
  // src/preview/SpacefrontPreviewProvider.tsx
10197
- import * as React37 from "react";
10198
- import { jsx as jsx20 } from "react/jsx-runtime";
10345
+ import * as React39 from "react";
10346
+ import { jsx as jsx22 } from "react/jsx-runtime";
10199
10347
  var NOOP = () => {
10200
10348
  };
10201
10349
  var ASYNC_NOOP = () => Promise.resolve();
10202
10350
  var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
10203
- var PreviewContext = React37.createContext(null);
10351
+ var PreviewContext = React39.createContext(null);
10204
10352
  function usePreview() {
10205
- const value = React37.useContext(PreviewContext);
10353
+ const value = React39.useContext(PreviewContext);
10206
10354
  if (value === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
10207
10355
  return value;
10208
10356
  }
@@ -10356,11 +10504,11 @@ var PRESENCE = {
10356
10504
  usePresenceLiveTurn: () => usePreview().pending?.messageId
10357
10505
  };
10358
10506
  function SpacefrontPreviewProvider({ scene, onSend, children }) {
10359
- const [sessionId] = React37.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
10360
- const derived = React37.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
10361
- const onSendRef = React37.useRef(onSend);
10507
+ const [sessionId] = React39.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
10508
+ const derived = React39.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
10509
+ const onSendRef = React39.useRef(onSend);
10362
10510
  onSendRef.current = onSend;
10363
- const draft = React37.useMemo(() => {
10511
+ const draft = React39.useMemo(() => {
10364
10512
  let text2 = "";
10365
10513
  const listeners12 = /* @__PURE__ */ new Set();
10366
10514
  return {
@@ -10376,7 +10524,7 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
10376
10524
  }
10377
10525
  };
10378
10526
  }, []);
10379
- const session = React37.useMemo(() => {
10527
+ const session = React39.useMemo(() => {
10380
10528
  const send = (text2) => {
10381
10529
  draft.set("");
10382
10530
  onSendRef.current?.(text2);
@@ -10428,15 +10576,15 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
10428
10576
  const qId = question === null ? null : question.id;
10429
10577
  const qText = question === null ? "" : question.text;
10430
10578
  const qReplies = question === null ? "" : list(question.replies).join("\0");
10431
- const raised = React37.useRef(0);
10432
- React37.useEffect(() => {
10579
+ const raised = React39.useRef(0);
10580
+ React39.useEffect(() => {
10433
10581
  if (qId === null) return;
10434
10582
  raised.current += 1;
10435
10583
  const id = `${qId}-${raised.current}`;
10436
10584
  raiseStanding(AGENT_ASK_SIGNAL, id, { ask: qText, suggestions: qReplies === "" ? [] : qReplies.split("\0") }, sessionId);
10437
10585
  return () => resolveStanding(id, sessionId);
10438
10586
  }, [qId, qText, qReplies, sessionId]);
10439
- return /* @__PURE__ */ jsx20(PreviewContext.Provider, { value: derived, children: /* @__PURE__ */ jsx20(FourtySessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx20(FourtyRuntimeProvider, { value: RUNTIME, children: /* @__PURE__ */ jsx20(PresenceRuntimeProvider, { value: PRESENCE, children }) }) }) });
10587
+ return /* @__PURE__ */ jsx22(PreviewContext.Provider, { value: derived, children: /* @__PURE__ */ jsx22(FourtySessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx22(FourtyRuntimeProvider, { value: RUNTIME, children: /* @__PURE__ */ jsx22(PresenceRuntimeProvider, { value: PRESENCE, children }) }) }) });
10440
10588
  }
10441
10589
 
10442
10590
  // src/verticals/commerce/index.ts
@@ -10517,6 +10665,7 @@ __export(commerce_exports, {
10517
10665
  useCommerceActions: () => useCommerceActions,
10518
10666
  useCommerceRuntime: () => useCommerceRuntime,
10519
10667
  useComparisonHighlight: () => useComparisonHighlight,
10668
+ useCustomerAccount: () => useCustomerAccount,
10520
10669
  useLookCard: () => useLookCard,
10521
10670
  useOptionSelections: () => useOptionSelections,
10522
10671
  usePendingVariantChoice: () => usePendingVariantChoice,
@@ -10571,7 +10720,7 @@ registerEntityPageKind("search", {
10571
10720
  });
10572
10721
 
10573
10722
  // src/verticals/commerce/commerce-context.tsx
10574
- import { createContext as createContext25, useContext as useContext25 } from "react";
10723
+ import { createContext as createContext27, useContext as useContext27 } from "react";
10575
10724
  var INERT_COMMERCE_RUNTIME = {
10576
10725
  useCart: () => {
10577
10726
  throw new Error("useCart must be used within a <CommerceProvider>");
@@ -10605,14 +10754,17 @@ var INERT_COMMERCE_RUNTIME = {
10605
10754
  highlights: [],
10606
10755
  isLoading: false,
10607
10756
  error: null
10608
- })
10757
+ }),
10758
+ useCustomerAccount: () => ({ signedIn: false, email: null, signIn: () => {
10759
+ }, signOut: async () => {
10760
+ }, available: false })
10609
10761
  };
10610
- var FourtyCommerceRuntimeContext = createContext25(
10762
+ var FourtyCommerceRuntimeContext = createContext27(
10611
10763
  INERT_COMMERCE_RUNTIME
10612
10764
  );
10613
10765
  var FourtyCommerceRuntimeProvider = FourtyCommerceRuntimeContext.Provider;
10614
10766
  function useCommerceRuntime() {
10615
- return useContext25(FourtyCommerceRuntimeContext);
10767
+ return useContext27(FourtyCommerceRuntimeContext);
10616
10768
  }
10617
10769
  function useCart() {
10618
10770
  return useCommerceRuntime().useCart();
@@ -10635,6 +10787,9 @@ function useCollectionByHandle(handle) {
10635
10787
  function useProductReviews(product, intent) {
10636
10788
  return useCommerceRuntime().useProductReviews(product, intent);
10637
10789
  }
10790
+ function useCustomerAccount() {
10791
+ return useCommerceRuntime().useCustomerAccount();
10792
+ }
10638
10793
 
10639
10794
  // src/verticals/commerce/checkout/external-navigation.ts
10640
10795
  function navigateToExternalCommerceUrl(url) {
@@ -10789,18 +10944,18 @@ __export(ecommerce_exports, {
10789
10944
  });
10790
10945
 
10791
10946
  // ../spacestation/src/analytics/ecommerce/surfacing.ts
10792
- import { z as z47 } from "zod";
10947
+ import { z as z48 } from "zod";
10793
10948
  var PRODUCTS_SURFACED = defineEventKind(
10794
10949
  "commerce.products_surfaced",
10795
10950
  "client",
10796
- z47.object({
10951
+ z48.object({
10797
10952
  /** The turn whose commit this describes. Minted where the prompt signal
10798
10953
  * is built and shared with `agent_runs`, so the read layer can line a
10799
10954
  * surfacing up against the prompt that asked for it. */
10800
- turnId: z47.string().min(1).max(128),
10955
+ turnId: z48.string().min(1).max(128),
10801
10956
  /** Distinct entity refs this turn placed that were not on the canvas
10802
10957
  * before it. ZERO IS A REAL VALUE — see the header. */
10803
- productCount: z47.number().int().nonnegative()
10958
+ productCount: z48.number().int().nonnegative()
10804
10959
  }).strict()
10805
10960
  );
10806
10961
 
@@ -11380,10 +11535,10 @@ function useCartDrawer() {
11380
11535
  }
11381
11536
 
11382
11537
  // src/verticals/commerce/cart/use-cart-view.ts
11383
- import React38 from "react";
11538
+ import React40 from "react";
11384
11539
  function useCartView(cart, onCheckout) {
11385
11540
  const analytics = useOptionalAnalyticsSink();
11386
- const [exitPending, setExitPending] = React38.useState(null);
11541
+ const [exitPending, setExitPending] = React40.useState(null);
11387
11542
  const lines = cart === null ? [] : cart.lines;
11388
11543
  const count = lines.reduce((sum, l) => sum + l.quantity, 0);
11389
11544
  const totalsPending = lines.some((l) => isPendingCartLine(l));
@@ -11393,7 +11548,7 @@ function useCartView(cart, onCheckout) {
11393
11548
  const backendTotal = cart !== null && cart.total !== void 0 ? cart.total.amount : void 0;
11394
11549
  const discountAmount = backendTotal !== void 0 && backendTotal < subtotal ? subtotal - backendTotal : 0;
11395
11550
  const effectiveTotal = backendTotal !== void 0 ? backendTotal : subtotal;
11396
- const navigateToExit = React38.useCallback((url, kind) => {
11551
+ const navigateToExit = React40.useCallback((url, kind) => {
11397
11552
  const result = navigateToExternalCommerceUrl(url);
11398
11553
  if (kind === "checkout") recordVisitorCheckoutExit(analytics, result);
11399
11554
  if (result === "new-tab") {
@@ -11410,7 +11565,7 @@ function useCartView(cart, onCheckout) {
11410
11565
  setExitPending(null);
11411
11566
  }
11412
11567
  }, [analytics]);
11413
- const handleCheckout = React38.useCallback(() => {
11568
+ const handleCheckout = React40.useCallback(() => {
11414
11569
  if (lines.length === 0 || exitPending !== null) return;
11415
11570
  setExitPending("checkout");
11416
11571
  if (onCheckout) {
@@ -11430,7 +11585,7 @@ function useCartView(cart, onCheckout) {
11430
11585
  }
11431
11586
  navigateToExit(cart?.checkoutUrl, "checkout");
11432
11587
  }, [lines.length, exitPending, onCheckout, cart, navigateToExit]);
11433
- const handleGoToStore = React38.useCallback(() => {
11588
+ const handleGoToStore = React40.useCallback(() => {
11434
11589
  if (lines.length === 0 || exitPending !== null) return;
11435
11590
  setExitPending("store");
11436
11591
  navigateToExit(cart?.storeCartUrl, "store");
@@ -11518,7 +11673,7 @@ registerSessionScopedClear(() => {
11518
11673
  });
11519
11674
 
11520
11675
  // src/verticals/commerce/cart/use-cart-line-row.ts
11521
- import * as React39 from "react";
11676
+ import * as React41 from "react";
11522
11677
 
11523
11678
  // src/verticals/commerce/use-commerce-actions.ts
11524
11679
  import { useCallback as useCallback22 } from "react";
@@ -11564,19 +11719,19 @@ var SPOTLIGHT_MAX_AGE_MS = 3e4;
11564
11719
  function useCartLineRow(line, opts) {
11565
11720
  const actions = useCommerceActions();
11566
11721
  const drawerFocus = useCartDrawerFocus();
11567
- const rowRef = React39.useRef(null);
11722
+ const rowRef = React41.useRef(null);
11568
11723
  const pending2 = isPendingCartLine(line);
11569
11724
  const navigable = actions !== null && !pending2 && line.productId.length > 0;
11570
11725
  const onNavigated = opts === void 0 ? void 0 : opts.onNavigated;
11571
- const navigatedRef = React39.useRef(onNavigated);
11726
+ const navigatedRef = React41.useRef(onNavigated);
11572
11727
  navigatedRef.current = onNavigated;
11573
- const navigate = React39.useCallback(() => {
11728
+ const navigate = React41.useCallback(() => {
11574
11729
  if (actions === null) return;
11575
11730
  actions.navigateToProduct(line.productId, line.title);
11576
11731
  const done = navigatedRef.current;
11577
11732
  if (done !== void 0) done();
11578
11733
  }, [actions, line.productId, line.title]);
11579
- const interaction = React39.useMemo(() => {
11734
+ const interaction = React41.useMemo(() => {
11580
11735
  if (!navigable) return void 0;
11581
11736
  return {
11582
11737
  onClick: navigate,
@@ -11591,7 +11746,7 @@ function useCartLineRow(line, opts) {
11591
11746
  };
11592
11747
  }, [navigable, navigate]);
11593
11748
  const spotlightKey = drawerFocus !== null && !pending2 && line.productId.length > 0 && drawerFocus.productId === line.productId && Date.now() - drawerFocus.at < SPOTLIGHT_MAX_AGE_MS ? drawerFocus.at : null;
11594
- React39.useEffect(() => {
11749
+ React41.useEffect(() => {
11595
11750
  if (spotlightKey === null) return;
11596
11751
  const node = rowRef.current;
11597
11752
  if (node === null) return;
@@ -11666,7 +11821,7 @@ function useImageHover() {
11666
11821
  }
11667
11822
 
11668
11823
  // src/verticals/commerce/price/format-price.ts
11669
- function formatPrice(amount, currencyCode = "USD", locale = "en-US") {
11824
+ function formatPrice(amount, currencyCode, locale) {
11670
11825
  const hasCents = Math.round(amount * 100) % 100 !== 0;
11671
11826
  const formatter = new Intl.NumberFormat(locale, {
11672
11827
  style: "currency",
@@ -11681,6 +11836,7 @@ function formatPrice(amount, currencyCode = "USD", locale = "en-US") {
11681
11836
  function useProductCard(product) {
11682
11837
  const session = useFourtySession();
11683
11838
  const { hover, hoverProps } = useImageHover();
11839
+ const locale = useSpaceLocale();
11684
11840
  const productImages = Array.isArray(product.images) ? product.images : [];
11685
11841
  const primaryImage2 = productImages[0];
11686
11842
  const hoverImage = productImages[1];
@@ -11688,8 +11844,8 @@ function useProductCard(product) {
11688
11844
  const onSale = isOnSale(product.price.amount, product.compareAtPrice?.amount);
11689
11845
  const badge = pickBadge(product);
11690
11846
  const colorCount = pickColorCount(product);
11691
- const priceLabel = formatPrice(product.price.amount, product.price.currencyCode);
11692
- const compareAtPriceLabel = onSale && product.compareAtPrice !== void 0 ? formatPrice(product.compareAtPrice.amount, product.compareAtPrice.currencyCode) : void 0;
11847
+ const priceLabel = formatPrice(product.price.amount, product.price.currencyCode, locale);
11848
+ const compareAtPriceLabel = onSale && product.compareAtPrice !== void 0 ? formatPrice(product.compareAtPrice.amount, product.compareAtPrice.currencyCode, locale) : void 0;
11693
11849
  const onCardClick = () => {
11694
11850
  session.dispatchSuggestionAction(pickProductCardAction(product));
11695
11851
  };
@@ -11735,7 +11891,7 @@ function pickColorCount(product) {
11735
11891
  }
11736
11892
 
11737
11893
  // src/verticals/commerce/product/use-look-card.ts
11738
- import * as React40 from "react";
11894
+ import * as React42 from "react";
11739
11895
 
11740
11896
  // src/verticals/commerce/variant/variant-option-axes.ts
11741
11897
  function carriesValue(variant, name, value) {
@@ -11944,8 +12100,9 @@ function useLookCard({
11944
12100
  }) {
11945
12101
  const session = useFourtySession();
11946
12102
  const addFlash = useSuccessFlash({ duration: 1200 });
11947
- const [pending2, setPending] = React40.useState(null);
11948
- const clean = React40.useMemo(
12103
+ const locale = useSpaceLocale();
12104
+ const [pending2, setPending] = React42.useState(null);
12105
+ const clean = React42.useMemo(
11949
12106
  () => (Array.isArray(products) ? products : []).filter(
11950
12107
  (p) => p !== null && p !== void 0 && typeof p === "object"
11951
12108
  ),
@@ -11953,7 +12110,7 @@ function useLookCard({
11953
12110
  );
11954
12111
  if (clean.length === 0) return null;
11955
12112
  const visibleProducts = clean.slice(0, maxTiles);
11956
- const total = sumTotal(visibleProducts);
12113
+ const total = sumTotal(visibleProducts, locale);
11957
12114
  const totalEyebrow = typeof totalLabel === "string" && totalLabel.length > 0 && totalLabel.length < 24 ? totalLabel : "Total";
11958
12115
  const visible = visibleProducts.map((product) => ({
11959
12116
  product,
@@ -12043,7 +12200,7 @@ function useLookCard({
12043
12200
  addFlash
12044
12201
  };
12045
12202
  }
12046
- function sumTotal(products) {
12203
+ function sumTotal(products, locale) {
12047
12204
  if (products.length === 0) return null;
12048
12205
  const currency = products[0].price.currencyCode;
12049
12206
  let total = 0;
@@ -12051,7 +12208,7 @@ function sumTotal(products) {
12051
12208
  if (p.price.currencyCode !== currency) return null;
12052
12209
  total += p.price.amount;
12053
12210
  }
12054
- return formatPrice(total, currency);
12211
+ return formatPrice(total, currency, locale);
12055
12212
  }
12056
12213
  function pickPrimaryImage(product) {
12057
12214
  const productImages = Array.isArray(product.images) ? product.images : [];
@@ -12181,24 +12338,24 @@ function discountPct(p) {
12181
12338
  const saved = (p.compareAtPrice.amount - p.price.amount) / p.compareAtPrice.amount;
12182
12339
  return Math.round(saved * 100);
12183
12340
  }
12184
- function buildComparisonRows(products) {
12341
+ function buildComparisonRows(products, locale, words) {
12185
12342
  const rows = [
12186
- { id: "price", label: "Price", values: byProduct(products, (p) => formatProductPrice(p)) }
12343
+ { id: "price", label: words.price, values: byProduct(products, (p) => formatProductPrice(p, locale)) }
12187
12344
  ];
12188
12345
  if (products.some((p) => discountPct(p) !== void 0)) {
12189
12346
  rows.push({
12190
12347
  id: "sale",
12191
- label: "Sale",
12348
+ label: words.sale,
12192
12349
  values: byProduct(products, (p) => {
12193
12350
  const pct = discountPct(p);
12194
- return pct === void 0 ? "\u2014" : `${pct}% off`;
12351
+ return pct === void 0 ? "\u2014" : words.percentOff(pct);
12195
12352
  })
12196
12353
  });
12197
12354
  }
12198
12355
  if (products.some((p) => ratingOf(p) !== void 0)) {
12199
12356
  rows.push({
12200
12357
  id: "rating",
12201
- label: "Rating",
12358
+ label: words.rating,
12202
12359
  values: byProduct(products, (p) => {
12203
12360
  const r = ratingOf(p);
12204
12361
  return r === void 0 ? "\u2014" : `${r.value.toFixed(1)} (${r.count})`;
@@ -12207,12 +12364,12 @@ function buildComparisonRows(products) {
12207
12364
  }
12208
12365
  return rows;
12209
12366
  }
12210
- function formatProductPrice(p) {
12367
+ function formatProductPrice(p, locale) {
12211
12368
  if (p.price === void 0 || p.price === null) return "\u2014";
12212
12369
  if (typeof p.price.amount !== "string" && typeof p.price.amount !== "number") {
12213
12370
  return "\u2014";
12214
12371
  }
12215
- return formatPrice(p.price.amount, p.price.currencyCode);
12372
+ return formatPrice(p.price.amount, p.price.currencyCode, locale);
12216
12373
  }
12217
12374
 
12218
12375
  // src/verticals/commerce/variant/resolve-swatch-color.ts
@@ -12300,7 +12457,7 @@ function useContentActions() {
12300
12457
  import { useEffect as useEffect19, useState as useState18 } from "react";
12301
12458
 
12302
12459
  // package.json
12303
- var version = "0.5.5";
12460
+ var version = "0.5.7";
12304
12461
 
12305
12462
  // src/host/host-modules.ts
12306
12463
  import * as react from "react";
@@ -12361,7 +12518,7 @@ function loadEngine(apiUrl) {
12361
12518
  }
12362
12519
 
12363
12520
  // src/host/Spacefront.tsx
12364
- import { jsx as jsx21 } from "react/jsx-runtime";
12521
+ import { jsx as jsx23 } from "react/jsx-runtime";
12365
12522
  function Spacefront(props) {
12366
12523
  const [engine, setEngine] = useState18(null);
12367
12524
  const [failure, setFailure] = useState18(null);
@@ -12383,11 +12540,11 @@ function Spacefront(props) {
12383
12540
  if (failure !== null) throw failure;
12384
12541
  if (engine === null) return null;
12385
12542
  const EngineRoot = engine.EngineRoot;
12386
- return /* @__PURE__ */ jsx21(EngineRoot, { ...props });
12543
+ return /* @__PURE__ */ jsx23(EngineRoot, { ...props });
12387
12544
  }
12388
12545
 
12389
12546
  // src/npm.ts
12390
- import { z as z49 } from "zod";
12547
+ import { z as z50 } from "zod";
12391
12548
  export {
12392
12549
  ACQUISITION_KIND_LABELS,
12393
12550
  ACTIVE_PANEL_ATTR,
@@ -12413,6 +12570,7 @@ export {
12413
12570
  AssetSchema,
12414
12571
  AttachmentRefSchema,
12415
12572
  AttachmentRefsSchema,
12573
+ AttachmentUploadError,
12416
12574
  AttributeDefSchema,
12417
12575
  AttributeScopeBucketSchema,
12418
12576
  AttributeScopeConfigSchema,
@@ -12480,6 +12638,7 @@ export {
12480
12638
  DEFAULT_HOSTING,
12481
12639
  DEFAULT_PRESENCE_PROFILE,
12482
12640
  DEFAULT_SPACE_CONFIG,
12641
+ DEFAULT_SPACE_LOCALE,
12483
12642
  DEFAULT_VISITOR_ACCESS,
12484
12643
  DIRECTION_FLOW,
12485
12644
  DROP_REASONS,
@@ -12522,6 +12681,7 @@ export {
12522
12681
  HandlerRegistryContext,
12523
12682
  HostClearedSchema,
12524
12683
  HostPayloadSchema,
12684
+ HydrationNoticeProvider,
12525
12685
  HydrationStateContext,
12526
12686
  HydratorProvider,
12527
12687
  INITIAL_NAV_PRESENTATION,
@@ -12538,6 +12698,7 @@ export {
12538
12698
  LlmUsageDailySchema,
12539
12699
  MAX_ACTIVE_AGENT_DIRECTIVES,
12540
12700
  MAX_ATTACHMENT_BYTES,
12701
+ MAX_ATTACHMENT_MB,
12541
12702
  MAX_VISITOR_PROMPT_CHARS,
12542
12703
  MIN_WIRE_PROTOCOL_VERSION,
12543
12704
  MOBILE_VIEWPORT_MAX,
@@ -12592,6 +12753,7 @@ export {
12592
12753
  SOCKET_TICKET_PARAM,
12593
12754
  STRUCTURAL_BASELINE_CATALOG,
12594
12755
  STRUCTURAL_BASELINE_TYPES,
12756
+ SUPPORTED_SPACE_LOCALES,
12595
12757
  SURFACES,
12596
12758
  SURFACE_DISPOSITION,
12597
12759
  ScrollContainerProvider,
@@ -12624,6 +12786,8 @@ export {
12624
12786
  SpaceAgentDirectiveSchema,
12625
12787
  SpaceBrandMarkSchema,
12626
12788
  SpaceBugSchema,
12789
+ SpaceLocaleProvider,
12790
+ SpaceLocaleSchema,
12627
12791
  Spacefront,
12628
12792
  SpacefrontCanvas,
12629
12793
  SpacefrontPreviewProvider,
@@ -12682,6 +12846,7 @@ export {
12682
12846
  arraysEqual,
12683
12847
  arrivalFromParams,
12684
12848
  arrivalToParams,
12849
+ attachmentFailureOfStatus,
12685
12850
  bareComponentType,
12686
12851
  buildBaseAttributesConfig,
12687
12852
  buildBucketLabelsConfig,
@@ -12706,6 +12871,7 @@ export {
12706
12871
  classifyItemChange,
12707
12872
  clearAgentPresence,
12708
12873
  clearCartActionFailures,
12874
+ clearCodeDiscountSources,
12709
12875
  clearProductNameLookups,
12710
12876
  clearVariantChoice,
12711
12877
  clientStateEntries,
@@ -12715,6 +12881,7 @@ export {
12715
12881
  collectLayoutGids,
12716
12882
  collectPlacedEntityRefs,
12717
12883
  colorHexOf,
12884
+ commerceLocaleOf,
12718
12885
  compareSdkVersions,
12719
12886
  compressArray,
12720
12887
  compressString,
@@ -12729,6 +12896,7 @@ export {
12729
12896
  createSessionStorageAdapter,
12730
12897
  createTokenOverlapScorer,
12731
12898
  createUnavailableProduct,
12899
+ declaredSpaceLocaleOf,
12732
12900
  defineEventKind,
12733
12901
  derivePropsDoc,
12734
12902
  deriveSourceElement,
@@ -12787,6 +12955,8 @@ export {
12787
12955
  isPresenceStreamArtifact,
12788
12956
  isReservedId,
12789
12957
  isVideoUrl,
12958
+ languageNameOf,
12959
+ languageOf,
12790
12960
  layoutTopWithin,
12791
12961
  listRegisteredPlatforms,
12792
12962
  listRegisteredServices,
@@ -12840,6 +13010,7 @@ export {
12840
13010
  reducePatch,
12841
13011
  refuseCheckoutHandoff,
12842
13012
  registerChipRelevanceRule,
13013
+ registerCodeDiscountSource,
12843
13014
  registerComponent,
12844
13015
  registerEntityPageKind,
12845
13016
  registerExclusiveOverlay,
@@ -12864,6 +13035,7 @@ export {
12864
13035
  requestVariantChoice,
12865
13036
  requiredTopLevelProps,
12866
13037
  resetServerState,
13038
+ resolveCodeDiscountSource,
12867
13039
  resolveHydrators,
12868
13040
  resolvePresenceFactForm,
12869
13041
  resolvePresenceForm,
@@ -12899,6 +13071,7 @@ export {
12899
13071
  settleArmedCheckoutHandoff,
12900
13072
  settledBlocks,
12901
13073
  settledCart,
13074
+ spaceLocaleOf,
12902
13075
  splitAnswer,
12903
13076
  splitSentences,
12904
13077
  stateSnapshotSignal,
@@ -12909,6 +13082,7 @@ export {
12909
13082
  surfaceEmits,
12910
13083
  surfaceSuppressionReason,
12911
13084
  text,
13085
+ textDirectionOf,
12912
13086
  threadRowAttrs,
12913
13087
  toggleCartDrawer,
12914
13088
  token,
@@ -12963,6 +13137,7 @@ export {
12963
13137
  useConversationState,
12964
13138
  useConversations,
12965
13139
  useCurrentMessageIndex,
13140
+ useCustomerAccount,
12966
13141
  useDebug,
12967
13142
  useDictation,
12968
13143
  useDismissedLabels,
@@ -12988,6 +13163,7 @@ export {
12988
13163
  useHasLeftSeedHome,
12989
13164
  useHistoryNav,
12990
13165
  useHydrated,
13166
+ useHydrationNotice,
12991
13167
  useHydrationState,
12992
13168
  useHydrators,
12993
13169
  useInlineCompletion,
@@ -13042,10 +13218,12 @@ export {
13042
13218
  useSessionState,
13043
13219
  useShellRegistry,
13044
13220
  useShellRoot,
13221
+ useSpaceLocale,
13045
13222
  useStandingOfType,
13046
13223
  useStream,
13047
13224
  useSuccessFlash,
13048
13225
  useSuggestionsWithDefaults,
13226
+ useTextDirection,
13049
13227
  useThreadJumpMarks,
13050
13228
  useThreadLanding,
13051
13229
  useThreadRows,
@@ -13074,5 +13252,5 @@ export {
13074
13252
  withCartActorOrigin,
13075
13253
  withInteractionTracking,
13076
13254
  withSignalTurn,
13077
- z49 as z
13255
+ z50 as z
13078
13256
  };