@40rty/ams-cli 0.5.11 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/commands/space.mjs +17 -0
- package/bin/commands/whoami.mjs +1 -1
- package/bin/forty.mjs +2 -0
- package/bin/lib/__tests__/theme-normalize.test.mjs +26 -0
- package/bin/lib/theme/normalize.mjs +31 -1
- package/dist/wire.js +237 -230
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// `forty space delete <slug> --confirm <slug>` — end a space the organization
|
|
2
|
+
// owns: its spacefront, connector, configuration and agent runs. Cannot be
|
|
3
|
+
// undone. The slug is typed twice for the same reason the console asks for it:
|
|
4
|
+
// a wrong slug is the realistic mistake, and only naming the target catches it.
|
|
5
|
+
import { deployment, fail, option, positionals } from '../lib/context.mjs';
|
|
6
|
+
import { call } from '../lib/credentials.mjs';
|
|
7
|
+
|
|
8
|
+
const USAGE = 'usage: forty space delete <slug> --confirm <slug>';
|
|
9
|
+
|
|
10
|
+
export async function space() {
|
|
11
|
+
const [action, slug] = positionals();
|
|
12
|
+
if (action !== 'delete' || slug === undefined) fail(USAGE);
|
|
13
|
+
if (option('confirm') !== slug) fail(`${USAGE}\n deleting cannot be undone — repeat the slug after --confirm`);
|
|
14
|
+
const { apiUrl } = deployment(null);
|
|
15
|
+
await call(apiUrl, 'DELETE', `/org/spaces/${encodeURIComponent(slug)}`);
|
|
16
|
+
console.log(`deleted "${slug}"`);
|
|
17
|
+
}
|
package/bin/commands/whoami.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { deployment } from '../lib/context.mjs';
|
|
|
5
5
|
import { call } from '../lib/credentials.mjs';
|
|
6
6
|
|
|
7
7
|
/** What a 40rty organization does differently — shared with `forty init`. */
|
|
8
|
-
export const STAFF_NOTICE = '40rty organization: its spaces are 40rty demos. Build the package in the 40RTY-ai/brands repo (packages/<space>, on the shape of packages/ryleeandcru
|
|
8
|
+
export const STAFF_NOTICE = '40rty organization: its spaces are 40rty demos. Build the package in the 40RTY-ai/brands repo (packages/<space>, on the shape of packages/ryleeandcru, which passes the brands lint), open a PR there, and release it by merging (the brands CI publishes) — never from this machine.';
|
|
9
9
|
|
|
10
10
|
export async function whoami() {
|
|
11
11
|
const { apiUrl } = deployment(null);
|
package/bin/forty.mjs
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
// forty deploy host this Hydrogen app on 40rty, at the space's address
|
|
26
26
|
// (`--detect` prints where the app's own production deploys)
|
|
27
27
|
// forty hosting self the app's own deployment serves the space again
|
|
28
|
+
// forty space delete end a space the organization owns (`--confirm <slug>`)
|
|
28
29
|
// forty theme sync write the product pages' data from the store's own live
|
|
29
30
|
// theme (its templates, sections and apps) — `theme` in the config
|
|
30
31
|
//
|
|
@@ -50,6 +51,7 @@ const commands = {
|
|
|
50
51
|
deploy: () => import('./commands/deploy.mjs').then((m) => m.deploy()),
|
|
51
52
|
hosting: () => import('./commands/hosting.mjs').then((m) => m.hosting()),
|
|
52
53
|
theme: () => import('./commands/theme.mjs').then((m) => m.theme()),
|
|
54
|
+
space: () => import('./commands/space.mjs').then((m) => m.space()),
|
|
53
55
|
};
|
|
54
56
|
try {
|
|
55
57
|
const command = commands[process.argv[2]];
|
|
@@ -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
|
-
|
|
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/
|
|
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 =
|
|
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
|
|
1287
|
-
var RunTokenUsageSchema =
|
|
1288
|
-
input_tokens:
|
|
1289
|
-
output_tokens:
|
|
1290
|
-
cache_read_tokens:
|
|
1291
|
-
});
|
|
1292
|
-
var TraceRecordSchema =
|
|
1293
|
-
id:
|
|
1294
|
-
spaceId:
|
|
1295
|
-
sessionId:
|
|
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:
|
|
1299
|
-
userPrompt:
|
|
1300
|
-
branch:
|
|
1301
|
-
responseText:
|
|
1302
|
-
layout:
|
|
1303
|
-
phaseTimings:
|
|
1304
|
-
tokensByModel:
|
|
1305
|
-
toolCalls:
|
|
1306
|
-
diagnostics:
|
|
1307
|
-
latencyFirstText:
|
|
1308
|
-
latencyFirstPatch:
|
|
1309
|
-
latencyTotal:
|
|
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:
|
|
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:
|
|
1329
|
-
createdAt:
|
|
1330
|
-
});
|
|
1331
|
-
var MillisecondsSchema =
|
|
1332
|
-
var CreateTraceInputSchema =
|
|
1333
|
-
spaceId:
|
|
1334
|
-
sessionId:
|
|
1335
|
-
visitorEmail:
|
|
1336
|
-
userPrompt:
|
|
1337
|
-
branch:
|
|
1338
|
-
responseText:
|
|
1339
|
-
layout:
|
|
1340
|
-
phaseTimings:
|
|
1341
|
-
tokensByModel:
|
|
1342
|
-
toolCalls:
|
|
1343
|
-
diagnostics:
|
|
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:
|
|
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:
|
|
1370
|
+
turnId: z38.string().nullable()
|
|
1364
1371
|
});
|
|
1365
|
-
var AgentSessionSummarySchema =
|
|
1366
|
-
sessionId:
|
|
1372
|
+
var AgentSessionSummarySchema = z38.object({
|
|
1373
|
+
sessionId: z38.string(),
|
|
1367
1374
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
1368
|
-
turnCount:
|
|
1375
|
+
turnCount: z38.number().int(),
|
|
1369
1376
|
/** The session's opening prompt — titles the row in the UI. */
|
|
1370
|
-
firstPrompt:
|
|
1371
|
-
startedAt:
|
|
1372
|
-
lastRunAt:
|
|
1377
|
+
firstPrompt: z38.string(),
|
|
1378
|
+
startedAt: z38.string(),
|
|
1379
|
+
lastRunAt: z38.string(),
|
|
1373
1380
|
/** Summed `latency_total` across the session's turns. */
|
|
1374
|
-
totalLatencyMs:
|
|
1381
|
+
totalLatencyMs: z38.number().int()
|
|
1375
1382
|
});
|
|
1376
|
-
var SessionTurnSchema =
|
|
1377
|
-
id:
|
|
1378
|
-
userPrompt:
|
|
1379
|
-
responseText:
|
|
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:
|
|
1382
|
-
createdAt:
|
|
1383
|
-
latencyTotal:
|
|
1384
|
-
phaseTimings:
|
|
1385
|
-
tokensByModel:
|
|
1386
|
-
input_tokens:
|
|
1387
|
-
output_tokens:
|
|
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:
|
|
1390
|
-
diagnostics:
|
|
1396
|
+
toolCalls: z38.array(z38.unknown()).nullable(),
|
|
1397
|
+
diagnostics: z38.array(z38.unknown()).nullable()
|
|
1391
1398
|
});
|
|
1392
|
-
var SessionReplaySchema =
|
|
1393
|
-
turns:
|
|
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:
|
|
1411
|
+
sessionLayout: z38.record(z38.string(), z38.unknown()).nullable()
|
|
1405
1412
|
});
|
|
1406
|
-
var SessionTraceSchema =
|
|
1407
|
-
trackerState:
|
|
1413
|
+
var SessionTraceSchema = z38.object({
|
|
1414
|
+
trackerState: z38.string().nullable()
|
|
1408
1415
|
});
|
|
1409
|
-
var LlmUsageDailySchema =
|
|
1410
|
-
day:
|
|
1416
|
+
var LlmUsageDailySchema = z38.object({
|
|
1417
|
+
day: z38.string(),
|
|
1411
1418
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
1412
|
-
environment:
|
|
1413
|
-
feature:
|
|
1414
|
-
model:
|
|
1415
|
-
provider:
|
|
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:
|
|
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:
|
|
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:
|
|
1434
|
-
inputTokens:
|
|
1435
|
-
outputTokens:
|
|
1440
|
+
surface: z38.string().nullable(),
|
|
1441
|
+
inputTokens: z38.number(),
|
|
1442
|
+
outputTokens: z38.number(),
|
|
1436
1443
|
/** Subset of inputTokens, never additional to it. */
|
|
1437
|
-
cachedInputTokens:
|
|
1438
|
-
reasoningTokens:
|
|
1439
|
-
callCount:
|
|
1440
|
-
errorCount:
|
|
1441
|
-
estimatedCostUsd:
|
|
1442
|
-
});
|
|
1443
|
-
var LlmUsageBySessionSchema =
|
|
1444
|
-
sessionId:
|
|
1445
|
-
environment:
|
|
1446
|
-
model:
|
|
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:
|
|
1455
|
+
spaceId: z38.string().nullable(),
|
|
1449
1456
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
1450
|
-
surface:
|
|
1457
|
+
surface: z38.string().nullable(),
|
|
1451
1458
|
/** Label only — the first feature seen in the session. */
|
|
1452
|
-
firstFeature:
|
|
1453
|
-
startedAt:
|
|
1454
|
-
endedAt:
|
|
1455
|
-
inputTokens:
|
|
1456
|
-
outputTokens:
|
|
1457
|
-
cachedInputTokens:
|
|
1458
|
-
reasoningTokens:
|
|
1459
|
-
callCount:
|
|
1460
|
-
errorCount:
|
|
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:
|
|
1471
|
+
estimatedCostUsd: z38.number().nullable()
|
|
1465
1472
|
});
|
|
1466
|
-
var LlmSessionsDailySchema =
|
|
1467
|
-
day:
|
|
1468
|
-
environment:
|
|
1469
|
-
sessionCount:
|
|
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
|
|
1480
|
+
import { z as z40 } from "zod";
|
|
1474
1481
|
|
|
1475
1482
|
// ../spacestation/src/space/session-activity.ts
|
|
1476
|
-
import { z as
|
|
1477
|
-
var SessionActivityEventSchema =
|
|
1478
|
-
id:
|
|
1479
|
-
kind:
|
|
1480
|
-
occurredAt:
|
|
1481
|
-
source:
|
|
1482
|
-
surface:
|
|
1483
|
-
payload:
|
|
1484
|
-
});
|
|
1485
|
-
var SessionActivitySchema =
|
|
1486
|
-
events:
|
|
1487
|
-
hasMore:
|
|
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 =
|
|
1492
|
-
var RecordableVerdictSchema =
|
|
1493
|
-
var SessionReviewEventSchema =
|
|
1494
|
-
id:
|
|
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:
|
|
1499
|
-
note:
|
|
1500
|
-
createdAt:
|
|
1505
|
+
reviewer: z40.string(),
|
|
1506
|
+
note: z40.string().nullable(),
|
|
1507
|
+
createdAt: z40.string()
|
|
1501
1508
|
});
|
|
1502
|
-
var BugSeveritySchema =
|
|
1503
|
-
var BugLocationSchema =
|
|
1504
|
-
elementId:
|
|
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:
|
|
1514
|
+
elementType: z40.string().nullable(),
|
|
1508
1515
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
1509
|
-
offsetXPct:
|
|
1510
|
-
offsetYPct:
|
|
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:
|
|
1522
|
-
pageY:
|
|
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 =
|
|
1537
|
-
id:
|
|
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:
|
|
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:
|
|
1544
|
-
issueKey:
|
|
1545
|
-
issueUrl:
|
|
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:
|
|
1549
|
-
title:
|
|
1550
|
-
body:
|
|
1555
|
+
issueState: z40.string().nullable(),
|
|
1556
|
+
title: z40.string(),
|
|
1557
|
+
body: z40.string(),
|
|
1551
1558
|
severity: BugSeveritySchema,
|
|
1552
|
-
createdBy:
|
|
1553
|
-
createdAt:
|
|
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:
|
|
1563
|
-
resolvedBy:
|
|
1569
|
+
resolvedAt: z40.string().nullable(),
|
|
1570
|
+
resolvedBy: z40.string().nullable()
|
|
1564
1571
|
});
|
|
1565
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
1566
|
-
var SessionCommentSchema =
|
|
1567
|
-
id:
|
|
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:
|
|
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:
|
|
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:
|
|
1576
|
-
createdBy:
|
|
1577
|
-
createdAt:
|
|
1582
|
+
body: z40.string(),
|
|
1583
|
+
createdBy: z40.string(),
|
|
1584
|
+
createdAt: z40.string()
|
|
1578
1585
|
});
|
|
1579
|
-
var CreateCommentInputSchema =
|
|
1580
|
-
bugId:
|
|
1581
|
-
turnIndex:
|
|
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:
|
|
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 =
|
|
1590
|
-
body:
|
|
1591
|
-
bugId:
|
|
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 =
|
|
1595
|
-
var SessionSummarySchema =
|
|
1596
|
-
sessionId:
|
|
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:
|
|
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:
|
|
1603
|
-
identityKey:
|
|
1609
|
+
identityProvider: z40.string().nullable(),
|
|
1610
|
+
identityKey: z40.string().nullable(),
|
|
1604
1611
|
/** Team/test traffic. The queue hides these by default. */
|
|
1605
|
-
isInternal:
|
|
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:
|
|
1615
|
+
clientVersion: z40.string().nullable(),
|
|
1609
1616
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
1610
|
-
signalCounts:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
1664
|
-
orderLabel:
|
|
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:
|
|
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:
|
|
1681
|
-
startedAt:
|
|
1682
|
-
lastRunAt:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
1725
|
-
totalLatencyMs:
|
|
1726
|
-
durationMs:
|
|
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:
|
|
1736
|
+
isLive: z40.boolean(),
|
|
1730
1737
|
verdict: SessionVerdictSchema,
|
|
1731
|
-
reviewedBy:
|
|
1732
|
-
reviewedAt:
|
|
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:
|
|
1736
|
-
bugIssueUrl:
|
|
1737
|
-
bugIssueState:
|
|
1738
|
-
});
|
|
1739
|
-
var SessionQueuePageSchema =
|
|
1740
|
-
sessions:
|
|
1741
|
-
totalCount:
|
|
1742
|
-
hiddenInternalCount:
|
|
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:
|
|
1759
|
+
hiddenBouncedCount: z40.number().int()
|
|
1753
1760
|
});
|
|
1754
|
-
var SessionQueueFacetsSchema =
|
|
1755
|
-
review:
|
|
1756
|
-
version:
|
|
1757
|
-
turns:
|
|
1758
|
-
durationS:
|
|
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:
|
|
1767
|
+
funnel: z40.record(z40.number())
|
|
1761
1768
|
});
|
|
1762
|
-
var SessionCaptureSchema =
|
|
1763
|
-
viewportWidth:
|
|
1764
|
-
viewportHeight:
|
|
1765
|
-
userAgent:
|
|
1766
|
-
locale:
|
|
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:
|
|
1775
|
+
referrer: z40.string().nullable()
|
|
1769
1776
|
});
|
|
1770
|
-
var SessionCaptureInputSchema =
|
|
1771
|
-
viewportWidth:
|
|
1772
|
-
viewportHeight:
|
|
1773
|
-
userAgent:
|
|
1774
|
-
locale:
|
|
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:
|
|
1779
|
-
referrer:
|
|
1780
|
-
clientVersion:
|
|
1781
|
-
isInternal:
|
|
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 =
|
|
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:
|
|
1789
|
-
bugs:
|
|
1790
|
-
comments:
|
|
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 =
|
|
1802
|
+
var RecordVerdictInputSchema = z40.object({
|
|
1796
1803
|
verdict: RecordableVerdictSchema,
|
|
1797
|
-
note:
|
|
1804
|
+
note: z40.string().max(2e3).optional()
|
|
1798
1805
|
});
|
|
1799
|
-
var FileBugInputSchema =
|
|
1800
|
-
turnIndex:
|
|
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:
|
|
1804
|
-
body:
|
|
1810
|
+
title: z40.string().min(1).max(300),
|
|
1811
|
+
body: z40.string().min(1),
|
|
1805
1812
|
severity: BugSeveritySchema,
|
|
1806
|
-
payload:
|
|
1813
|
+
payload: z40.record(z40.unknown())
|
|
1807
1814
|
});
|
|
1808
1815
|
export {
|
|
1809
1816
|
EMPTY_SPEC,
|