@vm0/cli 9.61.0 → 9.62.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/index.js +1207 -1716
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ if (DSN) {
|
|
|
45
45
|
Sentry.init({
|
|
46
46
|
dsn: DSN,
|
|
47
47
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
48
|
-
release: "9.
|
|
48
|
+
release: "9.62.0",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.62.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -673,7 +673,7 @@ function getConfigPath() {
|
|
|
673
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
674
674
|
}
|
|
675
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
676
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.62.0"}`));
|
|
677
677
|
console.log();
|
|
678
678
|
const config = await loadConfig();
|
|
679
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -708,7 +708,7 @@ import chalk6 from "chalk";
|
|
|
708
708
|
import { readFile as readFile4, rm as rm3 } from "fs/promises";
|
|
709
709
|
import { existsSync as existsSync5 } from "fs";
|
|
710
710
|
import { dirname as dirname2, join as join8 } from "path";
|
|
711
|
-
import { parse as
|
|
711
|
+
import { parse as parseYaml3 } from "yaml";
|
|
712
712
|
|
|
713
713
|
// ../../packages/core/src/variable-expander.ts
|
|
714
714
|
var VARIABLE_PATTERN = /\$\{\{\s*(env|vars|secrets)\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
|
|
@@ -780,20 +780,45 @@ var apiErrorSchema = z2.object({
|
|
|
780
780
|
});
|
|
781
781
|
|
|
782
782
|
// ../../packages/core/src/contracts/composes.ts
|
|
783
|
+
import { z as z4 } from "zod";
|
|
784
|
+
|
|
785
|
+
// ../../packages/core/src/contracts/firewalls.ts
|
|
783
786
|
import { z as z3 } from "zod";
|
|
787
|
+
var firewallPermissionSchema = z3.object({
|
|
788
|
+
name: z3.string(),
|
|
789
|
+
description: z3.string().optional(),
|
|
790
|
+
rules: z3.array(z3.string())
|
|
791
|
+
});
|
|
792
|
+
var firewallApiSchema = z3.object({
|
|
793
|
+
base: z3.string(),
|
|
794
|
+
auth: z3.object({
|
|
795
|
+
headers: z3.record(z3.string(), z3.string())
|
|
796
|
+
}),
|
|
797
|
+
permissions: z3.array(firewallPermissionSchema).optional()
|
|
798
|
+
});
|
|
799
|
+
var firewallSchema = z3.object({
|
|
800
|
+
name: z3.string(),
|
|
801
|
+
ref: z3.string(),
|
|
802
|
+
apis: z3.array(firewallApiSchema)
|
|
803
|
+
});
|
|
804
|
+
var experimentalFirewallSchema = z3.array(firewallSchema);
|
|
805
|
+
var firewallConfigSchema = z3.object({
|
|
806
|
+
name: z3.string().min(1, "Firewall name is required"),
|
|
807
|
+
description: z3.string().optional(),
|
|
808
|
+
apis: z3.array(firewallApiSchema).min(1, "Firewall must have at least one API entry"),
|
|
809
|
+
placeholders: z3.record(z3.string(), z3.string()).optional()
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
// ../../packages/core/src/contracts/composes.ts
|
|
784
813
|
var c = initContract();
|
|
785
|
-
var composeVersionQuerySchema =
|
|
814
|
+
var composeVersionQuerySchema = z4.string().min(1, "Missing version query parameter").regex(
|
|
786
815
|
/^[a-f0-9]{8,64}$|^latest$/i,
|
|
787
816
|
"Version must be 8-64 hex characters or 'latest'"
|
|
788
817
|
);
|
|
789
818
|
var AGENT_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,62}[a-zA-Z0-9]$/;
|
|
790
819
|
var VALID_CAPABILITIES = [
|
|
791
|
-
"
|
|
792
|
-
"
|
|
793
|
-
"artifact:read",
|
|
794
|
-
"artifact:write",
|
|
795
|
-
"memory:read",
|
|
796
|
-
"memory:write",
|
|
820
|
+
"storage:read",
|
|
821
|
+
"storage:write",
|
|
797
822
|
"agent:read",
|
|
798
823
|
"agent:write",
|
|
799
824
|
"agent-run:read",
|
|
@@ -801,31 +826,26 @@ var VALID_CAPABILITIES = [
|
|
|
801
826
|
"schedule:read",
|
|
802
827
|
"schedule:write"
|
|
803
828
|
];
|
|
804
|
-
var
|
|
805
|
-
name: z3.string(),
|
|
806
|
-
description: z3.string().optional(),
|
|
807
|
-
rules: z3.array(z3.string())
|
|
808
|
-
});
|
|
809
|
-
var agentNameSchema = z3.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
829
|
+
var agentNameSchema = z4.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
810
830
|
AGENT_NAME_REGEX,
|
|
811
831
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
812
832
|
);
|
|
813
|
-
var volumeConfigSchema =
|
|
814
|
-
name:
|
|
815
|
-
version:
|
|
833
|
+
var volumeConfigSchema = z4.object({
|
|
834
|
+
name: z4.string().min(1, "Volume name is required"),
|
|
835
|
+
version: z4.string().min(1, "Volume version is required"),
|
|
816
836
|
/** When true, skip mounting without error if volume doesn't exist */
|
|
817
|
-
optional:
|
|
837
|
+
optional: z4.boolean().optional()
|
|
818
838
|
});
|
|
819
|
-
var agentDefinitionSchema =
|
|
820
|
-
description:
|
|
821
|
-
framework:
|
|
822
|
-
volumes:
|
|
823
|
-
environment:
|
|
839
|
+
var agentDefinitionSchema = z4.object({
|
|
840
|
+
description: z4.string().optional(),
|
|
841
|
+
framework: z4.string().min(1, "Framework is required"),
|
|
842
|
+
volumes: z4.array(z4.string()).optional(),
|
|
843
|
+
environment: z4.record(z4.string(), z4.string()).optional(),
|
|
824
844
|
/**
|
|
825
845
|
* Path to instructions file (e.g., AGENTS.md).
|
|
826
846
|
* Auto-uploaded as volume and mounted at /home/user/.claude/CLAUDE.md
|
|
827
847
|
*/
|
|
828
|
-
instructions:
|
|
848
|
+
instructions: z4.string().min(1, "Instructions path cannot be empty").refine(
|
|
829
849
|
(val) => !val.includes("..") && !val.startsWith("/") && !val.startsWith("\\"),
|
|
830
850
|
"Instructions path must be a relative path without '..' segments"
|
|
831
851
|
).optional(),
|
|
@@ -833,13 +853,13 @@ var agentDefinitionSchema = z3.object({
|
|
|
833
853
|
* Array of GitHub tree URLs for agent skills.
|
|
834
854
|
* Each skill is auto-downloaded and mounted at /home/user/.claude/skills/{skillName}/
|
|
835
855
|
*/
|
|
836
|
-
skills:
|
|
856
|
+
skills: z4.array(z4.string()).optional(),
|
|
837
857
|
/**
|
|
838
858
|
* Route this agent to a self-hosted runner instead of E2B.
|
|
839
859
|
* When specified, runs will be queued for the specified runner group.
|
|
840
860
|
*/
|
|
841
|
-
experimental_runner:
|
|
842
|
-
group:
|
|
861
|
+
experimental_runner: z4.object({
|
|
862
|
+
group: z4.string().regex(
|
|
843
863
|
/^[a-z0-9-]+\/[a-z0-9-]+$/,
|
|
844
864
|
"Runner group must be in org/name format (e.g., acme/production)"
|
|
845
865
|
)
|
|
@@ -849,17 +869,17 @@ var agentDefinitionSchema = z3.object({
|
|
|
849
869
|
* CLI input: map format { slack: { permissions: [...] | "all" } }
|
|
850
870
|
* — expanded by CLI to full ExpandedFirewallConfig[] before API call.
|
|
851
871
|
*/
|
|
852
|
-
experimental_firewall:
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
permissions:
|
|
872
|
+
experimental_firewall: z4.record(
|
|
873
|
+
z4.string(),
|
|
874
|
+
z4.object({
|
|
875
|
+
permissions: z4.union([z4.literal("all"), z4.array(z4.string()).min(1)])
|
|
856
876
|
})
|
|
857
877
|
).optional(),
|
|
858
878
|
/**
|
|
859
879
|
* Capabilities that the agent is allowed to use.
|
|
860
880
|
* Validated against VALID_CAPABILITIES at compose time.
|
|
861
881
|
*/
|
|
862
|
-
experimental_capabilities:
|
|
882
|
+
experimental_capabilities: z4.array(z4.enum(VALID_CAPABILITIES)).refine((arr) => new Set(arr).size === arr.length, {
|
|
863
883
|
message: "Duplicate capabilities are not allowed"
|
|
864
884
|
}).optional(),
|
|
865
885
|
/**
|
|
@@ -867,66 +887,66 @@ var agentDefinitionSchema = z3.object({
|
|
|
867
887
|
* - displayName: Human-readable name shown in the UI (preserves original casing).
|
|
868
888
|
* - sound: Communication tone (e.g., "professional", "friendly").
|
|
869
889
|
*/
|
|
870
|
-
metadata:
|
|
871
|
-
displayName:
|
|
872
|
-
description:
|
|
873
|
-
sound:
|
|
890
|
+
metadata: z4.object({
|
|
891
|
+
displayName: z4.string().optional(),
|
|
892
|
+
description: z4.string().optional(),
|
|
893
|
+
sound: z4.string().optional()
|
|
874
894
|
}).optional(),
|
|
875
895
|
/**
|
|
876
896
|
* @deprecated Server-resolved field. User input is ignored.
|
|
877
897
|
* @internal
|
|
878
898
|
*/
|
|
879
|
-
image:
|
|
899
|
+
image: z4.string().optional(),
|
|
880
900
|
/**
|
|
881
901
|
* @deprecated Server-resolved field. User input is ignored.
|
|
882
902
|
* @internal
|
|
883
903
|
*/
|
|
884
|
-
working_dir:
|
|
904
|
+
working_dir: z4.string().optional()
|
|
885
905
|
});
|
|
886
|
-
var agentComposeContentSchema =
|
|
887
|
-
version:
|
|
888
|
-
agents:
|
|
889
|
-
volumes:
|
|
906
|
+
var agentComposeContentSchema = z4.object({
|
|
907
|
+
version: z4.string().min(1, "Version is required"),
|
|
908
|
+
agents: z4.record(z4.string(), agentDefinitionSchema),
|
|
909
|
+
volumes: z4.record(z4.string(), volumeConfigSchema).optional()
|
|
890
910
|
});
|
|
891
|
-
var expandedFirewallConfigSchema =
|
|
892
|
-
name:
|
|
893
|
-
ref:
|
|
894
|
-
description:
|
|
895
|
-
apis:
|
|
896
|
-
|
|
897
|
-
base:
|
|
898
|
-
auth:
|
|
899
|
-
headers:
|
|
911
|
+
var expandedFirewallConfigSchema = z4.object({
|
|
912
|
+
name: z4.string(),
|
|
913
|
+
ref: z4.string(),
|
|
914
|
+
description: z4.string().optional(),
|
|
915
|
+
apis: z4.array(
|
|
916
|
+
z4.object({
|
|
917
|
+
base: z4.string(),
|
|
918
|
+
auth: z4.object({
|
|
919
|
+
headers: z4.record(z4.string(), z4.string())
|
|
900
920
|
}),
|
|
901
|
-
permissions:
|
|
921
|
+
permissions: z4.array(firewallPermissionSchema).optional()
|
|
902
922
|
})
|
|
903
923
|
),
|
|
904
|
-
placeholders:
|
|
924
|
+
placeholders: z4.record(z4.string(), z4.string()).optional()
|
|
905
925
|
});
|
|
906
|
-
var agentComposeApiContentSchema =
|
|
907
|
-
version:
|
|
908
|
-
agents:
|
|
909
|
-
|
|
926
|
+
var agentComposeApiContentSchema = z4.object({
|
|
927
|
+
version: z4.string().min(1, "Version is required"),
|
|
928
|
+
agents: z4.record(
|
|
929
|
+
z4.string(),
|
|
910
930
|
agentDefinitionSchema.extend({
|
|
911
|
-
experimental_firewall:
|
|
931
|
+
experimental_firewall: z4.array(expandedFirewallConfigSchema).optional()
|
|
912
932
|
})
|
|
913
933
|
),
|
|
914
|
-
volumes:
|
|
934
|
+
volumes: z4.record(z4.string(), volumeConfigSchema).optional()
|
|
915
935
|
});
|
|
916
|
-
var composeResponseSchema =
|
|
917
|
-
id:
|
|
918
|
-
name:
|
|
919
|
-
headVersionId:
|
|
936
|
+
var composeResponseSchema = z4.object({
|
|
937
|
+
id: z4.string(),
|
|
938
|
+
name: z4.string(),
|
|
939
|
+
headVersionId: z4.string().nullable(),
|
|
920
940
|
content: agentComposeApiContentSchema.nullable(),
|
|
921
|
-
createdAt:
|
|
922
|
-
updatedAt:
|
|
941
|
+
createdAt: z4.string(),
|
|
942
|
+
updatedAt: z4.string()
|
|
923
943
|
});
|
|
924
|
-
var createComposeResponseSchema =
|
|
925
|
-
composeId:
|
|
926
|
-
name:
|
|
927
|
-
versionId:
|
|
928
|
-
action:
|
|
929
|
-
updatedAt:
|
|
944
|
+
var createComposeResponseSchema = z4.object({
|
|
945
|
+
composeId: z4.string(),
|
|
946
|
+
name: z4.string(),
|
|
947
|
+
versionId: z4.string(),
|
|
948
|
+
action: z4.enum(["created", "existing"]),
|
|
949
|
+
updatedAt: z4.string()
|
|
930
950
|
});
|
|
931
951
|
var composesMainContract = c.router({
|
|
932
952
|
/**
|
|
@@ -938,9 +958,9 @@ var composesMainContract = c.router({
|
|
|
938
958
|
method: "GET",
|
|
939
959
|
path: "/api/agent/composes",
|
|
940
960
|
headers: authHeadersSchema,
|
|
941
|
-
query:
|
|
942
|
-
name:
|
|
943
|
-
org:
|
|
961
|
+
query: z4.object({
|
|
962
|
+
name: z4.string().min(1, "Missing name query parameter"),
|
|
963
|
+
org: z4.string().optional()
|
|
944
964
|
}),
|
|
945
965
|
responses: {
|
|
946
966
|
200: composeResponseSchema,
|
|
@@ -960,7 +980,7 @@ var composesMainContract = c.router({
|
|
|
960
980
|
method: "POST",
|
|
961
981
|
path: "/api/agent/composes",
|
|
962
982
|
headers: authHeadersSchema,
|
|
963
|
-
body:
|
|
983
|
+
body: z4.object({
|
|
964
984
|
content: agentComposeApiContentSchema
|
|
965
985
|
}),
|
|
966
986
|
responses: {
|
|
@@ -981,8 +1001,8 @@ var composesByIdContract = c.router({
|
|
|
981
1001
|
method: "GET",
|
|
982
1002
|
path: "/api/agent/composes/:id",
|
|
983
1003
|
headers: authHeadersSchema,
|
|
984
|
-
pathParams:
|
|
985
|
-
id:
|
|
1004
|
+
pathParams: z4.object({
|
|
1005
|
+
id: z4.string().min(1, "Compose ID is required")
|
|
986
1006
|
}),
|
|
987
1007
|
responses: {
|
|
988
1008
|
200: composeResponseSchema,
|
|
@@ -1000,8 +1020,8 @@ var composesByIdContract = c.router({
|
|
|
1000
1020
|
method: "DELETE",
|
|
1001
1021
|
path: "/api/agent/composes/:id",
|
|
1002
1022
|
headers: authHeadersSchema,
|
|
1003
|
-
pathParams:
|
|
1004
|
-
id:
|
|
1023
|
+
pathParams: z4.object({
|
|
1024
|
+
id: z4.string().uuid("Compose ID is required")
|
|
1005
1025
|
}),
|
|
1006
1026
|
body: c.noBody(),
|
|
1007
1027
|
responses: {
|
|
@@ -1022,14 +1042,14 @@ var composesVersionsContract = c.router({
|
|
|
1022
1042
|
method: "GET",
|
|
1023
1043
|
path: "/api/agent/composes/versions",
|
|
1024
1044
|
headers: authHeadersSchema,
|
|
1025
|
-
query:
|
|
1026
|
-
composeId:
|
|
1045
|
+
query: z4.object({
|
|
1046
|
+
composeId: z4.string().min(1, "Missing composeId query parameter"),
|
|
1027
1047
|
version: composeVersionQuerySchema
|
|
1028
1048
|
}),
|
|
1029
1049
|
responses: {
|
|
1030
|
-
200:
|
|
1031
|
-
versionId:
|
|
1032
|
-
tag:
|
|
1050
|
+
200: z4.object({
|
|
1051
|
+
versionId: z4.string(),
|
|
1052
|
+
tag: z4.string().optional()
|
|
1033
1053
|
}),
|
|
1034
1054
|
400: apiErrorSchema,
|
|
1035
1055
|
401: apiErrorSchema,
|
|
@@ -1038,13 +1058,13 @@ var composesVersionsContract = c.router({
|
|
|
1038
1058
|
summary: "Resolve version specifier to full version ID"
|
|
1039
1059
|
}
|
|
1040
1060
|
});
|
|
1041
|
-
var composeListItemSchema =
|
|
1042
|
-
id:
|
|
1043
|
-
name:
|
|
1044
|
-
displayName:
|
|
1045
|
-
description:
|
|
1046
|
-
headVersionId:
|
|
1047
|
-
updatedAt:
|
|
1061
|
+
var composeListItemSchema = z4.object({
|
|
1062
|
+
id: z4.string(),
|
|
1063
|
+
name: z4.string(),
|
|
1064
|
+
displayName: z4.string().nullable().optional(),
|
|
1065
|
+
description: z4.string().nullable().optional(),
|
|
1066
|
+
headVersionId: z4.string().nullable(),
|
|
1067
|
+
updatedAt: z4.string()
|
|
1048
1068
|
});
|
|
1049
1069
|
var composesListContract = c.router({
|
|
1050
1070
|
/**
|
|
@@ -1056,12 +1076,12 @@ var composesListContract = c.router({
|
|
|
1056
1076
|
method: "GET",
|
|
1057
1077
|
path: "/api/agent/composes/list",
|
|
1058
1078
|
headers: authHeadersSchema,
|
|
1059
|
-
query:
|
|
1060
|
-
org:
|
|
1079
|
+
query: z4.object({
|
|
1080
|
+
org: z4.string().optional()
|
|
1061
1081
|
}),
|
|
1062
1082
|
responses: {
|
|
1063
|
-
200:
|
|
1064
|
-
composes:
|
|
1083
|
+
200: z4.object({
|
|
1084
|
+
composes: z4.array(composeListItemSchema)
|
|
1065
1085
|
}),
|
|
1066
1086
|
400: apiErrorSchema,
|
|
1067
1087
|
401: apiErrorSchema
|
|
@@ -1071,24 +1091,24 @@ var composesListContract = c.router({
|
|
|
1071
1091
|
});
|
|
1072
1092
|
|
|
1073
1093
|
// ../../packages/core/src/contracts/runs.ts
|
|
1074
|
-
import { z as
|
|
1094
|
+
import { z as z6 } from "zod";
|
|
1075
1095
|
|
|
1076
1096
|
// ../../packages/core/src/contracts/orgs.ts
|
|
1077
|
-
import { z as
|
|
1097
|
+
import { z as z5 } from "zod";
|
|
1078
1098
|
var c2 = initContract();
|
|
1079
|
-
var orgTierSchema =
|
|
1080
|
-
var orgSlugSchema =
|
|
1099
|
+
var orgTierSchema = z5.enum(["free", "pro", "max"]);
|
|
1100
|
+
var orgSlugSchema = z5.string().min(3, "Org slug must be at least 3 characters").max(64, "Org slug must be at most 64 characters").regex(
|
|
1081
1101
|
/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]{1,2}$/,
|
|
1082
1102
|
"Org slug must contain only lowercase letters, numbers, and hyphens, and must start and end with an alphanumeric character"
|
|
1083
1103
|
).transform((s) => s.toLowerCase());
|
|
1084
|
-
var orgResponseSchema =
|
|
1085
|
-
id:
|
|
1086
|
-
slug:
|
|
1087
|
-
tier:
|
|
1104
|
+
var orgResponseSchema = z5.object({
|
|
1105
|
+
id: z5.string(),
|
|
1106
|
+
slug: z5.string(),
|
|
1107
|
+
tier: z5.string().optional()
|
|
1088
1108
|
});
|
|
1089
|
-
var updateOrgRequestSchema =
|
|
1109
|
+
var updateOrgRequestSchema = z5.object({
|
|
1090
1110
|
slug: orgSlugSchema,
|
|
1091
|
-
force:
|
|
1111
|
+
force: z5.boolean().optional().default(false)
|
|
1092
1112
|
});
|
|
1093
1113
|
var orgContract = c2.router({
|
|
1094
1114
|
/**
|
|
@@ -1139,15 +1159,15 @@ var orgDefaultAgentContract = c2.router({
|
|
|
1139
1159
|
method: "PUT",
|
|
1140
1160
|
path: "/api/orgs/default-agent",
|
|
1141
1161
|
headers: authHeadersSchema,
|
|
1142
|
-
query:
|
|
1143
|
-
org:
|
|
1162
|
+
query: z5.object({
|
|
1163
|
+
org: z5.string().optional()
|
|
1144
1164
|
}),
|
|
1145
|
-
body:
|
|
1146
|
-
agentComposeId:
|
|
1165
|
+
body: z5.object({
|
|
1166
|
+
agentComposeId: z5.string().uuid().nullable()
|
|
1147
1167
|
}),
|
|
1148
1168
|
responses: {
|
|
1149
|
-
200:
|
|
1150
|
-
agentComposeId:
|
|
1169
|
+
200: z5.object({
|
|
1170
|
+
agentComposeId: z5.string().uuid().nullable()
|
|
1151
1171
|
}),
|
|
1152
1172
|
400: apiErrorSchema,
|
|
1153
1173
|
401: apiErrorSchema,
|
|
@@ -1169,95 +1189,95 @@ var ALL_RUN_STATUSES = [
|
|
|
1169
1189
|
"timeout",
|
|
1170
1190
|
"cancelled"
|
|
1171
1191
|
];
|
|
1172
|
-
var runStatusSchema =
|
|
1173
|
-
var unifiedRunRequestSchema =
|
|
1192
|
+
var runStatusSchema = z6.enum(ALL_RUN_STATUSES);
|
|
1193
|
+
var unifiedRunRequestSchema = z6.object({
|
|
1174
1194
|
// High-level shortcuts (mutually exclusive with each other)
|
|
1175
|
-
checkpointId:
|
|
1176
|
-
sessionId:
|
|
1195
|
+
checkpointId: z6.string().optional(),
|
|
1196
|
+
sessionId: z6.string().optional(),
|
|
1177
1197
|
// Base parameters (can be used directly or overridden after shortcut expansion)
|
|
1178
|
-
agentComposeId:
|
|
1179
|
-
agentComposeVersionId:
|
|
1180
|
-
conversationId:
|
|
1181
|
-
artifactName:
|
|
1182
|
-
artifactVersion:
|
|
1183
|
-
vars:
|
|
1184
|
-
secrets:
|
|
1185
|
-
volumeVersions:
|
|
1186
|
-
memoryName:
|
|
1198
|
+
agentComposeId: z6.string().optional(),
|
|
1199
|
+
agentComposeVersionId: z6.string().optional(),
|
|
1200
|
+
conversationId: z6.string().optional(),
|
|
1201
|
+
artifactName: z6.string().optional(),
|
|
1202
|
+
artifactVersion: z6.string().optional(),
|
|
1203
|
+
vars: z6.record(z6.string(), z6.string()).optional(),
|
|
1204
|
+
secrets: z6.record(z6.string(), z6.string()).optional(),
|
|
1205
|
+
volumeVersions: z6.record(z6.string(), z6.string()).optional(),
|
|
1206
|
+
memoryName: z6.string().optional(),
|
|
1187
1207
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
1188
|
-
debugNoMockClaude:
|
|
1208
|
+
debugNoMockClaude: z6.boolean().optional(),
|
|
1189
1209
|
// Model provider for automatic secret injection
|
|
1190
|
-
modelProvider:
|
|
1210
|
+
modelProvider: z6.string().optional(),
|
|
1191
1211
|
// Environment validation flag - when true, validates secrets/vars before running
|
|
1192
|
-
checkEnv:
|
|
1212
|
+
checkEnv: z6.boolean().optional(),
|
|
1193
1213
|
// Required
|
|
1194
|
-
prompt:
|
|
1214
|
+
prompt: z6.string().min(1, "Missing prompt")
|
|
1195
1215
|
});
|
|
1196
|
-
var createRunResponseSchema =
|
|
1197
|
-
runId:
|
|
1216
|
+
var createRunResponseSchema = z6.object({
|
|
1217
|
+
runId: z6.string(),
|
|
1198
1218
|
status: runStatusSchema,
|
|
1199
|
-
sandboxId:
|
|
1200
|
-
output:
|
|
1201
|
-
error:
|
|
1202
|
-
executionTimeMs:
|
|
1203
|
-
createdAt:
|
|
1219
|
+
sandboxId: z6.string().optional(),
|
|
1220
|
+
output: z6.string().optional(),
|
|
1221
|
+
error: z6.string().optional(),
|
|
1222
|
+
executionTimeMs: z6.number().optional(),
|
|
1223
|
+
createdAt: z6.string()
|
|
1204
1224
|
});
|
|
1205
|
-
var getRunResponseSchema =
|
|
1206
|
-
runId:
|
|
1207
|
-
agentComposeVersionId:
|
|
1225
|
+
var getRunResponseSchema = z6.object({
|
|
1226
|
+
runId: z6.string(),
|
|
1227
|
+
agentComposeVersionId: z6.string().nullable(),
|
|
1208
1228
|
status: runStatusSchema,
|
|
1209
|
-
prompt:
|
|
1210
|
-
vars:
|
|
1211
|
-
sandboxId:
|
|
1212
|
-
result:
|
|
1213
|
-
output:
|
|
1214
|
-
executionTimeMs:
|
|
1215
|
-
agentSessionId:
|
|
1216
|
-
checkpointId:
|
|
1217
|
-
conversationId:
|
|
1229
|
+
prompt: z6.string(),
|
|
1230
|
+
vars: z6.record(z6.string(), z6.string()).optional(),
|
|
1231
|
+
sandboxId: z6.string().optional(),
|
|
1232
|
+
result: z6.object({
|
|
1233
|
+
output: z6.string().optional(),
|
|
1234
|
+
executionTimeMs: z6.number().optional(),
|
|
1235
|
+
agentSessionId: z6.string().optional(),
|
|
1236
|
+
checkpointId: z6.string().optional(),
|
|
1237
|
+
conversationId: z6.string().optional()
|
|
1218
1238
|
}).passthrough().optional(),
|
|
1219
|
-
error:
|
|
1220
|
-
createdAt:
|
|
1221
|
-
startedAt:
|
|
1222
|
-
completedAt:
|
|
1239
|
+
error: z6.string().optional(),
|
|
1240
|
+
createdAt: z6.string(),
|
|
1241
|
+
startedAt: z6.string().optional(),
|
|
1242
|
+
completedAt: z6.string().optional()
|
|
1223
1243
|
});
|
|
1224
|
-
var runEventSchema =
|
|
1225
|
-
sequenceNumber:
|
|
1226
|
-
eventType:
|
|
1227
|
-
eventData:
|
|
1228
|
-
createdAt:
|
|
1244
|
+
var runEventSchema = z6.object({
|
|
1245
|
+
sequenceNumber: z6.number(),
|
|
1246
|
+
eventType: z6.string(),
|
|
1247
|
+
eventData: z6.unknown(),
|
|
1248
|
+
createdAt: z6.string()
|
|
1229
1249
|
});
|
|
1230
|
-
var runResultSchema =
|
|
1231
|
-
checkpointId:
|
|
1232
|
-
agentSessionId:
|
|
1233
|
-
conversationId:
|
|
1234
|
-
artifact:
|
|
1250
|
+
var runResultSchema = z6.object({
|
|
1251
|
+
checkpointId: z6.string(),
|
|
1252
|
+
agentSessionId: z6.string(),
|
|
1253
|
+
conversationId: z6.string(),
|
|
1254
|
+
artifact: z6.record(z6.string(), z6.string()).optional(),
|
|
1235
1255
|
// optional when run has no artifact
|
|
1236
|
-
volumes:
|
|
1237
|
-
memory:
|
|
1256
|
+
volumes: z6.record(z6.string(), z6.string()).optional(),
|
|
1257
|
+
memory: z6.record(z6.string(), z6.string()).optional()
|
|
1238
1258
|
});
|
|
1239
|
-
var runStateSchema =
|
|
1259
|
+
var runStateSchema = z6.object({
|
|
1240
1260
|
status: runStatusSchema,
|
|
1241
1261
|
result: runResultSchema.optional(),
|
|
1242
|
-
error:
|
|
1262
|
+
error: z6.string().optional()
|
|
1243
1263
|
});
|
|
1244
|
-
var eventsResponseSchema =
|
|
1245
|
-
events:
|
|
1246
|
-
hasMore:
|
|
1247
|
-
nextSequence:
|
|
1264
|
+
var eventsResponseSchema = z6.object({
|
|
1265
|
+
events: z6.array(runEventSchema),
|
|
1266
|
+
hasMore: z6.boolean(),
|
|
1267
|
+
nextSequence: z6.number(),
|
|
1248
1268
|
run: runStateSchema,
|
|
1249
|
-
framework:
|
|
1269
|
+
framework: z6.string()
|
|
1250
1270
|
});
|
|
1251
|
-
var runListItemSchema =
|
|
1252
|
-
id:
|
|
1253
|
-
agentName:
|
|
1271
|
+
var runListItemSchema = z6.object({
|
|
1272
|
+
id: z6.string(),
|
|
1273
|
+
agentName: z6.string(),
|
|
1254
1274
|
status: runStatusSchema,
|
|
1255
|
-
prompt:
|
|
1256
|
-
createdAt:
|
|
1257
|
-
startedAt:
|
|
1275
|
+
prompt: z6.string(),
|
|
1276
|
+
createdAt: z6.string(),
|
|
1277
|
+
startedAt: z6.string().nullable()
|
|
1258
1278
|
});
|
|
1259
|
-
var runsListResponseSchema =
|
|
1260
|
-
runs:
|
|
1279
|
+
var runsListResponseSchema = z6.object({
|
|
1280
|
+
runs: z6.array(runListItemSchema)
|
|
1261
1281
|
});
|
|
1262
1282
|
var runsMainContract = c3.router({
|
|
1263
1283
|
/**
|
|
@@ -1268,16 +1288,16 @@ var runsMainContract = c3.router({
|
|
|
1268
1288
|
method: "GET",
|
|
1269
1289
|
path: "/api/agent/runs",
|
|
1270
1290
|
headers: authHeadersSchema,
|
|
1271
|
-
query:
|
|
1272
|
-
status:
|
|
1291
|
+
query: z6.object({
|
|
1292
|
+
status: z6.string().optional(),
|
|
1273
1293
|
// comma-separated: "pending,running"
|
|
1274
|
-
agent:
|
|
1294
|
+
agent: z6.string().optional(),
|
|
1275
1295
|
// agent name filter
|
|
1276
|
-
since:
|
|
1296
|
+
since: z6.string().optional(),
|
|
1277
1297
|
// ISO timestamp
|
|
1278
|
-
until:
|
|
1298
|
+
until: z6.string().optional(),
|
|
1279
1299
|
// ISO timestamp
|
|
1280
|
-
limit:
|
|
1300
|
+
limit: z6.coerce.number().min(1).max(100).default(50)
|
|
1281
1301
|
}),
|
|
1282
1302
|
responses: {
|
|
1283
1303
|
200: runsListResponseSchema,
|
|
@@ -1313,8 +1333,8 @@ var runsByIdContract = c3.router({
|
|
|
1313
1333
|
method: "GET",
|
|
1314
1334
|
path: "/api/agent/runs/:id",
|
|
1315
1335
|
headers: authHeadersSchema,
|
|
1316
|
-
pathParams:
|
|
1317
|
-
id:
|
|
1336
|
+
pathParams: z6.object({
|
|
1337
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1318
1338
|
}),
|
|
1319
1339
|
responses: {
|
|
1320
1340
|
200: getRunResponseSchema,
|
|
@@ -1325,10 +1345,10 @@ var runsByIdContract = c3.router({
|
|
|
1325
1345
|
summary: "Get agent run by ID"
|
|
1326
1346
|
}
|
|
1327
1347
|
});
|
|
1328
|
-
var cancelRunResponseSchema =
|
|
1329
|
-
id:
|
|
1330
|
-
status:
|
|
1331
|
-
message:
|
|
1348
|
+
var cancelRunResponseSchema = z6.object({
|
|
1349
|
+
id: z6.string(),
|
|
1350
|
+
status: z6.literal("cancelled"),
|
|
1351
|
+
message: z6.string()
|
|
1332
1352
|
});
|
|
1333
1353
|
var runsCancelContract = c3.router({
|
|
1334
1354
|
/**
|
|
@@ -1339,10 +1359,10 @@ var runsCancelContract = c3.router({
|
|
|
1339
1359
|
method: "POST",
|
|
1340
1360
|
path: "/api/agent/runs/:id/cancel",
|
|
1341
1361
|
headers: authHeadersSchema,
|
|
1342
|
-
pathParams:
|
|
1343
|
-
id:
|
|
1362
|
+
pathParams: z6.object({
|
|
1363
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1344
1364
|
}),
|
|
1345
|
-
body:
|
|
1365
|
+
body: z6.undefined(),
|
|
1346
1366
|
responses: {
|
|
1347
1367
|
200: cancelRunResponseSchema,
|
|
1348
1368
|
400: apiErrorSchema,
|
|
@@ -1361,12 +1381,12 @@ var runEventsContract = c3.router({
|
|
|
1361
1381
|
method: "GET",
|
|
1362
1382
|
path: "/api/agent/runs/:id/events",
|
|
1363
1383
|
headers: authHeadersSchema,
|
|
1364
|
-
pathParams:
|
|
1365
|
-
id:
|
|
1384
|
+
pathParams: z6.object({
|
|
1385
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1366
1386
|
}),
|
|
1367
|
-
query:
|
|
1368
|
-
since:
|
|
1369
|
-
limit:
|
|
1387
|
+
query: z6.object({
|
|
1388
|
+
since: z6.coerce.number().default(-1),
|
|
1389
|
+
limit: z6.coerce.number().default(100)
|
|
1370
1390
|
}),
|
|
1371
1391
|
responses: {
|
|
1372
1392
|
200: eventsResponseSchema,
|
|
@@ -1376,48 +1396,48 @@ var runEventsContract = c3.router({
|
|
|
1376
1396
|
summary: "Get agent run events"
|
|
1377
1397
|
}
|
|
1378
1398
|
});
|
|
1379
|
-
var telemetryMetricSchema =
|
|
1380
|
-
ts:
|
|
1381
|
-
cpu:
|
|
1382
|
-
mem_used:
|
|
1383
|
-
mem_total:
|
|
1384
|
-
disk_used:
|
|
1385
|
-
disk_total:
|
|
1399
|
+
var telemetryMetricSchema = z6.object({
|
|
1400
|
+
ts: z6.string(),
|
|
1401
|
+
cpu: z6.number(),
|
|
1402
|
+
mem_used: z6.number(),
|
|
1403
|
+
mem_total: z6.number(),
|
|
1404
|
+
disk_used: z6.number(),
|
|
1405
|
+
disk_total: z6.number()
|
|
1386
1406
|
});
|
|
1387
|
-
var systemLogResponseSchema =
|
|
1388
|
-
systemLog:
|
|
1389
|
-
hasMore:
|
|
1407
|
+
var systemLogResponseSchema = z6.object({
|
|
1408
|
+
systemLog: z6.string(),
|
|
1409
|
+
hasMore: z6.boolean()
|
|
1390
1410
|
});
|
|
1391
|
-
var metricsResponseSchema =
|
|
1392
|
-
metrics:
|
|
1393
|
-
hasMore:
|
|
1411
|
+
var metricsResponseSchema = z6.object({
|
|
1412
|
+
metrics: z6.array(telemetryMetricSchema),
|
|
1413
|
+
hasMore: z6.boolean()
|
|
1394
1414
|
});
|
|
1395
|
-
var agentEventsResponseSchema =
|
|
1396
|
-
events:
|
|
1397
|
-
hasMore:
|
|
1398
|
-
framework:
|
|
1415
|
+
var agentEventsResponseSchema = z6.object({
|
|
1416
|
+
events: z6.array(runEventSchema),
|
|
1417
|
+
hasMore: z6.boolean(),
|
|
1418
|
+
framework: z6.string()
|
|
1399
1419
|
});
|
|
1400
|
-
var networkLogEntrySchema =
|
|
1401
|
-
timestamp:
|
|
1402
|
-
mode:
|
|
1403
|
-
action:
|
|
1404
|
-
host:
|
|
1405
|
-
port:
|
|
1406
|
-
rule_matched:
|
|
1407
|
-
method:
|
|
1408
|
-
url:
|
|
1409
|
-
status:
|
|
1410
|
-
latency_ms:
|
|
1411
|
-
request_size:
|
|
1412
|
-
response_size:
|
|
1420
|
+
var networkLogEntrySchema = z6.object({
|
|
1421
|
+
timestamp: z6.string(),
|
|
1422
|
+
mode: z6.literal("mitm").optional(),
|
|
1423
|
+
action: z6.enum(["ALLOW", "DENY"]).optional(),
|
|
1424
|
+
host: z6.string().optional(),
|
|
1425
|
+
port: z6.number().optional(),
|
|
1426
|
+
rule_matched: z6.string().nullable().optional(),
|
|
1427
|
+
method: z6.string().optional(),
|
|
1428
|
+
url: z6.string().optional(),
|
|
1429
|
+
status: z6.number().optional(),
|
|
1430
|
+
latency_ms: z6.number().optional(),
|
|
1431
|
+
request_size: z6.number().optional(),
|
|
1432
|
+
response_size: z6.number().optional()
|
|
1413
1433
|
});
|
|
1414
|
-
var networkLogsResponseSchema =
|
|
1415
|
-
networkLogs:
|
|
1416
|
-
hasMore:
|
|
1434
|
+
var networkLogsResponseSchema = z6.object({
|
|
1435
|
+
networkLogs: z6.array(networkLogEntrySchema),
|
|
1436
|
+
hasMore: z6.boolean()
|
|
1417
1437
|
});
|
|
1418
|
-
var telemetryResponseSchema =
|
|
1419
|
-
systemLog:
|
|
1420
|
-
metrics:
|
|
1438
|
+
var telemetryResponseSchema = z6.object({
|
|
1439
|
+
systemLog: z6.string(),
|
|
1440
|
+
metrics: z6.array(telemetryMetricSchema)
|
|
1421
1441
|
});
|
|
1422
1442
|
var runTelemetryContract = c3.router({
|
|
1423
1443
|
/**
|
|
@@ -1428,8 +1448,8 @@ var runTelemetryContract = c3.router({
|
|
|
1428
1448
|
method: "GET",
|
|
1429
1449
|
path: "/api/agent/runs/:id/telemetry",
|
|
1430
1450
|
headers: authHeadersSchema,
|
|
1431
|
-
pathParams:
|
|
1432
|
-
id:
|
|
1451
|
+
pathParams: z6.object({
|
|
1452
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1433
1453
|
}),
|
|
1434
1454
|
responses: {
|
|
1435
1455
|
200: telemetryResponseSchema,
|
|
@@ -1448,13 +1468,13 @@ var runSystemLogContract = c3.router({
|
|
|
1448
1468
|
method: "GET",
|
|
1449
1469
|
path: "/api/agent/runs/:id/telemetry/system-log",
|
|
1450
1470
|
headers: authHeadersSchema,
|
|
1451
|
-
pathParams:
|
|
1452
|
-
id:
|
|
1471
|
+
pathParams: z6.object({
|
|
1472
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1453
1473
|
}),
|
|
1454
|
-
query:
|
|
1455
|
-
since:
|
|
1456
|
-
limit:
|
|
1457
|
-
order:
|
|
1474
|
+
query: z6.object({
|
|
1475
|
+
since: z6.coerce.number().optional(),
|
|
1476
|
+
limit: z6.coerce.number().min(1).max(100).default(5),
|
|
1477
|
+
order: z6.enum(["asc", "desc"]).default("desc")
|
|
1458
1478
|
}),
|
|
1459
1479
|
responses: {
|
|
1460
1480
|
200: systemLogResponseSchema,
|
|
@@ -1473,13 +1493,13 @@ var runMetricsContract = c3.router({
|
|
|
1473
1493
|
method: "GET",
|
|
1474
1494
|
path: "/api/agent/runs/:id/telemetry/metrics",
|
|
1475
1495
|
headers: authHeadersSchema,
|
|
1476
|
-
pathParams:
|
|
1477
|
-
id:
|
|
1496
|
+
pathParams: z6.object({
|
|
1497
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1478
1498
|
}),
|
|
1479
|
-
query:
|
|
1480
|
-
since:
|
|
1481
|
-
limit:
|
|
1482
|
-
order:
|
|
1499
|
+
query: z6.object({
|
|
1500
|
+
since: z6.coerce.number().optional(),
|
|
1501
|
+
limit: z6.coerce.number().min(1).max(100).default(5),
|
|
1502
|
+
order: z6.enum(["asc", "desc"]).default("desc")
|
|
1483
1503
|
}),
|
|
1484
1504
|
responses: {
|
|
1485
1505
|
200: metricsResponseSchema,
|
|
@@ -1498,13 +1518,13 @@ var runAgentEventsContract = c3.router({
|
|
|
1498
1518
|
method: "GET",
|
|
1499
1519
|
path: "/api/agent/runs/:id/telemetry/agent",
|
|
1500
1520
|
headers: authHeadersSchema,
|
|
1501
|
-
pathParams:
|
|
1502
|
-
id:
|
|
1521
|
+
pathParams: z6.object({
|
|
1522
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1503
1523
|
}),
|
|
1504
|
-
query:
|
|
1505
|
-
since:
|
|
1506
|
-
limit:
|
|
1507
|
-
order:
|
|
1524
|
+
query: z6.object({
|
|
1525
|
+
since: z6.coerce.number().optional(),
|
|
1526
|
+
limit: z6.coerce.number().min(1).max(100).default(5),
|
|
1527
|
+
order: z6.enum(["asc", "desc"]).default("desc")
|
|
1508
1528
|
}),
|
|
1509
1529
|
responses: {
|
|
1510
1530
|
200: agentEventsResponseSchema,
|
|
@@ -1523,13 +1543,13 @@ var runNetworkLogsContract = c3.router({
|
|
|
1523
1543
|
method: "GET",
|
|
1524
1544
|
path: "/api/agent/runs/:id/telemetry/network",
|
|
1525
1545
|
headers: authHeadersSchema,
|
|
1526
|
-
pathParams:
|
|
1527
|
-
id:
|
|
1546
|
+
pathParams: z6.object({
|
|
1547
|
+
id: z6.string().min(1, "Run ID is required")
|
|
1528
1548
|
}),
|
|
1529
|
-
query:
|
|
1530
|
-
since:
|
|
1531
|
-
limit:
|
|
1532
|
-
order:
|
|
1549
|
+
query: z6.object({
|
|
1550
|
+
since: z6.coerce.number().optional(),
|
|
1551
|
+
limit: z6.coerce.number().min(1).max(100).default(5),
|
|
1552
|
+
order: z6.enum(["asc", "desc"]).default("desc")
|
|
1533
1553
|
}),
|
|
1534
1554
|
responses: {
|
|
1535
1555
|
200: networkLogsResponseSchema,
|
|
@@ -1539,16 +1559,16 @@ var runNetworkLogsContract = c3.router({
|
|
|
1539
1559
|
summary: "Get network logs with pagination"
|
|
1540
1560
|
}
|
|
1541
1561
|
});
|
|
1542
|
-
var searchResultSchema =
|
|
1543
|
-
runId:
|
|
1544
|
-
agentName:
|
|
1562
|
+
var searchResultSchema = z6.object({
|
|
1563
|
+
runId: z6.string(),
|
|
1564
|
+
agentName: z6.string(),
|
|
1545
1565
|
matchedEvent: runEventSchema,
|
|
1546
|
-
contextBefore:
|
|
1547
|
-
contextAfter:
|
|
1566
|
+
contextBefore: z6.array(runEventSchema),
|
|
1567
|
+
contextAfter: z6.array(runEventSchema)
|
|
1548
1568
|
});
|
|
1549
|
-
var logsSearchResponseSchema =
|
|
1550
|
-
results:
|
|
1551
|
-
hasMore:
|
|
1569
|
+
var logsSearchResponseSchema = z6.object({
|
|
1570
|
+
results: z6.array(searchResultSchema),
|
|
1571
|
+
hasMore: z6.boolean()
|
|
1552
1572
|
});
|
|
1553
1573
|
var logsSearchContract = c3.router({
|
|
1554
1574
|
/**
|
|
@@ -1559,14 +1579,14 @@ var logsSearchContract = c3.router({
|
|
|
1559
1579
|
method: "GET",
|
|
1560
1580
|
path: "/api/logs/search",
|
|
1561
1581
|
headers: authHeadersSchema,
|
|
1562
|
-
query:
|
|
1563
|
-
keyword:
|
|
1564
|
-
agent:
|
|
1565
|
-
runId:
|
|
1566
|
-
since:
|
|
1567
|
-
limit:
|
|
1568
|
-
before:
|
|
1569
|
-
after:
|
|
1582
|
+
query: z6.object({
|
|
1583
|
+
keyword: z6.string().min(1),
|
|
1584
|
+
agent: z6.string().optional(),
|
|
1585
|
+
runId: z6.string().optional(),
|
|
1586
|
+
since: z6.coerce.number().optional(),
|
|
1587
|
+
limit: z6.coerce.number().min(1).max(50).default(20),
|
|
1588
|
+
before: z6.coerce.number().min(0).max(10).default(0),
|
|
1589
|
+
after: z6.coerce.number().min(0).max(10).default(0)
|
|
1570
1590
|
}),
|
|
1571
1591
|
responses: {
|
|
1572
1592
|
200: logsSearchResponseSchema,
|
|
@@ -1575,23 +1595,23 @@ var logsSearchContract = c3.router({
|
|
|
1575
1595
|
summary: "Search agent events across runs"
|
|
1576
1596
|
}
|
|
1577
1597
|
});
|
|
1578
|
-
var queueEntrySchema =
|
|
1579
|
-
position:
|
|
1580
|
-
agentName:
|
|
1581
|
-
userEmail:
|
|
1582
|
-
createdAt:
|
|
1583
|
-
isOwner:
|
|
1584
|
-
runId:
|
|
1598
|
+
var queueEntrySchema = z6.object({
|
|
1599
|
+
position: z6.number(),
|
|
1600
|
+
agentName: z6.string(),
|
|
1601
|
+
userEmail: z6.string(),
|
|
1602
|
+
createdAt: z6.string(),
|
|
1603
|
+
isOwner: z6.boolean(),
|
|
1604
|
+
runId: z6.string().nullable()
|
|
1585
1605
|
});
|
|
1586
|
-
var concurrencyInfoSchema =
|
|
1606
|
+
var concurrencyInfoSchema = z6.object({
|
|
1587
1607
|
tier: orgTierSchema,
|
|
1588
|
-
limit:
|
|
1589
|
-
active:
|
|
1590
|
-
available:
|
|
1608
|
+
limit: z6.number(),
|
|
1609
|
+
active: z6.number(),
|
|
1610
|
+
available: z6.number()
|
|
1591
1611
|
});
|
|
1592
|
-
var queueResponseSchema =
|
|
1612
|
+
var queueResponseSchema = z6.object({
|
|
1593
1613
|
concurrency: concurrencyInfoSchema,
|
|
1594
|
-
queue:
|
|
1614
|
+
queue: z6.array(queueEntrySchema)
|
|
1595
1615
|
});
|
|
1596
1616
|
var runsQueueContract = c3.router({
|
|
1597
1617
|
/**
|
|
@@ -1612,17 +1632,17 @@ var runsQueueContract = c3.router({
|
|
|
1612
1632
|
});
|
|
1613
1633
|
|
|
1614
1634
|
// ../../packages/core/src/contracts/storages.ts
|
|
1615
|
-
import { z as
|
|
1635
|
+
import { z as z7 } from "zod";
|
|
1616
1636
|
var c4 = initContract();
|
|
1617
|
-
var storageTypeSchema =
|
|
1618
|
-
var versionQuerySchema =
|
|
1619
|
-
var uploadStorageResponseSchema =
|
|
1620
|
-
name:
|
|
1621
|
-
versionId:
|
|
1622
|
-
size:
|
|
1623
|
-
fileCount:
|
|
1637
|
+
var storageTypeSchema = z7.enum(["volume", "artifact", "memory"]);
|
|
1638
|
+
var versionQuerySchema = z7.string().regex(/^[a-f0-9]{8,64}$/i, "Version must be 8-64 hex characters").optional();
|
|
1639
|
+
var uploadStorageResponseSchema = z7.object({
|
|
1640
|
+
name: z7.string(),
|
|
1641
|
+
versionId: z7.string(),
|
|
1642
|
+
size: z7.number(),
|
|
1643
|
+
fileCount: z7.number(),
|
|
1624
1644
|
type: storageTypeSchema,
|
|
1625
|
-
deduplicated:
|
|
1645
|
+
deduplicated: z7.boolean()
|
|
1626
1646
|
});
|
|
1627
1647
|
var storagesContract = c4.router({
|
|
1628
1648
|
/**
|
|
@@ -1664,8 +1684,8 @@ var storagesContract = c4.router({
|
|
|
1664
1684
|
method: "GET",
|
|
1665
1685
|
path: "/api/storages",
|
|
1666
1686
|
headers: authHeadersSchema,
|
|
1667
|
-
query:
|
|
1668
|
-
name:
|
|
1687
|
+
query: z7.object({
|
|
1688
|
+
name: z7.string().min(1, "Storage name is required"),
|
|
1669
1689
|
version: versionQuerySchema
|
|
1670
1690
|
}),
|
|
1671
1691
|
responses: {
|
|
@@ -1683,41 +1703,41 @@ var storagesContract = c4.router({
|
|
|
1683
1703
|
}
|
|
1684
1704
|
});
|
|
1685
1705
|
var MAX_FILE_SIZE_BYTES = 104857600;
|
|
1686
|
-
var fileEntryWithHashSchema =
|
|
1687
|
-
path:
|
|
1688
|
-
hash:
|
|
1689
|
-
size:
|
|
1706
|
+
var fileEntryWithHashSchema = z7.object({
|
|
1707
|
+
path: z7.string().min(1, "File path is required"),
|
|
1708
|
+
hash: z7.string().length(64, "Hash must be SHA-256 (64 hex chars)"),
|
|
1709
|
+
size: z7.number().int().min(0, "Size must be non-negative").max(MAX_FILE_SIZE_BYTES, "File size exceeds 100MB limit")
|
|
1690
1710
|
});
|
|
1691
|
-
var storageChangesSchema =
|
|
1692
|
-
added:
|
|
1693
|
-
modified:
|
|
1694
|
-
deleted:
|
|
1711
|
+
var storageChangesSchema = z7.object({
|
|
1712
|
+
added: z7.array(z7.string()),
|
|
1713
|
+
modified: z7.array(z7.string()),
|
|
1714
|
+
deleted: z7.array(z7.string())
|
|
1695
1715
|
});
|
|
1696
|
-
var presignedUploadSchema =
|
|
1697
|
-
key:
|
|
1698
|
-
presignedUrl:
|
|
1716
|
+
var presignedUploadSchema = z7.object({
|
|
1717
|
+
key: z7.string(),
|
|
1718
|
+
presignedUrl: z7.string().url()
|
|
1699
1719
|
});
|
|
1700
1720
|
var storagesPrepareContract = c4.router({
|
|
1701
1721
|
prepare: {
|
|
1702
1722
|
method: "POST",
|
|
1703
1723
|
path: "/api/storages/prepare",
|
|
1704
1724
|
headers: authHeadersSchema,
|
|
1705
|
-
body:
|
|
1706
|
-
storageName:
|
|
1725
|
+
body: z7.object({
|
|
1726
|
+
storageName: z7.string().min(1, "Storage name is required"),
|
|
1707
1727
|
storageType: storageTypeSchema,
|
|
1708
|
-
files:
|
|
1709
|
-
force:
|
|
1710
|
-
runId:
|
|
1728
|
+
files: z7.array(fileEntryWithHashSchema),
|
|
1729
|
+
force: z7.boolean().optional(),
|
|
1730
|
+
runId: z7.string().optional(),
|
|
1711
1731
|
// For sandbox auth
|
|
1712
|
-
baseVersion:
|
|
1732
|
+
baseVersion: z7.string().optional(),
|
|
1713
1733
|
// For incremental uploads
|
|
1714
1734
|
changes: storageChangesSchema.optional()
|
|
1715
1735
|
}),
|
|
1716
1736
|
responses: {
|
|
1717
|
-
200:
|
|
1718
|
-
versionId:
|
|
1719
|
-
existing:
|
|
1720
|
-
uploads:
|
|
1737
|
+
200: z7.object({
|
|
1738
|
+
versionId: z7.string(),
|
|
1739
|
+
existing: z7.boolean(),
|
|
1740
|
+
uploads: z7.object({
|
|
1721
1741
|
archive: presignedUploadSchema,
|
|
1722
1742
|
manifest: presignedUploadSchema
|
|
1723
1743
|
}).optional()
|
|
@@ -1736,22 +1756,22 @@ var storagesCommitContract = c4.router({
|
|
|
1736
1756
|
method: "POST",
|
|
1737
1757
|
path: "/api/storages/commit",
|
|
1738
1758
|
headers: authHeadersSchema,
|
|
1739
|
-
body:
|
|
1740
|
-
storageName:
|
|
1759
|
+
body: z7.object({
|
|
1760
|
+
storageName: z7.string().min(1, "Storage name is required"),
|
|
1741
1761
|
storageType: storageTypeSchema,
|
|
1742
|
-
versionId:
|
|
1743
|
-
files:
|
|
1744
|
-
runId:
|
|
1745
|
-
message:
|
|
1762
|
+
versionId: z7.string().min(1, "Version ID is required"),
|
|
1763
|
+
files: z7.array(fileEntryWithHashSchema),
|
|
1764
|
+
runId: z7.string().optional(),
|
|
1765
|
+
message: z7.string().optional()
|
|
1746
1766
|
}),
|
|
1747
1767
|
responses: {
|
|
1748
|
-
200:
|
|
1749
|
-
success:
|
|
1750
|
-
versionId:
|
|
1751
|
-
storageName:
|
|
1752
|
-
size:
|
|
1753
|
-
fileCount:
|
|
1754
|
-
deduplicated:
|
|
1768
|
+
200: z7.object({
|
|
1769
|
+
success: z7.literal(true),
|
|
1770
|
+
versionId: z7.string(),
|
|
1771
|
+
storageName: z7.string(),
|
|
1772
|
+
size: z7.number(),
|
|
1773
|
+
fileCount: z7.number(),
|
|
1774
|
+
deduplicated: z7.boolean().optional()
|
|
1755
1775
|
}),
|
|
1756
1776
|
400: apiErrorSchema,
|
|
1757
1777
|
401: apiErrorSchema,
|
|
@@ -1769,26 +1789,26 @@ var storagesDownloadContract = c4.router({
|
|
|
1769
1789
|
method: "GET",
|
|
1770
1790
|
path: "/api/storages/download",
|
|
1771
1791
|
headers: authHeadersSchema,
|
|
1772
|
-
query:
|
|
1773
|
-
name:
|
|
1792
|
+
query: z7.object({
|
|
1793
|
+
name: z7.string().min(1, "Storage name is required"),
|
|
1774
1794
|
type: storageTypeSchema,
|
|
1775
1795
|
version: versionQuerySchema
|
|
1776
1796
|
}),
|
|
1777
1797
|
responses: {
|
|
1778
1798
|
// Normal response with presigned URL
|
|
1779
|
-
200:
|
|
1780
|
-
|
|
1781
|
-
url:
|
|
1782
|
-
versionId:
|
|
1783
|
-
fileCount:
|
|
1784
|
-
size:
|
|
1799
|
+
200: z7.union([
|
|
1800
|
+
z7.object({
|
|
1801
|
+
url: z7.string().url(),
|
|
1802
|
+
versionId: z7.string(),
|
|
1803
|
+
fileCount: z7.number(),
|
|
1804
|
+
size: z7.number()
|
|
1785
1805
|
}),
|
|
1786
1806
|
// Empty artifact response
|
|
1787
|
-
|
|
1788
|
-
empty:
|
|
1789
|
-
versionId:
|
|
1790
|
-
fileCount:
|
|
1791
|
-
size:
|
|
1807
|
+
z7.object({
|
|
1808
|
+
empty: z7.literal(true),
|
|
1809
|
+
versionId: z7.string(),
|
|
1810
|
+
fileCount: z7.literal(0),
|
|
1811
|
+
size: z7.literal(0)
|
|
1792
1812
|
})
|
|
1793
1813
|
]),
|
|
1794
1814
|
400: apiErrorSchema,
|
|
@@ -1804,16 +1824,16 @@ var storagesListContract = c4.router({
|
|
|
1804
1824
|
method: "GET",
|
|
1805
1825
|
path: "/api/storages/list",
|
|
1806
1826
|
headers: authHeadersSchema,
|
|
1807
|
-
query:
|
|
1827
|
+
query: z7.object({
|
|
1808
1828
|
type: storageTypeSchema
|
|
1809
1829
|
}),
|
|
1810
1830
|
responses: {
|
|
1811
|
-
200:
|
|
1812
|
-
|
|
1813
|
-
name:
|
|
1814
|
-
size:
|
|
1815
|
-
fileCount:
|
|
1816
|
-
updatedAt:
|
|
1831
|
+
200: z7.array(
|
|
1832
|
+
z7.object({
|
|
1833
|
+
name: z7.string(),
|
|
1834
|
+
size: z7.number(),
|
|
1835
|
+
fileCount: z7.number(),
|
|
1836
|
+
updatedAt: z7.string()
|
|
1817
1837
|
})
|
|
1818
1838
|
),
|
|
1819
1839
|
401: apiErrorSchema,
|
|
@@ -1824,22 +1844,22 @@ var storagesListContract = c4.router({
|
|
|
1824
1844
|
});
|
|
1825
1845
|
|
|
1826
1846
|
// ../../packages/core/src/contracts/webhooks.ts
|
|
1827
|
-
import { z as
|
|
1847
|
+
import { z as z8 } from "zod";
|
|
1828
1848
|
var c5 = initContract();
|
|
1829
|
-
var agentEventSchema =
|
|
1830
|
-
type:
|
|
1831
|
-
sequenceNumber:
|
|
1849
|
+
var agentEventSchema = z8.object({
|
|
1850
|
+
type: z8.string(),
|
|
1851
|
+
sequenceNumber: z8.number().int().nonnegative()
|
|
1832
1852
|
}).passthrough();
|
|
1833
|
-
var artifactSnapshotSchema =
|
|
1834
|
-
artifactName:
|
|
1835
|
-
artifactVersion:
|
|
1853
|
+
var artifactSnapshotSchema = z8.object({
|
|
1854
|
+
artifactName: z8.string(),
|
|
1855
|
+
artifactVersion: z8.string()
|
|
1836
1856
|
});
|
|
1837
|
-
var memorySnapshotSchema =
|
|
1838
|
-
memoryName:
|
|
1839
|
-
memoryVersion:
|
|
1857
|
+
var memorySnapshotSchema = z8.object({
|
|
1858
|
+
memoryName: z8.string(),
|
|
1859
|
+
memoryVersion: z8.string()
|
|
1840
1860
|
});
|
|
1841
|
-
var volumeVersionsSnapshotSchema =
|
|
1842
|
-
versions:
|
|
1861
|
+
var volumeVersionsSnapshotSchema = z8.object({
|
|
1862
|
+
versions: z8.record(z8.string(), z8.string())
|
|
1843
1863
|
});
|
|
1844
1864
|
var webhookEventsContract = c5.router({
|
|
1845
1865
|
/**
|
|
@@ -1850,15 +1870,15 @@ var webhookEventsContract = c5.router({
|
|
|
1850
1870
|
method: "POST",
|
|
1851
1871
|
path: "/api/webhooks/agent/events",
|
|
1852
1872
|
headers: authHeadersSchema,
|
|
1853
|
-
body:
|
|
1854
|
-
runId:
|
|
1855
|
-
events:
|
|
1873
|
+
body: z8.object({
|
|
1874
|
+
runId: z8.string().min(1, "runId is required"),
|
|
1875
|
+
events: z8.array(agentEventSchema).min(1, "events array cannot be empty")
|
|
1856
1876
|
}),
|
|
1857
1877
|
responses: {
|
|
1858
|
-
200:
|
|
1859
|
-
received:
|
|
1860
|
-
firstSequence:
|
|
1861
|
-
lastSequence:
|
|
1878
|
+
200: z8.object({
|
|
1879
|
+
received: z8.number(),
|
|
1880
|
+
firstSequence: z8.number(),
|
|
1881
|
+
lastSequence: z8.number()
|
|
1862
1882
|
}),
|
|
1863
1883
|
400: apiErrorSchema,
|
|
1864
1884
|
401: apiErrorSchema,
|
|
@@ -1877,15 +1897,15 @@ var webhookCompleteContract = c5.router({
|
|
|
1877
1897
|
method: "POST",
|
|
1878
1898
|
path: "/api/webhooks/agent/complete",
|
|
1879
1899
|
headers: authHeadersSchema,
|
|
1880
|
-
body:
|
|
1881
|
-
runId:
|
|
1882
|
-
exitCode:
|
|
1883
|
-
error:
|
|
1900
|
+
body: z8.object({
|
|
1901
|
+
runId: z8.string().min(1, "runId is required"),
|
|
1902
|
+
exitCode: z8.number(),
|
|
1903
|
+
error: z8.string().optional()
|
|
1884
1904
|
}),
|
|
1885
1905
|
responses: {
|
|
1886
|
-
200:
|
|
1887
|
-
success:
|
|
1888
|
-
status:
|
|
1906
|
+
200: z8.object({
|
|
1907
|
+
success: z8.boolean(),
|
|
1908
|
+
status: z8.enum(["completed", "failed"])
|
|
1889
1909
|
}),
|
|
1890
1910
|
400: apiErrorSchema,
|
|
1891
1911
|
401: apiErrorSchema,
|
|
@@ -1904,23 +1924,23 @@ var webhookCheckpointsContract = c5.router({
|
|
|
1904
1924
|
method: "POST",
|
|
1905
1925
|
path: "/api/webhooks/agent/checkpoints",
|
|
1906
1926
|
headers: authHeadersSchema,
|
|
1907
|
-
body:
|
|
1908
|
-
runId:
|
|
1909
|
-
cliAgentType:
|
|
1910
|
-
cliAgentSessionId:
|
|
1911
|
-
cliAgentSessionHistory:
|
|
1927
|
+
body: z8.object({
|
|
1928
|
+
runId: z8.string().min(1, "runId is required"),
|
|
1929
|
+
cliAgentType: z8.string().min(1, "cliAgentType is required"),
|
|
1930
|
+
cliAgentSessionId: z8.string().min(1, "cliAgentSessionId is required"),
|
|
1931
|
+
cliAgentSessionHistory: z8.string().min(1, "cliAgentSessionHistory is required"),
|
|
1912
1932
|
artifactSnapshot: artifactSnapshotSchema.optional(),
|
|
1913
1933
|
memorySnapshot: memorySnapshotSchema.optional(),
|
|
1914
1934
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema.optional()
|
|
1915
1935
|
}),
|
|
1916
1936
|
responses: {
|
|
1917
|
-
200:
|
|
1918
|
-
checkpointId:
|
|
1919
|
-
agentSessionId:
|
|
1920
|
-
conversationId:
|
|
1937
|
+
200: z8.object({
|
|
1938
|
+
checkpointId: z8.string(),
|
|
1939
|
+
agentSessionId: z8.string(),
|
|
1940
|
+
conversationId: z8.string(),
|
|
1921
1941
|
artifact: artifactSnapshotSchema.optional(),
|
|
1922
1942
|
memory: memorySnapshotSchema.optional(),
|
|
1923
|
-
volumes:
|
|
1943
|
+
volumes: z8.record(z8.string(), z8.string()).optional()
|
|
1924
1944
|
}),
|
|
1925
1945
|
400: apiErrorSchema,
|
|
1926
1946
|
401: apiErrorSchema,
|
|
@@ -1939,12 +1959,12 @@ var webhookHeartbeatContract = c5.router({
|
|
|
1939
1959
|
method: "POST",
|
|
1940
1960
|
path: "/api/webhooks/agent/heartbeat",
|
|
1941
1961
|
headers: authHeadersSchema,
|
|
1942
|
-
body:
|
|
1943
|
-
runId:
|
|
1962
|
+
body: z8.object({
|
|
1963
|
+
runId: z8.string().min(1, "runId is required")
|
|
1944
1964
|
}),
|
|
1945
1965
|
responses: {
|
|
1946
|
-
200:
|
|
1947
|
-
ok:
|
|
1966
|
+
200: z8.object({
|
|
1967
|
+
ok: z8.boolean()
|
|
1948
1968
|
}),
|
|
1949
1969
|
400: apiErrorSchema,
|
|
1950
1970
|
401: apiErrorSchema,
|
|
@@ -1972,11 +1992,11 @@ var webhookStoragesContract = c5.router({
|
|
|
1972
1992
|
contentType: "multipart/form-data",
|
|
1973
1993
|
body: c5.type(),
|
|
1974
1994
|
responses: {
|
|
1975
|
-
200:
|
|
1976
|
-
versionId:
|
|
1977
|
-
storageName:
|
|
1978
|
-
size:
|
|
1979
|
-
fileCount:
|
|
1995
|
+
200: z8.object({
|
|
1996
|
+
versionId: z8.string(),
|
|
1997
|
+
storageName: z8.string(),
|
|
1998
|
+
size: z8.number(),
|
|
1999
|
+
fileCount: z8.number()
|
|
1980
2000
|
}),
|
|
1981
2001
|
400: apiErrorSchema,
|
|
1982
2002
|
401: apiErrorSchema,
|
|
@@ -2006,17 +2026,17 @@ var webhookStoragesIncrementalContract = c5.router({
|
|
|
2006
2026
|
contentType: "multipart/form-data",
|
|
2007
2027
|
body: c5.type(),
|
|
2008
2028
|
responses: {
|
|
2009
|
-
200:
|
|
2010
|
-
versionId:
|
|
2011
|
-
storageName:
|
|
2012
|
-
size:
|
|
2013
|
-
fileCount:
|
|
2014
|
-
incrementalStats:
|
|
2015
|
-
addedFiles:
|
|
2016
|
-
modifiedFiles:
|
|
2017
|
-
deletedFiles:
|
|
2018
|
-
unchangedFiles:
|
|
2019
|
-
bytesUploaded:
|
|
2029
|
+
200: z8.object({
|
|
2030
|
+
versionId: z8.string(),
|
|
2031
|
+
storageName: z8.string(),
|
|
2032
|
+
size: z8.number(),
|
|
2033
|
+
fileCount: z8.number(),
|
|
2034
|
+
incrementalStats: z8.object({
|
|
2035
|
+
addedFiles: z8.number(),
|
|
2036
|
+
modifiedFiles: z8.number(),
|
|
2037
|
+
deletedFiles: z8.number(),
|
|
2038
|
+
unchangedFiles: z8.number(),
|
|
2039
|
+
bytesUploaded: z8.number()
|
|
2020
2040
|
}).optional()
|
|
2021
2041
|
}),
|
|
2022
2042
|
400: apiErrorSchema,
|
|
@@ -2027,34 +2047,34 @@ var webhookStoragesIncrementalContract = c5.router({
|
|
|
2027
2047
|
summary: "Upload storage version incrementally from sandbox"
|
|
2028
2048
|
}
|
|
2029
2049
|
});
|
|
2030
|
-
var metricDataSchema =
|
|
2031
|
-
ts:
|
|
2032
|
-
cpu:
|
|
2033
|
-
mem_used:
|
|
2034
|
-
mem_total:
|
|
2035
|
-
disk_used:
|
|
2036
|
-
disk_total:
|
|
2050
|
+
var metricDataSchema = z8.object({
|
|
2051
|
+
ts: z8.string(),
|
|
2052
|
+
cpu: z8.number(),
|
|
2053
|
+
mem_used: z8.number(),
|
|
2054
|
+
mem_total: z8.number(),
|
|
2055
|
+
disk_used: z8.number(),
|
|
2056
|
+
disk_total: z8.number()
|
|
2037
2057
|
});
|
|
2038
|
-
var sandboxOperationSchema =
|
|
2039
|
-
ts:
|
|
2040
|
-
action_type:
|
|
2041
|
-
duration_ms:
|
|
2042
|
-
success:
|
|
2043
|
-
error:
|
|
2058
|
+
var sandboxOperationSchema = z8.object({
|
|
2059
|
+
ts: z8.string(),
|
|
2060
|
+
action_type: z8.string(),
|
|
2061
|
+
duration_ms: z8.number(),
|
|
2062
|
+
success: z8.boolean(),
|
|
2063
|
+
error: z8.string().optional()
|
|
2044
2064
|
});
|
|
2045
|
-
var networkLogSchema =
|
|
2046
|
-
timestamp:
|
|
2047
|
-
mode:
|
|
2048
|
-
action:
|
|
2049
|
-
host:
|
|
2050
|
-
port:
|
|
2051
|
-
rule_matched:
|
|
2052
|
-
method:
|
|
2053
|
-
url:
|
|
2054
|
-
status:
|
|
2055
|
-
latency_ms:
|
|
2056
|
-
request_size:
|
|
2057
|
-
response_size:
|
|
2065
|
+
var networkLogSchema = z8.object({
|
|
2066
|
+
timestamp: z8.string(),
|
|
2067
|
+
mode: z8.literal("mitm").optional(),
|
|
2068
|
+
action: z8.enum(["ALLOW", "DENY"]).optional(),
|
|
2069
|
+
host: z8.string().optional(),
|
|
2070
|
+
port: z8.number().optional(),
|
|
2071
|
+
rule_matched: z8.string().nullable().optional(),
|
|
2072
|
+
method: z8.string().optional(),
|
|
2073
|
+
url: z8.string().optional(),
|
|
2074
|
+
status: z8.number().optional(),
|
|
2075
|
+
latency_ms: z8.number().optional(),
|
|
2076
|
+
request_size: z8.number().optional(),
|
|
2077
|
+
response_size: z8.number().optional()
|
|
2058
2078
|
});
|
|
2059
2079
|
var webhookTelemetryContract = c5.router({
|
|
2060
2080
|
/**
|
|
@@ -2065,17 +2085,17 @@ var webhookTelemetryContract = c5.router({
|
|
|
2065
2085
|
method: "POST",
|
|
2066
2086
|
path: "/api/webhooks/agent/telemetry",
|
|
2067
2087
|
headers: authHeadersSchema,
|
|
2068
|
-
body:
|
|
2069
|
-
runId:
|
|
2070
|
-
systemLog:
|
|
2071
|
-
metrics:
|
|
2072
|
-
networkLogs:
|
|
2073
|
-
sandboxOperations:
|
|
2088
|
+
body: z8.object({
|
|
2089
|
+
runId: z8.string().min(1, "runId is required"),
|
|
2090
|
+
systemLog: z8.string().optional(),
|
|
2091
|
+
metrics: z8.array(metricDataSchema).optional(),
|
|
2092
|
+
networkLogs: z8.array(networkLogSchema).optional(),
|
|
2093
|
+
sandboxOperations: z8.array(sandboxOperationSchema).optional()
|
|
2074
2094
|
}),
|
|
2075
2095
|
responses: {
|
|
2076
|
-
200:
|
|
2077
|
-
success:
|
|
2078
|
-
id:
|
|
2096
|
+
200: z8.object({
|
|
2097
|
+
success: z8.boolean(),
|
|
2098
|
+
id: z8.string()
|
|
2079
2099
|
}),
|
|
2080
2100
|
400: apiErrorSchema,
|
|
2081
2101
|
401: apiErrorSchema,
|
|
@@ -2090,21 +2110,21 @@ var webhookStoragesPrepareContract = c5.router({
|
|
|
2090
2110
|
method: "POST",
|
|
2091
2111
|
path: "/api/webhooks/agent/storages/prepare",
|
|
2092
2112
|
headers: authHeadersSchema,
|
|
2093
|
-
body:
|
|
2094
|
-
runId:
|
|
2113
|
+
body: z8.object({
|
|
2114
|
+
runId: z8.string().min(1, "runId is required"),
|
|
2095
2115
|
// Required for webhook auth
|
|
2096
|
-
storageName:
|
|
2116
|
+
storageName: z8.string().min(1, "Storage name is required"),
|
|
2097
2117
|
storageType: storageTypeSchema,
|
|
2098
|
-
files:
|
|
2099
|
-
force:
|
|
2100
|
-
baseVersion:
|
|
2118
|
+
files: z8.array(fileEntryWithHashSchema),
|
|
2119
|
+
force: z8.boolean().optional(),
|
|
2120
|
+
baseVersion: z8.string().optional(),
|
|
2101
2121
|
changes: storageChangesSchema.optional()
|
|
2102
2122
|
}),
|
|
2103
2123
|
responses: {
|
|
2104
|
-
200:
|
|
2105
|
-
versionId:
|
|
2106
|
-
existing:
|
|
2107
|
-
uploads:
|
|
2124
|
+
200: z8.object({
|
|
2125
|
+
versionId: z8.string(),
|
|
2126
|
+
existing: z8.boolean(),
|
|
2127
|
+
uploads: z8.object({
|
|
2108
2128
|
archive: presignedUploadSchema,
|
|
2109
2129
|
manifest: presignedUploadSchema
|
|
2110
2130
|
}).optional()
|
|
@@ -2123,23 +2143,23 @@ var webhookStoragesCommitContract = c5.router({
|
|
|
2123
2143
|
method: "POST",
|
|
2124
2144
|
path: "/api/webhooks/agent/storages/commit",
|
|
2125
2145
|
headers: authHeadersSchema,
|
|
2126
|
-
body:
|
|
2127
|
-
runId:
|
|
2146
|
+
body: z8.object({
|
|
2147
|
+
runId: z8.string().min(1, "runId is required"),
|
|
2128
2148
|
// Required for webhook auth
|
|
2129
|
-
storageName:
|
|
2149
|
+
storageName: z8.string().min(1, "Storage name is required"),
|
|
2130
2150
|
storageType: storageTypeSchema,
|
|
2131
|
-
versionId:
|
|
2132
|
-
files:
|
|
2133
|
-
message:
|
|
2151
|
+
versionId: z8.string().min(1, "Version ID is required"),
|
|
2152
|
+
files: z8.array(fileEntryWithHashSchema),
|
|
2153
|
+
message: z8.string().optional()
|
|
2134
2154
|
}),
|
|
2135
2155
|
responses: {
|
|
2136
|
-
200:
|
|
2137
|
-
success:
|
|
2138
|
-
versionId:
|
|
2139
|
-
storageName:
|
|
2140
|
-
size:
|
|
2141
|
-
fileCount:
|
|
2142
|
-
deduplicated:
|
|
2156
|
+
200: z8.object({
|
|
2157
|
+
success: z8.literal(true),
|
|
2158
|
+
versionId: z8.string(),
|
|
2159
|
+
storageName: z8.string(),
|
|
2160
|
+
size: z8.number(),
|
|
2161
|
+
fileCount: z8.number(),
|
|
2162
|
+
deduplicated: z8.boolean().optional()
|
|
2143
2163
|
}),
|
|
2144
2164
|
400: apiErrorSchema,
|
|
2145
2165
|
401: apiErrorSchema,
|
|
@@ -2154,11 +2174,11 @@ var webhookStoragesCommitContract = c5.router({
|
|
|
2154
2174
|
});
|
|
2155
2175
|
|
|
2156
2176
|
// ../../packages/core/src/contracts/cli-auth.ts
|
|
2157
|
-
import { z as
|
|
2177
|
+
import { z as z9 } from "zod";
|
|
2158
2178
|
var c6 = initContract();
|
|
2159
|
-
var oauthErrorSchema =
|
|
2160
|
-
error:
|
|
2161
|
-
error_description:
|
|
2179
|
+
var oauthErrorSchema = z9.object({
|
|
2180
|
+
error: z9.string(),
|
|
2181
|
+
error_description: z9.string()
|
|
2162
2182
|
});
|
|
2163
2183
|
var cliAuthDeviceContract = c6.router({
|
|
2164
2184
|
/**
|
|
@@ -2168,14 +2188,14 @@ var cliAuthDeviceContract = c6.router({
|
|
|
2168
2188
|
create: {
|
|
2169
2189
|
method: "POST",
|
|
2170
2190
|
path: "/api/cli/auth/device",
|
|
2171
|
-
body:
|
|
2191
|
+
body: z9.object({}).optional(),
|
|
2172
2192
|
responses: {
|
|
2173
|
-
200:
|
|
2174
|
-
device_code:
|
|
2175
|
-
user_code:
|
|
2176
|
-
verification_path:
|
|
2177
|
-
expires_in:
|
|
2178
|
-
interval:
|
|
2193
|
+
200: z9.object({
|
|
2194
|
+
device_code: z9.string(),
|
|
2195
|
+
user_code: z9.string(),
|
|
2196
|
+
verification_path: z9.string(),
|
|
2197
|
+
expires_in: z9.number(),
|
|
2198
|
+
interval: z9.number()
|
|
2179
2199
|
}),
|
|
2180
2200
|
500: oauthErrorSchema
|
|
2181
2201
|
},
|
|
@@ -2190,16 +2210,16 @@ var cliAuthTokenContract = c6.router({
|
|
|
2190
2210
|
exchange: {
|
|
2191
2211
|
method: "POST",
|
|
2192
2212
|
path: "/api/cli/auth/token",
|
|
2193
|
-
body:
|
|
2194
|
-
device_code:
|
|
2213
|
+
body: z9.object({
|
|
2214
|
+
device_code: z9.string().min(1, "device_code is required")
|
|
2195
2215
|
}),
|
|
2196
2216
|
responses: {
|
|
2197
2217
|
// Success - token issued
|
|
2198
|
-
200:
|
|
2199
|
-
access_token:
|
|
2200
|
-
token_type:
|
|
2201
|
-
expires_in:
|
|
2202
|
-
org_slug:
|
|
2218
|
+
200: z9.object({
|
|
2219
|
+
access_token: z9.string(),
|
|
2220
|
+
token_type: z9.literal("Bearer"),
|
|
2221
|
+
expires_in: z9.number(),
|
|
2222
|
+
org_slug: z9.string().optional()
|
|
2203
2223
|
}),
|
|
2204
2224
|
// Authorization pending
|
|
2205
2225
|
202: oauthErrorSchema,
|
|
@@ -2212,7 +2232,7 @@ var cliAuthTokenContract = c6.router({
|
|
|
2212
2232
|
});
|
|
2213
2233
|
|
|
2214
2234
|
// ../../packages/core/src/contracts/auth.ts
|
|
2215
|
-
import { z as
|
|
2235
|
+
import { z as z10 } from "zod";
|
|
2216
2236
|
var c7 = initContract();
|
|
2217
2237
|
var authContract = c7.router({
|
|
2218
2238
|
/**
|
|
@@ -2224,9 +2244,9 @@ var authContract = c7.router({
|
|
|
2224
2244
|
path: "/api/auth/me",
|
|
2225
2245
|
headers: authHeadersSchema,
|
|
2226
2246
|
responses: {
|
|
2227
|
-
200:
|
|
2228
|
-
userId:
|
|
2229
|
-
email:
|
|
2247
|
+
200: z10.object({
|
|
2248
|
+
userId: z10.string(),
|
|
2249
|
+
email: z10.string()
|
|
2230
2250
|
}),
|
|
2231
2251
|
401: apiErrorSchema,
|
|
2232
2252
|
404: apiErrorSchema,
|
|
@@ -2237,21 +2257,21 @@ var authContract = c7.router({
|
|
|
2237
2257
|
});
|
|
2238
2258
|
|
|
2239
2259
|
// ../../packages/core/src/contracts/cron.ts
|
|
2240
|
-
import { z as
|
|
2260
|
+
import { z as z11 } from "zod";
|
|
2241
2261
|
var c8 = initContract();
|
|
2242
|
-
var cleanupResultSchema =
|
|
2243
|
-
runId:
|
|
2244
|
-
sandboxId:
|
|
2245
|
-
status:
|
|
2246
|
-
error:
|
|
2247
|
-
reason:
|
|
2262
|
+
var cleanupResultSchema = z11.object({
|
|
2263
|
+
runId: z11.string(),
|
|
2264
|
+
sandboxId: z11.string().nullable(),
|
|
2265
|
+
status: z11.enum(["cleaned", "error"]),
|
|
2266
|
+
error: z11.string().optional(),
|
|
2267
|
+
reason: z11.string().optional()
|
|
2248
2268
|
});
|
|
2249
|
-
var cleanupResponseSchema =
|
|
2250
|
-
cleaned:
|
|
2251
|
-
errors:
|
|
2252
|
-
results:
|
|
2253
|
-
composeJobsCleaned:
|
|
2254
|
-
composeJobErrors:
|
|
2269
|
+
var cleanupResponseSchema = z11.object({
|
|
2270
|
+
cleaned: z11.number(),
|
|
2271
|
+
errors: z11.number(),
|
|
2272
|
+
results: z11.array(cleanupResultSchema),
|
|
2273
|
+
composeJobsCleaned: z11.number(),
|
|
2274
|
+
composeJobErrors: z11.number()
|
|
2255
2275
|
});
|
|
2256
2276
|
var cronCleanupSandboxesContract = c8.router({
|
|
2257
2277
|
/**
|
|
@@ -2272,28 +2292,28 @@ var cronCleanupSandboxesContract = c8.router({
|
|
|
2272
2292
|
});
|
|
2273
2293
|
|
|
2274
2294
|
// ../../packages/core/src/contracts/secrets.ts
|
|
2275
|
-
import { z as
|
|
2295
|
+
import { z as z12 } from "zod";
|
|
2276
2296
|
var c9 = initContract();
|
|
2277
|
-
var secretNameSchema =
|
|
2297
|
+
var secretNameSchema = z12.string().min(1, "Secret name is required").max(255, "Secret name must be at most 255 characters").regex(
|
|
2278
2298
|
/^[A-Z][A-Z0-9_]*$/,
|
|
2279
2299
|
"Secret name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
|
|
2280
2300
|
);
|
|
2281
|
-
var secretTypeSchema =
|
|
2282
|
-
var secretResponseSchema =
|
|
2283
|
-
id:
|
|
2284
|
-
name:
|
|
2285
|
-
description:
|
|
2301
|
+
var secretTypeSchema = z12.enum(["user", "model-provider", "connector"]);
|
|
2302
|
+
var secretResponseSchema = z12.object({
|
|
2303
|
+
id: z12.string().uuid(),
|
|
2304
|
+
name: z12.string(),
|
|
2305
|
+
description: z12.string().nullable(),
|
|
2286
2306
|
type: secretTypeSchema,
|
|
2287
|
-
createdAt:
|
|
2288
|
-
updatedAt:
|
|
2307
|
+
createdAt: z12.string(),
|
|
2308
|
+
updatedAt: z12.string()
|
|
2289
2309
|
});
|
|
2290
|
-
var secretListResponseSchema =
|
|
2291
|
-
secrets:
|
|
2310
|
+
var secretListResponseSchema = z12.object({
|
|
2311
|
+
secrets: z12.array(secretResponseSchema)
|
|
2292
2312
|
});
|
|
2293
|
-
var setSecretRequestSchema =
|
|
2313
|
+
var setSecretRequestSchema = z12.object({
|
|
2294
2314
|
name: secretNameSchema,
|
|
2295
|
-
value:
|
|
2296
|
-
description:
|
|
2315
|
+
value: z12.string().min(1, "Secret value is required"),
|
|
2316
|
+
description: z12.string().max(1e3).optional()
|
|
2297
2317
|
});
|
|
2298
2318
|
var secretsMainContract = c9.router({
|
|
2299
2319
|
/**
|
|
@@ -2339,7 +2359,7 @@ var secretsByNameContract = c9.router({
|
|
|
2339
2359
|
method: "GET",
|
|
2340
2360
|
path: "/api/secrets/:name",
|
|
2341
2361
|
headers: authHeadersSchema,
|
|
2342
|
-
pathParams:
|
|
2362
|
+
pathParams: z12.object({
|
|
2343
2363
|
name: secretNameSchema
|
|
2344
2364
|
}),
|
|
2345
2365
|
responses: {
|
|
@@ -2358,7 +2378,7 @@ var secretsByNameContract = c9.router({
|
|
|
2358
2378
|
method: "DELETE",
|
|
2359
2379
|
path: "/api/secrets/:name",
|
|
2360
2380
|
headers: authHeadersSchema,
|
|
2361
|
-
pathParams:
|
|
2381
|
+
pathParams: z12.object({
|
|
2362
2382
|
name: secretNameSchema
|
|
2363
2383
|
}),
|
|
2364
2384
|
responses: {
|
|
@@ -2372,27 +2392,27 @@ var secretsByNameContract = c9.router({
|
|
|
2372
2392
|
});
|
|
2373
2393
|
|
|
2374
2394
|
// ../../packages/core/src/contracts/variables.ts
|
|
2375
|
-
import { z as
|
|
2395
|
+
import { z as z13 } from "zod";
|
|
2376
2396
|
var c10 = initContract();
|
|
2377
|
-
var variableNameSchema =
|
|
2397
|
+
var variableNameSchema = z13.string().min(1, "Variable name is required").max(255, "Variable name must be at most 255 characters").regex(
|
|
2378
2398
|
/^[A-Z][A-Z0-9_]*$/,
|
|
2379
2399
|
"Variable name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_VAR)"
|
|
2380
2400
|
);
|
|
2381
|
-
var variableResponseSchema =
|
|
2382
|
-
id:
|
|
2383
|
-
name:
|
|
2384
|
-
value:
|
|
2385
|
-
description:
|
|
2386
|
-
createdAt:
|
|
2387
|
-
updatedAt:
|
|
2401
|
+
var variableResponseSchema = z13.object({
|
|
2402
|
+
id: z13.string().uuid(),
|
|
2403
|
+
name: z13.string(),
|
|
2404
|
+
value: z13.string(),
|
|
2405
|
+
description: z13.string().nullable(),
|
|
2406
|
+
createdAt: z13.string(),
|
|
2407
|
+
updatedAt: z13.string()
|
|
2388
2408
|
});
|
|
2389
|
-
var variableListResponseSchema =
|
|
2390
|
-
variables:
|
|
2409
|
+
var variableListResponseSchema = z13.object({
|
|
2410
|
+
variables: z13.array(variableResponseSchema)
|
|
2391
2411
|
});
|
|
2392
|
-
var setVariableRequestSchema =
|
|
2412
|
+
var setVariableRequestSchema = z13.object({
|
|
2393
2413
|
name: variableNameSchema,
|
|
2394
|
-
value:
|
|
2395
|
-
description:
|
|
2414
|
+
value: z13.string().min(1, "Variable value is required"),
|
|
2415
|
+
description: z13.string().max(1e3).optional()
|
|
2396
2416
|
});
|
|
2397
2417
|
var variablesMainContract = c10.router({
|
|
2398
2418
|
/**
|
|
@@ -2438,7 +2458,7 @@ var variablesByNameContract = c10.router({
|
|
|
2438
2458
|
method: "GET",
|
|
2439
2459
|
path: "/api/variables/:name",
|
|
2440
2460
|
headers: authHeadersSchema,
|
|
2441
|
-
pathParams:
|
|
2461
|
+
pathParams: z13.object({
|
|
2442
2462
|
name: variableNameSchema
|
|
2443
2463
|
}),
|
|
2444
2464
|
responses: {
|
|
@@ -2457,7 +2477,7 @@ var variablesByNameContract = c10.router({
|
|
|
2457
2477
|
method: "DELETE",
|
|
2458
2478
|
path: "/api/variables/:name",
|
|
2459
2479
|
headers: authHeadersSchema,
|
|
2460
|
-
pathParams:
|
|
2480
|
+
pathParams: z13.object({
|
|
2461
2481
|
name: variableNameSchema
|
|
2462
2482
|
}),
|
|
2463
2483
|
responses: {
|
|
@@ -2471,7 +2491,7 @@ var variablesByNameContract = c10.router({
|
|
|
2471
2491
|
});
|
|
2472
2492
|
|
|
2473
2493
|
// ../../packages/core/src/contracts/model-providers.ts
|
|
2474
|
-
import { z as
|
|
2494
|
+
import { z as z14 } from "zod";
|
|
2475
2495
|
var c11 = initContract();
|
|
2476
2496
|
var MODEL_PROVIDER_TYPES = {
|
|
2477
2497
|
"claude-code-oauth-token": {
|
|
@@ -2693,7 +2713,7 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
2693
2713
|
customModelPlaceholder: "anthropic.claude-sonnet-4-20250514-v1:0"
|
|
2694
2714
|
}
|
|
2695
2715
|
};
|
|
2696
|
-
var modelProviderTypeSchema =
|
|
2716
|
+
var modelProviderTypeSchema = z14.enum([
|
|
2697
2717
|
"claude-code-oauth-token",
|
|
2698
2718
|
"anthropic-api-key",
|
|
2699
2719
|
"openrouter-api-key",
|
|
@@ -2704,7 +2724,7 @@ var modelProviderTypeSchema = z13.enum([
|
|
|
2704
2724
|
"azure-foundry",
|
|
2705
2725
|
"aws-bedrock"
|
|
2706
2726
|
]);
|
|
2707
|
-
var modelProviderFrameworkSchema =
|
|
2727
|
+
var modelProviderFrameworkSchema = z14.enum(["claude-code", "codex"]);
|
|
2708
2728
|
function hasAuthMethods(type2) {
|
|
2709
2729
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
2710
2730
|
return "authMethods" in config;
|
|
@@ -2745,41 +2765,41 @@ function getCustomModelPlaceholder(type2) {
|
|
|
2745
2765
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
2746
2766
|
return "customModelPlaceholder" in config ? config.customModelPlaceholder : void 0;
|
|
2747
2767
|
}
|
|
2748
|
-
var modelProviderResponseSchema =
|
|
2749
|
-
id:
|
|
2768
|
+
var modelProviderResponseSchema = z14.object({
|
|
2769
|
+
id: z14.string().uuid(),
|
|
2750
2770
|
type: modelProviderTypeSchema,
|
|
2751
2771
|
framework: modelProviderFrameworkSchema,
|
|
2752
|
-
secretName:
|
|
2772
|
+
secretName: z14.string().nullable(),
|
|
2753
2773
|
// Legacy single-secret (deprecated for multi-auth)
|
|
2754
|
-
authMethod:
|
|
2774
|
+
authMethod: z14.string().nullable(),
|
|
2755
2775
|
// For multi-auth providers
|
|
2756
|
-
secretNames:
|
|
2776
|
+
secretNames: z14.array(z14.string()).nullable(),
|
|
2757
2777
|
// For multi-auth providers
|
|
2758
|
-
isDefault:
|
|
2759
|
-
selectedModel:
|
|
2760
|
-
createdAt:
|
|
2761
|
-
updatedAt:
|
|
2778
|
+
isDefault: z14.boolean(),
|
|
2779
|
+
selectedModel: z14.string().nullable(),
|
|
2780
|
+
createdAt: z14.string(),
|
|
2781
|
+
updatedAt: z14.string()
|
|
2762
2782
|
});
|
|
2763
|
-
var modelProviderListResponseSchema =
|
|
2764
|
-
modelProviders:
|
|
2783
|
+
var modelProviderListResponseSchema = z14.object({
|
|
2784
|
+
modelProviders: z14.array(modelProviderResponseSchema)
|
|
2765
2785
|
});
|
|
2766
|
-
var upsertModelProviderRequestSchema =
|
|
2786
|
+
var upsertModelProviderRequestSchema = z14.object({
|
|
2767
2787
|
type: modelProviderTypeSchema,
|
|
2768
|
-
secret:
|
|
2788
|
+
secret: z14.string().min(1).optional(),
|
|
2769
2789
|
// Legacy single secret
|
|
2770
|
-
authMethod:
|
|
2790
|
+
authMethod: z14.string().optional(),
|
|
2771
2791
|
// For multi-auth providers
|
|
2772
|
-
secrets:
|
|
2792
|
+
secrets: z14.record(z14.string(), z14.string()).optional(),
|
|
2773
2793
|
// For multi-auth providers
|
|
2774
|
-
selectedModel:
|
|
2794
|
+
selectedModel: z14.string().optional()
|
|
2775
2795
|
});
|
|
2776
|
-
var upsertModelProviderResponseSchema =
|
|
2796
|
+
var upsertModelProviderResponseSchema = z14.object({
|
|
2777
2797
|
provider: modelProviderResponseSchema,
|
|
2778
|
-
created:
|
|
2798
|
+
created: z14.boolean()
|
|
2779
2799
|
});
|
|
2780
|
-
var checkSecretResponseSchema =
|
|
2781
|
-
exists:
|
|
2782
|
-
secretName:
|
|
2800
|
+
var checkSecretResponseSchema = z14.object({
|
|
2801
|
+
exists: z14.boolean(),
|
|
2802
|
+
secretName: z14.string()
|
|
2783
2803
|
});
|
|
2784
2804
|
var modelProvidersMainContract = c11.router({
|
|
2785
2805
|
list: {
|
|
@@ -2814,7 +2834,7 @@ var modelProvidersCheckContract = c11.router({
|
|
|
2814
2834
|
method: "GET",
|
|
2815
2835
|
path: "/api/model-providers/check/:type",
|
|
2816
2836
|
headers: authHeadersSchema,
|
|
2817
|
-
pathParams:
|
|
2837
|
+
pathParams: z14.object({
|
|
2818
2838
|
type: modelProviderTypeSchema
|
|
2819
2839
|
}),
|
|
2820
2840
|
responses: {
|
|
@@ -2830,7 +2850,7 @@ var modelProvidersByTypeContract = c11.router({
|
|
|
2830
2850
|
method: "DELETE",
|
|
2831
2851
|
path: "/api/model-providers/:type",
|
|
2832
2852
|
headers: authHeadersSchema,
|
|
2833
|
-
pathParams:
|
|
2853
|
+
pathParams: z14.object({
|
|
2834
2854
|
type: modelProviderTypeSchema
|
|
2835
2855
|
}),
|
|
2836
2856
|
responses: {
|
|
@@ -2847,10 +2867,10 @@ var modelProvidersConvertContract = c11.router({
|
|
|
2847
2867
|
method: "POST",
|
|
2848
2868
|
path: "/api/model-providers/:type/convert",
|
|
2849
2869
|
headers: authHeadersSchema,
|
|
2850
|
-
pathParams:
|
|
2870
|
+
pathParams: z14.object({
|
|
2851
2871
|
type: modelProviderTypeSchema
|
|
2852
2872
|
}),
|
|
2853
|
-
body:
|
|
2873
|
+
body: z14.undefined(),
|
|
2854
2874
|
responses: {
|
|
2855
2875
|
200: modelProviderResponseSchema,
|
|
2856
2876
|
400: apiErrorSchema,
|
|
@@ -2866,10 +2886,10 @@ var modelProvidersSetDefaultContract = c11.router({
|
|
|
2866
2886
|
method: "POST",
|
|
2867
2887
|
path: "/api/model-providers/:type/set-default",
|
|
2868
2888
|
headers: authHeadersSchema,
|
|
2869
|
-
pathParams:
|
|
2889
|
+
pathParams: z14.object({
|
|
2870
2890
|
type: modelProviderTypeSchema
|
|
2871
2891
|
}),
|
|
2872
|
-
body:
|
|
2892
|
+
body: z14.undefined(),
|
|
2873
2893
|
responses: {
|
|
2874
2894
|
200: modelProviderResponseSchema,
|
|
2875
2895
|
401: apiErrorSchema,
|
|
@@ -2879,15 +2899,15 @@ var modelProvidersSetDefaultContract = c11.router({
|
|
|
2879
2899
|
summary: "Set a model provider as default for its framework"
|
|
2880
2900
|
}
|
|
2881
2901
|
});
|
|
2882
|
-
var updateModelRequestSchema =
|
|
2883
|
-
selectedModel:
|
|
2902
|
+
var updateModelRequestSchema = z14.object({
|
|
2903
|
+
selectedModel: z14.string().optional()
|
|
2884
2904
|
});
|
|
2885
2905
|
var modelProvidersUpdateModelContract = c11.router({
|
|
2886
2906
|
updateModel: {
|
|
2887
2907
|
method: "PATCH",
|
|
2888
2908
|
path: "/api/model-providers/:type/model",
|
|
2889
2909
|
headers: authHeadersSchema,
|
|
2890
|
-
pathParams:
|
|
2910
|
+
pathParams: z14.object({
|
|
2891
2911
|
type: modelProviderTypeSchema
|
|
2892
2912
|
}),
|
|
2893
2913
|
body: updateModelRequestSchema,
|
|
@@ -2902,51 +2922,51 @@ var modelProvidersUpdateModelContract = c11.router({
|
|
|
2902
2922
|
});
|
|
2903
2923
|
|
|
2904
2924
|
// ../../packages/core/src/contracts/sessions.ts
|
|
2905
|
-
import { z as
|
|
2925
|
+
import { z as z15 } from "zod";
|
|
2906
2926
|
var c12 = initContract();
|
|
2907
|
-
var storedChatMessageSchema =
|
|
2908
|
-
role:
|
|
2909
|
-
content:
|
|
2910
|
-
runId:
|
|
2911
|
-
createdAt:
|
|
2927
|
+
var storedChatMessageSchema = z15.object({
|
|
2928
|
+
role: z15.enum(["user", "assistant"]),
|
|
2929
|
+
content: z15.string(),
|
|
2930
|
+
runId: z15.string().optional(),
|
|
2931
|
+
createdAt: z15.string()
|
|
2912
2932
|
});
|
|
2913
|
-
var sessionResponseSchema =
|
|
2914
|
-
id:
|
|
2915
|
-
agentComposeId:
|
|
2916
|
-
conversationId:
|
|
2917
|
-
artifactName:
|
|
2918
|
-
secretNames:
|
|
2919
|
-
chatMessages:
|
|
2920
|
-
createdAt:
|
|
2921
|
-
updatedAt:
|
|
2933
|
+
var sessionResponseSchema = z15.object({
|
|
2934
|
+
id: z15.string(),
|
|
2935
|
+
agentComposeId: z15.string(),
|
|
2936
|
+
conversationId: z15.string().nullable(),
|
|
2937
|
+
artifactName: z15.string().nullable(),
|
|
2938
|
+
secretNames: z15.array(z15.string()).nullable(),
|
|
2939
|
+
chatMessages: z15.array(storedChatMessageSchema).optional(),
|
|
2940
|
+
createdAt: z15.string(),
|
|
2941
|
+
updatedAt: z15.string()
|
|
2922
2942
|
});
|
|
2923
|
-
var sessionListItemSchema =
|
|
2924
|
-
id:
|
|
2925
|
-
createdAt:
|
|
2926
|
-
updatedAt:
|
|
2927
|
-
messageCount:
|
|
2928
|
-
preview:
|
|
2943
|
+
var sessionListItemSchema = z15.object({
|
|
2944
|
+
id: z15.string(),
|
|
2945
|
+
createdAt: z15.string(),
|
|
2946
|
+
updatedAt: z15.string(),
|
|
2947
|
+
messageCount: z15.number(),
|
|
2948
|
+
preview: z15.string().nullable()
|
|
2929
2949
|
});
|
|
2930
|
-
var agentComposeSnapshotSchema =
|
|
2931
|
-
agentComposeVersionId:
|
|
2932
|
-
vars:
|
|
2933
|
-
secretNames:
|
|
2950
|
+
var agentComposeSnapshotSchema = z15.object({
|
|
2951
|
+
agentComposeVersionId: z15.string(),
|
|
2952
|
+
vars: z15.record(z15.string(), z15.string()).optional(),
|
|
2953
|
+
secretNames: z15.array(z15.string()).optional()
|
|
2934
2954
|
});
|
|
2935
|
-
var artifactSnapshotSchema2 =
|
|
2936
|
-
artifactName:
|
|
2937
|
-
artifactVersion:
|
|
2955
|
+
var artifactSnapshotSchema2 = z15.object({
|
|
2956
|
+
artifactName: z15.string(),
|
|
2957
|
+
artifactVersion: z15.string()
|
|
2938
2958
|
});
|
|
2939
|
-
var volumeVersionsSnapshotSchema2 =
|
|
2940
|
-
versions:
|
|
2959
|
+
var volumeVersionsSnapshotSchema2 = z15.object({
|
|
2960
|
+
versions: z15.record(z15.string(), z15.string())
|
|
2941
2961
|
});
|
|
2942
|
-
var checkpointResponseSchema =
|
|
2943
|
-
id:
|
|
2944
|
-
runId:
|
|
2945
|
-
conversationId:
|
|
2962
|
+
var checkpointResponseSchema = z15.object({
|
|
2963
|
+
id: z15.string(),
|
|
2964
|
+
runId: z15.string(),
|
|
2965
|
+
conversationId: z15.string(),
|
|
2946
2966
|
agentComposeSnapshot: agentComposeSnapshotSchema,
|
|
2947
2967
|
artifactSnapshot: artifactSnapshotSchema2.nullable(),
|
|
2948
2968
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
|
|
2949
|
-
createdAt:
|
|
2969
|
+
createdAt: z15.string()
|
|
2950
2970
|
});
|
|
2951
2971
|
var sessionsContract = c12.router({
|
|
2952
2972
|
/**
|
|
@@ -2957,11 +2977,11 @@ var sessionsContract = c12.router({
|
|
|
2957
2977
|
method: "GET",
|
|
2958
2978
|
path: "/api/agent/sessions",
|
|
2959
2979
|
headers: authHeadersSchema,
|
|
2960
|
-
query:
|
|
2961
|
-
agentComposeId:
|
|
2980
|
+
query: z15.object({
|
|
2981
|
+
agentComposeId: z15.string().min(1, "agentComposeId is required")
|
|
2962
2982
|
}),
|
|
2963
2983
|
responses: {
|
|
2964
|
-
200:
|
|
2984
|
+
200: z15.object({ sessions: z15.array(sessionListItemSchema) }),
|
|
2965
2985
|
401: apiErrorSchema
|
|
2966
2986
|
},
|
|
2967
2987
|
summary: "List chat sessions for an agent"
|
|
@@ -2976,8 +2996,8 @@ var sessionsByIdContract = c12.router({
|
|
|
2976
2996
|
method: "GET",
|
|
2977
2997
|
path: "/api/agent/sessions/:id",
|
|
2978
2998
|
headers: authHeadersSchema,
|
|
2979
|
-
pathParams:
|
|
2980
|
-
id:
|
|
2999
|
+
pathParams: z15.object({
|
|
3000
|
+
id: z15.string().min(1, "Session ID is required")
|
|
2981
3001
|
}),
|
|
2982
3002
|
responses: {
|
|
2983
3003
|
200: sessionResponseSchema,
|
|
@@ -2997,20 +3017,20 @@ var sessionMessagesContract = c12.router({
|
|
|
2997
3017
|
method: "POST",
|
|
2998
3018
|
path: "/api/agent/sessions/:id/messages",
|
|
2999
3019
|
headers: authHeadersSchema,
|
|
3000
|
-
pathParams:
|
|
3001
|
-
id:
|
|
3020
|
+
pathParams: z15.object({
|
|
3021
|
+
id: z15.string().min(1, "Session ID is required")
|
|
3002
3022
|
}),
|
|
3003
|
-
body:
|
|
3004
|
-
messages:
|
|
3005
|
-
|
|
3006
|
-
role:
|
|
3007
|
-
content:
|
|
3008
|
-
runId:
|
|
3023
|
+
body: z15.object({
|
|
3024
|
+
messages: z15.array(
|
|
3025
|
+
z15.object({
|
|
3026
|
+
role: z15.enum(["user", "assistant"]),
|
|
3027
|
+
content: z15.string(),
|
|
3028
|
+
runId: z15.string().optional()
|
|
3009
3029
|
})
|
|
3010
3030
|
)
|
|
3011
3031
|
}),
|
|
3012
3032
|
responses: {
|
|
3013
|
-
200:
|
|
3033
|
+
200: z15.object({ success: z15.literal(true) }),
|
|
3014
3034
|
401: apiErrorSchema,
|
|
3015
3035
|
403: apiErrorSchema,
|
|
3016
3036
|
404: apiErrorSchema
|
|
@@ -3027,8 +3047,8 @@ var checkpointsByIdContract = c12.router({
|
|
|
3027
3047
|
method: "GET",
|
|
3028
3048
|
path: "/api/agent/checkpoints/:id",
|
|
3029
3049
|
headers: authHeadersSchema,
|
|
3030
|
-
pathParams:
|
|
3031
|
-
id:
|
|
3050
|
+
pathParams: z15.object({
|
|
3051
|
+
id: z15.string().min(1, "Checkpoint ID is required")
|
|
3032
3052
|
}),
|
|
3033
3053
|
responses: {
|
|
3034
3054
|
200: checkpointResponseSchema,
|
|
@@ -3041,29 +3061,29 @@ var checkpointsByIdContract = c12.router({
|
|
|
3041
3061
|
});
|
|
3042
3062
|
|
|
3043
3063
|
// ../../packages/core/src/contracts/runners.ts
|
|
3044
|
-
import { z as
|
|
3064
|
+
import { z as z16 } from "zod";
|
|
3045
3065
|
var c13 = initContract();
|
|
3046
|
-
var runnerGroupSchema =
|
|
3066
|
+
var runnerGroupSchema = z16.string().regex(
|
|
3047
3067
|
/^[a-z0-9-]+\/[a-z0-9-]+$/,
|
|
3048
3068
|
"Runner group must be in org/name format (e.g., acme/production)"
|
|
3049
3069
|
);
|
|
3050
|
-
var jobSchema =
|
|
3051
|
-
runId:
|
|
3052
|
-
prompt:
|
|
3053
|
-
agentComposeVersionId:
|
|
3054
|
-
vars:
|
|
3055
|
-
checkpointId:
|
|
3070
|
+
var jobSchema = z16.object({
|
|
3071
|
+
runId: z16.string().uuid(),
|
|
3072
|
+
prompt: z16.string(),
|
|
3073
|
+
agentComposeVersionId: z16.string().nullable(),
|
|
3074
|
+
vars: z16.record(z16.string(), z16.string()).nullable(),
|
|
3075
|
+
checkpointId: z16.string().uuid().nullable()
|
|
3056
3076
|
});
|
|
3057
3077
|
var runnersPollContract = c13.router({
|
|
3058
3078
|
poll: {
|
|
3059
3079
|
method: "POST",
|
|
3060
3080
|
path: "/api/runners/poll",
|
|
3061
3081
|
headers: authHeadersSchema,
|
|
3062
|
-
body:
|
|
3082
|
+
body: z16.object({
|
|
3063
3083
|
group: runnerGroupSchema
|
|
3064
3084
|
}),
|
|
3065
3085
|
responses: {
|
|
3066
|
-
200:
|
|
3086
|
+
200: z16.object({
|
|
3067
3087
|
job: jobSchema.nullable()
|
|
3068
3088
|
}),
|
|
3069
3089
|
400: apiErrorSchema,
|
|
@@ -3073,107 +3093,94 @@ var runnersPollContract = c13.router({
|
|
|
3073
3093
|
summary: "Poll for pending jobs (long-polling with 30s timeout)"
|
|
3074
3094
|
}
|
|
3075
3095
|
});
|
|
3076
|
-
var
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
headers: z15.record(z15.string(), z15.string())
|
|
3080
|
-
}),
|
|
3081
|
-
permissions: z15.array(firewallPermissionSchema).optional()
|
|
3082
|
-
});
|
|
3083
|
-
var firewallSchema = z15.object({
|
|
3084
|
-
name: z15.string(),
|
|
3085
|
-
ref: z15.string(),
|
|
3086
|
-
apis: z15.array(firewallApiSchema)
|
|
3087
|
-
});
|
|
3088
|
-
var experimentalFirewallSchema = z15.array(firewallSchema);
|
|
3089
|
-
var storageEntrySchema = z15.object({
|
|
3090
|
-
mountPath: z15.string(),
|
|
3091
|
-
archiveUrl: z15.string().nullable()
|
|
3096
|
+
var storageEntrySchema = z16.object({
|
|
3097
|
+
mountPath: z16.string(),
|
|
3098
|
+
archiveUrl: z16.string().nullable()
|
|
3092
3099
|
});
|
|
3093
|
-
var artifactEntrySchema =
|
|
3094
|
-
mountPath:
|
|
3095
|
-
archiveUrl:
|
|
3096
|
-
vasStorageName:
|
|
3097
|
-
vasVersionId:
|
|
3100
|
+
var artifactEntrySchema = z16.object({
|
|
3101
|
+
mountPath: z16.string(),
|
|
3102
|
+
archiveUrl: z16.string().nullable(),
|
|
3103
|
+
vasStorageName: z16.string(),
|
|
3104
|
+
vasVersionId: z16.string()
|
|
3098
3105
|
});
|
|
3099
|
-
var storageManifestSchema =
|
|
3100
|
-
storages:
|
|
3106
|
+
var storageManifestSchema = z16.object({
|
|
3107
|
+
storages: z16.array(storageEntrySchema),
|
|
3101
3108
|
artifact: artifactEntrySchema.nullable(),
|
|
3102
3109
|
memory: artifactEntrySchema.nullable()
|
|
3103
3110
|
});
|
|
3104
|
-
var resumeSessionSchema =
|
|
3105
|
-
sessionId:
|
|
3106
|
-
sessionHistory:
|
|
3111
|
+
var resumeSessionSchema = z16.object({
|
|
3112
|
+
sessionId: z16.string(),
|
|
3113
|
+
sessionHistory: z16.string()
|
|
3107
3114
|
});
|
|
3108
|
-
var storedExecutionContextSchema =
|
|
3109
|
-
workingDir:
|
|
3115
|
+
var storedExecutionContextSchema = z16.object({
|
|
3116
|
+
workingDir: z16.string(),
|
|
3110
3117
|
storageManifest: storageManifestSchema.nullable(),
|
|
3111
|
-
environment:
|
|
3118
|
+
environment: z16.record(z16.string(), z16.string()).nullable(),
|
|
3112
3119
|
resumeSession: resumeSessionSchema.nullable(),
|
|
3113
|
-
encryptedSecrets:
|
|
3120
|
+
encryptedSecrets: z16.string().nullable(),
|
|
3114
3121
|
// AES-256-GCM encrypted Record<string, string> (secret name → value)
|
|
3115
3122
|
// Maps secret names to OAuth connector types for runtime token refresh (e.g. { "GMAIL_ACCESS_TOKEN": "gmail" })
|
|
3116
|
-
secretConnectorMap:
|
|
3117
|
-
cliAgentType:
|
|
3123
|
+
secretConnectorMap: z16.record(z16.string(), z16.string()).nullable().optional(),
|
|
3124
|
+
cliAgentType: z16.string(),
|
|
3118
3125
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
3119
|
-
debugNoMockClaude:
|
|
3126
|
+
debugNoMockClaude: z16.boolean().optional(),
|
|
3120
3127
|
// Dispatch timestamp for E2E timing metrics
|
|
3121
|
-
apiStartTime:
|
|
3128
|
+
apiStartTime: z16.number().optional(),
|
|
3122
3129
|
// User's timezone preference (IANA format, e.g., "Asia/Shanghai")
|
|
3123
|
-
userTimezone:
|
|
3130
|
+
userTimezone: z16.string().optional(),
|
|
3124
3131
|
// Agent metadata for VM0_AGENT_NAME and VM0_AGENT_ORG env vars
|
|
3125
|
-
agentName:
|
|
3126
|
-
agentOrgSlug:
|
|
3132
|
+
agentName: z16.string().optional(),
|
|
3133
|
+
agentOrgSlug: z16.string().optional(),
|
|
3127
3134
|
// Memory storage name (for first-run when manifest.memory is null)
|
|
3128
|
-
memoryName:
|
|
3135
|
+
memoryName: z16.string().optional(),
|
|
3129
3136
|
// Experimental firewall for proxy-side token replacement
|
|
3130
3137
|
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
3131
3138
|
// Experimental capabilities for agent permission enforcement
|
|
3132
|
-
experimentalCapabilities:
|
|
3139
|
+
experimentalCapabilities: z16.array(z16.enum(VALID_CAPABILITIES)).optional()
|
|
3133
3140
|
});
|
|
3134
|
-
var executionContextSchema =
|
|
3135
|
-
runId:
|
|
3136
|
-
prompt:
|
|
3137
|
-
agentComposeVersionId:
|
|
3138
|
-
vars:
|
|
3139
|
-
checkpointId:
|
|
3140
|
-
sandboxToken:
|
|
3141
|
+
var executionContextSchema = z16.object({
|
|
3142
|
+
runId: z16.string().uuid(),
|
|
3143
|
+
prompt: z16.string(),
|
|
3144
|
+
agentComposeVersionId: z16.string().nullable(),
|
|
3145
|
+
vars: z16.record(z16.string(), z16.string()).nullable(),
|
|
3146
|
+
checkpointId: z16.string().uuid().nullable(),
|
|
3147
|
+
sandboxToken: z16.string(),
|
|
3141
3148
|
// New fields for E2B parity:
|
|
3142
|
-
workingDir:
|
|
3149
|
+
workingDir: z16.string(),
|
|
3143
3150
|
storageManifest: storageManifestSchema.nullable(),
|
|
3144
|
-
environment:
|
|
3151
|
+
environment: z16.record(z16.string(), z16.string()).nullable(),
|
|
3145
3152
|
resumeSession: resumeSessionSchema.nullable(),
|
|
3146
|
-
secretValues:
|
|
3153
|
+
secretValues: z16.array(z16.string()).nullable(),
|
|
3147
3154
|
// AES-256-GCM encrypted Record<string, string> — passed through to mitm-addon for auth resolution
|
|
3148
|
-
encryptedSecrets:
|
|
3155
|
+
encryptedSecrets: z16.string().nullable(),
|
|
3149
3156
|
// Maps secret names to OAuth connector types for runtime token refresh
|
|
3150
|
-
secretConnectorMap:
|
|
3151
|
-
cliAgentType:
|
|
3157
|
+
secretConnectorMap: z16.record(z16.string(), z16.string()).nullable().optional(),
|
|
3158
|
+
cliAgentType: z16.string(),
|
|
3152
3159
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
3153
|
-
debugNoMockClaude:
|
|
3160
|
+
debugNoMockClaude: z16.boolean().optional(),
|
|
3154
3161
|
// Dispatch timestamp for E2E timing metrics
|
|
3155
|
-
apiStartTime:
|
|
3162
|
+
apiStartTime: z16.number().optional(),
|
|
3156
3163
|
// User's timezone preference (IANA format, e.g., "Asia/Shanghai")
|
|
3157
|
-
userTimezone:
|
|
3164
|
+
userTimezone: z16.string().optional(),
|
|
3158
3165
|
// Agent metadata
|
|
3159
|
-
agentName:
|
|
3160
|
-
agentOrgSlug:
|
|
3166
|
+
agentName: z16.string().optional(),
|
|
3167
|
+
agentOrgSlug: z16.string().optional(),
|
|
3161
3168
|
// Memory storage name (for first-run when manifest.memory is null)
|
|
3162
|
-
memoryName:
|
|
3169
|
+
memoryName: z16.string().optional(),
|
|
3163
3170
|
// Experimental firewall for proxy-side token replacement
|
|
3164
3171
|
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
3165
3172
|
// Experimental capabilities for agent permission enforcement
|
|
3166
|
-
experimentalCapabilities:
|
|
3173
|
+
experimentalCapabilities: z16.array(z16.enum(VALID_CAPABILITIES)).optional()
|
|
3167
3174
|
});
|
|
3168
3175
|
var runnersJobClaimContract = c13.router({
|
|
3169
3176
|
claim: {
|
|
3170
3177
|
method: "POST",
|
|
3171
3178
|
path: "/api/runners/jobs/:id/claim",
|
|
3172
3179
|
headers: authHeadersSchema,
|
|
3173
|
-
pathParams:
|
|
3174
|
-
id:
|
|
3180
|
+
pathParams: z16.object({
|
|
3181
|
+
id: z16.string().uuid()
|
|
3175
3182
|
}),
|
|
3176
|
-
body:
|
|
3183
|
+
body: z16.object({}),
|
|
3177
3184
|
responses: {
|
|
3178
3185
|
200: executionContextSchema,
|
|
3179
3186
|
400: apiErrorSchema,
|
|
@@ -3190,13 +3197,13 @@ var runnersJobClaimContract = c13.router({
|
|
|
3190
3197
|
});
|
|
3191
3198
|
|
|
3192
3199
|
// ../../packages/core/src/contracts/schedules.ts
|
|
3193
|
-
import { z as
|
|
3200
|
+
import { z as z17 } from "zod";
|
|
3194
3201
|
var c14 = initContract();
|
|
3195
|
-
var scheduleTriggerSchema =
|
|
3196
|
-
cron:
|
|
3197
|
-
at:
|
|
3198
|
-
loop:
|
|
3199
|
-
timezone:
|
|
3202
|
+
var scheduleTriggerSchema = z17.object({
|
|
3203
|
+
cron: z17.string().optional(),
|
|
3204
|
+
at: z17.string().optional(),
|
|
3205
|
+
loop: z17.object({ interval: z17.number().int().min(0) }).optional(),
|
|
3206
|
+
timezone: z17.string().default("UTC")
|
|
3200
3207
|
}).refine(
|
|
3201
3208
|
(data) => {
|
|
3202
3209
|
const triggers = [data.cron, data.at, data.loop].filter(Boolean);
|
|
@@ -3206,41 +3213,41 @@ var scheduleTriggerSchema = z16.object({
|
|
|
3206
3213
|
message: "Exactly one of 'cron', 'at', or 'loop' must be specified"
|
|
3207
3214
|
}
|
|
3208
3215
|
);
|
|
3209
|
-
var scheduleRunConfigSchema =
|
|
3210
|
-
agent:
|
|
3211
|
-
prompt:
|
|
3212
|
-
vars:
|
|
3213
|
-
secrets:
|
|
3214
|
-
artifactName:
|
|
3215
|
-
artifactVersion:
|
|
3216
|
-
volumeVersions:
|
|
3216
|
+
var scheduleRunConfigSchema = z17.object({
|
|
3217
|
+
agent: z17.string().min(1, "Agent reference required"),
|
|
3218
|
+
prompt: z17.string().min(1, "Prompt required"),
|
|
3219
|
+
vars: z17.record(z17.string(), z17.string()).optional(),
|
|
3220
|
+
secrets: z17.record(z17.string(), z17.string()).optional(),
|
|
3221
|
+
artifactName: z17.string().optional(),
|
|
3222
|
+
artifactVersion: z17.string().optional(),
|
|
3223
|
+
volumeVersions: z17.record(z17.string(), z17.string()).optional()
|
|
3217
3224
|
});
|
|
3218
|
-
var scheduleDefinitionSchema =
|
|
3225
|
+
var scheduleDefinitionSchema = z17.object({
|
|
3219
3226
|
on: scheduleTriggerSchema,
|
|
3220
3227
|
run: scheduleRunConfigSchema
|
|
3221
3228
|
});
|
|
3222
|
-
var scheduleYamlSchema =
|
|
3223
|
-
version:
|
|
3224
|
-
schedules:
|
|
3229
|
+
var scheduleYamlSchema = z17.object({
|
|
3230
|
+
version: z17.literal("1.0"),
|
|
3231
|
+
schedules: z17.record(z17.string(), scheduleDefinitionSchema)
|
|
3225
3232
|
});
|
|
3226
|
-
var deployScheduleRequestSchema =
|
|
3227
|
-
name:
|
|
3228
|
-
cronExpression:
|
|
3229
|
-
atTime:
|
|
3230
|
-
intervalSeconds:
|
|
3231
|
-
timezone:
|
|
3232
|
-
prompt:
|
|
3233
|
+
var deployScheduleRequestSchema = z17.object({
|
|
3234
|
+
name: z17.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
3235
|
+
cronExpression: z17.string().optional(),
|
|
3236
|
+
atTime: z17.string().optional(),
|
|
3237
|
+
intervalSeconds: z17.number().int().min(0).optional(),
|
|
3238
|
+
timezone: z17.string().default("UTC"),
|
|
3239
|
+
prompt: z17.string().min(1, "Prompt required"),
|
|
3233
3240
|
// vars and secrets removed - now managed via platform tables
|
|
3234
|
-
artifactName:
|
|
3235
|
-
artifactVersion:
|
|
3236
|
-
volumeVersions:
|
|
3241
|
+
artifactName: z17.string().optional(),
|
|
3242
|
+
artifactVersion: z17.string().optional(),
|
|
3243
|
+
volumeVersions: z17.record(z17.string(), z17.string()).optional(),
|
|
3237
3244
|
// Resolved agent compose ID (CLI resolves org/name:version → composeId)
|
|
3238
|
-
composeId:
|
|
3245
|
+
composeId: z17.string().uuid("Invalid compose ID"),
|
|
3239
3246
|
// Enable schedule immediately upon creation
|
|
3240
|
-
enabled:
|
|
3247
|
+
enabled: z17.boolean().optional(),
|
|
3241
3248
|
// Per-schedule notification control (AND'd with user global preferences)
|
|
3242
|
-
notifyEmail:
|
|
3243
|
-
notifySlack:
|
|
3249
|
+
notifyEmail: z17.boolean().optional(),
|
|
3250
|
+
notifySlack: z17.boolean().optional()
|
|
3244
3251
|
}).refine(
|
|
3245
3252
|
(data) => {
|
|
3246
3253
|
const triggers = [
|
|
@@ -3254,38 +3261,38 @@ var deployScheduleRequestSchema = z16.object({
|
|
|
3254
3261
|
message: "Exactly one of 'cronExpression', 'atTime', or 'intervalSeconds' must be specified"
|
|
3255
3262
|
}
|
|
3256
3263
|
);
|
|
3257
|
-
var scheduleResponseSchema =
|
|
3258
|
-
id:
|
|
3259
|
-
composeId:
|
|
3260
|
-
composeName:
|
|
3261
|
-
orgSlug:
|
|
3262
|
-
userId:
|
|
3263
|
-
name:
|
|
3264
|
-
triggerType:
|
|
3265
|
-
cronExpression:
|
|
3266
|
-
atTime:
|
|
3267
|
-
intervalSeconds:
|
|
3268
|
-
timezone:
|
|
3269
|
-
prompt:
|
|
3270
|
-
vars:
|
|
3264
|
+
var scheduleResponseSchema = z17.object({
|
|
3265
|
+
id: z17.string().uuid(),
|
|
3266
|
+
composeId: z17.string().uuid(),
|
|
3267
|
+
composeName: z17.string(),
|
|
3268
|
+
orgSlug: z17.string(),
|
|
3269
|
+
userId: z17.string(),
|
|
3270
|
+
name: z17.string(),
|
|
3271
|
+
triggerType: z17.enum(["cron", "once", "loop"]),
|
|
3272
|
+
cronExpression: z17.string().nullable(),
|
|
3273
|
+
atTime: z17.string().nullable(),
|
|
3274
|
+
intervalSeconds: z17.number().nullable(),
|
|
3275
|
+
timezone: z17.string(),
|
|
3276
|
+
prompt: z17.string(),
|
|
3277
|
+
vars: z17.record(z17.string(), z17.string()).nullable(),
|
|
3271
3278
|
// Secret names only (values are never returned)
|
|
3272
|
-
secretNames:
|
|
3273
|
-
artifactName:
|
|
3274
|
-
artifactVersion:
|
|
3275
|
-
volumeVersions:
|
|
3276
|
-
enabled:
|
|
3277
|
-
notifyEmail:
|
|
3278
|
-
notifySlack:
|
|
3279
|
-
nextRunAt:
|
|
3280
|
-
lastRunAt:
|
|
3281
|
-
retryStartedAt:
|
|
3282
|
-
consecutiveFailures:
|
|
3283
|
-
createdAt:
|
|
3284
|
-
updatedAt:
|
|
3279
|
+
secretNames: z17.array(z17.string()).nullable(),
|
|
3280
|
+
artifactName: z17.string().nullable(),
|
|
3281
|
+
artifactVersion: z17.string().nullable(),
|
|
3282
|
+
volumeVersions: z17.record(z17.string(), z17.string()).nullable(),
|
|
3283
|
+
enabled: z17.boolean(),
|
|
3284
|
+
notifyEmail: z17.boolean(),
|
|
3285
|
+
notifySlack: z17.boolean(),
|
|
3286
|
+
nextRunAt: z17.string().nullable(),
|
|
3287
|
+
lastRunAt: z17.string().nullable(),
|
|
3288
|
+
retryStartedAt: z17.string().nullable(),
|
|
3289
|
+
consecutiveFailures: z17.number(),
|
|
3290
|
+
createdAt: z17.string(),
|
|
3291
|
+
updatedAt: z17.string()
|
|
3285
3292
|
});
|
|
3286
|
-
var runSummarySchema =
|
|
3287
|
-
id:
|
|
3288
|
-
status:
|
|
3293
|
+
var runSummarySchema = z17.object({
|
|
3294
|
+
id: z17.string().uuid(),
|
|
3295
|
+
status: z17.enum([
|
|
3289
3296
|
"queued",
|
|
3290
3297
|
"pending",
|
|
3291
3298
|
"running",
|
|
@@ -3293,19 +3300,19 @@ var runSummarySchema = z16.object({
|
|
|
3293
3300
|
"failed",
|
|
3294
3301
|
"timeout"
|
|
3295
3302
|
]),
|
|
3296
|
-
createdAt:
|
|
3297
|
-
completedAt:
|
|
3298
|
-
error:
|
|
3303
|
+
createdAt: z17.string(),
|
|
3304
|
+
completedAt: z17.string().nullable(),
|
|
3305
|
+
error: z17.string().nullable()
|
|
3299
3306
|
});
|
|
3300
|
-
var scheduleRunsResponseSchema =
|
|
3301
|
-
runs:
|
|
3307
|
+
var scheduleRunsResponseSchema = z17.object({
|
|
3308
|
+
runs: z17.array(runSummarySchema)
|
|
3302
3309
|
});
|
|
3303
|
-
var scheduleListResponseSchema =
|
|
3304
|
-
schedules:
|
|
3310
|
+
var scheduleListResponseSchema = z17.object({
|
|
3311
|
+
schedules: z17.array(scheduleResponseSchema)
|
|
3305
3312
|
});
|
|
3306
|
-
var deployScheduleResponseSchema =
|
|
3313
|
+
var deployScheduleResponseSchema = z17.object({
|
|
3307
3314
|
schedule: scheduleResponseSchema,
|
|
3308
|
-
created:
|
|
3315
|
+
created: z17.boolean()
|
|
3309
3316
|
// true if created, false if updated
|
|
3310
3317
|
});
|
|
3311
3318
|
var schedulesMainContract = c14.router({
|
|
@@ -3353,11 +3360,11 @@ var schedulesByNameContract = c14.router({
|
|
|
3353
3360
|
method: "GET",
|
|
3354
3361
|
path: "/api/agent/schedules/:name",
|
|
3355
3362
|
headers: authHeadersSchema,
|
|
3356
|
-
pathParams:
|
|
3357
|
-
name:
|
|
3363
|
+
pathParams: z17.object({
|
|
3364
|
+
name: z17.string().min(1, "Schedule name required")
|
|
3358
3365
|
}),
|
|
3359
|
-
query:
|
|
3360
|
-
composeId:
|
|
3366
|
+
query: z17.object({
|
|
3367
|
+
composeId: z17.string().uuid("Compose ID required")
|
|
3361
3368
|
}),
|
|
3362
3369
|
responses: {
|
|
3363
3370
|
200: scheduleResponseSchema,
|
|
@@ -3374,11 +3381,11 @@ var schedulesByNameContract = c14.router({
|
|
|
3374
3381
|
method: "DELETE",
|
|
3375
3382
|
path: "/api/agent/schedules/:name",
|
|
3376
3383
|
headers: authHeadersSchema,
|
|
3377
|
-
pathParams:
|
|
3378
|
-
name:
|
|
3384
|
+
pathParams: z17.object({
|
|
3385
|
+
name: z17.string().min(1, "Schedule name required")
|
|
3379
3386
|
}),
|
|
3380
|
-
query:
|
|
3381
|
-
composeId:
|
|
3387
|
+
query: z17.object({
|
|
3388
|
+
composeId: z17.string().uuid("Compose ID required")
|
|
3382
3389
|
}),
|
|
3383
3390
|
responses: {
|
|
3384
3391
|
204: c14.noBody(),
|
|
@@ -3397,11 +3404,11 @@ var schedulesEnableContract = c14.router({
|
|
|
3397
3404
|
method: "POST",
|
|
3398
3405
|
path: "/api/agent/schedules/:name/enable",
|
|
3399
3406
|
headers: authHeadersSchema,
|
|
3400
|
-
pathParams:
|
|
3401
|
-
name:
|
|
3407
|
+
pathParams: z17.object({
|
|
3408
|
+
name: z17.string().min(1, "Schedule name required")
|
|
3402
3409
|
}),
|
|
3403
|
-
body:
|
|
3404
|
-
composeId:
|
|
3410
|
+
body: z17.object({
|
|
3411
|
+
composeId: z17.string().uuid("Compose ID required")
|
|
3405
3412
|
}),
|
|
3406
3413
|
responses: {
|
|
3407
3414
|
200: scheduleResponseSchema,
|
|
@@ -3418,11 +3425,11 @@ var schedulesEnableContract = c14.router({
|
|
|
3418
3425
|
method: "POST",
|
|
3419
3426
|
path: "/api/agent/schedules/:name/disable",
|
|
3420
3427
|
headers: authHeadersSchema,
|
|
3421
|
-
pathParams:
|
|
3422
|
-
name:
|
|
3428
|
+
pathParams: z17.object({
|
|
3429
|
+
name: z17.string().min(1, "Schedule name required")
|
|
3423
3430
|
}),
|
|
3424
|
-
body:
|
|
3425
|
-
composeId:
|
|
3431
|
+
body: z17.object({
|
|
3432
|
+
composeId: z17.string().uuid("Compose ID required")
|
|
3426
3433
|
}),
|
|
3427
3434
|
responses: {
|
|
3428
3435
|
200: scheduleResponseSchema,
|
|
@@ -3441,12 +3448,12 @@ var scheduleRunsContract = c14.router({
|
|
|
3441
3448
|
method: "GET",
|
|
3442
3449
|
path: "/api/agent/schedules/:name/runs",
|
|
3443
3450
|
headers: authHeadersSchema,
|
|
3444
|
-
pathParams:
|
|
3445
|
-
name:
|
|
3451
|
+
pathParams: z17.object({
|
|
3452
|
+
name: z17.string().min(1, "Schedule name required")
|
|
3446
3453
|
}),
|
|
3447
|
-
query:
|
|
3448
|
-
composeId:
|
|
3449
|
-
limit:
|
|
3454
|
+
query: z17.object({
|
|
3455
|
+
composeId: z17.string().uuid("Compose ID required"),
|
|
3456
|
+
limit: z17.coerce.number().min(0).max(100).default(5)
|
|
3450
3457
|
}),
|
|
3451
3458
|
responses: {
|
|
3452
3459
|
200: scheduleRunsResponseSchema,
|
|
@@ -3458,16 +3465,16 @@ var scheduleRunsContract = c14.router({
|
|
|
3458
3465
|
});
|
|
3459
3466
|
|
|
3460
3467
|
// ../../packages/core/src/contracts/realtime.ts
|
|
3461
|
-
import { z as
|
|
3468
|
+
import { z as z18 } from "zod";
|
|
3462
3469
|
var c15 = initContract();
|
|
3463
|
-
var ablyTokenRequestSchema =
|
|
3464
|
-
keyName:
|
|
3465
|
-
ttl:
|
|
3466
|
-
timestamp:
|
|
3467
|
-
capability:
|
|
3468
|
-
clientId:
|
|
3469
|
-
nonce:
|
|
3470
|
-
mac:
|
|
3470
|
+
var ablyTokenRequestSchema = z18.object({
|
|
3471
|
+
keyName: z18.string(),
|
|
3472
|
+
ttl: z18.number().optional(),
|
|
3473
|
+
timestamp: z18.number(),
|
|
3474
|
+
capability: z18.string(),
|
|
3475
|
+
clientId: z18.string().optional(),
|
|
3476
|
+
nonce: z18.string(),
|
|
3477
|
+
mac: z18.string()
|
|
3471
3478
|
});
|
|
3472
3479
|
var runnerRealtimeTokenContract = c15.router({
|
|
3473
3480
|
/**
|
|
@@ -3478,7 +3485,7 @@ var runnerRealtimeTokenContract = c15.router({
|
|
|
3478
3485
|
method: "POST",
|
|
3479
3486
|
path: "/api/runners/realtime/token",
|
|
3480
3487
|
headers: authHeadersSchema,
|
|
3481
|
-
body:
|
|
3488
|
+
body: z18.object({
|
|
3482
3489
|
group: runnerGroupSchema
|
|
3483
3490
|
}),
|
|
3484
3491
|
responses: {
|
|
@@ -3492,22 +3499,22 @@ var runnerRealtimeTokenContract = c15.router({
|
|
|
3492
3499
|
});
|
|
3493
3500
|
|
|
3494
3501
|
// ../../packages/core/src/contracts/platform.ts
|
|
3495
|
-
import { z as
|
|
3496
|
-
var paginationSchema =
|
|
3497
|
-
hasMore:
|
|
3498
|
-
nextCursor:
|
|
3502
|
+
import { z as z19 } from "zod";
|
|
3503
|
+
var paginationSchema = z19.object({
|
|
3504
|
+
hasMore: z19.boolean(),
|
|
3505
|
+
nextCursor: z19.string().nullable()
|
|
3499
3506
|
});
|
|
3500
|
-
var listQuerySchema =
|
|
3501
|
-
cursor:
|
|
3502
|
-
limit:
|
|
3507
|
+
var listQuerySchema = z19.object({
|
|
3508
|
+
cursor: z19.string().optional(),
|
|
3509
|
+
limit: z19.coerce.number().min(1).max(100).default(20)
|
|
3503
3510
|
});
|
|
3504
3511
|
var c16 = initContract();
|
|
3505
|
-
var platformPaginationSchema =
|
|
3506
|
-
hasMore:
|
|
3507
|
-
nextCursor:
|
|
3508
|
-
totalPages:
|
|
3512
|
+
var platformPaginationSchema = z19.object({
|
|
3513
|
+
hasMore: z19.boolean(),
|
|
3514
|
+
nextCursor: z19.string().nullable(),
|
|
3515
|
+
totalPages: z19.number()
|
|
3509
3516
|
});
|
|
3510
|
-
var platformLogStatusSchema =
|
|
3517
|
+
var platformLogStatusSchema = z19.enum([
|
|
3511
3518
|
"queued",
|
|
3512
3519
|
"pending",
|
|
3513
3520
|
"running",
|
|
@@ -3516,36 +3523,36 @@ var platformLogStatusSchema = z18.enum([
|
|
|
3516
3523
|
"timeout",
|
|
3517
3524
|
"cancelled"
|
|
3518
3525
|
]);
|
|
3519
|
-
var platformLogEntrySchema =
|
|
3520
|
-
id:
|
|
3521
|
-
sessionId:
|
|
3522
|
-
agentName:
|
|
3523
|
-
orgSlug:
|
|
3524
|
-
framework:
|
|
3526
|
+
var platformLogEntrySchema = z19.object({
|
|
3527
|
+
id: z19.string().uuid(),
|
|
3528
|
+
sessionId: z19.string().nullable(),
|
|
3529
|
+
agentName: z19.string(),
|
|
3530
|
+
orgSlug: z19.string().nullable(),
|
|
3531
|
+
framework: z19.string().nullable(),
|
|
3525
3532
|
status: platformLogStatusSchema,
|
|
3526
|
-
createdAt:
|
|
3527
|
-
startedAt:
|
|
3528
|
-
completedAt:
|
|
3533
|
+
createdAt: z19.string(),
|
|
3534
|
+
startedAt: z19.string().nullable(),
|
|
3535
|
+
completedAt: z19.string().nullable()
|
|
3529
3536
|
});
|
|
3530
|
-
var platformLogsListResponseSchema =
|
|
3531
|
-
data:
|
|
3537
|
+
var platformLogsListResponseSchema = z19.object({
|
|
3538
|
+
data: z19.array(platformLogEntrySchema),
|
|
3532
3539
|
pagination: platformPaginationSchema
|
|
3533
3540
|
});
|
|
3534
|
-
var artifactSchema =
|
|
3535
|
-
name:
|
|
3536
|
-
version:
|
|
3541
|
+
var artifactSchema = z19.object({
|
|
3542
|
+
name: z19.string().nullable(),
|
|
3543
|
+
version: z19.string().nullable()
|
|
3537
3544
|
});
|
|
3538
|
-
var platformLogDetailSchema =
|
|
3539
|
-
id:
|
|
3540
|
-
sessionId:
|
|
3541
|
-
agentName:
|
|
3542
|
-
framework:
|
|
3545
|
+
var platformLogDetailSchema = z19.object({
|
|
3546
|
+
id: z19.string().uuid(),
|
|
3547
|
+
sessionId: z19.string().nullable(),
|
|
3548
|
+
agentName: z19.string(),
|
|
3549
|
+
framework: z19.string().nullable(),
|
|
3543
3550
|
status: platformLogStatusSchema,
|
|
3544
|
-
prompt:
|
|
3545
|
-
error:
|
|
3546
|
-
createdAt:
|
|
3547
|
-
startedAt:
|
|
3548
|
-
completedAt:
|
|
3551
|
+
prompt: z19.string(),
|
|
3552
|
+
error: z19.string().nullable(),
|
|
3553
|
+
createdAt: z19.string(),
|
|
3554
|
+
startedAt: z19.string().nullable(),
|
|
3555
|
+
completedAt: z19.string().nullable(),
|
|
3549
3556
|
artifact: artifactSchema
|
|
3550
3557
|
});
|
|
3551
3558
|
var platformLogsListContract = c16.router({
|
|
@@ -3553,10 +3560,10 @@ var platformLogsListContract = c16.router({
|
|
|
3553
3560
|
method: "GET",
|
|
3554
3561
|
path: "/api/platform/logs",
|
|
3555
3562
|
query: listQuerySchema.extend({
|
|
3556
|
-
search:
|
|
3557
|
-
agent:
|
|
3558
|
-
name:
|
|
3559
|
-
org:
|
|
3563
|
+
search: z19.string().optional(),
|
|
3564
|
+
agent: z19.string().optional(),
|
|
3565
|
+
name: z19.string().optional(),
|
|
3566
|
+
org: z19.string().optional(),
|
|
3560
3567
|
status: platformLogStatusSchema.optional()
|
|
3561
3568
|
}),
|
|
3562
3569
|
responses: {
|
|
@@ -3571,8 +3578,8 @@ var platformLogsByIdContract = c16.router({
|
|
|
3571
3578
|
method: "GET",
|
|
3572
3579
|
path: "/api/platform/logs/:id",
|
|
3573
3580
|
headers: authHeadersSchema,
|
|
3574
|
-
pathParams:
|
|
3575
|
-
id:
|
|
3581
|
+
pathParams: z19.object({
|
|
3582
|
+
id: z19.string().uuid("Invalid log ID")
|
|
3576
3583
|
}),
|
|
3577
3584
|
responses: {
|
|
3578
3585
|
200: platformLogDetailSchema,
|
|
@@ -3582,17 +3589,17 @@ var platformLogsByIdContract = c16.router({
|
|
|
3582
3589
|
summary: "Get agent run log details by ID"
|
|
3583
3590
|
}
|
|
3584
3591
|
});
|
|
3585
|
-
var artifactDownloadResponseSchema =
|
|
3586
|
-
url:
|
|
3587
|
-
expiresAt:
|
|
3592
|
+
var artifactDownloadResponseSchema = z19.object({
|
|
3593
|
+
url: z19.string().url(),
|
|
3594
|
+
expiresAt: z19.string()
|
|
3588
3595
|
});
|
|
3589
3596
|
var platformArtifactDownloadContract = c16.router({
|
|
3590
3597
|
getDownloadUrl: {
|
|
3591
3598
|
method: "GET",
|
|
3592
3599
|
path: "/api/platform/artifacts/download",
|
|
3593
|
-
query:
|
|
3594
|
-
name:
|
|
3595
|
-
version:
|
|
3600
|
+
query: z19.object({
|
|
3601
|
+
name: z19.string().min(1, "Artifact name is required"),
|
|
3602
|
+
version: z19.string().optional()
|
|
3596
3603
|
}),
|
|
3597
3604
|
responses: {
|
|
3598
3605
|
200: artifactDownloadResponseSchema,
|
|
@@ -3604,41 +3611,41 @@ var platformArtifactDownloadContract = c16.router({
|
|
|
3604
3611
|
});
|
|
3605
3612
|
|
|
3606
3613
|
// ../../packages/core/src/contracts/compose-jobs.ts
|
|
3607
|
-
import { z as
|
|
3614
|
+
import { z as z20 } from "zod";
|
|
3608
3615
|
var c17 = initContract();
|
|
3609
|
-
var composeJobStatusSchema =
|
|
3616
|
+
var composeJobStatusSchema = z20.enum([
|
|
3610
3617
|
"pending",
|
|
3611
3618
|
"running",
|
|
3612
3619
|
"completed",
|
|
3613
3620
|
"failed"
|
|
3614
3621
|
]);
|
|
3615
|
-
var composeJobResultSchema =
|
|
3616
|
-
composeId:
|
|
3617
|
-
composeName:
|
|
3618
|
-
versionId:
|
|
3619
|
-
warnings:
|
|
3622
|
+
var composeJobResultSchema = z20.object({
|
|
3623
|
+
composeId: z20.string(),
|
|
3624
|
+
composeName: z20.string(),
|
|
3625
|
+
versionId: z20.string(),
|
|
3626
|
+
warnings: z20.array(z20.string())
|
|
3620
3627
|
});
|
|
3621
|
-
var composeJobSourceSchema =
|
|
3622
|
-
var createComposeJobRequestSchema =
|
|
3623
|
-
|
|
3624
|
-
githubUrl:
|
|
3625
|
-
overwrite:
|
|
3628
|
+
var composeJobSourceSchema = z20.enum(["github", "platform", "slack"]);
|
|
3629
|
+
var createComposeJobRequestSchema = z20.union([
|
|
3630
|
+
z20.object({
|
|
3631
|
+
githubUrl: z20.string().url().startsWith("https://github.com/"),
|
|
3632
|
+
overwrite: z20.boolean().optional().default(false)
|
|
3626
3633
|
}),
|
|
3627
|
-
|
|
3628
|
-
content:
|
|
3629
|
-
instructions:
|
|
3634
|
+
z20.object({
|
|
3635
|
+
content: z20.record(z20.string(), z20.unknown()),
|
|
3636
|
+
instructions: z20.string().optional()
|
|
3630
3637
|
})
|
|
3631
3638
|
]);
|
|
3632
|
-
var composeJobResponseSchema =
|
|
3633
|
-
jobId:
|
|
3639
|
+
var composeJobResponseSchema = z20.object({
|
|
3640
|
+
jobId: z20.string(),
|
|
3634
3641
|
status: composeJobStatusSchema,
|
|
3635
|
-
githubUrl:
|
|
3642
|
+
githubUrl: z20.string().optional(),
|
|
3636
3643
|
source: composeJobSourceSchema.optional(),
|
|
3637
3644
|
result: composeJobResultSchema.optional(),
|
|
3638
|
-
error:
|
|
3639
|
-
createdAt:
|
|
3640
|
-
startedAt:
|
|
3641
|
-
completedAt:
|
|
3645
|
+
error: z20.string().optional(),
|
|
3646
|
+
createdAt: z20.string(),
|
|
3647
|
+
startedAt: z20.string().optional(),
|
|
3648
|
+
completedAt: z20.string().optional()
|
|
3642
3649
|
});
|
|
3643
3650
|
var composeJobsMainContract = c17.router({
|
|
3644
3651
|
/**
|
|
@@ -3669,8 +3676,8 @@ var composeJobsByIdContract = c17.router({
|
|
|
3669
3676
|
method: "GET",
|
|
3670
3677
|
path: "/api/compose/jobs/:jobId",
|
|
3671
3678
|
headers: authHeadersSchema,
|
|
3672
|
-
pathParams:
|
|
3673
|
-
jobId:
|
|
3679
|
+
pathParams: z20.object({
|
|
3680
|
+
jobId: z20.string().uuid()
|
|
3674
3681
|
}),
|
|
3675
3682
|
responses: {
|
|
3676
3683
|
200: composeJobResponseSchema,
|
|
@@ -3689,16 +3696,16 @@ var webhookComposeCompleteContract = c17.router({
|
|
|
3689
3696
|
method: "POST",
|
|
3690
3697
|
path: "/api/webhooks/compose/complete",
|
|
3691
3698
|
headers: authHeadersSchema,
|
|
3692
|
-
body:
|
|
3693
|
-
jobId:
|
|
3694
|
-
success:
|
|
3699
|
+
body: z20.object({
|
|
3700
|
+
jobId: z20.string().uuid(),
|
|
3701
|
+
success: z20.boolean(),
|
|
3695
3702
|
// Result from CLI compose command
|
|
3696
3703
|
result: composeJobResultSchema.optional(),
|
|
3697
|
-
error:
|
|
3704
|
+
error: z20.string().optional()
|
|
3698
3705
|
}),
|
|
3699
3706
|
responses: {
|
|
3700
|
-
200:
|
|
3701
|
-
success:
|
|
3707
|
+
200: z20.object({
|
|
3708
|
+
success: z20.boolean()
|
|
3702
3709
|
}),
|
|
3703
3710
|
400: apiErrorSchema,
|
|
3704
3711
|
401: apiErrorSchema,
|
|
@@ -3709,7 +3716,7 @@ var webhookComposeCompleteContract = c17.router({
|
|
|
3709
3716
|
});
|
|
3710
3717
|
|
|
3711
3718
|
// ../../packages/core/src/contracts/connectors.ts
|
|
3712
|
-
import { z as
|
|
3719
|
+
import { z as z21 } from "zod";
|
|
3713
3720
|
var c18 = initContract();
|
|
3714
3721
|
var CONNECTOR_TYPES_DEF = {
|
|
3715
3722
|
axiom: {
|
|
@@ -6194,7 +6201,7 @@ var CONNECTOR_TYPES_DEF = {
|
|
|
6194
6201
|
}
|
|
6195
6202
|
};
|
|
6196
6203
|
var CONNECTOR_TYPES = CONNECTOR_TYPES_DEF;
|
|
6197
|
-
var connectorTypeSchema =
|
|
6204
|
+
var connectorTypeSchema = z21.enum([
|
|
6198
6205
|
"agentmail",
|
|
6199
6206
|
"ahrefs",
|
|
6200
6207
|
"atlassian",
|
|
@@ -6322,21 +6329,21 @@ function getConnectorDerivedNames(secretName) {
|
|
|
6322
6329
|
}
|
|
6323
6330
|
return null;
|
|
6324
6331
|
}
|
|
6325
|
-
var connectorResponseSchema =
|
|
6326
|
-
id:
|
|
6332
|
+
var connectorResponseSchema = z21.object({
|
|
6333
|
+
id: z21.string().uuid().nullable(),
|
|
6327
6334
|
type: connectorTypeSchema,
|
|
6328
|
-
authMethod:
|
|
6329
|
-
externalId:
|
|
6330
|
-
externalUsername:
|
|
6331
|
-
externalEmail:
|
|
6332
|
-
oauthScopes:
|
|
6333
|
-
createdAt:
|
|
6334
|
-
updatedAt:
|
|
6335
|
+
authMethod: z21.string(),
|
|
6336
|
+
externalId: z21.string().nullable(),
|
|
6337
|
+
externalUsername: z21.string().nullable(),
|
|
6338
|
+
externalEmail: z21.string().nullable(),
|
|
6339
|
+
oauthScopes: z21.array(z21.string()).nullable(),
|
|
6340
|
+
createdAt: z21.string(),
|
|
6341
|
+
updatedAt: z21.string()
|
|
6335
6342
|
});
|
|
6336
|
-
var connectorListResponseSchema =
|
|
6337
|
-
connectors:
|
|
6338
|
-
configuredTypes:
|
|
6339
|
-
connectorProvidedSecretNames:
|
|
6343
|
+
var connectorListResponseSchema = z21.object({
|
|
6344
|
+
connectors: z21.array(connectorResponseSchema),
|
|
6345
|
+
configuredTypes: z21.array(connectorTypeSchema),
|
|
6346
|
+
connectorProvidedSecretNames: z21.array(z21.string())
|
|
6340
6347
|
});
|
|
6341
6348
|
var connectorsMainContract = c18.router({
|
|
6342
6349
|
list: {
|
|
@@ -6356,7 +6363,7 @@ var connectorsByTypeContract = c18.router({
|
|
|
6356
6363
|
method: "GET",
|
|
6357
6364
|
path: "/api/connectors/:type",
|
|
6358
6365
|
headers: authHeadersSchema,
|
|
6359
|
-
pathParams:
|
|
6366
|
+
pathParams: z21.object({
|
|
6360
6367
|
type: connectorTypeSchema
|
|
6361
6368
|
}),
|
|
6362
6369
|
responses: {
|
|
@@ -6371,7 +6378,7 @@ var connectorsByTypeContract = c18.router({
|
|
|
6371
6378
|
method: "DELETE",
|
|
6372
6379
|
path: "/api/connectors/:type",
|
|
6373
6380
|
headers: authHeadersSchema,
|
|
6374
|
-
pathParams:
|
|
6381
|
+
pathParams: z21.object({
|
|
6375
6382
|
type: connectorTypeSchema
|
|
6376
6383
|
}),
|
|
6377
6384
|
responses: {
|
|
@@ -6383,25 +6390,25 @@ var connectorsByTypeContract = c18.router({
|
|
|
6383
6390
|
summary: "Disconnect a connector"
|
|
6384
6391
|
}
|
|
6385
6392
|
});
|
|
6386
|
-
var connectorSessionStatusSchema =
|
|
6393
|
+
var connectorSessionStatusSchema = z21.enum([
|
|
6387
6394
|
"pending",
|
|
6388
6395
|
"complete",
|
|
6389
6396
|
"expired",
|
|
6390
6397
|
"error"
|
|
6391
6398
|
]);
|
|
6392
|
-
var connectorSessionResponseSchema =
|
|
6393
|
-
id:
|
|
6394
|
-
code:
|
|
6399
|
+
var connectorSessionResponseSchema = z21.object({
|
|
6400
|
+
id: z21.string().uuid(),
|
|
6401
|
+
code: z21.string(),
|
|
6395
6402
|
type: connectorTypeSchema,
|
|
6396
6403
|
status: connectorSessionStatusSchema,
|
|
6397
|
-
verificationUrl:
|
|
6398
|
-
expiresIn:
|
|
6399
|
-
interval:
|
|
6400
|
-
errorMessage:
|
|
6404
|
+
verificationUrl: z21.string(),
|
|
6405
|
+
expiresIn: z21.number(),
|
|
6406
|
+
interval: z21.number(),
|
|
6407
|
+
errorMessage: z21.string().nullable().optional()
|
|
6401
6408
|
});
|
|
6402
|
-
var connectorSessionStatusResponseSchema =
|
|
6409
|
+
var connectorSessionStatusResponseSchema = z21.object({
|
|
6403
6410
|
status: connectorSessionStatusSchema,
|
|
6404
|
-
errorMessage:
|
|
6411
|
+
errorMessage: z21.string().nullable().optional()
|
|
6405
6412
|
});
|
|
6406
6413
|
var connectorSessionsContract = c18.router({
|
|
6407
6414
|
/**
|
|
@@ -6412,10 +6419,10 @@ var connectorSessionsContract = c18.router({
|
|
|
6412
6419
|
method: "POST",
|
|
6413
6420
|
path: "/api/connectors/:type/sessions",
|
|
6414
6421
|
headers: authHeadersSchema,
|
|
6415
|
-
pathParams:
|
|
6422
|
+
pathParams: z21.object({
|
|
6416
6423
|
type: connectorTypeSchema
|
|
6417
6424
|
}),
|
|
6418
|
-
body:
|
|
6425
|
+
body: z21.object({}).optional(),
|
|
6419
6426
|
responses: {
|
|
6420
6427
|
200: connectorSessionResponseSchema,
|
|
6421
6428
|
400: apiErrorSchema,
|
|
@@ -6434,9 +6441,9 @@ var connectorSessionByIdContract = c18.router({
|
|
|
6434
6441
|
method: "GET",
|
|
6435
6442
|
path: "/api/connectors/:type/sessions/:sessionId",
|
|
6436
6443
|
headers: authHeadersSchema,
|
|
6437
|
-
pathParams:
|
|
6444
|
+
pathParams: z21.object({
|
|
6438
6445
|
type: connectorTypeSchema,
|
|
6439
|
-
sessionId:
|
|
6446
|
+
sessionId: z21.string().uuid()
|
|
6440
6447
|
}),
|
|
6441
6448
|
responses: {
|
|
6442
6449
|
200: connectorSessionStatusResponseSchema,
|
|
@@ -6448,19 +6455,19 @@ var connectorSessionByIdContract = c18.router({
|
|
|
6448
6455
|
summary: "Get connector session status"
|
|
6449
6456
|
}
|
|
6450
6457
|
});
|
|
6451
|
-
var computerConnectorCreateResponseSchema =
|
|
6452
|
-
id:
|
|
6453
|
-
ngrokToken:
|
|
6454
|
-
bridgeToken:
|
|
6455
|
-
endpointPrefix:
|
|
6456
|
-
domain:
|
|
6458
|
+
var computerConnectorCreateResponseSchema = z21.object({
|
|
6459
|
+
id: z21.string().uuid(),
|
|
6460
|
+
ngrokToken: z21.string(),
|
|
6461
|
+
bridgeToken: z21.string(),
|
|
6462
|
+
endpointPrefix: z21.string(),
|
|
6463
|
+
domain: z21.string()
|
|
6457
6464
|
});
|
|
6458
6465
|
var computerConnectorContract = c18.router({
|
|
6459
6466
|
create: {
|
|
6460
6467
|
method: "POST",
|
|
6461
6468
|
path: "/api/connectors/computer",
|
|
6462
6469
|
headers: authHeadersSchema,
|
|
6463
|
-
body:
|
|
6470
|
+
body: z21.object({}).optional(),
|
|
6464
6471
|
responses: {
|
|
6465
6472
|
200: computerConnectorCreateResponseSchema,
|
|
6466
6473
|
400: apiErrorSchema,
|
|
@@ -6478,605 +6485,187 @@ var computerConnectorContract = c18.router({
|
|
|
6478
6485
|
200: connectorResponseSchema,
|
|
6479
6486
|
401: apiErrorSchema,
|
|
6480
6487
|
404: apiErrorSchema
|
|
6481
|
-
},
|
|
6482
|
-
summary: "Get computer connector status"
|
|
6483
|
-
},
|
|
6484
|
-
delete: {
|
|
6485
|
-
method: "DELETE",
|
|
6486
|
-
path: "/api/connectors/computer",
|
|
6487
|
-
headers: authHeadersSchema,
|
|
6488
|
-
responses: {
|
|
6489
|
-
204: c18.noBody(),
|
|
6490
|
-
401: apiErrorSchema,
|
|
6491
|
-
404: apiErrorSchema,
|
|
6492
|
-
500: apiErrorSchema
|
|
6493
|
-
},
|
|
6494
|
-
summary: "Delete computer connector and revoke ngrok credentials"
|
|
6495
|
-
}
|
|
6496
|
-
});
|
|
6497
|
-
|
|
6498
|
-
// ../../packages/core/src/contracts/firewall.ts
|
|
6499
|
-
function bearerAuth(secretName) {
|
|
6500
|
-
return { headers: { Authorization: `Bearer \${{ secrets.${secretName} }}` } };
|
|
6501
|
-
}
|
|
6502
|
-
var FULL_ACCESS_PERMISSION = {
|
|
6503
|
-
name: "full-access",
|
|
6504
|
-
rules: ["ANY /{path+}"]
|
|
6505
|
-
};
|
|
6506
|
-
function api(base, auth) {
|
|
6507
|
-
return { base, auth, permissions: [FULL_ACCESS_PERMISSION] };
|
|
6508
|
-
}
|
|
6509
|
-
var FIREWALL_CONFIGS = {
|
|
6510
|
-
ahrefs: {
|
|
6511
|
-
apis: [api("https://api.ahrefs.com", bearerAuth("AHREFS_TOKEN"))]
|
|
6512
|
-
},
|
|
6513
|
-
axiom: {
|
|
6514
|
-
apis: [api("https://api.axiom.co", bearerAuth("AXIOM_TOKEN"))]
|
|
6515
|
-
},
|
|
6516
|
-
airtable: {
|
|
6517
|
-
apis: [api("https://api.airtable.com", bearerAuth("AIRTABLE_TOKEN"))]
|
|
6518
|
-
},
|
|
6519
|
-
github: {
|
|
6520
|
-
apis: [
|
|
6521
|
-
{
|
|
6522
|
-
base: "https://api.github.com",
|
|
6523
|
-
auth: bearerAuth("GITHUB_TOKEN"),
|
|
6524
|
-
permissions: [
|
|
6525
|
-
{
|
|
6526
|
-
name: "repo-read",
|
|
6527
|
-
description: "Read repository metadata, branches, and commits",
|
|
6528
|
-
rules: [
|
|
6529
|
-
"GET /repos/{owner}/{repo}",
|
|
6530
|
-
"GET /repos/{owner}/{repo}/branches",
|
|
6531
|
-
"GET /repos/{owner}/{repo}/branches/{branch}",
|
|
6532
|
-
"GET /repos/{owner}/{repo}/commits",
|
|
6533
|
-
"GET /repos/{owner}/{repo}/commits/{ref}",
|
|
6534
|
-
"GET /repos/{owner}/{repo}/contributors",
|
|
6535
|
-
"GET /repos/{owner}/{repo}/tags",
|
|
6536
|
-
"GET /repos/{owner}/{repo}/releases",
|
|
6537
|
-
"GET /repos/{owner}/{repo}/releases/{release_id}"
|
|
6538
|
-
]
|
|
6539
|
-
},
|
|
6540
|
-
{
|
|
6541
|
-
name: "contents-read",
|
|
6542
|
-
description: "Read file contents and directory listings",
|
|
6543
|
-
rules: [
|
|
6544
|
-
"GET /repos/{owner}/{repo}/contents/{path+}",
|
|
6545
|
-
"GET /repos/{owner}/{repo}/readme",
|
|
6546
|
-
"GET /repos/{owner}/{repo}/git/trees/{sha}",
|
|
6547
|
-
"GET /repos/{owner}/{repo}/git/blobs/{sha}",
|
|
6548
|
-
"GET /repos/{owner}/{repo}/git/refs/{ref+}"
|
|
6549
|
-
]
|
|
6550
|
-
},
|
|
6551
|
-
{
|
|
6552
|
-
name: "contents-write",
|
|
6553
|
-
description: "Create, update, and delete file contents",
|
|
6554
|
-
rules: [
|
|
6555
|
-
"PUT /repos/{owner}/{repo}/contents/{path+}",
|
|
6556
|
-
"DELETE /repos/{owner}/{repo}/contents/{path+}",
|
|
6557
|
-
"POST /repos/{owner}/{repo}/git/blobs",
|
|
6558
|
-
"POST /repos/{owner}/{repo}/git/trees",
|
|
6559
|
-
"POST /repos/{owner}/{repo}/git/commits",
|
|
6560
|
-
"POST /repos/{owner}/{repo}/git/refs",
|
|
6561
|
-
"PATCH /repos/{owner}/{repo}/git/refs/{ref+}"
|
|
6562
|
-
]
|
|
6563
|
-
},
|
|
6564
|
-
{
|
|
6565
|
-
name: "issues-read",
|
|
6566
|
-
description: "Read issues and comments",
|
|
6567
|
-
rules: [
|
|
6568
|
-
"GET /repos/{owner}/{repo}/issues",
|
|
6569
|
-
"GET /repos/{owner}/{repo}/issues/{issue_number}",
|
|
6570
|
-
"GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
|
|
6571
|
-
"GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
|
|
6572
|
-
"GET /repos/{owner}/{repo}/labels"
|
|
6573
|
-
]
|
|
6574
|
-
},
|
|
6575
|
-
{
|
|
6576
|
-
name: "issues-write",
|
|
6577
|
-
description: "Create and update issues, comments, and labels",
|
|
6578
|
-
rules: [
|
|
6579
|
-
"POST /repos/{owner}/{repo}/issues",
|
|
6580
|
-
"PATCH /repos/{owner}/{repo}/issues/{issue_number}",
|
|
6581
|
-
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
|
|
6582
|
-
"PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}",
|
|
6583
|
-
"POST /repos/{owner}/{repo}/issues/{issue_number}/labels",
|
|
6584
|
-
"DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"
|
|
6585
|
-
]
|
|
6586
|
-
},
|
|
6587
|
-
{
|
|
6588
|
-
name: "pull-requests-read",
|
|
6589
|
-
description: "Read pull requests, reviews, and diffs",
|
|
6590
|
-
rules: [
|
|
6591
|
-
"GET /repos/{owner}/{repo}/pulls",
|
|
6592
|
-
"GET /repos/{owner}/{repo}/pulls/{pull_number}",
|
|
6593
|
-
"GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
|
|
6594
|
-
"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
|
|
6595
|
-
"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
|
|
6596
|
-
"GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"
|
|
6597
|
-
]
|
|
6598
|
-
},
|
|
6599
|
-
{
|
|
6600
|
-
name: "pull-requests-write",
|
|
6601
|
-
description: "Create, update, and merge pull requests",
|
|
6602
|
-
rules: [
|
|
6603
|
-
"POST /repos/{owner}/{repo}/pulls",
|
|
6604
|
-
"PATCH /repos/{owner}/{repo}/pulls/{pull_number}",
|
|
6605
|
-
"POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
|
|
6606
|
-
"POST /repos/{owner}/{repo}/pulls/{pull_number}/comments",
|
|
6607
|
-
"PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"
|
|
6608
|
-
]
|
|
6609
|
-
},
|
|
6610
|
-
{
|
|
6611
|
-
name: "actions-read",
|
|
6612
|
-
description: "Read workflow runs and logs",
|
|
6613
|
-
rules: [
|
|
6614
|
-
"GET /repos/{owner}/{repo}/actions/runs",
|
|
6615
|
-
"GET /repos/{owner}/{repo}/actions/runs/{run_id}",
|
|
6616
|
-
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
|
|
6617
|
-
"GET /repos/{owner}/{repo}/actions/workflows",
|
|
6618
|
-
"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
|
|
6619
|
-
]
|
|
6620
|
-
},
|
|
6621
|
-
{
|
|
6622
|
-
name: "user-read",
|
|
6623
|
-
description: "Read authenticated user profile and related data",
|
|
6624
|
-
rules: [
|
|
6625
|
-
"GET /user",
|
|
6626
|
-
"GET /user/emails",
|
|
6627
|
-
"GET /user/repos",
|
|
6628
|
-
"GET /user/orgs",
|
|
6629
|
-
"GET /user/teams",
|
|
6630
|
-
"GET /user/starred",
|
|
6631
|
-
"GET /user/subscriptions",
|
|
6632
|
-
"GET /users/{username}",
|
|
6633
|
-
"GET /users/{username}/repos",
|
|
6634
|
-
"GET /users/{username}/orgs"
|
|
6635
|
-
]
|
|
6636
|
-
},
|
|
6637
|
-
{
|
|
6638
|
-
name: "user-write",
|
|
6639
|
-
description: "Update user profile, manage starred repos and email",
|
|
6640
|
-
rules: [
|
|
6641
|
-
"PATCH /user",
|
|
6642
|
-
"POST /user/emails",
|
|
6643
|
-
"DELETE /user/emails",
|
|
6644
|
-
"PUT /user/starred/{owner}/{repo}",
|
|
6645
|
-
"DELETE /user/starred/{owner}/{repo}"
|
|
6646
|
-
]
|
|
6647
|
-
},
|
|
6648
|
-
{
|
|
6649
|
-
name: "search",
|
|
6650
|
-
description: "Search code, issues, and repositories",
|
|
6651
|
-
rules: [
|
|
6652
|
-
"GET /search/code",
|
|
6653
|
-
"GET /search/issues",
|
|
6654
|
-
"GET /search/repositories",
|
|
6655
|
-
"GET /search/commits"
|
|
6656
|
-
]
|
|
6657
|
-
}
|
|
6658
|
-
]
|
|
6659
|
-
}
|
|
6660
|
-
],
|
|
6661
|
-
placeholders: {
|
|
6662
|
-
GITHUB_TOKEN: "gho_vm0placeholder0000000000000000000000"
|
|
6663
|
-
}
|
|
6664
|
-
},
|
|
6665
|
-
notion: {
|
|
6666
|
-
apis: [
|
|
6667
|
-
api("https://api.notion.com/v1", {
|
|
6668
|
-
headers: {
|
|
6669
|
-
Authorization: "Bearer ${{ secrets.NOTION_TOKEN }}",
|
|
6670
|
-
"Notion-Version": "2022-06-28"
|
|
6671
|
-
}
|
|
6672
|
-
})
|
|
6673
|
-
]
|
|
6674
|
-
},
|
|
6675
|
-
gmail: {
|
|
6676
|
-
apis: [
|
|
6677
|
-
api(
|
|
6678
|
-
"https://gmail.googleapis.com/gmail/v1/users/me",
|
|
6679
|
-
bearerAuth("GMAIL_TOKEN")
|
|
6680
|
-
)
|
|
6681
|
-
]
|
|
6682
|
-
},
|
|
6683
|
-
"google-sheets": {
|
|
6684
|
-
apis: [
|
|
6685
|
-
api(
|
|
6686
|
-
"https://sheets.googleapis.com/v4/spreadsheets",
|
|
6687
|
-
bearerAuth("GOOGLE_SHEETS_TOKEN")
|
|
6688
|
-
)
|
|
6689
|
-
]
|
|
6690
|
-
},
|
|
6691
|
-
"google-docs": {
|
|
6692
|
-
apis: [
|
|
6693
|
-
api(
|
|
6694
|
-
"https://docs.googleapis.com/v1/documents",
|
|
6695
|
-
bearerAuth("GOOGLE_DOCS_TOKEN")
|
|
6696
|
-
)
|
|
6697
|
-
]
|
|
6698
|
-
},
|
|
6699
|
-
"google-drive": {
|
|
6700
|
-
apis: [
|
|
6701
|
-
api(
|
|
6702
|
-
"https://www.googleapis.com/drive/v3",
|
|
6703
|
-
bearerAuth("GOOGLE_DRIVE_TOKEN")
|
|
6704
|
-
)
|
|
6705
|
-
]
|
|
6706
|
-
},
|
|
6707
|
-
"google-calendar": {
|
|
6708
|
-
apis: [
|
|
6709
|
-
api(
|
|
6710
|
-
"https://www.googleapis.com/calendar/v3",
|
|
6711
|
-
bearerAuth("GOOGLE_CALENDAR_TOKEN")
|
|
6712
|
-
)
|
|
6713
|
-
]
|
|
6714
|
-
},
|
|
6715
|
-
"hugging-face": {
|
|
6716
|
-
apis: [api("https://huggingface.co/api", bearerAuth("HUGGING_FACE_TOKEN"))]
|
|
6717
|
-
},
|
|
6718
|
-
hume: {
|
|
6719
|
-
apis: [
|
|
6720
|
-
api("https://api.hume.ai", {
|
|
6721
|
-
headers: { "X-Hume-Api-Key": "${{ secrets.HUME_TOKEN }}" }
|
|
6722
|
-
})
|
|
6723
|
-
]
|
|
6724
|
-
},
|
|
6725
|
-
heygen: {
|
|
6726
|
-
apis: [
|
|
6727
|
-
api("https://api.heygen.com", {
|
|
6728
|
-
headers: { "x-api-key": "${{ secrets.HEYGEN_TOKEN }}" }
|
|
6729
|
-
})
|
|
6730
|
-
]
|
|
6731
|
-
},
|
|
6732
|
-
hubspot: {
|
|
6733
|
-
apis: [api("https://api.hubapi.com", bearerAuth("HUBSPOT_TOKEN"))]
|
|
6734
|
-
},
|
|
6735
|
-
slack: {
|
|
6736
|
-
apis: [
|
|
6737
|
-
api("https://slack.com/api", bearerAuth("SLACK_TOKEN")),
|
|
6738
|
-
api("https://files.slack.com", bearerAuth("SLACK_TOKEN"))
|
|
6739
|
-
],
|
|
6740
|
-
placeholders: {
|
|
6741
|
-
SLACK_TOKEN: "xoxb-0000-0000-vm0placeholder"
|
|
6742
|
-
}
|
|
6743
|
-
},
|
|
6744
|
-
docusign: {
|
|
6745
|
-
apis: [
|
|
6746
|
-
api("https://demo.docusign.net/restapi", bearerAuth("DOCUSIGN_TOKEN")),
|
|
6747
|
-
api("https://na1.docusign.net/restapi", bearerAuth("DOCUSIGN_TOKEN"))
|
|
6748
|
-
]
|
|
6749
|
-
},
|
|
6750
|
-
dropbox: {
|
|
6751
|
-
apis: [
|
|
6752
|
-
api("https://api.dropboxapi.com/2", bearerAuth("DROPBOX_TOKEN")),
|
|
6753
|
-
api("https://content.dropboxapi.com/2", bearerAuth("DROPBOX_TOKEN"))
|
|
6754
|
-
]
|
|
6755
|
-
},
|
|
6756
|
-
linear: {
|
|
6757
|
-
apis: [api("https://api.linear.app", bearerAuth("LINEAR_TOKEN"))]
|
|
6758
|
-
},
|
|
6759
|
-
intercom: {
|
|
6760
|
-
apis: [
|
|
6761
|
-
api("https://api.intercom.io", bearerAuth("INTERCOM_TOKEN")),
|
|
6762
|
-
api("https://api.eu.intercom.io", bearerAuth("INTERCOM_TOKEN")),
|
|
6763
|
-
api("https://api.au.intercom.io", bearerAuth("INTERCOM_TOKEN"))
|
|
6764
|
-
]
|
|
6765
|
-
},
|
|
6766
|
-
jam: {
|
|
6767
|
-
apis: [api("https://api.jam.dev", bearerAuth("JAM_TOKEN"))]
|
|
6768
|
-
},
|
|
6769
|
-
jotform: {
|
|
6770
|
-
apis: [
|
|
6771
|
-
api("https://api.jotform.com", {
|
|
6772
|
-
headers: {
|
|
6773
|
-
APIKEY: "${{ secrets.JOTFORM_TOKEN }}"
|
|
6774
|
-
}
|
|
6775
|
-
}),
|
|
6776
|
-
api("https://eu-api.jotform.com", {
|
|
6777
|
-
headers: {
|
|
6778
|
-
APIKEY: "${{ secrets.JOTFORM_TOKEN }}"
|
|
6779
|
-
}
|
|
6780
|
-
})
|
|
6781
|
-
]
|
|
6782
|
-
},
|
|
6783
|
-
line: {
|
|
6784
|
-
apis: [api("https://api.line.me", bearerAuth("LINE_TOKEN"))]
|
|
6785
|
-
},
|
|
6786
|
-
make: {
|
|
6787
|
-
apis: [
|
|
6788
|
-
api("https://eu1.make.com/api/v2", {
|
|
6789
|
-
headers: {
|
|
6790
|
-
Authorization: "Token ${{ secrets.MAKE_TOKEN }}"
|
|
6791
|
-
}
|
|
6792
|
-
}),
|
|
6793
|
-
api("https://eu2.make.com/api/v2", {
|
|
6794
|
-
headers: {
|
|
6795
|
-
Authorization: "Token ${{ secrets.MAKE_TOKEN }}"
|
|
6796
|
-
}
|
|
6797
|
-
}),
|
|
6798
|
-
api("https://us1.make.com/api/v2", {
|
|
6799
|
-
headers: {
|
|
6800
|
-
Authorization: "Token ${{ secrets.MAKE_TOKEN }}"
|
|
6801
|
-
}
|
|
6802
|
-
}),
|
|
6803
|
-
api("https://us2.make.com/api/v2", {
|
|
6804
|
-
headers: {
|
|
6805
|
-
Authorization: "Token ${{ secrets.MAKE_TOKEN }}"
|
|
6806
|
-
}
|
|
6807
|
-
})
|
|
6808
|
-
]
|
|
6809
|
-
},
|
|
6810
|
-
metabase: {
|
|
6811
|
-
apis: [
|
|
6812
|
-
api("https://api.metabase.com", {
|
|
6813
|
-
headers: {
|
|
6814
|
-
"x-api-key": "${{ secrets.METABASE_TOKEN }}"
|
|
6815
|
-
}
|
|
6816
|
-
})
|
|
6817
|
-
]
|
|
6818
|
-
},
|
|
6819
|
-
clickup: {
|
|
6820
|
-
apis: [api("https://api.clickup.com/api/v2", bearerAuth("CLICKUP_TOKEN"))]
|
|
6821
|
-
},
|
|
6822
|
-
cloudflare: {
|
|
6823
|
-
apis: [
|
|
6824
|
-
api(
|
|
6825
|
-
"https://api.cloudflare.com/client/v4",
|
|
6826
|
-
bearerAuth("CLOUDFLARE_TOKEN")
|
|
6827
|
-
)
|
|
6828
|
-
]
|
|
6829
|
-
},
|
|
6830
|
-
deel: {
|
|
6831
|
-
apis: [api("https://api.deel.com", bearerAuth("DEEL_TOKEN"))]
|
|
6832
|
-
},
|
|
6833
|
-
deepseek: {
|
|
6834
|
-
apis: [api("https://api.deepseek.com", bearerAuth("DEEPSEEK_TOKEN"))]
|
|
6835
|
-
},
|
|
6836
|
-
dify: {
|
|
6837
|
-
apis: [api("https://api.dify.ai/v1", bearerAuth("DIFY_TOKEN"))]
|
|
6838
|
-
},
|
|
6839
|
-
figma: {
|
|
6840
|
-
apis: [api("https://api.figma.com", bearerAuth("FIGMA_TOKEN"))]
|
|
6841
|
-
},
|
|
6842
|
-
mercury: {
|
|
6843
|
-
apis: [api("https://api.mercury.com", bearerAuth("MERCURY_TOKEN"))]
|
|
6844
|
-
},
|
|
6845
|
-
minimax: {
|
|
6846
|
-
apis: [api("https://api.minimaxi.com/v1", bearerAuth("MINIMAX_TOKEN"))]
|
|
6847
|
-
},
|
|
6848
|
-
reddit: {
|
|
6849
|
-
apis: [api("https://oauth.reddit.com", bearerAuth("REDDIT_TOKEN"))]
|
|
6850
|
-
},
|
|
6851
|
-
strava: {
|
|
6852
|
-
apis: [api("https://www.strava.com/api/v3", bearerAuth("STRAVA_TOKEN"))]
|
|
6853
|
-
},
|
|
6854
|
-
x: {
|
|
6855
|
-
apis: [api("https://api.x.com/2", bearerAuth("X_ACCESS_TOKEN"))]
|
|
6856
|
-
},
|
|
6857
|
-
neon: {
|
|
6858
|
-
apis: [api("https://console.neon.tech/api/v2", bearerAuth("NEON_TOKEN"))]
|
|
6859
|
-
},
|
|
6860
|
-
vercel: {
|
|
6861
|
-
apis: [api("https://api.vercel.com", bearerAuth("VERCEL_TOKEN"))]
|
|
6862
|
-
},
|
|
6863
|
-
sentry: {
|
|
6864
|
-
apis: [api("https://sentry.io/api", bearerAuth("SENTRY_TOKEN"))]
|
|
6865
|
-
},
|
|
6866
|
-
monday: {
|
|
6867
|
-
apis: [api("https://api.monday.com/v2", bearerAuth("MONDAY_TOKEN"))]
|
|
6868
|
-
},
|
|
6869
|
-
canva: {
|
|
6870
|
-
apis: [api("https://api.canva.com/rest/v1", bearerAuth("CANVA_TOKEN"))]
|
|
6871
|
-
},
|
|
6872
|
-
xero: {
|
|
6873
|
-
apis: [api("https://api.xero.com", bearerAuth("XERO_TOKEN"))]
|
|
6874
|
-
},
|
|
6875
|
-
supabase: {
|
|
6876
|
-
apis: [api("https://api.supabase.com/v1", bearerAuth("SUPABASE_TOKEN"))]
|
|
6877
|
-
},
|
|
6878
|
-
todoist: {
|
|
6879
|
-
apis: [api("https://api.todoist.com/rest/v2", bearerAuth("TODOIST_TOKEN"))]
|
|
6880
|
-
},
|
|
6881
|
-
webflow: {
|
|
6882
|
-
apis: [api("https://api.webflow.com/v2", bearerAuth("WEBFLOW_TOKEN"))]
|
|
6883
|
-
},
|
|
6884
|
-
asana: {
|
|
6885
|
-
apis: [api("https://app.asana.com/api/1.0", bearerAuth("ASANA_TOKEN"))]
|
|
6886
|
-
},
|
|
6887
|
-
"meta-ads": {
|
|
6888
|
-
apis: [api("https://graph.facebook.com", bearerAuth("META_ADS_TOKEN"))]
|
|
6889
|
-
},
|
|
6890
|
-
posthog: {
|
|
6891
|
-
apis: [
|
|
6892
|
-
api("https://us.posthog.com/api", bearerAuth("POSTHOG_ACCESS_TOKEN")),
|
|
6893
|
-
api("https://app.posthog.com/api", bearerAuth("POSTHOG_ACCESS_TOKEN"))
|
|
6894
|
-
]
|
|
6895
|
-
},
|
|
6896
|
-
stripe: {
|
|
6897
|
-
apis: [api("https://api.stripe.com", bearerAuth("STRIPE_TOKEN"))]
|
|
6898
|
-
},
|
|
6899
|
-
productlane: {
|
|
6900
|
-
apis: [
|
|
6901
|
-
api("https://productlane.com/api/v1", bearerAuth("PRODUCTLANE_TOKEN"))
|
|
6902
|
-
]
|
|
6903
|
-
},
|
|
6904
|
-
openai: {
|
|
6905
|
-
apis: [api("https://api.openai.com", bearerAuth("OPENAI_TOKEN"))]
|
|
6906
|
-
},
|
|
6907
|
-
similarweb: {
|
|
6908
|
-
apis: [
|
|
6909
|
-
api("https://api.similarweb.com", {
|
|
6910
|
-
headers: { "api-key": "${{ secrets.SIMILARWEB_API_KEY }}" }
|
|
6911
|
-
})
|
|
6912
|
-
]
|
|
6913
|
-
},
|
|
6914
|
-
perplexity: {
|
|
6915
|
-
apis: [api("https://api.perplexity.ai", bearerAuth("PERPLEXITY_TOKEN"))]
|
|
6916
|
-
},
|
|
6917
|
-
plausible: {
|
|
6918
|
-
apis: [api("https://plausible.io/api", bearerAuth("PLAUSIBLE_TOKEN"))]
|
|
6919
|
-
},
|
|
6920
|
-
mailchimp: {
|
|
6921
|
-
apis: Array.from(
|
|
6922
|
-
{ length: 21 },
|
|
6923
|
-
(_, i) => api(
|
|
6924
|
-
`https://us${i + 1}.api.mailchimp.com/3.0`,
|
|
6925
|
-
bearerAuth("MAILCHIMP_TOKEN")
|
|
6926
|
-
)
|
|
6927
|
-
)
|
|
6928
|
-
},
|
|
6929
|
-
chatwoot: {
|
|
6930
|
-
apis: [api("https://app.chatwoot.com", bearerAuth("CHATWOOT_TOKEN"))]
|
|
6931
|
-
},
|
|
6932
|
-
resend: {
|
|
6933
|
-
apis: [api("https://api.resend.com", bearerAuth("RESEND_TOKEN"))]
|
|
6934
|
-
},
|
|
6935
|
-
revenuecat: {
|
|
6936
|
-
apis: [api("https://api.revenuecat.com", bearerAuth("REVENUECAT_TOKEN"))]
|
|
6937
|
-
},
|
|
6938
|
-
pdf4me: {
|
|
6939
|
-
apis: [
|
|
6940
|
-
api("https://api.pdf4me.com", {
|
|
6941
|
-
headers: { Authorization: "${{ secrets.PDF4ME_TOKEN }}" }
|
|
6942
|
-
})
|
|
6943
|
-
]
|
|
6944
|
-
},
|
|
6945
|
-
pdfco: {
|
|
6946
|
-
apis: [
|
|
6947
|
-
api("https://api.pdf.co/v1", {
|
|
6948
|
-
headers: { "x-api-key": "${{ secrets.PDFCO_TOKEN }}" }
|
|
6949
|
-
})
|
|
6950
|
-
]
|
|
6951
|
-
},
|
|
6952
|
-
apify: {
|
|
6953
|
-
apis: [api("https://api.apify.com/v2", bearerAuth("APIFY_TOKEN"))]
|
|
6954
|
-
},
|
|
6955
|
-
"bright-data": {
|
|
6956
|
-
apis: [api("https://api.brightdata.com", bearerAuth("BRIGHTDATA_TOKEN"))]
|
|
6957
|
-
},
|
|
6958
|
-
browserbase: {
|
|
6959
|
-
apis: [
|
|
6960
|
-
api("https://api.browserbase.com/v1", {
|
|
6961
|
-
headers: { "X-BB-API-Key": "${{ secrets.BROWSERBASE_TOKEN }}" }
|
|
6962
|
-
})
|
|
6963
|
-
]
|
|
6964
|
-
},
|
|
6965
|
-
fireflies: {
|
|
6966
|
-
apis: [
|
|
6967
|
-
api("https://api.fireflies.ai/graphql", bearerAuth("FIREFLIES_TOKEN"))
|
|
6968
|
-
]
|
|
6969
|
-
},
|
|
6970
|
-
explorium: {
|
|
6971
|
-
apis: [
|
|
6972
|
-
api("https://api.explorium.ai", {
|
|
6973
|
-
headers: { api_key: "${{ secrets.EXPLORIUM_TOKEN }}" }
|
|
6974
|
-
})
|
|
6975
|
-
]
|
|
6976
|
-
},
|
|
6977
|
-
firecrawl: {
|
|
6978
|
-
apis: [api("https://api.firecrawl.dev/v1", bearerAuth("FIRECRAWL_TOKEN"))]
|
|
6979
|
-
},
|
|
6980
|
-
scrapeninja: {
|
|
6981
|
-
apis: [
|
|
6982
|
-
api("https://scrapeninja.p.rapidapi.com", {
|
|
6983
|
-
headers: { "X-RapidAPI-Key": "${{ secrets.SCRAPENINJA_TOKEN }}" }
|
|
6984
|
-
})
|
|
6985
|
-
]
|
|
6986
|
-
},
|
|
6987
|
-
elevenlabs: {
|
|
6988
|
-
apis: [
|
|
6989
|
-
api("https://api.elevenlabs.io", {
|
|
6990
|
-
headers: { "xi-api-key": "${{ secrets.ELEVENLABS_TOKEN }}" }
|
|
6991
|
-
})
|
|
6992
|
-
]
|
|
6993
|
-
},
|
|
6994
|
-
devto: {
|
|
6995
|
-
apis: [
|
|
6996
|
-
api("https://dev.to/api", {
|
|
6997
|
-
headers: { "api-key": "${{ secrets.DEVTO_TOKEN }}" }
|
|
6998
|
-
})
|
|
6999
|
-
]
|
|
7000
|
-
},
|
|
7001
|
-
fal: {
|
|
7002
|
-
apis: [api("https://fal.run", bearerAuth("FAL_TOKEN"))]
|
|
7003
|
-
},
|
|
7004
|
-
podchaser: {
|
|
7005
|
-
apis: [api("https://api.podchaser.com", bearerAuth("PODCHASER_TOKEN"))]
|
|
7006
|
-
},
|
|
7007
|
-
pushinator: {
|
|
7008
|
-
apis: [api("https://api.pushinator.com", bearerAuth("PUSHINATOR_TOKEN"))]
|
|
7009
|
-
},
|
|
7010
|
-
qdrant: {
|
|
7011
|
-
apis: [
|
|
7012
|
-
api("https://cloud.qdrant.io", {
|
|
7013
|
-
headers: { "api-key": "${{ secrets.QDRANT_TOKEN }}" }
|
|
7014
|
-
})
|
|
7015
|
-
]
|
|
7016
|
-
},
|
|
7017
|
-
qiita: {
|
|
7018
|
-
apis: [api("https://qiita.com/api/v2", bearerAuth("QIITA_TOKEN"))]
|
|
7019
|
-
},
|
|
7020
|
-
reportei: {
|
|
7021
|
-
apis: [
|
|
7022
|
-
api("https://app.reportei.com/api/v1", bearerAuth("REPORTEI_TOKEN"))
|
|
7023
|
-
]
|
|
7024
|
-
},
|
|
7025
|
-
zeptomail: {
|
|
7026
|
-
apis: [
|
|
7027
|
-
api("https://api.zeptomail.com/v1.1", {
|
|
7028
|
-
headers: {
|
|
7029
|
-
Authorization: "Zoho-enczapikey ${{ secrets.ZEPTOMAIL_TOKEN }}"
|
|
7030
|
-
}
|
|
7031
|
-
})
|
|
7032
|
-
]
|
|
7033
|
-
},
|
|
7034
|
-
runway: {
|
|
7035
|
-
apis: [api("https://api.dev.runwayml.com/v1", bearerAuth("RUNWAY_TOKEN"))]
|
|
7036
|
-
},
|
|
7037
|
-
shortio: {
|
|
7038
|
-
apis: [
|
|
7039
|
-
api("https://api.short.io", {
|
|
7040
|
-
headers: { Authorization: "${{ secrets.SHORTIO_TOKEN }}" }
|
|
7041
|
-
})
|
|
7042
|
-
]
|
|
7043
|
-
},
|
|
7044
|
-
supadata: {
|
|
7045
|
-
apis: [
|
|
7046
|
-
api("https://api.supadata.ai/v1", {
|
|
7047
|
-
headers: { "x-api-key": "${{ secrets.SUPADATA_TOKEN }}" }
|
|
7048
|
-
})
|
|
7049
|
-
]
|
|
7050
|
-
},
|
|
7051
|
-
tavily: {
|
|
7052
|
-
apis: [api("https://api.tavily.com", bearerAuth("TAVILY_TOKEN"))]
|
|
7053
|
-
},
|
|
7054
|
-
tldv: {
|
|
7055
|
-
apis: [
|
|
7056
|
-
api("https://pasta.tldv.io", {
|
|
7057
|
-
headers: { "x-api-key": "${{ secrets.TLDV_TOKEN }}" }
|
|
7058
|
-
})
|
|
7059
|
-
]
|
|
7060
|
-
},
|
|
7061
|
-
twenty: {
|
|
7062
|
-
apis: [api("https://api.twenty.com", bearerAuth("TWENTY_TOKEN"))]
|
|
7063
|
-
},
|
|
7064
|
-
wrike: {
|
|
7065
|
-
apis: [api("https://www.wrike.com/api/v4", bearerAuth("WRIKE_TOKEN"))]
|
|
7066
|
-
},
|
|
7067
|
-
zapier: {
|
|
7068
|
-
apis: [api("https://actions.zapier.com", bearerAuth("ZAPIER_TOKEN"))]
|
|
6488
|
+
},
|
|
6489
|
+
summary: "Get computer connector status"
|
|
7069
6490
|
},
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
6491
|
+
delete: {
|
|
6492
|
+
method: "DELETE",
|
|
6493
|
+
path: "/api/connectors/computer",
|
|
6494
|
+
headers: authHeadersSchema,
|
|
6495
|
+
responses: {
|
|
6496
|
+
204: c18.noBody(),
|
|
6497
|
+
401: apiErrorSchema,
|
|
6498
|
+
404: apiErrorSchema,
|
|
6499
|
+
500: apiErrorSchema
|
|
6500
|
+
},
|
|
6501
|
+
summary: "Delete computer connector and revoke ngrok credentials"
|
|
7074
6502
|
}
|
|
7075
|
-
};
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
6503
|
+
});
|
|
6504
|
+
|
|
6505
|
+
// ../../packages/core/src/firewall-loader.ts
|
|
6506
|
+
import { parse as parseYaml } from "yaml";
|
|
6507
|
+
|
|
6508
|
+
// ../../packages/core/src/github-url.ts
|
|
6509
|
+
function parseGitHubTreeUrl(url) {
|
|
6510
|
+
let normalizedUrl = url;
|
|
6511
|
+
while (normalizedUrl.endsWith("/")) {
|
|
6512
|
+
normalizedUrl = normalizedUrl.slice(0, -1);
|
|
6513
|
+
}
|
|
6514
|
+
const fullPathMatch = normalizedUrl.match(/^https:\/\/github\.com\/(.+)$/);
|
|
6515
|
+
if (!fullPathMatch) {
|
|
6516
|
+
return null;
|
|
6517
|
+
}
|
|
6518
|
+
const fullPath = fullPathMatch[1];
|
|
6519
|
+
const regex = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/;
|
|
6520
|
+
const match = normalizedUrl.match(regex);
|
|
6521
|
+
if (!match) {
|
|
6522
|
+
return null;
|
|
6523
|
+
}
|
|
6524
|
+
const [, owner, repo, branch, pathPart] = match;
|
|
6525
|
+
const resolvedPath = pathPart ?? "";
|
|
6526
|
+
const pathSegments = resolvedPath.split("/").filter(Boolean);
|
|
6527
|
+
const skillName = pathSegments[pathSegments.length - 1] || repo;
|
|
6528
|
+
return {
|
|
6529
|
+
owner,
|
|
6530
|
+
repo,
|
|
6531
|
+
branch,
|
|
6532
|
+
path: resolvedPath,
|
|
6533
|
+
skillName,
|
|
6534
|
+
fullPath
|
|
6535
|
+
};
|
|
6536
|
+
}
|
|
6537
|
+
function parseGitHubUrl(url) {
|
|
6538
|
+
let normalizedUrl = url;
|
|
6539
|
+
while (normalizedUrl.endsWith("/")) {
|
|
6540
|
+
normalizedUrl = normalizedUrl.slice(0, -1);
|
|
6541
|
+
}
|
|
6542
|
+
const fullPathMatch = normalizedUrl.match(/^https:\/\/github\.com\/(.+)$/);
|
|
6543
|
+
if (!fullPathMatch) {
|
|
6544
|
+
return null;
|
|
6545
|
+
}
|
|
6546
|
+
const fullPath = fullPathMatch[1];
|
|
6547
|
+
const plainMatch = normalizedUrl.match(
|
|
6548
|
+
/^https:\/\/github\.com\/([^/]+)\/([^/]+)$/
|
|
6549
|
+
);
|
|
6550
|
+
if (plainMatch) {
|
|
6551
|
+
return {
|
|
6552
|
+
owner: plainMatch[1],
|
|
6553
|
+
repo: plainMatch[2],
|
|
6554
|
+
branch: null,
|
|
6555
|
+
path: null,
|
|
6556
|
+
fullPath
|
|
6557
|
+
};
|
|
6558
|
+
}
|
|
6559
|
+
const treeMatch = normalizedUrl.match(
|
|
6560
|
+
/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/
|
|
6561
|
+
);
|
|
6562
|
+
if (treeMatch) {
|
|
6563
|
+
return {
|
|
6564
|
+
owner: treeMatch[1],
|
|
6565
|
+
repo: treeMatch[2],
|
|
6566
|
+
branch: treeMatch[3],
|
|
6567
|
+
path: treeMatch[4] ?? null,
|
|
6568
|
+
fullPath
|
|
6569
|
+
};
|
|
6570
|
+
}
|
|
6571
|
+
return null;
|
|
6572
|
+
}
|
|
6573
|
+
var DEFAULT_SKILLS_OWNER = "vm0-ai";
|
|
6574
|
+
var DEFAULT_SKILLS_REPO = "vm0-skills";
|
|
6575
|
+
var DEFAULT_SKILLS_BRANCH = "main";
|
|
6576
|
+
var DEFAULT_FIREWALLS_OWNER = "vm0-ai";
|
|
6577
|
+
var DEFAULT_FIREWALLS_REPO = "vm0-firewalls";
|
|
6578
|
+
var DEFAULT_FIREWALLS_BRANCH = "main";
|
|
6579
|
+
function resolveSkillRef(input) {
|
|
6580
|
+
const trimmed = input.trim();
|
|
6581
|
+
if (!trimmed) {
|
|
6582
|
+
throw new Error("Skill reference cannot be empty");
|
|
6583
|
+
}
|
|
6584
|
+
if (!trimmed.includes("/") && !trimmed.startsWith("https://")) {
|
|
6585
|
+
return `https://github.com/${DEFAULT_SKILLS_OWNER}/${DEFAULT_SKILLS_REPO}/tree/${DEFAULT_SKILLS_BRANCH}/${trimmed}`;
|
|
6586
|
+
}
|
|
6587
|
+
const parsed = parseGitHubUrl(trimmed);
|
|
6588
|
+
if (!parsed) {
|
|
6589
|
+
throw new Error(
|
|
6590
|
+
`Invalid skill URL: ${trimmed}. Expected a bare skill name (e.g. "slack") or a GitHub URL (https://github.com/{owner}/{repo}[/tree/{branch}[/path]])`
|
|
6591
|
+
);
|
|
6592
|
+
}
|
|
6593
|
+
if (!parsed.branch) {
|
|
6594
|
+
return `https://github.com/${parsed.owner}/${parsed.repo}/tree/${DEFAULT_SKILLS_BRANCH}`;
|
|
6595
|
+
}
|
|
6596
|
+
return trimmed;
|
|
6597
|
+
}
|
|
6598
|
+
var FIREWALL_NAME_PATTERN = /^[a-zA-Z0-9]([a-zA-Z0-9\-_.]*[a-zA-Z0-9])?$/;
|
|
6599
|
+
function resolveFirewallRef(input) {
|
|
6600
|
+
const trimmed = input.trim();
|
|
6601
|
+
if (!trimmed) {
|
|
6602
|
+
throw new Error("Firewall reference cannot be empty");
|
|
6603
|
+
}
|
|
6604
|
+
if (!trimmed.includes("/") && !trimmed.startsWith("https://")) {
|
|
6605
|
+
if (!FIREWALL_NAME_PATTERN.test(trimmed)) {
|
|
6606
|
+
throw new Error(
|
|
6607
|
+
`Invalid firewall name "${trimmed}": must be alphanumeric with hyphens, dots, or underscores`
|
|
6608
|
+
);
|
|
6609
|
+
}
|
|
6610
|
+
return `https://github.com/${DEFAULT_FIREWALLS_OWNER}/${DEFAULT_FIREWALLS_REPO}/tree/${DEFAULT_FIREWALLS_BRANCH}/${trimmed}`;
|
|
6611
|
+
}
|
|
6612
|
+
const parsed = parseGitHubUrl(trimmed);
|
|
6613
|
+
if (!parsed) {
|
|
6614
|
+
throw new Error(
|
|
6615
|
+
`Invalid firewall URL: ${trimmed}. Expected a bare firewall name (e.g. "custom-api") or a GitHub URL (https://github.com/{owner}/{repo}[/tree/{branch}[/path]])`
|
|
6616
|
+
);
|
|
6617
|
+
}
|
|
6618
|
+
if (!parsed.branch) {
|
|
6619
|
+
return `https://github.com/${parsed.owner}/${parsed.repo}/tree/${DEFAULT_FIREWALLS_BRANCH}`;
|
|
6620
|
+
}
|
|
6621
|
+
return trimmed;
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6624
|
+
// ../../packages/core/src/firewall-loader.ts
|
|
6625
|
+
var MAX_RESPONSE_SIZE = 64 * 1024;
|
|
6626
|
+
function buildFirewallYamlUrl(ref) {
|
|
6627
|
+
const url = resolveFirewallRef(ref);
|
|
6628
|
+
const parsed = parseGitHubTreeUrl(url);
|
|
6629
|
+
if (!parsed) {
|
|
6630
|
+
throw new Error(`Invalid firewall URL after resolution: ${url}`);
|
|
6631
|
+
}
|
|
6632
|
+
const pathPrefix = parsed.path ? `${parsed.path}/` : "";
|
|
6633
|
+
return `https://raw.githubusercontent.com/${parsed.owner}/${parsed.repo}/${parsed.branch}/${pathPrefix}firewall.yaml`;
|
|
6634
|
+
}
|
|
6635
|
+
async function fetchFirewallConfig(ref, fetchFn = fetch) {
|
|
6636
|
+
const rawUrl = buildFirewallYamlUrl(ref);
|
|
6637
|
+
const res = await fetchFn(rawUrl);
|
|
6638
|
+
if (!res.ok) {
|
|
6639
|
+
throw new Error(
|
|
6640
|
+
`Failed to fetch firewall config for "${ref}" from ${rawUrl}: ${res.status} ${res.statusText}`
|
|
6641
|
+
);
|
|
6642
|
+
}
|
|
6643
|
+
const contentLength = res.headers.get("content-length");
|
|
6644
|
+
if (contentLength && parseInt(contentLength, 10) > MAX_RESPONSE_SIZE) {
|
|
6645
|
+
throw new Error(
|
|
6646
|
+
`Firewall config "${ref}" exceeds maximum size (${MAX_RESPONSE_SIZE} bytes)`
|
|
6647
|
+
);
|
|
6648
|
+
}
|
|
6649
|
+
const content = await res.text();
|
|
6650
|
+
if (content.length > MAX_RESPONSE_SIZE) {
|
|
6651
|
+
throw new Error(
|
|
6652
|
+
`Firewall config "${ref}" exceeds maximum size (${MAX_RESPONSE_SIZE} bytes)`
|
|
6653
|
+
);
|
|
6654
|
+
}
|
|
6655
|
+
let yamlData;
|
|
6656
|
+
try {
|
|
6657
|
+
yamlData = parseYaml(content);
|
|
6658
|
+
} catch (e) {
|
|
6659
|
+
throw new Error(
|
|
6660
|
+
`Invalid YAML in firewall config "${ref}": ${e instanceof Error ? e.message : String(e)}`
|
|
6661
|
+
);
|
|
6662
|
+
}
|
|
6663
|
+
const result = firewallConfigSchema.safeParse(yamlData);
|
|
6664
|
+
if (!result.success) {
|
|
6665
|
+
const issues = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
|
|
6666
|
+
throw new Error(`Invalid firewall config "${ref}": ${issues}`);
|
|
6667
|
+
}
|
|
6668
|
+
return result.data;
|
|
7080
6669
|
}
|
|
7081
6670
|
|
|
7082
6671
|
// ../../packages/core/src/contracts/firewall-expander.ts
|
|
@@ -7159,21 +6748,6 @@ function validateBaseUrl(base, serviceName) {
|
|
|
7159
6748
|
);
|
|
7160
6749
|
}
|
|
7161
6750
|
}
|
|
7162
|
-
function resolveFirewallConfig(ref) {
|
|
7163
|
-
const parsed = connectorTypeSchema.safeParse(ref);
|
|
7164
|
-
if (!parsed.success) {
|
|
7165
|
-
throw new Error(
|
|
7166
|
-
`Cannot resolve firewall ref "${ref}": no built-in firewall config with this name`
|
|
7167
|
-
);
|
|
7168
|
-
}
|
|
7169
|
-
const serviceConfig = getFirewallConfig(parsed.data);
|
|
7170
|
-
if (!serviceConfig) {
|
|
7171
|
-
throw new Error(
|
|
7172
|
-
`Firewall ref "${ref}" resolved to "${parsed.data}" but it does not support proxy-side token replacement`
|
|
7173
|
-
);
|
|
7174
|
-
}
|
|
7175
|
-
return serviceConfig;
|
|
7176
|
-
}
|
|
7177
6751
|
function collectAndValidatePermissions(ref, serviceConfig) {
|
|
7178
6752
|
if (serviceConfig.apis.length === 0) {
|
|
7179
6753
|
throw new Error(
|
|
@@ -7181,15 +6755,15 @@ function collectAndValidatePermissions(ref, serviceConfig) {
|
|
|
7181
6755
|
);
|
|
7182
6756
|
}
|
|
7183
6757
|
const available = /* @__PURE__ */ new Set();
|
|
7184
|
-
for (const
|
|
7185
|
-
validateBaseUrl(
|
|
7186
|
-
if (!
|
|
6758
|
+
for (const api of serviceConfig.apis) {
|
|
6759
|
+
validateBaseUrl(api.base, serviceConfig.name);
|
|
6760
|
+
if (!api.permissions || api.permissions.length === 0) {
|
|
7187
6761
|
throw new Error(
|
|
7188
|
-
`API entry "${
|
|
6762
|
+
`API entry "${api.base}" in firewall "${serviceConfig.name}" (ref "${ref}") has no permissions`
|
|
7189
6763
|
);
|
|
7190
6764
|
}
|
|
7191
6765
|
const seen = /* @__PURE__ */ new Set();
|
|
7192
|
-
for (const perm of
|
|
6766
|
+
for (const perm of api.permissions) {
|
|
7193
6767
|
if (!perm.name) {
|
|
7194
6768
|
throw new Error(
|
|
7195
6769
|
`Firewall "${serviceConfig.name}" (ref "${ref}") has a permission with empty name`
|
|
@@ -7202,7 +6776,7 @@ function collectAndValidatePermissions(ref, serviceConfig) {
|
|
|
7202
6776
|
}
|
|
7203
6777
|
if (seen.has(perm.name)) {
|
|
7204
6778
|
throw new Error(
|
|
7205
|
-
`Duplicate permission name "${perm.name}" in API entry "${
|
|
6779
|
+
`Duplicate permission name "${perm.name}" in API entry "${api.base}" of firewall "${serviceConfig.name}" (ref "${ref}")`
|
|
7206
6780
|
);
|
|
7207
6781
|
}
|
|
7208
6782
|
if (perm.rules.length === 0) {
|
|
@@ -7219,7 +6793,7 @@ function collectAndValidatePermissions(ref, serviceConfig) {
|
|
|
7219
6793
|
}
|
|
7220
6794
|
return available;
|
|
7221
6795
|
}
|
|
7222
|
-
function expandFirewallConfigs(config) {
|
|
6796
|
+
async function expandFirewallConfigs(config, fetchFn) {
|
|
7223
6797
|
const compose = config;
|
|
7224
6798
|
if (!compose?.agents) return;
|
|
7225
6799
|
for (const agent of Object.values(compose.agents)) {
|
|
@@ -7227,8 +6801,13 @@ function expandFirewallConfigs(config) {
|
|
|
7227
6801
|
if (!configs) continue;
|
|
7228
6802
|
if (Array.isArray(configs)) continue;
|
|
7229
6803
|
const expanded = [];
|
|
7230
|
-
|
|
7231
|
-
|
|
6804
|
+
const entries = Object.entries(configs);
|
|
6805
|
+
const resolvedConfigs = await Promise.all(
|
|
6806
|
+
entries.map(([ref]) => fetchFirewallConfig(ref, fetchFn))
|
|
6807
|
+
);
|
|
6808
|
+
for (let i = 0; i < entries.length; i++) {
|
|
6809
|
+
const [ref, selection] = entries[i];
|
|
6810
|
+
const serviceConfig = resolvedConfigs[i];
|
|
7232
6811
|
const availablePermissions = collectAndValidatePermissions(
|
|
7233
6812
|
ref,
|
|
7234
6813
|
serviceConfig
|
|
@@ -7244,10 +6823,10 @@ function expandFirewallConfigs(config) {
|
|
|
7244
6823
|
}
|
|
7245
6824
|
}
|
|
7246
6825
|
const selectedSet = selection.permissions === "all" ? null : new Set(selection.permissions);
|
|
7247
|
-
const filteredApis = serviceConfig.apis.map((
|
|
7248
|
-
...
|
|
7249
|
-
permissions: selectedSet ? (
|
|
7250
|
-
})).filter((
|
|
6826
|
+
const filteredApis = serviceConfig.apis.map((api) => ({
|
|
6827
|
+
...api,
|
|
6828
|
+
permissions: selectedSet ? (api.permissions ?? []).filter((p) => selectedSet.has(p.name)) : api.permissions
|
|
6829
|
+
})).filter((api) => (api.permissions ?? []).length > 0);
|
|
7251
6830
|
if (filteredApis.length === 0) continue;
|
|
7252
6831
|
const entry = {
|
|
7253
6832
|
name: serviceConfig.name,
|
|
@@ -7265,21 +6844,21 @@ function expandFirewallConfigs(config) {
|
|
|
7265
6844
|
}
|
|
7266
6845
|
|
|
7267
6846
|
// ../../packages/core/src/contracts/user-preferences.ts
|
|
7268
|
-
import { z as
|
|
6847
|
+
import { z as z22 } from "zod";
|
|
7269
6848
|
var c19 = initContract();
|
|
7270
|
-
var sendModeSchema =
|
|
7271
|
-
var userPreferencesResponseSchema =
|
|
7272
|
-
timezone:
|
|
7273
|
-
notifyEmail:
|
|
7274
|
-
notifySlack:
|
|
7275
|
-
pinnedAgentIds:
|
|
6849
|
+
var sendModeSchema = z22.enum(["enter", "cmd-enter"]);
|
|
6850
|
+
var userPreferencesResponseSchema = z22.object({
|
|
6851
|
+
timezone: z22.string().nullable(),
|
|
6852
|
+
notifyEmail: z22.boolean(),
|
|
6853
|
+
notifySlack: z22.boolean(),
|
|
6854
|
+
pinnedAgentIds: z22.array(z22.string()),
|
|
7276
6855
|
sendMode: sendModeSchema
|
|
7277
6856
|
});
|
|
7278
|
-
var updateUserPreferencesRequestSchema =
|
|
7279
|
-
timezone:
|
|
7280
|
-
notifyEmail:
|
|
7281
|
-
notifySlack:
|
|
7282
|
-
pinnedAgentIds:
|
|
6857
|
+
var updateUserPreferencesRequestSchema = z22.object({
|
|
6858
|
+
timezone: z22.string().min(1).optional(),
|
|
6859
|
+
notifyEmail: z22.boolean().optional(),
|
|
6860
|
+
notifySlack: z22.boolean().optional(),
|
|
6861
|
+
pinnedAgentIds: z22.array(z22.string()).max(4).optional(),
|
|
7283
6862
|
sendMode: sendModeSchema.optional()
|
|
7284
6863
|
}).refine(
|
|
7285
6864
|
(data) => data.timezone !== void 0 || data.notifyEmail !== void 0 || data.notifySlack !== void 0 || data.pinnedAgentIds !== void 0 || data.sendMode !== void 0,
|
|
@@ -7323,15 +6902,15 @@ var userPreferencesContract = c19.router({
|
|
|
7323
6902
|
});
|
|
7324
6903
|
|
|
7325
6904
|
// ../../packages/core/src/contracts/org-list.ts
|
|
7326
|
-
import { z as
|
|
6905
|
+
import { z as z23 } from "zod";
|
|
7327
6906
|
var c20 = initContract();
|
|
7328
|
-
var orgListItemSchema =
|
|
7329
|
-
slug:
|
|
7330
|
-
role:
|
|
6907
|
+
var orgListItemSchema = z23.object({
|
|
6908
|
+
slug: z23.string(),
|
|
6909
|
+
role: z23.string()
|
|
7331
6910
|
});
|
|
7332
|
-
var orgListResponseSchema =
|
|
7333
|
-
orgs:
|
|
7334
|
-
active:
|
|
6911
|
+
var orgListResponseSchema = z23.object({
|
|
6912
|
+
orgs: z23.array(orgListItemSchema),
|
|
6913
|
+
active: z23.string().optional()
|
|
7335
6914
|
});
|
|
7336
6915
|
var orgListContract = c20.router({
|
|
7337
6916
|
/**
|
|
@@ -7352,29 +6931,29 @@ var orgListContract = c20.router({
|
|
|
7352
6931
|
});
|
|
7353
6932
|
|
|
7354
6933
|
// ../../packages/core/src/contracts/org-members.ts
|
|
7355
|
-
import { z as
|
|
6934
|
+
import { z as z24 } from "zod";
|
|
7356
6935
|
var c21 = initContract();
|
|
7357
|
-
var orgRoleSchema =
|
|
7358
|
-
var orgMemberSchema =
|
|
7359
|
-
userId:
|
|
7360
|
-
email:
|
|
6936
|
+
var orgRoleSchema = z24.enum(["admin", "member"]);
|
|
6937
|
+
var orgMemberSchema = z24.object({
|
|
6938
|
+
userId: z24.string(),
|
|
6939
|
+
email: z24.string(),
|
|
7361
6940
|
role: orgRoleSchema,
|
|
7362
|
-
joinedAt:
|
|
6941
|
+
joinedAt: z24.string()
|
|
7363
6942
|
});
|
|
7364
|
-
var orgMembersResponseSchema =
|
|
7365
|
-
slug:
|
|
6943
|
+
var orgMembersResponseSchema = z24.object({
|
|
6944
|
+
slug: z24.string(),
|
|
7366
6945
|
role: orgRoleSchema,
|
|
7367
|
-
members:
|
|
7368
|
-
createdAt:
|
|
6946
|
+
members: z24.array(orgMemberSchema),
|
|
6947
|
+
createdAt: z24.string()
|
|
7369
6948
|
});
|
|
7370
|
-
var inviteOrgMemberRequestSchema =
|
|
7371
|
-
email:
|
|
6949
|
+
var inviteOrgMemberRequestSchema = z24.object({
|
|
6950
|
+
email: z24.string().email()
|
|
7372
6951
|
});
|
|
7373
|
-
var removeOrgMemberRequestSchema =
|
|
7374
|
-
email:
|
|
6952
|
+
var removeOrgMemberRequestSchema = z24.object({
|
|
6953
|
+
email: z24.string().email()
|
|
7375
6954
|
});
|
|
7376
|
-
var orgMessageResponseSchema =
|
|
7377
|
-
message:
|
|
6955
|
+
var orgMessageResponseSchema = z24.object({
|
|
6956
|
+
message: z24.string()
|
|
7378
6957
|
});
|
|
7379
6958
|
var orgMembersContract = c21.router({
|
|
7380
6959
|
/**
|
|
@@ -7421,7 +7000,7 @@ var orgMembersContract = c21.router({
|
|
|
7421
7000
|
method: "POST",
|
|
7422
7001
|
path: "/api/org/leave",
|
|
7423
7002
|
headers: authHeadersSchema,
|
|
7424
|
-
body:
|
|
7003
|
+
body: z24.object({}),
|
|
7425
7004
|
responses: {
|
|
7426
7005
|
200: orgMessageResponseSchema,
|
|
7427
7006
|
401: apiErrorSchema,
|
|
@@ -7451,19 +7030,19 @@ var orgMembersContract = c21.router({
|
|
|
7451
7030
|
});
|
|
7452
7031
|
|
|
7453
7032
|
// ../../packages/core/src/contracts/onboarding.ts
|
|
7454
|
-
import { z as
|
|
7033
|
+
import { z as z25 } from "zod";
|
|
7455
7034
|
var c22 = initContract();
|
|
7456
|
-
var onboardingStatusResponseSchema =
|
|
7457
|
-
needsOnboarding:
|
|
7458
|
-
hasOrg:
|
|
7459
|
-
hasModelProvider:
|
|
7460
|
-
hasDefaultAgent:
|
|
7461
|
-
defaultAgentName:
|
|
7462
|
-
defaultAgentComposeId:
|
|
7463
|
-
defaultAgentMetadata:
|
|
7464
|
-
displayName:
|
|
7465
|
-
description:
|
|
7466
|
-
sound:
|
|
7035
|
+
var onboardingStatusResponseSchema = z25.object({
|
|
7036
|
+
needsOnboarding: z25.boolean(),
|
|
7037
|
+
hasOrg: z25.boolean(),
|
|
7038
|
+
hasModelProvider: z25.boolean(),
|
|
7039
|
+
hasDefaultAgent: z25.boolean(),
|
|
7040
|
+
defaultAgentName: z25.string().nullable(),
|
|
7041
|
+
defaultAgentComposeId: z25.string().nullable(),
|
|
7042
|
+
defaultAgentMetadata: z25.object({
|
|
7043
|
+
displayName: z25.string().optional(),
|
|
7044
|
+
description: z25.string().optional(),
|
|
7045
|
+
sound: z25.string().optional()
|
|
7467
7046
|
}).nullable()
|
|
7468
7047
|
});
|
|
7469
7048
|
var onboardingStatusContract = c22.router({
|
|
@@ -7480,17 +7059,17 @@ var onboardingStatusContract = c22.router({
|
|
|
7480
7059
|
});
|
|
7481
7060
|
|
|
7482
7061
|
// ../../packages/core/src/contracts/skills.ts
|
|
7483
|
-
import { z as
|
|
7062
|
+
import { z as z26 } from "zod";
|
|
7484
7063
|
var c23 = initContract();
|
|
7485
|
-
var skillFrontmatterSchema =
|
|
7486
|
-
name:
|
|
7487
|
-
description:
|
|
7488
|
-
vm0_secrets:
|
|
7489
|
-
vm0_vars:
|
|
7064
|
+
var skillFrontmatterSchema = z26.object({
|
|
7065
|
+
name: z26.string().optional(),
|
|
7066
|
+
description: z26.string().optional(),
|
|
7067
|
+
vm0_secrets: z26.array(z26.string()).optional(),
|
|
7068
|
+
vm0_vars: z26.array(z26.string()).optional()
|
|
7490
7069
|
});
|
|
7491
|
-
var resolvedSkillSchema =
|
|
7492
|
-
storageName:
|
|
7493
|
-
versionHash:
|
|
7070
|
+
var resolvedSkillSchema = z26.object({
|
|
7071
|
+
storageName: z26.string(),
|
|
7072
|
+
versionHash: z26.string(),
|
|
7494
7073
|
frontmatter: skillFrontmatterSchema
|
|
7495
7074
|
});
|
|
7496
7075
|
var skillsResolveContract = c23.router({
|
|
@@ -7498,13 +7077,13 @@ var skillsResolveContract = c23.router({
|
|
|
7498
7077
|
method: "POST",
|
|
7499
7078
|
path: "/api/skills/resolve",
|
|
7500
7079
|
headers: authHeadersSchema,
|
|
7501
|
-
body:
|
|
7502
|
-
skills:
|
|
7080
|
+
body: z26.object({
|
|
7081
|
+
skills: z26.array(z26.string().url()).min(1).max(100)
|
|
7503
7082
|
}),
|
|
7504
7083
|
responses: {
|
|
7505
|
-
200:
|
|
7506
|
-
resolved:
|
|
7507
|
-
unresolved:
|
|
7084
|
+
200: z26.object({
|
|
7085
|
+
resolved: z26.record(z26.string(), resolvedSkillSchema),
|
|
7086
|
+
unresolved: z26.array(z26.string())
|
|
7508
7087
|
}),
|
|
7509
7088
|
400: apiErrorSchema,
|
|
7510
7089
|
401: apiErrorSchema
|
|
@@ -7541,94 +7120,6 @@ function getSkillStorageName(fullPath) {
|
|
|
7541
7120
|
return `agent-skills@${fullPath}`;
|
|
7542
7121
|
}
|
|
7543
7122
|
|
|
7544
|
-
// ../../packages/core/src/github-url.ts
|
|
7545
|
-
function parseGitHubTreeUrl(url) {
|
|
7546
|
-
let normalizedUrl = url;
|
|
7547
|
-
while (normalizedUrl.endsWith("/")) {
|
|
7548
|
-
normalizedUrl = normalizedUrl.slice(0, -1);
|
|
7549
|
-
}
|
|
7550
|
-
const fullPathMatch = normalizedUrl.match(/^https:\/\/github\.com\/(.+)$/);
|
|
7551
|
-
if (!fullPathMatch) {
|
|
7552
|
-
return null;
|
|
7553
|
-
}
|
|
7554
|
-
const fullPath = fullPathMatch[1];
|
|
7555
|
-
const regex = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/;
|
|
7556
|
-
const match = normalizedUrl.match(regex);
|
|
7557
|
-
if (!match) {
|
|
7558
|
-
return null;
|
|
7559
|
-
}
|
|
7560
|
-
const [, owner, repo, branch, pathPart] = match;
|
|
7561
|
-
const resolvedPath = pathPart ?? "";
|
|
7562
|
-
const pathSegments = resolvedPath.split("/").filter(Boolean);
|
|
7563
|
-
const skillName = pathSegments[pathSegments.length - 1] || repo;
|
|
7564
|
-
return {
|
|
7565
|
-
owner,
|
|
7566
|
-
repo,
|
|
7567
|
-
branch,
|
|
7568
|
-
path: resolvedPath,
|
|
7569
|
-
skillName,
|
|
7570
|
-
fullPath
|
|
7571
|
-
};
|
|
7572
|
-
}
|
|
7573
|
-
function parseGitHubUrl(url) {
|
|
7574
|
-
let normalizedUrl = url;
|
|
7575
|
-
while (normalizedUrl.endsWith("/")) {
|
|
7576
|
-
normalizedUrl = normalizedUrl.slice(0, -1);
|
|
7577
|
-
}
|
|
7578
|
-
const fullPathMatch = normalizedUrl.match(/^https:\/\/github\.com\/(.+)$/);
|
|
7579
|
-
if (!fullPathMatch) {
|
|
7580
|
-
return null;
|
|
7581
|
-
}
|
|
7582
|
-
const fullPath = fullPathMatch[1];
|
|
7583
|
-
const plainMatch = normalizedUrl.match(
|
|
7584
|
-
/^https:\/\/github\.com\/([^/]+)\/([^/]+)$/
|
|
7585
|
-
);
|
|
7586
|
-
if (plainMatch) {
|
|
7587
|
-
return {
|
|
7588
|
-
owner: plainMatch[1],
|
|
7589
|
-
repo: plainMatch[2],
|
|
7590
|
-
branch: null,
|
|
7591
|
-
path: null,
|
|
7592
|
-
fullPath
|
|
7593
|
-
};
|
|
7594
|
-
}
|
|
7595
|
-
const treeMatch = normalizedUrl.match(
|
|
7596
|
-
/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/
|
|
7597
|
-
);
|
|
7598
|
-
if (treeMatch) {
|
|
7599
|
-
return {
|
|
7600
|
-
owner: treeMatch[1],
|
|
7601
|
-
repo: treeMatch[2],
|
|
7602
|
-
branch: treeMatch[3],
|
|
7603
|
-
path: treeMatch[4] ?? null,
|
|
7604
|
-
fullPath
|
|
7605
|
-
};
|
|
7606
|
-
}
|
|
7607
|
-
return null;
|
|
7608
|
-
}
|
|
7609
|
-
var DEFAULT_SKILLS_OWNER = "vm0-ai";
|
|
7610
|
-
var DEFAULT_SKILLS_REPO = "vm0-skills";
|
|
7611
|
-
var DEFAULT_SKILLS_BRANCH = "main";
|
|
7612
|
-
function resolveSkillRef(input) {
|
|
7613
|
-
const trimmed = input.trim();
|
|
7614
|
-
if (!trimmed) {
|
|
7615
|
-
throw new Error("Skill reference cannot be empty");
|
|
7616
|
-
}
|
|
7617
|
-
if (!trimmed.includes("/") && !trimmed.startsWith("https://")) {
|
|
7618
|
-
return `https://github.com/${DEFAULT_SKILLS_OWNER}/${DEFAULT_SKILLS_REPO}/tree/${DEFAULT_SKILLS_BRANCH}/${trimmed}`;
|
|
7619
|
-
}
|
|
7620
|
-
const parsed = parseGitHubUrl(trimmed);
|
|
7621
|
-
if (!parsed) {
|
|
7622
|
-
throw new Error(
|
|
7623
|
-
`Invalid skill URL: ${trimmed}. Expected a bare skill name (e.g. "slack") or a GitHub URL (https://github.com/{owner}/{repo}[/tree/{branch}[/path]])`
|
|
7624
|
-
);
|
|
7625
|
-
}
|
|
7626
|
-
if (!parsed.branch) {
|
|
7627
|
-
return `https://github.com/${parsed.owner}/${parsed.repo}/tree/${DEFAULT_SKILLS_BRANCH}`;
|
|
7628
|
-
}
|
|
7629
|
-
return trimmed;
|
|
7630
|
-
}
|
|
7631
|
-
|
|
7632
7123
|
// ../../packages/core/src/frameworks.ts
|
|
7633
7124
|
var SUPPORTED_FRAMEWORKS = ["claude-code", "codex"];
|
|
7634
7125
|
function isSupportedFramework(framework) {
|
|
@@ -7876,7 +7367,7 @@ async function isFeatureEnabled(key, userId) {
|
|
|
7876
7367
|
}
|
|
7877
7368
|
|
|
7878
7369
|
// ../../packages/core/src/skill-frontmatter.ts
|
|
7879
|
-
import { parse as
|
|
7370
|
+
import { parse as parseYaml2 } from "yaml";
|
|
7880
7371
|
function parseSkillFrontmatter(content) {
|
|
7881
7372
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
7882
7373
|
if (!frontmatterMatch) {
|
|
@@ -7886,7 +7377,7 @@ function parseSkillFrontmatter(content) {
|
|
|
7886
7377
|
if (!yamlContent) {
|
|
7887
7378
|
return {};
|
|
7888
7379
|
}
|
|
7889
|
-
const parsed =
|
|
7380
|
+
const parsed = parseYaml2(yamlContent);
|
|
7890
7381
|
if (!parsed || typeof parsed !== "object") {
|
|
7891
7382
|
return {};
|
|
7892
7383
|
}
|
|
@@ -8686,8 +8177,8 @@ async function resolveSkills(skillUrls) {
|
|
|
8686
8177
|
}
|
|
8687
8178
|
|
|
8688
8179
|
// src/lib/domain/yaml-validator.ts
|
|
8689
|
-
import { z as
|
|
8690
|
-
var cliAgentNameSchema =
|
|
8180
|
+
import { z as z27 } from "zod";
|
|
8181
|
+
var cliAgentNameSchema = z27.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
8691
8182
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
8692
8183
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
8693
8184
|
);
|
|
@@ -8701,7 +8192,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
8701
8192
|
resolveSkillRef(skillRef);
|
|
8702
8193
|
} catch (error) {
|
|
8703
8194
|
ctx.addIssue({
|
|
8704
|
-
code:
|
|
8195
|
+
code: z27.ZodIssueCode.custom,
|
|
8705
8196
|
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
8706
8197
|
path: ["skills", i]
|
|
8707
8198
|
});
|
|
@@ -8711,15 +8202,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
8711
8202
|
}
|
|
8712
8203
|
}
|
|
8713
8204
|
);
|
|
8714
|
-
var cliComposeSchema =
|
|
8715
|
-
version:
|
|
8716
|
-
agents:
|
|
8717
|
-
volumes:
|
|
8205
|
+
var cliComposeSchema = z27.object({
|
|
8206
|
+
version: z27.string().min(1, "Missing config.version"),
|
|
8207
|
+
agents: z27.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
8208
|
+
volumes: z27.record(z27.string(), volumeConfigSchema).optional()
|
|
8718
8209
|
}).superRefine((config, ctx) => {
|
|
8719
8210
|
const agentKeys = Object.keys(config.agents);
|
|
8720
8211
|
if (agentKeys.length === 0) {
|
|
8721
8212
|
ctx.addIssue({
|
|
8722
|
-
code:
|
|
8213
|
+
code: z27.ZodIssueCode.custom,
|
|
8723
8214
|
message: "agents must have at least one agent defined",
|
|
8724
8215
|
path: ["agents"]
|
|
8725
8216
|
});
|
|
@@ -8727,7 +8218,7 @@ var cliComposeSchema = z26.object({
|
|
|
8727
8218
|
}
|
|
8728
8219
|
if (agentKeys.length > 1) {
|
|
8729
8220
|
ctx.addIssue({
|
|
8730
|
-
code:
|
|
8221
|
+
code: z27.ZodIssueCode.custom,
|
|
8731
8222
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
8732
8223
|
path: ["agents"]
|
|
8733
8224
|
});
|
|
@@ -8739,7 +8230,7 @@ var cliComposeSchema = z26.object({
|
|
|
8739
8230
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
8740
8231
|
if (!config.volumes) {
|
|
8741
8232
|
ctx.addIssue({
|
|
8742
|
-
code:
|
|
8233
|
+
code: z27.ZodIssueCode.custom,
|
|
8743
8234
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
8744
8235
|
path: ["volumes"]
|
|
8745
8236
|
});
|
|
@@ -8749,7 +8240,7 @@ var cliComposeSchema = z26.object({
|
|
|
8749
8240
|
const parts = volDeclaration.split(":");
|
|
8750
8241
|
if (parts.length !== 2) {
|
|
8751
8242
|
ctx.addIssue({
|
|
8752
|
-
code:
|
|
8243
|
+
code: z27.ZodIssueCode.custom,
|
|
8753
8244
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
8754
8245
|
path: ["agents", agentName, "volumes"]
|
|
8755
8246
|
});
|
|
@@ -8758,7 +8249,7 @@ var cliComposeSchema = z26.object({
|
|
|
8758
8249
|
const volumeKey = parts[0].trim();
|
|
8759
8250
|
if (!config.volumes[volumeKey]) {
|
|
8760
8251
|
ctx.addIssue({
|
|
8761
|
-
code:
|
|
8252
|
+
code: z27.ZodIssueCode.custom,
|
|
8762
8253
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
8763
8254
|
path: ["volumes", volumeKey]
|
|
8764
8255
|
});
|
|
@@ -9586,7 +9077,7 @@ async function loadAndValidateConfig(configFile) {
|
|
|
9586
9077
|
const content = await readFile4(configFile, "utf8");
|
|
9587
9078
|
let config;
|
|
9588
9079
|
try {
|
|
9589
|
-
config =
|
|
9080
|
+
config = parseYaml3(content);
|
|
9590
9081
|
} catch (error) {
|
|
9591
9082
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
9592
9083
|
throw new Error(`Invalid YAML format: ${message}`);
|
|
@@ -9855,7 +9346,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
9855
9346
|
process.exit(0);
|
|
9856
9347
|
}
|
|
9857
9348
|
mergeSkillVariables(agent, variables);
|
|
9858
|
-
expandFirewallConfigs(config);
|
|
9349
|
+
await expandFirewallConfigs(config);
|
|
9859
9350
|
if (!options.json) {
|
|
9860
9351
|
console.log("Uploading compose...");
|
|
9861
9352
|
}
|
|
@@ -9995,7 +9486,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9995
9486
|
options.autoUpdate = false;
|
|
9996
9487
|
}
|
|
9997
9488
|
if (options.autoUpdate !== false) {
|
|
9998
|
-
await startSilentUpgrade("9.
|
|
9489
|
+
await startSilentUpgrade("9.62.0");
|
|
9999
9490
|
}
|
|
10000
9491
|
try {
|
|
10001
9492
|
let result;
|
|
@@ -11166,7 +10657,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
11166
10657
|
withErrorHandler(
|
|
11167
10658
|
async (identifier, prompt, options) => {
|
|
11168
10659
|
if (options.autoUpdate !== false) {
|
|
11169
|
-
await startSilentUpgrade("9.
|
|
10660
|
+
await startSilentUpgrade("9.62.0");
|
|
11170
10661
|
}
|
|
11171
10662
|
const { org, name, version } = parseIdentifier(identifier);
|
|
11172
10663
|
let composeId;
|
|
@@ -11604,7 +11095,7 @@ import path7 from "path";
|
|
|
11604
11095
|
// src/lib/storage/storage-utils.ts
|
|
11605
11096
|
import { readFile as readFile5, writeFile as writeFile4, mkdir as mkdir4 } from "fs/promises";
|
|
11606
11097
|
import { existsSync as existsSync7 } from "fs";
|
|
11607
|
-
import { parse as
|
|
11098
|
+
import { parse as parseYaml4, stringify as stringifyYaml } from "yaml";
|
|
11608
11099
|
import path6 from "path";
|
|
11609
11100
|
var CONFIG_DIR = ".vm0";
|
|
11610
11101
|
var CONFIG_FILE = "storage.yaml";
|
|
@@ -11628,7 +11119,7 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
11628
11119
|
return null;
|
|
11629
11120
|
}
|
|
11630
11121
|
const content = await readFile5(actualPath, "utf8");
|
|
11631
|
-
const config =
|
|
11122
|
+
const config = parseYaml4(content);
|
|
11632
11123
|
if (!config.type) {
|
|
11633
11124
|
config.type = "volume";
|
|
11634
11125
|
}
|
|
@@ -12544,7 +12035,7 @@ import chalk35 from "chalk";
|
|
|
12544
12035
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
12545
12036
|
import { existsSync as existsSync10 } from "fs";
|
|
12546
12037
|
import path13 from "path";
|
|
12547
|
-
import { parse as
|
|
12038
|
+
import { parse as parseYaml5 } from "yaml";
|
|
12548
12039
|
|
|
12549
12040
|
// src/lib/domain/cook-state.ts
|
|
12550
12041
|
import { homedir as homedir3 } from "os";
|
|
@@ -12743,7 +12234,7 @@ async function loadAndValidateConfig2() {
|
|
|
12743
12234
|
let config;
|
|
12744
12235
|
try {
|
|
12745
12236
|
const content = await readFile7(CONFIG_FILE2, "utf8");
|
|
12746
|
-
config =
|
|
12237
|
+
config = parseYaml5(content);
|
|
12747
12238
|
} catch (error) {
|
|
12748
12239
|
if (error instanceof Error) {
|
|
12749
12240
|
throw new Error("Invalid YAML format", { cause: error });
|
|
@@ -12880,7 +12371,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
12880
12371
|
withErrorHandler(
|
|
12881
12372
|
async (prompt, options) => {
|
|
12882
12373
|
if (options.autoUpdate !== false) {
|
|
12883
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12374
|
+
const shouldExit = await checkAndUpgrade("9.62.0", prompt);
|
|
12884
12375
|
if (shouldExit) {
|
|
12885
12376
|
process.exit(0);
|
|
12886
12377
|
}
|
|
@@ -14849,7 +14340,7 @@ import { Command as Command56 } from "commander";
|
|
|
14849
14340
|
import chalk51 from "chalk";
|
|
14850
14341
|
|
|
14851
14342
|
// src/lib/domain/schedule-utils.ts
|
|
14852
|
-
import { parse as
|
|
14343
|
+
import { parse as parseYaml6 } from "yaml";
|
|
14853
14344
|
function formatRelativeTime2(dateStr) {
|
|
14854
14345
|
if (!dateStr) return "-";
|
|
14855
14346
|
const date = new Date(dateStr);
|
|
@@ -18019,13 +17510,13 @@ var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CL
|
|
|
18019
17510
|
if (latestVersion === null) {
|
|
18020
17511
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18021
17512
|
}
|
|
18022
|
-
if (latestVersion === "9.
|
|
18023
|
-
console.log(chalk80.green(`\u2713 Already up to date (${"9.
|
|
17513
|
+
if (latestVersion === "9.62.0") {
|
|
17514
|
+
console.log(chalk80.green(`\u2713 Already up to date (${"9.62.0"})`));
|
|
18024
17515
|
return;
|
|
18025
17516
|
}
|
|
18026
17517
|
console.log(
|
|
18027
17518
|
chalk80.yellow(
|
|
18028
|
-
`Current version: ${"9.
|
|
17519
|
+
`Current version: ${"9.62.0"} -> Latest version: ${latestVersion}`
|
|
18029
17520
|
)
|
|
18030
17521
|
);
|
|
18031
17522
|
console.log();
|
|
@@ -18052,7 +17543,7 @@ var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CL
|
|
|
18052
17543
|
const success = await performUpgrade(packageManager);
|
|
18053
17544
|
if (success) {
|
|
18054
17545
|
console.log(
|
|
18055
|
-
chalk80.green(`\u2713 Upgraded from ${"9.
|
|
17546
|
+
chalk80.green(`\u2713 Upgraded from ${"9.62.0"} to ${latestVersion}`)
|
|
18056
17547
|
);
|
|
18057
17548
|
return;
|
|
18058
17549
|
}
|
|
@@ -18066,7 +17557,7 @@ var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CL
|
|
|
18066
17557
|
|
|
18067
17558
|
// src/index.ts
|
|
18068
17559
|
var program = new Command87();
|
|
18069
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
17560
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.62.0");
|
|
18070
17561
|
program.addCommand(authCommand);
|
|
18071
17562
|
program.addCommand(infoCommand);
|
|
18072
17563
|
program.addCommand(composeCommand);
|