@vm0/cli 9.77.1 → 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 +1140 -1144
- 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,26 +13010,38 @@ var zeroConnectorsMainContract = c20.router({
|
|
|
13036
13010
|
summary: "List all connectors (zero proxy)"
|
|
13037
13011
|
}
|
|
13038
13012
|
});
|
|
13039
|
-
var zeroConnectorsByTypeContract =
|
|
13013
|
+
var zeroConnectorsByTypeContract = c19.router({
|
|
13014
|
+
get: {
|
|
13015
|
+
method: "GET",
|
|
13016
|
+
path: "/api/zero/connectors/:type",
|
|
13017
|
+
headers: authHeadersSchema,
|
|
13018
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13019
|
+
responses: {
|
|
13020
|
+
200: connectorResponseSchema,
|
|
13021
|
+
401: apiErrorSchema,
|
|
13022
|
+
404: apiErrorSchema
|
|
13023
|
+
},
|
|
13024
|
+
summary: "Get connector by type (zero proxy)"
|
|
13025
|
+
},
|
|
13040
13026
|
delete: {
|
|
13041
13027
|
method: "DELETE",
|
|
13042
13028
|
path: "/api/zero/connectors/:type",
|
|
13043
13029
|
headers: authHeadersSchema,
|
|
13044
|
-
pathParams:
|
|
13030
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13045
13031
|
responses: {
|
|
13046
|
-
204:
|
|
13032
|
+
204: c19.noBody(),
|
|
13047
13033
|
401: apiErrorSchema,
|
|
13048
13034
|
404: apiErrorSchema
|
|
13049
13035
|
},
|
|
13050
13036
|
summary: "Disconnect a connector (zero proxy)"
|
|
13051
13037
|
}
|
|
13052
13038
|
});
|
|
13053
|
-
var zeroConnectorScopeDiffContract =
|
|
13039
|
+
var zeroConnectorScopeDiffContract = c19.router({
|
|
13054
13040
|
getScopeDiff: {
|
|
13055
13041
|
method: "GET",
|
|
13056
13042
|
path: "/api/zero/connectors/:type/scope-diff",
|
|
13057
13043
|
headers: authHeadersSchema,
|
|
13058
|
-
pathParams:
|
|
13044
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13059
13045
|
responses: {
|
|
13060
13046
|
200: scopeDiffResponseSchema,
|
|
13061
13047
|
401: apiErrorSchema,
|
|
@@ -13064,22 +13050,22 @@ var zeroConnectorScopeDiffContract = c20.router({
|
|
|
13064
13050
|
summary: "Get scope diff for a connector"
|
|
13065
13051
|
}
|
|
13066
13052
|
});
|
|
13067
|
-
var connectorSearchAuthMethodSchema =
|
|
13068
|
-
var connectorSearchItemSchema =
|
|
13069
|
-
id:
|
|
13070
|
-
label:
|
|
13071
|
-
description:
|
|
13072
|
-
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)
|
|
13073
13059
|
});
|
|
13074
|
-
var connectorSearchResponseSchema =
|
|
13075
|
-
connectors:
|
|
13060
|
+
var connectorSearchResponseSchema = z27.object({
|
|
13061
|
+
connectors: z27.array(connectorSearchItemSchema)
|
|
13076
13062
|
});
|
|
13077
|
-
var zeroConnectorsSearchContract =
|
|
13063
|
+
var zeroConnectorsSearchContract = c19.router({
|
|
13078
13064
|
search: {
|
|
13079
13065
|
method: "GET",
|
|
13080
13066
|
path: "/api/zero/connectors/search",
|
|
13081
13067
|
headers: authHeadersSchema,
|
|
13082
|
-
query:
|
|
13068
|
+
query: z27.object({ keyword: z27.string().optional() }),
|
|
13083
13069
|
responses: {
|
|
13084
13070
|
200: connectorSearchResponseSchema,
|
|
13085
13071
|
401: apiErrorSchema
|
|
@@ -13087,11 +13073,81 @@ var zeroConnectorsSearchContract = c20.router({
|
|
|
13087
13073
|
summary: "Search available connector types"
|
|
13088
13074
|
}
|
|
13089
13075
|
});
|
|
13076
|
+
var zeroConnectorSessionsContract = c19.router({
|
|
13077
|
+
create: {
|
|
13078
|
+
method: "POST",
|
|
13079
|
+
path: "/api/zero/connectors/:type/sessions",
|
|
13080
|
+
headers: authHeadersSchema,
|
|
13081
|
+
pathParams: z27.object({ type: connectorTypeSchema }),
|
|
13082
|
+
body: z27.object({}).optional(),
|
|
13083
|
+
responses: {
|
|
13084
|
+
200: connectorSessionResponseSchema,
|
|
13085
|
+
400: apiErrorSchema,
|
|
13086
|
+
401: apiErrorSchema
|
|
13087
|
+
},
|
|
13088
|
+
summary: "Create connector session for device flow (zero proxy)"
|
|
13089
|
+
}
|
|
13090
|
+
});
|
|
13091
|
+
var zeroConnectorSessionByIdContract = c19.router({
|
|
13092
|
+
get: {
|
|
13093
|
+
method: "GET",
|
|
13094
|
+
path: "/api/zero/connectors/:type/sessions/:sessionId",
|
|
13095
|
+
headers: authHeadersSchema,
|
|
13096
|
+
pathParams: z27.object({
|
|
13097
|
+
type: connectorTypeSchema,
|
|
13098
|
+
sessionId: z27.uuid()
|
|
13099
|
+
}),
|
|
13100
|
+
responses: {
|
|
13101
|
+
200: connectorSessionStatusResponseSchema,
|
|
13102
|
+
400: apiErrorSchema,
|
|
13103
|
+
401: apiErrorSchema,
|
|
13104
|
+
404: apiErrorSchema
|
|
13105
|
+
},
|
|
13106
|
+
summary: "Get connector session status (zero proxy)"
|
|
13107
|
+
}
|
|
13108
|
+
});
|
|
13109
|
+
var zeroComputerConnectorContract = c19.router({
|
|
13110
|
+
create: {
|
|
13111
|
+
method: "POST",
|
|
13112
|
+
path: "/api/zero/connectors/computer",
|
|
13113
|
+
headers: authHeadersSchema,
|
|
13114
|
+
body: z27.object({}).optional(),
|
|
13115
|
+
responses: {
|
|
13116
|
+
200: computerConnectorCreateResponseSchema,
|
|
13117
|
+
400: apiErrorSchema,
|
|
13118
|
+
401: apiErrorSchema,
|
|
13119
|
+
409: apiErrorSchema
|
|
13120
|
+
},
|
|
13121
|
+
summary: "Create computer connector (zero proxy)"
|
|
13122
|
+
},
|
|
13123
|
+
get: {
|
|
13124
|
+
method: "GET",
|
|
13125
|
+
path: "/api/zero/connectors/computer",
|
|
13126
|
+
headers: authHeadersSchema,
|
|
13127
|
+
responses: {
|
|
13128
|
+
200: connectorResponseSchema,
|
|
13129
|
+
401: apiErrorSchema,
|
|
13130
|
+
404: apiErrorSchema
|
|
13131
|
+
},
|
|
13132
|
+
summary: "Get computer connector status (zero proxy)"
|
|
13133
|
+
},
|
|
13134
|
+
delete: {
|
|
13135
|
+
method: "DELETE",
|
|
13136
|
+
path: "/api/zero/connectors/computer",
|
|
13137
|
+
headers: authHeadersSchema,
|
|
13138
|
+
responses: {
|
|
13139
|
+
204: c19.noBody(),
|
|
13140
|
+
401: apiErrorSchema,
|
|
13141
|
+
404: apiErrorSchema
|
|
13142
|
+
},
|
|
13143
|
+
summary: "Delete computer connector (zero proxy)"
|
|
13144
|
+
}
|
|
13145
|
+
});
|
|
13090
13146
|
|
|
13091
13147
|
// ../../packages/core/src/contracts/zero-org.ts
|
|
13092
|
-
import { z as
|
|
13093
|
-
var
|
|
13094
|
-
var zeroOrgContract =
|
|
13148
|
+
import { z as z28 } from "zod";
|
|
13149
|
+
var c20 = initContract();
|
|
13150
|
+
var zeroOrgContract = c20.router({
|
|
13095
13151
|
get: {
|
|
13096
13152
|
method: "GET",
|
|
13097
13153
|
path: "/api/zero/org",
|
|
@@ -13120,12 +13176,12 @@ var zeroOrgContract = c21.router({
|
|
|
13120
13176
|
summary: "Update org slug (zero proxy)"
|
|
13121
13177
|
}
|
|
13122
13178
|
});
|
|
13123
|
-
var zeroOrgLeaveContract =
|
|
13179
|
+
var zeroOrgLeaveContract = c20.router({
|
|
13124
13180
|
leave: {
|
|
13125
13181
|
method: "POST",
|
|
13126
13182
|
path: "/api/zero/org/leave",
|
|
13127
13183
|
headers: authHeadersSchema,
|
|
13128
|
-
body:
|
|
13184
|
+
body: z28.object({}),
|
|
13129
13185
|
responses: {
|
|
13130
13186
|
200: orgMessageResponseSchema,
|
|
13131
13187
|
401: apiErrorSchema,
|
|
@@ -13135,12 +13191,12 @@ var zeroOrgLeaveContract = c21.router({
|
|
|
13135
13191
|
summary: "Leave the current org (zero proxy)"
|
|
13136
13192
|
}
|
|
13137
13193
|
});
|
|
13138
|
-
var zeroOrgDeleteContract =
|
|
13194
|
+
var zeroOrgDeleteContract = c20.router({
|
|
13139
13195
|
delete: {
|
|
13140
13196
|
method: "POST",
|
|
13141
13197
|
path: "/api/zero/org/delete",
|
|
13142
13198
|
headers: authHeadersSchema,
|
|
13143
|
-
body:
|
|
13199
|
+
body: z28.object({ slug: z28.string() }),
|
|
13144
13200
|
responses: {
|
|
13145
13201
|
200: orgMessageResponseSchema,
|
|
13146
13202
|
400: apiErrorSchema,
|
|
@@ -13153,8 +13209,8 @@ var zeroOrgDeleteContract = c21.router({
|
|
|
13153
13209
|
});
|
|
13154
13210
|
|
|
13155
13211
|
// ../../packages/core/src/contracts/zero-org-list.ts
|
|
13156
|
-
var
|
|
13157
|
-
var zeroOrgListContract =
|
|
13212
|
+
var c21 = initContract();
|
|
13213
|
+
var zeroOrgListContract = c21.router({
|
|
13158
13214
|
list: {
|
|
13159
13215
|
method: "GET",
|
|
13160
13216
|
path: "/api/zero/org/list",
|
|
@@ -13169,8 +13225,8 @@ var zeroOrgListContract = c22.router({
|
|
|
13169
13225
|
});
|
|
13170
13226
|
|
|
13171
13227
|
// ../../packages/core/src/contracts/zero-org-members.ts
|
|
13172
|
-
var
|
|
13173
|
-
var zeroOrgMembersContract =
|
|
13228
|
+
var c22 = initContract();
|
|
13229
|
+
var zeroOrgMembersContract = c22.router({
|
|
13174
13230
|
members: {
|
|
13175
13231
|
method: "GET",
|
|
13176
13232
|
path: "/api/zero/org/members",
|
|
@@ -13214,7 +13270,7 @@ var zeroOrgMembersContract = c23.router({
|
|
|
13214
13270
|
summary: "Remove a member from the org (zero proxy)"
|
|
13215
13271
|
}
|
|
13216
13272
|
});
|
|
13217
|
-
var zeroOrgInviteContract =
|
|
13273
|
+
var zeroOrgInviteContract = c22.router({
|
|
13218
13274
|
invite: {
|
|
13219
13275
|
method: "POST",
|
|
13220
13276
|
path: "/api/zero/org/invite",
|
|
@@ -13232,16 +13288,16 @@ var zeroOrgInviteContract = c23.router({
|
|
|
13232
13288
|
});
|
|
13233
13289
|
|
|
13234
13290
|
// ../../packages/core/src/contracts/zero-composes.ts
|
|
13235
|
-
import { z as
|
|
13236
|
-
var
|
|
13237
|
-
var zeroComposesMainContract =
|
|
13291
|
+
import { z as z29 } from "zod";
|
|
13292
|
+
var c23 = initContract();
|
|
13293
|
+
var zeroComposesMainContract = c23.router({
|
|
13238
13294
|
getByName: {
|
|
13239
13295
|
method: "GET",
|
|
13240
13296
|
path: "/api/zero/composes",
|
|
13241
13297
|
headers: authHeadersSchema,
|
|
13242
|
-
query:
|
|
13243
|
-
name:
|
|
13244
|
-
org:
|
|
13298
|
+
query: z29.object({
|
|
13299
|
+
name: z29.string().min(1, "Missing name query parameter"),
|
|
13300
|
+
org: z29.string().optional()
|
|
13245
13301
|
}),
|
|
13246
13302
|
responses: {
|
|
13247
13303
|
200: composeResponseSchema,
|
|
@@ -13252,13 +13308,13 @@ var zeroComposesMainContract = c24.router({
|
|
|
13252
13308
|
summary: "Get agent compose by name (zero proxy)"
|
|
13253
13309
|
}
|
|
13254
13310
|
});
|
|
13255
|
-
var zeroComposesByIdContract =
|
|
13311
|
+
var zeroComposesByIdContract = c23.router({
|
|
13256
13312
|
getById: {
|
|
13257
13313
|
method: "GET",
|
|
13258
13314
|
path: "/api/zero/composes/:id",
|
|
13259
13315
|
headers: authHeadersSchema,
|
|
13260
|
-
pathParams:
|
|
13261
|
-
id:
|
|
13316
|
+
pathParams: z29.object({
|
|
13317
|
+
id: z29.string().min(1, "Compose ID is required")
|
|
13262
13318
|
}),
|
|
13263
13319
|
responses: {
|
|
13264
13320
|
200: composeResponseSchema,
|
|
@@ -13272,12 +13328,12 @@ var zeroComposesByIdContract = c24.router({
|
|
|
13272
13328
|
method: "DELETE",
|
|
13273
13329
|
path: "/api/zero/composes/:id",
|
|
13274
13330
|
headers: authHeadersSchema,
|
|
13275
|
-
pathParams:
|
|
13276
|
-
id:
|
|
13331
|
+
pathParams: z29.object({
|
|
13332
|
+
id: z29.string().uuid("Compose ID is required")
|
|
13277
13333
|
}),
|
|
13278
|
-
body:
|
|
13334
|
+
body: c23.noBody(),
|
|
13279
13335
|
responses: {
|
|
13280
|
-
204:
|
|
13336
|
+
204: c23.noBody(),
|
|
13281
13337
|
401: apiErrorSchema,
|
|
13282
13338
|
403: apiErrorSchema,
|
|
13283
13339
|
404: apiErrorSchema,
|
|
@@ -13286,17 +13342,17 @@ var zeroComposesByIdContract = c24.router({
|
|
|
13286
13342
|
summary: "Delete agent compose (zero proxy)"
|
|
13287
13343
|
}
|
|
13288
13344
|
});
|
|
13289
|
-
var zeroComposesListContract =
|
|
13345
|
+
var zeroComposesListContract = c23.router({
|
|
13290
13346
|
list: {
|
|
13291
13347
|
method: "GET",
|
|
13292
13348
|
path: "/api/zero/composes/list",
|
|
13293
13349
|
headers: authHeadersSchema,
|
|
13294
|
-
query:
|
|
13295
|
-
org:
|
|
13350
|
+
query: z29.object({
|
|
13351
|
+
org: z29.string().optional()
|
|
13296
13352
|
}),
|
|
13297
13353
|
responses: {
|
|
13298
|
-
200:
|
|
13299
|
-
composes:
|
|
13354
|
+
200: z29.object({
|
|
13355
|
+
composes: z29.array(composeListItemSchema)
|
|
13300
13356
|
}),
|
|
13301
13357
|
400: apiErrorSchema,
|
|
13302
13358
|
401: apiErrorSchema,
|
|
@@ -13307,7 +13363,7 @@ var zeroComposesListContract = c24.router({
|
|
|
13307
13363
|
});
|
|
13308
13364
|
|
|
13309
13365
|
// ../../packages/core/src/contracts/zero-runs.ts
|
|
13310
|
-
import { z as
|
|
13366
|
+
import { z as z30 } from "zod";
|
|
13311
13367
|
var zeroRunRequestSchema = unifiedRunRequestSchema.omit({
|
|
13312
13368
|
triggerSource: true,
|
|
13313
13369
|
memoryName: true,
|
|
@@ -13318,8 +13374,8 @@ var zeroRunRequestSchema = unifiedRunRequestSchema.omit({
|
|
|
13318
13374
|
vars: true,
|
|
13319
13375
|
secrets: true
|
|
13320
13376
|
});
|
|
13321
|
-
var
|
|
13322
|
-
var zeroRunsMainContract =
|
|
13377
|
+
var c24 = initContract();
|
|
13378
|
+
var zeroRunsMainContract = c24.router({
|
|
13323
13379
|
create: {
|
|
13324
13380
|
method: "POST",
|
|
13325
13381
|
path: "/api/zero/runs",
|
|
@@ -13335,13 +13391,13 @@ var zeroRunsMainContract = c25.router({
|
|
|
13335
13391
|
summary: "Create and execute agent run (zero proxy)"
|
|
13336
13392
|
}
|
|
13337
13393
|
});
|
|
13338
|
-
var zeroRunsByIdContract =
|
|
13394
|
+
var zeroRunsByIdContract = c24.router({
|
|
13339
13395
|
getById: {
|
|
13340
13396
|
method: "GET",
|
|
13341
13397
|
path: "/api/zero/runs/:id",
|
|
13342
13398
|
headers: authHeadersSchema,
|
|
13343
|
-
pathParams:
|
|
13344
|
-
id:
|
|
13399
|
+
pathParams: z30.object({
|
|
13400
|
+
id: z30.string().min(1, "Run ID is required")
|
|
13345
13401
|
}),
|
|
13346
13402
|
responses: {
|
|
13347
13403
|
200: getRunResponseSchema,
|
|
@@ -13352,15 +13408,15 @@ var zeroRunsByIdContract = c25.router({
|
|
|
13352
13408
|
summary: "Get agent run by ID (zero proxy)"
|
|
13353
13409
|
}
|
|
13354
13410
|
});
|
|
13355
|
-
var zeroRunsCancelContract =
|
|
13411
|
+
var zeroRunsCancelContract = c24.router({
|
|
13356
13412
|
cancel: {
|
|
13357
13413
|
method: "POST",
|
|
13358
13414
|
path: "/api/zero/runs/:id/cancel",
|
|
13359
13415
|
headers: authHeadersSchema,
|
|
13360
|
-
pathParams:
|
|
13361
|
-
id:
|
|
13416
|
+
pathParams: z30.object({
|
|
13417
|
+
id: z30.string().min(1, "Run ID is required")
|
|
13362
13418
|
}),
|
|
13363
|
-
body:
|
|
13419
|
+
body: z30.undefined(),
|
|
13364
13420
|
responses: {
|
|
13365
13421
|
200: cancelRunResponseSchema,
|
|
13366
13422
|
400: apiErrorSchema,
|
|
@@ -13371,7 +13427,7 @@ var zeroRunsCancelContract = c25.router({
|
|
|
13371
13427
|
summary: "Cancel a pending or running run (zero proxy)"
|
|
13372
13428
|
}
|
|
13373
13429
|
});
|
|
13374
|
-
var zeroRunsQueueContract =
|
|
13430
|
+
var zeroRunsQueueContract = c24.router({
|
|
13375
13431
|
getQueue: {
|
|
13376
13432
|
method: "GET",
|
|
13377
13433
|
path: "/api/zero/runs/queue",
|
|
@@ -13384,18 +13440,18 @@ var zeroRunsQueueContract = c25.router({
|
|
|
13384
13440
|
summary: "Get org run queue status (zero proxy)"
|
|
13385
13441
|
}
|
|
13386
13442
|
});
|
|
13387
|
-
var zeroRunAgentEventsContract =
|
|
13443
|
+
var zeroRunAgentEventsContract = c24.router({
|
|
13388
13444
|
getAgentEvents: {
|
|
13389
13445
|
method: "GET",
|
|
13390
13446
|
path: "/api/zero/runs/:id/telemetry/agent",
|
|
13391
13447
|
headers: authHeadersSchema,
|
|
13392
|
-
pathParams:
|
|
13393
|
-
id:
|
|
13448
|
+
pathParams: z30.object({
|
|
13449
|
+
id: z30.string().min(1, "Run ID is required")
|
|
13394
13450
|
}),
|
|
13395
|
-
query:
|
|
13396
|
-
since:
|
|
13397
|
-
limit:
|
|
13398
|
-
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")
|
|
13399
13455
|
}),
|
|
13400
13456
|
responses: {
|
|
13401
13457
|
200: agentEventsResponseSchema,
|
|
@@ -13407,62 +13463,62 @@ var zeroRunAgentEventsContract = c25.router({
|
|
|
13407
13463
|
});
|
|
13408
13464
|
|
|
13409
13465
|
// ../../packages/core/src/contracts/zero-schedules.ts
|
|
13410
|
-
import { z as
|
|
13411
|
-
var
|
|
13412
|
-
var scheduleResponseSchema =
|
|
13413
|
-
id:
|
|
13414
|
-
zeroAgentId:
|
|
13415
|
-
agentName:
|
|
13416
|
-
orgSlug:
|
|
13417
|
-
userId:
|
|
13418
|
-
name:
|
|
13419
|
-
triggerType:
|
|
13420
|
-
cronExpression:
|
|
13421
|
-
atTime:
|
|
13422
|
-
intervalSeconds:
|
|
13423
|
-
timezone:
|
|
13424
|
-
prompt:
|
|
13425
|
-
description:
|
|
13426
|
-
appendSystemPrompt:
|
|
13427
|
-
vars:
|
|
13428
|
-
secretNames:
|
|
13429
|
-
artifactName:
|
|
13430
|
-
artifactVersion:
|
|
13431
|
-
volumeVersions:
|
|
13432
|
-
enabled:
|
|
13433
|
-
notifyEmail:
|
|
13434
|
-
notifySlack:
|
|
13435
|
-
nextRunAt:
|
|
13436
|
-
lastRunAt:
|
|
13437
|
-
retryStartedAt:
|
|
13438
|
-
consecutiveFailures:
|
|
13439
|
-
createdAt:
|
|
13440
|
-
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()
|
|
13441
13497
|
});
|
|
13442
|
-
var scheduleListResponseSchema =
|
|
13443
|
-
schedules:
|
|
13498
|
+
var scheduleListResponseSchema = z31.object({
|
|
13499
|
+
schedules: z31.array(scheduleResponseSchema)
|
|
13444
13500
|
});
|
|
13445
|
-
var deployScheduleResponseSchema =
|
|
13501
|
+
var deployScheduleResponseSchema = z31.object({
|
|
13446
13502
|
schedule: scheduleResponseSchema,
|
|
13447
|
-
created:
|
|
13503
|
+
created: z31.boolean()
|
|
13448
13504
|
});
|
|
13449
|
-
var zeroDeployScheduleRequestSchema =
|
|
13450
|
-
name:
|
|
13451
|
-
cronExpression:
|
|
13452
|
-
atTime:
|
|
13453
|
-
intervalSeconds:
|
|
13454
|
-
timezone:
|
|
13455
|
-
prompt:
|
|
13456
|
-
description:
|
|
13457
|
-
appendSystemPrompt:
|
|
13458
|
-
artifactName:
|
|
13459
|
-
artifactVersion:
|
|
13460
|
-
volumeVersions:
|
|
13461
|
-
zeroAgentId:
|
|
13462
|
-
composeId:
|
|
13463
|
-
enabled:
|
|
13464
|
-
notifyEmail:
|
|
13465
|
-
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()
|
|
13466
13522
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13467
13523
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13468
13524
|
}).refine(
|
|
@@ -13478,7 +13534,7 @@ var zeroDeployScheduleRequestSchema = z32.object({
|
|
|
13478
13534
|
message: "Exactly one of 'cronExpression', 'atTime', or 'intervalSeconds' must be specified"
|
|
13479
13535
|
}
|
|
13480
13536
|
);
|
|
13481
|
-
var zeroSchedulesMainContract =
|
|
13537
|
+
var zeroSchedulesMainContract = c25.router({
|
|
13482
13538
|
deploy: {
|
|
13483
13539
|
method: "POST",
|
|
13484
13540
|
path: "/api/zero/schedules",
|
|
@@ -13506,22 +13562,22 @@ var zeroSchedulesMainContract = c26.router({
|
|
|
13506
13562
|
summary: "List all schedules (zero proxy)"
|
|
13507
13563
|
}
|
|
13508
13564
|
});
|
|
13509
|
-
var zeroSchedulesByNameContract =
|
|
13565
|
+
var zeroSchedulesByNameContract = c25.router({
|
|
13510
13566
|
delete: {
|
|
13511
13567
|
method: "DELETE",
|
|
13512
13568
|
path: "/api/zero/schedules/:name",
|
|
13513
13569
|
headers: authHeadersSchema,
|
|
13514
|
-
pathParams:
|
|
13515
|
-
name:
|
|
13570
|
+
pathParams: z31.object({
|
|
13571
|
+
name: z31.string().min(1, "Schedule name required")
|
|
13516
13572
|
}),
|
|
13517
|
-
query:
|
|
13518
|
-
zeroAgentId:
|
|
13519
|
-
composeId:
|
|
13573
|
+
query: z31.object({
|
|
13574
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13575
|
+
composeId: z31.string().uuid("Invalid compose ID").optional()
|
|
13520
13576
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13521
13577
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13522
13578
|
}),
|
|
13523
13579
|
responses: {
|
|
13524
|
-
204:
|
|
13580
|
+
204: c25.noBody(),
|
|
13525
13581
|
401: apiErrorSchema,
|
|
13526
13582
|
403: apiErrorSchema,
|
|
13527
13583
|
404: apiErrorSchema
|
|
@@ -13529,17 +13585,17 @@ var zeroSchedulesByNameContract = c26.router({
|
|
|
13529
13585
|
summary: "Delete schedule (zero proxy)"
|
|
13530
13586
|
}
|
|
13531
13587
|
});
|
|
13532
|
-
var zeroSchedulesEnableContract =
|
|
13588
|
+
var zeroSchedulesEnableContract = c25.router({
|
|
13533
13589
|
enable: {
|
|
13534
13590
|
method: "POST",
|
|
13535
13591
|
path: "/api/zero/schedules/:name/enable",
|
|
13536
13592
|
headers: authHeadersSchema,
|
|
13537
|
-
pathParams:
|
|
13538
|
-
name:
|
|
13593
|
+
pathParams: z31.object({
|
|
13594
|
+
name: z31.string().min(1, "Schedule name required")
|
|
13539
13595
|
}),
|
|
13540
|
-
body:
|
|
13541
|
-
zeroAgentId:
|
|
13542
|
-
composeId:
|
|
13596
|
+
body: z31.object({
|
|
13597
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13598
|
+
composeId: z31.string().uuid("Invalid compose ID").optional()
|
|
13543
13599
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13544
13600
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13545
13601
|
}),
|
|
@@ -13556,12 +13612,12 @@ var zeroSchedulesEnableContract = c26.router({
|
|
|
13556
13612
|
method: "POST",
|
|
13557
13613
|
path: "/api/zero/schedules/:name/disable",
|
|
13558
13614
|
headers: authHeadersSchema,
|
|
13559
|
-
pathParams:
|
|
13560
|
-
name:
|
|
13615
|
+
pathParams: z31.object({
|
|
13616
|
+
name: z31.string().min(1, "Schedule name required")
|
|
13561
13617
|
}),
|
|
13562
|
-
body:
|
|
13563
|
-
zeroAgentId:
|
|
13564
|
-
composeId:
|
|
13618
|
+
body: z31.object({
|
|
13619
|
+
zeroAgentId: z31.string().uuid("Invalid agent ID").optional(),
|
|
13620
|
+
composeId: z31.string().uuid("Invalid compose ID").optional()
|
|
13565
13621
|
}).refine((data) => Boolean(data.zeroAgentId ?? data.composeId), {
|
|
13566
13622
|
message: "Either 'zeroAgentId' or 'composeId' must be provided"
|
|
13567
13623
|
}),
|
|
@@ -13577,9 +13633,9 @@ var zeroSchedulesEnableContract = c26.router({
|
|
|
13577
13633
|
});
|
|
13578
13634
|
|
|
13579
13635
|
// ../../packages/core/src/contracts/zero-model-providers.ts
|
|
13580
|
-
import { z as
|
|
13581
|
-
var
|
|
13582
|
-
var zeroModelProvidersMainContract =
|
|
13636
|
+
import { z as z32 } from "zod";
|
|
13637
|
+
var c26 = initContract();
|
|
13638
|
+
var zeroModelProvidersMainContract = c26.router({
|
|
13583
13639
|
list: {
|
|
13584
13640
|
method: "GET",
|
|
13585
13641
|
path: "/api/zero/model-providers",
|
|
@@ -13607,16 +13663,16 @@ var zeroModelProvidersMainContract = c27.router({
|
|
|
13607
13663
|
summary: "Create or update an org-level model provider (admin only)"
|
|
13608
13664
|
}
|
|
13609
13665
|
});
|
|
13610
|
-
var zeroModelProvidersByTypeContract =
|
|
13666
|
+
var zeroModelProvidersByTypeContract = c26.router({
|
|
13611
13667
|
delete: {
|
|
13612
13668
|
method: "DELETE",
|
|
13613
13669
|
path: "/api/zero/model-providers/:type",
|
|
13614
13670
|
headers: authHeadersSchema,
|
|
13615
|
-
pathParams:
|
|
13671
|
+
pathParams: z32.object({
|
|
13616
13672
|
type: modelProviderTypeSchema
|
|
13617
13673
|
}),
|
|
13618
13674
|
responses: {
|
|
13619
|
-
204:
|
|
13675
|
+
204: c26.noBody(),
|
|
13620
13676
|
401: apiErrorSchema,
|
|
13621
13677
|
403: apiErrorSchema,
|
|
13622
13678
|
404: apiErrorSchema,
|
|
@@ -13625,15 +13681,15 @@ var zeroModelProvidersByTypeContract = c27.router({
|
|
|
13625
13681
|
summary: "Delete an org-level model provider (admin only)"
|
|
13626
13682
|
}
|
|
13627
13683
|
});
|
|
13628
|
-
var zeroModelProvidersDefaultContract =
|
|
13684
|
+
var zeroModelProvidersDefaultContract = c26.router({
|
|
13629
13685
|
setDefault: {
|
|
13630
13686
|
method: "POST",
|
|
13631
13687
|
path: "/api/zero/model-providers/:type/default",
|
|
13632
13688
|
headers: authHeadersSchema,
|
|
13633
|
-
pathParams:
|
|
13689
|
+
pathParams: z32.object({
|
|
13634
13690
|
type: modelProviderTypeSchema
|
|
13635
13691
|
}),
|
|
13636
|
-
body:
|
|
13692
|
+
body: z32.undefined(),
|
|
13637
13693
|
responses: {
|
|
13638
13694
|
200: modelProviderResponseSchema,
|
|
13639
13695
|
401: apiErrorSchema,
|
|
@@ -13644,12 +13700,12 @@ var zeroModelProvidersDefaultContract = c27.router({
|
|
|
13644
13700
|
summary: "Set org-level model provider as default (admin only)"
|
|
13645
13701
|
}
|
|
13646
13702
|
});
|
|
13647
|
-
var zeroModelProvidersUpdateModelContract =
|
|
13703
|
+
var zeroModelProvidersUpdateModelContract = c26.router({
|
|
13648
13704
|
updateModel: {
|
|
13649
13705
|
method: "PATCH",
|
|
13650
13706
|
path: "/api/zero/model-providers/:type/model",
|
|
13651
13707
|
headers: authHeadersSchema,
|
|
13652
|
-
pathParams:
|
|
13708
|
+
pathParams: z32.object({
|
|
13653
13709
|
type: modelProviderTypeSchema
|
|
13654
13710
|
}),
|
|
13655
13711
|
body: updateModelRequestSchema,
|
|
@@ -13665,8 +13721,8 @@ var zeroModelProvidersUpdateModelContract = c27.router({
|
|
|
13665
13721
|
});
|
|
13666
13722
|
|
|
13667
13723
|
// ../../packages/core/src/contracts/zero-user-preferences.ts
|
|
13668
|
-
var
|
|
13669
|
-
var zeroUserPreferencesContract =
|
|
13724
|
+
var c27 = initContract();
|
|
13725
|
+
var zeroUserPreferencesContract = c27.router({
|
|
13670
13726
|
get: {
|
|
13671
13727
|
method: "GET",
|
|
13672
13728
|
path: "/api/zero/user-preferences",
|
|
@@ -13694,9 +13750,9 @@ var zeroUserPreferencesContract = c28.router({
|
|
|
13694
13750
|
});
|
|
13695
13751
|
|
|
13696
13752
|
// ../../packages/core/src/contracts/zero-secrets.ts
|
|
13697
|
-
import { z as
|
|
13698
|
-
var
|
|
13699
|
-
var zeroSecretsContract =
|
|
13753
|
+
import { z as z33 } from "zod";
|
|
13754
|
+
var c28 = initContract();
|
|
13755
|
+
var zeroSecretsContract = c28.router({
|
|
13700
13756
|
list: {
|
|
13701
13757
|
method: "GET",
|
|
13702
13758
|
path: "/api/zero/secrets",
|
|
@@ -13723,16 +13779,16 @@ var zeroSecretsContract = c29.router({
|
|
|
13723
13779
|
summary: "Create or update a secret"
|
|
13724
13780
|
}
|
|
13725
13781
|
});
|
|
13726
|
-
var zeroSecretsByNameContract =
|
|
13782
|
+
var zeroSecretsByNameContract = c28.router({
|
|
13727
13783
|
delete: {
|
|
13728
13784
|
method: "DELETE",
|
|
13729
13785
|
path: "/api/zero/secrets/:name",
|
|
13730
13786
|
headers: authHeadersSchema,
|
|
13731
|
-
pathParams:
|
|
13787
|
+
pathParams: z33.object({
|
|
13732
13788
|
name: secretNameSchema
|
|
13733
13789
|
}),
|
|
13734
13790
|
responses: {
|
|
13735
|
-
204:
|
|
13791
|
+
204: c28.noBody(),
|
|
13736
13792
|
401: apiErrorSchema,
|
|
13737
13793
|
404: apiErrorSchema,
|
|
13738
13794
|
500: apiErrorSchema
|
|
@@ -13740,7 +13796,7 @@ var zeroSecretsByNameContract = c29.router({
|
|
|
13740
13796
|
summary: "Delete a secret by name"
|
|
13741
13797
|
}
|
|
13742
13798
|
});
|
|
13743
|
-
var zeroVariablesContract =
|
|
13799
|
+
var zeroVariablesContract = c28.router({
|
|
13744
13800
|
list: {
|
|
13745
13801
|
method: "GET",
|
|
13746
13802
|
path: "/api/zero/variables",
|
|
@@ -13767,16 +13823,16 @@ var zeroVariablesContract = c29.router({
|
|
|
13767
13823
|
summary: "Create or update a variable"
|
|
13768
13824
|
}
|
|
13769
13825
|
});
|
|
13770
|
-
var zeroVariablesByNameContract =
|
|
13826
|
+
var zeroVariablesByNameContract = c28.router({
|
|
13771
13827
|
delete: {
|
|
13772
13828
|
method: "DELETE",
|
|
13773
13829
|
path: "/api/zero/variables/:name",
|
|
13774
13830
|
headers: authHeadersSchema,
|
|
13775
|
-
pathParams:
|
|
13831
|
+
pathParams: z33.object({
|
|
13776
13832
|
name: variableNameSchema
|
|
13777
13833
|
}),
|
|
13778
13834
|
responses: {
|
|
13779
|
-
204:
|
|
13835
|
+
204: c28.noBody(),
|
|
13780
13836
|
401: apiErrorSchema,
|
|
13781
13837
|
404: apiErrorSchema,
|
|
13782
13838
|
500: apiErrorSchema
|
|
@@ -13786,15 +13842,15 @@ var zeroVariablesByNameContract = c29.router({
|
|
|
13786
13842
|
});
|
|
13787
13843
|
|
|
13788
13844
|
// ../../packages/core/src/contracts/zero-sessions.ts
|
|
13789
|
-
import { z as
|
|
13790
|
-
var
|
|
13791
|
-
var zeroSessionsByIdContract =
|
|
13845
|
+
import { z as z34 } from "zod";
|
|
13846
|
+
var c29 = initContract();
|
|
13847
|
+
var zeroSessionsByIdContract = c29.router({
|
|
13792
13848
|
getById: {
|
|
13793
13849
|
method: "GET",
|
|
13794
13850
|
path: "/api/zero/sessions/:id",
|
|
13795
13851
|
headers: authHeadersSchema,
|
|
13796
|
-
pathParams:
|
|
13797
|
-
id:
|
|
13852
|
+
pathParams: z34.object({
|
|
13853
|
+
id: z34.string().min(1, "Session ID is required")
|
|
13798
13854
|
}),
|
|
13799
13855
|
responses: {
|
|
13800
13856
|
200: sessionResponseSchema,
|
|
@@ -13807,24 +13863,24 @@ var zeroSessionsByIdContract = c30.router({
|
|
|
13807
13863
|
});
|
|
13808
13864
|
|
|
13809
13865
|
// ../../packages/core/src/contracts/integrations.ts
|
|
13810
|
-
import { z as
|
|
13811
|
-
var
|
|
13812
|
-
var integrationsSlackMessageContract =
|
|
13866
|
+
import { z as z35 } from "zod";
|
|
13867
|
+
var c30 = initContract();
|
|
13868
|
+
var integrationsSlackMessageContract = c30.router({
|
|
13813
13869
|
sendMessage: {
|
|
13814
13870
|
method: "POST",
|
|
13815
|
-
path: "/api/
|
|
13871
|
+
path: "/api/zero/integrations/slack/message",
|
|
13816
13872
|
headers: authHeadersSchema,
|
|
13817
|
-
body:
|
|
13818
|
-
channel:
|
|
13819
|
-
text:
|
|
13820
|
-
threadTs:
|
|
13821
|
-
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()
|
|
13822
13878
|
}),
|
|
13823
13879
|
responses: {
|
|
13824
|
-
200:
|
|
13825
|
-
ok:
|
|
13826
|
-
ts:
|
|
13827
|
-
channel:
|
|
13880
|
+
200: z35.object({
|
|
13881
|
+
ok: z35.literal(true),
|
|
13882
|
+
ts: z35.string().optional(),
|
|
13883
|
+
channel: z35.string().optional()
|
|
13828
13884
|
}),
|
|
13829
13885
|
400: apiErrorSchema,
|
|
13830
13886
|
401: apiErrorSchema,
|
|
@@ -13836,41 +13892,41 @@ var integrationsSlackMessageContract = c31.router({
|
|
|
13836
13892
|
});
|
|
13837
13893
|
|
|
13838
13894
|
// ../../packages/core/src/contracts/zero-billing.ts
|
|
13839
|
-
import { z as
|
|
13840
|
-
var
|
|
13841
|
-
var autoRechargeSchema =
|
|
13842
|
-
enabled:
|
|
13843
|
-
threshold:
|
|
13844
|
-
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()
|
|
13845
13901
|
});
|
|
13846
|
-
var billingStatusResponseSchema =
|
|
13847
|
-
tier:
|
|
13848
|
-
credits:
|
|
13849
|
-
subscriptionStatus:
|
|
13850
|
-
currentPeriodEnd:
|
|
13851
|
-
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(),
|
|
13852
13908
|
autoRecharge: autoRechargeSchema
|
|
13853
13909
|
});
|
|
13854
|
-
var checkoutResponseSchema =
|
|
13855
|
-
url:
|
|
13910
|
+
var checkoutResponseSchema = z36.object({
|
|
13911
|
+
url: z36.string()
|
|
13856
13912
|
});
|
|
13857
|
-
var portalResponseSchema =
|
|
13858
|
-
url:
|
|
13913
|
+
var portalResponseSchema = z36.object({
|
|
13914
|
+
url: z36.string()
|
|
13859
13915
|
});
|
|
13860
|
-
var checkoutRequestSchema =
|
|
13861
|
-
tier:
|
|
13862
|
-
successUrl:
|
|
13863
|
-
cancelUrl:
|
|
13916
|
+
var checkoutRequestSchema = z36.object({
|
|
13917
|
+
tier: z36.enum(["pro", "team"]),
|
|
13918
|
+
successUrl: z36.string().url(),
|
|
13919
|
+
cancelUrl: z36.string().url()
|
|
13864
13920
|
});
|
|
13865
|
-
var portalRequestSchema =
|
|
13866
|
-
returnUrl:
|
|
13921
|
+
var portalRequestSchema = z36.object({
|
|
13922
|
+
returnUrl: z36.string().min(1)
|
|
13867
13923
|
});
|
|
13868
|
-
var autoRechargeUpdateRequestSchema =
|
|
13869
|
-
enabled:
|
|
13870
|
-
threshold:
|
|
13871
|
-
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()
|
|
13872
13928
|
});
|
|
13873
|
-
var zeroBillingStatusContract =
|
|
13929
|
+
var zeroBillingStatusContract = c31.router({
|
|
13874
13930
|
get: {
|
|
13875
13931
|
method: "GET",
|
|
13876
13932
|
path: "/api/zero/billing/status",
|
|
@@ -13883,7 +13939,7 @@ var zeroBillingStatusContract = c32.router({
|
|
|
13883
13939
|
summary: "Get billing status for current org"
|
|
13884
13940
|
}
|
|
13885
13941
|
});
|
|
13886
|
-
var zeroBillingCheckoutContract =
|
|
13942
|
+
var zeroBillingCheckoutContract = c31.router({
|
|
13887
13943
|
create: {
|
|
13888
13944
|
method: "POST",
|
|
13889
13945
|
path: "/api/zero/billing/checkout",
|
|
@@ -13899,7 +13955,7 @@ var zeroBillingCheckoutContract = c32.router({
|
|
|
13899
13955
|
summary: "Create Stripe checkout session"
|
|
13900
13956
|
}
|
|
13901
13957
|
});
|
|
13902
|
-
var zeroBillingPortalContract =
|
|
13958
|
+
var zeroBillingPortalContract = c31.router({
|
|
13903
13959
|
create: {
|
|
13904
13960
|
method: "POST",
|
|
13905
13961
|
path: "/api/zero/billing/portal",
|
|
@@ -13915,7 +13971,7 @@ var zeroBillingPortalContract = c32.router({
|
|
|
13915
13971
|
summary: "Create Stripe billing portal session"
|
|
13916
13972
|
}
|
|
13917
13973
|
});
|
|
13918
|
-
var zeroBillingAutoRechargeContract =
|
|
13974
|
+
var zeroBillingAutoRechargeContract = c31.router({
|
|
13919
13975
|
get: {
|
|
13920
13976
|
method: "GET",
|
|
13921
13977
|
path: "/api/zero/billing/auto-recharge",
|
|
@@ -13944,25 +14000,25 @@ var zeroBillingAutoRechargeContract = c32.router({
|
|
|
13944
14000
|
});
|
|
13945
14001
|
|
|
13946
14002
|
// ../../packages/core/src/contracts/zero-usage.ts
|
|
13947
|
-
import { z as
|
|
13948
|
-
var
|
|
13949
|
-
var memberUsageSchema =
|
|
13950
|
-
userId:
|
|
13951
|
-
email:
|
|
13952
|
-
inputTokens:
|
|
13953
|
-
outputTokens:
|
|
13954
|
-
cacheReadInputTokens:
|
|
13955
|
-
cacheCreationInputTokens:
|
|
13956
|
-
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()
|
|
13957
14013
|
});
|
|
13958
|
-
var usageMembersResponseSchema =
|
|
13959
|
-
period:
|
|
13960
|
-
start:
|
|
13961
|
-
end:
|
|
14014
|
+
var usageMembersResponseSchema = z37.object({
|
|
14015
|
+
period: z37.object({
|
|
14016
|
+
start: z37.string(),
|
|
14017
|
+
end: z37.string()
|
|
13962
14018
|
}).nullable(),
|
|
13963
|
-
members:
|
|
14019
|
+
members: z37.array(memberUsageSchema)
|
|
13964
14020
|
});
|
|
13965
|
-
var zeroUsageMembersContract =
|
|
14021
|
+
var zeroUsageMembersContract = c32.router({
|
|
13966
14022
|
get: {
|
|
13967
14023
|
method: "GET",
|
|
13968
14024
|
path: "/api/zero/usage/members",
|
|
@@ -14460,16 +14516,16 @@ async function getLatestVersion() {
|
|
|
14460
14516
|
}
|
|
14461
14517
|
}
|
|
14462
14518
|
function performUpgrade(packageManager) {
|
|
14463
|
-
return new Promise((
|
|
14519
|
+
return new Promise((resolve) => {
|
|
14464
14520
|
const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
|
|
14465
14521
|
const child = safeSpawn(packageManager, args, {
|
|
14466
14522
|
stdio: "inherit"
|
|
14467
14523
|
});
|
|
14468
14524
|
child.on("close", (code) => {
|
|
14469
|
-
|
|
14525
|
+
resolve(code === 0);
|
|
14470
14526
|
});
|
|
14471
14527
|
child.on("error", () => {
|
|
14472
|
-
|
|
14528
|
+
resolve(false);
|
|
14473
14529
|
});
|
|
14474
14530
|
});
|
|
14475
14531
|
}
|
|
@@ -14545,9 +14601,9 @@ async function startSilentUpgrade(currentVersion) {
|
|
|
14545
14601
|
detached: !isWindows,
|
|
14546
14602
|
windowsHide: true
|
|
14547
14603
|
});
|
|
14548
|
-
const promise = new Promise((
|
|
14549
|
-
child.on("close", (code) =>
|
|
14550
|
-
child.on("error", () =>
|
|
14604
|
+
const promise = new Promise((resolve) => {
|
|
14605
|
+
child.on("close", (code) => resolve(code === 0));
|
|
14606
|
+
child.on("error", () => resolve(false));
|
|
14551
14607
|
});
|
|
14552
14608
|
pendingUpgrade = { promise, child, packageManager };
|
|
14553
14609
|
}
|
|
@@ -14559,10 +14615,10 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
|
|
|
14559
14615
|
pendingUpgrade = null;
|
|
14560
14616
|
const result = await Promise.race([
|
|
14561
14617
|
promise,
|
|
14562
|
-
new Promise((
|
|
14618
|
+
new Promise((resolve) => {
|
|
14563
14619
|
setTimeout(() => {
|
|
14564
14620
|
child.kill();
|
|
14565
|
-
|
|
14621
|
+
resolve(false);
|
|
14566
14622
|
}, timeout);
|
|
14567
14623
|
})
|
|
14568
14624
|
]);
|
|
@@ -14581,7 +14637,7 @@ function getConfigPath() {
|
|
|
14581
14637
|
return join2(homedir2(), ".vm0", "config.json");
|
|
14582
14638
|
}
|
|
14583
14639
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
14584
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
14640
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.78.0"}`));
|
|
14585
14641
|
console.log();
|
|
14586
14642
|
const config = await loadConfig();
|
|
14587
14643
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -14618,61 +14674,6 @@ import { existsSync as existsSync5 } from "fs";
|
|
|
14618
14674
|
import { dirname as dirname2, join as join8 } from "path";
|
|
14619
14675
|
import { parse as parseYaml3 } from "yaml";
|
|
14620
14676
|
|
|
14621
|
-
// src/lib/api/core/http.ts
|
|
14622
|
-
async function appendOrgParam(path18) {
|
|
14623
|
-
const activeOrg = await getActiveOrg();
|
|
14624
|
-
if (!activeOrg) {
|
|
14625
|
-
throw new Error(
|
|
14626
|
-
"No active organization configured. Run: vm0 org use <slug>"
|
|
14627
|
-
);
|
|
14628
|
-
}
|
|
14629
|
-
const queryStart = path18.indexOf("?");
|
|
14630
|
-
if (queryStart !== -1) {
|
|
14631
|
-
const params = new URLSearchParams(path18.slice(queryStart));
|
|
14632
|
-
if (params.has("org")) {
|
|
14633
|
-
return path18;
|
|
14634
|
-
}
|
|
14635
|
-
return `${path18}&org=${encodeURIComponent(activeOrg)}`;
|
|
14636
|
-
}
|
|
14637
|
-
return `${path18}?org=${encodeURIComponent(activeOrg)}`;
|
|
14638
|
-
}
|
|
14639
|
-
async function getRawHeaders() {
|
|
14640
|
-
const token = await getActiveToken();
|
|
14641
|
-
if (!token) {
|
|
14642
|
-
throw new Error("Not authenticated. Run: vm0 auth login");
|
|
14643
|
-
}
|
|
14644
|
-
const headers = {
|
|
14645
|
-
Authorization: `Bearer ${token}`
|
|
14646
|
-
};
|
|
14647
|
-
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
14648
|
-
if (bypassSecret) {
|
|
14649
|
-
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
14650
|
-
}
|
|
14651
|
-
return headers;
|
|
14652
|
-
}
|
|
14653
|
-
async function httpGet(path18) {
|
|
14654
|
-
const baseUrl = await getBaseUrl();
|
|
14655
|
-
const headers = await getRawHeaders();
|
|
14656
|
-
const orgPath = await appendOrgParam(path18);
|
|
14657
|
-
return fetch(`${baseUrl}${orgPath}`, {
|
|
14658
|
-
method: "GET",
|
|
14659
|
-
headers
|
|
14660
|
-
});
|
|
14661
|
-
}
|
|
14662
|
-
async function httpPost(path18, body) {
|
|
14663
|
-
const baseUrl = await getBaseUrl();
|
|
14664
|
-
const headers = await getRawHeaders();
|
|
14665
|
-
const orgPath = await appendOrgParam(path18);
|
|
14666
|
-
return fetch(`${baseUrl}${orgPath}`, {
|
|
14667
|
-
method: "POST",
|
|
14668
|
-
headers: {
|
|
14669
|
-
...headers,
|
|
14670
|
-
"Content-Type": "application/json"
|
|
14671
|
-
},
|
|
14672
|
-
body: JSON.stringify(body)
|
|
14673
|
-
});
|
|
14674
|
-
}
|
|
14675
|
-
|
|
14676
14677
|
// src/lib/api/domains/composes.ts
|
|
14677
14678
|
import { initClient } from "@ts-rest/core";
|
|
14678
14679
|
async function getComposeByName(name, org) {
|
|
@@ -14722,17 +14723,6 @@ async function createOrUpdateCompose(body) {
|
|
|
14722
14723
|
}
|
|
14723
14724
|
handleError(result, "Failed to create compose");
|
|
14724
14725
|
}
|
|
14725
|
-
async function deleteCompose(id) {
|
|
14726
|
-
const config = await getClientConfig();
|
|
14727
|
-
const client = initClient(composesByIdContract, config);
|
|
14728
|
-
const result = await client.delete({
|
|
14729
|
-
params: { id }
|
|
14730
|
-
});
|
|
14731
|
-
if (result.status === 204) {
|
|
14732
|
-
return;
|
|
14733
|
-
}
|
|
14734
|
-
handleError(result, "Failed to delete agent");
|
|
14735
|
-
}
|
|
14736
14726
|
|
|
14737
14727
|
// src/lib/api/domains/runs.ts
|
|
14738
14728
|
import { initClient as initClient2 } from "@ts-rest/core";
|
|
@@ -14928,6 +14918,52 @@ async function updateUserPreferences(body) {
|
|
|
14928
14918
|
handleError(result, "Failed to update user preferences");
|
|
14929
14919
|
}
|
|
14930
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
|
+
|
|
14931
14967
|
// src/lib/api/domains/skills.ts
|
|
14932
14968
|
import chalk5 from "chalk";
|
|
14933
14969
|
function isResolveSkillsResponse(value) {
|
|
@@ -15300,20 +15336,100 @@ async function updateZeroAgentInstructions(name, content) {
|
|
|
15300
15336
|
handleError(result, `Failed to update instructions for zero agent "${name}"`);
|
|
15301
15337
|
}
|
|
15302
15338
|
|
|
15303
|
-
// src/lib/api/domains/zero-
|
|
15339
|
+
// src/lib/api/domains/zero-connectors.ts
|
|
15304
15340
|
import { initClient as initClient14 } from "@ts-rest/core";
|
|
15305
|
-
async function
|
|
15341
|
+
async function listZeroConnectors() {
|
|
15306
15342
|
const config = await getClientConfig();
|
|
15307
|
-
const client = initClient14(
|
|
15308
|
-
const result = await client.
|
|
15309
|
-
if (result.status === 200
|
|
15310
|
-
return result.body;
|
|
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";
|
|
15421
|
+
async function deployZeroSchedule(body) {
|
|
15422
|
+
const config = await getClientConfig();
|
|
15423
|
+
const client = initClient15(zeroSchedulesMainContract, config);
|
|
15424
|
+
const result = await client.deploy({ body });
|
|
15425
|
+
if (result.status === 200 || result.status === 201) {
|
|
15426
|
+
return result.body;
|
|
15311
15427
|
}
|
|
15312
15428
|
handleError(result, "Failed to deploy schedule");
|
|
15313
15429
|
}
|
|
15314
15430
|
async function listZeroSchedules() {
|
|
15315
15431
|
const config = await getClientConfig();
|
|
15316
|
-
const client =
|
|
15432
|
+
const client = initClient15(zeroSchedulesMainContract, config);
|
|
15317
15433
|
const result = await client.list({ headers: {} });
|
|
15318
15434
|
if (result.status === 200) {
|
|
15319
15435
|
return result.body;
|
|
@@ -15322,7 +15438,7 @@ async function listZeroSchedules() {
|
|
|
15322
15438
|
}
|
|
15323
15439
|
async function deleteZeroSchedule(params) {
|
|
15324
15440
|
const config = await getClientConfig();
|
|
15325
|
-
const client =
|
|
15441
|
+
const client = initClient15(zeroSchedulesByNameContract, config);
|
|
15326
15442
|
const result = await client.delete({
|
|
15327
15443
|
params: { name: params.name },
|
|
15328
15444
|
query: { zeroAgentId: params.zeroAgentId }
|
|
@@ -15334,7 +15450,7 @@ async function deleteZeroSchedule(params) {
|
|
|
15334
15450
|
}
|
|
15335
15451
|
async function enableZeroSchedule(params) {
|
|
15336
15452
|
const config = await getClientConfig();
|
|
15337
|
-
const client =
|
|
15453
|
+
const client = initClient15(zeroSchedulesEnableContract, config);
|
|
15338
15454
|
const result = await client.enable({
|
|
15339
15455
|
params: { name: params.name },
|
|
15340
15456
|
body: { zeroAgentId: params.zeroAgentId }
|
|
@@ -15346,7 +15462,7 @@ async function enableZeroSchedule(params) {
|
|
|
15346
15462
|
}
|
|
15347
15463
|
async function disableZeroSchedule(params) {
|
|
15348
15464
|
const config = await getClientConfig();
|
|
15349
|
-
const client =
|
|
15465
|
+
const client = initClient15(zeroSchedulesEnableContract, config);
|
|
15350
15466
|
const result = await client.disable({
|
|
15351
15467
|
params: { name: params.name },
|
|
15352
15468
|
body: { zeroAgentId: params.zeroAgentId }
|
|
@@ -15382,8 +15498,8 @@ async function resolveZeroScheduleByAgent(agentName, scheduleName) {
|
|
|
15382
15498
|
}
|
|
15383
15499
|
|
|
15384
15500
|
// src/lib/domain/yaml-validator.ts
|
|
15385
|
-
import { z as
|
|
15386
|
-
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(
|
|
15387
15503
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
15388
15504
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
15389
15505
|
);
|
|
@@ -15397,7 +15513,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
15397
15513
|
resolveSkillRef(skillRef);
|
|
15398
15514
|
} catch (error) {
|
|
15399
15515
|
ctx.addIssue({
|
|
15400
|
-
code:
|
|
15516
|
+
code: z38.ZodIssueCode.custom,
|
|
15401
15517
|
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
15402
15518
|
path: ["skills", i]
|
|
15403
15519
|
});
|
|
@@ -15407,15 +15523,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
15407
15523
|
}
|
|
15408
15524
|
}
|
|
15409
15525
|
);
|
|
15410
|
-
var cliComposeSchema =
|
|
15411
|
-
version:
|
|
15412
|
-
agents:
|
|
15413
|
-
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()
|
|
15414
15530
|
}).superRefine((config, ctx) => {
|
|
15415
15531
|
const agentKeys = Object.keys(config.agents);
|
|
15416
15532
|
if (agentKeys.length === 0) {
|
|
15417
15533
|
ctx.addIssue({
|
|
15418
|
-
code:
|
|
15534
|
+
code: z38.ZodIssueCode.custom,
|
|
15419
15535
|
message: "agents must have at least one agent defined",
|
|
15420
15536
|
path: ["agents"]
|
|
15421
15537
|
});
|
|
@@ -15423,7 +15539,7 @@ var cliComposeSchema = z39.object({
|
|
|
15423
15539
|
}
|
|
15424
15540
|
if (agentKeys.length > 1) {
|
|
15425
15541
|
ctx.addIssue({
|
|
15426
|
-
code:
|
|
15542
|
+
code: z38.ZodIssueCode.custom,
|
|
15427
15543
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
15428
15544
|
path: ["agents"]
|
|
15429
15545
|
});
|
|
@@ -15435,7 +15551,7 @@ var cliComposeSchema = z39.object({
|
|
|
15435
15551
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
15436
15552
|
if (!config.volumes) {
|
|
15437
15553
|
ctx.addIssue({
|
|
15438
|
-
code:
|
|
15554
|
+
code: z38.ZodIssueCode.custom,
|
|
15439
15555
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
15440
15556
|
path: ["volumes"]
|
|
15441
15557
|
});
|
|
@@ -15445,7 +15561,7 @@ var cliComposeSchema = z39.object({
|
|
|
15445
15561
|
const parts = volDeclaration.split(":");
|
|
15446
15562
|
if (parts.length !== 2) {
|
|
15447
15563
|
ctx.addIssue({
|
|
15448
|
-
code:
|
|
15564
|
+
code: z38.ZodIssueCode.custom,
|
|
15449
15565
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
15450
15566
|
path: ["agents", agentName, "volumes"]
|
|
15451
15567
|
});
|
|
@@ -15454,7 +15570,7 @@ var cliComposeSchema = z39.object({
|
|
|
15454
15570
|
const volumeKey = parts[0].trim();
|
|
15455
15571
|
if (!config.volumes[volumeKey]) {
|
|
15456
15572
|
ctx.addIssue({
|
|
15457
|
-
code:
|
|
15573
|
+
code: z38.ZodIssueCode.custom,
|
|
15458
15574
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
15459
15575
|
path: ["volumes", volumeKey]
|
|
15460
15576
|
});
|
|
@@ -15462,29 +15578,29 @@ var cliComposeSchema = z39.object({
|
|
|
15462
15578
|
}
|
|
15463
15579
|
}
|
|
15464
15580
|
});
|
|
15465
|
-
function formatInvalidTypeIssue(
|
|
15581
|
+
function formatInvalidTypeIssue(path17, issue) {
|
|
15466
15582
|
const received = issue.received;
|
|
15467
15583
|
const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
|
|
15468
|
-
if (
|
|
15584
|
+
if (path17 === "version" && isMissing) {
|
|
15469
15585
|
return "Missing config.version";
|
|
15470
15586
|
}
|
|
15471
|
-
if (
|
|
15587
|
+
if (path17 === "agents" && isMissing) {
|
|
15472
15588
|
return "Missing agents object in config";
|
|
15473
15589
|
}
|
|
15474
|
-
if (
|
|
15475
|
-
const volumeKey =
|
|
15590
|
+
if (path17.startsWith("volumes.") && path17.endsWith(".name")) {
|
|
15591
|
+
const volumeKey = path17.split(".")[1];
|
|
15476
15592
|
return `Volume "${volumeKey}" must have a 'name' field (string)`;
|
|
15477
15593
|
}
|
|
15478
|
-
if (
|
|
15479
|
-
const volumeKey =
|
|
15594
|
+
if (path17.startsWith("volumes.") && path17.endsWith(".version")) {
|
|
15595
|
+
const volumeKey = path17.split(".")[1];
|
|
15480
15596
|
return `Volume "${volumeKey}" must have a 'version' field (string)`;
|
|
15481
15597
|
}
|
|
15482
15598
|
if (issue.expected === "array") {
|
|
15483
|
-
const fieldName =
|
|
15599
|
+
const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
15484
15600
|
return `${fieldName} must be an array`;
|
|
15485
15601
|
}
|
|
15486
15602
|
if (issue.expected === "string" && received === "number") {
|
|
15487
|
-
const fieldName =
|
|
15603
|
+
const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
15488
15604
|
const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
|
|
15489
15605
|
if (match) {
|
|
15490
15606
|
return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
|
|
@@ -15495,24 +15611,24 @@ function formatInvalidTypeIssue(path18, issue) {
|
|
|
15495
15611
|
function formatZodError(error) {
|
|
15496
15612
|
const issue = error.issues[0];
|
|
15497
15613
|
if (!issue) return "Validation failed";
|
|
15498
|
-
const
|
|
15614
|
+
const path17 = issue.path.join(".");
|
|
15499
15615
|
const message = issue.message;
|
|
15500
|
-
if (!
|
|
15616
|
+
if (!path17) return message;
|
|
15501
15617
|
if (issue.code === "invalid_type") {
|
|
15502
|
-
const formatted = formatInvalidTypeIssue(
|
|
15618
|
+
const formatted = formatInvalidTypeIssue(path17, issue);
|
|
15503
15619
|
if (formatted) return formatted;
|
|
15504
15620
|
}
|
|
15505
|
-
if (issue.code === "invalid_key" &&
|
|
15621
|
+
if (issue.code === "invalid_key" && path17.startsWith("agents.")) {
|
|
15506
15622
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
15507
15623
|
}
|
|
15508
|
-
if (message === "Invalid key in record" &&
|
|
15624
|
+
if (message === "Invalid key in record" && path17.startsWith("agents.")) {
|
|
15509
15625
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
15510
15626
|
}
|
|
15511
15627
|
if (issue.code === "custom") {
|
|
15512
15628
|
return message;
|
|
15513
15629
|
}
|
|
15514
|
-
if (
|
|
15515
|
-
const cleanPath =
|
|
15630
|
+
if (path17.startsWith("agents.")) {
|
|
15631
|
+
const cleanPath = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
15516
15632
|
if (message.startsWith("Invalid input:")) {
|
|
15517
15633
|
const match = message.match(/expected (\w+), received (\w+)/);
|
|
15518
15634
|
if (match && match[1] === "string" && match[2] === "number") {
|
|
@@ -15524,7 +15640,7 @@ function formatZodError(error) {
|
|
|
15524
15640
|
}
|
|
15525
15641
|
return `${cleanPath}: ${message}`;
|
|
15526
15642
|
}
|
|
15527
|
-
return `${
|
|
15643
|
+
return `${path17}: ${message}`;
|
|
15528
15644
|
}
|
|
15529
15645
|
function validateAgentName(name) {
|
|
15530
15646
|
return cliAgentNameSchema.safeParse(name).success;
|
|
@@ -15873,7 +15989,7 @@ function excludeVm0Filter(filePath) {
|
|
|
15873
15989
|
return !shouldExclude;
|
|
15874
15990
|
}
|
|
15875
15991
|
function listTarFiles(tarPath) {
|
|
15876
|
-
return new Promise((
|
|
15992
|
+
return new Promise((resolve, reject) => {
|
|
15877
15993
|
const files = [];
|
|
15878
15994
|
tar.list({
|
|
15879
15995
|
file: tarPath,
|
|
@@ -15882,7 +15998,7 @@ function listTarFiles(tarPath) {
|
|
|
15882
15998
|
files.push(entry.path);
|
|
15883
15999
|
}
|
|
15884
16000
|
}
|
|
15885
|
-
}).then(() =>
|
|
16001
|
+
}).then(() => resolve(files)).catch(reject);
|
|
15886
16002
|
});
|
|
15887
16003
|
}
|
|
15888
16004
|
async function listLocalFiles(dir, excludeDirs = [".vm0"]) {
|
|
@@ -15944,11 +16060,11 @@ async function removeEmptyDirs(dir, excludeDirs = [".vm0"]) {
|
|
|
15944
16060
|
|
|
15945
16061
|
// src/lib/storage/direct-upload.ts
|
|
15946
16062
|
async function hashFileStream(filePath) {
|
|
15947
|
-
return new Promise((
|
|
16063
|
+
return new Promise((resolve, reject) => {
|
|
15948
16064
|
const hash = createHash("sha256");
|
|
15949
16065
|
const stream = fs4.createReadStream(filePath);
|
|
15950
16066
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
15951
|
-
stream.on("end", () =>
|
|
16067
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
15952
16068
|
stream.on("error", reject);
|
|
15953
16069
|
});
|
|
15954
16070
|
}
|
|
@@ -16033,7 +16149,7 @@ function createManifest(files) {
|
|
|
16033
16149
|
return Buffer.from(JSON.stringify(manifest, null, 2));
|
|
16034
16150
|
}
|
|
16035
16151
|
function sleep(ms) {
|
|
16036
|
-
return new Promise((
|
|
16152
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
16037
16153
|
}
|
|
16038
16154
|
async function uploadToPresignedUrl(presignedUrl, data, contentType, maxRetries = 3) {
|
|
16039
16155
|
let lastError = null;
|
|
@@ -16653,7 +16769,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
16653
16769
|
options.autoUpdate = false;
|
|
16654
16770
|
}
|
|
16655
16771
|
if (options.autoUpdate !== false) {
|
|
16656
|
-
await startSilentUpgrade("9.
|
|
16772
|
+
await startSilentUpgrade("9.78.0");
|
|
16657
16773
|
}
|
|
16658
16774
|
try {
|
|
16659
16775
|
let result;
|
|
@@ -17415,7 +17531,7 @@ async function pollEvents(runId, options) {
|
|
|
17415
17531
|
result = { succeeded: false, runId };
|
|
17416
17532
|
}
|
|
17417
17533
|
if (!complete) {
|
|
17418
|
-
await new Promise((
|
|
17534
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
17419
17535
|
}
|
|
17420
17536
|
}
|
|
17421
17537
|
return result;
|
|
@@ -17488,7 +17604,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
17488
17604
|
withErrorHandler(
|
|
17489
17605
|
async (identifier, prompt, options) => {
|
|
17490
17606
|
if (options.autoUpdate !== false) {
|
|
17491
|
-
await startSilentUpgrade("9.
|
|
17607
|
+
await startSilentUpgrade("9.78.0");
|
|
17492
17608
|
}
|
|
17493
17609
|
const { org, name, version } = parseIdentifier(identifier);
|
|
17494
17610
|
let composeId;
|
|
@@ -18984,7 +19100,7 @@ function printCommand(cmd) {
|
|
|
18984
19100
|
console.log(chalk33.dim(`> ${cmd}`));
|
|
18985
19101
|
}
|
|
18986
19102
|
function execVm0Command(args, options = {}) {
|
|
18987
|
-
return new Promise((
|
|
19103
|
+
return new Promise((resolve, reject) => {
|
|
18988
19104
|
const stdio = options.silent ? "pipe" : "inherit";
|
|
18989
19105
|
const proc = safeSpawn("vm0", args, {
|
|
18990
19106
|
cwd: options.cwd,
|
|
@@ -19002,7 +19118,7 @@ function execVm0Command(args, options = {}) {
|
|
|
19002
19118
|
}
|
|
19003
19119
|
proc.on("close", (code) => {
|
|
19004
19120
|
if (code === 0) {
|
|
19005
|
-
|
|
19121
|
+
resolve(stdout);
|
|
19006
19122
|
} else {
|
|
19007
19123
|
reject(new Error(stderr || `Command failed with exit code ${code}`));
|
|
19008
19124
|
}
|
|
@@ -19013,7 +19129,7 @@ function execVm0Command(args, options = {}) {
|
|
|
19013
19129
|
});
|
|
19014
19130
|
}
|
|
19015
19131
|
function execVm0RunWithCapture(args, options = {}) {
|
|
19016
|
-
return new Promise((
|
|
19132
|
+
return new Promise((resolve, reject) => {
|
|
19017
19133
|
const env = process.stdout.isTTY ? { ...process.env, FORCE_COLOR: "1" } : process.env;
|
|
19018
19134
|
const proc = safeSpawn("vm0", args, {
|
|
19019
19135
|
cwd: options.cwd,
|
|
@@ -19034,7 +19150,7 @@ function execVm0RunWithCapture(args, options = {}) {
|
|
|
19034
19150
|
});
|
|
19035
19151
|
proc.on("close", (code) => {
|
|
19036
19152
|
if (code === 0) {
|
|
19037
|
-
|
|
19153
|
+
resolve(stdout);
|
|
19038
19154
|
} else {
|
|
19039
19155
|
reject(new Error(stderr || `Command failed with exit code ${code}`));
|
|
19040
19156
|
}
|
|
@@ -19244,7 +19360,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
19244
19360
|
withErrorHandler(
|
|
19245
19361
|
async (prompt, options) => {
|
|
19246
19362
|
if (options.autoUpdate !== false) {
|
|
19247
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
19363
|
+
const shouldExit = await checkAndUpgrade("9.78.0", prompt);
|
|
19248
19364
|
if (shouldExit) {
|
|
19249
19365
|
process.exit(0);
|
|
19250
19366
|
}
|
|
@@ -19430,7 +19546,7 @@ import { Command as Command40 } from "commander";
|
|
|
19430
19546
|
import chalk36 from "chalk";
|
|
19431
19547
|
|
|
19432
19548
|
// src/lib/api/api-client.ts
|
|
19433
|
-
import { initClient as
|
|
19549
|
+
import { initClient as initClient16 } from "@ts-rest/core";
|
|
19434
19550
|
var ApiClient = class {
|
|
19435
19551
|
async getHeaders() {
|
|
19436
19552
|
const token = await getActiveToken();
|
|
@@ -19456,7 +19572,7 @@ var ApiClient = class {
|
|
|
19456
19572
|
async getComposeByName(name, org) {
|
|
19457
19573
|
const baseUrl = await this.getBaseUrl();
|
|
19458
19574
|
const headers = await this.getHeaders();
|
|
19459
|
-
const client =
|
|
19575
|
+
const client = initClient16(composesMainContract, {
|
|
19460
19576
|
baseUrl,
|
|
19461
19577
|
baseHeaders: headers,
|
|
19462
19578
|
jsonQuery: false
|
|
@@ -19477,7 +19593,7 @@ var ApiClient = class {
|
|
|
19477
19593
|
async getComposeById(id) {
|
|
19478
19594
|
const baseUrl = await this.getBaseUrl();
|
|
19479
19595
|
const headers = await this.getHeaders();
|
|
19480
|
-
const client =
|
|
19596
|
+
const client = initClient16(composesByIdContract, {
|
|
19481
19597
|
baseUrl,
|
|
19482
19598
|
baseHeaders: headers,
|
|
19483
19599
|
jsonQuery: false
|
|
@@ -19499,7 +19615,7 @@ var ApiClient = class {
|
|
|
19499
19615
|
async getComposeVersion(composeId, version) {
|
|
19500
19616
|
const baseUrl = await this.getBaseUrl();
|
|
19501
19617
|
const headers = await this.getHeaders();
|
|
19502
|
-
const client =
|
|
19618
|
+
const client = initClient16(composesVersionsContract, {
|
|
19503
19619
|
baseUrl,
|
|
19504
19620
|
baseHeaders: headers,
|
|
19505
19621
|
jsonQuery: false
|
|
@@ -19520,7 +19636,7 @@ var ApiClient = class {
|
|
|
19520
19636
|
async createOrUpdateCompose(body) {
|
|
19521
19637
|
const baseUrl = await this.getBaseUrl();
|
|
19522
19638
|
const headers = await this.getHeaders();
|
|
19523
|
-
const client =
|
|
19639
|
+
const client = initClient16(composesMainContract, {
|
|
19524
19640
|
baseUrl,
|
|
19525
19641
|
baseHeaders: headers,
|
|
19526
19642
|
jsonQuery: false
|
|
@@ -19543,7 +19659,7 @@ var ApiClient = class {
|
|
|
19543
19659
|
async createRun(body) {
|
|
19544
19660
|
const baseUrl = await this.getBaseUrl();
|
|
19545
19661
|
const headers = await this.getHeaders();
|
|
19546
|
-
const client =
|
|
19662
|
+
const client = initClient16(runsMainContract, {
|
|
19547
19663
|
baseUrl,
|
|
19548
19664
|
baseHeaders: headers,
|
|
19549
19665
|
jsonQuery: false
|
|
@@ -19558,7 +19674,7 @@ var ApiClient = class {
|
|
|
19558
19674
|
}
|
|
19559
19675
|
async getEvents(runId, options) {
|
|
19560
19676
|
const config = await getClientConfig();
|
|
19561
|
-
const client =
|
|
19677
|
+
const client = initClient16(runEventsContract, config);
|
|
19562
19678
|
const result = await client.getEvents({
|
|
19563
19679
|
params: { id: runId },
|
|
19564
19680
|
query: {
|
|
@@ -19575,7 +19691,7 @@ var ApiClient = class {
|
|
|
19575
19691
|
}
|
|
19576
19692
|
async getSystemLog(runId, options) {
|
|
19577
19693
|
const config = await getClientConfig();
|
|
19578
|
-
const client =
|
|
19694
|
+
const client = initClient16(runSystemLogContract, config);
|
|
19579
19695
|
const result = await client.getSystemLog({
|
|
19580
19696
|
params: { id: runId },
|
|
19581
19697
|
query: {
|
|
@@ -19593,7 +19709,7 @@ var ApiClient = class {
|
|
|
19593
19709
|
}
|
|
19594
19710
|
async getMetrics(runId, options) {
|
|
19595
19711
|
const config = await getClientConfig();
|
|
19596
|
-
const client =
|
|
19712
|
+
const client = initClient16(runMetricsContract, config);
|
|
19597
19713
|
const result = await client.getMetrics({
|
|
19598
19714
|
params: { id: runId },
|
|
19599
19715
|
query: {
|
|
@@ -19611,7 +19727,7 @@ var ApiClient = class {
|
|
|
19611
19727
|
}
|
|
19612
19728
|
async getAgentEvents(runId, options) {
|
|
19613
19729
|
const config = await getClientConfig();
|
|
19614
|
-
const client =
|
|
19730
|
+
const client = initClient16(runAgentEventsContract, config);
|
|
19615
19731
|
const result = await client.getAgentEvents({
|
|
19616
19732
|
params: { id: runId },
|
|
19617
19733
|
query: {
|
|
@@ -19629,7 +19745,7 @@ var ApiClient = class {
|
|
|
19629
19745
|
}
|
|
19630
19746
|
async getNetworkLogs(runId, options) {
|
|
19631
19747
|
const config = await getClientConfig();
|
|
19632
|
-
const client =
|
|
19748
|
+
const client = initClient16(runNetworkLogsContract, config);
|
|
19633
19749
|
const result = await client.getNetworkLogs({
|
|
19634
19750
|
params: { id: runId },
|
|
19635
19751
|
query: {
|
|
@@ -19652,7 +19768,7 @@ var ApiClient = class {
|
|
|
19652
19768
|
async getSession(sessionId) {
|
|
19653
19769
|
const baseUrl = await this.getBaseUrl();
|
|
19654
19770
|
const headers = await this.getHeaders();
|
|
19655
|
-
const client =
|
|
19771
|
+
const client = initClient16(sessionsByIdContract, {
|
|
19656
19772
|
baseUrl,
|
|
19657
19773
|
baseHeaders: headers,
|
|
19658
19774
|
jsonQuery: false
|
|
@@ -19673,7 +19789,7 @@ var ApiClient = class {
|
|
|
19673
19789
|
*/
|
|
19674
19790
|
async getCheckpoint(checkpointId) {
|
|
19675
19791
|
const config = await getClientConfig();
|
|
19676
|
-
const client =
|
|
19792
|
+
const client = initClient16(checkpointsByIdContract, config);
|
|
19677
19793
|
const result = await client.getById({
|
|
19678
19794
|
params: { id: checkpointId }
|
|
19679
19795
|
});
|
|
@@ -19690,7 +19806,7 @@ var ApiClient = class {
|
|
|
19690
19806
|
async prepareStorage(body) {
|
|
19691
19807
|
const baseUrl = await this.getBaseUrl();
|
|
19692
19808
|
const headers = await this.getHeaders();
|
|
19693
|
-
const client =
|
|
19809
|
+
const client = initClient16(storagesPrepareContract, {
|
|
19694
19810
|
baseUrl,
|
|
19695
19811
|
baseHeaders: headers,
|
|
19696
19812
|
jsonQuery: false
|
|
@@ -19709,7 +19825,7 @@ var ApiClient = class {
|
|
|
19709
19825
|
async commitStorage(body) {
|
|
19710
19826
|
const baseUrl = await this.getBaseUrl();
|
|
19711
19827
|
const headers = await this.getHeaders();
|
|
19712
|
-
const client =
|
|
19828
|
+
const client = initClient16(storagesCommitContract, {
|
|
19713
19829
|
baseUrl,
|
|
19714
19830
|
baseHeaders: headers,
|
|
19715
19831
|
jsonQuery: false
|
|
@@ -19728,7 +19844,7 @@ var ApiClient = class {
|
|
|
19728
19844
|
async getStorageDownload(query) {
|
|
19729
19845
|
const baseUrl = await this.getBaseUrl();
|
|
19730
19846
|
const headers = await this.getHeaders();
|
|
19731
|
-
const client =
|
|
19847
|
+
const client = initClient16(storagesDownloadContract, {
|
|
19732
19848
|
baseUrl,
|
|
19733
19849
|
baseHeaders: headers,
|
|
19734
19850
|
jsonQuery: false
|
|
@@ -19753,7 +19869,7 @@ var ApiClient = class {
|
|
|
19753
19869
|
async listStorages(query) {
|
|
19754
19870
|
const baseUrl = await this.getBaseUrl();
|
|
19755
19871
|
const headers = await this.getHeaders();
|
|
19756
|
-
const client =
|
|
19872
|
+
const client = initClient16(storagesListContract, {
|
|
19757
19873
|
baseUrl,
|
|
19758
19874
|
baseHeaders: headers,
|
|
19759
19875
|
jsonQuery: false
|
|
@@ -19769,7 +19885,7 @@ var ApiClient = class {
|
|
|
19769
19885
|
/**
|
|
19770
19886
|
* Generic GET request
|
|
19771
19887
|
*/
|
|
19772
|
-
async get(
|
|
19888
|
+
async get(path17) {
|
|
19773
19889
|
const baseUrl = await this.getBaseUrl();
|
|
19774
19890
|
const token = await getActiveToken();
|
|
19775
19891
|
if (!token) {
|
|
@@ -19782,7 +19898,7 @@ var ApiClient = class {
|
|
|
19782
19898
|
if (bypassSecret) {
|
|
19783
19899
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
19784
19900
|
}
|
|
19785
|
-
return fetch(`${baseUrl}${
|
|
19901
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
19786
19902
|
method: "GET",
|
|
19787
19903
|
headers
|
|
19788
19904
|
});
|
|
@@ -19790,7 +19906,7 @@ var ApiClient = class {
|
|
|
19790
19906
|
/**
|
|
19791
19907
|
* Generic POST request
|
|
19792
19908
|
*/
|
|
19793
|
-
async post(
|
|
19909
|
+
async post(path17, options) {
|
|
19794
19910
|
const baseUrl = await this.getBaseUrl();
|
|
19795
19911
|
const token = await getActiveToken();
|
|
19796
19912
|
if (!token) {
|
|
@@ -19806,7 +19922,7 @@ var ApiClient = class {
|
|
|
19806
19922
|
if (bypassSecret) {
|
|
19807
19923
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
19808
19924
|
}
|
|
19809
|
-
return fetch(`${baseUrl}${
|
|
19925
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
19810
19926
|
method: "POST",
|
|
19811
19927
|
headers,
|
|
19812
19928
|
body: options?.body
|
|
@@ -19815,7 +19931,7 @@ var ApiClient = class {
|
|
|
19815
19931
|
/**
|
|
19816
19932
|
* Generic DELETE request
|
|
19817
19933
|
*/
|
|
19818
|
-
async delete(
|
|
19934
|
+
async delete(path17) {
|
|
19819
19935
|
const baseUrl = await this.getBaseUrl();
|
|
19820
19936
|
const token = await getActiveToken();
|
|
19821
19937
|
if (!token) {
|
|
@@ -19828,14 +19944,14 @@ var ApiClient = class {
|
|
|
19828
19944
|
if (bypassSecret) {
|
|
19829
19945
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
19830
19946
|
}
|
|
19831
|
-
return fetch(`${baseUrl}${
|
|
19947
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
19832
19948
|
method: "DELETE",
|
|
19833
19949
|
headers
|
|
19834
19950
|
});
|
|
19835
19951
|
}
|
|
19836
19952
|
async searchLogs(options) {
|
|
19837
19953
|
const config = await getClientConfig();
|
|
19838
|
-
const client =
|
|
19954
|
+
const client = initClient16(logsSearchContract, config);
|
|
19839
19955
|
const result = await client.searchLogs({
|
|
19840
19956
|
query: {
|
|
19841
19957
|
keyword: options.keyword,
|
|
@@ -20299,432 +20415,12 @@ async function showNetworkLogs(runId, options) {
|
|
|
20299
20415
|
}
|
|
20300
20416
|
}
|
|
20301
20417
|
|
|
20302
|
-
// src/commands/
|
|
20303
|
-
import { Command as Command45 } from "commander";
|
|
20304
|
-
|
|
20305
|
-
// src/commands/agent/clone.ts
|
|
20418
|
+
// src/commands/init/index.ts
|
|
20306
20419
|
import { Command as Command41 } from "commander";
|
|
20307
20420
|
import chalk37 from "chalk";
|
|
20308
|
-
import
|
|
20309
|
-
import { mkdir as mkdir7, writeFile as writeFile6, readdir as readdir2, copyFile, rm as rm4 } from "fs/promises";
|
|
20310
|
-
import { join as join10, dirname as dirname3, resolve, sep } from "path";
|
|
20311
|
-
import { tmpdir as tmpdir7 } from "os";
|
|
20312
|
-
import * as tar6 from "tar";
|
|
20313
|
-
import { stringify as yamlStringify } from "yaml";
|
|
20314
|
-
function cleanComposeContent(content) {
|
|
20315
|
-
const agents = {};
|
|
20316
|
-
for (const [name, agent] of Object.entries(content.agents)) {
|
|
20317
|
-
const cleaned = {
|
|
20318
|
-
framework: agent.framework
|
|
20319
|
-
};
|
|
20320
|
-
if (agent.description) cleaned.description = agent.description;
|
|
20321
|
-
if (agent.volumes) cleaned.volumes = agent.volumes;
|
|
20322
|
-
if (agent.environment) cleaned.environment = agent.environment;
|
|
20323
|
-
if (agent.instructions) cleaned.instructions = agent.instructions;
|
|
20324
|
-
if (agent.skills) cleaned.skills = agent.skills;
|
|
20325
|
-
if (agent.experimental_runner)
|
|
20326
|
-
cleaned.experimental_runner = agent.experimental_runner;
|
|
20327
|
-
if (agent.experimental_profile)
|
|
20328
|
-
cleaned.experimental_profile = agent.experimental_profile;
|
|
20329
|
-
if (agent.experimental_capabilities)
|
|
20330
|
-
cleaned.experimental_capabilities = agent.experimental_capabilities;
|
|
20331
|
-
if (agent.experimental_firewalls)
|
|
20332
|
-
cleaned.experimental_firewalls = agent.experimental_firewalls;
|
|
20333
|
-
agents[name] = cleaned;
|
|
20334
|
-
}
|
|
20335
|
-
const result = {
|
|
20336
|
-
version: content.version,
|
|
20337
|
-
agents
|
|
20338
|
-
};
|
|
20339
|
-
if (content.volumes) {
|
|
20340
|
-
result.volumes = content.volumes;
|
|
20341
|
-
}
|
|
20342
|
-
return result;
|
|
20343
|
-
}
|
|
20344
|
-
async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
20345
|
-
const destPath = join10(destination, instructionsPath);
|
|
20346
|
-
const resolvedDest = resolve(destPath);
|
|
20347
|
-
const resolvedBase = resolve(destination);
|
|
20348
|
-
if (resolvedDest !== resolvedBase && !resolvedDest.startsWith(resolvedBase + sep)) {
|
|
20349
|
-
throw new Error("Invalid instructions path: path traversal detected");
|
|
20350
|
-
}
|
|
20351
|
-
const volumeName = getInstructionsStorageName(agentName);
|
|
20352
|
-
console.log(chalk37.dim("Downloading instructions..."));
|
|
20353
|
-
const downloadInfo = await getStorageDownload({
|
|
20354
|
-
name: volumeName,
|
|
20355
|
-
type: "volume"
|
|
20356
|
-
});
|
|
20357
|
-
if ("empty" in downloadInfo) {
|
|
20358
|
-
console.log(chalk37.yellow("\u26A0 Instructions volume is empty"));
|
|
20359
|
-
return false;
|
|
20360
|
-
}
|
|
20361
|
-
const response = await fetch(downloadInfo.url);
|
|
20362
|
-
if (!response.ok) {
|
|
20363
|
-
throw new Error(`Failed to download instructions: ${response.status}`);
|
|
20364
|
-
}
|
|
20365
|
-
const buffer = Buffer.from(await response.arrayBuffer());
|
|
20366
|
-
const tmpDir = mkdtempSync5(join10(tmpdir7(), "vm0-clone-"));
|
|
20367
|
-
const tarPath = join10(tmpDir, "archive.tar.gz");
|
|
20368
|
-
await writeFile6(tarPath, buffer);
|
|
20369
|
-
await tar6.extract({ file: tarPath, cwd: tmpDir, gzip: true });
|
|
20370
|
-
const files = await readdir2(tmpDir);
|
|
20371
|
-
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
20372
|
-
if (!mdFile) {
|
|
20373
|
-
console.log(chalk37.yellow("\u26A0 No instructions file found in volume"));
|
|
20374
|
-
await rm4(tmpDir, { recursive: true, force: true });
|
|
20375
|
-
return false;
|
|
20376
|
-
}
|
|
20377
|
-
await mkdir7(dirname3(destPath), { recursive: true });
|
|
20378
|
-
await copyFile(join10(tmpDir, mdFile), destPath);
|
|
20379
|
-
await rm4(tmpDir, { recursive: true, force: true });
|
|
20380
|
-
return true;
|
|
20381
|
-
}
|
|
20382
|
-
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(
|
|
20383
|
-
withErrorHandler(async (name, destination) => {
|
|
20384
|
-
const targetDir = destination || name;
|
|
20385
|
-
const dirStatus = checkDirectoryStatus(targetDir);
|
|
20386
|
-
if (dirStatus.exists && !dirStatus.empty) {
|
|
20387
|
-
throw new Error(`Directory "${targetDir}" is not empty`);
|
|
20388
|
-
}
|
|
20389
|
-
console.log(`Cloning agent compose: ${name}`);
|
|
20390
|
-
const compose = await getComposeByName(name);
|
|
20391
|
-
if (!compose) {
|
|
20392
|
-
throw new Error(`Agent compose not found: ${name}`);
|
|
20393
|
-
}
|
|
20394
|
-
if (!compose.content || !compose.headVersionId) {
|
|
20395
|
-
throw new Error(`Agent compose has no content: ${name}`);
|
|
20396
|
-
}
|
|
20397
|
-
const content = compose.content;
|
|
20398
|
-
const cleanedContent = cleanComposeContent(content);
|
|
20399
|
-
const yamlContent = yamlStringify(cleanedContent);
|
|
20400
|
-
await mkdir7(targetDir, { recursive: true });
|
|
20401
|
-
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
20402
|
-
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
20403
|
-
console.log(chalk37.green("\u2713 Created vm0.yaml"));
|
|
20404
|
-
const agentKey = Object.keys(content.agents)[0];
|
|
20405
|
-
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
20406
|
-
if (agent?.instructions) {
|
|
20407
|
-
try {
|
|
20408
|
-
const instructionsDownloaded = await downloadInstructions(
|
|
20409
|
-
name,
|
|
20410
|
-
agent.instructions,
|
|
20411
|
-
targetDir
|
|
20412
|
-
);
|
|
20413
|
-
if (instructionsDownloaded) {
|
|
20414
|
-
console.log(chalk37.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
20415
|
-
}
|
|
20416
|
-
} catch (error) {
|
|
20417
|
-
console.log(
|
|
20418
|
-
chalk37.yellow(
|
|
20419
|
-
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
20420
|
-
)
|
|
20421
|
-
);
|
|
20422
|
-
}
|
|
20423
|
-
}
|
|
20424
|
-
console.log();
|
|
20425
|
-
console.log(chalk37.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
20426
|
-
console.log(chalk37.dim(` Location: ${targetDir}/`));
|
|
20427
|
-
console.log(chalk37.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
20428
|
-
})
|
|
20429
|
-
);
|
|
20430
|
-
|
|
20431
|
-
// src/commands/agent/delete.ts
|
|
20432
|
-
import { Command as Command42 } from "commander";
|
|
20433
|
-
import chalk38 from "chalk";
|
|
20434
|
-
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(
|
|
20435
|
-
withErrorHandler(async (name, options) => {
|
|
20436
|
-
const compose = await getComposeByName(name);
|
|
20437
|
-
if (!compose) {
|
|
20438
|
-
throw new Error(`Agent '${name}' not found`, {
|
|
20439
|
-
cause: new Error("Run: vm0 agent list")
|
|
20440
|
-
});
|
|
20441
|
-
}
|
|
20442
|
-
if (!options.yes) {
|
|
20443
|
-
if (!isInteractive()) {
|
|
20444
|
-
throw new Error("--yes flag is required in non-interactive mode");
|
|
20445
|
-
}
|
|
20446
|
-
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
20447
|
-
if (!confirmed) {
|
|
20448
|
-
console.log(chalk38.dim("Cancelled"));
|
|
20449
|
-
return;
|
|
20450
|
-
}
|
|
20451
|
-
}
|
|
20452
|
-
try {
|
|
20453
|
-
await deleteCompose(compose.id);
|
|
20454
|
-
} catch (error) {
|
|
20455
|
-
if (error instanceof Error && error.message.includes("currently running")) {
|
|
20456
|
-
throw new Error("Cannot delete agent: agent is currently running", {
|
|
20457
|
-
cause: new Error("Run: vm0 run list")
|
|
20458
|
-
});
|
|
20459
|
-
}
|
|
20460
|
-
throw error;
|
|
20461
|
-
}
|
|
20462
|
-
console.log(chalk38.green(`\u2713 Agent '${name}' deleted`));
|
|
20463
|
-
})
|
|
20464
|
-
);
|
|
20465
|
-
|
|
20466
|
-
// src/commands/agent/list.ts
|
|
20467
|
-
import { Command as Command43 } from "commander";
|
|
20468
|
-
import chalk39 from "chalk";
|
|
20469
|
-
var listCommand5 = new Command43().name("list").alias("ls").description("List all agent composes").action(
|
|
20470
|
-
withErrorHandler(async () => {
|
|
20471
|
-
const response = await httpGet("/api/agent/composes/list");
|
|
20472
|
-
if (!response.ok) {
|
|
20473
|
-
const error = await response.json();
|
|
20474
|
-
throw new Error(error.error?.message || "List failed");
|
|
20475
|
-
}
|
|
20476
|
-
const data = await response.json();
|
|
20477
|
-
if (data.composes.length === 0) {
|
|
20478
|
-
console.log(chalk39.dim("No agent composes found"));
|
|
20479
|
-
console.log(
|
|
20480
|
-
chalk39.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
20481
|
-
);
|
|
20482
|
-
return;
|
|
20483
|
-
}
|
|
20484
|
-
const nameWidth = Math.max(4, ...data.composes.map((c34) => c34.name.length));
|
|
20485
|
-
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
20486
|
-
" "
|
|
20487
|
-
);
|
|
20488
|
-
console.log(chalk39.dim(header));
|
|
20489
|
-
for (const compose of data.composes) {
|
|
20490
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk39.dim("-");
|
|
20491
|
-
const row = [
|
|
20492
|
-
compose.name.padEnd(nameWidth),
|
|
20493
|
-
versionShort,
|
|
20494
|
-
formatRelativeTime(compose.updatedAt)
|
|
20495
|
-
].join(" ");
|
|
20496
|
-
console.log(row);
|
|
20497
|
-
}
|
|
20498
|
-
})
|
|
20499
|
-
);
|
|
20500
|
-
|
|
20501
|
-
// src/commands/agent/status.ts
|
|
20502
|
-
import { Command as Command44 } from "commander";
|
|
20503
|
-
import chalk40 from "chalk";
|
|
20504
|
-
|
|
20505
|
-
// src/lib/domain/source-derivation.ts
|
|
20506
|
-
import * as fs10 from "fs/promises";
|
|
20507
|
-
import * as path16 from "path";
|
|
20508
|
-
import * as os8 from "os";
|
|
20509
|
-
async function fetchSkillFrontmatter(skillUrl, tempDir) {
|
|
20510
|
-
try {
|
|
20511
|
-
const parsed = parseGitHubTreeUrl2(skillUrl);
|
|
20512
|
-
const skillDir = await downloadGitHubSkill(parsed, tempDir);
|
|
20513
|
-
const frontmatter = await readSkillFrontmatter(skillDir);
|
|
20514
|
-
return { skillName: parsed.skillName, frontmatter };
|
|
20515
|
-
} catch {
|
|
20516
|
-
return null;
|
|
20517
|
-
}
|
|
20518
|
-
}
|
|
20519
|
-
async function deriveAgentVariableSources(agent, options) {
|
|
20520
|
-
const grouped = extractAndGroupVariables(agent.environment ?? {});
|
|
20521
|
-
const secretSources = /* @__PURE__ */ new Map();
|
|
20522
|
-
const varSources = /* @__PURE__ */ new Map();
|
|
20523
|
-
for (const ref of grouped.secrets) {
|
|
20524
|
-
secretSources.set(ref.name, {
|
|
20525
|
-
name: ref.name,
|
|
20526
|
-
source: "agent environment"
|
|
20527
|
-
});
|
|
20528
|
-
}
|
|
20529
|
-
for (const ref of grouped.vars) {
|
|
20530
|
-
varSources.set(ref.name, { name: ref.name, source: "agent environment" });
|
|
20531
|
-
}
|
|
20532
|
-
if (options?.skipNetwork || !agent.skills || agent.skills.length === 0) {
|
|
20533
|
-
return {
|
|
20534
|
-
secrets: Array.from(secretSources.values()),
|
|
20535
|
-
vars: Array.from(varSources.values())
|
|
20536
|
-
};
|
|
20537
|
-
}
|
|
20538
|
-
const tempDir = await fs10.mkdtemp(
|
|
20539
|
-
path16.join(os8.tmpdir(), "vm0-source-derivation-")
|
|
20540
|
-
);
|
|
20541
|
-
try {
|
|
20542
|
-
const skillResults = await Promise.all(
|
|
20543
|
-
agent.skills.map((url) => fetchSkillFrontmatter(url, tempDir))
|
|
20544
|
-
);
|
|
20545
|
-
for (const result of skillResults) {
|
|
20546
|
-
if (!result) continue;
|
|
20547
|
-
const { skillName, frontmatter } = result;
|
|
20548
|
-
if (frontmatter.vm0_secrets) {
|
|
20549
|
-
for (const secretName of frontmatter.vm0_secrets) {
|
|
20550
|
-
if (secretSources.has(secretName)) {
|
|
20551
|
-
secretSources.set(secretName, {
|
|
20552
|
-
name: secretName,
|
|
20553
|
-
source: `skill: ${skillName}`,
|
|
20554
|
-
skillName
|
|
20555
|
-
});
|
|
20556
|
-
}
|
|
20557
|
-
}
|
|
20558
|
-
}
|
|
20559
|
-
if (frontmatter.vm0_vars) {
|
|
20560
|
-
for (const varName of frontmatter.vm0_vars) {
|
|
20561
|
-
if (varSources.has(varName)) {
|
|
20562
|
-
varSources.set(varName, {
|
|
20563
|
-
name: varName,
|
|
20564
|
-
source: `skill: ${skillName}`,
|
|
20565
|
-
skillName
|
|
20566
|
-
});
|
|
20567
|
-
}
|
|
20568
|
-
}
|
|
20569
|
-
}
|
|
20570
|
-
}
|
|
20571
|
-
} finally {
|
|
20572
|
-
await fs10.rm(tempDir, { recursive: true, force: true });
|
|
20573
|
-
}
|
|
20574
|
-
return {
|
|
20575
|
-
secrets: Array.from(secretSources.values()),
|
|
20576
|
-
vars: Array.from(varSources.values())
|
|
20577
|
-
};
|
|
20578
|
-
}
|
|
20579
|
-
async function deriveComposeVariableSources(content, options) {
|
|
20580
|
-
const results = /* @__PURE__ */ new Map();
|
|
20581
|
-
const entries = Object.entries(content.agents);
|
|
20582
|
-
const sourcesPromises = entries.map(async ([agentName, agent]) => {
|
|
20583
|
-
const sources = await deriveAgentVariableSources(agent, options);
|
|
20584
|
-
return { agentName, sources };
|
|
20585
|
-
});
|
|
20586
|
-
const sourcesResults = await Promise.all(sourcesPromises);
|
|
20587
|
-
for (const { agentName, sources } of sourcesResults) {
|
|
20588
|
-
results.set(agentName, sources);
|
|
20589
|
-
}
|
|
20590
|
-
return results;
|
|
20591
|
-
}
|
|
20592
|
-
|
|
20593
|
-
// src/commands/agent/status.ts
|
|
20594
|
-
function formatListSection(label, items) {
|
|
20595
|
-
if (items.length === 0) return;
|
|
20596
|
-
console.log(` ${label}:`);
|
|
20597
|
-
for (const item of items) {
|
|
20598
|
-
console.log(` - ${item}`);
|
|
20599
|
-
}
|
|
20600
|
-
}
|
|
20601
|
-
function formatVolumes(volumes, volumeConfigs) {
|
|
20602
|
-
if (volumes.length === 0) return;
|
|
20603
|
-
console.log(` Volumes:`);
|
|
20604
|
-
for (const vol of volumes) {
|
|
20605
|
-
const volumeDef = volumeConfigs?.[vol];
|
|
20606
|
-
if (volumeDef) {
|
|
20607
|
-
console.log(` - ${vol}:${volumeDef.version.slice(0, 8)}`);
|
|
20608
|
-
} else {
|
|
20609
|
-
console.log(` - ${vol}`);
|
|
20610
|
-
}
|
|
20611
|
-
}
|
|
20612
|
-
}
|
|
20613
|
-
function formatVariableSources(sources) {
|
|
20614
|
-
if (sources.secrets.length > 0) {
|
|
20615
|
-
console.log(` Secrets:`);
|
|
20616
|
-
for (const secret of sources.secrets) {
|
|
20617
|
-
const sourceInfo = chalk40.dim(`(${secret.source})`);
|
|
20618
|
-
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
20619
|
-
}
|
|
20620
|
-
}
|
|
20621
|
-
if (sources.vars.length > 0) {
|
|
20622
|
-
console.log(` Vars:`);
|
|
20623
|
-
for (const v of sources.vars) {
|
|
20624
|
-
const sourceInfo = chalk40.dim(`(${v.source})`);
|
|
20625
|
-
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
20626
|
-
}
|
|
20627
|
-
}
|
|
20628
|
-
}
|
|
20629
|
-
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
20630
|
-
console.log(` ${chalk40.cyan(agentName)}:`);
|
|
20631
|
-
console.log(` Framework: ${agent.framework}`);
|
|
20632
|
-
formatVolumes(agent.volumes ?? [], volumeConfigs);
|
|
20633
|
-
formatListSection("Skills", agent.skills ?? []);
|
|
20634
|
-
if (agentSources) {
|
|
20635
|
-
formatVariableSources(agentSources);
|
|
20636
|
-
}
|
|
20637
|
-
if (agent.experimental_runner) {
|
|
20638
|
-
console.log(` Runner: ${agent.experimental_runner.group}`);
|
|
20639
|
-
}
|
|
20640
|
-
}
|
|
20641
|
-
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
20642
|
-
console.log(chalk40.bold("Name:") + ` ${name}`);
|
|
20643
|
-
console.log(chalk40.bold("Version:") + ` ${versionId}`);
|
|
20644
|
-
console.log();
|
|
20645
|
-
console.log(chalk40.bold("Agents:"));
|
|
20646
|
-
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
20647
|
-
const agentSources = variableSources?.get(agentName);
|
|
20648
|
-
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
20649
|
-
}
|
|
20650
|
-
}
|
|
20651
|
-
var statusCommand5 = new Command44().name("status").description("Show status of agent compose").argument(
|
|
20652
|
-
"<name[:version]>",
|
|
20653
|
-
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
20654
|
-
).option("--no-sources", "Skip fetching skills to determine variable sources").action(
|
|
20655
|
-
withErrorHandler(
|
|
20656
|
-
async (argument, options) => {
|
|
20657
|
-
const colonIndex = argument.lastIndexOf(":");
|
|
20658
|
-
let name;
|
|
20659
|
-
let version;
|
|
20660
|
-
if (colonIndex === -1) {
|
|
20661
|
-
name = argument;
|
|
20662
|
-
version = "latest";
|
|
20663
|
-
} else {
|
|
20664
|
-
name = argument.slice(0, colonIndex);
|
|
20665
|
-
version = argument.slice(colonIndex + 1) || "latest";
|
|
20666
|
-
}
|
|
20667
|
-
const compose = await getComposeByName(name);
|
|
20668
|
-
if (!compose) {
|
|
20669
|
-
throw new Error(`Agent compose not found: ${name}`, {
|
|
20670
|
-
cause: new Error("Run: vm0 agent list")
|
|
20671
|
-
});
|
|
20672
|
-
}
|
|
20673
|
-
let resolvedVersionId = compose.headVersionId;
|
|
20674
|
-
if (version !== "latest" && compose.headVersionId) {
|
|
20675
|
-
if (version.length < 64) {
|
|
20676
|
-
try {
|
|
20677
|
-
const versionInfo = await getComposeVersion(compose.id, version);
|
|
20678
|
-
resolvedVersionId = versionInfo.versionId;
|
|
20679
|
-
} catch (error) {
|
|
20680
|
-
if (error instanceof Error && error.message.includes("not found")) {
|
|
20681
|
-
throw new Error(`Version not found: ${version}`, {
|
|
20682
|
-
cause: new Error(
|
|
20683
|
-
`HEAD version: ${compose.headVersionId?.slice(0, 8)}`
|
|
20684
|
-
)
|
|
20685
|
-
});
|
|
20686
|
-
}
|
|
20687
|
-
throw error;
|
|
20688
|
-
}
|
|
20689
|
-
} else {
|
|
20690
|
-
resolvedVersionId = version;
|
|
20691
|
-
}
|
|
20692
|
-
}
|
|
20693
|
-
if (!resolvedVersionId || !compose.content) {
|
|
20694
|
-
throw new Error(`No version found for: ${name}`);
|
|
20695
|
-
}
|
|
20696
|
-
const content = compose.content;
|
|
20697
|
-
let variableSources;
|
|
20698
|
-
try {
|
|
20699
|
-
variableSources = await deriveComposeVariableSources(content, {
|
|
20700
|
-
skipNetwork: options.sources === false
|
|
20701
|
-
});
|
|
20702
|
-
} catch {
|
|
20703
|
-
console.error(
|
|
20704
|
-
chalk40.yellow(
|
|
20705
|
-
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
20706
|
-
)
|
|
20707
|
-
);
|
|
20708
|
-
}
|
|
20709
|
-
formatComposeOutput(
|
|
20710
|
-
compose.name,
|
|
20711
|
-
resolvedVersionId,
|
|
20712
|
-
content,
|
|
20713
|
-
variableSources
|
|
20714
|
-
);
|
|
20715
|
-
}
|
|
20716
|
-
)
|
|
20717
|
-
);
|
|
20718
|
-
|
|
20719
|
-
// src/commands/agent/index.ts
|
|
20720
|
-
var agentCommand = new Command45().name("agent").description("Manage agent composes").addCommand(cloneCommand4).addCommand(deleteCommand).addCommand(listCommand5).addCommand(statusCommand5);
|
|
20721
|
-
|
|
20722
|
-
// src/commands/init/index.ts
|
|
20723
|
-
import { Command as Command46 } from "commander";
|
|
20724
|
-
import chalk41 from "chalk";
|
|
20725
|
-
import path17 from "path";
|
|
20421
|
+
import path16 from "path";
|
|
20726
20422
|
import { existsSync as existsSync11 } from "fs";
|
|
20727
|
-
import { writeFile as
|
|
20423
|
+
import { writeFile as writeFile6 } from "fs/promises";
|
|
20728
20424
|
var VM0_YAML_FILE = "vm0.yaml";
|
|
20729
20425
|
var AGENTS_MD_FILE = "AGENTS.md";
|
|
20730
20426
|
function generateVm0Yaml(agentName) {
|
|
@@ -20759,7 +20455,7 @@ function checkExistingFiles() {
|
|
|
20759
20455
|
if (existsSync11(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
20760
20456
|
return existingFiles;
|
|
20761
20457
|
}
|
|
20762
|
-
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(
|
|
20763
20459
|
withErrorHandler(async (options) => {
|
|
20764
20460
|
const existingFiles = checkExistingFiles();
|
|
20765
20461
|
if (existingFiles.length > 0 && !options.force) {
|
|
@@ -20775,7 +20471,7 @@ var initCommand4 = new Command46().name("init").description("Initialize a new VM
|
|
|
20775
20471
|
cause: new Error("Usage: vm0 init --name <agent-name>")
|
|
20776
20472
|
});
|
|
20777
20473
|
} else {
|
|
20778
|
-
const dirName =
|
|
20474
|
+
const dirName = path16.basename(process.cwd());
|
|
20779
20475
|
const defaultName = validateAgentName(dirName) ? dirName : void 0;
|
|
20780
20476
|
const name = await promptText(
|
|
20781
20477
|
"Enter agent name",
|
|
@@ -20788,7 +20484,7 @@ var initCommand4 = new Command46().name("init").description("Initialize a new VM
|
|
|
20788
20484
|
}
|
|
20789
20485
|
);
|
|
20790
20486
|
if (name === void 0) {
|
|
20791
|
-
console.log(
|
|
20487
|
+
console.log(chalk37.dim("Cancelled"));
|
|
20792
20488
|
return;
|
|
20793
20489
|
}
|
|
20794
20490
|
agentName = name;
|
|
@@ -20800,41 +20496,41 @@ var initCommand4 = new Command46().name("init").description("Initialize a new VM
|
|
|
20800
20496
|
)
|
|
20801
20497
|
});
|
|
20802
20498
|
}
|
|
20803
|
-
await
|
|
20499
|
+
await writeFile6(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
20804
20500
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
20805
|
-
console.log(
|
|
20806
|
-
await
|
|
20501
|
+
console.log(chalk37.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
20502
|
+
await writeFile6(AGENTS_MD_FILE, generateAgentsMd());
|
|
20807
20503
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
20808
|
-
console.log(
|
|
20504
|
+
console.log(chalk37.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
20809
20505
|
console.log();
|
|
20810
20506
|
console.log("Next steps:");
|
|
20811
20507
|
console.log(
|
|
20812
|
-
` 1. Set up model provider (one-time): ${
|
|
20508
|
+
` 1. Set up model provider (one-time): ${chalk37.cyan("vm0 org model-provider setup")}`
|
|
20813
20509
|
);
|
|
20814
20510
|
console.log(
|
|
20815
|
-
` 2. Edit ${
|
|
20511
|
+
` 2. Edit ${chalk37.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
20816
20512
|
);
|
|
20817
20513
|
console.log(
|
|
20818
|
-
` 3. Run your agent: ${
|
|
20514
|
+
` 3. Run your agent: ${chalk37.cyan(`vm0 cook "let's start working"`)}`
|
|
20819
20515
|
);
|
|
20820
20516
|
})
|
|
20821
20517
|
);
|
|
20822
20518
|
|
|
20823
20519
|
// src/commands/connector/index.ts
|
|
20824
|
-
import { Command as
|
|
20520
|
+
import { Command as Command46 } from "commander";
|
|
20825
20521
|
|
|
20826
20522
|
// src/commands/connector/connect.ts
|
|
20827
|
-
import { Command as
|
|
20828
|
-
import
|
|
20829
|
-
import { initClient as
|
|
20523
|
+
import { Command as Command42 } from "commander";
|
|
20524
|
+
import chalk39 from "chalk";
|
|
20525
|
+
import { initClient as initClient17 } from "@ts-rest/core";
|
|
20830
20526
|
|
|
20831
20527
|
// src/commands/connector/lib/computer/start-services.ts
|
|
20832
20528
|
import { spawn as spawn2 } from "child_process";
|
|
20833
20529
|
import { access as access2, constants } from "fs/promises";
|
|
20834
20530
|
import { createServer } from "net";
|
|
20835
20531
|
import { homedir as homedir4 } from "os";
|
|
20836
|
-
import { join as
|
|
20837
|
-
import
|
|
20532
|
+
import { join as join10 } from "path";
|
|
20533
|
+
import chalk38 from "chalk";
|
|
20838
20534
|
|
|
20839
20535
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
20840
20536
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -20868,11 +20564,11 @@ var CHROME_CANDIDATES = [
|
|
|
20868
20564
|
"chrome"
|
|
20869
20565
|
];
|
|
20870
20566
|
async function getRandomPort() {
|
|
20871
|
-
return new Promise((
|
|
20567
|
+
return new Promise((resolve, reject) => {
|
|
20872
20568
|
const server = createServer();
|
|
20873
20569
|
server.listen(0, "127.0.0.1", () => {
|
|
20874
20570
|
const { port } = server.address();
|
|
20875
|
-
server.close(() =>
|
|
20571
|
+
server.close(() => resolve(port));
|
|
20876
20572
|
});
|
|
20877
20573
|
server.on("error", reject);
|
|
20878
20574
|
});
|
|
@@ -20886,9 +20582,9 @@ async function findBinary(...candidates) {
|
|
|
20886
20582
|
} catch {
|
|
20887
20583
|
}
|
|
20888
20584
|
} else {
|
|
20889
|
-
const found = await new Promise((
|
|
20585
|
+
const found = await new Promise((resolve) => {
|
|
20890
20586
|
const child = spawn2("which", [candidate]);
|
|
20891
|
-
child.on("close", (code) =>
|
|
20587
|
+
child.on("close", (code) => resolve(code === 0));
|
|
20892
20588
|
});
|
|
20893
20589
|
if (found) return candidate;
|
|
20894
20590
|
}
|
|
@@ -20908,7 +20604,7 @@ async function checkComputerDependencies() {
|
|
|
20908
20604
|
}
|
|
20909
20605
|
}
|
|
20910
20606
|
async function startComputerServices(credentials) {
|
|
20911
|
-
console.log(
|
|
20607
|
+
console.log(chalk38.cyan("Starting computer connector services..."));
|
|
20912
20608
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
20913
20609
|
if (!wsgidavBinary) {
|
|
20914
20610
|
throw new Error(
|
|
@@ -20921,7 +20617,7 @@ async function startComputerServices(credentials) {
|
|
|
20921
20617
|
}
|
|
20922
20618
|
const webdavPort = await getRandomPort();
|
|
20923
20619
|
const cdpPort = await getRandomPort();
|
|
20924
|
-
const downloadsPath =
|
|
20620
|
+
const downloadsPath = join10(homedir4(), "Downloads");
|
|
20925
20621
|
const wsgidav = spawn2(
|
|
20926
20622
|
wsgidavBinary,
|
|
20927
20623
|
[
|
|
@@ -20935,7 +20631,7 @@ async function startComputerServices(credentials) {
|
|
|
20935
20631
|
);
|
|
20936
20632
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
20937
20633
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
20938
|
-
console.log(
|
|
20634
|
+
console.log(chalk38.green("\u2713 WebDAV server started"));
|
|
20939
20635
|
const chrome = spawn2(
|
|
20940
20636
|
chromeBinary,
|
|
20941
20637
|
[
|
|
@@ -20949,7 +20645,7 @@ async function startComputerServices(credentials) {
|
|
|
20949
20645
|
);
|
|
20950
20646
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
20951
20647
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
20952
|
-
console.log(
|
|
20648
|
+
console.log(chalk38.green("\u2713 Chrome started"));
|
|
20953
20649
|
try {
|
|
20954
20650
|
await startNgrokTunnels(
|
|
20955
20651
|
credentials.ngrokToken,
|
|
@@ -20958,32 +20654,32 @@ async function startComputerServices(credentials) {
|
|
|
20958
20654
|
cdpPort
|
|
20959
20655
|
);
|
|
20960
20656
|
console.log(
|
|
20961
|
-
|
|
20657
|
+
chalk38.green(
|
|
20962
20658
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
20963
20659
|
)
|
|
20964
20660
|
);
|
|
20965
20661
|
console.log();
|
|
20966
|
-
console.log(
|
|
20662
|
+
console.log(chalk38.green("\u2713 Computer connector active"));
|
|
20967
20663
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
20968
20664
|
console.log(
|
|
20969
20665
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
20970
20666
|
);
|
|
20971
20667
|
console.log();
|
|
20972
|
-
console.log(
|
|
20668
|
+
console.log(chalk38.dim("Press ^C twice to disconnect"));
|
|
20973
20669
|
console.log();
|
|
20974
20670
|
let sigintCount = 0;
|
|
20975
|
-
await new Promise((
|
|
20671
|
+
await new Promise((resolve) => {
|
|
20976
20672
|
const keepAlive = setInterval(() => {
|
|
20977
20673
|
}, 6e4);
|
|
20978
20674
|
const done = () => {
|
|
20979
20675
|
clearInterval(keepAlive);
|
|
20980
20676
|
process.removeListener("SIGINT", onSigint);
|
|
20981
|
-
|
|
20677
|
+
resolve();
|
|
20982
20678
|
};
|
|
20983
20679
|
const onSigint = () => {
|
|
20984
20680
|
sigintCount++;
|
|
20985
20681
|
if (sigintCount === 1) {
|
|
20986
|
-
console.log(
|
|
20682
|
+
console.log(chalk38.dim("\nPress ^C again to disconnect and exit..."));
|
|
20987
20683
|
} else {
|
|
20988
20684
|
done();
|
|
20989
20685
|
}
|
|
@@ -20993,17 +20689,17 @@ async function startComputerServices(credentials) {
|
|
|
20993
20689
|
});
|
|
20994
20690
|
} finally {
|
|
20995
20691
|
console.log();
|
|
20996
|
-
console.log(
|
|
20692
|
+
console.log(chalk38.cyan("Stopping services..."));
|
|
20997
20693
|
wsgidav.kill("SIGTERM");
|
|
20998
20694
|
chrome.kill("SIGTERM");
|
|
20999
20695
|
await stopNgrokTunnels();
|
|
21000
|
-
console.log(
|
|
20696
|
+
console.log(chalk38.green("\u2713 Services stopped"));
|
|
21001
20697
|
}
|
|
21002
20698
|
}
|
|
21003
20699
|
|
|
21004
20700
|
// src/commands/connector/connect.ts
|
|
21005
20701
|
function delay2(ms) {
|
|
21006
|
-
return new Promise((
|
|
20702
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21007
20703
|
}
|
|
21008
20704
|
async function getHeaders2() {
|
|
21009
20705
|
const token = await getActiveToken();
|
|
@@ -21022,10 +20718,10 @@ async function getHeaders2() {
|
|
|
21022
20718
|
function renderHelpText(text) {
|
|
21023
20719
|
return text.replace(
|
|
21024
20720
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
21025
|
-
(_m, label, url) => `${label} (${
|
|
21026
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
20721
|
+
(_m, label, url) => `${label} (${chalk39.cyan(url)})`
|
|
20722
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk39.bold(content)).replace(
|
|
21027
20723
|
/^> (.+)$/gm,
|
|
21028
|
-
(_m, content) =>
|
|
20724
|
+
(_m, content) => chalk39.yellow(` ${content}`)
|
|
21029
20725
|
);
|
|
21030
20726
|
}
|
|
21031
20727
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -21050,7 +20746,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
21050
20746
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
21051
20747
|
if (!secretConfig.required) continue;
|
|
21052
20748
|
const value = await promptPassword(
|
|
21053
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
20749
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk39.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
21054
20750
|
);
|
|
21055
20751
|
if (!value) {
|
|
21056
20752
|
throw new Error("Cancelled");
|
|
@@ -21066,14 +20762,14 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
21066
20762
|
});
|
|
21067
20763
|
}
|
|
21068
20764
|
console.log(
|
|
21069
|
-
|
|
20765
|
+
chalk39.green(`
|
|
21070
20766
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
21071
20767
|
);
|
|
21072
20768
|
}
|
|
21073
20769
|
async function connectComputer(apiUrl, headers) {
|
|
21074
20770
|
await checkComputerDependencies();
|
|
21075
|
-
console.log(
|
|
21076
|
-
const computerClient =
|
|
20771
|
+
console.log(chalk39.cyan("Setting up computer connector..."));
|
|
20772
|
+
const computerClient = initClient17(computerConnectorContract, {
|
|
21077
20773
|
baseUrl: apiUrl,
|
|
21078
20774
|
baseHeaders: headers,
|
|
21079
20775
|
jsonQuery: false
|
|
@@ -21087,9 +20783,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
21087
20783
|
}
|
|
21088
20784
|
const credentials = createResult.body;
|
|
21089
20785
|
await startComputerServices(credentials);
|
|
21090
|
-
console.log(
|
|
20786
|
+
console.log(chalk39.cyan("Disconnecting computer connector..."));
|
|
21091
20787
|
await deleteConnector("computer");
|
|
21092
|
-
console.log(
|
|
20788
|
+
console.log(chalk39.green("\u2713 Disconnected computer"));
|
|
21093
20789
|
process.exit(0);
|
|
21094
20790
|
}
|
|
21095
20791
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -21128,8 +20824,8 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
21128
20824
|
);
|
|
21129
20825
|
}
|
|
21130
20826
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
21131
|
-
console.log(`Connecting ${
|
|
21132
|
-
const sessionsClient =
|
|
20827
|
+
console.log(`Connecting ${chalk39.cyan(connectorType)}...`);
|
|
20828
|
+
const sessionsClient = initClient17(connectorSessionsContract, {
|
|
21133
20829
|
baseUrl: apiUrl,
|
|
21134
20830
|
baseHeaders: headers,
|
|
21135
20831
|
jsonQuery: false
|
|
@@ -21144,15 +20840,15 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
21144
20840
|
}
|
|
21145
20841
|
const session = createResult.body;
|
|
21146
20842
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
21147
|
-
console.log(
|
|
21148
|
-
console.log(
|
|
20843
|
+
console.log(chalk39.green("\nSession created"));
|
|
20844
|
+
console.log(chalk39.cyan(`
|
|
21149
20845
|
To connect, visit: ${verificationUrl}`));
|
|
21150
20846
|
console.log(
|
|
21151
20847
|
`
|
|
21152
20848
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
21153
20849
|
);
|
|
21154
20850
|
console.log("\nWaiting for authorization...");
|
|
21155
|
-
const sessionClient =
|
|
20851
|
+
const sessionClient = initClient17(connectorSessionByIdContract, {
|
|
21156
20852
|
baseUrl: apiUrl,
|
|
21157
20853
|
baseHeaders: headers,
|
|
21158
20854
|
jsonQuery: false
|
|
@@ -21177,7 +20873,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
21177
20873
|
switch (status.status) {
|
|
21178
20874
|
case "complete":
|
|
21179
20875
|
console.log(
|
|
21180
|
-
|
|
20876
|
+
chalk39.green(`
|
|
21181
20877
|
|
|
21182
20878
|
${connectorType} connected successfully!`)
|
|
21183
20879
|
);
|
|
@@ -21189,13 +20885,13 @@ ${connectorType} connected successfully!`)
|
|
|
21189
20885
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
21190
20886
|
);
|
|
21191
20887
|
case "pending":
|
|
21192
|
-
process.stdout.write(
|
|
20888
|
+
process.stdout.write(chalk39.dim("."));
|
|
21193
20889
|
break;
|
|
21194
20890
|
}
|
|
21195
20891
|
}
|
|
21196
20892
|
throw new Error("Session timed out, please try again");
|
|
21197
20893
|
}
|
|
21198
|
-
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(
|
|
21199
20895
|
withErrorHandler(async (type2, options) => {
|
|
21200
20896
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
21201
20897
|
if (!parseResult.success) {
|
|
@@ -21220,12 +20916,12 @@ var connectCommand = new Command47().name("connect").description("Connect a thir
|
|
|
21220
20916
|
);
|
|
21221
20917
|
|
|
21222
20918
|
// src/commands/connector/list.ts
|
|
21223
|
-
import { Command as
|
|
21224
|
-
import
|
|
21225
|
-
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(
|
|
21226
20922
|
withErrorHandler(async () => {
|
|
21227
20923
|
const result = await listConnectors();
|
|
21228
|
-
const connectedMap = new Map(result.connectors.map((
|
|
20924
|
+
const connectedMap = new Map(result.connectors.map((c33) => [c33.type, c33]));
|
|
21229
20925
|
const allTypesRaw = Object.keys(CONNECTOR_TYPES);
|
|
21230
20926
|
const allTypes = [];
|
|
21231
20927
|
for (const type2 of allTypesRaw) {
|
|
@@ -21244,24 +20940,24 @@ var listCommand6 = new Command48().name("list").alias("ls").description("List al
|
|
|
21244
20940
|
statusText.padEnd(statusWidth),
|
|
21245
20941
|
"ACCOUNT"
|
|
21246
20942
|
].join(" ");
|
|
21247
|
-
console.log(
|
|
20943
|
+
console.log(chalk40.dim(header));
|
|
21248
20944
|
for (const type2 of allTypes) {
|
|
21249
20945
|
const connector = connectedMap.get(type2);
|
|
21250
20946
|
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type2, connector.oauthScopes);
|
|
21251
|
-
const status = connector ? connector.needsReconnect ?
|
|
21252
|
-
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("-");
|
|
21253
20949
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
21254
20950
|
console.log(row);
|
|
21255
20951
|
}
|
|
21256
20952
|
console.log();
|
|
21257
|
-
console.log(
|
|
21258
|
-
console.log(
|
|
20953
|
+
console.log(chalk40.dim("To connect a service:"));
|
|
20954
|
+
console.log(chalk40.dim(" vm0 connector connect <type>"));
|
|
21259
20955
|
})
|
|
21260
20956
|
);
|
|
21261
20957
|
|
|
21262
20958
|
// src/commands/connector/status.ts
|
|
21263
|
-
import { Command as
|
|
21264
|
-
import
|
|
20959
|
+
import { Command as Command44 } from "commander";
|
|
20960
|
+
import chalk41 from "chalk";
|
|
21265
20961
|
|
|
21266
20962
|
// src/lib/domain/schedule-utils.ts
|
|
21267
20963
|
function formatRelativeTime2(dateStr) {
|
|
@@ -21378,7 +21074,7 @@ function toISODateTime(dateTimeStr) {
|
|
|
21378
21074
|
|
|
21379
21075
|
// src/commands/connector/status.ts
|
|
21380
21076
|
var LABEL_WIDTH = 16;
|
|
21381
|
-
var
|
|
21077
|
+
var statusCommand5 = new Command44().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
21382
21078
|
withErrorHandler(async (type2) => {
|
|
21383
21079
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
21384
21080
|
if (!parseResult.success) {
|
|
@@ -21388,11 +21084,11 @@ var statusCommand6 = new Command49().name("status").description("Show detailed s
|
|
|
21388
21084
|
});
|
|
21389
21085
|
}
|
|
21390
21086
|
const connector = await getConnector(parseResult.data);
|
|
21391
|
-
console.log(`Connector: ${
|
|
21087
|
+
console.log(`Connector: ${chalk41.cyan(type2)}`);
|
|
21392
21088
|
console.log();
|
|
21393
21089
|
if (connector) {
|
|
21394
21090
|
console.log(
|
|
21395
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
21091
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk41.green("connected")}`
|
|
21396
21092
|
);
|
|
21397
21093
|
console.log(
|
|
21398
21094
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -21408,7 +21104,7 @@ var statusCommand6 = new Command49().name("status").description("Show detailed s
|
|
|
21408
21104
|
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
21409
21105
|
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
21410
21106
|
console.log(
|
|
21411
|
-
`${"Permissions:".padEnd(LABEL_WIDTH)}${
|
|
21107
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${chalk41.yellow("update available")}`
|
|
21412
21108
|
);
|
|
21413
21109
|
if (diff.addedScopes.length > 0) {
|
|
21414
21110
|
console.log(
|
|
@@ -21430,23 +21126,23 @@ var statusCommand6 = new Command49().name("status").description("Show detailed s
|
|
|
21430
21126
|
);
|
|
21431
21127
|
}
|
|
21432
21128
|
console.log();
|
|
21433
|
-
console.log(
|
|
21434
|
-
console.log(
|
|
21129
|
+
console.log(chalk41.dim("To disconnect:"));
|
|
21130
|
+
console.log(chalk41.dim(` vm0 connector disconnect ${type2}`));
|
|
21435
21131
|
} else {
|
|
21436
21132
|
console.log(
|
|
21437
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
21133
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk41.dim("not connected")}`
|
|
21438
21134
|
);
|
|
21439
21135
|
console.log();
|
|
21440
|
-
console.log(
|
|
21441
|
-
console.log(
|
|
21136
|
+
console.log(chalk41.dim("To connect:"));
|
|
21137
|
+
console.log(chalk41.dim(` vm0 connector connect ${type2}`));
|
|
21442
21138
|
}
|
|
21443
21139
|
})
|
|
21444
21140
|
);
|
|
21445
21141
|
|
|
21446
21142
|
// src/commands/connector/disconnect.ts
|
|
21447
|
-
import { Command as
|
|
21448
|
-
import
|
|
21449
|
-
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(
|
|
21450
21146
|
withErrorHandler(async (type2) => {
|
|
21451
21147
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
21452
21148
|
if (!parseResult.success) {
|
|
@@ -21457,16 +21153,16 @@ var disconnectCommand = new Command50().name("disconnect").description("Disconne
|
|
|
21457
21153
|
}
|
|
21458
21154
|
const connectorType = parseResult.data;
|
|
21459
21155
|
await deleteConnector(connectorType);
|
|
21460
|
-
console.log(
|
|
21156
|
+
console.log(chalk42.green(`\u2713 Disconnected ${type2}`));
|
|
21461
21157
|
})
|
|
21462
21158
|
);
|
|
21463
21159
|
|
|
21464
21160
|
// src/commands/connector/index.ts
|
|
21465
|
-
var connectorCommand = new
|
|
21161
|
+
var connectorCommand = new Command46().name("connector").description("Manage third-party service connections").addCommand(listCommand5).addCommand(statusCommand5).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
21466
21162
|
|
|
21467
21163
|
// src/commands/preference/index.ts
|
|
21468
|
-
import { Command as
|
|
21469
|
-
import
|
|
21164
|
+
import { Command as Command47 } from "commander";
|
|
21165
|
+
import chalk43 from "chalk";
|
|
21470
21166
|
function detectTimezone2() {
|
|
21471
21167
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
21472
21168
|
}
|
|
@@ -21487,15 +21183,15 @@ function parseOnOff(flag, value) {
|
|
|
21487
21183
|
);
|
|
21488
21184
|
}
|
|
21489
21185
|
function displayPreferences(prefs) {
|
|
21490
|
-
console.log(
|
|
21186
|
+
console.log(chalk43.bold("Current preferences:"));
|
|
21491
21187
|
console.log(
|
|
21492
|
-
` Timezone: ${prefs.timezone ?
|
|
21188
|
+
` Timezone: ${prefs.timezone ? chalk43.cyan(prefs.timezone) : chalk43.dim("not set")}`
|
|
21493
21189
|
);
|
|
21494
21190
|
console.log(
|
|
21495
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
21191
|
+
` Email notify: ${prefs.notifyEmail ? chalk43.green("on") : chalk43.dim("off")}`
|
|
21496
21192
|
);
|
|
21497
21193
|
console.log(
|
|
21498
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
21194
|
+
` Slack notify: ${prefs.notifySlack ? chalk43.green("on") : chalk43.dim("off")}`
|
|
21499
21195
|
);
|
|
21500
21196
|
}
|
|
21501
21197
|
function buildUpdates(opts) {
|
|
@@ -21525,21 +21221,21 @@ function buildUpdates(opts) {
|
|
|
21525
21221
|
function printUpdateResult(updates, result) {
|
|
21526
21222
|
if (updates.timezone !== void 0) {
|
|
21527
21223
|
console.log(
|
|
21528
|
-
|
|
21529
|
-
`Timezone set to ${
|
|
21224
|
+
chalk43.green(
|
|
21225
|
+
`Timezone set to ${chalk43.cyan(result.timezone ?? updates.timezone)}`
|
|
21530
21226
|
)
|
|
21531
21227
|
);
|
|
21532
21228
|
}
|
|
21533
21229
|
if (updates.notifyEmail !== void 0) {
|
|
21534
21230
|
console.log(
|
|
21535
|
-
|
|
21231
|
+
chalk43.green(
|
|
21536
21232
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
21537
21233
|
)
|
|
21538
21234
|
);
|
|
21539
21235
|
}
|
|
21540
21236
|
if (updates.notifySlack !== void 0) {
|
|
21541
21237
|
console.log(
|
|
21542
|
-
|
|
21238
|
+
chalk43.green(
|
|
21543
21239
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
21544
21240
|
)
|
|
21545
21241
|
);
|
|
@@ -21548,7 +21244,7 @@ function printUpdateResult(updates, result) {
|
|
|
21548
21244
|
async function interactiveSetup(prefs) {
|
|
21549
21245
|
if (!prefs.timezone) {
|
|
21550
21246
|
const detectedTz = detectTimezone2();
|
|
21551
|
-
console.log(
|
|
21247
|
+
console.log(chalk43.dim(`
|
|
21552
21248
|
System timezone detected: ${detectedTz}`));
|
|
21553
21249
|
const tz = await promptText(
|
|
21554
21250
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -21559,7 +21255,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
21559
21255
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
21560
21256
|
}
|
|
21561
21257
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
21562
|
-
console.log(
|
|
21258
|
+
console.log(chalk43.green(`Timezone set to ${chalk43.cyan(tz.trim())}`));
|
|
21563
21259
|
}
|
|
21564
21260
|
}
|
|
21565
21261
|
if (!prefs.notifyEmail) {
|
|
@@ -21569,11 +21265,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
21569
21265
|
);
|
|
21570
21266
|
if (enable) {
|
|
21571
21267
|
await updateUserPreferences({ notifyEmail: true });
|
|
21572
|
-
console.log(
|
|
21268
|
+
console.log(chalk43.green("Email notifications enabled"));
|
|
21573
21269
|
}
|
|
21574
21270
|
}
|
|
21575
21271
|
}
|
|
21576
|
-
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(
|
|
21577
21273
|
withErrorHandler(async (opts) => {
|
|
21578
21274
|
const updates = buildUpdates(opts);
|
|
21579
21275
|
if (updates) {
|
|
@@ -21588,32 +21284,32 @@ var preferenceCommand = new Command52().name("preference").description("View or
|
|
|
21588
21284
|
} else if (!prefs.timezone) {
|
|
21589
21285
|
console.log();
|
|
21590
21286
|
console.log(
|
|
21591
|
-
`To set timezone: ${
|
|
21287
|
+
`To set timezone: ${chalk43.cyan("vm0 preference --timezone <timezone>")}`
|
|
21592
21288
|
);
|
|
21593
21289
|
console.log(
|
|
21594
|
-
|
|
21290
|
+
chalk43.dim("Example: vm0 preference --timezone America/New_York")
|
|
21595
21291
|
);
|
|
21596
21292
|
}
|
|
21597
21293
|
})
|
|
21598
21294
|
);
|
|
21599
21295
|
|
|
21600
21296
|
// src/commands/upgrade/index.ts
|
|
21601
|
-
import { Command as
|
|
21602
|
-
import
|
|
21603
|
-
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(
|
|
21604
21300
|
withErrorHandler(async () => {
|
|
21605
21301
|
console.log("Checking for updates...");
|
|
21606
21302
|
const latestVersion = await getLatestVersion();
|
|
21607
21303
|
if (latestVersion === null) {
|
|
21608
21304
|
throw new Error("Could not check for updates. Please try again later.");
|
|
21609
21305
|
}
|
|
21610
|
-
if (latestVersion === "9.
|
|
21611
|
-
console.log(
|
|
21306
|
+
if (latestVersion === "9.78.0") {
|
|
21307
|
+
console.log(chalk44.green(`\u2713 Already up to date (${"9.78.0"})`));
|
|
21612
21308
|
return;
|
|
21613
21309
|
}
|
|
21614
21310
|
console.log(
|
|
21615
|
-
|
|
21616
|
-
`Current version: ${"9.
|
|
21311
|
+
chalk44.yellow(
|
|
21312
|
+
`Current version: ${"9.78.0"} -> Latest version: ${latestVersion}`
|
|
21617
21313
|
)
|
|
21618
21314
|
);
|
|
21619
21315
|
console.log();
|
|
@@ -21621,26 +21317,26 @@ var upgradeCommand = new Command53().name("upgrade").description("Upgrade vm0 CL
|
|
|
21621
21317
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
21622
21318
|
if (packageManager === "unknown") {
|
|
21623
21319
|
console.log(
|
|
21624
|
-
|
|
21320
|
+
chalk44.yellow(
|
|
21625
21321
|
"Could not detect your package manager for auto-upgrade."
|
|
21626
21322
|
)
|
|
21627
21323
|
);
|
|
21628
21324
|
} else {
|
|
21629
21325
|
console.log(
|
|
21630
|
-
|
|
21326
|
+
chalk44.yellow(
|
|
21631
21327
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
21632
21328
|
)
|
|
21633
21329
|
);
|
|
21634
21330
|
}
|
|
21635
|
-
console.log(
|
|
21636
|
-
console.log(
|
|
21331
|
+
console.log(chalk44.yellow("Please upgrade manually:"));
|
|
21332
|
+
console.log(chalk44.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
21637
21333
|
return;
|
|
21638
21334
|
}
|
|
21639
21335
|
console.log(`Upgrading via ${packageManager}...`);
|
|
21640
21336
|
const success = await performUpgrade(packageManager);
|
|
21641
21337
|
if (success) {
|
|
21642
21338
|
console.log(
|
|
21643
|
-
|
|
21339
|
+
chalk44.green(`\u2713 Upgraded from ${"9.78.0"} to ${latestVersion}`)
|
|
21644
21340
|
);
|
|
21645
21341
|
return;
|
|
21646
21342
|
}
|
|
@@ -21653,8 +21349,8 @@ var upgradeCommand = new Command53().name("upgrade").description("Upgrade vm0 CL
|
|
|
21653
21349
|
);
|
|
21654
21350
|
|
|
21655
21351
|
// src/commands/whoami.ts
|
|
21656
|
-
import { Command as
|
|
21657
|
-
import
|
|
21352
|
+
import { Command as Command49 } from "commander";
|
|
21353
|
+
import chalk45 from "chalk";
|
|
21658
21354
|
function isInsideSandbox() {
|
|
21659
21355
|
return !!process.env.VM0_RUN_ID;
|
|
21660
21356
|
}
|
|
@@ -21669,7 +21365,7 @@ async function showSandboxInfo() {
|
|
|
21669
21365
|
const apiUrl = process.env.VM0_API_URL;
|
|
21670
21366
|
const hasAgentInfo = agentName || agentVersion || agentComposeId || agentOrgSlug || cliAgentType;
|
|
21671
21367
|
if (hasAgentInfo) {
|
|
21672
|
-
console.log(
|
|
21368
|
+
console.log(chalk45.bold("Agent:"));
|
|
21673
21369
|
if (agentName) console.log(` Name: ${agentName}`);
|
|
21674
21370
|
if (agentVersion) console.log(` Version: ${agentVersion}`);
|
|
21675
21371
|
if (agentComposeId) console.log(` Compose ID: ${agentComposeId}`);
|
|
@@ -21677,7 +21373,7 @@ async function showSandboxInfo() {
|
|
|
21677
21373
|
if (cliAgentType) console.log(` Framework: ${cliAgentType}`);
|
|
21678
21374
|
console.log();
|
|
21679
21375
|
}
|
|
21680
|
-
console.log(
|
|
21376
|
+
console.log(chalk45.bold("Run:"));
|
|
21681
21377
|
if (runId) console.log(` ID: ${runId}`);
|
|
21682
21378
|
if (activeOrg) console.log(` Org: ${activeOrg}`);
|
|
21683
21379
|
if (apiUrl) console.log(` API: ${apiUrl}`);
|
|
@@ -21686,23 +21382,23 @@ async function showLocalInfo() {
|
|
|
21686
21382
|
const token = await getToken();
|
|
21687
21383
|
const apiUrl = await getApiUrl();
|
|
21688
21384
|
const activeOrg = await getActiveOrg();
|
|
21689
|
-
console.log(
|
|
21385
|
+
console.log(chalk45.bold("Auth:"));
|
|
21690
21386
|
if (token) {
|
|
21691
21387
|
const tokenSource = process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
21692
21388
|
console.log(
|
|
21693
|
-
` Status: ${
|
|
21389
|
+
` Status: ${chalk45.green("Authenticated")} (via ${tokenSource})`
|
|
21694
21390
|
);
|
|
21695
21391
|
} else {
|
|
21696
|
-
console.log(` Status: ${
|
|
21392
|
+
console.log(` Status: ${chalk45.dim("Not authenticated")}`);
|
|
21697
21393
|
}
|
|
21698
21394
|
console.log(` API: ${apiUrl}`);
|
|
21699
21395
|
console.log();
|
|
21700
21396
|
if (activeOrg) {
|
|
21701
|
-
console.log(
|
|
21397
|
+
console.log(chalk45.bold("Org:"));
|
|
21702
21398
|
console.log(` Active: ${activeOrg}`);
|
|
21703
21399
|
}
|
|
21704
21400
|
}
|
|
21705
|
-
var whoamiCommand = new
|
|
21401
|
+
var whoamiCommand = new Command49().name("whoami").description("Show current identity and environment information").action(
|
|
21706
21402
|
withErrorHandler(async () => {
|
|
21707
21403
|
if (isInsideSandbox()) {
|
|
21708
21404
|
await showSandboxInfo();
|
|
@@ -21716,17 +21412,17 @@ var whoamiCommand = new Command54().name("whoami").description("Show current ide
|
|
|
21716
21412
|
import { Command as Command99 } from "commander";
|
|
21717
21413
|
|
|
21718
21414
|
// src/commands/zero/org/index.ts
|
|
21719
|
-
import { Command as
|
|
21415
|
+
import { Command as Command72 } from "commander";
|
|
21720
21416
|
|
|
21721
21417
|
// src/commands/zero/org/status.ts
|
|
21722
|
-
import { Command as
|
|
21723
|
-
import
|
|
21724
|
-
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(
|
|
21725
21421
|
withErrorHandler(async () => {
|
|
21726
21422
|
try {
|
|
21727
21423
|
const org = await getZeroOrg();
|
|
21728
|
-
console.log(
|
|
21729
|
-
console.log(` Slug: ${
|
|
21424
|
+
console.log(chalk46.bold("Organization Information:"));
|
|
21425
|
+
console.log(` Slug: ${chalk46.green(org.slug)}`);
|
|
21730
21426
|
} catch (error) {
|
|
21731
21427
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
21732
21428
|
throw new Error("No organization configured", {
|
|
@@ -21741,9 +21437,9 @@ var statusCommand7 = new Command55().name("status").description("View current or
|
|
|
21741
21437
|
);
|
|
21742
21438
|
|
|
21743
21439
|
// src/commands/zero/org/set.ts
|
|
21744
|
-
import { Command as
|
|
21745
|
-
import
|
|
21746
|
-
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(
|
|
21747
21443
|
"--force",
|
|
21748
21444
|
"Force change existing organization (may break references)"
|
|
21749
21445
|
).action(
|
|
@@ -21762,10 +21458,10 @@ var setCommand = new Command56().name("set").description("Rename your organizati
|
|
|
21762
21458
|
}
|
|
21763
21459
|
const org = await updateZeroOrg({ slug, force: true });
|
|
21764
21460
|
await saveConfig({ activeOrg: org.slug });
|
|
21765
|
-
console.log(
|
|
21461
|
+
console.log(chalk47.green(`\u2713 Organization updated to ${org.slug}`));
|
|
21766
21462
|
console.log();
|
|
21767
21463
|
console.log("Your agents will now be namespaced as:");
|
|
21768
|
-
console.log(
|
|
21464
|
+
console.log(chalk47.cyan(` ${org.slug}/<agent-name>`));
|
|
21769
21465
|
} catch (error) {
|
|
21770
21466
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
21771
21467
|
throw new Error(
|
|
@@ -21778,27 +21474,27 @@ var setCommand = new Command56().name("set").description("Rename your organizati
|
|
|
21778
21474
|
);
|
|
21779
21475
|
|
|
21780
21476
|
// src/commands/zero/org/list.ts
|
|
21781
|
-
import { Command as
|
|
21782
|
-
import
|
|
21783
|
-
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(
|
|
21784
21480
|
withErrorHandler(async () => {
|
|
21785
21481
|
const result = await listZeroOrgs();
|
|
21786
21482
|
const activeOrg = await getActiveOrg();
|
|
21787
|
-
console.log(
|
|
21483
|
+
console.log(chalk48.bold("Available organizations:"));
|
|
21788
21484
|
for (const org of result.orgs) {
|
|
21789
21485
|
const isCurrent = org.slug === activeOrg;
|
|
21790
|
-
const marker = isCurrent ?
|
|
21486
|
+
const marker = isCurrent ? chalk48.green("* ") : " ";
|
|
21791
21487
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
21792
|
-
const currentLabel = isCurrent ?
|
|
21488
|
+
const currentLabel = isCurrent ? chalk48.dim(" \u2190 current") : "";
|
|
21793
21489
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
21794
21490
|
}
|
|
21795
21491
|
})
|
|
21796
21492
|
);
|
|
21797
21493
|
|
|
21798
21494
|
// src/commands/zero/org/use.ts
|
|
21799
|
-
import { Command as
|
|
21800
|
-
import
|
|
21801
|
-
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(
|
|
21802
21498
|
withErrorHandler(async (slug) => {
|
|
21803
21499
|
const orgList = await listZeroOrgs();
|
|
21804
21500
|
const target = orgList.orgs.find((s) => s.slug === slug);
|
|
@@ -21806,119 +21502,119 @@ var useCommand = new Command58().name("use").description("Switch to a different
|
|
|
21806
21502
|
throw new Error(`Organization '${slug}' not found or not accessible.`);
|
|
21807
21503
|
}
|
|
21808
21504
|
await saveConfig({ activeOrg: slug });
|
|
21809
|
-
console.log(
|
|
21505
|
+
console.log(chalk49.green(`\u2713 Switched to organization: ${slug}`));
|
|
21810
21506
|
})
|
|
21811
21507
|
);
|
|
21812
21508
|
|
|
21813
21509
|
// src/commands/zero/org/members.ts
|
|
21814
|
-
import { Command as
|
|
21815
|
-
import
|
|
21816
|
-
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(
|
|
21817
21513
|
withErrorHandler(async () => {
|
|
21818
21514
|
const status = await getZeroOrgMembers();
|
|
21819
|
-
console.log(
|
|
21515
|
+
console.log(chalk50.bold(`Organization: ${status.slug}`));
|
|
21820
21516
|
console.log(` Role: ${status.role}`);
|
|
21821
21517
|
console.log(
|
|
21822
21518
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
21823
21519
|
);
|
|
21824
21520
|
console.log();
|
|
21825
|
-
console.log(
|
|
21521
|
+
console.log(chalk50.bold("Members:"));
|
|
21826
21522
|
for (const member of status.members) {
|
|
21827
|
-
const roleTag = member.role === "admin" ?
|
|
21523
|
+
const roleTag = member.role === "admin" ? chalk50.yellow(` (${member.role})`) : chalk50.dim(` (${member.role})`);
|
|
21828
21524
|
console.log(` ${member.email}${roleTag}`);
|
|
21829
21525
|
}
|
|
21830
21526
|
})
|
|
21831
21527
|
);
|
|
21832
21528
|
|
|
21833
21529
|
// src/commands/zero/org/invite.ts
|
|
21834
|
-
import { Command as
|
|
21835
|
-
import
|
|
21836
|
-
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(
|
|
21837
21533
|
withErrorHandler(async (options) => {
|
|
21838
21534
|
await inviteZeroOrgMember(options.email);
|
|
21839
|
-
console.log(
|
|
21535
|
+
console.log(chalk51.green(`\u2713 Invitation sent to ${options.email}`));
|
|
21840
21536
|
})
|
|
21841
21537
|
);
|
|
21842
21538
|
|
|
21843
21539
|
// src/commands/zero/org/remove.ts
|
|
21844
|
-
import { Command as
|
|
21845
|
-
import
|
|
21846
|
-
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(
|
|
21847
21543
|
withErrorHandler(async (email) => {
|
|
21848
21544
|
await removeZeroOrgMember(email);
|
|
21849
|
-
console.log(
|
|
21545
|
+
console.log(chalk52.green(`\u2713 Removed ${email} from organization`));
|
|
21850
21546
|
})
|
|
21851
21547
|
);
|
|
21852
21548
|
|
|
21853
21549
|
// src/commands/zero/org/leave.ts
|
|
21854
|
-
import { Command as
|
|
21855
|
-
import
|
|
21856
|
-
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(
|
|
21857
21553
|
withErrorHandler(async () => {
|
|
21858
21554
|
await leaveZeroOrg();
|
|
21859
21555
|
const { orgs } = await listZeroOrgs();
|
|
21860
21556
|
if (orgs.length === 0) {
|
|
21861
21557
|
await saveConfig({ activeOrg: void 0 });
|
|
21862
|
-
console.log(
|
|
21558
|
+
console.log(chalk53.green("\u2713 Left organization."));
|
|
21863
21559
|
console.log(
|
|
21864
|
-
|
|
21560
|
+
chalk53.yellow("No remaining organizations. Run: vm0 auth login")
|
|
21865
21561
|
);
|
|
21866
21562
|
return;
|
|
21867
21563
|
}
|
|
21868
21564
|
const nextOrg = orgs[0].slug;
|
|
21869
21565
|
await saveConfig({ activeOrg: nextOrg });
|
|
21870
|
-
console.log(
|
|
21566
|
+
console.log(chalk53.green(`\u2713 Left organization. Switched to: ${nextOrg}`));
|
|
21871
21567
|
})
|
|
21872
21568
|
);
|
|
21873
21569
|
|
|
21874
21570
|
// src/commands/zero/org/delete.ts
|
|
21875
|
-
import { Command as
|
|
21876
|
-
import
|
|
21877
|
-
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(
|
|
21878
21574
|
withErrorHandler(async (slug) => {
|
|
21879
21575
|
await deleteZeroOrg(slug);
|
|
21880
|
-
console.log(
|
|
21576
|
+
console.log(chalk54.green(`\u2713 Organization '${slug}' has been deleted.`));
|
|
21881
21577
|
})
|
|
21882
21578
|
);
|
|
21883
21579
|
|
|
21884
21580
|
// src/commands/zero/org/secret/index.ts
|
|
21885
|
-
import { Command as
|
|
21581
|
+
import { Command as Command62 } from "commander";
|
|
21886
21582
|
|
|
21887
21583
|
// src/commands/zero/org/secret/list.ts
|
|
21888
|
-
import { Command as
|
|
21889
|
-
import
|
|
21890
|
-
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(
|
|
21891
21587
|
withErrorHandler(async () => {
|
|
21892
21588
|
const result = await listZeroOrgSecrets();
|
|
21893
21589
|
if (result.secrets.length === 0) {
|
|
21894
|
-
console.log(
|
|
21590
|
+
console.log(chalk55.dim("No org secrets found"));
|
|
21895
21591
|
console.log();
|
|
21896
21592
|
console.log("To add an org secret:");
|
|
21897
21593
|
console.log(
|
|
21898
|
-
|
|
21594
|
+
chalk55.cyan(" vm0 zero org secret set MY_API_KEY --body <value>")
|
|
21899
21595
|
);
|
|
21900
21596
|
return;
|
|
21901
21597
|
}
|
|
21902
|
-
console.log(
|
|
21598
|
+
console.log(chalk55.bold("Org Secrets:"));
|
|
21903
21599
|
console.log();
|
|
21904
21600
|
for (const secret of result.secrets) {
|
|
21905
|
-
console.log(` ${
|
|
21601
|
+
console.log(` ${chalk55.cyan(secret.name)}`);
|
|
21906
21602
|
if (secret.description) {
|
|
21907
|
-
console.log(` ${
|
|
21603
|
+
console.log(` ${chalk55.dim(secret.description)}`);
|
|
21908
21604
|
}
|
|
21909
21605
|
console.log(
|
|
21910
|
-
` ${
|
|
21606
|
+
` ${chalk55.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
21911
21607
|
);
|
|
21912
21608
|
console.log();
|
|
21913
21609
|
}
|
|
21914
|
-
console.log(
|
|
21610
|
+
console.log(chalk55.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
21915
21611
|
})
|
|
21916
21612
|
);
|
|
21917
21613
|
|
|
21918
21614
|
// src/commands/zero/org/secret/set.ts
|
|
21919
|
-
import { Command as
|
|
21920
|
-
import
|
|
21921
|
-
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(
|
|
21922
21618
|
"-b, --body <value>",
|
|
21923
21619
|
"Secret value (required in non-interactive mode)"
|
|
21924
21620
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -21957,19 +21653,19 @@ var setCommand2 = new Command65().name("set").description("Create or update an o
|
|
|
21957
21653
|
}
|
|
21958
21654
|
throw error;
|
|
21959
21655
|
}
|
|
21960
|
-
console.log(
|
|
21656
|
+
console.log(chalk56.green(`\u2713 Org secret "${secret.name}" saved`));
|
|
21961
21657
|
console.log();
|
|
21962
21658
|
console.log("Use in vm0.yaml:");
|
|
21963
|
-
console.log(
|
|
21964
|
-
console.log(
|
|
21659
|
+
console.log(chalk56.cyan(` environment:`));
|
|
21660
|
+
console.log(chalk56.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
21965
21661
|
}
|
|
21966
21662
|
)
|
|
21967
21663
|
);
|
|
21968
21664
|
|
|
21969
21665
|
// src/commands/zero/org/secret/remove.ts
|
|
21970
|
-
import { Command as
|
|
21971
|
-
import
|
|
21972
|
-
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(
|
|
21973
21669
|
withErrorHandler(async (name, options) => {
|
|
21974
21670
|
if (!options.yes) {
|
|
21975
21671
|
if (!isInteractive()) {
|
|
@@ -21980,61 +21676,61 @@ var removeCommand2 = new Command66().name("remove").description("Delete an org-l
|
|
|
21980
21676
|
false
|
|
21981
21677
|
);
|
|
21982
21678
|
if (!confirmed) {
|
|
21983
|
-
console.log(
|
|
21679
|
+
console.log(chalk57.dim("Cancelled"));
|
|
21984
21680
|
return;
|
|
21985
21681
|
}
|
|
21986
21682
|
}
|
|
21987
21683
|
await deleteZeroOrgSecret(name);
|
|
21988
|
-
console.log(
|
|
21684
|
+
console.log(chalk57.green(`\u2713 Org secret "${name}" deleted`));
|
|
21989
21685
|
})
|
|
21990
21686
|
);
|
|
21991
21687
|
|
|
21992
21688
|
// src/commands/zero/org/secret/index.ts
|
|
21993
|
-
var zeroOrgSecretCommand = new
|
|
21689
|
+
var zeroOrgSecretCommand = new Command62().name("secret").description("Manage org-level secrets (admin)").addCommand(listCommand7).addCommand(setCommand2).addCommand(removeCommand2);
|
|
21994
21690
|
|
|
21995
21691
|
// src/commands/zero/org/variable/index.ts
|
|
21996
|
-
import { Command as
|
|
21692
|
+
import { Command as Command66 } from "commander";
|
|
21997
21693
|
|
|
21998
21694
|
// src/commands/zero/org/variable/list.ts
|
|
21999
|
-
import { Command as
|
|
22000
|
-
import
|
|
21695
|
+
import { Command as Command63 } from "commander";
|
|
21696
|
+
import chalk58 from "chalk";
|
|
22001
21697
|
function truncateValue(value, maxLength = 60) {
|
|
22002
21698
|
if (value.length <= maxLength) {
|
|
22003
21699
|
return value;
|
|
22004
21700
|
}
|
|
22005
21701
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
22006
21702
|
}
|
|
22007
|
-
var
|
|
21703
|
+
var listCommand8 = new Command63().name("list").alias("ls").description("List all org-level variables").action(
|
|
22008
21704
|
withErrorHandler(async () => {
|
|
22009
21705
|
const result = await listZeroOrgVariables();
|
|
22010
21706
|
if (result.variables.length === 0) {
|
|
22011
|
-
console.log(
|
|
21707
|
+
console.log(chalk58.dim("No org variables found"));
|
|
22012
21708
|
console.log();
|
|
22013
21709
|
console.log("To add an org variable:");
|
|
22014
|
-
console.log(
|
|
21710
|
+
console.log(chalk58.cyan(" vm0 zero org variable set MY_VAR <value>"));
|
|
22015
21711
|
return;
|
|
22016
21712
|
}
|
|
22017
|
-
console.log(
|
|
21713
|
+
console.log(chalk58.bold("Org Variables:"));
|
|
22018
21714
|
console.log();
|
|
22019
21715
|
for (const variable of result.variables) {
|
|
22020
21716
|
const displayValue = truncateValue(variable.value);
|
|
22021
|
-
console.log(` ${
|
|
21717
|
+
console.log(` ${chalk58.cyan(variable.name)} = ${displayValue}`);
|
|
22022
21718
|
if (variable.description) {
|
|
22023
|
-
console.log(` ${
|
|
21719
|
+
console.log(` ${chalk58.dim(variable.description)}`);
|
|
22024
21720
|
}
|
|
22025
21721
|
console.log(
|
|
22026
|
-
` ${
|
|
21722
|
+
` ${chalk58.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
22027
21723
|
);
|
|
22028
21724
|
console.log();
|
|
22029
21725
|
}
|
|
22030
|
-
console.log(
|
|
21726
|
+
console.log(chalk58.dim(`Total: ${result.variables.length} variable(s)`));
|
|
22031
21727
|
})
|
|
22032
21728
|
);
|
|
22033
21729
|
|
|
22034
21730
|
// src/commands/zero/org/variable/set.ts
|
|
22035
|
-
import { Command as
|
|
22036
|
-
import
|
|
22037
|
-
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(
|
|
22038
21734
|
withErrorHandler(
|
|
22039
21735
|
async (name, value, options) => {
|
|
22040
21736
|
let variable;
|
|
@@ -22054,19 +21750,19 @@ var setCommand3 = new Command69().name("set").description("Create or update an o
|
|
|
22054
21750
|
}
|
|
22055
21751
|
throw error;
|
|
22056
21752
|
}
|
|
22057
|
-
console.log(
|
|
21753
|
+
console.log(chalk59.green(`\u2713 Org variable "${variable.name}" saved`));
|
|
22058
21754
|
console.log();
|
|
22059
21755
|
console.log("Use in vm0.yaml:");
|
|
22060
|
-
console.log(
|
|
22061
|
-
console.log(
|
|
21756
|
+
console.log(chalk59.cyan(` environment:`));
|
|
21757
|
+
console.log(chalk59.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
22062
21758
|
}
|
|
22063
21759
|
)
|
|
22064
21760
|
);
|
|
22065
21761
|
|
|
22066
21762
|
// src/commands/zero/org/variable/remove.ts
|
|
22067
|
-
import { Command as
|
|
22068
|
-
import
|
|
22069
|
-
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(
|
|
22070
21766
|
withErrorHandler(async (name, options) => {
|
|
22071
21767
|
if (!options.yes) {
|
|
22072
21768
|
if (!isInteractive()) {
|
|
@@ -22077,32 +21773,32 @@ var removeCommand3 = new Command70().name("remove").description("Delete an org-l
|
|
|
22077
21773
|
false
|
|
22078
21774
|
);
|
|
22079
21775
|
if (!confirmed) {
|
|
22080
|
-
console.log(
|
|
21776
|
+
console.log(chalk60.dim("Cancelled"));
|
|
22081
21777
|
return;
|
|
22082
21778
|
}
|
|
22083
21779
|
}
|
|
22084
21780
|
await deleteZeroOrgVariable(name);
|
|
22085
|
-
console.log(
|
|
21781
|
+
console.log(chalk60.green(`\u2713 Org variable "${name}" deleted`));
|
|
22086
21782
|
})
|
|
22087
21783
|
);
|
|
22088
21784
|
|
|
22089
21785
|
// src/commands/zero/org/variable/index.ts
|
|
22090
|
-
var zeroOrgVariableCommand = new
|
|
21786
|
+
var zeroOrgVariableCommand = new Command66().name("variable").description("Manage org-level variables (admin)").addCommand(listCommand8).addCommand(setCommand3).addCommand(removeCommand3);
|
|
22091
21787
|
|
|
22092
21788
|
// src/commands/zero/org/model-provider/index.ts
|
|
22093
|
-
import { Command as
|
|
21789
|
+
import { Command as Command71 } from "commander";
|
|
22094
21790
|
|
|
22095
21791
|
// src/commands/zero/org/model-provider/list.ts
|
|
22096
|
-
import { Command as
|
|
22097
|
-
import
|
|
22098
|
-
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(
|
|
22099
21795
|
withErrorHandler(async () => {
|
|
22100
21796
|
const result = await listZeroOrgModelProviders();
|
|
22101
21797
|
if (result.modelProviders.length === 0) {
|
|
22102
|
-
console.log(
|
|
21798
|
+
console.log(chalk61.dim("No org-level model providers configured"));
|
|
22103
21799
|
console.log();
|
|
22104
21800
|
console.log("To add an org-level model provider:");
|
|
22105
|
-
console.log(
|
|
21801
|
+
console.log(chalk61.cyan(" vm0 zero org model-provider setup"));
|
|
22106
21802
|
return;
|
|
22107
21803
|
}
|
|
22108
21804
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -22116,16 +21812,16 @@ var listCommand10 = new Command72().name("list").alias("ls").description("List a
|
|
|
22116
21812
|
},
|
|
22117
21813
|
{}
|
|
22118
21814
|
);
|
|
22119
|
-
console.log(
|
|
21815
|
+
console.log(chalk61.bold("Org Model Providers:"));
|
|
22120
21816
|
console.log();
|
|
22121
21817
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
22122
|
-
console.log(` ${
|
|
21818
|
+
console.log(` ${chalk61.cyan(framework)}:`);
|
|
22123
21819
|
for (const provider of providers) {
|
|
22124
|
-
const defaultTag = provider.isDefault ?
|
|
22125
|
-
const modelTag = provider.selectedModel ?
|
|
21820
|
+
const defaultTag = provider.isDefault ? chalk61.green(" (default)") : "";
|
|
21821
|
+
const modelTag = provider.selectedModel ? chalk61.dim(` [${provider.selectedModel}]`) : "";
|
|
22126
21822
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
22127
21823
|
console.log(
|
|
22128
|
-
|
|
21824
|
+
chalk61.dim(
|
|
22129
21825
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
22130
21826
|
)
|
|
22131
21827
|
);
|
|
@@ -22133,18 +21829,18 @@ var listCommand10 = new Command72().name("list").alias("ls").description("List a
|
|
|
22133
21829
|
console.log();
|
|
22134
21830
|
}
|
|
22135
21831
|
console.log(
|
|
22136
|
-
|
|
21832
|
+
chalk61.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
22137
21833
|
);
|
|
22138
21834
|
})
|
|
22139
21835
|
);
|
|
22140
21836
|
|
|
22141
21837
|
// src/commands/zero/org/model-provider/setup.ts
|
|
22142
|
-
import { Command as
|
|
22143
|
-
import
|
|
21838
|
+
import { Command as Command68 } from "commander";
|
|
21839
|
+
import chalk63 from "chalk";
|
|
22144
21840
|
import prompts3 from "prompts";
|
|
22145
21841
|
|
|
22146
21842
|
// src/lib/domain/model-provider/shared.ts
|
|
22147
|
-
import
|
|
21843
|
+
import chalk62 from "chalk";
|
|
22148
21844
|
import prompts2 from "prompts";
|
|
22149
21845
|
function validateProviderType(typeStr) {
|
|
22150
21846
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -22329,7 +22025,7 @@ async function promptForModelSelection(type2) {
|
|
|
22329
22025
|
if (selected === "__custom__") {
|
|
22330
22026
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
22331
22027
|
if (placeholder) {
|
|
22332
|
-
console.log(
|
|
22028
|
+
console.log(chalk62.dim(`Example: ${placeholder}`));
|
|
22333
22029
|
}
|
|
22334
22030
|
const customResponse = await prompts2(
|
|
22335
22031
|
{
|
|
@@ -22379,7 +22075,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
22379
22075
|
const secrets = {};
|
|
22380
22076
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
22381
22077
|
if (fieldConfig.helpText) {
|
|
22382
|
-
console.log(
|
|
22078
|
+
console.log(chalk62.dim(fieldConfig.helpText));
|
|
22383
22079
|
}
|
|
22384
22080
|
const isSensitive = isSensitiveSecret(name);
|
|
22385
22081
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -22436,7 +22132,7 @@ async function handleInteractiveMode() {
|
|
|
22436
22132
|
title = `${title} \u2713`;
|
|
22437
22133
|
}
|
|
22438
22134
|
if (isExperimental) {
|
|
22439
|
-
title = `${title} ${
|
|
22135
|
+
title = `${title} ${chalk63.dim("(experimental)")}`;
|
|
22440
22136
|
}
|
|
22441
22137
|
return {
|
|
22442
22138
|
title,
|
|
@@ -22483,7 +22179,7 @@ async function handleInteractiveMode() {
|
|
|
22483
22179
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
22484
22180
|
console.log();
|
|
22485
22181
|
if ("helpText" in config) {
|
|
22486
|
-
console.log(
|
|
22182
|
+
console.log(chalk63.dim(config.helpText));
|
|
22487
22183
|
}
|
|
22488
22184
|
console.log();
|
|
22489
22185
|
if (hasAuthMethods(type2)) {
|
|
@@ -22525,10 +22221,10 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
22525
22221
|
);
|
|
22526
22222
|
if (response.setDefault) {
|
|
22527
22223
|
await setZeroOrgModelProviderDefault(type2);
|
|
22528
|
-
console.log(
|
|
22224
|
+
console.log(chalk63.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
22529
22225
|
}
|
|
22530
22226
|
}
|
|
22531
|
-
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(
|
|
22532
22228
|
"-s, --secret <value>",
|
|
22533
22229
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
22534
22230
|
collectSecrets,
|
|
@@ -22567,11 +22263,11 @@ var setupCommand = new Command73().name("setup").description("Configure an org-l
|
|
|
22567
22263
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
22568
22264
|
if (!hasModelSelection(input.type)) {
|
|
22569
22265
|
console.log(
|
|
22570
|
-
|
|
22266
|
+
chalk63.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
22571
22267
|
);
|
|
22572
22268
|
} else {
|
|
22573
22269
|
console.log(
|
|
22574
|
-
|
|
22270
|
+
chalk63.green(
|
|
22575
22271
|
`\u2713 Org model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
22576
22272
|
)
|
|
22577
22273
|
);
|
|
@@ -22596,7 +22292,7 @@ var setupCommand = new Command73().name("setup").description("Configure an org-l
|
|
|
22596
22292
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
22597
22293
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
22598
22294
|
console.log(
|
|
22599
|
-
|
|
22295
|
+
chalk63.green(
|
|
22600
22296
|
`\u2713 Org model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
22601
22297
|
)
|
|
22602
22298
|
);
|
|
@@ -22612,9 +22308,9 @@ var setupCommand = new Command73().name("setup").description("Configure an org-l
|
|
|
22612
22308
|
);
|
|
22613
22309
|
|
|
22614
22310
|
// src/commands/zero/org/model-provider/remove.ts
|
|
22615
|
-
import { Command as
|
|
22616
|
-
import
|
|
22617
|
-
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(
|
|
22618
22314
|
withErrorHandler(async (type2) => {
|
|
22619
22315
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
22620
22316
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -22623,14 +22319,14 @@ var removeCommand4 = new Command74().name("remove").description("Remove an org-l
|
|
|
22623
22319
|
});
|
|
22624
22320
|
}
|
|
22625
22321
|
await deleteZeroOrgModelProvider(type2);
|
|
22626
|
-
console.log(
|
|
22322
|
+
console.log(chalk64.green(`\u2713 Org model provider "${type2}" removed`));
|
|
22627
22323
|
})
|
|
22628
22324
|
);
|
|
22629
22325
|
|
|
22630
22326
|
// src/commands/zero/org/model-provider/set-default.ts
|
|
22631
|
-
import { Command as
|
|
22632
|
-
import
|
|
22633
|
-
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(
|
|
22634
22330
|
withErrorHandler(async (type2) => {
|
|
22635
22331
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
22636
22332
|
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
@@ -22642,7 +22338,7 @@ var setDefaultCommand = new Command75().name("set-default").description("Set an
|
|
|
22642
22338
|
type2
|
|
22643
22339
|
);
|
|
22644
22340
|
console.log(
|
|
22645
|
-
|
|
22341
|
+
chalk65.green(
|
|
22646
22342
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
22647
22343
|
)
|
|
22648
22344
|
);
|
|
@@ -22650,19 +22346,19 @@ var setDefaultCommand = new Command75().name("set-default").description("Set an
|
|
|
22650
22346
|
);
|
|
22651
22347
|
|
|
22652
22348
|
// src/commands/zero/org/model-provider/index.ts
|
|
22653
|
-
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);
|
|
22654
22350
|
|
|
22655
22351
|
// src/commands/zero/org/index.ts
|
|
22656
|
-
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);
|
|
22657
22353
|
|
|
22658
22354
|
// src/commands/zero/agent/index.ts
|
|
22659
|
-
import { Command as
|
|
22355
|
+
import { Command as Command78 } from "commander";
|
|
22660
22356
|
|
|
22661
22357
|
// src/commands/zero/agent/create.ts
|
|
22662
|
-
import { Command as
|
|
22358
|
+
import { Command as Command73 } from "commander";
|
|
22663
22359
|
import { readFileSync } from "fs";
|
|
22664
|
-
import
|
|
22665
|
-
var createCommand = new
|
|
22360
|
+
import chalk66 from "chalk";
|
|
22361
|
+
var createCommand = new Command73().name("create").description("Create a new zero agent").requiredOption(
|
|
22666
22362
|
"--connectors <items>",
|
|
22667
22363
|
"Comma-separated connector short names (e.g. github,linear)"
|
|
22668
22364
|
).option("--display-name <name>", "Agent display name").option("--description <text>", "Agent description").option(
|
|
@@ -22682,7 +22378,7 @@ var createCommand = new Command78().name("create").description("Create a new zer
|
|
|
22682
22378
|
const content = readFileSync(options.instructionsFile, "utf-8");
|
|
22683
22379
|
await updateZeroAgentInstructions(agent.name, content);
|
|
22684
22380
|
}
|
|
22685
|
-
console.log(
|
|
22381
|
+
console.log(chalk66.green(`\u2713 Zero agent '${agent.name}' created`));
|
|
22686
22382
|
console.log(` Compose ID: ${agent.agentComposeId}`);
|
|
22687
22383
|
console.log(` Connectors: ${agent.connectors.join(", ")}`);
|
|
22688
22384
|
if (agent.displayName) {
|
|
@@ -22693,10 +22389,10 @@ var createCommand = new Command78().name("create").description("Create a new zer
|
|
|
22693
22389
|
);
|
|
22694
22390
|
|
|
22695
22391
|
// src/commands/zero/agent/edit.ts
|
|
22696
|
-
import { Command as
|
|
22392
|
+
import { Command as Command74 } from "commander";
|
|
22697
22393
|
import { readFileSync as readFileSync2 } from "fs";
|
|
22698
|
-
import
|
|
22699
|
-
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(
|
|
22700
22396
|
"--connectors <items>",
|
|
22701
22397
|
"Comma-separated connector short names (e.g. github,linear)"
|
|
22702
22398
|
).option("--display-name <name>", "New display name").option("--description <text>", "New description").option(
|
|
@@ -22725,20 +22421,20 @@ var editCommand = new Command79().name("edit").description("Edit a zero agent").
|
|
|
22725
22421
|
const content = readFileSync2(options.instructionsFile, "utf-8");
|
|
22726
22422
|
await updateZeroAgentInstructions(name, content);
|
|
22727
22423
|
}
|
|
22728
|
-
console.log(
|
|
22424
|
+
console.log(chalk67.green(`\u2713 Zero agent '${name}' updated`));
|
|
22729
22425
|
}
|
|
22730
22426
|
)
|
|
22731
22427
|
);
|
|
22732
22428
|
|
|
22733
22429
|
// src/commands/zero/agent/view.ts
|
|
22734
|
-
import { Command as
|
|
22735
|
-
import
|
|
22736
|
-
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(
|
|
22737
22433
|
withErrorHandler(
|
|
22738
22434
|
async (name, options) => {
|
|
22739
22435
|
const agent = await getZeroAgent(name);
|
|
22740
|
-
console.log(
|
|
22741
|
-
if (agent.displayName) console.log(
|
|
22436
|
+
console.log(chalk68.bold(agent.name));
|
|
22437
|
+
if (agent.displayName) console.log(chalk68.dim(agent.displayName));
|
|
22742
22438
|
console.log();
|
|
22743
22439
|
console.log(`Compose ID: ${agent.agentComposeId}`);
|
|
22744
22440
|
console.log(`Connectors: ${agent.connectors.join(", ") || "-"}`);
|
|
@@ -22749,10 +22445,10 @@ var viewCommand = new Command80().name("view").description("View a zero agent").
|
|
|
22749
22445
|
console.log();
|
|
22750
22446
|
const result = await getZeroAgentInstructions(name);
|
|
22751
22447
|
if (result.content) {
|
|
22752
|
-
console.log(
|
|
22448
|
+
console.log(chalk68.dim("\u2500\u2500 Instructions \u2500\u2500"));
|
|
22753
22449
|
console.log(result.content);
|
|
22754
22450
|
} else {
|
|
22755
|
-
console.log(
|
|
22451
|
+
console.log(chalk68.dim("No instructions set"));
|
|
22756
22452
|
}
|
|
22757
22453
|
}
|
|
22758
22454
|
}
|
|
@@ -22760,15 +22456,15 @@ var viewCommand = new Command80().name("view").description("View a zero agent").
|
|
|
22760
22456
|
);
|
|
22761
22457
|
|
|
22762
22458
|
// src/commands/zero/agent/list.ts
|
|
22763
|
-
import { Command as
|
|
22764
|
-
import
|
|
22765
|
-
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(
|
|
22766
22462
|
withErrorHandler(async () => {
|
|
22767
22463
|
const agents = await listZeroAgents();
|
|
22768
22464
|
if (agents.length === 0) {
|
|
22769
|
-
console.log(
|
|
22465
|
+
console.log(chalk69.dim("No zero agents found"));
|
|
22770
22466
|
console.log(
|
|
22771
|
-
|
|
22467
|
+
chalk69.dim(
|
|
22772
22468
|
' Create one with: vm0 zero agent create --connectors github --display-name "My Agent"'
|
|
22773
22469
|
)
|
|
22774
22470
|
);
|
|
@@ -22784,7 +22480,7 @@ var listCommand11 = new Command81().name("list").alias("ls").description("List a
|
|
|
22784
22480
|
"DISPLAY NAME".padEnd(displayWidth),
|
|
22785
22481
|
"CONNECTORS"
|
|
22786
22482
|
].join(" ");
|
|
22787
|
-
console.log(
|
|
22483
|
+
console.log(chalk69.dim(header));
|
|
22788
22484
|
for (const agent of agents) {
|
|
22789
22485
|
const row = [
|
|
22790
22486
|
agent.name.padEnd(nameWidth),
|
|
@@ -22797,9 +22493,9 @@ var listCommand11 = new Command81().name("list").alias("ls").description("List a
|
|
|
22797
22493
|
);
|
|
22798
22494
|
|
|
22799
22495
|
// src/commands/zero/agent/delete.ts
|
|
22800
|
-
import { Command as
|
|
22801
|
-
import
|
|
22802
|
-
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(
|
|
22803
22499
|
withErrorHandler(async (name, options) => {
|
|
22804
22500
|
await getZeroAgent(name);
|
|
22805
22501
|
if (!options.yes) {
|
|
@@ -22811,17 +22507,318 @@ var deleteCommand3 = new Command82().name("delete").alias("rm").description("Del
|
|
|
22811
22507
|
false
|
|
22812
22508
|
);
|
|
22813
22509
|
if (!confirmed) {
|
|
22814
|
-
console.log(
|
|
22510
|
+
console.log(chalk70.dim("Cancelled"));
|
|
22815
22511
|
return;
|
|
22816
22512
|
}
|
|
22817
22513
|
}
|
|
22818
22514
|
await deleteZeroAgent(name);
|
|
22819
|
-
console.log(
|
|
22515
|
+
console.log(chalk70.green(`\u2713 Zero agent '${name}' deleted`));
|
|
22820
22516
|
})
|
|
22821
22517
|
);
|
|
22822
22518
|
|
|
22823
22519
|
// src/commands/zero/agent/index.ts
|
|
22824
|
-
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);
|
|
22825
22822
|
|
|
22826
22823
|
// src/commands/zero/schedule/index.ts
|
|
22827
22824
|
import { Command as Command90 } from "commander";
|
|
@@ -22934,7 +22931,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
22934
22931
|
if (!isInteractive()) {
|
|
22935
22932
|
throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
|
|
22936
22933
|
}
|
|
22937
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
22934
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c33) => c33.value === existingFrequency) : 0;
|
|
22938
22935
|
frequency = await promptSelect(
|
|
22939
22936
|
"Schedule frequency",
|
|
22940
22937
|
FREQUENCY_CHOICES,
|
|
@@ -22959,7 +22956,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
22959
22956
|
throw new Error("--day is required for weekly/monthly");
|
|
22960
22957
|
}
|
|
22961
22958
|
if (frequency === "weekly") {
|
|
22962
|
-
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;
|
|
22963
22960
|
const day2 = await promptSelect(
|
|
22964
22961
|
"Day of week",
|
|
22965
22962
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -23479,7 +23476,7 @@ var statusCommand8 = new Command86().name("status").description("Show detailed s
|
|
|
23479
23476
|
// src/commands/zero/schedule/delete.ts
|
|
23480
23477
|
import { Command as Command87 } from "commander";
|
|
23481
23478
|
import chalk78 from "chalk";
|
|
23482
|
-
var
|
|
23479
|
+
var deleteCommand3 = new Command87().name("delete").alias("rm").description("Delete a zero schedule").argument("<agent-name>", "Agent name").option(
|
|
23483
23480
|
"-n, --name <schedule-name>",
|
|
23484
23481
|
"Schedule name (required when agent has multiple schedules)"
|
|
23485
23482
|
).option("-y, --yes", "Skip confirmation prompt").action(
|
|
@@ -23558,7 +23555,7 @@ var disableCommand = new Command89().name("disable").description("Disable a zero
|
|
|
23558
23555
|
);
|
|
23559
23556
|
|
|
23560
23557
|
// src/commands/zero/schedule/index.ts
|
|
23561
|
-
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);
|
|
23562
23559
|
|
|
23563
23560
|
// src/commands/zero/secret/index.ts
|
|
23564
23561
|
import { Command as Command94 } from "commander";
|
|
@@ -23674,7 +23671,7 @@ var setCommand4 = new Command92().name("set").description("Create or update a se
|
|
|
23674
23671
|
// src/commands/zero/secret/delete.ts
|
|
23675
23672
|
import { Command as Command93 } from "commander";
|
|
23676
23673
|
import chalk83 from "chalk";
|
|
23677
|
-
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(
|
|
23678
23675
|
withErrorHandler(async (name, options) => {
|
|
23679
23676
|
if (!options.yes) {
|
|
23680
23677
|
if (!isInteractive()) {
|
|
@@ -23695,7 +23692,7 @@ var deleteCommand5 = new Command93().name("delete").description("Delete a secret
|
|
|
23695
23692
|
);
|
|
23696
23693
|
|
|
23697
23694
|
// src/commands/zero/secret/index.ts
|
|
23698
|
-
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);
|
|
23699
23696
|
|
|
23700
23697
|
// src/commands/zero/variable/index.ts
|
|
23701
23698
|
import { Command as Command98 } from "commander";
|
|
@@ -23771,7 +23768,7 @@ var setCommand5 = new Command96().name("set").description("Create or update a va
|
|
|
23771
23768
|
// src/commands/zero/variable/delete.ts
|
|
23772
23769
|
import { Command as Command97 } from "commander";
|
|
23773
23770
|
import chalk86 from "chalk";
|
|
23774
|
-
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(
|
|
23775
23772
|
withErrorHandler(async (name, options) => {
|
|
23776
23773
|
if (!options.yes) {
|
|
23777
23774
|
if (!isInteractive()) {
|
|
@@ -23792,14 +23789,14 @@ var deleteCommand6 = new Command97().name("delete").description("Delete a variab
|
|
|
23792
23789
|
);
|
|
23793
23790
|
|
|
23794
23791
|
// src/commands/zero/variable/index.ts
|
|
23795
|
-
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);
|
|
23796
23793
|
|
|
23797
23794
|
// src/commands/zero/index.ts
|
|
23798
|
-
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);
|
|
23799
23796
|
|
|
23800
23797
|
// src/index.ts
|
|
23801
23798
|
var program = new Command100();
|
|
23802
|
-
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");
|
|
23803
23800
|
program.addCommand(authCommand);
|
|
23804
23801
|
program.addCommand(infoCommand);
|
|
23805
23802
|
program.addCommand(composeCommand);
|
|
@@ -23809,7 +23806,6 @@ program.addCommand(artifactCommand);
|
|
|
23809
23806
|
program.addCommand(memoryCommand);
|
|
23810
23807
|
program.addCommand(cookCommand);
|
|
23811
23808
|
program.addCommand(logsCommand2);
|
|
23812
|
-
program.addCommand(agentCommand);
|
|
23813
23809
|
program.addCommand(initCommand4);
|
|
23814
23810
|
program.addCommand(connectorCommand);
|
|
23815
23811
|
program.addCommand(preferenceCommand);
|