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