@40rty/ams-cli 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/commands/publish.mjs +16 -4
- package/bin/commands/releases.mjs +1 -0
- package/bin/forty.mjs +1 -1
- package/dist/wire.js +326 -308
- package/package.json +1 -1
package/bin/commands/publish.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { PackageReleaseSchema, carriesShapeToken, catalogToWire } from '../../dist/wire.js';
|
|
4
4
|
import { buildBundle, loadBrandDefinition, loadCatalog, loadManifests, loadMark, loadSpacePrompt } from '../lib/build.mjs';
|
|
5
|
-
import { cwd, flag, option, readConfig } from '../lib/context.mjs';
|
|
5
|
+
import { cwd, fail, flag, option, readConfig } from '../lib/context.mjs';
|
|
6
6
|
import { call } from '../lib/credentials.mjs';
|
|
7
7
|
import { registerOrigin } from './origin.mjs';
|
|
8
8
|
import { resolvedSdkVersion } from '../lib/sdk-version.mjs';
|
|
@@ -59,13 +59,25 @@ function warnShapeTokenExamples(catalog) {
|
|
|
59
59
|
console.warn(' pass `examples` to catalogComponentFrom(...) for each');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** A release's summary is one line a person can read in a version list. */
|
|
63
|
+
const MAX_MESSAGE = 140;
|
|
64
|
+
|
|
65
|
+
/** `--message "…"`: what this release changed — mandatory; the console's version list shows it. */
|
|
66
|
+
export function releaseMessage() {
|
|
67
|
+
const message = option('message');
|
|
68
|
+
const text = typeof message === 'string' ? message.trim() : '';
|
|
69
|
+
if (text === '') fail('a release needs a short summary of what changed — `forty publish --message "what changed"`');
|
|
70
|
+
if (text.length > MAX_MESSAGE) fail(`the release message is ${text.length} characters — keep it to one line of ${MAX_MESSAGE} or fewer`);
|
|
71
|
+
return text;
|
|
72
|
+
}
|
|
73
|
+
|
|
62
74
|
/** `forty publish` — release: the package changes, and the space's visitors see it. */
|
|
63
75
|
export async function publish() {
|
|
76
|
+
// Asked before the build: a missing summary should not cost a bundle.
|
|
77
|
+
const message = releaseMessage();
|
|
64
78
|
const config = await readConfig();
|
|
65
79
|
const release = await buildRelease(config);
|
|
66
|
-
|
|
67
|
-
const message = option('message');
|
|
68
|
-
if (message !== undefined) release.description = message;
|
|
80
|
+
release.description = message;
|
|
69
81
|
// `--keep-locked`: a space `forty init` created opens to visitors on its first release — unless asked not to.
|
|
70
82
|
const keepLocked = flag('keep-locked') ? '&keepLocked=true' : '';
|
|
71
83
|
const result = await call(config.apiUrl, 'PUT', `/org/packages/releases?space=${encodeURIComponent(config.spaceSlug)}${keepLocked}`, release);
|
|
@@ -17,6 +17,7 @@ export async function releases() {
|
|
|
17
17
|
for (const release of list) {
|
|
18
18
|
const when = new Date(release.createdAt).toLocaleString();
|
|
19
19
|
console.log(`${release.number === active ? '●' : ' '} release ${release.number} v${release.version} ${release.publishedBy} ${when}`);
|
|
20
|
+
if (release.description !== null) console.log(` ${release.description}`);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
package/bin/forty.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// forty publish release it: the package changes and the space's visitors
|
|
12
12
|
// see it. The catalog + manifests named in the config; with
|
|
13
13
|
// a `bundle` entry the components too, for a hosted spacefront.
|
|
14
|
-
// `--message "…"` says what the release changed
|
|
14
|
+
// `--message "…"` (required, one line) says what the release changed
|
|
15
15
|
// forty releases the package's release history, and which one is live
|
|
16
16
|
// forty rollback make an earlier release live again (`forty rollback 3`)
|
|
17
17
|
// forty connect attach this app's store to the space
|
package/dist/wire.js
CHANGED
|
@@ -112,8 +112,10 @@ var ShellConfigSchema = z4.record(z4.unknown());
|
|
|
112
112
|
|
|
113
113
|
// ../spacestation/src/layout/page.ts
|
|
114
114
|
var pageKindSchemas = /* @__PURE__ */ new Map();
|
|
115
|
-
|
|
115
|
+
var pageKindIdentityOmit = /* @__PURE__ */ new Map();
|
|
116
|
+
function registerPageKindSchema(kind, schema, options = {}) {
|
|
116
117
|
pageKindSchemas.set(kind, schema);
|
|
118
|
+
if (options.identityOmit !== void 0) pageKindIdentityOmit.set(kind, new Set(options.identityOmit));
|
|
117
119
|
}
|
|
118
120
|
registerPageKindSchema("home", z5.object({ kind: z5.literal("home") }));
|
|
119
121
|
registerPageKindSchema(
|
|
@@ -122,7 +124,8 @@ registerPageKindSchema(
|
|
|
122
124
|
kind: z5.literal("message"),
|
|
123
125
|
messageIndex: z5.number().int().nonnegative(),
|
|
124
126
|
messageId: z5.string().min(1).optional()
|
|
125
|
-
})
|
|
127
|
+
}),
|
|
128
|
+
{ identityOmit: ["messageId"] }
|
|
126
129
|
);
|
|
127
130
|
registerPageKindSchema(
|
|
128
131
|
"answer",
|
|
@@ -130,7 +133,8 @@ registerPageKindSchema(
|
|
|
130
133
|
kind: z5.literal("answer"),
|
|
131
134
|
messageIndex: z5.number().int().nonnegative(),
|
|
132
135
|
messageId: z5.string().min(1).optional()
|
|
133
|
-
})
|
|
136
|
+
}),
|
|
137
|
+
{ identityOmit: ["messageId"] }
|
|
134
138
|
);
|
|
135
139
|
function lookupPageKindSchema(val) {
|
|
136
140
|
if (typeof val !== "object" || val === null || Array.isArray(val)) return null;
|
|
@@ -170,8 +174,10 @@ registerPageKindSchema(
|
|
|
170
174
|
z6.object({
|
|
171
175
|
kind: z6.literal("product"),
|
|
172
176
|
id: z6.string().min(1),
|
|
173
|
-
morph: z6.boolean().optional()
|
|
174
|
-
|
|
177
|
+
morph: z6.boolean().optional(),
|
|
178
|
+
title: z6.string().optional()
|
|
179
|
+
}),
|
|
180
|
+
{ identityOmit: ["morph"] }
|
|
175
181
|
);
|
|
176
182
|
registerPageKindSchema(
|
|
177
183
|
"collection",
|
|
@@ -180,7 +186,8 @@ registerPageKindSchema(
|
|
|
180
186
|
handle: z6.string().min(1),
|
|
181
187
|
products: z6.array(z6.string()).optional(),
|
|
182
188
|
title: z6.string().optional()
|
|
183
|
-
})
|
|
189
|
+
}),
|
|
190
|
+
{ identityOmit: ["products"] }
|
|
184
191
|
);
|
|
185
192
|
registerPageKindSchema(
|
|
186
193
|
"search",
|
|
@@ -188,7 +195,8 @@ registerPageKindSchema(
|
|
|
188
195
|
kind: z6.literal("search"),
|
|
189
196
|
query: z6.string(),
|
|
190
197
|
products: z6.array(z6.string()).optional()
|
|
191
|
-
})
|
|
198
|
+
}),
|
|
199
|
+
{ identityOmit: ["products"] }
|
|
192
200
|
);
|
|
193
201
|
registerPageKindSchema("article", z6.object({ kind: z6.literal("article"), id: z6.string().min(1) }));
|
|
194
202
|
registerPageKindSchema("cms", z6.object({ kind: z6.literal("cms"), handle: z6.string().min(1) }));
|
|
@@ -390,7 +398,8 @@ var CartAddSignalPayloadSchema = z10.object({
|
|
|
390
398
|
/**
|
|
391
399
|
* The agent turn whose canvas element the add came from — stamped by the sdk
|
|
392
400
|
* session hooks for a producer inside a turn (`turn-attributed-session.ts`),
|
|
393
|
-
*
|
|
401
|
+
* stamped with the live turn for the agent's own add (`FourtyProvider`),
|
|
402
|
+
* absent for one outside any (the header cart, WebMCP).
|
|
394
403
|
* Carried for the same reason as `origin`: the handler that emits the outcome
|
|
395
404
|
* sees only this payload.
|
|
396
405
|
*/
|
|
@@ -990,20 +999,29 @@ var ProjectionSetPayloadSchema = z26.object({
|
|
|
990
999
|
set: ProjectionPreferencesSchema.optional()
|
|
991
1000
|
});
|
|
992
1001
|
|
|
993
|
-
// ../spacestation/src/
|
|
1002
|
+
// ../spacestation/src/host/host-page.ts
|
|
994
1003
|
import { z as z27 } from "zod";
|
|
995
|
-
var
|
|
996
|
-
|
|
1004
|
+
var HostPayloadSchema = z27.object({
|
|
1005
|
+
page: PageSchema.nullable(),
|
|
1006
|
+
maxSections: z27.number().int().positive().nullable(),
|
|
1007
|
+
surface: z27.enum(["page", "slot"])
|
|
997
1008
|
});
|
|
1009
|
+
var HostClearedSchema = z27.object({ cleared: z27.literal(true) });
|
|
998
1010
|
|
|
999
|
-
// ../spacestation/src/
|
|
1011
|
+
// ../spacestation/src/focus/focus.ts
|
|
1000
1012
|
import { z as z28 } from "zod";
|
|
1001
|
-
var
|
|
1002
|
-
|
|
1013
|
+
var FocusElementPayloadSchema = z28.object({
|
|
1014
|
+
elementId: z28.string().min(1)
|
|
1003
1015
|
});
|
|
1004
1016
|
|
|
1005
|
-
// ../spacestation/src/
|
|
1017
|
+
// ../spacestation/src/view/continuation.ts
|
|
1006
1018
|
import { z as z29 } from "zod";
|
|
1019
|
+
var ViewExtendPayloadSchema = z29.object({
|
|
1020
|
+
reason: z29.enum(["scroll_near_bottom"])
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
// ../spacestation/src/attachment/attachment.ts
|
|
1024
|
+
import { z as z30 } from "zod";
|
|
1007
1025
|
var ALLOWED_ATTACHMENT_TYPES = [
|
|
1008
1026
|
"image/jpeg",
|
|
1009
1027
|
"image/png",
|
|
@@ -1015,36 +1033,36 @@ var MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
|
|
1015
1033
|
function isAllowedAttachmentType(mime) {
|
|
1016
1034
|
return ALLOWED_ATTACHMENT_TYPES.includes(mime);
|
|
1017
1035
|
}
|
|
1018
|
-
var AttachmentRefSchema =
|
|
1036
|
+
var AttachmentRefSchema = z30.object({
|
|
1019
1037
|
// A UUID, as `storeAttachment` mints it: the id becomes a storage path segment,
|
|
1020
1038
|
// so nothing else — no `/`, no `..` — may reach that lookup.
|
|
1021
|
-
id:
|
|
1022
|
-
mimeType:
|
|
1039
|
+
id: z30.string().uuid(),
|
|
1040
|
+
mimeType: z30.string().refine(isAllowedAttachmentType, {
|
|
1023
1041
|
message: "mimeType not on the attachment allow-list"
|
|
1024
1042
|
}),
|
|
1025
|
-
name:
|
|
1026
|
-
size:
|
|
1027
|
-
url:
|
|
1043
|
+
name: z30.string().min(1),
|
|
1044
|
+
size: z30.number().int().positive().max(MAX_ATTACHMENT_BYTES),
|
|
1045
|
+
url: z30.string().min(1)
|
|
1028
1046
|
});
|
|
1029
|
-
var AttachmentRefsSchema =
|
|
1047
|
+
var AttachmentRefsSchema = z30.array(AttachmentRefSchema);
|
|
1030
1048
|
|
|
1031
1049
|
// ../spacestation/src/contracts/entry-context.ts
|
|
1032
|
-
import { z as
|
|
1050
|
+
import { z as z31 } from "zod";
|
|
1033
1051
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
1034
1052
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
1035
1053
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
1036
1054
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
1037
|
-
var EntryContextValueSchema =
|
|
1038
|
-
var EntryContextNameSchema =
|
|
1039
|
-
var EntryContextNamespaceSchema =
|
|
1055
|
+
var EntryContextValueSchema = z31.string().trim().min(1).max(ENTRY_CONTEXT_MAX_VALUE_CHARS);
|
|
1056
|
+
var EntryContextNameSchema = z31.string().trim().min(1).max(ENTRY_CONTEXT_MAX_NAME_CHARS);
|
|
1057
|
+
var EntryContextNamespaceSchema = z31.record(EntryContextNameSchema, EntryContextValueSchema).refine((entries) => Object.keys(entries).length <= ENTRY_CONTEXT_MAX_KEYS, {
|
|
1040
1058
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
1041
1059
|
});
|
|
1042
|
-
var EntryContextSchema =
|
|
1060
|
+
var EntryContextSchema = z31.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
1043
1061
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
1044
1062
|
});
|
|
1045
1063
|
|
|
1046
1064
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
1047
|
-
import { z as
|
|
1065
|
+
import { z as z32 } from "zod";
|
|
1048
1066
|
var SURFACES = [
|
|
1049
1067
|
"spacefront",
|
|
1050
1068
|
"embed",
|
|
@@ -1054,11 +1072,11 @@ var SURFACES = [
|
|
|
1054
1072
|
"playground",
|
|
1055
1073
|
"automation"
|
|
1056
1074
|
];
|
|
1057
|
-
var SurfaceSchema =
|
|
1075
|
+
var SurfaceSchema = z32.enum(SURFACES);
|
|
1058
1076
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
1059
|
-
var ClickIdKindSchema =
|
|
1077
|
+
var ClickIdKindSchema = z32.enum(CLICK_ID_KINDS);
|
|
1060
1078
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
1061
|
-
var VisitorIdDurabilitySchema =
|
|
1079
|
+
var VisitorIdDurabilitySchema = z32.enum(VISITOR_ID_DURABILITIES);
|
|
1062
1080
|
var TRAFFIC_BUCKETS = [
|
|
1063
1081
|
"paid_google",
|
|
1064
1082
|
"paid_meta",
|
|
@@ -1070,10 +1088,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
1070
1088
|
"direct",
|
|
1071
1089
|
"unknown"
|
|
1072
1090
|
];
|
|
1073
|
-
var TrafficBucketSchema =
|
|
1091
|
+
var TrafficBucketSchema = z32.enum(TRAFFIC_BUCKETS);
|
|
1074
1092
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
1075
|
-
var ArrivalValueSchema =
|
|
1076
|
-
var SessionArrivalSchema =
|
|
1093
|
+
var ArrivalValueSchema = z32.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
1094
|
+
var SessionArrivalSchema = z32.object({
|
|
1077
1095
|
utmSource: ArrivalValueSchema.optional(),
|
|
1078
1096
|
utmMedium: ArrivalValueSchema.optional(),
|
|
1079
1097
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -1111,82 +1129,82 @@ var WIRE_PROTOCOL_VERSION = 1;
|
|
|
1111
1129
|
var WIRE_PROTOCOL_PARAM = "protocol";
|
|
1112
1130
|
|
|
1113
1131
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
1114
|
-
import { z as
|
|
1115
|
-
var AttributeScopeBucketSchema =
|
|
1116
|
-
scope:
|
|
1117
|
-
needles:
|
|
1118
|
-
label:
|
|
1132
|
+
import { z as z33 } from "zod";
|
|
1133
|
+
var AttributeScopeBucketSchema = z33.object({
|
|
1134
|
+
scope: z33.string(),
|
|
1135
|
+
needles: z33.array(z33.string()).readonly(),
|
|
1136
|
+
label: z33.string().optional()
|
|
1119
1137
|
});
|
|
1120
|
-
var AttributeScopeConfigSchema =
|
|
1121
|
-
facet:
|
|
1122
|
-
buckets:
|
|
1123
|
-
emptyScope:
|
|
1124
|
-
noMatchScope:
|
|
1125
|
-
ignoreValues:
|
|
1126
|
-
emptyScopeLabel:
|
|
1127
|
-
noMatchScopeLabel:
|
|
1138
|
+
var AttributeScopeConfigSchema = z33.object({
|
|
1139
|
+
facet: z33.string(),
|
|
1140
|
+
buckets: z33.array(AttributeScopeBucketSchema).readonly(),
|
|
1141
|
+
emptyScope: z33.string(),
|
|
1142
|
+
noMatchScope: z33.string(),
|
|
1143
|
+
ignoreValues: z33.array(z33.string()).readonly(),
|
|
1144
|
+
emptyScopeLabel: z33.string().optional(),
|
|
1145
|
+
noMatchScopeLabel: z33.string().optional()
|
|
1128
1146
|
});
|
|
1129
|
-
var AttributeDefBaseSchema =
|
|
1130
|
-
description:
|
|
1131
|
-
durable:
|
|
1132
|
-
label:
|
|
1147
|
+
var AttributeDefBaseSchema = z33.object({
|
|
1148
|
+
description: z33.string().optional(),
|
|
1149
|
+
durable: z33.boolean().optional(),
|
|
1150
|
+
label: z33.string().optional()
|
|
1133
1151
|
});
|
|
1134
|
-
var AttributeDefSchema =
|
|
1135
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1136
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1137
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1138
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1152
|
+
var AttributeDefSchema = z33.discriminatedUnion("kind", [
|
|
1153
|
+
AttributeDefBaseSchema.extend({ kind: z33.literal("enum"), values: z33.array(z33.string()) }),
|
|
1154
|
+
AttributeDefBaseSchema.extend({ kind: z33.literal("free_text") }),
|
|
1155
|
+
AttributeDefBaseSchema.extend({ kind: z33.literal("date_or_season") }),
|
|
1156
|
+
AttributeDefBaseSchema.extend({ kind: z33.literal("money_or_band") }),
|
|
1139
1157
|
AttributeDefBaseSchema.extend({
|
|
1140
|
-
kind:
|
|
1141
|
-
min:
|
|
1142
|
-
max:
|
|
1143
|
-
unit:
|
|
1158
|
+
kind: z33.literal("number"),
|
|
1159
|
+
min: z33.number().optional(),
|
|
1160
|
+
max: z33.number().optional(),
|
|
1161
|
+
unit: z33.string().optional()
|
|
1144
1162
|
})
|
|
1145
1163
|
]);
|
|
1146
1164
|
|
|
1147
1165
|
// ../spacestation/src/space/agent-directive.ts
|
|
1148
|
-
import { z as
|
|
1166
|
+
import { z as z34 } from "zod";
|
|
1149
1167
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
1150
1168
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
1151
1169
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
1152
1170
|
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
1153
|
-
var AgentDirectiveSchema =
|
|
1154
|
-
name:
|
|
1155
|
-
kind:
|
|
1156
|
-
severity:
|
|
1171
|
+
var AgentDirectiveSchema = z34.object({
|
|
1172
|
+
name: z34.string().trim().min(1).max(80),
|
|
1173
|
+
kind: z34.enum(AGENT_DIRECTIVE_KINDS),
|
|
1174
|
+
severity: z34.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
1157
1175
|
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
1158
1176
|
* product name. */
|
|
1159
|
-
text:
|
|
1177
|
+
text: z34.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
1160
1178
|
}).strict();
|
|
1161
|
-
var SpaceAgentDirectiveSchema =
|
|
1162
|
-
id:
|
|
1163
|
-
position:
|
|
1164
|
-
name:
|
|
1165
|
-
kind:
|
|
1166
|
-
severity:
|
|
1167
|
-
text:
|
|
1168
|
-
source:
|
|
1169
|
-
status:
|
|
1179
|
+
var SpaceAgentDirectiveSchema = z34.object({
|
|
1180
|
+
id: z34.string(),
|
|
1181
|
+
position: z34.number().int(),
|
|
1182
|
+
name: z34.string(),
|
|
1183
|
+
kind: z34.enum(AGENT_DIRECTIVE_KINDS),
|
|
1184
|
+
severity: z34.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
1185
|
+
text: z34.string(),
|
|
1186
|
+
source: z34.enum(AGENT_DIRECTIVE_SOURCES),
|
|
1187
|
+
status: z34.enum(AGENT_DIRECTIVE_STATUSES),
|
|
1170
1188
|
/** Who wrote it; null for a lesson the system proposed. */
|
|
1171
|
-
createdBy:
|
|
1189
|
+
createdBy: z34.string().nullable(),
|
|
1172
1190
|
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
1173
|
-
evidence:
|
|
1174
|
-
decidedBy:
|
|
1175
|
-
decidedAt:
|
|
1176
|
-
createdAt:
|
|
1191
|
+
evidence: z34.record(z34.unknown()).nullable(),
|
|
1192
|
+
decidedBy: z34.string().nullable(),
|
|
1193
|
+
decidedAt: z34.string().nullable(),
|
|
1194
|
+
createdAt: z34.string()
|
|
1177
1195
|
});
|
|
1178
|
-
var OutcomeTallySchema =
|
|
1196
|
+
var OutcomeTallySchema = z34.object({ turns: z34.number().int(), acted: z34.number().int() });
|
|
1179
1197
|
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
1180
|
-
impact:
|
|
1198
|
+
impact: z34.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
1181
1199
|
});
|
|
1182
|
-
var UpdateAgentDirectiveInputSchema =
|
|
1200
|
+
var UpdateAgentDirectiveInputSchema = z34.object({
|
|
1183
1201
|
name: AgentDirectiveSchema.shape.name.optional(),
|
|
1184
1202
|
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
1185
1203
|
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
1186
1204
|
text: AgentDirectiveSchema.shape.text.optional(),
|
|
1187
|
-
status:
|
|
1205
|
+
status: z34.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
1188
1206
|
}).strict();
|
|
1189
|
-
var ReorderAgentDirectivesInputSchema =
|
|
1207
|
+
var ReorderAgentDirectivesInputSchema = z34.object({ ids: z34.array(z34.string()).min(1) }).strict();
|
|
1190
1208
|
|
|
1191
1209
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
1192
1210
|
var COMPONENT_SOURCE = {
|
|
@@ -1216,30 +1234,30 @@ var DEFAULT_SPACE_CONFIG = {
|
|
|
1216
1234
|
};
|
|
1217
1235
|
|
|
1218
1236
|
// ../spacestation/src/space/trace.ts
|
|
1219
|
-
import { z as
|
|
1220
|
-
var RunTokenUsageSchema =
|
|
1221
|
-
input_tokens:
|
|
1222
|
-
output_tokens:
|
|
1223
|
-
cache_read_tokens:
|
|
1237
|
+
import { z as z35 } from "zod";
|
|
1238
|
+
var RunTokenUsageSchema = z35.object({
|
|
1239
|
+
input_tokens: z35.number().optional(),
|
|
1240
|
+
output_tokens: z35.number().optional(),
|
|
1241
|
+
cache_read_tokens: z35.number().optional()
|
|
1224
1242
|
});
|
|
1225
|
-
var TraceRecordSchema =
|
|
1226
|
-
id:
|
|
1227
|
-
spaceId:
|
|
1228
|
-
sessionId:
|
|
1243
|
+
var TraceRecordSchema = z35.object({
|
|
1244
|
+
id: z35.string().uuid(),
|
|
1245
|
+
spaceId: z35.string().uuid().nullable(),
|
|
1246
|
+
sessionId: z35.string(),
|
|
1229
1247
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
1230
1248
|
* for an unlocked space / anonymous unlock. */
|
|
1231
|
-
visitorEmail:
|
|
1232
|
-
userPrompt:
|
|
1233
|
-
branch:
|
|
1234
|
-
responseText:
|
|
1235
|
-
layout:
|
|
1236
|
-
phaseTimings:
|
|
1237
|
-
tokensByModel:
|
|
1238
|
-
toolCalls:
|
|
1239
|
-
diagnostics:
|
|
1240
|
-
latencyFirstText:
|
|
1241
|
-
latencyFirstPatch:
|
|
1242
|
-
latencyTotal:
|
|
1249
|
+
visitorEmail: z35.string().nullable(),
|
|
1250
|
+
userPrompt: z35.string(),
|
|
1251
|
+
branch: z35.string().nullable(),
|
|
1252
|
+
responseText: z35.string().nullable(),
|
|
1253
|
+
layout: z35.unknown().nullable(),
|
|
1254
|
+
phaseTimings: z35.record(z35.number()).nullable(),
|
|
1255
|
+
tokensByModel: z35.record(RunTokenUsageSchema).nullable(),
|
|
1256
|
+
toolCalls: z35.array(z35.unknown()).nullable(),
|
|
1257
|
+
diagnostics: z35.array(z35.unknown()).nullable(),
|
|
1258
|
+
latencyFirstText: z35.number().int().nullable(),
|
|
1259
|
+
latencyFirstPatch: z35.number().int().nullable(),
|
|
1260
|
+
latencyTotal: z35.number().int().nullable(),
|
|
1243
1261
|
/**
|
|
1244
1262
|
* The CLIENT's turn id for this run, or `null`.
|
|
1245
1263
|
*
|
|
@@ -1255,29 +1273,29 @@ var TraceRecordSchema = z34.object({
|
|
|
1255
1273
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1256
1274
|
* visitor asked something and got nothing.
|
|
1257
1275
|
*/
|
|
1258
|
-
turnId:
|
|
1276
|
+
turnId: z35.string().nullable(),
|
|
1259
1277
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
1260
1278
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
1261
|
-
trackerState:
|
|
1262
|
-
createdAt:
|
|
1279
|
+
trackerState: z35.unknown().nullable(),
|
|
1280
|
+
createdAt: z35.string()
|
|
1263
1281
|
});
|
|
1264
|
-
var MillisecondsSchema =
|
|
1265
|
-
var CreateTraceInputSchema =
|
|
1266
|
-
spaceId:
|
|
1267
|
-
sessionId:
|
|
1268
|
-
visitorEmail:
|
|
1269
|
-
userPrompt:
|
|
1270
|
-
branch:
|
|
1271
|
-
responseText:
|
|
1272
|
-
layout:
|
|
1273
|
-
phaseTimings:
|
|
1274
|
-
tokensByModel:
|
|
1275
|
-
toolCalls:
|
|
1276
|
-
diagnostics:
|
|
1282
|
+
var MillisecondsSchema = z35.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
1283
|
+
var CreateTraceInputSchema = z35.object({
|
|
1284
|
+
spaceId: z35.string().uuid().nullable(),
|
|
1285
|
+
sessionId: z35.string(),
|
|
1286
|
+
visitorEmail: z35.string().nullable(),
|
|
1287
|
+
userPrompt: z35.string(),
|
|
1288
|
+
branch: z35.string().nullable(),
|
|
1289
|
+
responseText: z35.string().nullable(),
|
|
1290
|
+
layout: z35.unknown().nullable(),
|
|
1291
|
+
phaseTimings: z35.record(z35.number()).nullable(),
|
|
1292
|
+
tokensByModel: z35.record(RunTokenUsageSchema).nullable(),
|
|
1293
|
+
toolCalls: z35.array(z35.unknown()).nullable(),
|
|
1294
|
+
diagnostics: z35.array(z35.unknown()).nullable(),
|
|
1277
1295
|
latencyFirstText: MillisecondsSchema,
|
|
1278
1296
|
latencyFirstPatch: MillisecondsSchema,
|
|
1279
1297
|
latencyTotal: MillisecondsSchema,
|
|
1280
|
-
trackerState:
|
|
1298
|
+
trackerState: z35.unknown().nullable(),
|
|
1281
1299
|
/**
|
|
1282
1300
|
* The CLIENT's turn id for this run, or `null`.
|
|
1283
1301
|
*
|
|
@@ -1293,37 +1311,37 @@ var CreateTraceInputSchema = z34.object({
|
|
|
1293
1311
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1294
1312
|
* visitor asked something and got nothing.
|
|
1295
1313
|
*/
|
|
1296
|
-
turnId:
|
|
1314
|
+
turnId: z35.string().nullable()
|
|
1297
1315
|
});
|
|
1298
|
-
var AgentSessionSummarySchema =
|
|
1299
|
-
sessionId:
|
|
1316
|
+
var AgentSessionSummarySchema = z35.object({
|
|
1317
|
+
sessionId: z35.string(),
|
|
1300
1318
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
1301
|
-
turnCount:
|
|
1319
|
+
turnCount: z35.number().int(),
|
|
1302
1320
|
/** The session's opening prompt — titles the row in the UI. */
|
|
1303
|
-
firstPrompt:
|
|
1304
|
-
startedAt:
|
|
1305
|
-
lastRunAt:
|
|
1321
|
+
firstPrompt: z35.string(),
|
|
1322
|
+
startedAt: z35.string(),
|
|
1323
|
+
lastRunAt: z35.string(),
|
|
1306
1324
|
/** Summed `latency_total` across the session's turns. */
|
|
1307
|
-
totalLatencyMs:
|
|
1325
|
+
totalLatencyMs: z35.number().int()
|
|
1308
1326
|
});
|
|
1309
|
-
var SessionTurnSchema =
|
|
1310
|
-
id:
|
|
1311
|
-
userPrompt:
|
|
1312
|
-
responseText:
|
|
1327
|
+
var SessionTurnSchema = z35.object({
|
|
1328
|
+
id: z35.string().uuid(),
|
|
1329
|
+
userPrompt: z35.string(),
|
|
1330
|
+
responseText: z35.string().nullable(),
|
|
1313
1331
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
1314
|
-
layout:
|
|
1315
|
-
createdAt:
|
|
1316
|
-
latencyTotal:
|
|
1317
|
-
phaseTimings:
|
|
1318
|
-
tokensByModel:
|
|
1319
|
-
input_tokens:
|
|
1320
|
-
output_tokens:
|
|
1332
|
+
layout: z35.unknown().nullable(),
|
|
1333
|
+
createdAt: z35.string(),
|
|
1334
|
+
latencyTotal: z35.number().int().nullable(),
|
|
1335
|
+
phaseTimings: z35.record(z35.number()).nullable(),
|
|
1336
|
+
tokensByModel: z35.record(z35.object({
|
|
1337
|
+
input_tokens: z35.number().optional(),
|
|
1338
|
+
output_tokens: z35.number().optional()
|
|
1321
1339
|
})).nullable(),
|
|
1322
|
-
toolCalls:
|
|
1323
|
-
diagnostics:
|
|
1340
|
+
toolCalls: z35.array(z35.unknown()).nullable(),
|
|
1341
|
+
diagnostics: z35.array(z35.unknown()).nullable()
|
|
1324
1342
|
});
|
|
1325
|
-
var SessionReplaySchema =
|
|
1326
|
-
turns:
|
|
1343
|
+
var SessionReplaySchema = z35.object({
|
|
1344
|
+
turns: z35.array(SessionTurnSchema),
|
|
1327
1345
|
/**
|
|
1328
1346
|
* The session's own last-committed layout, read straight off the durable
|
|
1329
1347
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -1334,20 +1352,20 @@ var SessionReplaySchema = z34.object({
|
|
|
1334
1352
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
1335
1353
|
* when the durable session row itself could not be read.
|
|
1336
1354
|
*/
|
|
1337
|
-
sessionLayout:
|
|
1355
|
+
sessionLayout: z35.record(z35.string(), z35.unknown()).nullable()
|
|
1338
1356
|
});
|
|
1339
|
-
var SessionTraceSchema =
|
|
1340
|
-
trackerState:
|
|
1357
|
+
var SessionTraceSchema = z35.object({
|
|
1358
|
+
trackerState: z35.string().nullable()
|
|
1341
1359
|
});
|
|
1342
|
-
var LlmUsageDailySchema =
|
|
1343
|
-
day:
|
|
1360
|
+
var LlmUsageDailySchema = z35.object({
|
|
1361
|
+
day: z35.string(),
|
|
1344
1362
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
1345
|
-
environment:
|
|
1346
|
-
feature:
|
|
1347
|
-
model:
|
|
1348
|
-
provider:
|
|
1363
|
+
environment: z35.string(),
|
|
1364
|
+
feature: z35.string(),
|
|
1365
|
+
model: z35.string(),
|
|
1366
|
+
provider: z35.string(),
|
|
1349
1367
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
1350
|
-
keyFingerprint:
|
|
1368
|
+
keyFingerprint: z35.string().nullable(),
|
|
1351
1369
|
/**
|
|
1352
1370
|
* The space the call served, or null when it served none.
|
|
1353
1371
|
*
|
|
@@ -1356,91 +1374,91 @@ var LlmUsageDailySchema = z34.object({
|
|
|
1356
1374
|
* report that share rather than dropping it, or a per-space total reads as
|
|
1357
1375
|
* the platform total.
|
|
1358
1376
|
*/
|
|
1359
|
-
spaceId:
|
|
1377
|
+
spaceId: z35.string().nullable(),
|
|
1360
1378
|
/**
|
|
1361
1379
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
1362
1380
|
* when it served no session or the session predates surface recording.
|
|
1363
1381
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
1364
1382
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
1365
1383
|
*/
|
|
1366
|
-
surface:
|
|
1367
|
-
inputTokens:
|
|
1368
|
-
outputTokens:
|
|
1384
|
+
surface: z35.string().nullable(),
|
|
1385
|
+
inputTokens: z35.number(),
|
|
1386
|
+
outputTokens: z35.number(),
|
|
1369
1387
|
/** Subset of inputTokens, never additional to it. */
|
|
1370
|
-
cachedInputTokens:
|
|
1371
|
-
reasoningTokens:
|
|
1372
|
-
callCount:
|
|
1373
|
-
errorCount:
|
|
1374
|
-
estimatedCostUsd:
|
|
1388
|
+
cachedInputTokens: z35.number(),
|
|
1389
|
+
reasoningTokens: z35.number(),
|
|
1390
|
+
callCount: z35.number(),
|
|
1391
|
+
errorCount: z35.number(),
|
|
1392
|
+
estimatedCostUsd: z35.number().nullable()
|
|
1375
1393
|
});
|
|
1376
|
-
var LlmUsageBySessionSchema =
|
|
1377
|
-
sessionId:
|
|
1378
|
-
environment:
|
|
1379
|
-
model:
|
|
1394
|
+
var LlmUsageBySessionSchema = z35.object({
|
|
1395
|
+
sessionId: z35.string(),
|
|
1396
|
+
environment: z35.string(),
|
|
1397
|
+
model: z35.string(),
|
|
1380
1398
|
/** The space this session belongs to, or null for a session with no space. */
|
|
1381
|
-
spaceId:
|
|
1399
|
+
spaceId: z35.string().nullable(),
|
|
1382
1400
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
1383
|
-
surface:
|
|
1401
|
+
surface: z35.string().nullable(),
|
|
1384
1402
|
/** Label only — the first feature seen in the session. */
|
|
1385
|
-
firstFeature:
|
|
1386
|
-
startedAt:
|
|
1387
|
-
endedAt:
|
|
1388
|
-
inputTokens:
|
|
1389
|
-
outputTokens:
|
|
1390
|
-
cachedInputTokens:
|
|
1391
|
-
reasoningTokens:
|
|
1392
|
-
callCount:
|
|
1393
|
-
errorCount:
|
|
1403
|
+
firstFeature: z35.string(),
|
|
1404
|
+
startedAt: z35.string(),
|
|
1405
|
+
endedAt: z35.string(),
|
|
1406
|
+
inputTokens: z35.number(),
|
|
1407
|
+
outputTokens: z35.number(),
|
|
1408
|
+
cachedInputTokens: z35.number(),
|
|
1409
|
+
reasoningTokens: z35.number(),
|
|
1410
|
+
callCount: z35.number(),
|
|
1411
|
+
errorCount: z35.number(),
|
|
1394
1412
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
1395
1413
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
1396
1414
|
* the model is unpriced; never 0, which would read as free. */
|
|
1397
|
-
estimatedCostUsd:
|
|
1415
|
+
estimatedCostUsd: z35.number().nullable()
|
|
1398
1416
|
});
|
|
1399
|
-
var LlmSessionsDailySchema =
|
|
1400
|
-
day:
|
|
1401
|
-
environment:
|
|
1402
|
-
sessionCount:
|
|
1417
|
+
var LlmSessionsDailySchema = z35.object({
|
|
1418
|
+
day: z35.string(),
|
|
1419
|
+
environment: z35.string(),
|
|
1420
|
+
sessionCount: z35.number()
|
|
1403
1421
|
});
|
|
1404
1422
|
|
|
1405
1423
|
// ../spacestation/src/space/session-queue.ts
|
|
1406
|
-
import { z as
|
|
1424
|
+
import { z as z37 } from "zod";
|
|
1407
1425
|
|
|
1408
1426
|
// ../spacestation/src/space/session-activity.ts
|
|
1409
|
-
import { z as
|
|
1410
|
-
var SessionActivityEventSchema =
|
|
1411
|
-
id:
|
|
1412
|
-
kind:
|
|
1413
|
-
occurredAt:
|
|
1414
|
-
source:
|
|
1415
|
-
surface:
|
|
1416
|
-
payload:
|
|
1427
|
+
import { z as z36 } from "zod";
|
|
1428
|
+
var SessionActivityEventSchema = z36.object({
|
|
1429
|
+
id: z36.string(),
|
|
1430
|
+
kind: z36.string(),
|
|
1431
|
+
occurredAt: z36.string(),
|
|
1432
|
+
source: z36.string(),
|
|
1433
|
+
surface: z36.string(),
|
|
1434
|
+
payload: z36.record(z36.unknown())
|
|
1417
1435
|
});
|
|
1418
|
-
var SessionActivitySchema =
|
|
1419
|
-
events:
|
|
1420
|
-
hasMore:
|
|
1436
|
+
var SessionActivitySchema = z36.object({
|
|
1437
|
+
events: z36.array(SessionActivityEventSchema),
|
|
1438
|
+
hasMore: z36.boolean()
|
|
1421
1439
|
});
|
|
1422
1440
|
|
|
1423
1441
|
// ../spacestation/src/space/session-queue.ts
|
|
1424
|
-
var SessionVerdictSchema =
|
|
1425
|
-
var RecordableVerdictSchema =
|
|
1426
|
-
var SessionReviewEventSchema =
|
|
1427
|
-
id:
|
|
1442
|
+
var SessionVerdictSchema = z37.enum(["unreviewed", "viewed", "bug"]);
|
|
1443
|
+
var RecordableVerdictSchema = z37.enum(["viewed", "bug"]);
|
|
1444
|
+
var SessionReviewEventSchema = z37.object({
|
|
1445
|
+
id: z37.string().uuid(),
|
|
1428
1446
|
verdict: RecordableVerdictSchema,
|
|
1429
1447
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
1430
1448
|
* log is append-only rather than a mutable current-state row. */
|
|
1431
|
-
reviewer:
|
|
1432
|
-
note:
|
|
1433
|
-
createdAt:
|
|
1449
|
+
reviewer: z37.string(),
|
|
1450
|
+
note: z37.string().nullable(),
|
|
1451
|
+
createdAt: z37.string()
|
|
1434
1452
|
});
|
|
1435
|
-
var BugSeveritySchema =
|
|
1436
|
-
var BugLocationSchema =
|
|
1437
|
-
elementId:
|
|
1453
|
+
var BugSeveritySchema = z37.enum(["high", "medium", "low"]);
|
|
1454
|
+
var BugLocationSchema = z37.object({
|
|
1455
|
+
elementId: z37.string().nullable(),
|
|
1438
1456
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
1439
1457
|
* alongside a null `elementId`. */
|
|
1440
|
-
elementType:
|
|
1458
|
+
elementType: z37.string().nullable(),
|
|
1441
1459
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
1442
|
-
offsetXPct:
|
|
1443
|
-
offsetYPct:
|
|
1460
|
+
offsetXPct: z37.number().min(0).max(100).nullable(),
|
|
1461
|
+
offsetYPct: z37.number().min(0).max(100).nullable(),
|
|
1444
1462
|
/**
|
|
1445
1463
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
1446
1464
|
* element anchor.
|
|
@@ -1451,8 +1469,8 @@ var BugLocationSchema = z36.object({
|
|
|
1451
1469
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
1452
1470
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
1453
1471
|
*/
|
|
1454
|
-
pageX:
|
|
1455
|
-
pageY:
|
|
1472
|
+
pageX: z37.number().nullable(),
|
|
1473
|
+
pageY: z37.number().nullable()
|
|
1456
1474
|
}).refine(
|
|
1457
1475
|
(loc) => {
|
|
1458
1476
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -1466,24 +1484,24 @@ var BugLocationSchema = z36.object({
|
|
|
1466
1484
|
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)"
|
|
1467
1485
|
}
|
|
1468
1486
|
);
|
|
1469
|
-
var SessionBugSchema =
|
|
1470
|
-
id:
|
|
1487
|
+
var SessionBugSchema = z37.object({
|
|
1488
|
+
id: z37.string().uuid(),
|
|
1471
1489
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
1472
|
-
turnIndex:
|
|
1490
|
+
turnIndex: z37.number().int().nullable(),
|
|
1473
1491
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
1474
1492
|
* without pinning a spot. */
|
|
1475
1493
|
location: BugLocationSchema.nullable(),
|
|
1476
|
-
provider:
|
|
1477
|
-
issueKey:
|
|
1478
|
-
issueUrl:
|
|
1494
|
+
provider: z37.string(),
|
|
1495
|
+
issueKey: z37.string().nullable(),
|
|
1496
|
+
issueUrl: z37.string().nullable(),
|
|
1479
1497
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
1480
1498
|
* open text. Null until first synced. */
|
|
1481
|
-
issueState:
|
|
1482
|
-
title:
|
|
1483
|
-
body:
|
|
1499
|
+
issueState: z37.string().nullable(),
|
|
1500
|
+
title: z37.string(),
|
|
1501
|
+
body: z37.string(),
|
|
1484
1502
|
severity: BugSeveritySchema,
|
|
1485
|
-
createdBy:
|
|
1486
|
-
createdAt:
|
|
1503
|
+
createdBy: z37.string(),
|
|
1504
|
+
createdAt: z37.string(),
|
|
1487
1505
|
/**
|
|
1488
1506
|
* When this bug was resolved from the console; null means still OPEN.
|
|
1489
1507
|
*
|
|
@@ -1492,55 +1510,55 @@ var SessionBugSchema = z36.object({
|
|
|
1492
1510
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
1493
1511
|
* no boolean can contradict it.
|
|
1494
1512
|
*/
|
|
1495
|
-
resolvedAt:
|
|
1496
|
-
resolvedBy:
|
|
1513
|
+
resolvedAt: z37.string().nullable(),
|
|
1514
|
+
resolvedBy: z37.string().nullable()
|
|
1497
1515
|
});
|
|
1498
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
1499
|
-
var SessionCommentSchema =
|
|
1500
|
-
id:
|
|
1516
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z37.string() });
|
|
1517
|
+
var SessionCommentSchema = z37.object({
|
|
1518
|
+
id: z37.string().uuid(),
|
|
1501
1519
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
1502
|
-
bugId:
|
|
1520
|
+
bugId: z37.string().uuid().nullable(),
|
|
1503
1521
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
1504
1522
|
* parent bug's turn). */
|
|
1505
|
-
turnIndex:
|
|
1523
|
+
turnIndex: z37.number().int().nullable(),
|
|
1506
1524
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
1507
1525
|
location: BugLocationSchema.nullable(),
|
|
1508
|
-
body:
|
|
1509
|
-
createdBy:
|
|
1510
|
-
createdAt:
|
|
1526
|
+
body: z37.string(),
|
|
1527
|
+
createdBy: z37.string(),
|
|
1528
|
+
createdAt: z37.string()
|
|
1511
1529
|
});
|
|
1512
|
-
var CreateCommentInputSchema =
|
|
1513
|
-
bugId:
|
|
1514
|
-
turnIndex:
|
|
1530
|
+
var CreateCommentInputSchema = z37.object({
|
|
1531
|
+
bugId: z37.string().uuid().nullable(),
|
|
1532
|
+
turnIndex: z37.number().int().positive().nullable(),
|
|
1515
1533
|
location: BugLocationSchema.nullable(),
|
|
1516
1534
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
1517
1535
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
1518
|
-
body:
|
|
1536
|
+
body: z37.string().trim().min(1)
|
|
1519
1537
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
1520
1538
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
1521
1539
|
});
|
|
1522
|
-
var UpdateCommentInputSchema =
|
|
1523
|
-
body:
|
|
1524
|
-
bugId:
|
|
1540
|
+
var UpdateCommentInputSchema = z37.object({
|
|
1541
|
+
body: z37.string().trim().min(1).optional(),
|
|
1542
|
+
bugId: z37.string().uuid().nullable().optional(),
|
|
1525
1543
|
location: BugLocationSchema.nullable().optional()
|
|
1526
1544
|
});
|
|
1527
|
-
var SessionFormFactorSchema =
|
|
1528
|
-
var SessionSummarySchema =
|
|
1529
|
-
sessionId:
|
|
1545
|
+
var SessionFormFactorSchema = z37.enum(["mobile", "desktop"]).nullable();
|
|
1546
|
+
var SessionSummarySchema = z37.object({
|
|
1547
|
+
sessionId: z37.string(),
|
|
1530
1548
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
1531
1549
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
1532
|
-
visitorId:
|
|
1550
|
+
visitorId: z37.string().nullable(),
|
|
1533
1551
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
1534
1552
|
* identified themselves. Both null together means "not identified yet". */
|
|
1535
|
-
identityProvider:
|
|
1536
|
-
identityKey:
|
|
1553
|
+
identityProvider: z37.string().nullable(),
|
|
1554
|
+
identityKey: z37.string().nullable(),
|
|
1537
1555
|
/** Team/test traffic. The queue hides these by default. */
|
|
1538
|
-
isInternal:
|
|
1556
|
+
isInternal: z37.boolean(),
|
|
1539
1557
|
/** Build that served the session. Null = not captured; a version filter must
|
|
1540
1558
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
1541
|
-
clientVersion:
|
|
1559
|
+
clientVersion: z37.string().nullable(),
|
|
1542
1560
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
1543
|
-
signalCounts:
|
|
1561
|
+
signalCounts: z37.record(z37.number()),
|
|
1544
1562
|
/**
|
|
1545
1563
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
1546
1564
|
*
|
|
@@ -1557,7 +1575,7 @@ var SessionSummarySchema = z36.object({
|
|
|
1557
1575
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
1558
1576
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
1559
1577
|
*/
|
|
1560
|
-
conversionAttempts:
|
|
1578
|
+
conversionAttempts: z37.number().int().nullable(),
|
|
1561
1579
|
/**
|
|
1562
1580
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
1563
1581
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -1573,7 +1591,7 @@ var SessionSummarySchema = z36.object({
|
|
|
1573
1591
|
* kinds together, and one attempt id appearing under both would be counted
|
|
1574
1592
|
* once there and twice here.
|
|
1575
1593
|
*/
|
|
1576
|
-
conversionKinds:
|
|
1594
|
+
conversionKinds: z37.record(z37.number()),
|
|
1577
1595
|
/**
|
|
1578
1596
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
1579
1597
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -1581,20 +1599,20 @@ var SessionSummarySchema = z36.object({
|
|
|
1581
1599
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
1582
1600
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
1583
1601
|
*/
|
|
1584
|
-
funnelSteps:
|
|
1602
|
+
funnelSteps: z37.array(z37.string()),
|
|
1585
1603
|
/**
|
|
1586
1604
|
* The connector's opaque handle for what this session produced in its back
|
|
1587
1605
|
* office — present only once a checkout actually reached the platform. The
|
|
1588
1606
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
1589
1607
|
*/
|
|
1590
|
-
backOfficeRef:
|
|
1608
|
+
backOfficeRef: z37.string().nullable(),
|
|
1591
1609
|
/**
|
|
1592
1610
|
* The order this session produced, when the connector's back office reported
|
|
1593
1611
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
1594
1612
|
* Both null when no order is known — the cart handle above is then the door.
|
|
1595
1613
|
*/
|
|
1596
|
-
orderRef:
|
|
1597
|
-
orderLabel:
|
|
1614
|
+
orderRef: z37.string().nullable(),
|
|
1615
|
+
orderLabel: z37.string().nullable(),
|
|
1598
1616
|
/**
|
|
1599
1617
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
1600
1618
|
* needs.
|
|
@@ -1607,12 +1625,12 @@ var SessionSummarySchema = z36.object({
|
|
|
1607
1625
|
* on a desktop are not the same session.
|
|
1608
1626
|
*/
|
|
1609
1627
|
formFactor: SessionFormFactorSchema,
|
|
1610
|
-
turnCount:
|
|
1628
|
+
turnCount: z37.number().int(),
|
|
1611
1629
|
/** The visitor's opening message — the single most informative field for
|
|
1612
1630
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
1613
|
-
firstPrompt:
|
|
1614
|
-
startedAt:
|
|
1615
|
-
lastRunAt:
|
|
1631
|
+
firstPrompt: z37.string(),
|
|
1632
|
+
startedAt: z37.string(),
|
|
1633
|
+
lastRunAt: z37.string(),
|
|
1616
1634
|
/**
|
|
1617
1635
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
1618
1636
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -1640,7 +1658,7 @@ var SessionSummarySchema = z36.object({
|
|
|
1640
1658
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
1641
1659
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
1642
1660
|
*/
|
|
1643
|
-
visitorTimeZone:
|
|
1661
|
+
visitorTimeZone: z37.string().nullable(),
|
|
1644
1662
|
/**
|
|
1645
1663
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
1646
1664
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -1648,31 +1666,31 @@ var SessionSummarySchema = z36.object({
|
|
|
1648
1666
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
1649
1667
|
* already reading. Null when no turn in the session recorded a patch.
|
|
1650
1668
|
*/
|
|
1651
|
-
avgTtftMs:
|
|
1669
|
+
avgTtftMs: z37.number().int().nullable(),
|
|
1652
1670
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
1653
1671
|
* a budget: null on sessions older than the mark's recording. */
|
|
1654
|
-
avgMainDoneMs:
|
|
1672
|
+
avgMainDoneMs: z37.number().int().nullable(),
|
|
1655
1673
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
1656
1674
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
1657
|
-
avgChipGenMs:
|
|
1658
|
-
totalLatencyMs:
|
|
1659
|
-
durationMs:
|
|
1675
|
+
avgChipGenMs: z37.number().int().nullable(),
|
|
1676
|
+
totalLatencyMs: z37.number().int(),
|
|
1677
|
+
durationMs: z37.number().int(),
|
|
1660
1678
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
1661
1679
|
* live session streams and cannot be given a verdict until it ends. */
|
|
1662
|
-
isLive:
|
|
1680
|
+
isLive: z37.boolean(),
|
|
1663
1681
|
verdict: SessionVerdictSchema,
|
|
1664
|
-
reviewedBy:
|
|
1665
|
-
reviewedAt:
|
|
1682
|
+
reviewedBy: z37.string().nullable(),
|
|
1683
|
+
reviewedAt: z37.string().nullable(),
|
|
1666
1684
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
1667
1685
|
* state without a second request. */
|
|
1668
|
-
bugIssueKey:
|
|
1669
|
-
bugIssueUrl:
|
|
1670
|
-
bugIssueState:
|
|
1686
|
+
bugIssueKey: z37.string().nullable(),
|
|
1687
|
+
bugIssueUrl: z37.string().nullable(),
|
|
1688
|
+
bugIssueState: z37.string().nullable()
|
|
1671
1689
|
});
|
|
1672
|
-
var SessionQueuePageSchema =
|
|
1673
|
-
sessions:
|
|
1674
|
-
totalCount:
|
|
1675
|
-
hiddenInternalCount:
|
|
1690
|
+
var SessionQueuePageSchema = z37.object({
|
|
1691
|
+
sessions: z37.array(SessionSummarySchema),
|
|
1692
|
+
totalCount: z37.number().int(),
|
|
1693
|
+
hiddenInternalCount: z37.number().int(),
|
|
1676
1694
|
/**
|
|
1677
1695
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
1678
1696
|
*
|
|
@@ -1682,61 +1700,61 @@ var SessionQueuePageSchema = z36.object({
|
|
|
1682
1700
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
1683
1701
|
* analytics dashboard's bounce over the same window.
|
|
1684
1702
|
*/
|
|
1685
|
-
hiddenBouncedCount:
|
|
1703
|
+
hiddenBouncedCount: z37.number().int()
|
|
1686
1704
|
});
|
|
1687
|
-
var SessionQueueFacetsSchema =
|
|
1688
|
-
review:
|
|
1689
|
-
version:
|
|
1690
|
-
turns:
|
|
1691
|
-
durationS:
|
|
1705
|
+
var SessionQueueFacetsSchema = z37.object({
|
|
1706
|
+
review: z37.record(z37.number()),
|
|
1707
|
+
version: z37.record(z37.number()),
|
|
1708
|
+
turns: z37.record(z37.number()),
|
|
1709
|
+
durationS: z37.record(z37.number()),
|
|
1692
1710
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
1693
|
-
funnel:
|
|
1711
|
+
funnel: z37.record(z37.number())
|
|
1694
1712
|
});
|
|
1695
|
-
var SessionCaptureSchema =
|
|
1696
|
-
viewportWidth:
|
|
1697
|
-
viewportHeight:
|
|
1698
|
-
userAgent:
|
|
1699
|
-
locale:
|
|
1713
|
+
var SessionCaptureSchema = z37.object({
|
|
1714
|
+
viewportWidth: z37.number().int().nullable(),
|
|
1715
|
+
viewportHeight: z37.number().int().nullable(),
|
|
1716
|
+
userAgent: z37.string().nullable(),
|
|
1717
|
+
locale: z37.string().nullable(),
|
|
1700
1718
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
1701
|
-
referrer:
|
|
1719
|
+
referrer: z37.string().nullable()
|
|
1702
1720
|
});
|
|
1703
|
-
var SessionCaptureInputSchema =
|
|
1704
|
-
viewportWidth:
|
|
1705
|
-
viewportHeight:
|
|
1706
|
-
userAgent:
|
|
1707
|
-
locale:
|
|
1721
|
+
var SessionCaptureInputSchema = z37.object({
|
|
1722
|
+
viewportWidth: z37.number().int().positive().max(2e4).optional(),
|
|
1723
|
+
viewportHeight: z37.number().int().positive().max(2e4).optional(),
|
|
1724
|
+
userAgent: z37.string().max(1e3).optional(),
|
|
1725
|
+
locale: z37.string().max(35).optional(),
|
|
1708
1726
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
1709
1727
|
* the zone database grows, and refusing a name this build has not heard of
|
|
1710
1728
|
* would drop a real session's capture over a table that is out of date. */
|
|
1711
|
-
timeZone:
|
|
1712
|
-
referrer:
|
|
1713
|
-
clientVersion:
|
|
1714
|
-
isInternal:
|
|
1729
|
+
timeZone: z37.string().max(64).optional(),
|
|
1730
|
+
referrer: z37.string().max(2048).optional(),
|
|
1731
|
+
clientVersion: z37.string().max(100).optional(),
|
|
1732
|
+
isInternal: z37.boolean().optional()
|
|
1715
1733
|
});
|
|
1716
|
-
var SessionDetailSchema =
|
|
1734
|
+
var SessionDetailSchema = z37.object({
|
|
1717
1735
|
session: SessionSummarySchema,
|
|
1718
1736
|
capture: SessionCaptureSchema,
|
|
1719
1737
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
1720
1738
|
* re-judged after a fix is the evidence the fix worked. */
|
|
1721
|
-
reviews:
|
|
1722
|
-
bugs:
|
|
1723
|
-
comments:
|
|
1739
|
+
reviews: z37.array(SessionReviewEventSchema),
|
|
1740
|
+
bugs: z37.array(SessionBugSchema),
|
|
1741
|
+
comments: z37.array(SessionCommentSchema),
|
|
1724
1742
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
1725
1743
|
* not evidence of zero visitor activity. */
|
|
1726
1744
|
activity: SessionActivitySchema.optional()
|
|
1727
1745
|
});
|
|
1728
|
-
var RecordVerdictInputSchema =
|
|
1746
|
+
var RecordVerdictInputSchema = z37.object({
|
|
1729
1747
|
verdict: RecordableVerdictSchema,
|
|
1730
|
-
note:
|
|
1748
|
+
note: z37.string().max(2e3).optional()
|
|
1731
1749
|
});
|
|
1732
|
-
var FileBugInputSchema =
|
|
1733
|
-
turnIndex:
|
|
1750
|
+
var FileBugInputSchema = z37.object({
|
|
1751
|
+
turnIndex: z37.number().int().positive().nullable(),
|
|
1734
1752
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
1735
1753
|
location: BugLocationSchema.nullable().optional(),
|
|
1736
|
-
title:
|
|
1737
|
-
body:
|
|
1754
|
+
title: z37.string().min(1).max(300),
|
|
1755
|
+
body: z37.string().min(1),
|
|
1738
1756
|
severity: BugSeveritySchema,
|
|
1739
|
-
payload:
|
|
1757
|
+
payload: z37.record(z37.unknown())
|
|
1740
1758
|
});
|
|
1741
1759
|
export {
|
|
1742
1760
|
EMPTY_SPEC,
|