@vm0/cli 9.75.1 → 9.76.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 +1413 -210
- 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.76.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.76.0",
|
|
70
70
|
command: process.argv.slice(2).join(" ")
|
|
71
71
|
});
|
|
72
72
|
Sentry.setContext("runtime", {
|
|
@@ -85,7 +85,7 @@ process.stdout.on("error", handleEpipe);
|
|
|
85
85
|
process.stderr.on("error", handleEpipe);
|
|
86
86
|
|
|
87
87
|
// src/index.ts
|
|
88
|
-
import { Command as
|
|
88
|
+
import { Command as Command122 } from "commander";
|
|
89
89
|
|
|
90
90
|
// src/lib/network/proxy.ts
|
|
91
91
|
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
@@ -13071,6 +13071,11 @@ var zeroAgentRequestSchema = z31.object({
|
|
|
13071
13071
|
sound: z31.string().optional(),
|
|
13072
13072
|
connectors: z31.array(z31.string())
|
|
13073
13073
|
});
|
|
13074
|
+
var zeroAgentMetadataRequestSchema = z31.object({
|
|
13075
|
+
displayName: z31.string().optional(),
|
|
13076
|
+
description: z31.string().optional(),
|
|
13077
|
+
sound: z31.string().optional()
|
|
13078
|
+
});
|
|
13074
13079
|
var zeroAgentInstructionsResponseSchema = z31.object({
|
|
13075
13080
|
content: z31.string().nullable(),
|
|
13076
13081
|
filename: z31.string().nullable()
|
|
@@ -13091,6 +13096,16 @@ var zeroAgentsMainContract = c27.router({
|
|
|
13091
13096
|
422: apiErrorSchema
|
|
13092
13097
|
},
|
|
13093
13098
|
summary: "Create zero agent"
|
|
13099
|
+
},
|
|
13100
|
+
list: {
|
|
13101
|
+
method: "GET",
|
|
13102
|
+
path: "/api/zero/agents",
|
|
13103
|
+
headers: authHeadersSchema,
|
|
13104
|
+
responses: {
|
|
13105
|
+
200: z31.array(zeroAgentResponseSchema),
|
|
13106
|
+
401: apiErrorSchema
|
|
13107
|
+
},
|
|
13108
|
+
summary: "List zero agents"
|
|
13094
13109
|
}
|
|
13095
13110
|
});
|
|
13096
13111
|
var zeroAgentsByNameContract = c27.router({
|
|
@@ -13120,6 +13135,32 @@ var zeroAgentsByNameContract = c27.router({
|
|
|
13120
13135
|
422: apiErrorSchema
|
|
13121
13136
|
},
|
|
13122
13137
|
summary: "Update zero agent"
|
|
13138
|
+
},
|
|
13139
|
+
updateMetadata: {
|
|
13140
|
+
method: "PATCH",
|
|
13141
|
+
path: "/api/zero/agents/:name",
|
|
13142
|
+
headers: authHeadersSchema,
|
|
13143
|
+
pathParams: z31.object({ name: z31.string() }),
|
|
13144
|
+
body: zeroAgentMetadataRequestSchema,
|
|
13145
|
+
responses: {
|
|
13146
|
+
200: zeroAgentResponseSchema,
|
|
13147
|
+
401: apiErrorSchema,
|
|
13148
|
+
404: apiErrorSchema
|
|
13149
|
+
},
|
|
13150
|
+
summary: "Update zero agent metadata"
|
|
13151
|
+
},
|
|
13152
|
+
delete: {
|
|
13153
|
+
method: "DELETE",
|
|
13154
|
+
path: "/api/zero/agents/:name",
|
|
13155
|
+
headers: authHeadersSchema,
|
|
13156
|
+
pathParams: z31.object({ name: z31.string() }),
|
|
13157
|
+
body: c27.noBody(),
|
|
13158
|
+
responses: {
|
|
13159
|
+
204: c27.noBody(),
|
|
13160
|
+
401: apiErrorSchema,
|
|
13161
|
+
404: apiErrorSchema
|
|
13162
|
+
},
|
|
13163
|
+
summary: "Delete zero agent by name"
|
|
13123
13164
|
}
|
|
13124
13165
|
});
|
|
13125
13166
|
var zeroAgentInstructionsContract = c27.router({
|
|
@@ -13747,8 +13788,20 @@ var zeroUserPreferencesContract = c36.router({
|
|
|
13747
13788
|
});
|
|
13748
13789
|
|
|
13749
13790
|
// ../../packages/core/src/contracts/zero-secrets.ts
|
|
13791
|
+
import { z as z38 } from "zod";
|
|
13750
13792
|
var c37 = initContract();
|
|
13751
13793
|
var zeroSecretsContract = c37.router({
|
|
13794
|
+
list: {
|
|
13795
|
+
method: "GET",
|
|
13796
|
+
path: "/api/zero/secrets",
|
|
13797
|
+
headers: authHeadersSchema,
|
|
13798
|
+
responses: {
|
|
13799
|
+
200: secretListResponseSchema,
|
|
13800
|
+
401: apiErrorSchema,
|
|
13801
|
+
500: apiErrorSchema
|
|
13802
|
+
},
|
|
13803
|
+
summary: "List all secrets (metadata only)"
|
|
13804
|
+
},
|
|
13752
13805
|
set: {
|
|
13753
13806
|
method: "POST",
|
|
13754
13807
|
path: "/api/zero/secrets",
|
|
@@ -13764,7 +13817,35 @@ var zeroSecretsContract = c37.router({
|
|
|
13764
13817
|
summary: "Create or update a secret"
|
|
13765
13818
|
}
|
|
13766
13819
|
});
|
|
13820
|
+
var zeroSecretsByNameContract = c37.router({
|
|
13821
|
+
delete: {
|
|
13822
|
+
method: "DELETE",
|
|
13823
|
+
path: "/api/zero/secrets/:name",
|
|
13824
|
+
headers: authHeadersSchema,
|
|
13825
|
+
pathParams: z38.object({
|
|
13826
|
+
name: secretNameSchema
|
|
13827
|
+
}),
|
|
13828
|
+
responses: {
|
|
13829
|
+
204: c37.noBody(),
|
|
13830
|
+
401: apiErrorSchema,
|
|
13831
|
+
404: apiErrorSchema,
|
|
13832
|
+
500: apiErrorSchema
|
|
13833
|
+
},
|
|
13834
|
+
summary: "Delete a secret by name"
|
|
13835
|
+
}
|
|
13836
|
+
});
|
|
13767
13837
|
var zeroVariablesContract = c37.router({
|
|
13838
|
+
list: {
|
|
13839
|
+
method: "GET",
|
|
13840
|
+
path: "/api/zero/variables",
|
|
13841
|
+
headers: authHeadersSchema,
|
|
13842
|
+
responses: {
|
|
13843
|
+
200: variableListResponseSchema,
|
|
13844
|
+
401: apiErrorSchema,
|
|
13845
|
+
500: apiErrorSchema
|
|
13846
|
+
},
|
|
13847
|
+
summary: "List all variables (includes values)"
|
|
13848
|
+
},
|
|
13768
13849
|
set: {
|
|
13769
13850
|
method: "POST",
|
|
13770
13851
|
path: "/api/zero/variables",
|
|
@@ -13780,17 +13861,34 @@ var zeroVariablesContract = c37.router({
|
|
|
13780
13861
|
summary: "Create or update a variable"
|
|
13781
13862
|
}
|
|
13782
13863
|
});
|
|
13864
|
+
var zeroVariablesByNameContract = c37.router({
|
|
13865
|
+
delete: {
|
|
13866
|
+
method: "DELETE",
|
|
13867
|
+
path: "/api/zero/variables/:name",
|
|
13868
|
+
headers: authHeadersSchema,
|
|
13869
|
+
pathParams: z38.object({
|
|
13870
|
+
name: variableNameSchema
|
|
13871
|
+
}),
|
|
13872
|
+
responses: {
|
|
13873
|
+
204: c37.noBody(),
|
|
13874
|
+
401: apiErrorSchema,
|
|
13875
|
+
404: apiErrorSchema,
|
|
13876
|
+
500: apiErrorSchema
|
|
13877
|
+
},
|
|
13878
|
+
summary: "Delete a variable by name"
|
|
13879
|
+
}
|
|
13880
|
+
});
|
|
13783
13881
|
|
|
13784
13882
|
// ../../packages/core/src/contracts/zero-sessions.ts
|
|
13785
|
-
import { z as
|
|
13883
|
+
import { z as z39 } from "zod";
|
|
13786
13884
|
var c38 = initContract();
|
|
13787
13885
|
var zeroSessionsByIdContract = c38.router({
|
|
13788
13886
|
getById: {
|
|
13789
13887
|
method: "GET",
|
|
13790
13888
|
path: "/api/zero/sessions/:id",
|
|
13791
13889
|
headers: authHeadersSchema,
|
|
13792
|
-
pathParams:
|
|
13793
|
-
id:
|
|
13890
|
+
pathParams: z39.object({
|
|
13891
|
+
id: z39.string().min(1, "Session ID is required")
|
|
13794
13892
|
}),
|
|
13795
13893
|
responses: {
|
|
13796
13894
|
200: sessionResponseSchema,
|
|
@@ -13803,24 +13901,24 @@ var zeroSessionsByIdContract = c38.router({
|
|
|
13803
13901
|
});
|
|
13804
13902
|
|
|
13805
13903
|
// ../../packages/core/src/contracts/integrations.ts
|
|
13806
|
-
import { z as
|
|
13904
|
+
import { z as z40 } from "zod";
|
|
13807
13905
|
var c39 = initContract();
|
|
13808
13906
|
var integrationsSlackMessageContract = c39.router({
|
|
13809
13907
|
sendMessage: {
|
|
13810
13908
|
method: "POST",
|
|
13811
13909
|
path: "/api/agent/integrations/slack/message",
|
|
13812
13910
|
headers: authHeadersSchema,
|
|
13813
|
-
body:
|
|
13814
|
-
channel:
|
|
13815
|
-
text:
|
|
13816
|
-
threadTs:
|
|
13817
|
-
blocks:
|
|
13911
|
+
body: z40.object({
|
|
13912
|
+
channel: z40.string().min(1, "Channel ID is required"),
|
|
13913
|
+
text: z40.string().optional(),
|
|
13914
|
+
threadTs: z40.string().optional(),
|
|
13915
|
+
blocks: z40.array(z40.object({ type: z40.string() }).passthrough()).optional()
|
|
13818
13916
|
}),
|
|
13819
13917
|
responses: {
|
|
13820
|
-
200:
|
|
13821
|
-
ok:
|
|
13822
|
-
ts:
|
|
13823
|
-
channel:
|
|
13918
|
+
200: z40.object({
|
|
13919
|
+
ok: z40.literal(true),
|
|
13920
|
+
ts: z40.string().optional(),
|
|
13921
|
+
channel: z40.string().optional()
|
|
13824
13922
|
}),
|
|
13825
13923
|
400: apiErrorSchema,
|
|
13826
13924
|
401: apiErrorSchema,
|
|
@@ -13832,39 +13930,39 @@ var integrationsSlackMessageContract = c39.router({
|
|
|
13832
13930
|
});
|
|
13833
13931
|
|
|
13834
13932
|
// ../../packages/core/src/contracts/zero-billing.ts
|
|
13835
|
-
import { z as
|
|
13933
|
+
import { z as z41 } from "zod";
|
|
13836
13934
|
var c40 = initContract();
|
|
13837
|
-
var autoRechargeSchema =
|
|
13838
|
-
enabled:
|
|
13839
|
-
threshold:
|
|
13840
|
-
amount:
|
|
13841
|
-
});
|
|
13842
|
-
var billingStatusResponseSchema =
|
|
13843
|
-
tier:
|
|
13844
|
-
credits:
|
|
13845
|
-
subscriptionStatus:
|
|
13846
|
-
currentPeriodEnd:
|
|
13847
|
-
hasSubscription:
|
|
13935
|
+
var autoRechargeSchema = z41.object({
|
|
13936
|
+
enabled: z41.boolean(),
|
|
13937
|
+
threshold: z41.number().nullable(),
|
|
13938
|
+
amount: z41.number().nullable()
|
|
13939
|
+
});
|
|
13940
|
+
var billingStatusResponseSchema = z41.object({
|
|
13941
|
+
tier: z41.string(),
|
|
13942
|
+
credits: z41.number(),
|
|
13943
|
+
subscriptionStatus: z41.string().nullable(),
|
|
13944
|
+
currentPeriodEnd: z41.string().nullable(),
|
|
13945
|
+
hasSubscription: z41.boolean(),
|
|
13848
13946
|
autoRecharge: autoRechargeSchema
|
|
13849
13947
|
});
|
|
13850
|
-
var checkoutResponseSchema =
|
|
13851
|
-
url:
|
|
13948
|
+
var checkoutResponseSchema = z41.object({
|
|
13949
|
+
url: z41.string()
|
|
13852
13950
|
});
|
|
13853
|
-
var portalResponseSchema =
|
|
13854
|
-
url:
|
|
13951
|
+
var portalResponseSchema = z41.object({
|
|
13952
|
+
url: z41.string()
|
|
13855
13953
|
});
|
|
13856
|
-
var checkoutRequestSchema =
|
|
13857
|
-
tier:
|
|
13858
|
-
successUrl:
|
|
13859
|
-
cancelUrl:
|
|
13954
|
+
var checkoutRequestSchema = z41.object({
|
|
13955
|
+
tier: z41.enum(["pro", "team"]),
|
|
13956
|
+
successUrl: z41.string().url(),
|
|
13957
|
+
cancelUrl: z41.string().url()
|
|
13860
13958
|
});
|
|
13861
|
-
var portalRequestSchema =
|
|
13862
|
-
returnUrl:
|
|
13959
|
+
var portalRequestSchema = z41.object({
|
|
13960
|
+
returnUrl: z41.string().min(1)
|
|
13863
13961
|
});
|
|
13864
|
-
var autoRechargeUpdateRequestSchema =
|
|
13865
|
-
enabled:
|
|
13866
|
-
threshold:
|
|
13867
|
-
amount:
|
|
13962
|
+
var autoRechargeUpdateRequestSchema = z41.object({
|
|
13963
|
+
enabled: z41.boolean(),
|
|
13964
|
+
threshold: z41.number().int().positive().optional(),
|
|
13965
|
+
amount: z41.number().int().min(1e3).optional()
|
|
13868
13966
|
});
|
|
13869
13967
|
var zeroBillingStatusContract = c40.router({
|
|
13870
13968
|
get: {
|
|
@@ -13940,23 +14038,23 @@ var zeroBillingAutoRechargeContract = c40.router({
|
|
|
13940
14038
|
});
|
|
13941
14039
|
|
|
13942
14040
|
// ../../packages/core/src/contracts/zero-usage.ts
|
|
13943
|
-
import { z as
|
|
14041
|
+
import { z as z42 } from "zod";
|
|
13944
14042
|
var c41 = initContract();
|
|
13945
|
-
var memberUsageSchema =
|
|
13946
|
-
userId:
|
|
13947
|
-
email:
|
|
13948
|
-
inputTokens:
|
|
13949
|
-
outputTokens:
|
|
13950
|
-
cacheReadInputTokens:
|
|
13951
|
-
cacheCreationInputTokens:
|
|
13952
|
-
creditsCharged:
|
|
13953
|
-
});
|
|
13954
|
-
var usageMembersResponseSchema =
|
|
13955
|
-
period:
|
|
13956
|
-
start:
|
|
13957
|
-
end:
|
|
14043
|
+
var memberUsageSchema = z42.object({
|
|
14044
|
+
userId: z42.string(),
|
|
14045
|
+
email: z42.string(),
|
|
14046
|
+
inputTokens: z42.number(),
|
|
14047
|
+
outputTokens: z42.number(),
|
|
14048
|
+
cacheReadInputTokens: z42.number(),
|
|
14049
|
+
cacheCreationInputTokens: z42.number(),
|
|
14050
|
+
creditsCharged: z42.number()
|
|
14051
|
+
});
|
|
14052
|
+
var usageMembersResponseSchema = z42.object({
|
|
14053
|
+
period: z42.object({
|
|
14054
|
+
start: z42.string(),
|
|
14055
|
+
end: z42.string()
|
|
13958
14056
|
}).nullable(),
|
|
13959
|
-
members:
|
|
14057
|
+
members: z42.array(memberUsageSchema)
|
|
13960
14058
|
});
|
|
13961
14059
|
var zeroUsageMembersContract = c41.router({
|
|
13962
14060
|
get: {
|
|
@@ -14611,7 +14709,7 @@ function getConfigPath() {
|
|
|
14611
14709
|
return join2(homedir2(), ".vm0", "config.json");
|
|
14612
14710
|
}
|
|
14613
14711
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
14614
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
14712
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.76.0"}`));
|
|
14615
14713
|
console.log();
|
|
14616
14714
|
const config = await loadConfig();
|
|
14617
14715
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -15370,126 +15468,398 @@ async function resolveSkills(skillUrls) {
|
|
|
15370
15468
|
}
|
|
15371
15469
|
}
|
|
15372
15470
|
|
|
15373
|
-
// src/lib/
|
|
15374
|
-
import {
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
)
|
|
15379
|
-
|
|
15380
|
-
(agent, ctx) => {
|
|
15381
|
-
if (agent.skills) {
|
|
15382
|
-
for (let i = 0; i < agent.skills.length; i++) {
|
|
15383
|
-
const skillRef = agent.skills[i];
|
|
15384
|
-
if (skillRef) {
|
|
15385
|
-
try {
|
|
15386
|
-
resolveSkillRef(skillRef);
|
|
15387
|
-
} catch (error) {
|
|
15388
|
-
ctx.addIssue({
|
|
15389
|
-
code: z42.ZodIssueCode.custom,
|
|
15390
|
-
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
15391
|
-
path: ["skills", i]
|
|
15392
|
-
});
|
|
15393
|
-
}
|
|
15394
|
-
}
|
|
15395
|
-
}
|
|
15396
|
-
}
|
|
15397
|
-
}
|
|
15398
|
-
);
|
|
15399
|
-
var cliComposeSchema = z42.object({
|
|
15400
|
-
version: z42.string().min(1, "Missing config.version"),
|
|
15401
|
-
agents: z42.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
15402
|
-
volumes: z42.record(z42.string(), volumeConfigSchema).optional()
|
|
15403
|
-
}).superRefine((config, ctx) => {
|
|
15404
|
-
const agentKeys = Object.keys(config.agents);
|
|
15405
|
-
if (agentKeys.length === 0) {
|
|
15406
|
-
ctx.addIssue({
|
|
15407
|
-
code: z42.ZodIssueCode.custom,
|
|
15408
|
-
message: "agents must have at least one agent defined",
|
|
15409
|
-
path: ["agents"]
|
|
15410
|
-
});
|
|
15411
|
-
return;
|
|
15471
|
+
// src/lib/api/domains/zero-orgs.ts
|
|
15472
|
+
import { initClient as initClient14 } from "@ts-rest/core";
|
|
15473
|
+
async function getUserTokenClientConfig2() {
|
|
15474
|
+
const baseUrl = await getBaseUrl();
|
|
15475
|
+
const token = await getToken();
|
|
15476
|
+
if (!token) {
|
|
15477
|
+
throw new Error("Not authenticated. Run: vm0 auth login");
|
|
15412
15478
|
}
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
return;
|
|
15479
|
+
const headers = {
|
|
15480
|
+
Authorization: `Bearer ${token}`
|
|
15481
|
+
};
|
|
15482
|
+
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
15483
|
+
if (bypassSecret) {
|
|
15484
|
+
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
15420
15485
|
}
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
path: ["volumes"]
|
|
15430
|
-
});
|
|
15431
|
-
return;
|
|
15432
|
-
}
|
|
15433
|
-
for (const volDeclaration of agentVolumes) {
|
|
15434
|
-
const parts = volDeclaration.split(":");
|
|
15435
|
-
if (parts.length !== 2) {
|
|
15436
|
-
ctx.addIssue({
|
|
15437
|
-
code: z42.ZodIssueCode.custom,
|
|
15438
|
-
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
15439
|
-
path: ["agents", agentName, "volumes"]
|
|
15440
|
-
});
|
|
15441
|
-
continue;
|
|
15442
|
-
}
|
|
15443
|
-
const volumeKey = parts[0].trim();
|
|
15444
|
-
if (!config.volumes[volumeKey]) {
|
|
15445
|
-
ctx.addIssue({
|
|
15446
|
-
code: z42.ZodIssueCode.custom,
|
|
15447
|
-
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
15448
|
-
path: ["volumes", volumeKey]
|
|
15449
|
-
});
|
|
15450
|
-
}
|
|
15451
|
-
}
|
|
15486
|
+
return { baseUrl, baseHeaders: headers, jsonQuery: false };
|
|
15487
|
+
}
|
|
15488
|
+
async function getZeroOrg() {
|
|
15489
|
+
const config = await getClientConfig();
|
|
15490
|
+
const client = initClient14(zeroOrgContract, config);
|
|
15491
|
+
const result = await client.get({ headers: {} });
|
|
15492
|
+
if (result.status === 200) {
|
|
15493
|
+
return result.body;
|
|
15452
15494
|
}
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
const
|
|
15457
|
-
|
|
15458
|
-
|
|
15495
|
+
handleError(result, "Failed to get organization");
|
|
15496
|
+
}
|
|
15497
|
+
async function updateZeroOrg(body) {
|
|
15498
|
+
const config = await getClientConfig();
|
|
15499
|
+
const client = initClient14(zeroOrgContract, config);
|
|
15500
|
+
const result = await client.update({ body });
|
|
15501
|
+
if (result.status === 200) {
|
|
15502
|
+
return result.body;
|
|
15459
15503
|
}
|
|
15460
|
-
|
|
15461
|
-
|
|
15504
|
+
handleError(result, "Failed to update organization");
|
|
15505
|
+
}
|
|
15506
|
+
async function listZeroOrgs() {
|
|
15507
|
+
const config = await getUserTokenClientConfig2();
|
|
15508
|
+
const client = initClient14(zeroOrgListContract, config);
|
|
15509
|
+
const result = await client.list({ headers: {} });
|
|
15510
|
+
if (result.status === 200) {
|
|
15511
|
+
return result.body;
|
|
15462
15512
|
}
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
15513
|
+
handleError(result, "Failed to list organizations");
|
|
15514
|
+
}
|
|
15515
|
+
async function getZeroOrgMembers() {
|
|
15516
|
+
const config = await getClientConfig();
|
|
15517
|
+
const client = initClient14(zeroOrgMembersContract, config);
|
|
15518
|
+
const result = await client.members({ headers: {} });
|
|
15519
|
+
if (result.status === 200) {
|
|
15520
|
+
return result.body;
|
|
15466
15521
|
}
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15522
|
+
handleError(result, "Failed to get organization members");
|
|
15523
|
+
}
|
|
15524
|
+
async function inviteZeroOrgMember(email) {
|
|
15525
|
+
const config = await getClientConfig();
|
|
15526
|
+
const client = initClient14(zeroOrgInviteContract, config);
|
|
15527
|
+
const result = await client.invite({
|
|
15528
|
+
body: { email }
|
|
15529
|
+
});
|
|
15530
|
+
if (result.status === 200) {
|
|
15531
|
+
return;
|
|
15470
15532
|
}
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15533
|
+
handleError(result, "Failed to invite member");
|
|
15534
|
+
}
|
|
15535
|
+
async function removeZeroOrgMember(email) {
|
|
15536
|
+
const config = await getClientConfig();
|
|
15537
|
+
const client = initClient14(zeroOrgMembersContract, config);
|
|
15538
|
+
const result = await client.removeMember({
|
|
15539
|
+
body: { email }
|
|
15540
|
+
});
|
|
15541
|
+
if (result.status === 200) {
|
|
15542
|
+
return;
|
|
15474
15543
|
}
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15544
|
+
handleError(result, "Failed to remove member");
|
|
15545
|
+
}
|
|
15546
|
+
async function leaveZeroOrg() {
|
|
15547
|
+
const config = await getClientConfig();
|
|
15548
|
+
const client = initClient14(zeroOrgLeaveContract, config);
|
|
15549
|
+
const result = await client.leave({
|
|
15550
|
+
body: {}
|
|
15551
|
+
});
|
|
15552
|
+
if (result.status === 200) {
|
|
15553
|
+
return;
|
|
15481
15554
|
}
|
|
15482
|
-
|
|
15555
|
+
handleError(result, "Failed to leave organization");
|
|
15483
15556
|
}
|
|
15484
|
-
function
|
|
15485
|
-
const
|
|
15486
|
-
|
|
15487
|
-
const
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
if (
|
|
15491
|
-
|
|
15492
|
-
|
|
15557
|
+
async function deleteZeroOrg(slug) {
|
|
15558
|
+
const config = await getClientConfig();
|
|
15559
|
+
const client = initClient14(zeroOrgDeleteContract, config);
|
|
15560
|
+
const result = await client.delete({
|
|
15561
|
+
body: { slug }
|
|
15562
|
+
});
|
|
15563
|
+
if (result.status === 200) {
|
|
15564
|
+
return;
|
|
15565
|
+
}
|
|
15566
|
+
handleError(result, "Failed to delete organization");
|
|
15567
|
+
}
|
|
15568
|
+
|
|
15569
|
+
// src/lib/api/domains/zero-org-secrets.ts
|
|
15570
|
+
import { initClient as initClient15 } from "@ts-rest/core";
|
|
15571
|
+
async function listZeroOrgSecrets() {
|
|
15572
|
+
const config = await getClientConfig();
|
|
15573
|
+
const client = initClient15(zeroSecretsContract, config);
|
|
15574
|
+
const result = await client.list({ headers: {} });
|
|
15575
|
+
if (result.status === 200) {
|
|
15576
|
+
return result.body;
|
|
15577
|
+
}
|
|
15578
|
+
handleError(result, "Failed to list org secrets");
|
|
15579
|
+
}
|
|
15580
|
+
async function setZeroOrgSecret(body) {
|
|
15581
|
+
const config = await getClientConfig();
|
|
15582
|
+
const client = initClient15(zeroSecretsContract, config);
|
|
15583
|
+
const result = await client.set({ body });
|
|
15584
|
+
if (result.status === 200 || result.status === 201) {
|
|
15585
|
+
return result.body;
|
|
15586
|
+
}
|
|
15587
|
+
handleError(result, "Failed to set org secret");
|
|
15588
|
+
}
|
|
15589
|
+
async function deleteZeroOrgSecret(name) {
|
|
15590
|
+
const config = await getClientConfig();
|
|
15591
|
+
const client = initClient15(zeroSecretsByNameContract, config);
|
|
15592
|
+
const result = await client.delete({
|
|
15593
|
+
params: { name }
|
|
15594
|
+
});
|
|
15595
|
+
if (result.status === 204) {
|
|
15596
|
+
return;
|
|
15597
|
+
}
|
|
15598
|
+
handleError(result, `Org secret "${name}" not found`);
|
|
15599
|
+
}
|
|
15600
|
+
|
|
15601
|
+
// src/lib/api/domains/zero-org-variables.ts
|
|
15602
|
+
import { initClient as initClient16 } from "@ts-rest/core";
|
|
15603
|
+
async function listZeroOrgVariables() {
|
|
15604
|
+
const config = await getClientConfig();
|
|
15605
|
+
const client = initClient16(zeroVariablesContract, config);
|
|
15606
|
+
const result = await client.list({ headers: {} });
|
|
15607
|
+
if (result.status === 200) {
|
|
15608
|
+
return result.body;
|
|
15609
|
+
}
|
|
15610
|
+
handleError(result, "Failed to list org variables");
|
|
15611
|
+
}
|
|
15612
|
+
async function setZeroOrgVariable(body) {
|
|
15613
|
+
const config = await getClientConfig();
|
|
15614
|
+
const client = initClient16(zeroVariablesContract, config);
|
|
15615
|
+
const result = await client.set({ body });
|
|
15616
|
+
if (result.status === 200 || result.status === 201) {
|
|
15617
|
+
return result.body;
|
|
15618
|
+
}
|
|
15619
|
+
handleError(result, "Failed to set org variable");
|
|
15620
|
+
}
|
|
15621
|
+
async function deleteZeroOrgVariable(name) {
|
|
15622
|
+
const config = await getClientConfig();
|
|
15623
|
+
const client = initClient16(zeroVariablesByNameContract, config);
|
|
15624
|
+
const result = await client.delete({
|
|
15625
|
+
params: { name }
|
|
15626
|
+
});
|
|
15627
|
+
if (result.status === 204) {
|
|
15628
|
+
return;
|
|
15629
|
+
}
|
|
15630
|
+
handleError(result, `Org variable "${name}" not found`);
|
|
15631
|
+
}
|
|
15632
|
+
|
|
15633
|
+
// src/lib/api/domains/zero-org-model-providers.ts
|
|
15634
|
+
import { initClient as initClient17 } from "@ts-rest/core";
|
|
15635
|
+
async function listZeroOrgModelProviders() {
|
|
15636
|
+
const config = await getClientConfig();
|
|
15637
|
+
const client = initClient17(zeroModelProvidersMainContract, config);
|
|
15638
|
+
const result = await client.list({ headers: {} });
|
|
15639
|
+
if (result.status === 200) {
|
|
15640
|
+
return result.body;
|
|
15641
|
+
}
|
|
15642
|
+
handleError(result, "Failed to list org model providers");
|
|
15643
|
+
}
|
|
15644
|
+
async function upsertZeroOrgModelProvider(body) {
|
|
15645
|
+
const config = await getClientConfig();
|
|
15646
|
+
const client = initClient17(zeroModelProvidersMainContract, config);
|
|
15647
|
+
const result = await client.upsert({ body });
|
|
15648
|
+
if (result.status === 200 || result.status === 201) {
|
|
15649
|
+
return result.body;
|
|
15650
|
+
}
|
|
15651
|
+
handleError(result, "Failed to set org model provider");
|
|
15652
|
+
}
|
|
15653
|
+
async function deleteZeroOrgModelProvider(type2) {
|
|
15654
|
+
const config = await getClientConfig();
|
|
15655
|
+
const client = initClient17(zeroModelProvidersByTypeContract, config);
|
|
15656
|
+
const result = await client.delete({
|
|
15657
|
+
params: { type: type2 }
|
|
15658
|
+
});
|
|
15659
|
+
if (result.status === 204) {
|
|
15660
|
+
return;
|
|
15661
|
+
}
|
|
15662
|
+
handleError(result, `Org model provider "${type2}" not found`);
|
|
15663
|
+
}
|
|
15664
|
+
async function setZeroOrgModelProviderDefault(type2) {
|
|
15665
|
+
const config = await getClientConfig();
|
|
15666
|
+
const client = initClient17(zeroModelProvidersDefaultContract, config);
|
|
15667
|
+
const result = await client.setDefault({
|
|
15668
|
+
params: { type: type2 }
|
|
15669
|
+
});
|
|
15670
|
+
if (result.status === 200) {
|
|
15671
|
+
return result.body;
|
|
15672
|
+
}
|
|
15673
|
+
handleError(result, "Failed to set default org model provider");
|
|
15674
|
+
}
|
|
15675
|
+
async function updateZeroOrgModelProviderModel(type2, selectedModel) {
|
|
15676
|
+
const config = await getClientConfig();
|
|
15677
|
+
const client = initClient17(zeroModelProvidersUpdateModelContract, config);
|
|
15678
|
+
const result = await client.updateModel({
|
|
15679
|
+
params: { type: type2 },
|
|
15680
|
+
body: { selectedModel }
|
|
15681
|
+
});
|
|
15682
|
+
if (result.status === 200) {
|
|
15683
|
+
return result.body;
|
|
15684
|
+
}
|
|
15685
|
+
handleError(result, "Failed to update org model provider");
|
|
15686
|
+
}
|
|
15687
|
+
|
|
15688
|
+
// src/lib/api/domains/zero-agents.ts
|
|
15689
|
+
import { initClient as initClient18 } from "@ts-rest/core";
|
|
15690
|
+
async function createZeroAgent(body) {
|
|
15691
|
+
const config = await getClientConfig();
|
|
15692
|
+
const client = initClient18(zeroAgentsMainContract, config);
|
|
15693
|
+
const result = await client.create({ body });
|
|
15694
|
+
if (result.status === 201) return result.body;
|
|
15695
|
+
handleError(result, "Failed to create zero agent");
|
|
15696
|
+
}
|
|
15697
|
+
async function listZeroAgents() {
|
|
15698
|
+
const config = await getClientConfig();
|
|
15699
|
+
const client = initClient18(zeroAgentsMainContract, config);
|
|
15700
|
+
const result = await client.list({ headers: {} });
|
|
15701
|
+
if (result.status === 200) return result.body;
|
|
15702
|
+
handleError(result, "Failed to list zero agents");
|
|
15703
|
+
}
|
|
15704
|
+
async function getZeroAgent(name) {
|
|
15705
|
+
const config = await getClientConfig();
|
|
15706
|
+
const client = initClient18(zeroAgentsByNameContract, config);
|
|
15707
|
+
const result = await client.get({ params: { name } });
|
|
15708
|
+
if (result.status === 200) return result.body;
|
|
15709
|
+
handleError(result, `Zero agent "${name}" not found`);
|
|
15710
|
+
}
|
|
15711
|
+
async function updateZeroAgent(name, body) {
|
|
15712
|
+
const config = await getClientConfig();
|
|
15713
|
+
const client = initClient18(zeroAgentsByNameContract, config);
|
|
15714
|
+
const result = await client.update({ params: { name }, body });
|
|
15715
|
+
if (result.status === 200) return result.body;
|
|
15716
|
+
handleError(result, `Failed to update zero agent "${name}"`);
|
|
15717
|
+
}
|
|
15718
|
+
async function deleteZeroAgent(name) {
|
|
15719
|
+
const config = await getClientConfig();
|
|
15720
|
+
const client = initClient18(zeroAgentsByNameContract, config);
|
|
15721
|
+
const result = await client.delete({ params: { name } });
|
|
15722
|
+
if (result.status === 204) return;
|
|
15723
|
+
handleError(result, `Zero agent "${name}" not found`);
|
|
15724
|
+
}
|
|
15725
|
+
async function getZeroAgentInstructions(name) {
|
|
15726
|
+
const config = await getClientConfig();
|
|
15727
|
+
const client = initClient18(zeroAgentInstructionsContract, config);
|
|
15728
|
+
const result = await client.get({ params: { name } });
|
|
15729
|
+
if (result.status === 200) return result.body;
|
|
15730
|
+
handleError(result, `Failed to get instructions for zero agent "${name}"`);
|
|
15731
|
+
}
|
|
15732
|
+
async function updateZeroAgentInstructions(name, content) {
|
|
15733
|
+
const config = await getClientConfig();
|
|
15734
|
+
const client = initClient18(zeroAgentInstructionsContract, config);
|
|
15735
|
+
const result = await client.update({
|
|
15736
|
+
params: { name },
|
|
15737
|
+
body: { content }
|
|
15738
|
+
});
|
|
15739
|
+
if (result.status === 200) return;
|
|
15740
|
+
handleError(result, `Failed to update instructions for zero agent "${name}"`);
|
|
15741
|
+
}
|
|
15742
|
+
|
|
15743
|
+
// src/lib/domain/yaml-validator.ts
|
|
15744
|
+
import { z as z43 } from "zod";
|
|
15745
|
+
var cliAgentNameSchema = z43.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
15746
|
+
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
15747
|
+
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
15748
|
+
);
|
|
15749
|
+
var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
15750
|
+
(agent, ctx) => {
|
|
15751
|
+
if (agent.skills) {
|
|
15752
|
+
for (let i = 0; i < agent.skills.length; i++) {
|
|
15753
|
+
const skillRef = agent.skills[i];
|
|
15754
|
+
if (skillRef) {
|
|
15755
|
+
try {
|
|
15756
|
+
resolveSkillRef(skillRef);
|
|
15757
|
+
} catch (error) {
|
|
15758
|
+
ctx.addIssue({
|
|
15759
|
+
code: z43.ZodIssueCode.custom,
|
|
15760
|
+
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
15761
|
+
path: ["skills", i]
|
|
15762
|
+
});
|
|
15763
|
+
}
|
|
15764
|
+
}
|
|
15765
|
+
}
|
|
15766
|
+
}
|
|
15767
|
+
}
|
|
15768
|
+
);
|
|
15769
|
+
var cliComposeSchema = z43.object({
|
|
15770
|
+
version: z43.string().min(1, "Missing config.version"),
|
|
15771
|
+
agents: z43.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
15772
|
+
volumes: z43.record(z43.string(), volumeConfigSchema).optional()
|
|
15773
|
+
}).superRefine((config, ctx) => {
|
|
15774
|
+
const agentKeys = Object.keys(config.agents);
|
|
15775
|
+
if (agentKeys.length === 0) {
|
|
15776
|
+
ctx.addIssue({
|
|
15777
|
+
code: z43.ZodIssueCode.custom,
|
|
15778
|
+
message: "agents must have at least one agent defined",
|
|
15779
|
+
path: ["agents"]
|
|
15780
|
+
});
|
|
15781
|
+
return;
|
|
15782
|
+
}
|
|
15783
|
+
if (agentKeys.length > 1) {
|
|
15784
|
+
ctx.addIssue({
|
|
15785
|
+
code: z43.ZodIssueCode.custom,
|
|
15786
|
+
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
15787
|
+
path: ["agents"]
|
|
15788
|
+
});
|
|
15789
|
+
return;
|
|
15790
|
+
}
|
|
15791
|
+
const agentName = agentKeys[0];
|
|
15792
|
+
const agent = config.agents[agentName];
|
|
15793
|
+
const agentVolumes = agent?.volumes;
|
|
15794
|
+
if (agentVolumes && agentVolumes.length > 0) {
|
|
15795
|
+
if (!config.volumes) {
|
|
15796
|
+
ctx.addIssue({
|
|
15797
|
+
code: z43.ZodIssueCode.custom,
|
|
15798
|
+
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
15799
|
+
path: ["volumes"]
|
|
15800
|
+
});
|
|
15801
|
+
return;
|
|
15802
|
+
}
|
|
15803
|
+
for (const volDeclaration of agentVolumes) {
|
|
15804
|
+
const parts = volDeclaration.split(":");
|
|
15805
|
+
if (parts.length !== 2) {
|
|
15806
|
+
ctx.addIssue({
|
|
15807
|
+
code: z43.ZodIssueCode.custom,
|
|
15808
|
+
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
15809
|
+
path: ["agents", agentName, "volumes"]
|
|
15810
|
+
});
|
|
15811
|
+
continue;
|
|
15812
|
+
}
|
|
15813
|
+
const volumeKey = parts[0].trim();
|
|
15814
|
+
if (!config.volumes[volumeKey]) {
|
|
15815
|
+
ctx.addIssue({
|
|
15816
|
+
code: z43.ZodIssueCode.custom,
|
|
15817
|
+
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
15818
|
+
path: ["volumes", volumeKey]
|
|
15819
|
+
});
|
|
15820
|
+
}
|
|
15821
|
+
}
|
|
15822
|
+
}
|
|
15823
|
+
});
|
|
15824
|
+
function formatInvalidTypeIssue(path18, issue) {
|
|
15825
|
+
const received = issue.received;
|
|
15826
|
+
const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
|
|
15827
|
+
if (path18 === "version" && isMissing) {
|
|
15828
|
+
return "Missing config.version";
|
|
15829
|
+
}
|
|
15830
|
+
if (path18 === "agents" && isMissing) {
|
|
15831
|
+
return "Missing agents object in config";
|
|
15832
|
+
}
|
|
15833
|
+
if (path18.startsWith("volumes.") && path18.endsWith(".name")) {
|
|
15834
|
+
const volumeKey = path18.split(".")[1];
|
|
15835
|
+
return `Volume "${volumeKey}" must have a 'name' field (string)`;
|
|
15836
|
+
}
|
|
15837
|
+
if (path18.startsWith("volumes.") && path18.endsWith(".version")) {
|
|
15838
|
+
const volumeKey = path18.split(".")[1];
|
|
15839
|
+
return `Volume "${volumeKey}" must have a 'version' field (string)`;
|
|
15840
|
+
}
|
|
15841
|
+
if (issue.expected === "array") {
|
|
15842
|
+
const fieldName = path18.replace(/^agents\.[^.]+\./, "agent.");
|
|
15843
|
+
return `${fieldName} must be an array`;
|
|
15844
|
+
}
|
|
15845
|
+
if (issue.expected === "string" && received === "number") {
|
|
15846
|
+
const fieldName = path18.replace(/^agents\.[^.]+\./, "agent.");
|
|
15847
|
+
const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
|
|
15848
|
+
if (match) {
|
|
15849
|
+
return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
|
|
15850
|
+
}
|
|
15851
|
+
}
|
|
15852
|
+
return null;
|
|
15853
|
+
}
|
|
15854
|
+
function formatZodError(error) {
|
|
15855
|
+
const issue = error.issues[0];
|
|
15856
|
+
if (!issue) return "Validation failed";
|
|
15857
|
+
const path18 = issue.path.join(".");
|
|
15858
|
+
const message = issue.message;
|
|
15859
|
+
if (!path18) return message;
|
|
15860
|
+
if (issue.code === "invalid_type") {
|
|
15861
|
+
const formatted = formatInvalidTypeIssue(path18, issue);
|
|
15862
|
+
if (formatted) return formatted;
|
|
15493
15863
|
}
|
|
15494
15864
|
if (issue.code === "invalid_key" && path18.startsWith("agents.")) {
|
|
15495
15865
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
@@ -16642,7 +17012,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
16642
17012
|
options.autoUpdate = false;
|
|
16643
17013
|
}
|
|
16644
17014
|
if (options.autoUpdate !== false) {
|
|
16645
|
-
await startSilentUpgrade("9.
|
|
17015
|
+
await startSilentUpgrade("9.76.0");
|
|
16646
17016
|
}
|
|
16647
17017
|
try {
|
|
16648
17018
|
let result;
|
|
@@ -17477,7 +17847,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
17477
17847
|
withErrorHandler(
|
|
17478
17848
|
async (identifier, prompt, options) => {
|
|
17479
17849
|
if (options.autoUpdate !== false) {
|
|
17480
|
-
await startSilentUpgrade("9.
|
|
17850
|
+
await startSilentUpgrade("9.76.0");
|
|
17481
17851
|
}
|
|
17482
17852
|
const { org, name, version } = parseIdentifier(identifier);
|
|
17483
17853
|
let composeId;
|
|
@@ -19233,7 +19603,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
19233
19603
|
withErrorHandler(
|
|
19234
19604
|
async (prompt, options) => {
|
|
19235
19605
|
if (options.autoUpdate !== false) {
|
|
19236
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
19606
|
+
const shouldExit = await checkAndUpgrade("9.76.0", prompt);
|
|
19237
19607
|
if (shouldExit) {
|
|
19238
19608
|
process.exit(0);
|
|
19239
19609
|
}
|
|
@@ -19419,7 +19789,7 @@ import { Command as Command40 } from "commander";
|
|
|
19419
19789
|
import chalk36 from "chalk";
|
|
19420
19790
|
|
|
19421
19791
|
// src/lib/api/api-client.ts
|
|
19422
|
-
import { initClient as
|
|
19792
|
+
import { initClient as initClient19 } from "@ts-rest/core";
|
|
19423
19793
|
var ApiClient = class {
|
|
19424
19794
|
async getHeaders() {
|
|
19425
19795
|
const token = await getActiveToken();
|
|
@@ -19445,7 +19815,7 @@ var ApiClient = class {
|
|
|
19445
19815
|
async getComposeByName(name, org) {
|
|
19446
19816
|
const baseUrl = await this.getBaseUrl();
|
|
19447
19817
|
const headers = await this.getHeaders();
|
|
19448
|
-
const client =
|
|
19818
|
+
const client = initClient19(composesMainContract, {
|
|
19449
19819
|
baseUrl,
|
|
19450
19820
|
baseHeaders: headers,
|
|
19451
19821
|
jsonQuery: false
|
|
@@ -19466,7 +19836,7 @@ var ApiClient = class {
|
|
|
19466
19836
|
async getComposeById(id) {
|
|
19467
19837
|
const baseUrl = await this.getBaseUrl();
|
|
19468
19838
|
const headers = await this.getHeaders();
|
|
19469
|
-
const client =
|
|
19839
|
+
const client = initClient19(composesByIdContract, {
|
|
19470
19840
|
baseUrl,
|
|
19471
19841
|
baseHeaders: headers,
|
|
19472
19842
|
jsonQuery: false
|
|
@@ -19488,7 +19858,7 @@ var ApiClient = class {
|
|
|
19488
19858
|
async getComposeVersion(composeId, version) {
|
|
19489
19859
|
const baseUrl = await this.getBaseUrl();
|
|
19490
19860
|
const headers = await this.getHeaders();
|
|
19491
|
-
const client =
|
|
19861
|
+
const client = initClient19(composesVersionsContract, {
|
|
19492
19862
|
baseUrl,
|
|
19493
19863
|
baseHeaders: headers,
|
|
19494
19864
|
jsonQuery: false
|
|
@@ -19509,7 +19879,7 @@ var ApiClient = class {
|
|
|
19509
19879
|
async createOrUpdateCompose(body) {
|
|
19510
19880
|
const baseUrl = await this.getBaseUrl();
|
|
19511
19881
|
const headers = await this.getHeaders();
|
|
19512
|
-
const client =
|
|
19882
|
+
const client = initClient19(composesMainContract, {
|
|
19513
19883
|
baseUrl,
|
|
19514
19884
|
baseHeaders: headers,
|
|
19515
19885
|
jsonQuery: false
|
|
@@ -19532,7 +19902,7 @@ var ApiClient = class {
|
|
|
19532
19902
|
async createRun(body) {
|
|
19533
19903
|
const baseUrl = await this.getBaseUrl();
|
|
19534
19904
|
const headers = await this.getHeaders();
|
|
19535
|
-
const client =
|
|
19905
|
+
const client = initClient19(runsMainContract, {
|
|
19536
19906
|
baseUrl,
|
|
19537
19907
|
baseHeaders: headers,
|
|
19538
19908
|
jsonQuery: false
|
|
@@ -19547,7 +19917,7 @@ var ApiClient = class {
|
|
|
19547
19917
|
}
|
|
19548
19918
|
async getEvents(runId, options) {
|
|
19549
19919
|
const config = await getClientConfig();
|
|
19550
|
-
const client =
|
|
19920
|
+
const client = initClient19(runEventsContract, config);
|
|
19551
19921
|
const result = await client.getEvents({
|
|
19552
19922
|
params: { id: runId },
|
|
19553
19923
|
query: {
|
|
@@ -19564,7 +19934,7 @@ var ApiClient = class {
|
|
|
19564
19934
|
}
|
|
19565
19935
|
async getSystemLog(runId, options) {
|
|
19566
19936
|
const config = await getClientConfig();
|
|
19567
|
-
const client =
|
|
19937
|
+
const client = initClient19(runSystemLogContract, config);
|
|
19568
19938
|
const result = await client.getSystemLog({
|
|
19569
19939
|
params: { id: runId },
|
|
19570
19940
|
query: {
|
|
@@ -19582,7 +19952,7 @@ var ApiClient = class {
|
|
|
19582
19952
|
}
|
|
19583
19953
|
async getMetrics(runId, options) {
|
|
19584
19954
|
const config = await getClientConfig();
|
|
19585
|
-
const client =
|
|
19955
|
+
const client = initClient19(runMetricsContract, config);
|
|
19586
19956
|
const result = await client.getMetrics({
|
|
19587
19957
|
params: { id: runId },
|
|
19588
19958
|
query: {
|
|
@@ -19600,7 +19970,7 @@ var ApiClient = class {
|
|
|
19600
19970
|
}
|
|
19601
19971
|
async getAgentEvents(runId, options) {
|
|
19602
19972
|
const config = await getClientConfig();
|
|
19603
|
-
const client =
|
|
19973
|
+
const client = initClient19(runAgentEventsContract, config);
|
|
19604
19974
|
const result = await client.getAgentEvents({
|
|
19605
19975
|
params: { id: runId },
|
|
19606
19976
|
query: {
|
|
@@ -19618,7 +19988,7 @@ var ApiClient = class {
|
|
|
19618
19988
|
}
|
|
19619
19989
|
async getNetworkLogs(runId, options) {
|
|
19620
19990
|
const config = await getClientConfig();
|
|
19621
|
-
const client =
|
|
19991
|
+
const client = initClient19(runNetworkLogsContract, config);
|
|
19622
19992
|
const result = await client.getNetworkLogs({
|
|
19623
19993
|
params: { id: runId },
|
|
19624
19994
|
query: {
|
|
@@ -19640,7 +20010,7 @@ var ApiClient = class {
|
|
|
19640
20010
|
async getOrg() {
|
|
19641
20011
|
const baseUrl = await this.getBaseUrl();
|
|
19642
20012
|
const headers = await this.getHeaders();
|
|
19643
|
-
const client =
|
|
20013
|
+
const client = initClient19(orgContract, {
|
|
19644
20014
|
baseUrl,
|
|
19645
20015
|
baseHeaders: headers,
|
|
19646
20016
|
jsonQuery: false
|
|
@@ -19659,7 +20029,7 @@ var ApiClient = class {
|
|
|
19659
20029
|
async updateOrg(body) {
|
|
19660
20030
|
const baseUrl = await this.getBaseUrl();
|
|
19661
20031
|
const headers = await this.getHeaders();
|
|
19662
|
-
const client =
|
|
20032
|
+
const client = initClient19(orgContract, {
|
|
19663
20033
|
baseUrl,
|
|
19664
20034
|
baseHeaders: headers,
|
|
19665
20035
|
jsonQuery: false
|
|
@@ -19679,7 +20049,7 @@ var ApiClient = class {
|
|
|
19679
20049
|
async getSession(sessionId) {
|
|
19680
20050
|
const baseUrl = await this.getBaseUrl();
|
|
19681
20051
|
const headers = await this.getHeaders();
|
|
19682
|
-
const client =
|
|
20052
|
+
const client = initClient19(sessionsByIdContract, {
|
|
19683
20053
|
baseUrl,
|
|
19684
20054
|
baseHeaders: headers,
|
|
19685
20055
|
jsonQuery: false
|
|
@@ -19700,7 +20070,7 @@ var ApiClient = class {
|
|
|
19700
20070
|
*/
|
|
19701
20071
|
async getCheckpoint(checkpointId) {
|
|
19702
20072
|
const config = await getClientConfig();
|
|
19703
|
-
const client =
|
|
20073
|
+
const client = initClient19(checkpointsByIdContract, config);
|
|
19704
20074
|
const result = await client.getById({
|
|
19705
20075
|
params: { id: checkpointId }
|
|
19706
20076
|
});
|
|
@@ -19717,7 +20087,7 @@ var ApiClient = class {
|
|
|
19717
20087
|
async prepareStorage(body) {
|
|
19718
20088
|
const baseUrl = await this.getBaseUrl();
|
|
19719
20089
|
const headers = await this.getHeaders();
|
|
19720
|
-
const client =
|
|
20090
|
+
const client = initClient19(storagesPrepareContract, {
|
|
19721
20091
|
baseUrl,
|
|
19722
20092
|
baseHeaders: headers,
|
|
19723
20093
|
jsonQuery: false
|
|
@@ -19736,7 +20106,7 @@ var ApiClient = class {
|
|
|
19736
20106
|
async commitStorage(body) {
|
|
19737
20107
|
const baseUrl = await this.getBaseUrl();
|
|
19738
20108
|
const headers = await this.getHeaders();
|
|
19739
|
-
const client =
|
|
20109
|
+
const client = initClient19(storagesCommitContract, {
|
|
19740
20110
|
baseUrl,
|
|
19741
20111
|
baseHeaders: headers,
|
|
19742
20112
|
jsonQuery: false
|
|
@@ -19755,7 +20125,7 @@ var ApiClient = class {
|
|
|
19755
20125
|
async getStorageDownload(query) {
|
|
19756
20126
|
const baseUrl = await this.getBaseUrl();
|
|
19757
20127
|
const headers = await this.getHeaders();
|
|
19758
|
-
const client =
|
|
20128
|
+
const client = initClient19(storagesDownloadContract, {
|
|
19759
20129
|
baseUrl,
|
|
19760
20130
|
baseHeaders: headers,
|
|
19761
20131
|
jsonQuery: false
|
|
@@ -19780,7 +20150,7 @@ var ApiClient = class {
|
|
|
19780
20150
|
async listStorages(query) {
|
|
19781
20151
|
const baseUrl = await this.getBaseUrl();
|
|
19782
20152
|
const headers = await this.getHeaders();
|
|
19783
|
-
const client =
|
|
20153
|
+
const client = initClient19(storagesListContract, {
|
|
19784
20154
|
baseUrl,
|
|
19785
20155
|
baseHeaders: headers,
|
|
19786
20156
|
jsonQuery: false
|
|
@@ -19800,7 +20170,7 @@ var ApiClient = class {
|
|
|
19800
20170
|
async deploySchedule(body) {
|
|
19801
20171
|
const baseUrl = await this.getBaseUrl();
|
|
19802
20172
|
const headers = await this.getHeaders();
|
|
19803
|
-
const client =
|
|
20173
|
+
const client = initClient19(schedulesMainContract, {
|
|
19804
20174
|
baseUrl,
|
|
19805
20175
|
baseHeaders: headers,
|
|
19806
20176
|
jsonQuery: false
|
|
@@ -19819,7 +20189,7 @@ var ApiClient = class {
|
|
|
19819
20189
|
async listSchedules() {
|
|
19820
20190
|
const baseUrl = await this.getBaseUrl();
|
|
19821
20191
|
const headers = await this.getHeaders();
|
|
19822
|
-
const client =
|
|
20192
|
+
const client = initClient19(schedulesMainContract, {
|
|
19823
20193
|
baseUrl,
|
|
19824
20194
|
baseHeaders: headers,
|
|
19825
20195
|
jsonQuery: false
|
|
@@ -19838,7 +20208,7 @@ var ApiClient = class {
|
|
|
19838
20208
|
async getScheduleByName(params) {
|
|
19839
20209
|
const baseUrl = await this.getBaseUrl();
|
|
19840
20210
|
const headers = await this.getHeaders();
|
|
19841
|
-
const client =
|
|
20211
|
+
const client = initClient19(schedulesByNameContract, {
|
|
19842
20212
|
baseUrl,
|
|
19843
20213
|
baseHeaders: headers,
|
|
19844
20214
|
jsonQuery: false
|
|
@@ -19860,7 +20230,7 @@ var ApiClient = class {
|
|
|
19860
20230
|
async deleteSchedule(params) {
|
|
19861
20231
|
const baseUrl = await this.getBaseUrl();
|
|
19862
20232
|
const headers = await this.getHeaders();
|
|
19863
|
-
const client =
|
|
20233
|
+
const client = initClient19(schedulesByNameContract, {
|
|
19864
20234
|
baseUrl,
|
|
19865
20235
|
baseHeaders: headers,
|
|
19866
20236
|
jsonQuery: false
|
|
@@ -19882,7 +20252,7 @@ var ApiClient = class {
|
|
|
19882
20252
|
async enableSchedule(params) {
|
|
19883
20253
|
const baseUrl = await this.getBaseUrl();
|
|
19884
20254
|
const headers = await this.getHeaders();
|
|
19885
|
-
const client =
|
|
20255
|
+
const client = initClient19(schedulesEnableContract, {
|
|
19886
20256
|
baseUrl,
|
|
19887
20257
|
baseHeaders: headers,
|
|
19888
20258
|
jsonQuery: false
|
|
@@ -19904,7 +20274,7 @@ var ApiClient = class {
|
|
|
19904
20274
|
async disableSchedule(params) {
|
|
19905
20275
|
const baseUrl = await this.getBaseUrl();
|
|
19906
20276
|
const headers = await this.getHeaders();
|
|
19907
|
-
const client =
|
|
20277
|
+
const client = initClient19(schedulesDisableContract, {
|
|
19908
20278
|
baseUrl,
|
|
19909
20279
|
baseHeaders: headers,
|
|
19910
20280
|
jsonQuery: false
|
|
@@ -19926,7 +20296,7 @@ var ApiClient = class {
|
|
|
19926
20296
|
async listScheduleRuns(params) {
|
|
19927
20297
|
const baseUrl = await this.getBaseUrl();
|
|
19928
20298
|
const headers = await this.getHeaders();
|
|
19929
|
-
const client =
|
|
20299
|
+
const client = initClient19(scheduleRunsContract, {
|
|
19930
20300
|
baseUrl,
|
|
19931
20301
|
baseHeaders: headers,
|
|
19932
20302
|
jsonQuery: false
|
|
@@ -20014,7 +20384,7 @@ var ApiClient = class {
|
|
|
20014
20384
|
}
|
|
20015
20385
|
async searchLogs(options) {
|
|
20016
20386
|
const config = await getClientConfig();
|
|
20017
|
-
const client =
|
|
20387
|
+
const client = initClient19(logsSearchContract, config);
|
|
20018
20388
|
const result = await client.searchLogs({
|
|
20019
20389
|
query: {
|
|
20020
20390
|
keyword: options.keyword,
|
|
@@ -23120,7 +23490,7 @@ import { Command as Command88 } from "commander";
|
|
|
23120
23490
|
// src/commands/connector/connect.ts
|
|
23121
23491
|
import { Command as Command84 } from "commander";
|
|
23122
23492
|
import chalk74 from "chalk";
|
|
23123
|
-
import { initClient as
|
|
23493
|
+
import { initClient as initClient20 } from "@ts-rest/core";
|
|
23124
23494
|
|
|
23125
23495
|
// src/commands/connector/lib/computer/start-services.ts
|
|
23126
23496
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -23367,7 +23737,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
23367
23737
|
async function connectComputer(apiUrl, headers) {
|
|
23368
23738
|
await checkComputerDependencies();
|
|
23369
23739
|
console.log(chalk74.cyan("Setting up computer connector..."));
|
|
23370
|
-
const computerClient =
|
|
23740
|
+
const computerClient = initClient20(computerConnectorContract, {
|
|
23371
23741
|
baseUrl: apiUrl,
|
|
23372
23742
|
baseHeaders: headers,
|
|
23373
23743
|
jsonQuery: false
|
|
@@ -23423,7 +23793,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
23423
23793
|
}
|
|
23424
23794
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
23425
23795
|
console.log(`Connecting ${chalk74.cyan(connectorType)}...`);
|
|
23426
|
-
const sessionsClient =
|
|
23796
|
+
const sessionsClient = initClient20(connectorSessionsContract, {
|
|
23427
23797
|
baseUrl: apiUrl,
|
|
23428
23798
|
baseHeaders: headers,
|
|
23429
23799
|
jsonQuery: false
|
|
@@ -23446,7 +23816,7 @@ To connect, visit: ${verificationUrl}`));
|
|
|
23446
23816
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
23447
23817
|
);
|
|
23448
23818
|
console.log("\nWaiting for authorization...");
|
|
23449
|
-
const sessionClient =
|
|
23819
|
+
const sessionClient = initClient20(connectorSessionByIdContract, {
|
|
23450
23820
|
baseUrl: apiUrl,
|
|
23451
23821
|
baseHeaders: headers,
|
|
23452
23822
|
jsonQuery: false
|
|
@@ -23786,13 +24156,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
23786
24156
|
if (latestVersion === null) {
|
|
23787
24157
|
throw new Error("Could not check for updates. Please try again later.");
|
|
23788
24158
|
}
|
|
23789
|
-
if (latestVersion === "9.
|
|
23790
|
-
console.log(chalk79.green(`\u2713 Already up to date (${"9.
|
|
24159
|
+
if (latestVersion === "9.76.0") {
|
|
24160
|
+
console.log(chalk79.green(`\u2713 Already up to date (${"9.76.0"})`));
|
|
23791
24161
|
return;
|
|
23792
24162
|
}
|
|
23793
24163
|
console.log(
|
|
23794
24164
|
chalk79.yellow(
|
|
23795
|
-
`Current version: ${"9.
|
|
24165
|
+
`Current version: ${"9.76.0"} -> Latest version: ${latestVersion}`
|
|
23796
24166
|
)
|
|
23797
24167
|
);
|
|
23798
24168
|
console.log();
|
|
@@ -23819,7 +24189,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
23819
24189
|
const success = await performUpgrade(packageManager);
|
|
23820
24190
|
if (success) {
|
|
23821
24191
|
console.log(
|
|
23822
|
-
chalk79.green(`\u2713 Upgraded from ${"9.
|
|
24192
|
+
chalk79.green(`\u2713 Upgraded from ${"9.76.0"} to ${latestVersion}`)
|
|
23823
24193
|
);
|
|
23824
24194
|
return;
|
|
23825
24195
|
}
|
|
@@ -23892,14 +24262,847 @@ var whoamiCommand = new Command91().name("whoami").description("Show current ide
|
|
|
23892
24262
|
);
|
|
23893
24263
|
|
|
23894
24264
|
// src/commands/zero/index.ts
|
|
24265
|
+
import { Command as Command121 } from "commander";
|
|
24266
|
+
|
|
24267
|
+
// src/commands/zero/org/index.ts
|
|
24268
|
+
import { Command as Command114 } from "commander";
|
|
24269
|
+
|
|
24270
|
+
// src/commands/zero/org/status.ts
|
|
23895
24271
|
import { Command as Command92 } from "commander";
|
|
23896
|
-
|
|
23897
|
-
|
|
24272
|
+
import chalk81 from "chalk";
|
|
24273
|
+
var statusCommand9 = new Command92().name("status").description("View current organization status").action(
|
|
24274
|
+
withErrorHandler(async () => {
|
|
24275
|
+
try {
|
|
24276
|
+
const org = await getZeroOrg();
|
|
24277
|
+
console.log(chalk81.bold("Organization Information:"));
|
|
24278
|
+
console.log(` Slug: ${chalk81.green(org.slug)}`);
|
|
24279
|
+
} catch (error) {
|
|
24280
|
+
if (error instanceof ApiRequestError && error.status === 404) {
|
|
24281
|
+
throw new Error("No organization configured", {
|
|
24282
|
+
cause: new Error(
|
|
24283
|
+
"Set your organization with: vm0 zero org set <slug>"
|
|
24284
|
+
)
|
|
24285
|
+
});
|
|
24286
|
+
}
|
|
24287
|
+
throw error;
|
|
24288
|
+
}
|
|
24289
|
+
})
|
|
23898
24290
|
);
|
|
23899
24291
|
|
|
24292
|
+
// src/commands/zero/org/set.ts
|
|
24293
|
+
import { Command as Command93 } from "commander";
|
|
24294
|
+
import chalk82 from "chalk";
|
|
24295
|
+
var setCommand6 = new Command93().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
24296
|
+
"--force",
|
|
24297
|
+
"Force change existing organization (may break references)"
|
|
24298
|
+
).action(
|
|
24299
|
+
withErrorHandler(async (slug, options) => {
|
|
24300
|
+
try {
|
|
24301
|
+
const existingOrg = await getZeroOrg();
|
|
24302
|
+
if (!options.force) {
|
|
24303
|
+
throw new Error(
|
|
24304
|
+
`You already have an organization: ${existingOrg.slug}`,
|
|
24305
|
+
{
|
|
24306
|
+
cause: new Error(
|
|
24307
|
+
`To change, use: vm0 zero org set ${slug} --force`
|
|
24308
|
+
)
|
|
24309
|
+
}
|
|
24310
|
+
);
|
|
24311
|
+
}
|
|
24312
|
+
const org = await updateZeroOrg({ slug, force: true });
|
|
24313
|
+
await saveConfig({ activeOrg: org.slug });
|
|
24314
|
+
console.log(chalk82.green(`\u2713 Organization updated to ${org.slug}`));
|
|
24315
|
+
console.log();
|
|
24316
|
+
console.log("Your agents will now be namespaced as:");
|
|
24317
|
+
console.log(chalk82.cyan(` ${org.slug}/<agent-name>`));
|
|
24318
|
+
} catch (error) {
|
|
24319
|
+
if (error instanceof Error && error.message.includes("already exists")) {
|
|
24320
|
+
throw new Error(
|
|
24321
|
+
`Organization "${slug}" is already taken. Please choose a different slug.`
|
|
24322
|
+
);
|
|
24323
|
+
}
|
|
24324
|
+
throw error;
|
|
24325
|
+
}
|
|
24326
|
+
})
|
|
24327
|
+
);
|
|
24328
|
+
|
|
24329
|
+
// src/commands/zero/org/list.ts
|
|
24330
|
+
import { Command as Command94 } from "commander";
|
|
24331
|
+
import chalk83 from "chalk";
|
|
24332
|
+
var listCommand14 = new Command94().name("list").description("List all accessible organizations").action(
|
|
24333
|
+
withErrorHandler(async () => {
|
|
24334
|
+
const result = await listZeroOrgs();
|
|
24335
|
+
const activeOrg = await getActiveOrg();
|
|
24336
|
+
console.log(chalk83.bold("Available organizations:"));
|
|
24337
|
+
for (const org of result.orgs) {
|
|
24338
|
+
const isCurrent = org.slug === activeOrg;
|
|
24339
|
+
const marker = isCurrent ? chalk83.green("* ") : " ";
|
|
24340
|
+
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
24341
|
+
const currentLabel = isCurrent ? chalk83.dim(" \u2190 current") : "";
|
|
24342
|
+
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
24343
|
+
}
|
|
24344
|
+
})
|
|
24345
|
+
);
|
|
24346
|
+
|
|
24347
|
+
// src/commands/zero/org/use.ts
|
|
24348
|
+
import { Command as Command95 } from "commander";
|
|
24349
|
+
import chalk84 from "chalk";
|
|
24350
|
+
var useCommand2 = new Command95().name("use").description("Switch to a different organization").argument("<slug>", "Organization slug to switch to").action(
|
|
24351
|
+
withErrorHandler(async (slug) => {
|
|
24352
|
+
const orgList = await listZeroOrgs();
|
|
24353
|
+
const target = orgList.orgs.find((s) => s.slug === slug);
|
|
24354
|
+
if (!target) {
|
|
24355
|
+
throw new Error(`Organization '${slug}' not found or not accessible.`);
|
|
24356
|
+
}
|
|
24357
|
+
await saveConfig({ activeOrg: slug });
|
|
24358
|
+
console.log(chalk84.green(`\u2713 Switched to organization: ${slug}`));
|
|
24359
|
+
})
|
|
24360
|
+
);
|
|
24361
|
+
|
|
24362
|
+
// src/commands/zero/org/members.ts
|
|
24363
|
+
import { Command as Command96 } from "commander";
|
|
24364
|
+
import chalk85 from "chalk";
|
|
24365
|
+
var membersCommand2 = new Command96().name("members").description("View organization members").action(
|
|
24366
|
+
withErrorHandler(async () => {
|
|
24367
|
+
const status = await getZeroOrgMembers();
|
|
24368
|
+
console.log(chalk85.bold(`Organization: ${status.slug}`));
|
|
24369
|
+
console.log(` Role: ${status.role}`);
|
|
24370
|
+
console.log(
|
|
24371
|
+
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
24372
|
+
);
|
|
24373
|
+
console.log();
|
|
24374
|
+
console.log(chalk85.bold("Members:"));
|
|
24375
|
+
for (const member of status.members) {
|
|
24376
|
+
const roleTag = member.role === "admin" ? chalk85.yellow(` (${member.role})`) : chalk85.dim(` (${member.role})`);
|
|
24377
|
+
console.log(` ${member.email}${roleTag}`);
|
|
24378
|
+
}
|
|
24379
|
+
})
|
|
24380
|
+
);
|
|
24381
|
+
|
|
24382
|
+
// src/commands/zero/org/invite.ts
|
|
24383
|
+
import { Command as Command97 } from "commander";
|
|
24384
|
+
import chalk86 from "chalk";
|
|
24385
|
+
var inviteCommand2 = new Command97().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").action(
|
|
24386
|
+
withErrorHandler(async (options) => {
|
|
24387
|
+
await inviteZeroOrgMember(options.email);
|
|
24388
|
+
console.log(chalk86.green(`\u2713 Invitation sent to ${options.email}`));
|
|
24389
|
+
})
|
|
24390
|
+
);
|
|
24391
|
+
|
|
24392
|
+
// src/commands/zero/org/remove.ts
|
|
24393
|
+
import { Command as Command98 } from "commander";
|
|
24394
|
+
import chalk87 from "chalk";
|
|
24395
|
+
var removeCommand5 = new Command98().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
24396
|
+
withErrorHandler(async (email) => {
|
|
24397
|
+
await removeZeroOrgMember(email);
|
|
24398
|
+
console.log(chalk87.green(`\u2713 Removed ${email} from organization`));
|
|
24399
|
+
})
|
|
24400
|
+
);
|
|
24401
|
+
|
|
24402
|
+
// src/commands/zero/org/leave.ts
|
|
24403
|
+
import { Command as Command99 } from "commander";
|
|
24404
|
+
import chalk88 from "chalk";
|
|
24405
|
+
var leaveCommand2 = new Command99().name("leave").description("Leave the current organization").action(
|
|
24406
|
+
withErrorHandler(async () => {
|
|
24407
|
+
await leaveZeroOrg();
|
|
24408
|
+
const { orgs } = await listZeroOrgs();
|
|
24409
|
+
if (orgs.length === 0) {
|
|
24410
|
+
await saveConfig({ activeOrg: void 0 });
|
|
24411
|
+
console.log(chalk88.green("\u2713 Left organization."));
|
|
24412
|
+
console.log(
|
|
24413
|
+
chalk88.yellow("No remaining organizations. Run: vm0 auth login")
|
|
24414
|
+
);
|
|
24415
|
+
return;
|
|
24416
|
+
}
|
|
24417
|
+
const nextOrg = orgs[0].slug;
|
|
24418
|
+
await saveConfig({ activeOrg: nextOrg });
|
|
24419
|
+
console.log(chalk88.green(`\u2713 Left organization. Switched to: ${nextOrg}`));
|
|
24420
|
+
})
|
|
24421
|
+
);
|
|
24422
|
+
|
|
24423
|
+
// src/commands/zero/org/delete.ts
|
|
24424
|
+
import { Command as Command100 } from "commander";
|
|
24425
|
+
import chalk89 from "chalk";
|
|
24426
|
+
var deleteCommand5 = new Command100().name("delete").description("Delete the current organization (admin only)").argument("<slug>", "Organization slug to confirm deletion").action(
|
|
24427
|
+
withErrorHandler(async (slug) => {
|
|
24428
|
+
await deleteZeroOrg(slug);
|
|
24429
|
+
console.log(chalk89.green(`\u2713 Organization '${slug}' has been deleted.`));
|
|
24430
|
+
})
|
|
24431
|
+
);
|
|
24432
|
+
|
|
24433
|
+
// src/commands/zero/org/secret/index.ts
|
|
24434
|
+
import { Command as Command104 } from "commander";
|
|
24435
|
+
|
|
24436
|
+
// src/commands/zero/org/secret/list.ts
|
|
24437
|
+
import { Command as Command101 } from "commander";
|
|
24438
|
+
import chalk90 from "chalk";
|
|
24439
|
+
var listCommand15 = new Command101().name("list").alias("ls").description("List all org-level secrets").action(
|
|
24440
|
+
withErrorHandler(async () => {
|
|
24441
|
+
const result = await listZeroOrgSecrets();
|
|
24442
|
+
if (result.secrets.length === 0) {
|
|
24443
|
+
console.log(chalk90.dim("No org secrets found"));
|
|
24444
|
+
console.log();
|
|
24445
|
+
console.log("To add an org secret:");
|
|
24446
|
+
console.log(
|
|
24447
|
+
chalk90.cyan(" vm0 zero org secret set MY_API_KEY --body <value>")
|
|
24448
|
+
);
|
|
24449
|
+
return;
|
|
24450
|
+
}
|
|
24451
|
+
console.log(chalk90.bold("Org Secrets:"));
|
|
24452
|
+
console.log();
|
|
24453
|
+
for (const secret of result.secrets) {
|
|
24454
|
+
console.log(` ${chalk90.cyan(secret.name)}`);
|
|
24455
|
+
if (secret.description) {
|
|
24456
|
+
console.log(` ${chalk90.dim(secret.description)}`);
|
|
24457
|
+
}
|
|
24458
|
+
console.log(
|
|
24459
|
+
` ${chalk90.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
24460
|
+
);
|
|
24461
|
+
console.log();
|
|
24462
|
+
}
|
|
24463
|
+
console.log(chalk90.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
24464
|
+
})
|
|
24465
|
+
);
|
|
24466
|
+
|
|
24467
|
+
// src/commands/zero/org/secret/set.ts
|
|
24468
|
+
import { Command as Command102 } from "commander";
|
|
24469
|
+
import chalk91 from "chalk";
|
|
24470
|
+
var setCommand7 = new Command102().name("set").description("Create or update an org-level secret (admin only)").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
24471
|
+
"-b, --body <value>",
|
|
24472
|
+
"Secret value (required in non-interactive mode)"
|
|
24473
|
+
).option("-d, --description <description>", "Optional description").action(
|
|
24474
|
+
withErrorHandler(
|
|
24475
|
+
async (name, options) => {
|
|
24476
|
+
let value;
|
|
24477
|
+
if (options.body !== void 0) {
|
|
24478
|
+
value = options.body;
|
|
24479
|
+
} else if (isInteractive()) {
|
|
24480
|
+
const prompted = await promptPassword("Enter secret value:");
|
|
24481
|
+
if (prompted === void 0) {
|
|
24482
|
+
process.exit(0);
|
|
24483
|
+
}
|
|
24484
|
+
value = prompted;
|
|
24485
|
+
} else {
|
|
24486
|
+
throw new Error("--body is required in non-interactive mode", {
|
|
24487
|
+
cause: new Error(
|
|
24488
|
+
`Usage: vm0 zero org secret set ${name} --body "your-secret-value"`
|
|
24489
|
+
)
|
|
24490
|
+
});
|
|
24491
|
+
}
|
|
24492
|
+
let secret;
|
|
24493
|
+
try {
|
|
24494
|
+
secret = await setZeroOrgSecret({
|
|
24495
|
+
name,
|
|
24496
|
+
value,
|
|
24497
|
+
description: options.description
|
|
24498
|
+
});
|
|
24499
|
+
} catch (error) {
|
|
24500
|
+
if (error instanceof Error && error.message.includes("must contain only uppercase")) {
|
|
24501
|
+
throw new Error(error.message, {
|
|
24502
|
+
cause: new Error(
|
|
24503
|
+
"Examples of valid secret names: MY_API_KEY, GITHUB_TOKEN, AWS_ACCESS_KEY_ID"
|
|
24504
|
+
)
|
|
24505
|
+
});
|
|
24506
|
+
}
|
|
24507
|
+
throw error;
|
|
24508
|
+
}
|
|
24509
|
+
console.log(chalk91.green(`\u2713 Org secret "${secret.name}" saved`));
|
|
24510
|
+
console.log();
|
|
24511
|
+
console.log("Use in vm0.yaml:");
|
|
24512
|
+
console.log(chalk91.cyan(` environment:`));
|
|
24513
|
+
console.log(chalk91.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
24514
|
+
}
|
|
24515
|
+
)
|
|
24516
|
+
);
|
|
24517
|
+
|
|
24518
|
+
// src/commands/zero/org/secret/remove.ts
|
|
24519
|
+
import { Command as Command103 } from "commander";
|
|
24520
|
+
import chalk92 from "chalk";
|
|
24521
|
+
var removeCommand6 = new Command103().name("remove").description("Delete an org-level secret (admin only)").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
24522
|
+
withErrorHandler(async (name, options) => {
|
|
24523
|
+
if (!options.yes) {
|
|
24524
|
+
if (!isInteractive()) {
|
|
24525
|
+
throw new Error("--yes flag is required in non-interactive mode");
|
|
24526
|
+
}
|
|
24527
|
+
const confirmed = await promptConfirm(
|
|
24528
|
+
`Are you sure you want to delete org secret "${name}"?`,
|
|
24529
|
+
false
|
|
24530
|
+
);
|
|
24531
|
+
if (!confirmed) {
|
|
24532
|
+
console.log(chalk92.dim("Cancelled"));
|
|
24533
|
+
return;
|
|
24534
|
+
}
|
|
24535
|
+
}
|
|
24536
|
+
await deleteZeroOrgSecret(name);
|
|
24537
|
+
console.log(chalk92.green(`\u2713 Org secret "${name}" deleted`));
|
|
24538
|
+
})
|
|
24539
|
+
);
|
|
24540
|
+
|
|
24541
|
+
// src/commands/zero/org/secret/index.ts
|
|
24542
|
+
var zeroOrgSecretCommand = new Command104().name("secret").description("Manage org-level secrets (admin)").addCommand(listCommand15).addCommand(setCommand7).addCommand(removeCommand6);
|
|
24543
|
+
|
|
24544
|
+
// src/commands/zero/org/variable/index.ts
|
|
24545
|
+
import { Command as Command108 } from "commander";
|
|
24546
|
+
|
|
24547
|
+
// src/commands/zero/org/variable/list.ts
|
|
24548
|
+
import { Command as Command105 } from "commander";
|
|
24549
|
+
import chalk93 from "chalk";
|
|
24550
|
+
function truncateValue3(value, maxLength = 60) {
|
|
24551
|
+
if (value.length <= maxLength) {
|
|
24552
|
+
return value;
|
|
24553
|
+
}
|
|
24554
|
+
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
24555
|
+
}
|
|
24556
|
+
var listCommand16 = new Command105().name("list").alias("ls").description("List all org-level variables").action(
|
|
24557
|
+
withErrorHandler(async () => {
|
|
24558
|
+
const result = await listZeroOrgVariables();
|
|
24559
|
+
if (result.variables.length === 0) {
|
|
24560
|
+
console.log(chalk93.dim("No org variables found"));
|
|
24561
|
+
console.log();
|
|
24562
|
+
console.log("To add an org variable:");
|
|
24563
|
+
console.log(chalk93.cyan(" vm0 zero org variable set MY_VAR <value>"));
|
|
24564
|
+
return;
|
|
24565
|
+
}
|
|
24566
|
+
console.log(chalk93.bold("Org Variables:"));
|
|
24567
|
+
console.log();
|
|
24568
|
+
for (const variable of result.variables) {
|
|
24569
|
+
const displayValue = truncateValue3(variable.value);
|
|
24570
|
+
console.log(` ${chalk93.cyan(variable.name)} = ${displayValue}`);
|
|
24571
|
+
if (variable.description) {
|
|
24572
|
+
console.log(` ${chalk93.dim(variable.description)}`);
|
|
24573
|
+
}
|
|
24574
|
+
console.log(
|
|
24575
|
+
` ${chalk93.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
24576
|
+
);
|
|
24577
|
+
console.log();
|
|
24578
|
+
}
|
|
24579
|
+
console.log(chalk93.dim(`Total: ${result.variables.length} variable(s)`));
|
|
24580
|
+
})
|
|
24581
|
+
);
|
|
24582
|
+
|
|
24583
|
+
// src/commands/zero/org/variable/set.ts
|
|
24584
|
+
import { Command as Command106 } from "commander";
|
|
24585
|
+
import chalk94 from "chalk";
|
|
24586
|
+
var setCommand8 = new Command106().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(
|
|
24587
|
+
withErrorHandler(
|
|
24588
|
+
async (name, value, options) => {
|
|
24589
|
+
let variable;
|
|
24590
|
+
try {
|
|
24591
|
+
variable = await setZeroOrgVariable({
|
|
24592
|
+
name,
|
|
24593
|
+
value,
|
|
24594
|
+
description: options.description
|
|
24595
|
+
});
|
|
24596
|
+
} catch (error) {
|
|
24597
|
+
if (error instanceof Error && error.message.includes("must contain only uppercase")) {
|
|
24598
|
+
throw new Error(error.message, {
|
|
24599
|
+
cause: new Error(
|
|
24600
|
+
"Examples of valid variable names: MY_VAR, API_URL, DEBUG_MODE"
|
|
24601
|
+
)
|
|
24602
|
+
});
|
|
24603
|
+
}
|
|
24604
|
+
throw error;
|
|
24605
|
+
}
|
|
24606
|
+
console.log(chalk94.green(`\u2713 Org variable "${variable.name}" saved`));
|
|
24607
|
+
console.log();
|
|
24608
|
+
console.log("Use in vm0.yaml:");
|
|
24609
|
+
console.log(chalk94.cyan(` environment:`));
|
|
24610
|
+
console.log(chalk94.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
24611
|
+
}
|
|
24612
|
+
)
|
|
24613
|
+
);
|
|
24614
|
+
|
|
24615
|
+
// src/commands/zero/org/variable/remove.ts
|
|
24616
|
+
import { Command as Command107 } from "commander";
|
|
24617
|
+
import chalk95 from "chalk";
|
|
24618
|
+
var removeCommand7 = new Command107().name("remove").description("Delete an org-level variable (admin only)").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
24619
|
+
withErrorHandler(async (name, options) => {
|
|
24620
|
+
if (!options.yes) {
|
|
24621
|
+
if (!isInteractive()) {
|
|
24622
|
+
throw new Error("--yes flag is required in non-interactive mode");
|
|
24623
|
+
}
|
|
24624
|
+
const confirmed = await promptConfirm(
|
|
24625
|
+
`Are you sure you want to delete org variable "${name}"?`,
|
|
24626
|
+
false
|
|
24627
|
+
);
|
|
24628
|
+
if (!confirmed) {
|
|
24629
|
+
console.log(chalk95.dim("Cancelled"));
|
|
24630
|
+
return;
|
|
24631
|
+
}
|
|
24632
|
+
}
|
|
24633
|
+
await deleteZeroOrgVariable(name);
|
|
24634
|
+
console.log(chalk95.green(`\u2713 Org variable "${name}" deleted`));
|
|
24635
|
+
})
|
|
24636
|
+
);
|
|
24637
|
+
|
|
24638
|
+
// src/commands/zero/org/variable/index.ts
|
|
24639
|
+
var zeroOrgVariableCommand = new Command108().name("variable").description("Manage org-level variables (admin)").addCommand(listCommand16).addCommand(setCommand8).addCommand(removeCommand7);
|
|
24640
|
+
|
|
24641
|
+
// src/commands/zero/org/model-provider/index.ts
|
|
24642
|
+
import { Command as Command113 } from "commander";
|
|
24643
|
+
|
|
24644
|
+
// src/commands/zero/org/model-provider/list.ts
|
|
24645
|
+
import { Command as Command109 } from "commander";
|
|
24646
|
+
import chalk96 from "chalk";
|
|
24647
|
+
var listCommand17 = new Command109().name("list").alias("ls").description("List all org-level model providers").action(
|
|
24648
|
+
withErrorHandler(async () => {
|
|
24649
|
+
const result = await listZeroOrgModelProviders();
|
|
24650
|
+
if (result.modelProviders.length === 0) {
|
|
24651
|
+
console.log(chalk96.dim("No org-level model providers configured"));
|
|
24652
|
+
console.log();
|
|
24653
|
+
console.log("To add an org-level model provider:");
|
|
24654
|
+
console.log(chalk96.cyan(" vm0 zero org model-provider setup"));
|
|
24655
|
+
return;
|
|
24656
|
+
}
|
|
24657
|
+
const byFramework = result.modelProviders.reduce(
|
|
24658
|
+
(acc, p) => {
|
|
24659
|
+
const fw = p.framework;
|
|
24660
|
+
if (!acc[fw]) {
|
|
24661
|
+
acc[fw] = [];
|
|
24662
|
+
}
|
|
24663
|
+
acc[fw].push(p);
|
|
24664
|
+
return acc;
|
|
24665
|
+
},
|
|
24666
|
+
{}
|
|
24667
|
+
);
|
|
24668
|
+
console.log(chalk96.bold("Org Model Providers:"));
|
|
24669
|
+
console.log();
|
|
24670
|
+
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
24671
|
+
console.log(` ${chalk96.cyan(framework)}:`);
|
|
24672
|
+
for (const provider of providers) {
|
|
24673
|
+
const defaultTag = provider.isDefault ? chalk96.green(" (default)") : "";
|
|
24674
|
+
const modelTag = provider.selectedModel ? chalk96.dim(` [${provider.selectedModel}]`) : "";
|
|
24675
|
+
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
24676
|
+
console.log(
|
|
24677
|
+
chalk96.dim(
|
|
24678
|
+
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
24679
|
+
)
|
|
24680
|
+
);
|
|
24681
|
+
}
|
|
24682
|
+
console.log();
|
|
24683
|
+
}
|
|
24684
|
+
console.log(
|
|
24685
|
+
chalk96.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
24686
|
+
);
|
|
24687
|
+
})
|
|
24688
|
+
);
|
|
24689
|
+
|
|
24690
|
+
// src/commands/zero/org/model-provider/setup.ts
|
|
24691
|
+
import { Command as Command110 } from "commander";
|
|
24692
|
+
import chalk97 from "chalk";
|
|
24693
|
+
import prompts4 from "prompts";
|
|
24694
|
+
async function handleInteractiveMode2() {
|
|
24695
|
+
if (!isInteractive()) {
|
|
24696
|
+
throw new Error("Interactive mode requires a TTY", {
|
|
24697
|
+
cause: new Error(
|
|
24698
|
+
'Use non-interactive mode: vm0 zero org model-provider setup --type <type> --secret "<value>"'
|
|
24699
|
+
)
|
|
24700
|
+
});
|
|
24701
|
+
}
|
|
24702
|
+
const { modelProviders: configuredProviders } = await listZeroOrgModelProviders();
|
|
24703
|
+
const configuredTypes = new Set(configuredProviders.map((p) => p.type));
|
|
24704
|
+
const annotatedChoices = getSelectableProviderTypes().map((type3) => {
|
|
24705
|
+
const config2 = MODEL_PROVIDER_TYPES[type3];
|
|
24706
|
+
const isConfigured = configuredTypes.has(type3);
|
|
24707
|
+
const isExperimental = hasAuthMethods(type3);
|
|
24708
|
+
let title = config2.label;
|
|
24709
|
+
if (isConfigured) {
|
|
24710
|
+
title = `${title} \u2713`;
|
|
24711
|
+
}
|
|
24712
|
+
if (isExperimental) {
|
|
24713
|
+
title = `${title} ${chalk97.dim("(experimental)")}`;
|
|
24714
|
+
}
|
|
24715
|
+
return {
|
|
24716
|
+
title,
|
|
24717
|
+
value: type3
|
|
24718
|
+
};
|
|
24719
|
+
});
|
|
24720
|
+
const typeResponse = await prompts4(
|
|
24721
|
+
{
|
|
24722
|
+
type: "select",
|
|
24723
|
+
name: "type",
|
|
24724
|
+
message: "Select provider type:",
|
|
24725
|
+
choices: annotatedChoices
|
|
24726
|
+
},
|
|
24727
|
+
{ onCancel: () => process.exit(0) }
|
|
24728
|
+
);
|
|
24729
|
+
const type2 = typeResponse.type;
|
|
24730
|
+
const existingProvider = configuredProviders.find((p) => p.type === type2);
|
|
24731
|
+
if (existingProvider) {
|
|
24732
|
+
console.log();
|
|
24733
|
+
console.log(`"${type2}" is already configured`);
|
|
24734
|
+
console.log();
|
|
24735
|
+
const actionResponse = await prompts4(
|
|
24736
|
+
{
|
|
24737
|
+
type: "select",
|
|
24738
|
+
name: "action",
|
|
24739
|
+
message: "",
|
|
24740
|
+
choices: [
|
|
24741
|
+
{ title: "Keep existing secret", value: "keep" },
|
|
24742
|
+
{ title: "Update secret", value: "update" }
|
|
24743
|
+
]
|
|
24744
|
+
},
|
|
24745
|
+
{ onCancel: () => process.exit(0) }
|
|
24746
|
+
);
|
|
24747
|
+
if (actionResponse.action === "keep") {
|
|
24748
|
+
const selectedModel2 = await promptForModelSelection(type2);
|
|
24749
|
+
return {
|
|
24750
|
+
type: type2,
|
|
24751
|
+
keepExistingSecret: true,
|
|
24752
|
+
selectedModel: selectedModel2,
|
|
24753
|
+
isInteractiveMode: true
|
|
24754
|
+
};
|
|
24755
|
+
}
|
|
24756
|
+
}
|
|
24757
|
+
const config = MODEL_PROVIDER_TYPES[type2];
|
|
24758
|
+
console.log();
|
|
24759
|
+
if ("helpText" in config) {
|
|
24760
|
+
console.log(chalk97.dim(config.helpText));
|
|
24761
|
+
}
|
|
24762
|
+
console.log();
|
|
24763
|
+
if (hasAuthMethods(type2)) {
|
|
24764
|
+
const authMethod = await promptForAuthMethod(type2);
|
|
24765
|
+
const secrets = await promptForSecrets(type2, authMethod);
|
|
24766
|
+
const selectedModel2 = await promptForModelSelection(type2);
|
|
24767
|
+
return {
|
|
24768
|
+
type: type2,
|
|
24769
|
+
authMethod,
|
|
24770
|
+
secrets,
|
|
24771
|
+
selectedModel: selectedModel2,
|
|
24772
|
+
isInteractiveMode: true
|
|
24773
|
+
};
|
|
24774
|
+
}
|
|
24775
|
+
const secretLabel = "secretLabel" in config ? config.secretLabel : "secret";
|
|
24776
|
+
const secretResponse = await prompts4(
|
|
24777
|
+
{
|
|
24778
|
+
type: "password",
|
|
24779
|
+
name: "secret",
|
|
24780
|
+
message: `Enter your ${secretLabel}:`,
|
|
24781
|
+
validate: (value) => value.length > 0 || `${secretLabel} is required`
|
|
24782
|
+
},
|
|
24783
|
+
{ onCancel: () => process.exit(0) }
|
|
24784
|
+
);
|
|
24785
|
+
const secret = secretResponse.secret;
|
|
24786
|
+
const selectedModel = await promptForModelSelection(type2);
|
|
24787
|
+
return { type: type2, secret, selectedModel, isInteractiveMode: true };
|
|
24788
|
+
}
|
|
24789
|
+
async function promptSetAsDefault2(type2, framework, isDefault) {
|
|
24790
|
+
if (isDefault) return;
|
|
24791
|
+
const response = await prompts4(
|
|
24792
|
+
{
|
|
24793
|
+
type: "confirm",
|
|
24794
|
+
name: "setDefault",
|
|
24795
|
+
message: "Set this provider as default?",
|
|
24796
|
+
initial: false
|
|
24797
|
+
},
|
|
24798
|
+
{ onCancel: () => process.exit(0) }
|
|
24799
|
+
);
|
|
24800
|
+
if (response.setDefault) {
|
|
24801
|
+
await setZeroOrgModelProviderDefault(type2);
|
|
24802
|
+
console.log(chalk97.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
24803
|
+
}
|
|
24804
|
+
}
|
|
24805
|
+
var setupCommand3 = new Command110().name("setup").description("Configure an org-level model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
24806
|
+
"-s, --secret <value>",
|
|
24807
|
+
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
24808
|
+
collectSecrets,
|
|
24809
|
+
[]
|
|
24810
|
+
).option(
|
|
24811
|
+
"-a, --auth-method <method>",
|
|
24812
|
+
"Auth method (required for multi-auth providers like aws-bedrock)"
|
|
24813
|
+
).option("-m, --model <model>", "Model selection (for non-interactive mode)").action(
|
|
24814
|
+
withErrorHandler(
|
|
24815
|
+
async (options) => {
|
|
24816
|
+
let input;
|
|
24817
|
+
const secretArgs = options.secret ?? [];
|
|
24818
|
+
if (options.type && secretArgs.length > 0) {
|
|
24819
|
+
input = handleNonInteractiveMode({
|
|
24820
|
+
type: options.type,
|
|
24821
|
+
secret: secretArgs,
|
|
24822
|
+
authMethod: options.authMethod,
|
|
24823
|
+
model: options.model,
|
|
24824
|
+
commandPrefix: "vm0 zero org model-provider setup"
|
|
24825
|
+
});
|
|
24826
|
+
} else if (options.type || secretArgs.length > 0) {
|
|
24827
|
+
throw new Error("Both --type and --secret are required");
|
|
24828
|
+
} else {
|
|
24829
|
+
const result = await handleInteractiveMode2();
|
|
24830
|
+
if (result === null) {
|
|
24831
|
+
return;
|
|
24832
|
+
}
|
|
24833
|
+
input = result;
|
|
24834
|
+
}
|
|
24835
|
+
if (input.keepExistingSecret) {
|
|
24836
|
+
const provider2 = await updateZeroOrgModelProviderModel(
|
|
24837
|
+
input.type,
|
|
24838
|
+
input.selectedModel
|
|
24839
|
+
);
|
|
24840
|
+
const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
|
|
24841
|
+
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
24842
|
+
if (!hasModelSelection(input.type)) {
|
|
24843
|
+
console.log(
|
|
24844
|
+
chalk97.green(`\u2713 Org model provider "${input.type}" unchanged`)
|
|
24845
|
+
);
|
|
24846
|
+
} else {
|
|
24847
|
+
console.log(
|
|
24848
|
+
chalk97.green(
|
|
24849
|
+
`\u2713 Org model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
24850
|
+
)
|
|
24851
|
+
);
|
|
24852
|
+
}
|
|
24853
|
+
if (input.isInteractiveMode) {
|
|
24854
|
+
await promptSetAsDefault2(
|
|
24855
|
+
input.type,
|
|
24856
|
+
provider2.framework,
|
|
24857
|
+
provider2.isDefault
|
|
24858
|
+
);
|
|
24859
|
+
}
|
|
24860
|
+
return;
|
|
24861
|
+
}
|
|
24862
|
+
const { provider, created } = await upsertZeroOrgModelProvider({
|
|
24863
|
+
type: input.type,
|
|
24864
|
+
secret: input.secret,
|
|
24865
|
+
authMethod: input.authMethod,
|
|
24866
|
+
secrets: input.secrets,
|
|
24867
|
+
selectedModel: input.selectedModel
|
|
24868
|
+
});
|
|
24869
|
+
const action = created ? "created" : "updated";
|
|
24870
|
+
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
24871
|
+
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
24872
|
+
console.log(
|
|
24873
|
+
chalk97.green(
|
|
24874
|
+
`\u2713 Org model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
24875
|
+
)
|
|
24876
|
+
);
|
|
24877
|
+
if (input.isInteractiveMode) {
|
|
24878
|
+
await promptSetAsDefault2(
|
|
24879
|
+
input.type,
|
|
24880
|
+
provider.framework,
|
|
24881
|
+
provider.isDefault
|
|
24882
|
+
);
|
|
24883
|
+
}
|
|
24884
|
+
}
|
|
24885
|
+
)
|
|
24886
|
+
);
|
|
24887
|
+
|
|
24888
|
+
// src/commands/zero/org/model-provider/remove.ts
|
|
24889
|
+
import { Command as Command111 } from "commander";
|
|
24890
|
+
import chalk98 from "chalk";
|
|
24891
|
+
var removeCommand8 = new Command111().name("remove").description("Remove an org-level model provider").argument("<type>", "Model provider type to remove").action(
|
|
24892
|
+
withErrorHandler(async (type2) => {
|
|
24893
|
+
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
24894
|
+
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
24895
|
+
throw new Error(`Invalid type "${type2}"`, {
|
|
24896
|
+
cause: new Error(`Valid types: ${validTypes}`)
|
|
24897
|
+
});
|
|
24898
|
+
}
|
|
24899
|
+
await deleteZeroOrgModelProvider(type2);
|
|
24900
|
+
console.log(chalk98.green(`\u2713 Org model provider "${type2}" removed`));
|
|
24901
|
+
})
|
|
24902
|
+
);
|
|
24903
|
+
|
|
24904
|
+
// src/commands/zero/org/model-provider/set-default.ts
|
|
24905
|
+
import { Command as Command112 } from "commander";
|
|
24906
|
+
import chalk99 from "chalk";
|
|
24907
|
+
var setDefaultCommand2 = new Command112().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(
|
|
24908
|
+
withErrorHandler(async (type2) => {
|
|
24909
|
+
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
24910
|
+
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
24911
|
+
throw new Error(`Invalid type "${type2}"`, {
|
|
24912
|
+
cause: new Error(`Valid types: ${validTypes}`)
|
|
24913
|
+
});
|
|
24914
|
+
}
|
|
24915
|
+
const provider = await setZeroOrgModelProviderDefault(
|
|
24916
|
+
type2
|
|
24917
|
+
);
|
|
24918
|
+
console.log(
|
|
24919
|
+
chalk99.green(
|
|
24920
|
+
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
24921
|
+
)
|
|
24922
|
+
);
|
|
24923
|
+
})
|
|
24924
|
+
);
|
|
24925
|
+
|
|
24926
|
+
// src/commands/zero/org/model-provider/index.ts
|
|
24927
|
+
var zeroOrgModelProviderCommand = new Command113().name("model-provider").description("Manage org-level model providers").addCommand(listCommand17).addCommand(setupCommand3).addCommand(removeCommand8).addCommand(setDefaultCommand2);
|
|
24928
|
+
|
|
24929
|
+
// src/commands/zero/org/index.ts
|
|
24930
|
+
var zeroOrgCommand = new Command114().name("org").description("Manage your organization").addCommand(statusCommand9).addCommand(setCommand6).addCommand(listCommand14).addCommand(useCommand2).addCommand(membersCommand2).addCommand(inviteCommand2).addCommand(removeCommand5).addCommand(leaveCommand2).addCommand(deleteCommand5).addCommand(zeroOrgSecretCommand).addCommand(zeroOrgVariableCommand).addCommand(zeroOrgModelProviderCommand);
|
|
24931
|
+
|
|
24932
|
+
// src/commands/zero/agent/index.ts
|
|
24933
|
+
import { Command as Command120 } from "commander";
|
|
24934
|
+
|
|
24935
|
+
// src/commands/zero/agent/create.ts
|
|
24936
|
+
import { Command as Command115 } from "commander";
|
|
24937
|
+
import { readFileSync } from "fs";
|
|
24938
|
+
import chalk100 from "chalk";
|
|
24939
|
+
var createCommand = new Command115().name("create").description("Create a new zero agent").requiredOption(
|
|
24940
|
+
"--connectors <items>",
|
|
24941
|
+
"Comma-separated connector short names (e.g. github,linear)"
|
|
24942
|
+
).option("--display-name <name>", "Agent display name").option("--description <text>", "Agent description").option(
|
|
24943
|
+
"--sound <tone>",
|
|
24944
|
+
"Agent tone: professional, friendly, direct, supportive"
|
|
24945
|
+
).option("--instructions-file <path>", "Path to instructions file").action(
|
|
24946
|
+
withErrorHandler(
|
|
24947
|
+
async (options) => {
|
|
24948
|
+
const connectors = options.connectors.split(",").map((s) => s.trim());
|
|
24949
|
+
const agent = await createZeroAgent({
|
|
24950
|
+
connectors,
|
|
24951
|
+
displayName: options.displayName,
|
|
24952
|
+
description: options.description,
|
|
24953
|
+
sound: options.sound
|
|
24954
|
+
});
|
|
24955
|
+
if (options.instructionsFile) {
|
|
24956
|
+
const content = readFileSync(options.instructionsFile, "utf-8");
|
|
24957
|
+
await updateZeroAgentInstructions(agent.name, content);
|
|
24958
|
+
}
|
|
24959
|
+
console.log(chalk100.green(`\u2713 Zero agent '${agent.name}' created`));
|
|
24960
|
+
console.log(` Compose ID: ${agent.agentComposeId}`);
|
|
24961
|
+
console.log(` Connectors: ${agent.connectors.join(", ")}`);
|
|
24962
|
+
if (agent.displayName) {
|
|
24963
|
+
console.log(` Display Name: ${agent.displayName}`);
|
|
24964
|
+
}
|
|
24965
|
+
}
|
|
24966
|
+
)
|
|
24967
|
+
);
|
|
24968
|
+
|
|
24969
|
+
// src/commands/zero/agent/edit.ts
|
|
24970
|
+
import { Command as Command116 } from "commander";
|
|
24971
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
24972
|
+
import chalk101 from "chalk";
|
|
24973
|
+
var editCommand = new Command116().name("edit").description("Edit a zero agent").argument("<name>", "Agent name").option(
|
|
24974
|
+
"--connectors <items>",
|
|
24975
|
+
"Comma-separated connector short names (e.g. github,linear)"
|
|
24976
|
+
).option("--display-name <name>", "New display name").option("--description <text>", "New description").option(
|
|
24977
|
+
"--sound <tone>",
|
|
24978
|
+
"New tone: professional, friendly, direct, supportive"
|
|
24979
|
+
).option("--instructions-file <path>", "Path to new instructions file").action(
|
|
24980
|
+
withErrorHandler(
|
|
24981
|
+
async (name, options) => {
|
|
24982
|
+
const hasAgentUpdate = options.connectors !== void 0 || options.displayName !== void 0 || options.description !== void 0 || options.sound !== void 0;
|
|
24983
|
+
if (!hasAgentUpdate && !options.instructionsFile) {
|
|
24984
|
+
throw new Error(
|
|
24985
|
+
"At least one option is required (--connectors, --display-name, --description, --sound, --instructions-file)"
|
|
24986
|
+
);
|
|
24987
|
+
}
|
|
24988
|
+
if (hasAgentUpdate) {
|
|
24989
|
+
const current = await getZeroAgent(name);
|
|
24990
|
+
const connectors = options.connectors ? options.connectors.split(",").map((s) => s.trim()) : current.connectors;
|
|
24991
|
+
await updateZeroAgent(name, {
|
|
24992
|
+
connectors,
|
|
24993
|
+
displayName: options.displayName !== void 0 ? options.displayName : current.displayName ?? void 0,
|
|
24994
|
+
description: options.description !== void 0 ? options.description : current.description ?? void 0,
|
|
24995
|
+
sound: options.sound !== void 0 ? options.sound : current.sound ?? void 0
|
|
24996
|
+
});
|
|
24997
|
+
}
|
|
24998
|
+
if (options.instructionsFile) {
|
|
24999
|
+
const content = readFileSync2(options.instructionsFile, "utf-8");
|
|
25000
|
+
await updateZeroAgentInstructions(name, content);
|
|
25001
|
+
}
|
|
25002
|
+
console.log(chalk101.green(`\u2713 Zero agent '${name}' updated`));
|
|
25003
|
+
}
|
|
25004
|
+
)
|
|
25005
|
+
);
|
|
25006
|
+
|
|
25007
|
+
// src/commands/zero/agent/view.ts
|
|
25008
|
+
import { Command as Command117 } from "commander";
|
|
25009
|
+
import chalk102 from "chalk";
|
|
25010
|
+
var viewCommand = new Command117().name("view").description("View a zero agent").argument("<name>", "Agent name").option("--instructions", "Also show instructions content").action(
|
|
25011
|
+
withErrorHandler(
|
|
25012
|
+
async (name, options) => {
|
|
25013
|
+
const agent = await getZeroAgent(name);
|
|
25014
|
+
console.log(chalk102.bold(agent.name));
|
|
25015
|
+
if (agent.displayName) console.log(chalk102.dim(agent.displayName));
|
|
25016
|
+
console.log();
|
|
25017
|
+
console.log(`Compose ID: ${agent.agentComposeId}`);
|
|
25018
|
+
console.log(`Connectors: ${agent.connectors.join(", ") || "-"}`);
|
|
25019
|
+
if (agent.description)
|
|
25020
|
+
console.log(`Description: ${agent.description}`);
|
|
25021
|
+
if (agent.sound) console.log(`Sound: ${agent.sound}`);
|
|
25022
|
+
if (options.instructions) {
|
|
25023
|
+
console.log();
|
|
25024
|
+
const result = await getZeroAgentInstructions(name);
|
|
25025
|
+
if (result.content) {
|
|
25026
|
+
console.log(chalk102.dim("\u2500\u2500 Instructions \u2500\u2500"));
|
|
25027
|
+
console.log(result.content);
|
|
25028
|
+
} else {
|
|
25029
|
+
console.log(chalk102.dim("No instructions set"));
|
|
25030
|
+
}
|
|
25031
|
+
}
|
|
25032
|
+
}
|
|
25033
|
+
)
|
|
25034
|
+
);
|
|
25035
|
+
|
|
25036
|
+
// src/commands/zero/agent/list.ts
|
|
25037
|
+
import { Command as Command118 } from "commander";
|
|
25038
|
+
import chalk103 from "chalk";
|
|
25039
|
+
var listCommand18 = new Command118().name("list").alias("ls").description("List all zero agents").action(
|
|
25040
|
+
withErrorHandler(async () => {
|
|
25041
|
+
const agents = await listZeroAgents();
|
|
25042
|
+
if (agents.length === 0) {
|
|
25043
|
+
console.log(chalk103.dim("No zero agents found"));
|
|
25044
|
+
console.log(
|
|
25045
|
+
chalk103.dim(
|
|
25046
|
+
' Create one with: vm0 zero agent create --connectors github --display-name "My Agent"'
|
|
25047
|
+
)
|
|
25048
|
+
);
|
|
25049
|
+
return;
|
|
25050
|
+
}
|
|
25051
|
+
const nameWidth = Math.max(4, ...agents.map((a) => a.name.length));
|
|
25052
|
+
const displayWidth = Math.max(
|
|
25053
|
+
12,
|
|
25054
|
+
...agents.map((a) => (a.displayName ?? "").length)
|
|
25055
|
+
);
|
|
25056
|
+
const header = [
|
|
25057
|
+
"NAME".padEnd(nameWidth),
|
|
25058
|
+
"DISPLAY NAME".padEnd(displayWidth),
|
|
25059
|
+
"CONNECTORS"
|
|
25060
|
+
].join(" ");
|
|
25061
|
+
console.log(chalk103.dim(header));
|
|
25062
|
+
for (const agent of agents) {
|
|
25063
|
+
const row = [
|
|
25064
|
+
agent.name.padEnd(nameWidth),
|
|
25065
|
+
(agent.displayName ?? "-").padEnd(displayWidth),
|
|
25066
|
+
agent.connectors.join(", ") || "-"
|
|
25067
|
+
].join(" ");
|
|
25068
|
+
console.log(row);
|
|
25069
|
+
}
|
|
25070
|
+
})
|
|
25071
|
+
);
|
|
25072
|
+
|
|
25073
|
+
// src/commands/zero/agent/delete.ts
|
|
25074
|
+
import { Command as Command119 } from "commander";
|
|
25075
|
+
import chalk104 from "chalk";
|
|
25076
|
+
var deleteCommand6 = new Command119().name("delete").alias("rm").description("Delete a zero agent").argument("<name>", "Agent name").option("-y, --yes", "Skip confirmation prompt").action(
|
|
25077
|
+
withErrorHandler(async (name, options) => {
|
|
25078
|
+
await getZeroAgent(name);
|
|
25079
|
+
if (!options.yes) {
|
|
25080
|
+
if (!isInteractive()) {
|
|
25081
|
+
throw new Error("--yes flag is required in non-interactive mode");
|
|
25082
|
+
}
|
|
25083
|
+
const confirmed = await promptConfirm(
|
|
25084
|
+
`Delete zero agent '${name}'?`,
|
|
25085
|
+
false
|
|
25086
|
+
);
|
|
25087
|
+
if (!confirmed) {
|
|
25088
|
+
console.log(chalk104.dim("Cancelled"));
|
|
25089
|
+
return;
|
|
25090
|
+
}
|
|
25091
|
+
}
|
|
25092
|
+
await deleteZeroAgent(name);
|
|
25093
|
+
console.log(chalk104.green(`\u2713 Zero agent '${name}' deleted`));
|
|
25094
|
+
})
|
|
25095
|
+
);
|
|
25096
|
+
|
|
25097
|
+
// src/commands/zero/agent/index.ts
|
|
25098
|
+
var agentCommand2 = new Command120("agent").description("Manage zero agents").addCommand(createCommand).addCommand(editCommand).addCommand(viewCommand).addCommand(listCommand18).addCommand(deleteCommand6);
|
|
25099
|
+
|
|
25100
|
+
// src/commands/zero/index.ts
|
|
25101
|
+
var zeroCommand = new Command121("zero").description("Zero platform commands").addCommand(zeroOrgCommand).addCommand(agentCommand2);
|
|
25102
|
+
|
|
23900
25103
|
// src/index.ts
|
|
23901
|
-
var program = new
|
|
23902
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
25104
|
+
var program = new Command122();
|
|
25105
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.76.0");
|
|
23903
25106
|
program.addCommand(authCommand);
|
|
23904
25107
|
program.addCommand(infoCommand);
|
|
23905
25108
|
program.addCommand(composeCommand);
|