@usenaive-sdk/blueprints 0.6.0 → 0.7.0
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/dist/index.d.ts +5 -0
- package/dist/index.js +1168 -937
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -301,7 +301,7 @@ var HARNESS_IDS = ["pi", "claude_code", "vetta", "hermes"];
|
|
|
301
301
|
var HarnessIdSchema = z2.enum(HARNESS_IDS);
|
|
302
302
|
|
|
303
303
|
// ../core/src/schema/agent.ts
|
|
304
|
-
import { z as
|
|
304
|
+
import { z as z6 } from "zod";
|
|
305
305
|
|
|
306
306
|
// ../core/src/schema/browser.ts
|
|
307
307
|
import { z as z4 } from "zod";
|
|
@@ -553,16 +553,70 @@ var BrowserCredentialSchema = z4.object({
|
|
|
553
553
|
});
|
|
554
554
|
var LiveViewSchema = z4.object({ url: z4.string().url(), expires_at: Timestamp });
|
|
555
555
|
|
|
556
|
+
// ../core/src/schema/model-selection.ts
|
|
557
|
+
import { z as z5 } from "zod";
|
|
558
|
+
var MODEL_SELECTION_MIN_OPTIONS = 2;
|
|
559
|
+
var MODEL_SELECTION_MAX_OPTIONS = 16;
|
|
560
|
+
var MODEL_SELECTION_MAX_MESSAGES = 32;
|
|
561
|
+
var MODEL_SELECTION_MAX_CONTENT_CHARS = 32e3;
|
|
562
|
+
var ModelSelectionMessageSchema = z5.object({
|
|
563
|
+
role: z5.enum(["user", "assistant"]),
|
|
564
|
+
content: z5.string().min(1)
|
|
565
|
+
});
|
|
566
|
+
var OptionsSchema = z5.record(z5.string().min(1), z5.string().trim().min(1).max(500)).refine((options) => Object.keys(options).length >= MODEL_SELECTION_MIN_OPTIONS, {
|
|
567
|
+
message: `at least ${MODEL_SELECTION_MIN_OPTIONS} options are required`
|
|
568
|
+
}).refine((options) => Object.keys(options).length <= MODEL_SELECTION_MAX_OPTIONS, {
|
|
569
|
+
message: `at most ${MODEL_SELECTION_MAX_OPTIONS} options are allowed`
|
|
570
|
+
});
|
|
571
|
+
var ModelSelectionPolicySchema = z5.object({
|
|
572
|
+
options: OptionsSchema,
|
|
573
|
+
min_confidence: z5.number().gt(0).max(1).optional()
|
|
574
|
+
});
|
|
575
|
+
var ModelSelectionRequestSchema = z5.object({
|
|
576
|
+
options: OptionsSchema,
|
|
577
|
+
messages: z5.array(ModelSelectionMessageSchema).min(1).max(MODEL_SELECTION_MAX_MESSAGES),
|
|
578
|
+
default: z5.string().min(1).optional(),
|
|
579
|
+
min_confidence: z5.number().gt(0).max(1).optional()
|
|
580
|
+
}).superRefine((body, ctx) => {
|
|
581
|
+
const total = body.messages.reduce((sum, message3) => sum + message3.content.length, 0);
|
|
582
|
+
if (total > MODEL_SELECTION_MAX_CONTENT_CHARS) {
|
|
583
|
+
ctx.addIssue({
|
|
584
|
+
code: "custom",
|
|
585
|
+
path: ["messages"],
|
|
586
|
+
message: `total message content exceeds ${MODEL_SELECTION_MAX_CONTENT_CHARS} characters`
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
if (body.default !== void 0 && !Object.hasOwn(body.options, body.default)) {
|
|
590
|
+
ctx.addIssue({ code: "custom", path: ["default"], message: "default must be one of the options" });
|
|
591
|
+
}
|
|
592
|
+
if (body.min_confidence !== void 0 && body.default === void 0) {
|
|
593
|
+
ctx.addIssue({
|
|
594
|
+
code: "custom",
|
|
595
|
+
path: ["min_confidence"],
|
|
596
|
+
message: "min_confidence requires a default to fall back to"
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
var ModelSelectionSchema = z5.object({
|
|
601
|
+
object: z5.literal("model_selection"),
|
|
602
|
+
model: z5.string().min(1),
|
|
603
|
+
confidence: z5.number().min(0).max(1).nullable(),
|
|
604
|
+
probabilities: z5.record(z5.string(), z5.number()).nullable(),
|
|
605
|
+
defaulted: z5.boolean(),
|
|
606
|
+
spent_micro_usd: z5.number().int().nonnegative(),
|
|
607
|
+
usage: z5.object({ input_tokens: z5.number().int().nonnegative() })
|
|
608
|
+
});
|
|
609
|
+
|
|
556
610
|
// ../core/src/schema/agent.ts
|
|
557
|
-
var ToolPermissionSchema =
|
|
558
|
-
var ToolConfigSchema =
|
|
559
|
-
enabled:
|
|
611
|
+
var ToolPermissionSchema = z6.enum(["allow", "ask", "deny"]);
|
|
612
|
+
var ToolConfigSchema = z6.object({
|
|
613
|
+
enabled: z6.boolean(),
|
|
560
614
|
permission: ToolPermissionSchema,
|
|
561
|
-
config:
|
|
615
|
+
config: z6.record(z6.string(), z6.unknown()).optional()
|
|
562
616
|
});
|
|
563
|
-
var ToolsetSchema =
|
|
564
|
-
default_config:
|
|
565
|
-
configs:
|
|
617
|
+
var ToolsetSchema = z6.object({
|
|
618
|
+
default_config: z6.object({ permission: ToolPermissionSchema }),
|
|
619
|
+
configs: z6.record(z6.string(), ToolConfigSchema)
|
|
566
620
|
}).superRefine((tools, ctx) => {
|
|
567
621
|
const config = tools.configs["browser"]?.config;
|
|
568
622
|
if (config === void 0) return;
|
|
@@ -570,83 +624,85 @@ var ToolsetSchema = z5.object({
|
|
|
570
624
|
ctx.addIssue({ code: "custom", message: issue.message, path: ["configs", "browser", "config", ...issue.path] });
|
|
571
625
|
}
|
|
572
626
|
});
|
|
573
|
-
var BudgetSchema =
|
|
627
|
+
var BudgetSchema = z6.object({
|
|
574
628
|
cap_micro_usd: MicroUsdField.nonnegative(),
|
|
575
629
|
max_task_micro_usd: MicroUsdField.nonnegative(),
|
|
576
|
-
period:
|
|
630
|
+
period: z6.enum(["day", "week", "month"])
|
|
577
631
|
});
|
|
578
|
-
var SkillRefSchema =
|
|
632
|
+
var SkillRefSchema = z6.string().regex(/^(naive\/)?[a-z0-9][a-z0-9-]*(@\d+)?$/, {
|
|
579
633
|
error: "expected `slug`, `slug@N`, `naive/slug` or `naive/slug@N`"
|
|
580
634
|
});
|
|
581
|
-
var McpServerSchema =
|
|
582
|
-
name:
|
|
583
|
-
url:
|
|
584
|
-
headers:
|
|
635
|
+
var McpServerSchema = z6.object({
|
|
636
|
+
name: z6.string(),
|
|
637
|
+
url: z6.url(),
|
|
638
|
+
headers: z6.record(z6.string(), z6.string()).optional()
|
|
585
639
|
});
|
|
586
|
-
var RosterEntrySchema =
|
|
640
|
+
var RosterEntrySchema = z6.union([
|
|
587
641
|
idOf("agt").transform((id) => ({ type: "agent", id })),
|
|
588
|
-
|
|
589
|
-
type:
|
|
642
|
+
z6.object({
|
|
643
|
+
type: z6.literal("agent"),
|
|
590
644
|
id: idOf("agt"),
|
|
591
|
-
version:
|
|
645
|
+
version: z6.number().int().positive().optional()
|
|
592
646
|
}),
|
|
593
|
-
|
|
594
|
-
|
|
647
|
+
z6.object({ type: z6.literal("self") }),
|
|
648
|
+
z6.object({ type: z6.literal("advisor"), model: z6.string().min(1) })
|
|
595
649
|
]);
|
|
596
650
|
var SINGLETON_ENTRIES = ["self", "advisor"];
|
|
597
|
-
var MultiagentSchema =
|
|
598
|
-
type:
|
|
599
|
-
agents:
|
|
651
|
+
var MultiagentSchema = z6.object({
|
|
652
|
+
type: z6.literal("coordinator"),
|
|
653
|
+
agents: z6.array(RosterEntrySchema).min(1).max(20).refine(
|
|
600
654
|
(roster) => SINGLETON_ENTRIES.every((t) => roster.filter((e) => e.type === t).length <= 1),
|
|
601
655
|
{ error: "a roster carries at most one `self` and at most one `advisor` entry" }
|
|
602
656
|
),
|
|
603
|
-
board:
|
|
657
|
+
board: z6.boolean().optional()
|
|
604
658
|
});
|
|
605
|
-
var MultiagentField =
|
|
659
|
+
var MultiagentField = z6.union([z6.boolean(), MultiagentSchema, z6.null()]);
|
|
606
660
|
function normaliseMultiagent(value) {
|
|
607
661
|
if (value === true) return { type: "coordinator", agents: [], board: false };
|
|
608
662
|
if (value === false || value === null) return null;
|
|
609
663
|
return value;
|
|
610
664
|
}
|
|
611
|
-
var HandoffsField =
|
|
665
|
+
var HandoffsField = z6.union([z6.boolean(), z6.literal("team"), z6.array(z6.string().min(1)).max(50)]);
|
|
612
666
|
var handoffsOf = (config) => config.handoffs ?? true;
|
|
613
667
|
var handoffsEnabled = (handoffs) => handoffs === true || handoffs === "team" || handoffs !== false && handoffs.length > 0;
|
|
614
668
|
var agentConfigShape = {
|
|
615
|
-
model:
|
|
669
|
+
model: z6.string(),
|
|
616
670
|
window: WindowSchema,
|
|
617
|
-
system:
|
|
671
|
+
system: z6.string(),
|
|
618
672
|
tools: ToolsetSchema,
|
|
619
|
-
mcp_servers:
|
|
620
|
-
skills:
|
|
673
|
+
mcp_servers: z6.array(McpServerSchema),
|
|
674
|
+
skills: z6.array(SkillRefSchema),
|
|
621
675
|
multiagent: MultiagentField,
|
|
622
676
|
/** Optional on the type so a version minted before §28.15 still parses; read it through `handoffsOf`. */
|
|
623
677
|
handoffs: HandoffsField.optional(),
|
|
678
|
+
/** §46.6: when set, every turn picks one of its options and `model` is the default. Absent before it existed. */
|
|
679
|
+
model_selection: ModelSelectionPolicySchema.nullable().optional(),
|
|
624
680
|
budget: BudgetSchema,
|
|
625
681
|
output_schema: JsonSchemaDocument.nullable(),
|
|
626
|
-
structured_output_required:
|
|
627
|
-
description:
|
|
682
|
+
structured_output_required: z6.boolean(),
|
|
683
|
+
description: z6.string().nullable(),
|
|
628
684
|
metadata: Metadata
|
|
629
685
|
};
|
|
630
|
-
var AgentVersionSchema =
|
|
631
|
-
version:
|
|
686
|
+
var AgentVersionSchema = z6.object({
|
|
687
|
+
version: z6.number().int().positive(),
|
|
632
688
|
created_at: Timestamp,
|
|
633
689
|
created_by: PrincipalSchema,
|
|
634
690
|
...agentConfigShape
|
|
635
691
|
});
|
|
636
|
-
var AgentSchema =
|
|
692
|
+
var AgentSchema = z6.object({
|
|
637
693
|
id: idOf("agt"),
|
|
638
|
-
object:
|
|
639
|
-
name:
|
|
694
|
+
object: z6.literal("agent"),
|
|
695
|
+
name: z6.string(),
|
|
640
696
|
/** The agent loop this agent runs (§19). Chosen at create; the catalog lives in `harness.ts`. */
|
|
641
697
|
harness: HarnessIdSchema,
|
|
642
|
-
current_version:
|
|
698
|
+
current_version: z6.number().int().positive(),
|
|
643
699
|
created_at: Timestamp,
|
|
644
700
|
...agentConfigShape
|
|
645
701
|
});
|
|
646
702
|
|
|
647
703
|
// ../core/src/schema/session.ts
|
|
648
|
-
import { z as
|
|
649
|
-
var SessionStatusSchema =
|
|
704
|
+
import { z as z7 } from "zod";
|
|
705
|
+
var SessionStatusSchema = z7.enum([
|
|
650
706
|
"queued",
|
|
651
707
|
"running",
|
|
652
708
|
"idle",
|
|
@@ -654,7 +710,7 @@ var SessionStatusSchema = z6.enum([
|
|
|
654
710
|
"failed",
|
|
655
711
|
"cancelled"
|
|
656
712
|
]);
|
|
657
|
-
var StopReasonSchema =
|
|
713
|
+
var StopReasonSchema = z7.enum([
|
|
658
714
|
"end_turn",
|
|
659
715
|
"awaiting_input",
|
|
660
716
|
"awaiting_approval",
|
|
@@ -680,61 +736,86 @@ var StopReasonSchema = z6.enum([
|
|
|
680
736
|
*/
|
|
681
737
|
"awaiting_answer"
|
|
682
738
|
]);
|
|
683
|
-
var ThreadRoleSchema =
|
|
684
|
-
var MessageSchema =
|
|
685
|
-
role:
|
|
686
|
-
content:
|
|
687
|
-
tool_call_id:
|
|
688
|
-
});
|
|
689
|
-
var
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
739
|
+
var ThreadRoleSchema = z7.enum(["coordinator", "member"]);
|
|
740
|
+
var MessageSchema = z7.object({
|
|
741
|
+
role: z7.enum(["system", "user", "assistant", "tool"]),
|
|
742
|
+
content: z7.string(),
|
|
743
|
+
tool_call_id: z7.string().optional()
|
|
744
|
+
});
|
|
745
|
+
var ToolImageSchema = z7.object({
|
|
746
|
+
data: z7.string().min(1).max(5e6).describe("The image's bytes, base64."),
|
|
747
|
+
media_type: z7.enum(["image/png", "image/jpeg", "image/gif", "image/webp"])
|
|
748
|
+
});
|
|
749
|
+
var ToolResultSchema = z7.object({
|
|
750
|
+
output: z7.unknown(),
|
|
751
|
+
is_error: z7.boolean().optional(),
|
|
752
|
+
content: z7.string().optional(),
|
|
753
|
+
images: z7.array(ToolImageSchema).max(12).optional()
|
|
693
754
|
});
|
|
694
755
|
var QuestionFieldBase = {
|
|
695
|
-
key:
|
|
696
|
-
label:
|
|
697
|
-
help:
|
|
756
|
+
key: z7.string().min(1).max(64),
|
|
757
|
+
label: z7.string().min(1).max(200),
|
|
758
|
+
help: z7.string().max(500).optional(),
|
|
759
|
+
/**
|
|
760
|
+
* A field that may be left blank, and it defaults to **false** — the rule "every field must be
|
|
761
|
+
* answered" (`assertAnswers`) is still the rule, and this is the one documented way out of it.
|
|
762
|
+
*
|
|
763
|
+
* It exists for the question whose answer genuinely improves the work and does not gate it: a
|
|
764
|
+
* template's setup form asking for a reference to imitate, say. Before the flag the only way to
|
|
765
|
+
* ask such a thing was to make it mandatory — which forces an answer out of someone who has none,
|
|
766
|
+
* and an invented answer is worse than an absent one, because the crew cannot tell them apart.
|
|
767
|
+
*
|
|
768
|
+
* Nothing downstream needs an "if absent" branch: `projectContextFor` already lists only the
|
|
769
|
+
* questions that were answered, so an unanswered optional key is simply not in the context.
|
|
770
|
+
*
|
|
771
|
+
* ABSENT rather than `false`, which is why it is `.optional()` and not `.default(false)` like the
|
|
772
|
+
* `multiple` and `other` beside it. Those two sit on the `choice` branch, where a renderer has to
|
|
773
|
+
* branch on them and a definite value earns its place; this sits on the base, next to `help`,
|
|
774
|
+
* which is absent-by-default for the same reason. A default here would make `optional: boolean`
|
|
775
|
+
* required on the OUTPUT type — so every hand-written `QuestionField` in the codebase, and every
|
|
776
|
+
* one written after it, would have to spell out the flag it does not use.
|
|
777
|
+
*/
|
|
778
|
+
optional: z7.boolean().optional()
|
|
698
779
|
};
|
|
699
|
-
var QuestionFieldSchema =
|
|
700
|
-
|
|
780
|
+
var QuestionFieldSchema = z7.discriminatedUnion("type", [
|
|
781
|
+
z7.object({
|
|
701
782
|
...QuestionFieldBase,
|
|
702
|
-
type:
|
|
703
|
-
placeholder:
|
|
783
|
+
type: z7.literal("text"),
|
|
784
|
+
placeholder: z7.string().max(200).optional()
|
|
704
785
|
}),
|
|
705
|
-
|
|
786
|
+
z7.object({
|
|
706
787
|
...QuestionFieldBase,
|
|
707
|
-
type:
|
|
788
|
+
type: z7.literal("choice"),
|
|
708
789
|
/**
|
|
709
790
|
* Plain strings: the option is both the value and the label, because the answer is read back by
|
|
710
791
|
* a model, which wants the words and not an id. Fewer than two is not a choice, and more than
|
|
711
792
|
* twelve is a list — which belongs in the prompt.
|
|
712
793
|
*/
|
|
713
|
-
options:
|
|
714
|
-
multiple:
|
|
794
|
+
options: z7.array(z7.string().min(1).max(200)).min(2).max(12),
|
|
795
|
+
multiple: z7.boolean().default(false),
|
|
715
796
|
/**
|
|
716
797
|
* The free-text escape, and it defaults to **true** on purpose: the agent wrote the options and
|
|
717
798
|
* the agent is the one that does not know the answer, so an operator must always be able to say
|
|
718
799
|
* something it did not think of. A question that truly admits only its list opts out explicitly.
|
|
719
800
|
*/
|
|
720
|
-
other:
|
|
801
|
+
other: z7.boolean().default(true)
|
|
721
802
|
})
|
|
722
803
|
]);
|
|
723
|
-
var QuestionSchema =
|
|
724
|
-
prompt:
|
|
725
|
-
fields:
|
|
804
|
+
var QuestionSchema = z7.object({
|
|
805
|
+
prompt: z7.string().min(1).max(1e3),
|
|
806
|
+
fields: z7.array(QuestionFieldSchema).min(1).max(3)
|
|
726
807
|
});
|
|
727
|
-
var AnswersSchema =
|
|
728
|
-
|
|
729
|
-
|
|
808
|
+
var AnswersSchema = z7.record(
|
|
809
|
+
z7.string().min(1).max(64),
|
|
810
|
+
z7.union([z7.string().max(2e3), z7.array(z7.string().max(2e3)).min(1).max(12)])
|
|
730
811
|
).refine((answers) => Object.keys(answers).length <= 3, {
|
|
731
812
|
message: "a question has at most 3 fields, so an answer has at most 3 keys"
|
|
732
813
|
});
|
|
733
|
-
var PendingActionSchema =
|
|
734
|
-
kind:
|
|
735
|
-
tool_call_id:
|
|
736
|
-
name:
|
|
737
|
-
args:
|
|
814
|
+
var PendingActionSchema = z7.object({
|
|
815
|
+
kind: z7.enum(["tool", "question"]).default("tool"),
|
|
816
|
+
tool_call_id: z7.string(),
|
|
817
|
+
name: z7.string(),
|
|
818
|
+
args: z7.record(z7.string(), z7.unknown()),
|
|
738
819
|
/**
|
|
739
820
|
* Present iff `kind` is `"question"`, and it is the parse of `args` rather than a second source
|
|
740
821
|
* of truth: `args` is what the model called and therefore what replays byte-identically, while
|
|
@@ -743,11 +824,11 @@ var PendingActionSchema = z6.object({
|
|
|
743
824
|
*/
|
|
744
825
|
question: QuestionSchema.optional()
|
|
745
826
|
});
|
|
746
|
-
var SessionSchema =
|
|
827
|
+
var SessionSchema = z7.object({
|
|
747
828
|
id: idOf("ses"),
|
|
748
|
-
object:
|
|
829
|
+
object: z7.literal("session"),
|
|
749
830
|
agent_id: idOf("agt"),
|
|
750
|
-
agent_version:
|
|
831
|
+
agent_version: z7.number().int().positive(),
|
|
751
832
|
deployment_id: idOf("dep").nullable(),
|
|
752
833
|
/**
|
|
753
834
|
* The persona this session acts as (`canonical-spec §22`). Chosen per task from the personas the
|
|
@@ -776,54 +857,109 @@ var SessionSchema = z6.object({
|
|
|
776
857
|
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
777
858
|
consumed_micro_usd: MicroUsdField.nonnegative(),
|
|
778
859
|
token_usage: TokenUsageSchema,
|
|
779
|
-
pending_actions:
|
|
860
|
+
pending_actions: z7.array(PendingActionSchema),
|
|
780
861
|
output_schema: JsonSchemaDocument.nullable(),
|
|
781
|
-
structured_output:
|
|
782
|
-
last_seq:
|
|
862
|
+
structured_output: z7.record(z7.string(), z7.unknown()).nullable(),
|
|
863
|
+
last_seq: z7.number().int().nonnegative(),
|
|
783
864
|
metadata: Metadata,
|
|
784
865
|
started_at: Timestamp.nullable(),
|
|
785
866
|
ended_at: Timestamp.nullable(),
|
|
786
867
|
created_at: Timestamp
|
|
787
868
|
});
|
|
788
|
-
var SendMessageSchema =
|
|
789
|
-
message:
|
|
790
|
-
interrupt:
|
|
791
|
-
queue:
|
|
792
|
-
idempotency_key:
|
|
869
|
+
var SendMessageSchema = z7.object({
|
|
870
|
+
message: z7.string(),
|
|
871
|
+
interrupt: z7.boolean().optional(),
|
|
872
|
+
queue: z7.boolean().optional(),
|
|
873
|
+
idempotency_key: z7.string().optional()
|
|
793
874
|
}).refine((body) => !(body.interrupt === true && body.queue === true), {
|
|
794
875
|
message: "a send is either an interrupt or queued, not both",
|
|
795
876
|
path: ["queue"]
|
|
796
877
|
});
|
|
797
|
-
var SendAcceptedSchema =
|
|
798
|
-
session_id:
|
|
878
|
+
var SendAcceptedSchema = z7.object({
|
|
879
|
+
session_id: z7.string(),
|
|
799
880
|
status: SessionStatusSchema,
|
|
800
|
-
accepted_seq:
|
|
881
|
+
accepted_seq: z7.number().int().nonnegative()
|
|
801
882
|
});
|
|
802
|
-
var ToolConfirmationSchema =
|
|
803
|
-
tool_call_id:
|
|
804
|
-
decision:
|
|
805
|
-
reason:
|
|
806
|
-
scope:
|
|
883
|
+
var ToolConfirmationSchema = z7.object({
|
|
884
|
+
tool_call_id: z7.string(),
|
|
885
|
+
decision: z7.enum(["allow", "deny"]),
|
|
886
|
+
reason: z7.string().optional(),
|
|
887
|
+
scope: z7.enum(["call", "session"]).default("call")
|
|
807
888
|
});
|
|
808
|
-
var SessionAnswerSchema =
|
|
809
|
-
tool_call_id:
|
|
810
|
-
answers:
|
|
889
|
+
var SessionAnswerSchema = z7.object({
|
|
890
|
+
tool_call_id: z7.string(),
|
|
891
|
+
answers: z7.record(z7.string(), z7.union([z7.string(), z7.array(z7.string())]))
|
|
811
892
|
});
|
|
812
893
|
|
|
813
894
|
// ../core/src/schema/event.ts
|
|
814
|
-
import { z as
|
|
815
|
-
var EventTypeSchema =
|
|
895
|
+
import { z as z8 } from "zod";
|
|
896
|
+
var EventTypeSchema = z8.enum([
|
|
816
897
|
"message.delta",
|
|
817
898
|
"message.completed",
|
|
899
|
+
/** A caller's message, durable in the inbox and not yet admitted to a turn (§7, §8): `{ client_message_id, content }`. */
|
|
900
|
+
"message.accepted",
|
|
901
|
+
/** A person's fan-out, on the sender's log without waking it (§8, §28.16): `{ client_message_id, content, handoffs, refusals }`. */
|
|
902
|
+
"handoff.sent",
|
|
818
903
|
"tool.started",
|
|
819
904
|
"tool.completed",
|
|
820
905
|
"tool.confirm",
|
|
821
906
|
"session.running",
|
|
822
907
|
"session.usage",
|
|
823
908
|
"session.idle",
|
|
909
|
+
/** A failed attempt the loop will retry (§8): `{ attempt, in_ms, code }`. */
|
|
910
|
+
"session.retrying",
|
|
911
|
+
/**
|
|
912
|
+
* The turn ran, but without something it needed (§8): `{ reason, detail? }`.
|
|
913
|
+
*
|
|
914
|
+
* Emitted for a turn whose sandbox could not be woken. That turn used to be indistinguishable
|
|
915
|
+
* from a success — the model was handed the failure as a tool result, answered around it from the
|
|
916
|
+
* transcript, and the session ended `idle`/`end_turn` with no field anywhere saying the
|
|
917
|
+
* filesystem had been unavailable. This is the field. `reason` is open on purpose; today the only
|
|
918
|
+
* value is `"sandbox_unavailable"`.
|
|
919
|
+
*
|
|
920
|
+
* `detail` is the boot failure's own message, and it is here because `reason` alone reads the
|
|
921
|
+
* same for a vendor outage and for a fault of ours. Staging round 3 spent its whole budget
|
|
922
|
+
* establishing with raw Connect RPC that the vendor was refusing every `ResumeSession` on the
|
|
923
|
+
* account — a question the adapter could have answered, since its give-up names the vendor state
|
|
924
|
+
* it last saw and how long it waited (`compute-tenki index.ts`). It is diagnostic prose, not a
|
|
925
|
+
* contract: never parse it, and it may be absent.
|
|
926
|
+
*/
|
|
927
|
+
"session.degraded",
|
|
928
|
+
/**
|
|
929
|
+
* The session let go of a sandbox that would not resume and will run the next turn on a fresh
|
|
930
|
+
* one: `{ from, reason, failures, replacements }`.
|
|
931
|
+
*
|
|
932
|
+
* *** THE ONE TURN WHERE A FILESYSTEM ACTUALLY GOES MISSING USED TO BE THE SILENT ONE. ***
|
|
933
|
+
* `session.degraded` marks the turns whose resume FAILED, and those turns lose nothing — the box
|
|
934
|
+
* is still there and the next turn may still get it back. The turn that swaps the box is the
|
|
935
|
+
* damaging one, and it has no failure to report: it provisions a replacement and runs normally.
|
|
936
|
+
* Staging watched a session answer `cat: … No such file or directory` with nothing in its event
|
|
937
|
+
* log to tell that apart from the file never having been written, and support could not tell
|
|
938
|
+
* either. `from` is the box that was let go of, so a customer can still reach it through
|
|
939
|
+
* `GET /v1/computers/:id` while it lives.
|
|
940
|
+
*
|
|
941
|
+
* `reason` is open like `session.degraded`'s, and it carries the one distinction an operator
|
|
942
|
+
* cannot make any other way: `"resume_refused"` is the FIRST swap, where everything knowable here
|
|
943
|
+
* says the fault is that box's, and `"vendor_resume_unavailable"` is a swap that follows one — a
|
|
944
|
+
* fault that already outlived a fresh machine, so it is the account and not the box.
|
|
945
|
+
* `replacements` counts them. There is no third swap: past `box.ts MAX_BOX_REPLACEMENTS` the
|
|
946
|
+
* session keeps the box it holds and reports `session.degraded` under that same
|
|
947
|
+
* `vendor_resume_unavailable` reason, rather than abandoning one more live micro-VM every cycle
|
|
948
|
+
* for a fault a fresh one demonstrably does not fix.
|
|
949
|
+
*/
|
|
950
|
+
"session.computer_replaced",
|
|
824
951
|
"budget.exceeded",
|
|
825
952
|
"span.model_request.start",
|
|
826
953
|
"span.model_request.end",
|
|
954
|
+
// Pre-model spans (§15): what the gap before the first model request was spent on.
|
|
955
|
+
"span.transcript_load.start",
|
|
956
|
+
"span.transcript_load.end",
|
|
957
|
+
"span.harness_load.start",
|
|
958
|
+
"span.harness_load.end",
|
|
959
|
+
"span.harness_build.start",
|
|
960
|
+
"span.harness_build.end",
|
|
961
|
+
"span.box_resume.start",
|
|
962
|
+
"span.box_resume.end",
|
|
827
963
|
/**
|
|
828
964
|
* A delegated thread's lifecycle, on the **coordinator's** stream (§28). The child's own
|
|
829
965
|
* `ses_…` rides inside `data.thread_id` — the event schema gains no field and `vetta.event` gains
|
|
@@ -858,60 +994,63 @@ var EventTypeSchema = z7.enum([
|
|
|
858
994
|
"card.refunded",
|
|
859
995
|
"card.credentials_revealed"
|
|
860
996
|
]);
|
|
861
|
-
var EventSchema =
|
|
997
|
+
var EventSchema = z8.object({
|
|
862
998
|
id: idOf("evt"),
|
|
863
|
-
seq:
|
|
999
|
+
seq: z8.number().int().positive(),
|
|
864
1000
|
type: EventTypeSchema,
|
|
865
1001
|
session_id: idOf("ses"),
|
|
866
|
-
data:
|
|
1002
|
+
data: z8.record(z8.string(), z8.unknown()),
|
|
867
1003
|
created_at: Timestamp
|
|
868
1004
|
});
|
|
869
|
-
var ThreadEventDataSchema =
|
|
870
|
-
var SessionUsageDataSchema =
|
|
1005
|
+
var ThreadEventDataSchema = z8.looseObject({ thread_id: idOf("ses") });
|
|
1006
|
+
var SessionUsageDataSchema = z8.object({
|
|
871
1007
|
token_usage: TokenUsageSchema,
|
|
872
1008
|
consumed_micro_usd: MicroUsdField.nonnegative(),
|
|
873
|
-
active_seconds:
|
|
874
|
-
tool_calls:
|
|
1009
|
+
active_seconds: z8.number().nonnegative(),
|
|
1010
|
+
tool_calls: z8.number().int().nonnegative()
|
|
875
1011
|
});
|
|
876
1012
|
|
|
877
1013
|
// ../core/src/schema/board.ts
|
|
878
|
-
import { z as
|
|
1014
|
+
import { z as z9 } from "zod";
|
|
879
1015
|
var BOARD_STATUSES = ["todo", "doing", "blocked", "done"];
|
|
880
|
-
var BoardStatusSchema =
|
|
881
|
-
var BoardCountsSchema =
|
|
882
|
-
todo:
|
|
883
|
-
doing:
|
|
884
|
-
blocked:
|
|
885
|
-
done:
|
|
886
|
-
});
|
|
887
|
-
var BoardSchema =
|
|
1016
|
+
var BoardStatusSchema = z9.enum(BOARD_STATUSES);
|
|
1017
|
+
var BoardCountsSchema = z9.object({
|
|
1018
|
+
todo: z9.number().int().nonnegative(),
|
|
1019
|
+
doing: z9.number().int().nonnegative(),
|
|
1020
|
+
blocked: z9.number().int().nonnegative(),
|
|
1021
|
+
done: z9.number().int().nonnegative()
|
|
1022
|
+
});
|
|
1023
|
+
var BoardSchema = z9.object({
|
|
888
1024
|
id: idOf("brd"),
|
|
889
|
-
object:
|
|
1025
|
+
object: z9.literal("board"),
|
|
890
1026
|
agent_id: idOf("agt"),
|
|
891
1027
|
cards: BoardCountsSchema,
|
|
892
1028
|
created_at: Timestamp
|
|
893
1029
|
});
|
|
894
|
-
var BoardCardSchema =
|
|
1030
|
+
var BoardCardSchema = z9.object({
|
|
895
1031
|
id: idOf("crd"),
|
|
896
|
-
object:
|
|
1032
|
+
object: z9.literal("board_card"),
|
|
897
1033
|
board_id: idOf("brd"),
|
|
898
|
-
title:
|
|
1034
|
+
title: z9.string().min(1),
|
|
899
1035
|
/** The brief — what was asked. */
|
|
900
|
-
body:
|
|
1036
|
+
body: z9.string(),
|
|
901
1037
|
/** What the holder wrote back; a `done` carries one. */
|
|
902
|
-
note:
|
|
1038
|
+
note: z9.string().nullable().default(null),
|
|
903
1039
|
status: BoardStatusSchema,
|
|
904
|
-
assignee:
|
|
1040
|
+
assignee: z9.string().nullable(),
|
|
905
1041
|
/** The cards this one waits on. A `blocked` card with an empty list is stuck on the world. */
|
|
906
|
-
blocked_by:
|
|
907
|
-
|
|
908
|
-
|
|
1042
|
+
blocked_by: z9.array(idOf("crd")),
|
|
1043
|
+
// The wake fields default on read: a reader whose API predates one still gets the card (§28.11).
|
|
1044
|
+
woken_session_id: idOf("ses").nullable().default(null),
|
|
1045
|
+
reported_status: BoardStatusSchema.nullable().default(null),
|
|
1046
|
+
/** Sessions the board has started for this card; the third is its last (§28.18). */
|
|
1047
|
+
wake_count: z9.number().int().nonnegative().default(0),
|
|
909
1048
|
created_at: Timestamp,
|
|
910
1049
|
updated_at: Timestamp
|
|
911
1050
|
});
|
|
912
|
-
var BoardCommentSchema =
|
|
1051
|
+
var BoardCommentSchema = z9.object({
|
|
913
1052
|
id: idOf("bcm"),
|
|
914
|
-
object:
|
|
1053
|
+
object: z9.literal("board_comment"),
|
|
915
1054
|
card_id: idOf("crd"),
|
|
916
1055
|
/**
|
|
917
1056
|
* Who wrote it, as an id the server derived — never a name the caller supplied. A member's
|
|
@@ -919,42 +1058,42 @@ var BoardCommentSchema = z8.object({
|
|
|
919
1058
|
* `key_` principal. The prefix is what lets a reader tell an agent's comment from a person's,
|
|
920
1059
|
* which is the distinction a free-text author field could not make and could be used to forge.
|
|
921
1060
|
*/
|
|
922
|
-
author:
|
|
923
|
-
body:
|
|
1061
|
+
author: z9.string(),
|
|
1062
|
+
body: z9.string(),
|
|
924
1063
|
created_at: Timestamp
|
|
925
1064
|
});
|
|
926
1065
|
|
|
927
1066
|
// ../core/src/schema/identity.ts
|
|
928
|
-
import { z as
|
|
1067
|
+
import { z as z10 } from "zod";
|
|
929
1068
|
var IDENTITY_NAME_MAX = 128;
|
|
930
1069
|
var IDENTITY_DESCRIPTION_MAX = 1024;
|
|
931
|
-
var IdentitySchema =
|
|
1070
|
+
var IdentitySchema = z10.object({
|
|
932
1071
|
id: idOf("idn"),
|
|
933
|
-
object:
|
|
1072
|
+
object: z10.literal("identity"),
|
|
934
1073
|
/** Human-facing persona name. Surfaced to the model so it acts in character. */
|
|
935
|
-
name:
|
|
1074
|
+
name: z10.string().min(1).max(IDENTITY_NAME_MAX),
|
|
936
1075
|
/** What the persona is for. The model reads it to choose tone, scope and endpoint. */
|
|
937
|
-
description:
|
|
1076
|
+
description: z10.string().max(IDENTITY_DESCRIPTION_MAX).nullable(),
|
|
938
1077
|
/** Inbox addresses (`localpart@domain`) this identity owns. */
|
|
939
|
-
emails:
|
|
1078
|
+
emails: z10.array(z10.string()),
|
|
940
1079
|
/** Provisioned numbers in E.164. */
|
|
941
|
-
phones:
|
|
1080
|
+
phones: z10.array(z10.string()),
|
|
942
1081
|
/** Verified web domains reachable through this identity's inboxes. */
|
|
943
|
-
domains:
|
|
1082
|
+
domains: z10.array(z10.string()),
|
|
944
1083
|
/** `conn_` ids of authorized third-party connections. */
|
|
945
|
-
connections:
|
|
1084
|
+
connections: z10.array(z10.string()),
|
|
946
1085
|
metadata: Metadata,
|
|
947
1086
|
created_at: Timestamp,
|
|
948
1087
|
updated_at: Timestamp
|
|
949
1088
|
});
|
|
950
1089
|
|
|
951
1090
|
// ../core/src/schema/resource.ts
|
|
952
|
-
import { z as
|
|
1091
|
+
import { z as z12 } from "zod";
|
|
953
1092
|
|
|
954
1093
|
// ../core/src/schema/files-library.ts
|
|
955
|
-
import { z as
|
|
1094
|
+
import { z as z11 } from "zod";
|
|
956
1095
|
var FILE_KINDS = ["image", "video", "audio", "document", "other"];
|
|
957
|
-
var FileKindSchema =
|
|
1096
|
+
var FileKindSchema = z11.enum(FILE_KINDS);
|
|
958
1097
|
var FILE_SOURCE_TYPES = [
|
|
959
1098
|
"upload",
|
|
960
1099
|
"url_import",
|
|
@@ -964,50 +1103,50 @@ var FILE_SOURCE_TYPES = [
|
|
|
964
1103
|
"screenshot",
|
|
965
1104
|
"speech_generation"
|
|
966
1105
|
];
|
|
967
|
-
var FileSourceTypeSchema =
|
|
968
|
-
var FileSourceSchema =
|
|
1106
|
+
var FileSourceTypeSchema = z11.enum(FILE_SOURCE_TYPES);
|
|
1107
|
+
var FileSourceSchema = z11.object({
|
|
969
1108
|
type: FileSourceTypeSchema,
|
|
970
|
-
job_id:
|
|
971
|
-
url:
|
|
1109
|
+
job_id: z11.union([idOf("med"), idOf("clj")]).nullable(),
|
|
1110
|
+
url: z11.string().url().nullable()
|
|
972
1111
|
});
|
|
973
|
-
var FileTagsSchema =
|
|
974
|
-
var FileLibraryFieldsSchema =
|
|
975
|
-
title:
|
|
976
|
-
description:
|
|
1112
|
+
var FileTagsSchema = z11.array(z11.string().min(1).max(64)).max(32);
|
|
1113
|
+
var FileLibraryFieldsSchema = z11.object({
|
|
1114
|
+
title: z11.string().max(256).nullable().default(null),
|
|
1115
|
+
description: z11.string().max(4096).nullable().default(null),
|
|
977
1116
|
tags: FileTagsSchema.default([]),
|
|
978
1117
|
kind: FileKindSchema.default("other"),
|
|
979
1118
|
source: FileSourceSchema.nullable().default(null),
|
|
980
1119
|
thumbnail_file_id: idOf("fil").nullable().default(null),
|
|
981
|
-
width:
|
|
982
|
-
height:
|
|
983
|
-
duration_seconds:
|
|
1120
|
+
width: z11.number().int().positive().nullable().default(null),
|
|
1121
|
+
height: z11.number().int().positive().nullable().default(null),
|
|
1122
|
+
duration_seconds: z11.number().nonnegative().nullable().default(null)
|
|
984
1123
|
});
|
|
985
|
-
var UpdateFileSchema =
|
|
986
|
-
title:
|
|
987
|
-
description:
|
|
1124
|
+
var UpdateFileSchema = z11.object({
|
|
1125
|
+
title: z11.string().max(256).nullable().optional(),
|
|
1126
|
+
description: z11.string().max(4096).nullable().optional(),
|
|
988
1127
|
tags: FileTagsSchema.optional()
|
|
989
1128
|
});
|
|
990
|
-
var ImportFileSchema =
|
|
991
|
-
url:
|
|
992
|
-
title:
|
|
993
|
-
description:
|
|
1129
|
+
var ImportFileSchema = z11.object({
|
|
1130
|
+
url: z11.string().url().startsWith("http"),
|
|
1131
|
+
title: z11.string().max(256).optional(),
|
|
1132
|
+
description: z11.string().max(4096).optional(),
|
|
994
1133
|
tags: FileTagsSchema.optional()
|
|
995
1134
|
});
|
|
996
1135
|
|
|
997
1136
|
// ../core/src/schema/resource.ts
|
|
998
|
-
var ComputerStatusSchema =
|
|
999
|
-
var VolumeSchema =
|
|
1137
|
+
var ComputerStatusSchema = z12.enum(["creating", "running", "paused", "failed", "destroyed"]);
|
|
1138
|
+
var VolumeSchema = z12.object({
|
|
1000
1139
|
id: idOf("vol"),
|
|
1001
|
-
size_gb:
|
|
1002
|
-
mount_path:
|
|
1140
|
+
size_gb: z12.number().int().positive(),
|
|
1141
|
+
mount_path: z12.string()
|
|
1003
1142
|
});
|
|
1004
|
-
var ComputerSchema =
|
|
1143
|
+
var ComputerSchema = z12.object({
|
|
1005
1144
|
id: idOf("cmp"),
|
|
1006
|
-
object:
|
|
1007
|
-
name:
|
|
1008
|
-
vcpu:
|
|
1009
|
-
memory_mb:
|
|
1010
|
-
disk_gb:
|
|
1145
|
+
object: z12.literal("computer"),
|
|
1146
|
+
name: z12.string(),
|
|
1147
|
+
vcpu: z12.number().int().positive(),
|
|
1148
|
+
memory_mb: z12.number().int().positive(),
|
|
1149
|
+
disk_gb: z12.number().int().positive(),
|
|
1011
1150
|
status: ComputerStatusSchema,
|
|
1012
1151
|
// core-gaps: U2-browser-api — the whole option object (§32.2); `{ allowed_domains }` still parses.
|
|
1013
1152
|
browser: BrowserOptionsSchema.nullable(),
|
|
@@ -1015,125 +1154,125 @@ var ComputerSchema = z11.object({
|
|
|
1015
1154
|
snapshot_id: idOf("snp").nullable(),
|
|
1016
1155
|
created_at: Timestamp
|
|
1017
1156
|
});
|
|
1018
|
-
var SnapshotSchema =
|
|
1157
|
+
var SnapshotSchema = z12.object({
|
|
1019
1158
|
snapshot_id: idOf("snp"),
|
|
1020
1159
|
computer_id: idOf("cmp"),
|
|
1021
1160
|
created_at: Timestamp
|
|
1022
1161
|
});
|
|
1023
|
-
var ComputerProbeSchema =
|
|
1162
|
+
var ComputerProbeSchema = z12.object({
|
|
1024
1163
|
sampled_at: Timestamp,
|
|
1025
|
-
uptime_seconds:
|
|
1026
|
-
processes:
|
|
1027
|
-
load_1m:
|
|
1028
|
-
memory_used_mb:
|
|
1029
|
-
memory_total_mb:
|
|
1030
|
-
disk_used_gb:
|
|
1031
|
-
disk_total_gb:
|
|
1032
|
-
});
|
|
1033
|
-
var ComputerInspectSchema =
|
|
1034
|
-
object:
|
|
1164
|
+
uptime_seconds: z12.number().int().nonnegative(),
|
|
1165
|
+
processes: z12.number().int().nonnegative(),
|
|
1166
|
+
load_1m: z12.number().nonnegative(),
|
|
1167
|
+
memory_used_mb: z12.number().int().nonnegative(),
|
|
1168
|
+
memory_total_mb: z12.number().int().positive(),
|
|
1169
|
+
disk_used_gb: z12.number().nonnegative(),
|
|
1170
|
+
disk_total_gb: z12.number().positive()
|
|
1171
|
+
});
|
|
1172
|
+
var ComputerInspectSchema = z12.object({
|
|
1173
|
+
object: z12.literal("computer_inspect"),
|
|
1035
1174
|
id: idOf("cmp"),
|
|
1036
1175
|
status: ComputerStatusSchema,
|
|
1037
1176
|
last_active_at: Timestamp.nullable(),
|
|
1038
1177
|
/** Where the provider's file API is rooted (§41.1); `null` when it does not say. */
|
|
1039
|
-
home:
|
|
1178
|
+
home: z12.string().min(1).nullable(),
|
|
1040
1179
|
probe: ComputerProbeSchema.nullable()
|
|
1041
1180
|
});
|
|
1042
1181
|
var COMMAND_OUTPUT_CAP = 65536;
|
|
1043
|
-
var ComputerCommandSchema =
|
|
1182
|
+
var ComputerCommandSchema = z12.object({
|
|
1044
1183
|
id: idOf("cmd"),
|
|
1045
|
-
object:
|
|
1184
|
+
object: z12.literal("computer_command"),
|
|
1046
1185
|
computer_id: idOf("cmp"),
|
|
1047
|
-
command:
|
|
1048
|
-
exit_code:
|
|
1049
|
-
timed_out:
|
|
1050
|
-
duration_ms:
|
|
1051
|
-
stdout:
|
|
1052
|
-
stderr:
|
|
1053
|
-
truncated:
|
|
1186
|
+
command: z12.string(),
|
|
1187
|
+
exit_code: z12.number().int().nullable(),
|
|
1188
|
+
timed_out: z12.boolean(),
|
|
1189
|
+
duration_ms: z12.number().int().nonnegative(),
|
|
1190
|
+
stdout: z12.string().max(COMMAND_OUTPUT_CAP),
|
|
1191
|
+
stderr: z12.string().max(COMMAND_OUTPUT_CAP),
|
|
1192
|
+
truncated: z12.boolean(),
|
|
1054
1193
|
actor: PrincipalSchema,
|
|
1055
1194
|
created_at: Timestamp
|
|
1056
1195
|
});
|
|
1057
|
-
var ExecStreamFrameSchema =
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
exit:
|
|
1062
|
-
exit_code:
|
|
1063
|
-
timed_out:
|
|
1064
|
-
duration_ms:
|
|
1196
|
+
var ExecStreamFrameSchema = z12.union([
|
|
1197
|
+
z12.object({ stdout: z12.string() }),
|
|
1198
|
+
z12.object({ stderr: z12.string() }),
|
|
1199
|
+
z12.object({
|
|
1200
|
+
exit: z12.object({
|
|
1201
|
+
exit_code: z12.number().int().nullable(),
|
|
1202
|
+
timed_out: z12.boolean(),
|
|
1203
|
+
duration_ms: z12.number().int().nonnegative(),
|
|
1065
1204
|
command_id: idOf("cmd")
|
|
1066
1205
|
})
|
|
1067
1206
|
})
|
|
1068
1207
|
]);
|
|
1069
|
-
var FileEntryTypeSchema =
|
|
1070
|
-
var FileEntrySchema =
|
|
1071
|
-
name:
|
|
1072
|
-
path:
|
|
1208
|
+
var FileEntryTypeSchema = z12.enum(["file", "directory", "symlink", "other"]);
|
|
1209
|
+
var FileEntrySchema = z12.object({
|
|
1210
|
+
name: z12.string().min(1),
|
|
1211
|
+
path: z12.string().min(1),
|
|
1073
1212
|
type: FileEntryTypeSchema,
|
|
1074
|
-
size_bytes:
|
|
1213
|
+
size_bytes: z12.number().int().nonnegative(),
|
|
1075
1214
|
/** POSIX `st_mode`. */
|
|
1076
|
-
mode:
|
|
1215
|
+
mode: z12.number().int().nonnegative(),
|
|
1077
1216
|
modified_at: Timestamp.nullable()
|
|
1078
1217
|
});
|
|
1079
|
-
var ComputerUpdateSchema =
|
|
1080
|
-
var SkillSchema =
|
|
1218
|
+
var ComputerUpdateSchema = z12.strictObject({ name: z12.string().min(1).max(200) });
|
|
1219
|
+
var SkillSchema = z12.object({
|
|
1081
1220
|
id: idOf("skl"),
|
|
1082
|
-
object:
|
|
1083
|
-
name:
|
|
1084
|
-
description:
|
|
1085
|
-
latest_version:
|
|
1221
|
+
object: z12.literal("skill"),
|
|
1222
|
+
name: z12.string(),
|
|
1223
|
+
description: z12.string().nullable(),
|
|
1224
|
+
latest_version: z12.number().int().positive(),
|
|
1086
1225
|
created_at: Timestamp
|
|
1087
1226
|
});
|
|
1088
|
-
var ResolvedSkillRefSchema =
|
|
1227
|
+
var ResolvedSkillRefSchema = z12.object({
|
|
1089
1228
|
/** The reference exactly as the agent version wrote it: `slug` or `slug@N`. */
|
|
1090
|
-
ref:
|
|
1091
|
-
slug:
|
|
1092
|
-
version:
|
|
1093
|
-
description:
|
|
1094
|
-
storage_key:
|
|
1095
|
-
});
|
|
1096
|
-
var SkillVersionSchema =
|
|
1097
|
-
version:
|
|
1098
|
-
sha256:
|
|
1099
|
-
size_bytes:
|
|
1229
|
+
ref: z12.string().min(1),
|
|
1230
|
+
slug: z12.string().min(1),
|
|
1231
|
+
version: z12.number().int().positive(),
|
|
1232
|
+
description: z12.string(),
|
|
1233
|
+
storage_key: z12.string().min(1)
|
|
1234
|
+
});
|
|
1235
|
+
var SkillVersionSchema = z12.object({
|
|
1236
|
+
version: z12.number().int().positive(),
|
|
1237
|
+
sha256: z12.string().regex(/^[0-9a-f]{64}$/),
|
|
1238
|
+
size_bytes: z12.number().int().nonnegative(),
|
|
1100
1239
|
created_at: Timestamp
|
|
1101
1240
|
});
|
|
1102
|
-
var SkillCatalogEntrySchema =
|
|
1103
|
-
object:
|
|
1104
|
-
slug:
|
|
1105
|
-
version:
|
|
1106
|
-
name:
|
|
1107
|
-
description:
|
|
1108
|
-
tags:
|
|
1109
|
-
content_hash:
|
|
1241
|
+
var SkillCatalogEntrySchema = z12.object({
|
|
1242
|
+
object: z12.literal("skill_catalog_entry"),
|
|
1243
|
+
slug: z12.string().regex(/^[a-z0-9][a-z0-9-]*$/),
|
|
1244
|
+
version: z12.number().int().positive(),
|
|
1245
|
+
name: z12.string().min(1),
|
|
1246
|
+
description: z12.string(),
|
|
1247
|
+
tags: z12.array(z12.string().min(1)),
|
|
1248
|
+
content_hash: z12.string().regex(/^[0-9a-f]{64}$/),
|
|
1110
1249
|
published_at: Timestamp
|
|
1111
1250
|
});
|
|
1112
|
-
var SkillCatalogVersionSchema = SkillCatalogEntrySchema.extend({ content:
|
|
1113
|
-
var FileSchema =
|
|
1251
|
+
var SkillCatalogVersionSchema = SkillCatalogEntrySchema.extend({ content: z12.string() });
|
|
1252
|
+
var FileSchema = z12.object({
|
|
1114
1253
|
id: idOf("fil"),
|
|
1115
|
-
object:
|
|
1116
|
-
name:
|
|
1117
|
-
content_type:
|
|
1118
|
-
size_bytes:
|
|
1119
|
-
scope:
|
|
1254
|
+
object: z12.literal("file"),
|
|
1255
|
+
name: z12.string(),
|
|
1256
|
+
content_type: z12.string(),
|
|
1257
|
+
size_bytes: z12.number().int().nonnegative(),
|
|
1258
|
+
scope: z12.enum(["session", "published"]),
|
|
1120
1259
|
session_id: idOf("ses").nullable(),
|
|
1121
|
-
sha256:
|
|
1260
|
+
sha256: z12.string().regex(/^[0-9a-f]{64}$/),
|
|
1122
1261
|
created_at: Timestamp,
|
|
1123
1262
|
// The asset-library fields (`canonical-spec §36.1`), all nullable or defaulted.
|
|
1124
1263
|
...FileLibraryFieldsSchema.shape
|
|
1125
1264
|
});
|
|
1126
|
-
var ScheduleStatusSchema =
|
|
1127
|
-
var DeploymentSchema =
|
|
1265
|
+
var ScheduleStatusSchema = z12.enum(["scheduled", "paused", "unscheduled"]);
|
|
1266
|
+
var DeploymentSchema = z12.object({
|
|
1128
1267
|
id: idOf("dep"),
|
|
1129
|
-
object:
|
|
1268
|
+
object: z12.literal("deployment"),
|
|
1130
1269
|
agent_id: idOf("agt"),
|
|
1131
1270
|
/** A pin. `null` tracks the agent's `current_version` on every fire (§12). */
|
|
1132
|
-
agent_version:
|
|
1133
|
-
cron:
|
|
1271
|
+
agent_version: z12.number().int().positive().nullable(),
|
|
1272
|
+
cron: z12.string(),
|
|
1134
1273
|
/** IANA zone the `cron` is read in. "0 9 * * 1" means 09:00 *here*, across DST (ADR-0074). */
|
|
1135
|
-
timezone:
|
|
1136
|
-
input_template:
|
|
1274
|
+
timezone: z12.string(),
|
|
1275
|
+
input_template: z12.string(),
|
|
1137
1276
|
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
1138
1277
|
window: WindowSchema,
|
|
1139
1278
|
/**
|
|
@@ -1143,21 +1282,21 @@ var DeploymentSchema = z11.object({
|
|
|
1143
1282
|
* those endpoints, and a signed delivery over cleartext is not a delivery. Until the push was
|
|
1144
1283
|
* wired this field went nowhere, so nothing can be relying on an `http://` value (ADR-0161).
|
|
1145
1284
|
*/
|
|
1146
|
-
on_idle:
|
|
1285
|
+
on_idle: z12.url().startsWith("https://", { error: "a webhook URL must be https" }).nullable(),
|
|
1147
1286
|
/**
|
|
1148
1287
|
* The persona every fire speaks as, or `null` to run as nobody (§22). Written as an `idn_` id
|
|
1149
1288
|
* **or** the persona's name, the way a session names one, and always echoed as the id: a fire at
|
|
1150
1289
|
* 3am must not be silenced by someone renaming the persona at noon.
|
|
1151
1290
|
*/
|
|
1152
1291
|
identity: idOf("idn").nullable(),
|
|
1153
|
-
enabled:
|
|
1292
|
+
enabled: z12.boolean(),
|
|
1154
1293
|
/** Derived per deploy, never stored — the row cannot know whether a clock is watching it. */
|
|
1155
1294
|
schedule_status: ScheduleStatusSchema,
|
|
1156
1295
|
/** The next fire, or `null` when nothing will fire it (`schedule_status` says which). */
|
|
1157
1296
|
next_run_at: Timestamp.nullable(),
|
|
1158
1297
|
created_at: Timestamp
|
|
1159
1298
|
});
|
|
1160
|
-
var DeploymentRunSchema =
|
|
1299
|
+
var DeploymentRunSchema = z12.object({
|
|
1161
1300
|
id: idOf("run"),
|
|
1162
1301
|
session_id: idOf("ses"),
|
|
1163
1302
|
status: SessionStatusSchema,
|
|
@@ -1165,62 +1304,62 @@ var DeploymentRunSchema = z11.object({
|
|
|
1165
1304
|
});
|
|
1166
1305
|
|
|
1167
1306
|
// ../core/src/schema/comms.ts
|
|
1168
|
-
import { z as
|
|
1169
|
-
var DomainKindSchema =
|
|
1170
|
-
var DomainStatusSchema =
|
|
1171
|
-
var DomainDnsStatusSchema =
|
|
1172
|
-
var DomainInboundStatusSchema =
|
|
1173
|
-
var DomainAppConnectStatusSchema =
|
|
1174
|
-
var DnsRecordSchema =
|
|
1175
|
-
type:
|
|
1176
|
-
host:
|
|
1177
|
-
value:
|
|
1178
|
-
priority:
|
|
1307
|
+
import { z as z13 } from "zod";
|
|
1308
|
+
var DomainKindSchema = z13.enum(["system", "external", "purchased"]);
|
|
1309
|
+
var DomainStatusSchema = z13.enum(["pending_dns", "active", "failed"]);
|
|
1310
|
+
var DomainDnsStatusSchema = z13.enum(["pending_verification", "provisioned", "failed"]);
|
|
1311
|
+
var DomainInboundStatusSchema = z13.enum(["pending", "verified", "failed"]);
|
|
1312
|
+
var DomainAppConnectStatusSchema = z13.enum(["pending", "connected", "failed"]);
|
|
1313
|
+
var DnsRecordSchema = z13.object({
|
|
1314
|
+
type: z13.enum(["TXT", "CNAME", "MX"]),
|
|
1315
|
+
host: z13.string(),
|
|
1316
|
+
value: z13.string(),
|
|
1317
|
+
priority: z13.number().int().nullable(),
|
|
1179
1318
|
/** Vetta owns this record: `_dmarc`, DKIM, inbound MX. The agent may read it, never write it. */
|
|
1180
|
-
managed:
|
|
1319
|
+
managed: z13.boolean()
|
|
1181
1320
|
});
|
|
1182
|
-
var DomainSchema =
|
|
1321
|
+
var DomainSchema = z13.object({
|
|
1183
1322
|
id: idOf("dom"),
|
|
1184
|
-
object:
|
|
1323
|
+
object: z13.literal("domain"),
|
|
1185
1324
|
/** A domain belongs to the **organization**, not to one identity: two identities share one. */
|
|
1186
|
-
name:
|
|
1325
|
+
name: z13.string(),
|
|
1187
1326
|
kind: DomainKindSchema,
|
|
1188
1327
|
status: DomainStatusSchema,
|
|
1189
1328
|
dns_status: DomainDnsStatusSchema,
|
|
1190
1329
|
inbound_status: DomainInboundStatusSchema,
|
|
1191
1330
|
app_connect_status: DomainAppConnectStatusSchema,
|
|
1192
|
-
records:
|
|
1331
|
+
records: z13.array(DnsRecordSchema),
|
|
1193
1332
|
last_verified_at: Timestamp.nullable(),
|
|
1194
1333
|
created_at: Timestamp
|
|
1195
1334
|
});
|
|
1196
|
-
var EmailInboxSchema =
|
|
1335
|
+
var EmailInboxSchema = z13.object({
|
|
1197
1336
|
id: idOf("eml"),
|
|
1198
|
-
object:
|
|
1337
|
+
object: z13.literal("email_inbox"),
|
|
1199
1338
|
identity_id: idOf("idn"),
|
|
1200
1339
|
domain_id: idOf("dom"),
|
|
1201
|
-
address:
|
|
1202
|
-
localpart:
|
|
1340
|
+
address: z13.string(),
|
|
1341
|
+
localpart: z13.string(),
|
|
1203
1342
|
/** Inbound routing keys off this: mail to the address wakes exactly this agent. */
|
|
1204
1343
|
owning_agent_id: idOf("agt"),
|
|
1205
|
-
status:
|
|
1344
|
+
status: z13.enum(["active", "disabled"]),
|
|
1206
1345
|
created_at: Timestamp
|
|
1207
1346
|
});
|
|
1208
|
-
var PhoneTierSchema =
|
|
1209
|
-
var BrandStatusSchema =
|
|
1210
|
-
var CampaignStatusSchema =
|
|
1211
|
-
var PhoneNumberSchema =
|
|
1347
|
+
var PhoneTierSchema = z13.enum(["sole_prop", "standard"]);
|
|
1348
|
+
var BrandStatusSchema = z13.enum(["none", "pending_verification", "verified", "rejected"]);
|
|
1349
|
+
var CampaignStatusSchema = z13.enum(["none", "pending", "approved", "rejected"]);
|
|
1350
|
+
var PhoneNumberSchema = z13.object({
|
|
1212
1351
|
id: idOf("pho"),
|
|
1213
|
-
object:
|
|
1352
|
+
object: z13.literal("phone_number"),
|
|
1214
1353
|
identity_id: idOf("idn"),
|
|
1215
|
-
e164:
|
|
1216
|
-
country:
|
|
1217
|
-
capabilities:
|
|
1354
|
+
e164: z13.string(),
|
|
1355
|
+
country: z13.string(),
|
|
1356
|
+
capabilities: z13.object({
|
|
1218
1357
|
/** Live the moment the number is bought — inbound never waits on carrier registration. */
|
|
1219
|
-
sms_inbound:
|
|
1358
|
+
sms_inbound: z13.boolean(),
|
|
1220
1359
|
/** True **iff** `campaign_status === "approved"`. Nothing else may set it. */
|
|
1221
|
-
sms_outbound:
|
|
1360
|
+
sms_outbound: z13.boolean(),
|
|
1222
1361
|
/** Voice is not a P2 capability; the field exists so its absence is explicit. */
|
|
1223
|
-
voice:
|
|
1362
|
+
voice: z13.literal(false)
|
|
1224
1363
|
}),
|
|
1225
1364
|
tier: PhoneTierSchema,
|
|
1226
1365
|
brand_status: BrandStatusSchema,
|
|
@@ -1228,46 +1367,46 @@ var PhoneNumberSchema = z12.object({
|
|
|
1228
1367
|
provisioned_at: Timestamp.nullable(),
|
|
1229
1368
|
created_at: Timestamp
|
|
1230
1369
|
});
|
|
1231
|
-
var InboundMessageSchema =
|
|
1370
|
+
var InboundMessageSchema = z13.object({
|
|
1232
1371
|
id: idOf("inb"),
|
|
1233
|
-
object:
|
|
1234
|
-
channel:
|
|
1372
|
+
object: z13.literal("inbound_message"),
|
|
1373
|
+
channel: z13.enum(["email", "sms"]),
|
|
1235
1374
|
identity_id: idOf("idn"),
|
|
1236
1375
|
/** The `eml_`/`pho_` endpoint it arrived at — the persona is decided by *where*, not by *who*. */
|
|
1237
|
-
endpoint_id:
|
|
1238
|
-
from:
|
|
1239
|
-
to:
|
|
1240
|
-
subject:
|
|
1241
|
-
text:
|
|
1376
|
+
endpoint_id: z13.string(),
|
|
1377
|
+
from: z13.string(),
|
|
1378
|
+
to: z13.string(),
|
|
1379
|
+
subject: z13.string().nullable(),
|
|
1380
|
+
text: z13.string(),
|
|
1242
1381
|
/** SPF/DKIM/DMARC for mail, carrier origin for SMS. Kept for the audit of why it was accepted. */
|
|
1243
|
-
auth:
|
|
1382
|
+
auth: z13.record(z13.string(), z13.string()),
|
|
1244
1383
|
/** The session this message woke. Null until the wake seam lands (see ADR-0120). */
|
|
1245
1384
|
session_id: idOf("ses").nullable(),
|
|
1246
1385
|
received_at: Timestamp
|
|
1247
1386
|
});
|
|
1248
1387
|
|
|
1249
1388
|
// ../core/src/schema/app.ts
|
|
1250
|
-
import { z as
|
|
1251
|
-
var AppTypeSchema =
|
|
1252
|
-
var AppStatusSchema =
|
|
1253
|
-
var AppMcpPathSchema =
|
|
1254
|
-
var AppSchema =
|
|
1389
|
+
import { z as z14 } from "zod";
|
|
1390
|
+
var AppTypeSchema = z14.enum(["frontend_only", "fullstack"]);
|
|
1391
|
+
var AppStatusSchema = z14.enum(["provisioning", "active", "error"]);
|
|
1392
|
+
var AppMcpPathSchema = z14.string().regex(/^\/\S*$/, "must be an absolute path beginning with /").max(128);
|
|
1393
|
+
var AppSchema = z14.object({
|
|
1255
1394
|
id: idOf("app"),
|
|
1256
|
-
object:
|
|
1257
|
-
name:
|
|
1258
|
-
description:
|
|
1395
|
+
object: z14.literal("app"),
|
|
1396
|
+
name: z14.string(),
|
|
1397
|
+
description: z14.string().nullable(),
|
|
1259
1398
|
type: AppTypeSchema,
|
|
1260
1399
|
/**
|
|
1261
1400
|
* The customer's own project name that made this app, or `null` for one made outside a project
|
|
1262
1401
|
* (ADR-0375). Customer-visible, unlike the provider handles: it is the word the customer typed,
|
|
1263
1402
|
* and the refusal that guards a name quotes it.
|
|
1264
1403
|
*/
|
|
1265
|
-
project:
|
|
1404
|
+
project: z14.string().nullable(),
|
|
1266
1405
|
status: AppStatusSchema,
|
|
1267
1406
|
/** The address the app answers on — platform hostname until a custom domain connects. */
|
|
1268
|
-
url:
|
|
1407
|
+
url: z14.string().nullable(),
|
|
1269
1408
|
/** White-label words when `status` is `error`; never the provider's. */
|
|
1270
|
-
error:
|
|
1409
|
+
error: z14.string().nullable(),
|
|
1271
1410
|
/** Where the app serves MCP, or `null`. The bearer token for it is a server column. */
|
|
1272
1411
|
mcp: AppMcpPathSchema.nullable(),
|
|
1273
1412
|
/**
|
|
@@ -1275,49 +1414,49 @@ var AppSchema = z13.object({
|
|
|
1275
1414
|
* than linking its `url` (`§29.1`)? True when the platform holds the app's `DASHBOARD_TOKEN`
|
|
1276
1415
|
* or a secret of that name exists on the app; derived on read, never stored.
|
|
1277
1416
|
*/
|
|
1278
|
-
dashboard:
|
|
1417
|
+
dashboard: z14.boolean(),
|
|
1279
1418
|
created_at: Timestamp
|
|
1280
1419
|
});
|
|
1281
|
-
var AppDeploymentStatusSchema =
|
|
1282
|
-
var AppDeploymentSchema =
|
|
1420
|
+
var AppDeploymentStatusSchema = z14.enum(["queued", "building", "ready", "error"]);
|
|
1421
|
+
var AppDeploymentSchema = z14.object({
|
|
1283
1422
|
id: idOf("apd"),
|
|
1284
|
-
object:
|
|
1423
|
+
object: z14.literal("app_deployment"),
|
|
1285
1424
|
app_id: idOf("app"),
|
|
1286
1425
|
status: AppDeploymentStatusSchema,
|
|
1287
|
-
url:
|
|
1288
|
-
error:
|
|
1426
|
+
url: z14.string().nullable(),
|
|
1427
|
+
error: z14.string().nullable(),
|
|
1289
1428
|
/** The client's opaque digest of the files, echoed verbatim so it can skip an unchanged deploy. */
|
|
1290
|
-
content_hash:
|
|
1429
|
+
content_hash: z14.string().nullable(),
|
|
1291
1430
|
created_at: Timestamp
|
|
1292
1431
|
});
|
|
1293
|
-
var AppDeploymentFilesSchema =
|
|
1294
|
-
object:
|
|
1432
|
+
var AppDeploymentFilesSchema = z14.object({
|
|
1433
|
+
object: z14.literal("app_deployment_files"),
|
|
1295
1434
|
deployment_id: idOf("apd"),
|
|
1296
|
-
files:
|
|
1435
|
+
files: z14.record(z14.string().min(1), z14.string())
|
|
1297
1436
|
});
|
|
1298
|
-
var AppSecretSchema =
|
|
1299
|
-
object:
|
|
1300
|
-
name:
|
|
1437
|
+
var AppSecretSchema = z14.object({
|
|
1438
|
+
object: z14.literal("app_secret"),
|
|
1439
|
+
name: z14.string(),
|
|
1301
1440
|
/** The client's opaque digest of the value, echoed verbatim so it can skip an unchanged write. */
|
|
1302
|
-
value_hash:
|
|
1441
|
+
value_hash: z14.string().nullable(),
|
|
1303
1442
|
created_at: Timestamp
|
|
1304
1443
|
});
|
|
1305
|
-
var AppEntrySchema =
|
|
1306
|
-
object:
|
|
1307
|
-
url:
|
|
1308
|
-
ticket:
|
|
1444
|
+
var AppEntrySchema = z14.object({
|
|
1445
|
+
object: z14.literal("app_entry"),
|
|
1446
|
+
url: z14.string(),
|
|
1447
|
+
ticket: z14.string()
|
|
1309
1448
|
});
|
|
1310
|
-
var AppAccessSchema =
|
|
1311
|
-
object:
|
|
1312
|
-
url:
|
|
1313
|
-
password:
|
|
1449
|
+
var AppAccessSchema = z14.object({
|
|
1450
|
+
object: z14.literal("app_access"),
|
|
1451
|
+
url: z14.string().nullable(),
|
|
1452
|
+
password: z14.string().nullable()
|
|
1314
1453
|
});
|
|
1315
|
-
var AppDomainStatusSchema =
|
|
1316
|
-
var AppDomainSchema =
|
|
1317
|
-
object:
|
|
1454
|
+
var AppDomainStatusSchema = z14.enum(["pending", "connected", "failed"]);
|
|
1455
|
+
var AppDomainSchema = z14.object({
|
|
1456
|
+
object: z14.literal("app_domain"),
|
|
1318
1457
|
app_id: idOf("app"),
|
|
1319
1458
|
domain_id: idOf("dom"),
|
|
1320
|
-
domain:
|
|
1459
|
+
domain: z14.string(),
|
|
1321
1460
|
status: AppDomainStatusSchema,
|
|
1322
1461
|
created_at: Timestamp
|
|
1323
1462
|
});
|
|
@@ -1325,60 +1464,76 @@ var ENV_NAME = /^[A-Z_][A-Z0-9_]*$/;
|
|
|
1325
1464
|
var APP_NAME = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
1326
1465
|
|
|
1327
1466
|
// ../core/src/schema/install.ts
|
|
1328
|
-
import { z as
|
|
1329
|
-
var BlueprintInstallSourceSchema =
|
|
1330
|
-
var BlueprintInstallStatusSchema =
|
|
1331
|
-
var ResourceActionSchema =
|
|
1332
|
-
var ResourceReportSchema =
|
|
1333
|
-
name:
|
|
1467
|
+
import { z as z15 } from "zod";
|
|
1468
|
+
var BlueprintInstallSourceSchema = z15.enum(["studio", "cli"]);
|
|
1469
|
+
var BlueprintInstallStatusSchema = z15.enum(["pending", "applied", "failed"]);
|
|
1470
|
+
var ResourceActionSchema = z15.enum(["created", "updated", "unchanged", "deleted", "refused"]);
|
|
1471
|
+
var ResourceReportSchema = z15.object({
|
|
1472
|
+
name: z15.string().min(1),
|
|
1334
1473
|
action: ResourceActionSchema,
|
|
1335
1474
|
/** The `agt_`/`app_`/`ses_`… the line resolved to. Absent on a refusal that never got an id. */
|
|
1336
|
-
id:
|
|
1475
|
+
id: z15.string().optional(),
|
|
1337
1476
|
/** An app's hostname once its build went live; `null` while it has none. Apps only. */
|
|
1338
|
-
url:
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1477
|
+
url: z15.string().nullable().optional(),
|
|
1478
|
+
/**
|
|
1479
|
+
* What a TASK is called and who owes it. `name` is the declaration key (`first-render`), which is
|
|
1480
|
+
* how a re-apply finds the same card and is not a sentence anybody wants read to them. The
|
|
1481
|
+
* dashboard's opening message lists the team's work, so it needs the title the board shows and the
|
|
1482
|
+
* seat that holds it. Tasks only.
|
|
1483
|
+
*/
|
|
1484
|
+
title: z15.string().optional(),
|
|
1485
|
+
assignee: z15.string().optional(),
|
|
1486
|
+
/**
|
|
1487
|
+
* A SCHEDULE'S brief, in one short line — the opening sentence of its `input_template`. A
|
|
1488
|
+
* schedules line is named `<agent> @ <cron>`, which says when something runs and nothing at all
|
|
1489
|
+
* about what it does, so a roadmap built from these lines could only ever have been a timetable.
|
|
1490
|
+
* Written here rather than read back from the deployment so the receipt stays the one read the
|
|
1491
|
+
* welcome needs. Schedules only.
|
|
1492
|
+
*/
|
|
1493
|
+
summary: z15.string().optional(),
|
|
1494
|
+
reason: z15.string().optional()
|
|
1495
|
+
});
|
|
1496
|
+
var BlueprintReportSchema = z15.object({
|
|
1497
|
+
skills: z15.array(ResourceReportSchema),
|
|
1498
|
+
identities: z15.array(ResourceReportSchema),
|
|
1499
|
+
vaults: z15.array(ResourceReportSchema),
|
|
1500
|
+
apps: z15.array(ResourceReportSchema),
|
|
1501
|
+
agents: z15.array(ResourceReportSchema),
|
|
1502
|
+
schedules: z15.array(ResourceReportSchema),
|
|
1503
|
+
intake: z15.array(ResourceReportSchema),
|
|
1349
1504
|
/** One line per declared task (§31.11), `id` the card's `crd_`. Defaulted so older rows parse. */
|
|
1350
|
-
tasks:
|
|
1351
|
-
skipped:
|
|
1352
|
-
deselected:
|
|
1505
|
+
tasks: z15.array(ResourceReportSchema).default([]),
|
|
1506
|
+
skipped: z15.array(z15.string()),
|
|
1507
|
+
deselected: z15.array(z15.string()).default([])
|
|
1353
1508
|
});
|
|
1354
|
-
var BlueprintSelectionSchema =
|
|
1355
|
-
agents:
|
|
1356
|
-
apps:
|
|
1509
|
+
var BlueprintSelectionSchema = z15.object({
|
|
1510
|
+
agents: z15.array(z15.string().min(1)),
|
|
1511
|
+
apps: z15.array(z15.string().min(1))
|
|
1357
1512
|
});
|
|
1358
|
-
var BlueprintInstallSchema =
|
|
1513
|
+
var BlueprintInstallSchema = z15.object({
|
|
1359
1514
|
id: idOf("bpi"),
|
|
1360
|
-
object:
|
|
1515
|
+
object: z15.literal("blueprint_install"),
|
|
1361
1516
|
/** The customer's own `defineProject({ name })` — the same word `app.project` stamps (§29.2). */
|
|
1362
|
-
project:
|
|
1517
|
+
project: z15.string().min(1),
|
|
1363
1518
|
/** The pair the declaration resolved to; `null` for a declaration that names no blueprint. */
|
|
1364
|
-
blueprint:
|
|
1365
|
-
template:
|
|
1519
|
+
blueprint: z15.string().nullable(),
|
|
1520
|
+
template: z15.string().nullable(),
|
|
1366
1521
|
/**
|
|
1367
1522
|
* Applies, not versions of anything: 1 on the first apply, +1 on each one after, whichever writer
|
|
1368
1523
|
* made it. It is not an agent version and it never rolls back.
|
|
1369
1524
|
*/
|
|
1370
|
-
revision:
|
|
1525
|
+
revision: z15.number().int().positive(),
|
|
1371
1526
|
/**
|
|
1372
1527
|
* The blueprint artifact version this came from, or `null` when it was applied from a working
|
|
1373
1528
|
* tree — an operator editing a clone has no version to name.
|
|
1374
1529
|
*/
|
|
1375
|
-
artifact_version:
|
|
1530
|
+
artifact_version: z15.string().nullable(),
|
|
1376
1531
|
/**
|
|
1377
1532
|
* The setup answers this project was configured with (§7.1 fields, keyed by their `key`), so a
|
|
1378
1533
|
* re-apply does not re-ask and both writers configure from the same answers. Configuration only:
|
|
1379
1534
|
* a secret is a vault credential (§23) or an app secret (§29.2), and neither is ever an answer.
|
|
1380
1535
|
*/
|
|
1381
|
-
answers:
|
|
1536
|
+
answers: z15.record(z15.string(), z15.unknown()),
|
|
1382
1537
|
/**
|
|
1383
1538
|
* NO `declaration` ON THE WIRE, and that is the reconciliation of §29.6 with §31.1.
|
|
1384
1539
|
*
|
|
@@ -1407,7 +1562,7 @@ var BlueprintInstallSchema = z14.object({
|
|
|
1407
1562
|
report: BlueprintReportSchema.nullable(),
|
|
1408
1563
|
status: BlueprintInstallStatusSchema,
|
|
1409
1564
|
/** Why a `failed` run threw, in one sentence; `null` on every other row. Never a stack or a key. */
|
|
1410
|
-
failure:
|
|
1565
|
+
failure: z15.string().nullable(),
|
|
1411
1566
|
/**
|
|
1412
1567
|
* The `selection` the apply carried, or `null` — every row written before §31.2 and every apply
|
|
1413
1568
|
* that omitted it, both meaning "everything". Defaulted so those rows parse unchanged.
|
|
@@ -1418,29 +1573,29 @@ var BlueprintInstallSchema = z14.object({
|
|
|
1418
1573
|
applied_at: Timestamp,
|
|
1419
1574
|
created_at: Timestamp
|
|
1420
1575
|
});
|
|
1421
|
-
var ProjectContextAnswerSchema =
|
|
1422
|
-
key:
|
|
1423
|
-
label:
|
|
1424
|
-
value:
|
|
1425
|
-
});
|
|
1426
|
-
var ProjectContextSchema =
|
|
1427
|
-
object:
|
|
1428
|
-
project:
|
|
1429
|
-
blueprint:
|
|
1430
|
-
template:
|
|
1431
|
-
artifact_version:
|
|
1432
|
-
answers:
|
|
1433
|
-
apps:
|
|
1434
|
-
agents:
|
|
1576
|
+
var ProjectContextAnswerSchema = z15.object({
|
|
1577
|
+
key: z15.string().min(1),
|
|
1578
|
+
label: z15.string(),
|
|
1579
|
+
value: z15.union([z15.string(), z15.array(z15.string())])
|
|
1580
|
+
});
|
|
1581
|
+
var ProjectContextSchema = z15.object({
|
|
1582
|
+
object: z15.literal("project_context"),
|
|
1583
|
+
project: z15.string().min(1),
|
|
1584
|
+
blueprint: z15.string().nullable(),
|
|
1585
|
+
template: z15.string().nullable(),
|
|
1586
|
+
artifact_version: z15.string().nullable(),
|
|
1587
|
+
answers: z15.array(ProjectContextAnswerSchema),
|
|
1588
|
+
apps: z15.array(z15.object({ name: z15.string().min(1), url: z15.string().nullable() })),
|
|
1589
|
+
agents: z15.array(z15.object({ name: z15.string().min(1), role: z15.string().nullable() })),
|
|
1435
1590
|
/** `context_updated_at` once the answers have been edited, `applied_at` until then. */
|
|
1436
1591
|
updated_at: Timestamp
|
|
1437
1592
|
});
|
|
1438
1593
|
|
|
1439
1594
|
// ../core/src/schema/blueprint.ts
|
|
1440
|
-
import { z as
|
|
1595
|
+
import { z as z17 } from "zod";
|
|
1441
1596
|
|
|
1442
1597
|
// ../core/src/schema/social.ts
|
|
1443
|
-
import { z as
|
|
1598
|
+
import { z as z16 } from "zod";
|
|
1444
1599
|
var SOCIAL_PLATFORMS = [
|
|
1445
1600
|
"bluesky",
|
|
1446
1601
|
"facebook",
|
|
@@ -1454,6 +1609,7 @@ var SOCIAL_PLATFORMS = [
|
|
|
1454
1609
|
"x",
|
|
1455
1610
|
"youtube"
|
|
1456
1611
|
];
|
|
1612
|
+
var SOCIAL_APPS = /* @__PURE__ */ new Set([...SOCIAL_PLATFORMS, "twitter"]);
|
|
1457
1613
|
var SOCIAL_TEXT_PLATFORMS = [
|
|
1458
1614
|
"bluesky",
|
|
1459
1615
|
"facebook",
|
|
@@ -1465,24 +1621,24 @@ var SOCIAL_TEXT_PLATFORMS = [
|
|
|
1465
1621
|
var SOCIAL_MEDIA_PLATFORMS = ["instagram", "tiktok", "youtube"];
|
|
1466
1622
|
var SOCIAL_VISIBILITIES = ["public", "unlisted", "private"];
|
|
1467
1623
|
var SOCIAL_VISIBILITY_PLATFORMS = ["mastodon", "youtube"];
|
|
1468
|
-
var SocialVisibilitySchema =
|
|
1624
|
+
var SocialVisibilitySchema = z16.enum(SOCIAL_VISIBILITIES);
|
|
1469
1625
|
var SOCIAL_VISIBILITY_RULE = `visibility is ${SOCIAL_VISIBILITIES.join(", ")} and only ${SOCIAL_VISIBILITY_PLATFORMS.join(" and ")} accept it; omit it and the post publishes at the account's own default, which on a video channel is normally public`;
|
|
1470
|
-
var SocialPlatformSchema =
|
|
1471
|
-
var SocialTextPlatformSchema =
|
|
1626
|
+
var SocialPlatformSchema = z16.enum(SOCIAL_PLATFORMS);
|
|
1627
|
+
var SocialTextPlatformSchema = z16.enum(SOCIAL_TEXT_PLATFORMS);
|
|
1472
1628
|
var isText = (platform) => SOCIAL_TEXT_PLATFORMS.includes(platform);
|
|
1473
1629
|
var isMedia = (platform) => SOCIAL_MEDIA_PLATFORMS.includes(platform);
|
|
1474
1630
|
var SOCIAL_PLATFORM_RULE = `${SOCIAL_TEXT_PLATFORMS.join(", ")} take a text-only post; ${SOCIAL_MEDIA_PLATFORMS.join(", ")} may be named only when the post carries media_urls or file_ids; ${SOCIAL_PLATFORMS.filter((platform) => !isText(platform) && !isMedia(platform)).join(", ")} cannot be posted to`;
|
|
1475
|
-
var SocialAccountSchema =
|
|
1476
|
-
id:
|
|
1477
|
-
object:
|
|
1631
|
+
var SocialAccountSchema = z16.object({
|
|
1632
|
+
id: z16.string().min(1),
|
|
1633
|
+
object: z16.literal("social_account"),
|
|
1478
1634
|
identity_id: idOf("idn"),
|
|
1479
1635
|
platform: SocialPlatformSchema,
|
|
1480
|
-
username:
|
|
1481
|
-
display_name:
|
|
1482
|
-
avatar_url:
|
|
1636
|
+
username: z16.string().nullable(),
|
|
1637
|
+
display_name: z16.string().nullable(),
|
|
1638
|
+
avatar_url: z16.url().nullable(),
|
|
1483
1639
|
connected_at: Timestamp.nullable()
|
|
1484
1640
|
});
|
|
1485
|
-
var SocialPostStatusSchema =
|
|
1641
|
+
var SocialPostStatusSchema = z16.enum([
|
|
1486
1642
|
"draft",
|
|
1487
1643
|
"scheduled",
|
|
1488
1644
|
"processing",
|
|
@@ -1490,248 +1646,248 @@ var SocialPostStatusSchema = z15.enum([
|
|
|
1490
1646
|
"failed",
|
|
1491
1647
|
"deleted"
|
|
1492
1648
|
]);
|
|
1493
|
-
var SocialPostSchema =
|
|
1494
|
-
id:
|
|
1495
|
-
object:
|
|
1649
|
+
var SocialPostSchema = z16.object({
|
|
1650
|
+
id: z16.string().min(1),
|
|
1651
|
+
object: z16.literal("social_post"),
|
|
1496
1652
|
identity_id: idOf("idn"),
|
|
1497
|
-
title:
|
|
1498
|
-
platforms:
|
|
1653
|
+
title: z16.string(),
|
|
1654
|
+
platforms: z16.array(SocialPlatformSchema),
|
|
1499
1655
|
status: SocialPostStatusSchema,
|
|
1500
1656
|
scheduled_at: Timestamp.nullable(),
|
|
1501
1657
|
posted_at: Timestamp.nullable(),
|
|
1502
|
-
error:
|
|
1658
|
+
error: z16.string().nullable()
|
|
1503
1659
|
});
|
|
1504
|
-
var SocialUploadSchema =
|
|
1505
|
-
id:
|
|
1506
|
-
object:
|
|
1660
|
+
var SocialUploadSchema = z16.object({
|
|
1661
|
+
id: z16.string().min(1),
|
|
1662
|
+
object: z16.literal("social_upload"),
|
|
1507
1663
|
identity_id: idOf("idn"),
|
|
1508
|
-
type:
|
|
1509
|
-
url:
|
|
1664
|
+
type: z16.enum(["image", "video", "document"]),
|
|
1665
|
+
url: z16.url().nullable()
|
|
1510
1666
|
});
|
|
1511
|
-
var SocialAnalyticsSchema =
|
|
1512
|
-
object:
|
|
1667
|
+
var SocialAnalyticsSchema = z16.object({
|
|
1668
|
+
object: z16.literal("social_analytics"),
|
|
1513
1669
|
identity_id: idOf("idn"),
|
|
1514
|
-
resource_id:
|
|
1670
|
+
resource_id: z16.string().min(1),
|
|
1515
1671
|
platform: SocialPlatformSchema.nullable(),
|
|
1516
|
-
data:
|
|
1672
|
+
data: z16.unknown()
|
|
1517
1673
|
});
|
|
1518
|
-
var SocialCommentSchema =
|
|
1519
|
-
id:
|
|
1520
|
-
object:
|
|
1674
|
+
var SocialCommentSchema = z16.object({
|
|
1675
|
+
id: z16.string().min(1),
|
|
1676
|
+
object: z16.literal("social_comment"),
|
|
1521
1677
|
identity_id: idOf("idn"),
|
|
1522
|
-
post_id:
|
|
1523
|
-
platforms:
|
|
1678
|
+
post_id: z16.string().min(1),
|
|
1679
|
+
platforms: z16.array(SocialPlatformSchema),
|
|
1524
1680
|
status: SocialPostStatusSchema,
|
|
1525
1681
|
posted_at: Timestamp.nullable(),
|
|
1526
|
-
data:
|
|
1682
|
+
data: z16.unknown()
|
|
1527
1683
|
});
|
|
1528
1684
|
|
|
1529
1685
|
// ../core/src/schema/blueprint.ts
|
|
1530
|
-
var BlueprintScheduleSchema =
|
|
1531
|
-
agent:
|
|
1532
|
-
cron:
|
|
1533
|
-
timezone:
|
|
1686
|
+
var BlueprintScheduleSchema = z17.object({
|
|
1687
|
+
agent: z17.string().min(1),
|
|
1688
|
+
cron: z17.string().min(1),
|
|
1689
|
+
timezone: z17.string().nullable(),
|
|
1534
1690
|
/** The message each fire opens its session with — the sentence worth printing. */
|
|
1535
|
-
input:
|
|
1691
|
+
input: z17.string().min(1),
|
|
1536
1692
|
budget_micro_usd: MicroUsdField.nonnegative()
|
|
1537
1693
|
});
|
|
1538
1694
|
var BlueprintBudgetSchema = BlueprintScheduleSchema.pick({ agent: true, cron: true, budget_micro_usd: true });
|
|
1539
|
-
var BlueprintCrewSchema =
|
|
1540
|
-
name:
|
|
1541
|
-
description:
|
|
1542
|
-
model:
|
|
1543
|
-
briefed:
|
|
1544
|
-
intake:
|
|
1695
|
+
var BlueprintCrewSchema = z17.object({
|
|
1696
|
+
name: z17.string().min(1),
|
|
1697
|
+
description: z17.string().nullable(),
|
|
1698
|
+
model: z17.string().min(1),
|
|
1699
|
+
briefed: z17.boolean(),
|
|
1700
|
+
intake: z17.string().nullable().optional(),
|
|
1545
1701
|
/** What the first session may spend: the intake's own cap, else the agent's (§31.4). Set iff `briefed`. */
|
|
1546
1702
|
intake_micro_usd: MicroUsdField.nonnegative().optional(),
|
|
1547
|
-
role:
|
|
1548
|
-
skills:
|
|
1549
|
-
tools:
|
|
1550
|
-
required:
|
|
1703
|
+
role: z17.string().min(1).optional(),
|
|
1704
|
+
skills: z17.array(SkillRefSchema).optional(),
|
|
1705
|
+
tools: z17.array(z17.string().min(1)).optional(),
|
|
1706
|
+
required: z17.boolean().optional()
|
|
1551
1707
|
});
|
|
1552
|
-
var BlueprintAppSchema =
|
|
1553
|
-
name:
|
|
1708
|
+
var BlueprintAppSchema = z17.object({
|
|
1709
|
+
name: z17.string().min(1),
|
|
1554
1710
|
type: AppTypeSchema,
|
|
1555
|
-
description:
|
|
1556
|
-
mcp:
|
|
1557
|
-
tools:
|
|
1711
|
+
description: z17.string().nullable(),
|
|
1712
|
+
mcp: z17.string().nullable().optional(),
|
|
1713
|
+
tools: z17.array(z17.string().min(1)).optional(),
|
|
1558
1714
|
/** Whether an install may deselect it (§31.2). Optional: the rollout argument above. */
|
|
1559
|
-
required:
|
|
1715
|
+
required: z17.boolean().optional()
|
|
1560
1716
|
});
|
|
1561
|
-
var BlueprintIdentityConnectionsSchema =
|
|
1562
|
-
social:
|
|
1563
|
-
from:
|
|
1564
|
-
map:
|
|
1717
|
+
var BlueprintIdentityConnectionsSchema = z17.object({
|
|
1718
|
+
social: z17.object({
|
|
1719
|
+
from: z17.string().min(1),
|
|
1720
|
+
map: z17.record(z17.string().min(1), SocialPlatformSchema)
|
|
1565
1721
|
}).optional()
|
|
1566
1722
|
});
|
|
1567
|
-
var BlueprintIdentitySchema =
|
|
1568
|
-
name:
|
|
1569
|
-
description:
|
|
1723
|
+
var BlueprintIdentitySchema = z17.object({
|
|
1724
|
+
name: z17.string().min(1),
|
|
1725
|
+
description: z17.string().nullable(),
|
|
1570
1726
|
connections: BlueprintIdentityConnectionsSchema.optional()
|
|
1571
1727
|
});
|
|
1572
|
-
var ContentHashSchema =
|
|
1573
|
-
var BlueprintTreeSchema =
|
|
1728
|
+
var ContentHashSchema = z17.string().regex(/^[0-9a-f]{64}$/, "a lowercase sha-256 hex digest");
|
|
1729
|
+
var BlueprintTreeSchema = z17.object({
|
|
1574
1730
|
/** `apps[].name` in the declaration — the same name §31.5 prints and the install ensures by. */
|
|
1575
|
-
app:
|
|
1731
|
+
app: z17.string().min(1),
|
|
1576
1732
|
content_hash: ContentHashSchema
|
|
1577
1733
|
});
|
|
1578
|
-
var BlueprintArtifactSchema =
|
|
1734
|
+
var BlueprintArtifactSchema = z17.object({
|
|
1579
1735
|
id: idOf("bpa"),
|
|
1580
|
-
object:
|
|
1736
|
+
object: z17.literal("blueprint_artifact"),
|
|
1581
1737
|
/** The machine — its repository, screens and `/api/*`. */
|
|
1582
|
-
blueprint:
|
|
1738
|
+
blueprint: z17.string().min(1),
|
|
1583
1739
|
/** Which of that blueprint's templates provides the crew. */
|
|
1584
|
-
template:
|
|
1740
|
+
template: z17.string().min(1),
|
|
1585
1741
|
/** The blueprint repository's own released version. Stored, never parsed (ADR-0401). */
|
|
1586
|
-
version:
|
|
1742
|
+
version: z17.string().min(1),
|
|
1587
1743
|
/**
|
|
1588
1744
|
* The built trees, one per deployable app, ordered as the declaration orders its apps. Never
|
|
1589
1745
|
* empty: an artifact that built nothing is not an artifact, and the column behind it says so
|
|
1590
1746
|
* (migration 0040) exactly as the single `content_hash` it replaces was `not null`.
|
|
1591
1747
|
*/
|
|
1592
|
-
trees:
|
|
1748
|
+
trees: z17.array(BlueprintTreeSchema).min(1),
|
|
1593
1749
|
/**
|
|
1594
1750
|
* The setup questions, asked by the studio **before** provisioning. `QuestionField` (§7.1) is
|
|
1595
1751
|
* reused rather than restated: a setup question and a question a parked agent asks are the same
|
|
1596
1752
|
* object at different times, so one component renders both.
|
|
1597
1753
|
*/
|
|
1598
|
-
questions:
|
|
1599
|
-
schedules:
|
|
1754
|
+
questions: z17.array(QuestionFieldSchema),
|
|
1755
|
+
schedules: z17.array(BlueprintScheduleSchema),
|
|
1600
1756
|
/** Who the crew is, and what it deploys — §31.5. Derived from `declaration`, never stored twice. */
|
|
1601
|
-
agents:
|
|
1602
|
-
apps:
|
|
1757
|
+
agents: z17.array(BlueprintCrewSchema),
|
|
1758
|
+
apps: z17.array(BlueprintAppSchema),
|
|
1603
1759
|
/**
|
|
1604
1760
|
* The agents a template creates per client the operator signs — printed, never provisioned by an
|
|
1605
1761
|
* apply (§31.1). Absent on rows published before WS12 v2, hence optional.
|
|
1606
1762
|
*/
|
|
1607
|
-
crew_per_client:
|
|
1763
|
+
crew_per_client: z17.array(BlueprintCrewSchema).optional(),
|
|
1608
1764
|
/**
|
|
1609
1765
|
* The personas the crew posts from, and which accounts to connect to each before the crew
|
|
1610
1766
|
* exists (§31.10). Derived from `declaration` like `agents`; optional for the §31.5 rollout reason.
|
|
1611
1767
|
*/
|
|
1612
|
-
identities:
|
|
1768
|
+
identities: z17.array(BlueprintIdentitySchema).optional(),
|
|
1613
1769
|
/**
|
|
1614
1770
|
* The creator template a row was published from (§42.8), `null` on every first-party row.
|
|
1615
1771
|
* `creator_name` is the public display name the landing page credits. The API sends all three
|
|
1616
1772
|
* on every row; they are optional here only so an artifact typed before §42 still reads.
|
|
1617
1773
|
*/
|
|
1618
1774
|
creator_template_id: idOf("ctp").nullish(),
|
|
1619
|
-
creator_template_version:
|
|
1620
|
-
creator_name:
|
|
1775
|
+
creator_template_version: z17.number().int().positive().nullish(),
|
|
1776
|
+
creator_name: z17.string().min(1).nullish(),
|
|
1621
1777
|
published_at: Timestamp
|
|
1622
1778
|
});
|
|
1623
1779
|
|
|
1624
1780
|
// ../core/src/schema/vault.ts
|
|
1625
|
-
import { z as
|
|
1626
|
-
var VaultCredentialKindSchema =
|
|
1627
|
-
var VaultSchema =
|
|
1781
|
+
import { z as z18 } from "zod";
|
|
1782
|
+
var VaultCredentialKindSchema = z18.enum(["env_var", "static_bearer", "mcp_oauth"]);
|
|
1783
|
+
var VaultSchema = z18.object({
|
|
1628
1784
|
id: idOf("vlt"),
|
|
1629
|
-
object:
|
|
1785
|
+
object: z18.literal("vault"),
|
|
1630
1786
|
identity_id: idOf("idn").nullable(),
|
|
1631
|
-
display_name:
|
|
1632
|
-
credential_count:
|
|
1787
|
+
display_name: z18.string().min(1).max(128),
|
|
1788
|
+
credential_count: z18.number().int().nonnegative(),
|
|
1633
1789
|
created_at: Timestamp
|
|
1634
1790
|
});
|
|
1635
|
-
var VaultCredentialSchema =
|
|
1791
|
+
var VaultCredentialSchema = z18.object({
|
|
1636
1792
|
id: idOf("vcr"),
|
|
1637
|
-
object:
|
|
1793
|
+
object: z18.literal("vault_credential"),
|
|
1638
1794
|
vault_id: idOf("vlt"),
|
|
1639
1795
|
kind: VaultCredentialKindSchema,
|
|
1640
1796
|
/** For `env_var`, the environment variable name. For the MCP kinds, a display label. */
|
|
1641
|
-
key:
|
|
1797
|
+
key: z18.string().min(1).max(128),
|
|
1642
1798
|
/** The exact destination host an `env_var` credential is bound to. Never a wildcard. */
|
|
1643
|
-
host:
|
|
1799
|
+
host: z18.string().nullable(),
|
|
1644
1800
|
/** The exact MCP server URL an `mcp_*` token is matched to. */
|
|
1645
|
-
mcp_server_url:
|
|
1646
|
-
placeholder_ref:
|
|
1801
|
+
mcp_server_url: z18.url().nullable(),
|
|
1802
|
+
placeholder_ref: z18.string(),
|
|
1647
1803
|
expires_at: Timestamp.nullable(),
|
|
1648
1804
|
last_injected_at: Timestamp.nullable(),
|
|
1649
1805
|
created_at: Timestamp
|
|
1650
1806
|
});
|
|
1651
1807
|
|
|
1652
1808
|
// ../core/src/schema/handoff.ts
|
|
1653
|
-
import { z as
|
|
1809
|
+
import { z as z19 } from "zod";
|
|
1654
1810
|
var MAX_HANDOFF_TARGETS = 6;
|
|
1655
|
-
var HandoffRequestSchema =
|
|
1656
|
-
agent:
|
|
1657
|
-
message:
|
|
1658
|
-
handoff_key:
|
|
1659
|
-
budget_micro_usd:
|
|
1660
|
-
});
|
|
1661
|
-
var HandoffSchema =
|
|
1662
|
-
object:
|
|
1811
|
+
var HandoffRequestSchema = z19.object({
|
|
1812
|
+
agent: z19.string().min(1),
|
|
1813
|
+
message: z19.string().min(1),
|
|
1814
|
+
handoff_key: z19.string().min(1).max(128).optional(),
|
|
1815
|
+
budget_micro_usd: z19.number().int().positive().optional()
|
|
1816
|
+
});
|
|
1817
|
+
var HandoffSchema = z19.object({
|
|
1818
|
+
object: z19.literal("handoff"),
|
|
1663
1819
|
session_id: idOf("ses"),
|
|
1664
|
-
status:
|
|
1665
|
-
handoff_key:
|
|
1666
|
-
});
|
|
1667
|
-
var SessionHandoffRequestSchema =
|
|
1668
|
-
agents:
|
|
1669
|
-
message:
|
|
1670
|
-
handoff_key:
|
|
1671
|
-
budget_micro_usd:
|
|
1672
|
-
});
|
|
1673
|
-
var HandoffRefusalSchema =
|
|
1674
|
-
object:
|
|
1675
|
-
agent:
|
|
1676
|
-
code:
|
|
1677
|
-
message:
|
|
1678
|
-
});
|
|
1679
|
-
var HandoffBatchSchema =
|
|
1680
|
-
object:
|
|
1681
|
-
handoffs:
|
|
1682
|
-
refusals:
|
|
1683
|
-
});
|
|
1684
|
-
var SessionHandoffSchema =
|
|
1820
|
+
status: z19.enum(["queued", "already_running"]),
|
|
1821
|
+
handoff_key: z19.string().nullable()
|
|
1822
|
+
});
|
|
1823
|
+
var SessionHandoffRequestSchema = z19.object({
|
|
1824
|
+
agents: z19.array(z19.string().min(1)).min(1).max(MAX_HANDOFF_TARGETS),
|
|
1825
|
+
message: z19.string().min(1),
|
|
1826
|
+
handoff_key: z19.string().min(1).max(128).optional(),
|
|
1827
|
+
budget_micro_usd: z19.number().int().positive().optional()
|
|
1828
|
+
});
|
|
1829
|
+
var HandoffRefusalSchema = z19.object({
|
|
1830
|
+
object: z19.literal("handoff_refusal"),
|
|
1831
|
+
agent: z19.string(),
|
|
1832
|
+
code: z19.string(),
|
|
1833
|
+
message: z19.string()
|
|
1834
|
+
});
|
|
1835
|
+
var HandoffBatchSchema = z19.object({
|
|
1836
|
+
object: z19.literal("handoff_batch"),
|
|
1837
|
+
handoffs: z19.array(HandoffSchema.extend({ agent_id: idOf("agt") })),
|
|
1838
|
+
refusals: z19.array(HandoffRefusalSchema)
|
|
1839
|
+
});
|
|
1840
|
+
var SessionHandoffSchema = z19.object({
|
|
1685
1841
|
from_session: idOf("ses"),
|
|
1686
1842
|
from_agent: idOf("agt"),
|
|
1687
|
-
key:
|
|
1688
|
-
depth:
|
|
1843
|
+
key: z19.string().nullable(),
|
|
1844
|
+
depth: z19.number().int().positive()
|
|
1689
1845
|
});
|
|
1690
|
-
var ChannelBriefSchema =
|
|
1846
|
+
var ChannelBriefSchema = z19.object({
|
|
1691
1847
|
root_session_id: idOf("ses"),
|
|
1692
|
-
name:
|
|
1693
|
-
members:
|
|
1848
|
+
name: z19.string().min(1),
|
|
1849
|
+
members: z19.array(z19.string().min(1))
|
|
1694
1850
|
});
|
|
1695
|
-
var ChannelPostRequestSchema =
|
|
1696
|
-
message:
|
|
1851
|
+
var ChannelPostRequestSchema = z19.object({
|
|
1852
|
+
message: z19.string().min(1).max(2e4)
|
|
1697
1853
|
});
|
|
1698
|
-
var ChannelPostSchema =
|
|
1699
|
-
object:
|
|
1854
|
+
var ChannelPostSchema = z19.object({
|
|
1855
|
+
object: z19.literal("channel_post"),
|
|
1700
1856
|
root_session_id: idOf("ses"),
|
|
1701
|
-
queued:
|
|
1857
|
+
queued: z19.boolean()
|
|
1702
1858
|
});
|
|
1703
1859
|
|
|
1704
1860
|
// ../core/src/schema/media.ts
|
|
1705
|
-
import { z as
|
|
1861
|
+
import { z as z20 } from "zod";
|
|
1706
1862
|
var MEDIA_JOB_KINDS = ["video", "clip", "transcription"];
|
|
1707
|
-
var MediaJobKindSchema =
|
|
1708
|
-
var MediaJobStatusSchema =
|
|
1709
|
-
var PublicUrl =
|
|
1710
|
-
var Score =
|
|
1711
|
-
var Seconds =
|
|
1712
|
-
var VideoResultSchema =
|
|
1713
|
-
files:
|
|
1714
|
-
|
|
1863
|
+
var MediaJobKindSchema = z20.enum(MEDIA_JOB_KINDS);
|
|
1864
|
+
var MediaJobStatusSchema = z20.enum(["queued", "processing", "completed", "failed"]);
|
|
1865
|
+
var PublicUrl = z20.string().url().startsWith("http");
|
|
1866
|
+
var Score = z20.number().int().min(0).max(100);
|
|
1867
|
+
var Seconds = z20.number().nonnegative();
|
|
1868
|
+
var VideoResultSchema = z20.object({
|
|
1869
|
+
files: z20.array(
|
|
1870
|
+
z20.object({
|
|
1715
1871
|
file_id: idOf("fil"),
|
|
1716
|
-
content_type:
|
|
1717
|
-
width:
|
|
1718
|
-
height:
|
|
1872
|
+
content_type: z20.string(),
|
|
1873
|
+
width: z20.number().int().positive().nullable(),
|
|
1874
|
+
height: z20.number().int().positive().nullable(),
|
|
1719
1875
|
duration_seconds: Seconds.nullable()
|
|
1720
1876
|
})
|
|
1721
1877
|
)
|
|
1722
1878
|
});
|
|
1723
|
-
var ViralityScoreSchema =
|
|
1879
|
+
var ViralityScoreSchema = z20.object({
|
|
1724
1880
|
total: Score,
|
|
1725
1881
|
shareability: Score,
|
|
1726
1882
|
hook_strength: Score,
|
|
1727
1883
|
story_quality: Score,
|
|
1728
1884
|
emotional_impact: Score
|
|
1729
1885
|
});
|
|
1730
|
-
var ClipResultSchema =
|
|
1731
|
-
clips:
|
|
1732
|
-
|
|
1886
|
+
var ClipResultSchema = z20.object({
|
|
1887
|
+
clips: z20.array(
|
|
1888
|
+
z20.object({
|
|
1733
1889
|
file_id: idOf("fil"),
|
|
1734
|
-
title:
|
|
1890
|
+
title: z20.string(),
|
|
1735
1891
|
start_seconds: Seconds,
|
|
1736
1892
|
end_seconds: Seconds,
|
|
1737
1893
|
duration_seconds: Seconds,
|
|
@@ -1739,189 +1895,189 @@ var ClipResultSchema = z19.object({
|
|
|
1739
1895
|
})
|
|
1740
1896
|
)
|
|
1741
1897
|
});
|
|
1742
|
-
var TranscriptSchema =
|
|
1743
|
-
text:
|
|
1744
|
-
language:
|
|
1898
|
+
var TranscriptSchema = z20.object({
|
|
1899
|
+
text: z20.string(),
|
|
1900
|
+
language: z20.string().nullable(),
|
|
1745
1901
|
duration_seconds: Seconds.nullable(),
|
|
1746
|
-
segments:
|
|
1902
|
+
segments: z20.array(z20.object({ start_seconds: Seconds, end_seconds: Seconds, text: z20.string() }))
|
|
1747
1903
|
});
|
|
1748
|
-
var MediaJobResultSchema =
|
|
1749
|
-
var MediaJobSchema =
|
|
1904
|
+
var MediaJobResultSchema = z20.union([VideoResultSchema, ClipResultSchema, TranscriptSchema]);
|
|
1905
|
+
var MediaJobSchema = z20.object({
|
|
1750
1906
|
id: idOf("med"),
|
|
1751
|
-
object:
|
|
1907
|
+
object: z20.literal("media_job"),
|
|
1752
1908
|
kind: MediaJobKindSchema,
|
|
1753
1909
|
status: MediaJobStatusSchema,
|
|
1754
|
-
model:
|
|
1755
|
-
input:
|
|
1910
|
+
model: z20.string().nullable(),
|
|
1911
|
+
input: z20.record(z20.string(), z20.unknown()),
|
|
1756
1912
|
result: MediaJobResultSchema.nullable(),
|
|
1757
|
-
error:
|
|
1913
|
+
error: z20.object({ code: z20.string(), message: z20.string() }).nullable(),
|
|
1758
1914
|
cost_micro_usd: MicroUsdField.nullable(),
|
|
1759
1915
|
session_id: idOf("ses").nullable(),
|
|
1760
1916
|
created_at: Timestamp,
|
|
1761
1917
|
completed_at: Timestamp.nullable()
|
|
1762
1918
|
});
|
|
1763
|
-
var ImageRequestSchema =
|
|
1764
|
-
model:
|
|
1765
|
-
prompt:
|
|
1766
|
-
image_urls:
|
|
1767
|
-
aspect_ratio:
|
|
1768
|
-
seed:
|
|
1769
|
-
n:
|
|
1770
|
-
});
|
|
1771
|
-
var VideoRequestSchema =
|
|
1772
|
-
model:
|
|
1773
|
-
prompt:
|
|
1774
|
-
image_urls:
|
|
1775
|
-
aspect_ratio:
|
|
1776
|
-
seed:
|
|
1777
|
-
seconds:
|
|
1778
|
-
});
|
|
1779
|
-
var ImageGenerationSchema =
|
|
1780
|
-
object:
|
|
1781
|
-
model:
|
|
1782
|
-
files:
|
|
1919
|
+
var ImageRequestSchema = z20.object({
|
|
1920
|
+
model: z20.string().min(1).optional(),
|
|
1921
|
+
prompt: z20.string().min(1),
|
|
1922
|
+
image_urls: z20.array(PublicUrl).max(4).optional(),
|
|
1923
|
+
aspect_ratio: z20.string().optional(),
|
|
1924
|
+
seed: z20.number().int().optional(),
|
|
1925
|
+
n: z20.number().int().min(1).max(4).default(1)
|
|
1926
|
+
});
|
|
1927
|
+
var VideoRequestSchema = z20.object({
|
|
1928
|
+
model: z20.string().min(1),
|
|
1929
|
+
prompt: z20.string().min(1),
|
|
1930
|
+
image_urls: z20.array(PublicUrl).max(1).optional(),
|
|
1931
|
+
aspect_ratio: z20.string().optional(),
|
|
1932
|
+
seed: z20.number().int().optional(),
|
|
1933
|
+
seconds: z20.number().int().min(1).max(60).optional()
|
|
1934
|
+
});
|
|
1935
|
+
var ImageGenerationSchema = z20.object({
|
|
1936
|
+
object: z20.literal("image_generation"),
|
|
1937
|
+
model: z20.string(),
|
|
1938
|
+
files: z20.array(FileSchema),
|
|
1783
1939
|
cost_micro_usd: MicroUsdField
|
|
1784
1940
|
});
|
|
1785
|
-
var ClipLength =
|
|
1786
|
-
var ClipRequestSchema =
|
|
1941
|
+
var ClipLength = z20.number().int().min(5).max(180);
|
|
1942
|
+
var ClipRequestSchema = z20.object({
|
|
1787
1943
|
video_url: PublicUrl,
|
|
1788
|
-
aspect_ratio:
|
|
1789
|
-
remove_silence:
|
|
1790
|
-
caption_preset:
|
|
1791
|
-
language:
|
|
1944
|
+
aspect_ratio: z20.enum(["9:16", "16:9"]).default("9:16"),
|
|
1945
|
+
remove_silence: z20.boolean().default(false),
|
|
1946
|
+
caption_preset: z20.enum(["none", "clean", "bold", "karaoke"]).default("none"),
|
|
1947
|
+
language: z20.string().min(2).optional(),
|
|
1792
1948
|
min_seconds: ClipLength.default(15),
|
|
1793
1949
|
max_seconds: ClipLength.default(60),
|
|
1794
|
-
title:
|
|
1950
|
+
title: z20.string().min(1).optional()
|
|
1795
1951
|
});
|
|
1796
|
-
var AudioFormatSchema =
|
|
1797
|
-
var TranscriptionRequestSchema =
|
|
1798
|
-
model:
|
|
1952
|
+
var AudioFormatSchema = z20.enum(["mp3", "wav", "ogg"]);
|
|
1953
|
+
var TranscriptionRequestSchema = z20.object({
|
|
1954
|
+
model: z20.string().min(1).optional(),
|
|
1799
1955
|
file_id: idOf("fil").optional(),
|
|
1800
1956
|
url: PublicUrl.optional(),
|
|
1801
|
-
language:
|
|
1802
|
-
timestamps:
|
|
1957
|
+
language: z20.string().min(2).optional(),
|
|
1958
|
+
timestamps: z20.boolean().default(true)
|
|
1803
1959
|
}).refine((request) => request.file_id === void 0 !== (request.url === void 0), {
|
|
1804
1960
|
error: "exactly one of file_id or url",
|
|
1805
1961
|
path: ["file_id"]
|
|
1806
1962
|
});
|
|
1807
|
-
var SpeechRequestSchema =
|
|
1808
|
-
model:
|
|
1809
|
-
text:
|
|
1810
|
-
voice:
|
|
1963
|
+
var SpeechRequestSchema = z20.object({
|
|
1964
|
+
model: z20.string().min(1).optional(),
|
|
1965
|
+
text: z20.string().min(1).max(4096),
|
|
1966
|
+
voice: z20.string().min(1).optional(),
|
|
1811
1967
|
format: AudioFormatSchema.default("mp3"),
|
|
1812
|
-
speed:
|
|
1968
|
+
speed: z20.number().min(0.5).max(2).optional()
|
|
1813
1969
|
});
|
|
1814
|
-
var SpeechToSpeechRequestSchema =
|
|
1815
|
-
model:
|
|
1970
|
+
var SpeechToSpeechRequestSchema = z20.object({
|
|
1971
|
+
model: z20.string().min(1).optional(),
|
|
1816
1972
|
file_id: idOf("fil"),
|
|
1817
|
-
voice:
|
|
1973
|
+
voice: z20.string().min(1).optional(),
|
|
1818
1974
|
format: AudioFormatSchema.default("mp3")
|
|
1819
1975
|
});
|
|
1820
|
-
var SpeechGenerationSchema =
|
|
1821
|
-
object:
|
|
1822
|
-
model:
|
|
1976
|
+
var SpeechGenerationSchema = z20.object({
|
|
1977
|
+
object: z20.literal("speech_generation"),
|
|
1978
|
+
model: z20.string(),
|
|
1823
1979
|
file: FileSchema,
|
|
1824
1980
|
duration_seconds: Seconds.nullable(),
|
|
1825
1981
|
cost_micro_usd: MicroUsdField
|
|
1826
1982
|
});
|
|
1827
1983
|
|
|
1828
1984
|
// ../core/src/schema/app-data.ts
|
|
1829
|
-
import { z as
|
|
1830
|
-
var DbTableSchema =
|
|
1831
|
-
object:
|
|
1832
|
-
name:
|
|
1833
|
-
schema:
|
|
1834
|
-
rows:
|
|
1835
|
-
size_bytes:
|
|
1836
|
-
});
|
|
1837
|
-
var DbMigrationSchema =
|
|
1985
|
+
import { z as z21 } from "zod";
|
|
1986
|
+
var DbTableSchema = z21.object({
|
|
1987
|
+
object: z21.literal("db_table"),
|
|
1988
|
+
name: z21.string(),
|
|
1989
|
+
schema: z21.string().default("public"),
|
|
1990
|
+
rows: z21.number().int().nonnegative().nullable(),
|
|
1991
|
+
size_bytes: z21.number().int().nonnegative().nullable()
|
|
1992
|
+
});
|
|
1993
|
+
var DbMigrationSchema = z21.object({
|
|
1838
1994
|
id: idOf("dbm"),
|
|
1839
|
-
object:
|
|
1840
|
-
name:
|
|
1841
|
-
sha256:
|
|
1995
|
+
object: z21.literal("db_migration"),
|
|
1996
|
+
name: z21.string(),
|
|
1997
|
+
sha256: z21.string().regex(/^[0-9a-f]{64}$/),
|
|
1842
1998
|
applied_at: Timestamp,
|
|
1843
|
-
statements:
|
|
1999
|
+
statements: z21.number().int().nonnegative()
|
|
1844
2000
|
});
|
|
1845
|
-
var ApplyDbMigrationSchema =
|
|
1846
|
-
name:
|
|
1847
|
-
sql:
|
|
2001
|
+
var ApplyDbMigrationSchema = z21.object({
|
|
2002
|
+
name: z21.string().min(1).max(128).regex(/^[a-z0-9][a-z0-9_-]*$/),
|
|
2003
|
+
sql: z21.string().min(1)
|
|
1848
2004
|
});
|
|
1849
2005
|
var DB_REST_METHODS = ["GET", "POST", "PATCH", "PUT", "DELETE", "HEAD"];
|
|
1850
|
-
var DbRestMethodSchema =
|
|
2006
|
+
var DbRestMethodSchema = z21.enum(DB_REST_METHODS);
|
|
1851
2007
|
var BUCKET_NAME = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
1852
|
-
var BucketSchema =
|
|
1853
|
-
object:
|
|
1854
|
-
name:
|
|
1855
|
-
public:
|
|
2008
|
+
var BucketSchema = z21.object({
|
|
2009
|
+
object: z21.literal("bucket"),
|
|
2010
|
+
name: z21.string().regex(BUCKET_NAME),
|
|
2011
|
+
public: z21.boolean(),
|
|
1856
2012
|
created_at: Timestamp
|
|
1857
2013
|
});
|
|
1858
|
-
var CreateBucketSchema =
|
|
1859
|
-
name:
|
|
1860
|
-
public:
|
|
1861
|
-
});
|
|
1862
|
-
var StorageObjectSchema =
|
|
1863
|
-
object:
|
|
1864
|
-
bucket:
|
|
1865
|
-
key:
|
|
1866
|
-
size_bytes:
|
|
1867
|
-
content_type:
|
|
1868
|
-
etag:
|
|
2014
|
+
var CreateBucketSchema = z21.object({
|
|
2015
|
+
name: z21.string().regex(BUCKET_NAME, { error: "3\u201363 lowercase letters, digits and hyphens" }),
|
|
2016
|
+
public: z21.boolean().default(false)
|
|
2017
|
+
});
|
|
2018
|
+
var StorageObjectSchema = z21.object({
|
|
2019
|
+
object: z21.literal("storage_object"),
|
|
2020
|
+
bucket: z21.string(),
|
|
2021
|
+
key: z21.string().min(1),
|
|
2022
|
+
size_bytes: z21.number().int().nonnegative(),
|
|
2023
|
+
content_type: z21.string(),
|
|
2024
|
+
etag: z21.string().nullable(),
|
|
1869
2025
|
updated_at: Timestamp
|
|
1870
2026
|
});
|
|
1871
|
-
var SignedUrlMethodSchema =
|
|
1872
|
-
var SignedUrlSchema =
|
|
1873
|
-
object:
|
|
1874
|
-
url:
|
|
2027
|
+
var SignedUrlMethodSchema = z21.enum(["PUT", "GET"]);
|
|
2028
|
+
var SignedUrlSchema = z21.object({
|
|
2029
|
+
object: z21.literal("signed_url"),
|
|
2030
|
+
url: z21.string().url(),
|
|
1875
2031
|
method: SignedUrlMethodSchema,
|
|
1876
2032
|
expires_at: Timestamp
|
|
1877
2033
|
});
|
|
1878
|
-
var CreateUploadUrlSchema =
|
|
1879
|
-
content_type:
|
|
1880
|
-
expires_seconds:
|
|
2034
|
+
var CreateUploadUrlSchema = z21.object({
|
|
2035
|
+
content_type: z21.string().min(1),
|
|
2036
|
+
expires_seconds: z21.number().int().min(60).max(3600).default(900)
|
|
1881
2037
|
});
|
|
1882
2038
|
|
|
1883
2039
|
// ../core/src/schema/stock-photo.ts
|
|
1884
|
-
import { z as
|
|
2040
|
+
import { z as z22 } from "zod";
|
|
1885
2041
|
var STOCK_PHOTO_ORIENTATIONS = ["landscape", "portrait", "square"];
|
|
1886
2042
|
var STOCK_PHOTO_SIZES = ["small", "medium", "large"];
|
|
1887
|
-
var StockPhotoQuerySchema =
|
|
1888
|
-
query:
|
|
1889
|
-
count:
|
|
1890
|
-
orientation:
|
|
1891
|
-
color:
|
|
1892
|
-
size:
|
|
1893
|
-
});
|
|
1894
|
-
var StockPhotoSchema =
|
|
1895
|
-
object:
|
|
1896
|
-
id:
|
|
1897
|
-
width:
|
|
1898
|
-
height:
|
|
1899
|
-
url:
|
|
1900
|
-
preview_url:
|
|
1901
|
-
alt:
|
|
1902
|
-
photographer:
|
|
1903
|
-
attribution_url:
|
|
1904
|
-
dominant_color:
|
|
2043
|
+
var StockPhotoQuerySchema = z22.object({
|
|
2044
|
+
query: z22.string().min(1).max(200),
|
|
2045
|
+
count: z22.coerce.number().int().min(1).max(30).default(10),
|
|
2046
|
+
orientation: z22.enum(STOCK_PHOTO_ORIENTATIONS).optional(),
|
|
2047
|
+
color: z22.string().min(1).max(32).optional(),
|
|
2048
|
+
size: z22.enum(STOCK_PHOTO_SIZES).optional()
|
|
2049
|
+
});
|
|
2050
|
+
var StockPhotoSchema = z22.object({
|
|
2051
|
+
object: z22.literal("stock_photo"),
|
|
2052
|
+
id: z22.string().min(1),
|
|
2053
|
+
width: z22.number().int().positive(),
|
|
2054
|
+
height: z22.number().int().positive(),
|
|
2055
|
+
url: z22.string().url(),
|
|
2056
|
+
preview_url: z22.string().url(),
|
|
2057
|
+
alt: z22.string().nullable(),
|
|
2058
|
+
photographer: z22.string().nullable(),
|
|
2059
|
+
attribution_url: z22.string().url().nullable(),
|
|
2060
|
+
dominant_color: z22.string().nullable()
|
|
1905
2061
|
});
|
|
1906
2062
|
|
|
1907
2063
|
// ../core/src/schema/creator.ts
|
|
1908
|
-
import { z as
|
|
1909
|
-
var CreatorCodeSchema =
|
|
1910
|
-
var PayoutMethodSchema =
|
|
1911
|
-
var PayoutDetailsSchema =
|
|
2064
|
+
import { z as z23 } from "zod";
|
|
2065
|
+
var CreatorCodeSchema = z23.string().regex(/^[a-z0-9]{3,24}$/, "3 to 24 lowercase letters or digits");
|
|
2066
|
+
var PayoutMethodSchema = z23.enum(["wise", "paypal"]);
|
|
2067
|
+
var PayoutDetailsSchema = z23.object({
|
|
1912
2068
|
method: PayoutMethodSchema,
|
|
1913
|
-
account:
|
|
2069
|
+
account: z23.string().min(1).max(320)
|
|
1914
2070
|
});
|
|
1915
|
-
var CreatorStatusSchema =
|
|
1916
|
-
var CreatorSchema =
|
|
2071
|
+
var CreatorStatusSchema = z23.enum(["active", "suspended"]);
|
|
2072
|
+
var CreatorSchema = z23.object({
|
|
1917
2073
|
id: idOf("crt"),
|
|
1918
|
-
object:
|
|
1919
|
-
email:
|
|
1920
|
-
display_name:
|
|
2074
|
+
object: z23.literal("creator"),
|
|
2075
|
+
email: z23.email(),
|
|
2076
|
+
display_name: z23.string().min(1).max(80),
|
|
1921
2077
|
code: CreatorCodeSchema,
|
|
1922
2078
|
status: CreatorStatusSchema,
|
|
1923
2079
|
payout: PayoutDetailsSchema.nullable(),
|
|
1924
|
-
clicks:
|
|
2080
|
+
clicks: z23.number().int().nonnegative(),
|
|
1925
2081
|
created_at: Timestamp,
|
|
1926
2082
|
updated_at: Timestamp
|
|
1927
2083
|
});
|
|
@@ -1929,28 +2085,28 @@ var IdentityCreatorSchema = CreatorSchema.pick({
|
|
|
1929
2085
|
id: true,
|
|
1930
2086
|
status: true
|
|
1931
2087
|
});
|
|
1932
|
-
var CreatorApplicationStatusSchema =
|
|
2088
|
+
var CreatorApplicationStatusSchema = z23.enum([
|
|
1933
2089
|
"pending",
|
|
1934
2090
|
"approved",
|
|
1935
2091
|
"rejected"
|
|
1936
2092
|
]);
|
|
1937
|
-
var CreatorApplicationSchema =
|
|
2093
|
+
var CreatorApplicationSchema = z23.object({
|
|
1938
2094
|
id: idOf("cra"),
|
|
1939
|
-
object:
|
|
1940
|
-
email:
|
|
1941
|
-
display_name:
|
|
1942
|
-
pitch:
|
|
1943
|
-
links:
|
|
2095
|
+
object: z23.literal("creator_application"),
|
|
2096
|
+
email: z23.email(),
|
|
2097
|
+
display_name: z23.string().min(1).max(80),
|
|
2098
|
+
pitch: z23.string().min(1).max(2e3),
|
|
2099
|
+
links: z23.array(z23.url({ protocol: /^https$/ })).max(5),
|
|
1944
2100
|
status: CreatorApplicationStatusSchema,
|
|
1945
|
-
note:
|
|
2101
|
+
note: z23.string().nullable(),
|
|
1946
2102
|
creator_id: idOf("crt").nullable(),
|
|
1947
2103
|
created_at: Timestamp,
|
|
1948
2104
|
decided_at: Timestamp.nullable()
|
|
1949
2105
|
});
|
|
1950
|
-
var ReferralStatusSchema =
|
|
1951
|
-
var ReferralSchema =
|
|
2106
|
+
var ReferralStatusSchema = z23.enum(["pending", "active", "expired"]);
|
|
2107
|
+
var ReferralSchema = z23.object({
|
|
1952
2108
|
id: idOf("crf"),
|
|
1953
|
-
object:
|
|
2109
|
+
object: z23.literal("referral"),
|
|
1954
2110
|
creator_id: idOf("crt"),
|
|
1955
2111
|
organization_id: idOf("org"),
|
|
1956
2112
|
status: ReferralStatusSchema,
|
|
@@ -1958,16 +2114,16 @@ var ReferralSchema = z22.object({
|
|
|
1958
2114
|
first_paid_at: Timestamp.nullable(),
|
|
1959
2115
|
commission_until: Timestamp.nullable()
|
|
1960
2116
|
});
|
|
1961
|
-
var CommissionKindSchema =
|
|
1962
|
-
var CommissionStatusSchema =
|
|
2117
|
+
var CommissionKindSchema = z23.enum(["referral", "template"]);
|
|
2118
|
+
var CommissionStatusSchema = z23.enum([
|
|
1963
2119
|
"pending",
|
|
1964
2120
|
"available",
|
|
1965
2121
|
"claimed",
|
|
1966
2122
|
"paid"
|
|
1967
2123
|
]);
|
|
1968
|
-
var CommissionSchema =
|
|
2124
|
+
var CommissionSchema = z23.object({
|
|
1969
2125
|
id: idOf("crc"),
|
|
1970
|
-
object:
|
|
2126
|
+
object: z23.literal("commission"),
|
|
1971
2127
|
creator_id: idOf("crt"),
|
|
1972
2128
|
kind: CommissionKindSchema,
|
|
1973
2129
|
referral_id: idOf("crf").nullable(),
|
|
@@ -1980,18 +2136,18 @@ var CommissionSchema = z22.object({
|
|
|
1980
2136
|
available_at: Timestamp,
|
|
1981
2137
|
payout_id: idOf("crp").nullable()
|
|
1982
2138
|
});
|
|
1983
|
-
var PayoutStatusSchema =
|
|
1984
|
-
var PayoutSchema =
|
|
2139
|
+
var PayoutStatusSchema = z23.enum(["requested", "paid", "rejected"]);
|
|
2140
|
+
var PayoutSchema = z23.object({
|
|
1985
2141
|
id: idOf("crp"),
|
|
1986
|
-
object:
|
|
2142
|
+
object: z23.literal("payout"),
|
|
1987
2143
|
creator_id: idOf("crt"),
|
|
1988
2144
|
amount_micro_usd: MicroUsdField.positive(),
|
|
1989
|
-
currency:
|
|
2145
|
+
currency: z23.literal("USD"),
|
|
1990
2146
|
method: PayoutMethodSchema,
|
|
1991
|
-
account:
|
|
2147
|
+
account: z23.string().min(1),
|
|
1992
2148
|
status: PayoutStatusSchema,
|
|
1993
|
-
reference:
|
|
1994
|
-
note:
|
|
2149
|
+
reference: z23.string().nullable(),
|
|
2150
|
+
note: z23.string().nullable(),
|
|
1995
2151
|
requested_at: Timestamp,
|
|
1996
2152
|
decided_at: Timestamp.nullable()
|
|
1997
2153
|
});
|
|
@@ -2003,100 +2159,100 @@ var CREATOR_PROGRAM = {
|
|
|
2003
2159
|
attribution_days: 30,
|
|
2004
2160
|
minimum_payout_micro_usd: 2e7
|
|
2005
2161
|
};
|
|
2006
|
-
var CreatorTemplateSlugSchema =
|
|
2162
|
+
var CreatorTemplateSlugSchema = z23.string().max(32).regex(
|
|
2007
2163
|
/^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
2008
2164
|
"lowercase letters, digits and single dashes"
|
|
2009
2165
|
);
|
|
2010
|
-
var CreatorSkillSchema =
|
|
2011
|
-
slug:
|
|
2012
|
-
body:
|
|
2166
|
+
var CreatorSkillSchema = z23.object({
|
|
2167
|
+
slug: z23.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
|
|
2168
|
+
body: z23.string().min(1).max(64 * 1024)
|
|
2013
2169
|
});
|
|
2014
|
-
var CreatorDeclarationSchema =
|
|
2015
|
-
agents:
|
|
2016
|
-
questions:
|
|
2017
|
-
skills:
|
|
2170
|
+
var CreatorDeclarationSchema = z23.object({
|
|
2171
|
+
agents: z23.array(z23.unknown()),
|
|
2172
|
+
questions: z23.array(z23.unknown()),
|
|
2173
|
+
skills: z23.array(CreatorSkillSchema).max(16)
|
|
2018
2174
|
});
|
|
2019
|
-
var CreatorTemplateVersionStatusSchema =
|
|
2175
|
+
var CreatorTemplateVersionStatusSchema = z23.enum([
|
|
2020
2176
|
"in_review",
|
|
2021
2177
|
"approved",
|
|
2022
2178
|
"changes_requested"
|
|
2023
2179
|
]);
|
|
2024
|
-
var VersionNumber =
|
|
2025
|
-
var CreatorTemplateSchema =
|
|
2180
|
+
var VersionNumber = z23.number().int().positive();
|
|
2181
|
+
var CreatorTemplateSchema = z23.object({
|
|
2026
2182
|
id: idOf("ctp"),
|
|
2027
|
-
object:
|
|
2183
|
+
object: z23.literal("creator_template"),
|
|
2028
2184
|
creator_id: idOf("crt"),
|
|
2029
|
-
blueprint:
|
|
2030
|
-
base_template:
|
|
2185
|
+
blueprint: z23.string().min(1),
|
|
2186
|
+
base_template: z23.string().min(1),
|
|
2031
2187
|
slug: CreatorTemplateSlugSchema,
|
|
2032
|
-
template:
|
|
2033
|
-
name:
|
|
2034
|
-
description:
|
|
2188
|
+
template: z23.string().min(1).max(64),
|
|
2189
|
+
name: z23.string().min(1).max(80),
|
|
2190
|
+
description: z23.string().max(2e3),
|
|
2035
2191
|
declaration: CreatorDeclarationSchema,
|
|
2036
2192
|
published_version: VersionNumber.nullable(),
|
|
2037
|
-
latest_version:
|
|
2193
|
+
latest_version: z23.object({
|
|
2038
2194
|
version: VersionNumber,
|
|
2039
2195
|
status: CreatorTemplateVersionStatusSchema
|
|
2040
2196
|
}).nullable(),
|
|
2041
2197
|
created_at: Timestamp,
|
|
2042
2198
|
updated_at: Timestamp
|
|
2043
2199
|
});
|
|
2044
|
-
var CreatorTemplateVersionSchema =
|
|
2045
|
-
object:
|
|
2200
|
+
var CreatorTemplateVersionSchema = z23.object({
|
|
2201
|
+
object: z23.literal("creator_template_version"),
|
|
2046
2202
|
template_id: idOf("ctp"),
|
|
2047
2203
|
version: VersionNumber,
|
|
2048
2204
|
declaration: CreatorDeclarationSchema,
|
|
2049
2205
|
status: CreatorTemplateVersionStatusSchema,
|
|
2050
|
-
note:
|
|
2206
|
+
note: z23.string().nullable(),
|
|
2051
2207
|
artifact_id: idOf("bpa").nullable(),
|
|
2052
2208
|
submitted_at: Timestamp,
|
|
2053
2209
|
decided_at: Timestamp.nullable()
|
|
2054
2210
|
});
|
|
2055
|
-
var CreatorBalanceSchema =
|
|
2056
|
-
object:
|
|
2211
|
+
var CreatorBalanceSchema = z23.object({
|
|
2212
|
+
object: z23.literal("creator_balance"),
|
|
2057
2213
|
pending_micro_usd: MicroUsdField.nonnegative(),
|
|
2058
2214
|
available_micro_usd: MicroUsdField.nonnegative(),
|
|
2059
2215
|
claimed_micro_usd: MicroUsdField.nonnegative(),
|
|
2060
2216
|
paid_micro_usd: MicroUsdField.nonnegative(),
|
|
2061
|
-
minimum_payout_micro_usd:
|
|
2217
|
+
minimum_payout_micro_usd: z23.literal(CREATOR_PROGRAM.minimum_payout_micro_usd)
|
|
2062
2218
|
});
|
|
2063
|
-
var ReferralClickSchema =
|
|
2064
|
-
object:
|
|
2219
|
+
var ReferralClickSchema = z23.object({
|
|
2220
|
+
object: z23.literal("referral_click"),
|
|
2065
2221
|
code: CreatorCodeSchema,
|
|
2066
|
-
creator:
|
|
2222
|
+
creator: z23.object({ display_name: z23.string().min(1) }),
|
|
2067
2223
|
expires_at: Timestamp
|
|
2068
2224
|
});
|
|
2069
|
-
var Day =
|
|
2070
|
-
var CreatorAnalyticsSchema =
|
|
2071
|
-
object:
|
|
2072
|
-
days:
|
|
2225
|
+
var Day = z23.iso.date();
|
|
2226
|
+
var CreatorAnalyticsSchema = z23.object({
|
|
2227
|
+
object: z23.literal("creator_analytics"),
|
|
2228
|
+
days: z23.number().int().min(1).max(90),
|
|
2073
2229
|
from: Day,
|
|
2074
2230
|
to: Day,
|
|
2075
|
-
clicks:
|
|
2076
|
-
referrals:
|
|
2077
|
-
installs:
|
|
2078
|
-
active_installs:
|
|
2079
|
-
usage_by_day:
|
|
2080
|
-
|
|
2231
|
+
clicks: z23.number().int().nonnegative(),
|
|
2232
|
+
referrals: z23.number().int().nonnegative(),
|
|
2233
|
+
installs: z23.number().int().nonnegative(),
|
|
2234
|
+
active_installs: z23.number().int().nonnegative(),
|
|
2235
|
+
usage_by_day: z23.array(
|
|
2236
|
+
z23.object({ day: Day, debit_micro_usd: MicroUsdField.nonnegative() })
|
|
2081
2237
|
),
|
|
2082
|
-
commission_micro_usd:
|
|
2238
|
+
commission_micro_usd: z23.object({
|
|
2083
2239
|
pending: MicroUsdField.nonnegative(),
|
|
2084
2240
|
available: MicroUsdField.nonnegative(),
|
|
2085
2241
|
claimed: MicroUsdField.nonnegative(),
|
|
2086
2242
|
paid: MicroUsdField.nonnegative()
|
|
2087
2243
|
}),
|
|
2088
|
-
commissions_by_template:
|
|
2089
|
-
|
|
2244
|
+
commissions_by_template: z23.array(
|
|
2245
|
+
z23.object({
|
|
2090
2246
|
creator_template_id: idOf("ctp"),
|
|
2091
2247
|
amount_micro_usd: MicroUsdField.nonnegative()
|
|
2092
2248
|
})
|
|
2093
2249
|
),
|
|
2094
2250
|
/** Every install covered, newest first: the day it was created and the day its twelve months end. */
|
|
2095
|
-
install_windows:
|
|
2251
|
+
install_windows: z23.array(z23.object({ install_id: idOf("bpi"), from: Day, until: Day }))
|
|
2096
2252
|
});
|
|
2097
2253
|
|
|
2098
2254
|
// ../core/src/schema/legal.ts
|
|
2099
|
-
import { z as
|
|
2255
|
+
import { z as z24 } from "zod";
|
|
2100
2256
|
var LEGAL_MEMBER_STATUSES = [
|
|
2101
2257
|
"pending",
|
|
2102
2258
|
"link_ready",
|
|
@@ -2106,16 +2262,16 @@ var LEGAL_MEMBER_STATUSES = [
|
|
|
2106
2262
|
"verified",
|
|
2107
2263
|
"failed"
|
|
2108
2264
|
];
|
|
2109
|
-
var LegalMemberStatusSchema =
|
|
2265
|
+
var LegalMemberStatusSchema = z24.enum(LEGAL_MEMBER_STATUSES);
|
|
2110
2266
|
var LEGAL_VERIFICATION_STATUSES = ["in_progress", "pending_review", "verified", "failed"];
|
|
2111
|
-
var LegalVerificationStatusSchema =
|
|
2267
|
+
var LegalVerificationStatusSchema = z24.enum(LEGAL_VERIFICATION_STATUSES);
|
|
2112
2268
|
var LEGAL_COMPANY_STATUSES = ["awaiting_payment", "paid", "submitted", "formed", "failed"];
|
|
2113
|
-
var LegalCompanyStatusSchema =
|
|
2269
|
+
var LegalCompanyStatusSchema = z24.enum(LEGAL_COMPANY_STATUSES);
|
|
2114
2270
|
var LEGAL_DOCUMENT_KINDS = ["articles", "ein_letter", "operating_agreement", "other"];
|
|
2115
|
-
var LegalDocumentKindSchema =
|
|
2116
|
-
var LegalMemberRoleSchema =
|
|
2117
|
-
var LegalEinStatusSchema =
|
|
2118
|
-
var LegalRequiredActionKindSchema =
|
|
2271
|
+
var LegalDocumentKindSchema = z24.enum(LEGAL_DOCUMENT_KINDS);
|
|
2272
|
+
var LegalMemberRoleSchema = z24.enum(["primary", "secondary"]);
|
|
2273
|
+
var LegalEinStatusSchema = z24.enum(["none", "pending", "issued"]);
|
|
2274
|
+
var LegalRequiredActionKindSchema = z24.enum(["signature", "information", "payment", "other"]);
|
|
2119
2275
|
var US_STATES = [
|
|
2120
2276
|
"AL",
|
|
2121
2277
|
"AK",
|
|
@@ -2169,105 +2325,105 @@ var US_STATES = [
|
|
|
2169
2325
|
"WI",
|
|
2170
2326
|
"WY"
|
|
2171
2327
|
];
|
|
2172
|
-
var UsStateSchema =
|
|
2173
|
-
var LegalMemberInputSchema =
|
|
2174
|
-
first_name:
|
|
2175
|
-
last_name:
|
|
2176
|
-
email:
|
|
2328
|
+
var UsStateSchema = z24.enum(US_STATES);
|
|
2329
|
+
var LegalMemberInputSchema = z24.object({
|
|
2330
|
+
first_name: z24.string().min(1).max(128),
|
|
2331
|
+
last_name: z24.string().min(1).max(128),
|
|
2332
|
+
email: z24.string().min(1).max(320),
|
|
2177
2333
|
role: LegalMemberRoleSchema,
|
|
2178
|
-
is_responsible_party:
|
|
2179
|
-
ownership_percent:
|
|
2334
|
+
is_responsible_party: z24.boolean(),
|
|
2335
|
+
ownership_percent: z24.number().int()
|
|
2180
2336
|
});
|
|
2181
2337
|
var LegalMemberSchema = LegalMemberInputSchema.extend({
|
|
2182
2338
|
id: idOf("lgm"),
|
|
2183
|
-
object:
|
|
2339
|
+
object: z24.literal("legal_member"),
|
|
2184
2340
|
verification_id: idOf("lgv"),
|
|
2185
2341
|
status: LegalMemberStatusSchema,
|
|
2186
|
-
link_url:
|
|
2342
|
+
link_url: z24.url().nullable(),
|
|
2187
2343
|
link_expires_at: Timestamp.nullable(),
|
|
2188
2344
|
completed_at: Timestamp.nullable()
|
|
2189
2345
|
});
|
|
2190
|
-
var LegalVerificationSchema =
|
|
2346
|
+
var LegalVerificationSchema = z24.object({
|
|
2191
2347
|
id: idOf("lgv"),
|
|
2192
|
-
object:
|
|
2348
|
+
object: z24.literal("legal_verification"),
|
|
2193
2349
|
identity_id: idOf("idn"),
|
|
2194
2350
|
status: LegalVerificationStatusSchema,
|
|
2195
|
-
members:
|
|
2196
|
-
ready_for_formation:
|
|
2351
|
+
members: z24.array(LegalMemberSchema),
|
|
2352
|
+
ready_for_formation: z24.boolean(),
|
|
2197
2353
|
started_at: Timestamp,
|
|
2198
2354
|
completed_at: Timestamp.nullable(),
|
|
2199
2355
|
created_at: Timestamp,
|
|
2200
2356
|
updated_at: Timestamp
|
|
2201
2357
|
});
|
|
2202
|
-
var StartLegalVerificationSchema =
|
|
2203
|
-
var CompleteLegalMemberSchema =
|
|
2204
|
-
var LegalNameOptionSchema =
|
|
2205
|
-
var LegalMailingAddressSchema =
|
|
2206
|
-
line1:
|
|
2207
|
-
line2:
|
|
2208
|
-
city:
|
|
2358
|
+
var StartLegalVerificationSchema = z24.object({ members: z24.array(LegalMemberInputSchema) });
|
|
2359
|
+
var CompleteLegalMemberSchema = z24.object({ token: z24.string().min(1) });
|
|
2360
|
+
var LegalNameOptionSchema = z24.object({ name: z24.string().min(1).max(200), ending: z24.literal("LLC") });
|
|
2361
|
+
var LegalMailingAddressSchema = z24.object({
|
|
2362
|
+
line1: z24.string().min(1).max(200),
|
|
2363
|
+
line2: z24.string().max(200).nullable(),
|
|
2364
|
+
city: z24.string().min(1).max(100),
|
|
2209
2365
|
state: UsStateSchema,
|
|
2210
|
-
postal_code:
|
|
2211
|
-
country:
|
|
2366
|
+
postal_code: z24.string().min(1).max(16),
|
|
2367
|
+
country: z24.literal("US")
|
|
2212
2368
|
});
|
|
2213
|
-
var LegalRequiredActionSchema =
|
|
2369
|
+
var LegalRequiredActionSchema = z24.object({
|
|
2214
2370
|
kind: LegalRequiredActionKindSchema,
|
|
2215
|
-
description:
|
|
2216
|
-
url:
|
|
2371
|
+
description: z24.string(),
|
|
2372
|
+
url: z24.url().nullable()
|
|
2217
2373
|
});
|
|
2218
2374
|
var LEGAL_DESCRIPTION_MAX = 50;
|
|
2219
|
-
var CreateLegalCompanySchema =
|
|
2375
|
+
var CreateLegalCompanySchema = z24.object({
|
|
2220
2376
|
verification_id: idOf("lgv"),
|
|
2221
2377
|
state: UsStateSchema,
|
|
2222
|
-
name_options:
|
|
2223
|
-
naics_code:
|
|
2224
|
-
description:
|
|
2378
|
+
name_options: z24.array(z24.string().min(1).max(200)).min(1).max(3),
|
|
2379
|
+
naics_code: z24.string().regex(/^\d{2,6}$/),
|
|
2380
|
+
description: z24.string().min(1).max(LEGAL_DESCRIPTION_MAX),
|
|
2225
2381
|
mailing_address: LegalMailingAddressSchema
|
|
2226
2382
|
});
|
|
2227
2383
|
var LegalCompanySchema = CreateLegalCompanySchema.omit({ name_options: true }).extend({
|
|
2228
2384
|
id: idOf("lgc"),
|
|
2229
|
-
object:
|
|
2385
|
+
object: z24.literal("legal_company"),
|
|
2230
2386
|
identity_id: idOf("idn"),
|
|
2231
2387
|
status: LegalCompanyStatusSchema,
|
|
2232
|
-
entity_type:
|
|
2233
|
-
name_options:
|
|
2234
|
-
legal_name:
|
|
2388
|
+
entity_type: z24.literal("llc"),
|
|
2389
|
+
name_options: z24.array(LegalNameOptionSchema),
|
|
2390
|
+
legal_name: z24.string().nullable(),
|
|
2235
2391
|
ein_status: LegalEinStatusSchema,
|
|
2236
2392
|
price_micro_usd: MicroUsdField,
|
|
2237
|
-
required_actions:
|
|
2238
|
-
failure_reason:
|
|
2393
|
+
required_actions: z24.array(LegalRequiredActionSchema),
|
|
2394
|
+
failure_reason: z24.string().max(256).nullable(),
|
|
2239
2395
|
submitted_at: Timestamp.nullable(),
|
|
2240
2396
|
formed_at: Timestamp.nullable(),
|
|
2241
2397
|
created_at: Timestamp,
|
|
2242
2398
|
updated_at: Timestamp
|
|
2243
2399
|
});
|
|
2244
|
-
var LegalDocumentSchema =
|
|
2400
|
+
var LegalDocumentSchema = z24.object({
|
|
2245
2401
|
id: idOf("lgd"),
|
|
2246
|
-
object:
|
|
2402
|
+
object: z24.literal("legal_document"),
|
|
2247
2403
|
company_id: idOf("lgc"),
|
|
2248
2404
|
kind: LegalDocumentKindSchema,
|
|
2249
|
-
name:
|
|
2405
|
+
name: z24.string(),
|
|
2250
2406
|
created_at: Timestamp
|
|
2251
2407
|
});
|
|
2252
|
-
var LegalDocumentLinkSchema =
|
|
2253
|
-
object:
|
|
2254
|
-
url:
|
|
2408
|
+
var LegalDocumentLinkSchema = z24.object({
|
|
2409
|
+
object: z24.literal("legal_document_link"),
|
|
2410
|
+
url: z24.url(),
|
|
2255
2411
|
expires_at: Timestamp
|
|
2256
2412
|
});
|
|
2257
|
-
var NaicsCodeSchema =
|
|
2258
|
-
object:
|
|
2259
|
-
code:
|
|
2260
|
-
title:
|
|
2413
|
+
var NaicsCodeSchema = z24.object({
|
|
2414
|
+
object: z24.literal("naics_code"),
|
|
2415
|
+
code: z24.string().regex(/^\d{2,6}$/),
|
|
2416
|
+
title: z24.string()
|
|
2261
2417
|
});
|
|
2262
|
-
var LegalStateSchema =
|
|
2263
|
-
object:
|
|
2418
|
+
var LegalStateSchema = z24.object({
|
|
2419
|
+
object: z24.literal("legal_state"),
|
|
2264
2420
|
code: UsStateSchema,
|
|
2265
|
-
name:
|
|
2421
|
+
name: z24.string(),
|
|
2266
2422
|
formation_fee_micro_usd: MicroUsdField
|
|
2267
2423
|
});
|
|
2268
|
-
var LegalWebhookEventSchema =
|
|
2269
|
-
provider_session_ref:
|
|
2270
|
-
status:
|
|
2424
|
+
var LegalWebhookEventSchema = z24.object({
|
|
2425
|
+
provider_session_ref: z24.string().min(1),
|
|
2426
|
+
status: z24.enum(["verified", "failed", "pending_review"]),
|
|
2271
2427
|
metadata: Metadata
|
|
2272
2428
|
});
|
|
2273
2429
|
var LLC_ENDING = /\s*(?:,\s*)?(?:l\.?l\.?c\.?|limited\s+liability\s+company)\s*$/i;
|
|
@@ -2278,186 +2434,243 @@ function canonicalName(raw) {
|
|
|
2278
2434
|
}
|
|
2279
2435
|
|
|
2280
2436
|
// ../core/src/schema/wallet.ts
|
|
2281
|
-
import { z as
|
|
2437
|
+
import { z as z25 } from "zod";
|
|
2282
2438
|
var WALLET_NETWORKS = ["eip155:84532", "eip155:8453"];
|
|
2283
|
-
var WalletNetworkSchema =
|
|
2439
|
+
var WalletNetworkSchema = z25.enum(WALLET_NETWORKS);
|
|
2284
2440
|
var DEFAULT_WALLET_NETWORK = "eip155:84532";
|
|
2285
|
-
var WalletSelectSchema =
|
|
2441
|
+
var WalletSelectSchema = z25.object({ network: WalletNetworkSchema.optional() });
|
|
2286
2442
|
var WALLET_STATUSES = ["active", "frozen", "swept"];
|
|
2287
|
-
var WalletStatusSchema =
|
|
2443
|
+
var WalletStatusSchema = z25.enum(WALLET_STATUSES);
|
|
2288
2444
|
var WALLET_TRANSACTION_KINDS = ["fund", "transfer", "pay", "sweep"];
|
|
2289
|
-
var WalletTransactionKindSchema =
|
|
2445
|
+
var WalletTransactionKindSchema = z25.enum(WALLET_TRANSACTION_KINDS);
|
|
2290
2446
|
var WALLET_TRANSACTION_STATUSES = ["pending", "confirmed", "failed"];
|
|
2291
|
-
var WalletTransactionStatusSchema =
|
|
2292
|
-
var WalletDirectionSchema =
|
|
2293
|
-
var WalletFundSourceSchema =
|
|
2294
|
-
var EvmAddressSchema =
|
|
2295
|
-
var TxHashSchema =
|
|
2296
|
-
var WalletPolicySchema =
|
|
2447
|
+
var WalletTransactionStatusSchema = z25.enum(WALLET_TRANSACTION_STATUSES);
|
|
2448
|
+
var WalletDirectionSchema = z25.enum(["in", "out"]);
|
|
2449
|
+
var WalletFundSourceSchema = z25.enum(["faucet", "treasury"]);
|
|
2450
|
+
var EvmAddressSchema = z25.string().regex(/^0x[0-9a-fA-F]{40}$/, "expected a 0x address");
|
|
2451
|
+
var TxHashSchema = z25.string().regex(/^0x[0-9a-fA-F]{64}$/, "expected a 0x transaction hash");
|
|
2452
|
+
var WalletPolicySchema = z25.object({
|
|
2297
2453
|
per_tx_cap_micro_usd: MicroUsdField.nonnegative(),
|
|
2298
2454
|
daily_cap_micro_usd: MicroUsdField.positive().nullable(),
|
|
2299
2455
|
low_balance_micro_usd: MicroUsdField.nonnegative().nullable()
|
|
2300
2456
|
});
|
|
2301
|
-
var WalletSchema =
|
|
2457
|
+
var WalletSchema = z25.object({
|
|
2302
2458
|
id: idOf("wlt"),
|
|
2303
|
-
object:
|
|
2459
|
+
object: z25.literal("wallet"),
|
|
2304
2460
|
identity_id: idOf("idn"),
|
|
2305
2461
|
status: WalletStatusSchema,
|
|
2306
2462
|
network: WalletNetworkSchema,
|
|
2307
2463
|
address: EvmAddressSchema,
|
|
2308
|
-
asset:
|
|
2464
|
+
asset: z25.literal("usdc"),
|
|
2309
2465
|
balance_micro_usd: MicroUsdField,
|
|
2310
2466
|
policy: WalletPolicySchema,
|
|
2311
2467
|
spent_today_micro_usd: MicroUsdField,
|
|
2312
2468
|
created_at: Timestamp,
|
|
2313
2469
|
updated_at: Timestamp
|
|
2314
2470
|
});
|
|
2315
|
-
var CreateWalletSchema =
|
|
2471
|
+
var CreateWalletSchema = z25.object({
|
|
2316
2472
|
network: WalletNetworkSchema.optional(),
|
|
2317
2473
|
policy: WalletPolicySchema.partial().optional()
|
|
2318
2474
|
});
|
|
2319
2475
|
var UpdateWalletPolicySchema = WalletPolicySchema.partial();
|
|
2320
|
-
var FundWalletSchema =
|
|
2476
|
+
var FundWalletSchema = z25.object({
|
|
2321
2477
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2322
2478
|
source: WalletFundSourceSchema
|
|
2323
2479
|
});
|
|
2324
|
-
var TransferWalletSchema =
|
|
2325
|
-
to:
|
|
2480
|
+
var TransferWalletSchema = z25.object({
|
|
2481
|
+
to: z25.union([EvmAddressSchema, idOf("idn")]),
|
|
2326
2482
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2327
|
-
purpose:
|
|
2483
|
+
purpose: z25.string().min(1).max(256)
|
|
2328
2484
|
});
|
|
2329
|
-
var SweepWalletSchema =
|
|
2330
|
-
var WalletTransactionSchema =
|
|
2485
|
+
var SweepWalletSchema = z25.object({ to: EvmAddressSchema.optional() });
|
|
2486
|
+
var WalletTransactionSchema = z25.object({
|
|
2331
2487
|
id: idOf("wtx"),
|
|
2332
|
-
object:
|
|
2488
|
+
object: z25.literal("wallet_transaction"),
|
|
2333
2489
|
wallet_id: idOf("wlt"),
|
|
2334
2490
|
kind: WalletTransactionKindSchema,
|
|
2335
2491
|
direction: WalletDirectionSchema,
|
|
2336
2492
|
amount_micro_usd: MicroUsdField,
|
|
2337
|
-
counterparty:
|
|
2338
|
-
origin:
|
|
2339
|
-
purpose:
|
|
2493
|
+
counterparty: z25.string().nullable(),
|
|
2494
|
+
origin: z25.string().nullable(),
|
|
2495
|
+
purpose: z25.string().nullable(),
|
|
2340
2496
|
tx_hash: TxHashSchema.nullable(),
|
|
2341
2497
|
session_id: idOf("ses").nullable(),
|
|
2342
2498
|
status: WalletTransactionStatusSchema,
|
|
2343
2499
|
created_at: Timestamp
|
|
2344
2500
|
});
|
|
2345
|
-
var ListWalletTransactionsSchema =
|
|
2501
|
+
var ListWalletTransactionsSchema = z25.object({
|
|
2346
2502
|
kind: WalletTransactionKindSchema.optional(),
|
|
2347
2503
|
direction: WalletDirectionSchema.optional(),
|
|
2348
|
-
origin:
|
|
2504
|
+
origin: z25.string().optional(),
|
|
2349
2505
|
since: Timestamp.optional()
|
|
2350
2506
|
});
|
|
2351
|
-
var HttpMethodSchema =
|
|
2352
|
-
var WalletQuoteRequestSchema =
|
|
2353
|
-
var WalletQuoteSchema =
|
|
2354
|
-
object:
|
|
2355
|
-
url:
|
|
2356
|
-
payable:
|
|
2507
|
+
var HttpMethodSchema = z25.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]);
|
|
2508
|
+
var WalletQuoteRequestSchema = z25.object({ url: z25.url(), method: HttpMethodSchema.optional() });
|
|
2509
|
+
var WalletQuoteSchema = z25.object({
|
|
2510
|
+
object: z25.literal("wallet_quote"),
|
|
2511
|
+
url: z25.url(),
|
|
2512
|
+
payable: z25.boolean(),
|
|
2357
2513
|
network: WalletNetworkSchema.nullable(),
|
|
2358
|
-
asset:
|
|
2514
|
+
asset: z25.literal("usdc").nullable(),
|
|
2359
2515
|
amount_micro_usd: MicroUsdField.nullable(),
|
|
2360
2516
|
pay_to: EvmAddressSchema.nullable(),
|
|
2361
|
-
description:
|
|
2362
|
-
max_timeout_seconds:
|
|
2517
|
+
description: z25.string().nullable(),
|
|
2518
|
+
max_timeout_seconds: z25.number().int().nullable()
|
|
2363
2519
|
});
|
|
2364
2520
|
var WalletPayRequestSchema = WalletQuoteRequestSchema.extend({
|
|
2365
2521
|
max_amount_micro_usd: MicroUsdField.positive().optional()
|
|
2366
2522
|
});
|
|
2367
2523
|
var WALLET_RESPONSE_BODY_MAX = 64 * 1024;
|
|
2368
|
-
var WalletPaymentSchema =
|
|
2369
|
-
object:
|
|
2370
|
-
paid:
|
|
2524
|
+
var WalletPaymentSchema = z25.object({
|
|
2525
|
+
object: z25.literal("wallet_payment"),
|
|
2526
|
+
paid: z25.boolean(),
|
|
2371
2527
|
transaction_id: idOf("wtx").nullable(),
|
|
2372
2528
|
amount_micro_usd: MicroUsdField.nullable(),
|
|
2373
|
-
response_status:
|
|
2374
|
-
response_body:
|
|
2529
|
+
response_status: z25.number().int(),
|
|
2530
|
+
response_body: z25.string().max(WALLET_RESPONSE_BODY_MAX)
|
|
2375
2531
|
});
|
|
2376
2532
|
|
|
2377
2533
|
// ../core/src/schema/cards.ts
|
|
2378
|
-
import { z as
|
|
2534
|
+
import { z as z26 } from "zod";
|
|
2379
2535
|
var CARD_STATUSES = ["pending_payment", "issuing", "active", "failed", "cancelled", "refunded"];
|
|
2380
|
-
var CardStatusSchema =
|
|
2536
|
+
var CardStatusSchema = z26.enum(CARD_STATUSES);
|
|
2381
2537
|
var CARD_MIN_LOAD_MICRO_USD = 1e6;
|
|
2382
2538
|
var CARD_MAX_LOAD_MICRO_USD = 15e7;
|
|
2383
2539
|
var CARD_LOAD_GRANULARITY_MICRO_USD = 1e4;
|
|
2384
|
-
var CardSchema =
|
|
2540
|
+
var CardSchema = z26.object({
|
|
2385
2541
|
id: idOf("vcd"),
|
|
2386
|
-
object:
|
|
2542
|
+
object: z26.literal("card"),
|
|
2387
2543
|
identity_id: idOf("idn"),
|
|
2388
|
-
kind:
|
|
2544
|
+
kind: z26.literal("prepaid"),
|
|
2389
2545
|
status: CardStatusSchema,
|
|
2390
|
-
label:
|
|
2391
|
-
brand:
|
|
2392
|
-
last4:
|
|
2546
|
+
label: z26.string().min(1).max(128),
|
|
2547
|
+
brand: z26.string().nullable(),
|
|
2548
|
+
last4: z26.string().regex(/^\d{4}$/).nullable(),
|
|
2393
2549
|
load_micro_usd: MicroUsdField,
|
|
2394
2550
|
spent_micro_usd: MicroUsdField,
|
|
2395
|
-
currency:
|
|
2551
|
+
currency: z26.literal("usd"),
|
|
2396
2552
|
expires_at: Timestamp.nullable(),
|
|
2397
|
-
failure_reason:
|
|
2553
|
+
failure_reason: z26.string().max(256).nullable(),
|
|
2398
2554
|
created_at: Timestamp,
|
|
2399
2555
|
updated_at: Timestamp
|
|
2400
2556
|
});
|
|
2401
|
-
var IssueCardSchema =
|
|
2557
|
+
var IssueCardSchema = z26.object({
|
|
2402
2558
|
label: CardSchema.shape.label,
|
|
2403
2559
|
load_micro_usd: MicroUsdField.min(CARD_MIN_LOAD_MICRO_USD).max(CARD_MAX_LOAD_MICRO_USD).multipleOf(CARD_LOAD_GRANULARITY_MICRO_USD)
|
|
2404
2560
|
});
|
|
2405
2561
|
var CardQuoteRequestSchema = IssueCardSchema.pick({ load_micro_usd: true });
|
|
2406
|
-
var CardQuoteSchema =
|
|
2407
|
-
object:
|
|
2562
|
+
var CardQuoteSchema = z26.object({
|
|
2563
|
+
object: z26.literal("card_quote"),
|
|
2408
2564
|
load_micro_usd: MicroUsdField,
|
|
2409
2565
|
price_micro_usd: MicroUsdField,
|
|
2410
|
-
brand:
|
|
2566
|
+
brand: z26.string().nullable(),
|
|
2411
2567
|
min_load_micro_usd: MicroUsdField,
|
|
2412
2568
|
max_load_micro_usd: MicroUsdField
|
|
2413
2569
|
});
|
|
2414
|
-
var CardCredentialsSchema =
|
|
2415
|
-
object:
|
|
2570
|
+
var CardCredentialsSchema = z26.object({
|
|
2571
|
+
object: z26.literal("card_credentials"),
|
|
2416
2572
|
card_id: idOf("vcd"),
|
|
2417
|
-
number:
|
|
2418
|
-
pin:
|
|
2419
|
-
cvv:
|
|
2420
|
-
expiry:
|
|
2421
|
-
url:
|
|
2422
|
-
instructions:
|
|
2573
|
+
number: z26.string().min(1),
|
|
2574
|
+
pin: z26.string().nullable(),
|
|
2575
|
+
cvv: z26.string().nullable(),
|
|
2576
|
+
expiry: z26.string().nullable(),
|
|
2577
|
+
url: z26.url().nullable(),
|
|
2578
|
+
instructions: z26.string().nullable(),
|
|
2423
2579
|
revealed_at: Timestamp
|
|
2424
2580
|
});
|
|
2425
|
-
var CardTransactionSchema =
|
|
2581
|
+
var CardTransactionSchema = z26.object({
|
|
2426
2582
|
id: idOf("vct"),
|
|
2427
|
-
object:
|
|
2583
|
+
object: z26.literal("card_transaction"),
|
|
2428
2584
|
card_id: idOf("vcd"),
|
|
2429
2585
|
amount_micro_usd: MicroUsdField,
|
|
2430
|
-
merchant:
|
|
2431
|
-
description:
|
|
2586
|
+
merchant: z26.string().nullable(),
|
|
2587
|
+
description: z26.string().nullable(),
|
|
2432
2588
|
session_id: idOf("ses").nullable(),
|
|
2433
2589
|
metadata: Metadata,
|
|
2434
2590
|
created_at: Timestamp
|
|
2435
2591
|
});
|
|
2436
|
-
var LogCardTransactionSchema =
|
|
2592
|
+
var LogCardTransactionSchema = z26.object({
|
|
2437
2593
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2438
|
-
merchant:
|
|
2439
|
-
description:
|
|
2594
|
+
merchant: z26.string().max(256).optional(),
|
|
2595
|
+
description: z26.string().max(1024).optional(),
|
|
2440
2596
|
metadata: Metadata.optional()
|
|
2441
2597
|
});
|
|
2442
|
-
var ListCardsSchema =
|
|
2598
|
+
var ListCardsSchema = z26.object({ status: CardStatusSchema.optional() });
|
|
2599
|
+
|
|
2600
|
+
// ../core/src/schema/proxy-trace.ts
|
|
2601
|
+
import { z as z27 } from "zod";
|
|
2602
|
+
var ProxyDialectSchema = z27.enum(["anthropic", "openai"]);
|
|
2603
|
+
var ProxyTraceContentScopeSchema = z27.enum(["full", "metadata"]);
|
|
2604
|
+
var ProxyTraceRequestSchema = z27.object({
|
|
2605
|
+
system: z27.string(),
|
|
2606
|
+
messages: z27.array(z27.object({ role: z27.string(), content: z27.string() })),
|
|
2607
|
+
tool_names: z27.array(z27.string())
|
|
2608
|
+
});
|
|
2609
|
+
var ProxyTraceResponseSchema = z27.object({
|
|
2610
|
+
text: z27.string(),
|
|
2611
|
+
tool_calls: z27.array(z27.object({ name: z27.string(), arguments: z27.string() }))
|
|
2612
|
+
});
|
|
2613
|
+
var Sha256 = z27.string().regex(/^[0-9a-f]{64}$/);
|
|
2614
|
+
var ProxyCallTraceSchema = z27.object({
|
|
2615
|
+
/** The request id: also `x-request-id`, the reply's `id`, and the ledger entry's idempotency key. */
|
|
2616
|
+
id: idOf("req"),
|
|
2617
|
+
object: z27.literal("proxy_call_trace"),
|
|
2618
|
+
dialect: ProxyDialectSchema,
|
|
2619
|
+
/** The principal that made the call (§17). An API key here is the answer to "who sent this". */
|
|
2620
|
+
actor: PrincipalSchema,
|
|
2621
|
+
/** The public model id the caller asked for. */
|
|
2622
|
+
model: z27.string(),
|
|
2623
|
+
window: WindowSchema,
|
|
2624
|
+
/** The model the reply said served it — where `vetta/auto` resolves — or null if it named none. */
|
|
2625
|
+
resolved_model: z27.string().nullable(),
|
|
2626
|
+
/**
|
|
2627
|
+
* The serving provider and the gateway's own generation id. Null on every row written before the
|
|
2628
|
+
* adapter stops dropping them (Track A); together they are what lets an upstream invoice line be
|
|
2629
|
+
* matched back to an organization, a key and a ledger entry.
|
|
2630
|
+
*/
|
|
2631
|
+
provider: z27.string().nullable(),
|
|
2632
|
+
generation_id: z27.string().nullable(),
|
|
2633
|
+
stop: z27.enum(["end_turn", "tool_use", "length"]).nullable(),
|
|
2634
|
+
usage: TokenUsageSchema,
|
|
2635
|
+
/** What the customer was charged, µUSD. The ledger entry is the authority; this is its copy. */
|
|
2636
|
+
billed_micro_usd: MicroUsdField.nullable(),
|
|
2637
|
+
/** What the vendor said it cost, µUSD. A CROSS-CHECK, NEVER A DEBIT. */
|
|
2638
|
+
vendor_cost_micro_usd: MicroUsdField.nullable(),
|
|
2639
|
+
duration_ms: z27.number().int().nonnegative().nullable(),
|
|
2640
|
+
content_scope: ProxyTraceContentScopeSchema,
|
|
2641
|
+
request_sha256: Sha256,
|
|
2642
|
+
response_sha256: Sha256,
|
|
2643
|
+
/** The size of each body BEFORE any cap, so a truncated row still reports what was really sent. */
|
|
2644
|
+
request_bytes: z27.number().int().nonnegative(),
|
|
2645
|
+
response_bytes: z27.number().int().nonnegative(),
|
|
2646
|
+
/** Null whenever `content_scope` is `metadata`. */
|
|
2647
|
+
request: ProxyTraceRequestSchema.nullable(),
|
|
2648
|
+
response: ProxyTraceResponseSchema.nullable(),
|
|
2649
|
+
truncated: z27.boolean(),
|
|
2650
|
+
created_at: Timestamp,
|
|
2651
|
+
/** When the reaper deletes this row. Never null: there is no row that is kept forever. */
|
|
2652
|
+
expires_at: Timestamp
|
|
2653
|
+
});
|
|
2443
2654
|
|
|
2444
2655
|
// src/define.ts
|
|
2445
|
-
import { z as
|
|
2656
|
+
import { z as z30 } from "zod";
|
|
2446
2657
|
|
|
2447
2658
|
// src/roster.ts
|
|
2448
|
-
import { z as
|
|
2659
|
+
import { z as z29 } from "zod";
|
|
2449
2660
|
|
|
2450
2661
|
// src/report.ts
|
|
2451
2662
|
import { ApiError, send } from "@usenaive-sdk/vetta";
|
|
2452
|
-
import { z as
|
|
2663
|
+
import { z as z28 } from "zod";
|
|
2453
2664
|
function message(error) {
|
|
2665
|
+
if (error instanceof ApiError && error.requestId !== "") return `${error.message} (request ${error.requestId})`;
|
|
2454
2666
|
return error instanceof Error ? error.message : String(error);
|
|
2455
2667
|
}
|
|
2456
|
-
async function line(name, work) {
|
|
2668
|
+
async function line(name, work, id) {
|
|
2457
2669
|
try {
|
|
2458
2670
|
return await work();
|
|
2459
2671
|
} catch (error) {
|
|
2460
|
-
|
|
2672
|
+
const resolved = id?.();
|
|
2673
|
+
return { name, action: "refused", ...resolved !== void 0 ? { id: resolved } : {}, reason: message(error) };
|
|
2461
2674
|
}
|
|
2462
2675
|
}
|
|
2463
2676
|
var AT_ONCE = 6;
|
|
@@ -2489,10 +2702,10 @@ async function absent(work) {
|
|
|
2489
2702
|
throw error;
|
|
2490
2703
|
}
|
|
2491
2704
|
}
|
|
2492
|
-
var PageShape =
|
|
2493
|
-
data:
|
|
2494
|
-
has_more:
|
|
2495
|
-
next_cursor:
|
|
2705
|
+
var PageShape = z28.object({
|
|
2706
|
+
data: z28.array(z28.unknown()),
|
|
2707
|
+
has_more: z28.boolean(),
|
|
2708
|
+
next_cursor: z28.string().nullable()
|
|
2496
2709
|
});
|
|
2497
2710
|
function rowLabel(row) {
|
|
2498
2711
|
const { object, id } = row ?? {};
|
|
@@ -2524,17 +2737,17 @@ async function tombstone(name, current, remove, dryRun) {
|
|
|
2524
2737
|
}
|
|
2525
2738
|
|
|
2526
2739
|
// src/roster.ts
|
|
2527
|
-
var NAME =
|
|
2528
|
-
var RosterNameSchema =
|
|
2740
|
+
var NAME = z29.string().min(1);
|
|
2741
|
+
var RosterNameSchema = z29.union([
|
|
2529
2742
|
NAME.transform((name) => ({ type: "agent", name })),
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2743
|
+
z29.object({ type: z29.literal("agent"), name: NAME, version: z29.number().int().positive().optional() }),
|
|
2744
|
+
z29.object({ type: z29.literal("self") }),
|
|
2745
|
+
z29.object({ type: z29.literal("advisor"), model: z29.string().min(1) })
|
|
2533
2746
|
]);
|
|
2534
|
-
var DeclMultiagentField =
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2747
|
+
var DeclMultiagentField = z29.union([
|
|
2748
|
+
z29.boolean(),
|
|
2749
|
+
z29.object({ ...MultiagentSchema.shape, agents: z29.array(RosterNameSchema).min(1).max(20) }),
|
|
2750
|
+
z29.null()
|
|
2538
2751
|
]);
|
|
2539
2752
|
var hasRoster = (value) => typeof value === "object" && value !== null;
|
|
2540
2753
|
var rosterNames = (roster) => roster.agents.flatMap((entry) => entry.type === "agent" ? [entry.name] : []);
|
|
@@ -2622,65 +2835,65 @@ function chooseTemplate(blueprint, template) {
|
|
|
2622
2835
|
var BlueprintRefusal = class extends Error {
|
|
2623
2836
|
name = "BlueprintRefusal";
|
|
2624
2837
|
};
|
|
2625
|
-
var EnvValueSchema =
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2838
|
+
var EnvValueSchema = z30.union([
|
|
2839
|
+
z30.string(),
|
|
2840
|
+
z30.object({ from_env: z30.string().min(1) }),
|
|
2841
|
+
z30.object({ generate: z30.literal(true) })
|
|
2629
2842
|
]);
|
|
2630
|
-
var AppDeclSchema =
|
|
2843
|
+
var AppDeclSchema = z30.object({
|
|
2631
2844
|
/** Becomes a hostname, so the grammar is the platform's `APP_NAME` (a DNS label). */
|
|
2632
|
-
name:
|
|
2845
|
+
name: z30.string().regex(APP_NAME, "a lowercase DNS label, 63 characters or fewer"),
|
|
2633
2846
|
type: AppTypeSchema,
|
|
2634
|
-
description:
|
|
2847
|
+
description: z30.string().optional(),
|
|
2635
2848
|
/** A directory whose files are collected and shipped as the app's file-map deployment. */
|
|
2636
|
-
deploy_dir:
|
|
2849
|
+
deploy_dir: z30.string().min(1).optional(),
|
|
2637
2850
|
/** The path the app itself serves MCP on (§29.5); `fullstack` only. Absent means none. */
|
|
2638
2851
|
mcp: AppMcpPathSchema.optional(),
|
|
2639
2852
|
/** Written as the app's write-only secrets (§29.2) on every apply; names follow the platform's `ENV_NAME`. */
|
|
2640
|
-
env:
|
|
2853
|
+
env: z30.record(z30.string().regex(ENV_NAME), EnvValueSchema, { error: "keyed by environment variable name (A-Z, 0-9, _)" }).optional(),
|
|
2641
2854
|
/** An install may not leave this app out of its `selection` (§31.2). Absent means it may. */
|
|
2642
|
-
required:
|
|
2855
|
+
required: z30.boolean().optional(),
|
|
2643
2856
|
// core-gaps: U8-database
|
|
2644
2857
|
/** SQL files applied in order to the app's database after it is provisioned (§37); `fullstack` only. */
|
|
2645
|
-
migrations:
|
|
2858
|
+
migrations: z30.array(z30.string().min(1)).optional(),
|
|
2646
2859
|
// core-gaps: storage-stock
|
|
2647
2860
|
/** Buckets the app's object store must hold (§38.2); `fullstack` only. `public` defaults to false. */
|
|
2648
|
-
buckets:
|
|
2861
|
+
buckets: z30.array(CreateBucketSchema).optional()
|
|
2649
2862
|
});
|
|
2650
|
-
var ScheduleDeclSchema =
|
|
2651
|
-
cron:
|
|
2652
|
-
timezone:
|
|
2863
|
+
var ScheduleDeclSchema = z30.object({
|
|
2864
|
+
cron: z30.string().min(1),
|
|
2865
|
+
timezone: z30.string().min(1).optional(),
|
|
2653
2866
|
/** The message every fire opens its session with (`input_template` on the wire). */
|
|
2654
|
-
input:
|
|
2867
|
+
input: z30.string().min(1),
|
|
2655
2868
|
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
2656
|
-
identity:
|
|
2657
|
-
enabled:
|
|
2869
|
+
identity: z30.string().min(1).optional(),
|
|
2870
|
+
enabled: z30.boolean().optional()
|
|
2658
2871
|
});
|
|
2659
2872
|
var ToolsDeclSchema = ToolsetSchema;
|
|
2660
|
-
var AgentDeclSchema =
|
|
2661
|
-
name:
|
|
2662
|
-
model:
|
|
2873
|
+
var AgentDeclSchema = z30.object({
|
|
2874
|
+
name: z30.string().min(1),
|
|
2875
|
+
model: z30.string().min(1),
|
|
2663
2876
|
budget: BudgetSchema,
|
|
2664
|
-
description:
|
|
2877
|
+
description: z30.string().optional(),
|
|
2665
2878
|
/** Two or three words the studio prints beside the name (§31.5) — "Head of content", not a sentence. */
|
|
2666
|
-
role:
|
|
2879
|
+
role: z30.string().min(1).optional(),
|
|
2667
2880
|
/** An install may not leave this agent out of its `selection` (§31.2). Absent means it may. */
|
|
2668
|
-
required:
|
|
2669
|
-
system:
|
|
2881
|
+
required: z30.boolean().optional(),
|
|
2882
|
+
system: z30.string().optional(),
|
|
2670
2883
|
tools: ToolsDeclSchema.optional(),
|
|
2671
|
-
skills:
|
|
2672
|
-
mcp_servers:
|
|
2884
|
+
skills: z30.array(SkillRefSchema).optional(),
|
|
2885
|
+
mcp_servers: z30.array(McpServerSchema).optional(),
|
|
2673
2886
|
/** The rest of the runtime's agent config (§31.6), each the core schema; absent means the route's default and never drift. */
|
|
2674
2887
|
window: WindowSchema.optional(),
|
|
2675
2888
|
/** A roster names crew members by declared *name*; `up` resolves them to `agt_` ids in a second pass (`roster.ts`). */
|
|
2676
2889
|
multiagent: DeclMultiagentField.optional(),
|
|
2677
2890
|
output_schema: JsonSchemaDocument.nullable().optional(),
|
|
2678
|
-
structured_output_required:
|
|
2891
|
+
structured_output_required: z30.boolean().optional(),
|
|
2679
2892
|
metadata: Metadata.optional(),
|
|
2680
2893
|
/** Declared app *names*; `up` resolves them to `app_` ids in `tools.configs.apps` (§29.3). */
|
|
2681
|
-
allowed_apps:
|
|
2894
|
+
allowed_apps: z30.array(z30.string()).optional(),
|
|
2682
2895
|
/** A declared identity *name*; `up` attaches it after the agent upsert (§22). */
|
|
2683
|
-
identity:
|
|
2896
|
+
identity: z30.string().min(1).optional(),
|
|
2684
2897
|
/**
|
|
2685
2898
|
* Who this agent may `send_to_agent` (§31.7, §28.12): `true` (anyone in the organization),
|
|
2686
2899
|
* `false` (nobody), `"team"` (its `multiagent` roster), or declared agent *names*, checked
|
|
@@ -2688,7 +2901,7 @@ var AgentDeclSchema = z28.object({
|
|
|
2688
2901
|
*/
|
|
2689
2902
|
handoffs: HandoffsField.optional(),
|
|
2690
2903
|
/** The agent's deployments as a complete set: declared → owned, and the rest are pruned (ADR-0355). */
|
|
2691
|
-
schedules:
|
|
2904
|
+
schedules: z30.array(ScheduleDeclSchema).optional(),
|
|
2692
2905
|
/**
|
|
2693
2906
|
* The first thing this agent reads, once, on the apply that **creates** it (`canonical-spec
|
|
2694
2907
|
* §31.4`). It is what turns a provisioned crew into a crew that has started working.
|
|
@@ -2701,34 +2914,34 @@ var AgentDeclSchema = z28.object({
|
|
|
2701
2914
|
* repeatedly and unattended while an intake spends once, at an apply a person is watching. Absent
|
|
2702
2915
|
* means the agent's own `budget` governs.
|
|
2703
2916
|
*/
|
|
2704
|
-
intake:
|
|
2917
|
+
intake: z30.object({ message: z30.string().min(1), budget_micro_usd: MicroUsdField.nonnegative().optional() }).optional()
|
|
2705
2918
|
});
|
|
2706
|
-
var CredentialDeclSchema =
|
|
2919
|
+
var CredentialDeclSchema = z30.object({
|
|
2707
2920
|
kind: VaultCredentialKindSchema,
|
|
2708
|
-
key:
|
|
2921
|
+
key: z30.string().min(1).max(128),
|
|
2709
2922
|
/** The one exact destination host an `env_var` is bound to. */
|
|
2710
|
-
host:
|
|
2923
|
+
host: z30.string().min(1).optional(),
|
|
2711
2924
|
/** The MCP server URL a `static_bearer` / `mcp_oauth` token is matched to. */
|
|
2712
|
-
mcp_server_url:
|
|
2713
|
-
value:
|
|
2925
|
+
mcp_server_url: z30.url().optional(),
|
|
2926
|
+
value: z30.object({ from_env: z30.string().min(1) })
|
|
2714
2927
|
});
|
|
2715
|
-
var VaultDeclSchema =
|
|
2928
|
+
var VaultDeclSchema = z30.object({
|
|
2716
2929
|
name: VaultSchema.shape.display_name,
|
|
2717
|
-
identity:
|
|
2718
|
-
credentials:
|
|
2930
|
+
identity: z30.string().min(1).optional(),
|
|
2931
|
+
credentials: z30.array(CredentialDeclSchema)
|
|
2719
2932
|
});
|
|
2720
|
-
var SkillDeclSchema =
|
|
2721
|
-
slug:
|
|
2722
|
-
file:
|
|
2933
|
+
var SkillDeclSchema = z30.object({
|
|
2934
|
+
slug: z30.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
|
|
2935
|
+
file: z30.string().min(1)
|
|
2723
2936
|
});
|
|
2724
2937
|
var LegalDeclSchema = CreateLegalCompanySchema.pick({
|
|
2725
2938
|
state: true,
|
|
2726
2939
|
name_options: true,
|
|
2727
2940
|
naics_code: true,
|
|
2728
2941
|
description: true
|
|
2729
|
-
}).extend({ label:
|
|
2942
|
+
}).extend({ label: z30.string().min(1).max(128) });
|
|
2730
2943
|
var WalletDeclSchema = CreateWalletSchema.or(
|
|
2731
|
-
|
|
2944
|
+
z30.array(CreateWalletSchema).refine(
|
|
2732
2945
|
(list2) => new Set(list2.map((w) => w.network ?? DEFAULT_WALLET_NETWORK)).size === list2.length,
|
|
2733
2946
|
{ message: "one wallet per network" }
|
|
2734
2947
|
)
|
|
@@ -2736,31 +2949,31 @@ var WalletDeclSchema = CreateWalletSchema.or(
|
|
|
2736
2949
|
var CardDeclSchema = IssueCardSchema;
|
|
2737
2950
|
var IdentityDeclSchema = IdentitySchema.pick({ name: true, description: true }).partial({ description: true }).extend({
|
|
2738
2951
|
connections: BlueprintIdentityConnectionsSchema.optional(),
|
|
2739
|
-
legal:
|
|
2952
|
+
legal: z30.array(LegalDeclSchema).optional(),
|
|
2740
2953
|
wallet: WalletDeclSchema.optional(),
|
|
2741
|
-
cards:
|
|
2742
|
-
});
|
|
2743
|
-
var RemovedSchema =
|
|
2744
|
-
apps:
|
|
2745
|
-
agents:
|
|
2746
|
-
skills:
|
|
2747
|
-
identities:
|
|
2748
|
-
vaults:
|
|
2749
|
-
});
|
|
2750
|
-
var KeptSchema =
|
|
2751
|
-
var TaskDeclSchema =
|
|
2752
|
-
key:
|
|
2753
|
-
title:
|
|
2754
|
-
body:
|
|
2755
|
-
assignee:
|
|
2756
|
-
blocked_by:
|
|
2757
|
-
});
|
|
2758
|
-
var ProjectSchema =
|
|
2759
|
-
name:
|
|
2954
|
+
cards: z30.array(CardDeclSchema).optional()
|
|
2955
|
+
});
|
|
2956
|
+
var RemovedSchema = z30.object({
|
|
2957
|
+
apps: z30.array(z30.string().min(1)).default([]),
|
|
2958
|
+
agents: z30.array(z30.string().min(1)).default([]),
|
|
2959
|
+
skills: z30.array(z30.string().min(1)).default([]),
|
|
2960
|
+
identities: z30.array(z30.string().min(1)).default([]),
|
|
2961
|
+
vaults: z30.array(z30.string().min(1)).default([])
|
|
2962
|
+
});
|
|
2963
|
+
var KeptSchema = z30.object({ agents: z30.array(z30.string().min(1)).default([]) });
|
|
2964
|
+
var TaskDeclSchema = z30.object({
|
|
2965
|
+
key: z30.string().min(1),
|
|
2966
|
+
title: z30.string().min(1).max(200),
|
|
2967
|
+
body: z30.string().max(8192).optional(),
|
|
2968
|
+
assignee: z30.string().min(1).optional(),
|
|
2969
|
+
blocked_by: z30.array(z30.string().min(1)).optional()
|
|
2970
|
+
});
|
|
2971
|
+
var ProjectSchema = z30.object({
|
|
2972
|
+
name: z30.string().min(1),
|
|
2760
2973
|
/** The machine this project runs: its repo, its screens, its `/api/*` (`template.ts`). */
|
|
2761
|
-
blueprint:
|
|
2974
|
+
blueprint: z30.string().min(1).optional(),
|
|
2762
2975
|
/** Which of that blueprint's templates provides the crew; a blueprint with a default may omit it. */
|
|
2763
|
-
template:
|
|
2976
|
+
template: z30.string().min(1).optional(),
|
|
2764
2977
|
/**
|
|
2765
2978
|
* What a person is asked BEFORE the crew is provisioned (`canonical-spec §31.2`).
|
|
2766
2979
|
*
|
|
@@ -2772,21 +2985,21 @@ var ProjectSchema = z28.object({
|
|
|
2772
2985
|
*
|
|
2773
2986
|
* **Configuration only.** A secret is a vault credential or an app secret; neither is an answer.
|
|
2774
2987
|
*/
|
|
2775
|
-
questions:
|
|
2776
|
-
skills:
|
|
2777
|
-
identities:
|
|
2778
|
-
vaults:
|
|
2779
|
-
apps:
|
|
2780
|
-
agents:
|
|
2988
|
+
questions: z30.array(QuestionFieldSchema).default([]),
|
|
2989
|
+
skills: z30.array(SkillDeclSchema).default([]),
|
|
2990
|
+
identities: z30.array(IdentityDeclSchema).default([]),
|
|
2991
|
+
vaults: z30.array(VaultDeclSchema).default([]),
|
|
2992
|
+
apps: z30.array(AppDeclSchema).default([]),
|
|
2993
|
+
agents: z30.array(AgentDeclSchema).default([]),
|
|
2781
2994
|
/**
|
|
2782
2995
|
* The agents this template creates PER CLIENT the operator signs (`canonical-spec §31.1`) —
|
|
2783
2996
|
* printed on the artifact so a person sees the whole company, never provisioned by an apply,
|
|
2784
2997
|
* because the apply does not know the clients yet. Names only: a model and a budget are the
|
|
2785
2998
|
* crew's business at the moment a client is signed, not the declaration's.
|
|
2786
2999
|
*/
|
|
2787
|
-
crew_per_client:
|
|
3000
|
+
crew_per_client: z30.array(z30.object({ name: z30.string().min(1), role: z30.string().min(1).optional(), description: z30.string().optional() })).optional(),
|
|
2788
3001
|
/** The crew's first work, as cards on the organization's board rather than N private intakes (§31.11). */
|
|
2789
|
-
tasks:
|
|
3002
|
+
tasks: z30.array(TaskDeclSchema).default([]),
|
|
2790
3003
|
removed: RemovedSchema.default({ apps: [], agents: [], skills: [], identities: [], vaults: [] }),
|
|
2791
3004
|
kept: KeptSchema.default({ agents: [] })
|
|
2792
3005
|
});
|
|
@@ -2841,8 +3054,8 @@ function parseProject(input) {
|
|
|
2841
3054
|
}
|
|
2842
3055
|
const config = parsed.data;
|
|
2843
3056
|
applyChoice(config);
|
|
2844
|
-
if (config.template !== void 0 && config.questions.length >
|
|
2845
|
-
refuse(`template "${config.template}" asks ${config.questions.length} questions, but a template asks at most
|
|
3057
|
+
if (config.template !== void 0 && config.questions.length > 4) {
|
|
3058
|
+
refuse(`template "${config.template}" asks ${config.questions.length} questions, but a template asks at most 4 before anything is provisioned \u2014 a fifth belongs to the crew's first conversation`);
|
|
2846
3059
|
}
|
|
2847
3060
|
assertUniqueNames("app", [...config.apps.map((a) => a.name), ...config.removed.apps]);
|
|
2848
3061
|
assertUniqueNames("agent", [...config.agents.map((a) => a.name), ...config.removed.agents, ...config.kept.agents]);
|
|
@@ -3194,6 +3407,11 @@ async function openIntake(client, agent, decl, dryRun) {
|
|
|
3194
3407
|
});
|
|
3195
3408
|
return { name: agent.name, action: "created", id: started.id };
|
|
3196
3409
|
}
|
|
3410
|
+
function brief(input) {
|
|
3411
|
+
const first = input.trim().split(/(?<=[.!?])\s|\n/)[0]?.trim() ?? "";
|
|
3412
|
+
const text = first.replace(/[.\s]+$/, "");
|
|
3413
|
+
return text.length > 72 ? `${text.slice(0, 71).trimEnd()}\u2026` : text;
|
|
3414
|
+
}
|
|
3197
3415
|
async function upsertSchedule(client, agent, decl, current, identityIds, dryRun) {
|
|
3198
3416
|
const name = `${agent.name} @ ${decl.cron}`;
|
|
3199
3417
|
if (agent.action === "refused") throw new Error(`agent "${agent.name}" was not provisioned in this run`);
|
|
@@ -3226,13 +3444,16 @@ async function upsertSchedule(client, agent, decl, current, identityIds, dryRun)
|
|
|
3226
3444
|
async function reconcileSchedules(client, agent, declared, live, identityIds, dryRun, into) {
|
|
3227
3445
|
const rows = live.filter((row) => row.agent_id === agent.id);
|
|
3228
3446
|
into.push(
|
|
3229
|
-
...await eachInFlight(
|
|
3230
|
-
|
|
3231
|
-
(decl) => line(
|
|
3447
|
+
...await eachInFlight(declared, async (decl) => ({
|
|
3448
|
+
...await line(
|
|
3232
3449
|
`${agent.name} @ ${decl.cron}`,
|
|
3233
3450
|
() => upsertSchedule(client, agent, decl, rows.find((row) => row.cron === decl.cron), identityIds, dryRun)
|
|
3234
|
-
)
|
|
3235
|
-
|
|
3451
|
+
),
|
|
3452
|
+
// `<agent> @ <cron>` says WHEN a timer runs and nothing about what it does, so the dashboard's
|
|
3453
|
+
// opening message could only ever draw a timetable from these lines. The brief's first
|
|
3454
|
+
// sentence is what turns that timetable into a roadmap (§29.6).
|
|
3455
|
+
summary: brief(decl.input)
|
|
3456
|
+
}))
|
|
3236
3457
|
);
|
|
3237
3458
|
for (const row of rows.filter((row2) => !declared.some((decl) => decl.cron === row2.cron))) {
|
|
3238
3459
|
const name = `${agent.name} @ ${row.cron}`;
|
|
@@ -3703,7 +3924,13 @@ async function seedTasks(client, config, existing, agents, dryRun, into, skipped
|
|
|
3703
3924
|
blocked_by: blockers.map((key) => ids.get(key))
|
|
3704
3925
|
});
|
|
3705
3926
|
ids.set(task.key, card.id);
|
|
3706
|
-
return {
|
|
3927
|
+
return {
|
|
3928
|
+
name: task.key,
|
|
3929
|
+
action: known.has(card.id) ? "unchanged" : "created",
|
|
3930
|
+
id: card.id,
|
|
3931
|
+
title: task.title,
|
|
3932
|
+
...assignee === void 0 ? {} : { assignee }
|
|
3933
|
+
};
|
|
3707
3934
|
})
|
|
3708
3935
|
);
|
|
3709
3936
|
}
|
|
@@ -3978,7 +4205,11 @@ async function up(config, client, opts = {}) {
|
|
|
3978
4205
|
platform
|
|
3979
4206
|
},
|
|
3980
4207
|
ids.apps
|
|
3981
|
-
)
|
|
4208
|
+
),
|
|
4209
|
+
// The app's id is recorded the moment it exists — before its secrets and deploy — so a
|
|
4210
|
+
// failure in that upload reports `refused` naming the created app, not one the operator
|
|
4211
|
+
// cannot find. A pre-create refusal (an unset `from_env`, a missing tree) has set nothing.
|
|
4212
|
+
() => ids.apps.get(decl.name)
|
|
3982
4213
|
)
|
|
3983
4214
|
)
|
|
3984
4215
|
);
|