@40rty/ams-cli 0.4.4 → 0.5.0
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/publish.mjs +3 -1
- package/bin/lib/build.mjs +19 -0
- package/dist/wire.js +330 -304
- package/package.json +1 -1
package/bin/commands/publish.mjs
CHANGED
|
@@ -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 } from '../lib/build.mjs';
|
|
4
|
+
import { buildBundle, loadBrandDefinition, loadCatalog, loadManifests, loadMark } 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';
|
|
@@ -30,6 +30,8 @@ export async function buildRelease(config) {
|
|
|
30
30
|
if (typeof config.brand === 'string') Object.assign(release, await loadBrandDefinition(config.brand, config.prompts));
|
|
31
31
|
if (typeof config.theme === 'string') release.theme = { themeClass: config.theme };
|
|
32
32
|
if (typeof config.seedLayout === 'string') release.seedLayout = JSON.parse(await readFile(path.join(cwd, config.seedLayout), 'utf8'));
|
|
33
|
+
// The brand's mark — the files themselves; the platform stores and serves them.
|
|
34
|
+
if (config.mark !== undefined) release.mark = await loadMark(config.mark);
|
|
33
35
|
warnShapeTokenExamples(release.catalog);
|
|
34
36
|
return PackageReleaseSchema.parse(release);
|
|
35
37
|
}
|
package/bin/lib/build.mjs
CHANGED
|
@@ -231,3 +231,22 @@ export async function loadBrandDefinition(file, promptsDir) {
|
|
|
231
231
|
}
|
|
232
232
|
return out;
|
|
233
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The brand's mark — forty.config.json `"mark": { "square": "brand/mark.svg",
|
|
237
|
+
* "wordmark": "brand/wordmark.svg" }`, either or both. The files are sent
|
|
238
|
+
* whole; the platform checks and stores them, and serves them wherever it
|
|
239
|
+
* names the space (the console, the locked gate, the browser tab).
|
|
240
|
+
*/
|
|
241
|
+
export async function loadMark(mark) {
|
|
242
|
+
if (typeof mark !== 'object' || mark === null) fail('forty.config.json "mark" is { "square"?: <file>, "wordmark"?: <file> }');
|
|
243
|
+
const out = {};
|
|
244
|
+
for (const [slot, file] of Object.entries(mark)) {
|
|
245
|
+
if (slot !== 'square' && slot !== 'wordmark') fail(`forty.config.json "mark.${slot}": a mark has a "square" and a "wordmark"`);
|
|
246
|
+
if (typeof file !== 'string') fail(`forty.config.json "mark.${slot}" is a path to an .svg or .png file`);
|
|
247
|
+
const type = path.extname(file).slice(1).toLowerCase();
|
|
248
|
+
if (type !== 'svg' && type !== 'png') fail(`forty.config.json "mark.${slot}": ${file} is not an .svg or .png file`);
|
|
249
|
+
out[slot] = { type, data: (await readFile(path.join(cwd, file))).toString('base64') };
|
|
250
|
+
}
|
|
251
|
+
return out;
|
|
252
|
+
}
|
package/dist/wire.js
CHANGED
|
@@ -840,20 +840,40 @@ function catalogToWire(catalog) {
|
|
|
840
840
|
}
|
|
841
841
|
|
|
842
842
|
// ../spacestation/src/catalog/wire/package-release.ts
|
|
843
|
+
import { z as z23 } from "zod";
|
|
844
|
+
|
|
845
|
+
// ../spacestation/src/catalog/wire/brand-mark.ts
|
|
843
846
|
import { z as z22 } from "zod";
|
|
847
|
+
var BRAND_MARK_TYPES = ["svg", "png"];
|
|
848
|
+
var BRAND_MARK_MAX_BYTES = 256 * 1024;
|
|
849
|
+
var MAX_BASE64_LENGTH = Math.ceil(BRAND_MARK_MAX_BYTES / 3) * 4;
|
|
850
|
+
var BrandMarkUploadSchema = z22.object({
|
|
851
|
+
type: z22.enum(BRAND_MARK_TYPES),
|
|
852
|
+
data: z22.string().base64().min(1).max(MAX_BASE64_LENGTH, `a mark file is at most ${BRAND_MARK_MAX_BYTES / 1024} KB`)
|
|
853
|
+
}).strict();
|
|
854
|
+
var BrandMarkStoredSchema = z22.object({
|
|
855
|
+
type: z22.enum(BRAND_MARK_TYPES),
|
|
856
|
+
sha256: z22.string().regex(/^[0-9a-f]{64}$/, "a stored mark is named by its sha256")
|
|
857
|
+
}).strict();
|
|
858
|
+
var BrandMarkFileSchema = z22.union([BrandMarkUploadSchema, BrandMarkStoredSchema]);
|
|
859
|
+
var BrandMarkSchema = z22.object({ square: BrandMarkFileSchema.optional(), wordmark: BrandMarkFileSchema.optional() }).strict().refine((mark) => mark.square !== void 0 || mark.wordmark !== void 0, "a mark names a square, a wordmark, or both");
|
|
860
|
+
var BrandMarkImageSchema = z22.object({ src: z22.string().min(1), type: z22.enum(BRAND_MARK_TYPES) }).strict();
|
|
861
|
+
var SpaceBrandMarkSchema = z22.object({ square: BrandMarkImageSchema.nullable(), wordmark: BrandMarkImageSchema.nullable() }).strict();
|
|
862
|
+
|
|
863
|
+
// ../spacestation/src/catalog/wire/package-release.ts
|
|
844
864
|
var RESERVED_SCOPES = ["@fourty/", "@40rty/"];
|
|
845
865
|
var BUNDLE_ASSET_PATH = /^assets\/[A-Za-z0-9_-]+\.(woff2?|ttf|otf|png|jpe?g|svg|gif|webp)$/;
|
|
846
|
-
var PackageReleaseSchema =
|
|
866
|
+
var PackageReleaseSchema = z23.object({
|
|
847
867
|
/** The id spaces name in `componentSources` — an npm-style package name. */
|
|
848
|
-
sourceId:
|
|
849
|
-
label:
|
|
868
|
+
sourceId: z23.string().regex(/^(@[a-z0-9][a-z0-9-]*\/)?[a-z0-9][a-z0-9-]*$/, "sourceId must be an npm-style package name").refine((id) => !RESERVED_SCOPES.some((scope) => id.startsWith(scope)), `the ${RESERVED_SCOPES.join(" and ")} scopes are reserved`),
|
|
869
|
+
label: z23.string().min(1).max(120),
|
|
850
870
|
/** The package's own version, as its repository states it — shown in the console. */
|
|
851
|
-
version:
|
|
871
|
+
version: z23.string().min(1).max(40),
|
|
852
872
|
/** What this release changed, in the publisher's words (`forty publish --message`) — shown in the console's version list. */
|
|
853
|
-
description:
|
|
873
|
+
description: z23.string().min(1).max(500).optional(),
|
|
854
874
|
catalog: WireCatalogSchema,
|
|
855
875
|
/** Component manifests by path under `catalogs/`, e.g. `catalogs/product/productGrid.md`. */
|
|
856
|
-
manifests:
|
|
876
|
+
manifests: z23.record(z23.string().regex(/^catalogs\/.+\.md$/, "a manifest path is catalogs/<\u2026>.md"), z23.string()),
|
|
857
877
|
/**
|
|
858
878
|
* The brand's components, built — present when the PLATFORM hosts this
|
|
859
879
|
* brand's spacefront, absent when the brand hosts it in its own app. One
|
|
@@ -862,80 +882,86 @@ var PackageReleaseSchema = z22.object({
|
|
|
862
882
|
* images — base64, keyed by the path the stylesheet's `url()` names, beside
|
|
863
883
|
* it). It is served to browsers; the platform's servers never run it.
|
|
864
884
|
*/
|
|
865
|
-
bundle:
|
|
866
|
-
js:
|
|
867
|
-
css:
|
|
868
|
-
assets:
|
|
885
|
+
bundle: z23.object({
|
|
886
|
+
js: z23.string().min(1),
|
|
887
|
+
css: z23.string(),
|
|
888
|
+
assets: z23.record(z23.string().regex(BUNDLE_ASSET_PATH, "an asset is assets/<name>.<font or image extension>"), z23.string().base64()).optional()
|
|
869
889
|
}).strict().optional(),
|
|
870
890
|
/**
|
|
871
891
|
* The class the spacefront root carries while this package is the space's.
|
|
872
892
|
* The package's own stylesheet styles under it. Absent = the platform's
|
|
873
893
|
* default theme class.
|
|
874
894
|
*/
|
|
875
|
-
theme:
|
|
895
|
+
theme: z23.object({ themeClass: z23.string().regex(/^[a-z][a-z0-9-]*$/, "a theme class is lowercase letters, digits and hyphens") }).strict().optional(),
|
|
896
|
+
/**
|
|
897
|
+
* The brand's mark (`brand-mark.ts`). Sent as the files themselves; the
|
|
898
|
+
* platform stores them content-addressed at ingest and keeps only their
|
|
899
|
+
* addresses here.
|
|
900
|
+
*/
|
|
901
|
+
mark: BrandMarkSchema.optional(),
|
|
876
902
|
/** The canvas a fresh session opens on, before the visitor has asked anything. */
|
|
877
903
|
seedLayout: SpecSchema.optional(),
|
|
878
904
|
/**
|
|
879
905
|
* The package's own composition guidance for its own components — prompt
|
|
880
906
|
* markdown the agent reads, gated on the capabilities it names (`requires`).
|
|
881
907
|
*/
|
|
882
|
-
promptSections:
|
|
908
|
+
promptSections: z23.array(z23.object({ id: z23.string().regex(/^[a-z0-9-]+$/), order: z23.number().int(), content: z23.string().min(1).max(2e4), requires: z23.array(z23.string()) }).strict()).max(10).optional(),
|
|
883
909
|
/**
|
|
884
910
|
* Opaque per-vertical extension data (`BrandDefinition.config`): the
|
|
885
911
|
* platform stays vertical-agnostic and the vertical's own code reads its keys.
|
|
886
912
|
*/
|
|
887
|
-
config:
|
|
913
|
+
config: z23.record(z23.string(), z23.unknown()).optional(),
|
|
888
914
|
/**
|
|
889
915
|
* Set by the platform, never by a publisher: this release is a DRAFT of the
|
|
890
916
|
* package `of`, previewed on the space `space`. See `draftSourceId`.
|
|
891
917
|
*/
|
|
892
|
-
draft:
|
|
918
|
+
draft: z23.object({ of: z23.string().min(1), space: z23.string().min(1) }).strict().optional()
|
|
893
919
|
}).strict();
|
|
894
920
|
|
|
895
921
|
// ../spacestation/src/projection/projection.ts
|
|
896
|
-
import { z as
|
|
897
|
-
var LateBoundValueSchema =
|
|
898
|
-
var DirectiveValueSchema =
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
922
|
+
import { z as z24 } from "zod";
|
|
923
|
+
var LateBoundValueSchema = z24.object({ fact: z24.literal(true) });
|
|
924
|
+
var DirectiveValueSchema = z24.union([
|
|
925
|
+
z24.string(),
|
|
926
|
+
z24.number(),
|
|
927
|
+
z24.boolean(),
|
|
902
928
|
LateBoundValueSchema
|
|
903
929
|
]);
|
|
904
|
-
var ProjectionDirectiveSchema =
|
|
930
|
+
var ProjectionDirectiveSchema = z24.object({
|
|
905
931
|
/** Keep only items whose axis values all match. Keyed by axis name
|
|
906
932
|
* (e.g. `Size`); value is a literal or the `{fact:true}` marker. */
|
|
907
|
-
isolateTo:
|
|
933
|
+
isolateTo: z24.record(DirectiveValueSchema).optional(),
|
|
908
934
|
/** Isolate to EVERY axis the visitor has a stored fact for. The agent
|
|
909
935
|
* emits this (it is vertical-agnostic — it cannot name axes); the
|
|
910
936
|
* entity binding expands it against the entity's own axes + facts. */
|
|
911
|
-
isolateToFacts:
|
|
937
|
+
isolateToFacts: z24.boolean().optional(),
|
|
912
938
|
/** Keep only items the entity binding reports as available. */
|
|
913
|
-
availableOnly:
|
|
939
|
+
availableOnly: z24.boolean().optional(),
|
|
914
940
|
/** Cap the rendered count after filtering. */
|
|
915
|
-
limit:
|
|
941
|
+
limit: z24.number().int().positive().optional()
|
|
916
942
|
});
|
|
917
|
-
var ProjectionPreferencesSchema =
|
|
918
|
-
|
|
943
|
+
var ProjectionPreferencesSchema = z24.record(
|
|
944
|
+
z24.union([ProjectionDirectiveSchema, z24.null()])
|
|
919
945
|
);
|
|
920
|
-
var ProjectionSetPayloadSchema =
|
|
921
|
-
setAll:
|
|
946
|
+
var ProjectionSetPayloadSchema = z24.object({
|
|
947
|
+
setAll: z24.union([ProjectionDirectiveSchema, z24.null()]).optional(),
|
|
922
948
|
set: ProjectionPreferencesSchema.optional()
|
|
923
949
|
});
|
|
924
950
|
|
|
925
951
|
// ../spacestation/src/focus/focus.ts
|
|
926
|
-
import { z as
|
|
927
|
-
var FocusElementPayloadSchema =
|
|
928
|
-
elementId:
|
|
952
|
+
import { z as z25 } from "zod";
|
|
953
|
+
var FocusElementPayloadSchema = z25.object({
|
|
954
|
+
elementId: z25.string().min(1)
|
|
929
955
|
});
|
|
930
956
|
|
|
931
957
|
// ../spacestation/src/view/continuation.ts
|
|
932
|
-
import { z as
|
|
933
|
-
var ViewExtendPayloadSchema =
|
|
934
|
-
reason:
|
|
958
|
+
import { z as z26 } from "zod";
|
|
959
|
+
var ViewExtendPayloadSchema = z26.object({
|
|
960
|
+
reason: z26.enum(["scroll_near_bottom"])
|
|
935
961
|
});
|
|
936
962
|
|
|
937
963
|
// ../spacestation/src/attachment/attachment.ts
|
|
938
|
-
import { z as
|
|
964
|
+
import { z as z27 } from "zod";
|
|
939
965
|
var ALLOWED_ATTACHMENT_TYPES = [
|
|
940
966
|
"image/jpeg",
|
|
941
967
|
"image/png",
|
|
@@ -947,34 +973,34 @@ var MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
|
|
947
973
|
function isAllowedAttachmentType(mime) {
|
|
948
974
|
return ALLOWED_ATTACHMENT_TYPES.includes(mime);
|
|
949
975
|
}
|
|
950
|
-
var AttachmentRefSchema =
|
|
951
|
-
id:
|
|
952
|
-
mimeType:
|
|
976
|
+
var AttachmentRefSchema = z27.object({
|
|
977
|
+
id: z27.string().min(1),
|
|
978
|
+
mimeType: z27.string().refine(isAllowedAttachmentType, {
|
|
953
979
|
message: "mimeType not on the attachment allow-list"
|
|
954
980
|
}),
|
|
955
|
-
name:
|
|
956
|
-
size:
|
|
957
|
-
url:
|
|
981
|
+
name: z27.string().min(1),
|
|
982
|
+
size: z27.number().int().positive().max(MAX_ATTACHMENT_BYTES),
|
|
983
|
+
url: z27.string().min(1)
|
|
958
984
|
});
|
|
959
|
-
var AttachmentRefsSchema =
|
|
985
|
+
var AttachmentRefsSchema = z27.array(AttachmentRefSchema);
|
|
960
986
|
|
|
961
987
|
// ../spacestation/src/contracts/entry-context.ts
|
|
962
|
-
import { z as
|
|
988
|
+
import { z as z28 } from "zod";
|
|
963
989
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
964
990
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
965
991
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
966
992
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
967
|
-
var EntryContextValueSchema =
|
|
968
|
-
var EntryContextNameSchema =
|
|
969
|
-
var EntryContextNamespaceSchema =
|
|
993
|
+
var EntryContextValueSchema = z28.string().trim().min(1).max(ENTRY_CONTEXT_MAX_VALUE_CHARS);
|
|
994
|
+
var EntryContextNameSchema = z28.string().trim().min(1).max(ENTRY_CONTEXT_MAX_NAME_CHARS);
|
|
995
|
+
var EntryContextNamespaceSchema = z28.record(EntryContextNameSchema, EntryContextValueSchema).refine((entries) => Object.keys(entries).length <= ENTRY_CONTEXT_MAX_KEYS, {
|
|
970
996
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
971
997
|
});
|
|
972
|
-
var EntryContextSchema =
|
|
998
|
+
var EntryContextSchema = z28.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
973
999
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
974
1000
|
});
|
|
975
1001
|
|
|
976
1002
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
977
|
-
import { z as
|
|
1003
|
+
import { z as z29 } from "zod";
|
|
978
1004
|
var SURFACES = [
|
|
979
1005
|
"spacefront",
|
|
980
1006
|
"embed",
|
|
@@ -984,11 +1010,11 @@ var SURFACES = [
|
|
|
984
1010
|
"playground",
|
|
985
1011
|
"automation"
|
|
986
1012
|
];
|
|
987
|
-
var SurfaceSchema =
|
|
1013
|
+
var SurfaceSchema = z29.enum(SURFACES);
|
|
988
1014
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
989
|
-
var ClickIdKindSchema =
|
|
1015
|
+
var ClickIdKindSchema = z29.enum(CLICK_ID_KINDS);
|
|
990
1016
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
991
|
-
var VisitorIdDurabilitySchema =
|
|
1017
|
+
var VisitorIdDurabilitySchema = z29.enum(VISITOR_ID_DURABILITIES);
|
|
992
1018
|
var TRAFFIC_BUCKETS = [
|
|
993
1019
|
"paid_google",
|
|
994
1020
|
"paid_meta",
|
|
@@ -1000,10 +1026,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
1000
1026
|
"direct",
|
|
1001
1027
|
"unknown"
|
|
1002
1028
|
];
|
|
1003
|
-
var TrafficBucketSchema =
|
|
1029
|
+
var TrafficBucketSchema = z29.enum(TRAFFIC_BUCKETS);
|
|
1004
1030
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
1005
|
-
var ArrivalValueSchema =
|
|
1006
|
-
var SessionArrivalSchema =
|
|
1031
|
+
var ArrivalValueSchema = z29.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
1032
|
+
var SessionArrivalSchema = z29.object({
|
|
1007
1033
|
utmSource: ArrivalValueSchema.optional(),
|
|
1008
1034
|
utmMedium: ArrivalValueSchema.optional(),
|
|
1009
1035
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -1037,36 +1063,36 @@ var ARRIVAL_PARAMS = [
|
|
|
1037
1063
|
];
|
|
1038
1064
|
|
|
1039
1065
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
1040
|
-
import { z as
|
|
1041
|
-
var AttributeScopeBucketSchema =
|
|
1042
|
-
scope:
|
|
1043
|
-
needles:
|
|
1044
|
-
label:
|
|
1066
|
+
import { z as z30 } from "zod";
|
|
1067
|
+
var AttributeScopeBucketSchema = z30.object({
|
|
1068
|
+
scope: z30.string(),
|
|
1069
|
+
needles: z30.array(z30.string()).readonly(),
|
|
1070
|
+
label: z30.string().optional()
|
|
1045
1071
|
});
|
|
1046
|
-
var AttributeScopeConfigSchema =
|
|
1047
|
-
facet:
|
|
1048
|
-
buckets:
|
|
1049
|
-
emptyScope:
|
|
1050
|
-
noMatchScope:
|
|
1051
|
-
ignoreValues:
|
|
1052
|
-
emptyScopeLabel:
|
|
1053
|
-
noMatchScopeLabel:
|
|
1072
|
+
var AttributeScopeConfigSchema = z30.object({
|
|
1073
|
+
facet: z30.string(),
|
|
1074
|
+
buckets: z30.array(AttributeScopeBucketSchema).readonly(),
|
|
1075
|
+
emptyScope: z30.string(),
|
|
1076
|
+
noMatchScope: z30.string(),
|
|
1077
|
+
ignoreValues: z30.array(z30.string()).readonly(),
|
|
1078
|
+
emptyScopeLabel: z30.string().optional(),
|
|
1079
|
+
noMatchScopeLabel: z30.string().optional()
|
|
1054
1080
|
});
|
|
1055
|
-
var AttributeDefBaseSchema =
|
|
1056
|
-
description:
|
|
1057
|
-
durable:
|
|
1058
|
-
label:
|
|
1081
|
+
var AttributeDefBaseSchema = z30.object({
|
|
1082
|
+
description: z30.string().optional(),
|
|
1083
|
+
durable: z30.boolean().optional(),
|
|
1084
|
+
label: z30.string().optional()
|
|
1059
1085
|
});
|
|
1060
|
-
var AttributeDefSchema =
|
|
1061
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1062
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1063
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1064
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1086
|
+
var AttributeDefSchema = z30.discriminatedUnion("kind", [
|
|
1087
|
+
AttributeDefBaseSchema.extend({ kind: z30.literal("enum"), values: z30.array(z30.string()) }),
|
|
1088
|
+
AttributeDefBaseSchema.extend({ kind: z30.literal("free_text") }),
|
|
1089
|
+
AttributeDefBaseSchema.extend({ kind: z30.literal("date_or_season") }),
|
|
1090
|
+
AttributeDefBaseSchema.extend({ kind: z30.literal("money_or_band") }),
|
|
1065
1091
|
AttributeDefBaseSchema.extend({
|
|
1066
|
-
kind:
|
|
1067
|
-
min:
|
|
1068
|
-
max:
|
|
1069
|
-
unit:
|
|
1092
|
+
kind: z30.literal("number"),
|
|
1093
|
+
min: z30.number().optional(),
|
|
1094
|
+
max: z30.number().optional(),
|
|
1095
|
+
unit: z30.string().optional()
|
|
1070
1096
|
})
|
|
1071
1097
|
]);
|
|
1072
1098
|
|
|
@@ -1098,30 +1124,30 @@ var DEFAULT_SPACE_CONFIG = {
|
|
|
1098
1124
|
};
|
|
1099
1125
|
|
|
1100
1126
|
// ../spacestation/src/space/trace.ts
|
|
1101
|
-
import { z as
|
|
1102
|
-
var RunTokenUsageSchema =
|
|
1103
|
-
input_tokens:
|
|
1104
|
-
output_tokens:
|
|
1105
|
-
cache_read_tokens:
|
|
1127
|
+
import { z as z31 } from "zod";
|
|
1128
|
+
var RunTokenUsageSchema = z31.object({
|
|
1129
|
+
input_tokens: z31.number().optional(),
|
|
1130
|
+
output_tokens: z31.number().optional(),
|
|
1131
|
+
cache_read_tokens: z31.number().optional()
|
|
1106
1132
|
});
|
|
1107
|
-
var TraceRecordSchema =
|
|
1108
|
-
id:
|
|
1109
|
-
spaceId:
|
|
1110
|
-
sessionId:
|
|
1133
|
+
var TraceRecordSchema = z31.object({
|
|
1134
|
+
id: z31.string().uuid(),
|
|
1135
|
+
spaceId: z31.string().uuid().nullable(),
|
|
1136
|
+
sessionId: z31.string(),
|
|
1111
1137
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
1112
1138
|
* for an unlocked space / anonymous unlock. */
|
|
1113
|
-
visitorEmail:
|
|
1114
|
-
userPrompt:
|
|
1115
|
-
branch:
|
|
1116
|
-
responseText:
|
|
1117
|
-
layout:
|
|
1118
|
-
phaseTimings:
|
|
1119
|
-
tokensByModel:
|
|
1120
|
-
toolCalls:
|
|
1121
|
-
diagnostics:
|
|
1122
|
-
latencyFirstText:
|
|
1123
|
-
latencyFirstPatch:
|
|
1124
|
-
latencyTotal:
|
|
1139
|
+
visitorEmail: z31.string().nullable(),
|
|
1140
|
+
userPrompt: z31.string(),
|
|
1141
|
+
branch: z31.string().nullable(),
|
|
1142
|
+
responseText: z31.string().nullable(),
|
|
1143
|
+
layout: z31.unknown().nullable(),
|
|
1144
|
+
phaseTimings: z31.record(z31.number()).nullable(),
|
|
1145
|
+
tokensByModel: z31.record(RunTokenUsageSchema).nullable(),
|
|
1146
|
+
toolCalls: z31.array(z31.unknown()).nullable(),
|
|
1147
|
+
diagnostics: z31.array(z31.unknown()).nullable(),
|
|
1148
|
+
latencyFirstText: z31.number().int().nullable(),
|
|
1149
|
+
latencyFirstPatch: z31.number().int().nullable(),
|
|
1150
|
+
latencyTotal: z31.number().int().nullable(),
|
|
1125
1151
|
/**
|
|
1126
1152
|
* The CLIENT's turn id for this run, or `null`.
|
|
1127
1153
|
*
|
|
@@ -1137,29 +1163,29 @@ var TraceRecordSchema = z30.object({
|
|
|
1137
1163
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1138
1164
|
* visitor asked something and got nothing.
|
|
1139
1165
|
*/
|
|
1140
|
-
turnId:
|
|
1166
|
+
turnId: z31.string().nullable(),
|
|
1141
1167
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
1142
1168
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
1143
|
-
trackerState:
|
|
1144
|
-
createdAt:
|
|
1169
|
+
trackerState: z31.unknown().nullable(),
|
|
1170
|
+
createdAt: z31.string()
|
|
1145
1171
|
});
|
|
1146
|
-
var MillisecondsSchema =
|
|
1147
|
-
var CreateTraceInputSchema =
|
|
1148
|
-
spaceId:
|
|
1149
|
-
sessionId:
|
|
1150
|
-
visitorEmail:
|
|
1151
|
-
userPrompt:
|
|
1152
|
-
branch:
|
|
1153
|
-
responseText:
|
|
1154
|
-
layout:
|
|
1155
|
-
phaseTimings:
|
|
1156
|
-
tokensByModel:
|
|
1157
|
-
toolCalls:
|
|
1158
|
-
diagnostics:
|
|
1172
|
+
var MillisecondsSchema = z31.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
1173
|
+
var CreateTraceInputSchema = z31.object({
|
|
1174
|
+
spaceId: z31.string().uuid().nullable(),
|
|
1175
|
+
sessionId: z31.string(),
|
|
1176
|
+
visitorEmail: z31.string().nullable(),
|
|
1177
|
+
userPrompt: z31.string(),
|
|
1178
|
+
branch: z31.string().nullable(),
|
|
1179
|
+
responseText: z31.string().nullable(),
|
|
1180
|
+
layout: z31.unknown().nullable(),
|
|
1181
|
+
phaseTimings: z31.record(z31.number()).nullable(),
|
|
1182
|
+
tokensByModel: z31.record(RunTokenUsageSchema).nullable(),
|
|
1183
|
+
toolCalls: z31.array(z31.unknown()).nullable(),
|
|
1184
|
+
diagnostics: z31.array(z31.unknown()).nullable(),
|
|
1159
1185
|
latencyFirstText: MillisecondsSchema,
|
|
1160
1186
|
latencyFirstPatch: MillisecondsSchema,
|
|
1161
1187
|
latencyTotal: MillisecondsSchema,
|
|
1162
|
-
trackerState:
|
|
1188
|
+
trackerState: z31.unknown().nullable(),
|
|
1163
1189
|
/**
|
|
1164
1190
|
* The CLIENT's turn id for this run, or `null`.
|
|
1165
1191
|
*
|
|
@@ -1175,37 +1201,37 @@ var CreateTraceInputSchema = z30.object({
|
|
|
1175
1201
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1176
1202
|
* visitor asked something and got nothing.
|
|
1177
1203
|
*/
|
|
1178
|
-
turnId:
|
|
1204
|
+
turnId: z31.string().nullable()
|
|
1179
1205
|
});
|
|
1180
|
-
var AgentSessionSummarySchema =
|
|
1181
|
-
sessionId:
|
|
1206
|
+
var AgentSessionSummarySchema = z31.object({
|
|
1207
|
+
sessionId: z31.string(),
|
|
1182
1208
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
1183
|
-
turnCount:
|
|
1209
|
+
turnCount: z31.number().int(),
|
|
1184
1210
|
/** The session's opening prompt — titles the row in the UI. */
|
|
1185
|
-
firstPrompt:
|
|
1186
|
-
startedAt:
|
|
1187
|
-
lastRunAt:
|
|
1211
|
+
firstPrompt: z31.string(),
|
|
1212
|
+
startedAt: z31.string(),
|
|
1213
|
+
lastRunAt: z31.string(),
|
|
1188
1214
|
/** Summed `latency_total` across the session's turns. */
|
|
1189
|
-
totalLatencyMs:
|
|
1215
|
+
totalLatencyMs: z31.number().int()
|
|
1190
1216
|
});
|
|
1191
|
-
var SessionTurnSchema =
|
|
1192
|
-
id:
|
|
1193
|
-
userPrompt:
|
|
1194
|
-
responseText:
|
|
1217
|
+
var SessionTurnSchema = z31.object({
|
|
1218
|
+
id: z31.string().uuid(),
|
|
1219
|
+
userPrompt: z31.string(),
|
|
1220
|
+
responseText: z31.string().nullable(),
|
|
1195
1221
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
1196
|
-
layout:
|
|
1197
|
-
createdAt:
|
|
1198
|
-
latencyTotal:
|
|
1199
|
-
phaseTimings:
|
|
1200
|
-
tokensByModel:
|
|
1201
|
-
input_tokens:
|
|
1202
|
-
output_tokens:
|
|
1222
|
+
layout: z31.unknown().nullable(),
|
|
1223
|
+
createdAt: z31.string(),
|
|
1224
|
+
latencyTotal: z31.number().int().nullable(),
|
|
1225
|
+
phaseTimings: z31.record(z31.number()).nullable(),
|
|
1226
|
+
tokensByModel: z31.record(z31.object({
|
|
1227
|
+
input_tokens: z31.number().optional(),
|
|
1228
|
+
output_tokens: z31.number().optional()
|
|
1203
1229
|
})).nullable(),
|
|
1204
|
-
toolCalls:
|
|
1205
|
-
diagnostics:
|
|
1230
|
+
toolCalls: z31.array(z31.unknown()).nullable(),
|
|
1231
|
+
diagnostics: z31.array(z31.unknown()).nullable()
|
|
1206
1232
|
});
|
|
1207
|
-
var SessionReplaySchema =
|
|
1208
|
-
turns:
|
|
1233
|
+
var SessionReplaySchema = z31.object({
|
|
1234
|
+
turns: z31.array(SessionTurnSchema),
|
|
1209
1235
|
/**
|
|
1210
1236
|
* The session's own last-committed layout, read straight off the durable
|
|
1211
1237
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -1216,20 +1242,20 @@ var SessionReplaySchema = z30.object({
|
|
|
1216
1242
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
1217
1243
|
* when the durable session row itself could not be read.
|
|
1218
1244
|
*/
|
|
1219
|
-
sessionLayout:
|
|
1245
|
+
sessionLayout: z31.record(z31.string(), z31.unknown()).nullable()
|
|
1220
1246
|
});
|
|
1221
|
-
var SessionTraceSchema =
|
|
1222
|
-
trackerState:
|
|
1247
|
+
var SessionTraceSchema = z31.object({
|
|
1248
|
+
trackerState: z31.string().nullable()
|
|
1223
1249
|
});
|
|
1224
|
-
var LlmUsageDailySchema =
|
|
1225
|
-
day:
|
|
1250
|
+
var LlmUsageDailySchema = z31.object({
|
|
1251
|
+
day: z31.string(),
|
|
1226
1252
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
1227
|
-
environment:
|
|
1228
|
-
feature:
|
|
1229
|
-
model:
|
|
1230
|
-
provider:
|
|
1253
|
+
environment: z31.string(),
|
|
1254
|
+
feature: z31.string(),
|
|
1255
|
+
model: z31.string(),
|
|
1256
|
+
provider: z31.string(),
|
|
1231
1257
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
1232
|
-
keyFingerprint:
|
|
1258
|
+
keyFingerprint: z31.string().nullable(),
|
|
1233
1259
|
/**
|
|
1234
1260
|
* The space the call served, or null when it served none.
|
|
1235
1261
|
*
|
|
@@ -1238,91 +1264,91 @@ var LlmUsageDailySchema = z30.object({
|
|
|
1238
1264
|
* report that share rather than dropping it, or a per-space total reads as
|
|
1239
1265
|
* the platform total.
|
|
1240
1266
|
*/
|
|
1241
|
-
spaceId:
|
|
1267
|
+
spaceId: z31.string().nullable(),
|
|
1242
1268
|
/**
|
|
1243
1269
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
1244
1270
|
* when it served no session or the session predates surface recording.
|
|
1245
1271
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
1246
1272
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
1247
1273
|
*/
|
|
1248
|
-
surface:
|
|
1249
|
-
inputTokens:
|
|
1250
|
-
outputTokens:
|
|
1274
|
+
surface: z31.string().nullable(),
|
|
1275
|
+
inputTokens: z31.number(),
|
|
1276
|
+
outputTokens: z31.number(),
|
|
1251
1277
|
/** Subset of inputTokens, never additional to it. */
|
|
1252
|
-
cachedInputTokens:
|
|
1253
|
-
reasoningTokens:
|
|
1254
|
-
callCount:
|
|
1255
|
-
errorCount:
|
|
1256
|
-
estimatedCostUsd:
|
|
1278
|
+
cachedInputTokens: z31.number(),
|
|
1279
|
+
reasoningTokens: z31.number(),
|
|
1280
|
+
callCount: z31.number(),
|
|
1281
|
+
errorCount: z31.number(),
|
|
1282
|
+
estimatedCostUsd: z31.number().nullable()
|
|
1257
1283
|
});
|
|
1258
|
-
var LlmUsageBySessionSchema =
|
|
1259
|
-
sessionId:
|
|
1260
|
-
environment:
|
|
1261
|
-
model:
|
|
1284
|
+
var LlmUsageBySessionSchema = z31.object({
|
|
1285
|
+
sessionId: z31.string(),
|
|
1286
|
+
environment: z31.string(),
|
|
1287
|
+
model: z31.string(),
|
|
1262
1288
|
/** The space this session belongs to, or null for a session with no space. */
|
|
1263
|
-
spaceId:
|
|
1289
|
+
spaceId: z31.string().nullable(),
|
|
1264
1290
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
1265
|
-
surface:
|
|
1291
|
+
surface: z31.string().nullable(),
|
|
1266
1292
|
/** Label only — the first feature seen in the session. */
|
|
1267
|
-
firstFeature:
|
|
1268
|
-
startedAt:
|
|
1269
|
-
endedAt:
|
|
1270
|
-
inputTokens:
|
|
1271
|
-
outputTokens:
|
|
1272
|
-
cachedInputTokens:
|
|
1273
|
-
reasoningTokens:
|
|
1274
|
-
callCount:
|
|
1275
|
-
errorCount:
|
|
1293
|
+
firstFeature: z31.string(),
|
|
1294
|
+
startedAt: z31.string(),
|
|
1295
|
+
endedAt: z31.string(),
|
|
1296
|
+
inputTokens: z31.number(),
|
|
1297
|
+
outputTokens: z31.number(),
|
|
1298
|
+
cachedInputTokens: z31.number(),
|
|
1299
|
+
reasoningTokens: z31.number(),
|
|
1300
|
+
callCount: z31.number(),
|
|
1301
|
+
errorCount: z31.number(),
|
|
1276
1302
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
1277
1303
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
1278
1304
|
* the model is unpriced; never 0, which would read as free. */
|
|
1279
|
-
estimatedCostUsd:
|
|
1305
|
+
estimatedCostUsd: z31.number().nullable()
|
|
1280
1306
|
});
|
|
1281
|
-
var LlmSessionsDailySchema =
|
|
1282
|
-
day:
|
|
1283
|
-
environment:
|
|
1284
|
-
sessionCount:
|
|
1307
|
+
var LlmSessionsDailySchema = z31.object({
|
|
1308
|
+
day: z31.string(),
|
|
1309
|
+
environment: z31.string(),
|
|
1310
|
+
sessionCount: z31.number()
|
|
1285
1311
|
});
|
|
1286
1312
|
|
|
1287
1313
|
// ../spacestation/src/space/session-queue.ts
|
|
1288
|
-
import { z as
|
|
1314
|
+
import { z as z33 } from "zod";
|
|
1289
1315
|
|
|
1290
1316
|
// ../spacestation/src/space/session-activity.ts
|
|
1291
|
-
import { z as
|
|
1292
|
-
var SessionActivityEventSchema =
|
|
1293
|
-
id:
|
|
1294
|
-
kind:
|
|
1295
|
-
occurredAt:
|
|
1296
|
-
source:
|
|
1297
|
-
surface:
|
|
1298
|
-
payload:
|
|
1317
|
+
import { z as z32 } from "zod";
|
|
1318
|
+
var SessionActivityEventSchema = z32.object({
|
|
1319
|
+
id: z32.string(),
|
|
1320
|
+
kind: z32.string(),
|
|
1321
|
+
occurredAt: z32.string(),
|
|
1322
|
+
source: z32.string(),
|
|
1323
|
+
surface: z32.string(),
|
|
1324
|
+
payload: z32.record(z32.unknown())
|
|
1299
1325
|
});
|
|
1300
|
-
var SessionActivitySchema =
|
|
1301
|
-
events:
|
|
1302
|
-
hasMore:
|
|
1326
|
+
var SessionActivitySchema = z32.object({
|
|
1327
|
+
events: z32.array(SessionActivityEventSchema),
|
|
1328
|
+
hasMore: z32.boolean()
|
|
1303
1329
|
});
|
|
1304
1330
|
|
|
1305
1331
|
// ../spacestation/src/space/session-queue.ts
|
|
1306
|
-
var SessionVerdictSchema =
|
|
1307
|
-
var RecordableVerdictSchema =
|
|
1308
|
-
var SessionReviewEventSchema =
|
|
1309
|
-
id:
|
|
1332
|
+
var SessionVerdictSchema = z33.enum(["unreviewed", "viewed", "bug"]);
|
|
1333
|
+
var RecordableVerdictSchema = z33.enum(["viewed", "bug"]);
|
|
1334
|
+
var SessionReviewEventSchema = z33.object({
|
|
1335
|
+
id: z33.string().uuid(),
|
|
1310
1336
|
verdict: RecordableVerdictSchema,
|
|
1311
1337
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
1312
1338
|
* log is append-only rather than a mutable current-state row. */
|
|
1313
|
-
reviewer:
|
|
1314
|
-
note:
|
|
1315
|
-
createdAt:
|
|
1339
|
+
reviewer: z33.string(),
|
|
1340
|
+
note: z33.string().nullable(),
|
|
1341
|
+
createdAt: z33.string()
|
|
1316
1342
|
});
|
|
1317
|
-
var BugSeveritySchema =
|
|
1318
|
-
var BugLocationSchema =
|
|
1319
|
-
elementId:
|
|
1343
|
+
var BugSeveritySchema = z33.enum(["high", "medium", "low"]);
|
|
1344
|
+
var BugLocationSchema = z33.object({
|
|
1345
|
+
elementId: z33.string().nullable(),
|
|
1320
1346
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
1321
1347
|
* alongside a null `elementId`. */
|
|
1322
|
-
elementType:
|
|
1348
|
+
elementType: z33.string().nullable(),
|
|
1323
1349
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
1324
|
-
offsetXPct:
|
|
1325
|
-
offsetYPct:
|
|
1350
|
+
offsetXPct: z33.number().min(0).max(100).nullable(),
|
|
1351
|
+
offsetYPct: z33.number().min(0).max(100).nullable(),
|
|
1326
1352
|
/**
|
|
1327
1353
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
1328
1354
|
* element anchor.
|
|
@@ -1333,8 +1359,8 @@ var BugLocationSchema = z32.object({
|
|
|
1333
1359
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
1334
1360
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
1335
1361
|
*/
|
|
1336
|
-
pageX:
|
|
1337
|
-
pageY:
|
|
1362
|
+
pageX: z33.number().nullable(),
|
|
1363
|
+
pageY: z33.number().nullable()
|
|
1338
1364
|
}).refine(
|
|
1339
1365
|
(loc) => {
|
|
1340
1366
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -1348,24 +1374,24 @@ var BugLocationSchema = z32.object({
|
|
|
1348
1374
|
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)"
|
|
1349
1375
|
}
|
|
1350
1376
|
);
|
|
1351
|
-
var SessionBugSchema =
|
|
1352
|
-
id:
|
|
1377
|
+
var SessionBugSchema = z33.object({
|
|
1378
|
+
id: z33.string().uuid(),
|
|
1353
1379
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
1354
|
-
turnIndex:
|
|
1380
|
+
turnIndex: z33.number().int().nullable(),
|
|
1355
1381
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
1356
1382
|
* without pinning a spot. */
|
|
1357
1383
|
location: BugLocationSchema.nullable(),
|
|
1358
|
-
provider:
|
|
1359
|
-
issueKey:
|
|
1360
|
-
issueUrl:
|
|
1384
|
+
provider: z33.string(),
|
|
1385
|
+
issueKey: z33.string().nullable(),
|
|
1386
|
+
issueUrl: z33.string().nullable(),
|
|
1361
1387
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
1362
1388
|
* open text. Null until first synced. */
|
|
1363
|
-
issueState:
|
|
1364
|
-
title:
|
|
1365
|
-
body:
|
|
1389
|
+
issueState: z33.string().nullable(),
|
|
1390
|
+
title: z33.string(),
|
|
1391
|
+
body: z33.string(),
|
|
1366
1392
|
severity: BugSeveritySchema,
|
|
1367
|
-
createdBy:
|
|
1368
|
-
createdAt:
|
|
1393
|
+
createdBy: z33.string(),
|
|
1394
|
+
createdAt: z33.string(),
|
|
1369
1395
|
/**
|
|
1370
1396
|
* When this bug was resolved from the console; null means still OPEN.
|
|
1371
1397
|
*
|
|
@@ -1374,55 +1400,55 @@ var SessionBugSchema = z32.object({
|
|
|
1374
1400
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
1375
1401
|
* no boolean can contradict it.
|
|
1376
1402
|
*/
|
|
1377
|
-
resolvedAt:
|
|
1378
|
-
resolvedBy:
|
|
1403
|
+
resolvedAt: z33.string().nullable(),
|
|
1404
|
+
resolvedBy: z33.string().nullable()
|
|
1379
1405
|
});
|
|
1380
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
1381
|
-
var SessionCommentSchema =
|
|
1382
|
-
id:
|
|
1406
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z33.string() });
|
|
1407
|
+
var SessionCommentSchema = z33.object({
|
|
1408
|
+
id: z33.string().uuid(),
|
|
1383
1409
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
1384
|
-
bugId:
|
|
1410
|
+
bugId: z33.string().uuid().nullable(),
|
|
1385
1411
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
1386
1412
|
* parent bug's turn). */
|
|
1387
|
-
turnIndex:
|
|
1413
|
+
turnIndex: z33.number().int().nullable(),
|
|
1388
1414
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
1389
1415
|
location: BugLocationSchema.nullable(),
|
|
1390
|
-
body:
|
|
1391
|
-
createdBy:
|
|
1392
|
-
createdAt:
|
|
1416
|
+
body: z33.string(),
|
|
1417
|
+
createdBy: z33.string(),
|
|
1418
|
+
createdAt: z33.string()
|
|
1393
1419
|
});
|
|
1394
|
-
var CreateCommentInputSchema =
|
|
1395
|
-
bugId:
|
|
1396
|
-
turnIndex:
|
|
1420
|
+
var CreateCommentInputSchema = z33.object({
|
|
1421
|
+
bugId: z33.string().uuid().nullable(),
|
|
1422
|
+
turnIndex: z33.number().int().positive().nullable(),
|
|
1397
1423
|
location: BugLocationSchema.nullable(),
|
|
1398
1424
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
1399
1425
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
1400
|
-
body:
|
|
1426
|
+
body: z33.string().trim().min(1)
|
|
1401
1427
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
1402
1428
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
1403
1429
|
});
|
|
1404
|
-
var UpdateCommentInputSchema =
|
|
1405
|
-
body:
|
|
1406
|
-
bugId:
|
|
1430
|
+
var UpdateCommentInputSchema = z33.object({
|
|
1431
|
+
body: z33.string().trim().min(1).optional(),
|
|
1432
|
+
bugId: z33.string().uuid().nullable().optional(),
|
|
1407
1433
|
location: BugLocationSchema.nullable().optional()
|
|
1408
1434
|
});
|
|
1409
|
-
var SessionFormFactorSchema =
|
|
1410
|
-
var SessionSummarySchema =
|
|
1411
|
-
sessionId:
|
|
1435
|
+
var SessionFormFactorSchema = z33.enum(["mobile", "desktop"]).nullable();
|
|
1436
|
+
var SessionSummarySchema = z33.object({
|
|
1437
|
+
sessionId: z33.string(),
|
|
1412
1438
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
1413
1439
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
1414
|
-
visitorId:
|
|
1440
|
+
visitorId: z33.string().nullable(),
|
|
1415
1441
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
1416
1442
|
* identified themselves. Both null together means "not identified yet". */
|
|
1417
|
-
identityProvider:
|
|
1418
|
-
identityKey:
|
|
1443
|
+
identityProvider: z33.string().nullable(),
|
|
1444
|
+
identityKey: z33.string().nullable(),
|
|
1419
1445
|
/** Team/test traffic. The queue hides these by default. */
|
|
1420
|
-
isInternal:
|
|
1446
|
+
isInternal: z33.boolean(),
|
|
1421
1447
|
/** Build that served the session. Null = not captured; a version filter must
|
|
1422
1448
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
1423
|
-
clientVersion:
|
|
1449
|
+
clientVersion: z33.string().nullable(),
|
|
1424
1450
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
1425
|
-
signalCounts:
|
|
1451
|
+
signalCounts: z33.record(z33.number()),
|
|
1426
1452
|
/**
|
|
1427
1453
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
1428
1454
|
*
|
|
@@ -1439,7 +1465,7 @@ var SessionSummarySchema = z32.object({
|
|
|
1439
1465
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
1440
1466
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
1441
1467
|
*/
|
|
1442
|
-
conversionAttempts:
|
|
1468
|
+
conversionAttempts: z33.number().int().nullable(),
|
|
1443
1469
|
/**
|
|
1444
1470
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
1445
1471
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -1455,7 +1481,7 @@ var SessionSummarySchema = z32.object({
|
|
|
1455
1481
|
* kinds together, and one attempt id appearing under both would be counted
|
|
1456
1482
|
* once there and twice here.
|
|
1457
1483
|
*/
|
|
1458
|
-
conversionKinds:
|
|
1484
|
+
conversionKinds: z33.record(z33.number()),
|
|
1459
1485
|
/**
|
|
1460
1486
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
1461
1487
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -1463,20 +1489,20 @@ var SessionSummarySchema = z32.object({
|
|
|
1463
1489
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
1464
1490
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
1465
1491
|
*/
|
|
1466
|
-
funnelSteps:
|
|
1492
|
+
funnelSteps: z33.array(z33.string()),
|
|
1467
1493
|
/**
|
|
1468
1494
|
* The connector's opaque handle for what this session produced in its back
|
|
1469
1495
|
* office — present only once a checkout actually reached the platform. The
|
|
1470
1496
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
1471
1497
|
*/
|
|
1472
|
-
backOfficeRef:
|
|
1498
|
+
backOfficeRef: z33.string().nullable(),
|
|
1473
1499
|
/**
|
|
1474
1500
|
* The order this session produced, when the connector's back office reported
|
|
1475
1501
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
1476
1502
|
* Both null when no order is known — the cart handle above is then the door.
|
|
1477
1503
|
*/
|
|
1478
|
-
orderRef:
|
|
1479
|
-
orderLabel:
|
|
1504
|
+
orderRef: z33.string().nullable(),
|
|
1505
|
+
orderLabel: z33.string().nullable(),
|
|
1480
1506
|
/**
|
|
1481
1507
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
1482
1508
|
* needs.
|
|
@@ -1489,12 +1515,12 @@ var SessionSummarySchema = z32.object({
|
|
|
1489
1515
|
* on a desktop are not the same session.
|
|
1490
1516
|
*/
|
|
1491
1517
|
formFactor: SessionFormFactorSchema,
|
|
1492
|
-
turnCount:
|
|
1518
|
+
turnCount: z33.number().int(),
|
|
1493
1519
|
/** The visitor's opening message — the single most informative field for
|
|
1494
1520
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
1495
|
-
firstPrompt:
|
|
1496
|
-
startedAt:
|
|
1497
|
-
lastRunAt:
|
|
1521
|
+
firstPrompt: z33.string(),
|
|
1522
|
+
startedAt: z33.string(),
|
|
1523
|
+
lastRunAt: z33.string(),
|
|
1498
1524
|
/**
|
|
1499
1525
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
1500
1526
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -1522,7 +1548,7 @@ var SessionSummarySchema = z32.object({
|
|
|
1522
1548
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
1523
1549
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
1524
1550
|
*/
|
|
1525
|
-
visitorTimeZone:
|
|
1551
|
+
visitorTimeZone: z33.string().nullable(),
|
|
1526
1552
|
/**
|
|
1527
1553
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
1528
1554
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -1530,31 +1556,31 @@ var SessionSummarySchema = z32.object({
|
|
|
1530
1556
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
1531
1557
|
* already reading. Null when no turn in the session recorded a patch.
|
|
1532
1558
|
*/
|
|
1533
|
-
avgTtftMs:
|
|
1559
|
+
avgTtftMs: z33.number().int().nullable(),
|
|
1534
1560
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
1535
1561
|
* a budget: null on sessions older than the mark's recording. */
|
|
1536
|
-
avgMainDoneMs:
|
|
1562
|
+
avgMainDoneMs: z33.number().int().nullable(),
|
|
1537
1563
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
1538
1564
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
1539
|
-
avgChipGenMs:
|
|
1540
|
-
totalLatencyMs:
|
|
1541
|
-
durationMs:
|
|
1565
|
+
avgChipGenMs: z33.number().int().nullable(),
|
|
1566
|
+
totalLatencyMs: z33.number().int(),
|
|
1567
|
+
durationMs: z33.number().int(),
|
|
1542
1568
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
1543
1569
|
* live session streams and cannot be given a verdict until it ends. */
|
|
1544
|
-
isLive:
|
|
1570
|
+
isLive: z33.boolean(),
|
|
1545
1571
|
verdict: SessionVerdictSchema,
|
|
1546
|
-
reviewedBy:
|
|
1547
|
-
reviewedAt:
|
|
1572
|
+
reviewedBy: z33.string().nullable(),
|
|
1573
|
+
reviewedAt: z33.string().nullable(),
|
|
1548
1574
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
1549
1575
|
* state without a second request. */
|
|
1550
|
-
bugIssueKey:
|
|
1551
|
-
bugIssueUrl:
|
|
1552
|
-
bugIssueState:
|
|
1576
|
+
bugIssueKey: z33.string().nullable(),
|
|
1577
|
+
bugIssueUrl: z33.string().nullable(),
|
|
1578
|
+
bugIssueState: z33.string().nullable()
|
|
1553
1579
|
});
|
|
1554
|
-
var SessionQueuePageSchema =
|
|
1555
|
-
sessions:
|
|
1556
|
-
totalCount:
|
|
1557
|
-
hiddenInternalCount:
|
|
1580
|
+
var SessionQueuePageSchema = z33.object({
|
|
1581
|
+
sessions: z33.array(SessionSummarySchema),
|
|
1582
|
+
totalCount: z33.number().int(),
|
|
1583
|
+
hiddenInternalCount: z33.number().int(),
|
|
1558
1584
|
/**
|
|
1559
1585
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
1560
1586
|
*
|
|
@@ -1564,61 +1590,61 @@ var SessionQueuePageSchema = z32.object({
|
|
|
1564
1590
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
1565
1591
|
* analytics dashboard's bounce over the same window.
|
|
1566
1592
|
*/
|
|
1567
|
-
hiddenBouncedCount:
|
|
1593
|
+
hiddenBouncedCount: z33.number().int()
|
|
1568
1594
|
});
|
|
1569
|
-
var SessionQueueFacetsSchema =
|
|
1570
|
-
review:
|
|
1571
|
-
version:
|
|
1572
|
-
turns:
|
|
1573
|
-
durationS:
|
|
1595
|
+
var SessionQueueFacetsSchema = z33.object({
|
|
1596
|
+
review: z33.record(z33.number()),
|
|
1597
|
+
version: z33.record(z33.number()),
|
|
1598
|
+
turns: z33.record(z33.number()),
|
|
1599
|
+
durationS: z33.record(z33.number()),
|
|
1574
1600
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
1575
|
-
funnel:
|
|
1601
|
+
funnel: z33.record(z33.number())
|
|
1576
1602
|
});
|
|
1577
|
-
var SessionCaptureSchema =
|
|
1578
|
-
viewportWidth:
|
|
1579
|
-
viewportHeight:
|
|
1580
|
-
userAgent:
|
|
1581
|
-
locale:
|
|
1603
|
+
var SessionCaptureSchema = z33.object({
|
|
1604
|
+
viewportWidth: z33.number().int().nullable(),
|
|
1605
|
+
viewportHeight: z33.number().int().nullable(),
|
|
1606
|
+
userAgent: z33.string().nullable(),
|
|
1607
|
+
locale: z33.string().nullable(),
|
|
1582
1608
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
1583
|
-
referrer:
|
|
1609
|
+
referrer: z33.string().nullable()
|
|
1584
1610
|
});
|
|
1585
|
-
var SessionCaptureInputSchema =
|
|
1586
|
-
viewportWidth:
|
|
1587
|
-
viewportHeight:
|
|
1588
|
-
userAgent:
|
|
1589
|
-
locale:
|
|
1611
|
+
var SessionCaptureInputSchema = z33.object({
|
|
1612
|
+
viewportWidth: z33.number().int().positive().max(2e4).optional(),
|
|
1613
|
+
viewportHeight: z33.number().int().positive().max(2e4).optional(),
|
|
1614
|
+
userAgent: z33.string().max(1e3).optional(),
|
|
1615
|
+
locale: z33.string().max(35).optional(),
|
|
1590
1616
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
1591
1617
|
* the zone database grows, and refusing a name this build has not heard of
|
|
1592
1618
|
* would drop a real session's capture over a table that is out of date. */
|
|
1593
|
-
timeZone:
|
|
1594
|
-
referrer:
|
|
1595
|
-
clientVersion:
|
|
1596
|
-
isInternal:
|
|
1619
|
+
timeZone: z33.string().max(64).optional(),
|
|
1620
|
+
referrer: z33.string().max(2048).optional(),
|
|
1621
|
+
clientVersion: z33.string().max(100).optional(),
|
|
1622
|
+
isInternal: z33.boolean().optional()
|
|
1597
1623
|
});
|
|
1598
|
-
var SessionDetailSchema =
|
|
1624
|
+
var SessionDetailSchema = z33.object({
|
|
1599
1625
|
session: SessionSummarySchema,
|
|
1600
1626
|
capture: SessionCaptureSchema,
|
|
1601
1627
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
1602
1628
|
* re-judged after a fix is the evidence the fix worked. */
|
|
1603
|
-
reviews:
|
|
1604
|
-
bugs:
|
|
1605
|
-
comments:
|
|
1629
|
+
reviews: z33.array(SessionReviewEventSchema),
|
|
1630
|
+
bugs: z33.array(SessionBugSchema),
|
|
1631
|
+
comments: z33.array(SessionCommentSchema),
|
|
1606
1632
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
1607
1633
|
* not evidence of zero visitor activity. */
|
|
1608
1634
|
activity: SessionActivitySchema.optional()
|
|
1609
1635
|
});
|
|
1610
|
-
var RecordVerdictInputSchema =
|
|
1636
|
+
var RecordVerdictInputSchema = z33.object({
|
|
1611
1637
|
verdict: RecordableVerdictSchema,
|
|
1612
|
-
note:
|
|
1638
|
+
note: z33.string().max(2e3).optional()
|
|
1613
1639
|
});
|
|
1614
|
-
var FileBugInputSchema =
|
|
1615
|
-
turnIndex:
|
|
1640
|
+
var FileBugInputSchema = z33.object({
|
|
1641
|
+
turnIndex: z33.number().int().positive().nullable(),
|
|
1616
1642
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
1617
1643
|
location: BugLocationSchema.nullable().optional(),
|
|
1618
|
-
title:
|
|
1619
|
-
body:
|
|
1644
|
+
title: z33.string().min(1).max(300),
|
|
1645
|
+
body: z33.string().min(1),
|
|
1620
1646
|
severity: BugSeveritySchema,
|
|
1621
|
-
payload:
|
|
1647
|
+
payload: z33.record(z33.unknown())
|
|
1622
1648
|
});
|
|
1623
1649
|
export {
|
|
1624
1650
|
EMPTY_SPEC,
|