@usenaive-sdk/blueprints 0.9.0 → 0.11.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/chunk-CVZ2DY27.js +50 -0
- package/dist/chunk-CVZ2DY27.js.map +1 -0
- package/dist/define-DiOsp5oY.d.ts +846 -0
- package/dist/index.d.ts +34 -826
- package/dist/index.js +1839 -1438
- package/dist/index.js.map +1 -1
- package/dist/template.d.ts +2 -0
- package/dist/template.js +9 -0
- package/dist/template.js.map +1 -0
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BLUEPRINTS,
|
|
3
|
+
chooseTemplate
|
|
4
|
+
} from "./chunk-CVZ2DY27.js";
|
|
5
|
+
|
|
1
6
|
// ../core/src/id.ts
|
|
2
7
|
var ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz";
|
|
3
8
|
var SUFFIX_LENGTH = 26;
|
|
@@ -116,10 +121,6 @@ function decimalStringFromMicro(amount) {
|
|
|
116
121
|
return `${amount < 0 ? "-" : ""}${absolute / BigInt(USD)}.${fraction}`;
|
|
117
122
|
}
|
|
118
123
|
|
|
119
|
-
// ../core/src/session-token.ts
|
|
120
|
-
var SESSION_TTL_SECONDS = 30 * 24 * 60 * 60;
|
|
121
|
-
var encoder = new TextEncoder();
|
|
122
|
-
|
|
123
124
|
// ../core/src/schema/audit-actions.ts
|
|
124
125
|
var AUDIT_ACTIONS_SHIPPED = [
|
|
125
126
|
"agent.updated",
|
|
@@ -161,6 +162,7 @@ var AUDIT_ACTIONS_P1 = [
|
|
|
161
162
|
"org.updated",
|
|
162
163
|
"subscription.updated",
|
|
163
164
|
"subscription.canceled",
|
|
165
|
+
"subscription.plan_changed",
|
|
164
166
|
"session.budget_updated",
|
|
165
167
|
"session.cancelled",
|
|
166
168
|
"skill.created",
|
|
@@ -185,6 +187,8 @@ var AUDIT_ACTIONS_P2 = [
|
|
|
185
187
|
"connection.auth_config_created",
|
|
186
188
|
"connection.auth_config_deleted",
|
|
187
189
|
"domain.created",
|
|
190
|
+
"domain.purchased",
|
|
191
|
+
"domain.purchase_refunded",
|
|
188
192
|
"domain.verified",
|
|
189
193
|
"domain.deleted",
|
|
190
194
|
"email.created",
|
|
@@ -220,6 +224,9 @@ var AUDIT_ACTIONS_P3 = [
|
|
|
220
224
|
"referral.attributed"
|
|
221
225
|
];
|
|
222
226
|
var AUDIT_ACTIONS_PRIMITIVES = [
|
|
227
|
+
"ad_campaign.created",
|
|
228
|
+
"ad_campaign.activated",
|
|
229
|
+
"ad_campaign.paused",
|
|
223
230
|
"legal_verification.started",
|
|
224
231
|
"legal_member.completed",
|
|
225
232
|
"legal_member.link_resent",
|
|
@@ -282,7 +289,7 @@ var JsonSchemaDocument = z.record(z.string(), z.unknown()).refine((schema) => sc
|
|
|
282
289
|
var WindowSchema = z.enum(["immediate", "priority", "loose"]);
|
|
283
290
|
var TOKEN_TIERS = ["input", "cache_write", "cache_read", "output", "reasoning"];
|
|
284
291
|
var TokenTierSchema = z.enum(TOKEN_TIERS);
|
|
285
|
-
var TOOL_TIERS = ["search", "media", "social", "browser", "storage", "email"];
|
|
292
|
+
var TOOL_TIERS = ["search", "media", "social", "browser", "storage", "email", "voice"];
|
|
286
293
|
var LINE_ITEM_TIERS = [...TOKEN_TIERS, "computer", ...TOOL_TIERS];
|
|
287
294
|
var LineItemTierSchema = z.enum(LINE_ITEM_TIERS);
|
|
288
295
|
var TokenUsageSchema = z.object({
|
|
@@ -330,6 +337,12 @@ var TimezoneSchema = z3.string().transform((name, ctx) => {
|
|
|
330
337
|
}
|
|
331
338
|
return zone;
|
|
332
339
|
});
|
|
340
|
+
var BRAND_TYPEFACES = ["grotesk", "serif", "rounded", "mono"];
|
|
341
|
+
var BrandKitSchema = z3.object({
|
|
342
|
+
palette: z3.array(z3.object({ name: z3.string().trim().min(1).max(24), hex: z3.string().regex(/^#[0-9a-f]{6}$/) }).strict()).min(3).max(6),
|
|
343
|
+
typeface: z3.enum(BRAND_TYPEFACES),
|
|
344
|
+
tagline: z3.string().trim().max(80)
|
|
345
|
+
}).strict();
|
|
333
346
|
var OrganizationSchema = z3.object({
|
|
334
347
|
id: idOf("org"),
|
|
335
348
|
object: z3.literal("organization"),
|
|
@@ -347,6 +360,15 @@ var OrganizationSchema = z3.object({
|
|
|
347
360
|
* until one is set. Defaulted so a reply from a control plane older than 0093 still parses.
|
|
348
361
|
*/
|
|
349
362
|
logo_svg: z3.string().nullable().default(null),
|
|
363
|
+
/** Its brand kit (ADR-1163), `null` until one is set. Defaulted so an older control plane parses. */
|
|
364
|
+
brand: BrandKitSchema.nullable().default(null),
|
|
365
|
+
/**
|
|
366
|
+
* Still being set up: made in a chat with its CEO and not yet activated by a payment (ADR-1108).
|
|
367
|
+
* Defaulted `false`, so a reply from a control plane older than 0101 reads as an ordinary company.
|
|
368
|
+
*/
|
|
369
|
+
setting_up: z3.boolean().default(false),
|
|
370
|
+
/** The `blueprint/template` a link named when the company was made, else `null` (ADR-1108). */
|
|
371
|
+
start_template: z3.string().nullable().default(null),
|
|
350
372
|
created_at: Timestamp
|
|
351
373
|
});
|
|
352
374
|
var RoleSchema = z3.enum(["owner", "admin", "member"]);
|
|
@@ -666,7 +688,35 @@ var BudgetSchema = z6.object({
|
|
|
666
688
|
var SkillRefSchema = z6.string().regex(/^(naive\/)?[a-z0-9][a-z0-9-]*(@\d+)?$/, {
|
|
667
689
|
error: "expected `slug`, `slug@N`, `naive/slug` or `naive/slug@N`"
|
|
668
690
|
});
|
|
691
|
+
var SECRET_HEADER = /^(authorization|proxy-authorization|cookie|set-cookie|x-api-key|x-auth-token)$/i;
|
|
669
692
|
var McpServerSchema = z6.object({
|
|
693
|
+
name: z6.string().min(1).max(64),
|
|
694
|
+
url: z6.url().startsWith("https://", { error: "an MCP server URL must be HTTPS" }),
|
|
695
|
+
headers: z6.record(z6.string().max(128), z6.string().max(4096)).optional()
|
|
696
|
+
}).superRefine((server, ctx) => {
|
|
697
|
+
let url = null;
|
|
698
|
+
try {
|
|
699
|
+
url = new URL(server.url);
|
|
700
|
+
} catch {
|
|
701
|
+
}
|
|
702
|
+
if (url && (url.username !== "" || url.password !== "")) {
|
|
703
|
+
ctx.addIssue({
|
|
704
|
+
code: "custom",
|
|
705
|
+
path: ["url"],
|
|
706
|
+
message: "credentials belong in a vault-bound MCP credential, not the server URL"
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
for (const name of Object.keys(server.headers ?? {})) {
|
|
710
|
+
if (SECRET_HEADER.test(name)) {
|
|
711
|
+
ctx.addIssue({
|
|
712
|
+
code: "custom",
|
|
713
|
+
path: ["headers", name],
|
|
714
|
+
message: "credentials belong in a vault-bound MCP credential, not agent config"
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
var StoredMcpServerSchema = z6.object({
|
|
670
720
|
name: z6.string(),
|
|
671
721
|
url: z6.url(),
|
|
672
722
|
headers: z6.record(z6.string(), z6.string()).optional()
|
|
@@ -704,7 +754,7 @@ var agentConfigShape = {
|
|
|
704
754
|
window: WindowSchema,
|
|
705
755
|
system: z6.string(),
|
|
706
756
|
tools: ToolsetSchema,
|
|
707
|
-
mcp_servers: z6.array(
|
|
757
|
+
mcp_servers: z6.array(StoredMcpServerSchema),
|
|
708
758
|
skills: z6.array(SkillRefSchema),
|
|
709
759
|
multiagent: MultiagentField,
|
|
710
760
|
/** Optional on the type so a version minted before §28.15 still parses; read it through `handoffsOf`. */
|
|
@@ -735,8 +785,131 @@ var AgentSchema = z6.object({
|
|
|
735
785
|
});
|
|
736
786
|
|
|
737
787
|
// ../core/src/schema/session.ts
|
|
788
|
+
import { z as z8 } from "zod";
|
|
789
|
+
|
|
790
|
+
// ../core/src/schema/social.ts
|
|
738
791
|
import { z as z7 } from "zod";
|
|
739
|
-
var
|
|
792
|
+
var SOCIAL_PLATFORMS = [
|
|
793
|
+
"bluesky",
|
|
794
|
+
"facebook",
|
|
795
|
+
"instagram",
|
|
796
|
+
"linkedin",
|
|
797
|
+
"mastodon",
|
|
798
|
+
"pinterest",
|
|
799
|
+
"reddit",
|
|
800
|
+
"threads",
|
|
801
|
+
"tiktok",
|
|
802
|
+
"x",
|
|
803
|
+
"youtube"
|
|
804
|
+
];
|
|
805
|
+
var SOCIAL_APPS = /* @__PURE__ */ new Set([...SOCIAL_PLATFORMS, "twitter"]);
|
|
806
|
+
var SOCIAL_TEXT_PLATFORMS = [
|
|
807
|
+
"bluesky",
|
|
808
|
+
"facebook",
|
|
809
|
+
"linkedin",
|
|
810
|
+
"mastodon",
|
|
811
|
+
"threads",
|
|
812
|
+
"x"
|
|
813
|
+
];
|
|
814
|
+
var SOCIAL_MEDIA_PLATFORMS = ["instagram", "tiktok", "youtube"];
|
|
815
|
+
var SOCIAL_VISIBILITIES = ["public", "unlisted", "private"];
|
|
816
|
+
var SOCIAL_VISIBILITY_PLATFORMS = ["mastodon", "youtube"];
|
|
817
|
+
var SocialVisibilitySchema = z7.enum(SOCIAL_VISIBILITIES);
|
|
818
|
+
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`;
|
|
819
|
+
var SocialPlatformSchema = z7.enum(SOCIAL_PLATFORMS);
|
|
820
|
+
var SocialTextPlatformSchema = z7.enum(SOCIAL_TEXT_PLATFORMS);
|
|
821
|
+
var isText = (platform) => SOCIAL_TEXT_PLATFORMS.includes(platform);
|
|
822
|
+
var isMedia = (platform) => SOCIAL_MEDIA_PLATFORMS.includes(platform);
|
|
823
|
+
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`;
|
|
824
|
+
var SocialAccountSchema = z7.object({
|
|
825
|
+
id: z7.string().min(1),
|
|
826
|
+
object: z7.literal("social_account"),
|
|
827
|
+
identity_id: idOf("idn"),
|
|
828
|
+
platform: SocialPlatformSchema,
|
|
829
|
+
username: z7.string().nullable(),
|
|
830
|
+
display_name: z7.string().nullable(),
|
|
831
|
+
avatar_url: z7.url().nullable(),
|
|
832
|
+
connected_at: Timestamp.nullable()
|
|
833
|
+
});
|
|
834
|
+
var SocialPostStatusSchema = z7.enum([
|
|
835
|
+
"draft",
|
|
836
|
+
"scheduled",
|
|
837
|
+
"processing",
|
|
838
|
+
"posted",
|
|
839
|
+
"failed",
|
|
840
|
+
"deleted"
|
|
841
|
+
]);
|
|
842
|
+
var SocialPostSchema = z7.object({
|
|
843
|
+
id: z7.string().min(1),
|
|
844
|
+
object: z7.literal("social_post"),
|
|
845
|
+
identity_id: idOf("idn"),
|
|
846
|
+
title: z7.string(),
|
|
847
|
+
platforms: z7.array(SocialPlatformSchema),
|
|
848
|
+
status: SocialPostStatusSchema,
|
|
849
|
+
scheduled_at: Timestamp.nullable(),
|
|
850
|
+
posted_at: Timestamp.nullable(),
|
|
851
|
+
error: z7.string().nullable()
|
|
852
|
+
});
|
|
853
|
+
var SocialUploadSchema = z7.object({
|
|
854
|
+
id: z7.string().min(1),
|
|
855
|
+
object: z7.literal("social_upload"),
|
|
856
|
+
identity_id: idOf("idn"),
|
|
857
|
+
type: z7.enum(["image", "video", "document"]),
|
|
858
|
+
url: z7.url().nullable()
|
|
859
|
+
});
|
|
860
|
+
var SocialAnalyticsSchema = z7.object({
|
|
861
|
+
object: z7.literal("social_analytics"),
|
|
862
|
+
identity_id: idOf("idn"),
|
|
863
|
+
resource_id: z7.string().min(1),
|
|
864
|
+
platform: SocialPlatformSchema.nullable(),
|
|
865
|
+
data: z7.unknown()
|
|
866
|
+
});
|
|
867
|
+
var SocialCommentSchema = z7.object({
|
|
868
|
+
id: z7.string().min(1),
|
|
869
|
+
object: z7.literal("social_comment"),
|
|
870
|
+
identity_id: idOf("idn"),
|
|
871
|
+
post_id: z7.string().min(1),
|
|
872
|
+
platforms: z7.array(SocialPlatformSchema),
|
|
873
|
+
status: SocialPostStatusSchema,
|
|
874
|
+
posted_at: Timestamp.nullable(),
|
|
875
|
+
data: z7.unknown()
|
|
876
|
+
});
|
|
877
|
+
var POST_STATUSES = ["pending", "scheduled", "posted", "failed"];
|
|
878
|
+
var PostStatusSchema = z7.enum(POST_STATUSES);
|
|
879
|
+
var PostSchema = z7.object({
|
|
880
|
+
object: z7.literal("post"),
|
|
881
|
+
id: z7.string().min(1),
|
|
882
|
+
status: PostStatusSchema,
|
|
883
|
+
identity_id: z7.string().nullable(),
|
|
884
|
+
agent_id: z7.string().nullable(),
|
|
885
|
+
session_id: z7.string().nullable(),
|
|
886
|
+
tool_call_id: z7.string().nullable(),
|
|
887
|
+
content: z7.string().nullable(),
|
|
888
|
+
platforms: z7.array(z7.string()),
|
|
889
|
+
file_ids: z7.array(z7.string()),
|
|
890
|
+
media_urls: z7.array(z7.string()),
|
|
891
|
+
visibility: SocialVisibilitySchema.nullable(),
|
|
892
|
+
scheduled_at: Timestamp.nullable(),
|
|
893
|
+
posted_at: Timestamp.nullable(),
|
|
894
|
+
url: z7.string().nullable(),
|
|
895
|
+
error: z7.string().nullable(),
|
|
896
|
+
/** The latest stored reading, `{metric: value}`; `null` before `social.post_metrics` read any. */
|
|
897
|
+
metrics: z7.record(z7.string(), z7.number()).nullable(),
|
|
898
|
+
measured_at: Timestamp.nullable(),
|
|
899
|
+
/** Pending only: the earlier post this call would repeat — same identity, network and file. */
|
|
900
|
+
duplicate_of: z7.object({
|
|
901
|
+
id: z7.string(),
|
|
902
|
+
status: PostStatusSchema,
|
|
903
|
+
platform: z7.string(),
|
|
904
|
+
at: Timestamp.nullable(),
|
|
905
|
+
agent_id: z7.string().nullable(),
|
|
906
|
+
session_id: z7.string().nullable()
|
|
907
|
+
}).nullable(),
|
|
908
|
+
created_at: Timestamp
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
// ../core/src/schema/session.ts
|
|
912
|
+
var SessionStatusSchema = z8.enum([
|
|
740
913
|
"queued",
|
|
741
914
|
"running",
|
|
742
915
|
"idle",
|
|
@@ -744,23 +917,23 @@ var SessionStatusSchema = z7.enum([
|
|
|
744
917
|
"failed",
|
|
745
918
|
"cancelled"
|
|
746
919
|
]);
|
|
747
|
-
var SessionModeSchema =
|
|
920
|
+
var SessionModeSchema = z8.enum(["plan", "build"]);
|
|
748
921
|
var PLAN_MAX_CHARS = 2e4;
|
|
749
|
-
var PlanSchema =
|
|
750
|
-
object:
|
|
751
|
-
markdown:
|
|
752
|
-
version:
|
|
753
|
-
by:
|
|
922
|
+
var PlanSchema = z8.object({
|
|
923
|
+
object: z8.literal("plan"),
|
|
924
|
+
markdown: z8.string().max(PLAN_MAX_CHARS),
|
|
925
|
+
version: z8.number().int().nonnegative(),
|
|
926
|
+
by: z8.enum(["agent", "owner"]).nullable()
|
|
754
927
|
});
|
|
755
|
-
var PlanWriteSchema =
|
|
756
|
-
markdown:
|
|
757
|
-
base_version:
|
|
928
|
+
var PlanWriteSchema = z8.object({
|
|
929
|
+
markdown: z8.string().max(PLAN_MAX_CHARS),
|
|
930
|
+
base_version: z8.number().int().nonnegative()
|
|
758
931
|
});
|
|
759
|
-
var ProposePlanSchema =
|
|
760
|
-
version:
|
|
761
|
-
spends_or_publishes:
|
|
932
|
+
var ProposePlanSchema = z8.object({
|
|
933
|
+
version: z8.number().int().positive(),
|
|
934
|
+
spends_or_publishes: z8.array(z8.string().min(1).max(200)).max(10).optional()
|
|
762
935
|
});
|
|
763
|
-
var StopReasonSchema =
|
|
936
|
+
var StopReasonSchema = z8.enum([
|
|
764
937
|
"end_turn",
|
|
765
938
|
"awaiting_input",
|
|
766
939
|
"awaiting_approval",
|
|
@@ -786,27 +959,27 @@ var StopReasonSchema = z7.enum([
|
|
|
786
959
|
*/
|
|
787
960
|
"awaiting_answer"
|
|
788
961
|
]);
|
|
789
|
-
var ThreadRoleSchema =
|
|
790
|
-
var MessageSchema =
|
|
791
|
-
role:
|
|
792
|
-
content:
|
|
793
|
-
tool_call_id:
|
|
962
|
+
var ThreadRoleSchema = z8.enum(["coordinator", "member"]);
|
|
963
|
+
var MessageSchema = z8.object({
|
|
964
|
+
role: z8.enum(["system", "user", "assistant", "tool"]),
|
|
965
|
+
content: z8.string(),
|
|
966
|
+
tool_call_id: z8.string().optional()
|
|
794
967
|
});
|
|
795
|
-
var ToolImageSchema =
|
|
968
|
+
var ToolImageSchema = z8.object({
|
|
796
969
|
file_id: idOf("fil"),
|
|
797
|
-
url:
|
|
798
|
-
media_type:
|
|
970
|
+
url: z8.string().url().describe("A short-lived signed read for the file's bytes."),
|
|
971
|
+
media_type: z8.enum(["image/png", "image/jpeg", "image/gif", "image/webp"])
|
|
799
972
|
});
|
|
800
|
-
var ToolResultSchema =
|
|
801
|
-
output:
|
|
802
|
-
is_error:
|
|
803
|
-
content:
|
|
804
|
-
images:
|
|
973
|
+
var ToolResultSchema = z8.object({
|
|
974
|
+
output: z8.unknown(),
|
|
975
|
+
is_error: z8.boolean().optional(),
|
|
976
|
+
content: z8.string().optional(),
|
|
977
|
+
images: z8.array(ToolImageSchema).max(12).optional()
|
|
805
978
|
});
|
|
806
979
|
var QuestionFieldBase = {
|
|
807
|
-
key:
|
|
808
|
-
label:
|
|
809
|
-
help:
|
|
980
|
+
key: z8.string().min(1).max(64),
|
|
981
|
+
label: z8.string().min(1).max(200),
|
|
982
|
+
help: z8.string().max(500).optional(),
|
|
810
983
|
/**
|
|
811
984
|
* A field that may be left blank, and it defaults to **false** — the rule "every field must be
|
|
812
985
|
* answered" (`assertAnswers`) is still the rule, and this is the one documented way out of it.
|
|
@@ -826,42 +999,79 @@ var QuestionFieldBase = {
|
|
|
826
999
|
* required on the OUTPUT type — so every hand-written `QuestionField` in the codebase, and every
|
|
827
1000
|
* one written after it, would have to spell out the flag it does not use.
|
|
828
1001
|
*/
|
|
829
|
-
optional:
|
|
1002
|
+
optional: z8.boolean().optional()
|
|
830
1003
|
};
|
|
831
|
-
var QuestionFieldSchema =
|
|
832
|
-
|
|
1004
|
+
var QuestionFieldSchema = z8.discriminatedUnion("type", [
|
|
1005
|
+
z8.object({
|
|
833
1006
|
...QuestionFieldBase,
|
|
834
|
-
type:
|
|
835
|
-
placeholder:
|
|
1007
|
+
type: z8.literal("text"),
|
|
1008
|
+
placeholder: z8.string().max(200).optional()
|
|
836
1009
|
}),
|
|
837
|
-
|
|
1010
|
+
z8.object({
|
|
838
1011
|
...QuestionFieldBase,
|
|
839
|
-
type:
|
|
1012
|
+
type: z8.literal("choice"),
|
|
840
1013
|
/**
|
|
841
1014
|
* Plain strings: the option is both the value and the label, because the answer is read back by
|
|
842
1015
|
* a model, which wants the words and not an id. Fewer than two is not a choice, and more than
|
|
843
1016
|
* twelve is a list — which belongs in the prompt.
|
|
844
1017
|
*/
|
|
845
|
-
options:
|
|
846
|
-
multiple:
|
|
1018
|
+
options: z8.array(z8.string().min(1).max(200)).min(2).max(12),
|
|
1019
|
+
multiple: z8.boolean().default(false),
|
|
847
1020
|
/**
|
|
848
1021
|
* The free-text escape, and it defaults to **true** on purpose: the agent wrote the options and
|
|
849
1022
|
* the agent is the one that does not know the answer, so an operator must always be able to say
|
|
850
1023
|
* something it did not think of. A question that truly admits only its list opts out explicitly.
|
|
851
1024
|
*/
|
|
852
|
-
other:
|
|
1025
|
+
other: z8.boolean().default(true),
|
|
1026
|
+
/**
|
|
1027
|
+
* A PICTURE OR A LINE FOR AN OPTION (ADR-1103): a template's "how it looks" shows its looks, and
|
|
1028
|
+
* a niche says what it means in one line. Each names its option by its words; one naming no
|
|
1029
|
+
* option is ignored, never refused. With a picture on any option the dashboard draws the choice
|
|
1030
|
+
* as a grid of pictures. `image` is `https://`, or a path on the dashboard itself. An array
|
|
1031
|
+
* and not a map, because a model's tool schema cannot always take a map. An older reader drops
|
|
1032
|
+
* it and draws the plain list.
|
|
1033
|
+
*/
|
|
1034
|
+
details: z8.array(
|
|
1035
|
+
z8.object({
|
|
1036
|
+
option: z8.string().min(1).max(200),
|
|
1037
|
+
note: z8.string().min(1).max(120).optional(),
|
|
1038
|
+
image: z8.string().max(500).regex(/^\/(?!\/)/, "an image is a path on the dashboard").optional()
|
|
1039
|
+
})
|
|
1040
|
+
).max(12).optional()
|
|
1041
|
+
}),
|
|
1042
|
+
/**
|
|
1043
|
+
* THE PERSON'S OWN MEDIA (ADR-1103): "show us what you like". The dashboard offers an upload for
|
|
1044
|
+
* images or a video, which land in the organization's files, and a box for a link. The answer is
|
|
1045
|
+
* the list: `fil_` ids and `https://` links, which an agent opens with `files_get`, `view_image`
|
|
1046
|
+
* or the browser. `placeholder` is the link box's.
|
|
1047
|
+
*/
|
|
1048
|
+
z8.object({
|
|
1049
|
+
...QuestionFieldBase,
|
|
1050
|
+
type: z8.literal("media"),
|
|
1051
|
+
placeholder: z8.string().max(200).optional()
|
|
853
1052
|
})
|
|
854
1053
|
]);
|
|
1054
|
+
var ConnectFieldSchema = z8.object({
|
|
1055
|
+
...QuestionFieldBase,
|
|
1056
|
+
type: z8.literal("connect"),
|
|
1057
|
+
platforms: z8.array(SocialPlatformSchema).min(1).max(6)
|
|
1058
|
+
});
|
|
1059
|
+
var AskFieldSchema = z8.discriminatedUnion("type", [...QuestionFieldSchema.options, ConnectFieldSchema]);
|
|
855
1060
|
var QUESTION_FIELDS_MAX = 3;
|
|
856
|
-
var QuestionSchema =
|
|
857
|
-
prompt:
|
|
858
|
-
fields:
|
|
1061
|
+
var QuestionSchema = z8.object({
|
|
1062
|
+
prompt: z8.string().min(1).max(1e3),
|
|
1063
|
+
fields: z8.array(AskFieldSchema).min(1).max(QUESTION_FIELDS_MAX, {
|
|
859
1064
|
message: `a question has at most ${QUESTION_FIELDS_MAX} fields \u2014 ask the rest in a second question once these are answered`
|
|
860
1065
|
})
|
|
861
|
-
})
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1066
|
+
}).refine((question) => question.fields.length === 1 || question.fields.every((field) => field.type !== "connect"), {
|
|
1067
|
+
// A connect card answers itself when the accounts land (ADR-1102); a field beside it would need
|
|
1068
|
+
// a Send the card does not have.
|
|
1069
|
+
message: "a connect field is a question of its own: ask anything else in a separate question",
|
|
1070
|
+
path: ["fields"]
|
|
1071
|
+
});
|
|
1072
|
+
var answersOf = (max, message3) => z8.record(
|
|
1073
|
+
z8.string().min(1).max(64),
|
|
1074
|
+
z8.union([z8.string().max(2e3), z8.array(z8.string().max(2e3)).min(1).max(12)])
|
|
865
1075
|
).refine((answers) => Object.keys(answers).length <= max, { message: message3 });
|
|
866
1076
|
var AnswersSchema = answersOf(
|
|
867
1077
|
QUESTION_FIELDS_MAX,
|
|
@@ -872,24 +1082,29 @@ var InstallAnswersSchema = answersOf(
|
|
|
872
1082
|
TEMPLATE_QUESTIONS_MAX,
|
|
873
1083
|
`a template asks at most ${TEMPLATE_QUESTIONS_MAX} questions, so an install has at most ${TEMPLATE_QUESTIONS_MAX} answers`
|
|
874
1084
|
);
|
|
875
|
-
var PendingActionSchema =
|
|
876
|
-
kind:
|
|
877
|
-
tool_call_id:
|
|
878
|
-
name:
|
|
879
|
-
args:
|
|
1085
|
+
var PendingActionSchema = z8.object({
|
|
1086
|
+
kind: z8.enum(["tool", "question"]).default("tool"),
|
|
1087
|
+
tool_call_id: z8.string(),
|
|
1088
|
+
name: z8.string(),
|
|
1089
|
+
args: z8.record(z8.string(), z8.unknown()),
|
|
880
1090
|
/**
|
|
881
1091
|
* Present iff `kind` is `"question"`, and it is the parse of `args` rather than a second source
|
|
882
1092
|
* of truth: `args` is what the model called and therefore what replays byte-identically, while
|
|
883
1093
|
* `question` is what a renderer reads without having to know that `ask_operator`'s arguments
|
|
884
1094
|
* happen to be the question. Same content, two jobs.
|
|
885
1095
|
*/
|
|
886
|
-
question: QuestionSchema.optional()
|
|
1096
|
+
question: QuestionSchema.optional(),
|
|
1097
|
+
/**
|
|
1098
|
+
* The helper's thread a coordinator adopted this call from (§28, B-3; ADR-1101): the dashboard
|
|
1099
|
+
* marks that helper as waiting on you. Absent on the session's own calls.
|
|
1100
|
+
*/
|
|
1101
|
+
thread_id: idOf("ses").optional()
|
|
887
1102
|
});
|
|
888
|
-
var SessionSchema =
|
|
1103
|
+
var SessionSchema = z8.object({
|
|
889
1104
|
id: idOf("ses"),
|
|
890
|
-
object:
|
|
1105
|
+
object: z8.literal("session"),
|
|
891
1106
|
agent_id: idOf("agt"),
|
|
892
|
-
agent_version:
|
|
1107
|
+
agent_version: z8.number().int().positive(),
|
|
893
1108
|
deployment_id: idOf("dep").nullable(),
|
|
894
1109
|
/**
|
|
895
1110
|
* The persona this session acts as (`canonical-spec §22`). Chosen per task from the personas the
|
|
@@ -916,7 +1131,7 @@ var SessionSchema = z7.object({
|
|
|
916
1131
|
* The model the latest send picked (§7 `model`), or `null` when none has and the session runs its
|
|
917
1132
|
* pinned version's model (§10, ADR-0832). Defaulted so a reply from an older control plane parses.
|
|
918
1133
|
*/
|
|
919
|
-
model:
|
|
1134
|
+
model: z8.string().nullable().default(null),
|
|
920
1135
|
/** Plan mode (§7.5, §10): defaulted so a reply from an older control plane parses as `build`. */
|
|
921
1136
|
mode: SessionModeSchema.default("build"),
|
|
922
1137
|
status: SessionStatusSchema,
|
|
@@ -925,38 +1140,38 @@ var SessionSchema = z7.object({
|
|
|
925
1140
|
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
926
1141
|
consumed_micro_usd: MicroUsdField.nonnegative(),
|
|
927
1142
|
token_usage: TokenUsageSchema,
|
|
928
|
-
pending_actions:
|
|
1143
|
+
pending_actions: z8.array(PendingActionSchema),
|
|
929
1144
|
output_schema: JsonSchemaDocument.nullable(),
|
|
930
|
-
structured_output:
|
|
931
|
-
last_seq:
|
|
1145
|
+
structured_output: z8.record(z8.string(), z8.unknown()).nullable(),
|
|
1146
|
+
last_seq: z8.number().int().nonnegative(),
|
|
932
1147
|
metadata: Metadata,
|
|
933
1148
|
started_at: Timestamp.nullable(),
|
|
934
1149
|
ended_at: Timestamp.nullable(),
|
|
935
1150
|
created_at: Timestamp
|
|
936
1151
|
});
|
|
937
|
-
var SendMessageSchema =
|
|
938
|
-
message:
|
|
939
|
-
interrupt:
|
|
940
|
-
queue:
|
|
1152
|
+
var SendMessageSchema = z8.object({
|
|
1153
|
+
message: z8.string(),
|
|
1154
|
+
interrupt: z8.boolean().optional(),
|
|
1155
|
+
queue: z8.boolean().optional(),
|
|
941
1156
|
/** A catalogue id: this session runs on it from this message's turn on (§7, ADR-0832). */
|
|
942
|
-
model:
|
|
1157
|
+
model: z8.string().min(1).optional(),
|
|
943
1158
|
/** Plan mode from this message's turn on (§7.5, ADR-0905). */
|
|
944
1159
|
mode: SessionModeSchema.optional(),
|
|
945
|
-
idempotency_key:
|
|
1160
|
+
idempotency_key: z8.string().optional()
|
|
946
1161
|
}).refine((body) => !(body.interrupt === true && body.queue === true), {
|
|
947
1162
|
message: "a send is either an interrupt or queued, not both",
|
|
948
1163
|
path: ["queue"]
|
|
949
1164
|
});
|
|
950
|
-
var SendAcceptedSchema =
|
|
951
|
-
session_id:
|
|
1165
|
+
var SendAcceptedSchema = z8.object({
|
|
1166
|
+
session_id: z8.string(),
|
|
952
1167
|
status: SessionStatusSchema,
|
|
953
|
-
accepted_seq:
|
|
1168
|
+
accepted_seq: z8.number().int().nonnegative()
|
|
954
1169
|
});
|
|
955
|
-
var ToolConfirmationSchema =
|
|
956
|
-
tool_call_id:
|
|
957
|
-
decision:
|
|
958
|
-
reason:
|
|
959
|
-
scope:
|
|
1170
|
+
var ToolConfirmationSchema = z8.object({
|
|
1171
|
+
tool_call_id: z8.string(),
|
|
1172
|
+
decision: z8.enum(["allow", "deny"]),
|
|
1173
|
+
reason: z8.string().optional(),
|
|
1174
|
+
scope: z8.enum(["call", "session"]).default("call"),
|
|
960
1175
|
/**
|
|
961
1176
|
* THE PERSON'S OWN ANSWERS for a template install they approve (ADR-1030): the call runs with
|
|
962
1177
|
* these in place of the `answers` the agent proposed, and with nothing else changed. A modifier on
|
|
@@ -965,14 +1180,14 @@ var ToolConfirmationSchema = z7.object({
|
|
|
965
1180
|
*/
|
|
966
1181
|
answers: InstallAnswersSchema.optional()
|
|
967
1182
|
});
|
|
968
|
-
var SessionAnswerSchema =
|
|
969
|
-
tool_call_id:
|
|
970
|
-
answers:
|
|
1183
|
+
var SessionAnswerSchema = z8.object({
|
|
1184
|
+
tool_call_id: z8.string(),
|
|
1185
|
+
answers: z8.record(z8.string(), z8.union([z8.string(), z8.array(z8.string())]))
|
|
971
1186
|
});
|
|
972
1187
|
|
|
973
1188
|
// ../core/src/schema/event.ts
|
|
974
|
-
import { z as
|
|
975
|
-
var EventTypeSchema =
|
|
1189
|
+
import { z as z9 } from "zod";
|
|
1190
|
+
var EventTypeSchema = z9.enum([
|
|
976
1191
|
"message.delta",
|
|
977
1192
|
/**
|
|
978
1193
|
* The agent's answer (no `role`), or a user row `{ role: "user", content, client_message_id? }` (§8).
|
|
@@ -1087,78 +1302,78 @@ var EventTypeSchema = z8.enum([
|
|
|
1087
1302
|
"card.refunded",
|
|
1088
1303
|
"card.credentials_revealed"
|
|
1089
1304
|
]);
|
|
1090
|
-
var EventSchema =
|
|
1305
|
+
var EventSchema = z9.object({
|
|
1091
1306
|
id: idOf("evt"),
|
|
1092
|
-
seq:
|
|
1307
|
+
seq: z9.number().int().positive(),
|
|
1093
1308
|
type: EventTypeSchema,
|
|
1094
1309
|
session_id: idOf("ses"),
|
|
1095
|
-
data:
|
|
1310
|
+
data: z9.record(z9.string(), z9.unknown()),
|
|
1096
1311
|
created_at: Timestamp
|
|
1097
1312
|
});
|
|
1098
|
-
var ThreadEventDataSchema =
|
|
1099
|
-
var ToolConfirmResolvedDataSchema =
|
|
1100
|
-
tool_call_id:
|
|
1101
|
-
decision:
|
|
1102
|
-
reason:
|
|
1103
|
-
scope:
|
|
1313
|
+
var ThreadEventDataSchema = z9.looseObject({ thread_id: idOf("ses") });
|
|
1314
|
+
var ToolConfirmResolvedDataSchema = z9.object({
|
|
1315
|
+
tool_call_id: z9.string(),
|
|
1316
|
+
decision: z9.enum(["allow", "deny"]),
|
|
1317
|
+
reason: z9.string().nullable(),
|
|
1318
|
+
scope: z9.enum(["call", "session"]),
|
|
1104
1319
|
actor: PrincipalSchema.nullable(),
|
|
1105
1320
|
decided_at: Timestamp,
|
|
1106
|
-
proposed_args:
|
|
1107
|
-
final_args:
|
|
1321
|
+
proposed_args: z9.record(z9.string(), z9.unknown()).nullable(),
|
|
1322
|
+
final_args: z9.record(z9.string(), z9.unknown()).nullable()
|
|
1108
1323
|
});
|
|
1109
|
-
var ToolConfirmAnsweredDataSchema =
|
|
1110
|
-
tool_call_id:
|
|
1324
|
+
var ToolConfirmAnsweredDataSchema = z9.object({
|
|
1325
|
+
tool_call_id: z9.string(),
|
|
1111
1326
|
answers: AnswersSchema,
|
|
1112
1327
|
answered_at: Timestamp
|
|
1113
1328
|
});
|
|
1114
|
-
var SessionUsageDataSchema =
|
|
1329
|
+
var SessionUsageDataSchema = z9.object({
|
|
1115
1330
|
token_usage: TokenUsageSchema,
|
|
1116
1331
|
consumed_micro_usd: MicroUsdField.nonnegative(),
|
|
1117
|
-
active_seconds:
|
|
1118
|
-
tool_calls:
|
|
1332
|
+
active_seconds: z9.number().nonnegative(),
|
|
1333
|
+
tool_calls: z9.number().int().nonnegative()
|
|
1119
1334
|
});
|
|
1120
1335
|
|
|
1121
1336
|
// ../core/src/schema/board.ts
|
|
1122
|
-
import { z as
|
|
1337
|
+
import { z as z10 } from "zod";
|
|
1123
1338
|
var BOARD_STATUSES = ["todo", "doing", "blocked", "done"];
|
|
1124
|
-
var BoardStatusSchema =
|
|
1125
|
-
var BoardCountsSchema =
|
|
1126
|
-
todo:
|
|
1127
|
-
doing:
|
|
1128
|
-
blocked:
|
|
1129
|
-
done:
|
|
1130
|
-
});
|
|
1131
|
-
var BoardSchema =
|
|
1339
|
+
var BoardStatusSchema = z10.enum(BOARD_STATUSES);
|
|
1340
|
+
var BoardCountsSchema = z10.object({
|
|
1341
|
+
todo: z10.number().int().nonnegative(),
|
|
1342
|
+
doing: z10.number().int().nonnegative(),
|
|
1343
|
+
blocked: z10.number().int().nonnegative(),
|
|
1344
|
+
done: z10.number().int().nonnegative()
|
|
1345
|
+
});
|
|
1346
|
+
var BoardSchema = z10.object({
|
|
1132
1347
|
id: idOf("brd"),
|
|
1133
|
-
object:
|
|
1348
|
+
object: z10.literal("board"),
|
|
1134
1349
|
agent_id: idOf("agt"),
|
|
1135
1350
|
cards: BoardCountsSchema,
|
|
1136
1351
|
created_at: Timestamp
|
|
1137
1352
|
});
|
|
1138
|
-
var BoardCardSchema =
|
|
1353
|
+
var BoardCardSchema = z10.object({
|
|
1139
1354
|
id: idOf("crd"),
|
|
1140
|
-
object:
|
|
1355
|
+
object: z10.literal("board_card"),
|
|
1141
1356
|
board_id: idOf("brd"),
|
|
1142
|
-
title:
|
|
1357
|
+
title: z10.string().min(1),
|
|
1143
1358
|
/** The brief — what was asked. */
|
|
1144
|
-
body:
|
|
1359
|
+
body: z10.string(),
|
|
1145
1360
|
/** What the holder wrote back; a `done` carries one. */
|
|
1146
|
-
note:
|
|
1361
|
+
note: z10.string().nullable().default(null),
|
|
1147
1362
|
status: BoardStatusSchema,
|
|
1148
|
-
assignee:
|
|
1363
|
+
assignee: z10.string().nullable(),
|
|
1149
1364
|
/** The cards this one waits on. A `blocked` card with an empty list is stuck on the world. */
|
|
1150
|
-
blocked_by:
|
|
1365
|
+
blocked_by: z10.array(idOf("crd")),
|
|
1151
1366
|
// The wake fields default on read: a reader whose API predates one still gets the card (§28.11).
|
|
1152
1367
|
woken_session_id: idOf("ses").nullable().default(null),
|
|
1153
1368
|
reported_status: BoardStatusSchema.nullable().default(null),
|
|
1154
1369
|
/** Sessions the board has started for this card; the third is its last (§28.18). */
|
|
1155
|
-
wake_count:
|
|
1370
|
+
wake_count: z10.number().int().nonnegative().default(0),
|
|
1156
1371
|
created_at: Timestamp,
|
|
1157
1372
|
updated_at: Timestamp
|
|
1158
1373
|
});
|
|
1159
|
-
var BoardCommentSchema =
|
|
1374
|
+
var BoardCommentSchema = z10.object({
|
|
1160
1375
|
id: idOf("bcm"),
|
|
1161
|
-
object:
|
|
1376
|
+
object: z10.literal("board_comment"),
|
|
1162
1377
|
card_id: idOf("crd"),
|
|
1163
1378
|
/**
|
|
1164
1379
|
* Who wrote it, as an id the server derived — never a name the caller supplied. A member's
|
|
@@ -1166,42 +1381,42 @@ var BoardCommentSchema = z9.object({
|
|
|
1166
1381
|
* `key_` principal. The prefix is what lets a reader tell an agent's comment from a person's,
|
|
1167
1382
|
* which is the distinction a free-text author field could not make and could be used to forge.
|
|
1168
1383
|
*/
|
|
1169
|
-
author:
|
|
1170
|
-
body:
|
|
1384
|
+
author: z10.string(),
|
|
1385
|
+
body: z10.string(),
|
|
1171
1386
|
created_at: Timestamp
|
|
1172
1387
|
});
|
|
1173
1388
|
|
|
1174
1389
|
// ../core/src/schema/identity.ts
|
|
1175
|
-
import { z as
|
|
1390
|
+
import { z as z11 } from "zod";
|
|
1176
1391
|
var IDENTITY_NAME_MAX = 128;
|
|
1177
1392
|
var IDENTITY_DESCRIPTION_MAX = 1024;
|
|
1178
|
-
var IdentitySchema =
|
|
1393
|
+
var IdentitySchema = z11.object({
|
|
1179
1394
|
id: idOf("idn"),
|
|
1180
|
-
object:
|
|
1395
|
+
object: z11.literal("identity"),
|
|
1181
1396
|
/** Human-facing persona name. Surfaced to the model so it acts in character. */
|
|
1182
|
-
name:
|
|
1397
|
+
name: z11.string().min(1).max(IDENTITY_NAME_MAX),
|
|
1183
1398
|
/** What the persona is for. The model reads it to choose tone, scope and endpoint. */
|
|
1184
|
-
description:
|
|
1399
|
+
description: z11.string().max(IDENTITY_DESCRIPTION_MAX).nullable(),
|
|
1185
1400
|
/** Inbox addresses (`localpart@domain`) this identity owns. */
|
|
1186
|
-
emails:
|
|
1401
|
+
emails: z11.array(z11.string()),
|
|
1187
1402
|
/** Provisioned numbers in E.164. */
|
|
1188
|
-
phones:
|
|
1403
|
+
phones: z11.array(z11.string()),
|
|
1189
1404
|
/** Verified web domains reachable through this identity's inboxes. */
|
|
1190
|
-
domains:
|
|
1405
|
+
domains: z11.array(z11.string()),
|
|
1191
1406
|
/** `conn_` ids of authorized third-party connections. */
|
|
1192
|
-
connections:
|
|
1407
|
+
connections: z11.array(z11.string()),
|
|
1193
1408
|
metadata: Metadata,
|
|
1194
1409
|
created_at: Timestamp,
|
|
1195
1410
|
updated_at: Timestamp
|
|
1196
1411
|
});
|
|
1197
1412
|
|
|
1198
1413
|
// ../core/src/schema/resource.ts
|
|
1199
|
-
import { z as
|
|
1414
|
+
import { z as z13 } from "zod";
|
|
1200
1415
|
|
|
1201
1416
|
// ../core/src/schema/files-library.ts
|
|
1202
|
-
import { z as
|
|
1417
|
+
import { z as z12 } from "zod";
|
|
1203
1418
|
var FILE_KINDS = ["image", "video", "audio", "document", "other"];
|
|
1204
|
-
var FileKindSchema =
|
|
1419
|
+
var FileKindSchema = z12.enum(FILE_KINDS);
|
|
1205
1420
|
var FILE_SOURCE_TYPES = [
|
|
1206
1421
|
"upload",
|
|
1207
1422
|
"url_import",
|
|
@@ -1211,53 +1426,53 @@ var FILE_SOURCE_TYPES = [
|
|
|
1211
1426
|
"screenshot",
|
|
1212
1427
|
"speech_generation"
|
|
1213
1428
|
];
|
|
1214
|
-
var FileSourceTypeSchema =
|
|
1215
|
-
var FileSourceSchema =
|
|
1429
|
+
var FileSourceTypeSchema = z12.enum(FILE_SOURCE_TYPES);
|
|
1430
|
+
var FileSourceSchema = z12.object({
|
|
1216
1431
|
type: FileSourceTypeSchema,
|
|
1217
|
-
job_id:
|
|
1218
|
-
url:
|
|
1432
|
+
job_id: z12.union([idOf("med"), idOf("clj")]).nullable(),
|
|
1433
|
+
url: z12.string().url().nullable(),
|
|
1219
1434
|
/** What a generator was asked with (§36.1, ADR-0886); absent on every other writer's row. */
|
|
1220
|
-
model:
|
|
1221
|
-
prompt:
|
|
1435
|
+
model: z12.string().nullable().optional(),
|
|
1436
|
+
prompt: z12.string().nullable().optional()
|
|
1222
1437
|
});
|
|
1223
|
-
var FileTagsSchema =
|
|
1224
|
-
var FileLibraryFieldsSchema =
|
|
1225
|
-
title:
|
|
1226
|
-
description:
|
|
1438
|
+
var FileTagsSchema = z12.array(z12.string().min(1).max(64)).max(32);
|
|
1439
|
+
var FileLibraryFieldsSchema = z12.object({
|
|
1440
|
+
title: z12.string().max(256).nullable().default(null),
|
|
1441
|
+
description: z12.string().max(4096).nullable().default(null),
|
|
1227
1442
|
tags: FileTagsSchema.default([]),
|
|
1228
1443
|
kind: FileKindSchema.default("other"),
|
|
1229
1444
|
source: FileSourceSchema.nullable().default(null),
|
|
1230
1445
|
thumbnail_file_id: idOf("fil").nullable().default(null),
|
|
1231
|
-
width:
|
|
1232
|
-
height:
|
|
1233
|
-
duration_seconds:
|
|
1446
|
+
width: z12.number().int().positive().nullable().default(null),
|
|
1447
|
+
height: z12.number().int().positive().nullable().default(null),
|
|
1448
|
+
duration_seconds: z12.number().nonnegative().nullable().default(null)
|
|
1234
1449
|
});
|
|
1235
|
-
var UpdateFileSchema =
|
|
1236
|
-
title:
|
|
1237
|
-
description:
|
|
1450
|
+
var UpdateFileSchema = z12.object({
|
|
1451
|
+
title: z12.string().max(256).nullable().optional(),
|
|
1452
|
+
description: z12.string().max(4096).nullable().optional(),
|
|
1238
1453
|
tags: FileTagsSchema.optional()
|
|
1239
1454
|
});
|
|
1240
|
-
var ImportFileSchema =
|
|
1241
|
-
url:
|
|
1242
|
-
title:
|
|
1243
|
-
description:
|
|
1455
|
+
var ImportFileSchema = z12.object({
|
|
1456
|
+
url: z12.string().url().startsWith("http"),
|
|
1457
|
+
title: z12.string().max(256).optional(),
|
|
1458
|
+
description: z12.string().max(4096).optional(),
|
|
1244
1459
|
tags: FileTagsSchema.optional()
|
|
1245
1460
|
});
|
|
1246
1461
|
|
|
1247
1462
|
// ../core/src/schema/resource.ts
|
|
1248
|
-
var ComputerStatusSchema =
|
|
1249
|
-
var VolumeSchema =
|
|
1463
|
+
var ComputerStatusSchema = z13.enum(["creating", "running", "paused", "failed", "destroyed"]);
|
|
1464
|
+
var VolumeSchema = z13.object({
|
|
1250
1465
|
id: idOf("vol"),
|
|
1251
|
-
size_gb:
|
|
1252
|
-
mount_path:
|
|
1466
|
+
size_gb: z13.number().int().positive(),
|
|
1467
|
+
mount_path: z13.string()
|
|
1253
1468
|
});
|
|
1254
|
-
var ComputerSchema =
|
|
1469
|
+
var ComputerSchema = z13.object({
|
|
1255
1470
|
id: idOf("cmp"),
|
|
1256
|
-
object:
|
|
1257
|
-
name:
|
|
1258
|
-
vcpu:
|
|
1259
|
-
memory_mb:
|
|
1260
|
-
disk_gb:
|
|
1471
|
+
object: z13.literal("computer"),
|
|
1472
|
+
name: z13.string(),
|
|
1473
|
+
vcpu: z13.number().int().positive(),
|
|
1474
|
+
memory_mb: z13.number().int().positive(),
|
|
1475
|
+
disk_gb: z13.number().int().positive(),
|
|
1261
1476
|
status: ComputerStatusSchema,
|
|
1262
1477
|
// core-gaps: U2-browser-api — the whole option object (§32.2); `{ allowed_domains }` still parses.
|
|
1263
1478
|
browser: BrowserOptionsSchema.nullable(),
|
|
@@ -1270,127 +1485,127 @@ var ComputerSchema = z12.object({
|
|
|
1270
1485
|
agent_id: idOf("agt").nullable().default(null),
|
|
1271
1486
|
created_at: Timestamp
|
|
1272
1487
|
});
|
|
1273
|
-
var SnapshotSchema =
|
|
1488
|
+
var SnapshotSchema = z13.object({
|
|
1274
1489
|
snapshot_id: idOf("snp"),
|
|
1275
1490
|
computer_id: idOf("cmp"),
|
|
1276
1491
|
created_at: Timestamp
|
|
1277
1492
|
});
|
|
1278
|
-
var ComputerProbeSchema =
|
|
1493
|
+
var ComputerProbeSchema = z13.object({
|
|
1279
1494
|
sampled_at: Timestamp,
|
|
1280
|
-
uptime_seconds:
|
|
1281
|
-
processes:
|
|
1282
|
-
load_1m:
|
|
1283
|
-
memory_used_mb:
|
|
1284
|
-
memory_total_mb:
|
|
1285
|
-
disk_used_gb:
|
|
1286
|
-
disk_total_gb:
|
|
1287
|
-
});
|
|
1288
|
-
var ComputerInspectSchema =
|
|
1289
|
-
object:
|
|
1495
|
+
uptime_seconds: z13.number().int().nonnegative(),
|
|
1496
|
+
processes: z13.number().int().nonnegative(),
|
|
1497
|
+
load_1m: z13.number().nonnegative(),
|
|
1498
|
+
memory_used_mb: z13.number().int().nonnegative(),
|
|
1499
|
+
memory_total_mb: z13.number().int().positive(),
|
|
1500
|
+
disk_used_gb: z13.number().nonnegative(),
|
|
1501
|
+
disk_total_gb: z13.number().positive()
|
|
1502
|
+
});
|
|
1503
|
+
var ComputerInspectSchema = z13.object({
|
|
1504
|
+
object: z13.literal("computer_inspect"),
|
|
1290
1505
|
id: idOf("cmp"),
|
|
1291
1506
|
status: ComputerStatusSchema,
|
|
1292
1507
|
last_active_at: Timestamp.nullable(),
|
|
1293
1508
|
/** Where the provider's file API is rooted (§41.1); `null` when it does not say. */
|
|
1294
|
-
home:
|
|
1509
|
+
home: z13.string().min(1).nullable(),
|
|
1295
1510
|
probe: ComputerProbeSchema.nullable()
|
|
1296
1511
|
});
|
|
1297
1512
|
var COMMAND_OUTPUT_CAP = 65536;
|
|
1298
|
-
var ComputerCommandSchema =
|
|
1513
|
+
var ComputerCommandSchema = z13.object({
|
|
1299
1514
|
id: idOf("cmd"),
|
|
1300
|
-
object:
|
|
1515
|
+
object: z13.literal("computer_command"),
|
|
1301
1516
|
computer_id: idOf("cmp"),
|
|
1302
|
-
command:
|
|
1303
|
-
exit_code:
|
|
1304
|
-
timed_out:
|
|
1305
|
-
duration_ms:
|
|
1306
|
-
stdout:
|
|
1307
|
-
stderr:
|
|
1308
|
-
truncated:
|
|
1517
|
+
command: z13.string(),
|
|
1518
|
+
exit_code: z13.number().int().nullable(),
|
|
1519
|
+
timed_out: z13.boolean(),
|
|
1520
|
+
duration_ms: z13.number().int().nonnegative(),
|
|
1521
|
+
stdout: z13.string().max(COMMAND_OUTPUT_CAP),
|
|
1522
|
+
stderr: z13.string().max(COMMAND_OUTPUT_CAP),
|
|
1523
|
+
truncated: z13.boolean(),
|
|
1309
1524
|
actor: PrincipalSchema,
|
|
1310
1525
|
created_at: Timestamp
|
|
1311
1526
|
});
|
|
1312
|
-
var ExecStreamFrameSchema =
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
exit:
|
|
1317
|
-
exit_code:
|
|
1318
|
-
timed_out:
|
|
1319
|
-
duration_ms:
|
|
1527
|
+
var ExecStreamFrameSchema = z13.union([
|
|
1528
|
+
z13.object({ stdout: z13.string() }),
|
|
1529
|
+
z13.object({ stderr: z13.string() }),
|
|
1530
|
+
z13.object({
|
|
1531
|
+
exit: z13.object({
|
|
1532
|
+
exit_code: z13.number().int().nullable(),
|
|
1533
|
+
timed_out: z13.boolean(),
|
|
1534
|
+
duration_ms: z13.number().int().nonnegative(),
|
|
1320
1535
|
command_id: idOf("cmd")
|
|
1321
1536
|
})
|
|
1322
1537
|
})
|
|
1323
1538
|
]);
|
|
1324
|
-
var FileEntryTypeSchema =
|
|
1325
|
-
var FileEntrySchema =
|
|
1326
|
-
name:
|
|
1327
|
-
path:
|
|
1539
|
+
var FileEntryTypeSchema = z13.enum(["file", "directory", "symlink", "other"]);
|
|
1540
|
+
var FileEntrySchema = z13.object({
|
|
1541
|
+
name: z13.string().min(1),
|
|
1542
|
+
path: z13.string().min(1),
|
|
1328
1543
|
type: FileEntryTypeSchema,
|
|
1329
|
-
size_bytes:
|
|
1544
|
+
size_bytes: z13.number().int().nonnegative(),
|
|
1330
1545
|
/** POSIX `st_mode`. */
|
|
1331
|
-
mode:
|
|
1546
|
+
mode: z13.number().int().nonnegative(),
|
|
1332
1547
|
modified_at: Timestamp.nullable()
|
|
1333
1548
|
});
|
|
1334
|
-
var ComputerUpdateSchema =
|
|
1335
|
-
var SkillSchema =
|
|
1549
|
+
var ComputerUpdateSchema = z13.strictObject({ name: z13.string().min(1).max(200) });
|
|
1550
|
+
var SkillSchema = z13.object({
|
|
1336
1551
|
id: idOf("skl"),
|
|
1337
|
-
object:
|
|
1338
|
-
name:
|
|
1339
|
-
description:
|
|
1340
|
-
latest_version:
|
|
1552
|
+
object: z13.literal("skill"),
|
|
1553
|
+
name: z13.string(),
|
|
1554
|
+
description: z13.string().nullable(),
|
|
1555
|
+
latest_version: z13.number().int().positive(),
|
|
1341
1556
|
created_at: Timestamp
|
|
1342
1557
|
});
|
|
1343
|
-
var ResolvedSkillRefSchema =
|
|
1558
|
+
var ResolvedSkillRefSchema = z13.object({
|
|
1344
1559
|
/** The reference exactly as the agent version wrote it: `slug` or `slug@N`. */
|
|
1345
|
-
ref:
|
|
1346
|
-
slug:
|
|
1347
|
-
version:
|
|
1348
|
-
description:
|
|
1349
|
-
storage_key:
|
|
1350
|
-
});
|
|
1351
|
-
var SkillVersionSchema =
|
|
1352
|
-
version:
|
|
1353
|
-
sha256:
|
|
1354
|
-
size_bytes:
|
|
1560
|
+
ref: z13.string().min(1),
|
|
1561
|
+
slug: z13.string().min(1),
|
|
1562
|
+
version: z13.number().int().positive(),
|
|
1563
|
+
description: z13.string(),
|
|
1564
|
+
storage_key: z13.string().min(1)
|
|
1565
|
+
});
|
|
1566
|
+
var SkillVersionSchema = z13.object({
|
|
1567
|
+
version: z13.number().int().positive(),
|
|
1568
|
+
sha256: z13.string().regex(/^[0-9a-f]{64}$/),
|
|
1569
|
+
size_bytes: z13.number().int().nonnegative(),
|
|
1355
1570
|
created_at: Timestamp
|
|
1356
1571
|
});
|
|
1357
|
-
var SkillCatalogEntrySchema =
|
|
1358
|
-
object:
|
|
1359
|
-
slug:
|
|
1360
|
-
version:
|
|
1361
|
-
name:
|
|
1362
|
-
description:
|
|
1363
|
-
tags:
|
|
1364
|
-
content_hash:
|
|
1572
|
+
var SkillCatalogEntrySchema = z13.object({
|
|
1573
|
+
object: z13.literal("skill_catalog_entry"),
|
|
1574
|
+
slug: z13.string().regex(/^[a-z0-9][a-z0-9-]*$/),
|
|
1575
|
+
version: z13.number().int().positive(),
|
|
1576
|
+
name: z13.string().min(1),
|
|
1577
|
+
description: z13.string(),
|
|
1578
|
+
tags: z13.array(z13.string().min(1)),
|
|
1579
|
+
content_hash: z13.string().regex(/^[0-9a-f]{64}$/),
|
|
1365
1580
|
published_at: Timestamp
|
|
1366
1581
|
});
|
|
1367
|
-
var SkillCatalogVersionSchema = SkillCatalogEntrySchema.extend({ content:
|
|
1368
|
-
var FileSchema =
|
|
1582
|
+
var SkillCatalogVersionSchema = SkillCatalogEntrySchema.extend({ content: z13.string() });
|
|
1583
|
+
var FileSchema = z13.object({
|
|
1369
1584
|
id: idOf("fil"),
|
|
1370
|
-
object:
|
|
1371
|
-
name:
|
|
1372
|
-
content_type:
|
|
1373
|
-
size_bytes:
|
|
1374
|
-
scope:
|
|
1585
|
+
object: z13.literal("file"),
|
|
1586
|
+
name: z13.string(),
|
|
1587
|
+
content_type: z13.string(),
|
|
1588
|
+
size_bytes: z13.number().int().nonnegative(),
|
|
1589
|
+
scope: z13.enum(["session", "published"]),
|
|
1375
1590
|
session_id: idOf("ses").nullable(),
|
|
1376
|
-
sha256:
|
|
1591
|
+
sha256: z13.string().regex(/^[0-9a-f]{64}$/),
|
|
1377
1592
|
created_at: Timestamp,
|
|
1378
1593
|
// The asset-library fields (`canonical-spec §36.1`), all nullable or defaulted.
|
|
1379
1594
|
...FileLibraryFieldsSchema.shape,
|
|
1380
1595
|
/** The agent of `session_id`, joined at read (§36.1, ADR-0887); a writer never sets it. */
|
|
1381
1596
|
agent_id: idOf("agt").nullable().optional()
|
|
1382
1597
|
});
|
|
1383
|
-
var ScheduleStatusSchema =
|
|
1384
|
-
var DeploymentSchema =
|
|
1598
|
+
var ScheduleStatusSchema = z13.enum(["scheduled", "paused", "unscheduled"]);
|
|
1599
|
+
var DeploymentSchema = z13.object({
|
|
1385
1600
|
id: idOf("dep"),
|
|
1386
|
-
object:
|
|
1601
|
+
object: z13.literal("deployment"),
|
|
1387
1602
|
agent_id: idOf("agt"),
|
|
1388
1603
|
/** A pin. `null` tracks the agent's `current_version` on every fire (§12). */
|
|
1389
|
-
agent_version:
|
|
1390
|
-
cron:
|
|
1604
|
+
agent_version: z13.number().int().positive().nullable(),
|
|
1605
|
+
cron: z13.string(),
|
|
1391
1606
|
/** IANA zone the `cron` is read in. "0 9 * * 1" means 09:00 *here*, across DST (ADR-0074). */
|
|
1392
|
-
timezone:
|
|
1393
|
-
input_template:
|
|
1607
|
+
timezone: z13.string(),
|
|
1608
|
+
input_template: z13.string(),
|
|
1394
1609
|
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
1395
1610
|
window: WindowSchema,
|
|
1396
1611
|
/**
|
|
@@ -1400,21 +1615,21 @@ var DeploymentSchema = z12.object({
|
|
|
1400
1615
|
* those endpoints, and a signed delivery over cleartext is not a delivery. Until the push was
|
|
1401
1616
|
* wired this field went nowhere, so nothing can be relying on an `http://` value (ADR-0161).
|
|
1402
1617
|
*/
|
|
1403
|
-
on_idle:
|
|
1618
|
+
on_idle: z13.url().startsWith("https://", { error: "a webhook URL must be https" }).nullable(),
|
|
1404
1619
|
/**
|
|
1405
1620
|
* The persona every fire speaks as, or `null` to run as nobody (§22). Written as an `idn_` id
|
|
1406
1621
|
* **or** the persona's name, the way a session names one, and always echoed as the id: a fire at
|
|
1407
1622
|
* 3am must not be silenced by someone renaming the persona at noon.
|
|
1408
1623
|
*/
|
|
1409
1624
|
identity: idOf("idn").nullable(),
|
|
1410
|
-
enabled:
|
|
1625
|
+
enabled: z13.boolean(),
|
|
1411
1626
|
/** Derived per deploy, never stored — the row cannot know whether a clock is watching it. */
|
|
1412
1627
|
schedule_status: ScheduleStatusSchema,
|
|
1413
1628
|
/** The next fire, or `null` when nothing will fire it (`schedule_status` says which). */
|
|
1414
1629
|
next_run_at: Timestamp.nullable(),
|
|
1415
1630
|
created_at: Timestamp
|
|
1416
1631
|
});
|
|
1417
|
-
var DeploymentRunSchema =
|
|
1632
|
+
var DeploymentRunSchema = z13.object({
|
|
1418
1633
|
id: idOf("run"),
|
|
1419
1634
|
session_id: idOf("ses"),
|
|
1420
1635
|
status: SessionStatusSchema,
|
|
@@ -1422,62 +1637,62 @@ var DeploymentRunSchema = z12.object({
|
|
|
1422
1637
|
});
|
|
1423
1638
|
|
|
1424
1639
|
// ../core/src/schema/comms.ts
|
|
1425
|
-
import { z as
|
|
1426
|
-
var DomainKindSchema =
|
|
1427
|
-
var DomainStatusSchema =
|
|
1428
|
-
var DomainDnsStatusSchema =
|
|
1429
|
-
var DomainInboundStatusSchema =
|
|
1430
|
-
var DomainAppConnectStatusSchema =
|
|
1431
|
-
var DnsRecordSchema =
|
|
1432
|
-
type:
|
|
1433
|
-
host:
|
|
1434
|
-
value:
|
|
1435
|
-
priority:
|
|
1640
|
+
import { z as z14 } from "zod";
|
|
1641
|
+
var DomainKindSchema = z14.enum(["system", "external", "purchased"]);
|
|
1642
|
+
var DomainStatusSchema = z14.enum(["pending_dns", "active", "failed"]);
|
|
1643
|
+
var DomainDnsStatusSchema = z14.enum(["pending_verification", "provisioned", "failed"]);
|
|
1644
|
+
var DomainInboundStatusSchema = z14.enum(["pending", "verified", "failed"]);
|
|
1645
|
+
var DomainAppConnectStatusSchema = z14.enum(["pending", "connected", "failed"]);
|
|
1646
|
+
var DnsRecordSchema = z14.object({
|
|
1647
|
+
type: z14.enum(["TXT", "CNAME", "MX"]),
|
|
1648
|
+
host: z14.string(),
|
|
1649
|
+
value: z14.string(),
|
|
1650
|
+
priority: z14.number().int().nullable(),
|
|
1436
1651
|
/** Vetta owns this record: `_dmarc`, DKIM, inbound MX. The agent may read it, never write it. */
|
|
1437
|
-
managed:
|
|
1652
|
+
managed: z14.boolean()
|
|
1438
1653
|
});
|
|
1439
|
-
var DomainSchema =
|
|
1654
|
+
var DomainSchema = z14.object({
|
|
1440
1655
|
id: idOf("dom"),
|
|
1441
|
-
object:
|
|
1656
|
+
object: z14.literal("domain"),
|
|
1442
1657
|
/** A domain belongs to the **organization**, not to one identity: two identities share one. */
|
|
1443
|
-
name:
|
|
1658
|
+
name: z14.string(),
|
|
1444
1659
|
kind: DomainKindSchema,
|
|
1445
1660
|
status: DomainStatusSchema,
|
|
1446
1661
|
dns_status: DomainDnsStatusSchema,
|
|
1447
1662
|
inbound_status: DomainInboundStatusSchema,
|
|
1448
1663
|
app_connect_status: DomainAppConnectStatusSchema,
|
|
1449
|
-
records:
|
|
1664
|
+
records: z14.array(DnsRecordSchema),
|
|
1450
1665
|
last_verified_at: Timestamp.nullable(),
|
|
1451
1666
|
created_at: Timestamp
|
|
1452
1667
|
});
|
|
1453
|
-
var EmailInboxSchema =
|
|
1668
|
+
var EmailInboxSchema = z14.object({
|
|
1454
1669
|
id: idOf("eml"),
|
|
1455
|
-
object:
|
|
1670
|
+
object: z14.literal("email_inbox"),
|
|
1456
1671
|
identity_id: idOf("idn"),
|
|
1457
1672
|
domain_id: idOf("dom"),
|
|
1458
|
-
address:
|
|
1459
|
-
localpart:
|
|
1673
|
+
address: z14.string(),
|
|
1674
|
+
localpart: z14.string(),
|
|
1460
1675
|
/** Inbound routing keys off this: mail to the address wakes exactly this agent. */
|
|
1461
1676
|
owning_agent_id: idOf("agt"),
|
|
1462
|
-
status:
|
|
1677
|
+
status: z14.enum(["active", "disabled"]),
|
|
1463
1678
|
created_at: Timestamp
|
|
1464
1679
|
});
|
|
1465
|
-
var PhoneTierSchema =
|
|
1466
|
-
var BrandStatusSchema =
|
|
1467
|
-
var CampaignStatusSchema =
|
|
1468
|
-
var PhoneNumberSchema =
|
|
1680
|
+
var PhoneTierSchema = z14.enum(["sole_prop", "standard"]);
|
|
1681
|
+
var BrandStatusSchema = z14.enum(["none", "pending_verification", "verified", "rejected"]);
|
|
1682
|
+
var CampaignStatusSchema = z14.enum(["none", "pending", "approved", "rejected"]);
|
|
1683
|
+
var PhoneNumberSchema = z14.object({
|
|
1469
1684
|
id: idOf("pho"),
|
|
1470
|
-
object:
|
|
1685
|
+
object: z14.literal("phone_number"),
|
|
1471
1686
|
identity_id: idOf("idn"),
|
|
1472
|
-
e164:
|
|
1473
|
-
country:
|
|
1474
|
-
capabilities:
|
|
1687
|
+
e164: z14.string(),
|
|
1688
|
+
country: z14.string(),
|
|
1689
|
+
capabilities: z14.object({
|
|
1475
1690
|
/** Live the moment the number is bought — inbound never waits on carrier registration. */
|
|
1476
|
-
sms_inbound:
|
|
1691
|
+
sms_inbound: z14.boolean(),
|
|
1477
1692
|
/** True **iff** `campaign_status === "approved"`. Nothing else may set it. */
|
|
1478
|
-
sms_outbound:
|
|
1693
|
+
sms_outbound: z14.boolean(),
|
|
1479
1694
|
/** Voice is not a P2 capability; the field exists so its absence is explicit. */
|
|
1480
|
-
voice:
|
|
1695
|
+
voice: z14.literal(false)
|
|
1481
1696
|
}),
|
|
1482
1697
|
tier: PhoneTierSchema,
|
|
1483
1698
|
brand_status: BrandStatusSchema,
|
|
@@ -1485,19 +1700,19 @@ var PhoneNumberSchema = z13.object({
|
|
|
1485
1700
|
provisioned_at: Timestamp.nullable(),
|
|
1486
1701
|
created_at: Timestamp
|
|
1487
1702
|
});
|
|
1488
|
-
var InboundMessageSchema =
|
|
1703
|
+
var InboundMessageSchema = z14.object({
|
|
1489
1704
|
id: idOf("inb"),
|
|
1490
|
-
object:
|
|
1491
|
-
channel:
|
|
1705
|
+
object: z14.literal("inbound_message"),
|
|
1706
|
+
channel: z14.enum(["email", "sms"]),
|
|
1492
1707
|
identity_id: idOf("idn"),
|
|
1493
1708
|
/** The `eml_`/`pho_` endpoint it arrived at — the persona is decided by *where*, not by *who*. */
|
|
1494
|
-
endpoint_id:
|
|
1495
|
-
from:
|
|
1496
|
-
to:
|
|
1497
|
-
subject:
|
|
1498
|
-
text:
|
|
1709
|
+
endpoint_id: z14.string(),
|
|
1710
|
+
from: z14.string(),
|
|
1711
|
+
to: z14.string(),
|
|
1712
|
+
subject: z14.string().nullable(),
|
|
1713
|
+
text: z14.string(),
|
|
1499
1714
|
/** SPF/DKIM/DMARC for mail, carrier origin for SMS. Kept for the audit of why it was accepted. */
|
|
1500
|
-
auth:
|
|
1715
|
+
auth: z14.record(z14.string(), z14.string()),
|
|
1501
1716
|
/** The session this message woke. Null until the wake seam lands (see ADR-0120). */
|
|
1502
1717
|
session_id: idOf("ses").nullable(),
|
|
1503
1718
|
received_at: Timestamp,
|
|
@@ -1507,44 +1722,44 @@ var InboundMessageSchema = z13.object({
|
|
|
1507
1722
|
*/
|
|
1508
1723
|
read_at: Timestamp.nullable().default(null)
|
|
1509
1724
|
});
|
|
1510
|
-
var OutboundMessageSchema =
|
|
1725
|
+
var OutboundMessageSchema = z14.object({
|
|
1511
1726
|
id: idOf("out"),
|
|
1512
|
-
object:
|
|
1727
|
+
object: z14.literal("outbound_message"),
|
|
1513
1728
|
channel: InboundMessageSchema.shape.channel,
|
|
1514
1729
|
identity_id: idOf("idn"),
|
|
1515
1730
|
/** The `eml_` endpoint it was sent from. */
|
|
1516
|
-
endpoint_id:
|
|
1517
|
-
from:
|
|
1518
|
-
to:
|
|
1519
|
-
subject:
|
|
1520
|
-
text:
|
|
1731
|
+
endpoint_id: z14.string(),
|
|
1732
|
+
from: z14.string(),
|
|
1733
|
+
to: z14.array(z14.string()),
|
|
1734
|
+
subject: z14.string().nullable(),
|
|
1735
|
+
text: z14.string(),
|
|
1521
1736
|
sent_by_agent_id: idOf("agt").nullable(),
|
|
1522
1737
|
actor: PrincipalSchema.nullable(),
|
|
1523
1738
|
sent_at: Timestamp
|
|
1524
1739
|
});
|
|
1525
1740
|
|
|
1526
1741
|
// ../core/src/schema/app.ts
|
|
1527
|
-
import { z as
|
|
1528
|
-
var AppTypeSchema =
|
|
1529
|
-
var AppStatusSchema =
|
|
1530
|
-
var AppMcpPathSchema =
|
|
1531
|
-
var AppSchema =
|
|
1742
|
+
import { z as z15 } from "zod";
|
|
1743
|
+
var AppTypeSchema = z15.enum(["frontend_only", "fullstack"]);
|
|
1744
|
+
var AppStatusSchema = z15.enum(["provisioning", "active", "error"]);
|
|
1745
|
+
var AppMcpPathSchema = z15.string().regex(/^\/\S*$/, "must be an absolute path beginning with /").max(128);
|
|
1746
|
+
var AppSchema = z15.object({
|
|
1532
1747
|
id: idOf("app"),
|
|
1533
|
-
object:
|
|
1534
|
-
name:
|
|
1535
|
-
description:
|
|
1748
|
+
object: z15.literal("app"),
|
|
1749
|
+
name: z15.string(),
|
|
1750
|
+
description: z15.string().nullable(),
|
|
1536
1751
|
type: AppTypeSchema,
|
|
1537
1752
|
/**
|
|
1538
1753
|
* The customer's own project name that made this app, or `null` for one made outside a project
|
|
1539
1754
|
* (ADR-0375). Customer-visible, unlike the provider handles: it is the word the customer typed,
|
|
1540
1755
|
* and the refusal that guards a name quotes it.
|
|
1541
1756
|
*/
|
|
1542
|
-
project:
|
|
1757
|
+
project: z15.string().nullable(),
|
|
1543
1758
|
status: AppStatusSchema,
|
|
1544
1759
|
/** The address the app answers on — platform hostname until a custom domain connects. */
|
|
1545
|
-
url:
|
|
1760
|
+
url: z15.string().nullable(),
|
|
1546
1761
|
/** White-label words when `status` is `error`; never the provider's. */
|
|
1547
|
-
error:
|
|
1762
|
+
error: z15.string().nullable(),
|
|
1548
1763
|
/** Where the app serves MCP, or `null`. The bearer token for it is a server column. */
|
|
1549
1764
|
mcp: AppMcpPathSchema.nullable(),
|
|
1550
1765
|
/**
|
|
@@ -1552,80 +1767,80 @@ var AppSchema = z14.object({
|
|
|
1552
1767
|
* than linking its `url` (`§29.1`)? True when the platform holds the app's `DASHBOARD_TOKEN`
|
|
1553
1768
|
* or a secret of that name exists on the app; derived on read, never stored.
|
|
1554
1769
|
*/
|
|
1555
|
-
dashboard:
|
|
1770
|
+
dashboard: z15.boolean(),
|
|
1556
1771
|
created_at: Timestamp
|
|
1557
1772
|
});
|
|
1558
|
-
var AppDeploymentStatusSchema =
|
|
1559
|
-
var AppDeploymentSchema =
|
|
1773
|
+
var AppDeploymentStatusSchema = z15.enum(["queued", "building", "ready", "error"]);
|
|
1774
|
+
var AppDeploymentSchema = z15.object({
|
|
1560
1775
|
id: idOf("apd"),
|
|
1561
|
-
object:
|
|
1776
|
+
object: z15.literal("app_deployment"),
|
|
1562
1777
|
app_id: idOf("app"),
|
|
1563
1778
|
status: AppDeploymentStatusSchema,
|
|
1564
|
-
url:
|
|
1565
|
-
error:
|
|
1779
|
+
url: z15.string().nullable(),
|
|
1780
|
+
error: z15.string().nullable(),
|
|
1566
1781
|
/** The client's opaque digest of the files, echoed verbatim so it can skip an unchanged deploy. */
|
|
1567
|
-
content_hash:
|
|
1782
|
+
content_hash: z15.string().nullable(),
|
|
1568
1783
|
created_at: Timestamp
|
|
1569
1784
|
});
|
|
1570
|
-
var AppDeploymentFilesSchema =
|
|
1571
|
-
object:
|
|
1785
|
+
var AppDeploymentFilesSchema = z15.object({
|
|
1786
|
+
object: z15.literal("app_deployment_files"),
|
|
1572
1787
|
deployment_id: idOf("apd"),
|
|
1573
|
-
files:
|
|
1788
|
+
files: z15.record(z15.string().min(1), z15.string())
|
|
1574
1789
|
});
|
|
1575
|
-
var AppSecretSchema =
|
|
1576
|
-
object:
|
|
1577
|
-
name:
|
|
1790
|
+
var AppSecretSchema = z15.object({
|
|
1791
|
+
object: z15.literal("app_secret"),
|
|
1792
|
+
name: z15.string(),
|
|
1578
1793
|
/** The client's opaque digest of the value, echoed verbatim so it can skip an unchanged write. */
|
|
1579
|
-
value_hash:
|
|
1794
|
+
value_hash: z15.string().nullable(),
|
|
1580
1795
|
created_at: Timestamp
|
|
1581
1796
|
});
|
|
1582
|
-
var AppEntrySchema =
|
|
1583
|
-
object:
|
|
1584
|
-
url:
|
|
1585
|
-
ticket:
|
|
1797
|
+
var AppEntrySchema = z15.object({
|
|
1798
|
+
object: z15.literal("app_entry"),
|
|
1799
|
+
url: z15.string(),
|
|
1800
|
+
ticket: z15.string()
|
|
1586
1801
|
});
|
|
1587
|
-
var AppAccessSchema =
|
|
1588
|
-
object:
|
|
1589
|
-
url:
|
|
1590
|
-
password:
|
|
1802
|
+
var AppAccessSchema = z15.object({
|
|
1803
|
+
object: z15.literal("app_access"),
|
|
1804
|
+
url: z15.string().nullable(),
|
|
1805
|
+
password: z15.string().nullable()
|
|
1591
1806
|
});
|
|
1592
|
-
var AppDomainStatusSchema =
|
|
1593
|
-
var AppDomainSchema =
|
|
1594
|
-
object:
|
|
1807
|
+
var AppDomainStatusSchema = z15.enum(["pending", "connected", "failed"]);
|
|
1808
|
+
var AppDomainSchema = z15.object({
|
|
1809
|
+
object: z15.literal("app_domain"),
|
|
1595
1810
|
app_id: idOf("app"),
|
|
1596
1811
|
domain_id: idOf("dom"),
|
|
1597
|
-
domain:
|
|
1812
|
+
domain: z15.string(),
|
|
1598
1813
|
status: AppDomainStatusSchema,
|
|
1599
1814
|
created_at: Timestamp
|
|
1600
1815
|
});
|
|
1601
1816
|
var ENV_NAME = /^[A-Z_][A-Z0-9_]*$/;
|
|
1602
1817
|
var APP_NAME = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
1603
|
-
var AppPermissionsSchema =
|
|
1604
|
-
object:
|
|
1818
|
+
var AppPermissionsSchema = z15.object({
|
|
1819
|
+
object: z15.literal("app_permissions"),
|
|
1605
1820
|
app_id: idOf("app"),
|
|
1606
|
-
scopes:
|
|
1821
|
+
scopes: z15.array(z15.string())
|
|
1607
1822
|
});
|
|
1608
1823
|
|
|
1609
1824
|
// ../core/src/schema/install.ts
|
|
1610
|
-
import { z as
|
|
1611
|
-
var BlueprintInstallSourceSchema =
|
|
1612
|
-
var BlueprintInstallStatusSchema =
|
|
1613
|
-
var ResourceActionSchema =
|
|
1614
|
-
var ResourceReportSchema =
|
|
1615
|
-
name:
|
|
1825
|
+
import { z as z16 } from "zod";
|
|
1826
|
+
var BlueprintInstallSourceSchema = z16.enum(["studio", "cli"]);
|
|
1827
|
+
var BlueprintInstallStatusSchema = z16.enum(["held", "pending", "applied", "failed"]);
|
|
1828
|
+
var ResourceActionSchema = z16.enum(["created", "updated", "unchanged", "deleted", "refused"]);
|
|
1829
|
+
var ResourceReportSchema = z16.object({
|
|
1830
|
+
name: z16.string().min(1),
|
|
1616
1831
|
action: ResourceActionSchema,
|
|
1617
1832
|
/** The `agt_`/`app_`/`ses_`… the line resolved to. Absent on a refusal that never got an id. */
|
|
1618
|
-
id:
|
|
1833
|
+
id: z16.string().optional(),
|
|
1619
1834
|
/** An app's hostname once its build went live; `null` while it has none. Apps only. */
|
|
1620
|
-
url:
|
|
1835
|
+
url: z16.string().nullable().optional(),
|
|
1621
1836
|
/**
|
|
1622
1837
|
* What a TASK is called and who owes it. `name` is the declaration key (`first-render`), which is
|
|
1623
1838
|
* how a re-apply finds the same card and is not a sentence anybody wants read to them. The
|
|
1624
1839
|
* dashboard's opening message lists the team's work, so it needs the title the board shows and the
|
|
1625
1840
|
* seat that holds it. Tasks only.
|
|
1626
1841
|
*/
|
|
1627
|
-
title:
|
|
1628
|
-
assignee:
|
|
1842
|
+
title: z16.string().optional(),
|
|
1843
|
+
assignee: z16.string().optional(),
|
|
1629
1844
|
/**
|
|
1630
1845
|
* A SCHEDULE'S brief, in one short line — the opening sentence of its `input_template`. A
|
|
1631
1846
|
* schedules line is named `<agent> @ <cron>`, which says when something runs and nothing at all
|
|
@@ -1633,50 +1848,50 @@ var ResourceReportSchema = z15.object({
|
|
|
1633
1848
|
* Written here rather than read back from the deployment so the receipt stays the one read the
|
|
1634
1849
|
* welcome needs. Schedules only.
|
|
1635
1850
|
*/
|
|
1636
|
-
summary:
|
|
1637
|
-
reason:
|
|
1638
|
-
});
|
|
1639
|
-
var BlueprintReportSchema =
|
|
1640
|
-
skills:
|
|
1641
|
-
identities:
|
|
1642
|
-
vaults:
|
|
1643
|
-
apps:
|
|
1644
|
-
agents:
|
|
1645
|
-
schedules:
|
|
1646
|
-
intake:
|
|
1851
|
+
summary: z16.string().optional(),
|
|
1852
|
+
reason: z16.string().optional()
|
|
1853
|
+
});
|
|
1854
|
+
var BlueprintReportSchema = z16.object({
|
|
1855
|
+
skills: z16.array(ResourceReportSchema),
|
|
1856
|
+
identities: z16.array(ResourceReportSchema),
|
|
1857
|
+
vaults: z16.array(ResourceReportSchema),
|
|
1858
|
+
apps: z16.array(ResourceReportSchema),
|
|
1859
|
+
agents: z16.array(ResourceReportSchema),
|
|
1860
|
+
schedules: z16.array(ResourceReportSchema),
|
|
1861
|
+
intake: z16.array(ResourceReportSchema),
|
|
1647
1862
|
/** One line per declared task (§31.11), `id` the card's `crd_`. Defaulted so older rows parse. */
|
|
1648
|
-
tasks:
|
|
1649
|
-
skipped:
|
|
1650
|
-
deselected:
|
|
1863
|
+
tasks: z16.array(ResourceReportSchema).default([]),
|
|
1864
|
+
skipped: z16.array(z16.string()),
|
|
1865
|
+
deselected: z16.array(z16.string()).default([])
|
|
1651
1866
|
});
|
|
1652
|
-
var BlueprintSelectionSchema =
|
|
1653
|
-
agents:
|
|
1654
|
-
apps:
|
|
1867
|
+
var BlueprintSelectionSchema = z16.object({
|
|
1868
|
+
agents: z16.array(z16.string().min(1)),
|
|
1869
|
+
apps: z16.array(z16.string().min(1))
|
|
1655
1870
|
});
|
|
1656
|
-
var BlueprintInstallSchema =
|
|
1871
|
+
var BlueprintInstallSchema = z16.object({
|
|
1657
1872
|
id: idOf("bpi"),
|
|
1658
|
-
object:
|
|
1873
|
+
object: z16.literal("blueprint_install"),
|
|
1659
1874
|
/** The customer's own `defineProject({ name })` — the same word `app.project` stamps (§29.2). */
|
|
1660
|
-
project:
|
|
1875
|
+
project: z16.string().min(1),
|
|
1661
1876
|
/** The pair the declaration resolved to; `null` for a declaration that names no blueprint. */
|
|
1662
|
-
blueprint:
|
|
1663
|
-
template:
|
|
1877
|
+
blueprint: z16.string().nullable(),
|
|
1878
|
+
template: z16.string().nullable(),
|
|
1664
1879
|
/**
|
|
1665
1880
|
* Applies, not versions of anything: 1 on the first apply, +1 on each one after, whichever writer
|
|
1666
1881
|
* made it. It is not an agent version and it never rolls back.
|
|
1667
1882
|
*/
|
|
1668
|
-
revision:
|
|
1883
|
+
revision: z16.number().int().positive(),
|
|
1669
1884
|
/**
|
|
1670
1885
|
* The blueprint artifact version this came from, or `null` when it was applied from a working
|
|
1671
1886
|
* tree — an operator editing a clone has no version to name.
|
|
1672
1887
|
*/
|
|
1673
|
-
artifact_version:
|
|
1888
|
+
artifact_version: z16.string().nullable(),
|
|
1674
1889
|
/**
|
|
1675
1890
|
* The setup answers this project was configured with (§7.1 fields, keyed by their `key`), so a
|
|
1676
1891
|
* re-apply does not re-ask and both writers configure from the same answers. Configuration only:
|
|
1677
1892
|
* a secret is a vault credential (§23) or an app secret (§29.2), and neither is ever an answer.
|
|
1678
1893
|
*/
|
|
1679
|
-
answers:
|
|
1894
|
+
answers: z16.record(z16.string(), z16.unknown()),
|
|
1680
1895
|
/**
|
|
1681
1896
|
* NO `declaration` ON THE WIRE, and that is the reconciliation of §29.6 with §31.1.
|
|
1682
1897
|
*
|
|
@@ -1708,7 +1923,7 @@ var BlueprintInstallSchema = z15.object({
|
|
|
1708
1923
|
* Why a `failed` run threw, in one sentence — or, on an `applied` row, which `required` agent or
|
|
1709
1924
|
* app the apply refused and why (§29.6). `null` otherwise. Never a stack or a key.
|
|
1710
1925
|
*/
|
|
1711
|
-
failure:
|
|
1926
|
+
failure: z16.string().nullable(),
|
|
1712
1927
|
/**
|
|
1713
1928
|
* The `selection` the apply carried, or `null` — every row written before §31.2 and every apply
|
|
1714
1929
|
* that omitted it, both meaning "everything". Defaulted so those rows parse unchanged.
|
|
@@ -1716,397 +1931,109 @@ var BlueprintInstallSchema = z15.object({
|
|
|
1716
1931
|
selection: BlueprintSelectionSchema.nullable().default(null),
|
|
1717
1932
|
/** When the answers were last edited through `PATCH …/installs/{id}` (§31.8); `null` if never. */
|
|
1718
1933
|
context_updated_at: Timestamp.nullable().default(null),
|
|
1934
|
+
/**
|
|
1935
|
+
* What this install's agent, app, identity and vault names start with (§29.6, ADR-1104): `""`
|
|
1936
|
+
* when its template's names were free in the organization, `"<project>-"` when any was already
|
|
1937
|
+
* another project's. Decided once, by the apply that created the row, and never again. `null` is
|
|
1938
|
+
* an install from before that rule, or one a working tree recorded: its names are the template's.
|
|
1939
|
+
* Optional only so a Worker from before the field still parses; this API always sends it.
|
|
1940
|
+
*/
|
|
1941
|
+
name_prefix: z16.string().nullable().optional(),
|
|
1719
1942
|
applied_at: Timestamp,
|
|
1720
1943
|
created_at: Timestamp
|
|
1721
1944
|
});
|
|
1722
|
-
var ProjectContextAnswerSchema =
|
|
1723
|
-
key:
|
|
1724
|
-
label:
|
|
1725
|
-
value:
|
|
1726
|
-
});
|
|
1727
|
-
var ProjectContextSchema =
|
|
1728
|
-
object:
|
|
1729
|
-
project:
|
|
1730
|
-
blueprint:
|
|
1731
|
-
template:
|
|
1732
|
-
artifact_version:
|
|
1733
|
-
answers:
|
|
1734
|
-
apps:
|
|
1735
|
-
agents:
|
|
1945
|
+
var ProjectContextAnswerSchema = z16.object({
|
|
1946
|
+
key: z16.string().min(1),
|
|
1947
|
+
label: z16.string(),
|
|
1948
|
+
value: z16.union([z16.string(), z16.array(z16.string())])
|
|
1949
|
+
});
|
|
1950
|
+
var ProjectContextSchema = z16.object({
|
|
1951
|
+
object: z16.literal("project_context"),
|
|
1952
|
+
project: z16.string().min(1),
|
|
1953
|
+
blueprint: z16.string().nullable(),
|
|
1954
|
+
template: z16.string().nullable(),
|
|
1955
|
+
artifact_version: z16.string().nullable(),
|
|
1956
|
+
answers: z16.array(ProjectContextAnswerSchema),
|
|
1957
|
+
apps: z16.array(z16.object({ name: z16.string().min(1), url: z16.string().nullable() })),
|
|
1958
|
+
agents: z16.array(z16.object({ name: z16.string().min(1), role: z16.string().nullable() })),
|
|
1736
1959
|
/** `context_updated_at` once the answers have been edited, `applied_at` until then. */
|
|
1737
1960
|
updated_at: Timestamp
|
|
1738
1961
|
});
|
|
1739
1962
|
|
|
1740
1963
|
// ../core/src/schema/blueprint.ts
|
|
1741
|
-
import { z as
|
|
1742
|
-
|
|
1743
|
-
// ../core/src/schema/social.ts
|
|
1744
|
-
import { z as z16 } from "zod";
|
|
1745
|
-
var SOCIAL_PLATFORMS = [
|
|
1746
|
-
"bluesky",
|
|
1747
|
-
"facebook",
|
|
1748
|
-
"instagram",
|
|
1749
|
-
"linkedin",
|
|
1750
|
-
"mastodon",
|
|
1751
|
-
"pinterest",
|
|
1752
|
-
"reddit",
|
|
1753
|
-
"threads",
|
|
1754
|
-
"tiktok",
|
|
1755
|
-
"x",
|
|
1756
|
-
"youtube"
|
|
1757
|
-
];
|
|
1758
|
-
var SOCIAL_APPS = /* @__PURE__ */ new Set([...SOCIAL_PLATFORMS, "twitter"]);
|
|
1759
|
-
var SOCIAL_TEXT_PLATFORMS = [
|
|
1760
|
-
"bluesky",
|
|
1761
|
-
"facebook",
|
|
1762
|
-
"linkedin",
|
|
1763
|
-
"mastodon",
|
|
1764
|
-
"threads",
|
|
1765
|
-
"x"
|
|
1766
|
-
];
|
|
1767
|
-
var SOCIAL_MEDIA_PLATFORMS = ["instagram", "tiktok", "youtube"];
|
|
1768
|
-
var SOCIAL_VISIBILITIES = ["public", "unlisted", "private"];
|
|
1769
|
-
var SOCIAL_VISIBILITY_PLATFORMS = ["mastodon", "youtube"];
|
|
1770
|
-
var SocialVisibilitySchema = z16.enum(SOCIAL_VISIBILITIES);
|
|
1771
|
-
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`;
|
|
1772
|
-
var SocialPlatformSchema = z16.enum(SOCIAL_PLATFORMS);
|
|
1773
|
-
var SocialTextPlatformSchema = z16.enum(SOCIAL_TEXT_PLATFORMS);
|
|
1774
|
-
var isText = (platform) => SOCIAL_TEXT_PLATFORMS.includes(platform);
|
|
1775
|
-
var isMedia = (platform) => SOCIAL_MEDIA_PLATFORMS.includes(platform);
|
|
1776
|
-
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`;
|
|
1777
|
-
var SocialAccountSchema = z16.object({
|
|
1778
|
-
id: z16.string().min(1),
|
|
1779
|
-
object: z16.literal("social_account"),
|
|
1780
|
-
identity_id: idOf("idn"),
|
|
1781
|
-
platform: SocialPlatformSchema,
|
|
1782
|
-
username: z16.string().nullable(),
|
|
1783
|
-
display_name: z16.string().nullable(),
|
|
1784
|
-
avatar_url: z16.url().nullable(),
|
|
1785
|
-
connected_at: Timestamp.nullable()
|
|
1786
|
-
});
|
|
1787
|
-
var SocialPostStatusSchema = z16.enum([
|
|
1788
|
-
"draft",
|
|
1789
|
-
"scheduled",
|
|
1790
|
-
"processing",
|
|
1791
|
-
"posted",
|
|
1792
|
-
"failed",
|
|
1793
|
-
"deleted"
|
|
1794
|
-
]);
|
|
1795
|
-
var SocialPostSchema = z16.object({
|
|
1796
|
-
id: z16.string().min(1),
|
|
1797
|
-
object: z16.literal("social_post"),
|
|
1798
|
-
identity_id: idOf("idn"),
|
|
1799
|
-
title: z16.string(),
|
|
1800
|
-
platforms: z16.array(SocialPlatformSchema),
|
|
1801
|
-
status: SocialPostStatusSchema,
|
|
1802
|
-
scheduled_at: Timestamp.nullable(),
|
|
1803
|
-
posted_at: Timestamp.nullable(),
|
|
1804
|
-
error: z16.string().nullable()
|
|
1805
|
-
});
|
|
1806
|
-
var SocialUploadSchema = z16.object({
|
|
1807
|
-
id: z16.string().min(1),
|
|
1808
|
-
object: z16.literal("social_upload"),
|
|
1809
|
-
identity_id: idOf("idn"),
|
|
1810
|
-
type: z16.enum(["image", "video", "document"]),
|
|
1811
|
-
url: z16.url().nullable()
|
|
1812
|
-
});
|
|
1813
|
-
var SocialAnalyticsSchema = z16.object({
|
|
1814
|
-
object: z16.literal("social_analytics"),
|
|
1815
|
-
identity_id: idOf("idn"),
|
|
1816
|
-
resource_id: z16.string().min(1),
|
|
1817
|
-
platform: SocialPlatformSchema.nullable(),
|
|
1818
|
-
data: z16.unknown()
|
|
1819
|
-
});
|
|
1820
|
-
var SocialCommentSchema = z16.object({
|
|
1821
|
-
id: z16.string().min(1),
|
|
1822
|
-
object: z16.literal("social_comment"),
|
|
1823
|
-
identity_id: idOf("idn"),
|
|
1824
|
-
post_id: z16.string().min(1),
|
|
1825
|
-
platforms: z16.array(SocialPlatformSchema),
|
|
1826
|
-
status: SocialPostStatusSchema,
|
|
1827
|
-
posted_at: Timestamp.nullable(),
|
|
1828
|
-
data: z16.unknown()
|
|
1829
|
-
});
|
|
1830
|
-
var POST_STATUSES = ["pending", "scheduled", "posted", "failed"];
|
|
1831
|
-
var PostStatusSchema = z16.enum(POST_STATUSES);
|
|
1832
|
-
var PostSchema = z16.object({
|
|
1833
|
-
object: z16.literal("post"),
|
|
1834
|
-
id: z16.string().min(1),
|
|
1835
|
-
status: PostStatusSchema,
|
|
1836
|
-
identity_id: z16.string().nullable(),
|
|
1837
|
-
agent_id: z16.string().nullable(),
|
|
1838
|
-
session_id: z16.string().nullable(),
|
|
1839
|
-
tool_call_id: z16.string().nullable(),
|
|
1840
|
-
content: z16.string().nullable(),
|
|
1841
|
-
platforms: z16.array(z16.string()),
|
|
1842
|
-
file_ids: z16.array(z16.string()),
|
|
1843
|
-
media_urls: z16.array(z16.string()),
|
|
1844
|
-
visibility: SocialVisibilitySchema.nullable(),
|
|
1845
|
-
scheduled_at: Timestamp.nullable(),
|
|
1846
|
-
posted_at: Timestamp.nullable(),
|
|
1847
|
-
url: z16.string().nullable(),
|
|
1848
|
-
error: z16.string().nullable(),
|
|
1849
|
-
/** The latest stored reading, `{metric: value}`; `null` before `social.post_metrics` read any. */
|
|
1850
|
-
metrics: z16.record(z16.string(), z16.number()).nullable(),
|
|
1851
|
-
measured_at: Timestamp.nullable(),
|
|
1852
|
-
/** Pending only: the earlier post this call would repeat — same identity, network and file. */
|
|
1853
|
-
duplicate_of: z16.object({
|
|
1854
|
-
id: z16.string(),
|
|
1855
|
-
status: PostStatusSchema,
|
|
1856
|
-
platform: z16.string(),
|
|
1857
|
-
at: Timestamp.nullable(),
|
|
1858
|
-
agent_id: z16.string().nullable(),
|
|
1859
|
-
session_id: z16.string().nullable()
|
|
1860
|
-
}).nullable(),
|
|
1861
|
-
created_at: Timestamp
|
|
1862
|
-
});
|
|
1863
|
-
|
|
1864
|
-
// ../core/src/schema/blueprint.ts
|
|
1865
|
-
var BlueprintScheduleSchema = z17.object({
|
|
1866
|
-
agent: z17.string().min(1),
|
|
1867
|
-
cron: z17.string().min(1),
|
|
1868
|
-
timezone: z17.string().nullable(),
|
|
1869
|
-
/** The message each fire opens its session with — the sentence worth printing. */
|
|
1870
|
-
input: z17.string().min(1),
|
|
1871
|
-
budget_micro_usd: MicroUsdField.nonnegative()
|
|
1872
|
-
});
|
|
1873
|
-
var BlueprintBudgetSchema = BlueprintScheduleSchema.pick({ agent: true, cron: true, budget_micro_usd: true });
|
|
1874
|
-
var BlueprintCrewSchema = z17.object({
|
|
1875
|
-
name: z17.string().min(1),
|
|
1876
|
-
description: z17.string().nullable(),
|
|
1877
|
-
model: z17.string().min(1),
|
|
1878
|
-
briefed: z17.boolean(),
|
|
1879
|
-
intake: z17.string().nullable().optional(),
|
|
1880
|
-
/** What the first session may spend: the intake's own cap, else the agent's (§31.4). Set iff `briefed`. */
|
|
1881
|
-
intake_micro_usd: MicroUsdField.nonnegative().optional(),
|
|
1882
|
-
role: z17.string().min(1).optional(),
|
|
1883
|
-
skills: z17.array(SkillRefSchema).optional(),
|
|
1884
|
-
tools: z17.array(z17.string().min(1)).optional(),
|
|
1885
|
-
required: z17.boolean().optional()
|
|
1886
|
-
});
|
|
1887
|
-
var BlueprintAppSchema = z17.object({
|
|
1888
|
-
name: z17.string().min(1),
|
|
1889
|
-
type: AppTypeSchema,
|
|
1890
|
-
description: z17.string().nullable(),
|
|
1891
|
-
mcp: z17.string().nullable().optional(),
|
|
1892
|
-
tools: z17.array(z17.string().min(1)).optional(),
|
|
1893
|
-
/** Whether an install may deselect it (§31.2). Optional: the rollout argument above. */
|
|
1894
|
-
required: z17.boolean().optional()
|
|
1895
|
-
});
|
|
1896
|
-
var BlueprintIdentitySchema = z17.object({
|
|
1897
|
-
name: z17.string().min(1),
|
|
1898
|
-
description: z17.string().nullable()
|
|
1899
|
-
});
|
|
1900
|
-
var ContentHashSchema = z17.string().regex(/^[0-9a-f]{64}$/, "a lowercase sha-256 hex digest");
|
|
1901
|
-
var BlueprintTreeSchema = z17.object({
|
|
1902
|
-
/** `apps[].name` in the declaration — the same name §31.5 prints and the install ensures by. */
|
|
1903
|
-
app: z17.string().min(1),
|
|
1904
|
-
content_hash: ContentHashSchema
|
|
1905
|
-
});
|
|
1906
|
-
var BlueprintArtifactSchema = z17.object({
|
|
1907
|
-
id: idOf("bpa"),
|
|
1908
|
-
object: z17.literal("blueprint_artifact"),
|
|
1909
|
-
/** The machine — its repository, screens and `/api/*`. */
|
|
1910
|
-
blueprint: z17.string().min(1),
|
|
1911
|
-
/** Which of that blueprint's templates provides the crew. */
|
|
1912
|
-
template: z17.string().min(1),
|
|
1913
|
-
/** The blueprint repository's own released version. Stored, never parsed (ADR-0401). */
|
|
1914
|
-
version: z17.string().min(1),
|
|
1915
|
-
/**
|
|
1916
|
-
* What a person calls the template, one line on what its crew does, and the networks it publishes
|
|
1917
|
-
* to — printed, never provisioned (§31.5, ADR-0921). `platforms` is decoration: where the crew
|
|
1918
|
-
* posts is the accounts connected to its persona. Optional for the §31.5 rollout reason.
|
|
1919
|
-
*/
|
|
1920
|
-
title: z17.string().min(1).optional(),
|
|
1921
|
-
description: z17.string().min(1).optional(),
|
|
1922
|
-
platforms: z17.array(SocialPlatformSchema).optional(),
|
|
1923
|
-
/**
|
|
1924
|
-
* The built trees, one per deployable app, ordered as the declaration orders its apps. Empty for
|
|
1925
|
-
* a data-only blueprint: it declares no app, builds nothing, and still ships a crew (ADR-0900).
|
|
1926
|
-
*/
|
|
1927
|
-
trees: z17.array(BlueprintTreeSchema),
|
|
1928
|
-
/**
|
|
1929
|
-
* The setup questions, asked by the studio **before** provisioning. `QuestionField` (§7.1) is
|
|
1930
|
-
* reused rather than restated: a setup question and a question a parked agent asks are the same
|
|
1931
|
-
* object at different times, so one component renders both.
|
|
1932
|
-
*/
|
|
1933
|
-
questions: z17.array(QuestionFieldSchema),
|
|
1934
|
-
schedules: z17.array(BlueprintScheduleSchema),
|
|
1935
|
-
/** Who the crew is, and what it deploys — §31.5. Derived from `declaration`, never stored twice. */
|
|
1936
|
-
agents: z17.array(BlueprintCrewSchema),
|
|
1937
|
-
apps: z17.array(BlueprintAppSchema),
|
|
1938
|
-
/**
|
|
1939
|
-
* The agents a template creates per client the operator signs — printed, never provisioned by an
|
|
1940
|
-
* apply (§31.1). Absent on rows published before WS12 v2, hence optional.
|
|
1941
|
-
*/
|
|
1942
|
-
crew_per_client: z17.array(BlueprintCrewSchema).optional(),
|
|
1943
|
-
/**
|
|
1944
|
-
* The personas the crew posts from, and which accounts to connect to each before the crew
|
|
1945
|
-
* exists (§31.10). Derived from `declaration` like `agents`; optional for the §31.5 rollout reason.
|
|
1946
|
-
*/
|
|
1947
|
-
identities: z17.array(BlueprintIdentitySchema).optional(),
|
|
1948
|
-
/**
|
|
1949
|
-
* The creator template a row was published from (§42.8), `null` on every first-party row.
|
|
1950
|
-
* `creator_name` is the public display name the landing page credits. The API sends all three
|
|
1951
|
-
* on every row; they are optional here only so an artifact typed before §42 still reads.
|
|
1952
|
-
*/
|
|
1953
|
-
creator_template_id: idOf("ctp").nullish(),
|
|
1954
|
-
creator_template_version: z17.number().int().positive().nullish(),
|
|
1955
|
-
creator_name: z17.string().min(1).nullish(),
|
|
1956
|
-
published_at: Timestamp
|
|
1957
|
-
});
|
|
1958
|
-
|
|
1959
|
-
// ../core/src/schema/vault.ts
|
|
1960
|
-
import { z as z18 } from "zod";
|
|
1961
|
-
var VaultCredentialKindSchema = z18.enum(["env_var", "static_bearer", "mcp_oauth"]);
|
|
1962
|
-
var VaultSchema = z18.object({
|
|
1963
|
-
id: idOf("vlt"),
|
|
1964
|
-
object: z18.literal("vault"),
|
|
1965
|
-
identity_id: idOf("idn").nullable(),
|
|
1966
|
-
display_name: z18.string().min(1).max(128),
|
|
1967
|
-
credential_count: z18.number().int().nonnegative(),
|
|
1968
|
-
created_at: Timestamp
|
|
1969
|
-
});
|
|
1970
|
-
var VaultCredentialSchema = z18.object({
|
|
1971
|
-
id: idOf("vcr"),
|
|
1972
|
-
object: z18.literal("vault_credential"),
|
|
1973
|
-
vault_id: idOf("vlt"),
|
|
1974
|
-
kind: VaultCredentialKindSchema,
|
|
1975
|
-
/** For `env_var`, the environment variable name. For the MCP kinds, a display label. */
|
|
1976
|
-
key: z18.string().min(1).max(128),
|
|
1977
|
-
/** The exact destination host an `env_var` credential is bound to. Never a wildcard. */
|
|
1978
|
-
host: z18.string().nullable(),
|
|
1979
|
-
/** The exact MCP server URL an `mcp_*` token is matched to. */
|
|
1980
|
-
mcp_server_url: z18.url().nullable(),
|
|
1981
|
-
placeholder_ref: z18.string(),
|
|
1982
|
-
expires_at: Timestamp.nullable(),
|
|
1983
|
-
last_injected_at: Timestamp.nullable(),
|
|
1984
|
-
created_at: Timestamp
|
|
1985
|
-
});
|
|
1964
|
+
import { z as z20 } from "zod";
|
|
1986
1965
|
|
|
1987
|
-
// ../core/src/schema/
|
|
1966
|
+
// ../core/src/schema/mini-app.ts
|
|
1988
1967
|
import { z as z19 } from "zod";
|
|
1989
|
-
var MAX_HANDOFF_TARGETS = 6;
|
|
1990
|
-
var HandoffRequestSchema = z19.object({
|
|
1991
|
-
agent: z19.string().min(1),
|
|
1992
|
-
message: z19.string().min(1),
|
|
1993
|
-
handoff_key: z19.string().min(1).max(128).optional(),
|
|
1994
|
-
budget_micro_usd: z19.number().int().positive().optional()
|
|
1995
|
-
});
|
|
1996
|
-
var HandoffSchema = z19.object({
|
|
1997
|
-
object: z19.literal("handoff"),
|
|
1998
|
-
session_id: idOf("ses"),
|
|
1999
|
-
status: z19.enum(["queued", "already_running"]),
|
|
2000
|
-
handoff_key: z19.string().nullable()
|
|
2001
|
-
});
|
|
2002
|
-
var SessionHandoffRequestSchema = z19.object({
|
|
2003
|
-
agents: z19.array(z19.string().min(1)).min(1).max(MAX_HANDOFF_TARGETS),
|
|
2004
|
-
message: z19.string().min(1),
|
|
2005
|
-
handoff_key: z19.string().min(1).max(128).optional(),
|
|
2006
|
-
budget_micro_usd: z19.number().int().positive().optional()
|
|
2007
|
-
});
|
|
2008
|
-
var HandoffRefusalSchema = z19.object({
|
|
2009
|
-
object: z19.literal("handoff_refusal"),
|
|
2010
|
-
agent: z19.string(),
|
|
2011
|
-
code: z19.string(),
|
|
2012
|
-
message: z19.string()
|
|
2013
|
-
});
|
|
2014
|
-
var HandoffBatchSchema = z19.object({
|
|
2015
|
-
object: z19.literal("handoff_batch"),
|
|
2016
|
-
handoffs: z19.array(HandoffSchema.extend({ agent_id: idOf("agt") })),
|
|
2017
|
-
refusals: z19.array(HandoffRefusalSchema)
|
|
2018
|
-
});
|
|
2019
|
-
var SessionHandoffSchema = z19.object({
|
|
2020
|
-
from_session: idOf("ses"),
|
|
2021
|
-
from_agent: idOf("agt"),
|
|
2022
|
-
key: z19.string().nullable(),
|
|
2023
|
-
depth: z19.number().int().positive()
|
|
2024
|
-
});
|
|
2025
|
-
var ChannelBriefSchema = z19.object({
|
|
2026
|
-
root_session_id: idOf("ses"),
|
|
2027
|
-
name: z19.string().min(1),
|
|
2028
|
-
members: z19.array(z19.string().min(1))
|
|
2029
|
-
});
|
|
2030
|
-
var ChannelPostRequestSchema = z19.object({
|
|
2031
|
-
message: z19.string().min(1).max(2e4)
|
|
2032
|
-
});
|
|
2033
|
-
var ChannelPostSchema = z19.object({
|
|
2034
|
-
object: z19.literal("channel_post"),
|
|
2035
|
-
root_session_id: idOf("ses"),
|
|
2036
|
-
queued: z19.boolean()
|
|
2037
|
-
});
|
|
2038
1968
|
|
|
2039
1969
|
// ../core/src/schema/show.ts
|
|
2040
|
-
import { z as
|
|
1970
|
+
import { z as z17 } from "zod";
|
|
2041
1971
|
var SHOW_SOURCES = ["spend_by_day", "post_views", "roadmap", "schedule"];
|
|
2042
|
-
var ShowSourceSchema =
|
|
2043
|
-
var ShowArgsSchema =
|
|
1972
|
+
var ShowSourceSchema = z17.enum(SHOW_SOURCES);
|
|
1973
|
+
var ShowArgsSchema = z17.object({
|
|
2044
1974
|
source: ShowSourceSchema.describe(
|
|
2045
1975
|
"What to show: spend_by_day (company spend per day, a line), post_views (views per recent post, bars), roadmap (the board's work by status), schedule (routines and scheduled posts over the next 7 days)."
|
|
2046
1976
|
),
|
|
2047
|
-
days:
|
|
1977
|
+
days: z17.number().int().min(2).max(30).optional().describe("spend_by_day only: days back, today included. Default 14.")
|
|
2048
1978
|
});
|
|
2049
|
-
var Day =
|
|
2050
|
-
var Count =
|
|
2051
|
-
var head = { title:
|
|
2052
|
-
var SpendByDayViewSchema =
|
|
2053
|
-
source:
|
|
1979
|
+
var Day = z17.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
|
1980
|
+
var Count = z17.number().int().nonnegative();
|
|
1981
|
+
var head = { title: z17.string().min(1), as_of: Timestamp, timezone: z17.string().min(1) };
|
|
1982
|
+
var SpendByDayViewSchema = z17.object({
|
|
1983
|
+
source: z17.literal("spend_by_day"),
|
|
2054
1984
|
...head,
|
|
2055
|
-
days:
|
|
1985
|
+
days: z17.array(z17.object({ day: Day, micro_usd: Count })).min(2).max(30)
|
|
2056
1986
|
});
|
|
2057
|
-
var PostViewsViewSchema =
|
|
2058
|
-
source:
|
|
1987
|
+
var PostViewsViewSchema = z17.object({
|
|
1988
|
+
source: z17.literal("post_views"),
|
|
2059
1989
|
...head,
|
|
2060
|
-
posts:
|
|
1990
|
+
posts: z17.array(z17.object({ post_id: z17.string().min(1), label: z17.string(), networks: z17.array(z17.string()), posted_at: Timestamp, views: Count })).max(12)
|
|
2061
1991
|
});
|
|
2062
|
-
var RoadmapViewSchema =
|
|
2063
|
-
source:
|
|
1992
|
+
var RoadmapViewSchema = z17.object({
|
|
1993
|
+
source: z17.literal("roadmap"),
|
|
2064
1994
|
...head,
|
|
2065
|
-
groups:
|
|
2066
|
-
|
|
1995
|
+
groups: z17.array(
|
|
1996
|
+
z17.object({
|
|
2067
1997
|
status: BoardStatusSchema,
|
|
2068
1998
|
count: Count,
|
|
2069
|
-
cards:
|
|
1999
|
+
cards: z17.array(z17.object({ title: z17.string(), assignee: z17.string().nullable(), waits_on: z17.array(z17.string()) })).max(5)
|
|
2070
2000
|
})
|
|
2071
2001
|
)
|
|
2072
2002
|
});
|
|
2073
|
-
var ScheduleViewSchema =
|
|
2074
|
-
source:
|
|
2003
|
+
var ScheduleViewSchema = z17.object({
|
|
2004
|
+
source: z17.literal("schedule"),
|
|
2075
2005
|
...head,
|
|
2076
|
-
days:
|
|
2077
|
-
|
|
2006
|
+
days: z17.array(
|
|
2007
|
+
z17.object({
|
|
2078
2008
|
day: Day,
|
|
2079
2009
|
count: Count,
|
|
2080
|
-
items:
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2010
|
+
items: z17.array(
|
|
2011
|
+
z17.discriminatedUnion("kind", [
|
|
2012
|
+
z17.object({ kind: z17.literal("routine"), at: Timestamp, agent: z17.string(), text: z17.string(), runs: z17.number().int().min(1).max(100) }),
|
|
2013
|
+
z17.object({ kind: z17.literal("post"), at: Timestamp, networks: z17.array(z17.string()), text: z17.string() })
|
|
2084
2014
|
])
|
|
2085
2015
|
).max(8)
|
|
2086
2016
|
})
|
|
2087
2017
|
).max(7)
|
|
2088
2018
|
});
|
|
2089
|
-
var ShowViewSchema =
|
|
2019
|
+
var ShowViewSchema = z17.discriminatedUnion("source", [
|
|
2090
2020
|
SpendByDayViewSchema,
|
|
2091
2021
|
PostViewsViewSchema,
|
|
2092
2022
|
RoadmapViewSchema,
|
|
2093
2023
|
ScheduleViewSchema
|
|
2094
2024
|
]);
|
|
2095
2025
|
|
|
2096
|
-
// ../core/src/schema/compose.ts
|
|
2097
|
-
import { z as z22 } from "zod";
|
|
2098
|
-
|
|
2099
2026
|
// ../core/src/schema/catalog.ts
|
|
2100
|
-
import { z as
|
|
2101
|
-
var Key =
|
|
2102
|
-
var Count2 =
|
|
2027
|
+
import { z as z18 } from "zod";
|
|
2028
|
+
var Key = z18.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,39}$/, "an element key is a short name: a letter, then letters, digits, - or _");
|
|
2029
|
+
var Count2 = z18.number().int().nonnegative();
|
|
2103
2030
|
var DIGIT = "words only: a digit is refused, because every number on the card is read by code from a $source binding";
|
|
2104
|
-
var words = (max) =>
|
|
2105
|
-
var Days =
|
|
2031
|
+
var words = (max) => z18.string().trim().min(1).max(max).regex(/^[^0-9]*$/, DIGIT).refine((text) => !new RegExp("\\p{N}", "u").test(text), DIGIT);
|
|
2032
|
+
var Days = z18.number().int().min(1).max(30).default(7).describe("The window: today and the days before it, on the company's clock. Default 7.");
|
|
2106
2033
|
function bound(sources2, shape) {
|
|
2107
2034
|
const example = JSON.stringify({ $source: sources2[0] });
|
|
2108
|
-
return
|
|
2109
|
-
{ $source:
|
|
2035
|
+
return z18.strictObject(
|
|
2036
|
+
{ $source: z18.enum(sources2), ...shape },
|
|
2110
2037
|
{ error: (issue) => issue.code === "invalid_type" ? `must be a binding such as ${example}: a literal value is refused, code reads every number` : void 0 }
|
|
2111
2038
|
);
|
|
2112
2039
|
}
|
|
@@ -2117,38 +2044,38 @@ var Bound = {
|
|
|
2117
2044
|
delta: bound(["views_change"], {}).describe(
|
|
2118
2045
|
"views_change: the value's views_total against the same number of days before it, as a percentage. Its window is the value's."
|
|
2119
2046
|
),
|
|
2120
|
-
series: bound(["spend_by_day"], { days:
|
|
2121
|
-
bars: bound(["post_views"], { limit:
|
|
2047
|
+
series: bound(["spend_by_day"], { days: z18.number().int().min(2).max(30).default(14) }).describe("spend_by_day: the company's spend per day (the CEO only)."),
|
|
2048
|
+
bars: bound(["post_views"], { limit: z18.number().int().min(1).max(12).default(5).describe("How many posts, newest first. Default 5.") }).describe(
|
|
2122
2049
|
"post_views: each recent post's latest views, newest first."
|
|
2123
2050
|
),
|
|
2124
|
-
progress: bound(["posts_this_week"], {}).describe("posts_this_week: posts published since Monday against the weekly cadence from the company's setup."),
|
|
2051
|
+
progress: bound(["posts_this_week"], {}).describe("posts_this_week: posts published since Monday against the weekly cadence from the company's setup or its channel plan, else 3\xD7 a week."),
|
|
2125
2052
|
board: bound(["roadmap"], {}).describe("roadmap: the board's work by status."),
|
|
2126
2053
|
week: bound(["schedule"], {}).describe("schedule: routines and scheduled posts over the next 7 days."),
|
|
2127
|
-
media:
|
|
2054
|
+
media: z18.union([bound(["latest_media"], { count: z18.number().int().min(1).max(4).default(1) }), z18.array(idOf("fil")).min(1).max(4)]).describe('{"$source":"latest_media","count":1} for the newest posted pictures or clips, or up to 4 fil_ ids.')
|
|
2128
2055
|
};
|
|
2129
|
-
var SpendDay =
|
|
2056
|
+
var SpendDay = z18.strictObject({ day: z18.string().regex(/^\d{4}-\d{2}-\d{2}$/), micro_usd: Count2 });
|
|
2130
2057
|
var Resolved = {
|
|
2131
|
-
value:
|
|
2132
|
-
|
|
2133
|
-
|
|
2058
|
+
value: z18.discriminatedUnion("$source", [
|
|
2059
|
+
z18.strictObject({ $source: z18.literal("views_total"), days: z18.number().int(), value: Count2, posts: Count2 }),
|
|
2060
|
+
z18.strictObject({ $source: z18.literal("spend_total"), days: z18.number().int(), value: Count2 })
|
|
2134
2061
|
]),
|
|
2135
|
-
delta:
|
|
2136
|
-
series:
|
|
2137
|
-
bars:
|
|
2138
|
-
progress:
|
|
2139
|
-
board:
|
|
2140
|
-
week:
|
|
2141
|
-
media:
|
|
2062
|
+
delta: z18.strictObject({ $source: z18.literal("views_change"), days: z18.number().int(), current: Count2, previous: Count2 }),
|
|
2063
|
+
series: z18.strictObject({ $source: z18.literal("spend_by_day"), days: z18.number().int(), points: z18.array(SpendDay).min(2).max(30) }),
|
|
2064
|
+
bars: z18.strictObject({ $source: z18.literal("post_views"), limit: z18.number().int(), posts: PostViewsViewSchema.shape.posts }),
|
|
2065
|
+
progress: z18.strictObject({ $source: z18.literal("posts_this_week"), value: Count2, max: z18.number().int().positive(), cadence: z18.string() }),
|
|
2066
|
+
board: z18.strictObject({ $source: z18.literal("roadmap"), groups: RoadmapViewSchema.shape.groups }),
|
|
2067
|
+
week: z18.strictObject({ $source: z18.literal("schedule"), days: ScheduleViewSchema.shape.days }),
|
|
2068
|
+
media: z18.array(z18.strictObject({ id: idOf("fil"), kind: z18.enum(["image", "video"]) })).min(1).max(4)
|
|
2142
2069
|
};
|
|
2143
|
-
var box = { children:
|
|
2144
|
-
var leaf = { children:
|
|
2070
|
+
var box = { children: z18.array(Key).min(1).max(12) };
|
|
2071
|
+
var leaf = { children: z18.array(Key).max(0).optional() };
|
|
2145
2072
|
var label = words(40).optional();
|
|
2146
|
-
var element = (type, props, children, about) =>
|
|
2073
|
+
var element = (type, props, children, about) => z18.strictObject({ type: z18.literal(type), props: z18.strictObject(props), ...children }).describe(about);
|
|
2147
2074
|
function catalog(slot) {
|
|
2148
2075
|
return {
|
|
2149
2076
|
Card: element("Card", { title: words(60) }, box, "The card, with a short title. It is the root, and only the root."),
|
|
2150
2077
|
Stack: element("Stack", {}, box, "Children one under another."),
|
|
2151
|
-
Grid: element("Grid", { columns:
|
|
2078
|
+
Grid: element("Grid", { columns: z18.literal([1, 2, 3]) }, box, "Children side by side, 1 to 3 columns."),
|
|
2152
2079
|
Metric: element("Metric", { label: words(40), value: slot.value, delta: slot.delta.optional() }, leaf, "One big number with a label, and optionally its change."),
|
|
2153
2080
|
LineChart: element("LineChart", { label, series: slot.series }, leaf, "A line over days."),
|
|
2154
2081
|
BarList: element("BarList", { label, bars: slot.bars }, leaf, "One bar per post."),
|
|
@@ -2162,36 +2089,396 @@ function catalog(slot) {
|
|
|
2162
2089
|
var unknownComponent = (names) => ({
|
|
2163
2090
|
error: (issue) => issue.code === "invalid_union" ? `unknown component: use one of ${names.join(", ")}` : void 0
|
|
2164
2091
|
});
|
|
2165
|
-
function tree(rootType, max, spec2, ctx) {
|
|
2166
|
-
const refuse2 = (message3, path = []) => ctx.addIssue({ code: "custom", message: message3, path });
|
|
2167
|
-
const keys = Object.keys(spec2.elements);
|
|
2168
|
-
const has = (key) => Object.hasOwn(spec2.elements, key);
|
|
2169
|
-
if (keys.length > max) return refuse2(`at most ${max} elements`, ["elements"]);
|
|
2170
|
-
const root = has(spec2.root) ? spec2.elements[spec2.root] : void 0;
|
|
2171
|
-
if (!root) return refuse2(`root names "${spec2.root}", which is not in elements`, ["root"]);
|
|
2172
|
-
if (root.type !== rootType) return refuse2(`the root must be a ${rootType}`, ["root"]);
|
|
2173
|
-
const parent = /* @__PURE__ */ new Map();
|
|
2174
|
-
for (const key of keys) {
|
|
2175
|
-
for (const child of spec2.elements[key].children ?? []) {
|
|
2176
|
-
if (!has(child)) return refuse2(`"${child}" is not in elements`, ["elements", key, "children"]);
|
|
2177
|
-
if (child === spec2.root || parent.has(child)) return refuse2(`"${child}" has more than one parent`, ["elements", key, "children"]);
|
|
2178
|
-
if (spec2.elements[child].type === rootType) return refuse2(`a ${rootType} is the root only; group with Stack or Grid`, ["elements", child, "type"]);
|
|
2179
|
-
parent.set(child, key);
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
const reached = /* @__PURE__ */ new Set([spec2.root]);
|
|
2183
|
-
for (const key of reached) for (const child of spec2.elements[key].children ?? []) reached.add(child);
|
|
2184
|
-
const lost = keys.find((key) => !reached.has(key));
|
|
2185
|
-
if (lost) refuse2(`"${lost}" is not under the root`, ["elements", lost]);
|
|
2186
|
-
}
|
|
2187
|
-
var spec = (element2, rootType, max) =>
|
|
2092
|
+
function tree(rootType, max, spec2, ctx) {
|
|
2093
|
+
const refuse2 = (message3, path = []) => ctx.addIssue({ code: "custom", message: message3, path });
|
|
2094
|
+
const keys = Object.keys(spec2.elements);
|
|
2095
|
+
const has = (key) => Object.hasOwn(spec2.elements, key);
|
|
2096
|
+
if (keys.length > max) return refuse2(`at most ${max} elements`, ["elements"]);
|
|
2097
|
+
const root = has(spec2.root) ? spec2.elements[spec2.root] : void 0;
|
|
2098
|
+
if (!root) return refuse2(`root names "${spec2.root}", which is not in elements`, ["root"]);
|
|
2099
|
+
if (root.type !== rootType) return refuse2(`the root must be a ${rootType}`, ["root"]);
|
|
2100
|
+
const parent = /* @__PURE__ */ new Map();
|
|
2101
|
+
for (const key of keys) {
|
|
2102
|
+
for (const child of spec2.elements[key].children ?? []) {
|
|
2103
|
+
if (!has(child)) return refuse2(`"${child}" is not in elements`, ["elements", key, "children"]);
|
|
2104
|
+
if (child === spec2.root || parent.has(child)) return refuse2(`"${child}" has more than one parent`, ["elements", key, "children"]);
|
|
2105
|
+
if (spec2.elements[child].type === rootType) return refuse2(`a ${rootType} is the root only; group with Stack or Grid`, ["elements", child, "type"]);
|
|
2106
|
+
parent.set(child, key);
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
const reached = /* @__PURE__ */ new Set([spec2.root]);
|
|
2110
|
+
for (const key of reached) for (const child of spec2.elements[key].children ?? []) reached.add(child);
|
|
2111
|
+
const lost = keys.find((key) => !reached.has(key));
|
|
2112
|
+
if (lost) refuse2(`"${lost}" is not under the root`, ["elements", lost]);
|
|
2113
|
+
}
|
|
2114
|
+
var spec = (element2, rootType, max) => z18.strictObject({ root: Key, elements: z18.record(Key, element2) }).superRefine((value, ctx) => tree(rootType, max, value, ctx));
|
|
2115
|
+
|
|
2116
|
+
// ../core/src/schema/mini-app.ts
|
|
2117
|
+
var PAGE_BLOCKS = [
|
|
2118
|
+
"Page",
|
|
2119
|
+
"Section",
|
|
2120
|
+
"Stack",
|
|
2121
|
+
"Grid",
|
|
2122
|
+
"Metric",
|
|
2123
|
+
"LineChart",
|
|
2124
|
+
"BarList",
|
|
2125
|
+
"Progress",
|
|
2126
|
+
"Roadmap",
|
|
2127
|
+
"Schedule",
|
|
2128
|
+
"Media",
|
|
2129
|
+
"Text",
|
|
2130
|
+
"Needs",
|
|
2131
|
+
"Activity",
|
|
2132
|
+
"Accounts",
|
|
2133
|
+
"Posts",
|
|
2134
|
+
"Answers",
|
|
2135
|
+
"MediaLibrary"
|
|
2136
|
+
];
|
|
2137
|
+
var MAX_PAGE_ELEMENTS = 48;
|
|
2138
|
+
var MINI_APP_ICONS = ["grid", "list", "chart", "calendar", "play"];
|
|
2139
|
+
var MiniAppIconSchema = z19.enum(MINI_APP_ICONS);
|
|
2140
|
+
var SLUG = "[a-z][a-z0-9-]{0,39}";
|
|
2141
|
+
var MiniAppSlugSchema = z19.string().regex(new RegExp(`^${SLUG}$`), "a slug is lowercase letters, digits and -");
|
|
2142
|
+
var Place = z19.string().regex(new RegExp(`^/(board|connections|apps/${SLUG}(\\?page=${SLUG})?)$`), "a section links to /board, /connections or /apps/<slug>[?page=<slug>]");
|
|
2143
|
+
var POSTS = ["waiting", "scheduled", "posted"];
|
|
2144
|
+
var PostStatus = z19.enum(POSTS);
|
|
2145
|
+
var PostLayout = z19.enum(["list", "row", "grid"]);
|
|
2146
|
+
var PostStatuses = z19.union([PostStatus, z19.array(PostStatus).min(1).max(3).refine((all) => new Set(all).size === all.length, "each status once")]);
|
|
2147
|
+
var PageBound = {
|
|
2148
|
+
...Bound,
|
|
2149
|
+
board: bound(["roadmap"], { per_group: z19.number().int().min(1).max(5).default(5) }),
|
|
2150
|
+
media: bound(["latest_media", "newest_media"], { count: z19.number().int().min(1).max(6).default(4) })
|
|
2151
|
+
};
|
|
2152
|
+
var PageResolved = {
|
|
2153
|
+
...Resolved,
|
|
2154
|
+
board: z19.strictObject({ $source: z19.literal("roadmap"), per_group: z19.number().int(), groups: RoadmapViewSchema.shape.groups }),
|
|
2155
|
+
media: z19.array(z19.strictObject({ id: z19.string(), kind: z19.enum(["image", "video"]) })).max(6)
|
|
2156
|
+
};
|
|
2157
|
+
function pageBlocks(slot) {
|
|
2158
|
+
return {
|
|
2159
|
+
Page: element("Page", {}, box, "The page itself, the root and only the root."),
|
|
2160
|
+
Section: element("Section", { title: words(40), to: Place.optional(), hide_empty: z19.boolean().optional() }, box, "A titled part of the page; hidden when every block in it is empty, if asked."),
|
|
2161
|
+
Needs: element("Needs", { label, needs: slot.needs }, leaf, "What waits on a person: approvals, questions, spent caps."),
|
|
2162
|
+
Activity: element("Activity", { label, agents: slot.agents }, leaf, "The agents working or waiting, and on what."),
|
|
2163
|
+
Accounts: element("Accounts", { accounts: slot.accounts }, leaf, "The template's networks: connected with a handle, or not."),
|
|
2164
|
+
Posts: element(
|
|
2165
|
+
"Posts",
|
|
2166
|
+
{ label, layout: PostLayout.optional(), posts: slot.posts },
|
|
2167
|
+
leaf,
|
|
2168
|
+
"Posts waiting on a person, scheduled, or posted; several statuses make one list. Drawn as rows (list, the default), one sideways row of cards (row), or a picture grid (grid)."
|
|
2169
|
+
),
|
|
2170
|
+
Answers: element("Answers", { answers: slot.answers }, leaf, "The setup's answers in one line, linking to the setup."),
|
|
2171
|
+
// No binding: the studio's gallery reads and pages the company's files itself (ADR-0987).
|
|
2172
|
+
MediaLibrary: element("MediaLibrary", {}, leaf, "Every picture and clip the company's agents made, with filters, sort and a viewer.")
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
var OwnBound = pageBlocks({
|
|
2176
|
+
needs: bound(["needs"], {}),
|
|
2177
|
+
agents: bound(["agents_activity"], {}),
|
|
2178
|
+
accounts: bound(["accounts"], {}),
|
|
2179
|
+
posts: bound(["posts"], { status: PostStatuses, limit: z19.number().int().min(1).max(50).default(10) }),
|
|
2180
|
+
answers: bound(["answers"], { keys: z19.array(Key).min(1).max(TEMPLATE_QUESTIONS_MAX) })
|
|
2181
|
+
});
|
|
2182
|
+
var Need = z19.object({
|
|
2183
|
+
session_id: z19.string(),
|
|
2184
|
+
agent_id: z19.string(),
|
|
2185
|
+
agent: z19.string(),
|
|
2186
|
+
since: Timestamp,
|
|
2187
|
+
/** The chat's stored title, or `null`: the studio names it by when it began. */
|
|
2188
|
+
title: z19.string().nullable(),
|
|
2189
|
+
kind: z19.enum(["tool", "question", "budget"]),
|
|
2190
|
+
/** The call or question it is held on; `null` for a spent cap. */
|
|
2191
|
+
action: PendingActionSchema.nullable()
|
|
2192
|
+
});
|
|
2193
|
+
var Working = z19.object({
|
|
2194
|
+
agent_id: z19.string(),
|
|
2195
|
+
agent: z19.string(),
|
|
2196
|
+
state: z19.enum(["working", "waiting"]),
|
|
2197
|
+
session_id: z19.string().nullable(),
|
|
2198
|
+
title: z19.string().nullable(),
|
|
2199
|
+
at: Timestamp
|
|
2200
|
+
});
|
|
2201
|
+
var OwnResolved = pageBlocks({
|
|
2202
|
+
needs: z19.strictObject({ $source: z19.literal("needs"), items: z19.array(Need) }),
|
|
2203
|
+
agents: z19.strictObject({ $source: z19.literal("agents_activity"), agents: z19.array(Working) }),
|
|
2204
|
+
accounts: z19.strictObject({
|
|
2205
|
+
$source: z19.literal("accounts"),
|
|
2206
|
+
accounts: z19.array(z19.object({ platform: SocialPlatformSchema, connected: z19.boolean(), handle: z19.string().nullable() }))
|
|
2207
|
+
}),
|
|
2208
|
+
posts: z19.strictObject({ $source: z19.literal("posts"), status: z19.union([PostStatus, z19.array(PostStatus)]), limit: z19.number().int(), posts: z19.array(PostSchema), more: z19.boolean() }),
|
|
2209
|
+
answers: z19.strictObject({
|
|
2210
|
+
$source: z19.literal("answers"),
|
|
2211
|
+
keys: z19.array(z19.string()),
|
|
2212
|
+
values: z19.array(z19.string()),
|
|
2213
|
+
template: z19.object({ blueprint: z19.string(), template: z19.string() }).nullable()
|
|
2214
|
+
})
|
|
2215
|
+
});
|
|
2216
|
+
var BoundBlocks = { ...catalog(PageBound), ...OwnBound };
|
|
2217
|
+
var ResolvedBlocks = { ...catalog(PageResolved), ...OwnResolved };
|
|
2218
|
+
var Unread = element("Unread", { of: z19.string(), label: z19.string().nullable(), reason: z19.string() }, leaf, "A block that could not be read.");
|
|
2219
|
+
var B = BoundBlocks;
|
|
2220
|
+
var PageSpecSchema = spec(
|
|
2221
|
+
z19.discriminatedUnion(
|
|
2222
|
+
"type",
|
|
2223
|
+
[B.Page, B.Section, B.Stack, B.Grid, B.Metric, B.LineChart, B.BarList, B.Progress, B.Roadmap, B.Schedule, B.Media, B.Text, B.Needs, B.Activity, B.Accounts, B.Posts, B.Answers, B.MediaLibrary],
|
|
2224
|
+
unknownComponent(PAGE_BLOCKS)
|
|
2225
|
+
),
|
|
2226
|
+
"Page",
|
|
2227
|
+
MAX_PAGE_ELEMENTS
|
|
2228
|
+
);
|
|
2229
|
+
var R = ResolvedBlocks;
|
|
2230
|
+
var ResolvedPageElementSchema = z19.discriminatedUnion(
|
|
2231
|
+
"type",
|
|
2232
|
+
[R.Page, R.Section, R.Stack, R.Grid, R.Metric, R.LineChart, R.BarList, R.Progress, R.Roadmap, R.Schedule, R.Media, R.Text, R.Needs, R.Activity, R.Accounts, R.Posts, R.Answers, R.MediaLibrary, Unread],
|
|
2233
|
+
unknownComponent(PAGE_BLOCKS)
|
|
2234
|
+
);
|
|
2235
|
+
var ResolvedPageSpecSchema = spec(ResolvedPageElementSchema, "Page", MAX_PAGE_ELEMENTS);
|
|
2236
|
+
var unique = (items) => new Set(items.map((item) => item.slug)).size === items.length;
|
|
2237
|
+
var MiniAppPageSchema = z19.strictObject({ slug: MiniAppSlugSchema, title: words(24), spec: PageSpecSchema });
|
|
2238
|
+
var MiniAppDeclSchema = z19.strictObject({
|
|
2239
|
+
slug: MiniAppSlugSchema,
|
|
2240
|
+
name: words(40),
|
|
2241
|
+
icon: MiniAppIconSchema,
|
|
2242
|
+
pages: z19.array(MiniAppPageSchema).min(1).max(6).refine(unique, "each page's slug is its own")
|
|
2243
|
+
});
|
|
2244
|
+
var MiniAppDeclsSchema = z19.array(MiniAppDeclSchema).max(8).refine(unique, "each mini app's slug is its own");
|
|
2245
|
+
var MiniAppSummarySchema = z19.object({
|
|
2246
|
+
object: z19.literal("mini_app"),
|
|
2247
|
+
slug: MiniAppSlugSchema,
|
|
2248
|
+
name: z19.string(),
|
|
2249
|
+
icon: MiniAppIconSchema,
|
|
2250
|
+
pages: z19.array(z19.object({ slug: MiniAppSlugSchema, title: z19.string() })).min(1),
|
|
2251
|
+
/** What it reads (`miniAppReads`). Absent from an older API: the Studio then claims nothing it cannot see. */
|
|
2252
|
+
reads: z19.array(z19.string()).optional()
|
|
2253
|
+
});
|
|
2254
|
+
var MiniAppSchema = MiniAppSummarySchema.extend({
|
|
2255
|
+
networks: z19.array(z19.object({ platform: SocialPlatformSchema, connected: z19.boolean().nullable() })),
|
|
2256
|
+
page: MiniAppSlugSchema,
|
|
2257
|
+
as_of: Timestamp,
|
|
2258
|
+
timezone: z19.string().min(1),
|
|
2259
|
+
spec: ResolvedPageSpecSchema
|
|
2260
|
+
});
|
|
2261
|
+
|
|
2262
|
+
// ../core/src/schema/blueprint.ts
|
|
2263
|
+
var BlueprintScheduleSchema = z20.object({
|
|
2264
|
+
agent: z20.string().min(1),
|
|
2265
|
+
cron: z20.string().min(1),
|
|
2266
|
+
timezone: z20.string().nullable(),
|
|
2267
|
+
/** The message each fire opens its session with — the sentence worth printing. */
|
|
2268
|
+
input: z20.string().min(1),
|
|
2269
|
+
/** What a fire does in a few words, as the template says it (ADR-1172); absent on a row that declares none. */
|
|
2270
|
+
summary: z20.string().min(1).optional(),
|
|
2271
|
+
budget_micro_usd: MicroUsdField.nonnegative()
|
|
2272
|
+
});
|
|
2273
|
+
var BlueprintBudgetSchema = BlueprintScheduleSchema.pick({ agent: true, cron: true, budget_micro_usd: true });
|
|
2274
|
+
var BlueprintCrewSchema = z20.object({
|
|
2275
|
+
name: z20.string().min(1),
|
|
2276
|
+
description: z20.string().nullable(),
|
|
2277
|
+
model: z20.string().min(1),
|
|
2278
|
+
briefed: z20.boolean(),
|
|
2279
|
+
intake: z20.string().nullable().optional(),
|
|
2280
|
+
/** What the first session may spend: the intake's own cap, else the agent's (§31.4). Set iff `briefed`. */
|
|
2281
|
+
intake_micro_usd: MicroUsdField.nonnegative().optional(),
|
|
2282
|
+
role: z20.string().min(1).optional(),
|
|
2283
|
+
skills: z20.array(SkillRefSchema).optional(),
|
|
2284
|
+
tools: z20.array(z20.string().min(1)).optional(),
|
|
2285
|
+
required: z20.boolean().optional()
|
|
2286
|
+
});
|
|
2287
|
+
var BlueprintAppSchema = z20.object({
|
|
2288
|
+
name: z20.string().min(1),
|
|
2289
|
+
type: AppTypeSchema,
|
|
2290
|
+
description: z20.string().nullable(),
|
|
2291
|
+
mcp: z20.string().nullable().optional(),
|
|
2292
|
+
tools: z20.array(z20.string().min(1)).optional(),
|
|
2293
|
+
/** Whether an install may deselect it (§31.2). Optional: the rollout argument above. */
|
|
2294
|
+
required: z20.boolean().optional()
|
|
2295
|
+
});
|
|
2296
|
+
var BlueprintIdentitySchema = z20.object({
|
|
2297
|
+
name: z20.string().min(1),
|
|
2298
|
+
description: z20.string().nullable()
|
|
2299
|
+
});
|
|
2300
|
+
var ContentHashSchema = z20.string().regex(/^[0-9a-f]{64}$/, "a lowercase sha-256 hex digest");
|
|
2301
|
+
var BlueprintTaskSchema = z20.object({ title: z20.string().min(1), assignee: z20.string().min(1).nullable() });
|
|
2302
|
+
var BlueprintMiniAppSchema = z20.object({ slug: MiniAppSlugSchema, name: z20.string().min(1), icon: MiniAppIconSchema });
|
|
2303
|
+
var BlueprintTreeSchema = z20.object({
|
|
2304
|
+
/** `apps[].name` in the declaration — the same name §31.5 prints and the install ensures by. */
|
|
2305
|
+
app: z20.string().min(1),
|
|
2306
|
+
content_hash: ContentHashSchema
|
|
2307
|
+
});
|
|
2308
|
+
var BlueprintArtifactSchema = z20.object({
|
|
2309
|
+
id: idOf("bpa"),
|
|
2310
|
+
object: z20.literal("blueprint_artifact"),
|
|
2311
|
+
/** The machine — its repository, screens and `/api/*`. */
|
|
2312
|
+
blueprint: z20.string().min(1),
|
|
2313
|
+
/** Which of that blueprint's templates provides the crew. */
|
|
2314
|
+
template: z20.string().min(1),
|
|
2315
|
+
/** The blueprint repository's own released version. Stored, never parsed (ADR-0401). */
|
|
2316
|
+
version: z20.string().min(1),
|
|
2317
|
+
/**
|
|
2318
|
+
* What a person calls the template, one line on what its crew does, and the networks it publishes
|
|
2319
|
+
* to — printed, never provisioned (§31.5, ADR-0921). `platforms` is decoration: where the crew
|
|
2320
|
+
* posts is the accounts connected to its persona. Optional for the §31.5 rollout reason.
|
|
2321
|
+
*/
|
|
2322
|
+
title: z20.string().min(1).optional(),
|
|
2323
|
+
description: z20.string().min(1).optional(),
|
|
2324
|
+
platforms: z20.array(SocialPlatformSchema).optional(),
|
|
2325
|
+
/**
|
|
2326
|
+
* The built trees, one per deployable app, ordered as the declaration orders its apps. Empty for
|
|
2327
|
+
* a data-only blueprint: it declares no app, builds nothing, and still ships a crew (ADR-0900).
|
|
2328
|
+
*/
|
|
2329
|
+
trees: z20.array(BlueprintTreeSchema),
|
|
2330
|
+
/**
|
|
2331
|
+
* The setup questions, asked by the studio **before** provisioning. `QuestionField` (§7.1) is
|
|
2332
|
+
* reused rather than restated: a setup question and a question a parked agent asks are the same
|
|
2333
|
+
* object at different times, so one component renders both.
|
|
2334
|
+
*/
|
|
2335
|
+
questions: z20.array(QuestionFieldSchema),
|
|
2336
|
+
schedules: z20.array(BlueprintScheduleSchema),
|
|
2337
|
+
/** Who the crew is, and what it deploys — §31.5. Derived from `declaration`, never stored twice. */
|
|
2338
|
+
agents: z20.array(BlueprintCrewSchema),
|
|
2339
|
+
apps: z20.array(BlueprintAppSchema),
|
|
2340
|
+
/**
|
|
2341
|
+
* The agents a template creates per client the operator signs — printed, never provisioned by an
|
|
2342
|
+
* apply (§31.1). Absent on rows published before WS12 v2, hence optional.
|
|
2343
|
+
*/
|
|
2344
|
+
crew_per_client: z20.array(BlueprintCrewSchema).optional(),
|
|
2345
|
+
/**
|
|
2346
|
+
* The personas the crew posts from, and which accounts to connect to each before the crew
|
|
2347
|
+
* exists (§31.10). Derived from `declaration` like `agents`; optional for the §31.5 rollout reason.
|
|
2348
|
+
*/
|
|
2349
|
+
identities: z20.array(BlueprintIdentitySchema).optional(),
|
|
2350
|
+
/**
|
|
2351
|
+
* The crew's first work: the cards an apply seeds on the board (§31.11), as a title and who has
|
|
2352
|
+
* it, in the declared order. Derived from `declaration` like `agents`, so a person reads day one
|
|
2353
|
+
* before paying for it (the launch roadmap, ADR-1170); optional for the §31.5 rollout reason.
|
|
2354
|
+
*/
|
|
2355
|
+
tasks: z20.array(BlueprintTaskSchema).optional(),
|
|
2356
|
+
/**
|
|
2357
|
+
* The mini apps the template brings (§50.1): no tree, no deploy, so they are not in `apps`, and a
|
|
2358
|
+
* person is shown them beside the hosted ones before paying (ADR-1171). Derived from
|
|
2359
|
+
* `declaration.mini_apps` like `tasks`; optional for the §31.5 rollout reason.
|
|
2360
|
+
*/
|
|
2361
|
+
mini_apps: z20.array(BlueprintMiniAppSchema).optional(),
|
|
2362
|
+
/** The first week in the template's own words (ADR-1172): Day 1, what each day after it carries, and what follows the week. */
|
|
2363
|
+
roadmap: z20.object({ day_one: z20.string().min(1).optional(), every_day: z20.string().min(1).optional(), after: z20.string().min(1).optional() }).optional(),
|
|
2364
|
+
/**
|
|
2365
|
+
* The creator template a row was published from (§42.8), `null` on every first-party row.
|
|
2366
|
+
* `creator_name` is the public display name the landing page credits. The API sends all three
|
|
2367
|
+
* on every row; they are optional here only so an artifact typed before §42 still reads.
|
|
2368
|
+
*/
|
|
2369
|
+
creator_template_id: idOf("ctp").nullish(),
|
|
2370
|
+
creator_template_version: z20.number().int().positive().nullish(),
|
|
2371
|
+
creator_name: z20.string().min(1).nullish(),
|
|
2372
|
+
/**
|
|
2373
|
+
* The listing a reviewer curated for a creator row (§42.8): its one-line pitch, and a public
|
|
2374
|
+
* sample video with its poster frame. Optional and nullish — a first-party row and a row whose
|
|
2375
|
+
* listing names no hero carry none, and the landing page prints only what is present.
|
|
2376
|
+
*/
|
|
2377
|
+
creator_tagline: z20.string().min(1).nullish(),
|
|
2378
|
+
creator_hero_url: z20.string().url().nullish(),
|
|
2379
|
+
creator_hero_poster_url: z20.string().url().nullish(),
|
|
2380
|
+
published_at: Timestamp
|
|
2381
|
+
});
|
|
2382
|
+
|
|
2383
|
+
// ../core/src/schema/vault.ts
|
|
2384
|
+
import { z as z21 } from "zod";
|
|
2385
|
+
var VaultCredentialKindSchema = z21.enum(["env_var", "static_bearer", "mcp_oauth"]);
|
|
2386
|
+
var VaultSchema = z21.object({
|
|
2387
|
+
id: idOf("vlt"),
|
|
2388
|
+
object: z21.literal("vault"),
|
|
2389
|
+
identity_id: idOf("idn").nullable(),
|
|
2390
|
+
display_name: z21.string().min(1).max(128),
|
|
2391
|
+
credential_count: z21.number().int().nonnegative(),
|
|
2392
|
+
created_at: Timestamp
|
|
2393
|
+
});
|
|
2394
|
+
var VaultCredentialSchema = z21.object({
|
|
2395
|
+
id: idOf("vcr"),
|
|
2396
|
+
object: z21.literal("vault_credential"),
|
|
2397
|
+
vault_id: idOf("vlt"),
|
|
2398
|
+
kind: VaultCredentialKindSchema,
|
|
2399
|
+
/** For `env_var`, the environment variable name. For the MCP kinds, a display label. */
|
|
2400
|
+
key: z21.string().min(1).max(128),
|
|
2401
|
+
/** The exact destination host an `env_var` credential is bound to. Never a wildcard. */
|
|
2402
|
+
host: z21.string().nullable(),
|
|
2403
|
+
/** The exact MCP server URL an `mcp_*` token is matched to. */
|
|
2404
|
+
mcp_server_url: z21.url().nullable(),
|
|
2405
|
+
/**
|
|
2406
|
+
* The one agent this credential may be injected into (ADR-1097). `null` is any agent that
|
|
2407
|
+
* declares `mcp_server_url` — except the platform's own `/v1/mcp`, whose key is never injected
|
|
2408
|
+
* unbound. Set at create, by `admin`, and immutable like the rest. Defaults to `null` so a
|
|
2409
|
+
* client reading a control plane older than the field still parses the row.
|
|
2410
|
+
*/
|
|
2411
|
+
agent_id: idOf("agt").nullable().default(null),
|
|
2412
|
+
placeholder_ref: z21.string(),
|
|
2413
|
+
expires_at: Timestamp.nullable(),
|
|
2414
|
+
last_injected_at: Timestamp.nullable(),
|
|
2415
|
+
created_at: Timestamp
|
|
2416
|
+
});
|
|
2417
|
+
|
|
2418
|
+
// ../core/src/schema/handoff.ts
|
|
2419
|
+
import { z as z22 } from "zod";
|
|
2420
|
+
var MAX_HANDOFF_TARGETS = 6;
|
|
2421
|
+
var HandoffRequestSchema = z22.object({
|
|
2422
|
+
agent: z22.string().min(1),
|
|
2423
|
+
message: z22.string().min(1),
|
|
2424
|
+
handoff_key: z22.string().min(1).max(128).optional(),
|
|
2425
|
+
budget_micro_usd: z22.number().int().positive().optional()
|
|
2426
|
+
});
|
|
2427
|
+
var HandoffSchema = z22.object({
|
|
2428
|
+
object: z22.literal("handoff"),
|
|
2429
|
+
session_id: idOf("ses"),
|
|
2430
|
+
status: z22.enum(["queued", "already_running"]),
|
|
2431
|
+
handoff_key: z22.string().nullable()
|
|
2432
|
+
});
|
|
2433
|
+
var SessionHandoffRequestSchema = z22.object({
|
|
2434
|
+
agents: z22.array(z22.string().min(1)).min(1).max(MAX_HANDOFF_TARGETS),
|
|
2435
|
+
message: z22.string().min(1),
|
|
2436
|
+
handoff_key: z22.string().min(1).max(128).optional(),
|
|
2437
|
+
budget_micro_usd: z22.number().int().positive().optional()
|
|
2438
|
+
});
|
|
2439
|
+
var HandoffRefusalSchema = z22.object({
|
|
2440
|
+
object: z22.literal("handoff_refusal"),
|
|
2441
|
+
agent: z22.string(),
|
|
2442
|
+
code: z22.string(),
|
|
2443
|
+
message: z22.string()
|
|
2444
|
+
});
|
|
2445
|
+
var HandoffBatchSchema = z22.object({
|
|
2446
|
+
object: z22.literal("handoff_batch"),
|
|
2447
|
+
handoffs: z22.array(HandoffSchema.extend({ agent_id: idOf("agt") })),
|
|
2448
|
+
refusals: z22.array(HandoffRefusalSchema)
|
|
2449
|
+
});
|
|
2450
|
+
var SessionHandoffSchema = z22.object({
|
|
2451
|
+
from_session: idOf("ses"),
|
|
2452
|
+
from_agent: idOf("agt"),
|
|
2453
|
+
key: z22.string().nullable(),
|
|
2454
|
+
depth: z22.number().int().positive()
|
|
2455
|
+
});
|
|
2456
|
+
var ChannelBriefSchema = z22.object({
|
|
2457
|
+
root_session_id: idOf("ses"),
|
|
2458
|
+
name: z22.string().min(1),
|
|
2459
|
+
members: z22.array(z22.string().min(1)),
|
|
2460
|
+
/**
|
|
2461
|
+
* The receiver's own name, so it can tell the part of a post addressed to it from a teammate's
|
|
2462
|
+
* (ADR-1099). Optional: a brief pinned before it existed still parses.
|
|
2463
|
+
*/
|
|
2464
|
+
you: z22.string().min(1).optional()
|
|
2465
|
+
});
|
|
2466
|
+
var ChannelPostRequestSchema = z22.object({
|
|
2467
|
+
message: z22.string().min(1).max(2e4)
|
|
2468
|
+
});
|
|
2469
|
+
var ChannelPostSchema = z22.object({
|
|
2470
|
+
object: z22.literal("channel_post"),
|
|
2471
|
+
root_session_id: idOf("ses"),
|
|
2472
|
+
queued: z22.boolean()
|
|
2473
|
+
});
|
|
2188
2474
|
|
|
2189
2475
|
// ../core/src/schema/compose.ts
|
|
2476
|
+
import { z as z23 } from "zod";
|
|
2190
2477
|
var COMPOSE_COMPONENTS = ["Card", "Stack", "Grid", "Metric", "LineChart", "BarList", "Progress", "Roadmap", "Schedule", "Media", "Text"];
|
|
2191
2478
|
var MAX_COMPOSE_ELEMENTS = 24;
|
|
2192
2479
|
var BoundComponents = catalog(Bound);
|
|
2193
2480
|
var ComposeSpecSchema = spec(
|
|
2194
|
-
|
|
2481
|
+
z23.discriminatedUnion(
|
|
2195
2482
|
"type",
|
|
2196
2483
|
[
|
|
2197
2484
|
BoundComponents.Card,
|
|
@@ -2211,14 +2498,14 @@ var ComposeSpecSchema = spec(
|
|
|
2211
2498
|
"Card",
|
|
2212
2499
|
MAX_COMPOSE_ELEMENTS
|
|
2213
2500
|
);
|
|
2214
|
-
var ComposeArgsSchema =
|
|
2501
|
+
var ComposeArgsSchema = z23.object({
|
|
2215
2502
|
spec: ComposeSpecSchema.describe(
|
|
2216
2503
|
'A json-render spec: { "root": key, "elements": { key: { "type", "props", "children"? } } }. The root is one Card.'
|
|
2217
2504
|
)
|
|
2218
2505
|
});
|
|
2219
2506
|
var ComposedComponents = catalog(Resolved);
|
|
2220
2507
|
var ComposedSpecSchema = spec(
|
|
2221
|
-
|
|
2508
|
+
z23.discriminatedUnion(
|
|
2222
2509
|
"type",
|
|
2223
2510
|
[
|
|
2224
2511
|
ComposedComponents.Card,
|
|
@@ -2238,39 +2525,39 @@ var ComposedSpecSchema = spec(
|
|
|
2238
2525
|
"Card",
|
|
2239
2526
|
MAX_COMPOSE_ELEMENTS
|
|
2240
2527
|
);
|
|
2241
|
-
var ComposedSchema =
|
|
2528
|
+
var ComposedSchema = z23.object({ as_of: Timestamp, timezone: z23.string().min(1), spec: ComposedSpecSchema });
|
|
2242
2529
|
|
|
2243
2530
|
// ../core/src/schema/media.ts
|
|
2244
|
-
import { z as
|
|
2531
|
+
import { z as z24 } from "zod";
|
|
2245
2532
|
var MEDIA_JOB_KINDS = ["video", "clip", "transcription"];
|
|
2246
|
-
var MediaJobKindSchema =
|
|
2247
|
-
var MediaJobStatusSchema =
|
|
2248
|
-
var PublicUrl =
|
|
2249
|
-
var Score =
|
|
2250
|
-
var Seconds =
|
|
2251
|
-
var VideoResultSchema =
|
|
2252
|
-
files:
|
|
2253
|
-
|
|
2533
|
+
var MediaJobKindSchema = z24.enum(MEDIA_JOB_KINDS);
|
|
2534
|
+
var MediaJobStatusSchema = z24.enum(["queued", "processing", "completed", "failed"]);
|
|
2535
|
+
var PublicUrl = z24.string().url().startsWith("http");
|
|
2536
|
+
var Score = z24.number().int().min(0).max(100);
|
|
2537
|
+
var Seconds = z24.number().nonnegative();
|
|
2538
|
+
var VideoResultSchema = z24.object({
|
|
2539
|
+
files: z24.array(
|
|
2540
|
+
z24.object({
|
|
2254
2541
|
file_id: idOf("fil"),
|
|
2255
|
-
content_type:
|
|
2256
|
-
width:
|
|
2257
|
-
height:
|
|
2542
|
+
content_type: z24.string(),
|
|
2543
|
+
width: z24.number().int().positive().nullable(),
|
|
2544
|
+
height: z24.number().int().positive().nullable(),
|
|
2258
2545
|
duration_seconds: Seconds.nullable()
|
|
2259
2546
|
})
|
|
2260
2547
|
)
|
|
2261
2548
|
});
|
|
2262
|
-
var ViralityScoreSchema =
|
|
2549
|
+
var ViralityScoreSchema = z24.object({
|
|
2263
2550
|
total: Score,
|
|
2264
2551
|
shareability: Score,
|
|
2265
2552
|
hook_strength: Score,
|
|
2266
2553
|
story_quality: Score,
|
|
2267
2554
|
emotional_impact: Score
|
|
2268
2555
|
});
|
|
2269
|
-
var ClipResultSchema =
|
|
2270
|
-
clips:
|
|
2271
|
-
|
|
2556
|
+
var ClipResultSchema = z24.object({
|
|
2557
|
+
clips: z24.array(
|
|
2558
|
+
z24.object({
|
|
2272
2559
|
file_id: idOf("fil"),
|
|
2273
|
-
title:
|
|
2560
|
+
title: z24.string(),
|
|
2274
2561
|
start_seconds: Seconds,
|
|
2275
2562
|
end_seconds: Seconds,
|
|
2276
2563
|
duration_seconds: Seconds,
|
|
@@ -2278,192 +2565,192 @@ var ClipResultSchema = z23.object({
|
|
|
2278
2565
|
})
|
|
2279
2566
|
)
|
|
2280
2567
|
});
|
|
2281
|
-
var TranscriptSchema =
|
|
2282
|
-
text:
|
|
2283
|
-
language:
|
|
2568
|
+
var TranscriptSchema = z24.object({
|
|
2569
|
+
text: z24.string(),
|
|
2570
|
+
language: z24.string().nullable(),
|
|
2284
2571
|
duration_seconds: Seconds.nullable(),
|
|
2285
|
-
segments:
|
|
2572
|
+
segments: z24.array(z24.object({ start_seconds: Seconds, end_seconds: Seconds, text: z24.string() }))
|
|
2286
2573
|
});
|
|
2287
|
-
var MediaJobResultSchema =
|
|
2288
|
-
var MediaJobSchema =
|
|
2574
|
+
var MediaJobResultSchema = z24.union([VideoResultSchema, ClipResultSchema, TranscriptSchema]);
|
|
2575
|
+
var MediaJobSchema = z24.object({
|
|
2289
2576
|
id: idOf("med"),
|
|
2290
|
-
object:
|
|
2577
|
+
object: z24.literal("media_job"),
|
|
2291
2578
|
kind: MediaJobKindSchema,
|
|
2292
2579
|
status: MediaJobStatusSchema,
|
|
2293
|
-
model:
|
|
2294
|
-
input:
|
|
2580
|
+
model: z24.string().nullable(),
|
|
2581
|
+
input: z24.record(z24.string(), z24.unknown()),
|
|
2295
2582
|
result: MediaJobResultSchema.nullable(),
|
|
2296
|
-
error:
|
|
2583
|
+
error: z24.object({ code: z24.string(), message: z24.string() }).nullable(),
|
|
2297
2584
|
cost_micro_usd: MicroUsdField.nullable(),
|
|
2298
2585
|
session_id: idOf("ses").nullable(),
|
|
2299
2586
|
created_at: Timestamp,
|
|
2300
2587
|
completed_at: Timestamp.nullable()
|
|
2301
2588
|
});
|
|
2302
|
-
var ImageRequestSchema =
|
|
2303
|
-
model:
|
|
2304
|
-
prompt:
|
|
2305
|
-
image_urls:
|
|
2306
|
-
aspect_ratio:
|
|
2307
|
-
seed:
|
|
2308
|
-
n:
|
|
2589
|
+
var ImageRequestSchema = z24.object({
|
|
2590
|
+
model: z24.string().min(1).optional(),
|
|
2591
|
+
prompt: z24.string().min(1),
|
|
2592
|
+
image_urls: z24.array(PublicUrl).max(4).optional(),
|
|
2593
|
+
aspect_ratio: z24.string().optional(),
|
|
2594
|
+
seed: z24.number().int().optional(),
|
|
2595
|
+
n: z24.number().int().min(1).max(4).default(1)
|
|
2309
2596
|
});
|
|
2310
|
-
var VideoRequestSchema =
|
|
2597
|
+
var VideoRequestSchema = z24.object({
|
|
2311
2598
|
/** Omitted: the platform's video default while the catalogue publishes it (`resolveModel`, §33.2). */
|
|
2312
|
-
model:
|
|
2313
|
-
prompt:
|
|
2314
|
-
image_urls:
|
|
2599
|
+
model: z24.string().min(1).optional(),
|
|
2600
|
+
prompt: z24.string().min(1),
|
|
2601
|
+
image_urls: z24.array(PublicUrl).max(1).optional(),
|
|
2315
2602
|
/** The source clip of a video-to-video edit (ADR-0814). */
|
|
2316
2603
|
video_url: PublicUrl.optional(),
|
|
2317
|
-
aspect_ratio:
|
|
2318
|
-
seed:
|
|
2319
|
-
seconds:
|
|
2320
|
-
});
|
|
2321
|
-
var ImageGenerationSchema =
|
|
2322
|
-
object:
|
|
2323
|
-
model:
|
|
2324
|
-
files:
|
|
2604
|
+
aspect_ratio: z24.string().optional(),
|
|
2605
|
+
seed: z24.number().int().optional(),
|
|
2606
|
+
seconds: z24.number().int().min(1).max(60).optional()
|
|
2607
|
+
});
|
|
2608
|
+
var ImageGenerationSchema = z24.object({
|
|
2609
|
+
object: z24.literal("image_generation"),
|
|
2610
|
+
model: z24.string(),
|
|
2611
|
+
files: z24.array(FileSchema),
|
|
2325
2612
|
cost_micro_usd: MicroUsdField
|
|
2326
2613
|
});
|
|
2327
|
-
var ClipLength =
|
|
2328
|
-
var ClipRequestSchema =
|
|
2614
|
+
var ClipLength = z24.number().int().min(5).max(180);
|
|
2615
|
+
var ClipRequestSchema = z24.object({
|
|
2329
2616
|
video_url: PublicUrl,
|
|
2330
|
-
aspect_ratio:
|
|
2331
|
-
remove_silence:
|
|
2332
|
-
caption_preset:
|
|
2333
|
-
language:
|
|
2617
|
+
aspect_ratio: z24.enum(["9:16", "16:9"]).default("9:16"),
|
|
2618
|
+
remove_silence: z24.boolean().default(false),
|
|
2619
|
+
caption_preset: z24.enum(["none", "clean", "bold", "karaoke"]).default("none"),
|
|
2620
|
+
language: z24.string().min(2).optional(),
|
|
2334
2621
|
min_seconds: ClipLength.default(15),
|
|
2335
2622
|
max_seconds: ClipLength.default(60),
|
|
2336
|
-
title:
|
|
2623
|
+
title: z24.string().min(1).optional()
|
|
2337
2624
|
});
|
|
2338
|
-
var AudioFormatSchema =
|
|
2339
|
-
var TranscriptionRequestSchema =
|
|
2340
|
-
model:
|
|
2625
|
+
var AudioFormatSchema = z24.enum(["mp3", "wav", "ogg"]);
|
|
2626
|
+
var TranscriptionRequestSchema = z24.object({
|
|
2627
|
+
model: z24.string().min(1).optional(),
|
|
2341
2628
|
file_id: idOf("fil").optional(),
|
|
2342
2629
|
url: PublicUrl.optional(),
|
|
2343
|
-
language:
|
|
2344
|
-
timestamps:
|
|
2630
|
+
language: z24.string().min(2).optional(),
|
|
2631
|
+
timestamps: z24.boolean().default(true)
|
|
2345
2632
|
}).refine((request) => request.file_id === void 0 !== (request.url === void 0), {
|
|
2346
2633
|
error: "exactly one of file_id or url",
|
|
2347
2634
|
path: ["file_id"]
|
|
2348
2635
|
});
|
|
2349
|
-
var SpeechRequestSchema =
|
|
2350
|
-
model:
|
|
2351
|
-
text:
|
|
2352
|
-
voice:
|
|
2636
|
+
var SpeechRequestSchema = z24.object({
|
|
2637
|
+
model: z24.string().min(1).optional(),
|
|
2638
|
+
text: z24.string().min(1).max(4096),
|
|
2639
|
+
voice: z24.string().min(1).optional(),
|
|
2353
2640
|
format: AudioFormatSchema.default("mp3"),
|
|
2354
|
-
speed:
|
|
2641
|
+
speed: z24.number().min(0.5).max(2).optional()
|
|
2355
2642
|
});
|
|
2356
|
-
var SpeechToSpeechRequestSchema =
|
|
2357
|
-
model:
|
|
2643
|
+
var SpeechToSpeechRequestSchema = z24.object({
|
|
2644
|
+
model: z24.string().min(1).optional(),
|
|
2358
2645
|
file_id: idOf("fil"),
|
|
2359
|
-
voice:
|
|
2646
|
+
voice: z24.string().min(1).optional(),
|
|
2360
2647
|
format: AudioFormatSchema.default("mp3")
|
|
2361
2648
|
});
|
|
2362
|
-
var SpeechGenerationSchema =
|
|
2363
|
-
object:
|
|
2364
|
-
model:
|
|
2649
|
+
var SpeechGenerationSchema = z24.object({
|
|
2650
|
+
object: z24.literal("speech_generation"),
|
|
2651
|
+
model: z24.string(),
|
|
2365
2652
|
file: FileSchema,
|
|
2366
2653
|
duration_seconds: Seconds.nullable(),
|
|
2367
2654
|
cost_micro_usd: MicroUsdField
|
|
2368
2655
|
});
|
|
2369
2656
|
|
|
2370
2657
|
// ../core/src/schema/app-data.ts
|
|
2371
|
-
import { z as
|
|
2372
|
-
var DbTableSchema =
|
|
2373
|
-
object:
|
|
2374
|
-
name:
|
|
2375
|
-
schema:
|
|
2376
|
-
rows:
|
|
2377
|
-
size_bytes:
|
|
2378
|
-
});
|
|
2379
|
-
var DbMigrationSchema =
|
|
2658
|
+
import { z as z25 } from "zod";
|
|
2659
|
+
var DbTableSchema = z25.object({
|
|
2660
|
+
object: z25.literal("db_table"),
|
|
2661
|
+
name: z25.string(),
|
|
2662
|
+
schema: z25.string().default("public"),
|
|
2663
|
+
rows: z25.number().int().nonnegative().nullable(),
|
|
2664
|
+
size_bytes: z25.number().int().nonnegative().nullable()
|
|
2665
|
+
});
|
|
2666
|
+
var DbMigrationSchema = z25.object({
|
|
2380
2667
|
id: idOf("dbm"),
|
|
2381
|
-
object:
|
|
2382
|
-
name:
|
|
2383
|
-
sha256:
|
|
2668
|
+
object: z25.literal("db_migration"),
|
|
2669
|
+
name: z25.string(),
|
|
2670
|
+
sha256: z25.string().regex(/^[0-9a-f]{64}$/),
|
|
2384
2671
|
applied_at: Timestamp,
|
|
2385
|
-
statements:
|
|
2672
|
+
statements: z25.number().int().nonnegative()
|
|
2386
2673
|
});
|
|
2387
|
-
var ApplyDbMigrationSchema =
|
|
2388
|
-
name:
|
|
2389
|
-
sql:
|
|
2674
|
+
var ApplyDbMigrationSchema = z25.object({
|
|
2675
|
+
name: z25.string().min(1).max(128).regex(/^[a-z0-9][a-z0-9_-]*$/),
|
|
2676
|
+
sql: z25.string().min(1)
|
|
2390
2677
|
});
|
|
2391
2678
|
var DB_REST_METHODS = ["GET", "POST", "PATCH", "PUT", "DELETE", "HEAD"];
|
|
2392
|
-
var DbRestMethodSchema =
|
|
2679
|
+
var DbRestMethodSchema = z25.enum(DB_REST_METHODS);
|
|
2393
2680
|
var BUCKET_NAME = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
2394
|
-
var BucketSchema =
|
|
2395
|
-
object:
|
|
2396
|
-
name:
|
|
2397
|
-
public:
|
|
2681
|
+
var BucketSchema = z25.object({
|
|
2682
|
+
object: z25.literal("bucket"),
|
|
2683
|
+
name: z25.string().regex(BUCKET_NAME),
|
|
2684
|
+
public: z25.boolean(),
|
|
2398
2685
|
created_at: Timestamp
|
|
2399
2686
|
});
|
|
2400
|
-
var CreateBucketSchema =
|
|
2401
|
-
name:
|
|
2402
|
-
public:
|
|
2403
|
-
});
|
|
2404
|
-
var StorageObjectSchema =
|
|
2405
|
-
object:
|
|
2406
|
-
bucket:
|
|
2407
|
-
key:
|
|
2408
|
-
size_bytes:
|
|
2409
|
-
content_type:
|
|
2410
|
-
etag:
|
|
2687
|
+
var CreateBucketSchema = z25.object({
|
|
2688
|
+
name: z25.string().regex(BUCKET_NAME, { error: "3\u201363 lowercase letters, digits and hyphens" }),
|
|
2689
|
+
public: z25.boolean().default(false)
|
|
2690
|
+
});
|
|
2691
|
+
var StorageObjectSchema = z25.object({
|
|
2692
|
+
object: z25.literal("storage_object"),
|
|
2693
|
+
bucket: z25.string(),
|
|
2694
|
+
key: z25.string().min(1),
|
|
2695
|
+
size_bytes: z25.number().int().nonnegative(),
|
|
2696
|
+
content_type: z25.string(),
|
|
2697
|
+
etag: z25.string().nullable(),
|
|
2411
2698
|
updated_at: Timestamp
|
|
2412
2699
|
});
|
|
2413
|
-
var SignedUrlMethodSchema =
|
|
2414
|
-
var SignedUrlSchema =
|
|
2415
|
-
object:
|
|
2416
|
-
url:
|
|
2700
|
+
var SignedUrlMethodSchema = z25.enum(["PUT", "GET"]);
|
|
2701
|
+
var SignedUrlSchema = z25.object({
|
|
2702
|
+
object: z25.literal("signed_url"),
|
|
2703
|
+
url: z25.string().url(),
|
|
2417
2704
|
method: SignedUrlMethodSchema,
|
|
2418
2705
|
expires_at: Timestamp
|
|
2419
2706
|
});
|
|
2420
|
-
var CreateUploadUrlSchema =
|
|
2421
|
-
content_type:
|
|
2422
|
-
expires_seconds:
|
|
2707
|
+
var CreateUploadUrlSchema = z25.object({
|
|
2708
|
+
content_type: z25.string().min(1),
|
|
2709
|
+
expires_seconds: z25.number().int().min(60).max(3600).default(900)
|
|
2423
2710
|
});
|
|
2424
2711
|
|
|
2425
2712
|
// ../core/src/schema/stock-photo.ts
|
|
2426
|
-
import { z as
|
|
2713
|
+
import { z as z26 } from "zod";
|
|
2427
2714
|
var STOCK_PHOTO_ORIENTATIONS = ["landscape", "portrait", "square"];
|
|
2428
2715
|
var STOCK_PHOTO_SIZES = ["small", "medium", "large"];
|
|
2429
|
-
var StockPhotoQuerySchema =
|
|
2430
|
-
query:
|
|
2431
|
-
count:
|
|
2432
|
-
orientation:
|
|
2433
|
-
color:
|
|
2434
|
-
size:
|
|
2435
|
-
});
|
|
2436
|
-
var StockPhotoSchema =
|
|
2437
|
-
object:
|
|
2438
|
-
id:
|
|
2439
|
-
width:
|
|
2440
|
-
height:
|
|
2441
|
-
url:
|
|
2442
|
-
preview_url:
|
|
2443
|
-
alt:
|
|
2444
|
-
photographer:
|
|
2445
|
-
attribution_url:
|
|
2446
|
-
dominant_color:
|
|
2716
|
+
var StockPhotoQuerySchema = z26.object({
|
|
2717
|
+
query: z26.string().min(1).max(200),
|
|
2718
|
+
count: z26.coerce.number().int().min(1).max(30).default(10),
|
|
2719
|
+
orientation: z26.enum(STOCK_PHOTO_ORIENTATIONS).optional(),
|
|
2720
|
+
color: z26.string().min(1).max(32).optional(),
|
|
2721
|
+
size: z26.enum(STOCK_PHOTO_SIZES).optional()
|
|
2722
|
+
});
|
|
2723
|
+
var StockPhotoSchema = z26.object({
|
|
2724
|
+
object: z26.literal("stock_photo"),
|
|
2725
|
+
id: z26.string().min(1),
|
|
2726
|
+
width: z26.number().int().positive(),
|
|
2727
|
+
height: z26.number().int().positive(),
|
|
2728
|
+
url: z26.string().url(),
|
|
2729
|
+
preview_url: z26.string().url(),
|
|
2730
|
+
alt: z26.string().nullable(),
|
|
2731
|
+
photographer: z26.string().nullable(),
|
|
2732
|
+
attribution_url: z26.string().url().nullable(),
|
|
2733
|
+
dominant_color: z26.string().nullable()
|
|
2447
2734
|
});
|
|
2448
2735
|
|
|
2449
2736
|
// ../core/src/schema/creator.ts
|
|
2450
|
-
import { z as
|
|
2451
|
-
var CreatorCodeSchema =
|
|
2452
|
-
var PayoutMethodSchema =
|
|
2453
|
-
var PayoutDetailsSchema =
|
|
2737
|
+
import { z as z27 } from "zod";
|
|
2738
|
+
var CreatorCodeSchema = z27.string().regex(/^[a-z0-9]{3,24}$/, "3 to 24 lowercase letters or digits");
|
|
2739
|
+
var PayoutMethodSchema = z27.enum(["wise", "paypal"]);
|
|
2740
|
+
var PayoutDetailsSchema = z27.object({
|
|
2454
2741
|
method: PayoutMethodSchema,
|
|
2455
|
-
account:
|
|
2742
|
+
account: z27.string().min(1).max(320)
|
|
2456
2743
|
});
|
|
2457
|
-
var CreatorStatusSchema =
|
|
2458
|
-
var CreatorSchema =
|
|
2744
|
+
var CreatorStatusSchema = z27.enum(["active", "suspended"]);
|
|
2745
|
+
var CreatorSchema = z27.object({
|
|
2459
2746
|
id: idOf("crt"),
|
|
2460
|
-
object:
|
|
2461
|
-
email:
|
|
2462
|
-
display_name:
|
|
2747
|
+
object: z27.literal("creator"),
|
|
2748
|
+
email: z27.email(),
|
|
2749
|
+
display_name: z27.string().min(1).max(80),
|
|
2463
2750
|
code: CreatorCodeSchema,
|
|
2464
2751
|
status: CreatorStatusSchema,
|
|
2465
2752
|
payout: PayoutDetailsSchema.nullable(),
|
|
2466
|
-
clicks:
|
|
2753
|
+
clicks: z27.number().int().nonnegative(),
|
|
2467
2754
|
created_at: Timestamp,
|
|
2468
2755
|
updated_at: Timestamp
|
|
2469
2756
|
});
|
|
@@ -2471,45 +2758,47 @@ var IdentityCreatorSchema = CreatorSchema.pick({
|
|
|
2471
2758
|
id: true,
|
|
2472
2759
|
status: true
|
|
2473
2760
|
});
|
|
2474
|
-
var CreatorApplicationStatusSchema =
|
|
2761
|
+
var CreatorApplicationStatusSchema = z27.enum([
|
|
2475
2762
|
"pending",
|
|
2476
2763
|
"approved",
|
|
2477
2764
|
"rejected"
|
|
2478
2765
|
]);
|
|
2479
|
-
var CreatorApplicationSchema =
|
|
2766
|
+
var CreatorApplicationSchema = z27.object({
|
|
2480
2767
|
id: idOf("cra"),
|
|
2481
|
-
object:
|
|
2482
|
-
email:
|
|
2483
|
-
display_name:
|
|
2484
|
-
pitch:
|
|
2485
|
-
links:
|
|
2768
|
+
object: z27.literal("creator_application"),
|
|
2769
|
+
email: z27.email(),
|
|
2770
|
+
display_name: z27.string().min(1).max(80),
|
|
2771
|
+
pitch: z27.string().min(1).max(2e3),
|
|
2772
|
+
links: z27.array(z27.url({ protocol: /^https$/ })).max(5),
|
|
2486
2773
|
status: CreatorApplicationStatusSchema,
|
|
2487
|
-
note:
|
|
2774
|
+
note: z27.string().nullable(),
|
|
2488
2775
|
creator_id: idOf("crt").nullable(),
|
|
2489
2776
|
created_at: Timestamp,
|
|
2490
2777
|
decided_at: Timestamp.nullable()
|
|
2491
2778
|
});
|
|
2492
|
-
var ReferralStatusSchema =
|
|
2493
|
-
var ReferralSchema =
|
|
2779
|
+
var ReferralStatusSchema = z27.enum(["pending", "active", "expired"]);
|
|
2780
|
+
var ReferralSchema = z27.object({
|
|
2494
2781
|
id: idOf("crf"),
|
|
2495
|
-
object:
|
|
2782
|
+
object: z27.literal("referral"),
|
|
2496
2783
|
creator_id: idOf("crt"),
|
|
2497
2784
|
organization_id: idOf("org"),
|
|
2498
2785
|
status: ReferralStatusSchema,
|
|
2499
2786
|
attributed_at: Timestamp,
|
|
2500
2787
|
first_paid_at: Timestamp.nullable(),
|
|
2501
|
-
commission_until: Timestamp.nullable()
|
|
2788
|
+
commission_until: Timestamp.nullable(),
|
|
2789
|
+
/** Opaque per-creator hash of the referred person, so organizations group by person; never the email. */
|
|
2790
|
+
person_key: z27.string().nullable().optional()
|
|
2502
2791
|
});
|
|
2503
|
-
var CommissionKindSchema =
|
|
2504
|
-
var CommissionStatusSchema =
|
|
2792
|
+
var CommissionKindSchema = z27.enum(["referral", "template"]);
|
|
2793
|
+
var CommissionStatusSchema = z27.enum([
|
|
2505
2794
|
"pending",
|
|
2506
2795
|
"available",
|
|
2507
2796
|
"claimed",
|
|
2508
2797
|
"paid"
|
|
2509
2798
|
]);
|
|
2510
|
-
var CommissionSchema =
|
|
2799
|
+
var CommissionSchema = z27.object({
|
|
2511
2800
|
id: idOf("crc"),
|
|
2512
|
-
object:
|
|
2801
|
+
object: z27.literal("commission"),
|
|
2513
2802
|
creator_id: idOf("crt"),
|
|
2514
2803
|
kind: CommissionKindSchema,
|
|
2515
2804
|
referral_id: idOf("crf").nullable(),
|
|
@@ -2522,123 +2811,290 @@ var CommissionSchema = z26.object({
|
|
|
2522
2811
|
available_at: Timestamp,
|
|
2523
2812
|
payout_id: idOf("crp").nullable()
|
|
2524
2813
|
});
|
|
2525
|
-
var PayoutStatusSchema =
|
|
2526
|
-
var PayoutSchema =
|
|
2814
|
+
var PayoutStatusSchema = z27.enum(["requested", "paid", "rejected"]);
|
|
2815
|
+
var PayoutSchema = z27.object({
|
|
2527
2816
|
id: idOf("crp"),
|
|
2528
|
-
object:
|
|
2817
|
+
object: z27.literal("payout"),
|
|
2529
2818
|
creator_id: idOf("crt"),
|
|
2530
2819
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2531
|
-
currency:
|
|
2820
|
+
currency: z27.literal("USD"),
|
|
2532
2821
|
method: PayoutMethodSchema,
|
|
2533
|
-
account:
|
|
2822
|
+
account: z27.string().min(1),
|
|
2534
2823
|
status: PayoutStatusSchema,
|
|
2535
|
-
reference:
|
|
2536
|
-
note:
|
|
2824
|
+
reference: z27.string().nullable(),
|
|
2825
|
+
note: z27.string().nullable(),
|
|
2537
2826
|
requested_at: Timestamp,
|
|
2538
2827
|
decided_at: Timestamp.nullable()
|
|
2539
2828
|
});
|
|
2540
2829
|
var CREATOR_PROGRAM = {
|
|
2541
|
-
referral_percent:
|
|
2542
|
-
|
|
2830
|
+
referral_percent: 15,
|
|
2831
|
+
/** Of each qualifying subscription invoice of an org whose FIRST install was the template. */
|
|
2832
|
+
template_percent: 15,
|
|
2543
2833
|
commission_months: 12,
|
|
2544
2834
|
hold_days: 30,
|
|
2545
2835
|
attribution_days: 30,
|
|
2546
|
-
|
|
2836
|
+
/** A template install earns only for an org it was installed in within this many days of creation. */
|
|
2837
|
+
template_new_org_days: 35,
|
|
2838
|
+
minimum_payout_micro_usd: 2e7,
|
|
2839
|
+
/** The creator studio's per-draft spend caps; one session never plans past what the draft has left. */
|
|
2840
|
+
studio: {
|
|
2841
|
+
draft_budget_micro_usd: 4e7,
|
|
2842
|
+
author_budget_micro_usd: 8e6,
|
|
2843
|
+
demo_budget_micro_usd: 1e7,
|
|
2844
|
+
uploads: 3,
|
|
2845
|
+
upload_max_bytes: 60 * 1024 * 1024,
|
|
2846
|
+
upload_token_minutes: 15,
|
|
2847
|
+
skill_max_bytes: 32 * 1024
|
|
2848
|
+
}
|
|
2547
2849
|
};
|
|
2548
|
-
var CreatorTemplateSlugSchema =
|
|
2850
|
+
var CreatorTemplateSlugSchema = z27.string().max(32).regex(
|
|
2549
2851
|
/^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
2550
2852
|
"lowercase letters, digits and single dashes"
|
|
2551
2853
|
);
|
|
2552
|
-
var CreatorSkillSchema =
|
|
2553
|
-
slug:
|
|
2554
|
-
body:
|
|
2555
|
-
});
|
|
2556
|
-
var CreatorDeclarationSchema =
|
|
2557
|
-
agents:
|
|
2558
|
-
questions:
|
|
2559
|
-
skills:
|
|
2560
|
-
|
|
2561
|
-
|
|
2854
|
+
var CreatorSkillSchema = z27.object({
|
|
2855
|
+
slug: z27.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
|
|
2856
|
+
body: z27.string().min(1).max(64 * 1024)
|
|
2857
|
+
});
|
|
2858
|
+
var CreatorDeclarationSchema = z27.object({
|
|
2859
|
+
agents: z27.array(z27.unknown()),
|
|
2860
|
+
questions: z27.array(z27.unknown()),
|
|
2861
|
+
skills: z27.array(CreatorSkillSchema).max(16),
|
|
2862
|
+
/** A `niche` version only: the studio round it froze (see `NicheVersionStudioSchema`, below). */
|
|
2863
|
+
studio: z27.lazy(() => NicheVersionStudioSchema).optional()
|
|
2864
|
+
});
|
|
2865
|
+
var CreatorTemplateVersionStatusSchema = z27.enum([
|
|
2562
2866
|
"in_review",
|
|
2563
2867
|
"approved",
|
|
2564
2868
|
"changes_requested"
|
|
2565
2869
|
]);
|
|
2566
|
-
var VersionNumber =
|
|
2567
|
-
var
|
|
2870
|
+
var VersionNumber = z27.number().int().positive();
|
|
2871
|
+
var CreatorTemplateKindSchema = z27.enum(["crew", "niche"]);
|
|
2872
|
+
var StudioStateSchema = z27.enum([
|
|
2873
|
+
"setup",
|
|
2874
|
+
"building",
|
|
2875
|
+
"ready",
|
|
2876
|
+
"in_review",
|
|
2877
|
+
"live",
|
|
2878
|
+
"changes_requested"
|
|
2879
|
+
]);
|
|
2880
|
+
var StudioUploadContentTypeSchema = z27.enum([
|
|
2881
|
+
"video/mp4",
|
|
2882
|
+
"video/quicktime",
|
|
2883
|
+
"video/webm"
|
|
2884
|
+
]);
|
|
2885
|
+
var UploadPosition = z27.number().int().min(1).max(CREATOR_PROGRAM.studio.uploads);
|
|
2886
|
+
var StudioPrompt = z27.string().max(2e3);
|
|
2887
|
+
var StudioUploadSchema = z27.object({
|
|
2888
|
+
position: UploadPosition,
|
|
2889
|
+
file_id: z27.string().nullable(),
|
|
2890
|
+
prompt: StudioPrompt,
|
|
2891
|
+
bytes: z27.number().int().positive().max(CREATOR_PROGRAM.studio.upload_max_bytes),
|
|
2892
|
+
content_type: StudioUploadContentTypeSchema,
|
|
2893
|
+
filename: z27.string().min(1).max(200)
|
|
2894
|
+
});
|
|
2895
|
+
var CreatorStudioSchema = z27.object({
|
|
2896
|
+
uploads: z27.array(StudioUploadSchema).max(CREATOR_PROGRAM.studio.uploads).default([]),
|
|
2897
|
+
state: StudioStateSchema.default("setup"),
|
|
2898
|
+
spend_micro_usd: MicroUsdField.nonnegative().default(0),
|
|
2899
|
+
rights_attested_at: Timestamp.nullable().default(null)
|
|
2900
|
+
});
|
|
2901
|
+
var CreatorTemplateListingSchema = z27.object({
|
|
2902
|
+
listed: z27.boolean(),
|
|
2903
|
+
featured: z27.boolean(),
|
|
2904
|
+
sort_order: z27.number().int(),
|
|
2905
|
+
tagline: z27.string().max(140).nullable(),
|
|
2906
|
+
hero_file_id: z27.string().nullable()
|
|
2907
|
+
});
|
|
2908
|
+
var StudioRoundStateSchema = z27.enum([
|
|
2909
|
+
"queued",
|
|
2910
|
+
"authoring",
|
|
2911
|
+
"rendering",
|
|
2912
|
+
"ready",
|
|
2913
|
+
"failed"
|
|
2914
|
+
]);
|
|
2915
|
+
var StudioFrameSchema = z27.object({
|
|
2916
|
+
file: z27.string().min(1),
|
|
2917
|
+
file_id: z27.string().min(1),
|
|
2918
|
+
role: z27.string()
|
|
2919
|
+
});
|
|
2920
|
+
var StudioSampleSchema = z27.object({
|
|
2921
|
+
file_id: z27.string().min(1),
|
|
2922
|
+
poster_file_id: z27.string().nullable(),
|
|
2923
|
+
seconds: z27.number().nonnegative(),
|
|
2924
|
+
title: z27.string()
|
|
2925
|
+
});
|
|
2926
|
+
var CreatorTemplateRoundSchema = z27.object({
|
|
2927
|
+
object: z27.literal("creator_template_round"),
|
|
2928
|
+
template_id: idOf("ctp"),
|
|
2929
|
+
n: z27.number().int().positive(),
|
|
2930
|
+
feedback: z27.string().nullable(),
|
|
2931
|
+
state: StudioRoundStateSchema,
|
|
2932
|
+
author_session_id: z27.string().nullable(),
|
|
2933
|
+
demo_session_id: z27.string().nullable(),
|
|
2934
|
+
skill_md: z27.string().nullable(),
|
|
2935
|
+
reference_json: z27.unknown().nullable(),
|
|
2936
|
+
frames: z27.array(StudioFrameSchema),
|
|
2937
|
+
samples: z27.array(StudioSampleSchema),
|
|
2938
|
+
spend_micro_usd: MicroUsdField.nonnegative(),
|
|
2939
|
+
error: z27.string().nullable(),
|
|
2940
|
+
created_at: Timestamp,
|
|
2941
|
+
finished_at: Timestamp.nullable()
|
|
2942
|
+
});
|
|
2943
|
+
var NicheVersionStudioSchema = z27.object({
|
|
2944
|
+
round: z27.number().int().positive(),
|
|
2945
|
+
uploads: z27.array(StudioUploadSchema),
|
|
2946
|
+
reference_json: z27.unknown().nullable(),
|
|
2947
|
+
frames: z27.array(StudioFrameSchema),
|
|
2948
|
+
samples: z27.array(StudioSampleSchema),
|
|
2949
|
+
tagline: z27.string().max(140),
|
|
2950
|
+
hero_sample_index: z27.number().int().nonnegative()
|
|
2951
|
+
});
|
|
2952
|
+
var CreatorTemplateSchema = z27.object({
|
|
2568
2953
|
id: idOf("ctp"),
|
|
2569
|
-
object:
|
|
2954
|
+
object: z27.literal("creator_template"),
|
|
2570
2955
|
creator_id: idOf("crt"),
|
|
2571
|
-
blueprint:
|
|
2572
|
-
base_template:
|
|
2956
|
+
blueprint: z27.string().min(1),
|
|
2957
|
+
base_template: z27.string().min(1),
|
|
2573
2958
|
slug: CreatorTemplateSlugSchema,
|
|
2574
|
-
template:
|
|
2575
|
-
name:
|
|
2576
|
-
description:
|
|
2959
|
+
template: z27.string().min(1).max(64),
|
|
2960
|
+
name: z27.string().min(1).max(80),
|
|
2961
|
+
description: z27.string().max(2e3),
|
|
2577
2962
|
declaration: CreatorDeclarationSchema,
|
|
2578
2963
|
published_version: VersionNumber.nullable(),
|
|
2579
|
-
latest_version:
|
|
2964
|
+
latest_version: z27.object({
|
|
2580
2965
|
version: VersionNumber,
|
|
2581
2966
|
status: CreatorTemplateVersionStatusSchema
|
|
2582
2967
|
}).nullable(),
|
|
2968
|
+
kind: CreatorTemplateKindSchema,
|
|
2969
|
+
studio: CreatorStudioSchema,
|
|
2970
|
+
listing: CreatorTemplateListingSchema,
|
|
2583
2971
|
created_at: Timestamp,
|
|
2584
2972
|
updated_at: Timestamp
|
|
2585
2973
|
});
|
|
2586
|
-
var CreatorTemplateVersionSchema =
|
|
2587
|
-
object:
|
|
2974
|
+
var CreatorTemplateVersionSchema = z27.object({
|
|
2975
|
+
object: z27.literal("creator_template_version"),
|
|
2588
2976
|
template_id: idOf("ctp"),
|
|
2589
2977
|
version: VersionNumber,
|
|
2590
2978
|
declaration: CreatorDeclarationSchema,
|
|
2591
2979
|
status: CreatorTemplateVersionStatusSchema,
|
|
2592
|
-
note:
|
|
2980
|
+
note: z27.string().nullable(),
|
|
2593
2981
|
artifact_id: idOf("bpa").nullable(),
|
|
2594
2982
|
submitted_at: Timestamp,
|
|
2595
2983
|
decided_at: Timestamp.nullable()
|
|
2596
2984
|
});
|
|
2597
|
-
var CreatorBalanceSchema =
|
|
2598
|
-
object:
|
|
2985
|
+
var CreatorBalanceSchema = z27.object({
|
|
2986
|
+
object: z27.literal("creator_balance"),
|
|
2599
2987
|
pending_micro_usd: MicroUsdField.nonnegative(),
|
|
2600
2988
|
available_micro_usd: MicroUsdField.nonnegative(),
|
|
2601
2989
|
claimed_micro_usd: MicroUsdField.nonnegative(),
|
|
2602
2990
|
paid_micro_usd: MicroUsdField.nonnegative(),
|
|
2603
|
-
minimum_payout_micro_usd:
|
|
2991
|
+
minimum_payout_micro_usd: z27.literal(CREATOR_PROGRAM.minimum_payout_micro_usd)
|
|
2604
2992
|
});
|
|
2605
|
-
var ReferralClickSchema =
|
|
2606
|
-
object:
|
|
2993
|
+
var ReferralClickSchema = z27.object({
|
|
2994
|
+
object: z27.literal("referral_click"),
|
|
2607
2995
|
code: CreatorCodeSchema,
|
|
2608
|
-
creator:
|
|
2996
|
+
creator: z27.object({ display_name: z27.string().min(1) }),
|
|
2609
2997
|
expires_at: Timestamp
|
|
2610
2998
|
});
|
|
2611
|
-
var Day2 =
|
|
2612
|
-
var CreatorAnalyticsSchema =
|
|
2613
|
-
object:
|
|
2614
|
-
days:
|
|
2999
|
+
var Day2 = z27.iso.date();
|
|
3000
|
+
var CreatorAnalyticsSchema = z27.object({
|
|
3001
|
+
object: z27.literal("creator_analytics"),
|
|
3002
|
+
days: z27.number().int().min(1).max(90),
|
|
2615
3003
|
from: Day2,
|
|
2616
3004
|
to: Day2,
|
|
2617
|
-
clicks:
|
|
2618
|
-
referrals:
|
|
2619
|
-
installs:
|
|
2620
|
-
active_installs:
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
)
|
|
2624
|
-
|
|
3005
|
+
clicks: z27.number().int().nonnegative(),
|
|
3006
|
+
referrals: z27.number().int().nonnegative(),
|
|
3007
|
+
installs: z27.number().int().nonnegative(),
|
|
3008
|
+
active_installs: z27.number().int().nonnegative(),
|
|
3009
|
+
/** Distinct orgs with at least one commission-bearing invoice in the window (invoice-based template commission). */
|
|
3010
|
+
paying_orgs: z27.number().int().nonnegative().optional(),
|
|
3011
|
+
/** DEPRECATED with the 5% usage accrual; optional until `analytics()` stops returning it. */
|
|
3012
|
+
usage_by_day: z27.array(z27.object({ day: Day2, debit_micro_usd: MicroUsdField.nonnegative() })).optional(),
|
|
3013
|
+
commission_micro_usd: z27.object({
|
|
2625
3014
|
pending: MicroUsdField.nonnegative(),
|
|
2626
3015
|
available: MicroUsdField.nonnegative(),
|
|
2627
3016
|
claimed: MicroUsdField.nonnegative(),
|
|
2628
3017
|
paid: MicroUsdField.nonnegative()
|
|
2629
3018
|
}),
|
|
2630
|
-
commissions_by_template:
|
|
2631
|
-
|
|
3019
|
+
commissions_by_template: z27.array(
|
|
3020
|
+
z27.object({
|
|
2632
3021
|
creator_template_id: idOf("ctp"),
|
|
2633
3022
|
amount_micro_usd: MicroUsdField.nonnegative()
|
|
2634
3023
|
})
|
|
2635
3024
|
),
|
|
2636
3025
|
/** Every install covered, newest first: the day it was created and the day its twelve months end. */
|
|
2637
|
-
install_windows:
|
|
3026
|
+
install_windows: z27.array(z27.object({ install_id: idOf("bpi"), from: Day2, until: Day2 })).optional()
|
|
3027
|
+
});
|
|
3028
|
+
var CreatorTemplateCreateKindSchema = z27.object({
|
|
3029
|
+
kind: CreatorTemplateKindSchema.default("crew")
|
|
3030
|
+
});
|
|
3031
|
+
var StudioUploadCreateSchema = z27.object({
|
|
3032
|
+
position: UploadPosition,
|
|
3033
|
+
filename: z27.string().min(1).max(200),
|
|
3034
|
+
content_type: StudioUploadContentTypeSchema,
|
|
3035
|
+
bytes: z27.number().int().positive().max(CREATOR_PROGRAM.studio.upload_max_bytes)
|
|
3036
|
+
});
|
|
3037
|
+
var StudioUploadTicketSchema = z27.object({
|
|
3038
|
+
object: z27.literal("studio_upload_ticket"),
|
|
3039
|
+
position: UploadPosition,
|
|
3040
|
+
upload_url: z27.url(),
|
|
3041
|
+
expires_at: Timestamp
|
|
3042
|
+
});
|
|
3043
|
+
var StudioUploadPatchSchema = z27.object({ prompt: StudioPrompt });
|
|
3044
|
+
var StudioUploadResultSchema = z27.object({
|
|
3045
|
+
object: z27.literal("studio_upload"),
|
|
3046
|
+
template_id: idOf("ctp"),
|
|
3047
|
+
upload: StudioUploadSchema
|
|
3048
|
+
});
|
|
3049
|
+
var StudioRoundCreateSchema = z27.object({
|
|
3050
|
+
feedback: z27.string().min(1).max(4e3).optional(),
|
|
3051
|
+
rights_attested: z27.boolean().optional()
|
|
3052
|
+
});
|
|
3053
|
+
var StudioBudgetSchema = z27.object({
|
|
3054
|
+
draft_micro_usd: MicroUsdField.nonnegative(),
|
|
3055
|
+
spent_micro_usd: MicroUsdField.nonnegative(),
|
|
3056
|
+
remaining_micro_usd: MicroUsdField.nonnegative()
|
|
3057
|
+
});
|
|
3058
|
+
var CreatorStudioViewSchema = z27.object({
|
|
3059
|
+
object: z27.literal("creator_studio"),
|
|
3060
|
+
template_id: idOf("ctp"),
|
|
3061
|
+
studio: CreatorStudioSchema,
|
|
3062
|
+
/** Newest first. */
|
|
3063
|
+
rounds: z27.array(CreatorTemplateRoundSchema),
|
|
3064
|
+
budget: StudioBudgetSchema
|
|
3065
|
+
});
|
|
3066
|
+
var NicheSubmitSchema = z27.object({
|
|
3067
|
+
round: z27.number().int().positive(),
|
|
3068
|
+
listing: z27.object({
|
|
3069
|
+
tagline: z27.string().min(1).max(140),
|
|
3070
|
+
hero_sample_index: z27.number().int().nonnegative()
|
|
3071
|
+
})
|
|
3072
|
+
});
|
|
3073
|
+
var CreatorListingPatchSchema = CreatorTemplateListingSchema.partial();
|
|
3074
|
+
var CreatorListingSchema = z27.object({
|
|
3075
|
+
object: z27.literal("creator_listing"),
|
|
3076
|
+
template_id: idOf("ctp"),
|
|
3077
|
+
template: z27.string().min(1),
|
|
3078
|
+
name: z27.string(),
|
|
3079
|
+
kind: CreatorTemplateKindSchema,
|
|
3080
|
+
blueprint: z27.string(),
|
|
3081
|
+
base_template: z27.string(),
|
|
3082
|
+
published_version: VersionNumber.nullable(),
|
|
3083
|
+
creator: z27.object({
|
|
3084
|
+
id: idOf("crt"),
|
|
3085
|
+
display_name: z27.string(),
|
|
3086
|
+
code: CreatorCodeSchema,
|
|
3087
|
+
status: CreatorStatusSchema
|
|
3088
|
+
}),
|
|
3089
|
+
listing: CreatorTemplateListingSchema,
|
|
3090
|
+
/** Installs of the template, and distinct orgs among them that earned a template commission. */
|
|
3091
|
+
deploys: z27.number().int().nonnegative().optional(),
|
|
3092
|
+
paying_orgs: z27.number().int().nonnegative().optional(),
|
|
3093
|
+
updated_at: Timestamp
|
|
2638
3094
|
});
|
|
2639
3095
|
|
|
2640
3096
|
// ../core/src/schema/legal.ts
|
|
2641
|
-
import { z as
|
|
3097
|
+
import { z as z28 } from "zod";
|
|
2642
3098
|
var LEGAL_MEMBER_STATUSES = [
|
|
2643
3099
|
"pending",
|
|
2644
3100
|
"link_ready",
|
|
@@ -2648,16 +3104,16 @@ var LEGAL_MEMBER_STATUSES = [
|
|
|
2648
3104
|
"verified",
|
|
2649
3105
|
"failed"
|
|
2650
3106
|
];
|
|
2651
|
-
var LegalMemberStatusSchema =
|
|
3107
|
+
var LegalMemberStatusSchema = z28.enum(LEGAL_MEMBER_STATUSES);
|
|
2652
3108
|
var LEGAL_VERIFICATION_STATUSES = ["in_progress", "pending_review", "verified", "failed"];
|
|
2653
|
-
var LegalVerificationStatusSchema =
|
|
3109
|
+
var LegalVerificationStatusSchema = z28.enum(LEGAL_VERIFICATION_STATUSES);
|
|
2654
3110
|
var LEGAL_COMPANY_STATUSES = ["awaiting_payment", "paid", "submitted", "formed", "failed"];
|
|
2655
|
-
var LegalCompanyStatusSchema =
|
|
3111
|
+
var LegalCompanyStatusSchema = z28.enum(LEGAL_COMPANY_STATUSES);
|
|
2656
3112
|
var LEGAL_DOCUMENT_KINDS = ["articles", "ein_letter", "operating_agreement", "other"];
|
|
2657
|
-
var LegalDocumentKindSchema =
|
|
2658
|
-
var LegalMemberRoleSchema =
|
|
2659
|
-
var LegalEinStatusSchema =
|
|
2660
|
-
var LegalRequiredActionKindSchema =
|
|
3113
|
+
var LegalDocumentKindSchema = z28.enum(LEGAL_DOCUMENT_KINDS);
|
|
3114
|
+
var LegalMemberRoleSchema = z28.enum(["primary", "secondary"]);
|
|
3115
|
+
var LegalEinStatusSchema = z28.enum(["none", "pending", "issued"]);
|
|
3116
|
+
var LegalRequiredActionKindSchema = z28.enum(["signature", "information", "payment", "other"]);
|
|
2661
3117
|
var US_STATES = [
|
|
2662
3118
|
"AL",
|
|
2663
3119
|
"AK",
|
|
@@ -2711,105 +3167,105 @@ var US_STATES = [
|
|
|
2711
3167
|
"WI",
|
|
2712
3168
|
"WY"
|
|
2713
3169
|
];
|
|
2714
|
-
var UsStateSchema =
|
|
2715
|
-
var LegalMemberInputSchema =
|
|
2716
|
-
first_name:
|
|
2717
|
-
last_name:
|
|
2718
|
-
email:
|
|
3170
|
+
var UsStateSchema = z28.enum(US_STATES);
|
|
3171
|
+
var LegalMemberInputSchema = z28.object({
|
|
3172
|
+
first_name: z28.string().min(1).max(128),
|
|
3173
|
+
last_name: z28.string().min(1).max(128),
|
|
3174
|
+
email: z28.string().min(1).max(320),
|
|
2719
3175
|
role: LegalMemberRoleSchema,
|
|
2720
|
-
is_responsible_party:
|
|
2721
|
-
ownership_percent:
|
|
3176
|
+
is_responsible_party: z28.boolean(),
|
|
3177
|
+
ownership_percent: z28.number().int()
|
|
2722
3178
|
});
|
|
2723
3179
|
var LegalMemberSchema = LegalMemberInputSchema.extend({
|
|
2724
3180
|
id: idOf("lgm"),
|
|
2725
|
-
object:
|
|
3181
|
+
object: z28.literal("legal_member"),
|
|
2726
3182
|
verification_id: idOf("lgv"),
|
|
2727
3183
|
status: LegalMemberStatusSchema,
|
|
2728
|
-
link_url:
|
|
3184
|
+
link_url: z28.url().nullable(),
|
|
2729
3185
|
link_expires_at: Timestamp.nullable(),
|
|
2730
3186
|
completed_at: Timestamp.nullable()
|
|
2731
3187
|
});
|
|
2732
|
-
var LegalVerificationSchema =
|
|
3188
|
+
var LegalVerificationSchema = z28.object({
|
|
2733
3189
|
id: idOf("lgv"),
|
|
2734
|
-
object:
|
|
3190
|
+
object: z28.literal("legal_verification"),
|
|
2735
3191
|
identity_id: idOf("idn"),
|
|
2736
3192
|
status: LegalVerificationStatusSchema,
|
|
2737
|
-
members:
|
|
2738
|
-
ready_for_formation:
|
|
3193
|
+
members: z28.array(LegalMemberSchema),
|
|
3194
|
+
ready_for_formation: z28.boolean(),
|
|
2739
3195
|
started_at: Timestamp,
|
|
2740
3196
|
completed_at: Timestamp.nullable(),
|
|
2741
3197
|
created_at: Timestamp,
|
|
2742
3198
|
updated_at: Timestamp
|
|
2743
3199
|
});
|
|
2744
|
-
var StartLegalVerificationSchema =
|
|
2745
|
-
var CompleteLegalMemberSchema =
|
|
2746
|
-
var LegalNameOptionSchema =
|
|
2747
|
-
var LegalMailingAddressSchema =
|
|
2748
|
-
line1:
|
|
2749
|
-
line2:
|
|
2750
|
-
city:
|
|
3200
|
+
var StartLegalVerificationSchema = z28.object({ members: z28.array(LegalMemberInputSchema) });
|
|
3201
|
+
var CompleteLegalMemberSchema = z28.object({ token: z28.string().min(1) });
|
|
3202
|
+
var LegalNameOptionSchema = z28.object({ name: z28.string().min(1).max(200), ending: z28.literal("LLC") });
|
|
3203
|
+
var LegalMailingAddressSchema = z28.object({
|
|
3204
|
+
line1: z28.string().min(1).max(200),
|
|
3205
|
+
line2: z28.string().max(200).nullable(),
|
|
3206
|
+
city: z28.string().min(1).max(100),
|
|
2751
3207
|
state: UsStateSchema,
|
|
2752
|
-
postal_code:
|
|
2753
|
-
country:
|
|
3208
|
+
postal_code: z28.string().min(1).max(16),
|
|
3209
|
+
country: z28.literal("US")
|
|
2754
3210
|
});
|
|
2755
|
-
var LegalRequiredActionSchema =
|
|
3211
|
+
var LegalRequiredActionSchema = z28.object({
|
|
2756
3212
|
kind: LegalRequiredActionKindSchema,
|
|
2757
|
-
description:
|
|
2758
|
-
url:
|
|
3213
|
+
description: z28.string(),
|
|
3214
|
+
url: z28.url().nullable()
|
|
2759
3215
|
});
|
|
2760
3216
|
var LEGAL_DESCRIPTION_MAX = 50;
|
|
2761
|
-
var CreateLegalCompanySchema =
|
|
3217
|
+
var CreateLegalCompanySchema = z28.object({
|
|
2762
3218
|
verification_id: idOf("lgv"),
|
|
2763
3219
|
state: UsStateSchema,
|
|
2764
|
-
name_options:
|
|
2765
|
-
naics_code:
|
|
2766
|
-
description:
|
|
3220
|
+
name_options: z28.array(z28.string().min(1).max(200)).min(1).max(3),
|
|
3221
|
+
naics_code: z28.string().regex(/^\d{2,6}$/),
|
|
3222
|
+
description: z28.string().min(1).max(LEGAL_DESCRIPTION_MAX),
|
|
2767
3223
|
mailing_address: LegalMailingAddressSchema
|
|
2768
3224
|
});
|
|
2769
3225
|
var LegalCompanySchema = CreateLegalCompanySchema.omit({ name_options: true }).extend({
|
|
2770
3226
|
id: idOf("lgc"),
|
|
2771
|
-
object:
|
|
3227
|
+
object: z28.literal("legal_company"),
|
|
2772
3228
|
identity_id: idOf("idn"),
|
|
2773
3229
|
status: LegalCompanyStatusSchema,
|
|
2774
|
-
entity_type:
|
|
2775
|
-
name_options:
|
|
2776
|
-
legal_name:
|
|
3230
|
+
entity_type: z28.literal("llc"),
|
|
3231
|
+
name_options: z28.array(LegalNameOptionSchema),
|
|
3232
|
+
legal_name: z28.string().nullable(),
|
|
2777
3233
|
ein_status: LegalEinStatusSchema,
|
|
2778
3234
|
price_micro_usd: MicroUsdField,
|
|
2779
|
-
required_actions:
|
|
2780
|
-
failure_reason:
|
|
3235
|
+
required_actions: z28.array(LegalRequiredActionSchema),
|
|
3236
|
+
failure_reason: z28.string().max(256).nullable(),
|
|
2781
3237
|
submitted_at: Timestamp.nullable(),
|
|
2782
3238
|
formed_at: Timestamp.nullable(),
|
|
2783
3239
|
created_at: Timestamp,
|
|
2784
3240
|
updated_at: Timestamp
|
|
2785
3241
|
});
|
|
2786
|
-
var LegalDocumentSchema =
|
|
3242
|
+
var LegalDocumentSchema = z28.object({
|
|
2787
3243
|
id: idOf("lgd"),
|
|
2788
|
-
object:
|
|
3244
|
+
object: z28.literal("legal_document"),
|
|
2789
3245
|
company_id: idOf("lgc"),
|
|
2790
3246
|
kind: LegalDocumentKindSchema,
|
|
2791
|
-
name:
|
|
3247
|
+
name: z28.string(),
|
|
2792
3248
|
created_at: Timestamp
|
|
2793
3249
|
});
|
|
2794
|
-
var LegalDocumentLinkSchema =
|
|
2795
|
-
object:
|
|
2796
|
-
url:
|
|
3250
|
+
var LegalDocumentLinkSchema = z28.object({
|
|
3251
|
+
object: z28.literal("legal_document_link"),
|
|
3252
|
+
url: z28.url(),
|
|
2797
3253
|
expires_at: Timestamp
|
|
2798
3254
|
});
|
|
2799
|
-
var NaicsCodeSchema =
|
|
2800
|
-
object:
|
|
2801
|
-
code:
|
|
2802
|
-
title:
|
|
3255
|
+
var NaicsCodeSchema = z28.object({
|
|
3256
|
+
object: z28.literal("naics_code"),
|
|
3257
|
+
code: z28.string().regex(/^\d{2,6}$/),
|
|
3258
|
+
title: z28.string()
|
|
2803
3259
|
});
|
|
2804
|
-
var LegalStateSchema =
|
|
2805
|
-
object:
|
|
3260
|
+
var LegalStateSchema = z28.object({
|
|
3261
|
+
object: z28.literal("legal_state"),
|
|
2806
3262
|
code: UsStateSchema,
|
|
2807
|
-
name:
|
|
3263
|
+
name: z28.string(),
|
|
2808
3264
|
formation_fee_micro_usd: MicroUsdField
|
|
2809
3265
|
});
|
|
2810
|
-
var LegalWebhookEventSchema =
|
|
2811
|
-
provider_session_ref:
|
|
2812
|
-
status:
|
|
3266
|
+
var LegalWebhookEventSchema = z28.object({
|
|
3267
|
+
provider_session_ref: z28.string().min(1),
|
|
3268
|
+
status: z28.enum(["verified", "failed", "pending_review"]),
|
|
2813
3269
|
metadata: Metadata
|
|
2814
3270
|
});
|
|
2815
3271
|
var LLC_ENDING = /\s*(?:,\s*)?(?:l\.?l\.?c\.?|limited\s+liability\s+company)\s*$/i;
|
|
@@ -2820,437 +3276,335 @@ function canonicalName(raw) {
|
|
|
2820
3276
|
}
|
|
2821
3277
|
|
|
2822
3278
|
// ../core/src/schema/wallet.ts
|
|
2823
|
-
import { z as
|
|
3279
|
+
import { z as z29 } from "zod";
|
|
2824
3280
|
var WALLET_NETWORKS = ["eip155:84532", "eip155:8453"];
|
|
2825
|
-
var WalletNetworkSchema =
|
|
3281
|
+
var WalletNetworkSchema = z29.enum(WALLET_NETWORKS);
|
|
2826
3282
|
var DEFAULT_WALLET_NETWORK = "eip155:84532";
|
|
2827
|
-
var WalletSelectSchema =
|
|
3283
|
+
var WalletSelectSchema = z29.object({ network: WalletNetworkSchema.optional() });
|
|
2828
3284
|
var WALLET_STATUSES = ["active", "frozen", "swept"];
|
|
2829
|
-
var WalletStatusSchema =
|
|
3285
|
+
var WalletStatusSchema = z29.enum(WALLET_STATUSES);
|
|
2830
3286
|
var WALLET_TRANSACTION_KINDS = ["fund", "transfer", "pay", "sweep"];
|
|
2831
|
-
var WalletTransactionKindSchema =
|
|
3287
|
+
var WalletTransactionKindSchema = z29.enum(WALLET_TRANSACTION_KINDS);
|
|
2832
3288
|
var WALLET_TRANSACTION_STATUSES = ["pending", "confirmed", "failed"];
|
|
2833
|
-
var WalletTransactionStatusSchema =
|
|
2834
|
-
var WalletDirectionSchema =
|
|
2835
|
-
var WalletFundSourceSchema =
|
|
2836
|
-
var EvmAddressSchema =
|
|
2837
|
-
var TxHashSchema =
|
|
2838
|
-
var WalletPolicySchema =
|
|
3289
|
+
var WalletTransactionStatusSchema = z29.enum(WALLET_TRANSACTION_STATUSES);
|
|
3290
|
+
var WalletDirectionSchema = z29.enum(["in", "out"]);
|
|
3291
|
+
var WalletFundSourceSchema = z29.enum(["faucet", "treasury"]);
|
|
3292
|
+
var EvmAddressSchema = z29.string().regex(/^0x[0-9a-fA-F]{40}$/, "expected a 0x address");
|
|
3293
|
+
var TxHashSchema = z29.string().regex(/^0x[0-9a-fA-F]{64}$/, "expected a 0x transaction hash");
|
|
3294
|
+
var WalletPolicySchema = z29.object({
|
|
2839
3295
|
per_tx_cap_micro_usd: MicroUsdField.nonnegative(),
|
|
2840
3296
|
daily_cap_micro_usd: MicroUsdField.positive().nullable(),
|
|
2841
3297
|
low_balance_micro_usd: MicroUsdField.nonnegative().nullable()
|
|
2842
3298
|
});
|
|
2843
|
-
var WalletSchema =
|
|
3299
|
+
var WalletSchema = z29.object({
|
|
2844
3300
|
id: idOf("wlt"),
|
|
2845
|
-
object:
|
|
3301
|
+
object: z29.literal("wallet"),
|
|
2846
3302
|
identity_id: idOf("idn"),
|
|
2847
3303
|
status: WalletStatusSchema,
|
|
2848
3304
|
network: WalletNetworkSchema,
|
|
2849
3305
|
address: EvmAddressSchema,
|
|
2850
|
-
asset:
|
|
3306
|
+
asset: z29.literal("usdc"),
|
|
2851
3307
|
balance_micro_usd: MicroUsdField,
|
|
2852
3308
|
policy: WalletPolicySchema,
|
|
2853
3309
|
spent_today_micro_usd: MicroUsdField,
|
|
2854
3310
|
created_at: Timestamp,
|
|
2855
3311
|
updated_at: Timestamp
|
|
2856
3312
|
});
|
|
2857
|
-
var CreateWalletSchema =
|
|
3313
|
+
var CreateWalletSchema = z29.object({
|
|
2858
3314
|
network: WalletNetworkSchema.optional(),
|
|
2859
3315
|
policy: WalletPolicySchema.partial().optional()
|
|
2860
3316
|
});
|
|
2861
3317
|
var UpdateWalletPolicySchema = WalletPolicySchema.partial();
|
|
2862
|
-
var FundWalletSchema =
|
|
3318
|
+
var FundWalletSchema = z29.object({
|
|
2863
3319
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2864
3320
|
source: WalletFundSourceSchema
|
|
2865
3321
|
});
|
|
2866
|
-
var TransferWalletSchema =
|
|
2867
|
-
to:
|
|
3322
|
+
var TransferWalletSchema = z29.object({
|
|
3323
|
+
to: z29.union([EvmAddressSchema, idOf("idn")]),
|
|
2868
3324
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2869
|
-
purpose:
|
|
3325
|
+
purpose: z29.string().min(1).max(256)
|
|
2870
3326
|
});
|
|
2871
|
-
var SweepWalletSchema =
|
|
2872
|
-
var WalletTransactionSchema =
|
|
3327
|
+
var SweepWalletSchema = z29.object({ to: EvmAddressSchema.optional() });
|
|
3328
|
+
var WalletTransactionSchema = z29.object({
|
|
2873
3329
|
id: idOf("wtx"),
|
|
2874
|
-
object:
|
|
3330
|
+
object: z29.literal("wallet_transaction"),
|
|
2875
3331
|
wallet_id: idOf("wlt"),
|
|
2876
3332
|
kind: WalletTransactionKindSchema,
|
|
2877
3333
|
direction: WalletDirectionSchema,
|
|
2878
3334
|
amount_micro_usd: MicroUsdField,
|
|
2879
|
-
counterparty:
|
|
2880
|
-
origin:
|
|
2881
|
-
purpose:
|
|
3335
|
+
counterparty: z29.string().nullable(),
|
|
3336
|
+
origin: z29.string().nullable(),
|
|
3337
|
+
purpose: z29.string().nullable(),
|
|
2882
3338
|
tx_hash: TxHashSchema.nullable(),
|
|
2883
3339
|
session_id: idOf("ses").nullable(),
|
|
2884
3340
|
status: WalletTransactionStatusSchema,
|
|
2885
3341
|
created_at: Timestamp
|
|
2886
3342
|
});
|
|
2887
|
-
var ListWalletTransactionsSchema =
|
|
3343
|
+
var ListWalletTransactionsSchema = z29.object({
|
|
2888
3344
|
kind: WalletTransactionKindSchema.optional(),
|
|
2889
3345
|
direction: WalletDirectionSchema.optional(),
|
|
2890
|
-
origin:
|
|
3346
|
+
origin: z29.string().optional(),
|
|
2891
3347
|
since: Timestamp.optional()
|
|
2892
3348
|
});
|
|
2893
|
-
var HttpMethodSchema =
|
|
2894
|
-
var WalletQuoteRequestSchema =
|
|
2895
|
-
var WalletQuoteSchema =
|
|
2896
|
-
object:
|
|
2897
|
-
url:
|
|
2898
|
-
payable:
|
|
3349
|
+
var HttpMethodSchema = z29.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]);
|
|
3350
|
+
var WalletQuoteRequestSchema = z29.object({ url: z29.url(), method: HttpMethodSchema.optional() });
|
|
3351
|
+
var WalletQuoteSchema = z29.object({
|
|
3352
|
+
object: z29.literal("wallet_quote"),
|
|
3353
|
+
url: z29.url(),
|
|
3354
|
+
payable: z29.boolean(),
|
|
2899
3355
|
network: WalletNetworkSchema.nullable(),
|
|
2900
|
-
asset:
|
|
3356
|
+
asset: z29.literal("usdc").nullable(),
|
|
2901
3357
|
amount_micro_usd: MicroUsdField.nullable(),
|
|
2902
3358
|
pay_to: EvmAddressSchema.nullable(),
|
|
2903
|
-
description:
|
|
2904
|
-
max_timeout_seconds:
|
|
3359
|
+
description: z29.string().nullable(),
|
|
3360
|
+
max_timeout_seconds: z29.number().int().nullable()
|
|
2905
3361
|
});
|
|
2906
3362
|
var WalletPayRequestSchema = WalletQuoteRequestSchema.extend({
|
|
2907
3363
|
max_amount_micro_usd: MicroUsdField.positive().optional()
|
|
2908
3364
|
});
|
|
2909
3365
|
var WALLET_RESPONSE_BODY_MAX = 64 * 1024;
|
|
2910
|
-
var WalletPaymentSchema =
|
|
2911
|
-
object:
|
|
2912
|
-
paid:
|
|
3366
|
+
var WalletPaymentSchema = z29.object({
|
|
3367
|
+
object: z29.literal("wallet_payment"),
|
|
3368
|
+
paid: z29.boolean(),
|
|
2913
3369
|
transaction_id: idOf("wtx").nullable(),
|
|
2914
3370
|
amount_micro_usd: MicroUsdField.nullable(),
|
|
2915
|
-
response_status:
|
|
2916
|
-
response_body:
|
|
3371
|
+
response_status: z29.number().int(),
|
|
3372
|
+
response_body: z29.string().max(WALLET_RESPONSE_BODY_MAX)
|
|
2917
3373
|
});
|
|
2918
3374
|
|
|
2919
3375
|
// ../core/src/schema/cards.ts
|
|
2920
|
-
import { z as
|
|
3376
|
+
import { z as z30 } from "zod";
|
|
2921
3377
|
var CARD_STATUSES = ["pending_payment", "issuing", "active", "failed", "cancelled", "refunded"];
|
|
2922
|
-
var CardStatusSchema =
|
|
3378
|
+
var CardStatusSchema = z30.enum(CARD_STATUSES);
|
|
2923
3379
|
var CARD_MIN_LOAD_MICRO_USD = 1e6;
|
|
2924
3380
|
var CARD_MAX_LOAD_MICRO_USD = 15e7;
|
|
2925
3381
|
var CARD_LOAD_GRANULARITY_MICRO_USD = 1e4;
|
|
2926
|
-
var CardSchema =
|
|
3382
|
+
var CardSchema = z30.object({
|
|
2927
3383
|
id: idOf("vcd"),
|
|
2928
|
-
object:
|
|
3384
|
+
object: z30.literal("card"),
|
|
2929
3385
|
identity_id: idOf("idn"),
|
|
2930
|
-
kind:
|
|
3386
|
+
kind: z30.literal("prepaid"),
|
|
2931
3387
|
status: CardStatusSchema,
|
|
2932
|
-
label:
|
|
2933
|
-
brand:
|
|
2934
|
-
last4:
|
|
3388
|
+
label: z30.string().min(1).max(128),
|
|
3389
|
+
brand: z30.string().nullable(),
|
|
3390
|
+
last4: z30.string().regex(/^\d{4}$/).nullable(),
|
|
2935
3391
|
load_micro_usd: MicroUsdField,
|
|
2936
3392
|
spent_micro_usd: MicroUsdField,
|
|
2937
|
-
currency:
|
|
3393
|
+
currency: z30.literal("usd"),
|
|
2938
3394
|
expires_at: Timestamp.nullable(),
|
|
2939
|
-
failure_reason:
|
|
3395
|
+
failure_reason: z30.string().max(256).nullable(),
|
|
2940
3396
|
created_at: Timestamp,
|
|
2941
3397
|
updated_at: Timestamp
|
|
2942
3398
|
});
|
|
2943
|
-
var IssueCardSchema =
|
|
3399
|
+
var IssueCardSchema = z30.object({
|
|
2944
3400
|
label: CardSchema.shape.label,
|
|
2945
3401
|
load_micro_usd: MicroUsdField.min(CARD_MIN_LOAD_MICRO_USD).max(CARD_MAX_LOAD_MICRO_USD).multipleOf(CARD_LOAD_GRANULARITY_MICRO_USD)
|
|
2946
3402
|
});
|
|
2947
3403
|
var CardQuoteRequestSchema = IssueCardSchema.pick({ load_micro_usd: true });
|
|
2948
|
-
var CardQuoteSchema =
|
|
2949
|
-
object:
|
|
3404
|
+
var CardQuoteSchema = z30.object({
|
|
3405
|
+
object: z30.literal("card_quote"),
|
|
2950
3406
|
load_micro_usd: MicroUsdField,
|
|
2951
3407
|
price_micro_usd: MicroUsdField,
|
|
2952
|
-
brand:
|
|
3408
|
+
brand: z30.string().nullable(),
|
|
2953
3409
|
min_load_micro_usd: MicroUsdField,
|
|
2954
3410
|
max_load_micro_usd: MicroUsdField
|
|
2955
3411
|
});
|
|
2956
|
-
var CardCredentialsSchema =
|
|
2957
|
-
object:
|
|
3412
|
+
var CardCredentialsSchema = z30.object({
|
|
3413
|
+
object: z30.literal("card_credentials"),
|
|
2958
3414
|
card_id: idOf("vcd"),
|
|
2959
|
-
number:
|
|
2960
|
-
pin:
|
|
2961
|
-
cvv:
|
|
2962
|
-
expiry:
|
|
2963
|
-
url:
|
|
2964
|
-
instructions:
|
|
3415
|
+
number: z30.string().min(1),
|
|
3416
|
+
pin: z30.string().nullable(),
|
|
3417
|
+
cvv: z30.string().nullable(),
|
|
3418
|
+
expiry: z30.string().nullable(),
|
|
3419
|
+
url: z30.url().nullable(),
|
|
3420
|
+
instructions: z30.string().nullable(),
|
|
2965
3421
|
revealed_at: Timestamp
|
|
2966
3422
|
});
|
|
2967
|
-
var CardTransactionSchema =
|
|
3423
|
+
var CardTransactionSchema = z30.object({
|
|
2968
3424
|
id: idOf("vct"),
|
|
2969
|
-
object:
|
|
3425
|
+
object: z30.literal("card_transaction"),
|
|
2970
3426
|
card_id: idOf("vcd"),
|
|
2971
3427
|
amount_micro_usd: MicroUsdField,
|
|
2972
|
-
merchant:
|
|
2973
|
-
description:
|
|
3428
|
+
merchant: z30.string().nullable(),
|
|
3429
|
+
description: z30.string().nullable(),
|
|
2974
3430
|
session_id: idOf("ses").nullable(),
|
|
2975
3431
|
metadata: Metadata,
|
|
2976
3432
|
created_at: Timestamp
|
|
2977
3433
|
});
|
|
2978
|
-
var LogCardTransactionSchema =
|
|
3434
|
+
var LogCardTransactionSchema = z30.object({
|
|
2979
3435
|
amount_micro_usd: MicroUsdField.positive(),
|
|
2980
|
-
merchant:
|
|
2981
|
-
description:
|
|
3436
|
+
merchant: z30.string().max(256).optional(),
|
|
3437
|
+
description: z30.string().max(1024).optional(),
|
|
2982
3438
|
metadata: Metadata.optional()
|
|
2983
3439
|
});
|
|
2984
|
-
var ListCardsSchema =
|
|
3440
|
+
var ListCardsSchema = z30.object({ status: CardStatusSchema.optional() });
|
|
2985
3441
|
|
|
2986
3442
|
// ../core/src/schema/proxy-trace.ts
|
|
2987
|
-
import { z as
|
|
2988
|
-
var ProxyDialectSchema =
|
|
2989
|
-
var ProxyTraceContentScopeSchema =
|
|
2990
|
-
var TraceToolCall =
|
|
2991
|
-
var ProxyTraceRequestSchema =
|
|
2992
|
-
model:
|
|
3443
|
+
import { z as z31 } from "zod";
|
|
3444
|
+
var ProxyDialectSchema = z31.enum(["anthropic", "openai", "native"]);
|
|
3445
|
+
var ProxyTraceContentScopeSchema = z31.enum(["full", "metadata", "object"]);
|
|
3446
|
+
var TraceToolCall = z31.object({ id: z31.string().optional(), name: z31.string(), arguments: z31.string() });
|
|
3447
|
+
var ProxyTraceRequestSchema = z31.object({
|
|
3448
|
+
model: z31.string().optional(),
|
|
2993
3449
|
window: WindowSchema.optional(),
|
|
2994
|
-
system:
|
|
2995
|
-
messages:
|
|
2996
|
-
|
|
2997
|
-
role:
|
|
2998
|
-
content:
|
|
2999
|
-
tool_calls:
|
|
3000
|
-
tool_call_id:
|
|
3450
|
+
system: z31.string(),
|
|
3451
|
+
messages: z31.array(
|
|
3452
|
+
z31.looseObject({
|
|
3453
|
+
role: z31.string(),
|
|
3454
|
+
content: z31.string(),
|
|
3455
|
+
tool_calls: z31.array(z31.looseObject({ id: z31.string(), name: z31.string() })).optional(),
|
|
3456
|
+
tool_call_id: z31.string().optional()
|
|
3001
3457
|
})
|
|
3002
3458
|
),
|
|
3003
|
-
tools:
|
|
3004
|
-
tool_schema_hash:
|
|
3005
|
-
max_output_tokens:
|
|
3006
|
-
tool_names:
|
|
3007
|
-
});
|
|
3008
|
-
var ProxyTraceResponseSchema =
|
|
3009
|
-
text:
|
|
3010
|
-
reasoning:
|
|
3011
|
-
reasoning_details:
|
|
3012
|
-
tool_calls:
|
|
3459
|
+
tools: z31.array(z31.object({ name: z31.string(), description: z31.string(), parameters: z31.record(z31.string(), z31.unknown()) })).optional(),
|
|
3460
|
+
tool_schema_hash: z31.string().optional(),
|
|
3461
|
+
max_output_tokens: z31.number().int().optional(),
|
|
3462
|
+
tool_names: z31.array(z31.string()).optional()
|
|
3463
|
+
});
|
|
3464
|
+
var ProxyTraceResponseSchema = z31.object({
|
|
3465
|
+
text: z31.string(),
|
|
3466
|
+
reasoning: z31.string().optional(),
|
|
3467
|
+
reasoning_details: z31.array(z31.unknown()).optional(),
|
|
3468
|
+
tool_calls: z31.array(TraceToolCall),
|
|
3013
3469
|
/** A call that threw, was abandoned or never completed (ADR-0794): the reply is what streamed before. */
|
|
3014
|
-
is_error:
|
|
3470
|
+
is_error: z31.literal(true).optional(),
|
|
3015
3471
|
/** The error's class name — never its message — or `incomplete` for a stream that just stopped. */
|
|
3016
|
-
error_class:
|
|
3017
|
-
partial:
|
|
3472
|
+
error_class: z31.string().optional(),
|
|
3473
|
+
partial: z31.literal(true).optional()
|
|
3018
3474
|
});
|
|
3019
|
-
var Sha256 =
|
|
3020
|
-
var ProxyCallTraceSchema =
|
|
3475
|
+
var Sha256 = z31.string().regex(/^[0-9a-f]{64}$/);
|
|
3476
|
+
var ProxyCallTraceSchema = z31.object({
|
|
3021
3477
|
/** The request id: also `x-request-id`, the reply's `id`, and the ledger entry's idempotency key. */
|
|
3022
3478
|
id: idOf("req"),
|
|
3023
|
-
object:
|
|
3479
|
+
object: z31.literal("proxy_call_trace"),
|
|
3024
3480
|
dialect: ProxyDialectSchema,
|
|
3025
3481
|
/** The principal that made the call (§17). An API key here is the answer to "who sent this". */
|
|
3026
3482
|
actor: PrincipalSchema,
|
|
3027
3483
|
/** The public model id the caller asked for. */
|
|
3028
|
-
model:
|
|
3484
|
+
model: z31.string(),
|
|
3029
3485
|
window: WindowSchema,
|
|
3030
3486
|
/** The model the reply said served it — where `vetta/auto` resolves — or null if it named none. */
|
|
3031
|
-
resolved_model:
|
|
3487
|
+
resolved_model: z31.string().nullable(),
|
|
3032
3488
|
/**
|
|
3033
3489
|
* The serving provider and the gateway's own generation id. Null on every row written before the
|
|
3034
3490
|
* adapter stops dropping them (Track A); together they are what lets an upstream invoice line be
|
|
3035
3491
|
* matched back to an organization, a key and a ledger entry.
|
|
3036
3492
|
*/
|
|
3037
|
-
provider:
|
|
3038
|
-
generation_id:
|
|
3039
|
-
stop:
|
|
3493
|
+
provider: z31.string().nullable(),
|
|
3494
|
+
generation_id: z31.string().nullable(),
|
|
3495
|
+
stop: z31.enum(["end_turn", "tool_use", "length"]).nullable(),
|
|
3040
3496
|
usage: TokenUsageSchema,
|
|
3041
3497
|
/** What the customer was charged, µUSD. The ledger entry is the authority; this is its copy. */
|
|
3042
3498
|
billed_micro_usd: MicroUsdField.nullable(),
|
|
3043
3499
|
/** What the vendor said it cost, µUSD. A CROSS-CHECK, NEVER A DEBIT. */
|
|
3044
3500
|
vendor_cost_micro_usd: MicroUsdField.nullable(),
|
|
3045
|
-
duration_ms:
|
|
3501
|
+
duration_ms: z31.number().int().nonnegative().nullable(),
|
|
3046
3502
|
content_scope: ProxyTraceContentScopeSchema,
|
|
3047
3503
|
/** `proxy` — a `/v1/proxy/*` call; `harness` — a hosted harness's own model call (ADR-0762). */
|
|
3048
|
-
source:
|
|
3504
|
+
source: z31.enum(["proxy", "harness"]),
|
|
3049
3505
|
/** The session the call belongs to: a harness call's, or a sandbox token's `sub` on the proxy. */
|
|
3050
|
-
session_id:
|
|
3506
|
+
session_id: z31.string().nullable(),
|
|
3051
3507
|
/**
|
|
3052
3508
|
* The `seq` of the call's `span.model_request.end` event — or of its `.start` when the call failed
|
|
3053
3509
|
* or its `.end` was withheld (ADR-0794). Null on the proxy, which writes no event.
|
|
3054
3510
|
*/
|
|
3055
|
-
seq:
|
|
3511
|
+
seq: z31.number().int().nullable(),
|
|
3056
3512
|
/** The board card the session was woken for (`session.metadata.board.card_id`), or null. */
|
|
3057
|
-
board_card_id:
|
|
3513
|
+
board_card_id: z31.string().nullable(),
|
|
3058
3514
|
/** The ids of the tool calls this reply made — the join to the `tool.*` events they caused. */
|
|
3059
|
-
tool_call_ids:
|
|
3515
|
+
tool_call_ids: z31.array(z31.string()),
|
|
3060
3516
|
/** sha-256 of the canonical JSON of the tool schema array the model was offered, or null. */
|
|
3061
3517
|
tool_schema_hash: Sha256.nullable(),
|
|
3062
3518
|
request_sha256: Sha256,
|
|
3063
3519
|
response_sha256: Sha256,
|
|
3064
3520
|
/** The UTF-8 size of each stored body. */
|
|
3065
|
-
request_bytes:
|
|
3066
|
-
response_bytes:
|
|
3521
|
+
request_bytes: z31.number().int().nonnegative(),
|
|
3522
|
+
response_bytes: z31.number().int().nonnegative(),
|
|
3067
3523
|
/** Inline in `full` scope — every new row. Null on a legacy `metadata` or `object` row. */
|
|
3068
3524
|
request: ProxyTraceRequestSchema.nullable(),
|
|
3069
3525
|
response: ProxyTraceResponseSchema.nullable(),
|
|
3070
3526
|
/** Always false since ADR-0762 (nothing is cut); true only on rows from before it. */
|
|
3071
|
-
truncated:
|
|
3527
|
+
truncated: z31.boolean(),
|
|
3072
3528
|
created_at: Timestamp,
|
|
3073
3529
|
/** When the reaper deletes this row. Null since ADR-0762: model I/O is kept, not expired. */
|
|
3074
3530
|
expires_at: Timestamp.nullable()
|
|
3075
3531
|
});
|
|
3076
3532
|
|
|
3077
3533
|
// ../core/src/schema/review.ts
|
|
3078
|
-
import { z as
|
|
3079
|
-
var ReviewDecisionSchema =
|
|
3080
|
-
var Fields =
|
|
3081
|
-
var CreateReviewSchema =
|
|
3534
|
+
import { z as z32 } from "zod";
|
|
3535
|
+
var ReviewDecisionSchema = z32.enum(["approve", "reject", "edit"]);
|
|
3536
|
+
var Fields = z32.record(z32.string().max(100), z32.unknown()).nullable().optional();
|
|
3537
|
+
var CreateReviewSchema = z32.object({
|
|
3082
3538
|
decision: ReviewDecisionSchema,
|
|
3083
|
-
reason:
|
|
3084
|
-
file_ids:
|
|
3539
|
+
reason: z32.string().max(4e3).nullable().optional(),
|
|
3540
|
+
file_ids: z32.array(idOf("fil")).max(50).optional(),
|
|
3085
3541
|
session_id: idOf("ses").optional(),
|
|
3086
|
-
subject:
|
|
3542
|
+
subject: z32.record(z32.string().max(100), z32.unknown()).optional(),
|
|
3087
3543
|
before: Fields,
|
|
3088
3544
|
after: Fields
|
|
3089
3545
|
});
|
|
3090
3546
|
|
|
3091
|
-
// ../core/src/schema/
|
|
3092
|
-
import { z as
|
|
3093
|
-
var
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
"
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
"
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
var POSTS = ["waiting", "scheduled", "posted"];
|
|
3120
|
-
var PostStatus = z32.enum(POSTS);
|
|
3121
|
-
var PostLayout = z32.enum(["list", "row", "grid"]);
|
|
3122
|
-
var PostStatuses = z32.union([PostStatus, z32.array(PostStatus).min(1).max(3).refine((all) => new Set(all).size === all.length, "each status once")]);
|
|
3123
|
-
var PageBound = {
|
|
3124
|
-
...Bound,
|
|
3125
|
-
board: bound(["roadmap"], { per_group: z32.number().int().min(1).max(5).default(5) }),
|
|
3126
|
-
media: bound(["latest_media", "newest_media"], { count: z32.number().int().min(1).max(6).default(4) })
|
|
3127
|
-
};
|
|
3128
|
-
var PageResolved = {
|
|
3129
|
-
...Resolved,
|
|
3130
|
-
board: z32.strictObject({ $source: z32.literal("roadmap"), per_group: z32.number().int(), groups: RoadmapViewSchema.shape.groups }),
|
|
3131
|
-
media: z32.array(z32.strictObject({ id: z32.string(), kind: z32.enum(["image", "video"]) })).max(6)
|
|
3132
|
-
};
|
|
3133
|
-
function pageBlocks(slot) {
|
|
3134
|
-
return {
|
|
3135
|
-
Page: element("Page", {}, box, "The page itself, the root and only the root."),
|
|
3136
|
-
Section: element("Section", { title: words(40), to: Place.optional(), hide_empty: z32.boolean().optional() }, box, "A titled part of the page; hidden when every block in it is empty, if asked."),
|
|
3137
|
-
Needs: element("Needs", { label, needs: slot.needs }, leaf, "What waits on a person: approvals, questions, spent caps."),
|
|
3138
|
-
Activity: element("Activity", { label, agents: slot.agents }, leaf, "The agents working or waiting, and on what."),
|
|
3139
|
-
Accounts: element("Accounts", { accounts: slot.accounts }, leaf, "The template's networks: connected with a handle, or not."),
|
|
3140
|
-
Posts: element(
|
|
3141
|
-
"Posts",
|
|
3142
|
-
{ label, layout: PostLayout.optional(), posts: slot.posts },
|
|
3143
|
-
leaf,
|
|
3144
|
-
"Posts waiting on a person, scheduled, or posted; several statuses make one list. Drawn as rows (list, the default), one sideways row of cards (row), or a picture grid (grid)."
|
|
3145
|
-
),
|
|
3146
|
-
Answers: element("Answers", { answers: slot.answers }, leaf, "The setup's answers in one line, linking to the setup."),
|
|
3147
|
-
// No binding: the studio's gallery reads and pages the company's files itself (ADR-0987).
|
|
3148
|
-
MediaLibrary: element("MediaLibrary", {}, leaf, "Every picture and clip the company's agents made, with filters, sort and a viewer.")
|
|
3149
|
-
};
|
|
3150
|
-
}
|
|
3151
|
-
var OwnBound = pageBlocks({
|
|
3152
|
-
needs: bound(["needs"], {}),
|
|
3153
|
-
agents: bound(["agents_activity"], {}),
|
|
3154
|
-
accounts: bound(["accounts"], {}),
|
|
3155
|
-
posts: bound(["posts"], { status: PostStatuses, limit: z32.number().int().min(1).max(50).default(10) }),
|
|
3156
|
-
answers: bound(["answers"], { keys: z32.array(Key).min(1).max(TEMPLATE_QUESTIONS_MAX) })
|
|
3157
|
-
});
|
|
3158
|
-
var Need = z32.object({
|
|
3159
|
-
session_id: z32.string(),
|
|
3160
|
-
agent_id: z32.string(),
|
|
3161
|
-
agent: z32.string(),
|
|
3162
|
-
since: Timestamp,
|
|
3163
|
-
/** The chat's stored title, or `null`: the studio names it by when it began. */
|
|
3164
|
-
title: z32.string().nullable(),
|
|
3165
|
-
kind: z32.enum(["tool", "question", "budget"]),
|
|
3166
|
-
/** The call or question it is held on; `null` for a spent cap. */
|
|
3167
|
-
action: PendingActionSchema.nullable()
|
|
3168
|
-
});
|
|
3169
|
-
var Working = z32.object({
|
|
3170
|
-
agent_id: z32.string(),
|
|
3171
|
-
agent: z32.string(),
|
|
3172
|
-
state: z32.enum(["working", "waiting"]),
|
|
3173
|
-
session_id: z32.string().nullable(),
|
|
3174
|
-
title: z32.string().nullable(),
|
|
3175
|
-
at: Timestamp
|
|
3176
|
-
});
|
|
3177
|
-
var OwnResolved = pageBlocks({
|
|
3178
|
-
needs: z32.strictObject({ $source: z32.literal("needs"), items: z32.array(Need) }),
|
|
3179
|
-
agents: z32.strictObject({ $source: z32.literal("agents_activity"), agents: z32.array(Working) }),
|
|
3180
|
-
accounts: z32.strictObject({
|
|
3181
|
-
$source: z32.literal("accounts"),
|
|
3182
|
-
accounts: z32.array(z32.object({ platform: SocialPlatformSchema, connected: z32.boolean(), handle: z32.string().nullable() }))
|
|
3183
|
-
}),
|
|
3184
|
-
posts: z32.strictObject({ $source: z32.literal("posts"), status: z32.union([PostStatus, z32.array(PostStatus)]), limit: z32.number().int(), posts: z32.array(PostSchema), more: z32.boolean() }),
|
|
3185
|
-
answers: z32.strictObject({
|
|
3186
|
-
$source: z32.literal("answers"),
|
|
3187
|
-
keys: z32.array(z32.string()),
|
|
3188
|
-
values: z32.array(z32.string()),
|
|
3189
|
-
template: z32.object({ blueprint: z32.string(), template: z32.string() }).nullable()
|
|
3190
|
-
})
|
|
3191
|
-
});
|
|
3192
|
-
var BoundBlocks = { ...catalog(PageBound), ...OwnBound };
|
|
3193
|
-
var ResolvedBlocks = { ...catalog(PageResolved), ...OwnResolved };
|
|
3194
|
-
var Unread = element("Unread", { of: z32.string(), label: z32.string().nullable(), reason: z32.string() }, leaf, "A block that could not be read.");
|
|
3195
|
-
var B = BoundBlocks;
|
|
3196
|
-
var PageSpecSchema = spec(
|
|
3197
|
-
z32.discriminatedUnion(
|
|
3198
|
-
"type",
|
|
3199
|
-
[B.Page, B.Section, B.Stack, B.Grid, B.Metric, B.LineChart, B.BarList, B.Progress, B.Roadmap, B.Schedule, B.Media, B.Text, B.Needs, B.Activity, B.Accounts, B.Posts, B.Answers, B.MediaLibrary],
|
|
3200
|
-
unknownComponent(PAGE_BLOCKS)
|
|
3201
|
-
),
|
|
3202
|
-
"Page",
|
|
3203
|
-
MAX_PAGE_ELEMENTS
|
|
3204
|
-
);
|
|
3205
|
-
var R = ResolvedBlocks;
|
|
3206
|
-
var ResolvedPageElementSchema = z32.discriminatedUnion(
|
|
3207
|
-
"type",
|
|
3208
|
-
[R.Page, R.Section, R.Stack, R.Grid, R.Metric, R.LineChart, R.BarList, R.Progress, R.Roadmap, R.Schedule, R.Media, R.Text, R.Needs, R.Activity, R.Accounts, R.Posts, R.Answers, R.MediaLibrary, Unread],
|
|
3209
|
-
unknownComponent(PAGE_BLOCKS)
|
|
3210
|
-
);
|
|
3211
|
-
var ResolvedPageSpecSchema = spec(ResolvedPageElementSchema, "Page", MAX_PAGE_ELEMENTS);
|
|
3212
|
-
var unique = (items) => new Set(items.map((item) => item.slug)).size === items.length;
|
|
3213
|
-
var MiniAppPageSchema = z32.strictObject({ slug: MiniAppSlugSchema, title: words(24), spec: PageSpecSchema });
|
|
3214
|
-
var MiniAppDeclSchema = z32.strictObject({
|
|
3215
|
-
slug: MiniAppSlugSchema,
|
|
3216
|
-
name: words(40),
|
|
3217
|
-
icon: MiniAppIconSchema,
|
|
3218
|
-
pages: z32.array(MiniAppPageSchema).min(1).max(6).refine(unique, "each page's slug is its own")
|
|
3219
|
-
});
|
|
3220
|
-
var MiniAppDeclsSchema = z32.array(MiniAppDeclSchema).max(8).refine(unique, "each mini app's slug is its own");
|
|
3221
|
-
var MiniAppSummarySchema = z32.object({
|
|
3222
|
-
object: z32.literal("mini_app"),
|
|
3223
|
-
slug: MiniAppSlugSchema,
|
|
3224
|
-
name: z32.string(),
|
|
3225
|
-
icon: MiniAppIconSchema,
|
|
3226
|
-
pages: z32.array(z32.object({ slug: MiniAppSlugSchema, title: z32.string() })).min(1),
|
|
3227
|
-
/** What it reads (`miniAppReads`). Absent from an older API: the Studio then claims nothing it cannot see. */
|
|
3228
|
-
reads: z32.array(z32.string()).optional()
|
|
3229
|
-
});
|
|
3230
|
-
var MiniAppSchema = MiniAppSummarySchema.extend({
|
|
3231
|
-
networks: z32.array(z32.object({ platform: SocialPlatformSchema, connected: z32.boolean().nullable() })),
|
|
3232
|
-
page: MiniAppSlugSchema,
|
|
3233
|
-
as_of: Timestamp,
|
|
3234
|
-
timezone: z32.string().min(1),
|
|
3235
|
-
spec: ResolvedPageSpecSchema
|
|
3547
|
+
// ../core/src/schema/ads.ts
|
|
3548
|
+
import { z as z33 } from "zod";
|
|
3549
|
+
var AdProviderSchema = z33.enum(["google"]);
|
|
3550
|
+
var AdCampaignStatusSchema = z33.enum(["enabled", "paused", "removed", "unknown"]);
|
|
3551
|
+
var AdCampaignSchema = z33.object({
|
|
3552
|
+
id: z33.string().min(1),
|
|
3553
|
+
object: z33.literal("ad_campaign"),
|
|
3554
|
+
provider: AdProviderSchema,
|
|
3555
|
+
connection_id: z33.string().min(1),
|
|
3556
|
+
customer_id: z33.string().regex(/^\d{10}$/),
|
|
3557
|
+
resource_name: z33.string().min(1),
|
|
3558
|
+
name: z33.string().min(1),
|
|
3559
|
+
type: z33.literal("search"),
|
|
3560
|
+
status: AdCampaignStatusSchema,
|
|
3561
|
+
/** Null for provider campaigns with no ad; list and status reads are campaign-based. */
|
|
3562
|
+
final_url: z33.url().nullable(),
|
|
3563
|
+
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
3564
|
+
start_date: z33.iso.date(),
|
|
3565
|
+
end_date: z33.iso.date()
|
|
3566
|
+
});
|
|
3567
|
+
var AdCampaignInsightsSchema = z33.object({
|
|
3568
|
+
object: z33.literal("ad_campaign_insights"),
|
|
3569
|
+
provider: AdProviderSchema,
|
|
3570
|
+
campaign_id: z33.string().min(1),
|
|
3571
|
+
impressions: z33.number().int().nonnegative(),
|
|
3572
|
+
clicks: z33.number().int().nonnegative(),
|
|
3573
|
+
conversions: z33.number().nonnegative(),
|
|
3574
|
+
spend_micro_usd: MicroUsdField.nonnegative()
|
|
3236
3575
|
});
|
|
3237
3576
|
|
|
3577
|
+
// ../core/src/session-token.ts
|
|
3578
|
+
var SESSION_TTL_SECONDS = 30 * 24 * 60 * 60;
|
|
3579
|
+
var encoder = new TextEncoder();
|
|
3580
|
+
|
|
3238
3581
|
// ../core/src/logo-svg.ts
|
|
3239
3582
|
var MAX_BYTES = 16 * 1024;
|
|
3240
3583
|
|
|
3584
|
+
// ../core/src/brand-kit.ts
|
|
3585
|
+
import { z as z34 } from "zod";
|
|
3586
|
+
var HARMONIES = [165, 40, 120, 200];
|
|
3587
|
+
var BRAND_HARMONIES = HARMONIES.length;
|
|
3588
|
+
var BrandKitArgsSchema = z34.object({
|
|
3589
|
+
colour: z34.string().regex(/^#[0-9a-fA-F]{6}$/).describe("The brand's main colour, as #rrggbb \u2014 usually the logo's own. The palette is drawn around it."),
|
|
3590
|
+
harmony: z34.number().int().min(0).max(BRAND_HARMONIES - 1).optional().describe("Which accent the palette takes, 0\u20133. Change it when asked for other colours with the same main one."),
|
|
3591
|
+
typeface: z34.enum(BRAND_TYPEFACES).describe("grotesk (clean), serif (classic), rounded (friendly) or mono (technical)."),
|
|
3592
|
+
tagline: z34.string().max(80).optional().describe("One short line under the name. Leave it out when there is none.")
|
|
3593
|
+
});
|
|
3594
|
+
|
|
3241
3595
|
// ../core/src/file-url.ts
|
|
3242
3596
|
var encoder2 = new TextEncoder();
|
|
3243
3597
|
var SESSION_FILE_URL_TTL_MS = 15 * 6e4;
|
|
3244
3598
|
|
|
3245
3599
|
// src/define.ts
|
|
3246
|
-
import { z as
|
|
3600
|
+
import { z as z37 } from "zod";
|
|
3247
3601
|
|
|
3248
3602
|
// src/roster.ts
|
|
3249
|
-
import { z as
|
|
3603
|
+
import { z as z36 } from "zod";
|
|
3250
3604
|
|
|
3251
3605
|
// src/report.ts
|
|
3252
3606
|
import { ApiError, send } from "@usenaive-sdk/vetta";
|
|
3253
|
-
import { z as
|
|
3607
|
+
import { z as z35 } from "zod";
|
|
3254
3608
|
function message(error) {
|
|
3255
3609
|
if (error instanceof ApiError && error.requestId !== "") return `${error.message} (request ${error.requestId})`;
|
|
3256
3610
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -3292,10 +3646,10 @@ async function absent(work) {
|
|
|
3292
3646
|
throw error;
|
|
3293
3647
|
}
|
|
3294
3648
|
}
|
|
3295
|
-
var PageShape =
|
|
3296
|
-
data:
|
|
3297
|
-
has_more:
|
|
3298
|
-
next_cursor:
|
|
3649
|
+
var PageShape = z35.object({
|
|
3650
|
+
data: z35.array(z35.unknown()),
|
|
3651
|
+
has_more: z35.boolean(),
|
|
3652
|
+
next_cursor: z35.string().nullable()
|
|
3299
3653
|
});
|
|
3300
3654
|
function rowLabel(row) {
|
|
3301
3655
|
const { object, id } = row ?? {};
|
|
@@ -3327,17 +3681,17 @@ async function tombstone(name, current, remove, dryRun) {
|
|
|
3327
3681
|
}
|
|
3328
3682
|
|
|
3329
3683
|
// src/roster.ts
|
|
3330
|
-
var NAME =
|
|
3331
|
-
var RosterNameSchema =
|
|
3684
|
+
var NAME = z36.string().min(1);
|
|
3685
|
+
var RosterNameSchema = z36.union([
|
|
3332
3686
|
NAME.transform((name) => ({ type: "agent", name })),
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3687
|
+
z36.object({ type: z36.literal("agent"), name: NAME, version: z36.number().int().positive().optional() }),
|
|
3688
|
+
z36.object({ type: z36.literal("self") }),
|
|
3689
|
+
z36.object({ type: z36.literal("advisor"), model: z36.string().min(1) })
|
|
3336
3690
|
]);
|
|
3337
|
-
var DeclMultiagentField =
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3691
|
+
var DeclMultiagentField = z36.union([
|
|
3692
|
+
z36.boolean(),
|
|
3693
|
+
z36.object({ ...MultiagentSchema.shape, agents: z36.array(RosterNameSchema).min(1).max(20) }),
|
|
3694
|
+
z36.null()
|
|
3341
3695
|
]);
|
|
3342
3696
|
var hasRoster = (value) => typeof value === "object" && value !== null;
|
|
3343
3697
|
var rosterNames = (roster) => roster.agents.flatMap((entry) => entry.type === "agent" ? [entry.name] : []);
|
|
@@ -3386,108 +3740,75 @@ async function patchRoster(client, decl, roster, existing, ids, dryRun, lines) {
|
|
|
3386
3740
|
updated();
|
|
3387
3741
|
}
|
|
3388
3742
|
|
|
3389
|
-
// src/template.ts
|
|
3390
|
-
var BLUEPRINTS = {
|
|
3391
|
-
/** Clients, pipeline, deliverables, calendar. */
|
|
3392
|
-
agency: { templates: ["blank", "seo-geo"], default: "blank" },
|
|
3393
|
-
/**
|
|
3394
|
-
* Post queue, accounts, calendar, analytics. The wire ids are frozen: `install.template` is a
|
|
3395
|
-
* stored string on every provisioned org, so the display names moved ("Naive Short Form v1",
|
|
3396
|
-
* "Naive Long Form v1", "Naive Clipping v1") and these did not.
|
|
3397
|
-
*/
|
|
3398
|
-
media: { templates: ["faceless", "longform", "clipping"] },
|
|
3399
|
-
/** Pages, posts, forms, analytics — a published site with a crew behind it (`usenaive/web-blueprint`). */
|
|
3400
|
-
web: { templates: ["publisher"], default: "publisher" }
|
|
3401
|
-
};
|
|
3402
|
-
var list = (names) => names.join(", ");
|
|
3403
|
-
function chooseTemplate(blueprint, template) {
|
|
3404
|
-
if (blueprint === void 0) {
|
|
3405
|
-
if (template === void 0) return { ok: true, template: void 0 };
|
|
3406
|
-
return {
|
|
3407
|
-
ok: false,
|
|
3408
|
-
message: `template "${template}" names no blueprint \u2014 a template belongs to one, so add \`blueprint: "\u2026"\` (${list(Object.keys(BLUEPRINTS))})`
|
|
3409
|
-
};
|
|
3410
|
-
}
|
|
3411
|
-
const known = BLUEPRINTS[blueprint];
|
|
3412
|
-
if (known === void 0) {
|
|
3413
|
-
return { ok: false, message: `blueprint "${blueprint}" is not a blueprint \u2014 the blueprints are ${list(Object.keys(BLUEPRINTS))}` };
|
|
3414
|
-
}
|
|
3415
|
-
if (template === void 0) {
|
|
3416
|
-
if (known.default !== void 0) return { ok: true, template: known.default };
|
|
3417
|
-
return {
|
|
3418
|
-
ok: false,
|
|
3419
|
-
message: `blueprint "${blueprint}" needs a template \u2014 choose one of ${list(known.templates)}. Its crews spend money in different ways, so there is no default to fall back to.`
|
|
3420
|
-
};
|
|
3421
|
-
}
|
|
3422
|
-
if (!known.templates.includes(template)) {
|
|
3423
|
-
return { ok: false, message: `template "${template}" is not a template of blueprint "${blueprint}" \u2014 its templates are ${list(known.templates)}` };
|
|
3424
|
-
}
|
|
3425
|
-
return { ok: true, template };
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
3743
|
// src/define.ts
|
|
3429
3744
|
var BlueprintRefusal = class extends Error {
|
|
3430
3745
|
name = "BlueprintRefusal";
|
|
3431
3746
|
};
|
|
3432
|
-
var EnvValueSchema =
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3747
|
+
var EnvValueSchema = z37.union([
|
|
3748
|
+
z37.string(),
|
|
3749
|
+
z37.object({ from_env: z37.string().min(1) }),
|
|
3750
|
+
z37.object({ generate: z37.literal(true) })
|
|
3436
3751
|
]);
|
|
3437
|
-
var AppDeclSchema =
|
|
3752
|
+
var AppDeclSchema = z37.object({
|
|
3438
3753
|
/** Becomes a hostname, so the grammar is the platform's `APP_NAME` (a DNS label). */
|
|
3439
|
-
name:
|
|
3754
|
+
name: z37.string().regex(APP_NAME, "a lowercase DNS label, 63 characters or fewer"),
|
|
3440
3755
|
type: AppTypeSchema,
|
|
3441
|
-
description:
|
|
3756
|
+
description: z37.string().optional(),
|
|
3442
3757
|
/** A directory whose files are collected and shipped as the app's file-map deployment. */
|
|
3443
|
-
deploy_dir:
|
|
3758
|
+
deploy_dir: z37.string().min(1).optional(),
|
|
3444
3759
|
/** The path the app itself serves MCP on (§29.5); `fullstack` only. Absent means none. */
|
|
3445
3760
|
mcp: AppMcpPathSchema.optional(),
|
|
3446
3761
|
/** Written as the app's write-only secrets (§29.2) on every apply; names follow the platform's `ENV_NAME`. */
|
|
3447
|
-
env:
|
|
3762
|
+
env: z37.record(z37.string().regex(ENV_NAME), EnvValueSchema, { error: "keyed by environment variable name (A-Z, 0-9, _)" }).optional(),
|
|
3448
3763
|
/** An install may not leave this app out of its `selection` (§31.2). Absent means it may. */
|
|
3449
|
-
required:
|
|
3764
|
+
required: z37.boolean().optional(),
|
|
3450
3765
|
// core-gaps: U8-database
|
|
3451
3766
|
/** SQL files applied in order to the app's database after it is provisioned (§37); `fullstack` only. */
|
|
3452
|
-
migrations:
|
|
3767
|
+
migrations: z37.array(z37.string().min(1)).optional(),
|
|
3453
3768
|
// core-gaps: storage-stock
|
|
3454
3769
|
/** Buckets the app's object store must hold (§38.2); `fullstack` only. `public` defaults to false. */
|
|
3455
|
-
buckets:
|
|
3770
|
+
buckets: z37.array(CreateBucketSchema).optional()
|
|
3456
3771
|
});
|
|
3457
|
-
var ScheduleDeclSchema =
|
|
3458
|
-
cron:
|
|
3459
|
-
timezone:
|
|
3772
|
+
var ScheduleDeclSchema = z37.object({
|
|
3773
|
+
cron: z37.string().min(1),
|
|
3774
|
+
timezone: z37.string().min(1).optional(),
|
|
3460
3775
|
/** The message every fire opens its session with (`input_template` on the wire). */
|
|
3461
|
-
input:
|
|
3776
|
+
input: z37.string().min(1),
|
|
3777
|
+
/**
|
|
3778
|
+
* What a fire does, in a few words a person reads ("Weekly report") — the launch card's line for it
|
|
3779
|
+
* and the receipt's (`canonical-spec §31.3`, ADR-1172). Printed, never provisioned; absent, the
|
|
3780
|
+
* platform reads the opening of `input`.
|
|
3781
|
+
*/
|
|
3782
|
+
summary: z37.string().min(1).max(48).optional(),
|
|
3462
3783
|
budget_micro_usd: MicroUsdField.nonnegative(),
|
|
3463
|
-
identity:
|
|
3464
|
-
enabled:
|
|
3784
|
+
identity: z37.string().min(1).optional(),
|
|
3785
|
+
enabled: z37.boolean().optional()
|
|
3465
3786
|
});
|
|
3466
3787
|
var ToolsDeclSchema = ToolsetSchema;
|
|
3467
|
-
var AgentDeclSchema =
|
|
3468
|
-
name:
|
|
3469
|
-
model:
|
|
3788
|
+
var AgentDeclSchema = z37.object({
|
|
3789
|
+
name: z37.string().min(1),
|
|
3790
|
+
model: z37.string().min(1),
|
|
3470
3791
|
budget: BudgetSchema,
|
|
3471
|
-
description:
|
|
3792
|
+
description: z37.string().optional(),
|
|
3472
3793
|
/** Two or three words the studio prints beside the name (§31.5) — "Head of content", not a sentence. */
|
|
3473
|
-
role:
|
|
3794
|
+
role: z37.string().min(1).optional(),
|
|
3474
3795
|
/** An install may not leave this agent out of its `selection` (§31.2). Absent means it may. */
|
|
3475
|
-
required:
|
|
3476
|
-
system:
|
|
3796
|
+
required: z37.boolean().optional(),
|
|
3797
|
+
system: z37.string().optional(),
|
|
3477
3798
|
tools: ToolsDeclSchema.optional(),
|
|
3478
|
-
skills:
|
|
3479
|
-
mcp_servers:
|
|
3799
|
+
skills: z37.array(SkillRefSchema).optional(),
|
|
3800
|
+
mcp_servers: z37.array(McpServerSchema).optional(),
|
|
3480
3801
|
/** The rest of the runtime's agent config (§31.6), each the core schema; absent means the route's default and never drift. */
|
|
3481
3802
|
window: WindowSchema.optional(),
|
|
3482
3803
|
/** A roster names crew members by declared *name*; `up` resolves them to `agt_` ids in a second pass (`roster.ts`). */
|
|
3483
3804
|
multiagent: DeclMultiagentField.optional(),
|
|
3484
3805
|
output_schema: JsonSchemaDocument.nullable().optional(),
|
|
3485
|
-
structured_output_required:
|
|
3806
|
+
structured_output_required: z37.boolean().optional(),
|
|
3486
3807
|
metadata: Metadata.optional(),
|
|
3487
3808
|
/** Declared app *names*; `up` resolves them to `app_` ids in `tools.configs.apps` (§29.3). */
|
|
3488
|
-
allowed_apps:
|
|
3809
|
+
allowed_apps: z37.array(z37.string()).optional(),
|
|
3489
3810
|
/** A declared identity *name*; `up` attaches it after the agent upsert (§22). */
|
|
3490
|
-
identity:
|
|
3811
|
+
identity: z37.string().min(1).optional(),
|
|
3491
3812
|
/**
|
|
3492
3813
|
* Who this agent may `send_to_agent` (§31.7, §28.12): `true` (anyone in the organization),
|
|
3493
3814
|
* `false` (nobody), `"team"` (its `multiagent` roster), or declared agent *names*, checked
|
|
@@ -3495,7 +3816,7 @@ var AgentDeclSchema = z35.object({
|
|
|
3495
3816
|
*/
|
|
3496
3817
|
handoffs: HandoffsField.optional(),
|
|
3497
3818
|
/** The agent's deployments as a complete set: declared → owned, and the rest are pruned (ADR-0355). */
|
|
3498
|
-
schedules:
|
|
3819
|
+
schedules: z37.array(ScheduleDeclSchema).optional(),
|
|
3499
3820
|
/**
|
|
3500
3821
|
* The first thing this agent reads, once, on the apply that **creates** it (`canonical-spec
|
|
3501
3822
|
* §31.4`). It is what turns a provisioned crew into a crew that has started working.
|
|
@@ -3508,73 +3829,86 @@ var AgentDeclSchema = z35.object({
|
|
|
3508
3829
|
* repeatedly and unattended while an intake spends once, at an apply a person is watching. Absent
|
|
3509
3830
|
* means the agent's own `budget` governs.
|
|
3510
3831
|
*/
|
|
3511
|
-
intake:
|
|
3832
|
+
intake: z37.object({ message: z37.string().min(1), budget_micro_usd: MicroUsdField.nonnegative().optional() }).optional()
|
|
3512
3833
|
});
|
|
3513
|
-
var CredentialDeclSchema =
|
|
3834
|
+
var CredentialDeclSchema = z37.object({
|
|
3514
3835
|
kind: VaultCredentialKindSchema,
|
|
3515
|
-
key:
|
|
3836
|
+
key: z37.string().min(1).max(128),
|
|
3516
3837
|
/** The one exact destination host an `env_var` is bound to. */
|
|
3517
|
-
host:
|
|
3838
|
+
host: z37.string().min(1).optional(),
|
|
3518
3839
|
/** The MCP server URL a `static_bearer` / `mcp_oauth` token is matched to. */
|
|
3519
|
-
mcp_server_url:
|
|
3520
|
-
value:
|
|
3840
|
+
mcp_server_url: z37.url().optional(),
|
|
3841
|
+
value: z37.object({ from_env: z37.string().min(1) })
|
|
3521
3842
|
});
|
|
3522
|
-
var VaultDeclSchema =
|
|
3843
|
+
var VaultDeclSchema = z37.object({
|
|
3523
3844
|
name: VaultSchema.shape.display_name,
|
|
3524
|
-
identity:
|
|
3525
|
-
credentials:
|
|
3845
|
+
identity: z37.string().min(1).optional(),
|
|
3846
|
+
credentials: z37.array(CredentialDeclSchema)
|
|
3526
3847
|
});
|
|
3527
|
-
var SkillDeclSchema =
|
|
3528
|
-
slug:
|
|
3529
|
-
file:
|
|
3848
|
+
var SkillDeclSchema = z37.object({
|
|
3849
|
+
slug: z37.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes"),
|
|
3850
|
+
file: z37.string().min(1)
|
|
3530
3851
|
});
|
|
3531
3852
|
var LegalDeclSchema = CreateLegalCompanySchema.pick({
|
|
3532
3853
|
state: true,
|
|
3533
3854
|
name_options: true,
|
|
3534
3855
|
naics_code: true,
|
|
3535
3856
|
description: true
|
|
3536
|
-
}).extend({ label:
|
|
3857
|
+
}).extend({ label: z37.string().min(1).max(128) });
|
|
3537
3858
|
var WalletDeclSchema = CreateWalletSchema.or(
|
|
3538
|
-
|
|
3539
|
-
(
|
|
3859
|
+
z37.array(CreateWalletSchema).refine(
|
|
3860
|
+
(list) => new Set(list.map((w) => w.network ?? DEFAULT_WALLET_NETWORK)).size === list.length,
|
|
3540
3861
|
{ message: "one wallet per network" }
|
|
3541
3862
|
)
|
|
3542
3863
|
);
|
|
3543
3864
|
var CardDeclSchema = IssueCardSchema;
|
|
3544
3865
|
var IdentityDeclSchema = IdentitySchema.pick({ name: true, description: true }).partial({ description: true }).extend({
|
|
3545
|
-
legal:
|
|
3866
|
+
legal: z37.array(LegalDeclSchema).optional(),
|
|
3546
3867
|
wallet: WalletDeclSchema.optional(),
|
|
3547
|
-
cards:
|
|
3548
|
-
});
|
|
3549
|
-
var RemovedSchema =
|
|
3550
|
-
apps:
|
|
3551
|
-
agents:
|
|
3552
|
-
skills:
|
|
3553
|
-
identities:
|
|
3554
|
-
vaults:
|
|
3555
|
-
});
|
|
3556
|
-
var KeptSchema =
|
|
3557
|
-
var TaskDeclSchema =
|
|
3558
|
-
key:
|
|
3559
|
-
title:
|
|
3560
|
-
body:
|
|
3561
|
-
assignee:
|
|
3562
|
-
blocked_by:
|
|
3563
|
-
});
|
|
3564
|
-
var ProjectSchema =
|
|
3565
|
-
name:
|
|
3868
|
+
cards: z37.array(CardDeclSchema).optional()
|
|
3869
|
+
});
|
|
3870
|
+
var RemovedSchema = z37.object({
|
|
3871
|
+
apps: z37.array(z37.string().min(1)).default([]),
|
|
3872
|
+
agents: z37.array(z37.string().min(1)).default([]),
|
|
3873
|
+
skills: z37.array(z37.string().min(1)).default([]),
|
|
3874
|
+
identities: z37.array(z37.string().min(1)).default([]),
|
|
3875
|
+
vaults: z37.array(z37.string().min(1)).default([])
|
|
3876
|
+
});
|
|
3877
|
+
var KeptSchema = z37.object({ agents: z37.array(z37.string().min(1)).default([]) });
|
|
3878
|
+
var TaskDeclSchema = z37.object({
|
|
3879
|
+
key: z37.string().min(1),
|
|
3880
|
+
title: z37.string().min(1).max(200),
|
|
3881
|
+
body: z37.string().max(8192).optional(),
|
|
3882
|
+
assignee: z37.string().min(1).optional(),
|
|
3883
|
+
blocked_by: z37.array(z37.string().min(1)).optional()
|
|
3884
|
+
});
|
|
3885
|
+
var ProjectSchema = z37.object({
|
|
3886
|
+
name: z37.string().min(1),
|
|
3566
3887
|
/** The machine this project runs: its repo, its screens, its `/api/*` (`template.ts`). */
|
|
3567
|
-
blueprint:
|
|
3888
|
+
blueprint: z37.string().min(1).optional(),
|
|
3568
3889
|
/** Which of that blueprint's templates provides the crew; a blueprint with a default may omit it. */
|
|
3569
|
-
template:
|
|
3890
|
+
template: z37.string().min(1).optional(),
|
|
3570
3891
|
/**
|
|
3571
3892
|
* What a person calls this template, one line on what its crew does, and the networks it
|
|
3572
3893
|
* publishes to (`canonical-spec §31.5`). Printed on the artifact and never provisioned: where the
|
|
3573
3894
|
* crew posts is the accounts connected to its persona, not this list.
|
|
3574
3895
|
*/
|
|
3575
|
-
title:
|
|
3576
|
-
description:
|
|
3577
|
-
platforms:
|
|
3896
|
+
title: z37.string().min(1).max(80).optional(),
|
|
3897
|
+
description: z37.string().min(1).max(280).optional(),
|
|
3898
|
+
platforms: z37.array(SocialPlatformSchema).optional(),
|
|
3899
|
+
/**
|
|
3900
|
+
* The first week in the template's own words, for the launch card (`canonical-spec §31.5`,
|
|
3901
|
+
* ADR-1172): `day_one` is what Day 1 comes to ("Set up and publish the first post"), `every_day`
|
|
3902
|
+
* what each day after it carries ("New posts · Performance analysis"), and `after` what the card's
|
|
3903
|
+
* "Day 8 on" line says follows the week ("The week repeats · the CEO finds sponsors…"). Printed,
|
|
3904
|
+
* never provisioned; absent, the card reads the seeded cards and the timers, and "Day 8 on" says
|
|
3905
|
+
* only "The week repeats".
|
|
3906
|
+
*/
|
|
3907
|
+
roadmap: z37.object({
|
|
3908
|
+
day_one: z37.string().min(1).max(60).optional(),
|
|
3909
|
+
every_day: z37.string().min(1).max(60).optional(),
|
|
3910
|
+
after: z37.string().min(1).max(80).optional()
|
|
3911
|
+
}).optional(),
|
|
3578
3912
|
/**
|
|
3579
3913
|
* The company's mini apps (`canonical-spec §50`): each a name, an icon and pages of the platform's
|
|
3580
3914
|
* blocks — data only, checked with the platform's catalog here and again when a page is read. The
|
|
@@ -3592,21 +3926,21 @@ var ProjectSchema = z35.object({
|
|
|
3592
3926
|
*
|
|
3593
3927
|
* **Configuration only.** A secret is a vault credential or an app secret; neither is an answer.
|
|
3594
3928
|
*/
|
|
3595
|
-
questions:
|
|
3596
|
-
skills:
|
|
3597
|
-
identities:
|
|
3598
|
-
vaults:
|
|
3599
|
-
apps:
|
|
3600
|
-
agents:
|
|
3929
|
+
questions: z37.array(QuestionFieldSchema).default([]),
|
|
3930
|
+
skills: z37.array(SkillDeclSchema).default([]),
|
|
3931
|
+
identities: z37.array(IdentityDeclSchema).default([]),
|
|
3932
|
+
vaults: z37.array(VaultDeclSchema).default([]),
|
|
3933
|
+
apps: z37.array(AppDeclSchema).default([]),
|
|
3934
|
+
agents: z37.array(AgentDeclSchema).default([]),
|
|
3601
3935
|
/**
|
|
3602
3936
|
* The agents this template creates PER CLIENT the operator signs (`canonical-spec §31.1`) —
|
|
3603
3937
|
* printed on the artifact so a person sees the whole company, never provisioned by an apply,
|
|
3604
3938
|
* because the apply does not know the clients yet. Names only: a model and a budget are the
|
|
3605
3939
|
* crew's business at the moment a client is signed, not the declaration's.
|
|
3606
3940
|
*/
|
|
3607
|
-
crew_per_client:
|
|
3941
|
+
crew_per_client: z37.array(z37.object({ name: z37.string().min(1), role: z37.string().min(1).optional(), description: z37.string().optional() })).optional(),
|
|
3608
3942
|
/** The crew's first work, as cards on the organization's board rather than N private intakes (§31.11). */
|
|
3609
|
-
tasks:
|
|
3943
|
+
tasks: z37.array(TaskDeclSchema).default([]),
|
|
3610
3944
|
removed: RemovedSchema.default({ apps: [], agents: [], skills: [], identities: [], vaults: [] }),
|
|
3611
3945
|
kept: KeptSchema.default({ agents: [] })
|
|
3612
3946
|
});
|
|
@@ -4203,7 +4537,7 @@ function desiredMetadata(decl, of, current) {
|
|
|
4203
4537
|
project: of.project,
|
|
4204
4538
|
...of.blueprint !== void 0 ? { blueprint: of.blueprint } : {},
|
|
4205
4539
|
template: of.template,
|
|
4206
|
-
group: of.template
|
|
4540
|
+
group: of.group ?? of.template
|
|
4207
4541
|
};
|
|
4208
4542
|
}
|
|
4209
4543
|
function desiredSystem(decl, of) {
|
|
@@ -4247,14 +4581,14 @@ async function createAgent(client, decl, tools, team, identityId, system, metada
|
|
|
4247
4581
|
if (identityId !== void 0) await client.identities.attach(created.id, identityId);
|
|
4248
4582
|
return { name: decl.name, action: "created", id: created.id };
|
|
4249
4583
|
}
|
|
4250
|
-
async function upsertAgent(client, decl, existing, ids, dryRun,
|
|
4584
|
+
async function upsertAgent(client, decl, existing, ids, dryRun, scoped2, of) {
|
|
4251
4585
|
const unresolved = (decl.allowed_apps ?? []).filter((name) => !ids.apps.has(name));
|
|
4252
4586
|
const identityId = decl.identity === void 0 ? void 0 : ids.identities.get(decl.identity);
|
|
4253
4587
|
const missing = unresolved.length > 0 ? `allowed_apps needs app "${unresolved[0]}"` : decl.identity !== void 0 && identityId === void 0 ? `identity needs "${decl.identity}"` : null;
|
|
4254
4588
|
if (missing !== null && !dryRun) {
|
|
4255
4589
|
return { name: decl.name, action: "refused", reason: `${missing}, which was not provisioned in this run` };
|
|
4256
4590
|
}
|
|
4257
|
-
const appIds = decl.allowed_apps !== void 0 ? decl.allowed_apps.flatMap((name) => ids.apps.get(name) ?? []) :
|
|
4591
|
+
const appIds = decl.allowed_apps !== void 0 ? decl.allowed_apps.flatMap((name) => ids.apps.get(name) ?? []) : scoped2;
|
|
4258
4592
|
const current = existing.find((agent) => agent.name === decl.name) ?? null;
|
|
4259
4593
|
const owner = typeof current?.metadata?.["project"] === "string" ? current.metadata["project"] : null;
|
|
4260
4594
|
if (current && of.template !== void 0 && owner !== null && owner !== of.project && !of.adopt) {
|
|
@@ -4349,9 +4683,10 @@ async function reconcileSchedules(client, agent, declared, live, identityIds, dr
|
|
|
4349
4683
|
// `<agent> @ <cron>` says WHEN a timer runs and nothing about what it does, so the dashboard's
|
|
4350
4684
|
// opening message could only ever draw a timetable from these lines. The brief's first
|
|
4351
4685
|
// sentence is what turns that timetable into a roadmap (§29.6).
|
|
4352
|
-
summary: brief(decl.input)
|
|
4686
|
+
summary: decl.summary ?? brief(decl.input)
|
|
4353
4687
|
}))
|
|
4354
4688
|
);
|
|
4689
|
+
if (agent.action === "refused") return;
|
|
4355
4690
|
for (const row of rows.filter((row2) => !declared.some((decl) => decl.cron === row2.cron))) {
|
|
4356
4691
|
const name = `${agent.name} @ ${row.cron}`;
|
|
4357
4692
|
await attempt(into, name, () => tombstone(name, row, (id) => client.deployments.delete(id), dryRun));
|
|
@@ -4459,6 +4794,7 @@ async function reportLegal(client, decls, identityId, skipped) {
|
|
|
4459
4794
|
}
|
|
4460
4795
|
|
|
4461
4796
|
// src/tasks.ts
|
|
4797
|
+
import { ApiError as ApiError2 } from "@usenaive-sdk/vetta";
|
|
4462
4798
|
var ORCHESTRATOR_MARKER = "orchestrator";
|
|
4463
4799
|
var CEO_LABEL = "CEO";
|
|
4464
4800
|
var CEO_DETAIL = "Hires and directs the crew";
|
|
@@ -4490,7 +4826,13 @@ async function ensureOrchestrator(client, existing, members, dryRun) {
|
|
|
4490
4826
|
return { name: CEO_LABEL, action: "created", id: made.id };
|
|
4491
4827
|
}
|
|
4492
4828
|
if (live !== null && !changed(team, live)) return { name: current.name, action: "unchanged", id: current.id };
|
|
4493
|
-
if (
|
|
4829
|
+
if (dryRun) return { name: current.name, action: "updated", id: current.id };
|
|
4830
|
+
try {
|
|
4831
|
+
await client.agents.update(current.id, { multiagent: team });
|
|
4832
|
+
} catch (error) {
|
|
4833
|
+
if (!(error instanceof ApiError2 && error.status === 403)) throw error;
|
|
4834
|
+
return { name: current.name, action: "unchanged", id: current.id, reason: `crew not seated on its roster: ${error.message} (request ${error.requestId})` };
|
|
4835
|
+
}
|
|
4494
4836
|
return { name: current.name, action: "updated", id: current.id };
|
|
4495
4837
|
}
|
|
4496
4838
|
async function seedTasks(client, config, existing, agents, dryRun, into, skipped) {
|
|
@@ -4672,17 +5014,22 @@ async function upsertSkill(client, decl, opts) {
|
|
|
4672
5014
|
const pushed = await client.skills.push({ slug: decl.slug, content, sha256 });
|
|
4673
5015
|
return { name: decl.slug, action, id: pushed.id };
|
|
4674
5016
|
}
|
|
4675
|
-
async function upsertIdentity(client, decl, dryRun, identityIds) {
|
|
5017
|
+
async function upsertIdentity(client, decl, dryRun, identityIds, owner) {
|
|
4676
5018
|
const current = await absent(client.identities.get(decl.name));
|
|
4677
5019
|
if (!current) {
|
|
4678
5020
|
if (dryRun) return { name: decl.name, action: "created" };
|
|
4679
5021
|
const created = await client.identities.create({
|
|
4680
5022
|
name: decl.name,
|
|
4681
|
-
...decl.description !== void 0 ? { description: decl.description } : {}
|
|
5023
|
+
...decl.description !== void 0 ? { description: decl.description } : {},
|
|
5024
|
+
...owner !== void 0 ? { metadata: { project: owner } } : {}
|
|
4682
5025
|
});
|
|
4683
5026
|
identityIds.set(decl.name, created.id);
|
|
4684
5027
|
return { name: decl.name, action: "created", id: created.id };
|
|
4685
5028
|
}
|
|
5029
|
+
const held = typeof current.metadata["project"] === "string" ? current.metadata["project"] : null;
|
|
5030
|
+
if (owner !== void 0 && held !== owner) {
|
|
5031
|
+
return { name: decl.name, action: "refused", id: current.id, reason: ownershipRefusal(decl.name, owner, held, "identity") };
|
|
5032
|
+
}
|
|
4686
5033
|
identityIds.set(decl.name, current.id);
|
|
4687
5034
|
const drifted = decl.description !== void 0 && decl.description !== current.description;
|
|
4688
5035
|
if (drifted && !dryRun) await client.identities.update(current.id, { description: decl.description ?? null });
|
|
@@ -4745,12 +5092,14 @@ async function up(config, client, opts = {}) {
|
|
|
4745
5092
|
const taken = selectCrew(config, opts.select);
|
|
4746
5093
|
const report2 = { dry_run: dryRun, ...applied(config), skills: [], identities: [], vaults: [], apps: [], agents: [], schedules: [], intake: [], tasks: [], skipped: [], deselected: taken.deselected };
|
|
4747
5094
|
const owner = { project: config.name, adopt: opts.adopt ?? false, skipped: report2.skipped };
|
|
5095
|
+
const project = opts.project ?? config.name;
|
|
5096
|
+
const isolated = opts.isolated === true ? project : void 0;
|
|
4748
5097
|
const hosted = opts.trees !== void 0;
|
|
4749
5098
|
for (const decl of config.skills) {
|
|
4750
5099
|
await attempt(report2.skills, decl.slug, () => upsertSkill(client, decl, { dryRun, dir, hosted, skills: opts.skills ?? {} }));
|
|
4751
5100
|
}
|
|
4752
5101
|
for (const decl of config.identities) {
|
|
4753
|
-
await attempt(report2.identities, decl.name, () => upsertIdentity(client, decl, dryRun, ids.identities));
|
|
5102
|
+
await attempt(report2.identities, decl.name, () => upsertIdentity(client, decl, dryRun, ids.identities, isolated));
|
|
4754
5103
|
const identityId = ids.identities.get(decl.name);
|
|
4755
5104
|
report2.identities.push(...await reportLegal(client, decl.legal ?? [], identityId, report2.skipped));
|
|
4756
5105
|
for (const wallet of decl.wallet === void 0 ? [] : Array.isArray(decl.wallet) ? decl.wallet : [decl.wallet]) {
|
|
@@ -4779,7 +5128,7 @@ async function up(config, client, opts = {}) {
|
|
|
4779
5128
|
...opts.platform,
|
|
4780
5129
|
known: {
|
|
4781
5130
|
...opts.platform.known,
|
|
4782
|
-
[PLATFORM_ENV.project]:
|
|
5131
|
+
[PLATFORM_ENV.project]: project,
|
|
4783
5132
|
...identityEnv(config, ids.identities)
|
|
4784
5133
|
}
|
|
4785
5134
|
};
|
|
@@ -4812,9 +5161,10 @@ async function up(config, client, opts = {}) {
|
|
|
4812
5161
|
);
|
|
4813
5162
|
const existing = taken.agents.length > 0 || config.removed.agents.length > 0 || config.kept.agents.length > 0 || config.tasks.length > 0 ? await listAll(client.config, "/v1/agents", AgentSchema, report2.skipped) : [];
|
|
4814
5163
|
const deployments = taken.agents.some((decl) => decl.schedules !== void 0) ? await listAll(client.config, "/v1/deployments", DeploymentSchema, report2.skipped) : [];
|
|
4815
|
-
const
|
|
5164
|
+
const scoped2 = config.apps.length > 0 ? [...ids.apps.values()] : void 0;
|
|
4816
5165
|
const crew = await eachInFlight(taken.agents, async (decl) => {
|
|
4817
|
-
const
|
|
5166
|
+
const of = { project, ...applied(config), adopt: opts.adopt ?? false, ...isolated === void 0 ? {} : { group: project } };
|
|
5167
|
+
const agent = await line(decl.name, () => upsertAgent(client, decl, existing, ids, dryRun, scoped2, of));
|
|
4818
5168
|
const schedules = [];
|
|
4819
5169
|
if (decl.schedules !== void 0) {
|
|
4820
5170
|
await reconcileSchedules(client, agent, decl.schedules, deployments, ids.identities, dryRun, schedules);
|
|
@@ -4851,6 +5201,56 @@ async function up(config, client, opts = {}) {
|
|
|
4851
5201
|
);
|
|
4852
5202
|
return report2;
|
|
4853
5203
|
}
|
|
5204
|
+
|
|
5205
|
+
// src/scoped.ts
|
|
5206
|
+
function scoped(config, prefix, project) {
|
|
5207
|
+
const removed = { ...config.removed, skills: [] };
|
|
5208
|
+
if (prefix === "") return { ...config, name: project, removed };
|
|
5209
|
+
const as = (name) => prefix + name;
|
|
5210
|
+
const apps = new Set(config.apps.map((app) => app.name));
|
|
5211
|
+
const tool = (key) => {
|
|
5212
|
+
const app = key.split(".")[0] ?? "";
|
|
5213
|
+
return key.includes(".") && apps.has(app) ? as(key) : key;
|
|
5214
|
+
};
|
|
5215
|
+
const team = teamLine(config, as);
|
|
5216
|
+
const agent = (decl) => ({
|
|
5217
|
+
...decl,
|
|
5218
|
+
name: as(decl.name),
|
|
5219
|
+
system: decl.system === void 0 ? team : `${decl.system}
|
|
5220
|
+
|
|
5221
|
+
${team}`,
|
|
5222
|
+
...decl.tools === void 0 ? {} : { tools: { ...decl.tools, configs: Object.fromEntries(Object.entries(decl.tools.configs).map(([key, one]) => [tool(key), one])) } },
|
|
5223
|
+
...decl.allowed_apps === void 0 ? {} : { allowed_apps: decl.allowed_apps.map(as) },
|
|
5224
|
+
...decl.identity === void 0 ? {} : { identity: as(decl.identity) },
|
|
5225
|
+
...Array.isArray(decl.handoffs) ? { handoffs: decl.handoffs.map(as) } : {},
|
|
5226
|
+
...hasRoster(decl.multiagent) ? { multiagent: { ...decl.multiagent, agents: decl.multiagent.agents.map((one) => one.type === "agent" ? { ...one, name: as(one.name) } : one) } } : {},
|
|
5227
|
+
...decl.schedules === void 0 ? {} : { schedules: decl.schedules.map((one) => one.identity === void 0 ? one : { ...one, identity: as(one.identity) }) }
|
|
5228
|
+
});
|
|
5229
|
+
return {
|
|
5230
|
+
...config,
|
|
5231
|
+
name: project,
|
|
5232
|
+
identities: config.identities.map((one) => ({ ...one, name: as(one.name) })),
|
|
5233
|
+
vaults: config.vaults.map((one) => ({ ...one, name: as(one.name), ...one.identity === void 0 ? {} : { identity: as(one.identity) } })),
|
|
5234
|
+
apps: config.apps.map((one) => ({ ...one, name: as(one.name) })),
|
|
5235
|
+
agents: config.agents.map(agent),
|
|
5236
|
+
tasks: config.tasks.map((one) => one.assignee === void 0 ? one : { ...one, assignee: as(one.assignee) }),
|
|
5237
|
+
removed: {
|
|
5238
|
+
...removed,
|
|
5239
|
+
apps: config.removed.apps.map(as),
|
|
5240
|
+
agents: config.removed.agents.map(as),
|
|
5241
|
+
identities: config.removed.identities.map(as),
|
|
5242
|
+
vaults: config.removed.vaults.map(as)
|
|
5243
|
+
},
|
|
5244
|
+
kept: { agents: config.kept.agents.map(as) }
|
|
5245
|
+
};
|
|
5246
|
+
}
|
|
5247
|
+
function teamLine(config, as) {
|
|
5248
|
+
const names = [
|
|
5249
|
+
...config.agents.map((one) => `${one.name} is ${as(one.name)}`),
|
|
5250
|
+
...config.apps.map((one) => `the app ${one.name} is ${as(one.name)} (its tools are ${as(one.name)}.*)`)
|
|
5251
|
+
];
|
|
5252
|
+
return `Your team's names here: ${names.join("; ")}.`;
|
|
5253
|
+
}
|
|
4854
5254
|
export {
|
|
4855
5255
|
BLUEPRINTS,
|
|
4856
5256
|
BlueprintRefusal,
|
|
@@ -4867,6 +5267,7 @@ export {
|
|
|
4867
5267
|
loadConfig,
|
|
4868
5268
|
migrationFiles,
|
|
4869
5269
|
parseProject,
|
|
5270
|
+
scoped,
|
|
4870
5271
|
selectCrew,
|
|
4871
5272
|
up
|
|
4872
5273
|
};
|