@40rty/ams-cli 0.5.17 → 0.5.19
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/connect.mjs +22 -1
- package/bin/forty.mjs +2 -1
- package/dist/wire.js +514 -485
- package/package.json +1 -1
package/dist/wire.js
CHANGED
|
@@ -423,68 +423,97 @@ var CartAddSignalPayloadSchema = z10.object({
|
|
|
423
423
|
acknowledgeInDrawer: z10.boolean().optional()
|
|
424
424
|
});
|
|
425
425
|
|
|
426
|
-
// ../spacestation/src/signal/
|
|
426
|
+
// ../spacestation/src/signal/visitor-view.ts
|
|
427
427
|
import { z as z11 } from "zod";
|
|
428
|
+
var Ref = z11.string().trim().min(1).max(200);
|
|
429
|
+
var Label = z11.string().trim().min(1).max(160);
|
|
430
|
+
var SeenSchema = z11.object({
|
|
431
|
+
/** The entity's id as the agent knows it (a product id), when the thing is an entity. */
|
|
432
|
+
ref: Ref.optional(),
|
|
433
|
+
label: Label,
|
|
434
|
+
/** One short fact the visitor can see on it ("$48", "sold out"). */
|
|
435
|
+
note: z11.string().trim().max(80).optional()
|
|
436
|
+
});
|
|
437
|
+
var AttentionSchema = z11.object({
|
|
438
|
+
/** On the visitor's screen now, in reading order. */
|
|
439
|
+
onScreen: z11.array(SeenSchema).max(24),
|
|
440
|
+
/** Where the visitor rested longest, most first. */
|
|
441
|
+
lingered: z11.array(SeenSchema.extend({ seconds: z11.number().nonnegative() })).max(6),
|
|
442
|
+
/** Sections the visitor has scrolled through, in order (titles the page showed). */
|
|
443
|
+
passed: z11.array(Label).max(12)
|
|
444
|
+
});
|
|
445
|
+
var PointedAtSchema = z11.object({
|
|
446
|
+
ref: Ref.optional(),
|
|
447
|
+
/** What the element is ("Faherty linen shirt", "the page headline"). */
|
|
448
|
+
label: Label,
|
|
449
|
+
/** Which of its facets the visitor tapped ("price", "colour", "style", "section"). */
|
|
450
|
+
field: z11.string().trim().min(1).max(40),
|
|
451
|
+
/** That facet's value as shown ("$128", "Navy"). */
|
|
452
|
+
value: z11.string().trim().max(160).optional()
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// ../spacestation/src/signal/turn-ask.ts
|
|
456
|
+
import { z as z12 } from "zod";
|
|
428
457
|
var MIN_CHOICE_ANSWERS = 2;
|
|
429
458
|
var MAX_CHOICE_ANSWERS = 4;
|
|
430
|
-
var AnswerPartSchema =
|
|
431
|
-
var PartSchema =
|
|
459
|
+
var AnswerPartSchema = z12.object({ answer: z12.string().trim().min(1) });
|
|
460
|
+
var PartSchema = z12.union([z12.string(), AnswerPartSchema]);
|
|
432
461
|
function partsText(parts) {
|
|
433
462
|
return parts.map((p) => typeof p === "string" ? p : p.answer).join("");
|
|
434
463
|
}
|
|
435
|
-
var ModelTurnAskSchema =
|
|
436
|
-
kind:
|
|
437
|
-
parts:
|
|
464
|
+
var ModelTurnAskSchema = z12.object({
|
|
465
|
+
kind: z12.enum(["choice", "open"]),
|
|
466
|
+
parts: z12.array(PartSchema).min(1)
|
|
438
467
|
}).refine((ask) => partsText(ask.parts).trim().length > 0, { message: "the question reads as nothing" }).refine((ask) => /\?["'”’*)\s]*$/.test(partsText(ask.parts)), { message: "an ask is a question" }).transform((ask) => {
|
|
439
468
|
const answers = ask.parts.filter((p) => typeof p !== "string").length;
|
|
440
469
|
if (ask.kind === "choice" && answers >= MIN_CHOICE_ANSWERS && answers <= MAX_CHOICE_ANSWERS) return ask;
|
|
441
470
|
if (ask.kind === "open" && answers === 0) return ask;
|
|
442
471
|
return { kind: "open", parts: [partsText(ask.parts)] };
|
|
443
472
|
});
|
|
444
|
-
var PersistedQuestionSchema =
|
|
445
|
-
var TurnAskSchema =
|
|
473
|
+
var PersistedQuestionSchema = z12.object({ question: z12.string().trim().min(1) }).transform((row) => ({ kind: "open", parts: [row.question.replace(/[[\]]/g, "")] }));
|
|
474
|
+
var TurnAskSchema = z12.union([ModelTurnAskSchema, PersistedQuestionSchema]);
|
|
446
475
|
|
|
447
476
|
// ../spacestation/src/types.ts
|
|
448
|
-
import { z as
|
|
449
|
-
var StateSnapshotFrameSchema =
|
|
450
|
-
rev:
|
|
451
|
-
state:
|
|
477
|
+
import { z as z13 } from "zod";
|
|
478
|
+
var StateSnapshotFrameSchema = z13.object({
|
|
479
|
+
rev: z13.number(),
|
|
480
|
+
state: z13.record(z13.unknown())
|
|
452
481
|
});
|
|
453
482
|
|
|
454
483
|
// ../spacestation/src/catalog/canvas-arrangement.ts
|
|
455
484
|
var CANVAS_BLOCK_SIZES = ["full", "wide", "half", "narrow"];
|
|
456
485
|
|
|
457
486
|
// ../spacestation/src/catalog/structural-baseline.ts
|
|
458
|
-
import { z as
|
|
459
|
-
var agentTextProps =
|
|
460
|
-
text:
|
|
461
|
-
parts:
|
|
462
|
-
type:
|
|
463
|
-
value:
|
|
487
|
+
import { z as z14 } from "zod";
|
|
488
|
+
var agentTextProps = z14.object({
|
|
489
|
+
text: z14.string().optional().describe("Plain prose. Used by the streaming text.delta slot binding so the agent can flow words in without choosing emphasis spans up front."),
|
|
490
|
+
parts: z14.array(z14.object({
|
|
491
|
+
type: z14.enum(["text", "em"]).describe("text = sans body; em = italic emphasis."),
|
|
492
|
+
value: z14.string()
|
|
464
493
|
})).optional().describe("Pre-segmented prose with mixed sans + italic spans. When present, takes precedence over `text`. Use sparingly \u2014 italic carries weight, save it for the human moment in the answer."),
|
|
465
|
-
size:
|
|
494
|
+
size: z14.enum(["sm", "md", "lg"]).optional().describe("Visual scale. lg for hero prose at the top of a turn; md (default) for body; sm for trailing footnote prose.")
|
|
466
495
|
});
|
|
467
|
-
var turnProps =
|
|
468
|
-
prompt:
|
|
469
|
-
index:
|
|
470
|
-
timestamp:
|
|
471
|
-
thinking:
|
|
496
|
+
var turnProps = z14.object({
|
|
497
|
+
prompt: z14.string().describe("The user's prompt for this turn, rendered as a quoted lede above the agent's response. Required so the conversation reads."),
|
|
498
|
+
index: z14.number().optional().describe("Turn index (0-based). When omitted the runtime infers from sibling turns."),
|
|
499
|
+
timestamp: z14.string().optional().describe("ISO timestamp for the small turn header. Omit to skip the header."),
|
|
500
|
+
thinking: z14.string().optional().describe("Short status line shown while the response streams in. Hidden once the first block lands.")
|
|
472
501
|
});
|
|
473
|
-
var backdropProps =
|
|
474
|
-
variant:
|
|
502
|
+
var backdropProps = z14.object({
|
|
503
|
+
variant: z14.enum(["ridges", "sky", "video", "none"]).optional().describe(
|
|
475
504
|
"Background variant. `ridges` = parallax silhouettes + sky gradient. `sky` = gradient + grain + vignette only. `video` = full-bleed autoplay-loop-muted video sourced from `videoUrl`. `none` = nothing rendered."
|
|
476
505
|
),
|
|
477
|
-
ridgeColor:
|
|
478
|
-
videoUrl:
|
|
506
|
+
ridgeColor: z14.string().optional().describe("Hex color of the ridge silhouettes. Defaults to surface fg1."),
|
|
507
|
+
videoUrl: z14.string().optional().describe(
|
|
479
508
|
'Direct mp4/webm URL for the `video` variant. Loaded with preload="metadata", muted, looped, playsInline.'
|
|
480
509
|
),
|
|
481
|
-
posterUrl:
|
|
510
|
+
posterUrl: z14.string().optional().describe("Optional poster frame shown while video buffers.")
|
|
482
511
|
});
|
|
483
512
|
var STRUCTURAL_BASELINE_CATALOG = {
|
|
484
513
|
page: {
|
|
485
514
|
type: "page",
|
|
486
515
|
alwaysInclude: true,
|
|
487
|
-
propsSchema:
|
|
516
|
+
propsSchema: z14.object({}),
|
|
488
517
|
layout: "fullbleed",
|
|
489
518
|
progressLabel: "Composing the page"
|
|
490
519
|
},
|
|
@@ -537,7 +566,7 @@ var STRUCTURAL_BASELINE_CATALOG = {
|
|
|
537
566
|
var STRUCTURAL_BASELINE_TYPES = Object.keys(STRUCTURAL_BASELINE_CATALOG);
|
|
538
567
|
|
|
539
568
|
// ../spacestation/src/catalog/resolved.ts
|
|
540
|
-
import { z as
|
|
569
|
+
import { z as z15 } from "zod";
|
|
541
570
|
function readResolvedMeta(schema) {
|
|
542
571
|
const def = schema._def;
|
|
543
572
|
if (!("_resolved" in def)) return void 0;
|
|
@@ -553,17 +582,17 @@ function readResolvedMeta(schema) {
|
|
|
553
582
|
}
|
|
554
583
|
|
|
555
584
|
// ../spacestation/src/catalog/prose.ts
|
|
556
|
-
import { z as
|
|
585
|
+
import { z as z16 } from "zod";
|
|
557
586
|
function readProseMeta(schema) {
|
|
558
587
|
const def = schema._def;
|
|
559
588
|
return "_prose" in def && def._prose === true;
|
|
560
589
|
}
|
|
561
590
|
|
|
562
591
|
// ../spacestation/src/catalog/required-props.ts
|
|
563
|
-
import { z as
|
|
592
|
+
import { z as z17 } from "zod";
|
|
564
593
|
|
|
565
594
|
// ../spacestation/src/catalog/function-props.ts
|
|
566
|
-
import { z as
|
|
595
|
+
import { z as z18 } from "zod";
|
|
567
596
|
|
|
568
597
|
// ../spacestation/src/catalog/shape-tokens.ts
|
|
569
598
|
var SHAPE_TOKEN = /<(?![/!])[^<>=]*\s[^<>=]*(?<!\/)>/;
|
|
@@ -673,47 +702,47 @@ function readAtPath(doc, path) {
|
|
|
673
702
|
}
|
|
674
703
|
|
|
675
704
|
// ../spacestation/src/catalog/wire/wire-schema.ts
|
|
676
|
-
import { z as
|
|
705
|
+
import { z as z19 } from "zod";
|
|
677
706
|
var common = {
|
|
678
|
-
description:
|
|
679
|
-
resolved:
|
|
680
|
-
resolverKey:
|
|
681
|
-
min:
|
|
682
|
-
max:
|
|
683
|
-
renderFloor:
|
|
684
|
-
derivedFrom:
|
|
707
|
+
description: z19.string().optional(),
|
|
708
|
+
resolved: z19.object({
|
|
709
|
+
resolverKey: z19.string(),
|
|
710
|
+
min: z19.number().optional(),
|
|
711
|
+
max: z19.number().optional(),
|
|
712
|
+
renderFloor: z19.number().optional(),
|
|
713
|
+
derivedFrom: z19.string().optional()
|
|
685
714
|
}).strict().optional(),
|
|
686
|
-
prose:
|
|
715
|
+
prose: z19.literal(true).optional()
|
|
687
716
|
};
|
|
688
|
-
var WireSchemaSchema =
|
|
689
|
-
() =>
|
|
690
|
-
|
|
691
|
-
|
|
717
|
+
var WireSchemaSchema = z19.lazy(
|
|
718
|
+
() => z19.discriminatedUnion("t", [
|
|
719
|
+
z19.object({ ...common, t: z19.literal("string"), min: z19.number().optional(), max: z19.number().optional() }).strict(),
|
|
720
|
+
z19.object({
|
|
692
721
|
...common,
|
|
693
|
-
t:
|
|
694
|
-
int:
|
|
695
|
-
min:
|
|
696
|
-
minExclusive:
|
|
697
|
-
max:
|
|
698
|
-
maxExclusive:
|
|
722
|
+
t: z19.literal("number"),
|
|
723
|
+
int: z19.literal(true).optional(),
|
|
724
|
+
min: z19.number().optional(),
|
|
725
|
+
minExclusive: z19.literal(true).optional(),
|
|
726
|
+
max: z19.number().optional(),
|
|
727
|
+
maxExclusive: z19.literal(true).optional()
|
|
699
728
|
}).strict(),
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
729
|
+
z19.object({ ...common, t: z19.literal("boolean") }).strict(),
|
|
730
|
+
z19.object({ ...common, t: z19.literal("unknown") }).strict(),
|
|
731
|
+
z19.object({ ...common, t: z19.literal("literal"), value: z19.union([z19.string(), z19.number(), z19.boolean()]) }).strict(),
|
|
732
|
+
z19.object({ ...common, t: z19.literal("enum"), values: z19.array(z19.string()).min(1) }).strict(),
|
|
733
|
+
z19.object({ ...common, t: z19.literal("array"), element: WireSchemaSchema, min: z19.number().optional(), max: z19.number().optional() }).strict(),
|
|
734
|
+
z19.object({ ...common, t: z19.literal("object"), shape: z19.record(WireSchemaSchema), unknownKeys: z19.enum(["strip", "passthrough", "strict"]) }).strict(),
|
|
735
|
+
z19.object({ ...common, t: z19.literal("union"), options: z19.array(WireSchemaSchema).min(2) }).strict(),
|
|
736
|
+
z19.object({ ...common, t: z19.literal("discriminatedUnion"), discriminator: z19.string(), options: z19.array(WireSchemaSchema).min(2) }).strict(),
|
|
737
|
+
z19.object({ ...common, t: z19.literal("record"), value: WireSchemaSchema }).strict(),
|
|
738
|
+
z19.object({ ...common, t: z19.literal("optional"), inner: WireSchemaSchema }).strict(),
|
|
739
|
+
z19.object({ ...common, t: z19.literal("nullable"), inner: WireSchemaSchema }).strict(),
|
|
740
|
+
z19.object({ ...common, t: z19.literal("default"), inner: WireSchemaSchema, value: z19.unknown() }).strict()
|
|
712
741
|
])
|
|
713
742
|
);
|
|
714
743
|
|
|
715
744
|
// ../spacestation/src/catalog/wire/schema-to-wire.ts
|
|
716
|
-
import { z as
|
|
745
|
+
import { z as z20 } from "zod";
|
|
717
746
|
var UnsupportedSchemaError = class extends Error {
|
|
718
747
|
constructor(path, what) {
|
|
719
748
|
super(`Cannot publish the schema at ${path === "" ? "<root>" : path}: ${what}.`);
|
|
@@ -751,7 +780,7 @@ function arrayNode(schema, path) {
|
|
|
751
780
|
return node;
|
|
752
781
|
}
|
|
753
782
|
function objectNode(schema, path) {
|
|
754
|
-
if (!(schema._def.catchall instanceof
|
|
783
|
+
if (!(schema._def.catchall instanceof z20.ZodNever)) throw new UnsupportedSchemaError(path, "object .catchall() is not supported");
|
|
755
784
|
const shape = {};
|
|
756
785
|
for (const [key, child] of Object.entries(schema.shape)) shape[key] = toNode(child, path === "" ? key : `${path}.${key}`);
|
|
757
786
|
return { t: "object", shape, unknownKeys: schema._def.unknownKeys };
|
|
@@ -762,19 +791,19 @@ function literalNode(schema, path) {
|
|
|
762
791
|
throw new UnsupportedSchemaError(path, "only string, number and boolean literals are supported");
|
|
763
792
|
}
|
|
764
793
|
function bare(schema, path) {
|
|
765
|
-
if (schema instanceof
|
|
766
|
-
if (schema instanceof
|
|
767
|
-
if (schema instanceof
|
|
768
|
-
if (schema instanceof
|
|
769
|
-
if (schema instanceof
|
|
770
|
-
if (schema instanceof
|
|
771
|
-
if (schema instanceof
|
|
772
|
-
if (schema instanceof
|
|
773
|
-
if (schema instanceof
|
|
794
|
+
if (schema instanceof z20.ZodString) return stringNode(schema, path);
|
|
795
|
+
if (schema instanceof z20.ZodNumber) return numberNode(schema, path);
|
|
796
|
+
if (schema instanceof z20.ZodBoolean) return { t: "boolean" };
|
|
797
|
+
if (schema instanceof z20.ZodUnknown || schema instanceof z20.ZodAny) return { t: "unknown" };
|
|
798
|
+
if (schema instanceof z20.ZodLiteral) return literalNode(schema, path);
|
|
799
|
+
if (schema instanceof z20.ZodEnum) return { t: "enum", values: [...schema.options] };
|
|
800
|
+
if (schema instanceof z20.ZodArray) return arrayNode(schema, path);
|
|
801
|
+
if (schema instanceof z20.ZodObject) return objectNode(schema, path);
|
|
802
|
+
if (schema instanceof z20.ZodUnion) {
|
|
774
803
|
const options = schema.options;
|
|
775
804
|
return { t: "union", options: options.map((option, i) => toNode(option, `${path}|${i}`)) };
|
|
776
805
|
}
|
|
777
|
-
if (schema instanceof
|
|
806
|
+
if (schema instanceof z20.ZodDiscriminatedUnion) {
|
|
778
807
|
const options = schema.options;
|
|
779
808
|
return {
|
|
780
809
|
t: "discriminatedUnion",
|
|
@@ -782,13 +811,13 @@ function bare(schema, path) {
|
|
|
782
811
|
options: options.map((option, i) => toNode(option, `${path}|${i}`))
|
|
783
812
|
};
|
|
784
813
|
}
|
|
785
|
-
if (schema instanceof
|
|
786
|
-
if (!(schema.keySchema instanceof
|
|
814
|
+
if (schema instanceof z20.ZodRecord) {
|
|
815
|
+
if (!(schema.keySchema instanceof z20.ZodString)) throw new UnsupportedSchemaError(path, "only string-keyed records are supported");
|
|
787
816
|
return { t: "record", value: toNode(schema.valueSchema, `${path}{}`) };
|
|
788
817
|
}
|
|
789
|
-
if (schema instanceof
|
|
790
|
-
if (schema instanceof
|
|
791
|
-
if (schema instanceof
|
|
818
|
+
if (schema instanceof z20.ZodOptional) return { t: "optional", inner: toNode(schema.unwrap(), path) };
|
|
819
|
+
if (schema instanceof z20.ZodNullable) return { t: "nullable", inner: toNode(schema.unwrap(), path) };
|
|
820
|
+
if (schema instanceof z20.ZodDefault) {
|
|
792
821
|
return { t: "default", inner: toNode(schema._def.innerType, path), value: schema._def.defaultValue() };
|
|
793
822
|
}
|
|
794
823
|
throw new UnsupportedSchemaError(path, `${schema.constructor.name} is not supported`);
|
|
@@ -806,41 +835,41 @@ function schemaToWire(schema) {
|
|
|
806
835
|
}
|
|
807
836
|
|
|
808
837
|
// ../spacestation/src/catalog/wire/schema-from-wire.ts
|
|
809
|
-
import { z as
|
|
838
|
+
import { z as z21 } from "zod";
|
|
810
839
|
|
|
811
840
|
// ../spacestation/src/catalog/wire/catalog-wire.ts
|
|
812
|
-
import { z as
|
|
813
|
-
var WireCatalogEntrySchema =
|
|
814
|
-
type:
|
|
841
|
+
import { z as z22 } from "zod";
|
|
842
|
+
var WireCatalogEntrySchema = z22.object({
|
|
843
|
+
type: z22.string().min(1),
|
|
815
844
|
propsSchema: WireSchemaSchema.optional(),
|
|
816
|
-
examples:
|
|
817
|
-
renderedBy:
|
|
818
|
-
alwaysInclude:
|
|
819
|
-
asks:
|
|
820
|
-
whenToUse:
|
|
821
|
-
dontUseWhen:
|
|
822
|
-
variants:
|
|
823
|
-
dependencies:
|
|
824
|
-
layout:
|
|
825
|
-
size:
|
|
826
|
-
extendsPage:
|
|
827
|
-
bindings:
|
|
828
|
-
|
|
829
|
-
source:
|
|
830
|
-
prop:
|
|
831
|
-
accumulate:
|
|
832
|
-
mountAt:
|
|
845
|
+
examples: z22.array(z22.record(z22.unknown())).optional(),
|
|
846
|
+
renderedBy: z22.string().optional(),
|
|
847
|
+
alwaysInclude: z22.boolean().optional(),
|
|
848
|
+
asks: z22.boolean().optional(),
|
|
849
|
+
whenToUse: z22.string().optional(),
|
|
850
|
+
dontUseWhen: z22.string().optional(),
|
|
851
|
+
variants: z22.string().optional(),
|
|
852
|
+
dependencies: z22.string().optional(),
|
|
853
|
+
layout: z22.enum(["section", "fullbleed"]).optional(),
|
|
854
|
+
size: z22.enum(CANVAS_BLOCK_SIZES).optional(),
|
|
855
|
+
extendsPage: z22.boolean().optional(),
|
|
856
|
+
bindings: z22.array(
|
|
857
|
+
z22.object({
|
|
858
|
+
source: z22.string(),
|
|
859
|
+
prop: z22.string(),
|
|
860
|
+
accumulate: z22.enum(["replace", "append", "concat-text"]).optional(),
|
|
861
|
+
mountAt: z22.string().optional()
|
|
833
862
|
})
|
|
834
863
|
).optional(),
|
|
835
|
-
defaultLayoutWeight:
|
|
836
|
-
defaultMaxHeight:
|
|
837
|
-
category:
|
|
838
|
-
progressLabel:
|
|
839
|
-
isExperience:
|
|
840
|
-
requires:
|
|
841
|
-
provides:
|
|
864
|
+
defaultLayoutWeight: z22.number().optional(),
|
|
865
|
+
defaultMaxHeight: z22.enum(["sm", "md", "lg", "full"]).optional(),
|
|
866
|
+
category: z22.string().optional(),
|
|
867
|
+
progressLabel: z22.string().optional(),
|
|
868
|
+
isExperience: z22.boolean().optional(),
|
|
869
|
+
requires: z22.array(z22.string()).optional(),
|
|
870
|
+
provides: z22.array(z22.string()).optional()
|
|
842
871
|
}).strict();
|
|
843
|
-
var WireCatalogSchema =
|
|
872
|
+
var WireCatalogSchema = z22.record(WireCatalogEntrySchema);
|
|
844
873
|
function propsToWire(type, schema) {
|
|
845
874
|
try {
|
|
846
875
|
return schemaToWire(schema);
|
|
@@ -858,36 +887,36 @@ function catalogToWire(catalog) {
|
|
|
858
887
|
}
|
|
859
888
|
|
|
860
889
|
// ../spacestation/src/catalog/wire/package-release.ts
|
|
861
|
-
import { z as
|
|
890
|
+
import { z as z26 } from "zod";
|
|
862
891
|
|
|
863
892
|
// ../spacestation/src/catalog/wire/brand-mark.ts
|
|
864
|
-
import { z as
|
|
893
|
+
import { z as z23 } from "zod";
|
|
865
894
|
var BRAND_MARK_TYPES = ["svg", "png"];
|
|
866
895
|
var BRAND_MARK_MAX_BYTES = 256 * 1024;
|
|
867
896
|
var MAX_BASE64_LENGTH = Math.ceil(BRAND_MARK_MAX_BYTES / 3) * 4;
|
|
868
|
-
var BrandMarkUploadSchema =
|
|
869
|
-
type:
|
|
870
|
-
data:
|
|
897
|
+
var BrandMarkUploadSchema = z23.object({
|
|
898
|
+
type: z23.enum(BRAND_MARK_TYPES),
|
|
899
|
+
data: z23.string().base64().min(1).max(MAX_BASE64_LENGTH, `a mark file is at most ${BRAND_MARK_MAX_BYTES / 1024} KB`)
|
|
871
900
|
}).strict();
|
|
872
|
-
var BrandMarkStoredSchema =
|
|
873
|
-
type:
|
|
874
|
-
sha256:
|
|
901
|
+
var BrandMarkStoredSchema = z23.object({
|
|
902
|
+
type: z23.enum(BRAND_MARK_TYPES),
|
|
903
|
+
sha256: z23.string().regex(/^[0-9a-f]{64}$/, "a stored mark is named by its sha256")
|
|
875
904
|
}).strict();
|
|
876
|
-
var BrandMarkFileSchema =
|
|
877
|
-
var BrandMarkSchema =
|
|
878
|
-
var BrandMarkImageSchema =
|
|
879
|
-
var SpaceBrandMarkSchema =
|
|
905
|
+
var BrandMarkFileSchema = z23.union([BrandMarkUploadSchema, BrandMarkStoredSchema]);
|
|
906
|
+
var BrandMarkSchema = z23.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");
|
|
907
|
+
var BrandMarkImageSchema = z23.object({ src: z23.string().min(1), type: z23.enum(BRAND_MARK_TYPES) }).strict();
|
|
908
|
+
var SpaceBrandMarkSchema = z23.object({ square: BrandMarkImageSchema.nullable(), wordmark: BrandMarkImageSchema.nullable() }).strict();
|
|
880
909
|
|
|
881
910
|
// ../spacestation/src/catalog/wire/sdk-compat.ts
|
|
882
|
-
import { z as
|
|
911
|
+
import { z as z24 } from "zod";
|
|
883
912
|
var SDK_VERSION_PATTERN = /^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.]{1,32})?$/;
|
|
884
|
-
var SdkVersionSchema =
|
|
913
|
+
var SdkVersionSchema = z24.string().regex(SDK_VERSION_PATTERN, "an sdk version is major.minor.patch");
|
|
885
914
|
|
|
886
915
|
// ../spacestation/src/catalog/wire/host-imports.ts
|
|
887
|
-
import { z as
|
|
888
|
-
var SpecifierSchema =
|
|
889
|
-
var HostImportsSchema =
|
|
890
|
-
var HostExportsSchema =
|
|
916
|
+
import { z as z25 } from "zod";
|
|
917
|
+
var SpecifierSchema = z25.string().min(1).max(200);
|
|
918
|
+
var HostImportsSchema = z25.record(SpecifierSchema, z25.array(z25.string().min(1).max(200)).max(5e3));
|
|
919
|
+
var HostExportsSchema = z25.record(SpecifierSchema, z25.array(z25.string()));
|
|
891
920
|
function hostImportProblems(imports, provided) {
|
|
892
921
|
const problems = [];
|
|
893
922
|
for (const [specifier, names] of Object.entries(imports)) {
|
|
@@ -910,15 +939,15 @@ function hostImportsRefusal(commit) {
|
|
|
910
939
|
var RESERVED_SCOPES = ["@fourty/", "@40rty/"];
|
|
911
940
|
var BUNDLE_ASSET_PATH = /^assets\/[A-Za-z0-9_-]+\.(woff2?|ttf|otf|png|jpe?g|svg|gif|webp)$/;
|
|
912
941
|
var RELEASE_MESSAGE_MAX = 140;
|
|
913
|
-
var ReleaseMessageSchema =
|
|
914
|
-
var PackageReleaseSchema =
|
|
942
|
+
var ReleaseMessageSchema = z26.string().trim().min(1, "say what this release changes").max(RELEASE_MESSAGE_MAX, `keep the message to one line of ${RELEASE_MESSAGE_MAX} characters or fewer`);
|
|
943
|
+
var PackageReleaseSchema = z26.object({
|
|
915
944
|
/** The id spaces name in `componentSources` — an npm-style package name. */
|
|
916
|
-
sourceId:
|
|
917
|
-
label:
|
|
945
|
+
sourceId: z26.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`),
|
|
946
|
+
label: z26.string().min(1).max(120),
|
|
918
947
|
/** The package's own version, as its repository states it — shown in the console. */
|
|
919
|
-
version:
|
|
948
|
+
version: z26.string().min(1).max(40),
|
|
920
949
|
/** What this release changed, in the publisher's words (`forty publish --message`) — shown in the console's version list. */
|
|
921
|
-
description:
|
|
950
|
+
description: z26.string().min(1).max(500).optional(),
|
|
922
951
|
/**
|
|
923
952
|
* The `@40rty/ams-sdk` version the brand project resolved when `forty
|
|
924
953
|
* publish` built this release. A bundle takes the sdk from the page at
|
|
@@ -938,7 +967,7 @@ var PackageReleaseSchema = z25.object({
|
|
|
938
967
|
hostImports: HostImportsSchema.optional(),
|
|
939
968
|
catalog: WireCatalogSchema,
|
|
940
969
|
/** Component manifests by path under `catalogs/`, e.g. `catalogs/product/productGrid.md`. */
|
|
941
|
-
manifests:
|
|
970
|
+
manifests: z26.record(z26.string().regex(/^catalogs\/.+\.md$/, "a manifest path is catalogs/<\u2026>.md"), z26.string()),
|
|
942
971
|
/**
|
|
943
972
|
* The brand's components, built — present when the PLATFORM hosts this
|
|
944
973
|
* brand's spacefront, absent when the brand hosts it in its own app. One
|
|
@@ -947,17 +976,17 @@ var PackageReleaseSchema = z25.object({
|
|
|
947
976
|
* images — base64, keyed by the path the stylesheet's `url()` names, beside
|
|
948
977
|
* it). It is served to browsers; the platform's servers never run it.
|
|
949
978
|
*/
|
|
950
|
-
bundle:
|
|
951
|
-
js:
|
|
952
|
-
css:
|
|
953
|
-
assets:
|
|
979
|
+
bundle: z26.object({
|
|
980
|
+
js: z26.string().min(1),
|
|
981
|
+
css: z26.string(),
|
|
982
|
+
assets: z26.record(z26.string().regex(BUNDLE_ASSET_PATH, "an asset is assets/<name>.<font or image extension>"), z26.string().base64()).optional()
|
|
954
983
|
}).strict().optional(),
|
|
955
984
|
/**
|
|
956
985
|
* The class the spacefront root carries while this package is the space's.
|
|
957
986
|
* The package's own stylesheet styles under it. Absent = the platform's
|
|
958
987
|
* default theme class.
|
|
959
988
|
*/
|
|
960
|
-
theme:
|
|
989
|
+
theme: z26.object({ themeClass: z26.string().regex(/^[a-z][a-z0-9-]*$/, "a theme class is lowercase letters, digits and hyphens") }).strict().optional(),
|
|
961
990
|
/**
|
|
962
991
|
* The brand's mark (`brand-mark.ts`). Sent as the files themselves; the
|
|
963
992
|
* platform stores them content-addressed at ingest and keeps only their
|
|
@@ -970,7 +999,7 @@ var PackageReleaseSchema = z25.object({
|
|
|
970
999
|
* The package's own composition guidance for its own components — prompt
|
|
971
1000
|
* markdown the agent reads, gated on the capabilities it names (`requires`).
|
|
972
1001
|
*/
|
|
973
|
-
promptSections:
|
|
1002
|
+
promptSections: z26.array(z26.object({ id: z26.string().regex(/^[a-z0-9-]+$/), order: z26.number().int(), content: z26.string().min(1).max(2e4), requires: z26.array(z26.string()) }).strict()).max(10).optional(),
|
|
974
1003
|
/**
|
|
975
1004
|
* The brand's SPACE prompt — its `prompts/space.md`, verbatim: sections split
|
|
976
1005
|
* by `<!-- section:<id> -->` markers, the same format as the platform's
|
|
@@ -978,85 +1007,85 @@ var PackageReleaseSchema = z25.object({
|
|
|
978
1007
|
* package. How the brand speaks, what it sells and what it never claims ship
|
|
979
1008
|
* with the brand, and a release changes them with no platform deploy.
|
|
980
1009
|
*/
|
|
981
|
-
spacePrompt:
|
|
1010
|
+
spacePrompt: z26.string().min(1).max(2e5).optional(),
|
|
982
1011
|
/**
|
|
983
1012
|
* Opaque per-vertical extension data (`BrandDefinition.config`): the
|
|
984
1013
|
* platform stays vertical-agnostic and the vertical's own code reads its keys.
|
|
985
1014
|
*/
|
|
986
|
-
config:
|
|
1015
|
+
config: z26.record(z26.string(), z26.unknown()).optional(),
|
|
987
1016
|
/**
|
|
988
1017
|
* Set by the platform, never by a publisher: this release is a DRAFT of the
|
|
989
1018
|
* package `of`, previewed on the space `space`. See `draftSourceId`.
|
|
990
1019
|
*/
|
|
991
|
-
draft:
|
|
1020
|
+
draft: z26.object({ of: z26.string().min(1), space: z26.string().min(1) }).strict().optional()
|
|
992
1021
|
}).strict();
|
|
993
1022
|
|
|
994
1023
|
// ../spacestation/src/catalog/wire/package-bundle-ref.ts
|
|
995
|
-
import { z as
|
|
996
|
-
var PackageBundleRefSchema =
|
|
997
|
-
sourceId:
|
|
998
|
-
js:
|
|
999
|
-
css:
|
|
1024
|
+
import { z as z27 } from "zod";
|
|
1025
|
+
var PackageBundleRefSchema = z27.object({
|
|
1026
|
+
sourceId: z27.string(),
|
|
1027
|
+
js: z27.string(),
|
|
1028
|
+
css: z27.string(),
|
|
1000
1029
|
/** The brand's name for itself, and its package's version. */
|
|
1001
|
-
label:
|
|
1002
|
-
version:
|
|
1030
|
+
label: z27.string(),
|
|
1031
|
+
version: z27.string(),
|
|
1003
1032
|
/** The sdk the bundle was built against (`PackageRelease.builtWithSdk`) — absent for a legacy release. Picks its compat shims. */
|
|
1004
1033
|
builtWithSdk: SdkVersionSchema.optional()
|
|
1005
1034
|
});
|
|
1006
1035
|
|
|
1007
1036
|
// ../spacestation/src/projection/projection.ts
|
|
1008
|
-
import { z as
|
|
1009
|
-
var LateBoundValueSchema =
|
|
1010
|
-
var DirectiveValueSchema =
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1037
|
+
import { z as z28 } from "zod";
|
|
1038
|
+
var LateBoundValueSchema = z28.object({ fact: z28.literal(true) });
|
|
1039
|
+
var DirectiveValueSchema = z28.union([
|
|
1040
|
+
z28.string(),
|
|
1041
|
+
z28.number(),
|
|
1042
|
+
z28.boolean(),
|
|
1014
1043
|
LateBoundValueSchema
|
|
1015
1044
|
]);
|
|
1016
|
-
var ProjectionDirectiveSchema =
|
|
1045
|
+
var ProjectionDirectiveSchema = z28.object({
|
|
1017
1046
|
/** Keep only items whose axis values all match. Keyed by axis name
|
|
1018
1047
|
* (e.g. `Size`); value is a literal or the `{fact:true}` marker. */
|
|
1019
|
-
isolateTo:
|
|
1048
|
+
isolateTo: z28.record(DirectiveValueSchema).optional(),
|
|
1020
1049
|
/** Isolate to EVERY axis the visitor has a stored fact for. The agent
|
|
1021
1050
|
* emits this (it is vertical-agnostic — it cannot name axes); the
|
|
1022
1051
|
* entity binding expands it against the entity's own axes + facts. */
|
|
1023
|
-
isolateToFacts:
|
|
1052
|
+
isolateToFacts: z28.boolean().optional(),
|
|
1024
1053
|
/** Keep only items the entity binding reports as available. */
|
|
1025
|
-
availableOnly:
|
|
1054
|
+
availableOnly: z28.boolean().optional(),
|
|
1026
1055
|
/** Cap the rendered count after filtering. */
|
|
1027
|
-
limit:
|
|
1056
|
+
limit: z28.number().int().positive().optional()
|
|
1028
1057
|
});
|
|
1029
|
-
var ProjectionPreferencesSchema =
|
|
1030
|
-
|
|
1058
|
+
var ProjectionPreferencesSchema = z28.record(
|
|
1059
|
+
z28.union([ProjectionDirectiveSchema, z28.null()])
|
|
1031
1060
|
);
|
|
1032
|
-
var ProjectionSetPayloadSchema =
|
|
1033
|
-
setAll:
|
|
1061
|
+
var ProjectionSetPayloadSchema = z28.object({
|
|
1062
|
+
setAll: z28.union([ProjectionDirectiveSchema, z28.null()]).optional(),
|
|
1034
1063
|
set: ProjectionPreferencesSchema.optional()
|
|
1035
1064
|
});
|
|
1036
1065
|
|
|
1037
1066
|
// ../spacestation/src/host/host-page.ts
|
|
1038
|
-
import { z as
|
|
1039
|
-
var HostPayloadSchema =
|
|
1067
|
+
import { z as z29 } from "zod";
|
|
1068
|
+
var HostPayloadSchema = z29.object({
|
|
1040
1069
|
page: PageSchema.nullable(),
|
|
1041
|
-
maxSections:
|
|
1042
|
-
surface:
|
|
1070
|
+
maxSections: z29.number().int().positive().nullable(),
|
|
1071
|
+
surface: z29.enum(["page", "slot"])
|
|
1043
1072
|
});
|
|
1044
|
-
var HostClearedSchema =
|
|
1073
|
+
var HostClearedSchema = z29.object({ cleared: z29.literal(true) });
|
|
1045
1074
|
|
|
1046
1075
|
// ../spacestation/src/focus/focus.ts
|
|
1047
|
-
import { z as
|
|
1048
|
-
var FocusElementPayloadSchema =
|
|
1049
|
-
elementId:
|
|
1076
|
+
import { z as z30 } from "zod";
|
|
1077
|
+
var FocusElementPayloadSchema = z30.object({
|
|
1078
|
+
elementId: z30.string().min(1)
|
|
1050
1079
|
});
|
|
1051
1080
|
|
|
1052
1081
|
// ../spacestation/src/view/continuation.ts
|
|
1053
|
-
import { z as
|
|
1054
|
-
var ViewExtendPayloadSchema =
|
|
1055
|
-
reason:
|
|
1082
|
+
import { z as z31 } from "zod";
|
|
1083
|
+
var ViewExtendPayloadSchema = z31.object({
|
|
1084
|
+
reason: z31.enum(["scroll_near_bottom"])
|
|
1056
1085
|
});
|
|
1057
1086
|
|
|
1058
1087
|
// ../spacestation/src/attachment/attachment.ts
|
|
1059
|
-
import { z as
|
|
1088
|
+
import { z as z32 } from "zod";
|
|
1060
1089
|
var ALLOWED_ATTACHMENT_TYPES = [
|
|
1061
1090
|
"image/jpeg",
|
|
1062
1091
|
"image/png",
|
|
@@ -1068,39 +1097,39 @@ var MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
|
|
1068
1097
|
function isAllowedAttachmentType(mime) {
|
|
1069
1098
|
return ALLOWED_ATTACHMENT_TYPES.includes(mime);
|
|
1070
1099
|
}
|
|
1071
|
-
var AttachmentRefSchema =
|
|
1100
|
+
var AttachmentRefSchema = z32.object({
|
|
1072
1101
|
// A UUID, as `storeAttachment` mints it: the id becomes a storage path segment,
|
|
1073
1102
|
// so nothing else — no `/`, no `..` — may reach that lookup.
|
|
1074
|
-
id:
|
|
1075
|
-
mimeType:
|
|
1103
|
+
id: z32.string().uuid(),
|
|
1104
|
+
mimeType: z32.string().refine(isAllowedAttachmentType, {
|
|
1076
1105
|
message: "mimeType not on the attachment allow-list"
|
|
1077
1106
|
}),
|
|
1078
|
-
name:
|
|
1079
|
-
size:
|
|
1080
|
-
url:
|
|
1107
|
+
name: z32.string().min(1),
|
|
1108
|
+
size: z32.number().int().positive().max(MAX_ATTACHMENT_BYTES),
|
|
1109
|
+
url: z32.string().min(1)
|
|
1081
1110
|
});
|
|
1082
|
-
var AttachmentRefsSchema =
|
|
1111
|
+
var AttachmentRefsSchema = z32.array(AttachmentRefSchema);
|
|
1083
1112
|
|
|
1084
1113
|
// ../spacestation/src/attachment/attachment-failure.ts
|
|
1085
1114
|
var MAX_ATTACHMENT_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
|
|
1086
1115
|
|
|
1087
1116
|
// ../spacestation/src/contracts/entry-context.ts
|
|
1088
|
-
import { z as
|
|
1117
|
+
import { z as z33 } from "zod";
|
|
1089
1118
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
1090
1119
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
1091
1120
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
1092
1121
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
1093
|
-
var EntryContextValueSchema =
|
|
1094
|
-
var EntryContextNameSchema =
|
|
1095
|
-
var EntryContextNamespaceSchema =
|
|
1122
|
+
var EntryContextValueSchema = z33.string().trim().min(1).max(ENTRY_CONTEXT_MAX_VALUE_CHARS);
|
|
1123
|
+
var EntryContextNameSchema = z33.string().trim().min(1).max(ENTRY_CONTEXT_MAX_NAME_CHARS);
|
|
1124
|
+
var EntryContextNamespaceSchema = z33.record(EntryContextNameSchema, EntryContextValueSchema).refine((entries) => Object.keys(entries).length <= ENTRY_CONTEXT_MAX_KEYS, {
|
|
1096
1125
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
1097
1126
|
});
|
|
1098
|
-
var EntryContextSchema =
|
|
1127
|
+
var EntryContextSchema = z33.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
1099
1128
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
1100
1129
|
});
|
|
1101
1130
|
|
|
1102
1131
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
1103
|
-
import { z as
|
|
1132
|
+
import { z as z34 } from "zod";
|
|
1104
1133
|
var SURFACES = [
|
|
1105
1134
|
"spacefront",
|
|
1106
1135
|
"embed",
|
|
@@ -1110,11 +1139,11 @@ var SURFACES = [
|
|
|
1110
1139
|
"playground",
|
|
1111
1140
|
"automation"
|
|
1112
1141
|
];
|
|
1113
|
-
var SurfaceSchema =
|
|
1142
|
+
var SurfaceSchema = z34.enum(SURFACES);
|
|
1114
1143
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
1115
|
-
var ClickIdKindSchema =
|
|
1144
|
+
var ClickIdKindSchema = z34.enum(CLICK_ID_KINDS);
|
|
1116
1145
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
1117
|
-
var VisitorIdDurabilitySchema =
|
|
1146
|
+
var VisitorIdDurabilitySchema = z34.enum(VISITOR_ID_DURABILITIES);
|
|
1118
1147
|
var TRAFFIC_BUCKETS = [
|
|
1119
1148
|
"paid_google",
|
|
1120
1149
|
"paid_meta",
|
|
@@ -1126,10 +1155,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
1126
1155
|
"direct",
|
|
1127
1156
|
"unknown"
|
|
1128
1157
|
];
|
|
1129
|
-
var TrafficBucketSchema =
|
|
1158
|
+
var TrafficBucketSchema = z34.enum(TRAFFIC_BUCKETS);
|
|
1130
1159
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
1131
|
-
var ArrivalValueSchema =
|
|
1132
|
-
var SessionArrivalSchema =
|
|
1160
|
+
var ArrivalValueSchema = z34.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
1161
|
+
var SessionArrivalSchema = z34.object({
|
|
1133
1162
|
utmSource: ArrivalValueSchema.optional(),
|
|
1134
1163
|
utmMedium: ArrivalValueSchema.optional(),
|
|
1135
1164
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -1167,92 +1196,92 @@ var WIRE_PROTOCOL_VERSION = 1;
|
|
|
1167
1196
|
var WIRE_PROTOCOL_PARAM = "protocol";
|
|
1168
1197
|
|
|
1169
1198
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
1170
|
-
import { z as
|
|
1171
|
-
var AttributeScopeBucketSchema =
|
|
1172
|
-
scope:
|
|
1173
|
-
needles:
|
|
1174
|
-
label:
|
|
1175
|
-
});
|
|
1176
|
-
var AttributeScopeConfigSchema =
|
|
1177
|
-
facet:
|
|
1178
|
-
buckets:
|
|
1179
|
-
emptyScope:
|
|
1180
|
-
noMatchScope:
|
|
1181
|
-
ignoreValues:
|
|
1182
|
-
emptyScopeLabel:
|
|
1183
|
-
noMatchScopeLabel:
|
|
1184
|
-
});
|
|
1185
|
-
var AttributeDefBaseSchema =
|
|
1186
|
-
description:
|
|
1187
|
-
durable:
|
|
1188
|
-
label:
|
|
1189
|
-
});
|
|
1190
|
-
var AttributeDefSchema =
|
|
1191
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1192
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1193
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1194
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
1199
|
+
import { z as z35 } from "zod";
|
|
1200
|
+
var AttributeScopeBucketSchema = z35.object({
|
|
1201
|
+
scope: z35.string(),
|
|
1202
|
+
needles: z35.array(z35.string()).readonly(),
|
|
1203
|
+
label: z35.string().optional()
|
|
1204
|
+
});
|
|
1205
|
+
var AttributeScopeConfigSchema = z35.object({
|
|
1206
|
+
facet: z35.string(),
|
|
1207
|
+
buckets: z35.array(AttributeScopeBucketSchema).readonly(),
|
|
1208
|
+
emptyScope: z35.string(),
|
|
1209
|
+
noMatchScope: z35.string(),
|
|
1210
|
+
ignoreValues: z35.array(z35.string()).readonly(),
|
|
1211
|
+
emptyScopeLabel: z35.string().optional(),
|
|
1212
|
+
noMatchScopeLabel: z35.string().optional()
|
|
1213
|
+
});
|
|
1214
|
+
var AttributeDefBaseSchema = z35.object({
|
|
1215
|
+
description: z35.string().optional(),
|
|
1216
|
+
durable: z35.boolean().optional(),
|
|
1217
|
+
label: z35.string().optional()
|
|
1218
|
+
});
|
|
1219
|
+
var AttributeDefSchema = z35.discriminatedUnion("kind", [
|
|
1220
|
+
AttributeDefBaseSchema.extend({ kind: z35.literal("enum"), values: z35.array(z35.string()) }),
|
|
1221
|
+
AttributeDefBaseSchema.extend({ kind: z35.literal("free_text") }),
|
|
1222
|
+
AttributeDefBaseSchema.extend({ kind: z35.literal("date_or_season") }),
|
|
1223
|
+
AttributeDefBaseSchema.extend({ kind: z35.literal("money_or_band") }),
|
|
1195
1224
|
AttributeDefBaseSchema.extend({
|
|
1196
|
-
kind:
|
|
1197
|
-
min:
|
|
1198
|
-
max:
|
|
1199
|
-
unit:
|
|
1225
|
+
kind: z35.literal("number"),
|
|
1226
|
+
min: z35.number().optional(),
|
|
1227
|
+
max: z35.number().optional(),
|
|
1228
|
+
unit: z35.string().optional()
|
|
1200
1229
|
})
|
|
1201
1230
|
]);
|
|
1202
1231
|
|
|
1203
1232
|
// ../spacestation/src/space/agent-directive.ts
|
|
1204
|
-
import { z as
|
|
1233
|
+
import { z as z36 } from "zod";
|
|
1205
1234
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
1206
1235
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
1207
1236
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
1208
1237
|
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
1209
|
-
var AgentDirectiveSchema =
|
|
1210
|
-
name:
|
|
1211
|
-
kind:
|
|
1212
|
-
severity:
|
|
1238
|
+
var AgentDirectiveSchema = z36.object({
|
|
1239
|
+
name: z36.string().trim().min(1).max(80),
|
|
1240
|
+
kind: z36.enum(AGENT_DIRECTIVE_KINDS),
|
|
1241
|
+
severity: z36.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
1213
1242
|
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
1214
1243
|
* product name. */
|
|
1215
|
-
text:
|
|
1244
|
+
text: z36.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
1216
1245
|
}).strict();
|
|
1217
|
-
var SpaceAgentDirectiveSchema =
|
|
1218
|
-
id:
|
|
1219
|
-
position:
|
|
1220
|
-
name:
|
|
1221
|
-
kind:
|
|
1222
|
-
severity:
|
|
1223
|
-
text:
|
|
1224
|
-
source:
|
|
1225
|
-
status:
|
|
1246
|
+
var SpaceAgentDirectiveSchema = z36.object({
|
|
1247
|
+
id: z36.string(),
|
|
1248
|
+
position: z36.number().int(),
|
|
1249
|
+
name: z36.string(),
|
|
1250
|
+
kind: z36.enum(AGENT_DIRECTIVE_KINDS),
|
|
1251
|
+
severity: z36.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
1252
|
+
text: z36.string(),
|
|
1253
|
+
source: z36.enum(AGENT_DIRECTIVE_SOURCES),
|
|
1254
|
+
status: z36.enum(AGENT_DIRECTIVE_STATUSES),
|
|
1226
1255
|
/** Who wrote it; null for a lesson the system proposed. */
|
|
1227
|
-
createdBy:
|
|
1256
|
+
createdBy: z36.string().nullable(),
|
|
1228
1257
|
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
1229
|
-
evidence:
|
|
1230
|
-
decidedBy:
|
|
1231
|
-
decidedAt:
|
|
1232
|
-
createdAt:
|
|
1258
|
+
evidence: z36.record(z36.unknown()).nullable(),
|
|
1259
|
+
decidedBy: z36.string().nullable(),
|
|
1260
|
+
decidedAt: z36.string().nullable(),
|
|
1261
|
+
createdAt: z36.string()
|
|
1233
1262
|
});
|
|
1234
|
-
var OutcomeTallySchema =
|
|
1263
|
+
var OutcomeTallySchema = z36.object({ turns: z36.number().int(), acted: z36.number().int() });
|
|
1235
1264
|
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
1236
|
-
impact:
|
|
1265
|
+
impact: z36.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
1237
1266
|
});
|
|
1238
|
-
var UpdateAgentDirectiveInputSchema =
|
|
1267
|
+
var UpdateAgentDirectiveInputSchema = z36.object({
|
|
1239
1268
|
name: AgentDirectiveSchema.shape.name.optional(),
|
|
1240
1269
|
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
1241
1270
|
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
1242
1271
|
text: AgentDirectiveSchema.shape.text.optional(),
|
|
1243
|
-
status:
|
|
1272
|
+
status: z36.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
1244
1273
|
}).strict();
|
|
1245
|
-
var ReorderAgentDirectivesInputSchema =
|
|
1274
|
+
var ReorderAgentDirectivesInputSchema = z36.object({ ids: z36.array(z36.string()).min(1) }).strict();
|
|
1246
1275
|
|
|
1247
1276
|
// ../spacestation/src/shell/bot-check-notice.ts
|
|
1248
|
-
import { z as
|
|
1249
|
-
var BotCheckNoticeSchema =
|
|
1277
|
+
import { z as z37 } from "zod";
|
|
1278
|
+
var BotCheckNoticeSchema = z37.object({
|
|
1250
1279
|
/** Read in order: plain text, and links the notice must keep linked. */
|
|
1251
|
-
segments:
|
|
1280
|
+
segments: z37.array(z37.union([z37.string(), z37.object({ text: z37.string(), href: z37.string().url() })])).min(1)
|
|
1252
1281
|
});
|
|
1253
1282
|
|
|
1254
1283
|
// ../spacestation/src/space/space-locale.ts
|
|
1255
|
-
import { z as
|
|
1284
|
+
import { z as z38 } from "zod";
|
|
1256
1285
|
function isBcp47(tag) {
|
|
1257
1286
|
try {
|
|
1258
1287
|
return new Intl.Locale(tag).language.length > 0;
|
|
@@ -1261,7 +1290,7 @@ function isBcp47(tag) {
|
|
|
1261
1290
|
throw err;
|
|
1262
1291
|
}
|
|
1263
1292
|
}
|
|
1264
|
-
var SpaceLocaleSchema =
|
|
1293
|
+
var SpaceLocaleSchema = z38.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
1265
1294
|
|
|
1266
1295
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
1267
1296
|
var COMPONENT_SOURCE = {
|
|
@@ -1291,30 +1320,30 @@ var DEFAULT_SPACE_CONFIG = {
|
|
|
1291
1320
|
};
|
|
1292
1321
|
|
|
1293
1322
|
// ../spacestation/src/space/trace.ts
|
|
1294
|
-
import { z as
|
|
1295
|
-
var RunTokenUsageSchema =
|
|
1296
|
-
input_tokens:
|
|
1297
|
-
output_tokens:
|
|
1298
|
-
cache_read_tokens:
|
|
1299
|
-
});
|
|
1300
|
-
var TraceRecordSchema =
|
|
1301
|
-
id:
|
|
1302
|
-
spaceId:
|
|
1303
|
-
sessionId:
|
|
1323
|
+
import { z as z39 } from "zod";
|
|
1324
|
+
var RunTokenUsageSchema = z39.object({
|
|
1325
|
+
input_tokens: z39.number().optional(),
|
|
1326
|
+
output_tokens: z39.number().optional(),
|
|
1327
|
+
cache_read_tokens: z39.number().optional()
|
|
1328
|
+
});
|
|
1329
|
+
var TraceRecordSchema = z39.object({
|
|
1330
|
+
id: z39.string().uuid(),
|
|
1331
|
+
spaceId: z39.string().uuid().nullable(),
|
|
1332
|
+
sessionId: z39.string(),
|
|
1304
1333
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
1305
1334
|
* for an unlocked space / anonymous unlock. */
|
|
1306
|
-
visitorEmail:
|
|
1307
|
-
userPrompt:
|
|
1308
|
-
branch:
|
|
1309
|
-
responseText:
|
|
1310
|
-
layout:
|
|
1311
|
-
phaseTimings:
|
|
1312
|
-
tokensByModel:
|
|
1313
|
-
toolCalls:
|
|
1314
|
-
diagnostics:
|
|
1315
|
-
latencyFirstText:
|
|
1316
|
-
latencyFirstPatch:
|
|
1317
|
-
latencyTotal:
|
|
1335
|
+
visitorEmail: z39.string().nullable(),
|
|
1336
|
+
userPrompt: z39.string(),
|
|
1337
|
+
branch: z39.string().nullable(),
|
|
1338
|
+
responseText: z39.string().nullable(),
|
|
1339
|
+
layout: z39.unknown().nullable(),
|
|
1340
|
+
phaseTimings: z39.record(z39.number()).nullable(),
|
|
1341
|
+
tokensByModel: z39.record(RunTokenUsageSchema).nullable(),
|
|
1342
|
+
toolCalls: z39.array(z39.unknown()).nullable(),
|
|
1343
|
+
diagnostics: z39.array(z39.unknown()).nullable(),
|
|
1344
|
+
latencyFirstText: z39.number().int().nullable(),
|
|
1345
|
+
latencyFirstPatch: z39.number().int().nullable(),
|
|
1346
|
+
latencyTotal: z39.number().int().nullable(),
|
|
1318
1347
|
/**
|
|
1319
1348
|
* The CLIENT's turn id for this run, or `null`.
|
|
1320
1349
|
*
|
|
@@ -1330,29 +1359,29 @@ var TraceRecordSchema = z38.object({
|
|
|
1330
1359
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1331
1360
|
* visitor asked something and got nothing.
|
|
1332
1361
|
*/
|
|
1333
|
-
turnId:
|
|
1362
|
+
turnId: z39.string().nullable(),
|
|
1334
1363
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
1335
1364
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
1336
|
-
trackerState:
|
|
1337
|
-
createdAt:
|
|
1338
|
-
});
|
|
1339
|
-
var MillisecondsSchema =
|
|
1340
|
-
var CreateTraceInputSchema =
|
|
1341
|
-
spaceId:
|
|
1342
|
-
sessionId:
|
|
1343
|
-
visitorEmail:
|
|
1344
|
-
userPrompt:
|
|
1345
|
-
branch:
|
|
1346
|
-
responseText:
|
|
1347
|
-
layout:
|
|
1348
|
-
phaseTimings:
|
|
1349
|
-
tokensByModel:
|
|
1350
|
-
toolCalls:
|
|
1351
|
-
diagnostics:
|
|
1365
|
+
trackerState: z39.unknown().nullable(),
|
|
1366
|
+
createdAt: z39.string()
|
|
1367
|
+
});
|
|
1368
|
+
var MillisecondsSchema = z39.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
1369
|
+
var CreateTraceInputSchema = z39.object({
|
|
1370
|
+
spaceId: z39.string().uuid().nullable(),
|
|
1371
|
+
sessionId: z39.string(),
|
|
1372
|
+
visitorEmail: z39.string().nullable(),
|
|
1373
|
+
userPrompt: z39.string(),
|
|
1374
|
+
branch: z39.string().nullable(),
|
|
1375
|
+
responseText: z39.string().nullable(),
|
|
1376
|
+
layout: z39.unknown().nullable(),
|
|
1377
|
+
phaseTimings: z39.record(z39.number()).nullable(),
|
|
1378
|
+
tokensByModel: z39.record(RunTokenUsageSchema).nullable(),
|
|
1379
|
+
toolCalls: z39.array(z39.unknown()).nullable(),
|
|
1380
|
+
diagnostics: z39.array(z39.unknown()).nullable(),
|
|
1352
1381
|
latencyFirstText: MillisecondsSchema,
|
|
1353
1382
|
latencyFirstPatch: MillisecondsSchema,
|
|
1354
1383
|
latencyTotal: MillisecondsSchema,
|
|
1355
|
-
trackerState:
|
|
1384
|
+
trackerState: z39.unknown().nullable(),
|
|
1356
1385
|
/**
|
|
1357
1386
|
* The CLIENT's turn id for this run, or `null`.
|
|
1358
1387
|
*
|
|
@@ -1368,37 +1397,37 @@ var CreateTraceInputSchema = z38.object({
|
|
|
1368
1397
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
1369
1398
|
* visitor asked something and got nothing.
|
|
1370
1399
|
*/
|
|
1371
|
-
turnId:
|
|
1400
|
+
turnId: z39.string().nullable()
|
|
1372
1401
|
});
|
|
1373
|
-
var AgentSessionSummarySchema =
|
|
1374
|
-
sessionId:
|
|
1402
|
+
var AgentSessionSummarySchema = z39.object({
|
|
1403
|
+
sessionId: z39.string(),
|
|
1375
1404
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
1376
|
-
turnCount:
|
|
1405
|
+
turnCount: z39.number().int(),
|
|
1377
1406
|
/** The session's opening prompt — titles the row in the UI. */
|
|
1378
|
-
firstPrompt:
|
|
1379
|
-
startedAt:
|
|
1380
|
-
lastRunAt:
|
|
1407
|
+
firstPrompt: z39.string(),
|
|
1408
|
+
startedAt: z39.string(),
|
|
1409
|
+
lastRunAt: z39.string(),
|
|
1381
1410
|
/** Summed `latency_total` across the session's turns. */
|
|
1382
|
-
totalLatencyMs:
|
|
1411
|
+
totalLatencyMs: z39.number().int()
|
|
1383
1412
|
});
|
|
1384
|
-
var SessionTurnSchema =
|
|
1385
|
-
id:
|
|
1386
|
-
userPrompt:
|
|
1387
|
-
responseText:
|
|
1413
|
+
var SessionTurnSchema = z39.object({
|
|
1414
|
+
id: z39.string().uuid(),
|
|
1415
|
+
userPrompt: z39.string(),
|
|
1416
|
+
responseText: z39.string().nullable(),
|
|
1388
1417
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
1389
|
-
layout:
|
|
1390
|
-
createdAt:
|
|
1391
|
-
latencyTotal:
|
|
1392
|
-
phaseTimings:
|
|
1393
|
-
tokensByModel:
|
|
1394
|
-
input_tokens:
|
|
1395
|
-
output_tokens:
|
|
1418
|
+
layout: z39.unknown().nullable(),
|
|
1419
|
+
createdAt: z39.string(),
|
|
1420
|
+
latencyTotal: z39.number().int().nullable(),
|
|
1421
|
+
phaseTimings: z39.record(z39.number()).nullable(),
|
|
1422
|
+
tokensByModel: z39.record(z39.object({
|
|
1423
|
+
input_tokens: z39.number().optional(),
|
|
1424
|
+
output_tokens: z39.number().optional()
|
|
1396
1425
|
})).nullable(),
|
|
1397
|
-
toolCalls:
|
|
1398
|
-
diagnostics:
|
|
1426
|
+
toolCalls: z39.array(z39.unknown()).nullable(),
|
|
1427
|
+
diagnostics: z39.array(z39.unknown()).nullable()
|
|
1399
1428
|
});
|
|
1400
|
-
var SessionReplaySchema =
|
|
1401
|
-
turns:
|
|
1429
|
+
var SessionReplaySchema = z39.object({
|
|
1430
|
+
turns: z39.array(SessionTurnSchema),
|
|
1402
1431
|
/**
|
|
1403
1432
|
* The session's own last-committed layout, read straight off the durable
|
|
1404
1433
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -1409,20 +1438,20 @@ var SessionReplaySchema = z38.object({
|
|
|
1409
1438
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
1410
1439
|
* when the durable session row itself could not be read.
|
|
1411
1440
|
*/
|
|
1412
|
-
sessionLayout:
|
|
1441
|
+
sessionLayout: z39.record(z39.string(), z39.unknown()).nullable()
|
|
1413
1442
|
});
|
|
1414
|
-
var SessionTraceSchema =
|
|
1415
|
-
trackerState:
|
|
1443
|
+
var SessionTraceSchema = z39.object({
|
|
1444
|
+
trackerState: z39.string().nullable()
|
|
1416
1445
|
});
|
|
1417
|
-
var LlmUsageDailySchema =
|
|
1418
|
-
day:
|
|
1446
|
+
var LlmUsageDailySchema = z39.object({
|
|
1447
|
+
day: z39.string(),
|
|
1419
1448
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
1420
|
-
environment:
|
|
1421
|
-
feature:
|
|
1422
|
-
model:
|
|
1423
|
-
provider:
|
|
1449
|
+
environment: z39.string(),
|
|
1450
|
+
feature: z39.string(),
|
|
1451
|
+
model: z39.string(),
|
|
1452
|
+
provider: z39.string(),
|
|
1424
1453
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
1425
|
-
keyFingerprint:
|
|
1454
|
+
keyFingerprint: z39.string().nullable(),
|
|
1426
1455
|
/**
|
|
1427
1456
|
* The space the call served, or null when it served none.
|
|
1428
1457
|
*
|
|
@@ -1431,91 +1460,91 @@ var LlmUsageDailySchema = z38.object({
|
|
|
1431
1460
|
* report that share rather than dropping it, or a per-space total reads as
|
|
1432
1461
|
* the platform total.
|
|
1433
1462
|
*/
|
|
1434
|
-
spaceId:
|
|
1463
|
+
spaceId: z39.string().nullable(),
|
|
1435
1464
|
/**
|
|
1436
1465
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
1437
1466
|
* when it served no session or the session predates surface recording.
|
|
1438
1467
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
1439
1468
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
1440
1469
|
*/
|
|
1441
|
-
surface:
|
|
1442
|
-
inputTokens:
|
|
1443
|
-
outputTokens:
|
|
1470
|
+
surface: z39.string().nullable(),
|
|
1471
|
+
inputTokens: z39.number(),
|
|
1472
|
+
outputTokens: z39.number(),
|
|
1444
1473
|
/** Subset of inputTokens, never additional to it. */
|
|
1445
|
-
cachedInputTokens:
|
|
1446
|
-
reasoningTokens:
|
|
1447
|
-
callCount:
|
|
1448
|
-
errorCount:
|
|
1449
|
-
estimatedCostUsd:
|
|
1450
|
-
});
|
|
1451
|
-
var LlmUsageBySessionSchema =
|
|
1452
|
-
sessionId:
|
|
1453
|
-
environment:
|
|
1454
|
-
model:
|
|
1474
|
+
cachedInputTokens: z39.number(),
|
|
1475
|
+
reasoningTokens: z39.number(),
|
|
1476
|
+
callCount: z39.number(),
|
|
1477
|
+
errorCount: z39.number(),
|
|
1478
|
+
estimatedCostUsd: z39.number().nullable()
|
|
1479
|
+
});
|
|
1480
|
+
var LlmUsageBySessionSchema = z39.object({
|
|
1481
|
+
sessionId: z39.string(),
|
|
1482
|
+
environment: z39.string(),
|
|
1483
|
+
model: z39.string(),
|
|
1455
1484
|
/** The space this session belongs to, or null for a session with no space. */
|
|
1456
|
-
spaceId:
|
|
1485
|
+
spaceId: z39.string().nullable(),
|
|
1457
1486
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
1458
|
-
surface:
|
|
1487
|
+
surface: z39.string().nullable(),
|
|
1459
1488
|
/** Label only — the first feature seen in the session. */
|
|
1460
|
-
firstFeature:
|
|
1461
|
-
startedAt:
|
|
1462
|
-
endedAt:
|
|
1463
|
-
inputTokens:
|
|
1464
|
-
outputTokens:
|
|
1465
|
-
cachedInputTokens:
|
|
1466
|
-
reasoningTokens:
|
|
1467
|
-
callCount:
|
|
1468
|
-
errorCount:
|
|
1489
|
+
firstFeature: z39.string(),
|
|
1490
|
+
startedAt: z39.string(),
|
|
1491
|
+
endedAt: z39.string(),
|
|
1492
|
+
inputTokens: z39.number(),
|
|
1493
|
+
outputTokens: z39.number(),
|
|
1494
|
+
cachedInputTokens: z39.number(),
|
|
1495
|
+
reasoningTokens: z39.number(),
|
|
1496
|
+
callCount: z39.number(),
|
|
1497
|
+
errorCount: z39.number(),
|
|
1469
1498
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
1470
1499
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
1471
1500
|
* the model is unpriced; never 0, which would read as free. */
|
|
1472
|
-
estimatedCostUsd:
|
|
1501
|
+
estimatedCostUsd: z39.number().nullable()
|
|
1473
1502
|
});
|
|
1474
|
-
var LlmSessionsDailySchema =
|
|
1475
|
-
day:
|
|
1476
|
-
environment:
|
|
1477
|
-
sessionCount:
|
|
1503
|
+
var LlmSessionsDailySchema = z39.object({
|
|
1504
|
+
day: z39.string(),
|
|
1505
|
+
environment: z39.string(),
|
|
1506
|
+
sessionCount: z39.number()
|
|
1478
1507
|
});
|
|
1479
1508
|
|
|
1480
1509
|
// ../spacestation/src/space/session-queue.ts
|
|
1481
|
-
import { z as
|
|
1510
|
+
import { z as z41 } from "zod";
|
|
1482
1511
|
|
|
1483
1512
|
// ../spacestation/src/space/session-activity.ts
|
|
1484
|
-
import { z as
|
|
1485
|
-
var SessionActivityEventSchema =
|
|
1486
|
-
id:
|
|
1487
|
-
kind:
|
|
1488
|
-
occurredAt:
|
|
1489
|
-
source:
|
|
1490
|
-
surface:
|
|
1491
|
-
payload:
|
|
1492
|
-
});
|
|
1493
|
-
var SessionActivitySchema =
|
|
1494
|
-
events:
|
|
1495
|
-
hasMore:
|
|
1513
|
+
import { z as z40 } from "zod";
|
|
1514
|
+
var SessionActivityEventSchema = z40.object({
|
|
1515
|
+
id: z40.string(),
|
|
1516
|
+
kind: z40.string(),
|
|
1517
|
+
occurredAt: z40.string(),
|
|
1518
|
+
source: z40.string(),
|
|
1519
|
+
surface: z40.string(),
|
|
1520
|
+
payload: z40.record(z40.unknown())
|
|
1521
|
+
});
|
|
1522
|
+
var SessionActivitySchema = z40.object({
|
|
1523
|
+
events: z40.array(SessionActivityEventSchema),
|
|
1524
|
+
hasMore: z40.boolean()
|
|
1496
1525
|
});
|
|
1497
1526
|
|
|
1498
1527
|
// ../spacestation/src/space/session-queue.ts
|
|
1499
|
-
var SessionVerdictSchema =
|
|
1500
|
-
var RecordableVerdictSchema =
|
|
1501
|
-
var SessionReviewEventSchema =
|
|
1502
|
-
id:
|
|
1528
|
+
var SessionVerdictSchema = z41.enum(["unreviewed", "viewed", "bug"]);
|
|
1529
|
+
var RecordableVerdictSchema = z41.enum(["viewed", "bug"]);
|
|
1530
|
+
var SessionReviewEventSchema = z41.object({
|
|
1531
|
+
id: z41.string().uuid(),
|
|
1503
1532
|
verdict: RecordableVerdictSchema,
|
|
1504
1533
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
1505
1534
|
* log is append-only rather than a mutable current-state row. */
|
|
1506
|
-
reviewer:
|
|
1507
|
-
note:
|
|
1508
|
-
createdAt:
|
|
1535
|
+
reviewer: z41.string(),
|
|
1536
|
+
note: z41.string().nullable(),
|
|
1537
|
+
createdAt: z41.string()
|
|
1509
1538
|
});
|
|
1510
|
-
var BugSeveritySchema =
|
|
1511
|
-
var BugLocationSchema =
|
|
1512
|
-
elementId:
|
|
1539
|
+
var BugSeveritySchema = z41.enum(["high", "medium", "low"]);
|
|
1540
|
+
var BugLocationSchema = z41.object({
|
|
1541
|
+
elementId: z41.string().nullable(),
|
|
1513
1542
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
1514
1543
|
* alongside a null `elementId`. */
|
|
1515
|
-
elementType:
|
|
1544
|
+
elementType: z41.string().nullable(),
|
|
1516
1545
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
1517
|
-
offsetXPct:
|
|
1518
|
-
offsetYPct:
|
|
1546
|
+
offsetXPct: z41.number().min(0).max(100).nullable(),
|
|
1547
|
+
offsetYPct: z41.number().min(0).max(100).nullable(),
|
|
1519
1548
|
/**
|
|
1520
1549
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
1521
1550
|
* element anchor.
|
|
@@ -1526,8 +1555,8 @@ var BugLocationSchema = z40.object({
|
|
|
1526
1555
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
1527
1556
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
1528
1557
|
*/
|
|
1529
|
-
pageX:
|
|
1530
|
-
pageY:
|
|
1558
|
+
pageX: z41.number().nullable(),
|
|
1559
|
+
pageY: z41.number().nullable()
|
|
1531
1560
|
}).refine(
|
|
1532
1561
|
(loc) => {
|
|
1533
1562
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -1541,24 +1570,24 @@ var BugLocationSchema = z40.object({
|
|
|
1541
1570
|
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)"
|
|
1542
1571
|
}
|
|
1543
1572
|
);
|
|
1544
|
-
var SessionBugSchema =
|
|
1545
|
-
id:
|
|
1573
|
+
var SessionBugSchema = z41.object({
|
|
1574
|
+
id: z41.string().uuid(),
|
|
1546
1575
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
1547
|
-
turnIndex:
|
|
1576
|
+
turnIndex: z41.number().int().nullable(),
|
|
1548
1577
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
1549
1578
|
* without pinning a spot. */
|
|
1550
1579
|
location: BugLocationSchema.nullable(),
|
|
1551
|
-
provider:
|
|
1552
|
-
issueKey:
|
|
1553
|
-
issueUrl:
|
|
1580
|
+
provider: z41.string(),
|
|
1581
|
+
issueKey: z41.string().nullable(),
|
|
1582
|
+
issueUrl: z41.string().nullable(),
|
|
1554
1583
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
1555
1584
|
* open text. Null until first synced. */
|
|
1556
|
-
issueState:
|
|
1557
|
-
title:
|
|
1558
|
-
body:
|
|
1585
|
+
issueState: z41.string().nullable(),
|
|
1586
|
+
title: z41.string(),
|
|
1587
|
+
body: z41.string(),
|
|
1559
1588
|
severity: BugSeveritySchema,
|
|
1560
|
-
createdBy:
|
|
1561
|
-
createdAt:
|
|
1589
|
+
createdBy: z41.string(),
|
|
1590
|
+
createdAt: z41.string(),
|
|
1562
1591
|
/**
|
|
1563
1592
|
* When this bug was resolved from the console; null means still OPEN.
|
|
1564
1593
|
*
|
|
@@ -1567,55 +1596,55 @@ var SessionBugSchema = z40.object({
|
|
|
1567
1596
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
1568
1597
|
* no boolean can contradict it.
|
|
1569
1598
|
*/
|
|
1570
|
-
resolvedAt:
|
|
1571
|
-
resolvedBy:
|
|
1599
|
+
resolvedAt: z41.string().nullable(),
|
|
1600
|
+
resolvedBy: z41.string().nullable()
|
|
1572
1601
|
});
|
|
1573
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
1574
|
-
var SessionCommentSchema =
|
|
1575
|
-
id:
|
|
1602
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z41.string() });
|
|
1603
|
+
var SessionCommentSchema = z41.object({
|
|
1604
|
+
id: z41.string().uuid(),
|
|
1576
1605
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
1577
|
-
bugId:
|
|
1606
|
+
bugId: z41.string().uuid().nullable(),
|
|
1578
1607
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
1579
1608
|
* parent bug's turn). */
|
|
1580
|
-
turnIndex:
|
|
1609
|
+
turnIndex: z41.number().int().nullable(),
|
|
1581
1610
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
1582
1611
|
location: BugLocationSchema.nullable(),
|
|
1583
|
-
body:
|
|
1584
|
-
createdBy:
|
|
1585
|
-
createdAt:
|
|
1612
|
+
body: z41.string(),
|
|
1613
|
+
createdBy: z41.string(),
|
|
1614
|
+
createdAt: z41.string()
|
|
1586
1615
|
});
|
|
1587
|
-
var CreateCommentInputSchema =
|
|
1588
|
-
bugId:
|
|
1589
|
-
turnIndex:
|
|
1616
|
+
var CreateCommentInputSchema = z41.object({
|
|
1617
|
+
bugId: z41.string().uuid().nullable(),
|
|
1618
|
+
turnIndex: z41.number().int().positive().nullable(),
|
|
1590
1619
|
location: BugLocationSchema.nullable(),
|
|
1591
1620
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
1592
1621
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
1593
|
-
body:
|
|
1622
|
+
body: z41.string().trim().min(1)
|
|
1594
1623
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
1595
1624
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
1596
1625
|
});
|
|
1597
|
-
var UpdateCommentInputSchema =
|
|
1598
|
-
body:
|
|
1599
|
-
bugId:
|
|
1626
|
+
var UpdateCommentInputSchema = z41.object({
|
|
1627
|
+
body: z41.string().trim().min(1).optional(),
|
|
1628
|
+
bugId: z41.string().uuid().nullable().optional(),
|
|
1600
1629
|
location: BugLocationSchema.nullable().optional()
|
|
1601
1630
|
});
|
|
1602
|
-
var SessionFormFactorSchema =
|
|
1603
|
-
var SessionSummarySchema =
|
|
1604
|
-
sessionId:
|
|
1631
|
+
var SessionFormFactorSchema = z41.enum(["mobile", "desktop"]).nullable();
|
|
1632
|
+
var SessionSummarySchema = z41.object({
|
|
1633
|
+
sessionId: z41.string(),
|
|
1605
1634
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
1606
1635
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
1607
|
-
visitorId:
|
|
1636
|
+
visitorId: z41.string().nullable(),
|
|
1608
1637
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
1609
1638
|
* identified themselves. Both null together means "not identified yet". */
|
|
1610
|
-
identityProvider:
|
|
1611
|
-
identityKey:
|
|
1639
|
+
identityProvider: z41.string().nullable(),
|
|
1640
|
+
identityKey: z41.string().nullable(),
|
|
1612
1641
|
/** Team/test traffic. The queue hides these by default. */
|
|
1613
|
-
isInternal:
|
|
1642
|
+
isInternal: z41.boolean(),
|
|
1614
1643
|
/** Build that served the session. Null = not captured; a version filter must
|
|
1615
1644
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
1616
|
-
clientVersion:
|
|
1645
|
+
clientVersion: z41.string().nullable(),
|
|
1617
1646
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
1618
|
-
signalCounts:
|
|
1647
|
+
signalCounts: z41.record(z41.number()),
|
|
1619
1648
|
/**
|
|
1620
1649
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
1621
1650
|
*
|
|
@@ -1632,7 +1661,7 @@ var SessionSummarySchema = z40.object({
|
|
|
1632
1661
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
1633
1662
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
1634
1663
|
*/
|
|
1635
|
-
conversionAttempts:
|
|
1664
|
+
conversionAttempts: z41.number().int().nullable(),
|
|
1636
1665
|
/**
|
|
1637
1666
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
1638
1667
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -1648,7 +1677,7 @@ var SessionSummarySchema = z40.object({
|
|
|
1648
1677
|
* kinds together, and one attempt id appearing under both would be counted
|
|
1649
1678
|
* once there and twice here.
|
|
1650
1679
|
*/
|
|
1651
|
-
conversionKinds:
|
|
1680
|
+
conversionKinds: z41.record(z41.number()),
|
|
1652
1681
|
/**
|
|
1653
1682
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
1654
1683
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -1656,20 +1685,20 @@ var SessionSummarySchema = z40.object({
|
|
|
1656
1685
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
1657
1686
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
1658
1687
|
*/
|
|
1659
|
-
funnelSteps:
|
|
1688
|
+
funnelSteps: z41.array(z41.string()),
|
|
1660
1689
|
/**
|
|
1661
1690
|
* The connector's opaque handle for what this session produced in its back
|
|
1662
1691
|
* office — present only once a checkout actually reached the platform. The
|
|
1663
1692
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
1664
1693
|
*/
|
|
1665
|
-
backOfficeRef:
|
|
1694
|
+
backOfficeRef: z41.string().nullable(),
|
|
1666
1695
|
/**
|
|
1667
1696
|
* The order this session produced, when the connector's back office reported
|
|
1668
1697
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
1669
1698
|
* Both null when no order is known — the cart handle above is then the door.
|
|
1670
1699
|
*/
|
|
1671
|
-
orderRef:
|
|
1672
|
-
orderLabel:
|
|
1700
|
+
orderRef: z41.string().nullable(),
|
|
1701
|
+
orderLabel: z41.string().nullable(),
|
|
1673
1702
|
/**
|
|
1674
1703
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
1675
1704
|
* needs.
|
|
@@ -1682,12 +1711,12 @@ var SessionSummarySchema = z40.object({
|
|
|
1682
1711
|
* on a desktop are not the same session.
|
|
1683
1712
|
*/
|
|
1684
1713
|
formFactor: SessionFormFactorSchema,
|
|
1685
|
-
turnCount:
|
|
1714
|
+
turnCount: z41.number().int(),
|
|
1686
1715
|
/** The visitor's opening message — the single most informative field for
|
|
1687
1716
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
1688
|
-
firstPrompt:
|
|
1689
|
-
startedAt:
|
|
1690
|
-
lastRunAt:
|
|
1717
|
+
firstPrompt: z41.string(),
|
|
1718
|
+
startedAt: z41.string(),
|
|
1719
|
+
lastRunAt: z41.string(),
|
|
1691
1720
|
/**
|
|
1692
1721
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
1693
1722
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -1715,7 +1744,7 @@ var SessionSummarySchema = z40.object({
|
|
|
1715
1744
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
1716
1745
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
1717
1746
|
*/
|
|
1718
|
-
visitorTimeZone:
|
|
1747
|
+
visitorTimeZone: z41.string().nullable(),
|
|
1719
1748
|
/**
|
|
1720
1749
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
1721
1750
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -1723,31 +1752,31 @@ var SessionSummarySchema = z40.object({
|
|
|
1723
1752
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
1724
1753
|
* already reading. Null when no turn in the session recorded a patch.
|
|
1725
1754
|
*/
|
|
1726
|
-
avgTtftMs:
|
|
1755
|
+
avgTtftMs: z41.number().int().nullable(),
|
|
1727
1756
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
1728
1757
|
* a budget: null on sessions older than the mark's recording. */
|
|
1729
|
-
avgMainDoneMs:
|
|
1758
|
+
avgMainDoneMs: z41.number().int().nullable(),
|
|
1730
1759
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
1731
1760
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
1732
|
-
avgChipGenMs:
|
|
1733
|
-
totalLatencyMs:
|
|
1734
|
-
durationMs:
|
|
1761
|
+
avgChipGenMs: z41.number().int().nullable(),
|
|
1762
|
+
totalLatencyMs: z41.number().int(),
|
|
1763
|
+
durationMs: z41.number().int(),
|
|
1735
1764
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
1736
1765
|
* live session streams and cannot be given a verdict until it ends. */
|
|
1737
|
-
isLive:
|
|
1766
|
+
isLive: z41.boolean(),
|
|
1738
1767
|
verdict: SessionVerdictSchema,
|
|
1739
|
-
reviewedBy:
|
|
1740
|
-
reviewedAt:
|
|
1768
|
+
reviewedBy: z41.string().nullable(),
|
|
1769
|
+
reviewedAt: z41.string().nullable(),
|
|
1741
1770
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
1742
1771
|
* state without a second request. */
|
|
1743
|
-
bugIssueKey:
|
|
1744
|
-
bugIssueUrl:
|
|
1745
|
-
bugIssueState:
|
|
1746
|
-
});
|
|
1747
|
-
var SessionQueuePageSchema =
|
|
1748
|
-
sessions:
|
|
1749
|
-
totalCount:
|
|
1750
|
-
hiddenInternalCount:
|
|
1772
|
+
bugIssueKey: z41.string().nullable(),
|
|
1773
|
+
bugIssueUrl: z41.string().nullable(),
|
|
1774
|
+
bugIssueState: z41.string().nullable()
|
|
1775
|
+
});
|
|
1776
|
+
var SessionQueuePageSchema = z41.object({
|
|
1777
|
+
sessions: z41.array(SessionSummarySchema),
|
|
1778
|
+
totalCount: z41.number().int(),
|
|
1779
|
+
hiddenInternalCount: z41.number().int(),
|
|
1751
1780
|
/**
|
|
1752
1781
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
1753
1782
|
*
|
|
@@ -1757,61 +1786,61 @@ var SessionQueuePageSchema = z40.object({
|
|
|
1757
1786
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
1758
1787
|
* analytics dashboard's bounce over the same window.
|
|
1759
1788
|
*/
|
|
1760
|
-
hiddenBouncedCount:
|
|
1789
|
+
hiddenBouncedCount: z41.number().int()
|
|
1761
1790
|
});
|
|
1762
|
-
var SessionQueueFacetsSchema =
|
|
1763
|
-
review:
|
|
1764
|
-
version:
|
|
1765
|
-
turns:
|
|
1766
|
-
durationS:
|
|
1791
|
+
var SessionQueueFacetsSchema = z41.object({
|
|
1792
|
+
review: z41.record(z41.number()),
|
|
1793
|
+
version: z41.record(z41.number()),
|
|
1794
|
+
turns: z41.record(z41.number()),
|
|
1795
|
+
durationS: z41.record(z41.number()),
|
|
1767
1796
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
1768
|
-
funnel:
|
|
1797
|
+
funnel: z41.record(z41.number())
|
|
1769
1798
|
});
|
|
1770
|
-
var SessionCaptureSchema =
|
|
1771
|
-
viewportWidth:
|
|
1772
|
-
viewportHeight:
|
|
1773
|
-
userAgent:
|
|
1774
|
-
locale:
|
|
1799
|
+
var SessionCaptureSchema = z41.object({
|
|
1800
|
+
viewportWidth: z41.number().int().nullable(),
|
|
1801
|
+
viewportHeight: z41.number().int().nullable(),
|
|
1802
|
+
userAgent: z41.string().nullable(),
|
|
1803
|
+
locale: z41.string().nullable(),
|
|
1775
1804
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
1776
|
-
referrer:
|
|
1805
|
+
referrer: z41.string().nullable()
|
|
1777
1806
|
});
|
|
1778
|
-
var SessionCaptureInputSchema =
|
|
1779
|
-
viewportWidth:
|
|
1780
|
-
viewportHeight:
|
|
1781
|
-
userAgent:
|
|
1782
|
-
locale:
|
|
1807
|
+
var SessionCaptureInputSchema = z41.object({
|
|
1808
|
+
viewportWidth: z41.number().int().positive().max(2e4).optional(),
|
|
1809
|
+
viewportHeight: z41.number().int().positive().max(2e4).optional(),
|
|
1810
|
+
userAgent: z41.string().max(1e3).optional(),
|
|
1811
|
+
locale: z41.string().max(35).optional(),
|
|
1783
1812
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
1784
1813
|
* the zone database grows, and refusing a name this build has not heard of
|
|
1785
1814
|
* would drop a real session's capture over a table that is out of date. */
|
|
1786
|
-
timeZone:
|
|
1787
|
-
referrer:
|
|
1788
|
-
clientVersion:
|
|
1789
|
-
isInternal:
|
|
1815
|
+
timeZone: z41.string().max(64).optional(),
|
|
1816
|
+
referrer: z41.string().max(2048).optional(),
|
|
1817
|
+
clientVersion: z41.string().max(100).optional(),
|
|
1818
|
+
isInternal: z41.boolean().optional()
|
|
1790
1819
|
});
|
|
1791
|
-
var SessionDetailSchema =
|
|
1820
|
+
var SessionDetailSchema = z41.object({
|
|
1792
1821
|
session: SessionSummarySchema,
|
|
1793
1822
|
capture: SessionCaptureSchema,
|
|
1794
1823
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
1795
1824
|
* re-judged after a fix is the evidence the fix worked. */
|
|
1796
|
-
reviews:
|
|
1797
|
-
bugs:
|
|
1798
|
-
comments:
|
|
1825
|
+
reviews: z41.array(SessionReviewEventSchema),
|
|
1826
|
+
bugs: z41.array(SessionBugSchema),
|
|
1827
|
+
comments: z41.array(SessionCommentSchema),
|
|
1799
1828
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
1800
1829
|
* not evidence of zero visitor activity. */
|
|
1801
1830
|
activity: SessionActivitySchema.optional()
|
|
1802
1831
|
});
|
|
1803
|
-
var RecordVerdictInputSchema =
|
|
1832
|
+
var RecordVerdictInputSchema = z41.object({
|
|
1804
1833
|
verdict: RecordableVerdictSchema,
|
|
1805
|
-
note:
|
|
1834
|
+
note: z41.string().max(2e3).optional()
|
|
1806
1835
|
});
|
|
1807
|
-
var FileBugInputSchema =
|
|
1808
|
-
turnIndex:
|
|
1836
|
+
var FileBugInputSchema = z41.object({
|
|
1837
|
+
turnIndex: z41.number().int().positive().nullable(),
|
|
1809
1838
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
1810
1839
|
location: BugLocationSchema.nullable().optional(),
|
|
1811
|
-
title:
|
|
1812
|
-
body:
|
|
1840
|
+
title: z41.string().min(1).max(300),
|
|
1841
|
+
body: z41.string().min(1),
|
|
1813
1842
|
severity: BugSeveritySchema,
|
|
1814
|
-
payload:
|
|
1843
|
+
payload: z41.record(z41.unknown())
|
|
1815
1844
|
});
|
|
1816
1845
|
export {
|
|
1817
1846
|
EMPTY_SPEC,
|