@40rty/ams-cli 0.5.7 → 0.5.9
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/dev.mjs +4 -1
- package/bin/commands/publish.mjs +12 -9
- package/bin/commands/theme.mjs +126 -0
- package/bin/forty.mjs +3 -0
- package/bin/lib/__tests__/theme-feeds.test.mjs +42 -0
- package/bin/lib/__tests__/theme-normalize.test.mjs +78 -0
- package/bin/lib/build.mjs +4 -3
- package/bin/lib/host-imports.mjs +136 -0
- package/bin/lib/theme/feeds.mjs +178 -0
- package/bin/lib/theme/normalize.mjs +226 -0
- package/dist/wire.js +385 -346
- package/package.json +2 -1
package/dist/wire.js
CHANGED
|
@@ -857,7 +857,7 @@ function catalogToWire(catalog) {
|
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
// ../spacestation/src/catalog/wire/package-release.ts
|
|
860
|
-
import { z as
|
|
860
|
+
import { z as z25 } from "zod";
|
|
861
861
|
|
|
862
862
|
// ../spacestation/src/catalog/wire/brand-mark.ts
|
|
863
863
|
import { z as z22 } from "zod";
|
|
@@ -882,17 +882,42 @@ import { z as z23 } from "zod";
|
|
|
882
882
|
var SDK_VERSION_PATTERN = /^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.]{1,32})?$/;
|
|
883
883
|
var SdkVersionSchema = z23.string().regex(SDK_VERSION_PATTERN, "an sdk version is major.minor.patch");
|
|
884
884
|
|
|
885
|
+
// ../spacestation/src/catalog/wire/host-imports.ts
|
|
886
|
+
import { z as z24 } from "zod";
|
|
887
|
+
var SpecifierSchema = z24.string().min(1).max(200);
|
|
888
|
+
var HostImportsSchema = z24.record(SpecifierSchema, z24.array(z24.string().min(1).max(200)).max(5e3));
|
|
889
|
+
var HostExportsSchema = z24.record(SpecifierSchema, z24.array(z24.string()));
|
|
890
|
+
function hostImportProblems(imports, provided) {
|
|
891
|
+
const problems = [];
|
|
892
|
+
for (const [specifier, names] of Object.entries(imports)) {
|
|
893
|
+
const exported = Object.hasOwn(provided, specifier) ? provided[specifier] : void 0;
|
|
894
|
+
if (exported === void 0) {
|
|
895
|
+
problems.push(`${specifier} (not provided)`);
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
const have = new Set(exported);
|
|
899
|
+
for (const name of names) if (!have.has(name)) problems.push(`${specifier} \u2192 ${name}`);
|
|
900
|
+
}
|
|
901
|
+
return problems;
|
|
902
|
+
}
|
|
903
|
+
function hostImportsRefusal(commit) {
|
|
904
|
+
const where = commit === null ? "this deployment" : `this deployment (commit ${commit.slice(0, 12)})`;
|
|
905
|
+
return `The bundle imports what ${where} does not provide \u2014 build against the @40rty/ams-* versions it serves, or wait for the platform to ship them`;
|
|
906
|
+
}
|
|
907
|
+
|
|
885
908
|
// ../spacestation/src/catalog/wire/package-release.ts
|
|
886
909
|
var RESERVED_SCOPES = ["@fourty/", "@40rty/"];
|
|
887
910
|
var BUNDLE_ASSET_PATH = /^assets\/[A-Za-z0-9_-]+\.(woff2?|ttf|otf|png|jpe?g|svg|gif|webp)$/;
|
|
888
|
-
var
|
|
911
|
+
var RELEASE_MESSAGE_MAX = 140;
|
|
912
|
+
var ReleaseMessageSchema = z25.string().trim().min(1, "say what this release changes").max(RELEASE_MESSAGE_MAX, `keep the message to one line of ${RELEASE_MESSAGE_MAX} characters or fewer`);
|
|
913
|
+
var PackageReleaseSchema = z25.object({
|
|
889
914
|
/** The id spaces name in `componentSources` — an npm-style package name. */
|
|
890
|
-
sourceId:
|
|
891
|
-
label:
|
|
915
|
+
sourceId: z25.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`),
|
|
916
|
+
label: z25.string().min(1).max(120),
|
|
892
917
|
/** The package's own version, as its repository states it — shown in the console. */
|
|
893
|
-
version:
|
|
918
|
+
version: z25.string().min(1).max(40),
|
|
894
919
|
/** What this release changed, in the publisher's words (`forty publish --message`) — shown in the console's version list. */
|
|
895
|
-
description:
|
|
920
|
+
description: z25.string().min(1).max(500).optional(),
|
|
896
921
|
/**
|
|
897
922
|
* The `@40rty/ams-sdk` version the brand project resolved when `forty
|
|
898
923
|
* publish` built this release. A bundle takes the sdk from the page at
|
|
@@ -901,9 +926,18 @@ var PackageReleaseSchema = z24.object({
|
|
|
901
926
|
* published before the stamp existed — those are legacy.
|
|
902
927
|
*/
|
|
903
928
|
builtWithSdk: SdkVersionSchema.optional(),
|
|
929
|
+
/**
|
|
930
|
+
* Every name the bundle reads from each module it takes from the page
|
|
931
|
+
* (`host-imports.ts`) — what lets the platform refuse a bundle it cannot
|
|
932
|
+
* run. Sent by `forty publish` / `forty dev` with every bundle; absent on
|
|
933
|
+
* releases built before it existed, which are admitted (and logged). Kept
|
|
934
|
+
* beside the release, not in the bundle, so a rollback can check it without
|
|
935
|
+
* fetching the components.
|
|
936
|
+
*/
|
|
937
|
+
hostImports: HostImportsSchema.optional(),
|
|
904
938
|
catalog: WireCatalogSchema,
|
|
905
939
|
/** Component manifests by path under `catalogs/`, e.g. `catalogs/product/productGrid.md`. */
|
|
906
|
-
manifests:
|
|
940
|
+
manifests: z25.record(z25.string().regex(/^catalogs\/.+\.md$/, "a manifest path is catalogs/<\u2026>.md"), z25.string()),
|
|
907
941
|
/**
|
|
908
942
|
* The brand's components, built — present when the PLATFORM hosts this
|
|
909
943
|
* brand's spacefront, absent when the brand hosts it in its own app. One
|
|
@@ -912,17 +946,17 @@ var PackageReleaseSchema = z24.object({
|
|
|
912
946
|
* images — base64, keyed by the path the stylesheet's `url()` names, beside
|
|
913
947
|
* it). It is served to browsers; the platform's servers never run it.
|
|
914
948
|
*/
|
|
915
|
-
bundle:
|
|
916
|
-
js:
|
|
917
|
-
css:
|
|
918
|
-
assets:
|
|
949
|
+
bundle: z25.object({
|
|
950
|
+
js: z25.string().min(1),
|
|
951
|
+
css: z25.string(),
|
|
952
|
+
assets: z25.record(z25.string().regex(BUNDLE_ASSET_PATH, "an asset is assets/<name>.<font or image extension>"), z25.string().base64()).optional()
|
|
919
953
|
}).strict().optional(),
|
|
920
954
|
/**
|
|
921
955
|
* The class the spacefront root carries while this package is the space's.
|
|
922
956
|
* The package's own stylesheet styles under it. Absent = the platform's
|
|
923
957
|
* default theme class.
|
|
924
958
|
*/
|
|
925
|
-
theme:
|
|
959
|
+
theme: z25.object({ themeClass: z25.string().regex(/^[a-z][a-z0-9-]*$/, "a theme class is lowercase letters, digits and hyphens") }).strict().optional(),
|
|
926
960
|
/**
|
|
927
961
|
* The brand's mark (`brand-mark.ts`). Sent as the files themselves; the
|
|
928
962
|
* platform stores them content-addressed at ingest and keeps only their
|
|
@@ -935,7 +969,7 @@ var PackageReleaseSchema = z24.object({
|
|
|
935
969
|
* The package's own composition guidance for its own components — prompt
|
|
936
970
|
* markdown the agent reads, gated on the capabilities it names (`requires`).
|
|
937
971
|
*/
|
|
938
|
-
promptSections:
|
|
972
|
+
promptSections: z25.array(z25.object({ id: z25.string().regex(/^[a-z0-9-]+$/), order: z25.number().int(), content: z25.string().min(1).max(2e4), requires: z25.array(z25.string()) }).strict()).max(10).optional(),
|
|
939
973
|
/**
|
|
940
974
|
* The brand's SPACE prompt — its `prompts/space.md`, verbatim: sections split
|
|
941
975
|
* by `<!-- section:<id> -->` markers, the same format as the platform's
|
|
@@ -943,85 +977,85 @@ var PackageReleaseSchema = z24.object({
|
|
|
943
977
|
* package. How the brand speaks, what it sells and what it never claims ship
|
|
944
978
|
* with the brand, and a release changes them with no platform deploy.
|
|
945
979
|
*/
|
|
946
|
-
spacePrompt:
|
|
980
|
+
spacePrompt: z25.string().min(1).max(2e5).optional(),
|
|
947
981
|
/**
|
|
948
982
|
* Opaque per-vertical extension data (`BrandDefinition.config`): the
|
|
949
983
|
* platform stays vertical-agnostic and the vertical's own code reads its keys.
|
|
950
984
|
*/
|
|
951
|
-
config:
|
|
985
|
+
config: z25.record(z25.string(), z25.unknown()).optional(),
|
|
952
986
|
/**
|
|
953
987
|
* Set by the platform, never by a publisher: this release is a DRAFT of the
|
|
954
988
|
* package `of`, previewed on the space `space`. See `draftSourceId`.
|
|
955
989
|
*/
|
|
956
|
-
draft:
|
|
990
|
+
draft: z25.object({ of: z25.string().min(1), space: z25.string().min(1) }).strict().optional()
|
|
957
991
|
}).strict();
|
|
958
992
|
|
|
959
993
|
// ../spacestation/src/catalog/wire/package-bundle-ref.ts
|
|
960
|
-
import { z as
|
|
961
|
-
var PackageBundleRefSchema =
|
|
962
|
-
sourceId:
|
|
963
|
-
js:
|
|
964
|
-
css:
|
|
994
|
+
import { z as z26 } from "zod";
|
|
995
|
+
var PackageBundleRefSchema = z26.object({
|
|
996
|
+
sourceId: z26.string(),
|
|
997
|
+
js: z26.string(),
|
|
998
|
+
css: z26.string(),
|
|
965
999
|
/** The brand's name for itself, and its package's version. */
|
|
966
|
-
label:
|
|
967
|
-
version:
|
|
1000
|
+
label: z26.string(),
|
|
1001
|
+
version: z26.string(),
|
|
968
1002
|
/** The sdk the bundle was built against (`PackageRelease.builtWithSdk`) — absent for a legacy release. Picks its compat shims. */
|
|
969
1003
|
builtWithSdk: SdkVersionSchema.optional()
|
|
970
1004
|
});
|
|
971
1005
|
|
|
972
1006
|
// ../spacestation/src/projection/projection.ts
|
|
973
|
-
import { z as
|
|
974
|
-
var LateBoundValueSchema =
|
|
975
|
-
var DirectiveValueSchema =
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1007
|
+
import { z as z27 } from "zod";
|
|
1008
|
+
var LateBoundValueSchema = z27.object({ fact: z27.literal(true) });
|
|
1009
|
+
var DirectiveValueSchema = z27.union([
|
|
1010
|
+
z27.string(),
|
|
1011
|
+
z27.number(),
|
|
1012
|
+
z27.boolean(),
|
|
979
1013
|
LateBoundValueSchema
|
|
980
1014
|
]);
|
|
981
|
-
var ProjectionDirectiveSchema =
|
|
1015
|
+
var ProjectionDirectiveSchema = z27.object({
|
|
982
1016
|
/** Keep only items whose axis values all match. Keyed by axis name
|
|
983
1017
|
* (e.g. `Size`); value is a literal or the `{fact:true}` marker. */
|
|
984
|
-
isolateTo:
|
|
1018
|
+
isolateTo: z27.record(DirectiveValueSchema).optional(),
|
|
985
1019
|
/** Isolate to EVERY axis the visitor has a stored fact for. The agent
|
|
986
1020
|
* emits this (it is vertical-agnostic — it cannot name axes); the
|
|
987
1021
|
* entity binding expands it against the entity's own axes + facts. */
|
|
988
|
-
isolateToFacts:
|
|
1022
|
+
isolateToFacts: z27.boolean().optional(),
|
|
989
1023
|
/** Keep only items the entity binding reports as available. */
|
|
990
|
-
availableOnly:
|
|
1024
|
+
availableOnly: z27.boolean().optional(),
|
|
991
1025
|
/** Cap the rendered count after filtering. */
|
|
992
|
-
limit:
|
|
1026
|
+
limit: z27.number().int().positive().optional()
|
|
993
1027
|
});
|
|
994
|
-
var ProjectionPreferencesSchema =
|
|
995
|
-
|
|
1028
|
+
var ProjectionPreferencesSchema = z27.record(
|
|
1029
|
+
z27.union([ProjectionDirectiveSchema, z27.null()])
|
|
996
1030
|
);
|
|
997
|
-
var ProjectionSetPayloadSchema =
|
|
998
|
-
setAll:
|
|
1031
|
+
var ProjectionSetPayloadSchema = z27.object({
|
|
1032
|
+
setAll: z27.union([ProjectionDirectiveSchema, z27.null()]).optional(),
|
|
999
1033
|
set: ProjectionPreferencesSchema.optional()
|
|
1000
1034
|
});
|
|
1001
1035
|
|
|
1002
1036
|
// ../spacestation/src/host/host-page.ts
|
|
1003
|
-
import { z as
|
|
1004
|
-
var HostPayloadSchema =
|
|
1037
|
+
import { z as z28 } from "zod";
|
|
1038
|
+
var HostPayloadSchema = z28.object({
|
|
1005
1039
|
page: PageSchema.nullable(),
|
|
1006
|
-
maxSections:
|
|
1007
|
-
surface:
|
|
1040
|
+
maxSections: z28.number().int().positive().nullable(),
|
|
1041
|
+
surface: z28.enum(["page", "slot"])
|
|
1008
1042
|
});
|
|
1009
|
-
var HostClearedSchema =
|
|
1043
|
+
var HostClearedSchema = z28.object({ cleared: z28.literal(true) });
|
|
1010
1044
|
|
|
1011
1045
|
// ../spacestation/src/focus/focus.ts
|
|
1012
|
-
import { z as
|
|
1013
|
-
var FocusElementPayloadSchema =
|
|
1014
|
-
elementId:
|
|
1046
|
+
import { z as z29 } from "zod";
|
|
1047
|
+
var FocusElementPayloadSchema = z29.object({
|
|
1048
|
+
elementId: z29.string().min(1)
|
|
1015
1049
|
});
|
|
1016
1050
|
|
|
1017
1051
|
// ../spacestation/src/view/continuation.ts
|
|
1018
|
-
import { z as
|
|
1019
|
-
var ViewExtendPayloadSchema =
|
|
1020
|
-
reason:
|
|
1052
|
+
import { z as z30 } from "zod";
|
|
1053
|
+
var ViewExtendPayloadSchema = z30.object({
|
|
1054
|
+
reason: z30.enum(["scroll_near_bottom"])
|
|
1021
1055
|
});
|
|
1022
1056
|
|
|
1023
1057
|
// ../spacestation/src/attachment/attachment.ts
|
|
1024
|
-
import { z as
|
|
1058
|
+
import { z as z31 } from "zod";
|
|
1025
1059
|
var ALLOWED_ATTACHMENT_TYPES = [
|
|
1026
1060
|
"image/jpeg",
|
|
1027
1061
|
"image/png",
|
|
@@ -1033,39 +1067,39 @@ var MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
|
|
1033
1067
|
function isAllowedAttachmentType(mime) {
|
|
1034
1068
|
return ALLOWED_ATTACHMENT_TYPES.includes(mime);
|
|
1035
1069
|
}
|
|
1036
|
-
var AttachmentRefSchema =
|
|
1070
|
+
var AttachmentRefSchema = z31.object({
|
|
1037
1071
|
// A UUID, as `storeAttachment` mints it: the id becomes a storage path segment,
|
|
1038
1072
|
// so nothing else — no `/`, no `..` — may reach that lookup.
|
|
1039
|
-
id:
|
|
1040
|
-
mimeType:
|
|
1073
|
+
id: z31.string().uuid(),
|
|
1074
|
+
mimeType: z31.string().refine(isAllowedAttachmentType, {
|
|
1041
1075
|
message: "mimeType not on the attachment allow-list"
|
|
1042
1076
|
}),
|
|
1043
|
-
name:
|
|
1044
|
-
size:
|
|
1045
|
-
url:
|
|
1077
|
+
name: z31.string().min(1),
|
|
1078
|
+
size: z31.number().int().positive().max(MAX_ATTACHMENT_BYTES),
|
|
1079
|
+
url: z31.string().min(1)
|
|
1046
1080
|
});
|
|
1047
|
-
var AttachmentRefsSchema =
|
|
1081
|
+
var AttachmentRefsSchema = z31.array(AttachmentRefSchema);
|
|
1048
1082
|
|
|
1049
1083
|
// ../spacestation/src/attachment/attachment-failure.ts
|
|
1050
1084
|
var MAX_ATTACHMENT_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
|
|
1051
1085
|
|
|
1052
1086
|
// ../spacestation/src/contracts/entry-context.ts
|
|
1053
|
-
import { z as
|
|
1087
|
+
import { z as z32 } from "zod";
|
|
1054
1088
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
1055
1089
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
1056
1090
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
1057
1091
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
1058
|
-
var EntryContextValueSchema =
|
|
1059
|
-
var EntryContextNameSchema =
|
|
1060
|
-
var EntryContextNamespaceSchema =
|
|
1092
|
+
var EntryContextValueSchema = z32.string().trim().min(1).max(ENTRY_CONTEXT_MAX_VALUE_CHARS);
|
|
1093
|
+
var EntryContextNameSchema = z32.string().trim().min(1).max(ENTRY_CONTEXT_MAX_NAME_CHARS);
|
|
1094
|
+
var EntryContextNamespaceSchema = z32.record(EntryContextNameSchema, EntryContextValueSchema).refine((entries) => Object.keys(entries).length <= ENTRY_CONTEXT_MAX_KEYS, {
|
|
1061
1095
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
1062
1096
|
});
|
|
1063
|
-
var EntryContextSchema =
|
|
1097
|
+
var EntryContextSchema = z32.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
1064
1098
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
1065
1099
|
});
|
|
1066
1100
|
|
|
1067
1101
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
1068
|
-
import { z as
|
|
1102
|
+
import { z as z33 } from "zod";
|
|
1069
1103
|
var SURFACES = [
|
|
1070
1104
|
"spacefront",
|
|
1071
1105
|
"embed",
|
|
@@ -1075,11 +1109,11 @@ var SURFACES = [
|
|
|
1075
1109
|
"playground",
|
|
1076
1110
|
"automation"
|
|
1077
1111
|
];
|
|
1078
|
-
var SurfaceSchema =
|
|
1112
|
+
var SurfaceSchema = z33.enum(SURFACES);
|
|
1079
1113
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
1080
|
-
var ClickIdKindSchema =
|
|
1114
|
+
var ClickIdKindSchema = z33.enum(CLICK_ID_KINDS);
|
|
1081
1115
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
1082
|
-
var VisitorIdDurabilitySchema =
|
|
1116
|
+
var VisitorIdDurabilitySchema = z33.enum(VISITOR_ID_DURABILITIES);
|
|
1083
1117
|
var TRAFFIC_BUCKETS = [
|
|
1084
1118
|
"paid_google",
|
|
1085
1119
|
"paid_meta",
|
|
@@ -1091,10 +1125,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
1091
1125
|
"direct",
|
|
1092
1126
|
"unknown"
|
|
1093
1127
|
];
|
|
1094
|
-
var TrafficBucketSchema =
|
|
1128
|
+
var TrafficBucketSchema = z33.enum(TRAFFIC_BUCKETS);
|
|
1095
1129
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
1096
|
-
var ArrivalValueSchema =
|
|
1097
|
-
var SessionArrivalSchema =
|
|
1130
|
+
var ArrivalValueSchema = z33.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
1131
|
+
var SessionArrivalSchema = z33.object({
|
|
1098
1132
|
utmSource: ArrivalValueSchema.optional(),
|
|
1099
1133
|
utmMedium: ArrivalValueSchema.optional(),
|
|
1100
1134
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -1132,85 +1166,85 @@ var WIRE_PROTOCOL_VERSION = 1;
|
|
|
1132
1166
|
var WIRE_PROTOCOL_PARAM = "protocol";
|
|
1133
1167
|
|
|
1134
1168
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
1135
|
-
import { z as
|
|
1136
|
-
var AttributeScopeBucketSchema =
|
|
1137
|
-
scope:
|
|
1138
|
-
needles:
|
|
1139
|
-
label:
|
|
1169
|
+
import { z as z34 } from "zod";
|
|
1170
|
+
var AttributeScopeBucketSchema = z34.object({
|
|
1171
|
+
scope: z34.string(),
|
|
1172
|
+
needles: z34.array(z34.string()).readonly(),
|
|
1173
|
+
label: z34.string().optional()
|
|
1140
1174
|
});
|
|
1141
|
-
var AttributeScopeConfigSchema =
|
|
1142
|
-
facet:
|
|
1143
|
-
buckets:
|
|
1144
|
-
emptyScope:
|
|
1145
|
-
noMatchScope:
|
|
1146
|
-
ignoreValues:
|
|
1147
|
-
emptyScopeLabel:
|
|
1148
|
-
noMatchScopeLabel:
|
|
1175
|
+
var AttributeScopeConfigSchema = z34.object({
|
|
1176
|
+
facet: z34.string(),
|
|
1177
|
+
buckets: z34.array(AttributeScopeBucketSchema).readonly(),
|
|
1178
|
+
emptyScope: z34.string(),
|
|
1179
|
+
noMatchScope: z34.string(),
|
|
1180
|
+
ignoreValues: z34.array(z34.string()).readonly(),
|
|
1181
|
+
emptyScopeLabel: z34.string().optional(),
|
|
1182
|
+
noMatchScopeLabel: z34.string().optional()
|
|
1149
1183
|
});
|
|
1150
|
-
var AttributeDefBaseSchema =
|
|
1151
|
-
description:
|
|
1152
|
-
durable:
|
|
1153
|
-
label:
|
|
1184
|
+
var AttributeDefBaseSchema = z34.object({
|
|
1185
|
+
description: z34.string().optional(),
|
|
1186
|
+
durable: z34.boolean().optional(),
|
|
1187
|
+
label: z34.string().optional()
|
|
1154
1188
|
});
|
|
1155
|
-
var AttributeDefSchema =
|
|
1156
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1157
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1158
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1159
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1189
|
+
var AttributeDefSchema = z34.discriminatedUnion("kind", [
|
|
1190
|
+
AttributeDefBaseSchema.extend({ kind: z34.literal("enum"), values: z34.array(z34.string()) }),
|
|
1191
|
+
AttributeDefBaseSchema.extend({ kind: z34.literal("free_text") }),
|
|
1192
|
+
AttributeDefBaseSchema.extend({ kind: z34.literal("date_or_season") }),
|
|
1193
|
+
AttributeDefBaseSchema.extend({ kind: z34.literal("money_or_band") }),
|
|
1160
1194
|
AttributeDefBaseSchema.extend({
|
|
1161
|
-
kind:
|
|
1162
|
-
min:
|
|
1163
|
-
max:
|
|
1164
|
-
unit:
|
|
1195
|
+
kind: z34.literal("number"),
|
|
1196
|
+
min: z34.number().optional(),
|
|
1197
|
+
max: z34.number().optional(),
|
|
1198
|
+
unit: z34.string().optional()
|
|
1165
1199
|
})
|
|
1166
1200
|
]);
|
|
1167
1201
|
|
|
1168
1202
|
// ../spacestation/src/space/agent-directive.ts
|
|
1169
|
-
import { z as
|
|
1203
|
+
import { z as z35 } from "zod";
|
|
1170
1204
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
1171
1205
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
1172
1206
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
1173
1207
|
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
1174
|
-
var AgentDirectiveSchema =
|
|
1175
|
-
name:
|
|
1176
|
-
kind:
|
|
1177
|
-
severity:
|
|
1208
|
+
var AgentDirectiveSchema = z35.object({
|
|
1209
|
+
name: z35.string().trim().min(1).max(80),
|
|
1210
|
+
kind: z35.enum(AGENT_DIRECTIVE_KINDS),
|
|
1211
|
+
severity: z35.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
1178
1212
|
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
1179
1213
|
* product name. */
|
|
1180
|
-
text:
|
|
1214
|
+
text: z35.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
1181
1215
|
}).strict();
|
|
1182
|
-
var SpaceAgentDirectiveSchema =
|
|
1183
|
-
id:
|
|
1184
|
-
position:
|
|
1185
|
-
name:
|
|
1186
|
-
kind:
|
|
1187
|
-
severity:
|
|
1188
|
-
text:
|
|
1189
|
-
source:
|
|
1190
|
-
status:
|
|
1216
|
+
var SpaceAgentDirectiveSchema = z35.object({
|
|
1217
|
+
id: z35.string(),
|
|
1218
|
+
position: z35.number().int(),
|
|
1219
|
+
name: z35.string(),
|
|
1220
|
+
kind: z35.enum(AGENT_DIRECTIVE_KINDS),
|
|
1221
|
+
severity: z35.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
1222
|
+
text: z35.string(),
|
|
1223
|
+
source: z35.enum(AGENT_DIRECTIVE_SOURCES),
|
|
1224
|
+
status: z35.enum(AGENT_DIRECTIVE_STATUSES),
|
|
1191
1225
|
/** Who wrote it; null for a lesson the system proposed. */
|
|
1192
|
-
createdBy:
|
|
1226
|
+
createdBy: z35.string().nullable(),
|
|
1193
1227
|
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
1194
|
-
evidence:
|
|
1195
|
-
decidedBy:
|
|
1196
|
-
decidedAt:
|
|
1197
|
-
createdAt:
|
|
1228
|
+
evidence: z35.record(z35.unknown()).nullable(),
|
|
1229
|
+
decidedBy: z35.string().nullable(),
|
|
1230
|
+
decidedAt: z35.string().nullable(),
|
|
1231
|
+
createdAt: z35.string()
|
|
1198
1232
|
});
|
|
1199
|
-
var OutcomeTallySchema =
|
|
1233
|
+
var OutcomeTallySchema = z35.object({ turns: z35.number().int(), acted: z35.number().int() });
|
|
1200
1234
|
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
1201
|
-
impact:
|
|
1235
|
+
impact: z35.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
1202
1236
|
});
|
|
1203
|
-
var UpdateAgentDirectiveInputSchema =
|
|
1237
|
+
var UpdateAgentDirectiveInputSchema = z35.object({
|
|
1204
1238
|
name: AgentDirectiveSchema.shape.name.optional(),
|
|
1205
1239
|
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
1206
1240
|
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
1207
1241
|
text: AgentDirectiveSchema.shape.text.optional(),
|
|
1208
|
-
status:
|
|
1242
|
+
status: z35.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
1209
1243
|
}).strict();
|
|
1210
|
-
var ReorderAgentDirectivesInputSchema =
|
|
1244
|
+
var ReorderAgentDirectivesInputSchema = z35.object({ ids: z35.array(z35.string()).min(1) }).strict();
|
|
1211
1245
|
|
|
1212
1246
|
// ../spacestation/src/space/space-locale.ts
|
|
1213
|
-
import { z as
|
|
1247
|
+
import { z as z36 } from "zod";
|
|
1214
1248
|
function isBcp47(tag) {
|
|
1215
1249
|
try {
|
|
1216
1250
|
return new Intl.Locale(tag).language.length > 0;
|
|
@@ -1219,7 +1253,7 @@ function isBcp47(tag) {
|
|
|
1219
1253
|
throw err;
|
|
1220
1254
|
}
|
|
1221
1255
|
}
|
|
1222
|
-
var SpaceLocaleSchema =
|
|
1256
|
+
var SpaceLocaleSchema = z36.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
1223
1257
|
|
|
1224
1258
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
1225
1259
|
var COMPONENT_SOURCE = {
|
|
@@ -1249,30 +1283,30 @@ var DEFAULT_SPACE_CONFIG = {
|
|
|
1249
1283
|
};
|
|
1250
1284
|
|
|
1251
1285
|
// ../spacestation/src/space/trace.ts
|
|
1252
|
-
import { z as
|
|
1253
|
-
var RunTokenUsageSchema =
|
|
1254
|
-
input_tokens:
|
|
1255
|
-
output_tokens:
|
|
1256
|
-
cache_read_tokens:
|
|
1286
|
+
import { z as z37 } from "zod";
|
|
1287
|
+
var RunTokenUsageSchema = z37.object({
|
|
1288
|
+
input_tokens: z37.number().optional(),
|
|
1289
|
+
output_tokens: z37.number().optional(),
|
|
1290
|
+
cache_read_tokens: z37.number().optional()
|
|
1257
1291
|
});
|
|
1258
|
-
var TraceRecordSchema =
|
|
1259
|
-
id:
|
|
1260
|
-
spaceId:
|
|
1261
|
-
sessionId:
|
|
1292
|
+
var TraceRecordSchema = z37.object({
|
|
1293
|
+
id: z37.string().uuid(),
|
|
1294
|
+
spaceId: z37.string().uuid().nullable(),
|
|
1295
|
+
sessionId: z37.string(),
|
|
1262
1296
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
1263
1297
|
* for an unlocked space / anonymous unlock. */
|
|
1264
|
-
visitorEmail:
|
|
1265
|
-
userPrompt:
|
|
1266
|
-
branch:
|
|
1267
|
-
responseText:
|
|
1268
|
-
layout:
|
|
1269
|
-
phaseTimings:
|
|
1270
|
-
tokensByModel:
|
|
1271
|
-
toolCalls:
|
|
1272
|
-
diagnostics:
|
|
1273
|
-
latencyFirstText:
|
|
1274
|
-
latencyFirstPatch:
|
|
1275
|
-
latencyTotal:
|
|
1298
|
+
visitorEmail: z37.string().nullable(),
|
|
1299
|
+
userPrompt: z37.string(),
|
|
1300
|
+
branch: z37.string().nullable(),
|
|
1301
|
+
responseText: z37.string().nullable(),
|
|
1302
|
+
layout: z37.unknown().nullable(),
|
|
1303
|
+
phaseTimings: z37.record(z37.number()).nullable(),
|
|
1304
|
+
tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
|
|
1305
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
1306
|
+
diagnostics: z37.array(z37.unknown()).nullable(),
|
|
1307
|
+
latencyFirstText: z37.number().int().nullable(),
|
|
1308
|
+
latencyFirstPatch: z37.number().int().nullable(),
|
|
1309
|
+
latencyTotal: z37.number().int().nullable(),
|
|
1276
1310
|
/**
|
|
1277
1311
|
* The CLIENT's turn id for this run, or `null`.
|
|
1278
1312
|
*
|
|
@@ -1288,29 +1322,29 @@ var TraceRecordSchema = z36.object({
|
|
|
1288
1322
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1289
1323
|
* visitor asked something and got nothing.
|
|
1290
1324
|
*/
|
|
1291
|
-
turnId:
|
|
1325
|
+
turnId: z37.string().nullable(),
|
|
1292
1326
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
1293
1327
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
1294
|
-
trackerState:
|
|
1295
|
-
createdAt:
|
|
1328
|
+
trackerState: z37.unknown().nullable(),
|
|
1329
|
+
createdAt: z37.string()
|
|
1296
1330
|
});
|
|
1297
|
-
var MillisecondsSchema =
|
|
1298
|
-
var CreateTraceInputSchema =
|
|
1299
|
-
spaceId:
|
|
1300
|
-
sessionId:
|
|
1301
|
-
visitorEmail:
|
|
1302
|
-
userPrompt:
|
|
1303
|
-
branch:
|
|
1304
|
-
responseText:
|
|
1305
|
-
layout:
|
|
1306
|
-
phaseTimings:
|
|
1307
|
-
tokensByModel:
|
|
1308
|
-
toolCalls:
|
|
1309
|
-
diagnostics:
|
|
1331
|
+
var MillisecondsSchema = z37.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
1332
|
+
var CreateTraceInputSchema = z37.object({
|
|
1333
|
+
spaceId: z37.string().uuid().nullable(),
|
|
1334
|
+
sessionId: z37.string(),
|
|
1335
|
+
visitorEmail: z37.string().nullable(),
|
|
1336
|
+
userPrompt: z37.string(),
|
|
1337
|
+
branch: z37.string().nullable(),
|
|
1338
|
+
responseText: z37.string().nullable(),
|
|
1339
|
+
layout: z37.unknown().nullable(),
|
|
1340
|
+
phaseTimings: z37.record(z37.number()).nullable(),
|
|
1341
|
+
tokensByModel: z37.record(RunTokenUsageSchema).nullable(),
|
|
1342
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
1343
|
+
diagnostics: z37.array(z37.unknown()).nullable(),
|
|
1310
1344
|
latencyFirstText: MillisecondsSchema,
|
|
1311
1345
|
latencyFirstPatch: MillisecondsSchema,
|
|
1312
1346
|
latencyTotal: MillisecondsSchema,
|
|
1313
|
-
trackerState:
|
|
1347
|
+
trackerState: z37.unknown().nullable(),
|
|
1314
1348
|
/**
|
|
1315
1349
|
* The CLIENT's turn id for this run, or `null`.
|
|
1316
1350
|
*
|
|
@@ -1326,37 +1360,37 @@ var CreateTraceInputSchema = z36.object({
|
|
|
1326
1360
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1327
1361
|
* visitor asked something and got nothing.
|
|
1328
1362
|
*/
|
|
1329
|
-
turnId:
|
|
1363
|
+
turnId: z37.string().nullable()
|
|
1330
1364
|
});
|
|
1331
|
-
var AgentSessionSummarySchema =
|
|
1332
|
-
sessionId:
|
|
1365
|
+
var AgentSessionSummarySchema = z37.object({
|
|
1366
|
+
sessionId: z37.string(),
|
|
1333
1367
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
1334
|
-
turnCount:
|
|
1368
|
+
turnCount: z37.number().int(),
|
|
1335
1369
|
/** The session's opening prompt — titles the row in the UI. */
|
|
1336
|
-
firstPrompt:
|
|
1337
|
-
startedAt:
|
|
1338
|
-
lastRunAt:
|
|
1370
|
+
firstPrompt: z37.string(),
|
|
1371
|
+
startedAt: z37.string(),
|
|
1372
|
+
lastRunAt: z37.string(),
|
|
1339
1373
|
/** Summed `latency_total` across the session's turns. */
|
|
1340
|
-
totalLatencyMs:
|
|
1374
|
+
totalLatencyMs: z37.number().int()
|
|
1341
1375
|
});
|
|
1342
|
-
var SessionTurnSchema =
|
|
1343
|
-
id:
|
|
1344
|
-
userPrompt:
|
|
1345
|
-
responseText:
|
|
1376
|
+
var SessionTurnSchema = z37.object({
|
|
1377
|
+
id: z37.string().uuid(),
|
|
1378
|
+
userPrompt: z37.string(),
|
|
1379
|
+
responseText: z37.string().nullable(),
|
|
1346
1380
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
1347
|
-
layout:
|
|
1348
|
-
createdAt:
|
|
1349
|
-
latencyTotal:
|
|
1350
|
-
phaseTimings:
|
|
1351
|
-
tokensByModel:
|
|
1352
|
-
input_tokens:
|
|
1353
|
-
output_tokens:
|
|
1381
|
+
layout: z37.unknown().nullable(),
|
|
1382
|
+
createdAt: z37.string(),
|
|
1383
|
+
latencyTotal: z37.number().int().nullable(),
|
|
1384
|
+
phaseTimings: z37.record(z37.number()).nullable(),
|
|
1385
|
+
tokensByModel: z37.record(z37.object({
|
|
1386
|
+
input_tokens: z37.number().optional(),
|
|
1387
|
+
output_tokens: z37.number().optional()
|
|
1354
1388
|
})).nullable(),
|
|
1355
|
-
toolCalls:
|
|
1356
|
-
diagnostics:
|
|
1389
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
1390
|
+
diagnostics: z37.array(z37.unknown()).nullable()
|
|
1357
1391
|
});
|
|
1358
|
-
var SessionReplaySchema =
|
|
1359
|
-
turns:
|
|
1392
|
+
var SessionReplaySchema = z37.object({
|
|
1393
|
+
turns: z37.array(SessionTurnSchema),
|
|
1360
1394
|
/**
|
|
1361
1395
|
* The session's own last-committed layout, read straight off the durable
|
|
1362
1396
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -1367,20 +1401,20 @@ var SessionReplaySchema = z36.object({
|
|
|
1367
1401
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
1368
1402
|
* when the durable session row itself could not be read.
|
|
1369
1403
|
*/
|
|
1370
|
-
sessionLayout:
|
|
1404
|
+
sessionLayout: z37.record(z37.string(), z37.unknown()).nullable()
|
|
1371
1405
|
});
|
|
1372
|
-
var SessionTraceSchema =
|
|
1373
|
-
trackerState:
|
|
1406
|
+
var SessionTraceSchema = z37.object({
|
|
1407
|
+
trackerState: z37.string().nullable()
|
|
1374
1408
|
});
|
|
1375
|
-
var LlmUsageDailySchema =
|
|
1376
|
-
day:
|
|
1409
|
+
var LlmUsageDailySchema = z37.object({
|
|
1410
|
+
day: z37.string(),
|
|
1377
1411
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
1378
|
-
environment:
|
|
1379
|
-
feature:
|
|
1380
|
-
model:
|
|
1381
|
-
provider:
|
|
1412
|
+
environment: z37.string(),
|
|
1413
|
+
feature: z37.string(),
|
|
1414
|
+
model: z37.string(),
|
|
1415
|
+
provider: z37.string(),
|
|
1382
1416
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
1383
|
-
keyFingerprint:
|
|
1417
|
+
keyFingerprint: z37.string().nullable(),
|
|
1384
1418
|
/**
|
|
1385
1419
|
* The space the call served, or null when it served none.
|
|
1386
1420
|
*
|
|
@@ -1389,91 +1423,91 @@ var LlmUsageDailySchema = z36.object({
|
|
|
1389
1423
|
* report that share rather than dropping it, or a per-space total reads as
|
|
1390
1424
|
* the platform total.
|
|
1391
1425
|
*/
|
|
1392
|
-
spaceId:
|
|
1426
|
+
spaceId: z37.string().nullable(),
|
|
1393
1427
|
/**
|
|
1394
1428
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
1395
1429
|
* when it served no session or the session predates surface recording.
|
|
1396
1430
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
1397
1431
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
1398
1432
|
*/
|
|
1399
|
-
surface:
|
|
1400
|
-
inputTokens:
|
|
1401
|
-
outputTokens:
|
|
1433
|
+
surface: z37.string().nullable(),
|
|
1434
|
+
inputTokens: z37.number(),
|
|
1435
|
+
outputTokens: z37.number(),
|
|
1402
1436
|
/** Subset of inputTokens, never additional to it. */
|
|
1403
|
-
cachedInputTokens:
|
|
1404
|
-
reasoningTokens:
|
|
1405
|
-
callCount:
|
|
1406
|
-
errorCount:
|
|
1407
|
-
estimatedCostUsd:
|
|
1437
|
+
cachedInputTokens: z37.number(),
|
|
1438
|
+
reasoningTokens: z37.number(),
|
|
1439
|
+
callCount: z37.number(),
|
|
1440
|
+
errorCount: z37.number(),
|
|
1441
|
+
estimatedCostUsd: z37.number().nullable()
|
|
1408
1442
|
});
|
|
1409
|
-
var LlmUsageBySessionSchema =
|
|
1410
|
-
sessionId:
|
|
1411
|
-
environment:
|
|
1412
|
-
model:
|
|
1443
|
+
var LlmUsageBySessionSchema = z37.object({
|
|
1444
|
+
sessionId: z37.string(),
|
|
1445
|
+
environment: z37.string(),
|
|
1446
|
+
model: z37.string(),
|
|
1413
1447
|
/** The space this session belongs to, or null for a session with no space. */
|
|
1414
|
-
spaceId:
|
|
1448
|
+
spaceId: z37.string().nullable(),
|
|
1415
1449
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
1416
|
-
surface:
|
|
1450
|
+
surface: z37.string().nullable(),
|
|
1417
1451
|
/** Label only — the first feature seen in the session. */
|
|
1418
|
-
firstFeature:
|
|
1419
|
-
startedAt:
|
|
1420
|
-
endedAt:
|
|
1421
|
-
inputTokens:
|
|
1422
|
-
outputTokens:
|
|
1423
|
-
cachedInputTokens:
|
|
1424
|
-
reasoningTokens:
|
|
1425
|
-
callCount:
|
|
1426
|
-
errorCount:
|
|
1452
|
+
firstFeature: z37.string(),
|
|
1453
|
+
startedAt: z37.string(),
|
|
1454
|
+
endedAt: z37.string(),
|
|
1455
|
+
inputTokens: z37.number(),
|
|
1456
|
+
outputTokens: z37.number(),
|
|
1457
|
+
cachedInputTokens: z37.number(),
|
|
1458
|
+
reasoningTokens: z37.number(),
|
|
1459
|
+
callCount: z37.number(),
|
|
1460
|
+
errorCount: z37.number(),
|
|
1427
1461
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
1428
1462
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
1429
1463
|
* the model is unpriced; never 0, which would read as free. */
|
|
1430
|
-
estimatedCostUsd:
|
|
1464
|
+
estimatedCostUsd: z37.number().nullable()
|
|
1431
1465
|
});
|
|
1432
|
-
var LlmSessionsDailySchema =
|
|
1433
|
-
day:
|
|
1434
|
-
environment:
|
|
1435
|
-
sessionCount:
|
|
1466
|
+
var LlmSessionsDailySchema = z37.object({
|
|
1467
|
+
day: z37.string(),
|
|
1468
|
+
environment: z37.string(),
|
|
1469
|
+
sessionCount: z37.number()
|
|
1436
1470
|
});
|
|
1437
1471
|
|
|
1438
1472
|
// ../spacestation/src/space/session-queue.ts
|
|
1439
|
-
import { z as
|
|
1473
|
+
import { z as z39 } from "zod";
|
|
1440
1474
|
|
|
1441
1475
|
// ../spacestation/src/space/session-activity.ts
|
|
1442
|
-
import { z as
|
|
1443
|
-
var SessionActivityEventSchema =
|
|
1444
|
-
id:
|
|
1445
|
-
kind:
|
|
1446
|
-
occurredAt:
|
|
1447
|
-
source:
|
|
1448
|
-
surface:
|
|
1449
|
-
payload:
|
|
1476
|
+
import { z as z38 } from "zod";
|
|
1477
|
+
var SessionActivityEventSchema = z38.object({
|
|
1478
|
+
id: z38.string(),
|
|
1479
|
+
kind: z38.string(),
|
|
1480
|
+
occurredAt: z38.string(),
|
|
1481
|
+
source: z38.string(),
|
|
1482
|
+
surface: z38.string(),
|
|
1483
|
+
payload: z38.record(z38.unknown())
|
|
1450
1484
|
});
|
|
1451
|
-
var SessionActivitySchema =
|
|
1452
|
-
events:
|
|
1453
|
-
hasMore:
|
|
1485
|
+
var SessionActivitySchema = z38.object({
|
|
1486
|
+
events: z38.array(SessionActivityEventSchema),
|
|
1487
|
+
hasMore: z38.boolean()
|
|
1454
1488
|
});
|
|
1455
1489
|
|
|
1456
1490
|
// ../spacestation/src/space/session-queue.ts
|
|
1457
|
-
var SessionVerdictSchema =
|
|
1458
|
-
var RecordableVerdictSchema =
|
|
1459
|
-
var SessionReviewEventSchema =
|
|
1460
|
-
id:
|
|
1491
|
+
var SessionVerdictSchema = z39.enum(["unreviewed", "viewed", "bug"]);
|
|
1492
|
+
var RecordableVerdictSchema = z39.enum(["viewed", "bug"]);
|
|
1493
|
+
var SessionReviewEventSchema = z39.object({
|
|
1494
|
+
id: z39.string().uuid(),
|
|
1461
1495
|
verdict: RecordableVerdictSchema,
|
|
1462
1496
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
1463
1497
|
* log is append-only rather than a mutable current-state row. */
|
|
1464
|
-
reviewer:
|
|
1465
|
-
note:
|
|
1466
|
-
createdAt:
|
|
1498
|
+
reviewer: z39.string(),
|
|
1499
|
+
note: z39.string().nullable(),
|
|
1500
|
+
createdAt: z39.string()
|
|
1467
1501
|
});
|
|
1468
|
-
var BugSeveritySchema =
|
|
1469
|
-
var BugLocationSchema =
|
|
1470
|
-
elementId:
|
|
1502
|
+
var BugSeveritySchema = z39.enum(["high", "medium", "low"]);
|
|
1503
|
+
var BugLocationSchema = z39.object({
|
|
1504
|
+
elementId: z39.string().nullable(),
|
|
1471
1505
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
1472
1506
|
* alongside a null `elementId`. */
|
|
1473
|
-
elementType:
|
|
1507
|
+
elementType: z39.string().nullable(),
|
|
1474
1508
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
1475
|
-
offsetXPct:
|
|
1476
|
-
offsetYPct:
|
|
1509
|
+
offsetXPct: z39.number().min(0).max(100).nullable(),
|
|
1510
|
+
offsetYPct: z39.number().min(0).max(100).nullable(),
|
|
1477
1511
|
/**
|
|
1478
1512
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
1479
1513
|
* element anchor.
|
|
@@ -1484,8 +1518,8 @@ var BugLocationSchema = z38.object({
|
|
|
1484
1518
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
1485
1519
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
1486
1520
|
*/
|
|
1487
|
-
pageX:
|
|
1488
|
-
pageY:
|
|
1521
|
+
pageX: z39.number().nullable(),
|
|
1522
|
+
pageY: z39.number().nullable()
|
|
1489
1523
|
}).refine(
|
|
1490
1524
|
(loc) => {
|
|
1491
1525
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -1499,24 +1533,24 @@ var BugLocationSchema = z38.object({
|
|
|
1499
1533
|
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)"
|
|
1500
1534
|
}
|
|
1501
1535
|
);
|
|
1502
|
-
var SessionBugSchema =
|
|
1503
|
-
id:
|
|
1536
|
+
var SessionBugSchema = z39.object({
|
|
1537
|
+
id: z39.string().uuid(),
|
|
1504
1538
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
1505
|
-
turnIndex:
|
|
1539
|
+
turnIndex: z39.number().int().nullable(),
|
|
1506
1540
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
1507
1541
|
* without pinning a spot. */
|
|
1508
1542
|
location: BugLocationSchema.nullable(),
|
|
1509
|
-
provider:
|
|
1510
|
-
issueKey:
|
|
1511
|
-
issueUrl:
|
|
1543
|
+
provider: z39.string(),
|
|
1544
|
+
issueKey: z39.string().nullable(),
|
|
1545
|
+
issueUrl: z39.string().nullable(),
|
|
1512
1546
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
1513
1547
|
* open text. Null until first synced. */
|
|
1514
|
-
issueState:
|
|
1515
|
-
title:
|
|
1516
|
-
body:
|
|
1548
|
+
issueState: z39.string().nullable(),
|
|
1549
|
+
title: z39.string(),
|
|
1550
|
+
body: z39.string(),
|
|
1517
1551
|
severity: BugSeveritySchema,
|
|
1518
|
-
createdBy:
|
|
1519
|
-
createdAt:
|
|
1552
|
+
createdBy: z39.string(),
|
|
1553
|
+
createdAt: z39.string(),
|
|
1520
1554
|
/**
|
|
1521
1555
|
* When this bug was resolved from the console; null means still OPEN.
|
|
1522
1556
|
*
|
|
@@ -1525,55 +1559,55 @@ var SessionBugSchema = z38.object({
|
|
|
1525
1559
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
1526
1560
|
* no boolean can contradict it.
|
|
1527
1561
|
*/
|
|
1528
|
-
resolvedAt:
|
|
1529
|
-
resolvedBy:
|
|
1562
|
+
resolvedAt: z39.string().nullable(),
|
|
1563
|
+
resolvedBy: z39.string().nullable()
|
|
1530
1564
|
});
|
|
1531
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
1532
|
-
var SessionCommentSchema =
|
|
1533
|
-
id:
|
|
1565
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z39.string() });
|
|
1566
|
+
var SessionCommentSchema = z39.object({
|
|
1567
|
+
id: z39.string().uuid(),
|
|
1534
1568
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
1535
|
-
bugId:
|
|
1569
|
+
bugId: z39.string().uuid().nullable(),
|
|
1536
1570
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
1537
1571
|
* parent bug's turn). */
|
|
1538
|
-
turnIndex:
|
|
1572
|
+
turnIndex: z39.number().int().nullable(),
|
|
1539
1573
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
1540
1574
|
location: BugLocationSchema.nullable(),
|
|
1541
|
-
body:
|
|
1542
|
-
createdBy:
|
|
1543
|
-
createdAt:
|
|
1575
|
+
body: z39.string(),
|
|
1576
|
+
createdBy: z39.string(),
|
|
1577
|
+
createdAt: z39.string()
|
|
1544
1578
|
});
|
|
1545
|
-
var CreateCommentInputSchema =
|
|
1546
|
-
bugId:
|
|
1547
|
-
turnIndex:
|
|
1579
|
+
var CreateCommentInputSchema = z39.object({
|
|
1580
|
+
bugId: z39.string().uuid().nullable(),
|
|
1581
|
+
turnIndex: z39.number().int().positive().nullable(),
|
|
1548
1582
|
location: BugLocationSchema.nullable(),
|
|
1549
1583
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
1550
1584
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
1551
|
-
body:
|
|
1585
|
+
body: z39.string().trim().min(1)
|
|
1552
1586
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
1553
1587
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
1554
1588
|
});
|
|
1555
|
-
var UpdateCommentInputSchema =
|
|
1556
|
-
body:
|
|
1557
|
-
bugId:
|
|
1589
|
+
var UpdateCommentInputSchema = z39.object({
|
|
1590
|
+
body: z39.string().trim().min(1).optional(),
|
|
1591
|
+
bugId: z39.string().uuid().nullable().optional(),
|
|
1558
1592
|
location: BugLocationSchema.nullable().optional()
|
|
1559
1593
|
});
|
|
1560
|
-
var SessionFormFactorSchema =
|
|
1561
|
-
var SessionSummarySchema =
|
|
1562
|
-
sessionId:
|
|
1594
|
+
var SessionFormFactorSchema = z39.enum(["mobile", "desktop"]).nullable();
|
|
1595
|
+
var SessionSummarySchema = z39.object({
|
|
1596
|
+
sessionId: z39.string(),
|
|
1563
1597
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
1564
1598
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
1565
|
-
visitorId:
|
|
1599
|
+
visitorId: z39.string().nullable(),
|
|
1566
1600
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
1567
1601
|
* identified themselves. Both null together means "not identified yet". */
|
|
1568
|
-
identityProvider:
|
|
1569
|
-
identityKey:
|
|
1602
|
+
identityProvider: z39.string().nullable(),
|
|
1603
|
+
identityKey: z39.string().nullable(),
|
|
1570
1604
|
/** Team/test traffic. The queue hides these by default. */
|
|
1571
|
-
isInternal:
|
|
1605
|
+
isInternal: z39.boolean(),
|
|
1572
1606
|
/** Build that served the session. Null = not captured; a version filter must
|
|
1573
1607
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
1574
|
-
clientVersion:
|
|
1608
|
+
clientVersion: z39.string().nullable(),
|
|
1575
1609
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
1576
|
-
signalCounts:
|
|
1610
|
+
signalCounts: z39.record(z39.number()),
|
|
1577
1611
|
/**
|
|
1578
1612
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
1579
1613
|
*
|
|
@@ -1590,7 +1624,7 @@ var SessionSummarySchema = z38.object({
|
|
|
1590
1624
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
1591
1625
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
1592
1626
|
*/
|
|
1593
|
-
conversionAttempts:
|
|
1627
|
+
conversionAttempts: z39.number().int().nullable(),
|
|
1594
1628
|
/**
|
|
1595
1629
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
1596
1630
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -1606,7 +1640,7 @@ var SessionSummarySchema = z38.object({
|
|
|
1606
1640
|
* kinds together, and one attempt id appearing under both would be counted
|
|
1607
1641
|
* once there and twice here.
|
|
1608
1642
|
*/
|
|
1609
|
-
conversionKinds:
|
|
1643
|
+
conversionKinds: z39.record(z39.number()),
|
|
1610
1644
|
/**
|
|
1611
1645
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
1612
1646
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -1614,20 +1648,20 @@ var SessionSummarySchema = z38.object({
|
|
|
1614
1648
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
1615
1649
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
1616
1650
|
*/
|
|
1617
|
-
funnelSteps:
|
|
1651
|
+
funnelSteps: z39.array(z39.string()),
|
|
1618
1652
|
/**
|
|
1619
1653
|
* The connector's opaque handle for what this session produced in its back
|
|
1620
1654
|
* office — present only once a checkout actually reached the platform. The
|
|
1621
1655
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
1622
1656
|
*/
|
|
1623
|
-
backOfficeRef:
|
|
1657
|
+
backOfficeRef: z39.string().nullable(),
|
|
1624
1658
|
/**
|
|
1625
1659
|
* The order this session produced, when the connector's back office reported
|
|
1626
1660
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
1627
1661
|
* Both null when no order is known — the cart handle above is then the door.
|
|
1628
1662
|
*/
|
|
1629
|
-
orderRef:
|
|
1630
|
-
orderLabel:
|
|
1663
|
+
orderRef: z39.string().nullable(),
|
|
1664
|
+
orderLabel: z39.string().nullable(),
|
|
1631
1665
|
/**
|
|
1632
1666
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
1633
1667
|
* needs.
|
|
@@ -1640,12 +1674,12 @@ var SessionSummarySchema = z38.object({
|
|
|
1640
1674
|
* on a desktop are not the same session.
|
|
1641
1675
|
*/
|
|
1642
1676
|
formFactor: SessionFormFactorSchema,
|
|
1643
|
-
turnCount:
|
|
1677
|
+
turnCount: z39.number().int(),
|
|
1644
1678
|
/** The visitor's opening message — the single most informative field for
|
|
1645
1679
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
1646
|
-
firstPrompt:
|
|
1647
|
-
startedAt:
|
|
1648
|
-
lastRunAt:
|
|
1680
|
+
firstPrompt: z39.string(),
|
|
1681
|
+
startedAt: z39.string(),
|
|
1682
|
+
lastRunAt: z39.string(),
|
|
1649
1683
|
/**
|
|
1650
1684
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
1651
1685
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -1673,7 +1707,7 @@ var SessionSummarySchema = z38.object({
|
|
|
1673
1707
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
1674
1708
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
1675
1709
|
*/
|
|
1676
|
-
visitorTimeZone:
|
|
1710
|
+
visitorTimeZone: z39.string().nullable(),
|
|
1677
1711
|
/**
|
|
1678
1712
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
1679
1713
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -1681,31 +1715,31 @@ var SessionSummarySchema = z38.object({
|
|
|
1681
1715
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
1682
1716
|
* already reading. Null when no turn in the session recorded a patch.
|
|
1683
1717
|
*/
|
|
1684
|
-
avgTtftMs:
|
|
1718
|
+
avgTtftMs: z39.number().int().nullable(),
|
|
1685
1719
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
1686
1720
|
* a budget: null on sessions older than the mark's recording. */
|
|
1687
|
-
avgMainDoneMs:
|
|
1721
|
+
avgMainDoneMs: z39.number().int().nullable(),
|
|
1688
1722
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
1689
1723
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
1690
|
-
avgChipGenMs:
|
|
1691
|
-
totalLatencyMs:
|
|
1692
|
-
durationMs:
|
|
1724
|
+
avgChipGenMs: z39.number().int().nullable(),
|
|
1725
|
+
totalLatencyMs: z39.number().int(),
|
|
1726
|
+
durationMs: z39.number().int(),
|
|
1693
1727
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
1694
1728
|
* live session streams and cannot be given a verdict until it ends. */
|
|
1695
|
-
isLive:
|
|
1729
|
+
isLive: z39.boolean(),
|
|
1696
1730
|
verdict: SessionVerdictSchema,
|
|
1697
|
-
reviewedBy:
|
|
1698
|
-
reviewedAt:
|
|
1731
|
+
reviewedBy: z39.string().nullable(),
|
|
1732
|
+
reviewedAt: z39.string().nullable(),
|
|
1699
1733
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
1700
1734
|
* state without a second request. */
|
|
1701
|
-
bugIssueKey:
|
|
1702
|
-
bugIssueUrl:
|
|
1703
|
-
bugIssueState:
|
|
1735
|
+
bugIssueKey: z39.string().nullable(),
|
|
1736
|
+
bugIssueUrl: z39.string().nullable(),
|
|
1737
|
+
bugIssueState: z39.string().nullable()
|
|
1704
1738
|
});
|
|
1705
|
-
var SessionQueuePageSchema =
|
|
1706
|
-
sessions:
|
|
1707
|
-
totalCount:
|
|
1708
|
-
hiddenInternalCount:
|
|
1739
|
+
var SessionQueuePageSchema = z39.object({
|
|
1740
|
+
sessions: z39.array(SessionSummarySchema),
|
|
1741
|
+
totalCount: z39.number().int(),
|
|
1742
|
+
hiddenInternalCount: z39.number().int(),
|
|
1709
1743
|
/**
|
|
1710
1744
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
1711
1745
|
*
|
|
@@ -1715,68 +1749,73 @@ var SessionQueuePageSchema = z38.object({
|
|
|
1715
1749
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
1716
1750
|
* analytics dashboard's bounce over the same window.
|
|
1717
1751
|
*/
|
|
1718
|
-
hiddenBouncedCount:
|
|
1752
|
+
hiddenBouncedCount: z39.number().int()
|
|
1719
1753
|
});
|
|
1720
|
-
var SessionQueueFacetsSchema =
|
|
1721
|
-
review:
|
|
1722
|
-
version:
|
|
1723
|
-
turns:
|
|
1724
|
-
durationS:
|
|
1754
|
+
var SessionQueueFacetsSchema = z39.object({
|
|
1755
|
+
review: z39.record(z39.number()),
|
|
1756
|
+
version: z39.record(z39.number()),
|
|
1757
|
+
turns: z39.record(z39.number()),
|
|
1758
|
+
durationS: z39.record(z39.number()),
|
|
1725
1759
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
1726
|
-
funnel:
|
|
1760
|
+
funnel: z39.record(z39.number())
|
|
1727
1761
|
});
|
|
1728
|
-
var SessionCaptureSchema =
|
|
1729
|
-
viewportWidth:
|
|
1730
|
-
viewportHeight:
|
|
1731
|
-
userAgent:
|
|
1732
|
-
locale:
|
|
1762
|
+
var SessionCaptureSchema = z39.object({
|
|
1763
|
+
viewportWidth: z39.number().int().nullable(),
|
|
1764
|
+
viewportHeight: z39.number().int().nullable(),
|
|
1765
|
+
userAgent: z39.string().nullable(),
|
|
1766
|
+
locale: z39.string().nullable(),
|
|
1733
1767
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
1734
|
-
referrer:
|
|
1768
|
+
referrer: z39.string().nullable()
|
|
1735
1769
|
});
|
|
1736
|
-
var SessionCaptureInputSchema =
|
|
1737
|
-
viewportWidth:
|
|
1738
|
-
viewportHeight:
|
|
1739
|
-
userAgent:
|
|
1740
|
-
locale:
|
|
1770
|
+
var SessionCaptureInputSchema = z39.object({
|
|
1771
|
+
viewportWidth: z39.number().int().positive().max(2e4).optional(),
|
|
1772
|
+
viewportHeight: z39.number().int().positive().max(2e4).optional(),
|
|
1773
|
+
userAgent: z39.string().max(1e3).optional(),
|
|
1774
|
+
locale: z39.string().max(35).optional(),
|
|
1741
1775
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
1742
1776
|
* the zone database grows, and refusing a name this build has not heard of
|
|
1743
1777
|
* would drop a real session's capture over a table that is out of date. */
|
|
1744
|
-
timeZone:
|
|
1745
|
-
referrer:
|
|
1746
|
-
clientVersion:
|
|
1747
|
-
isInternal:
|
|
1778
|
+
timeZone: z39.string().max(64).optional(),
|
|
1779
|
+
referrer: z39.string().max(2048).optional(),
|
|
1780
|
+
clientVersion: z39.string().max(100).optional(),
|
|
1781
|
+
isInternal: z39.boolean().optional()
|
|
1748
1782
|
});
|
|
1749
|
-
var SessionDetailSchema =
|
|
1783
|
+
var SessionDetailSchema = z39.object({
|
|
1750
1784
|
session: SessionSummarySchema,
|
|
1751
1785
|
capture: SessionCaptureSchema,
|
|
1752
1786
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
1753
1787
|
* re-judged after a fix is the evidence the fix worked. */
|
|
1754
|
-
reviews:
|
|
1755
|
-
bugs:
|
|
1756
|
-
comments:
|
|
1788
|
+
reviews: z39.array(SessionReviewEventSchema),
|
|
1789
|
+
bugs: z39.array(SessionBugSchema),
|
|
1790
|
+
comments: z39.array(SessionCommentSchema),
|
|
1757
1791
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
1758
1792
|
* not evidence of zero visitor activity. */
|
|
1759
1793
|
activity: SessionActivitySchema.optional()
|
|
1760
1794
|
});
|
|
1761
|
-
var RecordVerdictInputSchema =
|
|
1795
|
+
var RecordVerdictInputSchema = z39.object({
|
|
1762
1796
|
verdict: RecordableVerdictSchema,
|
|
1763
|
-
note:
|
|
1797
|
+
note: z39.string().max(2e3).optional()
|
|
1764
1798
|
});
|
|
1765
|
-
var FileBugInputSchema =
|
|
1766
|
-
turnIndex:
|
|
1799
|
+
var FileBugInputSchema = z39.object({
|
|
1800
|
+
turnIndex: z39.number().int().positive().nullable(),
|
|
1767
1801
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
1768
1802
|
location: BugLocationSchema.nullable().optional(),
|
|
1769
|
-
title:
|
|
1770
|
-
body:
|
|
1803
|
+
title: z39.string().min(1).max(300),
|
|
1804
|
+
body: z39.string().min(1),
|
|
1771
1805
|
severity: BugSeveritySchema,
|
|
1772
|
-
payload:
|
|
1806
|
+
payload: z39.record(z39.unknown())
|
|
1773
1807
|
});
|
|
1774
1808
|
export {
|
|
1775
1809
|
EMPTY_SPEC,
|
|
1810
|
+
HostExportsSchema,
|
|
1776
1811
|
PackageReleaseSchema,
|
|
1812
|
+
RELEASE_MESSAGE_MAX,
|
|
1813
|
+
ReleaseMessageSchema,
|
|
1777
1814
|
WIRE_PROTOCOL_PARAM,
|
|
1778
1815
|
WIRE_PROTOCOL_VERSION,
|
|
1779
1816
|
applySinglePatch,
|
|
1780
1817
|
carriesShapeToken,
|
|
1781
|
-
catalogToWire
|
|
1818
|
+
catalogToWire,
|
|
1819
|
+
hostImportProblems,
|
|
1820
|
+
hostImportsRefusal
|
|
1782
1821
|
};
|