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