@40rty/ams-cli 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { PackageReleaseSchema, carriesShapeToken, catalogToWire } from '../../dist/wire.js';
4
- import { buildBundle, loadBrandDefinition, loadCatalog, loadManifests, loadMark } from '../lib/build.mjs';
4
+ import { buildBundle, loadBrandDefinition, loadCatalog, loadManifests, loadMark, loadSpacePrompt } from '../lib/build.mjs';
5
5
  import { cwd, flag, option, readConfig } from '../lib/context.mjs';
6
6
  import { call } from '../lib/credentials.mjs';
7
7
  import { registerOrigin } from './origin.mjs';
@@ -36,6 +36,9 @@ export async function buildRelease(config) {
36
36
  if (typeof config.brand === 'string') Object.assign(release, await loadBrandDefinition(config.brand, config.prompts));
37
37
  if (typeof config.theme === 'string') release.theme = { themeClass: config.theme };
38
38
  if (typeof config.seedLayout === 'string') release.seedLayout = JSON.parse(await readFile(path.join(cwd, config.seedLayout), 'utf8'));
39
+ // The brand's space prompt (`<prompts>/space.md`) — its spaces' prompt file.
40
+ const spacePrompt = await loadSpacePrompt(config.prompts);
41
+ if (spacePrompt !== undefined) release.spacePrompt = spacePrompt;
39
42
  // The brand's mark — the files themselves; the platform stores and serves them.
40
43
  if (config.mark !== undefined) release.mark = await loadMark(config.mark);
41
44
  warnShapeTokenExamples(release.catalog);
package/bin/lib/build.mjs CHANGED
@@ -232,6 +232,22 @@ export async function loadBrandDefinition(file, promptsDir) {
232
232
  return out;
233
233
  }
234
234
 
235
+ /**
236
+ * The brand's SPACE prompt — `<prompts>/space.md`, sent verbatim. It is the
237
+ * prompt file every space bound to this package reads: how the brand speaks,
238
+ * what it sells, what it never claims. Absent when the package declares no
239
+ * `prompts` directory or ships no file there.
240
+ */
241
+ export async function loadSpacePrompt(promptsDir) {
242
+ if (typeof promptsDir !== 'string') return undefined;
243
+ try {
244
+ return await readFile(path.join(cwd, promptsDir, 'space.md'), 'utf8');
245
+ } catch (err) {
246
+ if (err instanceof Error && 'code' in err && err.code === 'ENOENT') return undefined;
247
+ throw err;
248
+ }
249
+ }
250
+
235
251
  /**
236
252
  * The brand's mark — forty.config.json `"mark": { "square": "brand/mark.svg",
237
253
  * "wordmark": "brand/wordmark.svg" }`, either or both. The files are sent
package/dist/wire.js CHANGED
@@ -919,6 +919,14 @@ var PackageReleaseSchema = z24.object({
919
919
  * markdown the agent reads, gated on the capabilities it names (`requires`).
920
920
  */
921
921
  promptSections: z24.array(z24.object({ id: z24.string().regex(/^[a-z0-9-]+$/), order: z24.number().int(), content: z24.string().min(1).max(2e4), requires: z24.array(z24.string()) }).strict()).max(10).optional(),
922
+ /**
923
+ * The brand's SPACE prompt — its `prompts/space.md`, verbatim: sections split
924
+ * by `<!-- section:<id> -->` markers, the same format as the platform's
925
+ * `prompts/spaces/<slug>.md`, which it replaces for any space bound to this
926
+ * package. How the brand speaks, what it sells and what it never claims ship
927
+ * with the brand, and a release changes them with no platform deploy.
928
+ */
929
+ spacePrompt: z24.string().min(1).max(2e5).optional(),
922
930
  /**
923
931
  * Opaque per-vertical extension data (`BrandDefinition.config`): the
924
932
  * platform stays vertical-agnostic and the vertical's own code reads its keys.
@@ -1128,6 +1136,50 @@ var AttributeDefSchema = z32.discriminatedUnion("kind", [
1128
1136
  })
1129
1137
  ]);
1130
1138
 
1139
+ // ../spacestation/src/space/agent-directive.ts
1140
+ import { z as z33 } from "zod";
1141
+ var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
1142
+ var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
1143
+ var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
1144
+ var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
1145
+ var AgentDirectiveSchema = z33.object({
1146
+ name: z33.string().trim().min(1).max(80),
1147
+ kind: z33.enum(AGENT_DIRECTIVE_KINDS),
1148
+ severity: z33.enum(AGENT_DIRECTIVE_SEVERITIES),
1149
+ /** No bare URL: a URL is a hallucination surface, and a handle is not a
1150
+ * product name. */
1151
+ text: z33.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
1152
+ }).strict();
1153
+ var SpaceAgentDirectiveSchema = z33.object({
1154
+ id: z33.string(),
1155
+ position: z33.number().int(),
1156
+ name: z33.string(),
1157
+ kind: z33.enum(AGENT_DIRECTIVE_KINDS),
1158
+ severity: z33.enum(AGENT_DIRECTIVE_SEVERITIES),
1159
+ text: z33.string(),
1160
+ source: z33.enum(AGENT_DIRECTIVE_SOURCES),
1161
+ status: z33.enum(AGENT_DIRECTIVE_STATUSES),
1162
+ /** Who wrote it; null for a lesson the system proposed. */
1163
+ createdBy: z33.string().nullable(),
1164
+ /** Why a mined lesson was proposed; null for a directive a person wrote. */
1165
+ evidence: z33.record(z33.unknown()).nullable(),
1166
+ decidedBy: z33.string().nullable(),
1167
+ decidedAt: z33.string().nullable(),
1168
+ createdAt: z33.string()
1169
+ });
1170
+ var OutcomeTallySchema = z33.object({ turns: z33.number().int(), acted: z33.number().int() });
1171
+ var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
1172
+ impact: z33.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
1173
+ });
1174
+ var UpdateAgentDirectiveInputSchema = z33.object({
1175
+ name: AgentDirectiveSchema.shape.name.optional(),
1176
+ kind: AgentDirectiveSchema.shape.kind.optional(),
1177
+ severity: AgentDirectiveSchema.shape.severity.optional(),
1178
+ text: AgentDirectiveSchema.shape.text.optional(),
1179
+ status: z33.enum(AGENT_DIRECTIVE_STATUSES).optional()
1180
+ }).strict();
1181
+ var ReorderAgentDirectivesInputSchema = z33.object({ ids: z33.array(z33.string()).min(1) }).strict();
1182
+
1131
1183
  // ../spacestation/src/space/workspace-catalog.ts
1132
1184
  var COMPONENT_SOURCE = {
1133
1185
  ui: "@fourty/ui"
@@ -1156,30 +1208,30 @@ var DEFAULT_SPACE_CONFIG = {
1156
1208
  };
1157
1209
 
1158
1210
  // ../spacestation/src/space/trace.ts
1159
- import { z as z33 } from "zod";
1160
- var RunTokenUsageSchema = z33.object({
1161
- input_tokens: z33.number().optional(),
1162
- output_tokens: z33.number().optional(),
1163
- cache_read_tokens: z33.number().optional()
1211
+ import { z as z34 } from "zod";
1212
+ var RunTokenUsageSchema = z34.object({
1213
+ input_tokens: z34.number().optional(),
1214
+ output_tokens: z34.number().optional(),
1215
+ cache_read_tokens: z34.number().optional()
1164
1216
  });
1165
- var TraceRecordSchema = z33.object({
1166
- id: z33.string().uuid(),
1167
- spaceId: z33.string().uuid().nullable(),
1168
- sessionId: z33.string(),
1217
+ var TraceRecordSchema = z34.object({
1218
+ id: z34.string().uuid(),
1219
+ spaceId: z34.string().uuid().nullable(),
1220
+ sessionId: z34.string(),
1169
1221
  /** OTP-verified visitor email the session was unlocked with, or `null`
1170
1222
  * for an unlocked space / anonymous unlock. */
1171
- visitorEmail: z33.string().nullable(),
1172
- userPrompt: z33.string(),
1173
- branch: z33.string().nullable(),
1174
- responseText: z33.string().nullable(),
1175
- layout: z33.unknown().nullable(),
1176
- phaseTimings: z33.record(z33.number()).nullable(),
1177
- tokensByModel: z33.record(RunTokenUsageSchema).nullable(),
1178
- toolCalls: z33.array(z33.unknown()).nullable(),
1179
- diagnostics: z33.array(z33.unknown()).nullable(),
1180
- latencyFirstText: z33.number().int().nullable(),
1181
- latencyFirstPatch: z33.number().int().nullable(),
1182
- latencyTotal: z33.number().int().nullable(),
1223
+ visitorEmail: z34.string().nullable(),
1224
+ userPrompt: z34.string(),
1225
+ branch: z34.string().nullable(),
1226
+ responseText: z34.string().nullable(),
1227
+ layout: z34.unknown().nullable(),
1228
+ phaseTimings: z34.record(z34.number()).nullable(),
1229
+ tokensByModel: z34.record(RunTokenUsageSchema).nullable(),
1230
+ toolCalls: z34.array(z34.unknown()).nullable(),
1231
+ diagnostics: z34.array(z34.unknown()).nullable(),
1232
+ latencyFirstText: z34.number().int().nullable(),
1233
+ latencyFirstPatch: z34.number().int().nullable(),
1234
+ latencyTotal: z34.number().int().nullable(),
1183
1235
  /**
1184
1236
  * The CLIENT's turn id for this run, or `null`.
1185
1237
  *
@@ -1195,29 +1247,29 @@ var TraceRecordSchema = z33.object({
1195
1247
  * a turn whose ack the client never saw — none of which is evidence that a
1196
1248
  * visitor asked something and got nothing.
1197
1249
  */
1198
- turnId: z33.string().nullable(),
1250
+ turnId: z34.string().nullable(),
1199
1251
  /** Serialized `TraceTracker.exportState()` payload (parsed object) —
1200
1252
  * lets the inspector rehydrate this run verbatim after a reload. */
1201
- trackerState: z33.unknown().nullable(),
1202
- createdAt: z33.string()
1253
+ trackerState: z34.unknown().nullable(),
1254
+ createdAt: z34.string()
1203
1255
  });
1204
- var MillisecondsSchema = z33.number().nullable().transform((v) => v === null ? null : Math.round(v));
1205
- var CreateTraceInputSchema = z33.object({
1206
- spaceId: z33.string().uuid().nullable(),
1207
- sessionId: z33.string(),
1208
- visitorEmail: z33.string().nullable(),
1209
- userPrompt: z33.string(),
1210
- branch: z33.string().nullable(),
1211
- responseText: z33.string().nullable(),
1212
- layout: z33.unknown().nullable(),
1213
- phaseTimings: z33.record(z33.number()).nullable(),
1214
- tokensByModel: z33.record(RunTokenUsageSchema).nullable(),
1215
- toolCalls: z33.array(z33.unknown()).nullable(),
1216
- diagnostics: z33.array(z33.unknown()).nullable(),
1256
+ var MillisecondsSchema = z34.number().nullable().transform((v) => v === null ? null : Math.round(v));
1257
+ var CreateTraceInputSchema = z34.object({
1258
+ spaceId: z34.string().uuid().nullable(),
1259
+ sessionId: z34.string(),
1260
+ visitorEmail: z34.string().nullable(),
1261
+ userPrompt: z34.string(),
1262
+ branch: z34.string().nullable(),
1263
+ responseText: z34.string().nullable(),
1264
+ layout: z34.unknown().nullable(),
1265
+ phaseTimings: z34.record(z34.number()).nullable(),
1266
+ tokensByModel: z34.record(RunTokenUsageSchema).nullable(),
1267
+ toolCalls: z34.array(z34.unknown()).nullable(),
1268
+ diagnostics: z34.array(z34.unknown()).nullable(),
1217
1269
  latencyFirstText: MillisecondsSchema,
1218
1270
  latencyFirstPatch: MillisecondsSchema,
1219
1271
  latencyTotal: MillisecondsSchema,
1220
- trackerState: z33.unknown().nullable(),
1272
+ trackerState: z34.unknown().nullable(),
1221
1273
  /**
1222
1274
  * The CLIENT's turn id for this run, or `null`.
1223
1275
  *
@@ -1233,37 +1285,37 @@ var CreateTraceInputSchema = z33.object({
1233
1285
  * a turn whose ack the client never saw — none of which is evidence that a
1234
1286
  * visitor asked something and got nothing.
1235
1287
  */
1236
- turnId: z33.string().nullable()
1288
+ turnId: z34.string().nullable()
1237
1289
  });
1238
- var AgentSessionSummarySchema = z33.object({
1239
- sessionId: z33.string(),
1290
+ var AgentSessionSummarySchema = z34.object({
1291
+ sessionId: z34.string(),
1240
1292
  /** Turn rows only; background/secondary runs are excluded by the aggregate. */
1241
- turnCount: z33.number().int(),
1293
+ turnCount: z34.number().int(),
1242
1294
  /** The session's opening prompt — titles the row in the UI. */
1243
- firstPrompt: z33.string(),
1244
- startedAt: z33.string(),
1245
- lastRunAt: z33.string(),
1295
+ firstPrompt: z34.string(),
1296
+ startedAt: z34.string(),
1297
+ lastRunAt: z34.string(),
1246
1298
  /** Summed `latency_total` across the session's turns. */
1247
- totalLatencyMs: z33.number().int()
1299
+ totalLatencyMs: z34.number().int()
1248
1300
  });
1249
- var SessionTurnSchema = z33.object({
1250
- id: z33.string().uuid(),
1251
- userPrompt: z33.string(),
1252
- responseText: z33.string().nullable(),
1301
+ var SessionTurnSchema = z34.object({
1302
+ id: z34.string().uuid(),
1303
+ userPrompt: z34.string(),
1304
+ responseText: z34.string().nullable(),
1253
1305
  /** Full cumulative Spec committed by this turn — never a patch delta. */
1254
- layout: z33.unknown().nullable(),
1255
- createdAt: z33.string(),
1256
- latencyTotal: z33.number().int().nullable(),
1257
- phaseTimings: z33.record(z33.number()).nullable(),
1258
- tokensByModel: z33.record(z33.object({
1259
- input_tokens: z33.number().optional(),
1260
- output_tokens: z33.number().optional()
1306
+ layout: z34.unknown().nullable(),
1307
+ createdAt: z34.string(),
1308
+ latencyTotal: z34.number().int().nullable(),
1309
+ phaseTimings: z34.record(z34.number()).nullable(),
1310
+ tokensByModel: z34.record(z34.object({
1311
+ input_tokens: z34.number().optional(),
1312
+ output_tokens: z34.number().optional()
1261
1313
  })).nullable(),
1262
- toolCalls: z33.array(z33.unknown()).nullable(),
1263
- diagnostics: z33.array(z33.unknown()).nullable()
1314
+ toolCalls: z34.array(z34.unknown()).nullable(),
1315
+ diagnostics: z34.array(z34.unknown()).nullable()
1264
1316
  });
1265
- var SessionReplaySchema = z33.object({
1266
- turns: z33.array(SessionTurnSchema),
1317
+ var SessionReplaySchema = z34.object({
1318
+ turns: z34.array(SessionTurnSchema),
1267
1319
  /**
1268
1320
  * The session's own last-committed layout, read straight off the durable
1269
1321
  * session record (`sessions.blob.layout`) rather than derived from `turns`.
@@ -1274,20 +1326,20 @@ var SessionReplaySchema = z33.object({
1274
1326
  * a perfectly real layout; only this field can show it. Null exclusively
1275
1327
  * when the durable session row itself could not be read.
1276
1328
  */
1277
- sessionLayout: z33.record(z33.string(), z33.unknown()).nullable()
1329
+ sessionLayout: z34.record(z34.string(), z34.unknown()).nullable()
1278
1330
  });
1279
- var SessionTraceSchema = z33.object({
1280
- trackerState: z33.string().nullable()
1331
+ var SessionTraceSchema = z34.object({
1332
+ trackerState: z34.string().nullable()
1281
1333
  });
1282
- var LlmUsageDailySchema = z33.object({
1283
- day: z33.string(),
1334
+ var LlmUsageDailySchema = z34.object({
1335
+ day: z34.string(),
1284
1336
  /** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
1285
- environment: z33.string(),
1286
- feature: z33.string(),
1287
- model: z33.string(),
1288
- provider: z33.string(),
1337
+ environment: z34.string(),
1338
+ feature: z34.string(),
1339
+ model: z34.string(),
1340
+ provider: z34.string(),
1289
1341
  /** Masked tail of the key actually billed, or null when unknown/non-Google. */
1290
- keyFingerprint: z33.string().nullable(),
1342
+ keyFingerprint: z34.string().nullable(),
1291
1343
  /**
1292
1344
  * The space the call served, or null when it served none.
1293
1345
  *
@@ -1296,91 +1348,91 @@ var LlmUsageDailySchema = z33.object({
1296
1348
  * report that share rather than dropping it, or a per-space total reads as
1297
1349
  * the platform total.
1298
1350
  */
1299
- spaceId: z33.string().nullable(),
1351
+ spaceId: z34.string().nullable(),
1300
1352
  /**
1301
1353
  * The surface of the session the call served (`sessions.surface`), or null
1302
1354
  * when it served no session or the session predates surface recording.
1303
1355
  * `automation` is the eval harness — the signal that files an ordinary
1304
1356
  * `agent-turn` as testing spend rather than as a visitor's.
1305
1357
  */
1306
- surface: z33.string().nullable(),
1307
- inputTokens: z33.number(),
1308
- outputTokens: z33.number(),
1358
+ surface: z34.string().nullable(),
1359
+ inputTokens: z34.number(),
1360
+ outputTokens: z34.number(),
1309
1361
  /** Subset of inputTokens, never additional to it. */
1310
- cachedInputTokens: z33.number(),
1311
- reasoningTokens: z33.number(),
1312
- callCount: z33.number(),
1313
- errorCount: z33.number(),
1314
- estimatedCostUsd: z33.number().nullable()
1362
+ cachedInputTokens: z34.number(),
1363
+ reasoningTokens: z34.number(),
1364
+ callCount: z34.number(),
1365
+ errorCount: z34.number(),
1366
+ estimatedCostUsd: z34.number().nullable()
1315
1367
  });
1316
- var LlmUsageBySessionSchema = z33.object({
1317
- sessionId: z33.string(),
1318
- environment: z33.string(),
1319
- model: z33.string(),
1368
+ var LlmUsageBySessionSchema = z34.object({
1369
+ sessionId: z34.string(),
1370
+ environment: z34.string(),
1371
+ model: z34.string(),
1320
1372
  /** The space this session belongs to, or null for a session with no space. */
1321
- spaceId: z33.string().nullable(),
1373
+ spaceId: z34.string().nullable(),
1322
1374
  /** The session's surface — see `LlmUsageDailySchema.surface`. */
1323
- surface: z33.string().nullable(),
1375
+ surface: z34.string().nullable(),
1324
1376
  /** Label only — the first feature seen in the session. */
1325
- firstFeature: z33.string(),
1326
- startedAt: z33.string(),
1327
- endedAt: z33.string(),
1328
- inputTokens: z33.number(),
1329
- outputTokens: z33.number(),
1330
- cachedInputTokens: z33.number(),
1331
- reasoningTokens: z33.number(),
1332
- callCount: z33.number(),
1333
- errorCount: z33.number(),
1377
+ firstFeature: z34.string(),
1378
+ startedAt: z34.string(),
1379
+ endedAt: z34.string(),
1380
+ inputTokens: z34.number(),
1381
+ outputTokens: z34.number(),
1382
+ cachedInputTokens: z34.number(),
1383
+ reasoningTokens: z34.number(),
1384
+ callCount: z34.number(),
1385
+ errorCount: z34.number(),
1334
1386
  /** Priced server-side, like the daily rollup — the browser never carries a
1335
1387
  * rate table, so there is exactly one place a price can be wrong. Null when
1336
1388
  * the model is unpriced; never 0, which would read as free. */
1337
- estimatedCostUsd: z33.number().nullable()
1389
+ estimatedCostUsd: z34.number().nullable()
1338
1390
  });
1339
- var LlmSessionsDailySchema = z33.object({
1340
- day: z33.string(),
1341
- environment: z33.string(),
1342
- sessionCount: z33.number()
1391
+ var LlmSessionsDailySchema = z34.object({
1392
+ day: z34.string(),
1393
+ environment: z34.string(),
1394
+ sessionCount: z34.number()
1343
1395
  });
1344
1396
 
1345
1397
  // ../spacestation/src/space/session-queue.ts
1346
- import { z as z35 } from "zod";
1398
+ import { z as z36 } from "zod";
1347
1399
 
1348
1400
  // ../spacestation/src/space/session-activity.ts
1349
- import { z as z34 } from "zod";
1350
- var SessionActivityEventSchema = z34.object({
1351
- id: z34.string(),
1352
- kind: z34.string(),
1353
- occurredAt: z34.string(),
1354
- source: z34.string(),
1355
- surface: z34.string(),
1356
- payload: z34.record(z34.unknown())
1401
+ import { z as z35 } from "zod";
1402
+ var SessionActivityEventSchema = z35.object({
1403
+ id: z35.string(),
1404
+ kind: z35.string(),
1405
+ occurredAt: z35.string(),
1406
+ source: z35.string(),
1407
+ surface: z35.string(),
1408
+ payload: z35.record(z35.unknown())
1357
1409
  });
1358
- var SessionActivitySchema = z34.object({
1359
- events: z34.array(SessionActivityEventSchema),
1360
- hasMore: z34.boolean()
1410
+ var SessionActivitySchema = z35.object({
1411
+ events: z35.array(SessionActivityEventSchema),
1412
+ hasMore: z35.boolean()
1361
1413
  });
1362
1414
 
1363
1415
  // ../spacestation/src/space/session-queue.ts
1364
- var SessionVerdictSchema = z35.enum(["unreviewed", "viewed", "bug"]);
1365
- var RecordableVerdictSchema = z35.enum(["viewed", "bug"]);
1366
- var SessionReviewEventSchema = z35.object({
1367
- id: z35.string().uuid(),
1416
+ var SessionVerdictSchema = z36.enum(["unreviewed", "viewed", "bug"]);
1417
+ var RecordableVerdictSchema = z36.enum(["viewed", "bug"]);
1418
+ var SessionReviewEventSchema = z36.object({
1419
+ id: z36.string().uuid(),
1368
1420
  verdict: RecordableVerdictSchema,
1369
1421
  /** Account email of the operator who judged it. Attribution is the reason the
1370
1422
  * log is append-only rather than a mutable current-state row. */
1371
- reviewer: z35.string(),
1372
- note: z35.string().nullable(),
1373
- createdAt: z35.string()
1423
+ reviewer: z36.string(),
1424
+ note: z36.string().nullable(),
1425
+ createdAt: z36.string()
1374
1426
  });
1375
- var BugSeveritySchema = z35.enum(["high", "medium", "low"]);
1376
- var BugLocationSchema = z35.object({
1377
- elementId: z35.string().nullable(),
1427
+ var BugSeveritySchema = z36.enum(["high", "medium", "low"]);
1428
+ var BugLocationSchema = z36.object({
1429
+ elementId: z36.string().nullable(),
1378
1430
  /** Display only — the catalog component type, e.g. "productGrid". Null
1379
1431
  * alongside a null `elementId`. */
1380
- elementType: z35.string().nullable(),
1432
+ elementType: z36.string().nullable(),
1381
1433
  /** Fraction of the ELEMENT's own box. Null for a page anchor. */
1382
- offsetXPct: z35.number().min(0).max(100).nullable(),
1383
- offsetYPct: z35.number().min(0).max(100).nullable(),
1434
+ offsetXPct: z36.number().min(0).max(100).nullable(),
1435
+ offsetYPct: z36.number().min(0).max(100).nullable(),
1384
1436
  /**
1385
1437
  * ABSOLUTE document pixels, for a pin with no element under it. Null for an
1386
1438
  * element anchor.
@@ -1391,8 +1443,8 @@ var BugLocationSchema = z35.object({
1391
1443
  * on the page with it. Measured before this was fixed: growing the page 9%
1392
1444
  * slid a pin 32px, so a pin ran away from the cursor reaching for it.
1393
1445
  */
1394
- pageX: z35.number().nullable(),
1395
- pageY: z35.number().nullable()
1446
+ pageX: z36.number().nullable(),
1447
+ pageY: z36.number().nullable()
1396
1448
  }).refine(
1397
1449
  (loc) => {
1398
1450
  const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
@@ -1406,24 +1458,24 @@ var BugLocationSchema = z35.object({
1406
1458
  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)"
1407
1459
  }
1408
1460
  );
1409
- var SessionBugSchema = z35.object({
1410
- id: z35.string().uuid(),
1461
+ var SessionBugSchema = z36.object({
1462
+ id: z36.string().uuid(),
1411
1463
  /** 1-based turn the fault was observed on; null when the fault is session-wide. */
1412
- turnIndex: z35.number().int().nullable(),
1464
+ turnIndex: z36.number().int().nullable(),
1413
1465
  /** Where on that turn's canvas the pin was dropped; null for a bug filed
1414
1466
  * without pinning a spot. */
1415
1467
  location: BugLocationSchema.nullable(),
1416
- provider: z35.string(),
1417
- issueKey: z35.string().nullable(),
1418
- issueUrl: z35.string().nullable(),
1468
+ provider: z36.string(),
1469
+ issueKey: z36.string().nullable(),
1470
+ issueUrl: z36.string().nullable(),
1419
1471
  /** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
1420
1472
  * open text. Null until first synced. */
1421
- issueState: z35.string().nullable(),
1422
- title: z35.string(),
1423
- body: z35.string(),
1473
+ issueState: z36.string().nullable(),
1474
+ title: z36.string(),
1475
+ body: z36.string(),
1424
1476
  severity: BugSeveritySchema,
1425
- createdBy: z35.string(),
1426
- createdAt: z35.string(),
1477
+ createdBy: z36.string(),
1478
+ createdAt: z36.string(),
1427
1479
  /**
1428
1480
  * When this bug was resolved from the console; null means still OPEN.
1429
1481
  *
@@ -1432,55 +1484,55 @@ var SessionBugSchema = z35.object({
1432
1484
  * whether a particular fault is still live. The timestamp IS the state, so
1433
1485
  * no boolean can contradict it.
1434
1486
  */
1435
- resolvedAt: z35.string().nullable(),
1436
- resolvedBy: z35.string().nullable()
1487
+ resolvedAt: z36.string().nullable(),
1488
+ resolvedBy: z36.string().nullable()
1437
1489
  });
1438
- var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z35.string() });
1439
- var SessionCommentSchema = z35.object({
1440
- id: z35.string().uuid(),
1490
+ var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z36.string() });
1491
+ var SessionCommentSchema = z36.object({
1492
+ id: z36.string().uuid(),
1441
1493
  /** Set = a reply in that bug's thread. Null = a standalone comment pin. */
1442
- bugId: z35.string().uuid().nullable(),
1494
+ bugId: z36.string().uuid().nullable(),
1443
1495
  /** 1-based turn the comment was left on; null for a reply (it reads its
1444
1496
  * parent bug's turn). */
1445
- turnIndex: z35.number().int().nullable(),
1497
+ turnIndex: z36.number().int().nullable(),
1446
1498
  /** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
1447
1499
  location: BugLocationSchema.nullable(),
1448
- body: z35.string(),
1449
- createdBy: z35.string(),
1450
- createdAt: z35.string()
1500
+ body: z36.string(),
1501
+ createdBy: z36.string(),
1502
+ createdAt: z36.string()
1451
1503
  });
1452
- var CreateCommentInputSchema = z35.object({
1453
- bugId: z35.string().uuid().nullable(),
1454
- turnIndex: z35.number().int().positive().nullable(),
1504
+ var CreateCommentInputSchema = z36.object({
1505
+ bugId: z36.string().uuid().nullable(),
1506
+ turnIndex: z36.number().int().positive().nullable(),
1455
1507
  location: BugLocationSchema.nullable(),
1456
1508
  // Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
1457
1509
  // of three spaces, which renders as an empty bubble nobody can interpret.
1458
- body: z35.string().trim().min(1)
1510
+ body: z36.string().trim().min(1)
1459
1511
  }).refine((input) => input.bugId === null !== (input.location === null), {
1460
1512
  message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
1461
1513
  });
1462
- var UpdateCommentInputSchema = z35.object({
1463
- body: z35.string().trim().min(1).optional(),
1464
- bugId: z35.string().uuid().nullable().optional(),
1514
+ var UpdateCommentInputSchema = z36.object({
1515
+ body: z36.string().trim().min(1).optional(),
1516
+ bugId: z36.string().uuid().nullable().optional(),
1465
1517
  location: BugLocationSchema.nullable().optional()
1466
1518
  });
1467
- var SessionFormFactorSchema = z35.enum(["mobile", "desktop"]).nullable();
1468
- var SessionSummarySchema = z35.object({
1469
- sessionId: z35.string(),
1519
+ var SessionFormFactorSchema = z36.enum(["mobile", "desktop"]).nullable();
1520
+ var SessionSummarySchema = z36.object({
1521
+ sessionId: z36.string(),
1470
1522
  /** Stable per-browser id — the join key across a visitor's sessions. Null when
1471
1523
  * the session row is gone (pruned) or predates the `sessions` table. */
1472
- visitorId: z35.string().nullable(),
1524
+ visitorId: z36.string().nullable(),
1473
1525
  /** Provider-qualified identity anchor, present only once the visitor
1474
1526
  * identified themselves. Both null together means "not identified yet". */
1475
- identityProvider: z35.string().nullable(),
1476
- identityKey: z35.string().nullable(),
1527
+ identityProvider: z36.string().nullable(),
1528
+ identityKey: z36.string().nullable(),
1477
1529
  /** Team/test traffic. The queue hides these by default. */
1478
- isInternal: z35.boolean(),
1530
+ isInternal: z36.boolean(),
1479
1531
  /** Build that served the session. Null = not captured; a version filter must
1480
1532
  * therefore EXCLUDE it rather than let it match an arbitrary bucket. */
1481
- clientVersion: z35.string().nullable(),
1533
+ clientVersion: z36.string().nullable(),
1482
1534
  /** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
1483
- signalCounts: z35.record(z35.number()),
1535
+ signalCounts: z36.record(z36.number()),
1484
1536
  /**
1485
1537
  * Did this conversation ACQUIRE anything, and how many times?
1486
1538
  *
@@ -1497,7 +1549,7 @@ var SessionSummarySchema = z35.object({
1497
1549
  * predates the column — and renders as no mark at all. It never means zero:
1498
1550
  * zero is a real, recorded answer and the rail reports it as one.
1499
1551
  */
1500
- conversionAttempts: z35.number().int().nullable(),
1552
+ conversionAttempts: z36.number().int().nullable(),
1501
1553
  /**
1502
1554
  * The same attempts split by EVENT KIND, keyed by the kind's own name
1503
1555
  * (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
@@ -1513,7 +1565,7 @@ var SessionSummarySchema = z35.object({
1513
1565
  * kinds together, and one attempt id appearing under both would be counted
1514
1566
  * once there and twice here.
1515
1567
  */
1516
- conversionKinds: z35.record(z35.number()),
1568
+ conversionKinds: z36.record(z36.number()),
1517
1569
  /**
1518
1570
  * Every analytics funnel step this session reached, in funnel order — the
1519
1571
  * dashboard's own step ids, read by the same per-step predicates, so a queue
@@ -1521,20 +1573,20 @@ var SessionSummarySchema = z35.object({
1521
1573
  * set of strings for the reason `conversionKinds` is: the contract does not
1522
1574
  * learn what a step means. Empty only when read from a pre-column database.
1523
1575
  */
1524
- funnelSteps: z35.array(z35.string()),
1576
+ funnelSteps: z36.array(z36.string()),
1525
1577
  /**
1526
1578
  * The connector's opaque handle for what this session produced in its back
1527
1579
  * office — present only once a checkout actually reached the platform. The
1528
1580
  * console hands it to the back-office link registry; nothing else reads it.
1529
1581
  */
1530
- backOfficeRef: z35.string().nullable(),
1582
+ backOfficeRef: z36.string().nullable(),
1531
1583
  /**
1532
1584
  * The order this session produced, when the connector's back office reported
1533
1585
  * it (`session_orders`): its opaque id and the back office's own name for it.
1534
1586
  * Both null when no order is known — the cart handle above is then the door.
1535
1587
  */
1536
- orderRef: z35.string().nullable(),
1537
- orderLabel: z35.string().nullable(),
1588
+ orderRef: z36.string().nullable(),
1589
+ orderLabel: z36.string().nullable(),
1538
1590
  /**
1539
1591
  * Which shell this session rendered — the one thing about the CAPTURE a list
1540
1592
  * needs.
@@ -1547,12 +1599,12 @@ var SessionSummarySchema = z35.object({
1547
1599
  * on a desktop are not the same session.
1548
1600
  */
1549
1601
  formFactor: SessionFormFactorSchema,
1550
- turnCount: z35.number().int(),
1602
+ turnCount: z36.number().int(),
1551
1603
  /** The visitor's opening message — the single most informative field for
1552
1604
  * deciding whether a session is worth opening, hence the widest column. */
1553
- firstPrompt: z35.string(),
1554
- startedAt: z35.string(),
1555
- lastRunAt: z35.string(),
1605
+ firstPrompt: z36.string(),
1606
+ startedAt: z36.string(),
1607
+ lastRunAt: z36.string(),
1556
1608
  /**
1557
1609
  * The VISITOR's own IANA zone (`America/New_York`), read from their browser
1558
1610
  * at session create — what the two timestamps above should be read in.
@@ -1580,7 +1632,7 @@ var SessionSummarySchema = z35.object({
1580
1632
  * Client-asserted and never validated against a zone table, so every consumer
1581
1633
  * must tolerate an unknown name: `Intl` throws a RangeError on one.
1582
1634
  */
1583
- visitorTimeZone: z35.string().nullable(),
1635
+ visitorTimeZone: z36.string().nullable(),
1584
1636
  /**
1585
1637
  * Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
1586
1638
  * layout op reaching the visitor, and THE latency the project is managed on.
@@ -1588,31 +1640,31 @@ var SessionSummarySchema = z35.object({
1588
1640
  * `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
1589
1641
  * already reading. Null when no turn in the session recorded a patch.
1590
1642
  */
1591
- avgTtftMs: z35.number().int().nullable(),
1643
+ avgTtftMs: z36.number().int().nullable(),
1592
1644
  /** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
1593
1645
  * a budget: null on sessions older than the mark's recording. */
1594
- avgMainDoneMs: z35.number().int().nullable(),
1646
+ avgMainDoneMs: z36.number().int().nullable(),
1595
1647
  /** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
1596
1648
  * budget. On the row only to explain the gap to `totalLatencyMs`. */
1597
- avgChipGenMs: z35.number().int().nullable(),
1598
- totalLatencyMs: z35.number().int(),
1599
- durationMs: z35.number().int(),
1649
+ avgChipGenMs: z36.number().int().nullable(),
1650
+ totalLatencyMs: z36.number().int(),
1651
+ durationMs: z36.number().int(),
1600
1652
  /** Inferred from recent activity — nothing writes a session-end marker. A
1601
1653
  * live session streams and cannot be given a verdict until it ends. */
1602
- isLive: z35.boolean(),
1654
+ isLive: z36.boolean(),
1603
1655
  verdict: SessionVerdictSchema,
1604
- reviewedBy: z35.string().nullable(),
1605
- reviewedAt: z35.string().nullable(),
1656
+ reviewedBy: z36.string().nullable(),
1657
+ reviewedAt: z36.string().nullable(),
1606
1658
  /** Latest filed bug, flattened onto the row so the queue can show its live
1607
1659
  * state without a second request. */
1608
- bugIssueKey: z35.string().nullable(),
1609
- bugIssueUrl: z35.string().nullable(),
1610
- bugIssueState: z35.string().nullable()
1660
+ bugIssueKey: z36.string().nullable(),
1661
+ bugIssueUrl: z36.string().nullable(),
1662
+ bugIssueState: z36.string().nullable()
1611
1663
  });
1612
- var SessionQueuePageSchema = z35.object({
1613
- sessions: z35.array(SessionSummarySchema),
1614
- totalCount: z35.number().int(),
1615
- hiddenInternalCount: z35.number().int(),
1664
+ var SessionQueuePageSchema = z36.object({
1665
+ sessions: z36.array(SessionSummarySchema),
1666
+ totalCount: z36.number().int(),
1667
+ hiddenInternalCount: z36.number().int(),
1616
1668
  /**
1617
1669
  * Bounced sessions the queue left out — no turn and no add, the default.
1618
1670
  *
@@ -1622,61 +1674,61 @@ var SessionQueuePageSchema = z35.object({
1622
1674
  * `totalCount + hiddenBouncedCount` is that population, and this count is the
1623
1675
  * analytics dashboard's bounce over the same window.
1624
1676
  */
1625
- hiddenBouncedCount: z35.number().int()
1677
+ hiddenBouncedCount: z36.number().int()
1626
1678
  });
1627
- var SessionQueueFacetsSchema = z35.object({
1628
- review: z35.record(z35.number()),
1629
- version: z35.record(z35.number()),
1630
- turns: z35.record(z35.number()),
1631
- durationS: z35.record(z35.number()),
1679
+ var SessionQueueFacetsSchema = z36.object({
1680
+ review: z36.record(z36.number()),
1681
+ version: z36.record(z36.number()),
1682
+ turns: z36.record(z36.number()),
1683
+ durationS: z36.record(z36.number()),
1632
1684
  /** Sessions per funnel step reached — a session counts under every step it reached. */
1633
- funnel: z35.record(z35.number())
1685
+ funnel: z36.record(z36.number())
1634
1686
  });
1635
- var SessionCaptureSchema = z35.object({
1636
- viewportWidth: z35.number().int().nullable(),
1637
- viewportHeight: z35.number().int().nullable(),
1638
- userAgent: z35.string().nullable(),
1639
- locale: z35.string().nullable(),
1687
+ var SessionCaptureSchema = z36.object({
1688
+ viewportWidth: z36.number().int().nullable(),
1689
+ viewportHeight: z36.number().int().nullable(),
1690
+ userAgent: z36.string().nullable(),
1691
+ locale: z36.string().nullable(),
1640
1692
  /** Referrer at session create — separates agentic traffic from organic. */
1641
- referrer: z35.string().nullable()
1693
+ referrer: z36.string().nullable()
1642
1694
  });
1643
- var SessionCaptureInputSchema = z35.object({
1644
- viewportWidth: z35.number().int().positive().max(2e4).optional(),
1645
- viewportHeight: z35.number().int().positive().max(2e4).optional(),
1646
- userAgent: z35.string().max(1e3).optional(),
1647
- locale: z35.string().max(35).optional(),
1695
+ var SessionCaptureInputSchema = z36.object({
1696
+ viewportWidth: z36.number().int().positive().max(2e4).optional(),
1697
+ viewportHeight: z36.number().int().positive().max(2e4).optional(),
1698
+ userAgent: z36.string().max(1e3).optional(),
1699
+ locale: z36.string().max(35).optional(),
1648
1700
  /** IANA zone name from the visitor's browser. Bounded rather than validated:
1649
1701
  * the zone database grows, and refusing a name this build has not heard of
1650
1702
  * would drop a real session's capture over a table that is out of date. */
1651
- timeZone: z35.string().max(64).optional(),
1652
- referrer: z35.string().max(2048).optional(),
1653
- clientVersion: z35.string().max(100).optional(),
1654
- isInternal: z35.boolean().optional()
1703
+ timeZone: z36.string().max(64).optional(),
1704
+ referrer: z36.string().max(2048).optional(),
1705
+ clientVersion: z36.string().max(100).optional(),
1706
+ isInternal: z36.boolean().optional()
1655
1707
  });
1656
- var SessionDetailSchema = z35.object({
1708
+ var SessionDetailSchema = z36.object({
1657
1709
  session: SessionSummarySchema,
1658
1710
  capture: SessionCaptureSchema,
1659
1711
  /** Full verdict history, newest first. Verdicts are revisable, and a session
1660
1712
  * re-judged after a fix is the evidence the fix worked. */
1661
- reviews: z35.array(SessionReviewEventSchema),
1662
- bugs: z35.array(SessionBugSchema),
1663
- comments: z35.array(SessionCommentSchema),
1713
+ reviews: z36.array(SessionReviewEventSchema),
1714
+ bugs: z36.array(SessionBugSchema),
1715
+ comments: z36.array(SessionCommentSchema),
1664
1716
  /** Optional during API/console rolling deployment. Absent is unavailable,
1665
1717
  * not evidence of zero visitor activity. */
1666
1718
  activity: SessionActivitySchema.optional()
1667
1719
  });
1668
- var RecordVerdictInputSchema = z35.object({
1720
+ var RecordVerdictInputSchema = z36.object({
1669
1721
  verdict: RecordableVerdictSchema,
1670
- note: z35.string().max(2e3).optional()
1722
+ note: z36.string().max(2e3).optional()
1671
1723
  });
1672
- var FileBugInputSchema = z35.object({
1673
- turnIndex: z35.number().int().positive().nullable(),
1724
+ var FileBugInputSchema = z36.object({
1725
+ turnIndex: z36.number().int().positive().nullable(),
1674
1726
  /** Optional — a bug filed without dropping a pin has no location. */
1675
1727
  location: BugLocationSchema.nullable().optional(),
1676
- title: z35.string().min(1).max(300),
1677
- body: z35.string().min(1),
1728
+ title: z36.string().min(1).max(300),
1729
+ body: z36.string().min(1),
1678
1730
  severity: BugSeveritySchema,
1679
- payload: z35.record(z35.unknown())
1731
+ payload: z36.record(z36.unknown())
1680
1732
  });
1681
1733
  export {
1682
1734
  EMPTY_SPEC,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "peerDependencies": {
16
16
  "zod": "^3.25.0"
17
17
  },
18
- "version": "0.5.1",
18
+ "version": "0.5.2",
19
19
  "homepage": "https://docs.40rty.ai",
20
20
  "license": "UNLICENSED",
21
21
  "engines": {