@vm0/cli 9.77.2 → 9.78.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 +1063 -1149
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -47,7 +47,7 @@ if (DSN) {
|
|
|
47
47
|
Sentry.init({
|
|
48
48
|
dsn: DSN,
|
|
49
49
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
50
|
-
release: "9.
|
|
50
|
+
release: "9.78.0",
|
|
51
51
|
sendDefaultPii: false,
|
|
52
52
|
tracesSampleRate: 0,
|
|
53
53
|
shutdownTimeout: 500,
|
|
@@ -66,7 +66,7 @@ if (DSN) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
Sentry.setContext("cli", {
|
|
69
|
-
version: "9.
|
|
69
|
+
version: "9.78.0",
|
|
70
70
|
command: process.argv.slice(2).join(" ")
|
|
71
71
|
});
|
|
72
72
|
Sentry.setContext("runtime", {
|
|
@@ -248,7 +248,7 @@ async function exchangeToken(apiUrl, deviceCode) {
|
|
|
248
248
|
return response.json();
|
|
249
249
|
}
|
|
250
250
|
function delay(ms) {
|
|
251
|
-
return new Promise((
|
|
251
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
252
252
|
}
|
|
253
253
|
async function authenticate(apiUrl) {
|
|
254
254
|
const targetApiUrl = apiUrl ?? await getApiUrl();
|
|
@@ -12544,23 +12544,23 @@ function validateRule(rule, permName, serviceName) {
|
|
|
12544
12544
|
`Invalid rule "${rule}" in permission "${permName}" of firewall "${serviceName}": must be "METHOD /path"`
|
|
12545
12545
|
);
|
|
12546
12546
|
}
|
|
12547
|
-
const [method,
|
|
12547
|
+
const [method, path17] = parts;
|
|
12548
12548
|
if (!VALID_RULE_METHODS.has(method)) {
|
|
12549
12549
|
throw new Error(
|
|
12550
12550
|
`Invalid rule "${rule}" in permission "${permName}" of firewall "${serviceName}": unknown method "${method}" (must be uppercase)`
|
|
12551
12551
|
);
|
|
12552
12552
|
}
|
|
12553
|
-
if (!
|
|
12553
|
+
if (!path17.startsWith("/")) {
|
|
12554
12554
|
throw new Error(
|
|
12555
12555
|
`Invalid rule "${rule}" in permission "${permName}" of firewall "${serviceName}": path must start with "/"`
|
|
12556
12556
|
);
|
|
12557
12557
|
}
|
|
12558
|
-
if (
|
|
12558
|
+
if (path17.includes("?") || path17.includes("#")) {
|
|
12559
12559
|
throw new Error(
|
|
12560
12560
|
`Invalid rule "${rule}" in permission "${permName}" of firewall "${serviceName}": path must not contain query string or fragment`
|
|
12561
12561
|
);
|
|
12562
12562
|
}
|
|
12563
|
-
const segments =
|
|
12563
|
+
const segments = path17.split("/").filter(Boolean);
|
|
12564
12564
|
const paramNames = /* @__PURE__ */ new Set();
|
|
12565
12565
|
for (let i = 0; i < segments.length; i++) {
|
|
12566
12566
|
const seg = segments[i];
|
|
@@ -12835,63 +12835,37 @@ var skillsResolveContract = c17.router({
|
|
|
12835
12835
|
}
|
|
12836
12836
|
});
|
|
12837
12837
|
|
|
12838
|
-
// ../../packages/core/src/contracts/
|
|
12838
|
+
// ../../packages/core/src/contracts/zero-agents.ts
|
|
12839
12839
|
import { z as z26 } from "zod";
|
|
12840
12840
|
var c18 = initContract();
|
|
12841
|
-
var
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
/**
|
|
12849
|
-
* GET /api/agent/required-env
|
|
12850
|
-
* Get required environment variables for user agents
|
|
12851
|
-
*/
|
|
12852
|
-
getRequiredEnv: {
|
|
12853
|
-
method: "GET",
|
|
12854
|
-
path: "/api/agent/required-env",
|
|
12855
|
-
headers: authHeadersSchema,
|
|
12856
|
-
responses: {
|
|
12857
|
-
200: z26.object({ agents: z26.array(agentRequiredEnvSchema) }),
|
|
12858
|
-
401: apiErrorSchema
|
|
12859
|
-
},
|
|
12860
|
-
summary: "Get required environment variables for user agents"
|
|
12861
|
-
}
|
|
12862
|
-
});
|
|
12863
|
-
|
|
12864
|
-
// ../../packages/core/src/contracts/zero-agents.ts
|
|
12865
|
-
import { z as z27 } from "zod";
|
|
12866
|
-
var c19 = initContract();
|
|
12867
|
-
var zeroAgentResponseSchema = z27.object({
|
|
12868
|
-
name: z27.string(),
|
|
12869
|
-
agentComposeId: z27.string(),
|
|
12870
|
-
description: z27.string().nullable(),
|
|
12871
|
-
displayName: z27.string().nullable(),
|
|
12872
|
-
sound: z27.string().nullable(),
|
|
12873
|
-
connectors: z27.array(z27.string()),
|
|
12841
|
+
var zeroAgentResponseSchema = z26.object({
|
|
12842
|
+
name: z26.string(),
|
|
12843
|
+
agentComposeId: z26.string(),
|
|
12844
|
+
description: z26.string().nullable(),
|
|
12845
|
+
displayName: z26.string().nullable(),
|
|
12846
|
+
sound: z26.string().nullable(),
|
|
12847
|
+
connectors: z26.array(z26.string()),
|
|
12874
12848
|
firewallPolicies: firewallPoliciesSchema.nullable()
|
|
12875
12849
|
});
|
|
12876
|
-
var zeroAgentRequestSchema =
|
|
12877
|
-
description:
|
|
12878
|
-
displayName:
|
|
12879
|
-
sound:
|
|
12880
|
-
connectors:
|
|
12850
|
+
var zeroAgentRequestSchema = z26.object({
|
|
12851
|
+
description: z26.string().optional(),
|
|
12852
|
+
displayName: z26.string().optional(),
|
|
12853
|
+
sound: z26.string().optional(),
|
|
12854
|
+
connectors: z26.array(z26.string())
|
|
12881
12855
|
});
|
|
12882
|
-
var zeroAgentMetadataRequestSchema =
|
|
12883
|
-
displayName:
|
|
12884
|
-
description:
|
|
12885
|
-
sound:
|
|
12856
|
+
var zeroAgentMetadataRequestSchema = z26.object({
|
|
12857
|
+
displayName: z26.string().optional(),
|
|
12858
|
+
description: z26.string().optional(),
|
|
12859
|
+
sound: z26.string().optional()
|
|
12886
12860
|
});
|
|
12887
|
-
var zeroAgentInstructionsResponseSchema =
|
|
12888
|
-
content:
|
|
12889
|
-
filename:
|
|
12861
|
+
var zeroAgentInstructionsResponseSchema = z26.object({
|
|
12862
|
+
content: z26.string().nullable(),
|
|
12863
|
+
filename: z26.string().nullable()
|
|
12890
12864
|
});
|
|
12891
|
-
var zeroAgentInstructionsRequestSchema =
|
|
12892
|
-
content:
|
|
12865
|
+
var zeroAgentInstructionsRequestSchema = z26.object({
|
|
12866
|
+
content: z26.string()
|
|
12893
12867
|
});
|
|
12894
|
-
var zeroAgentsMainContract =
|
|
12868
|
+
var zeroAgentsMainContract = c18.router({
|
|
12895
12869
|
create: {
|
|
12896
12870
|
method: "POST",
|
|
12897
12871
|
path: "/api/zero/agents",
|
|
@@ -12910,18 +12884,18 @@ var zeroAgentsMainContract = c19.router({
|
|
|
12910
12884
|
path: "/api/zero/agents",
|
|
12911
12885
|
headers: authHeadersSchema,
|
|
12912
12886
|
responses: {
|
|
12913
|
-
200:
|
|
12887
|
+
200: z26.array(zeroAgentResponseSchema),
|
|
12914
12888
|
401: apiErrorSchema
|
|
12915
12889
|
},
|
|
12916
12890
|
summary: "List zero agents"
|
|
12917
12891
|
}
|
|
12918
12892
|
});
|
|
12919
|
-
var zeroAgentsByNameContract =
|
|
12893
|
+
var zeroAgentsByNameContract = c18.router({
|
|
12920
12894
|
get: {
|
|
12921
12895
|
method: "GET",
|
|
12922
12896
|
path: "/api/zero/agents/:name",
|
|
12923
12897
|
headers: authHeadersSchema,
|
|
12924
|
-
pathParams:
|
|
12898
|
+
pathParams: z26.object({ name: z26.string() }),
|
|
12925
12899
|
responses: {
|
|
12926
12900
|
200: zeroAgentResponseSchema,
|
|
12927
12901
|
401: apiErrorSchema,
|
|
@@ -12933,7 +12907,7 @@ var zeroAgentsByNameContract = c19.router({
|
|
|
12933
12907
|
method: "PUT",
|
|
12934
12908
|
path: "/api/zero/agents/:name",
|
|
12935
12909
|
headers: authHeadersSchema,
|
|
12936
|
-
pathParams:
|
|
12910
|
+
pathParams: z26.object({ name: z26.string() }),
|
|
12937
12911
|
body: zeroAgentRequestSchema,
|
|
12938
12912
|
responses: {
|
|
12939
12913
|
200: zeroAgentResponseSchema,
|
|
@@ -12948,7 +12922,7 @@ var zeroAgentsByNameContract = c19.router({
|
|
|
12948
12922
|
method: "PATCH",
|
|
12949
12923
|
path: "/api/zero/agents/:name",
|
|
12950
12924
|
headers: authHeadersSchema,
|
|
12951
|
-
pathParams:
|
|
12925
|
+
pathParams: z26.object({ name: z26.string() }),
|
|
12952
12926
|
body: zeroAgentMetadataRequestSchema,
|
|
12953
12927
|
responses: {
|
|
12954
12928
|
200: zeroAgentResponseSchema,
|
|
@@ -12961,21 +12935,21 @@ var zeroAgentsByNameContract = c19.router({
|
|
|
12961
12935
|
method: "DELETE",
|
|
12962
12936
|
path: "/api/zero/agents/:name",
|
|
12963
12937
|
headers: authHeadersSchema,
|
|
12964
|
-
pathParams:
|
|
12965
|
-
body:
|
|
12938
|
+
pathParams: z26.object({ name: z26.string() }),
|
|
12939
|
+
body: c18.noBody(),
|
|
12966
12940
|
responses: {
|
|
12967
|
-
204:
|
|
12941
|
+
204: c18.noBody(),
|
|
12968
12942
|
401: apiErrorSchema,
|
|
12969
12943
|
404: apiErrorSchema
|
|
12970
12944
|
},
|
|
12971
12945
|
summary: "Delete zero agent by name"
|
|
12972
12946
|
}
|
|
12973
12947
|
});
|
|
12974
|
-
var zeroAgentFirewallPoliciesRequestSchema =
|
|
12975
|
-
name:
|
|
12948
|
+
var zeroAgentFirewallPoliciesRequestSchema = z26.object({
|
|
12949
|
+
name: z26.string(),
|
|
12976
12950
|
policies: firewallPoliciesSchema
|
|
12977
12951
|
});
|
|
12978
|
-
var zeroAgentFirewallPoliciesContract =
|
|
12952
|
+
var zeroAgentFirewallPoliciesContract = c18.router({
|
|
12979
12953
|
update: {
|
|
12980
12954
|
method: "PUT",
|
|
12981
12955
|
path: "/api/zero/firewall-policies",
|
|
@@ -12991,12 +12965,12 @@ var zeroAgentFirewallPoliciesContract = c19.router({
|
|
|
12991
12965
|
summary: "Update zero agent firewall policies (admin only)"
|
|
12992
12966
|
}
|
|
12993
12967
|
});
|
|
12994
|
-
var zeroAgentInstructionsContract =
|
|
12968
|
+
var zeroAgentInstructionsContract = c18.router({
|
|
12995
12969
|
get: {
|
|
12996
12970
|
method: "GET",
|
|
12997
12971
|
path: "/api/zero/agents/:name/instructions",
|
|
12998
12972
|
headers: authHeadersSchema,
|
|
12999
|
-
pathParams:
|
|
12973
|
+
pathParams: z26.object({ name: z26.string() }),
|
|
13000
12974
|
responses: {
|
|
13001
12975
|
200: zeroAgentInstructionsResponseSchema,
|
|
13002
12976
|
401: apiErrorSchema,
|
|
@@ -13008,7 +12982,7 @@ var zeroAgentInstructionsContract = c19.router({
|
|
|
13008
12982
|
method: "PUT",
|
|
13009
12983
|
path: "/api/zero/agents/:name/instructions",
|
|
13010
12984
|
headers: authHeadersSchema,
|
|
13011
|
-
pathParams:
|
|
12985
|
+
pathParams: z26.object({ name: z26.string() }),
|
|
13012
12986
|
body: zeroAgentInstructionsRequestSchema,
|
|
13013
12987
|
responses: {
|
|
13014
12988
|
200: zeroAgentResponseSchema,
|
|
@@ -13021,9 +12995,9 @@ var zeroAgentInstructionsContract = c19.router({
|
|
|
13021
12995
|
});
|
|
13022
12996
|
|
|
13023
12997
|
// ../../packages/core/src/contracts/zero-connectors.ts
|
|
13024
|
-
import { z as
|
|
13025
|
-
var
|
|
13026
|
-
var zeroConnectorsMainContract =
|
|
12998
|
+
import { z as z27 } from "zod";
|
|
12999
|
+
var c19 = initContract();
|
|
13000
|
+
var zeroConnectorsMainContract = c19.router({
|
|
13027
13001
|
list: {
|
|
13028
13002
|
method: "GET",
|
|
13029
13003
|
path: "/api/zero/connectors",
|
|
@@ -13036,12 +13010,12 @@ var zeroConnectorsMainContract = c20.router({
|
|
|
13036
13010
|
summary: "List all connectors (zero proxy)"
|
|
13037
13011
|
}
|
|
13038
13012
|
});
|
|
13039
|
-
var zeroConnectorsByTypeContract =
|
|
13013
|
+
var zeroConnectorsByTypeContract = c19.router({
|
|
13040
13014
|
get: {
|
|
13041
13015
|
method: "GET",
|
|
13042
13016
|
path: "/api/zero/connectors/:type",
|
|
13043
13017
|
headers: authHeadersSchema,
|
|
13044
|
-
pathParams:
|
|
13018
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13045
13019
|
responses: {
|
|
13046
13020
|
200: connectorResponseSchema,
|
|
13047
13021
|
401: apiErrorSchema,
|
|
@@ -13053,21 +13027,21 @@ var zeroConnectorsByTypeContract = c20.router({
|
|
|
13053
13027
|
method: "DELETE",
|
|
13054
13028
|
path: "/api/zero/connectors/:type",
|
|
13055
13029
|
headers: authHeadersSchema,
|
|
13056
|
-
pathParams:
|
|
13030
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13057
13031
|
responses: {
|
|
13058
|
-
204:
|
|
13032
|
+
204: c19.noBody(),
|
|
13059
13033
|
401: apiErrorSchema,
|
|
13060
13034
|
404: apiErrorSchema
|
|
13061
13035
|
},
|
|
13062
13036
|
summary: "Disconnect a connector (zero proxy)"
|
|
13063
13037
|
}
|
|
13064
13038
|
});
|
|
13065
|
-
var zeroConnectorScopeDiffContract =
|
|
13039
|
+
var zeroConnectorScopeDiffContract = c19.router({
|
|
13066
13040
|
getScopeDiff: {
|
|
13067
13041
|
method: "GET",
|
|
13068
13042
|
path: "/api/zero/connectors/:type/scope-diff",
|
|
13069
13043
|
headers: authHeadersSchema,
|
|
13070
|
-
pathParams:
|
|
13044
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13071
13045
|
responses: {
|
|
13072
13046
|
200: scopeDiffResponseSchema,
|
|
13073
13047
|
401: apiErrorSchema,
|
|
@@ -13076,22 +13050,22 @@ var zeroConnectorScopeDiffContract = c20.router({
|
|
|
13076
13050
|
summary: "Get scope diff for a connector"
|
|
13077
13051
|
}
|
|
13078
13052
|
});
|
|
13079
|
-
var connectorSearchAuthMethodSchema =
|
|
13080
|
-
var connectorSearchItemSchema =
|
|
13081
|
-
id:
|
|
13082
|
-
label:
|
|
13083
|
-
description:
|
|
13084
|
-
authMethods:
|
|
13053
|
+
var connectorSearchAuthMethodSchema = z27.enum(["oauth", "api-token"]);
|
|
13054
|
+
var connectorSearchItemSchema = z27.object({
|
|
13055
|
+
id: z27.string(),
|
|
13056
|
+
label: z27.string(),
|
|
13057
|
+
description: z27.string(),
|
|
13058
|
+
authMethods: z27.array(connectorSearchAuthMethodSchema)
|
|
13085
13059
|
});
|
|
13086
|
-
var connectorSearchResponseSchema =
|
|
13087
|
-
connectors:
|
|
13060
|
+
var connectorSearchResponseSchema = z27.object({
|
|
13061
|
+
connectors: z27.array(connectorSearchItemSchema)
|
|
13088
13062
|
});
|
|
13089
|
-
var zeroConnectorsSearchContract =
|
|
13063
|
+
var zeroConnectorsSearchContract = c19.router({
|
|
13090
13064
|
search: {
|
|
13091
13065
|
method: "GET",
|
|
13092
13066
|
path: "/api/zero/connectors/search",
|
|
13093
13067
|
headers: authHeadersSchema,
|
|
13094
|
-
query:
|
|
13068
|
+
query: z27.object({ keyword: z27.string().optional() }),
|
|
13095
13069
|
responses: {
|
|
13096
13070
|
200: connectorSearchResponseSchema,
|
|
13097
13071
|
401: apiErrorSchema
|
|
@@ -13099,13 +13073,13 @@ var zeroConnectorsSearchContract = c20.router({
|
|
|
13099
13073
|
summary: "Search available connector types"
|
|
13100
13074
|
}
|
|
13101
13075
|
});
|
|
13102
|
-
var zeroConnectorSessionsContract =
|
|
13076
|
+
var zeroConnectorSessionsContract = c19.router({
|
|
13103
13077
|
create: {
|
|
13104
13078
|
method: "POST",
|
|
13105
13079
|
path: "/api/zero/connectors/:type/sessions",
|
|
13106
13080
|
headers: authHeadersSchema,
|
|
13107
|
-
pathParams:
|
|
13108
|
-
body:
|
|
13081
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13082
|
+
body: z27.object({}).optional(),
|
|
13109
13083
|
responses: {
|
|
13110
13084
|
200: connectorSessionResponseSchema,
|
|
13111
13085
|
400: apiErrorSchema,
|
|
@@ -13114,14 +13088,14 @@ var zeroConnectorSessionsContract = c20.router({
|
|
|
13114
13088
|
summary: "Create connector session for device flow (zero proxy)"
|
|
13115
13089
|
}
|
|
13116
13090
|
});
|
|
13117
|
-
var zeroConnectorSessionByIdContract =
|
|
13091
|
+
var zeroConnectorSessionByIdContract = c19.router({
|
|
13118
13092
|
get: {
|
|
13119
13093
|
method: "GET",
|
|
13120
13094
|
path: "/api/zero/connectors/:type/sessions/:sessionId",
|
|
13121
13095
|
headers: authHeadersSchema,
|
|
13122
|
-
pathParams:
|
|
13096
|
+
pathParams: z27.object({
|
|
13123
13097
|
type: connectorTypeSchema,
|
|
13124
|
-
sessionId:
|
|
13098
|
+
sessionId: z27.uuid()
|
|
13125
13099
|
}),
|
|
13126
13100
|
responses: {
|
|
13127
13101
|
200: connectorSessionStatusResponseSchema,
|
|
@@ -13132,12 +13106,12 @@ var zeroConnectorSessionByIdContract = c20.router({
|
|
|
13132
13106
|
summary: "Get connector session status (zero proxy)"
|
|
13133
13107
|
}
|
|
13134
13108
|
});
|
|
13135
|
-
var zeroComputerConnectorContract =
|
|
13109
|
+
var zeroComputerConnectorContract = c19.router({
|
|
13136
13110
|
create: {
|
|
13137
13111
|
method: "POST",
|
|
13138
13112
|
path: "/api/zero/connectors/computer",
|
|
13139
13113
|
headers: authHeadersSchema,
|
|
13140
|
-
body:
|
|
13114
|
+
body: z27.object({}).optional(),
|
|
13141
13115
|
responses: {
|
|
13142
13116
|
200: computerConnectorCreateResponseSchema,
|
|
13143
13117
|
400: apiErrorSchema,
|
|
@@ -13162,7 +13136,7 @@ var zeroComputerConnectorContract = c20.router({
|
|
|
13162
13136
|
path: "/api/zero/connectors/computer",
|
|
13163
13137
|
headers: authHeadersSchema,
|
|
13164
13138
|
responses: {
|
|
13165
|
-
204:
|
|
13139
|
+
204: c19.noBody(),
|
|
13166
13140
|
401: apiErrorSchema,
|
|
13167
13141
|
404: apiErrorSchema
|
|
13168
13142
|
},
|
|
@@ -13171,9 +13145,9 @@ var zeroComputerConnectorContract = c20.router({
|
|
|
13171
13145
|
});
|
|
13172
13146
|
|
|
13173
13147
|
// ../../packages/core/src/contracts/zero-org.ts
|
|
13174
|
-
import { z as
|
|
13175
|
-
var
|
|
13176
|
-
var zeroOrgContract =
|
|
13148
|
+
import { z as z28 } from "zod";
|
|
13149
|
+
var c20 = initContract();
|
|
13150
|
+
var zeroOrgContract = c20.router({
|
|
13177
13151
|
get: {
|
|
13178
13152
|
method: "GET",
|
|
13179
13153
|
path: "/api/zero/org",
|
|
@@ -13202,12 +13176,12 @@ var zeroOrgContract = c21.router({
|
|
|
13202
13176
|
summary: "Update org slug (zero proxy)"
|
|
13203
13177
|
}
|
|
13204
13178
|
});
|
|
13205
|
-
var zeroOrgLeaveContract =
|
|
13179
|
+
var zeroOrgLeaveContract = c20.router({
|
|
13206
13180
|
leave: {
|
|
13207
13181
|
method: "POST",
|
|
13208
13182
|
path: "/api/zero/org/leave",
|
|
13209
13183
|
headers: authHeadersSchema,
|
|
13210
|
-
body:
|
|
13184
|
+
body: z28.object({}),
|
|
13211
13185
|
responses: {
|
|
13212
13186
|
200: orgMessageResponseSchema,
|
|
13213
13187
|
401: apiErrorSchema,
|
|
@@ -13217,12 +13191,12 @@ var zeroOrgLeaveContract = c21.router({
|
|
|
13217
13191
|
summary: "Leave the current org (zero proxy)"
|
|
13218
13192
|
}
|
|
13219
13193
|
});
|
|
13220
|
-
var zeroOrgDeleteContract =
|
|
13194
|
+
var zeroOrgDeleteContract = c20.router({
|
|
13221
13195
|
delete: {
|
|
13222
13196
|
method: "POST",
|
|
13223
13197
|
path: "/api/zero/org/delete",
|
|
13224
13198
|
headers: authHeadersSchema,
|
|
13225
|
-
body:
|
|
13199
|
+
body: z28.object({ slug: z28.string() }),
|
|
13226
13200
|
responses: {
|
|
13227
13201
|
200: orgMessageResponseSchema,
|
|
13228
13202
|
400: apiErrorSchema,
|
|
@@ -13235,8 +13209,8 @@ var zeroOrgDeleteContract = c21.router({
|
|
|
13235
13209
|
});
|
|
13236
13210
|
|
|
13237
13211
|
// ../../packages/core/src/contracts/zero-org-list.ts
|
|
13238
|
-
var
|
|
13239
|
-
var zeroOrgListContract =
|
|
13212
|
+
var c21 = initContract();
|
|
13213
|
+
var zeroOrgListContract = c21.router({
|
|
13240
13214
|
list: {
|
|
13241
13215
|
method: "GET",
|
|
13242
13216
|
path: "/api/zero/org/list",
|
|
@@ -13251,8 +13225,8 @@ var zeroOrgListContract = c22.router({
|
|
|
13251
13225
|
});
|
|
13252
13226
|
|
|
13253
13227
|
// ../../packages/core/src/contracts/zero-org-members.ts
|
|
13254
|
-
var
|
|
13255
|
-
var zeroOrgMembersContract =
|
|
13228
|
+
var c22 = initContract();
|
|
13229
|
+
var zeroOrgMembersContract = c22.router({
|
|
13256
13230
|
members: {
|
|
13257
13231
|
method: "GET",
|
|
13258
13232
|
path: "/api/zero/org/members",
|
|
@@ -13296,7 +13270,7 @@ var zeroOrgMembersContract = c23.router({
|
|
|
13296
13270
|
summary: "Remove a member from the org (zero proxy)"
|
|
13297
13271
|
}
|
|
13298
13272
|
});
|
|
13299
|
-
var zeroOrgInviteContract =
|
|
13273
|
+
var zeroOrgInviteContract = c22.router({
|
|
13300
13274
|
invite: {
|
|
13301
13275
|
method: "POST",
|
|
13302
13276
|
path: "/api/zero/org/invite",
|
|
@@ -13314,16 +13288,16 @@ var zeroOrgInviteContract = c23.router({
|
|
|
13314
13288
|
});
|
|
13315
13289
|
|
|
13316
13290
|
// ../../packages/core/src/contracts/zero-composes.ts
|
|
13317
|
-
import { z as
|
|
13318
|
-
var
|
|
13319
|
-
var zeroComposesMainContract =
|
|
13291
|
+
import { z as z29 } from "zod";
|
|
13292
|
+
var c23 = initContract();
|
|
13293
|
+
var zeroComposesMainContract = c23.router({
|
|
13320
13294
|
getByName: {
|
|
13321
13295
|
method: "GET",
|
|
13322
13296
|
path: "/api/zero/composes",
|
|
13323
13297
|
headers: authHeadersSchema,
|
|
13324
|
-
query:
|
|
13325
|
-
name:
|
|
13326
|
-
org:
|
|
13298
|
+
query: z29.object({
|
|
13299
|
+
name: z29.string().min(1, "Missing name query parameter"),
|
|
13300
|
+
org: z29.string().optional()
|
|
13327
13301
|
}),
|
|
13328
13302
|
responses: {
|
|
13329
13303
|
200: composeResponseSchema,
|
|
@@ -13334,13 +13308,13 @@ var zeroComposesMainContract = c24.router({
|
|
|
13334
13308
|
summary: "Get agent compose by name (zero proxy)"
|
|
13335
13309
|
}
|
|
13336
13310
|
});
|
|
13337
|
-
var zeroComposesByIdContract =
|
|
13311
|
+
var zeroComposesByIdContract = c23.router({
|
|
13338
13312
|
getById: {
|
|
13339
13313
|
method: "GET",
|
|
13340
13314
|
path: "/api/zero/composes/:id",
|
|
13341
13315
|
headers: authHeadersSchema,
|
|
13342
|
-
pathParams:
|
|
13343
|
-
id:
|
|
13316
|
+
pathParams: z29.object({
|
|
13317
|
+
id: z29.string().min(1, "Compose ID is required")
|
|
13344
13318
|
}),
|
|
13345
13319
|
responses: {
|
|
13346
13320
|
200: composeResponseSchema,
|
|
@@ -13354,12 +13328,12 @@ var zeroComposesByIdContract = c24.router({
|
|
|
13354
13328
|
method: "DELETE",
|
|
13355
13329
|
path: "/api/zero/composes/:id",
|
|
13356
13330
|
headers: authHeadersSchema,
|
|
13357
|
-
pathParams:
|
|
13358
|
-
id:
|
|
13331
|
+
pathParams: z29.object({
|
|
13332
|
+
id: z29.string().uuid("Compose ID is required")
|
|
13359
13333
|
}),
|
|
13360
|
-
body:
|
|
13334
|
+
body: c23.noBody(),
|
|
13361
13335
|
responses: {
|
|
13362
|
-
204:
|
|
13336
|
+
204: c23.noBody(),
|
|
13363
13337
|
401: apiErrorSchema,
|
|
13364
13338
|
403: apiErrorSchema,
|
|
13365
13339
|
404: apiErrorSchema,
|
|
@@ -13368,17 +13342,17 @@ var zeroComposesByIdContract = c24.router({
|
|
|
13368
13342
|
summary: "Delete agent compose (zero proxy)"
|
|
13369
13343
|
}
|
|
13370
13344
|
});
|
|
13371
|
-
var zeroComposesListContract =
|
|
13345
|
+
var zeroComposesListContract = c23.router({
|
|
13372
13346
|
list: {
|
|
13373
13347
|
method: "GET",
|
|
13374
13348
|
path: "/api/zero/composes/list",
|
|
13375
13349
|
headers: authHeadersSchema,
|
|
13376
|
-
query:
|
|
13377
|
-
org:
|
|
13350
|
+
query: z29.object({
|
|
13351
|
+
org: z29.string().optional()
|
|
13378
13352
|
}),
|
|
13379
13353
|
responses: {
|
|
13380
|
-
200:
|
|
13381
|
-
composes:
|
|
13354
|
+
200: z29.object({
|
|
13355
|
+
composes: z29.array(composeListItemSchema)
|
|
13382
13356
|
}),
|
|
13383
13357
|
400: apiErrorSchema,
|
|
13384
13358
|
401: apiErrorSchema,
|
|
@@ -13389,7 +13363,7 @@ var zeroComposesListContract = c24.router({
|
|
|
13389
13363
|
});
|
|
13390
13364
|
|
|
13391
13365
|
// ../../packages/core/src/contracts/zero-runs.ts
|
|
13392
|
-
import { z as
|
|
13366
|
+
import { z as z30 } from "zod";
|
|
13393
13367
|
var zeroRunRequestSchema = unifiedRunRequestSchema.omit({
|
|
13394
13368
|
triggerSource: true,
|
|
13395
13369
|
memoryName: true,
|
|
@@ -13400,8 +13374,8 @@ var zeroRunRequestSchema = unifiedRunRequestSchema.omit({
|
|
|
13400
13374
|
vars: true,
|
|
13401
13375
|
secrets: true
|
|
13402
13376
|
});
|
|
13403
|
-
var
|
|
13404
|
-
var zeroRunsMainContract =
|
|
13377
|
+
var c24 = initContract();
|
|
13378
|
+
var zeroRunsMainContract = c24.router({
|
|
13405
13379
|
create: {
|
|
13406
13380
|
method: "POST",
|
|
13407
13381
|
path: "/api/zero/runs",
|
|
@@ -13417,13 +13391,13 @@ var zeroRunsMainContract = c25.router({
|
|
|
13417
13391
|
summary: "Create and execute agent run (zero proxy)"
|
|
13418
13392
|
}
|
|
13419
13393
|
});
|
|
13420
|
-
var zeroRunsByIdContract =
|
|
13394
|
+
var zeroRunsByIdContract = c24.router({
|
|
13421
13395
|
getById: {
|
|
13422
13396
|
method: "GET",
|
|
13423
13397
|
path: "/api/zero/runs/:id",
|
|
13424
13398
|
headers: authHeadersSchema,
|
|
13425
|
-
pathParams:
|
|
13426
|
-
id:
|
|
13399
|
+
pathParams: z30.object({
|
|
13400
|
+
id: z30.string().min(1, "Run ID is required")
|
|
13427
13401
|
}),
|
|
13428
13402
|
responses: {
|
|
13429
13403
|
200: getRunResponseSchema,
|
|
@@ -13434,15 +13408,15 @@ var zeroRunsByIdContract = c25.router({
|
|
|
13434
13408
|
summary: "Get agent run by ID (zero proxy)"
|
|
13435
13409
|
}
|
|
13436
13410
|
});
|
|
13437
|
-
var zeroRunsCancelContract =
|
|
13411
|
+
var zeroRunsCancelContract = c24.router({
|
|
13438
13412
|
cancel: {
|
|
13439
13413
|
method: "POST",
|
|
13440
13414
|
path: "/api/zero/runs/:id/cancel",
|
|
13441
13415
|
headers: authHeadersSchema,
|
|
13442
|
-
pathParams:
|
|
13443
|
-
id:
|
|
13416
|
+
pathParams: z30.object({
|
|
13417
|
+
id: z30.string().min(1, "Run ID is required")
|
|
13444
13418
|
}),
|
|
13445
|
-
body:
|
|
13419
|
+
body: z30.undefined(),
|
|
13446
13420
|
responses: {
|
|
13447
13421
|
200: cancelRunResponseSchema,
|
|
13448
13422
|
400: apiErrorSchema,
|
|
@@ -13453,7 +13427,7 @@ var zeroRunsCancelContract = c25.router({
|
|
|
13453
13427
|
summary: "Cancel a pending or running run (zero proxy)"
|
|
13454
13428
|
}
|
|
13455
13429
|
});
|
|
13456
|
-
var zeroRunsQueueContract =
|
|
13430
|
+
var zeroRunsQueueContract = c24.router({
|
|
13457
13431
|
getQueue: {
|
|
13458
13432
|
method: "GET",
|
|
13459
13433
|
path: "/api/zero/runs/queue",
|
|
@@ -13466,18 +13440,18 @@ var zeroRunsQueueContract = c25.router({
|
|
|
13466
13440
|
summary: "Get org run queue status (zero proxy)"
|
|
13467
13441
|
}
|
|
13468
13442
|
});
|
|
13469
|
-
var zeroRunAgentEventsContract =
|
|
13443
|
+
var zeroRunAgentEventsContract = c24.router({
|
|
13470
13444
|
getAgentEvents: {
|
|
13471
13445
|
method: "GET",
|
|
13472
13446
|
path: "/api/zero/runs/:id/telemetry/agent",
|
|
13473
13447
|
headers: authHeadersSchema,
|
|
13474
|
-
pathParams:
|
|
13475
|
-
id:
|
|
13448
|
+
pathParams: z30.object({
|
|
13449
|
+
id: z30.string().min(1, "Run ID is required")
|
|
13476
13450
|
}),
|
|
13477
|
-
query:
|
|
13478
|
-
since:
|
|
13479
|
-
limit:
|
|
13480
|
-
order:
|
|
13451
|
+
query: z30.object({
|
|
13452
|
+
since: z30.coerce.number().optional(),
|
|
13453
|
+
limit: z30.coerce.number().min(1).max(100).default(5),
|
|
13454
|
+
order: z30.enum(["asc", "desc"]).default("desc")
|
|
13481
13455
|
}),
|
|
13482
13456
|
responses: {
|
|
13483
13457
|
200: agentEventsResponseSchema,
|
|
@@ -13489,62 +13463,62 @@ var zeroRunAgentEventsContract = c25.router({
|
|
|
13489
13463
|
});
|
|
13490
13464
|
|
|
13491
13465
|
// ../../packages/core/src/contracts/zero-schedules.ts
|
|
13492
|
-
import { z as
|
|
13493
|
-
var
|
|
13494
|
-
var scheduleResponseSchema =
|
|
13495
|
-
id:
|
|
13496
|
-
zeroAgentId:
|
|
13497
|
-
agentName:
|
|
13498
|
-
orgSlug:
|
|
13499
|
-
userId:
|
|
13500
|
-
name:
|
|
13501
|
-
triggerType:
|
|
13502
|
-
cronExpression:
|
|
13503
|
-
atTime:
|
|
13504
|
-
intervalSeconds:
|
|
13505
|
-
timezone:
|
|
13506
|
-
prompt:
|
|
13507
|
-
description:
|
|
13508
|
-
appendSystemPrompt:
|
|
13509
|
-
vars:
|
|
13510
|
-
secretNames:
|
|
13511
|
-
artifactName:
|
|
13512
|
-
artifactVersion:
|
|
13513
|
-
volumeVersions:
|
|
13514
|
-
enabled:
|
|
13515
|
-
notifyEmail:
|
|
13516
|
-
notifySlack:
|
|
13517
|
-
nextRunAt:
|
|
13518
|
-
lastRunAt:
|
|
13519
|
-
retryStartedAt:
|
|
13520
|
-
consecutiveFailures:
|
|
13521
|
-
createdAt:
|
|
13522
|
-
updatedAt:
|
|
13466
|
+
import { z as z31 } from "zod";
|
|
13467
|
+
var c25 = initContract();
|
|
13468
|
+
var scheduleResponseSchema = z31.object({
|
|
13469
|
+
id: z31.string().uuid(),
|
|
13470
|
+
zeroAgentId: z31.string().uuid(),
|
|
13471
|
+
agentName: z31.string(),
|
|
13472
|
+
orgSlug: z31.string(),
|
|
13473
|
+
userId: z31.string(),
|
|
13474
|
+
name: z31.string(),
|
|
13475
|
+
triggerType: z31.enum(["cron", "once", "loop"]),
|
|
13476
|
+
cronExpression: z31.string().nullable(),
|
|
13477
|
+
atTime: z31.string().nullable(),
|
|
13478
|
+
intervalSeconds: z31.number().nullable(),
|
|
13479
|
+
timezone: z31.string(),
|
|
13480
|
+
prompt: z31.string(),
|
|
13481
|
+
description: z31.string().nullable(),
|
|
13482
|
+
appendSystemPrompt: z31.string().nullable(),
|
|
13483
|
+
vars: z31.record(z31.string(), z31.string()).nullable(),
|
|
13484
|
+
secretNames: z31.array(z31.string()).nullable(),
|
|
13485
|
+
artifactName: z31.string().nullable(),
|
|
13486
|
+
artifactVersion: z31.string().nullable(),
|
|
13487
|
+
volumeVersions: z31.record(z31.string(), z31.string()).nullable(),
|
|
13488
|
+
enabled: z31.boolean(),
|
|
13489
|
+
notifyEmail: z31.boolean(),
|
|
13490
|
+
notifySlack: z31.boolean(),
|
|
13491
|
+
nextRunAt: z31.string().nullable(),
|
|
13492
|
+
lastRunAt: z31.string().nullable(),
|
|
13493
|
+
retryStartedAt: z31.string().nullable(),
|
|
13494
|
+
consecutiveFailures: z31.number(),
|
|
13495
|
+
createdAt: z31.string(),
|
|
13496
|
+
updatedAt: z31.string()
|
|
13523
13497
|
});
|
|
13524
|
-
var scheduleListResponseSchema =
|
|
13525
|
-
schedules:
|
|
13498
|
+
var scheduleListResponseSchema = z31.object({
|
|
13499
|
+
schedules: z31.array(scheduleResponseSchema)
|
|
13526
13500
|
});
|
|
13527
|
-
var deployScheduleResponseSchema =
|
|
13501
|
+
var deployScheduleResponseSchema = z31.object({
|
|
13528
13502
|
schedule: scheduleResponseSchema,
|
|
13529
|
-
created:
|
|
13503
|
+
created: z31.boolean()
|
|
13530
13504
|
});
|
|
13531
|
-
var zeroDeployScheduleRequestSchema =
|
|
13532
|
-
name:
|
|
13533
|
-
cronExpression:
|
|
13534
|
-
atTime:
|
|
13535
|
-
intervalSeconds:
|
|
13536
|
-
timezone:
|
|
13537
|
-
prompt:
|
|
13538
|
-
description:
|
|
13539
|
-
appendSystemPrompt:
|
|
13540
|
-
artifactName:
|
|
13541
|
-
artifactVersion:
|
|
13542
|
-
volumeVersions:
|
|
13543
|
-
zeroAgentId:
|
|
13544
|
-
composeId:
|
|
13545
|
-
enabled:
|
|
13546
|
-
notifyEmail:
|
|
13547
|
-
notifySlack:
|
|
13505
|
+
var zeroDeployScheduleRequestSchema = z31.object({
|
|
13506
|
+
name: z31.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
13507
|
+
cronExpression: z31.string().optional(),
|
|
13508
|
+
atTime: z31.string().optional(),
|
|
13509
|
+
intervalSeconds: z31.number().int().min(0).optional(),
|
|
13510
|
+
timezone: z31.string().default("UTC"),
|
|
13511
|
+
prompt: z31.string().min(1, "Prompt required"),
|
|
13512
|
+
description: z31.string().optional(),
|
|
13513
|
+
appendSystemPrompt: z31.string().optional(),
|
|
13514
|
+
artifactName: z31.string().optional(),
|
|
13515
|
+
artifactVersion: z31.string().optional(),
|
|
13516
|
+
volumeVersions: z31.record(z31.string(), z31.string()).optional(),
|
|
13517
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13518
|
+
composeId: z31.string().uuid("Invalid compose ID").optional(),
|
|
13519
|
+
enabled: z31.boolean().optional(),
|
|
13520
|
+
notifyEmail: z31.boolean().optional(),
|
|
13521
|
+
notifySlack: z31.boolean().optional()
|
|
13548
13522
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13549
13523
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13550
13524
|
}).refine(
|
|
@@ -13560,7 +13534,7 @@ var zeroDeployScheduleRequestSchema = z32.object({
|
|
|
13560
13534
|
message: "Exactly one of 'cronExpression', 'atTime', or 'intervalSeconds' must be specified"
|
|
13561
13535
|
}
|
|
13562
13536
|
);
|
|
13563
|
-
var zeroSchedulesMainContract =
|
|
13537
|
+
var zeroSchedulesMainContract = c25.router({
|
|
13564
13538
|
deploy: {
|
|
13565
13539
|
method: "POST",
|
|
13566
13540
|
path: "/api/zero/schedules",
|
|
@@ -13588,22 +13562,22 @@ var zeroSchedulesMainContract = c26.router({
|
|
|
13588
13562
|
summary: "List all schedules (zero proxy)"
|
|
13589
13563
|
}
|
|
13590
13564
|
});
|
|
13591
|
-
var zeroSchedulesByNameContract =
|
|
13565
|
+
var zeroSchedulesByNameContract = c25.router({
|
|
13592
13566
|
delete: {
|
|
13593
13567
|
method: "DELETE",
|
|
13594
13568
|
path: "/api/zero/schedules/:name",
|
|
13595
13569
|
headers: authHeadersSchema,
|
|
13596
|
-
pathParams:
|
|
13597
|
-
name:
|
|
13570
|
+
pathParams: z31.object({
|
|
13571
|
+
name: z31.string().min(1, "Schedule name required")
|
|
13598
13572
|
}),
|
|
13599
|
-
query:
|
|
13600
|
-
zeroAgentId:
|
|
13601
|
-
composeId:
|
|
13573
|
+
query: z31.object({
|
|
13574
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13575
|
+
composeId: z31.string().uuid("Invalid compose ID").optional()
|
|
13602
13576
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13603
13577
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13604
13578
|
}),
|
|
13605
13579
|
responses: {
|
|
13606
|
-
204:
|
|
13580
|
+
204: c25.noBody(),
|
|
13607
13581
|
401: apiErrorSchema,
|
|
13608
13582
|
403: apiErrorSchema,
|
|
13609
13583
|
404: apiErrorSchema
|
|
@@ -13611,17 +13585,17 @@ var zeroSchedulesByNameContract = c26.router({
|
|
|
13611
13585
|
summary: "Delete schedule (zero proxy)"
|
|
13612
13586
|
}
|
|
13613
13587
|
});
|
|
13614
|
-
var zeroSchedulesEnableContract =
|
|
13588
|
+
var zeroSchedulesEnableContract = c25.router({
|
|
13615
13589
|
enable: {
|
|
13616
13590
|
method: "POST",
|
|
13617
13591
|
path: "/api/zero/schedules/:name/enable",
|
|
13618
13592
|
headers: authHeadersSchema,
|
|
13619
|
-
pathParams:
|
|
13620
|
-
name:
|
|
13593
|
+
pathParams: z31.object({
|
|
13594
|
+
name: z31.string().min(1, "Schedule name required")
|
|
13621
13595
|
}),
|
|
13622
|
-
body:
|
|
13623
|
-
zeroAgentId:
|
|
13624
|
-
composeId:
|
|
13596
|
+
body: z31.object({
|
|
13597
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13598
|
+
composeId: z31.string().uuid("Invalid compose ID").optional()
|
|
13625
13599
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13626
13600
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13627
13601
|
}),
|
|
@@ -13638,12 +13612,12 @@ var zeroSchedulesEnableContract = c26.router({
|
|
|
13638
13612
|
method: "POST",
|
|
13639
13613
|
path: "/api/zero/schedules/:name/disable",
|
|
13640
13614
|
headers: authHeadersSchema,
|
|
13641
|
-
pathParams:
|
|
13642
|
-
name:
|
|
13615
|
+
pathParams: z31.object({
|
|
13616
|
+
name: z31.string().min(1, "Schedule name required")
|
|
13643
13617
|
}),
|
|
13644
|
-
body:
|
|
13645
|
-
zeroAgentId:
|
|
13646
|
-
composeId:
|
|
13618
|
+
body: z31.object({
|
|
13619
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13620
|
+
composeId: z31.string().uuid("Invalid compose ID").optional()
|
|
13647
13621
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13648
13622
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13649
13623
|
}),
|
|
@@ -13659,9 +13633,9 @@ var zeroSchedulesEnableContract = c26.router({
|
|
|
13659
13633
|
});
|
|
13660
13634
|
|
|
13661
13635
|
// ../../packages/core/src/contracts/zero-model-providers.ts
|
|
13662
|
-
import { z as
|
|
13663
|
-
var
|
|
13664
|
-
var zeroModelProvidersMainContract =
|
|
13636
|
+
import { z as z32 } from "zod";
|
|
13637
|
+
var c26 = initContract();
|
|
13638
|
+
var zeroModelProvidersMainContract = c26.router({
|
|
13665
13639
|
list: {
|
|
13666
13640
|
method: "GET",
|
|
13667
13641
|
path: "/api/zero/model-providers",
|
|
@@ -13689,16 +13663,16 @@ var zeroModelProvidersMainContract = c27.router({
|
|
|
13689
13663
|
summary: "Create or update an org-level model provider (admin only)"
|
|
13690
13664
|
}
|
|
13691
13665
|
});
|
|
13692
|
-
var zeroModelProvidersByTypeContract =
|
|
13666
|
+
var zeroModelProvidersByTypeContract = c26.router({
|
|
13693
13667
|
delete: {
|
|
13694
13668
|
method: "DELETE",
|
|
13695
13669
|
path: "/api/zero/model-providers/:type",
|
|
13696
13670
|
headers: authHeadersSchema,
|
|
13697
|
-
pathParams:
|
|
13671
|
+
pathParams: z32.object({
|
|
13698
13672
|
type: modelProviderTypeSchema
|
|
13699
13673
|
}),
|
|
13700
13674
|
responses: {
|
|
13701
|
-
204:
|
|
13675
|
+
204: c26.noBody(),
|
|
13702
13676
|
401: apiErrorSchema,
|
|
13703
13677
|
403: apiErrorSchema,
|
|
13704
13678
|
404: apiErrorSchema,
|
|
@@ -13707,15 +13681,15 @@ var zeroModelProvidersByTypeContract = c27.router({
|
|
|
13707
13681
|
summary: "Delete an org-level model provider (admin only)"
|
|
13708
13682
|
}
|
|
13709
13683
|
});
|
|
13710
|
-
var zeroModelProvidersDefaultContract =
|
|
13684
|
+
var zeroModelProvidersDefaultContract = c26.router({
|
|
13711
13685
|
setDefault: {
|
|
13712
13686
|
method: "POST",
|
|
13713
13687
|
path: "/api/zero/model-providers/:type/default",
|
|
13714
13688
|
headers: authHeadersSchema,
|
|
13715
|
-
pathParams:
|
|
13689
|
+
pathParams: z32.object({
|
|
13716
13690
|
type: modelProviderTypeSchema
|
|
13717
13691
|
}),
|
|
13718
|
-
body:
|
|
13692
|
+
body: z32.undefined(),
|
|
13719
13693
|
responses: {
|
|
13720
13694
|
200: modelProviderResponseSchema,
|
|
13721
13695
|
401: apiErrorSchema,
|
|
@@ -13726,12 +13700,12 @@ var zeroModelProvidersDefaultContract = c27.router({
|
|
|
13726
13700
|
summary: "Set org-level model provider as default (admin only)"
|
|
13727
13701
|
}
|
|
13728
13702
|
});
|
|
13729
|
-
var zeroModelProvidersUpdateModelContract =
|
|
13703
|
+
var zeroModelProvidersUpdateModelContract = c26.router({
|
|
13730
13704
|
updateModel: {
|
|
13731
13705
|
method: "PATCH",
|
|
13732
13706
|
path: "/api/zero/model-providers/:type/model",
|
|
13733
13707
|
headers: authHeadersSchema,
|
|
13734
|
-
pathParams:
|
|
13708
|
+
pathParams: z32.object({
|
|
13735
13709
|
type: modelProviderTypeSchema
|
|
13736
13710
|
}),
|
|
13737
13711
|
body: updateModelRequestSchema,
|
|
@@ -13747,8 +13721,8 @@ var zeroModelProvidersUpdateModelContract = c27.router({
|
|
|
13747
13721
|
});
|
|
13748
13722
|
|
|
13749
13723
|
// ../../packages/core/src/contracts/zero-user-preferences.ts
|
|
13750
|
-
var
|
|
13751
|
-
var zeroUserPreferencesContract =
|
|
13724
|
+
var c27 = initContract();
|
|
13725
|
+
var zeroUserPreferencesContract = c27.router({
|
|
13752
13726
|
get: {
|
|
13753
13727
|
method: "GET",
|
|
13754
13728
|
path: "/api/zero/user-preferences",
|
|
@@ -13776,9 +13750,9 @@ var zeroUserPreferencesContract = c28.router({
|
|
|
13776
13750
|
});
|
|
13777
13751
|
|
|
13778
13752
|
// ../../packages/core/src/contracts/zero-secrets.ts
|
|
13779
|
-
import { z as
|
|
13780
|
-
var
|
|
13781
|
-
var zeroSecretsContract =
|
|
13753
|
+
import { z as z33 } from "zod";
|
|
13754
|
+
var c28 = initContract();
|
|
13755
|
+
var zeroSecretsContract = c28.router({
|
|
13782
13756
|
list: {
|
|
13783
13757
|
method: "GET",
|
|
13784
13758
|
path: "/api/zero/secrets",
|
|
@@ -13805,16 +13779,16 @@ var zeroSecretsContract = c29.router({
|
|
|
13805
13779
|
summary: "Create or update a secret"
|
|
13806
13780
|
}
|
|
13807
13781
|
});
|
|
13808
|
-
var zeroSecretsByNameContract =
|
|
13782
|
+
var zeroSecretsByNameContract = c28.router({
|
|
13809
13783
|
delete: {
|
|
13810
13784
|
method: "DELETE",
|
|
13811
13785
|
path: "/api/zero/secrets/:name",
|
|
13812
13786
|
headers: authHeadersSchema,
|
|
13813
|
-
pathParams:
|
|
13787
|
+
pathParams: z33.object({
|
|
13814
13788
|
name: secretNameSchema
|
|
13815
13789
|
}),
|
|
13816
13790
|
responses: {
|
|
13817
|
-
204:
|
|
13791
|
+
204: c28.noBody(),
|
|
13818
13792
|
401: apiErrorSchema,
|
|
13819
13793
|
404: apiErrorSchema,
|
|
13820
13794
|
500: apiErrorSchema
|
|
@@ -13822,7 +13796,7 @@ var zeroSecretsByNameContract = c29.router({
|
|
|
13822
13796
|
summary: "Delete a secret by name"
|
|
13823
13797
|
}
|
|
13824
13798
|
});
|
|
13825
|
-
var zeroVariablesContract =
|
|
13799
|
+
var zeroVariablesContract = c28.router({
|
|
13826
13800
|
list: {
|
|
13827
13801
|
method: "GET",
|
|
13828
13802
|
path: "/api/zero/variables",
|
|
@@ -13849,16 +13823,16 @@ var zeroVariablesContract = c29.router({
|
|
|
13849
13823
|
summary: "Create or update a variable"
|
|
13850
13824
|
}
|
|
13851
13825
|
});
|
|
13852
|
-
var zeroVariablesByNameContract =
|
|
13826
|
+
var zeroVariablesByNameContract = c28.router({
|
|
13853
13827
|
delete: {
|
|
13854
13828
|
method: "DELETE",
|
|
13855
13829
|
path: "/api/zero/variables/:name",
|
|
13856
13830
|
headers: authHeadersSchema,
|
|
13857
|
-
pathParams:
|
|
13831
|
+
pathParams: z33.object({
|
|
13858
13832
|
name: variableNameSchema
|
|
13859
13833
|
}),
|
|
13860
13834
|
responses: {
|
|
13861
|
-
204:
|
|
13835
|
+
204: c28.noBody(),
|
|
13862
13836
|
401: apiErrorSchema,
|
|
13863
13837
|
404: apiErrorSchema,
|
|
13864
13838
|
500: apiErrorSchema
|
|
@@ -13868,15 +13842,15 @@ var zeroVariablesByNameContract = c29.router({
|
|
|
13868
13842
|
});
|
|
13869
13843
|
|
|
13870
13844
|
// ../../packages/core/src/contracts/zero-sessions.ts
|
|
13871
|
-
import { z as
|
|
13872
|
-
var
|
|
13873
|
-
var zeroSessionsByIdContract =
|
|
13845
|
+
import { z as z34 } from "zod";
|
|
13846
|
+
var c29 = initContract();
|
|
13847
|
+
var zeroSessionsByIdContract = c29.router({
|
|
13874
13848
|
getById: {
|
|
13875
13849
|
method: "GET",
|
|
13876
13850
|
path: "/api/zero/sessions/:id",
|
|
13877
13851
|
headers: authHeadersSchema,
|
|
13878
|
-
pathParams:
|
|
13879
|
-
id:
|
|
13852
|
+
pathParams: z34.object({
|
|
13853
|
+
id: z34.string().min(1, "Session ID is required")
|
|
13880
13854
|
}),
|
|
13881
13855
|
responses: {
|
|
13882
13856
|
200: sessionResponseSchema,
|
|
@@ -13889,24 +13863,24 @@ var zeroSessionsByIdContract = c30.router({
|
|
|
13889
13863
|
});
|
|
13890
13864
|
|
|
13891
13865
|
// ../../packages/core/src/contracts/integrations.ts
|
|
13892
|
-
import { z as
|
|
13893
|
-
var
|
|
13894
|
-
var integrationsSlackMessageContract =
|
|
13866
|
+
import { z as z35 } from "zod";
|
|
13867
|
+
var c30 = initContract();
|
|
13868
|
+
var integrationsSlackMessageContract = c30.router({
|
|
13895
13869
|
sendMessage: {
|
|
13896
13870
|
method: "POST",
|
|
13897
13871
|
path: "/api/zero/integrations/slack/message",
|
|
13898
13872
|
headers: authHeadersSchema,
|
|
13899
|
-
body:
|
|
13900
|
-
channel:
|
|
13901
|
-
text:
|
|
13902
|
-
threadTs:
|
|
13903
|
-
blocks:
|
|
13873
|
+
body: z35.object({
|
|
13874
|
+
channel: z35.string().min(1, "Channel ID is required"),
|
|
13875
|
+
text: z35.string().optional(),
|
|
13876
|
+
threadTs: z35.string().optional(),
|
|
13877
|
+
blocks: z35.array(z35.object({ type: z35.string() }).passthrough()).optional()
|
|
13904
13878
|
}),
|
|
13905
13879
|
responses: {
|
|
13906
|
-
200:
|
|
13907
|
-
ok:
|
|
13908
|
-
ts:
|
|
13909
|
-
channel:
|
|
13880
|
+
200: z35.object({
|
|
13881
|
+
ok: z35.literal(true),
|
|
13882
|
+
ts: z35.string().optional(),
|
|
13883
|
+
channel: z35.string().optional()
|
|
13910
13884
|
}),
|
|
13911
13885
|
400: apiErrorSchema,
|
|
13912
13886
|
401: apiErrorSchema,
|
|
@@ -13918,41 +13892,41 @@ var integrationsSlackMessageContract = c31.router({
|
|
|
13918
13892
|
});
|
|
13919
13893
|
|
|
13920
13894
|
// ../../packages/core/src/contracts/zero-billing.ts
|
|
13921
|
-
import { z as
|
|
13922
|
-
var
|
|
13923
|
-
var autoRechargeSchema =
|
|
13924
|
-
enabled:
|
|
13925
|
-
threshold:
|
|
13926
|
-
amount:
|
|
13895
|
+
import { z as z36 } from "zod";
|
|
13896
|
+
var c31 = initContract();
|
|
13897
|
+
var autoRechargeSchema = z36.object({
|
|
13898
|
+
enabled: z36.boolean(),
|
|
13899
|
+
threshold: z36.number().nullable(),
|
|
13900
|
+
amount: z36.number().nullable()
|
|
13927
13901
|
});
|
|
13928
|
-
var billingStatusResponseSchema =
|
|
13929
|
-
tier:
|
|
13930
|
-
credits:
|
|
13931
|
-
subscriptionStatus:
|
|
13932
|
-
currentPeriodEnd:
|
|
13933
|
-
hasSubscription:
|
|
13902
|
+
var billingStatusResponseSchema = z36.object({
|
|
13903
|
+
tier: z36.string(),
|
|
13904
|
+
credits: z36.number(),
|
|
13905
|
+
subscriptionStatus: z36.string().nullable(),
|
|
13906
|
+
currentPeriodEnd: z36.string().nullable(),
|
|
13907
|
+
hasSubscription: z36.boolean(),
|
|
13934
13908
|
autoRecharge: autoRechargeSchema
|
|
13935
13909
|
});
|
|
13936
|
-
var checkoutResponseSchema =
|
|
13937
|
-
url:
|
|
13910
|
+
var checkoutResponseSchema = z36.object({
|
|
13911
|
+
url: z36.string()
|
|
13938
13912
|
});
|
|
13939
|
-
var portalResponseSchema =
|
|
13940
|
-
url:
|
|
13913
|
+
var portalResponseSchema = z36.object({
|
|
13914
|
+
url: z36.string()
|
|
13941
13915
|
});
|
|
13942
|
-
var checkoutRequestSchema =
|
|
13943
|
-
tier:
|
|
13944
|
-
successUrl:
|
|
13945
|
-
cancelUrl:
|
|
13916
|
+
var checkoutRequestSchema = z36.object({
|
|
13917
|
+
tier: z36.enum(["pro", "team"]),
|
|
13918
|
+
successUrl: z36.string().url(),
|
|
13919
|
+
cancelUrl: z36.string().url()
|
|
13946
13920
|
});
|
|
13947
|
-
var portalRequestSchema =
|
|
13948
|
-
returnUrl:
|
|
13921
|
+
var portalRequestSchema = z36.object({
|
|
13922
|
+
returnUrl: z36.string().min(1)
|
|
13949
13923
|
});
|
|
13950
|
-
var autoRechargeUpdateRequestSchema =
|
|
13951
|
-
enabled:
|
|
13952
|
-
threshold:
|
|
13953
|
-
amount:
|
|
13924
|
+
var autoRechargeUpdateRequestSchema = z36.object({
|
|
13925
|
+
enabled: z36.boolean(),
|
|
13926
|
+
threshold: z36.number().int().positive().optional(),
|
|
13927
|
+
amount: z36.number().int().min(1e3).optional()
|
|
13954
13928
|
});
|
|
13955
|
-
var zeroBillingStatusContract =
|
|
13929
|
+
var zeroBillingStatusContract = c31.router({
|
|
13956
13930
|
get: {
|
|
13957
13931
|
method: "GET",
|
|
13958
13932
|
path: "/api/zero/billing/status",
|
|
@@ -13965,7 +13939,7 @@ var zeroBillingStatusContract = c32.router({
|
|
|
13965
13939
|
summary: "Get billing status for current org"
|
|
13966
13940
|
}
|
|
13967
13941
|
});
|
|
13968
|
-
var zeroBillingCheckoutContract =
|
|
13942
|
+
var zeroBillingCheckoutContract = c31.router({
|
|
13969
13943
|
create: {
|
|
13970
13944
|
method: "POST",
|
|
13971
13945
|
path: "/api/zero/billing/checkout",
|
|
@@ -13981,7 +13955,7 @@ var zeroBillingCheckoutContract = c32.router({
|
|
|
13981
13955
|
summary: "Create Stripe checkout session"
|
|
13982
13956
|
}
|
|
13983
13957
|
});
|
|
13984
|
-
var zeroBillingPortalContract =
|
|
13958
|
+
var zeroBillingPortalContract = c31.router({
|
|
13985
13959
|
create: {
|
|
13986
13960
|
method: "POST",
|
|
13987
13961
|
path: "/api/zero/billing/portal",
|
|
@@ -13997,7 +13971,7 @@ var zeroBillingPortalContract = c32.router({
|
|
|
13997
13971
|
summary: "Create Stripe billing portal session"
|
|
13998
13972
|
}
|
|
13999
13973
|
});
|
|
14000
|
-
var zeroBillingAutoRechargeContract =
|
|
13974
|
+
var zeroBillingAutoRechargeContract = c31.router({
|
|
14001
13975
|
get: {
|
|
14002
13976
|
method: "GET",
|
|
14003
13977
|
path: "/api/zero/billing/auto-recharge",
|
|
@@ -14026,25 +14000,25 @@ var zeroBillingAutoRechargeContract = c32.router({
|
|
|
14026
14000
|
});
|
|
14027
14001
|
|
|
14028
14002
|
// ../../packages/core/src/contracts/zero-usage.ts
|
|
14029
|
-
import { z as
|
|
14030
|
-
var
|
|
14031
|
-
var memberUsageSchema =
|
|
14032
|
-
userId:
|
|
14033
|
-
email:
|
|
14034
|
-
inputTokens:
|
|
14035
|
-
outputTokens:
|
|
14036
|
-
cacheReadInputTokens:
|
|
14037
|
-
cacheCreationInputTokens:
|
|
14038
|
-
creditsCharged:
|
|
14003
|
+
import { z as z37 } from "zod";
|
|
14004
|
+
var c32 = initContract();
|
|
14005
|
+
var memberUsageSchema = z37.object({
|
|
14006
|
+
userId: z37.string(),
|
|
14007
|
+
email: z37.string(),
|
|
14008
|
+
inputTokens: z37.number(),
|
|
14009
|
+
outputTokens: z37.number(),
|
|
14010
|
+
cacheReadInputTokens: z37.number(),
|
|
14011
|
+
cacheCreationInputTokens: z37.number(),
|
|
14012
|
+
creditsCharged: z37.number()
|
|
14039
14013
|
});
|
|
14040
|
-
var usageMembersResponseSchema =
|
|
14041
|
-
period:
|
|
14042
|
-
start:
|
|
14043
|
-
end:
|
|
14014
|
+
var usageMembersResponseSchema = z37.object({
|
|
14015
|
+
period: z37.object({
|
|
14016
|
+
start: z37.string(),
|
|
14017
|
+
end: z37.string()
|
|
14044
14018
|
}).nullable(),
|
|
14045
|
-
members:
|
|
14019
|
+
members: z37.array(memberUsageSchema)
|
|
14046
14020
|
});
|
|
14047
|
-
var zeroUsageMembersContract =
|
|
14021
|
+
var zeroUsageMembersContract = c32.router({
|
|
14048
14022
|
get: {
|
|
14049
14023
|
method: "GET",
|
|
14050
14024
|
path: "/api/zero/usage/members",
|
|
@@ -14542,16 +14516,16 @@ async function getLatestVersion() {
|
|
|
14542
14516
|
}
|
|
14543
14517
|
}
|
|
14544
14518
|
function performUpgrade(packageManager) {
|
|
14545
|
-
return new Promise((
|
|
14519
|
+
return new Promise((resolve) => {
|
|
14546
14520
|
const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
|
|
14547
14521
|
const child = safeSpawn(packageManager, args, {
|
|
14548
14522
|
stdio: "inherit"
|
|
14549
14523
|
});
|
|
14550
14524
|
child.on("close", (code) => {
|
|
14551
|
-
|
|
14525
|
+
resolve(code === 0);
|
|
14552
14526
|
});
|
|
14553
14527
|
child.on("error", () => {
|
|
14554
|
-
|
|
14528
|
+
resolve(false);
|
|
14555
14529
|
});
|
|
14556
14530
|
});
|
|
14557
14531
|
}
|
|
@@ -14627,9 +14601,9 @@ async function startSilentUpgrade(currentVersion) {
|
|
|
14627
14601
|
detached: !isWindows,
|
|
14628
14602
|
windowsHide: true
|
|
14629
14603
|
});
|
|
14630
|
-
const promise = new Promise((
|
|
14631
|
-
child.on("close", (code) =>
|
|
14632
|
-
child.on("error", () =>
|
|
14604
|
+
const promise = new Promise((resolve) => {
|
|
14605
|
+
child.on("close", (code) => resolve(code === 0));
|
|
14606
|
+
child.on("error", () => resolve(false));
|
|
14633
14607
|
});
|
|
14634
14608
|
pendingUpgrade = { promise, child, packageManager };
|
|
14635
14609
|
}
|
|
@@ -14641,10 +14615,10 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
|
|
|
14641
14615
|
pendingUpgrade = null;
|
|
14642
14616
|
const result = await Promise.race([
|
|
14643
14617
|
promise,
|
|
14644
|
-
new Promise((
|
|
14618
|
+
new Promise((resolve) => {
|
|
14645
14619
|
setTimeout(() => {
|
|
14646
14620
|
child.kill();
|
|
14647
|
-
|
|
14621
|
+
resolve(false);
|
|
14648
14622
|
}, timeout);
|
|
14649
14623
|
})
|
|
14650
14624
|
]);
|
|
@@ -14663,7 +14637,7 @@ function getConfigPath() {
|
|
|
14663
14637
|
return join2(homedir2(), ".vm0", "config.json");
|
|
14664
14638
|
}
|
|
14665
14639
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
14666
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
14640
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.78.0"}`));
|
|
14667
14641
|
console.log();
|
|
14668
14642
|
const config = await loadConfig();
|
|
14669
14643
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -14700,61 +14674,6 @@ import { existsSync as existsSync5 } from "fs";
|
|
|
14700
14674
|
import { dirname as dirname2, join as join8 } from "path";
|
|
14701
14675
|
import { parse as parseYaml3 } from "yaml";
|
|
14702
14676
|
|
|
14703
|
-
// src/lib/api/core/http.ts
|
|
14704
|
-
async function appendOrgParam(path18) {
|
|
14705
|
-
const activeOrg = await getActiveOrg();
|
|
14706
|
-
if (!activeOrg) {
|
|
14707
|
-
throw new Error(
|
|
14708
|
-
"No active organization configured. Run: vm0 org use <slug>"
|
|
14709
|
-
);
|
|
14710
|
-
}
|
|
14711
|
-
const queryStart = path18.indexOf("?");
|
|
14712
|
-
if (queryStart !== -1) {
|
|
14713
|
-
const params = new URLSearchParams(path18.slice(queryStart));
|
|
14714
|
-
if (params.has("org")) {
|
|
14715
|
-
return path18;
|
|
14716
|
-
}
|
|
14717
|
-
return `${path18}&org=${encodeURIComponent(activeOrg)}`;
|
|
14718
|
-
}
|
|
14719
|
-
return `${path18}?org=${encodeURIComponent(activeOrg)}`;
|
|
14720
|
-
}
|
|
14721
|
-
async function getRawHeaders() {
|
|
14722
|
-
const token = await getActiveToken();
|
|
14723
|
-
if (!token) {
|
|
14724
|
-
throw new Error("Not authenticated. Run: vm0 auth login");
|
|
14725
|
-
}
|
|
14726
|
-
const headers = {
|
|
14727
|
-
Authorization: `Bearer ${token}`
|
|
14728
|
-
};
|
|
14729
|
-
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
14730
|
-
if (bypassSecret) {
|
|
14731
|
-
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
14732
|
-
}
|
|
14733
|
-
return headers;
|
|
14734
|
-
}
|
|
14735
|
-
async function httpGet(path18) {
|
|
14736
|
-
const baseUrl = await getBaseUrl();
|
|
14737
|
-
const headers = await getRawHeaders();
|
|
14738
|
-
const orgPath = await appendOrgParam(path18);
|
|
14739
|
-
return fetch(`${baseUrl}${orgPath}`, {
|
|
14740
|
-
method: "GET",
|
|
14741
|
-
headers
|
|
14742
|
-
});
|
|
14743
|
-
}
|
|
14744
|
-
async function httpPost(path18, body) {
|
|
14745
|
-
const baseUrl = await getBaseUrl();
|
|
14746
|
-
const headers = await getRawHeaders();
|
|
14747
|
-
const orgPath = await appendOrgParam(path18);
|
|
14748
|
-
return fetch(`${baseUrl}${orgPath}`, {
|
|
14749
|
-
method: "POST",
|
|
14750
|
-
headers: {
|
|
14751
|
-
...headers,
|
|
14752
|
-
"Content-Type": "application/json"
|
|
14753
|
-
},
|
|
14754
|
-
body: JSON.stringify(body)
|
|
14755
|
-
});
|
|
14756
|
-
}
|
|
14757
|
-
|
|
14758
14677
|
// src/lib/api/domains/composes.ts
|
|
14759
14678
|
import { initClient } from "@ts-rest/core";
|
|
14760
14679
|
async function getComposeByName(name, org) {
|
|
@@ -14804,17 +14723,6 @@ async function createOrUpdateCompose(body) {
|
|
|
14804
14723
|
}
|
|
14805
14724
|
handleError(result, "Failed to create compose");
|
|
14806
14725
|
}
|
|
14807
|
-
async function deleteCompose(id) {
|
|
14808
|
-
const config = await getClientConfig();
|
|
14809
|
-
const client = initClient(composesByIdContract, config);
|
|
14810
|
-
const result = await client.delete({
|
|
14811
|
-
params: { id }
|
|
14812
|
-
});
|
|
14813
|
-
if (result.status === 204) {
|
|
14814
|
-
return;
|
|
14815
|
-
}
|
|
14816
|
-
handleError(result, "Failed to delete agent");
|
|
14817
|
-
}
|
|
14818
14726
|
|
|
14819
14727
|
// src/lib/api/domains/runs.ts
|
|
14820
14728
|
import { initClient as initClient2 } from "@ts-rest/core";
|
|
@@ -15010,6 +14918,52 @@ async function updateUserPreferences(body) {
|
|
|
15010
14918
|
handleError(result, "Failed to update user preferences");
|
|
15011
14919
|
}
|
|
15012
14920
|
|
|
14921
|
+
// src/lib/api/core/http.ts
|
|
14922
|
+
async function appendOrgParam(path17) {
|
|
14923
|
+
const activeOrg = await getActiveOrg();
|
|
14924
|
+
if (!activeOrg) {
|
|
14925
|
+
throw new Error(
|
|
14926
|
+
"No active organization configured. Run: vm0 org use <slug>"
|
|
14927
|
+
);
|
|
14928
|
+
}
|
|
14929
|
+
const queryStart = path17.indexOf("?");
|
|
14930
|
+
if (queryStart !== -1) {
|
|
14931
|
+
const params = new URLSearchParams(path17.slice(queryStart));
|
|
14932
|
+
if (params.has("org")) {
|
|
14933
|
+
return path17;
|
|
14934
|
+
}
|
|
14935
|
+
return `${path17}&org=${encodeURIComponent(activeOrg)}`;
|
|
14936
|
+
}
|
|
14937
|
+
return `${path17}?org=${encodeURIComponent(activeOrg)}`;
|
|
14938
|
+
}
|
|
14939
|
+
async function getRawHeaders() {
|
|
14940
|
+
const token = await getActiveToken();
|
|
14941
|
+
if (!token) {
|
|
14942
|
+
throw new Error("Not authenticated. Run: vm0 auth login");
|
|
14943
|
+
}
|
|
14944
|
+
const headers = {
|
|
14945
|
+
Authorization: `Bearer ${token}`
|
|
14946
|
+
};
|
|
14947
|
+
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
14948
|
+
if (bypassSecret) {
|
|
14949
|
+
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
14950
|
+
}
|
|
14951
|
+
return headers;
|
|
14952
|
+
}
|
|
14953
|
+
async function httpPost(path17, body) {
|
|
14954
|
+
const baseUrl = await getBaseUrl();
|
|
14955
|
+
const headers = await getRawHeaders();
|
|
14956
|
+
const orgPath = await appendOrgParam(path17);
|
|
14957
|
+
return fetch(`${baseUrl}${orgPath}`, {
|
|
14958
|
+
method: "POST",
|
|
14959
|
+
headers: {
|
|
14960
|
+
...headers,
|
|
14961
|
+
"Content-Type": "application/json"
|
|
14962
|
+
},
|
|
14963
|
+
body: JSON.stringify(body)
|
|
14964
|
+
});
|
|
14965
|
+
}
|
|
14966
|
+
|
|
15013
14967
|
// src/lib/api/domains/skills.ts
|
|
15014
14968
|
import chalk5 from "chalk";
|
|
15015
14969
|
function isResolveSkillsResponse(value) {
|
|
@@ -15382,11 +15336,91 @@ async function updateZeroAgentInstructions(name, content) {
|
|
|
15382
15336
|
handleError(result, `Failed to update instructions for zero agent "${name}"`);
|
|
15383
15337
|
}
|
|
15384
15338
|
|
|
15385
|
-
// src/lib/api/domains/zero-
|
|
15339
|
+
// src/lib/api/domains/zero-connectors.ts
|
|
15386
15340
|
import { initClient as initClient14 } from "@ts-rest/core";
|
|
15341
|
+
async function listZeroConnectors() {
|
|
15342
|
+
const config = await getClientConfig();
|
|
15343
|
+
const client = initClient14(zeroConnectorsMainContract, config);
|
|
15344
|
+
const result = await client.list({ headers: {} });
|
|
15345
|
+
if (result.status === 200) {
|
|
15346
|
+
return result.body;
|
|
15347
|
+
}
|
|
15348
|
+
handleError(result, "Failed to list connectors");
|
|
15349
|
+
}
|
|
15350
|
+
async function getZeroConnector(type2) {
|
|
15351
|
+
const config = await getClientConfig();
|
|
15352
|
+
const client = initClient14(zeroConnectorsByTypeContract, config);
|
|
15353
|
+
const result = await client.get({
|
|
15354
|
+
params: { type: type2 }
|
|
15355
|
+
});
|
|
15356
|
+
if (result.status === 200) {
|
|
15357
|
+
return result.body;
|
|
15358
|
+
}
|
|
15359
|
+
if (result.status === 404) {
|
|
15360
|
+
return null;
|
|
15361
|
+
}
|
|
15362
|
+
handleError(result, `Failed to get connector "${type2}"`);
|
|
15363
|
+
}
|
|
15364
|
+
async function deleteZeroConnector(type2) {
|
|
15365
|
+
const config = await getClientConfig();
|
|
15366
|
+
const client = initClient14(zeroConnectorsByTypeContract, config);
|
|
15367
|
+
const result = await client.delete({
|
|
15368
|
+
params: { type: type2 }
|
|
15369
|
+
});
|
|
15370
|
+
if (result.status === 204) {
|
|
15371
|
+
return;
|
|
15372
|
+
}
|
|
15373
|
+
handleError(result, `Connector "${type2}" not found`);
|
|
15374
|
+
}
|
|
15375
|
+
async function createZeroConnectorSession(type2) {
|
|
15376
|
+
const config = await getClientConfig();
|
|
15377
|
+
const client = initClient14(zeroConnectorSessionsContract, config);
|
|
15378
|
+
const result = await client.create({
|
|
15379
|
+
params: { type: type2 },
|
|
15380
|
+
body: {}
|
|
15381
|
+
});
|
|
15382
|
+
if (result.status === 200) {
|
|
15383
|
+
return result.body;
|
|
15384
|
+
}
|
|
15385
|
+
handleError(result, "Failed to create connector session");
|
|
15386
|
+
}
|
|
15387
|
+
async function getZeroConnectorSession(type2, sessionId) {
|
|
15388
|
+
const config = await getClientConfig();
|
|
15389
|
+
const client = initClient14(zeroConnectorSessionByIdContract, config);
|
|
15390
|
+
const result = await client.get({
|
|
15391
|
+
params: { type: type2, sessionId }
|
|
15392
|
+
});
|
|
15393
|
+
if (result.status === 200) {
|
|
15394
|
+
return result.body;
|
|
15395
|
+
}
|
|
15396
|
+
handleError(result, "Failed to get connector session status");
|
|
15397
|
+
}
|
|
15398
|
+
async function createZeroComputerConnector() {
|
|
15399
|
+
const config = await getClientConfig();
|
|
15400
|
+
const client = initClient14(zeroComputerConnectorContract, config);
|
|
15401
|
+
const result = await client.create({
|
|
15402
|
+
body: {}
|
|
15403
|
+
});
|
|
15404
|
+
if (result.status === 200) {
|
|
15405
|
+
return result.body;
|
|
15406
|
+
}
|
|
15407
|
+
handleError(result, "Failed to create computer connector");
|
|
15408
|
+
}
|
|
15409
|
+
async function deleteZeroComputerConnector() {
|
|
15410
|
+
const config = await getClientConfig();
|
|
15411
|
+
const client = initClient14(zeroComputerConnectorContract, config);
|
|
15412
|
+
const result = await client.delete({});
|
|
15413
|
+
if (result.status === 204) {
|
|
15414
|
+
return;
|
|
15415
|
+
}
|
|
15416
|
+
handleError(result, "Computer connector not found");
|
|
15417
|
+
}
|
|
15418
|
+
|
|
15419
|
+
// src/lib/api/domains/zero-schedules.ts
|
|
15420
|
+
import { initClient as initClient15 } from "@ts-rest/core";
|
|
15387
15421
|
async function deployZeroSchedule(body) {
|
|
15388
15422
|
const config = await getClientConfig();
|
|
15389
|
-
const client =
|
|
15423
|
+
const client = initClient15(zeroSchedulesMainContract, config);
|
|
15390
15424
|
const result = await client.deploy({ body });
|
|
15391
15425
|
if (result.status === 200 || result.status === 201) {
|
|
15392
15426
|
return result.body;
|
|
@@ -15395,7 +15429,7 @@ async function deployZeroSchedule(body) {
|
|
|
15395
15429
|
}
|
|
15396
15430
|
async function listZeroSchedules() {
|
|
15397
15431
|
const config = await getClientConfig();
|
|
15398
|
-
const client =
|
|
15432
|
+
const client = initClient15(zeroSchedulesMainContract, config);
|
|
15399
15433
|
const result = await client.list({ headers: {} });
|
|
15400
15434
|
if (result.status === 200) {
|
|
15401
15435
|
return result.body;
|
|
@@ -15404,7 +15438,7 @@ async function listZeroSchedules() {
|
|
|
15404
15438
|
}
|
|
15405
15439
|
async function deleteZeroSchedule(params) {
|
|
15406
15440
|
const config = await getClientConfig();
|
|
15407
|
-
const client =
|
|
15441
|
+
const client = initClient15(zeroSchedulesByNameContract, config);
|
|
15408
15442
|
const result = await client.delete({
|
|
15409
15443
|
params: { name: params.name },
|
|
15410
15444
|
query: { zeroAgentId: params.zeroAgentId }
|
|
@@ -15416,7 +15450,7 @@ async function deleteZeroSchedule(params) {
|
|
|
15416
15450
|
}
|
|
15417
15451
|
async function enableZeroSchedule(params) {
|
|
15418
15452
|
const config = await getClientConfig();
|
|
15419
|
-
const client =
|
|
15453
|
+
const client = initClient15(zeroSchedulesEnableContract, config);
|
|
15420
15454
|
const result = await client.enable({
|
|
15421
15455
|
params: { name: params.name },
|
|
15422
15456
|
body: { zeroAgentId: params.zeroAgentId }
|
|
@@ -15428,7 +15462,7 @@ async function enableZeroSchedule(params) {
|
|
|
15428
15462
|
}
|
|
15429
15463
|
async function disableZeroSchedule(params) {
|
|
15430
15464
|
const config = await getClientConfig();
|
|
15431
|
-
const client =
|
|
15465
|
+
const client = initClient15(zeroSchedulesEnableContract, config);
|
|
15432
15466
|
const result = await client.disable({
|
|
15433
15467
|
params: { name: params.name },
|
|
15434
15468
|
body: { zeroAgentId: params.zeroAgentId }
|
|
@@ -15464,8 +15498,8 @@ async function resolveZeroScheduleByAgent(agentName, scheduleName) {
|
|
|
15464
15498
|
}
|
|
15465
15499
|
|
|
15466
15500
|
// src/lib/domain/yaml-validator.ts
|
|
15467
|
-
import { z as
|
|
15468
|
-
var cliAgentNameSchema =
|
|
15501
|
+
import { z as z38 } from "zod";
|
|
15502
|
+
var cliAgentNameSchema = z38.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
15469
15503
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
15470
15504
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
15471
15505
|
);
|
|
@@ -15479,7 +15513,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
15479
15513
|
resolveSkillRef(skillRef);
|
|
15480
15514
|
} catch (error) {
|
|
15481
15515
|
ctx.addIssue({
|
|
15482
|
-
code:
|
|
15516
|
+
code: z38.ZodIssueCode.custom,
|
|
15483
15517
|
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
15484
15518
|
path: ["skills", i]
|
|
15485
15519
|
});
|
|
@@ -15489,15 +15523,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
15489
15523
|
}
|
|
15490
15524
|
}
|
|
15491
15525
|
);
|
|
15492
|
-
var cliComposeSchema =
|
|
15493
|
-
version:
|
|
15494
|
-
agents:
|
|
15495
|
-
volumes:
|
|
15526
|
+
var cliComposeSchema = z38.object({
|
|
15527
|
+
version: z38.string().min(1, "Missing config.version"),
|
|
15528
|
+
agents: z38.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
15529
|
+
volumes: z38.record(z38.string(), volumeConfigSchema).optional()
|
|
15496
15530
|
}).superRefine((config, ctx) => {
|
|
15497
15531
|
const agentKeys = Object.keys(config.agents);
|
|
15498
15532
|
if (agentKeys.length === 0) {
|
|
15499
15533
|
ctx.addIssue({
|
|
15500
|
-
code:
|
|
15534
|
+
code: z38.ZodIssueCode.custom,
|
|
15501
15535
|
message: "agents must have at least one agent defined",
|
|
15502
15536
|
path: ["agents"]
|
|
15503
15537
|
});
|
|
@@ -15505,7 +15539,7 @@ var cliComposeSchema = z39.object({
|
|
|
15505
15539
|
}
|
|
15506
15540
|
if (agentKeys.length > 1) {
|
|
15507
15541
|
ctx.addIssue({
|
|
15508
|
-
code:
|
|
15542
|
+
code: z38.ZodIssueCode.custom,
|
|
15509
15543
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
15510
15544
|
path: ["agents"]
|
|
15511
15545
|
});
|
|
@@ -15517,7 +15551,7 @@ var cliComposeSchema = z39.object({
|
|
|
15517
15551
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
15518
15552
|
if (!config.volumes) {
|
|
15519
15553
|
ctx.addIssue({
|
|
15520
|
-
code:
|
|
15554
|
+
code: z38.ZodIssueCode.custom,
|
|
15521
15555
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
15522
15556
|
path: ["volumes"]
|
|
15523
15557
|
});
|
|
@@ -15527,7 +15561,7 @@ var cliComposeSchema = z39.object({
|
|
|
15527
15561
|
const parts = volDeclaration.split(":");
|
|
15528
15562
|
if (parts.length !== 2) {
|
|
15529
15563
|
ctx.addIssue({
|
|
15530
|
-
code:
|
|
15564
|
+
code: z38.ZodIssueCode.custom,
|
|
15531
15565
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
15532
15566
|
path: ["agents", agentName, "volumes"]
|
|
15533
15567
|
});
|
|
@@ -15536,7 +15570,7 @@ var cliComposeSchema = z39.object({
|
|
|
15536
15570
|
const volumeKey = parts[0].trim();
|
|
15537
15571
|
if (!config.volumes[volumeKey]) {
|
|
15538
15572
|
ctx.addIssue({
|
|
15539
|
-
code:
|
|
15573
|
+
code: z38.ZodIssueCode.custom,
|
|
15540
15574
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
15541
15575
|
path: ["volumes", volumeKey]
|
|
15542
15576
|
});
|
|
@@ -15544,29 +15578,29 @@ var cliComposeSchema = z39.object({
|
|
|
15544
15578
|
}
|
|
15545
15579
|
}
|
|
15546
15580
|
});
|
|
15547
|
-
function formatInvalidTypeIssue(
|
|
15581
|
+
function formatInvalidTypeIssue(path17, issue) {
|
|
15548
15582
|
const received = issue.received;
|
|
15549
15583
|
const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
|
|
15550
|
-
if (
|
|
15584
|
+
if (path17 === "version" && isMissing) {
|
|
15551
15585
|
return "Missing config.version";
|
|
15552
15586
|
}
|
|
15553
|
-
if (
|
|
15587
|
+
if (path17 === "agents" && isMissing) {
|
|
15554
15588
|
return "Missing agents object in config";
|
|
15555
15589
|
}
|
|
15556
|
-
if (
|
|
15557
|
-
const volumeKey =
|
|
15590
|
+
if (path17.startsWith("volumes.") && path17.endsWith(".name")) {
|
|
15591
|
+
const volumeKey = path17.split(".")[1];
|
|
15558
15592
|
return `Volume "${volumeKey}" must have a 'name' field (string)`;
|
|
15559
15593
|
}
|
|
15560
|
-
if (
|
|
15561
|
-
const volumeKey =
|
|
15594
|
+
if (path17.startsWith("volumes.") && path17.endsWith(".version")) {
|
|
15595
|
+
const volumeKey = path17.split(".")[1];
|
|
15562
15596
|
return `Volume "${volumeKey}" must have a 'version' field (string)`;
|
|
15563
15597
|
}
|
|
15564
15598
|
if (issue.expected === "array") {
|
|
15565
|
-
const fieldName =
|
|
15599
|
+
const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
15566
15600
|
return `${fieldName} must be an array`;
|
|
15567
15601
|
}
|
|
15568
15602
|
if (issue.expected === "string" && received === "number") {
|
|
15569
|
-
const fieldName =
|
|
15603
|
+
const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
15570
15604
|
const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
|
|
15571
15605
|
if (match) {
|
|
15572
15606
|
return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
|
|
@@ -15577,24 +15611,24 @@ function formatInvalidTypeIssue(path18, issue) {
|
|
|
15577
15611
|
function formatZodError(error) {
|
|
15578
15612
|
const issue = error.issues[0];
|
|
15579
15613
|
if (!issue) return "Validation failed";
|
|
15580
|
-
const
|
|
15614
|
+
const path17 = issue.path.join(".");
|
|
15581
15615
|
const message = issue.message;
|
|
15582
|
-
if (!
|
|
15616
|
+
if (!path17) return message;
|
|
15583
15617
|
if (issue.code === "invalid_type") {
|
|
15584
|
-
const formatted = formatInvalidTypeIssue(
|
|
15618
|
+
const formatted = formatInvalidTypeIssue(path17, issue);
|
|
15585
15619
|
if (formatted) return formatted;
|
|
15586
15620
|
}
|
|
15587
|
-
if (issue.code === "invalid_key" &&
|
|
15621
|
+
if (issue.code === "invalid_key" && path17.startsWith("agents.")) {
|
|
15588
15622
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
15589
15623
|
}
|
|
15590
|
-
if (message === "Invalid key in record" &&
|
|
15624
|
+
if (message === "Invalid key in record" && path17.startsWith("agents.")) {
|
|
15591
15625
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
15592
15626
|
}
|
|
15593
15627
|
if (issue.code === "custom") {
|
|
15594
15628
|
return message;
|
|
15595
15629
|
}
|
|
15596
|
-
if (
|
|
15597
|
-
const cleanPath =
|
|
15630
|
+
if (path17.startsWith("agents.")) {
|
|
15631
|
+
const cleanPath = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
15598
15632
|
if (message.startsWith("Invalid input:")) {
|
|
15599
15633
|
const match = message.match(/expected (\w+), received (\w+)/);
|
|
15600
15634
|
if (match && match[1] === "string" && match[2] === "number") {
|
|
@@ -15606,7 +15640,7 @@ function formatZodError(error) {
|
|
|
15606
15640
|
}
|
|
15607
15641
|
return `${cleanPath}: ${message}`;
|
|
15608
15642
|
}
|
|
15609
|
-
return `${
|
|
15643
|
+
return `${path17}: ${message}`;
|
|
15610
15644
|
}
|
|
15611
15645
|
function validateAgentName(name) {
|
|
15612
15646
|
return cliAgentNameSchema.safeParse(name).success;
|
|
@@ -15955,7 +15989,7 @@ function excludeVm0Filter(filePath) {
|
|
|
15955
15989
|
return !shouldExclude;
|
|
15956
15990
|
}
|
|
15957
15991
|
function listTarFiles(tarPath) {
|
|
15958
|
-
return new Promise((
|
|
15992
|
+
return new Promise((resolve, reject) => {
|
|
15959
15993
|
const files = [];
|
|
15960
15994
|
tar.list({
|
|
15961
15995
|
file: tarPath,
|
|
@@ -15964,7 +15998,7 @@ function listTarFiles(tarPath) {
|
|
|
15964
15998
|
files.push(entry.path);
|
|
15965
15999
|
}
|
|
15966
16000
|
}
|
|
15967
|
-
}).then(() =>
|
|
16001
|
+
}).then(() => resolve(files)).catch(reject);
|
|
15968
16002
|
});
|
|
15969
16003
|
}
|
|
15970
16004
|
async function listLocalFiles(dir, excludeDirs = [".vm0"]) {
|
|
@@ -16026,11 +16060,11 @@ async function removeEmptyDirs(dir, excludeDirs = [".vm0"]) {
|
|
|
16026
16060
|
|
|
16027
16061
|
// src/lib/storage/direct-upload.ts
|
|
16028
16062
|
async function hashFileStream(filePath) {
|
|
16029
|
-
return new Promise((
|
|
16063
|
+
return new Promise((resolve, reject) => {
|
|
16030
16064
|
const hash = createHash("sha256");
|
|
16031
16065
|
const stream = fs4.createReadStream(filePath);
|
|
16032
16066
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
16033
|
-
stream.on("end", () =>
|
|
16067
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
16034
16068
|
stream.on("error", reject);
|
|
16035
16069
|
});
|
|
16036
16070
|
}
|
|
@@ -16115,7 +16149,7 @@ function createManifest(files) {
|
|
|
16115
16149
|
return Buffer.from(JSON.stringify(manifest, null, 2));
|
|
16116
16150
|
}
|
|
16117
16151
|
function sleep(ms) {
|
|
16118
|
-
return new Promise((
|
|
16152
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
16119
16153
|
}
|
|
16120
16154
|
async function uploadToPresignedUrl(presignedUrl, data, contentType, maxRetries = 3) {
|
|
16121
16155
|
let lastError = null;
|
|
@@ -16735,7 +16769,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
16735
16769
|
options.autoUpdate = false;
|
|
16736
16770
|
}
|
|
16737
16771
|
if (options.autoUpdate !== false) {
|
|
16738
|
-
await startSilentUpgrade("9.
|
|
16772
|
+
await startSilentUpgrade("9.78.0");
|
|
16739
16773
|
}
|
|
16740
16774
|
try {
|
|
16741
16775
|
let result;
|
|
@@ -17497,7 +17531,7 @@ async function pollEvents(runId, options) {
|
|
|
17497
17531
|
result = { succeeded: false, runId };
|
|
17498
17532
|
}
|
|
17499
17533
|
if (!complete) {
|
|
17500
|
-
await new Promise((
|
|
17534
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
17501
17535
|
}
|
|
17502
17536
|
}
|
|
17503
17537
|
return result;
|
|
@@ -17570,7 +17604,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
17570
17604
|
withErrorHandler(
|
|
17571
17605
|
async (identifier, prompt, options) => {
|
|
17572
17606
|
if (options.autoUpdate !== false) {
|
|
17573
|
-
await startSilentUpgrade("9.
|
|
17607
|
+
await startSilentUpgrade("9.78.0");
|
|
17574
17608
|
}
|
|
17575
17609
|
const { org, name, version } = parseIdentifier(identifier);
|
|
17576
17610
|
let composeId;
|
|
@@ -19066,7 +19100,7 @@ function printCommand(cmd) {
|
|
|
19066
19100
|
console.log(chalk33.dim(`> ${cmd}`));
|
|
19067
19101
|
}
|
|
19068
19102
|
function execVm0Command(args, options = {}) {
|
|
19069
|
-
return new Promise((
|
|
19103
|
+
return new Promise((resolve, reject) => {
|
|
19070
19104
|
const stdio = options.silent ? "pipe" : "inherit";
|
|
19071
19105
|
const proc = safeSpawn("vm0", args, {
|
|
19072
19106
|
cwd: options.cwd,
|
|
@@ -19084,7 +19118,7 @@ function execVm0Command(args, options = {}) {
|
|
|
19084
19118
|
}
|
|
19085
19119
|
proc.on("close", (code) => {
|
|
19086
19120
|
if (code === 0) {
|
|
19087
|
-
|
|
19121
|
+
resolve(stdout);
|
|
19088
19122
|
} else {
|
|
19089
19123
|
reject(new Error(stderr || `Command failed with exit code ${code}`));
|
|
19090
19124
|
}
|
|
@@ -19095,7 +19129,7 @@ function execVm0Command(args, options = {}) {
|
|
|
19095
19129
|
});
|
|
19096
19130
|
}
|
|
19097
19131
|
function execVm0RunWithCapture(args, options = {}) {
|
|
19098
|
-
return new Promise((
|
|
19132
|
+
return new Promise((resolve, reject) => {
|
|
19099
19133
|
const env = process.stdout.isTTY ? { ...process.env, FORCE_COLOR: "1" } : process.env;
|
|
19100
19134
|
const proc = safeSpawn("vm0", args, {
|
|
19101
19135
|
cwd: options.cwd,
|
|
@@ -19116,7 +19150,7 @@ function execVm0RunWithCapture(args, options = {}) {
|
|
|
19116
19150
|
});
|
|
19117
19151
|
proc.on("close", (code) => {
|
|
19118
19152
|
if (code === 0) {
|
|
19119
|
-
|
|
19153
|
+
resolve(stdout);
|
|
19120
19154
|
} else {
|
|
19121
19155
|
reject(new Error(stderr || `Command failed with exit code ${code}`));
|
|
19122
19156
|
}
|
|
@@ -19326,7 +19360,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
19326
19360
|
withErrorHandler(
|
|
19327
19361
|
async (prompt, options) => {
|
|
19328
19362
|
if (options.autoUpdate !== false) {
|
|
19329
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
19363
|
+
const shouldExit = await checkAndUpgrade("9.78.0", prompt);
|
|
19330
19364
|
if (shouldExit) {
|
|
19331
19365
|
process.exit(0);
|
|
19332
19366
|
}
|
|
@@ -19512,7 +19546,7 @@ import { Command as Command40 } from "commander";
|
|
|
19512
19546
|
import chalk36 from "chalk";
|
|
19513
19547
|
|
|
19514
19548
|
// src/lib/api/api-client.ts
|
|
19515
|
-
import { initClient as
|
|
19549
|
+
import { initClient as initClient16 } from "@ts-rest/core";
|
|
19516
19550
|
var ApiClient = class {
|
|
19517
19551
|
async getHeaders() {
|
|
19518
19552
|
const token = await getActiveToken();
|
|
@@ -19538,7 +19572,7 @@ var ApiClient = class {
|
|
|
19538
19572
|
async getComposeByName(name, org) {
|
|
19539
19573
|
const baseUrl = await this.getBaseUrl();
|
|
19540
19574
|
const headers = await this.getHeaders();
|
|
19541
|
-
const client =
|
|
19575
|
+
const client = initClient16(composesMainContract, {
|
|
19542
19576
|
baseUrl,
|
|
19543
19577
|
baseHeaders: headers,
|
|
19544
19578
|
jsonQuery: false
|
|
@@ -19559,7 +19593,7 @@ var ApiClient = class {
|
|
|
19559
19593
|
async getComposeById(id) {
|
|
19560
19594
|
const baseUrl = await this.getBaseUrl();
|
|
19561
19595
|
const headers = await this.getHeaders();
|
|
19562
|
-
const client =
|
|
19596
|
+
const client = initClient16(composesByIdContract, {
|
|
19563
19597
|
baseUrl,
|
|
19564
19598
|
baseHeaders: headers,
|
|
19565
19599
|
jsonQuery: false
|
|
@@ -19581,7 +19615,7 @@ var ApiClient = class {
|
|
|
19581
19615
|
async getComposeVersion(composeId, version) {
|
|
19582
19616
|
const baseUrl = await this.getBaseUrl();
|
|
19583
19617
|
const headers = await this.getHeaders();
|
|
19584
|
-
const client =
|
|
19618
|
+
const client = initClient16(composesVersionsContract, {
|
|
19585
19619
|
baseUrl,
|
|
19586
19620
|
baseHeaders: headers,
|
|
19587
19621
|
jsonQuery: false
|
|
@@ -19602,7 +19636,7 @@ var ApiClient = class {
|
|
|
19602
19636
|
async createOrUpdateCompose(body) {
|
|
19603
19637
|
const baseUrl = await this.getBaseUrl();
|
|
19604
19638
|
const headers = await this.getHeaders();
|
|
19605
|
-
const client =
|
|
19639
|
+
const client = initClient16(composesMainContract, {
|
|
19606
19640
|
baseUrl,
|
|
19607
19641
|
baseHeaders: headers,
|
|
19608
19642
|
jsonQuery: false
|
|
@@ -19625,7 +19659,7 @@ var ApiClient = class {
|
|
|
19625
19659
|
async createRun(body) {
|
|
19626
19660
|
const baseUrl = await this.getBaseUrl();
|
|
19627
19661
|
const headers = await this.getHeaders();
|
|
19628
|
-
const client =
|
|
19662
|
+
const client = initClient16(runsMainContract, {
|
|
19629
19663
|
baseUrl,
|
|
19630
19664
|
baseHeaders: headers,
|
|
19631
19665
|
jsonQuery: false
|
|
@@ -19640,7 +19674,7 @@ var ApiClient = class {
|
|
|
19640
19674
|
}
|
|
19641
19675
|
async getEvents(runId, options) {
|
|
19642
19676
|
const config = await getClientConfig();
|
|
19643
|
-
const client =
|
|
19677
|
+
const client = initClient16(runEventsContract, config);
|
|
19644
19678
|
const result = await client.getEvents({
|
|
19645
19679
|
params: { id: runId },
|
|
19646
19680
|
query: {
|
|
@@ -19657,7 +19691,7 @@ var ApiClient = class {
|
|
|
19657
19691
|
}
|
|
19658
19692
|
async getSystemLog(runId, options) {
|
|
19659
19693
|
const config = await getClientConfig();
|
|
19660
|
-
const client =
|
|
19694
|
+
const client = initClient16(runSystemLogContract, config);
|
|
19661
19695
|
const result = await client.getSystemLog({
|
|
19662
19696
|
params: { id: runId },
|
|
19663
19697
|
query: {
|
|
@@ -19675,7 +19709,7 @@ var ApiClient = class {
|
|
|
19675
19709
|
}
|
|
19676
19710
|
async getMetrics(runId, options) {
|
|
19677
19711
|
const config = await getClientConfig();
|
|
19678
|
-
const client =
|
|
19712
|
+
const client = initClient16(runMetricsContract, config);
|
|
19679
19713
|
const result = await client.getMetrics({
|
|
19680
19714
|
params: { id: runId },
|
|
19681
19715
|
query: {
|
|
@@ -19693,7 +19727,7 @@ var ApiClient = class {
|
|
|
19693
19727
|
}
|
|
19694
19728
|
async getAgentEvents(runId, options) {
|
|
19695
19729
|
const config = await getClientConfig();
|
|
19696
|
-
const client =
|
|
19730
|
+
const client = initClient16(runAgentEventsContract, config);
|
|
19697
19731
|
const result = await client.getAgentEvents({
|
|
19698
19732
|
params: { id: runId },
|
|
19699
19733
|
query: {
|
|
@@ -19711,7 +19745,7 @@ var ApiClient = class {
|
|
|
19711
19745
|
}
|
|
19712
19746
|
async getNetworkLogs(runId, options) {
|
|
19713
19747
|
const config = await getClientConfig();
|
|
19714
|
-
const client =
|
|
19748
|
+
const client = initClient16(runNetworkLogsContract, config);
|
|
19715
19749
|
const result = await client.getNetworkLogs({
|
|
19716
19750
|
params: { id: runId },
|
|
19717
19751
|
query: {
|
|
@@ -19734,7 +19768,7 @@ var ApiClient = class {
|
|
|
19734
19768
|
async getSession(sessionId) {
|
|
19735
19769
|
const baseUrl = await this.getBaseUrl();
|
|
19736
19770
|
const headers = await this.getHeaders();
|
|
19737
|
-
const client =
|
|
19771
|
+
const client = initClient16(sessionsByIdContract, {
|
|
19738
19772
|
baseUrl,
|
|
19739
19773
|
baseHeaders: headers,
|
|
19740
19774
|
jsonQuery: false
|
|
@@ -19755,7 +19789,7 @@ var ApiClient = class {
|
|
|
19755
19789
|
*/
|
|
19756
19790
|
async getCheckpoint(checkpointId) {
|
|
19757
19791
|
const config = await getClientConfig();
|
|
19758
|
-
const client =
|
|
19792
|
+
const client = initClient16(checkpointsByIdContract, config);
|
|
19759
19793
|
const result = await client.getById({
|
|
19760
19794
|
params: { id: checkpointId }
|
|
19761
19795
|
});
|
|
@@ -19772,7 +19806,7 @@ var ApiClient = class {
|
|
|
19772
19806
|
async prepareStorage(body) {
|
|
19773
19807
|
const baseUrl = await this.getBaseUrl();
|
|
19774
19808
|
const headers = await this.getHeaders();
|
|
19775
|
-
const client =
|
|
19809
|
+
const client = initClient16(storagesPrepareContract, {
|
|
19776
19810
|
baseUrl,
|
|
19777
19811
|
baseHeaders: headers,
|
|
19778
19812
|
jsonQuery: false
|
|
@@ -19791,7 +19825,7 @@ var ApiClient = class {
|
|
|
19791
19825
|
async commitStorage(body) {
|
|
19792
19826
|
const baseUrl = await this.getBaseUrl();
|
|
19793
19827
|
const headers = await this.getHeaders();
|
|
19794
|
-
const client =
|
|
19828
|
+
const client = initClient16(storagesCommitContract, {
|
|
19795
19829
|
baseUrl,
|
|
19796
19830
|
baseHeaders: headers,
|
|
19797
19831
|
jsonQuery: false
|
|
@@ -19810,7 +19844,7 @@ var ApiClient = class {
|
|
|
19810
19844
|
async getStorageDownload(query) {
|
|
19811
19845
|
const baseUrl = await this.getBaseUrl();
|
|
19812
19846
|
const headers = await this.getHeaders();
|
|
19813
|
-
const client =
|
|
19847
|
+
const client = initClient16(storagesDownloadContract, {
|
|
19814
19848
|
baseUrl,
|
|
19815
19849
|
baseHeaders: headers,
|
|
19816
19850
|
jsonQuery: false
|
|
@@ -19835,7 +19869,7 @@ var ApiClient = class {
|
|
|
19835
19869
|
async listStorages(query) {
|
|
19836
19870
|
const baseUrl = await this.getBaseUrl();
|
|
19837
19871
|
const headers = await this.getHeaders();
|
|
19838
|
-
const client =
|
|
19872
|
+
const client = initClient16(storagesListContract, {
|
|
19839
19873
|
baseUrl,
|
|
19840
19874
|
baseHeaders: headers,
|
|
19841
19875
|
jsonQuery: false
|
|
@@ -19851,7 +19885,7 @@ var ApiClient = class {
|
|
|
19851
19885
|
/**
|
|
19852
19886
|
* Generic GET request
|
|
19853
19887
|
*/
|
|
19854
|
-
async get(
|
|
19888
|
+
async get(path17) {
|
|
19855
19889
|
const baseUrl = await this.getBaseUrl();
|
|
19856
19890
|
const token = await getActiveToken();
|
|
19857
19891
|
if (!token) {
|
|
@@ -19864,7 +19898,7 @@ var ApiClient = class {
|
|
|
19864
19898
|
if (bypassSecret) {
|
|
19865
19899
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
19866
19900
|
}
|
|
19867
|
-
return fetch(`${baseUrl}${
|
|
19901
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
19868
19902
|
method: "GET",
|
|
19869
19903
|
headers
|
|
19870
19904
|
});
|
|
@@ -19872,7 +19906,7 @@ var ApiClient = class {
|
|
|
19872
19906
|
/**
|
|
19873
19907
|
* Generic POST request
|
|
19874
19908
|
*/
|
|
19875
|
-
async post(
|
|
19909
|
+
async post(path17, options) {
|
|
19876
19910
|
const baseUrl = await this.getBaseUrl();
|
|
19877
19911
|
const token = await getActiveToken();
|
|
19878
19912
|
if (!token) {
|
|
@@ -19888,7 +19922,7 @@ var ApiClient = class {
|
|
|
19888
19922
|
if (bypassSecret) {
|
|
19889
19923
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
19890
19924
|
}
|
|
19891
|
-
return fetch(`${baseUrl}${
|
|
19925
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
19892
19926
|
method: "POST",
|
|
19893
19927
|
headers,
|
|
19894
19928
|
body: options?.body
|
|
@@ -19897,7 +19931,7 @@ var ApiClient = class {
|
|
|
19897
19931
|
/**
|
|
19898
19932
|
* Generic DELETE request
|
|
19899
19933
|
*/
|
|
19900
|
-
async delete(
|
|
19934
|
+
async delete(path17) {
|
|
19901
19935
|
const baseUrl = await this.getBaseUrl();
|
|
19902
19936
|
const token = await getActiveToken();
|
|
19903
19937
|
if (!token) {
|
|
@@ -19910,14 +19944,14 @@ var ApiClient = class {
|
|
|
19910
19944
|
if (bypassSecret) {
|
|
19911
19945
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
19912
19946
|
}
|
|
19913
|
-
return fetch(`${baseUrl}${
|
|
19947
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
19914
19948
|
method: "DELETE",
|
|
19915
19949
|
headers
|
|
19916
19950
|
});
|
|
19917
19951
|
}
|
|
19918
19952
|
async searchLogs(options) {
|
|
19919
19953
|
const config = await getClientConfig();
|
|
19920
|
-
const client =
|
|
19954
|
+
const client = initClient16(logsSearchContract, config);
|
|
19921
19955
|
const result = await client.searchLogs({
|
|
19922
19956
|
query: {
|
|
19923
19957
|
keyword: options.keyword,
|
|
@@ -20381,432 +20415,12 @@ async function showNetworkLogs(runId, options) {
|
|
|
20381
20415
|
}
|
|
20382
20416
|
}
|
|
20383
20417
|
|
|
20384
|
-
// src/commands/
|
|
20385
|
-
import { Command as Command45 } from "commander";
|
|
20386
|
-
|
|
20387
|
-
// src/commands/agent/clone.ts
|
|
20418
|
+
// src/commands/init/index.ts
|
|
20388
20419
|
import { Command as Command41 } from "commander";
|
|
20389
20420
|
import chalk37 from "chalk";
|
|
20390
|
-
import
|
|
20391
|
-
import { mkdir as mkdir7, writeFile as writeFile6, readdir as readdir2, copyFile, rm as rm4 } from "fs/promises";
|
|
20392
|
-
import { join as join10, dirname as dirname3, resolve, sep } from "path";
|
|
20393
|
-
import { tmpdir as tmpdir7 } from "os";
|
|
20394
|
-
import * as tar6 from "tar";
|
|
20395
|
-
import { stringify as yamlStringify } from "yaml";
|
|
20396
|
-
function cleanComposeContent(content) {
|
|
20397
|
-
const agents = {};
|
|
20398
|
-
for (const [name, agent] of Object.entries(content.agents)) {
|
|
20399
|
-
const cleaned = {
|
|
20400
|
-
framework: agent.framework
|
|
20401
|
-
};
|
|
20402
|
-
if (agent.description) cleaned.description = agent.description;
|
|
20403
|
-
if (agent.volumes) cleaned.volumes = agent.volumes;
|
|
20404
|
-
if (agent.environment) cleaned.environment = agent.environment;
|
|
20405
|
-
if (agent.instructions) cleaned.instructions = agent.instructions;
|
|
20406
|
-
if (agent.skills) cleaned.skills = agent.skills;
|
|
20407
|
-
if (agent.experimental_runner)
|
|
20408
|
-
cleaned.experimental_runner = agent.experimental_runner;
|
|
20409
|
-
if (agent.experimental_profile)
|
|
20410
|
-
cleaned.experimental_profile = agent.experimental_profile;
|
|
20411
|
-
if (agent.experimental_capabilities)
|
|
20412
|
-
cleaned.experimental_capabilities = agent.experimental_capabilities;
|
|
20413
|
-
if (agent.experimental_firewalls)
|
|
20414
|
-
cleaned.experimental_firewalls = agent.experimental_firewalls;
|
|
20415
|
-
agents[name] = cleaned;
|
|
20416
|
-
}
|
|
20417
|
-
const result = {
|
|
20418
|
-
version: content.version,
|
|
20419
|
-
agents
|
|
20420
|
-
};
|
|
20421
|
-
if (content.volumes) {
|
|
20422
|
-
result.volumes = content.volumes;
|
|
20423
|
-
}
|
|
20424
|
-
return result;
|
|
20425
|
-
}
|
|
20426
|
-
async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
20427
|
-
const destPath = join10(destination, instructionsPath);
|
|
20428
|
-
const resolvedDest = resolve(destPath);
|
|
20429
|
-
const resolvedBase = resolve(destination);
|
|
20430
|
-
if (resolvedDest !== resolvedBase && !resolvedDest.startsWith(resolvedBase + sep)) {
|
|
20431
|
-
throw new Error("Invalid instructions path: path traversal detected");
|
|
20432
|
-
}
|
|
20433
|
-
const volumeName = getInstructionsStorageName(agentName);
|
|
20434
|
-
console.log(chalk37.dim("Downloading instructions..."));
|
|
20435
|
-
const downloadInfo = await getStorageDownload({
|
|
20436
|
-
name: volumeName,
|
|
20437
|
-
type: "volume"
|
|
20438
|
-
});
|
|
20439
|
-
if ("empty" in downloadInfo) {
|
|
20440
|
-
console.log(chalk37.yellow("\u26A0 Instructions volume is empty"));
|
|
20441
|
-
return false;
|
|
20442
|
-
}
|
|
20443
|
-
const response = await fetch(downloadInfo.url);
|
|
20444
|
-
if (!response.ok) {
|
|
20445
|
-
throw new Error(`Failed to download instructions: ${response.status}`);
|
|
20446
|
-
}
|
|
20447
|
-
const buffer = Buffer.from(await response.arrayBuffer());
|
|
20448
|
-
const tmpDir = mkdtempSync5(join10(tmpdir7(), "vm0-clone-"));
|
|
20449
|
-
const tarPath = join10(tmpDir, "archive.tar.gz");
|
|
20450
|
-
await writeFile6(tarPath, buffer);
|
|
20451
|
-
await tar6.extract({ file: tarPath, cwd: tmpDir, gzip: true });
|
|
20452
|
-
const files = await readdir2(tmpDir);
|
|
20453
|
-
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
20454
|
-
if (!mdFile) {
|
|
20455
|
-
console.log(chalk37.yellow("\u26A0 No instructions file found in volume"));
|
|
20456
|
-
await rm4(tmpDir, { recursive: true, force: true });
|
|
20457
|
-
return false;
|
|
20458
|
-
}
|
|
20459
|
-
await mkdir7(dirname3(destPath), { recursive: true });
|
|
20460
|
-
await copyFile(join10(tmpDir, mdFile), destPath);
|
|
20461
|
-
await rm4(tmpDir, { recursive: true, force: true });
|
|
20462
|
-
return true;
|
|
20463
|
-
}
|
|
20464
|
-
var cloneCommand4 = new Command41().name("clone").description("Clone agent compose to local directory (latest version)").argument("<name>", "Agent compose name to clone").argument("[destination]", "Destination directory (default: agent name)").action(
|
|
20465
|
-
withErrorHandler(async (name, destination) => {
|
|
20466
|
-
const targetDir = destination || name;
|
|
20467
|
-
const dirStatus = checkDirectoryStatus(targetDir);
|
|
20468
|
-
if (dirStatus.exists && !dirStatus.empty) {
|
|
20469
|
-
throw new Error(`Directory "${targetDir}" is not empty`);
|
|
20470
|
-
}
|
|
20471
|
-
console.log(`Cloning agent compose: ${name}`);
|
|
20472
|
-
const compose = await getComposeByName(name);
|
|
20473
|
-
if (!compose) {
|
|
20474
|
-
throw new Error(`Agent compose not found: ${name}`);
|
|
20475
|
-
}
|
|
20476
|
-
if (!compose.content || !compose.headVersionId) {
|
|
20477
|
-
throw new Error(`Agent compose has no content: ${name}`);
|
|
20478
|
-
}
|
|
20479
|
-
const content = compose.content;
|
|
20480
|
-
const cleanedContent = cleanComposeContent(content);
|
|
20481
|
-
const yamlContent = yamlStringify(cleanedContent);
|
|
20482
|
-
await mkdir7(targetDir, { recursive: true });
|
|
20483
|
-
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
20484
|
-
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
20485
|
-
console.log(chalk37.green("\u2713 Created vm0.yaml"));
|
|
20486
|
-
const agentKey = Object.keys(content.agents)[0];
|
|
20487
|
-
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
20488
|
-
if (agent?.instructions) {
|
|
20489
|
-
try {
|
|
20490
|
-
const instructionsDownloaded = await downloadInstructions(
|
|
20491
|
-
name,
|
|
20492
|
-
agent.instructions,
|
|
20493
|
-
targetDir
|
|
20494
|
-
);
|
|
20495
|
-
if (instructionsDownloaded) {
|
|
20496
|
-
console.log(chalk37.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
20497
|
-
}
|
|
20498
|
-
} catch (error) {
|
|
20499
|
-
console.log(
|
|
20500
|
-
chalk37.yellow(
|
|
20501
|
-
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
20502
|
-
)
|
|
20503
|
-
);
|
|
20504
|
-
}
|
|
20505
|
-
}
|
|
20506
|
-
console.log();
|
|
20507
|
-
console.log(chalk37.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
20508
|
-
console.log(chalk37.dim(` Location: ${targetDir}/`));
|
|
20509
|
-
console.log(chalk37.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
20510
|
-
})
|
|
20511
|
-
);
|
|
20512
|
-
|
|
20513
|
-
// src/commands/agent/delete.ts
|
|
20514
|
-
import { Command as Command42 } from "commander";
|
|
20515
|
-
import chalk38 from "chalk";
|
|
20516
|
-
var deleteCommand = new Command42().name("delete").alias("rm").description("Delete an agent").argument("<name>", "Agent name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
20517
|
-
withErrorHandler(async (name, options) => {
|
|
20518
|
-
const compose = await getComposeByName(name);
|
|
20519
|
-
if (!compose) {
|
|
20520
|
-
throw new Error(`Agent '${name}' not found`, {
|
|
20521
|
-
cause: new Error("Run: vm0 agent list")
|
|
20522
|
-
});
|
|
20523
|
-
}
|
|
20524
|
-
if (!options.yes) {
|
|
20525
|
-
if (!isInteractive()) {
|
|
20526
|
-
throw new Error("--yes flag is required in non-interactive mode");
|
|
20527
|
-
}
|
|
20528
|
-
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
20529
|
-
if (!confirmed) {
|
|
20530
|
-
console.log(chalk38.dim("Cancelled"));
|
|
20531
|
-
return;
|
|
20532
|
-
}
|
|
20533
|
-
}
|
|
20534
|
-
try {
|
|
20535
|
-
await deleteCompose(compose.id);
|
|
20536
|
-
} catch (error) {
|
|
20537
|
-
if (error instanceof Error && error.message.includes("currently running")) {
|
|
20538
|
-
throw new Error("Cannot delete agent: agent is currently running", {
|
|
20539
|
-
cause: new Error("Run: vm0 run list")
|
|
20540
|
-
});
|
|
20541
|
-
}
|
|
20542
|
-
throw error;
|
|
20543
|
-
}
|
|
20544
|
-
console.log(chalk38.green(`\u2713 Agent '${name}' deleted`));
|
|
20545
|
-
})
|
|
20546
|
-
);
|
|
20547
|
-
|
|
20548
|
-
// src/commands/agent/list.ts
|
|
20549
|
-
import { Command as Command43 } from "commander";
|
|
20550
|
-
import chalk39 from "chalk";
|
|
20551
|
-
var listCommand5 = new Command43().name("list").alias("ls").description("List all agent composes").action(
|
|
20552
|
-
withErrorHandler(async () => {
|
|
20553
|
-
const response = await httpGet("/api/agent/composes/list");
|
|
20554
|
-
if (!response.ok) {
|
|
20555
|
-
const error = await response.json();
|
|
20556
|
-
throw new Error(error.error?.message || "List failed");
|
|
20557
|
-
}
|
|
20558
|
-
const data = await response.json();
|
|
20559
|
-
if (data.composes.length === 0) {
|
|
20560
|
-
console.log(chalk39.dim("No agent composes found"));
|
|
20561
|
-
console.log(
|
|
20562
|
-
chalk39.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
20563
|
-
);
|
|
20564
|
-
return;
|
|
20565
|
-
}
|
|
20566
|
-
const nameWidth = Math.max(4, ...data.composes.map((c34) => c34.name.length));
|
|
20567
|
-
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
20568
|
-
" "
|
|
20569
|
-
);
|
|
20570
|
-
console.log(chalk39.dim(header));
|
|
20571
|
-
for (const compose of data.composes) {
|
|
20572
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk39.dim("-");
|
|
20573
|
-
const row = [
|
|
20574
|
-
compose.name.padEnd(nameWidth),
|
|
20575
|
-
versionShort,
|
|
20576
|
-
formatRelativeTime(compose.updatedAt)
|
|
20577
|
-
].join(" ");
|
|
20578
|
-
console.log(row);
|
|
20579
|
-
}
|
|
20580
|
-
})
|
|
20581
|
-
);
|
|
20582
|
-
|
|
20583
|
-
// src/commands/agent/status.ts
|
|
20584
|
-
import { Command as Command44 } from "commander";
|
|
20585
|
-
import chalk40 from "chalk";
|
|
20586
|
-
|
|
20587
|
-
// src/lib/domain/source-derivation.ts
|
|
20588
|
-
import * as fs10 from "fs/promises";
|
|
20589
|
-
import * as path16 from "path";
|
|
20590
|
-
import * as os8 from "os";
|
|
20591
|
-
async function fetchSkillFrontmatter(skillUrl, tempDir) {
|
|
20592
|
-
try {
|
|
20593
|
-
const parsed = parseGitHubTreeUrl2(skillUrl);
|
|
20594
|
-
const skillDir = await downloadGitHubSkill(parsed, tempDir);
|
|
20595
|
-
const frontmatter = await readSkillFrontmatter(skillDir);
|
|
20596
|
-
return { skillName: parsed.skillName, frontmatter };
|
|
20597
|
-
} catch {
|
|
20598
|
-
return null;
|
|
20599
|
-
}
|
|
20600
|
-
}
|
|
20601
|
-
async function deriveAgentVariableSources(agent, options) {
|
|
20602
|
-
const grouped = extractAndGroupVariables(agent.environment ?? {});
|
|
20603
|
-
const secretSources = /* @__PURE__ */ new Map();
|
|
20604
|
-
const varSources = /* @__PURE__ */ new Map();
|
|
20605
|
-
for (const ref of grouped.secrets) {
|
|
20606
|
-
secretSources.set(ref.name, {
|
|
20607
|
-
name: ref.name,
|
|
20608
|
-
source: "agent environment"
|
|
20609
|
-
});
|
|
20610
|
-
}
|
|
20611
|
-
for (const ref of grouped.vars) {
|
|
20612
|
-
varSources.set(ref.name, { name: ref.name, source: "agent environment" });
|
|
20613
|
-
}
|
|
20614
|
-
if (options?.skipNetwork || !agent.skills || agent.skills.length === 0) {
|
|
20615
|
-
return {
|
|
20616
|
-
secrets: Array.from(secretSources.values()),
|
|
20617
|
-
vars: Array.from(varSources.values())
|
|
20618
|
-
};
|
|
20619
|
-
}
|
|
20620
|
-
const tempDir = await fs10.mkdtemp(
|
|
20621
|
-
path16.join(os8.tmpdir(), "vm0-source-derivation-")
|
|
20622
|
-
);
|
|
20623
|
-
try {
|
|
20624
|
-
const skillResults = await Promise.all(
|
|
20625
|
-
agent.skills.map((url) => fetchSkillFrontmatter(url, tempDir))
|
|
20626
|
-
);
|
|
20627
|
-
for (const result of skillResults) {
|
|
20628
|
-
if (!result) continue;
|
|
20629
|
-
const { skillName, frontmatter } = result;
|
|
20630
|
-
if (frontmatter.vm0_secrets) {
|
|
20631
|
-
for (const secretName of frontmatter.vm0_secrets) {
|
|
20632
|
-
if (secretSources.has(secretName)) {
|
|
20633
|
-
secretSources.set(secretName, {
|
|
20634
|
-
name: secretName,
|
|
20635
|
-
source: `skill: ${skillName}`,
|
|
20636
|
-
skillName
|
|
20637
|
-
});
|
|
20638
|
-
}
|
|
20639
|
-
}
|
|
20640
|
-
}
|
|
20641
|
-
if (frontmatter.vm0_vars) {
|
|
20642
|
-
for (const varName of frontmatter.vm0_vars) {
|
|
20643
|
-
if (varSources.has(varName)) {
|
|
20644
|
-
varSources.set(varName, {
|
|
20645
|
-
name: varName,
|
|
20646
|
-
source: `skill: ${skillName}`,
|
|
20647
|
-
skillName
|
|
20648
|
-
});
|
|
20649
|
-
}
|
|
20650
|
-
}
|
|
20651
|
-
}
|
|
20652
|
-
}
|
|
20653
|
-
} finally {
|
|
20654
|
-
await fs10.rm(tempDir, { recursive: true, force: true });
|
|
20655
|
-
}
|
|
20656
|
-
return {
|
|
20657
|
-
secrets: Array.from(secretSources.values()),
|
|
20658
|
-
vars: Array.from(varSources.values())
|
|
20659
|
-
};
|
|
20660
|
-
}
|
|
20661
|
-
async function deriveComposeVariableSources(content, options) {
|
|
20662
|
-
const results = /* @__PURE__ */ new Map();
|
|
20663
|
-
const entries = Object.entries(content.agents);
|
|
20664
|
-
const sourcesPromises = entries.map(async ([agentName, agent]) => {
|
|
20665
|
-
const sources = await deriveAgentVariableSources(agent, options);
|
|
20666
|
-
return { agentName, sources };
|
|
20667
|
-
});
|
|
20668
|
-
const sourcesResults = await Promise.all(sourcesPromises);
|
|
20669
|
-
for (const { agentName, sources } of sourcesResults) {
|
|
20670
|
-
results.set(agentName, sources);
|
|
20671
|
-
}
|
|
20672
|
-
return results;
|
|
20673
|
-
}
|
|
20674
|
-
|
|
20675
|
-
// src/commands/agent/status.ts
|
|
20676
|
-
function formatListSection(label, items) {
|
|
20677
|
-
if (items.length === 0) return;
|
|
20678
|
-
console.log(` ${label}:`);
|
|
20679
|
-
for (const item of items) {
|
|
20680
|
-
console.log(` - ${item}`);
|
|
20681
|
-
}
|
|
20682
|
-
}
|
|
20683
|
-
function formatVolumes(volumes, volumeConfigs) {
|
|
20684
|
-
if (volumes.length === 0) return;
|
|
20685
|
-
console.log(` Volumes:`);
|
|
20686
|
-
for (const vol of volumes) {
|
|
20687
|
-
const volumeDef = volumeConfigs?.[vol];
|
|
20688
|
-
if (volumeDef) {
|
|
20689
|
-
console.log(` - ${vol}:${volumeDef.version.slice(0, 8)}`);
|
|
20690
|
-
} else {
|
|
20691
|
-
console.log(` - ${vol}`);
|
|
20692
|
-
}
|
|
20693
|
-
}
|
|
20694
|
-
}
|
|
20695
|
-
function formatVariableSources(sources) {
|
|
20696
|
-
if (sources.secrets.length > 0) {
|
|
20697
|
-
console.log(` Secrets:`);
|
|
20698
|
-
for (const secret of sources.secrets) {
|
|
20699
|
-
const sourceInfo = chalk40.dim(`(${secret.source})`);
|
|
20700
|
-
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
20701
|
-
}
|
|
20702
|
-
}
|
|
20703
|
-
if (sources.vars.length > 0) {
|
|
20704
|
-
console.log(` Vars:`);
|
|
20705
|
-
for (const v of sources.vars) {
|
|
20706
|
-
const sourceInfo = chalk40.dim(`(${v.source})`);
|
|
20707
|
-
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
20708
|
-
}
|
|
20709
|
-
}
|
|
20710
|
-
}
|
|
20711
|
-
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
20712
|
-
console.log(` ${chalk40.cyan(agentName)}:`);
|
|
20713
|
-
console.log(` Framework: ${agent.framework}`);
|
|
20714
|
-
formatVolumes(agent.volumes ?? [], volumeConfigs);
|
|
20715
|
-
formatListSection("Skills", agent.skills ?? []);
|
|
20716
|
-
if (agentSources) {
|
|
20717
|
-
formatVariableSources(agentSources);
|
|
20718
|
-
}
|
|
20719
|
-
if (agent.experimental_runner) {
|
|
20720
|
-
console.log(` Runner: ${agent.experimental_runner.group}`);
|
|
20721
|
-
}
|
|
20722
|
-
}
|
|
20723
|
-
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
20724
|
-
console.log(chalk40.bold("Name:") + ` ${name}`);
|
|
20725
|
-
console.log(chalk40.bold("Version:") + ` ${versionId}`);
|
|
20726
|
-
console.log();
|
|
20727
|
-
console.log(chalk40.bold("Agents:"));
|
|
20728
|
-
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
20729
|
-
const agentSources = variableSources?.get(agentName);
|
|
20730
|
-
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
20731
|
-
}
|
|
20732
|
-
}
|
|
20733
|
-
var statusCommand5 = new Command44().name("status").description("Show status of agent compose").argument(
|
|
20734
|
-
"<name[:version]>",
|
|
20735
|
-
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
20736
|
-
).option("--no-sources", "Skip fetching skills to determine variable sources").action(
|
|
20737
|
-
withErrorHandler(
|
|
20738
|
-
async (argument, options) => {
|
|
20739
|
-
const colonIndex = argument.lastIndexOf(":");
|
|
20740
|
-
let name;
|
|
20741
|
-
let version;
|
|
20742
|
-
if (colonIndex === -1) {
|
|
20743
|
-
name = argument;
|
|
20744
|
-
version = "latest";
|
|
20745
|
-
} else {
|
|
20746
|
-
name = argument.slice(0, colonIndex);
|
|
20747
|
-
version = argument.slice(colonIndex + 1) || "latest";
|
|
20748
|
-
}
|
|
20749
|
-
const compose = await getComposeByName(name);
|
|
20750
|
-
if (!compose) {
|
|
20751
|
-
throw new Error(`Agent compose not found: ${name}`, {
|
|
20752
|
-
cause: new Error("Run: vm0 agent list")
|
|
20753
|
-
});
|
|
20754
|
-
}
|
|
20755
|
-
let resolvedVersionId = compose.headVersionId;
|
|
20756
|
-
if (version !== "latest" && compose.headVersionId) {
|
|
20757
|
-
if (version.length < 64) {
|
|
20758
|
-
try {
|
|
20759
|
-
const versionInfo = await getComposeVersion(compose.id, version);
|
|
20760
|
-
resolvedVersionId = versionInfo.versionId;
|
|
20761
|
-
} catch (error) {
|
|
20762
|
-
if (error instanceof Error && error.message.includes("not found")) {
|
|
20763
|
-
throw new Error(`Version not found: ${version}`, {
|
|
20764
|
-
cause: new Error(
|
|
20765
|
-
`HEAD version: ${compose.headVersionId?.slice(0, 8)}`
|
|
20766
|
-
)
|
|
20767
|
-
});
|
|
20768
|
-
}
|
|
20769
|
-
throw error;
|
|
20770
|
-
}
|
|
20771
|
-
} else {
|
|
20772
|
-
resolvedVersionId = version;
|
|
20773
|
-
}
|
|
20774
|
-
}
|
|
20775
|
-
if (!resolvedVersionId || !compose.content) {
|
|
20776
|
-
throw new Error(`No version found for: ${name}`);
|
|
20777
|
-
}
|
|
20778
|
-
const content = compose.content;
|
|
20779
|
-
let variableSources;
|
|
20780
|
-
try {
|
|
20781
|
-
variableSources = await deriveComposeVariableSources(content, {
|
|
20782
|
-
skipNetwork: options.sources === false
|
|
20783
|
-
});
|
|
20784
|
-
} catch {
|
|
20785
|
-
console.error(
|
|
20786
|
-
chalk40.yellow(
|
|
20787
|
-
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
20788
|
-
)
|
|
20789
|
-
);
|
|
20790
|
-
}
|
|
20791
|
-
formatComposeOutput(
|
|
20792
|
-
compose.name,
|
|
20793
|
-
resolvedVersionId,
|
|
20794
|
-
content,
|
|
20795
|
-
variableSources
|
|
20796
|
-
);
|
|
20797
|
-
}
|
|
20798
|
-
)
|
|
20799
|
-
);
|
|
20800
|
-
|
|
20801
|
-
// src/commands/agent/index.ts
|
|
20802
|
-
var agentCommand = new Command45().name("agent").description("Manage agent composes").addCommand(cloneCommand4).addCommand(deleteCommand).addCommand(listCommand5).addCommand(statusCommand5);
|
|
20803
|
-
|
|
20804
|
-
// src/commands/init/index.ts
|
|
20805
|
-
import { Command as Command46 } from "commander";
|
|
20806
|
-
import chalk41 from "chalk";
|
|
20807
|
-
import path17 from "path";
|
|
20421
|
+
import path16 from "path";
|
|
20808
20422
|
import { existsSync as existsSync11 } from "fs";
|
|
20809
|
-
import { writeFile as
|
|
20423
|
+
import { writeFile as writeFile6 } from "fs/promises";
|
|
20810
20424
|
var VM0_YAML_FILE = "vm0.yaml";
|
|
20811
20425
|
var AGENTS_MD_FILE = "AGENTS.md";
|
|
20812
20426
|
function generateVm0Yaml(agentName) {
|
|
@@ -20841,7 +20455,7 @@ function checkExistingFiles() {
|
|
|
20841
20455
|
if (existsSync11(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
20842
20456
|
return existingFiles;
|
|
20843
20457
|
}
|
|
20844
|
-
var initCommand4 = new
|
|
20458
|
+
var initCommand4 = new Command41().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(
|
|
20845
20459
|
withErrorHandler(async (options) => {
|
|
20846
20460
|
const existingFiles = checkExistingFiles();
|
|
20847
20461
|
if (existingFiles.length > 0 && !options.force) {
|
|
@@ -20857,7 +20471,7 @@ var initCommand4 = new Command46().name("init").description("Initialize a new VM
|
|
|
20857
20471
|
cause: new Error("Usage: vm0 init --name <agent-name>")
|
|
20858
20472
|
});
|
|
20859
20473
|
} else {
|
|
20860
|
-
const dirName =
|
|
20474
|
+
const dirName = path16.basename(process.cwd());
|
|
20861
20475
|
const defaultName = validateAgentName(dirName) ? dirName : void 0;
|
|
20862
20476
|
const name = await promptText(
|
|
20863
20477
|
"Enter agent name",
|
|
@@ -20870,7 +20484,7 @@ var initCommand4 = new Command46().name("init").description("Initialize a new VM
|
|
|
20870
20484
|
}
|
|
20871
20485
|
);
|
|
20872
20486
|
if (name === void 0) {
|
|
20873
|
-
console.log(
|
|
20487
|
+
console.log(chalk37.dim("Cancelled"));
|
|
20874
20488
|
return;
|
|
20875
20489
|
}
|
|
20876
20490
|
agentName = name;
|
|
@@ -20882,41 +20496,41 @@ var initCommand4 = new Command46().name("init").description("Initialize a new VM
|
|
|
20882
20496
|
)
|
|
20883
20497
|
});
|
|
20884
20498
|
}
|
|
20885
|
-
await
|
|
20499
|
+
await writeFile6(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
20886
20500
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
20887
|
-
console.log(
|
|
20888
|
-
await
|
|
20501
|
+
console.log(chalk37.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
20502
|
+
await writeFile6(AGENTS_MD_FILE, generateAgentsMd());
|
|
20889
20503
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
20890
|
-
console.log(
|
|
20504
|
+
console.log(chalk37.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
20891
20505
|
console.log();
|
|
20892
20506
|
console.log("Next steps:");
|
|
20893
20507
|
console.log(
|
|
20894
|
-
` 1. Set up model provider (one-time): ${
|
|
20508
|
+
` 1. Set up model provider (one-time): ${chalk37.cyan("vm0 org model-provider setup")}`
|
|
20895
20509
|
);
|
|
20896
20510
|
console.log(
|
|
20897
|
-
` 2. Edit ${
|
|
20511
|
+
` 2. Edit ${chalk37.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
20898
20512
|
);
|
|
20899
20513
|
console.log(
|
|
20900
|
-
` 3. Run your agent: ${
|
|
20514
|
+
` 3. Run your agent: ${chalk37.cyan(`vm0 cook "let's start working"`)}`
|
|
20901
20515
|
);
|
|
20902
20516
|
})
|
|
20903
20517
|
);
|
|
20904
20518
|
|
|
20905
20519
|
// src/commands/connector/index.ts
|
|
20906
|
-
import { Command as
|
|
20520
|
+
import { Command as Command46 } from "commander";
|
|
20907
20521
|
|
|
20908
20522
|
// src/commands/connector/connect.ts
|
|
20909
|
-
import { Command as
|
|
20910
|
-
import
|
|
20911
|
-
import { initClient as
|
|
20523
|
+
import { Command as Command42 } from "commander";
|
|
20524
|
+
import chalk39 from "chalk";
|
|
20525
|
+
import { initClient as initClient17 } from "@ts-rest/core";
|
|
20912
20526
|
|
|
20913
20527
|
// src/commands/connector/lib/computer/start-services.ts
|
|
20914
20528
|
import { spawn as spawn2 } from "child_process";
|
|
20915
20529
|
import { access as access2, constants } from "fs/promises";
|
|
20916
20530
|
import { createServer } from "net";
|
|
20917
20531
|
import { homedir as homedir4 } from "os";
|
|
20918
|
-
import { join as
|
|
20919
|
-
import
|
|
20532
|
+
import { join as join10 } from "path";
|
|
20533
|
+
import chalk38 from "chalk";
|
|
20920
20534
|
|
|
20921
20535
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
20922
20536
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -20950,11 +20564,11 @@ var CHROME_CANDIDATES = [
|
|
|
20950
20564
|
"chrome"
|
|
20951
20565
|
];
|
|
20952
20566
|
async function getRandomPort() {
|
|
20953
|
-
return new Promise((
|
|
20567
|
+
return new Promise((resolve, reject) => {
|
|
20954
20568
|
const server = createServer();
|
|
20955
20569
|
server.listen(0, "127.0.0.1", () => {
|
|
20956
20570
|
const { port } = server.address();
|
|
20957
|
-
server.close(() =>
|
|
20571
|
+
server.close(() => resolve(port));
|
|
20958
20572
|
});
|
|
20959
20573
|
server.on("error", reject);
|
|
20960
20574
|
});
|
|
@@ -20968,9 +20582,9 @@ async function findBinary(...candidates) {
|
|
|
20968
20582
|
} catch {
|
|
20969
20583
|
}
|
|
20970
20584
|
} else {
|
|
20971
|
-
const found = await new Promise((
|
|
20585
|
+
const found = await new Promise((resolve) => {
|
|
20972
20586
|
const child = spawn2("which", [candidate]);
|
|
20973
|
-
child.on("close", (code) =>
|
|
20587
|
+
child.on("close", (code) => resolve(code === 0));
|
|
20974
20588
|
});
|
|
20975
20589
|
if (found) return candidate;
|
|
20976
20590
|
}
|
|
@@ -20990,7 +20604,7 @@ async function checkComputerDependencies() {
|
|
|
20990
20604
|
}
|
|
20991
20605
|
}
|
|
20992
20606
|
async function startComputerServices(credentials) {
|
|
20993
|
-
console.log(
|
|
20607
|
+
console.log(chalk38.cyan("Starting computer connector services..."));
|
|
20994
20608
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
20995
20609
|
if (!wsgidavBinary) {
|
|
20996
20610
|
throw new Error(
|
|
@@ -21003,7 +20617,7 @@ async function startComputerServices(credentials) {
|
|
|
21003
20617
|
}
|
|
21004
20618
|
const webdavPort = await getRandomPort();
|
|
21005
20619
|
const cdpPort = await getRandomPort();
|
|
21006
|
-
const downloadsPath =
|
|
20620
|
+
const downloadsPath = join10(homedir4(), "Downloads");
|
|
21007
20621
|
const wsgidav = spawn2(
|
|
21008
20622
|
wsgidavBinary,
|
|
21009
20623
|
[
|
|
@@ -21017,7 +20631,7 @@ async function startComputerServices(credentials) {
|
|
|
21017
20631
|
);
|
|
21018
20632
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
21019
20633
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
21020
|
-
console.log(
|
|
20634
|
+
console.log(chalk38.green("\u2713 WebDAV server started"));
|
|
21021
20635
|
const chrome = spawn2(
|
|
21022
20636
|
chromeBinary,
|
|
21023
20637
|
[
|
|
@@ -21031,7 +20645,7 @@ async function startComputerServices(credentials) {
|
|
|
21031
20645
|
);
|
|
21032
20646
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
21033
20647
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
21034
|
-
console.log(
|
|
20648
|
+
console.log(chalk38.green("\u2713 Chrome started"));
|
|
21035
20649
|
try {
|
|
21036
20650
|
await startNgrokTunnels(
|
|
21037
20651
|
credentials.ngrokToken,
|
|
@@ -21040,32 +20654,32 @@ async function startComputerServices(credentials) {
|
|
|
21040
20654
|
cdpPort
|
|
21041
20655
|
);
|
|
21042
20656
|
console.log(
|
|
21043
|
-
|
|
20657
|
+
chalk38.green(
|
|
21044
20658
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
21045
20659
|
)
|
|
21046
20660
|
);
|
|
21047
20661
|
console.log();
|
|
21048
|
-
console.log(
|
|
20662
|
+
console.log(chalk38.green("\u2713 Computer connector active"));
|
|
21049
20663
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
21050
20664
|
console.log(
|
|
21051
20665
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
21052
20666
|
);
|
|
21053
20667
|
console.log();
|
|
21054
|
-
console.log(
|
|
20668
|
+
console.log(chalk38.dim("Press ^C twice to disconnect"));
|
|
21055
20669
|
console.log();
|
|
21056
20670
|
let sigintCount = 0;
|
|
21057
|
-
await new Promise((
|
|
20671
|
+
await new Promise((resolve) => {
|
|
21058
20672
|
const keepAlive = setInterval(() => {
|
|
21059
20673
|
}, 6e4);
|
|
21060
20674
|
const done = () => {
|
|
21061
20675
|
clearInterval(keepAlive);
|
|
21062
20676
|
process.removeListener("SIGINT", onSigint);
|
|
21063
|
-
|
|
20677
|
+
resolve();
|
|
21064
20678
|
};
|
|
21065
20679
|
const onSigint = () => {
|
|
21066
20680
|
sigintCount++;
|
|
21067
20681
|
if (sigintCount === 1) {
|
|
21068
|
-
console.log(
|
|
20682
|
+
console.log(chalk38.dim("\nPress ^C again to disconnect and exit..."));
|
|
21069
20683
|
} else {
|
|
21070
20684
|
done();
|
|
21071
20685
|
}
|
|
@@ -21075,17 +20689,17 @@ async function startComputerServices(credentials) {
|
|
|
21075
20689
|
});
|
|
21076
20690
|
} finally {
|
|
21077
20691
|
console.log();
|
|
21078
|
-
console.log(
|
|
20692
|
+
console.log(chalk38.cyan("Stopping services..."));
|
|
21079
20693
|
wsgidav.kill("SIGTERM");
|
|
21080
20694
|
chrome.kill("SIGTERM");
|
|
21081
20695
|
await stopNgrokTunnels();
|
|
21082
|
-
console.log(
|
|
20696
|
+
console.log(chalk38.green("\u2713 Services stopped"));
|
|
21083
20697
|
}
|
|
21084
20698
|
}
|
|
21085
20699
|
|
|
21086
20700
|
// src/commands/connector/connect.ts
|
|
21087
20701
|
function delay2(ms) {
|
|
21088
|
-
return new Promise((
|
|
20702
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21089
20703
|
}
|
|
21090
20704
|
async function getHeaders2() {
|
|
21091
20705
|
const token = await getActiveToken();
|
|
@@ -21104,10 +20718,10 @@ async function getHeaders2() {
|
|
|
21104
20718
|
function renderHelpText(text) {
|
|
21105
20719
|
return text.replace(
|
|
21106
20720
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
21107
|
-
(_m, label, url) => `${label} (${
|
|
21108
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
20721
|
+
(_m, label, url) => `${label} (${chalk39.cyan(url)})`
|
|
20722
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk39.bold(content)).replace(
|
|
21109
20723
|
/^> (.+)$/gm,
|
|
21110
|
-
(_m, content) =>
|
|
20724
|
+
(_m, content) => chalk39.yellow(` ${content}`)
|
|
21111
20725
|
);
|
|
21112
20726
|
}
|
|
21113
20727
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -21132,7 +20746,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
21132
20746
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
21133
20747
|
if (!secretConfig.required) continue;
|
|
21134
20748
|
const value = await promptPassword(
|
|
21135
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
20749
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk39.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
21136
20750
|
);
|
|
21137
20751
|
if (!value) {
|
|
21138
20752
|
throw new Error("Cancelled");
|
|
@@ -21148,14 +20762,14 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
21148
20762
|
});
|
|
21149
20763
|
}
|
|
21150
20764
|
console.log(
|
|
21151
|
-
|
|
20765
|
+
chalk39.green(`
|
|
21152
20766
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
21153
20767
|
);
|
|
21154
20768
|
}
|
|
21155
20769
|
async function connectComputer(apiUrl, headers) {
|
|
21156
20770
|
await checkComputerDependencies();
|
|
21157
|
-
console.log(
|
|
21158
|
-
const computerClient =
|
|
20771
|
+
console.log(chalk39.cyan("Setting up computer connector..."));
|
|
20772
|
+
const computerClient = initClient17(computerConnectorContract, {
|
|
21159
20773
|
baseUrl: apiUrl,
|
|
21160
20774
|
baseHeaders: headers,
|
|
21161
20775
|
jsonQuery: false
|
|
@@ -21169,9 +20783,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
21169
20783
|
}
|
|
21170
20784
|
const credentials = createResult.body;
|
|
21171
20785
|
await startComputerServices(credentials);
|
|
21172
|
-
console.log(
|
|
20786
|
+
console.log(chalk39.cyan("Disconnecting computer connector..."));
|
|
21173
20787
|
await deleteConnector("computer");
|
|
21174
|
-
console.log(
|
|
20788
|
+
console.log(chalk39.green("\u2713 Disconnected computer"));
|
|
21175
20789
|
process.exit(0);
|
|
21176
20790
|
}
|
|
21177
20791
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -21210,8 +20824,8 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
21210
20824
|
);
|
|
21211
20825
|
}
|
|
21212
20826
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
21213
|
-
console.log(`Connecting ${
|
|
21214
|
-
const sessionsClient =
|
|
20827
|
+
console.log(`Connecting ${chalk39.cyan(connectorType)}...`);
|
|
20828
|
+
const sessionsClient = initClient17(connectorSessionsContract, {
|
|
21215
20829
|
baseUrl: apiUrl,
|
|
21216
20830
|
baseHeaders: headers,
|
|
21217
20831
|
jsonQuery: false
|
|
@@ -21226,15 +20840,15 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
21226
20840
|
}
|
|
21227
20841
|
const session = createResult.body;
|
|
21228
20842
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
21229
|
-
console.log(
|
|
21230
|
-
console.log(
|
|
20843
|
+
console.log(chalk39.green("\nSession created"));
|
|
20844
|
+
console.log(chalk39.cyan(`
|
|
21231
20845
|
To connect, visit: ${verificationUrl}`));
|
|
21232
20846
|
console.log(
|
|
21233
20847
|
`
|
|
21234
20848
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
21235
20849
|
);
|
|
21236
20850
|
console.log("\nWaiting for authorization...");
|
|
21237
|
-
const sessionClient =
|
|
20851
|
+
const sessionClient = initClient17(connectorSessionByIdContract, {
|
|
21238
20852
|
baseUrl: apiUrl,
|
|
21239
20853
|
baseHeaders: headers,
|
|
21240
20854
|
jsonQuery: false
|
|
@@ -21259,7 +20873,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
21259
20873
|
switch (status.status) {
|
|
21260
20874
|
case "complete":
|
|
21261
20875
|
console.log(
|
|
21262
|
-
|
|
20876
|
+
chalk39.green(`
|
|
21263
20877
|
|
|
21264
20878
|
${connectorType} connected successfully!`)
|
|
21265
20879
|
);
|
|
@@ -21271,13 +20885,13 @@ ${connectorType} connected successfully!`)
|
|
|
21271
20885
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
21272
20886
|
);
|
|
21273
20887
|
case "pending":
|
|
21274
|
-
process.stdout.write(
|
|
20888
|
+
process.stdout.write(chalk39.dim("."));
|
|
21275
20889
|
break;
|
|
21276
20890
|
}
|
|
21277
20891
|
}
|
|
21278
20892
|
throw new Error("Session timed out, please try again");
|
|
21279
20893
|
}
|
|
21280
|
-
var connectCommand = new
|
|
20894
|
+
var connectCommand = new Command42().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").option("--token <value>", "API token value (skip interactive prompt)").action(
|
|
21281
20895
|
withErrorHandler(async (type2, options) => {
|
|
21282
20896
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
21283
20897
|
if (!parseResult.success) {
|
|
@@ -21302,12 +20916,12 @@ var connectCommand = new Command47().name("connect").description("Connect a thir
|
|
|
21302
20916
|
);
|
|
21303
20917
|
|
|
21304
20918
|
// src/commands/connector/list.ts
|
|
21305
|
-
import { Command as
|
|
21306
|
-
import
|
|
21307
|
-
var
|
|
20919
|
+
import { Command as Command43 } from "commander";
|
|
20920
|
+
import chalk40 from "chalk";
|
|
20921
|
+
var listCommand5 = new Command43().name("list").alias("ls").description("List all connectors and their status").action(
|
|
21308
20922
|
withErrorHandler(async () => {
|
|
21309
20923
|
const result = await listConnectors();
|
|
21310
|
-
const connectedMap = new Map(result.connectors.map((
|
|
20924
|
+
const connectedMap = new Map(result.connectors.map((c33) => [c33.type, c33]));
|
|
21311
20925
|
const allTypesRaw = Object.keys(CONNECTOR_TYPES);
|
|
21312
20926
|
const allTypes = [];
|
|
21313
20927
|
for (const type2 of allTypesRaw) {
|
|
@@ -21326,24 +20940,24 @@ var listCommand6 = new Command48().name("list").alias("ls").description("List al
|
|
|
21326
20940
|
statusText.padEnd(statusWidth),
|
|
21327
20941
|
"ACCOUNT"
|
|
21328
20942
|
].join(" ");
|
|
21329
|
-
console.log(
|
|
20943
|
+
console.log(chalk40.dim(header));
|
|
21330
20944
|
for (const type2 of allTypes) {
|
|
21331
20945
|
const connector = connectedMap.get(type2);
|
|
21332
20946
|
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type2, connector.oauthScopes);
|
|
21333
|
-
const status = connector ? connector.needsReconnect ?
|
|
21334
|
-
const account = connector?.needsReconnect ?
|
|
20947
|
+
const status = connector ? connector.needsReconnect ? chalk40.yellow("!".padEnd(statusWidth)) : scopeMismatch ? chalk40.yellow("!".padEnd(statusWidth)) : chalk40.green("\u2713".padEnd(statusWidth)) : chalk40.dim("-".padEnd(statusWidth));
|
|
20948
|
+
const account = connector?.needsReconnect ? chalk40.yellow("(reconnect needed)") : scopeMismatch ? chalk40.yellow("(permissions update available)") : connector?.externalUsername ? `@${connector.externalUsername}` : chalk40.dim("-");
|
|
21335
20949
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
21336
20950
|
console.log(row);
|
|
21337
20951
|
}
|
|
21338
20952
|
console.log();
|
|
21339
|
-
console.log(
|
|
21340
|
-
console.log(
|
|
20953
|
+
console.log(chalk40.dim("To connect a service:"));
|
|
20954
|
+
console.log(chalk40.dim(" vm0 connector connect <type>"));
|
|
21341
20955
|
})
|
|
21342
20956
|
);
|
|
21343
20957
|
|
|
21344
20958
|
// src/commands/connector/status.ts
|
|
21345
|
-
import { Command as
|
|
21346
|
-
import
|
|
20959
|
+
import { Command as Command44 } from "commander";
|
|
20960
|
+
import chalk41 from "chalk";
|
|
21347
20961
|
|
|
21348
20962
|
// src/lib/domain/schedule-utils.ts
|
|
21349
20963
|
function formatRelativeTime2(dateStr) {
|
|
@@ -21460,7 +21074,7 @@ function toISODateTime(dateTimeStr) {
|
|
|
21460
21074
|
|
|
21461
21075
|
// src/commands/connector/status.ts
|
|
21462
21076
|
var LABEL_WIDTH = 16;
|
|
21463
|
-
var
|
|
21077
|
+
var statusCommand5 = new Command44().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
21464
21078
|
withErrorHandler(async (type2) => {
|
|
21465
21079
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
21466
21080
|
if (!parseResult.success) {
|
|
@@ -21470,11 +21084,11 @@ var statusCommand6 = new Command49().name("status").description("Show detailed s
|
|
|
21470
21084
|
});
|
|
21471
21085
|
}
|
|
21472
21086
|
const connector = await getConnector(parseResult.data);
|
|
21473
|
-
console.log(`Connector: ${
|
|
21087
|
+
console.log(`Connector: ${chalk41.cyan(type2)}`);
|
|
21474
21088
|
console.log();
|
|
21475
21089
|
if (connector) {
|
|
21476
21090
|
console.log(
|
|
21477
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
21091
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk41.green("connected")}`
|
|
21478
21092
|
);
|
|
21479
21093
|
console.log(
|
|
21480
21094
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -21490,7 +21104,7 @@ var statusCommand6 = new Command49().name("status").description("Show detailed s
|
|
|
21490
21104
|
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
21491
21105
|
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
21492
21106
|
console.log(
|
|
21493
|
-
`${"Permissions:".padEnd(LABEL_WIDTH)}${
|
|
21107
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${chalk41.yellow("update available")}`
|
|
21494
21108
|
);
|
|
21495
21109
|
if (diff.addedScopes.length > 0) {
|
|
21496
21110
|
console.log(
|
|
@@ -21512,23 +21126,23 @@ var statusCommand6 = new Command49().name("status").description("Show detailed s
|
|
|
21512
21126
|
);
|
|
21513
21127
|
}
|
|
21514
21128
|
console.log();
|
|
21515
|
-
console.log(
|
|
21516
|
-
console.log(
|
|
21129
|
+
console.log(chalk41.dim("To disconnect:"));
|
|
21130
|
+
console.log(chalk41.dim(` vm0 connector disconnect ${type2}`));
|
|
21517
21131
|
} else {
|
|
21518
21132
|
console.log(
|
|
21519
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
21133
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk41.dim("not connected")}`
|
|
21520
21134
|
);
|
|
21521
21135
|
console.log();
|
|
21522
|
-
console.log(
|
|
21523
|
-
console.log(
|
|
21136
|
+
console.log(chalk41.dim("To connect:"));
|
|
21137
|
+
console.log(chalk41.dim(` vm0 connector connect ${type2}`));
|
|
21524
21138
|
}
|
|
21525
21139
|
})
|
|
21526
21140
|
);
|
|
21527
21141
|
|
|
21528
21142
|
// src/commands/connector/disconnect.ts
|
|
21529
|
-
import { Command as
|
|
21530
|
-
import
|
|
21531
|
-
var disconnectCommand = new
|
|
21143
|
+
import { Command as Command45 } from "commander";
|
|
21144
|
+
import chalk42 from "chalk";
|
|
21145
|
+
var disconnectCommand = new Command45().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
21532
21146
|
withErrorHandler(async (type2) => {
|
|
21533
21147
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
21534
21148
|
if (!parseResult.success) {
|
|
@@ -21539,16 +21153,16 @@ var disconnectCommand = new Command50().name("disconnect").description("Disconne
|
|
|
21539
21153
|
}
|
|
21540
21154
|
const connectorType = parseResult.data;
|
|
21541
21155
|
await deleteConnector(connectorType);
|
|
21542
|
-
console.log(
|
|
21156
|
+
console.log(chalk42.green(`\u2713 Disconnected ${type2}`));
|
|
21543
21157
|
})
|
|
21544
21158
|
);
|
|
21545
21159
|
|
|
21546
21160
|
// src/commands/connector/index.ts
|
|
21547
|
-
var connectorCommand = new
|
|
21161
|
+
var connectorCommand = new Command46().name("connector").description("Manage third-party service connections").addCommand(listCommand5).addCommand(statusCommand5).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
21548
21162
|
|
|
21549
21163
|
// src/commands/preference/index.ts
|
|
21550
|
-
import { Command as
|
|
21551
|
-
import
|
|
21164
|
+
import { Command as Command47 } from "commander";
|
|
21165
|
+
import chalk43 from "chalk";
|
|
21552
21166
|
function detectTimezone2() {
|
|
21553
21167
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
21554
21168
|
}
|
|
@@ -21569,15 +21183,15 @@ function parseOnOff(flag, value) {
|
|
|
21569
21183
|
);
|
|
21570
21184
|
}
|
|
21571
21185
|
function displayPreferences(prefs) {
|
|
21572
|
-
console.log(
|
|
21186
|
+
console.log(chalk43.bold("Current preferences:"));
|
|
21573
21187
|
console.log(
|
|
21574
|
-
` Timezone: ${prefs.timezone ?
|
|
21188
|
+
` Timezone: ${prefs.timezone ? chalk43.cyan(prefs.timezone) : chalk43.dim("not set")}`
|
|
21575
21189
|
);
|
|
21576
21190
|
console.log(
|
|
21577
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
21191
|
+
` Email notify: ${prefs.notifyEmail ? chalk43.green("on") : chalk43.dim("off")}`
|
|
21578
21192
|
);
|
|
21579
21193
|
console.log(
|
|
21580
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
21194
|
+
` Slack notify: ${prefs.notifySlack ? chalk43.green("on") : chalk43.dim("off")}`
|
|
21581
21195
|
);
|
|
21582
21196
|
}
|
|
21583
21197
|
function buildUpdates(opts) {
|
|
@@ -21607,21 +21221,21 @@ function buildUpdates(opts) {
|
|
|
21607
21221
|
function printUpdateResult(updates, result) {
|
|
21608
21222
|
if (updates.timezone !== void 0) {
|
|
21609
21223
|
console.log(
|
|
21610
|
-
|
|
21611
|
-
`Timezone set to ${
|
|
21224
|
+
chalk43.green(
|
|
21225
|
+
`Timezone set to ${chalk43.cyan(result.timezone ?? updates.timezone)}`
|
|
21612
21226
|
)
|
|
21613
21227
|
);
|
|
21614
21228
|
}
|
|
21615
21229
|
if (updates.notifyEmail !== void 0) {
|
|
21616
21230
|
console.log(
|
|
21617
|
-
|
|
21231
|
+
chalk43.green(
|
|
21618
21232
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
21619
21233
|
)
|
|
21620
21234
|
);
|
|
21621
21235
|
}
|
|
21622
21236
|
if (updates.notifySlack !== void 0) {
|
|
21623
21237
|
console.log(
|
|
21624
|
-
|
|
21238
|
+
chalk43.green(
|
|
21625
21239
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
21626
21240
|
)
|
|
21627
21241
|
);
|
|
@@ -21630,7 +21244,7 @@ function printUpdateResult(updates, result) {
|
|
|
21630
21244
|
async function interactiveSetup(prefs) {
|
|
21631
21245
|
if (!prefs.timezone) {
|
|
21632
21246
|
const detectedTz = detectTimezone2();
|
|
21633
|
-
console.log(
|
|
21247
|
+
console.log(chalk43.dim(`
|
|
21634
21248
|
System timezone detected: ${detectedTz}`));
|
|
21635
21249
|
const tz = await promptText(
|
|
21636
21250
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -21641,7 +21255,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
21641
21255
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
21642
21256
|
}
|
|
21643
21257
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
21644
|
-
console.log(
|
|
21258
|
+
console.log(chalk43.green(`Timezone set to ${chalk43.cyan(tz.trim())}`));
|
|
21645
21259
|
}
|
|
21646
21260
|
}
|
|
21647
21261
|
if (!prefs.notifyEmail) {
|
|
@@ -21651,11 +21265,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
21651
21265
|
);
|
|
21652
21266
|
if (enable) {
|
|
21653
21267
|
await updateUserPreferences({ notifyEmail: true });
|
|
21654
|
-
console.log(
|
|
21268
|
+
console.log(chalk43.green("Email notifications enabled"));
|
|
21655
21269
|
}
|
|
21656
21270
|
}
|
|
21657
21271
|
}
|
|
21658
|
-
var preferenceCommand = new
|
|
21272
|
+
var preferenceCommand = new Command47().name("preference").description("View or update your preferences").option("--timezone <timezone>", "IANA timezone (e.g., America/New_York)").option("--notify-email <on|off>", "Enable or disable email notifications").option("--notify-slack <on|off>", "Enable or disable Slack notifications").action(
|
|
21659
21273
|
withErrorHandler(async (opts) => {
|
|
21660
21274
|
const updates = buildUpdates(opts);
|
|
21661
21275
|
if (updates) {
|
|
@@ -21670,32 +21284,32 @@ var preferenceCommand = new Command52().name("preference").description("View or
|
|
|
21670
21284
|
} else if (!prefs.timezone) {
|
|
21671
21285
|
console.log();
|
|
21672
21286
|
console.log(
|
|
21673
|
-
`To set timezone: ${
|
|
21287
|
+
`To set timezone: ${chalk43.cyan("vm0 preference --timezone <timezone>")}`
|
|
21674
21288
|
);
|
|
21675
21289
|
console.log(
|
|
21676
|
-
|
|
21290
|
+
chalk43.dim("Example: vm0 preference --timezone America/New_York")
|
|
21677
21291
|
);
|
|
21678
21292
|
}
|
|
21679
21293
|
})
|
|
21680
21294
|
);
|
|
21681
21295
|
|
|
21682
21296
|
// src/commands/upgrade/index.ts
|
|
21683
|
-
import { Command as
|
|
21684
|
-
import
|
|
21685
|
-
var upgradeCommand = new
|
|
21297
|
+
import { Command as Command48 } from "commander";
|
|
21298
|
+
import chalk44 from "chalk";
|
|
21299
|
+
var upgradeCommand = new Command48().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
21686
21300
|
withErrorHandler(async () => {
|
|
21687
21301
|
console.log("Checking for updates...");
|
|
21688
21302
|
const latestVersion = await getLatestVersion();
|
|
21689
21303
|
if (latestVersion === null) {
|
|
21690
21304
|
throw new Error("Could not check for updates. Please try again later.");
|
|
21691
21305
|
}
|
|
21692
|
-
if (latestVersion === "9.
|
|
21693
|
-
console.log(
|
|
21306
|
+
if (latestVersion === "9.78.0") {
|
|
21307
|
+
console.log(chalk44.green(`\u2713 Already up to date (${"9.78.0"})`));
|
|
21694
21308
|
return;
|
|
21695
21309
|
}
|
|
21696
21310
|
console.log(
|
|
21697
|
-
|
|
21698
|
-
`Current version: ${"9.
|
|
21311
|
+
chalk44.yellow(
|
|
21312
|
+
`Current version: ${"9.78.0"} -> Latest version: ${latestVersion}`
|
|
21699
21313
|
)
|
|
21700
21314
|
);
|
|
21701
21315
|
console.log();
|
|
@@ -21703,26 +21317,26 @@ var upgradeCommand = new Command53().name("upgrade").description("Upgrade vm0 CL
|
|
|
21703
21317
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
21704
21318
|
if (packageManager === "unknown") {
|
|
21705
21319
|
console.log(
|
|
21706
|
-
|
|
21320
|
+
chalk44.yellow(
|
|
21707
21321
|
"Could not detect your package manager for auto-upgrade."
|
|
21708
21322
|
)
|
|
21709
21323
|
);
|
|
21710
21324
|
} else {
|
|
21711
21325
|
console.log(
|
|
21712
|
-
|
|
21326
|
+
chalk44.yellow(
|
|
21713
21327
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
21714
21328
|
)
|
|
21715
21329
|
);
|
|
21716
21330
|
}
|
|
21717
|
-
console.log(
|
|
21718
|
-
console.log(
|
|
21331
|
+
console.log(chalk44.yellow("Please upgrade manually:"));
|
|
21332
|
+
console.log(chalk44.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
21719
21333
|
return;
|
|
21720
21334
|
}
|
|
21721
21335
|
console.log(`Upgrading via ${packageManager}...`);
|
|
21722
21336
|
const success = await performUpgrade(packageManager);
|
|
21723
21337
|
if (success) {
|
|
21724
21338
|
console.log(
|
|
21725
|
-
|
|
21339
|
+
chalk44.green(`\u2713 Upgraded from ${"9.78.0"} to ${latestVersion}`)
|
|
21726
21340
|
);
|
|
21727
21341
|
return;
|
|
21728
21342
|
}
|
|
@@ -21735,8 +21349,8 @@ var upgradeCommand = new Command53().name("upgrade").description("Upgrade vm0 CL
|
|
|
21735
21349
|
);
|
|
21736
21350
|
|
|
21737
21351
|
// src/commands/whoami.ts
|
|
21738
|
-
import { Command as
|
|
21739
|
-
import
|
|
21352
|
+
import { Command as Command49 } from "commander";
|
|
21353
|
+
import chalk45 from "chalk";
|
|
21740
21354
|
function isInsideSandbox() {
|
|
21741
21355
|
return !!process.env.VM0_RUN_ID;
|
|
21742
21356
|
}
|
|
@@ -21751,7 +21365,7 @@ async function showSandboxInfo() {
|
|
|
21751
21365
|
const apiUrl = process.env.VM0_API_URL;
|
|
21752
21366
|
const hasAgentInfo = agentName || agentVersion || agentComposeId || agentOrgSlug || cliAgentType;
|
|
21753
21367
|
if (hasAgentInfo) {
|
|
21754
|
-
console.log(
|
|
21368
|
+
console.log(chalk45.bold("Agent:"));
|
|
21755
21369
|
if (agentName) console.log(` Name: ${agentName}`);
|
|
21756
21370
|
if (agentVersion) console.log(` Version: ${agentVersion}`);
|
|
21757
21371
|
if (agentComposeId) console.log(` Compose ID: ${agentComposeId}`);
|
|
@@ -21759,7 +21373,7 @@ async function showSandboxInfo() {
|
|
|
21759
21373
|
if (cliAgentType) console.log(` Framework: ${cliAgentType}`);
|
|
21760
21374
|
console.log();
|
|
21761
21375
|
}
|
|
21762
|
-
console.log(
|
|
21376
|
+
console.log(chalk45.bold("Run:"));
|
|
21763
21377
|
if (runId) console.log(` ID: ${runId}`);
|
|
21764
21378
|
if (activeOrg) console.log(` Org: ${activeOrg}`);
|
|
21765
21379
|
if (apiUrl) console.log(` API: ${apiUrl}`);
|
|
@@ -21768,23 +21382,23 @@ async function showLocalInfo() {
|
|
|
21768
21382
|
const token = await getToken();
|
|
21769
21383
|
const apiUrl = await getApiUrl();
|
|
21770
21384
|
const activeOrg = await getActiveOrg();
|
|
21771
|
-
console.log(
|
|
21385
|
+
console.log(chalk45.bold("Auth:"));
|
|
21772
21386
|
if (token) {
|
|
21773
21387
|
const tokenSource = process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
21774
21388
|
console.log(
|
|
21775
|
-
` Status: ${
|
|
21389
|
+
` Status: ${chalk45.green("Authenticated")} (via ${tokenSource})`
|
|
21776
21390
|
);
|
|
21777
21391
|
} else {
|
|
21778
|
-
console.log(` Status: ${
|
|
21392
|
+
console.log(` Status: ${chalk45.dim("Not authenticated")}`);
|
|
21779
21393
|
}
|
|
21780
21394
|
console.log(` API: ${apiUrl}`);
|
|
21781
21395
|
console.log();
|
|
21782
21396
|
if (activeOrg) {
|
|
21783
|
-
console.log(
|
|
21397
|
+
console.log(chalk45.bold("Org:"));
|
|
21784
21398
|
console.log(` Active: ${activeOrg}`);
|
|
21785
21399
|
}
|
|
21786
21400
|
}
|
|
21787
|
-
var whoamiCommand = new
|
|
21401
|
+
var whoamiCommand = new Command49().name("whoami").description("Show current identity and environment information").action(
|
|
21788
21402
|
withErrorHandler(async () => {
|
|
21789
21403
|
if (isInsideSandbox()) {
|
|
21790
21404
|
await showSandboxInfo();
|
|
@@ -21798,17 +21412,17 @@ var whoamiCommand = new Command54().name("whoami").description("Show current ide
|
|
|
21798
21412
|
import { Command as Command99 } from "commander";
|
|
21799
21413
|
|
|
21800
21414
|
// src/commands/zero/org/index.ts
|
|
21801
|
-
import { Command as
|
|
21415
|
+
import { Command as Command72 } from "commander";
|
|
21802
21416
|
|
|
21803
21417
|
// src/commands/zero/org/status.ts
|
|
21804
|
-
import { Command as
|
|
21805
|
-
import
|
|
21806
|
-
var
|
|
21418
|
+
import { Command as Command50 } from "commander";
|
|
21419
|
+
import chalk46 from "chalk";
|
|
21420
|
+
var statusCommand6 = new Command50().name("status").description("View current organization status").action(
|
|
21807
21421
|
withErrorHandler(async () => {
|
|
21808
21422
|
try {
|
|
21809
21423
|
const org = await getZeroOrg();
|
|
21810
|
-
console.log(
|
|
21811
|
-
console.log(` Slug: ${
|
|
21424
|
+
console.log(chalk46.bold("Organization Information:"));
|
|
21425
|
+
console.log(` Slug: ${chalk46.green(org.slug)}`);
|
|
21812
21426
|
} catch (error) {
|
|
21813
21427
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
21814
21428
|
throw new Error("No organization configured", {
|
|
@@ -21823,9 +21437,9 @@ var statusCommand7 = new Command55().name("status").description("View current or
|
|
|
21823
21437
|
);
|
|
21824
21438
|
|
|
21825
21439
|
// src/commands/zero/org/set.ts
|
|
21826
|
-
import { Command as
|
|
21827
|
-
import
|
|
21828
|
-
var setCommand = new
|
|
21440
|
+
import { Command as Command51 } from "commander";
|
|
21441
|
+
import chalk47 from "chalk";
|
|
21442
|
+
var setCommand = new Command51().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
21829
21443
|
"--force",
|
|
21830
21444
|
"Force change existing organization (may break references)"
|
|
21831
21445
|
).action(
|
|
@@ -21844,10 +21458,10 @@ var setCommand = new Command56().name("set").description("Rename your organizati
|
|
|
21844
21458
|
}
|
|
21845
21459
|
const org = await updateZeroOrg({ slug, force: true });
|
|
21846
21460
|
await saveConfig({ activeOrg: org.slug });
|
|
21847
|
-
console.log(
|
|
21461
|
+
console.log(chalk47.green(`\u2713 Organization updated to ${org.slug}`));
|
|
21848
21462
|
console.log();
|
|
21849
21463
|
console.log("Your agents will now be namespaced as:");
|
|
21850
|
-
console.log(
|
|
21464
|
+
console.log(chalk47.cyan(` ${org.slug}/<agent-name>`));
|
|
21851
21465
|
} catch (error) {
|
|
21852
21466
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
21853
21467
|
throw new Error(
|
|
@@ -21860,27 +21474,27 @@ var setCommand = new Command56().name("set").description("Rename your organizati
|
|
|
21860
21474
|
);
|
|
21861
21475
|
|
|
21862
21476
|
// src/commands/zero/org/list.ts
|
|
21863
|
-
import { Command as
|
|
21864
|
-
import
|
|
21865
|
-
var
|
|
21477
|
+
import { Command as Command52 } from "commander";
|
|
21478
|
+
import chalk48 from "chalk";
|
|
21479
|
+
var listCommand6 = new Command52().name("list").description("List all accessible organizations").action(
|
|
21866
21480
|
withErrorHandler(async () => {
|
|
21867
21481
|
const result = await listZeroOrgs();
|
|
21868
21482
|
const activeOrg = await getActiveOrg();
|
|
21869
|
-
console.log(
|
|
21483
|
+
console.log(chalk48.bold("Available organizations:"));
|
|
21870
21484
|
for (const org of result.orgs) {
|
|
21871
21485
|
const isCurrent = org.slug === activeOrg;
|
|
21872
|
-
const marker = isCurrent ?
|
|
21486
|
+
const marker = isCurrent ? chalk48.green("* ") : " ";
|
|
21873
21487
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
21874
|
-
const currentLabel = isCurrent ?
|
|
21488
|
+
const currentLabel = isCurrent ? chalk48.dim(" \u2190 current") : "";
|
|
21875
21489
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
21876
21490
|
}
|
|
21877
21491
|
})
|
|
21878
21492
|
);
|
|
21879
21493
|
|
|
21880
21494
|
// src/commands/zero/org/use.ts
|
|
21881
|
-
import { Command as
|
|
21882
|
-
import
|
|
21883
|
-
var useCommand = new
|
|
21495
|
+
import { Command as Command53 } from "commander";
|
|
21496
|
+
import chalk49 from "chalk";
|
|
21497
|
+
var useCommand = new Command53().name("use").description("Switch to a different organization").argument("<slug>", "Organization slug to switch to").action(
|
|
21884
21498
|
withErrorHandler(async (slug) => {
|
|
21885
21499
|
const orgList = await listZeroOrgs();
|
|
21886
21500
|
const target = orgList.orgs.find((s) => s.slug === slug);
|
|
@@ -21888,119 +21502,119 @@ var useCommand = new Command58().name("use").description("Switch to a different
|
|
|
21888
21502
|
throw new Error(`Organization '${slug}' not found or not accessible.`);
|
|
21889
21503
|
}
|
|
21890
21504
|
await saveConfig({ activeOrg: slug });
|
|
21891
|
-
console.log(
|
|
21505
|
+
console.log(chalk49.green(`\u2713 Switched to organization: ${slug}`));
|
|
21892
21506
|
})
|
|
21893
21507
|
);
|
|
21894
21508
|
|
|
21895
21509
|
// src/commands/zero/org/members.ts
|
|
21896
|
-
import { Command as
|
|
21897
|
-
import
|
|
21898
|
-
var membersCommand = new
|
|
21510
|
+
import { Command as Command54 } from "commander";
|
|
21511
|
+
import chalk50 from "chalk";
|
|
21512
|
+
var membersCommand = new Command54().name("members").description("View organization members").action(
|
|
21899
21513
|
withErrorHandler(async () => {
|
|
21900
21514
|
const status = await getZeroOrgMembers();
|
|
21901
|
-
console.log(
|
|
21515
|
+
console.log(chalk50.bold(`Organization: ${status.slug}`));
|
|
21902
21516
|
console.log(` Role: ${status.role}`);
|
|
21903
21517
|
console.log(
|
|
21904
21518
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
21905
21519
|
);
|
|
21906
21520
|
console.log();
|
|
21907
|
-
console.log(
|
|
21521
|
+
console.log(chalk50.bold("Members:"));
|
|
21908
21522
|
for (const member of status.members) {
|
|
21909
|
-
const roleTag = member.role === "admin" ?
|
|
21523
|
+
const roleTag = member.role === "admin" ? chalk50.yellow(` (${member.role})`) : chalk50.dim(` (${member.role})`);
|
|
21910
21524
|
console.log(` ${member.email}${roleTag}`);
|
|
21911
21525
|
}
|
|
21912
21526
|
})
|
|
21913
21527
|
);
|
|
21914
21528
|
|
|
21915
21529
|
// src/commands/zero/org/invite.ts
|
|
21916
|
-
import { Command as
|
|
21917
|
-
import
|
|
21918
|
-
var inviteCommand = new
|
|
21530
|
+
import { Command as Command55 } from "commander";
|
|
21531
|
+
import chalk51 from "chalk";
|
|
21532
|
+
var inviteCommand = new Command55().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").action(
|
|
21919
21533
|
withErrorHandler(async (options) => {
|
|
21920
21534
|
await inviteZeroOrgMember(options.email);
|
|
21921
|
-
console.log(
|
|
21535
|
+
console.log(chalk51.green(`\u2713 Invitation sent to ${options.email}`));
|
|
21922
21536
|
})
|
|
21923
21537
|
);
|
|
21924
21538
|
|
|
21925
21539
|
// src/commands/zero/org/remove.ts
|
|
21926
|
-
import { Command as
|
|
21927
|
-
import
|
|
21928
|
-
var removeCommand = new
|
|
21540
|
+
import { Command as Command56 } from "commander";
|
|
21541
|
+
import chalk52 from "chalk";
|
|
21542
|
+
var removeCommand = new Command56().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
21929
21543
|
withErrorHandler(async (email) => {
|
|
21930
21544
|
await removeZeroOrgMember(email);
|
|
21931
|
-
console.log(
|
|
21545
|
+
console.log(chalk52.green(`\u2713 Removed ${email} from organization`));
|
|
21932
21546
|
})
|
|
21933
21547
|
);
|
|
21934
21548
|
|
|
21935
21549
|
// src/commands/zero/org/leave.ts
|
|
21936
|
-
import { Command as
|
|
21937
|
-
import
|
|
21938
|
-
var leaveCommand = new
|
|
21550
|
+
import { Command as Command57 } from "commander";
|
|
21551
|
+
import chalk53 from "chalk";
|
|
21552
|
+
var leaveCommand = new Command57().name("leave").description("Leave the current organization").action(
|
|
21939
21553
|
withErrorHandler(async () => {
|
|
21940
21554
|
await leaveZeroOrg();
|
|
21941
21555
|
const { orgs } = await listZeroOrgs();
|
|
21942
21556
|
if (orgs.length === 0) {
|
|
21943
21557
|
await saveConfig({ activeOrg: void 0 });
|
|
21944
|
-
console.log(
|
|
21558
|
+
console.log(chalk53.green("\u2713 Left organization."));
|
|
21945
21559
|
console.log(
|
|
21946
|
-
|
|
21560
|
+
chalk53.yellow("No remaining organizations. Run: vm0 auth login")
|
|
21947
21561
|
);
|
|
21948
21562
|
return;
|
|
21949
21563
|
}
|
|
21950
21564
|
const nextOrg = orgs[0].slug;
|
|
21951
21565
|
await saveConfig({ activeOrg: nextOrg });
|
|
21952
|
-
console.log(
|
|
21566
|
+
console.log(chalk53.green(`\u2713 Left organization. Switched to: ${nextOrg}`));
|
|
21953
21567
|
})
|
|
21954
21568
|
);
|
|
21955
21569
|
|
|
21956
21570
|
// src/commands/zero/org/delete.ts
|
|
21957
|
-
import { Command as
|
|
21958
|
-
import
|
|
21959
|
-
var
|
|
21571
|
+
import { Command as Command58 } from "commander";
|
|
21572
|
+
import chalk54 from "chalk";
|
|
21573
|
+
var deleteCommand = new Command58().name("delete").description("Delete the current organization (admin only)").argument("<slug>", "Organization slug to confirm deletion").action(
|
|
21960
21574
|
withErrorHandler(async (slug) => {
|
|
21961
21575
|
await deleteZeroOrg(slug);
|
|
21962
|
-
console.log(
|
|
21576
|
+
console.log(chalk54.green(`\u2713 Organization '${slug}' has been deleted.`));
|
|
21963
21577
|
})
|
|
21964
21578
|
);
|
|
21965
21579
|
|
|
21966
21580
|
// src/commands/zero/org/secret/index.ts
|
|
21967
|
-
import { Command as
|
|
21581
|
+
import { Command as Command62 } from "commander";
|
|
21968
21582
|
|
|
21969
21583
|
// src/commands/zero/org/secret/list.ts
|
|
21970
|
-
import { Command as
|
|
21971
|
-
import
|
|
21972
|
-
var
|
|
21584
|
+
import { Command as Command59 } from "commander";
|
|
21585
|
+
import chalk55 from "chalk";
|
|
21586
|
+
var listCommand7 = new Command59().name("list").alias("ls").description("List all org-level secrets").action(
|
|
21973
21587
|
withErrorHandler(async () => {
|
|
21974
21588
|
const result = await listZeroOrgSecrets();
|
|
21975
21589
|
if (result.secrets.length === 0) {
|
|
21976
|
-
console.log(
|
|
21590
|
+
console.log(chalk55.dim("No org secrets found"));
|
|
21977
21591
|
console.log();
|
|
21978
21592
|
console.log("To add an org secret:");
|
|
21979
21593
|
console.log(
|
|
21980
|
-
|
|
21594
|
+
chalk55.cyan(" vm0 zero org secret set MY_API_KEY --body <value>")
|
|
21981
21595
|
);
|
|
21982
21596
|
return;
|
|
21983
21597
|
}
|
|
21984
|
-
console.log(
|
|
21598
|
+
console.log(chalk55.bold("Org Secrets:"));
|
|
21985
21599
|
console.log();
|
|
21986
21600
|
for (const secret of result.secrets) {
|
|
21987
|
-
console.log(` ${
|
|
21601
|
+
console.log(` ${chalk55.cyan(secret.name)}`);
|
|
21988
21602
|
if (secret.description) {
|
|
21989
|
-
console.log(` ${
|
|
21603
|
+
console.log(` ${chalk55.dim(secret.description)}`);
|
|
21990
21604
|
}
|
|
21991
21605
|
console.log(
|
|
21992
|
-
` ${
|
|
21606
|
+
` ${chalk55.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
21993
21607
|
);
|
|
21994
21608
|
console.log();
|
|
21995
21609
|
}
|
|
21996
|
-
console.log(
|
|
21610
|
+
console.log(chalk55.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
21997
21611
|
})
|
|
21998
21612
|
);
|
|
21999
21613
|
|
|
22000
21614
|
// src/commands/zero/org/secret/set.ts
|
|
22001
|
-
import { Command as
|
|
22002
|
-
import
|
|
22003
|
-
var setCommand2 = new
|
|
21615
|
+
import { Command as Command60 } from "commander";
|
|
21616
|
+
import chalk56 from "chalk";
|
|
21617
|
+
var setCommand2 = new Command60().name("set").description("Create or update an org-level secret (admin only)").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
22004
21618
|
"-b, --body <value>",
|
|
22005
21619
|
"Secret value (required in non-interactive mode)"
|
|
22006
21620
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -22039,19 +21653,19 @@ var setCommand2 = new Command65().name("set").description("Create or update an o
|
|
|
22039
21653
|
}
|
|
22040
21654
|
throw error;
|
|
22041
21655
|
}
|
|
22042
|
-
console.log(
|
|
21656
|
+
console.log(chalk56.green(`\u2713 Org secret "${secret.name}" saved`));
|
|
22043
21657
|
console.log();
|
|
22044
21658
|
console.log("Use in vm0.yaml:");
|
|
22045
|
-
console.log(
|
|
22046
|
-
console.log(
|
|
21659
|
+
console.log(chalk56.cyan(` environment:`));
|
|
21660
|
+
console.log(chalk56.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
22047
21661
|
}
|
|
22048
21662
|
)
|
|
22049
21663
|
);
|
|
22050
21664
|
|
|
22051
21665
|
// src/commands/zero/org/secret/remove.ts
|
|
22052
|
-
import { Command as
|
|
22053
|
-
import
|
|
22054
|
-
var removeCommand2 = new
|
|
21666
|
+
import { Command as Command61 } from "commander";
|
|
21667
|
+
import chalk57 from "chalk";
|
|
21668
|
+
var removeCommand2 = new Command61().name("remove").description("Delete an org-level secret (admin only)").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
22055
21669
|
withErrorHandler(async (name, options) => {
|
|
22056
21670
|
if (!options.yes) {
|
|
22057
21671
|
if (!isInteractive()) {
|
|
@@ -22062,61 +21676,61 @@ var removeCommand2 = new Command66().name("remove").description("Delete an org-l
|
|
|
22062
21676
|
false
|
|
22063
21677
|
);
|
|
22064
21678
|
if (!confirmed) {
|
|
22065
|
-
console.log(
|
|
21679
|
+
console.log(chalk57.dim("Cancelled"));
|
|
22066
21680
|
return;
|
|
22067
21681
|
}
|
|
22068
21682
|
}
|
|
22069
21683
|
await deleteZeroOrgSecret(name);
|
|
22070
|
-
console.log(
|
|
21684
|
+
console.log(chalk57.green(`\u2713 Org secret "${name}" deleted`));
|
|
22071
21685
|
})
|
|
22072
21686
|
);
|
|
22073
21687
|
|
|
22074
21688
|
// src/commands/zero/org/secret/index.ts
|
|
22075
|
-
var zeroOrgSecretCommand = new
|
|
21689
|
+
var zeroOrgSecretCommand = new Command62().name("secret").description("Manage org-level secrets (admin)").addCommand(listCommand7).addCommand(setCommand2).addCommand(removeCommand2);
|
|
22076
21690
|
|
|
22077
21691
|
// src/commands/zero/org/variable/index.ts
|
|
22078
|
-
import { Command as
|
|
21692
|
+
import { Command as Command66 } from "commander";
|
|
22079
21693
|
|
|
22080
21694
|
// src/commands/zero/org/variable/list.ts
|
|
22081
|
-
import { Command as
|
|
22082
|
-
import
|
|
21695
|
+
import { Command as Command63 } from "commander";
|
|
21696
|
+
import chalk58 from "chalk";
|
|
22083
21697
|
function truncateValue(value, maxLength = 60) {
|
|
22084
21698
|
if (value.length <= maxLength) {
|
|
22085
21699
|
return value;
|
|
22086
21700
|
}
|
|
22087
21701
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
22088
21702
|
}
|
|
22089
|
-
var
|
|
21703
|
+
var listCommand8 = new Command63().name("list").alias("ls").description("List all org-level variables").action(
|
|
22090
21704
|
withErrorHandler(async () => {
|
|
22091
21705
|
const result = await listZeroOrgVariables();
|
|
22092
21706
|
if (result.variables.length === 0) {
|
|
22093
|
-
console.log(
|
|
21707
|
+
console.log(chalk58.dim("No org variables found"));
|
|
22094
21708
|
console.log();
|
|
22095
21709
|
console.log("To add an org variable:");
|
|
22096
|
-
console.log(
|
|
21710
|
+
console.log(chalk58.cyan(" vm0 zero org variable set MY_VAR <value>"));
|
|
22097
21711
|
return;
|
|
22098
21712
|
}
|
|
22099
|
-
console.log(
|
|
21713
|
+
console.log(chalk58.bold("Org Variables:"));
|
|
22100
21714
|
console.log();
|
|
22101
21715
|
for (const variable of result.variables) {
|
|
22102
21716
|
const displayValue = truncateValue(variable.value);
|
|
22103
|
-
console.log(` ${
|
|
21717
|
+
console.log(` ${chalk58.cyan(variable.name)} = ${displayValue}`);
|
|
22104
21718
|
if (variable.description) {
|
|
22105
|
-
console.log(` ${
|
|
21719
|
+
console.log(` ${chalk58.dim(variable.description)}`);
|
|
22106
21720
|
}
|
|
22107
21721
|
console.log(
|
|
22108
|
-
` ${
|
|
21722
|
+
` ${chalk58.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
22109
21723
|
);
|
|
22110
21724
|
console.log();
|
|
22111
21725
|
}
|
|
22112
|
-
console.log(
|
|
21726
|
+
console.log(chalk58.dim(`Total: ${result.variables.length} variable(s)`));
|
|
22113
21727
|
})
|
|
22114
21728
|
);
|
|
22115
21729
|
|
|
22116
21730
|
// src/commands/zero/org/variable/set.ts
|
|
22117
|
-
import { Command as
|
|
22118
|
-
import
|
|
22119
|
-
var setCommand3 = new
|
|
21731
|
+
import { Command as Command64 } from "commander";
|
|
21732
|
+
import chalk59 from "chalk";
|
|
21733
|
+
var setCommand3 = new Command64().name("set").description("Create or update an org-level variable (admin only)").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
22120
21734
|
withErrorHandler(
|
|
22121
21735
|
async (name, value, options) => {
|
|
22122
21736
|
let variable;
|
|
@@ -22136,19 +21750,19 @@ var setCommand3 = new Command69().name("set").description("Create or update an o
|
|
|
22136
21750
|
}
|
|
22137
21751
|
throw error;
|
|
22138
21752
|
}
|
|
22139
|
-
console.log(
|
|
21753
|
+
console.log(chalk59.green(`\u2713 Org variable "${variable.name}" saved`));
|
|
22140
21754
|
console.log();
|
|
22141
21755
|
console.log("Use in vm0.yaml:");
|
|
22142
|
-
console.log(
|
|
22143
|
-
console.log(
|
|
21756
|
+
console.log(chalk59.cyan(` environment:`));
|
|
21757
|
+
console.log(chalk59.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
22144
21758
|
}
|
|
22145
21759
|
)
|
|
22146
21760
|
);
|
|
22147
21761
|
|
|
22148
21762
|
// src/commands/zero/org/variable/remove.ts
|
|
22149
|
-
import { Command as
|
|
22150
|
-
import
|
|
22151
|
-
var removeCommand3 = new
|
|
21763
|
+
import { Command as Command65 } from "commander";
|
|
21764
|
+
import chalk60 from "chalk";
|
|
21765
|
+
var removeCommand3 = new Command65().name("remove").description("Delete an org-level variable (admin only)").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
22152
21766
|
withErrorHandler(async (name, options) => {
|
|
22153
21767
|
if (!options.yes) {
|
|
22154
21768
|
if (!isInteractive()) {
|
|
@@ -22159,32 +21773,32 @@ var removeCommand3 = new Command70().name("remove").description("Delete an org-l
|
|
|
22159
21773
|
false
|
|
22160
21774
|
);
|
|
22161
21775
|
if (!confirmed) {
|
|
22162
|
-
console.log(
|
|
21776
|
+
console.log(chalk60.dim("Cancelled"));
|
|
22163
21777
|
return;
|
|
22164
21778
|
}
|
|
22165
21779
|
}
|
|
22166
21780
|
await deleteZeroOrgVariable(name);
|
|
22167
|
-
console.log(
|
|
21781
|
+
console.log(chalk60.green(`\u2713 Org variable "${name}" deleted`));
|
|
22168
21782
|
})
|
|
22169
21783
|
);
|
|
22170
21784
|
|
|
22171
21785
|
// src/commands/zero/org/variable/index.ts
|
|
22172
|
-
var zeroOrgVariableCommand = new
|
|
21786
|
+
var zeroOrgVariableCommand = new Command66().name("variable").description("Manage org-level variables (admin)").addCommand(listCommand8).addCommand(setCommand3).addCommand(removeCommand3);
|
|
22173
21787
|
|
|
22174
21788
|
// src/commands/zero/org/model-provider/index.ts
|
|
22175
|
-
import { Command as
|
|
21789
|
+
import { Command as Command71 } from "commander";
|
|
22176
21790
|
|
|
22177
21791
|
// src/commands/zero/org/model-provider/list.ts
|
|
22178
|
-
import { Command as
|
|
22179
|
-
import
|
|
22180
|
-
var
|
|
21792
|
+
import { Command as Command67 } from "commander";
|
|
21793
|
+
import chalk61 from "chalk";
|
|
21794
|
+
var listCommand9 = new Command67().name("list").alias("ls").description("List all org-level model providers").action(
|
|
22181
21795
|
withErrorHandler(async () => {
|
|
22182
21796
|
const result = await listZeroOrgModelProviders();
|
|
22183
21797
|
if (result.modelProviders.length === 0) {
|
|
22184
|
-
console.log(
|
|
21798
|
+
console.log(chalk61.dim("No org-level model providers configured"));
|
|
22185
21799
|
console.log();
|
|
22186
21800
|
console.log("To add an org-level model provider:");
|
|
22187
|
-
console.log(
|
|
21801
|
+
console.log(chalk61.cyan(" vm0 zero org model-provider setup"));
|
|
22188
21802
|
return;
|
|
22189
21803
|
}
|
|
22190
21804
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -22198,16 +21812,16 @@ var listCommand10 = new Command72().name("list").alias("ls").description("List a
|
|
|
22198
21812
|
},
|
|
22199
21813
|
{}
|
|
22200
21814
|
);
|
|
22201
|
-
console.log(
|
|
21815
|
+
console.log(chalk61.bold("Org Model Providers:"));
|
|
22202
21816
|
console.log();
|
|
22203
21817
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
22204
|
-
console.log(` ${
|
|
21818
|
+
console.log(` ${chalk61.cyan(framework)}:`);
|
|
22205
21819
|
for (const provider of providers) {
|
|
22206
|
-
const defaultTag = provider.isDefault ?
|
|
22207
|
-
const modelTag = provider.selectedModel ?
|
|
21820
|
+
const defaultTag = provider.isDefault ? chalk61.green(" (default)") : "";
|
|
21821
|
+
const modelTag = provider.selectedModel ? chalk61.dim(` [${provider.selectedModel}]`) : "";
|
|
22208
21822
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
22209
21823
|
console.log(
|
|
22210
|
-
|
|
21824
|
+
chalk61.dim(
|
|
22211
21825
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
22212
21826
|
)
|
|
22213
21827
|
);
|
|
@@ -22215,18 +21829,18 @@ var listCommand10 = new Command72().name("list").alias("ls").description("List a
|
|
|
22215
21829
|
console.log();
|
|
22216
21830
|
}
|
|
22217
21831
|
console.log(
|
|
22218
|
-
|
|
21832
|
+
chalk61.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
22219
21833
|
);
|
|
22220
21834
|
})
|
|
22221
21835
|
);
|
|
22222
21836
|
|
|
22223
21837
|
// src/commands/zero/org/model-provider/setup.ts
|
|
22224
|
-
import { Command as
|
|
22225
|
-
import
|
|
21838
|
+
import { Command as Command68 } from "commander";
|
|
21839
|
+
import chalk63 from "chalk";
|
|
22226
21840
|
import prompts3 from "prompts";
|
|
22227
21841
|
|
|
22228
21842
|
// src/lib/domain/model-provider/shared.ts
|
|
22229
|
-
import
|
|
21843
|
+
import chalk62 from "chalk";
|
|
22230
21844
|
import prompts2 from "prompts";
|
|
22231
21845
|
function validateProviderType(typeStr) {
|
|
22232
21846
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -22411,7 +22025,7 @@ async function promptForModelSelection(type2) {
|
|
|
22411
22025
|
if (selected === "__custom__") {
|
|
22412
22026
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
22413
22027
|
if (placeholder) {
|
|
22414
|
-
console.log(
|
|
22028
|
+
console.log(chalk62.dim(`Example: ${placeholder}`));
|
|
22415
22029
|
}
|
|
22416
22030
|
const customResponse = await prompts2(
|
|
22417
22031
|
{
|
|
@@ -22461,7 +22075,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
22461
22075
|
const secrets = {};
|
|
22462
22076
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
22463
22077
|
if (fieldConfig.helpText) {
|
|
22464
|
-
console.log(
|
|
22078
|
+
console.log(chalk62.dim(fieldConfig.helpText));
|
|
22465
22079
|
}
|
|
22466
22080
|
const isSensitive = isSensitiveSecret(name);
|
|
22467
22081
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -22518,7 +22132,7 @@ async function handleInteractiveMode() {
|
|
|
22518
22132
|
title = `${title} \u2713`;
|
|
22519
22133
|
}
|
|
22520
22134
|
if (isExperimental) {
|
|
22521
|
-
title = `${title} ${
|
|
22135
|
+
title = `${title} ${chalk63.dim("(experimental)")}`;
|
|
22522
22136
|
}
|
|
22523
22137
|
return {
|
|
22524
22138
|
title,
|
|
@@ -22565,7 +22179,7 @@ async function handleInteractiveMode() {
|
|
|
22565
22179
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
22566
22180
|
console.log();
|
|
22567
22181
|
if ("helpText" in config) {
|
|
22568
|
-
console.log(
|
|
22182
|
+
console.log(chalk63.dim(config.helpText));
|
|
22569
22183
|
}
|
|
22570
22184
|
console.log();
|
|
22571
22185
|
if (hasAuthMethods(type2)) {
|
|
@@ -22607,10 +22221,10 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
22607
22221
|
);
|
|
22608
22222
|
if (response.setDefault) {
|
|
22609
22223
|
await setZeroOrgModelProviderDefault(type2);
|
|
22610
|
-
console.log(
|
|
22224
|
+
console.log(chalk63.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
22611
22225
|
}
|
|
22612
22226
|
}
|
|
22613
|
-
var setupCommand = new
|
|
22227
|
+
var setupCommand = new Command68().name("setup").description("Configure an org-level model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
22614
22228
|
"-s, --secret <value>",
|
|
22615
22229
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
22616
22230
|
collectSecrets,
|
|
@@ -22649,11 +22263,11 @@ var setupCommand = new Command73().name("setup").description("Configure an org-l
|
|
|
22649
22263
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
22650
22264
|
if (!hasModelSelection(input.type)) {
|
|
22651
22265
|
console.log(
|
|
22652
|
-
|
|
22266
|
+
chalk63.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
22653
22267
|
);
|
|
22654
22268
|
} else {
|
|
22655
22269
|
console.log(
|
|
22656
|
-
|
|
22270
|
+
chalk63.green(
|
|
22657
22271
|
`\u2713 Org model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
22658
22272
|
)
|
|
22659
22273
|
);
|
|
@@ -22678,7 +22292,7 @@ var setupCommand = new Command73().name("setup").description("Configure an org-l
|
|
|
22678
22292
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
22679
22293
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
22680
22294
|
console.log(
|
|
22681
|
-
|
|
22295
|
+
chalk63.green(
|
|
22682
22296
|
`\u2713 Org model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
22683
22297
|
)
|
|
22684
22298
|
);
|
|
@@ -22694,9 +22308,9 @@ var setupCommand = new Command73().name("setup").description("Configure an org-l
|
|
|
22694
22308
|
);
|
|
22695
22309
|
|
|
22696
22310
|
// src/commands/zero/org/model-provider/remove.ts
|
|
22697
|
-
import { Command as
|
|
22698
|
-
import
|
|
22699
|
-
var removeCommand4 = new
|
|
22311
|
+
import { Command as Command69 } from "commander";
|
|
22312
|
+
import chalk64 from "chalk";
|
|
22313
|
+
var removeCommand4 = new Command69().name("remove").description("Remove an org-level model provider").argument("<type>", "Model provider type to remove").action(
|
|
22700
22314
|
withErrorHandler(async (type2) => {
|
|
22701
22315
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
22702
22316
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -22705,14 +22319,14 @@ var removeCommand4 = new Command74().name("remove").description("Remove an org-l
|
|
|
22705
22319
|
});
|
|
22706
22320
|
}
|
|
22707
22321
|
await deleteZeroOrgModelProvider(type2);
|
|
22708
|
-
console.log(
|
|
22322
|
+
console.log(chalk64.green(`\u2713 Org model provider "${type2}" removed`));
|
|
22709
22323
|
})
|
|
22710
22324
|
);
|
|
22711
22325
|
|
|
22712
22326
|
// src/commands/zero/org/model-provider/set-default.ts
|
|
22713
|
-
import { Command as
|
|
22714
|
-
import
|
|
22715
|
-
var setDefaultCommand = new
|
|
22327
|
+
import { Command as Command70 } from "commander";
|
|
22328
|
+
import chalk65 from "chalk";
|
|
22329
|
+
var setDefaultCommand = new Command70().name("set-default").description("Set an org-level model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
22716
22330
|
withErrorHandler(async (type2) => {
|
|
22717
22331
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
22718
22332
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -22724,7 +22338,7 @@ var setDefaultCommand = new Command75().name("set-default").description("Set an
|
|
|
22724
22338
|
type2
|
|
22725
22339
|
);
|
|
22726
22340
|
console.log(
|
|
22727
|
-
|
|
22341
|
+
chalk65.green(
|
|
22728
22342
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
22729
22343
|
)
|
|
22730
22344
|
);
|
|
@@ -22732,19 +22346,19 @@ var setDefaultCommand = new Command75().name("set-default").description("Set an
|
|
|
22732
22346
|
);
|
|
22733
22347
|
|
|
22734
22348
|
// src/commands/zero/org/model-provider/index.ts
|
|
22735
|
-
var zeroOrgModelProviderCommand = new
|
|
22349
|
+
var zeroOrgModelProviderCommand = new Command71().name("model-provider").description("Manage org-level model providers").addCommand(listCommand9).addCommand(setupCommand).addCommand(removeCommand4).addCommand(setDefaultCommand);
|
|
22736
22350
|
|
|
22737
22351
|
// src/commands/zero/org/index.ts
|
|
22738
|
-
var zeroOrgCommand = new
|
|
22352
|
+
var zeroOrgCommand = new Command72().name("org").description("Manage your organization").addCommand(statusCommand6).addCommand(setCommand).addCommand(listCommand6).addCommand(useCommand).addCommand(membersCommand).addCommand(inviteCommand).addCommand(removeCommand).addCommand(leaveCommand).addCommand(deleteCommand).addCommand(zeroOrgSecretCommand).addCommand(zeroOrgVariableCommand).addCommand(zeroOrgModelProviderCommand);
|
|
22739
22353
|
|
|
22740
22354
|
// src/commands/zero/agent/index.ts
|
|
22741
|
-
import { Command as
|
|
22355
|
+
import { Command as Command78 } from "commander";
|
|
22742
22356
|
|
|
22743
22357
|
// src/commands/zero/agent/create.ts
|
|
22744
|
-
import { Command as
|
|
22358
|
+
import { Command as Command73 } from "commander";
|
|
22745
22359
|
import { readFileSync } from "fs";
|
|
22746
|
-
import
|
|
22747
|
-
var createCommand = new
|
|
22360
|
+
import chalk66 from "chalk";
|
|
22361
|
+
var createCommand = new Command73().name("create").description("Create a new zero agent").requiredOption(
|
|
22748
22362
|
"--connectors <items>",
|
|
22749
22363
|
"Comma-separated connector short names (e.g. github,linear)"
|
|
22750
22364
|
).option("--display-name <name>", "Agent display name").option("--description <text>", "Agent description").option(
|
|
@@ -22764,7 +22378,7 @@ var createCommand = new Command78().name("create").description("Create a new zer
|
|
|
22764
22378
|
const content = readFileSync(options.instructionsFile, "utf-8");
|
|
22765
22379
|
await updateZeroAgentInstructions(agent.name, content);
|
|
22766
22380
|
}
|
|
22767
|
-
console.log(
|
|
22381
|
+
console.log(chalk66.green(`\u2713 Zero agent '${agent.name}' created`));
|
|
22768
22382
|
console.log(` Compose ID: ${agent.agentComposeId}`);
|
|
22769
22383
|
console.log(` Connectors: ${agent.connectors.join(", ")}`);
|
|
22770
22384
|
if (agent.displayName) {
|
|
@@ -22775,10 +22389,10 @@ var createCommand = new Command78().name("create").description("Create a new zer
|
|
|
22775
22389
|
);
|
|
22776
22390
|
|
|
22777
22391
|
// src/commands/zero/agent/edit.ts
|
|
22778
|
-
import { Command as
|
|
22392
|
+
import { Command as Command74 } from "commander";
|
|
22779
22393
|
import { readFileSync as readFileSync2 } from "fs";
|
|
22780
|
-
import
|
|
22781
|
-
var editCommand = new
|
|
22394
|
+
import chalk67 from "chalk";
|
|
22395
|
+
var editCommand = new Command74().name("edit").description("Edit a zero agent").argument("<name>", "Agent name").option(
|
|
22782
22396
|
"--connectors <items>",
|
|
22783
22397
|
"Comma-separated connector short names (e.g. github,linear)"
|
|
22784
22398
|
).option("--display-name <name>", "New display name").option("--description <text>", "New description").option(
|
|
@@ -22807,20 +22421,20 @@ var editCommand = new Command79().name("edit").description("Edit a zero agent").
|
|
|
22807
22421
|
const content = readFileSync2(options.instructionsFile, "utf-8");
|
|
22808
22422
|
await updateZeroAgentInstructions(name, content);
|
|
22809
22423
|
}
|
|
22810
|
-
console.log(
|
|
22424
|
+
console.log(chalk67.green(`\u2713 Zero agent '${name}' updated`));
|
|
22811
22425
|
}
|
|
22812
22426
|
)
|
|
22813
22427
|
);
|
|
22814
22428
|
|
|
22815
22429
|
// src/commands/zero/agent/view.ts
|
|
22816
|
-
import { Command as
|
|
22817
|
-
import
|
|
22818
|
-
var viewCommand = new
|
|
22430
|
+
import { Command as Command75 } from "commander";
|
|
22431
|
+
import chalk68 from "chalk";
|
|
22432
|
+
var viewCommand = new Command75().name("view").description("View a zero agent").argument("<name>", "Agent name").option("--instructions", "Also show instructions content").action(
|
|
22819
22433
|
withErrorHandler(
|
|
22820
22434
|
async (name, options) => {
|
|
22821
22435
|
const agent = await getZeroAgent(name);
|
|
22822
|
-
console.log(
|
|
22823
|
-
if (agent.displayName) console.log(
|
|
22436
|
+
console.log(chalk68.bold(agent.name));
|
|
22437
|
+
if (agent.displayName) console.log(chalk68.dim(agent.displayName));
|
|
22824
22438
|
console.log();
|
|
22825
22439
|
console.log(`Compose ID: ${agent.agentComposeId}`);
|
|
22826
22440
|
console.log(`Connectors: ${agent.connectors.join(", ") || "-"}`);
|
|
@@ -22831,10 +22445,10 @@ var viewCommand = new Command80().name("view").description("View a zero agent").
|
|
|
22831
22445
|
console.log();
|
|
22832
22446
|
const result = await getZeroAgentInstructions(name);
|
|
22833
22447
|
if (result.content) {
|
|
22834
|
-
console.log(
|
|
22448
|
+
console.log(chalk68.dim("\u2500\u2500 Instructions \u2500\u2500"));
|
|
22835
22449
|
console.log(result.content);
|
|
22836
22450
|
} else {
|
|
22837
|
-
console.log(
|
|
22451
|
+
console.log(chalk68.dim("No instructions set"));
|
|
22838
22452
|
}
|
|
22839
22453
|
}
|
|
22840
22454
|
}
|
|
@@ -22842,15 +22456,15 @@ var viewCommand = new Command80().name("view").description("View a zero agent").
|
|
|
22842
22456
|
);
|
|
22843
22457
|
|
|
22844
22458
|
// src/commands/zero/agent/list.ts
|
|
22845
|
-
import { Command as
|
|
22846
|
-
import
|
|
22847
|
-
var
|
|
22459
|
+
import { Command as Command76 } from "commander";
|
|
22460
|
+
import chalk69 from "chalk";
|
|
22461
|
+
var listCommand10 = new Command76().name("list").alias("ls").description("List all zero agents").action(
|
|
22848
22462
|
withErrorHandler(async () => {
|
|
22849
22463
|
const agents = await listZeroAgents();
|
|
22850
22464
|
if (agents.length === 0) {
|
|
22851
|
-
console.log(
|
|
22465
|
+
console.log(chalk69.dim("No zero agents found"));
|
|
22852
22466
|
console.log(
|
|
22853
|
-
|
|
22467
|
+
chalk69.dim(
|
|
22854
22468
|
' Create one with: vm0 zero agent create --connectors github --display-name "My Agent"'
|
|
22855
22469
|
)
|
|
22856
22470
|
);
|
|
@@ -22866,7 +22480,7 @@ var listCommand11 = new Command81().name("list").alias("ls").description("List a
|
|
|
22866
22480
|
"DISPLAY NAME".padEnd(displayWidth),
|
|
22867
22481
|
"CONNECTORS"
|
|
22868
22482
|
].join(" ");
|
|
22869
|
-
console.log(
|
|
22483
|
+
console.log(chalk69.dim(header));
|
|
22870
22484
|
for (const agent of agents) {
|
|
22871
22485
|
const row = [
|
|
22872
22486
|
agent.name.padEnd(nameWidth),
|
|
@@ -22879,9 +22493,9 @@ var listCommand11 = new Command81().name("list").alias("ls").description("List a
|
|
|
22879
22493
|
);
|
|
22880
22494
|
|
|
22881
22495
|
// src/commands/zero/agent/delete.ts
|
|
22882
|
-
import { Command as
|
|
22883
|
-
import
|
|
22884
|
-
var
|
|
22496
|
+
import { Command as Command77 } from "commander";
|
|
22497
|
+
import chalk70 from "chalk";
|
|
22498
|
+
var deleteCommand2 = new Command77().name("delete").alias("rm").description("Delete a zero agent").argument("<name>", "Agent name").option("-y, --yes", "Skip confirmation prompt").action(
|
|
22885
22499
|
withErrorHandler(async (name, options) => {
|
|
22886
22500
|
await getZeroAgent(name);
|
|
22887
22501
|
if (!options.yes) {
|
|
@@ -22893,17 +22507,318 @@ var deleteCommand3 = new Command82().name("delete").alias("rm").description("Del
|
|
|
22893
22507
|
false
|
|
22894
22508
|
);
|
|
22895
22509
|
if (!confirmed) {
|
|
22896
|
-
console.log(
|
|
22510
|
+
console.log(chalk70.dim("Cancelled"));
|
|
22897
22511
|
return;
|
|
22898
22512
|
}
|
|
22899
22513
|
}
|
|
22900
22514
|
await deleteZeroAgent(name);
|
|
22901
|
-
console.log(
|
|
22515
|
+
console.log(chalk70.green(`\u2713 Zero agent '${name}' deleted`));
|
|
22902
22516
|
})
|
|
22903
22517
|
);
|
|
22904
22518
|
|
|
22905
22519
|
// src/commands/zero/agent/index.ts
|
|
22906
|
-
var
|
|
22520
|
+
var agentCommand = new Command78("agent").description("Manage zero agents").addCommand(createCommand).addCommand(editCommand).addCommand(viewCommand).addCommand(listCommand10).addCommand(deleteCommand2);
|
|
22521
|
+
|
|
22522
|
+
// src/commands/zero/connector/index.ts
|
|
22523
|
+
import { Command as Command83 } from "commander";
|
|
22524
|
+
|
|
22525
|
+
// src/commands/zero/connector/connect.ts
|
|
22526
|
+
import { Command as Command79 } from "commander";
|
|
22527
|
+
import chalk71 from "chalk";
|
|
22528
|
+
function delay3(ms) {
|
|
22529
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
22530
|
+
}
|
|
22531
|
+
function renderHelpText2(text) {
|
|
22532
|
+
return text.replace(
|
|
22533
|
+
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
22534
|
+
(_m, label, url) => `${label} (${chalk71.cyan(url)})`
|
|
22535
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk71.bold(content)).replace(
|
|
22536
|
+
/^> (.+)$/gm,
|
|
22537
|
+
(_m, content) => chalk71.yellow(` ${content}`)
|
|
22538
|
+
);
|
|
22539
|
+
}
|
|
22540
|
+
async function connectViaApiToken2(connectorType, tokenValue) {
|
|
22541
|
+
const config = CONNECTOR_TYPES[connectorType];
|
|
22542
|
+
const apiTokenConfig = config.authMethods["api-token"];
|
|
22543
|
+
if (!apiTokenConfig) {
|
|
22544
|
+
throw new Error(
|
|
22545
|
+
`${config.label} does not support API token authentication`
|
|
22546
|
+
);
|
|
22547
|
+
}
|
|
22548
|
+
const secretEntries = Object.entries(apiTokenConfig.secrets);
|
|
22549
|
+
const inputSecrets = {};
|
|
22550
|
+
if (tokenValue && secretEntries.length === 1) {
|
|
22551
|
+
const [secretName] = secretEntries[0];
|
|
22552
|
+
inputSecrets[secretName] = tokenValue;
|
|
22553
|
+
} else {
|
|
22554
|
+
if (apiTokenConfig.helpText) {
|
|
22555
|
+
console.log();
|
|
22556
|
+
console.log(renderHelpText2(apiTokenConfig.helpText));
|
|
22557
|
+
console.log();
|
|
22558
|
+
}
|
|
22559
|
+
for (const [secretName, secretConfig] of secretEntries) {
|
|
22560
|
+
if (!secretConfig.required) continue;
|
|
22561
|
+
const value = await promptPassword(
|
|
22562
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk71.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
22563
|
+
);
|
|
22564
|
+
if (!value) {
|
|
22565
|
+
throw new Error("Cancelled");
|
|
22566
|
+
}
|
|
22567
|
+
inputSecrets[secretName] = value;
|
|
22568
|
+
}
|
|
22569
|
+
}
|
|
22570
|
+
for (const [name, value] of Object.entries(inputSecrets)) {
|
|
22571
|
+
await setZeroSecret({
|
|
22572
|
+
name,
|
|
22573
|
+
value,
|
|
22574
|
+
description: `API token for ${config.label} connector`
|
|
22575
|
+
});
|
|
22576
|
+
}
|
|
22577
|
+
console.log(
|
|
22578
|
+
chalk71.green(`
|
|
22579
|
+
\u2713 ${config.label} connected successfully via API token!`)
|
|
22580
|
+
);
|
|
22581
|
+
}
|
|
22582
|
+
async function connectComputer2() {
|
|
22583
|
+
await checkComputerDependencies();
|
|
22584
|
+
console.log(chalk71.cyan("Setting up computer connector..."));
|
|
22585
|
+
const credentials = await createZeroComputerConnector();
|
|
22586
|
+
await startComputerServices(credentials);
|
|
22587
|
+
console.log(chalk71.cyan("Disconnecting computer connector..."));
|
|
22588
|
+
await deleteZeroComputerConnector();
|
|
22589
|
+
console.log(chalk71.green("\u2713 Disconnected computer"));
|
|
22590
|
+
}
|
|
22591
|
+
async function resolveAuthMethod2(connectorType, tokenFlag) {
|
|
22592
|
+
const config = CONNECTOR_TYPES[connectorType];
|
|
22593
|
+
const oauthFlag = CONNECTOR_TYPES[connectorType].featureFlag;
|
|
22594
|
+
const oauthAvailable = "oauth" in config.authMethods && (!oauthFlag || await isFeatureEnabled(oauthFlag));
|
|
22595
|
+
const apiTokenAvailable = "api-token" in config.authMethods;
|
|
22596
|
+
if (tokenFlag) {
|
|
22597
|
+
if (!apiTokenAvailable) {
|
|
22598
|
+
throw new Error(
|
|
22599
|
+
`${config.label} does not support API token authentication`
|
|
22600
|
+
);
|
|
22601
|
+
}
|
|
22602
|
+
return "api-token";
|
|
22603
|
+
}
|
|
22604
|
+
if (oauthAvailable && apiTokenAvailable) {
|
|
22605
|
+
const selected = await promptSelect(
|
|
22606
|
+
`How would you like to connect ${config.label}?`,
|
|
22607
|
+
[
|
|
22608
|
+
{ title: "OAuth (Sign in with browser)", value: "oauth" },
|
|
22609
|
+
{
|
|
22610
|
+
title: `API Token (${config.authMethods["api-token"].label})`,
|
|
22611
|
+
value: "api-token"
|
|
22612
|
+
}
|
|
22613
|
+
]
|
|
22614
|
+
);
|
|
22615
|
+
if (!selected) {
|
|
22616
|
+
throw new Error("Cancelled");
|
|
22617
|
+
}
|
|
22618
|
+
return selected;
|
|
22619
|
+
}
|
|
22620
|
+
if (apiTokenAvailable) return "api-token";
|
|
22621
|
+
if (oauthAvailable) return "oauth";
|
|
22622
|
+
throw new Error(
|
|
22623
|
+
`${config.label} has no available auth methods. OAuth may not be enabled yet.`
|
|
22624
|
+
);
|
|
22625
|
+
}
|
|
22626
|
+
async function connectViaOAuth2(connectorType) {
|
|
22627
|
+
console.log(`Connecting ${chalk71.cyan(connectorType)}...`);
|
|
22628
|
+
const session = await createZeroConnectorSession(connectorType);
|
|
22629
|
+
const apiUrl = await getBaseUrl();
|
|
22630
|
+
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
22631
|
+
console.log(chalk71.green("\nSession created"));
|
|
22632
|
+
console.log(chalk71.cyan(`
|
|
22633
|
+
To connect, visit: ${verificationUrl}`));
|
|
22634
|
+
console.log(
|
|
22635
|
+
`
|
|
22636
|
+
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
22637
|
+
);
|
|
22638
|
+
console.log("\nWaiting for authorization...");
|
|
22639
|
+
const startTime = Date.now();
|
|
22640
|
+
const maxWaitTime = session.expiresIn * 1e3;
|
|
22641
|
+
const pollInterval = (session.interval || 5) * 1e3;
|
|
22642
|
+
let isFirstPoll = true;
|
|
22643
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
22644
|
+
if (!isFirstPoll) {
|
|
22645
|
+
await delay3(pollInterval);
|
|
22646
|
+
}
|
|
22647
|
+
isFirstPoll = false;
|
|
22648
|
+
const status = await getZeroConnectorSession(connectorType, session.id);
|
|
22649
|
+
switch (status.status) {
|
|
22650
|
+
case "complete":
|
|
22651
|
+
console.log(
|
|
22652
|
+
chalk71.green(`
|
|
22653
|
+
|
|
22654
|
+
${connectorType} connected successfully!`)
|
|
22655
|
+
);
|
|
22656
|
+
return;
|
|
22657
|
+
case "expired":
|
|
22658
|
+
throw new Error("Session expired, please try again");
|
|
22659
|
+
case "error":
|
|
22660
|
+
throw new Error(
|
|
22661
|
+
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
22662
|
+
);
|
|
22663
|
+
case "pending":
|
|
22664
|
+
process.stdout.write(chalk71.dim("."));
|
|
22665
|
+
break;
|
|
22666
|
+
}
|
|
22667
|
+
}
|
|
22668
|
+
throw new Error("Session timed out, please try again");
|
|
22669
|
+
}
|
|
22670
|
+
var connectCommand2 = new Command79().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").option("--token <value>", "API token value (skip interactive prompt)").action(
|
|
22671
|
+
withErrorHandler(async (type2, options) => {
|
|
22672
|
+
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
22673
|
+
if (!parseResult.success) {
|
|
22674
|
+
const available = Object.keys(CONNECTOR_TYPES).join(", ");
|
|
22675
|
+
throw new Error(`Unknown connector type: ${type2}`, {
|
|
22676
|
+
cause: new Error(`Available connectors: ${available}`)
|
|
22677
|
+
});
|
|
22678
|
+
}
|
|
22679
|
+
const connectorType = parseResult.data;
|
|
22680
|
+
if (connectorType === "computer") {
|
|
22681
|
+
await connectComputer2();
|
|
22682
|
+
return;
|
|
22683
|
+
}
|
|
22684
|
+
const authMethod = await resolveAuthMethod2(connectorType, options.token);
|
|
22685
|
+
if (authMethod === "api-token") {
|
|
22686
|
+
await connectViaApiToken2(connectorType, options.token);
|
|
22687
|
+
return;
|
|
22688
|
+
}
|
|
22689
|
+
await connectViaOAuth2(connectorType);
|
|
22690
|
+
})
|
|
22691
|
+
);
|
|
22692
|
+
|
|
22693
|
+
// src/commands/zero/connector/list.ts
|
|
22694
|
+
import { Command as Command80 } from "commander";
|
|
22695
|
+
import chalk72 from "chalk";
|
|
22696
|
+
var listCommand11 = new Command80().name("list").alias("ls").description("List all connectors and their status").action(
|
|
22697
|
+
withErrorHandler(async () => {
|
|
22698
|
+
const result = await listZeroConnectors();
|
|
22699
|
+
const connectedMap = new Map(result.connectors.map((c33) => [c33.type, c33]));
|
|
22700
|
+
const allTypesRaw = Object.keys(CONNECTOR_TYPES);
|
|
22701
|
+
const allTypes = [];
|
|
22702
|
+
for (const type2 of allTypesRaw) {
|
|
22703
|
+
const flag = CONNECTOR_TYPES[type2].featureFlag;
|
|
22704
|
+
const hasApiToken = "api-token" in CONNECTOR_TYPES[type2].authMethods;
|
|
22705
|
+
if (flag && !await isFeatureEnabled(flag) && !hasApiToken) {
|
|
22706
|
+
continue;
|
|
22707
|
+
}
|
|
22708
|
+
allTypes.push(type2);
|
|
22709
|
+
}
|
|
22710
|
+
const typeWidth = Math.max(4, ...allTypes.map((t) => t.length));
|
|
22711
|
+
const statusText = "STATUS";
|
|
22712
|
+
const statusWidth = statusText.length;
|
|
22713
|
+
const header = [
|
|
22714
|
+
"TYPE".padEnd(typeWidth),
|
|
22715
|
+
statusText.padEnd(statusWidth),
|
|
22716
|
+
"ACCOUNT"
|
|
22717
|
+
].join(" ");
|
|
22718
|
+
console.log(chalk72.dim(header));
|
|
22719
|
+
for (const type2 of allTypes) {
|
|
22720
|
+
const connector = connectedMap.get(type2);
|
|
22721
|
+
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type2, connector.oauthScopes);
|
|
22722
|
+
const status = connector ? connector.needsReconnect ? chalk72.yellow("!".padEnd(statusWidth)) : scopeMismatch ? chalk72.yellow("!".padEnd(statusWidth)) : chalk72.green("\u2713".padEnd(statusWidth)) : chalk72.dim("-".padEnd(statusWidth));
|
|
22723
|
+
const account = connector?.needsReconnect ? chalk72.yellow("(reconnect needed)") : scopeMismatch ? chalk72.yellow("(permissions update available)") : connector?.externalUsername ? `@${connector.externalUsername}` : chalk72.dim("-");
|
|
22724
|
+
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
22725
|
+
console.log(row);
|
|
22726
|
+
}
|
|
22727
|
+
console.log();
|
|
22728
|
+
console.log(chalk72.dim("To connect a service:"));
|
|
22729
|
+
console.log(chalk72.dim(" vm0 zero connector connect <type>"));
|
|
22730
|
+
})
|
|
22731
|
+
);
|
|
22732
|
+
|
|
22733
|
+
// src/commands/zero/connector/status.ts
|
|
22734
|
+
import { Command as Command81 } from "commander";
|
|
22735
|
+
import chalk73 from "chalk";
|
|
22736
|
+
var LABEL_WIDTH2 = 16;
|
|
22737
|
+
var statusCommand7 = new Command81().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
22738
|
+
withErrorHandler(async (type2) => {
|
|
22739
|
+
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
22740
|
+
if (!parseResult.success) {
|
|
22741
|
+
const available = Object.keys(CONNECTOR_TYPES).join(", ");
|
|
22742
|
+
throw new Error(`Unknown connector type: ${type2}`, {
|
|
22743
|
+
cause: new Error(`Available connectors: ${available}`)
|
|
22744
|
+
});
|
|
22745
|
+
}
|
|
22746
|
+
const connector = await getZeroConnector(parseResult.data);
|
|
22747
|
+
console.log(`Connector: ${chalk73.cyan(type2)}`);
|
|
22748
|
+
console.log();
|
|
22749
|
+
if (connector) {
|
|
22750
|
+
console.log(
|
|
22751
|
+
`${"Status:".padEnd(LABEL_WIDTH2)}${chalk73.green("connected")}`
|
|
22752
|
+
);
|
|
22753
|
+
console.log(
|
|
22754
|
+
`${"Account:".padEnd(LABEL_WIDTH2)}@${connector.externalUsername}`
|
|
22755
|
+
);
|
|
22756
|
+
console.log(
|
|
22757
|
+
`${"Auth Method:".padEnd(LABEL_WIDTH2)}${connector.authMethod}`
|
|
22758
|
+
);
|
|
22759
|
+
if (connector.oauthScopes && connector.oauthScopes.length > 0) {
|
|
22760
|
+
console.log(
|
|
22761
|
+
`${"OAuth Scopes:".padEnd(LABEL_WIDTH2)}${connector.oauthScopes.join(", ")}`
|
|
22762
|
+
);
|
|
22763
|
+
}
|
|
22764
|
+
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
22765
|
+
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
22766
|
+
console.log(
|
|
22767
|
+
`${"Permissions:".padEnd(LABEL_WIDTH2)}${chalk73.yellow("update available")}`
|
|
22768
|
+
);
|
|
22769
|
+
if (diff.addedScopes.length > 0) {
|
|
22770
|
+
console.log(
|
|
22771
|
+
`${" Added:".padEnd(LABEL_WIDTH2)}${diff.addedScopes.join(", ")}`
|
|
22772
|
+
);
|
|
22773
|
+
}
|
|
22774
|
+
if (diff.removedScopes.length > 0) {
|
|
22775
|
+
console.log(
|
|
22776
|
+
`${" Removed:".padEnd(LABEL_WIDTH2)}${diff.removedScopes.join(", ")}`
|
|
22777
|
+
);
|
|
22778
|
+
}
|
|
22779
|
+
}
|
|
22780
|
+
console.log(
|
|
22781
|
+
`${"Connected:".padEnd(LABEL_WIDTH2)}${formatDateTime(connector.createdAt)}`
|
|
22782
|
+
);
|
|
22783
|
+
if (connector.updatedAt !== connector.createdAt) {
|
|
22784
|
+
console.log(
|
|
22785
|
+
`${"Last Updated:".padEnd(LABEL_WIDTH2)}${formatDateTime(connector.updatedAt)}`
|
|
22786
|
+
);
|
|
22787
|
+
}
|
|
22788
|
+
console.log();
|
|
22789
|
+
console.log(chalk73.dim("To disconnect:"));
|
|
22790
|
+
console.log(chalk73.dim(` vm0 zero connector disconnect ${type2}`));
|
|
22791
|
+
} else {
|
|
22792
|
+
console.log(
|
|
22793
|
+
`${"Status:".padEnd(LABEL_WIDTH2)}${chalk73.dim("not connected")}`
|
|
22794
|
+
);
|
|
22795
|
+
console.log();
|
|
22796
|
+
console.log(chalk73.dim("To connect:"));
|
|
22797
|
+
console.log(chalk73.dim(` vm0 zero connector connect ${type2}`));
|
|
22798
|
+
}
|
|
22799
|
+
})
|
|
22800
|
+
);
|
|
22801
|
+
|
|
22802
|
+
// src/commands/zero/connector/disconnect.ts
|
|
22803
|
+
import { Command as Command82 } from "commander";
|
|
22804
|
+
import chalk74 from "chalk";
|
|
22805
|
+
var disconnectCommand2 = new Command82().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
22806
|
+
withErrorHandler(async (type2) => {
|
|
22807
|
+
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
22808
|
+
if (!parseResult.success) {
|
|
22809
|
+
const available = Object.keys(CONNECTOR_TYPES).join(", ");
|
|
22810
|
+
throw new Error(`Unknown connector type: ${type2}`, {
|
|
22811
|
+
cause: new Error(`Available connectors: ${available}`)
|
|
22812
|
+
});
|
|
22813
|
+
}
|
|
22814
|
+
const connectorType = parseResult.data;
|
|
22815
|
+
await deleteZeroConnector(connectorType);
|
|
22816
|
+
console.log(chalk74.green(`\u2713 Disconnected ${type2}`));
|
|
22817
|
+
})
|
|
22818
|
+
);
|
|
22819
|
+
|
|
22820
|
+
// src/commands/zero/connector/index.ts
|
|
22821
|
+
var zeroConnectorCommand = new Command83().name("connector").description("Manage third-party service connections (zero)").addCommand(listCommand11).addCommand(statusCommand7).addCommand(connectCommand2).addCommand(disconnectCommand2);
|
|
22907
22822
|
|
|
22908
22823
|
// src/commands/zero/schedule/index.ts
|
|
22909
22824
|
import { Command as Command90 } from "commander";
|
|
@@ -23016,7 +22931,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
23016
22931
|
if (!isInteractive()) {
|
|
23017
22932
|
throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
|
|
23018
22933
|
}
|
|
23019
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
22934
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c33) => c33.value === existingFrequency) : 0;
|
|
23020
22935
|
frequency = await promptSelect(
|
|
23021
22936
|
"Schedule frequency",
|
|
23022
22937
|
FREQUENCY_CHOICES,
|
|
@@ -23041,7 +22956,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
23041
22956
|
throw new Error("--day is required for weekly/monthly");
|
|
23042
22957
|
}
|
|
23043
22958
|
if (frequency === "weekly") {
|
|
23044
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
22959
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c33) => c33.value === existingDay) : 0;
|
|
23045
22960
|
const day2 = await promptSelect(
|
|
23046
22961
|
"Day of week",
|
|
23047
22962
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -23561,7 +23476,7 @@ var statusCommand8 = new Command86().name("status").description("Show detailed s
|
|
|
23561
23476
|
// src/commands/zero/schedule/delete.ts
|
|
23562
23477
|
import { Command as Command87 } from "commander";
|
|
23563
23478
|
import chalk78 from "chalk";
|
|
23564
|
-
var
|
|
23479
|
+
var deleteCommand3 = new Command87().name("delete").alias("rm").description("Delete a zero schedule").argument("<agent-name>", "Agent name").option(
|
|
23565
23480
|
"-n, --name <schedule-name>",
|
|
23566
23481
|
"Schedule name (required when agent has multiple schedules)"
|
|
23567
23482
|
).option("-y, --yes", "Skip confirmation prompt").action(
|
|
@@ -23640,7 +23555,7 @@ var disableCommand = new Command89().name("disable").description("Disable a zero
|
|
|
23640
23555
|
);
|
|
23641
23556
|
|
|
23642
23557
|
// src/commands/zero/schedule/index.ts
|
|
23643
|
-
var zeroScheduleCommand = new Command90().name("schedule").description("Manage zero agent schedules").addCommand(setupCommand2).addCommand(listCommand12).addCommand(statusCommand8).addCommand(
|
|
23558
|
+
var zeroScheduleCommand = new Command90().name("schedule").description("Manage zero agent schedules").addCommand(setupCommand2).addCommand(listCommand12).addCommand(statusCommand8).addCommand(deleteCommand3).addCommand(enableCommand).addCommand(disableCommand);
|
|
23644
23559
|
|
|
23645
23560
|
// src/commands/zero/secret/index.ts
|
|
23646
23561
|
import { Command as Command94 } from "commander";
|
|
@@ -23756,7 +23671,7 @@ var setCommand4 = new Command92().name("set").description("Create or update a se
|
|
|
23756
23671
|
// src/commands/zero/secret/delete.ts
|
|
23757
23672
|
import { Command as Command93 } from "commander";
|
|
23758
23673
|
import chalk83 from "chalk";
|
|
23759
|
-
var
|
|
23674
|
+
var deleteCommand4 = new Command93().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
23760
23675
|
withErrorHandler(async (name, options) => {
|
|
23761
23676
|
if (!options.yes) {
|
|
23762
23677
|
if (!isInteractive()) {
|
|
@@ -23777,7 +23692,7 @@ var deleteCommand5 = new Command93().name("delete").description("Delete a secret
|
|
|
23777
23692
|
);
|
|
23778
23693
|
|
|
23779
23694
|
// src/commands/zero/secret/index.ts
|
|
23780
|
-
var zeroSecretCommand = new Command94().name("secret").description("Manage secrets").addCommand(listCommand13).addCommand(setCommand4).addCommand(
|
|
23695
|
+
var zeroSecretCommand = new Command94().name("secret").description("Manage secrets").addCommand(listCommand13).addCommand(setCommand4).addCommand(deleteCommand4);
|
|
23781
23696
|
|
|
23782
23697
|
// src/commands/zero/variable/index.ts
|
|
23783
23698
|
import { Command as Command98 } from "commander";
|
|
@@ -23853,7 +23768,7 @@ var setCommand5 = new Command96().name("set").description("Create or update a va
|
|
|
23853
23768
|
// src/commands/zero/variable/delete.ts
|
|
23854
23769
|
import { Command as Command97 } from "commander";
|
|
23855
23770
|
import chalk86 from "chalk";
|
|
23856
|
-
var
|
|
23771
|
+
var deleteCommand5 = new Command97().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
23857
23772
|
withErrorHandler(async (name, options) => {
|
|
23858
23773
|
if (!options.yes) {
|
|
23859
23774
|
if (!isInteractive()) {
|
|
@@ -23874,14 +23789,14 @@ var deleteCommand6 = new Command97().name("delete").description("Delete a variab
|
|
|
23874
23789
|
);
|
|
23875
23790
|
|
|
23876
23791
|
// src/commands/zero/variable/index.ts
|
|
23877
|
-
var zeroVariableCommand = new Command98().name("variable").description("Manage variables").addCommand(listCommand14).addCommand(setCommand5).addCommand(
|
|
23792
|
+
var zeroVariableCommand = new Command98().name("variable").description("Manage variables").addCommand(listCommand14).addCommand(setCommand5).addCommand(deleteCommand5);
|
|
23878
23793
|
|
|
23879
23794
|
// src/commands/zero/index.ts
|
|
23880
|
-
var zeroCommand = new Command99("zero").description("Zero platform commands").addCommand(zeroOrgCommand).addCommand(
|
|
23795
|
+
var zeroCommand = new Command99("zero").description("Zero platform commands").addCommand(zeroOrgCommand).addCommand(agentCommand).addCommand(zeroConnectorCommand).addCommand(zeroScheduleCommand).addCommand(zeroSecretCommand).addCommand(zeroVariableCommand);
|
|
23881
23796
|
|
|
23882
23797
|
// src/index.ts
|
|
23883
23798
|
var program = new Command100();
|
|
23884
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
23799
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.78.0");
|
|
23885
23800
|
program.addCommand(authCommand);
|
|
23886
23801
|
program.addCommand(infoCommand);
|
|
23887
23802
|
program.addCommand(composeCommand);
|
|
@@ -23891,7 +23806,6 @@ program.addCommand(artifactCommand);
|
|
|
23891
23806
|
program.addCommand(memoryCommand);
|
|
23892
23807
|
program.addCommand(cookCommand);
|
|
23893
23808
|
program.addCommand(logsCommand2);
|
|
23894
|
-
program.addCommand(agentCommand);
|
|
23895
23809
|
program.addCommand(initCommand4);
|
|
23896
23810
|
program.addCommand(connectorCommand);
|
|
23897
23811
|
program.addCommand(preferenceCommand);
|