@40rty/ams-cli 0.5.6 → 0.5.8
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 +77 -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 +224 -0
- package/dist/wire.js +398 -344
- 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,36 +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);
|
|
1082
|
+
|
|
1083
|
+
// ../spacestation/src/attachment/attachment-failure.ts
|
|
1084
|
+
var MAX_ATTACHMENT_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
|
|
1048
1085
|
|
|
1049
1086
|
// ../spacestation/src/contracts/entry-context.ts
|
|
1050
|
-
import { z as
|
|
1087
|
+
import { z as z32 } from "zod";
|
|
1051
1088
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
1052
1089
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
1053
1090
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
1054
1091
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
1055
|
-
var EntryContextValueSchema =
|
|
1056
|
-
var EntryContextNameSchema =
|
|
1057
|
-
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, {
|
|
1058
1095
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
1059
1096
|
});
|
|
1060
|
-
var EntryContextSchema =
|
|
1097
|
+
var EntryContextSchema = z32.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
1061
1098
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
1062
1099
|
});
|
|
1063
1100
|
|
|
1064
1101
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
1065
|
-
import { z as
|
|
1102
|
+
import { z as z33 } from "zod";
|
|
1066
1103
|
var SURFACES = [
|
|
1067
1104
|
"spacefront",
|
|
1068
1105
|
"embed",
|
|
@@ -1072,11 +1109,11 @@ var SURFACES = [
|
|
|
1072
1109
|
"playground",
|
|
1073
1110
|
"automation"
|
|
1074
1111
|
];
|
|
1075
|
-
var SurfaceSchema =
|
|
1112
|
+
var SurfaceSchema = z33.enum(SURFACES);
|
|
1076
1113
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
1077
|
-
var ClickIdKindSchema =
|
|
1114
|
+
var ClickIdKindSchema = z33.enum(CLICK_ID_KINDS);
|
|
1078
1115
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
1079
|
-
var VisitorIdDurabilitySchema =
|
|
1116
|
+
var VisitorIdDurabilitySchema = z33.enum(VISITOR_ID_DURABILITIES);
|
|
1080
1117
|
var TRAFFIC_BUCKETS = [
|
|
1081
1118
|
"paid_google",
|
|
1082
1119
|
"paid_meta",
|
|
@@ -1088,10 +1125,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
1088
1125
|
"direct",
|
|
1089
1126
|
"unknown"
|
|
1090
1127
|
];
|
|
1091
|
-
var TrafficBucketSchema =
|
|
1128
|
+
var TrafficBucketSchema = z33.enum(TRAFFIC_BUCKETS);
|
|
1092
1129
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
1093
|
-
var ArrivalValueSchema =
|
|
1094
|
-
var SessionArrivalSchema =
|
|
1130
|
+
var ArrivalValueSchema = z33.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
1131
|
+
var SessionArrivalSchema = z33.object({
|
|
1095
1132
|
utmSource: ArrivalValueSchema.optional(),
|
|
1096
1133
|
utmMedium: ArrivalValueSchema.optional(),
|
|
1097
1134
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -1129,82 +1166,94 @@ var WIRE_PROTOCOL_VERSION = 1;
|
|
|
1129
1166
|
var WIRE_PROTOCOL_PARAM = "protocol";
|
|
1130
1167
|
|
|
1131
1168
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
1132
|
-
import { z as
|
|
1133
|
-
var AttributeScopeBucketSchema =
|
|
1134
|
-
scope:
|
|
1135
|
-
needles:
|
|
1136
|
-
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()
|
|
1137
1174
|
});
|
|
1138
|
-
var AttributeScopeConfigSchema =
|
|
1139
|
-
facet:
|
|
1140
|
-
buckets:
|
|
1141
|
-
emptyScope:
|
|
1142
|
-
noMatchScope:
|
|
1143
|
-
ignoreValues:
|
|
1144
|
-
emptyScopeLabel:
|
|
1145
|
-
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()
|
|
1146
1183
|
});
|
|
1147
|
-
var AttributeDefBaseSchema =
|
|
1148
|
-
description:
|
|
1149
|
-
durable:
|
|
1150
|
-
label:
|
|
1184
|
+
var AttributeDefBaseSchema = z34.object({
|
|
1185
|
+
description: z34.string().optional(),
|
|
1186
|
+
durable: z34.boolean().optional(),
|
|
1187
|
+
label: z34.string().optional()
|
|
1151
1188
|
});
|
|
1152
|
-
var AttributeDefSchema =
|
|
1153
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1154
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1155
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1156
|
-
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") }),
|
|
1157
1194
|
AttributeDefBaseSchema.extend({
|
|
1158
|
-
kind:
|
|
1159
|
-
min:
|
|
1160
|
-
max:
|
|
1161
|
-
unit:
|
|
1195
|
+
kind: z34.literal("number"),
|
|
1196
|
+
min: z34.number().optional(),
|
|
1197
|
+
max: z34.number().optional(),
|
|
1198
|
+
unit: z34.string().optional()
|
|
1162
1199
|
})
|
|
1163
1200
|
]);
|
|
1164
1201
|
|
|
1165
1202
|
// ../spacestation/src/space/agent-directive.ts
|
|
1166
|
-
import { z as
|
|
1203
|
+
import { z as z35 } from "zod";
|
|
1167
1204
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
1168
1205
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
1169
1206
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
1170
1207
|
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
1171
|
-
var AgentDirectiveSchema =
|
|
1172
|
-
name:
|
|
1173
|
-
kind:
|
|
1174
|
-
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),
|
|
1175
1212
|
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
1176
1213
|
* product name. */
|
|
1177
|
-
text:
|
|
1214
|
+
text: z35.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
1178
1215
|
}).strict();
|
|
1179
|
-
var SpaceAgentDirectiveSchema =
|
|
1180
|
-
id:
|
|
1181
|
-
position:
|
|
1182
|
-
name:
|
|
1183
|
-
kind:
|
|
1184
|
-
severity:
|
|
1185
|
-
text:
|
|
1186
|
-
source:
|
|
1187
|
-
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),
|
|
1188
1225
|
/** Who wrote it; null for a lesson the system proposed. */
|
|
1189
|
-
createdBy:
|
|
1226
|
+
createdBy: z35.string().nullable(),
|
|
1190
1227
|
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
1191
|
-
evidence:
|
|
1192
|
-
decidedBy:
|
|
1193
|
-
decidedAt:
|
|
1194
|
-
createdAt:
|
|
1228
|
+
evidence: z35.record(z35.unknown()).nullable(),
|
|
1229
|
+
decidedBy: z35.string().nullable(),
|
|
1230
|
+
decidedAt: z35.string().nullable(),
|
|
1231
|
+
createdAt: z35.string()
|
|
1195
1232
|
});
|
|
1196
|
-
var OutcomeTallySchema =
|
|
1233
|
+
var OutcomeTallySchema = z35.object({ turns: z35.number().int(), acted: z35.number().int() });
|
|
1197
1234
|
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
1198
|
-
impact:
|
|
1235
|
+
impact: z35.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
1199
1236
|
});
|
|
1200
|
-
var UpdateAgentDirectiveInputSchema =
|
|
1237
|
+
var UpdateAgentDirectiveInputSchema = z35.object({
|
|
1201
1238
|
name: AgentDirectiveSchema.shape.name.optional(),
|
|
1202
1239
|
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
1203
1240
|
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
1204
1241
|
text: AgentDirectiveSchema.shape.text.optional(),
|
|
1205
|
-
status:
|
|
1242
|
+
status: z35.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
1206
1243
|
}).strict();
|
|
1207
|
-
var ReorderAgentDirectivesInputSchema =
|
|
1244
|
+
var ReorderAgentDirectivesInputSchema = z35.object({ ids: z35.array(z35.string()).min(1) }).strict();
|
|
1245
|
+
|
|
1246
|
+
// ../spacestation/src/space/space-locale.ts
|
|
1247
|
+
import { z as z36 } from "zod";
|
|
1248
|
+
function isBcp47(tag) {
|
|
1249
|
+
try {
|
|
1250
|
+
return new Intl.Locale(tag).language.length > 0;
|
|
1251
|
+
} catch (err) {
|
|
1252
|
+
if (err instanceof RangeError) return false;
|
|
1253
|
+
throw err;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
var SpaceLocaleSchema = z36.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
1208
1257
|
|
|
1209
1258
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
1210
1259
|
var COMPONENT_SOURCE = {
|
|
@@ -1234,30 +1283,30 @@ var DEFAULT_SPACE_CONFIG = {
|
|
|
1234
1283
|
};
|
|
1235
1284
|
|
|
1236
1285
|
// ../spacestation/src/space/trace.ts
|
|
1237
|
-
import { z as
|
|
1238
|
-
var RunTokenUsageSchema =
|
|
1239
|
-
input_tokens:
|
|
1240
|
-
output_tokens:
|
|
1241
|
-
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()
|
|
1242
1291
|
});
|
|
1243
|
-
var TraceRecordSchema =
|
|
1244
|
-
id:
|
|
1245
|
-
spaceId:
|
|
1246
|
-
sessionId:
|
|
1292
|
+
var TraceRecordSchema = z37.object({
|
|
1293
|
+
id: z37.string().uuid(),
|
|
1294
|
+
spaceId: z37.string().uuid().nullable(),
|
|
1295
|
+
sessionId: z37.string(),
|
|
1247
1296
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
1248
1297
|
* for an unlocked space / anonymous unlock. */
|
|
1249
|
-
visitorEmail:
|
|
1250
|
-
userPrompt:
|
|
1251
|
-
branch:
|
|
1252
|
-
responseText:
|
|
1253
|
-
layout:
|
|
1254
|
-
phaseTimings:
|
|
1255
|
-
tokensByModel:
|
|
1256
|
-
toolCalls:
|
|
1257
|
-
diagnostics:
|
|
1258
|
-
latencyFirstText:
|
|
1259
|
-
latencyFirstPatch:
|
|
1260
|
-
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(),
|
|
1261
1310
|
/**
|
|
1262
1311
|
* The CLIENT's turn id for this run, or `null`.
|
|
1263
1312
|
*
|
|
@@ -1273,29 +1322,29 @@ var TraceRecordSchema = z35.object({
|
|
|
1273
1322
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1274
1323
|
* visitor asked something and got nothing.
|
|
1275
1324
|
*/
|
|
1276
|
-
turnId:
|
|
1325
|
+
turnId: z37.string().nullable(),
|
|
1277
1326
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
1278
1327
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
1279
|
-
trackerState:
|
|
1280
|
-
createdAt:
|
|
1328
|
+
trackerState: z37.unknown().nullable(),
|
|
1329
|
+
createdAt: z37.string()
|
|
1281
1330
|
});
|
|
1282
|
-
var MillisecondsSchema =
|
|
1283
|
-
var CreateTraceInputSchema =
|
|
1284
|
-
spaceId:
|
|
1285
|
-
sessionId:
|
|
1286
|
-
visitorEmail:
|
|
1287
|
-
userPrompt:
|
|
1288
|
-
branch:
|
|
1289
|
-
responseText:
|
|
1290
|
-
layout:
|
|
1291
|
-
phaseTimings:
|
|
1292
|
-
tokensByModel:
|
|
1293
|
-
toolCalls:
|
|
1294
|
-
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(),
|
|
1295
1344
|
latencyFirstText: MillisecondsSchema,
|
|
1296
1345
|
latencyFirstPatch: MillisecondsSchema,
|
|
1297
1346
|
latencyTotal: MillisecondsSchema,
|
|
1298
|
-
trackerState:
|
|
1347
|
+
trackerState: z37.unknown().nullable(),
|
|
1299
1348
|
/**
|
|
1300
1349
|
* The CLIENT's turn id for this run, or `null`.
|
|
1301
1350
|
*
|
|
@@ -1311,37 +1360,37 @@ var CreateTraceInputSchema = z35.object({
|
|
|
1311
1360
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1312
1361
|
* visitor asked something and got nothing.
|
|
1313
1362
|
*/
|
|
1314
|
-
turnId:
|
|
1363
|
+
turnId: z37.string().nullable()
|
|
1315
1364
|
});
|
|
1316
|
-
var AgentSessionSummarySchema =
|
|
1317
|
-
sessionId:
|
|
1365
|
+
var AgentSessionSummarySchema = z37.object({
|
|
1366
|
+
sessionId: z37.string(),
|
|
1318
1367
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
1319
|
-
turnCount:
|
|
1368
|
+
turnCount: z37.number().int(),
|
|
1320
1369
|
/** The session's opening prompt — titles the row in the UI. */
|
|
1321
|
-
firstPrompt:
|
|
1322
|
-
startedAt:
|
|
1323
|
-
lastRunAt:
|
|
1370
|
+
firstPrompt: z37.string(),
|
|
1371
|
+
startedAt: z37.string(),
|
|
1372
|
+
lastRunAt: z37.string(),
|
|
1324
1373
|
/** Summed `latency_total` across the session's turns. */
|
|
1325
|
-
totalLatencyMs:
|
|
1374
|
+
totalLatencyMs: z37.number().int()
|
|
1326
1375
|
});
|
|
1327
|
-
var SessionTurnSchema =
|
|
1328
|
-
id:
|
|
1329
|
-
userPrompt:
|
|
1330
|
-
responseText:
|
|
1376
|
+
var SessionTurnSchema = z37.object({
|
|
1377
|
+
id: z37.string().uuid(),
|
|
1378
|
+
userPrompt: z37.string(),
|
|
1379
|
+
responseText: z37.string().nullable(),
|
|
1331
1380
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
1332
|
-
layout:
|
|
1333
|
-
createdAt:
|
|
1334
|
-
latencyTotal:
|
|
1335
|
-
phaseTimings:
|
|
1336
|
-
tokensByModel:
|
|
1337
|
-
input_tokens:
|
|
1338
|
-
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()
|
|
1339
1388
|
})).nullable(),
|
|
1340
|
-
toolCalls:
|
|
1341
|
-
diagnostics:
|
|
1389
|
+
toolCalls: z37.array(z37.unknown()).nullable(),
|
|
1390
|
+
diagnostics: z37.array(z37.unknown()).nullable()
|
|
1342
1391
|
});
|
|
1343
|
-
var SessionReplaySchema =
|
|
1344
|
-
turns:
|
|
1392
|
+
var SessionReplaySchema = z37.object({
|
|
1393
|
+
turns: z37.array(SessionTurnSchema),
|
|
1345
1394
|
/**
|
|
1346
1395
|
* The session's own last-committed layout, read straight off the durable
|
|
1347
1396
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -1352,20 +1401,20 @@ var SessionReplaySchema = z35.object({
|
|
|
1352
1401
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
1353
1402
|
* when the durable session row itself could not be read.
|
|
1354
1403
|
*/
|
|
1355
|
-
sessionLayout:
|
|
1404
|
+
sessionLayout: z37.record(z37.string(), z37.unknown()).nullable()
|
|
1356
1405
|
});
|
|
1357
|
-
var SessionTraceSchema =
|
|
1358
|
-
trackerState:
|
|
1406
|
+
var SessionTraceSchema = z37.object({
|
|
1407
|
+
trackerState: z37.string().nullable()
|
|
1359
1408
|
});
|
|
1360
|
-
var LlmUsageDailySchema =
|
|
1361
|
-
day:
|
|
1409
|
+
var LlmUsageDailySchema = z37.object({
|
|
1410
|
+
day: z37.string(),
|
|
1362
1411
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
1363
|
-
environment:
|
|
1364
|
-
feature:
|
|
1365
|
-
model:
|
|
1366
|
-
provider:
|
|
1412
|
+
environment: z37.string(),
|
|
1413
|
+
feature: z37.string(),
|
|
1414
|
+
model: z37.string(),
|
|
1415
|
+
provider: z37.string(),
|
|
1367
1416
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
1368
|
-
keyFingerprint:
|
|
1417
|
+
keyFingerprint: z37.string().nullable(),
|
|
1369
1418
|
/**
|
|
1370
1419
|
* The space the call served, or null when it served none.
|
|
1371
1420
|
*
|
|
@@ -1374,91 +1423,91 @@ var LlmUsageDailySchema = z35.object({
|
|
|
1374
1423
|
* report that share rather than dropping it, or a per-space total reads as
|
|
1375
1424
|
* the platform total.
|
|
1376
1425
|
*/
|
|
1377
|
-
spaceId:
|
|
1426
|
+
spaceId: z37.string().nullable(),
|
|
1378
1427
|
/**
|
|
1379
1428
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
1380
1429
|
* when it served no session or the session predates surface recording.
|
|
1381
1430
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
1382
1431
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
1383
1432
|
*/
|
|
1384
|
-
surface:
|
|
1385
|
-
inputTokens:
|
|
1386
|
-
outputTokens:
|
|
1433
|
+
surface: z37.string().nullable(),
|
|
1434
|
+
inputTokens: z37.number(),
|
|
1435
|
+
outputTokens: z37.number(),
|
|
1387
1436
|
/** Subset of inputTokens, never additional to it. */
|
|
1388
|
-
cachedInputTokens:
|
|
1389
|
-
reasoningTokens:
|
|
1390
|
-
callCount:
|
|
1391
|
-
errorCount:
|
|
1392
|
-
estimatedCostUsd:
|
|
1437
|
+
cachedInputTokens: z37.number(),
|
|
1438
|
+
reasoningTokens: z37.number(),
|
|
1439
|
+
callCount: z37.number(),
|
|
1440
|
+
errorCount: z37.number(),
|
|
1441
|
+
estimatedCostUsd: z37.number().nullable()
|
|
1393
1442
|
});
|
|
1394
|
-
var LlmUsageBySessionSchema =
|
|
1395
|
-
sessionId:
|
|
1396
|
-
environment:
|
|
1397
|
-
model:
|
|
1443
|
+
var LlmUsageBySessionSchema = z37.object({
|
|
1444
|
+
sessionId: z37.string(),
|
|
1445
|
+
environment: z37.string(),
|
|
1446
|
+
model: z37.string(),
|
|
1398
1447
|
/** The space this session belongs to, or null for a session with no space. */
|
|
1399
|
-
spaceId:
|
|
1448
|
+
spaceId: z37.string().nullable(),
|
|
1400
1449
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
1401
|
-
surface:
|
|
1450
|
+
surface: z37.string().nullable(),
|
|
1402
1451
|
/** Label only — the first feature seen in the session. */
|
|
1403
|
-
firstFeature:
|
|
1404
|
-
startedAt:
|
|
1405
|
-
endedAt:
|
|
1406
|
-
inputTokens:
|
|
1407
|
-
outputTokens:
|
|
1408
|
-
cachedInputTokens:
|
|
1409
|
-
reasoningTokens:
|
|
1410
|
-
callCount:
|
|
1411
|
-
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(),
|
|
1412
1461
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
1413
1462
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
1414
1463
|
* the model is unpriced; never 0, which would read as free. */
|
|
1415
|
-
estimatedCostUsd:
|
|
1464
|
+
estimatedCostUsd: z37.number().nullable()
|
|
1416
1465
|
});
|
|
1417
|
-
var LlmSessionsDailySchema =
|
|
1418
|
-
day:
|
|
1419
|
-
environment:
|
|
1420
|
-
sessionCount:
|
|
1466
|
+
var LlmSessionsDailySchema = z37.object({
|
|
1467
|
+
day: z37.string(),
|
|
1468
|
+
environment: z37.string(),
|
|
1469
|
+
sessionCount: z37.number()
|
|
1421
1470
|
});
|
|
1422
1471
|
|
|
1423
1472
|
// ../spacestation/src/space/session-queue.ts
|
|
1424
|
-
import { z as
|
|
1473
|
+
import { z as z39 } from "zod";
|
|
1425
1474
|
|
|
1426
1475
|
// ../spacestation/src/space/session-activity.ts
|
|
1427
|
-
import { z as
|
|
1428
|
-
var SessionActivityEventSchema =
|
|
1429
|
-
id:
|
|
1430
|
-
kind:
|
|
1431
|
-
occurredAt:
|
|
1432
|
-
source:
|
|
1433
|
-
surface:
|
|
1434
|
-
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())
|
|
1435
1484
|
});
|
|
1436
|
-
var SessionActivitySchema =
|
|
1437
|
-
events:
|
|
1438
|
-
hasMore:
|
|
1485
|
+
var SessionActivitySchema = z38.object({
|
|
1486
|
+
events: z38.array(SessionActivityEventSchema),
|
|
1487
|
+
hasMore: z38.boolean()
|
|
1439
1488
|
});
|
|
1440
1489
|
|
|
1441
1490
|
// ../spacestation/src/space/session-queue.ts
|
|
1442
|
-
var SessionVerdictSchema =
|
|
1443
|
-
var RecordableVerdictSchema =
|
|
1444
|
-
var SessionReviewEventSchema =
|
|
1445
|
-
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(),
|
|
1446
1495
|
verdict: RecordableVerdictSchema,
|
|
1447
1496
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
1448
1497
|
* log is append-only rather than a mutable current-state row. */
|
|
1449
|
-
reviewer:
|
|
1450
|
-
note:
|
|
1451
|
-
createdAt:
|
|
1498
|
+
reviewer: z39.string(),
|
|
1499
|
+
note: z39.string().nullable(),
|
|
1500
|
+
createdAt: z39.string()
|
|
1452
1501
|
});
|
|
1453
|
-
var BugSeveritySchema =
|
|
1454
|
-
var BugLocationSchema =
|
|
1455
|
-
elementId:
|
|
1502
|
+
var BugSeveritySchema = z39.enum(["high", "medium", "low"]);
|
|
1503
|
+
var BugLocationSchema = z39.object({
|
|
1504
|
+
elementId: z39.string().nullable(),
|
|
1456
1505
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
1457
1506
|
* alongside a null `elementId`. */
|
|
1458
|
-
elementType:
|
|
1507
|
+
elementType: z39.string().nullable(),
|
|
1459
1508
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
1460
|
-
offsetXPct:
|
|
1461
|
-
offsetYPct:
|
|
1509
|
+
offsetXPct: z39.number().min(0).max(100).nullable(),
|
|
1510
|
+
offsetYPct: z39.number().min(0).max(100).nullable(),
|
|
1462
1511
|
/**
|
|
1463
1512
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
1464
1513
|
* element anchor.
|
|
@@ -1469,8 +1518,8 @@ var BugLocationSchema = z37.object({
|
|
|
1469
1518
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
1470
1519
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
1471
1520
|
*/
|
|
1472
|
-
pageX:
|
|
1473
|
-
pageY:
|
|
1521
|
+
pageX: z39.number().nullable(),
|
|
1522
|
+
pageY: z39.number().nullable()
|
|
1474
1523
|
}).refine(
|
|
1475
1524
|
(loc) => {
|
|
1476
1525
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -1484,24 +1533,24 @@ var BugLocationSchema = z37.object({
|
|
|
1484
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)"
|
|
1485
1534
|
}
|
|
1486
1535
|
);
|
|
1487
|
-
var SessionBugSchema =
|
|
1488
|
-
id:
|
|
1536
|
+
var SessionBugSchema = z39.object({
|
|
1537
|
+
id: z39.string().uuid(),
|
|
1489
1538
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
1490
|
-
turnIndex:
|
|
1539
|
+
turnIndex: z39.number().int().nullable(),
|
|
1491
1540
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
1492
1541
|
* without pinning a spot. */
|
|
1493
1542
|
location: BugLocationSchema.nullable(),
|
|
1494
|
-
provider:
|
|
1495
|
-
issueKey:
|
|
1496
|
-
issueUrl:
|
|
1543
|
+
provider: z39.string(),
|
|
1544
|
+
issueKey: z39.string().nullable(),
|
|
1545
|
+
issueUrl: z39.string().nullable(),
|
|
1497
1546
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
1498
1547
|
* open text. Null until first synced. */
|
|
1499
|
-
issueState:
|
|
1500
|
-
title:
|
|
1501
|
-
body:
|
|
1548
|
+
issueState: z39.string().nullable(),
|
|
1549
|
+
title: z39.string(),
|
|
1550
|
+
body: z39.string(),
|
|
1502
1551
|
severity: BugSeveritySchema,
|
|
1503
|
-
createdBy:
|
|
1504
|
-
createdAt:
|
|
1552
|
+
createdBy: z39.string(),
|
|
1553
|
+
createdAt: z39.string(),
|
|
1505
1554
|
/**
|
|
1506
1555
|
* When this bug was resolved from the console; null means still OPEN.
|
|
1507
1556
|
*
|
|
@@ -1510,55 +1559,55 @@ var SessionBugSchema = z37.object({
|
|
|
1510
1559
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
1511
1560
|
* no boolean can contradict it.
|
|
1512
1561
|
*/
|
|
1513
|
-
resolvedAt:
|
|
1514
|
-
resolvedBy:
|
|
1562
|
+
resolvedAt: z39.string().nullable(),
|
|
1563
|
+
resolvedBy: z39.string().nullable()
|
|
1515
1564
|
});
|
|
1516
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
1517
|
-
var SessionCommentSchema =
|
|
1518
|
-
id:
|
|
1565
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z39.string() });
|
|
1566
|
+
var SessionCommentSchema = z39.object({
|
|
1567
|
+
id: z39.string().uuid(),
|
|
1519
1568
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
1520
|
-
bugId:
|
|
1569
|
+
bugId: z39.string().uuid().nullable(),
|
|
1521
1570
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
1522
1571
|
* parent bug's turn). */
|
|
1523
|
-
turnIndex:
|
|
1572
|
+
turnIndex: z39.number().int().nullable(),
|
|
1524
1573
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
1525
1574
|
location: BugLocationSchema.nullable(),
|
|
1526
|
-
body:
|
|
1527
|
-
createdBy:
|
|
1528
|
-
createdAt:
|
|
1575
|
+
body: z39.string(),
|
|
1576
|
+
createdBy: z39.string(),
|
|
1577
|
+
createdAt: z39.string()
|
|
1529
1578
|
});
|
|
1530
|
-
var CreateCommentInputSchema =
|
|
1531
|
-
bugId:
|
|
1532
|
-
turnIndex:
|
|
1579
|
+
var CreateCommentInputSchema = z39.object({
|
|
1580
|
+
bugId: z39.string().uuid().nullable(),
|
|
1581
|
+
turnIndex: z39.number().int().positive().nullable(),
|
|
1533
1582
|
location: BugLocationSchema.nullable(),
|
|
1534
1583
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
1535
1584
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
1536
|
-
body:
|
|
1585
|
+
body: z39.string().trim().min(1)
|
|
1537
1586
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
1538
1587
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
1539
1588
|
});
|
|
1540
|
-
var UpdateCommentInputSchema =
|
|
1541
|
-
body:
|
|
1542
|
-
bugId:
|
|
1589
|
+
var UpdateCommentInputSchema = z39.object({
|
|
1590
|
+
body: z39.string().trim().min(1).optional(),
|
|
1591
|
+
bugId: z39.string().uuid().nullable().optional(),
|
|
1543
1592
|
location: BugLocationSchema.nullable().optional()
|
|
1544
1593
|
});
|
|
1545
|
-
var SessionFormFactorSchema =
|
|
1546
|
-
var SessionSummarySchema =
|
|
1547
|
-
sessionId:
|
|
1594
|
+
var SessionFormFactorSchema = z39.enum(["mobile", "desktop"]).nullable();
|
|
1595
|
+
var SessionSummarySchema = z39.object({
|
|
1596
|
+
sessionId: z39.string(),
|
|
1548
1597
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
1549
1598
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
1550
|
-
visitorId:
|
|
1599
|
+
visitorId: z39.string().nullable(),
|
|
1551
1600
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
1552
1601
|
* identified themselves. Both null together means "not identified yet". */
|
|
1553
|
-
identityProvider:
|
|
1554
|
-
identityKey:
|
|
1602
|
+
identityProvider: z39.string().nullable(),
|
|
1603
|
+
identityKey: z39.string().nullable(),
|
|
1555
1604
|
/** Team/test traffic. The queue hides these by default. */
|
|
1556
|
-
isInternal:
|
|
1605
|
+
isInternal: z39.boolean(),
|
|
1557
1606
|
/** Build that served the session. Null = not captured; a version filter must
|
|
1558
1607
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
1559
|
-
clientVersion:
|
|
1608
|
+
clientVersion: z39.string().nullable(),
|
|
1560
1609
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
1561
|
-
signalCounts:
|
|
1610
|
+
signalCounts: z39.record(z39.number()),
|
|
1562
1611
|
/**
|
|
1563
1612
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
1564
1613
|
*
|
|
@@ -1575,7 +1624,7 @@ var SessionSummarySchema = z37.object({
|
|
|
1575
1624
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
1576
1625
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
1577
1626
|
*/
|
|
1578
|
-
conversionAttempts:
|
|
1627
|
+
conversionAttempts: z39.number().int().nullable(),
|
|
1579
1628
|
/**
|
|
1580
1629
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
1581
1630
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -1591,7 +1640,7 @@ var SessionSummarySchema = z37.object({
|
|
|
1591
1640
|
* kinds together, and one attempt id appearing under both would be counted
|
|
1592
1641
|
* once there and twice here.
|
|
1593
1642
|
*/
|
|
1594
|
-
conversionKinds:
|
|
1643
|
+
conversionKinds: z39.record(z39.number()),
|
|
1595
1644
|
/**
|
|
1596
1645
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
1597
1646
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -1599,20 +1648,20 @@ var SessionSummarySchema = z37.object({
|
|
|
1599
1648
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
1600
1649
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
1601
1650
|
*/
|
|
1602
|
-
funnelSteps:
|
|
1651
|
+
funnelSteps: z39.array(z39.string()),
|
|
1603
1652
|
/**
|
|
1604
1653
|
* The connector's opaque handle for what this session produced in its back
|
|
1605
1654
|
* office — present only once a checkout actually reached the platform. The
|
|
1606
1655
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
1607
1656
|
*/
|
|
1608
|
-
backOfficeRef:
|
|
1657
|
+
backOfficeRef: z39.string().nullable(),
|
|
1609
1658
|
/**
|
|
1610
1659
|
* The order this session produced, when the connector's back office reported
|
|
1611
1660
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
1612
1661
|
* Both null when no order is known — the cart handle above is then the door.
|
|
1613
1662
|
*/
|
|
1614
|
-
orderRef:
|
|
1615
|
-
orderLabel:
|
|
1663
|
+
orderRef: z39.string().nullable(),
|
|
1664
|
+
orderLabel: z39.string().nullable(),
|
|
1616
1665
|
/**
|
|
1617
1666
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
1618
1667
|
* needs.
|
|
@@ -1625,12 +1674,12 @@ var SessionSummarySchema = z37.object({
|
|
|
1625
1674
|
* on a desktop are not the same session.
|
|
1626
1675
|
*/
|
|
1627
1676
|
formFactor: SessionFormFactorSchema,
|
|
1628
|
-
turnCount:
|
|
1677
|
+
turnCount: z39.number().int(),
|
|
1629
1678
|
/** The visitor's opening message — the single most informative field for
|
|
1630
1679
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
1631
|
-
firstPrompt:
|
|
1632
|
-
startedAt:
|
|
1633
|
-
lastRunAt:
|
|
1680
|
+
firstPrompt: z39.string(),
|
|
1681
|
+
startedAt: z39.string(),
|
|
1682
|
+
lastRunAt: z39.string(),
|
|
1634
1683
|
/**
|
|
1635
1684
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
1636
1685
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -1658,7 +1707,7 @@ var SessionSummarySchema = z37.object({
|
|
|
1658
1707
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
1659
1708
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
1660
1709
|
*/
|
|
1661
|
-
visitorTimeZone:
|
|
1710
|
+
visitorTimeZone: z39.string().nullable(),
|
|
1662
1711
|
/**
|
|
1663
1712
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
1664
1713
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -1666,31 +1715,31 @@ var SessionSummarySchema = z37.object({
|
|
|
1666
1715
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
1667
1716
|
* already reading. Null when no turn in the session recorded a patch.
|
|
1668
1717
|
*/
|
|
1669
|
-
avgTtftMs:
|
|
1718
|
+
avgTtftMs: z39.number().int().nullable(),
|
|
1670
1719
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
1671
1720
|
* a budget: null on sessions older than the mark's recording. */
|
|
1672
|
-
avgMainDoneMs:
|
|
1721
|
+
avgMainDoneMs: z39.number().int().nullable(),
|
|
1673
1722
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
1674
1723
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
1675
|
-
avgChipGenMs:
|
|
1676
|
-
totalLatencyMs:
|
|
1677
|
-
durationMs:
|
|
1724
|
+
avgChipGenMs: z39.number().int().nullable(),
|
|
1725
|
+
totalLatencyMs: z39.number().int(),
|
|
1726
|
+
durationMs: z39.number().int(),
|
|
1678
1727
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
1679
1728
|
* live session streams and cannot be given a verdict until it ends. */
|
|
1680
|
-
isLive:
|
|
1729
|
+
isLive: z39.boolean(),
|
|
1681
1730
|
verdict: SessionVerdictSchema,
|
|
1682
|
-
reviewedBy:
|
|
1683
|
-
reviewedAt:
|
|
1731
|
+
reviewedBy: z39.string().nullable(),
|
|
1732
|
+
reviewedAt: z39.string().nullable(),
|
|
1684
1733
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
1685
1734
|
* state without a second request. */
|
|
1686
|
-
bugIssueKey:
|
|
1687
|
-
bugIssueUrl:
|
|
1688
|
-
bugIssueState:
|
|
1735
|
+
bugIssueKey: z39.string().nullable(),
|
|
1736
|
+
bugIssueUrl: z39.string().nullable(),
|
|
1737
|
+
bugIssueState: z39.string().nullable()
|
|
1689
1738
|
});
|
|
1690
|
-
var SessionQueuePageSchema =
|
|
1691
|
-
sessions:
|
|
1692
|
-
totalCount:
|
|
1693
|
-
hiddenInternalCount:
|
|
1739
|
+
var SessionQueuePageSchema = z39.object({
|
|
1740
|
+
sessions: z39.array(SessionSummarySchema),
|
|
1741
|
+
totalCount: z39.number().int(),
|
|
1742
|
+
hiddenInternalCount: z39.number().int(),
|
|
1694
1743
|
/**
|
|
1695
1744
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
1696
1745
|
*
|
|
@@ -1700,68 +1749,73 @@ var SessionQueuePageSchema = z37.object({
|
|
|
1700
1749
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
1701
1750
|
* analytics dashboard's bounce over the same window.
|
|
1702
1751
|
*/
|
|
1703
|
-
hiddenBouncedCount:
|
|
1752
|
+
hiddenBouncedCount: z39.number().int()
|
|
1704
1753
|
});
|
|
1705
|
-
var SessionQueueFacetsSchema =
|
|
1706
|
-
review:
|
|
1707
|
-
version:
|
|
1708
|
-
turns:
|
|
1709
|
-
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()),
|
|
1710
1759
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
1711
|
-
funnel:
|
|
1760
|
+
funnel: z39.record(z39.number())
|
|
1712
1761
|
});
|
|
1713
|
-
var SessionCaptureSchema =
|
|
1714
|
-
viewportWidth:
|
|
1715
|
-
viewportHeight:
|
|
1716
|
-
userAgent:
|
|
1717
|
-
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(),
|
|
1718
1767
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
1719
|
-
referrer:
|
|
1768
|
+
referrer: z39.string().nullable()
|
|
1720
1769
|
});
|
|
1721
|
-
var SessionCaptureInputSchema =
|
|
1722
|
-
viewportWidth:
|
|
1723
|
-
viewportHeight:
|
|
1724
|
-
userAgent:
|
|
1725
|
-
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(),
|
|
1726
1775
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
1727
1776
|
* the zone database grows, and refusing a name this build has not heard of
|
|
1728
1777
|
* would drop a real session's capture over a table that is out of date. */
|
|
1729
|
-
timeZone:
|
|
1730
|
-
referrer:
|
|
1731
|
-
clientVersion:
|
|
1732
|
-
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()
|
|
1733
1782
|
});
|
|
1734
|
-
var SessionDetailSchema =
|
|
1783
|
+
var SessionDetailSchema = z39.object({
|
|
1735
1784
|
session: SessionSummarySchema,
|
|
1736
1785
|
capture: SessionCaptureSchema,
|
|
1737
1786
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
1738
1787
|
* re-judged after a fix is the evidence the fix worked. */
|
|
1739
|
-
reviews:
|
|
1740
|
-
bugs:
|
|
1741
|
-
comments:
|
|
1788
|
+
reviews: z39.array(SessionReviewEventSchema),
|
|
1789
|
+
bugs: z39.array(SessionBugSchema),
|
|
1790
|
+
comments: z39.array(SessionCommentSchema),
|
|
1742
1791
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
1743
1792
|
* not evidence of zero visitor activity. */
|
|
1744
1793
|
activity: SessionActivitySchema.optional()
|
|
1745
1794
|
});
|
|
1746
|
-
var RecordVerdictInputSchema =
|
|
1795
|
+
var RecordVerdictInputSchema = z39.object({
|
|
1747
1796
|
verdict: RecordableVerdictSchema,
|
|
1748
|
-
note:
|
|
1797
|
+
note: z39.string().max(2e3).optional()
|
|
1749
1798
|
});
|
|
1750
|
-
var FileBugInputSchema =
|
|
1751
|
-
turnIndex:
|
|
1799
|
+
var FileBugInputSchema = z39.object({
|
|
1800
|
+
turnIndex: z39.number().int().positive().nullable(),
|
|
1752
1801
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
1753
1802
|
location: BugLocationSchema.nullable().optional(),
|
|
1754
|
-
title:
|
|
1755
|
-
body:
|
|
1803
|
+
title: z39.string().min(1).max(300),
|
|
1804
|
+
body: z39.string().min(1),
|
|
1756
1805
|
severity: BugSeveritySchema,
|
|
1757
|
-
payload:
|
|
1806
|
+
payload: z39.record(z39.unknown())
|
|
1758
1807
|
});
|
|
1759
1808
|
export {
|
|
1760
1809
|
EMPTY_SPEC,
|
|
1810
|
+
HostExportsSchema,
|
|
1761
1811
|
PackageReleaseSchema,
|
|
1812
|
+
RELEASE_MESSAGE_MAX,
|
|
1813
|
+
ReleaseMessageSchema,
|
|
1762
1814
|
WIRE_PROTOCOL_PARAM,
|
|
1763
1815
|
WIRE_PROTOCOL_VERSION,
|
|
1764
1816
|
applySinglePatch,
|
|
1765
1817
|
carriesShapeToken,
|
|
1766
|
-
catalogToWire
|
|
1818
|
+
catalogToWire,
|
|
1819
|
+
hostImportProblems,
|
|
1820
|
+
hostImportsRefusal
|
|
1767
1821
|
};
|