@40rty/ams-cli 0.5.11 → 0.5.12

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.
@@ -45,6 +45,32 @@ describe('theme normalizer', () => {
45
45
  expect(sections[3]).toEqual({ key: 'faq', kind: 'faq', title: 'FAQ', background: undefined, items: [{ question: 'Q?', html: '<p>A</p>' }] });
46
46
  });
47
47
 
48
+ it("reads the buy box's quantity, button and Yotpo star rating, and an app block the brand names", () => {
49
+ const catalogByHandle = new Map([['two-cam', { id: 7, title: 'Two cam', images: [], variants: [] }]]);
50
+ const appBlock = 'shopify://apps/acme-badges/blocks/badge/1';
51
+ const withBadge = { ...designs, blocks: { ...designs.blocks, [appBlock]: (s) => ({ kind: 'badge', label: s.label }) } };
52
+ const template = { order: ['main'], sections: { main: { type: 'main-product', block_order: ['q', 'b', 'r', 'x', 'e'], blocks: {
53
+ q: { type: 'quantity_selector' },
54
+ b: { type: 'button', settings: { text: 'Explore Two-Cameras Model', link: 'shopify://products/two-cam', stretch: true, background: '#f5f5f5', text_color: '#003a5d' } },
55
+ r: { type: 'shopify://apps/yotpo-product-reviews/blocks/star-rating/eb7d', settings: { product: '{{product}}' } },
56
+ x: { type: appBlock, settings: { label: 'New' } },
57
+ e: { type: 'button', settings: { text: '', link: 'shopify://products/two-cam' } },
58
+ } } } };
59
+ const { sections } = templateSections(template, () => ctx({ catalogByHandle, designs: withBadge }));
60
+ expect(sections[0].blocks).toEqual([
61
+ { kind: 'quantity' },
62
+ { kind: 'button', label: 'Explore Two-Cameras Model', target: { product: 'gid://shopify/Product/7' }, stretch: true, background: '#f5f5f5', color: '#003a5d' },
63
+ { kind: 'rating' },
64
+ { kind: 'badge', label: 'New' },
65
+ ]);
66
+ });
67
+
68
+ it('fails a buy-box app block nobody names, and a link it cannot follow', () => {
69
+ const run = (b) => () => templateSections({ order: ['k'], sections: { k: { type: 'main-product', block_order: ['a'], blocks: { a: b } } } }, () => ctx());
70
+ expect(run({ type: 'shopify://apps/mystery/blocks/x/1' })).toThrow(/mystery\/blocks\/x\/1 has no renderer — name it in the theme designs/);
71
+ expect(run({ type: 'button', settings: { text: 'Go', link: 'shopify://pages/about' } })).toThrow(/theme link shopify:\/\/pages\/about has no target/);
72
+ });
73
+
48
74
  it('fails loudly on what neither the theme nor the brand names', () => {
49
75
  const run = (s) => () => templateSections({ order: ['k'], sections: { k: s } }, () => ctx());
50
76
  expect(run({ type: 'mystery' })).toThrow(/section type mystery has no renderer/);
@@ -77,6 +77,24 @@ function liquidBlock(liquid, designs, h) {
77
77
  return design.build(visible, h);
78
78
  }
79
79
 
80
+ /**
81
+ * A theme link setting → where it goes: a product of the store (its gid, from the catalog), a collection
82
+ * (its handle), or a web address. Anything else is a link this sync does not know yet.
83
+ */
84
+ function themeLink(ref, ctx) {
85
+ if (typeof ref !== 'string' || ref.length === 0) return undefined;
86
+ const product = /^shopify:\/\/products\/(.+)$/.exec(ref);
87
+ if (product !== null) {
88
+ const found = ctx.catalogByHandle.get(product[1]);
89
+ if (found === undefined) throw new Error(`theme link: no product ${product[1]} in the catalog`);
90
+ return { product: `gid://shopify/Product/${found.id}` };
91
+ }
92
+ const collection = /^shopify:\/\/collections\/(.+)$/.exec(ref);
93
+ if (collection !== null) return { collection: collection[1] };
94
+ if (/^https?:\/\//.test(ref)) return { href: ref };
95
+ throw new Error(`theme link ${ref} has no target`);
96
+ }
97
+
80
98
  function mainProduct(set, blocks, ctx) {
81
99
  return {
82
100
  kind: 'main',
@@ -88,8 +106,20 @@ function mainProduct(set, blocks, ctx) {
88
106
  if (b.type === 'text') return ctx.h.text(bs.text) ? [{ kind: 'text', html: bs.text }] : [];
89
107
  if (b.type === 'buy_buttons') return [{ kind: 'buy' }];
90
108
  if (b.type === 'variant_picker') return [{ kind: 'variants' }];
109
+ if (b.type === 'quantity_selector') return [{ kind: 'quantity' }];
110
+ if (b.type === 'button') {
111
+ const label = ctx.h.text(bs.text);
112
+ const target = themeLink(bs.link, ctx);
113
+ if (label === undefined || target === undefined) return [];
114
+ return [{ kind: 'button', label, target, stretch: bs.stretch === true, background: ctx.h.color(bs.background), color: ctx.h.color(bs.text_color) }];
115
+ }
91
116
  if (b.type === 'liquid') return liquidBlock(typeof bs.liquid === 'string' ? bs.liquid : '', ctx.designs, ctx.h);
92
- throw new Error(`main-product block ${b.type} has no renderer`);
117
+ // Yotpo's star rating: the product's own rating, beside the price.
118
+ if (b.type.includes('/yotpo-product-reviews/blocks/star-rating/')) return [{ kind: 'rating' }];
119
+ // Any other app block is the brand's to name, as its theme blocks are.
120
+ const build = ctx.designs.blocks[b.type];
121
+ if (build !== undefined) return [build(bs, ctx.h, ctx.videos)].flat();
122
+ throw new Error(`main-product block ${b.type} has no renderer — name it in the theme designs`);
93
123
  }),
94
124
  };
95
125
  }
package/dist/wire.js CHANGED
@@ -1243,8 +1243,15 @@ var UpdateAgentDirectiveInputSchema = z35.object({
1243
1243
  }).strict();
1244
1244
  var ReorderAgentDirectivesInputSchema = z35.object({ ids: z35.array(z35.string()).min(1) }).strict();
1245
1245
 
1246
- // ../spacestation/src/space/space-locale.ts
1246
+ // ../spacestation/src/shell/bot-check-notice.ts
1247
1247
  import { z as z36 } from "zod";
1248
+ var BotCheckNoticeSchema = z36.object({
1249
+ /** Read in order: plain text, and links the notice must keep linked. */
1250
+ segments: z36.array(z36.union([z36.string(), z36.object({ text: z36.string(), href: z36.string().url() })])).min(1)
1251
+ });
1252
+
1253
+ // ../spacestation/src/space/space-locale.ts
1254
+ import { z as z37 } from "zod";
1248
1255
  function isBcp47(tag) {
1249
1256
  try {
1250
1257
  return new Intl.Locale(tag).language.length > 0;
@@ -1253,7 +1260,7 @@ function isBcp47(tag) {
1253
1260
  throw err;
1254
1261
  }
1255
1262
  }
1256
- var SpaceLocaleSchema = z36.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
1263
+ var SpaceLocaleSchema = z37.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
1257
1264
 
1258
1265
  // ../spacestation/src/space/workspace-catalog.ts
1259
1266
  var COMPONENT_SOURCE = {
@@ -1283,30 +1290,30 @@ var DEFAULT_SPACE_CONFIG = {
1283
1290
  };
1284
1291
 
1285
1292
  // ../spacestation/src/space/trace.ts
1286
- import { z as z37 } from "zod";
1287
- var RunTokenUsageSchema = z37.object({
1288
- input_tokens: z37.number().optional(),
1289
- output_tokens: z37.number().optional(),
1290
- cache_read_tokens: z37.number().optional()
1291
- });
1292
- var TraceRecordSchema = z37.object({
1293
- id: z37.string().uuid(),
1294
- spaceId: z37.string().uuid().nullable(),
1295
- sessionId: z37.string(),
1293
+ import { z as z38 } from "zod";
1294
+ var RunTokenUsageSchema = z38.object({
1295
+ input_tokens: z38.number().optional(),
1296
+ output_tokens: z38.number().optional(),
1297
+ cache_read_tokens: z38.number().optional()
1298
+ });
1299
+ var TraceRecordSchema = z38.object({
1300
+ id: z38.string().uuid(),
1301
+ spaceId: z38.string().uuid().nullable(),
1302
+ sessionId: z38.string(),
1296
1303
  /** OTP-verified visitor email the session was unlocked with, or `null`
1297
1304
  * for an unlocked space / anonymous unlock. */
1298
- visitorEmail: z37.string().nullable(),
1299
- userPrompt: z37.string(),
1300
- branch: z37.string().nullable(),
1301
- responseText: z37.string().nullable(),
1302
- layout: z37.unknown().nullable(),
1303
- phaseTimings: z37.record(z37.number()).nullable(),
1304
- tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
1305
- toolCalls: z37.array(z37.unknown()).nullable(),
1306
- diagnostics: z37.array(z37.unknown()).nullable(),
1307
- latencyFirstText: z37.number().int().nullable(),
1308
- latencyFirstPatch: z37.number().int().nullable(),
1309
- latencyTotal: z37.number().int().nullable(),
1305
+ visitorEmail: z38.string().nullable(),
1306
+ userPrompt: z38.string(),
1307
+ branch: z38.string().nullable(),
1308
+ responseText: z38.string().nullable(),
1309
+ layout: z38.unknown().nullable(),
1310
+ phaseTimings: z38.record(z38.number()).nullable(),
1311
+ tokensByModel: z38.record(RunTokenUsageSchema).nullable(),
1312
+ toolCalls: z38.array(z38.unknown()).nullable(),
1313
+ diagnostics: z38.array(z38.unknown()).nullable(),
1314
+ latencyFirstText: z38.number().int().nullable(),
1315
+ latencyFirstPatch: z38.number().int().nullable(),
1316
+ latencyTotal: z38.number().int().nullable(),
1310
1317
  /**
1311
1318
  * The CLIENT's turn id for this run, or `null`.
1312
1319
  *
@@ -1322,29 +1329,29 @@ var TraceRecordSchema = z37.object({
1322
1329
  * a turn whose ack the client never saw — none of which is evidence that a
1323
1330
  * visitor asked something and got nothing.
1324
1331
  */
1325
- turnId: z37.string().nullable(),
1332
+ turnId: z38.string().nullable(),
1326
1333
  /** Serialized `TraceTracker.exportState()` payload (parsed object) —
1327
1334
  * lets the inspector rehydrate this run verbatim after a reload. */
1328
- trackerState: z37.unknown().nullable(),
1329
- createdAt: z37.string()
1330
- });
1331
- var MillisecondsSchema = z37.number().nullable().transform((v) => v === null ? null : Math.round(v));
1332
- var CreateTraceInputSchema = z37.object({
1333
- spaceId: z37.string().uuid().nullable(),
1334
- sessionId: z37.string(),
1335
- visitorEmail: z37.string().nullable(),
1336
- userPrompt: z37.string(),
1337
- branch: z37.string().nullable(),
1338
- responseText: z37.string().nullable(),
1339
- layout: z37.unknown().nullable(),
1340
- phaseTimings: z37.record(z37.number()).nullable(),
1341
- tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
1342
- toolCalls: z37.array(z37.unknown()).nullable(),
1343
- diagnostics: z37.array(z37.unknown()).nullable(),
1335
+ trackerState: z38.unknown().nullable(),
1336
+ createdAt: z38.string()
1337
+ });
1338
+ var MillisecondsSchema = z38.number().nullable().transform((v) => v === null ? null : Math.round(v));
1339
+ var CreateTraceInputSchema = z38.object({
1340
+ spaceId: z38.string().uuid().nullable(),
1341
+ sessionId: z38.string(),
1342
+ visitorEmail: z38.string().nullable(),
1343
+ userPrompt: z38.string(),
1344
+ branch: z38.string().nullable(),
1345
+ responseText: z38.string().nullable(),
1346
+ layout: z38.unknown().nullable(),
1347
+ phaseTimings: z38.record(z38.number()).nullable(),
1348
+ tokensByModel: z38.record(RunTokenUsageSchema).nullable(),
1349
+ toolCalls: z38.array(z38.unknown()).nullable(),
1350
+ diagnostics: z38.array(z38.unknown()).nullable(),
1344
1351
  latencyFirstText: MillisecondsSchema,
1345
1352
  latencyFirstPatch: MillisecondsSchema,
1346
1353
  latencyTotal: MillisecondsSchema,
1347
- trackerState: z37.unknown().nullable(),
1354
+ trackerState: z38.unknown().nullable(),
1348
1355
  /**
1349
1356
  * The CLIENT's turn id for this run, or `null`.
1350
1357
  *
@@ -1360,37 +1367,37 @@ var CreateTraceInputSchema = z37.object({
1360
1367
  * a turn whose ack the client never saw — none of which is evidence that a
1361
1368
  * visitor asked something and got nothing.
1362
1369
  */
1363
- turnId: z37.string().nullable()
1370
+ turnId: z38.string().nullable()
1364
1371
  });
1365
- var AgentSessionSummarySchema = z37.object({
1366
- sessionId: z37.string(),
1372
+ var AgentSessionSummarySchema = z38.object({
1373
+ sessionId: z38.string(),
1367
1374
  /** Turn rows only; background/secondary runs are excluded by the aggregate. */
1368
- turnCount: z37.number().int(),
1375
+ turnCount: z38.number().int(),
1369
1376
  /** The session's opening prompt — titles the row in the UI. */
1370
- firstPrompt: z37.string(),
1371
- startedAt: z37.string(),
1372
- lastRunAt: z37.string(),
1377
+ firstPrompt: z38.string(),
1378
+ startedAt: z38.string(),
1379
+ lastRunAt: z38.string(),
1373
1380
  /** Summed `latency_total` across the session's turns. */
1374
- totalLatencyMs: z37.number().int()
1381
+ totalLatencyMs: z38.number().int()
1375
1382
  });
1376
- var SessionTurnSchema = z37.object({
1377
- id: z37.string().uuid(),
1378
- userPrompt: z37.string(),
1379
- responseText: z37.string().nullable(),
1383
+ var SessionTurnSchema = z38.object({
1384
+ id: z38.string().uuid(),
1385
+ userPrompt: z38.string(),
1386
+ responseText: z38.string().nullable(),
1380
1387
  /** Full cumulative Spec committed by this turn — never a patch delta. */
1381
- layout: z37.unknown().nullable(),
1382
- createdAt: z37.string(),
1383
- latencyTotal: z37.number().int().nullable(),
1384
- phaseTimings: z37.record(z37.number()).nullable(),
1385
- tokensByModel: z37.record(z37.object({
1386
- input_tokens: z37.number().optional(),
1387
- output_tokens: z37.number().optional()
1388
+ layout: z38.unknown().nullable(),
1389
+ createdAt: z38.string(),
1390
+ latencyTotal: z38.number().int().nullable(),
1391
+ phaseTimings: z38.record(z38.number()).nullable(),
1392
+ tokensByModel: z38.record(z38.object({
1393
+ input_tokens: z38.number().optional(),
1394
+ output_tokens: z38.number().optional()
1388
1395
  })).nullable(),
1389
- toolCalls: z37.array(z37.unknown()).nullable(),
1390
- diagnostics: z37.array(z37.unknown()).nullable()
1396
+ toolCalls: z38.array(z38.unknown()).nullable(),
1397
+ diagnostics: z38.array(z38.unknown()).nullable()
1391
1398
  });
1392
- var SessionReplaySchema = z37.object({
1393
- turns: z37.array(SessionTurnSchema),
1399
+ var SessionReplaySchema = z38.object({
1400
+ turns: z38.array(SessionTurnSchema),
1394
1401
  /**
1395
1402
  * The session's own last-committed layout, read straight off the durable
1396
1403
  * session record (`sessions.blob.layout`) rather than derived from `turns`.
@@ -1401,20 +1408,20 @@ var SessionReplaySchema = z37.object({
1401
1408
  * a perfectly real layout; only this field can show it. Null exclusively
1402
1409
  * when the durable session row itself could not be read.
1403
1410
  */
1404
- sessionLayout: z37.record(z37.string(), z37.unknown()).nullable()
1411
+ sessionLayout: z38.record(z38.string(), z38.unknown()).nullable()
1405
1412
  });
1406
- var SessionTraceSchema = z37.object({
1407
- trackerState: z37.string().nullable()
1413
+ var SessionTraceSchema = z38.object({
1414
+ trackerState: z38.string().nullable()
1408
1415
  });
1409
- var LlmUsageDailySchema = z37.object({
1410
- day: z37.string(),
1416
+ var LlmUsageDailySchema = z38.object({
1417
+ day: z38.string(),
1411
1418
  /** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
1412
- environment: z37.string(),
1413
- feature: z37.string(),
1414
- model: z37.string(),
1415
- provider: z37.string(),
1419
+ environment: z38.string(),
1420
+ feature: z38.string(),
1421
+ model: z38.string(),
1422
+ provider: z38.string(),
1416
1423
  /** Masked tail of the key actually billed, or null when unknown/non-Google. */
1417
- keyFingerprint: z37.string().nullable(),
1424
+ keyFingerprint: z38.string().nullable(),
1418
1425
  /**
1419
1426
  * The space the call served, or null when it served none.
1420
1427
  *
@@ -1423,91 +1430,91 @@ var LlmUsageDailySchema = z37.object({
1423
1430
  * report that share rather than dropping it, or a per-space total reads as
1424
1431
  * the platform total.
1425
1432
  */
1426
- spaceId: z37.string().nullable(),
1433
+ spaceId: z38.string().nullable(),
1427
1434
  /**
1428
1435
  * The surface of the session the call served (`sessions.surface`), or null
1429
1436
  * when it served no session or the session predates surface recording.
1430
1437
  * `automation` is the eval harness — the signal that files an ordinary
1431
1438
  * `agent-turn` as testing spend rather than as a visitor's.
1432
1439
  */
1433
- surface: z37.string().nullable(),
1434
- inputTokens: z37.number(),
1435
- outputTokens: z37.number(),
1440
+ surface: z38.string().nullable(),
1441
+ inputTokens: z38.number(),
1442
+ outputTokens: z38.number(),
1436
1443
  /** Subset of inputTokens, never additional to it. */
1437
- cachedInputTokens: z37.number(),
1438
- reasoningTokens: z37.number(),
1439
- callCount: z37.number(),
1440
- errorCount: z37.number(),
1441
- estimatedCostUsd: z37.number().nullable()
1442
- });
1443
- var LlmUsageBySessionSchema = z37.object({
1444
- sessionId: z37.string(),
1445
- environment: z37.string(),
1446
- model: z37.string(),
1444
+ cachedInputTokens: z38.number(),
1445
+ reasoningTokens: z38.number(),
1446
+ callCount: z38.number(),
1447
+ errorCount: z38.number(),
1448
+ estimatedCostUsd: z38.number().nullable()
1449
+ });
1450
+ var LlmUsageBySessionSchema = z38.object({
1451
+ sessionId: z38.string(),
1452
+ environment: z38.string(),
1453
+ model: z38.string(),
1447
1454
  /** The space this session belongs to, or null for a session with no space. */
1448
- spaceId: z37.string().nullable(),
1455
+ spaceId: z38.string().nullable(),
1449
1456
  /** The session's surface — see `LlmUsageDailySchema.surface`. */
1450
- surface: z37.string().nullable(),
1457
+ surface: z38.string().nullable(),
1451
1458
  /** Label only — the first feature seen in the session. */
1452
- firstFeature: z37.string(),
1453
- startedAt: z37.string(),
1454
- endedAt: z37.string(),
1455
- inputTokens: z37.number(),
1456
- outputTokens: z37.number(),
1457
- cachedInputTokens: z37.number(),
1458
- reasoningTokens: z37.number(),
1459
- callCount: z37.number(),
1460
- errorCount: z37.number(),
1459
+ firstFeature: z38.string(),
1460
+ startedAt: z38.string(),
1461
+ endedAt: z38.string(),
1462
+ inputTokens: z38.number(),
1463
+ outputTokens: z38.number(),
1464
+ cachedInputTokens: z38.number(),
1465
+ reasoningTokens: z38.number(),
1466
+ callCount: z38.number(),
1467
+ errorCount: z38.number(),
1461
1468
  /** Priced server-side, like the daily rollup — the browser never carries a
1462
1469
  * rate table, so there is exactly one place a price can be wrong. Null when
1463
1470
  * the model is unpriced; never 0, which would read as free. */
1464
- estimatedCostUsd: z37.number().nullable()
1471
+ estimatedCostUsd: z38.number().nullable()
1465
1472
  });
1466
- var LlmSessionsDailySchema = z37.object({
1467
- day: z37.string(),
1468
- environment: z37.string(),
1469
- sessionCount: z37.number()
1473
+ var LlmSessionsDailySchema = z38.object({
1474
+ day: z38.string(),
1475
+ environment: z38.string(),
1476
+ sessionCount: z38.number()
1470
1477
  });
1471
1478
 
1472
1479
  // ../spacestation/src/space/session-queue.ts
1473
- import { z as z39 } from "zod";
1480
+ import { z as z40 } from "zod";
1474
1481
 
1475
1482
  // ../spacestation/src/space/session-activity.ts
1476
- import { z as z38 } from "zod";
1477
- var SessionActivityEventSchema = z38.object({
1478
- id: z38.string(),
1479
- kind: z38.string(),
1480
- occurredAt: z38.string(),
1481
- source: z38.string(),
1482
- surface: z38.string(),
1483
- payload: z38.record(z38.unknown())
1484
- });
1485
- var SessionActivitySchema = z38.object({
1486
- events: z38.array(SessionActivityEventSchema),
1487
- hasMore: z38.boolean()
1483
+ import { z as z39 } from "zod";
1484
+ var SessionActivityEventSchema = z39.object({
1485
+ id: z39.string(),
1486
+ kind: z39.string(),
1487
+ occurredAt: z39.string(),
1488
+ source: z39.string(),
1489
+ surface: z39.string(),
1490
+ payload: z39.record(z39.unknown())
1491
+ });
1492
+ var SessionActivitySchema = z39.object({
1493
+ events: z39.array(SessionActivityEventSchema),
1494
+ hasMore: z39.boolean()
1488
1495
  });
1489
1496
 
1490
1497
  // ../spacestation/src/space/session-queue.ts
1491
- var SessionVerdictSchema = z39.enum(["unreviewed", "viewed", "bug"]);
1492
- var RecordableVerdictSchema = z39.enum(["viewed", "bug"]);
1493
- var SessionReviewEventSchema = z39.object({
1494
- id: z39.string().uuid(),
1498
+ var SessionVerdictSchema = z40.enum(["unreviewed", "viewed", "bug"]);
1499
+ var RecordableVerdictSchema = z40.enum(["viewed", "bug"]);
1500
+ var SessionReviewEventSchema = z40.object({
1501
+ id: z40.string().uuid(),
1495
1502
  verdict: RecordableVerdictSchema,
1496
1503
  /** Account email of the operator who judged it. Attribution is the reason the
1497
1504
  * log is append-only rather than a mutable current-state row. */
1498
- reviewer: z39.string(),
1499
- note: z39.string().nullable(),
1500
- createdAt: z39.string()
1505
+ reviewer: z40.string(),
1506
+ note: z40.string().nullable(),
1507
+ createdAt: z40.string()
1501
1508
  });
1502
- var BugSeveritySchema = z39.enum(["high", "medium", "low"]);
1503
- var BugLocationSchema = z39.object({
1504
- elementId: z39.string().nullable(),
1509
+ var BugSeveritySchema = z40.enum(["high", "medium", "low"]);
1510
+ var BugLocationSchema = z40.object({
1511
+ elementId: z40.string().nullable(),
1505
1512
  /** Display only — the catalog component type, e.g. "productGrid". Null
1506
1513
  * alongside a null `elementId`. */
1507
- elementType: z39.string().nullable(),
1514
+ elementType: z40.string().nullable(),
1508
1515
  /** Fraction of the ELEMENT's own box. Null for a page anchor. */
1509
- offsetXPct: z39.number().min(0).max(100).nullable(),
1510
- offsetYPct: z39.number().min(0).max(100).nullable(),
1516
+ offsetXPct: z40.number().min(0).max(100).nullable(),
1517
+ offsetYPct: z40.number().min(0).max(100).nullable(),
1511
1518
  /**
1512
1519
  * ABSOLUTE document pixels, for a pin with no element under it. Null for an
1513
1520
  * element anchor.
@@ -1518,8 +1525,8 @@ var BugLocationSchema = z39.object({
1518
1525
  * on the page with it. Measured before this was fixed: growing the page 9%
1519
1526
  * slid a pin 32px, so a pin ran away from the cursor reaching for it.
1520
1527
  */
1521
- pageX: z39.number().nullable(),
1522
- pageY: z39.number().nullable()
1528
+ pageX: z40.number().nullable(),
1529
+ pageY: z40.number().nullable()
1523
1530
  }).refine(
1524
1531
  (loc) => {
1525
1532
  const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
@@ -1533,24 +1540,24 @@ var BugLocationSchema = z39.object({
1533
1540
  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)"
1534
1541
  }
1535
1542
  );
1536
- var SessionBugSchema = z39.object({
1537
- id: z39.string().uuid(),
1543
+ var SessionBugSchema = z40.object({
1544
+ id: z40.string().uuid(),
1538
1545
  /** 1-based turn the fault was observed on; null when the fault is session-wide. */
1539
- turnIndex: z39.number().int().nullable(),
1546
+ turnIndex: z40.number().int().nullable(),
1540
1547
  /** Where on that turn's canvas the pin was dropped; null for a bug filed
1541
1548
  * without pinning a spot. */
1542
1549
  location: BugLocationSchema.nullable(),
1543
- provider: z39.string(),
1544
- issueKey: z39.string().nullable(),
1545
- issueUrl: z39.string().nullable(),
1550
+ provider: z40.string(),
1551
+ issueKey: z40.string().nullable(),
1552
+ issueUrl: z40.string().nullable(),
1546
1553
  /** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
1547
1554
  * open text. Null until first synced. */
1548
- issueState: z39.string().nullable(),
1549
- title: z39.string(),
1550
- body: z39.string(),
1555
+ issueState: z40.string().nullable(),
1556
+ title: z40.string(),
1557
+ body: z40.string(),
1551
1558
  severity: BugSeveritySchema,
1552
- createdBy: z39.string(),
1553
- createdAt: z39.string(),
1559
+ createdBy: z40.string(),
1560
+ createdAt: z40.string(),
1554
1561
  /**
1555
1562
  * When this bug was resolved from the console; null means still OPEN.
1556
1563
  *
@@ -1559,55 +1566,55 @@ var SessionBugSchema = z39.object({
1559
1566
  * whether a particular fault is still live. The timestamp IS the state, so
1560
1567
  * no boolean can contradict it.
1561
1568
  */
1562
- resolvedAt: z39.string().nullable(),
1563
- resolvedBy: z39.string().nullable()
1569
+ resolvedAt: z40.string().nullable(),
1570
+ resolvedBy: z40.string().nullable()
1564
1571
  });
1565
- var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z39.string() });
1566
- var SessionCommentSchema = z39.object({
1567
- id: z39.string().uuid(),
1572
+ var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z40.string() });
1573
+ var SessionCommentSchema = z40.object({
1574
+ id: z40.string().uuid(),
1568
1575
  /** Set = a reply in that bug's thread. Null = a standalone comment pin. */
1569
- bugId: z39.string().uuid().nullable(),
1576
+ bugId: z40.string().uuid().nullable(),
1570
1577
  /** 1-based turn the comment was left on; null for a reply (it reads its
1571
1578
  * parent bug's turn). */
1572
- turnIndex: z39.number().int().nullable(),
1579
+ turnIndex: z40.number().int().nullable(),
1573
1580
  /** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
1574
1581
  location: BugLocationSchema.nullable(),
1575
- body: z39.string(),
1576
- createdBy: z39.string(),
1577
- createdAt: z39.string()
1582
+ body: z40.string(),
1583
+ createdBy: z40.string(),
1584
+ createdAt: z40.string()
1578
1585
  });
1579
- var CreateCommentInputSchema = z39.object({
1580
- bugId: z39.string().uuid().nullable(),
1581
- turnIndex: z39.number().int().positive().nullable(),
1586
+ var CreateCommentInputSchema = z40.object({
1587
+ bugId: z40.string().uuid().nullable(),
1588
+ turnIndex: z40.number().int().positive().nullable(),
1582
1589
  location: BugLocationSchema.nullable(),
1583
1590
  // Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
1584
1591
  // of three spaces, which renders as an empty bubble nobody can interpret.
1585
- body: z39.string().trim().min(1)
1592
+ body: z40.string().trim().min(1)
1586
1593
  }).refine((input) => input.bugId === null !== (input.location === null), {
1587
1594
  message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
1588
1595
  });
1589
- var UpdateCommentInputSchema = z39.object({
1590
- body: z39.string().trim().min(1).optional(),
1591
- bugId: z39.string().uuid().nullable().optional(),
1596
+ var UpdateCommentInputSchema = z40.object({
1597
+ body: z40.string().trim().min(1).optional(),
1598
+ bugId: z40.string().uuid().nullable().optional(),
1592
1599
  location: BugLocationSchema.nullable().optional()
1593
1600
  });
1594
- var SessionFormFactorSchema = z39.enum(["mobile", "desktop"]).nullable();
1595
- var SessionSummarySchema = z39.object({
1596
- sessionId: z39.string(),
1601
+ var SessionFormFactorSchema = z40.enum(["mobile", "desktop"]).nullable();
1602
+ var SessionSummarySchema = z40.object({
1603
+ sessionId: z40.string(),
1597
1604
  /** Stable per-browser id — the join key across a visitor's sessions. Null when
1598
1605
  * the session row is gone (pruned) or predates the `sessions` table. */
1599
- visitorId: z39.string().nullable(),
1606
+ visitorId: z40.string().nullable(),
1600
1607
  /** Provider-qualified identity anchor, present only once the visitor
1601
1608
  * identified themselves. Both null together means "not identified yet". */
1602
- identityProvider: z39.string().nullable(),
1603
- identityKey: z39.string().nullable(),
1609
+ identityProvider: z40.string().nullable(),
1610
+ identityKey: z40.string().nullable(),
1604
1611
  /** Team/test traffic. The queue hides these by default. */
1605
- isInternal: z39.boolean(),
1612
+ isInternal: z40.boolean(),
1606
1613
  /** Build that served the session. Null = not captured; a version filter must
1607
1614
  * therefore EXCLUDE it rather than let it match an arbitrary bucket. */
1608
- clientVersion: z39.string().nullable(),
1615
+ clientVersion: z40.string().nullable(),
1609
1616
  /** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
1610
- signalCounts: z39.record(z39.number()),
1617
+ signalCounts: z40.record(z40.number()),
1611
1618
  /**
1612
1619
  * Did this conversation ACQUIRE anything, and how many times?
1613
1620
  *
@@ -1624,7 +1631,7 @@ var SessionSummarySchema = z39.object({
1624
1631
  * predates the column — and renders as no mark at all. It never means zero:
1625
1632
  * zero is a real, recorded answer and the rail reports it as one.
1626
1633
  */
1627
- conversionAttempts: z39.number().int().nullable(),
1634
+ conversionAttempts: z40.number().int().nullable(),
1628
1635
  /**
1629
1636
  * The same attempts split by EVENT KIND, keyed by the kind's own name
1630
1637
  * (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
@@ -1640,7 +1647,7 @@ var SessionSummarySchema = z39.object({
1640
1647
  * kinds together, and one attempt id appearing under both would be counted
1641
1648
  * once there and twice here.
1642
1649
  */
1643
- conversionKinds: z39.record(z39.number()),
1650
+ conversionKinds: z40.record(z40.number()),
1644
1651
  /**
1645
1652
  * Every analytics funnel step this session reached, in funnel order — the
1646
1653
  * dashboard's own step ids, read by the same per-step predicates, so a queue
@@ -1648,20 +1655,20 @@ var SessionSummarySchema = z39.object({
1648
1655
  * set of strings for the reason `conversionKinds` is: the contract does not
1649
1656
  * learn what a step means. Empty only when read from a pre-column database.
1650
1657
  */
1651
- funnelSteps: z39.array(z39.string()),
1658
+ funnelSteps: z40.array(z40.string()),
1652
1659
  /**
1653
1660
  * The connector's opaque handle for what this session produced in its back
1654
1661
  * office — present only once a checkout actually reached the platform. The
1655
1662
  * console hands it to the back-office link registry; nothing else reads it.
1656
1663
  */
1657
- backOfficeRef: z39.string().nullable(),
1664
+ backOfficeRef: z40.string().nullable(),
1658
1665
  /**
1659
1666
  * The order this session produced, when the connector's back office reported
1660
1667
  * it (`session_orders`): its opaque id and the back office's own name for it.
1661
1668
  * Both null when no order is known — the cart handle above is then the door.
1662
1669
  */
1663
- orderRef: z39.string().nullable(),
1664
- orderLabel: z39.string().nullable(),
1670
+ orderRef: z40.string().nullable(),
1671
+ orderLabel: z40.string().nullable(),
1665
1672
  /**
1666
1673
  * Which shell this session rendered — the one thing about the CAPTURE a list
1667
1674
  * needs.
@@ -1674,12 +1681,12 @@ var SessionSummarySchema = z39.object({
1674
1681
  * on a desktop are not the same session.
1675
1682
  */
1676
1683
  formFactor: SessionFormFactorSchema,
1677
- turnCount: z39.number().int(),
1684
+ turnCount: z40.number().int(),
1678
1685
  /** The visitor's opening message — the single most informative field for
1679
1686
  * deciding whether a session is worth opening, hence the widest column. */
1680
- firstPrompt: z39.string(),
1681
- startedAt: z39.string(),
1682
- lastRunAt: z39.string(),
1687
+ firstPrompt: z40.string(),
1688
+ startedAt: z40.string(),
1689
+ lastRunAt: z40.string(),
1683
1690
  /**
1684
1691
  * The VISITOR's own IANA zone (`America/New_York`), read from their browser
1685
1692
  * at session create — what the two timestamps above should be read in.
@@ -1707,7 +1714,7 @@ var SessionSummarySchema = z39.object({
1707
1714
  * Client-asserted and never validated against a zone table, so every consumer
1708
1715
  * must tolerate an unknown name: `Intl` throws a RangeError on one.
1709
1716
  */
1710
- visitorTimeZone: z39.string().nullable(),
1717
+ visitorTimeZone: z40.string().nullable(),
1711
1718
  /**
1712
1719
  * Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
1713
1720
  * layout op reaching the visitor, and THE latency the project is managed on.
@@ -1715,31 +1722,31 @@ var SessionSummarySchema = z39.object({
1715
1722
  * `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
1716
1723
  * already reading. Null when no turn in the session recorded a patch.
1717
1724
  */
1718
- avgTtftMs: z39.number().int().nullable(),
1725
+ avgTtftMs: z40.number().int().nullable(),
1719
1726
  /** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
1720
1727
  * a budget: null on sessions older than the mark's recording. */
1721
- avgMainDoneMs: z39.number().int().nullable(),
1728
+ avgMainDoneMs: z40.number().int().nullable(),
1722
1729
  /** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
1723
1730
  * budget. On the row only to explain the gap to `totalLatencyMs`. */
1724
- avgChipGenMs: z39.number().int().nullable(),
1725
- totalLatencyMs: z39.number().int(),
1726
- durationMs: z39.number().int(),
1731
+ avgChipGenMs: z40.number().int().nullable(),
1732
+ totalLatencyMs: z40.number().int(),
1733
+ durationMs: z40.number().int(),
1727
1734
  /** Inferred from recent activity — nothing writes a session-end marker. A
1728
1735
  * live session streams and cannot be given a verdict until it ends. */
1729
- isLive: z39.boolean(),
1736
+ isLive: z40.boolean(),
1730
1737
  verdict: SessionVerdictSchema,
1731
- reviewedBy: z39.string().nullable(),
1732
- reviewedAt: z39.string().nullable(),
1738
+ reviewedBy: z40.string().nullable(),
1739
+ reviewedAt: z40.string().nullable(),
1733
1740
  /** Latest filed bug, flattened onto the row so the queue can show its live
1734
1741
  * state without a second request. */
1735
- bugIssueKey: z39.string().nullable(),
1736
- bugIssueUrl: z39.string().nullable(),
1737
- bugIssueState: z39.string().nullable()
1738
- });
1739
- var SessionQueuePageSchema = z39.object({
1740
- sessions: z39.array(SessionSummarySchema),
1741
- totalCount: z39.number().int(),
1742
- hiddenInternalCount: z39.number().int(),
1742
+ bugIssueKey: z40.string().nullable(),
1743
+ bugIssueUrl: z40.string().nullable(),
1744
+ bugIssueState: z40.string().nullable()
1745
+ });
1746
+ var SessionQueuePageSchema = z40.object({
1747
+ sessions: z40.array(SessionSummarySchema),
1748
+ totalCount: z40.number().int(),
1749
+ hiddenInternalCount: z40.number().int(),
1743
1750
  /**
1744
1751
  * Bounced sessions the queue left out — no turn and no add, the default.
1745
1752
  *
@@ -1749,61 +1756,61 @@ var SessionQueuePageSchema = z39.object({
1749
1756
  * `totalCount + hiddenBouncedCount` is that population, and this count is the
1750
1757
  * analytics dashboard's bounce over the same window.
1751
1758
  */
1752
- hiddenBouncedCount: z39.number().int()
1759
+ hiddenBouncedCount: z40.number().int()
1753
1760
  });
1754
- var SessionQueueFacetsSchema = z39.object({
1755
- review: z39.record(z39.number()),
1756
- version: z39.record(z39.number()),
1757
- turns: z39.record(z39.number()),
1758
- durationS: z39.record(z39.number()),
1761
+ var SessionQueueFacetsSchema = z40.object({
1762
+ review: z40.record(z40.number()),
1763
+ version: z40.record(z40.number()),
1764
+ turns: z40.record(z40.number()),
1765
+ durationS: z40.record(z40.number()),
1759
1766
  /** Sessions per funnel step reached — a session counts under every step it reached. */
1760
- funnel: z39.record(z39.number())
1767
+ funnel: z40.record(z40.number())
1761
1768
  });
1762
- var SessionCaptureSchema = z39.object({
1763
- viewportWidth: z39.number().int().nullable(),
1764
- viewportHeight: z39.number().int().nullable(),
1765
- userAgent: z39.string().nullable(),
1766
- locale: z39.string().nullable(),
1769
+ var SessionCaptureSchema = z40.object({
1770
+ viewportWidth: z40.number().int().nullable(),
1771
+ viewportHeight: z40.number().int().nullable(),
1772
+ userAgent: z40.string().nullable(),
1773
+ locale: z40.string().nullable(),
1767
1774
  /** Referrer at session create — separates agentic traffic from organic. */
1768
- referrer: z39.string().nullable()
1775
+ referrer: z40.string().nullable()
1769
1776
  });
1770
- var SessionCaptureInputSchema = z39.object({
1771
- viewportWidth: z39.number().int().positive().max(2e4).optional(),
1772
- viewportHeight: z39.number().int().positive().max(2e4).optional(),
1773
- userAgent: z39.string().max(1e3).optional(),
1774
- locale: z39.string().max(35).optional(),
1777
+ var SessionCaptureInputSchema = z40.object({
1778
+ viewportWidth: z40.number().int().positive().max(2e4).optional(),
1779
+ viewportHeight: z40.number().int().positive().max(2e4).optional(),
1780
+ userAgent: z40.string().max(1e3).optional(),
1781
+ locale: z40.string().max(35).optional(),
1775
1782
  /** IANA zone name from the visitor's browser. Bounded rather than validated:
1776
1783
  * the zone database grows, and refusing a name this build has not heard of
1777
1784
  * would drop a real session's capture over a table that is out of date. */
1778
- timeZone: z39.string().max(64).optional(),
1779
- referrer: z39.string().max(2048).optional(),
1780
- clientVersion: z39.string().max(100).optional(),
1781
- isInternal: z39.boolean().optional()
1785
+ timeZone: z40.string().max(64).optional(),
1786
+ referrer: z40.string().max(2048).optional(),
1787
+ clientVersion: z40.string().max(100).optional(),
1788
+ isInternal: z40.boolean().optional()
1782
1789
  });
1783
- var SessionDetailSchema = z39.object({
1790
+ var SessionDetailSchema = z40.object({
1784
1791
  session: SessionSummarySchema,
1785
1792
  capture: SessionCaptureSchema,
1786
1793
  /** Full verdict history, newest first. Verdicts are revisable, and a session
1787
1794
  * re-judged after a fix is the evidence the fix worked. */
1788
- reviews: z39.array(SessionReviewEventSchema),
1789
- bugs: z39.array(SessionBugSchema),
1790
- comments: z39.array(SessionCommentSchema),
1795
+ reviews: z40.array(SessionReviewEventSchema),
1796
+ bugs: z40.array(SessionBugSchema),
1797
+ comments: z40.array(SessionCommentSchema),
1791
1798
  /** Optional during API/console rolling deployment. Absent is unavailable,
1792
1799
  * not evidence of zero visitor activity. */
1793
1800
  activity: SessionActivitySchema.optional()
1794
1801
  });
1795
- var RecordVerdictInputSchema = z39.object({
1802
+ var RecordVerdictInputSchema = z40.object({
1796
1803
  verdict: RecordableVerdictSchema,
1797
- note: z39.string().max(2e3).optional()
1804
+ note: z40.string().max(2e3).optional()
1798
1805
  });
1799
- var FileBugInputSchema = z39.object({
1800
- turnIndex: z39.number().int().positive().nullable(),
1806
+ var FileBugInputSchema = z40.object({
1807
+ turnIndex: z40.number().int().positive().nullable(),
1801
1808
  /** Optional — a bug filed without dropping a pin has no location. */
1802
1809
  location: BugLocationSchema.nullable().optional(),
1803
- title: z39.string().min(1).max(300),
1804
- body: z39.string().min(1),
1810
+ title: z40.string().min(1).max(300),
1811
+ body: z40.string().min(1),
1805
1812
  severity: BugSeveritySchema,
1806
- payload: z39.record(z39.unknown())
1813
+ payload: z40.record(z40.unknown())
1807
1814
  });
1808
1815
  export {
1809
1816
  EMPTY_SPEC,
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "peerDependencies": {
17
17
  "zod": "^3.25.0"
18
18
  },
19
- "version": "0.5.11",
19
+ "version": "0.5.12",
20
20
  "homepage": "https://docs.40rty.ai",
21
21
  "license": "UNLICENSED",
22
22
  "engines": {