@vm0/cli 9.64.1 → 9.65.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 +311 -600
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ if (DSN) {
|
|
|
45
45
|
Sentry.init({
|
|
46
46
|
dsn: DSN,
|
|
47
47
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
48
|
-
release: "9.
|
|
48
|
+
release: "9.65.0",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.65.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -83,7 +83,7 @@ process.stdout.on("error", handleEpipe);
|
|
|
83
83
|
process.stderr.on("error", handleEpipe);
|
|
84
84
|
|
|
85
85
|
// src/index.ts
|
|
86
|
-
import { Command as
|
|
86
|
+
import { Command as Command95 } from "commander";
|
|
87
87
|
|
|
88
88
|
// src/lib/network/proxy.ts
|
|
89
89
|
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
@@ -675,7 +675,7 @@ function getConfigPath() {
|
|
|
675
675
|
return join2(homedir2(), ".vm0", "config.json");
|
|
676
676
|
}
|
|
677
677
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
678
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
678
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.65.0"}`));
|
|
679
679
|
console.log();
|
|
680
680
|
const config = await loadConfig();
|
|
681
681
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1720,9 +1720,22 @@ var logsSearchContract = c4.router({
|
|
|
1720
1720
|
var queueEntrySchema = z7.object({
|
|
1721
1721
|
position: z7.number(),
|
|
1722
1722
|
agentName: z7.string().nullable(),
|
|
1723
|
+
agentDisplayName: z7.string().nullable(),
|
|
1723
1724
|
userEmail: z7.string().nullable(),
|
|
1724
1725
|
createdAt: z7.string(),
|
|
1725
|
-
|
|
1726
|
+
isOwner: z7.boolean(),
|
|
1727
|
+
runId: z7.string().nullable(),
|
|
1728
|
+
prompt: z7.string().nullable(),
|
|
1729
|
+
triggerSource: z7.enum(["schedule", "chat", "api"]).nullable(),
|
|
1730
|
+
sessionLink: z7.string().nullable()
|
|
1731
|
+
});
|
|
1732
|
+
var runningTaskSchema = z7.object({
|
|
1733
|
+
runId: z7.string().nullable(),
|
|
1734
|
+
agentName: z7.string(),
|
|
1735
|
+
agentDisplayName: z7.string().nullable(),
|
|
1736
|
+
userEmail: z7.string(),
|
|
1737
|
+
startedAt: z7.string().nullable(),
|
|
1738
|
+
isOwner: z7.boolean()
|
|
1726
1739
|
});
|
|
1727
1740
|
var concurrencyInfoSchema = z7.object({
|
|
1728
1741
|
tier: orgTierSchema,
|
|
@@ -1732,7 +1745,9 @@ var concurrencyInfoSchema = z7.object({
|
|
|
1732
1745
|
});
|
|
1733
1746
|
var queueResponseSchema = z7.object({
|
|
1734
1747
|
concurrency: concurrencyInfoSchema,
|
|
1735
|
-
queue: z7.array(queueEntrySchema)
|
|
1748
|
+
queue: z7.array(queueEntrySchema),
|
|
1749
|
+
runningTasks: z7.array(runningTaskSchema),
|
|
1750
|
+
estimatedTimePerRun: z7.number().nullable()
|
|
1736
1751
|
});
|
|
1737
1752
|
var runsQueueContract = c4.router({
|
|
1738
1753
|
/**
|
|
@@ -3823,7 +3838,7 @@ var platformLogDetailSchema = z21.object({
|
|
|
3823
3838
|
var platformLogsListContract = c18.router({
|
|
3824
3839
|
list: {
|
|
3825
3840
|
method: "GET",
|
|
3826
|
-
path: "/api/
|
|
3841
|
+
path: "/api/app/logs",
|
|
3827
3842
|
query: listQuerySchema.extend({
|
|
3828
3843
|
search: z21.string().optional(),
|
|
3829
3844
|
agent: z21.string().optional(),
|
|
@@ -3841,7 +3856,7 @@ var platformLogsListContract = c18.router({
|
|
|
3841
3856
|
var platformLogsByIdContract = c18.router({
|
|
3842
3857
|
getById: {
|
|
3843
3858
|
method: "GET",
|
|
3844
|
-
path: "/api/
|
|
3859
|
+
path: "/api/app/logs/:id",
|
|
3845
3860
|
headers: authHeadersSchema,
|
|
3846
3861
|
pathParams: z21.object({
|
|
3847
3862
|
id: z21.string().uuid("Invalid log ID")
|
|
@@ -3861,7 +3876,7 @@ var artifactDownloadResponseSchema = z21.object({
|
|
|
3861
3876
|
var platformArtifactDownloadContract = c18.router({
|
|
3862
3877
|
getDownloadUrl: {
|
|
3863
3878
|
method: "GET",
|
|
3864
|
-
path: "/api/
|
|
3879
|
+
path: "/api/app/artifacts/download",
|
|
3865
3880
|
query: z21.object({
|
|
3866
3881
|
name: z21.string().min(1, "Artifact name is required"),
|
|
3867
3882
|
version: z21.string().optional()
|
|
@@ -6600,6 +6615,31 @@ function getConnectorDerivedNames(secretName) {
|
|
|
6600
6615
|
}
|
|
6601
6616
|
return null;
|
|
6602
6617
|
}
|
|
6618
|
+
function getConnectorOAuthConfig(type2) {
|
|
6619
|
+
const config = CONNECTOR_TYPES[type2];
|
|
6620
|
+
return "oauth" in config ? config.oauth : void 0;
|
|
6621
|
+
}
|
|
6622
|
+
function hasRequiredScopes(connectorType, storedScopes) {
|
|
6623
|
+
const oauthConfig = getConnectorOAuthConfig(connectorType);
|
|
6624
|
+
if (!oauthConfig) return true;
|
|
6625
|
+
if (oauthConfig.scopes.length === 0) return true;
|
|
6626
|
+
if (!storedScopes) return false;
|
|
6627
|
+
const storedSet = new Set(storedScopes);
|
|
6628
|
+
return oauthConfig.scopes.every((s) => storedSet.has(s));
|
|
6629
|
+
}
|
|
6630
|
+
function getScopeDiff(connectorType, storedScopes) {
|
|
6631
|
+
const oauthConfig = getConnectorOAuthConfig(connectorType);
|
|
6632
|
+
const currentScopes = oauthConfig?.scopes ?? [];
|
|
6633
|
+
const stored = storedScopes ?? [];
|
|
6634
|
+
const storedSet = new Set(stored);
|
|
6635
|
+
const currentSet = new Set(currentScopes);
|
|
6636
|
+
return {
|
|
6637
|
+
addedScopes: currentScopes.filter((s) => !storedSet.has(s)),
|
|
6638
|
+
removedScopes: stored.filter((s) => !currentSet.has(s)),
|
|
6639
|
+
currentScopes,
|
|
6640
|
+
storedScopes: stored
|
|
6641
|
+
};
|
|
6642
|
+
}
|
|
6603
6643
|
var connectorResponseSchema = z23.object({
|
|
6604
6644
|
id: z23.uuid().nullable(),
|
|
6605
6645
|
type: connectorTypeSchema,
|
|
@@ -6662,6 +6702,27 @@ var connectorsByTypeContract = c20.router({
|
|
|
6662
6702
|
summary: "Disconnect a connector"
|
|
6663
6703
|
}
|
|
6664
6704
|
});
|
|
6705
|
+
var scopeDiffResponseSchema = z23.object({
|
|
6706
|
+
addedScopes: z23.array(z23.string()),
|
|
6707
|
+
removedScopes: z23.array(z23.string()),
|
|
6708
|
+
currentScopes: z23.array(z23.string()),
|
|
6709
|
+
storedScopes: z23.array(z23.string())
|
|
6710
|
+
});
|
|
6711
|
+
var connectorScopeDiffContract = c20.router({
|
|
6712
|
+
getScopeDiff: {
|
|
6713
|
+
method: "GET",
|
|
6714
|
+
path: "/api/connectors/:type/scope-diff",
|
|
6715
|
+
headers: authHeadersSchema,
|
|
6716
|
+
pathParams: z23.object({ type: connectorTypeSchema }),
|
|
6717
|
+
responses: {
|
|
6718
|
+
200: scopeDiffResponseSchema,
|
|
6719
|
+
401: apiErrorSchema,
|
|
6720
|
+
404: apiErrorSchema,
|
|
6721
|
+
500: apiErrorSchema
|
|
6722
|
+
},
|
|
6723
|
+
summary: "Get scope diff for a connector"
|
|
6724
|
+
}
|
|
6725
|
+
});
|
|
6665
6726
|
var connectorSessionStatusSchema = z23.enum([
|
|
6666
6727
|
"pending",
|
|
6667
6728
|
"complete",
|
|
@@ -7208,6 +7269,7 @@ import { z as z26 } from "zod";
|
|
|
7208
7269
|
var c23 = initContract();
|
|
7209
7270
|
var onboardingStatusResponseSchema = z26.object({
|
|
7210
7271
|
needsOnboarding: z26.boolean(),
|
|
7272
|
+
isAdmin: z26.boolean(),
|
|
7211
7273
|
hasOrg: z26.boolean(),
|
|
7212
7274
|
hasModelProvider: z26.boolean(),
|
|
7213
7275
|
hasDefaultAgent: z26.boolean(),
|
|
@@ -7217,7 +7279,8 @@ var onboardingStatusResponseSchema = z26.object({
|
|
|
7217
7279
|
displayName: z26.string().optional(),
|
|
7218
7280
|
description: z26.string().optional(),
|
|
7219
7281
|
sound: z26.string().optional()
|
|
7220
|
-
}).nullable()
|
|
7282
|
+
}).nullable(),
|
|
7283
|
+
defaultAgentSkills: z26.array(z26.string())
|
|
7221
7284
|
});
|
|
7222
7285
|
var onboardingStatusContract = c23.router({
|
|
7223
7286
|
getStatus: {
|
|
@@ -8362,77 +8425,11 @@ async function deleteVariable(name) {
|
|
|
8362
8425
|
handleError(result, `Variable "${name}" not found`);
|
|
8363
8426
|
}
|
|
8364
8427
|
|
|
8365
|
-
// src/lib/api/domains/model-providers.ts
|
|
8366
|
-
import { initClient as initClient9 } from "@ts-rest/core";
|
|
8367
|
-
async function listModelProviders() {
|
|
8368
|
-
const config = await getClientConfig();
|
|
8369
|
-
const client = initClient9(modelProvidersMainContract, config);
|
|
8370
|
-
const result = await client.list({ headers: {} });
|
|
8371
|
-
if (result.status === 200) {
|
|
8372
|
-
return result.body;
|
|
8373
|
-
}
|
|
8374
|
-
handleError(result, "Failed to list model providers");
|
|
8375
|
-
}
|
|
8376
|
-
async function upsertModelProvider(body) {
|
|
8377
|
-
const config = await getClientConfig();
|
|
8378
|
-
const client = initClient9(modelProvidersMainContract, config);
|
|
8379
|
-
const result = await client.upsert({ body });
|
|
8380
|
-
if (result.status === 200 || result.status === 201) {
|
|
8381
|
-
return result.body;
|
|
8382
|
-
}
|
|
8383
|
-
handleError(result, "Failed to set model provider");
|
|
8384
|
-
}
|
|
8385
|
-
async function checkModelProviderSecret(type2) {
|
|
8386
|
-
const config = await getClientConfig();
|
|
8387
|
-
const client = initClient9(modelProvidersCheckContract, config);
|
|
8388
|
-
const result = await client.check({
|
|
8389
|
-
params: { type: type2 }
|
|
8390
|
-
});
|
|
8391
|
-
if (result.status === 200) {
|
|
8392
|
-
return result.body;
|
|
8393
|
-
}
|
|
8394
|
-
handleError(result, "Failed to check secret");
|
|
8395
|
-
}
|
|
8396
|
-
async function deleteModelProvider(type2) {
|
|
8397
|
-
const config = await getClientConfig();
|
|
8398
|
-
const client = initClient9(modelProvidersByTypeContract, config);
|
|
8399
|
-
const result = await client.delete({
|
|
8400
|
-
params: { type: type2 }
|
|
8401
|
-
});
|
|
8402
|
-
if (result.status === 204) {
|
|
8403
|
-
return;
|
|
8404
|
-
}
|
|
8405
|
-
handleError(result, `Model provider "${type2}" not found`);
|
|
8406
|
-
}
|
|
8407
|
-
async function setModelProviderDefault(type2) {
|
|
8408
|
-
const config = await getClientConfig();
|
|
8409
|
-
const client = initClient9(modelProvidersSetDefaultContract, config);
|
|
8410
|
-
const result = await client.setDefault({
|
|
8411
|
-
params: { type: type2 }
|
|
8412
|
-
});
|
|
8413
|
-
if (result.status === 200) {
|
|
8414
|
-
return result.body;
|
|
8415
|
-
}
|
|
8416
|
-
handleError(result, "Failed to set default model provider");
|
|
8417
|
-
}
|
|
8418
|
-
async function updateModelProviderModel(type2, selectedModel) {
|
|
8419
|
-
const config = await getClientConfig();
|
|
8420
|
-
const client = initClient9(modelProvidersUpdateModelContract, config);
|
|
8421
|
-
const result = await client.updateModel({
|
|
8422
|
-
params: { type: type2 },
|
|
8423
|
-
body: { selectedModel }
|
|
8424
|
-
});
|
|
8425
|
-
if (result.status === 200) {
|
|
8426
|
-
return result.body;
|
|
8427
|
-
}
|
|
8428
|
-
handleError(result, "Failed to update model provider");
|
|
8429
|
-
}
|
|
8430
|
-
|
|
8431
8428
|
// src/lib/api/domains/org-model-providers.ts
|
|
8432
|
-
import { initClient as
|
|
8429
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
8433
8430
|
async function listOrgModelProviders() {
|
|
8434
8431
|
const config = await getClientConfig();
|
|
8435
|
-
const client =
|
|
8432
|
+
const client = initClient9(orgModelProvidersMainContract, config);
|
|
8436
8433
|
const result = await client.list({ headers: {} });
|
|
8437
8434
|
if (result.status === 200) {
|
|
8438
8435
|
return result.body;
|
|
@@ -8441,7 +8438,7 @@ async function listOrgModelProviders() {
|
|
|
8441
8438
|
}
|
|
8442
8439
|
async function upsertOrgModelProvider(body) {
|
|
8443
8440
|
const config = await getClientConfig();
|
|
8444
|
-
const client =
|
|
8441
|
+
const client = initClient9(orgModelProvidersMainContract, config);
|
|
8445
8442
|
const result = await client.upsert({ body });
|
|
8446
8443
|
if (result.status === 200 || result.status === 201) {
|
|
8447
8444
|
return result.body;
|
|
@@ -8450,7 +8447,7 @@ async function upsertOrgModelProvider(body) {
|
|
|
8450
8447
|
}
|
|
8451
8448
|
async function deleteOrgModelProvider(type2) {
|
|
8452
8449
|
const config = await getClientConfig();
|
|
8453
|
-
const client =
|
|
8450
|
+
const client = initClient9(orgModelProvidersByTypeContract, config);
|
|
8454
8451
|
const result = await client.delete({
|
|
8455
8452
|
params: { type: type2 }
|
|
8456
8453
|
});
|
|
@@ -8461,7 +8458,7 @@ async function deleteOrgModelProvider(type2) {
|
|
|
8461
8458
|
}
|
|
8462
8459
|
async function setOrgModelProviderDefault(type2) {
|
|
8463
8460
|
const config = await getClientConfig();
|
|
8464
|
-
const client =
|
|
8461
|
+
const client = initClient9(orgModelProvidersSetDefaultContract, config);
|
|
8465
8462
|
const result = await client.setDefault({
|
|
8466
8463
|
params: { type: type2 }
|
|
8467
8464
|
});
|
|
@@ -8472,7 +8469,7 @@ async function setOrgModelProviderDefault(type2) {
|
|
|
8472
8469
|
}
|
|
8473
8470
|
async function updateOrgModelProviderModel(type2, selectedModel) {
|
|
8474
8471
|
const config = await getClientConfig();
|
|
8475
|
-
const client =
|
|
8472
|
+
const client = initClient9(orgModelProvidersUpdateModelContract, config);
|
|
8476
8473
|
const result = await client.updateModel({
|
|
8477
8474
|
params: { type: type2 },
|
|
8478
8475
|
body: { selectedModel }
|
|
@@ -8484,10 +8481,10 @@ async function updateOrgModelProviderModel(type2, selectedModel) {
|
|
|
8484
8481
|
}
|
|
8485
8482
|
|
|
8486
8483
|
// src/lib/api/domains/connectors.ts
|
|
8487
|
-
import { initClient as
|
|
8484
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
8488
8485
|
async function listConnectors() {
|
|
8489
8486
|
const config = await getClientConfig();
|
|
8490
|
-
const client =
|
|
8487
|
+
const client = initClient10(connectorsMainContract, config);
|
|
8491
8488
|
const result = await client.list({ headers: {} });
|
|
8492
8489
|
if (result.status === 200) {
|
|
8493
8490
|
return result.body;
|
|
@@ -8496,7 +8493,7 @@ async function listConnectors() {
|
|
|
8496
8493
|
}
|
|
8497
8494
|
async function deleteConnector(type2) {
|
|
8498
8495
|
const config = await getClientConfig();
|
|
8499
|
-
const client =
|
|
8496
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
8500
8497
|
const result = await client.delete({
|
|
8501
8498
|
params: { type: type2 }
|
|
8502
8499
|
});
|
|
@@ -8507,7 +8504,7 @@ async function deleteConnector(type2) {
|
|
|
8507
8504
|
}
|
|
8508
8505
|
async function getConnector(type2) {
|
|
8509
8506
|
const config = await getClientConfig();
|
|
8510
|
-
const client =
|
|
8507
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
8511
8508
|
const result = await client.get({
|
|
8512
8509
|
params: { type: type2 }
|
|
8513
8510
|
});
|
|
@@ -8550,10 +8547,10 @@ async function getUsage(options) {
|
|
|
8550
8547
|
}
|
|
8551
8548
|
|
|
8552
8549
|
// src/lib/api/domains/user-preferences.ts
|
|
8553
|
-
import { initClient as
|
|
8550
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
8554
8551
|
async function getUserPreferences() {
|
|
8555
8552
|
const config = await getClientConfig();
|
|
8556
|
-
const client =
|
|
8553
|
+
const client = initClient11(userPreferencesContract, config);
|
|
8557
8554
|
const result = await client.get({ headers: {} });
|
|
8558
8555
|
if (result.status === 200) {
|
|
8559
8556
|
return result.body;
|
|
@@ -8562,7 +8559,7 @@ async function getUserPreferences() {
|
|
|
8562
8559
|
}
|
|
8563
8560
|
async function updateUserPreferences(body) {
|
|
8564
8561
|
const config = await getClientConfig();
|
|
8565
|
-
const client =
|
|
8562
|
+
const client = initClient11(userPreferencesContract, config);
|
|
8566
8563
|
const result = await client.update({ body });
|
|
8567
8564
|
if (result.status === 200) {
|
|
8568
8565
|
return result.body;
|
|
@@ -8571,10 +8568,10 @@ async function updateUserPreferences(body) {
|
|
|
8571
8568
|
}
|
|
8572
8569
|
|
|
8573
8570
|
// src/lib/api/domains/org-secrets.ts
|
|
8574
|
-
import { initClient as
|
|
8571
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
8575
8572
|
async function listOrgSecrets() {
|
|
8576
8573
|
const config = await getClientConfig();
|
|
8577
|
-
const client =
|
|
8574
|
+
const client = initClient12(orgSecretsMainContract, config);
|
|
8578
8575
|
const result = await client.list({ headers: {} });
|
|
8579
8576
|
if (result.status === 200) {
|
|
8580
8577
|
return result.body;
|
|
@@ -8583,7 +8580,7 @@ async function listOrgSecrets() {
|
|
|
8583
8580
|
}
|
|
8584
8581
|
async function setOrgSecret(body) {
|
|
8585
8582
|
const config = await getClientConfig();
|
|
8586
|
-
const client =
|
|
8583
|
+
const client = initClient12(orgSecretsMainContract, config);
|
|
8587
8584
|
const result = await client.set({ body });
|
|
8588
8585
|
if (result.status === 200 || result.status === 201) {
|
|
8589
8586
|
return result.body;
|
|
@@ -8592,7 +8589,7 @@ async function setOrgSecret(body) {
|
|
|
8592
8589
|
}
|
|
8593
8590
|
async function deleteOrgSecret(name) {
|
|
8594
8591
|
const config = await getClientConfig();
|
|
8595
|
-
const client =
|
|
8592
|
+
const client = initClient12(orgSecretsByNameContract, config);
|
|
8596
8593
|
const result = await client.delete({
|
|
8597
8594
|
params: { name }
|
|
8598
8595
|
});
|
|
@@ -8603,10 +8600,10 @@ async function deleteOrgSecret(name) {
|
|
|
8603
8600
|
}
|
|
8604
8601
|
|
|
8605
8602
|
// src/lib/api/domains/org-variables.ts
|
|
8606
|
-
import { initClient as
|
|
8603
|
+
import { initClient as initClient13 } from "@ts-rest/core";
|
|
8607
8604
|
async function listOrgVariables() {
|
|
8608
8605
|
const config = await getClientConfig();
|
|
8609
|
-
const client =
|
|
8606
|
+
const client = initClient13(orgVariablesMainContract, config);
|
|
8610
8607
|
const result = await client.list({ headers: {} });
|
|
8611
8608
|
if (result.status === 200) {
|
|
8612
8609
|
return result.body;
|
|
@@ -8615,7 +8612,7 @@ async function listOrgVariables() {
|
|
|
8615
8612
|
}
|
|
8616
8613
|
async function setOrgVariable(body) {
|
|
8617
8614
|
const config = await getClientConfig();
|
|
8618
|
-
const client =
|
|
8615
|
+
const client = initClient13(orgVariablesMainContract, config);
|
|
8619
8616
|
const result = await client.set({ body });
|
|
8620
8617
|
if (result.status === 200 || result.status === 201) {
|
|
8621
8618
|
return result.body;
|
|
@@ -8624,7 +8621,7 @@ async function setOrgVariable(body) {
|
|
|
8624
8621
|
}
|
|
8625
8622
|
async function deleteOrgVariable(name) {
|
|
8626
8623
|
const config = await getClientConfig();
|
|
8627
|
-
const client =
|
|
8624
|
+
const client = initClient13(orgVariablesByNameContract, config);
|
|
8628
8625
|
const result = await client.delete({
|
|
8629
8626
|
params: { name }
|
|
8630
8627
|
});
|
|
@@ -9980,7 +9977,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9980
9977
|
options.autoUpdate = false;
|
|
9981
9978
|
}
|
|
9982
9979
|
if (options.autoUpdate !== false) {
|
|
9983
|
-
await startSilentUpgrade("9.
|
|
9980
|
+
await startSilentUpgrade("9.65.0");
|
|
9984
9981
|
}
|
|
9985
9982
|
try {
|
|
9986
9983
|
let result;
|
|
@@ -10802,7 +10799,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10802
10799
|
withErrorHandler(
|
|
10803
10800
|
async (identifier, prompt, options) => {
|
|
10804
10801
|
if (options.autoUpdate !== false) {
|
|
10805
|
-
await startSilentUpgrade("9.
|
|
10802
|
+
await startSilentUpgrade("9.65.0");
|
|
10806
10803
|
}
|
|
10807
10804
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10808
10805
|
let composeId;
|
|
@@ -12522,7 +12519,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
12522
12519
|
withErrorHandler(
|
|
12523
12520
|
async (prompt, options) => {
|
|
12524
12521
|
if (options.autoUpdate !== false) {
|
|
12525
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12522
|
+
const shouldExit = await checkAndUpgrade("9.65.0", prompt);
|
|
12526
12523
|
if (shouldExit) {
|
|
12527
12524
|
process.exit(0);
|
|
12528
12525
|
}
|
|
@@ -12708,7 +12705,7 @@ import { Command as Command40 } from "commander";
|
|
|
12708
12705
|
import chalk36 from "chalk";
|
|
12709
12706
|
|
|
12710
12707
|
// src/lib/api/api-client.ts
|
|
12711
|
-
import { initClient as
|
|
12708
|
+
import { initClient as initClient14 } from "@ts-rest/core";
|
|
12712
12709
|
var ApiClient = class {
|
|
12713
12710
|
async getHeaders() {
|
|
12714
12711
|
const token = await getActiveToken();
|
|
@@ -12734,7 +12731,7 @@ var ApiClient = class {
|
|
|
12734
12731
|
async getComposeByName(name, org) {
|
|
12735
12732
|
const baseUrl = await this.getBaseUrl();
|
|
12736
12733
|
const headers = await this.getHeaders();
|
|
12737
|
-
const client =
|
|
12734
|
+
const client = initClient14(composesMainContract, {
|
|
12738
12735
|
baseUrl,
|
|
12739
12736
|
baseHeaders: headers,
|
|
12740
12737
|
jsonQuery: false
|
|
@@ -12755,7 +12752,7 @@ var ApiClient = class {
|
|
|
12755
12752
|
async getComposeById(id) {
|
|
12756
12753
|
const baseUrl = await this.getBaseUrl();
|
|
12757
12754
|
const headers = await this.getHeaders();
|
|
12758
|
-
const client =
|
|
12755
|
+
const client = initClient14(composesByIdContract, {
|
|
12759
12756
|
baseUrl,
|
|
12760
12757
|
baseHeaders: headers,
|
|
12761
12758
|
jsonQuery: false
|
|
@@ -12777,7 +12774,7 @@ var ApiClient = class {
|
|
|
12777
12774
|
async getComposeVersion(composeId, version) {
|
|
12778
12775
|
const baseUrl = await this.getBaseUrl();
|
|
12779
12776
|
const headers = await this.getHeaders();
|
|
12780
|
-
const client =
|
|
12777
|
+
const client = initClient14(composesVersionsContract, {
|
|
12781
12778
|
baseUrl,
|
|
12782
12779
|
baseHeaders: headers,
|
|
12783
12780
|
jsonQuery: false
|
|
@@ -12798,7 +12795,7 @@ var ApiClient = class {
|
|
|
12798
12795
|
async createOrUpdateCompose(body) {
|
|
12799
12796
|
const baseUrl = await this.getBaseUrl();
|
|
12800
12797
|
const headers = await this.getHeaders();
|
|
12801
|
-
const client =
|
|
12798
|
+
const client = initClient14(composesMainContract, {
|
|
12802
12799
|
baseUrl,
|
|
12803
12800
|
baseHeaders: headers,
|
|
12804
12801
|
jsonQuery: false
|
|
@@ -12821,7 +12818,7 @@ var ApiClient = class {
|
|
|
12821
12818
|
async createRun(body) {
|
|
12822
12819
|
const baseUrl = await this.getBaseUrl();
|
|
12823
12820
|
const headers = await this.getHeaders();
|
|
12824
|
-
const client =
|
|
12821
|
+
const client = initClient14(runsMainContract, {
|
|
12825
12822
|
baseUrl,
|
|
12826
12823
|
baseHeaders: headers,
|
|
12827
12824
|
jsonQuery: false
|
|
@@ -12835,13 +12832,8 @@ var ApiClient = class {
|
|
|
12835
12832
|
throw new Error(message);
|
|
12836
12833
|
}
|
|
12837
12834
|
async getEvents(runId, options) {
|
|
12838
|
-
const
|
|
12839
|
-
const
|
|
12840
|
-
const client = initClient15(runEventsContract, {
|
|
12841
|
-
baseUrl,
|
|
12842
|
-
baseHeaders: headers,
|
|
12843
|
-
jsonQuery: false
|
|
12844
|
-
});
|
|
12835
|
+
const config = await getClientConfig();
|
|
12836
|
+
const client = initClient14(runEventsContract, config);
|
|
12845
12837
|
const result = await client.getEvents({
|
|
12846
12838
|
params: { id: runId },
|
|
12847
12839
|
query: {
|
|
@@ -12857,13 +12849,8 @@ var ApiClient = class {
|
|
|
12857
12849
|
throw new Error(message);
|
|
12858
12850
|
}
|
|
12859
12851
|
async getSystemLog(runId, options) {
|
|
12860
|
-
const
|
|
12861
|
-
const
|
|
12862
|
-
const client = initClient15(runSystemLogContract, {
|
|
12863
|
-
baseUrl,
|
|
12864
|
-
baseHeaders: headers,
|
|
12865
|
-
jsonQuery: false
|
|
12866
|
-
});
|
|
12852
|
+
const config = await getClientConfig();
|
|
12853
|
+
const client = initClient14(runSystemLogContract, config);
|
|
12867
12854
|
const result = await client.getSystemLog({
|
|
12868
12855
|
params: { id: runId },
|
|
12869
12856
|
query: {
|
|
@@ -12880,13 +12867,8 @@ var ApiClient = class {
|
|
|
12880
12867
|
throw new Error(message);
|
|
12881
12868
|
}
|
|
12882
12869
|
async getMetrics(runId, options) {
|
|
12883
|
-
const
|
|
12884
|
-
const
|
|
12885
|
-
const client = initClient15(runMetricsContract, {
|
|
12886
|
-
baseUrl,
|
|
12887
|
-
baseHeaders: headers,
|
|
12888
|
-
jsonQuery: false
|
|
12889
|
-
});
|
|
12870
|
+
const config = await getClientConfig();
|
|
12871
|
+
const client = initClient14(runMetricsContract, config);
|
|
12890
12872
|
const result = await client.getMetrics({
|
|
12891
12873
|
params: { id: runId },
|
|
12892
12874
|
query: {
|
|
@@ -12903,13 +12885,8 @@ var ApiClient = class {
|
|
|
12903
12885
|
throw new Error(message);
|
|
12904
12886
|
}
|
|
12905
12887
|
async getAgentEvents(runId, options) {
|
|
12906
|
-
const
|
|
12907
|
-
const
|
|
12908
|
-
const client = initClient15(runAgentEventsContract, {
|
|
12909
|
-
baseUrl,
|
|
12910
|
-
baseHeaders: headers,
|
|
12911
|
-
jsonQuery: false
|
|
12912
|
-
});
|
|
12888
|
+
const config = await getClientConfig();
|
|
12889
|
+
const client = initClient14(runAgentEventsContract, config);
|
|
12913
12890
|
const result = await client.getAgentEvents({
|
|
12914
12891
|
params: { id: runId },
|
|
12915
12892
|
query: {
|
|
@@ -12926,13 +12903,8 @@ var ApiClient = class {
|
|
|
12926
12903
|
throw new Error(message);
|
|
12927
12904
|
}
|
|
12928
12905
|
async getNetworkLogs(runId, options) {
|
|
12929
|
-
const
|
|
12930
|
-
const
|
|
12931
|
-
const client = initClient15(runNetworkLogsContract, {
|
|
12932
|
-
baseUrl,
|
|
12933
|
-
baseHeaders: headers,
|
|
12934
|
-
jsonQuery: false
|
|
12935
|
-
});
|
|
12906
|
+
const config = await getClientConfig();
|
|
12907
|
+
const client = initClient14(runNetworkLogsContract, config);
|
|
12936
12908
|
const result = await client.getNetworkLogs({
|
|
12937
12909
|
params: { id: runId },
|
|
12938
12910
|
query: {
|
|
@@ -12954,7 +12926,7 @@ var ApiClient = class {
|
|
|
12954
12926
|
async getOrg() {
|
|
12955
12927
|
const baseUrl = await this.getBaseUrl();
|
|
12956
12928
|
const headers = await this.getHeaders();
|
|
12957
|
-
const client =
|
|
12929
|
+
const client = initClient14(orgContract, {
|
|
12958
12930
|
baseUrl,
|
|
12959
12931
|
baseHeaders: headers,
|
|
12960
12932
|
jsonQuery: false
|
|
@@ -12973,7 +12945,7 @@ var ApiClient = class {
|
|
|
12973
12945
|
async updateOrg(body) {
|
|
12974
12946
|
const baseUrl = await this.getBaseUrl();
|
|
12975
12947
|
const headers = await this.getHeaders();
|
|
12976
|
-
const client =
|
|
12948
|
+
const client = initClient14(orgContract, {
|
|
12977
12949
|
baseUrl,
|
|
12978
12950
|
baseHeaders: headers,
|
|
12979
12951
|
jsonQuery: false
|
|
@@ -12993,7 +12965,7 @@ var ApiClient = class {
|
|
|
12993
12965
|
async getSession(sessionId) {
|
|
12994
12966
|
const baseUrl = await this.getBaseUrl();
|
|
12995
12967
|
const headers = await this.getHeaders();
|
|
12996
|
-
const client =
|
|
12968
|
+
const client = initClient14(sessionsByIdContract, {
|
|
12997
12969
|
baseUrl,
|
|
12998
12970
|
baseHeaders: headers,
|
|
12999
12971
|
jsonQuery: false
|
|
@@ -13013,13 +12985,8 @@ var ApiClient = class {
|
|
|
13013
12985
|
* Used by run resume to fetch checkpoint info including secretNames
|
|
13014
12986
|
*/
|
|
13015
12987
|
async getCheckpoint(checkpointId) {
|
|
13016
|
-
const
|
|
13017
|
-
const
|
|
13018
|
-
const client = initClient15(checkpointsByIdContract, {
|
|
13019
|
-
baseUrl,
|
|
13020
|
-
baseHeaders: headers,
|
|
13021
|
-
jsonQuery: false
|
|
13022
|
-
});
|
|
12988
|
+
const config = await getClientConfig();
|
|
12989
|
+
const client = initClient14(checkpointsByIdContract, config);
|
|
13023
12990
|
const result = await client.getById({
|
|
13024
12991
|
params: { id: checkpointId }
|
|
13025
12992
|
});
|
|
@@ -13036,7 +13003,7 @@ var ApiClient = class {
|
|
|
13036
13003
|
async prepareStorage(body) {
|
|
13037
13004
|
const baseUrl = await this.getBaseUrl();
|
|
13038
13005
|
const headers = await this.getHeaders();
|
|
13039
|
-
const client =
|
|
13006
|
+
const client = initClient14(storagesPrepareContract, {
|
|
13040
13007
|
baseUrl,
|
|
13041
13008
|
baseHeaders: headers,
|
|
13042
13009
|
jsonQuery: false
|
|
@@ -13055,7 +13022,7 @@ var ApiClient = class {
|
|
|
13055
13022
|
async commitStorage(body) {
|
|
13056
13023
|
const baseUrl = await this.getBaseUrl();
|
|
13057
13024
|
const headers = await this.getHeaders();
|
|
13058
|
-
const client =
|
|
13025
|
+
const client = initClient14(storagesCommitContract, {
|
|
13059
13026
|
baseUrl,
|
|
13060
13027
|
baseHeaders: headers,
|
|
13061
13028
|
jsonQuery: false
|
|
@@ -13074,7 +13041,7 @@ var ApiClient = class {
|
|
|
13074
13041
|
async getStorageDownload(query) {
|
|
13075
13042
|
const baseUrl = await this.getBaseUrl();
|
|
13076
13043
|
const headers = await this.getHeaders();
|
|
13077
|
-
const client =
|
|
13044
|
+
const client = initClient14(storagesDownloadContract, {
|
|
13078
13045
|
baseUrl,
|
|
13079
13046
|
baseHeaders: headers,
|
|
13080
13047
|
jsonQuery: false
|
|
@@ -13099,7 +13066,7 @@ var ApiClient = class {
|
|
|
13099
13066
|
async listStorages(query) {
|
|
13100
13067
|
const baseUrl = await this.getBaseUrl();
|
|
13101
13068
|
const headers = await this.getHeaders();
|
|
13102
|
-
const client =
|
|
13069
|
+
const client = initClient14(storagesListContract, {
|
|
13103
13070
|
baseUrl,
|
|
13104
13071
|
baseHeaders: headers,
|
|
13105
13072
|
jsonQuery: false
|
|
@@ -13119,7 +13086,7 @@ var ApiClient = class {
|
|
|
13119
13086
|
async deploySchedule(body) {
|
|
13120
13087
|
const baseUrl = await this.getBaseUrl();
|
|
13121
13088
|
const headers = await this.getHeaders();
|
|
13122
|
-
const client =
|
|
13089
|
+
const client = initClient14(schedulesMainContract, {
|
|
13123
13090
|
baseUrl,
|
|
13124
13091
|
baseHeaders: headers,
|
|
13125
13092
|
jsonQuery: false
|
|
@@ -13138,7 +13105,7 @@ var ApiClient = class {
|
|
|
13138
13105
|
async listSchedules() {
|
|
13139
13106
|
const baseUrl = await this.getBaseUrl();
|
|
13140
13107
|
const headers = await this.getHeaders();
|
|
13141
|
-
const client =
|
|
13108
|
+
const client = initClient14(schedulesMainContract, {
|
|
13142
13109
|
baseUrl,
|
|
13143
13110
|
baseHeaders: headers,
|
|
13144
13111
|
jsonQuery: false
|
|
@@ -13157,7 +13124,7 @@ var ApiClient = class {
|
|
|
13157
13124
|
async getScheduleByName(params) {
|
|
13158
13125
|
const baseUrl = await this.getBaseUrl();
|
|
13159
13126
|
const headers = await this.getHeaders();
|
|
13160
|
-
const client =
|
|
13127
|
+
const client = initClient14(schedulesByNameContract, {
|
|
13161
13128
|
baseUrl,
|
|
13162
13129
|
baseHeaders: headers,
|
|
13163
13130
|
jsonQuery: false
|
|
@@ -13179,7 +13146,7 @@ var ApiClient = class {
|
|
|
13179
13146
|
async deleteSchedule(params) {
|
|
13180
13147
|
const baseUrl = await this.getBaseUrl();
|
|
13181
13148
|
const headers = await this.getHeaders();
|
|
13182
|
-
const client =
|
|
13149
|
+
const client = initClient14(schedulesByNameContract, {
|
|
13183
13150
|
baseUrl,
|
|
13184
13151
|
baseHeaders: headers,
|
|
13185
13152
|
jsonQuery: false
|
|
@@ -13201,7 +13168,7 @@ var ApiClient = class {
|
|
|
13201
13168
|
async enableSchedule(params) {
|
|
13202
13169
|
const baseUrl = await this.getBaseUrl();
|
|
13203
13170
|
const headers = await this.getHeaders();
|
|
13204
|
-
const client =
|
|
13171
|
+
const client = initClient14(schedulesEnableContract, {
|
|
13205
13172
|
baseUrl,
|
|
13206
13173
|
baseHeaders: headers,
|
|
13207
13174
|
jsonQuery: false
|
|
@@ -13223,7 +13190,7 @@ var ApiClient = class {
|
|
|
13223
13190
|
async disableSchedule(params) {
|
|
13224
13191
|
const baseUrl = await this.getBaseUrl();
|
|
13225
13192
|
const headers = await this.getHeaders();
|
|
13226
|
-
const client =
|
|
13193
|
+
const client = initClient14(schedulesEnableContract, {
|
|
13227
13194
|
baseUrl,
|
|
13228
13195
|
baseHeaders: headers,
|
|
13229
13196
|
jsonQuery: false
|
|
@@ -13245,7 +13212,7 @@ var ApiClient = class {
|
|
|
13245
13212
|
async listScheduleRuns(params) {
|
|
13246
13213
|
const baseUrl = await this.getBaseUrl();
|
|
13247
13214
|
const headers = await this.getHeaders();
|
|
13248
|
-
const client =
|
|
13215
|
+
const client = initClient14(scheduleRunsContract, {
|
|
13249
13216
|
baseUrl,
|
|
13250
13217
|
baseHeaders: headers,
|
|
13251
13218
|
jsonQuery: false
|
|
@@ -13353,7 +13320,7 @@ var ApiClient = class {
|
|
|
13353
13320
|
}
|
|
13354
13321
|
async searchLogs(options) {
|
|
13355
13322
|
const config = await getClientConfig();
|
|
13356
|
-
const client =
|
|
13323
|
+
const client = initClient14(logsSearchContract, config);
|
|
13357
13324
|
const result = await client.searchLogs({
|
|
13358
13325
|
query: {
|
|
13359
13326
|
keyword: options.keyword,
|
|
@@ -14210,7 +14177,7 @@ import { Command as Command58 } from "commander";
|
|
|
14210
14177
|
import chalk53 from "chalk";
|
|
14211
14178
|
import prompts3 from "prompts";
|
|
14212
14179
|
|
|
14213
|
-
// src/
|
|
14180
|
+
// src/lib/domain/model-provider/shared.ts
|
|
14214
14181
|
import chalk52 from "chalk";
|
|
14215
14182
|
import prompts2 from "prompts";
|
|
14216
14183
|
function validateProviderType(typeStr) {
|
|
@@ -14302,7 +14269,7 @@ function validateSecrets(type2, authMethod, secrets) {
|
|
|
14302
14269
|
}
|
|
14303
14270
|
function handleNonInteractiveMode(options) {
|
|
14304
14271
|
const type2 = validateProviderType(options.type);
|
|
14305
|
-
const cmdPrefix = options.commandPrefix ?? "vm0 model-provider setup";
|
|
14272
|
+
const cmdPrefix = options.commandPrefix ?? "vm0 org model-provider setup";
|
|
14306
14273
|
let selectedModel;
|
|
14307
14274
|
if (options.model) {
|
|
14308
14275
|
selectedModel = validateModel(type2, options.model);
|
|
@@ -15223,7 +15190,7 @@ var initCommand4 = new Command68().name("init").description("Initialize a new VM
|
|
|
15223
15190
|
console.log();
|
|
15224
15191
|
console.log("Next steps:");
|
|
15225
15192
|
console.log(
|
|
15226
|
-
` 1. Set up model provider (one-time): ${chalk60.cyan("vm0 model-provider setup")}`
|
|
15193
|
+
` 1. Set up model provider (one-time): ${chalk60.cyan("vm0 org model-provider setup")}`
|
|
15227
15194
|
);
|
|
15228
15195
|
console.log(
|
|
15229
15196
|
` 2. Edit ${chalk60.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
@@ -16563,297 +16530,13 @@ var deleteCommand4 = new Command83().name("delete").description("Delete a variab
|
|
|
16563
16530
|
// src/commands/variable/index.ts
|
|
16564
16531
|
var variableCommand = new Command84().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand12).addCommand(setCommand5).addCommand(deleteCommand4);
|
|
16565
16532
|
|
|
16566
|
-
// src/commands/
|
|
16533
|
+
// src/commands/connector/index.ts
|
|
16567
16534
|
import { Command as Command89 } from "commander";
|
|
16568
16535
|
|
|
16569
|
-
// src/commands/
|
|
16536
|
+
// src/commands/connector/connect.ts
|
|
16570
16537
|
import { Command as Command85 } from "commander";
|
|
16571
|
-
import chalk74 from "chalk";
|
|
16572
|
-
var listCommand13 = new Command85().name("list").alias("ls").description("List all model providers").action(
|
|
16573
|
-
withErrorHandler(async () => {
|
|
16574
|
-
const result = await listModelProviders();
|
|
16575
|
-
if (result.modelProviders.length === 0) {
|
|
16576
|
-
console.log(chalk74.dim("No model providers configured"));
|
|
16577
|
-
console.log();
|
|
16578
|
-
console.log("To add a model provider:");
|
|
16579
|
-
console.log(chalk74.cyan(" vm0 model-provider setup"));
|
|
16580
|
-
return;
|
|
16581
|
-
}
|
|
16582
|
-
const byFramework = result.modelProviders.reduce(
|
|
16583
|
-
(acc, p) => {
|
|
16584
|
-
const fw = p.framework;
|
|
16585
|
-
if (!acc[fw]) {
|
|
16586
|
-
acc[fw] = [];
|
|
16587
|
-
}
|
|
16588
|
-
acc[fw].push(p);
|
|
16589
|
-
return acc;
|
|
16590
|
-
},
|
|
16591
|
-
{}
|
|
16592
|
-
);
|
|
16593
|
-
console.log(chalk74.bold("Model Providers:"));
|
|
16594
|
-
console.log();
|
|
16595
|
-
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
16596
|
-
console.log(` ${chalk74.cyan(framework)}:`);
|
|
16597
|
-
for (const provider of providers) {
|
|
16598
|
-
const defaultTag = provider.isDefault ? chalk74.green(" (default)") : "";
|
|
16599
|
-
const modelTag = provider.selectedModel ? chalk74.dim(` [${provider.selectedModel}]`) : "";
|
|
16600
|
-
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
16601
|
-
console.log(
|
|
16602
|
-
chalk74.dim(
|
|
16603
|
-
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
16604
|
-
)
|
|
16605
|
-
);
|
|
16606
|
-
}
|
|
16607
|
-
console.log();
|
|
16608
|
-
}
|
|
16609
|
-
console.log(
|
|
16610
|
-
chalk74.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
16611
|
-
);
|
|
16612
|
-
})
|
|
16613
|
-
);
|
|
16614
|
-
|
|
16615
|
-
// src/commands/model-provider/setup.ts
|
|
16616
|
-
import { Command as Command86 } from "commander";
|
|
16617
16538
|
import chalk75 from "chalk";
|
|
16618
|
-
import
|
|
16619
|
-
async function handleInteractiveMode2() {
|
|
16620
|
-
if (!isInteractive()) {
|
|
16621
|
-
throw new Error("Interactive mode requires a TTY", {
|
|
16622
|
-
cause: new Error(
|
|
16623
|
-
'Use non-interactive mode: vm0 model-provider setup --type <type> --secret "<value>"'
|
|
16624
|
-
)
|
|
16625
|
-
});
|
|
16626
|
-
}
|
|
16627
|
-
const { modelProviders: configuredProviders } = await listModelProviders();
|
|
16628
|
-
const configuredTypes = new Set(configuredProviders.map((p) => p.type));
|
|
16629
|
-
const annotatedChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
16630
|
-
([type3, config2]) => {
|
|
16631
|
-
const isConfigured = configuredTypes.has(type3);
|
|
16632
|
-
const isExperimental = hasAuthMethods(type3);
|
|
16633
|
-
let title = config2.label;
|
|
16634
|
-
if (isConfigured) {
|
|
16635
|
-
title = `${title} \u2713`;
|
|
16636
|
-
}
|
|
16637
|
-
if (isExperimental) {
|
|
16638
|
-
title = `${title} ${chalk75.dim("(experimental)")}`;
|
|
16639
|
-
}
|
|
16640
|
-
return {
|
|
16641
|
-
title,
|
|
16642
|
-
value: type3
|
|
16643
|
-
};
|
|
16644
|
-
}
|
|
16645
|
-
);
|
|
16646
|
-
const typeResponse = await prompts4(
|
|
16647
|
-
{
|
|
16648
|
-
type: "select",
|
|
16649
|
-
name: "type",
|
|
16650
|
-
message: "Select provider type:",
|
|
16651
|
-
choices: annotatedChoices
|
|
16652
|
-
},
|
|
16653
|
-
{ onCancel: () => process.exit(0) }
|
|
16654
|
-
);
|
|
16655
|
-
const type2 = typeResponse.type;
|
|
16656
|
-
const checkResult = await checkModelProviderSecret(type2);
|
|
16657
|
-
if (checkResult.exists) {
|
|
16658
|
-
console.log();
|
|
16659
|
-
console.log(`"${type2}" is already configured`);
|
|
16660
|
-
console.log();
|
|
16661
|
-
const actionResponse = await prompts4(
|
|
16662
|
-
{
|
|
16663
|
-
type: "select",
|
|
16664
|
-
name: "action",
|
|
16665
|
-
message: "",
|
|
16666
|
-
choices: [
|
|
16667
|
-
{ title: "Keep existing secret", value: "keep" },
|
|
16668
|
-
{ title: "Update secret", value: "update" }
|
|
16669
|
-
]
|
|
16670
|
-
},
|
|
16671
|
-
{ onCancel: () => process.exit(0) }
|
|
16672
|
-
);
|
|
16673
|
-
if (actionResponse.action === "keep") {
|
|
16674
|
-
const selectedModel2 = await promptForModelSelection(type2);
|
|
16675
|
-
return {
|
|
16676
|
-
type: type2,
|
|
16677
|
-
keepExistingSecret: true,
|
|
16678
|
-
selectedModel: selectedModel2,
|
|
16679
|
-
isInteractiveMode: true
|
|
16680
|
-
};
|
|
16681
|
-
}
|
|
16682
|
-
}
|
|
16683
|
-
const config = MODEL_PROVIDER_TYPES[type2];
|
|
16684
|
-
console.log();
|
|
16685
|
-
console.log(chalk75.dim(config.helpText));
|
|
16686
|
-
console.log();
|
|
16687
|
-
if (hasAuthMethods(type2)) {
|
|
16688
|
-
const authMethod = await promptForAuthMethod(type2);
|
|
16689
|
-
const secrets = await promptForSecrets(type2, authMethod);
|
|
16690
|
-
const selectedModel2 = await promptForModelSelection(type2);
|
|
16691
|
-
return {
|
|
16692
|
-
type: type2,
|
|
16693
|
-
authMethod,
|
|
16694
|
-
secrets,
|
|
16695
|
-
selectedModel: selectedModel2,
|
|
16696
|
-
isInteractiveMode: true
|
|
16697
|
-
};
|
|
16698
|
-
}
|
|
16699
|
-
const secretLabel = "secretLabel" in config ? config.secretLabel : "secret";
|
|
16700
|
-
const secretResponse = await prompts4(
|
|
16701
|
-
{
|
|
16702
|
-
type: "password",
|
|
16703
|
-
name: "secret",
|
|
16704
|
-
message: `Enter your ${secretLabel}:`,
|
|
16705
|
-
validate: (value) => value.length > 0 || `${secretLabel} is required`
|
|
16706
|
-
},
|
|
16707
|
-
{ onCancel: () => process.exit(0) }
|
|
16708
|
-
);
|
|
16709
|
-
const secret = secretResponse.secret;
|
|
16710
|
-
const selectedModel = await promptForModelSelection(type2);
|
|
16711
|
-
return { type: type2, secret, selectedModel, isInteractiveMode: true };
|
|
16712
|
-
}
|
|
16713
|
-
async function promptSetAsDefault2(type2, framework, isDefault) {
|
|
16714
|
-
if (isDefault) return;
|
|
16715
|
-
const response = await prompts4(
|
|
16716
|
-
{
|
|
16717
|
-
type: "confirm",
|
|
16718
|
-
name: "setDefault",
|
|
16719
|
-
message: "Set this provider as default?",
|
|
16720
|
-
initial: false
|
|
16721
|
-
},
|
|
16722
|
-
{ onCancel: () => process.exit(0) }
|
|
16723
|
-
);
|
|
16724
|
-
if (response.setDefault) {
|
|
16725
|
-
await setModelProviderDefault(type2);
|
|
16726
|
-
console.log(chalk75.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
16727
|
-
}
|
|
16728
|
-
}
|
|
16729
|
-
var setupCommand3 = new Command86().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
16730
|
-
"-s, --secret <value>",
|
|
16731
|
-
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
16732
|
-
collectSecrets,
|
|
16733
|
-
[]
|
|
16734
|
-
).option(
|
|
16735
|
-
"-a, --auth-method <method>",
|
|
16736
|
-
"Auth method (required for multi-auth providers like aws-bedrock)"
|
|
16737
|
-
).option("-m, --model <model>", "Model selection (for non-interactive mode)").action(
|
|
16738
|
-
withErrorHandler(
|
|
16739
|
-
async (options) => {
|
|
16740
|
-
let input;
|
|
16741
|
-
const secretArgs = options.secret ?? [];
|
|
16742
|
-
if (options.type && secretArgs.length > 0) {
|
|
16743
|
-
input = handleNonInteractiveMode({
|
|
16744
|
-
type: options.type,
|
|
16745
|
-
secret: secretArgs,
|
|
16746
|
-
authMethod: options.authMethod,
|
|
16747
|
-
model: options.model
|
|
16748
|
-
});
|
|
16749
|
-
} else if (options.type || secretArgs.length > 0) {
|
|
16750
|
-
throw new Error("Both --type and --secret are required");
|
|
16751
|
-
} else {
|
|
16752
|
-
const result = await handleInteractiveMode2();
|
|
16753
|
-
if (result === null) {
|
|
16754
|
-
return;
|
|
16755
|
-
}
|
|
16756
|
-
input = result;
|
|
16757
|
-
}
|
|
16758
|
-
if (input.keepExistingSecret) {
|
|
16759
|
-
const provider2 = await updateModelProviderModel(
|
|
16760
|
-
input.type,
|
|
16761
|
-
input.selectedModel
|
|
16762
|
-
);
|
|
16763
|
-
const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
|
|
16764
|
-
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
16765
|
-
if (!hasModelSelection(input.type)) {
|
|
16766
|
-
console.log(
|
|
16767
|
-
chalk75.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
16768
|
-
);
|
|
16769
|
-
} else {
|
|
16770
|
-
console.log(
|
|
16771
|
-
chalk75.green(
|
|
16772
|
-
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
16773
|
-
)
|
|
16774
|
-
);
|
|
16775
|
-
}
|
|
16776
|
-
if (input.isInteractiveMode) {
|
|
16777
|
-
await promptSetAsDefault2(
|
|
16778
|
-
input.type,
|
|
16779
|
-
provider2.framework,
|
|
16780
|
-
provider2.isDefault
|
|
16781
|
-
);
|
|
16782
|
-
}
|
|
16783
|
-
return;
|
|
16784
|
-
}
|
|
16785
|
-
const { provider, created } = await upsertModelProvider({
|
|
16786
|
-
type: input.type,
|
|
16787
|
-
secret: input.secret,
|
|
16788
|
-
authMethod: input.authMethod,
|
|
16789
|
-
secrets: input.secrets,
|
|
16790
|
-
selectedModel: input.selectedModel
|
|
16791
|
-
});
|
|
16792
|
-
const action = created ? "created" : "updated";
|
|
16793
|
-
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
16794
|
-
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
16795
|
-
console.log(
|
|
16796
|
-
chalk75.green(
|
|
16797
|
-
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
16798
|
-
)
|
|
16799
|
-
);
|
|
16800
|
-
if (input.isInteractiveMode) {
|
|
16801
|
-
await promptSetAsDefault2(
|
|
16802
|
-
input.type,
|
|
16803
|
-
provider.framework,
|
|
16804
|
-
provider.isDefault
|
|
16805
|
-
);
|
|
16806
|
-
}
|
|
16807
|
-
}
|
|
16808
|
-
)
|
|
16809
|
-
);
|
|
16810
|
-
|
|
16811
|
-
// src/commands/model-provider/delete.ts
|
|
16812
|
-
import { Command as Command87 } from "commander";
|
|
16813
|
-
import chalk76 from "chalk";
|
|
16814
|
-
var deleteCommand5 = new Command87().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(
|
|
16815
|
-
withErrorHandler(async (type2) => {
|
|
16816
|
-
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
16817
|
-
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
16818
|
-
throw new Error(`Invalid type "${type2}"`, {
|
|
16819
|
-
cause: new Error(`Valid types: ${validTypes}`)
|
|
16820
|
-
});
|
|
16821
|
-
}
|
|
16822
|
-
await deleteModelProvider(type2);
|
|
16823
|
-
console.log(chalk76.green(`\u2713 Model provider "${type2}" deleted`));
|
|
16824
|
-
})
|
|
16825
|
-
);
|
|
16826
|
-
|
|
16827
|
-
// src/commands/model-provider/set-default.ts
|
|
16828
|
-
import { Command as Command88 } from "commander";
|
|
16829
|
-
import chalk77 from "chalk";
|
|
16830
|
-
var setDefaultCommand2 = new Command88().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
16831
|
-
withErrorHandler(async (type2) => {
|
|
16832
|
-
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
16833
|
-
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
16834
|
-
throw new Error(`Invalid type "${type2}"`, {
|
|
16835
|
-
cause: new Error(`Valid types: ${validTypes}`)
|
|
16836
|
-
});
|
|
16837
|
-
}
|
|
16838
|
-
const provider = await setModelProviderDefault(type2);
|
|
16839
|
-
console.log(
|
|
16840
|
-
chalk77.green(
|
|
16841
|
-
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
16842
|
-
)
|
|
16843
|
-
);
|
|
16844
|
-
})
|
|
16845
|
-
);
|
|
16846
|
-
|
|
16847
|
-
// src/commands/model-provider/index.ts
|
|
16848
|
-
var modelProviderCommand2 = new Command89().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand13).addCommand(setupCommand3).addCommand(deleteCommand5).addCommand(setDefaultCommand2);
|
|
16849
|
-
|
|
16850
|
-
// src/commands/connector/index.ts
|
|
16851
|
-
import { Command as Command94 } from "commander";
|
|
16852
|
-
|
|
16853
|
-
// src/commands/connector/connect.ts
|
|
16854
|
-
import { Command as Command90 } from "commander";
|
|
16855
|
-
import chalk79 from "chalk";
|
|
16856
|
-
import { initClient as initClient16 } from "@ts-rest/core";
|
|
16539
|
+
import { initClient as initClient15 } from "@ts-rest/core";
|
|
16857
16540
|
|
|
16858
16541
|
// src/commands/connector/lib/computer/start-services.ts
|
|
16859
16542
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -16861,7 +16544,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16861
16544
|
import { createServer } from "net";
|
|
16862
16545
|
import { homedir as homedir4 } from "os";
|
|
16863
16546
|
import { join as join12 } from "path";
|
|
16864
|
-
import
|
|
16547
|
+
import chalk74 from "chalk";
|
|
16865
16548
|
|
|
16866
16549
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16867
16550
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16935,7 +16618,7 @@ async function checkComputerDependencies() {
|
|
|
16935
16618
|
}
|
|
16936
16619
|
}
|
|
16937
16620
|
async function startComputerServices(credentials) {
|
|
16938
|
-
console.log(
|
|
16621
|
+
console.log(chalk74.cyan("Starting computer connector services..."));
|
|
16939
16622
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16940
16623
|
if (!wsgidavBinary) {
|
|
16941
16624
|
throw new Error(
|
|
@@ -16962,7 +16645,7 @@ async function startComputerServices(credentials) {
|
|
|
16962
16645
|
);
|
|
16963
16646
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16964
16647
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16965
|
-
console.log(
|
|
16648
|
+
console.log(chalk74.green("\u2713 WebDAV server started"));
|
|
16966
16649
|
const chrome = spawn2(
|
|
16967
16650
|
chromeBinary,
|
|
16968
16651
|
[
|
|
@@ -16976,7 +16659,7 @@ async function startComputerServices(credentials) {
|
|
|
16976
16659
|
);
|
|
16977
16660
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16978
16661
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16979
|
-
console.log(
|
|
16662
|
+
console.log(chalk74.green("\u2713 Chrome started"));
|
|
16980
16663
|
try {
|
|
16981
16664
|
await startNgrokTunnels(
|
|
16982
16665
|
credentials.ngrokToken,
|
|
@@ -16985,18 +16668,18 @@ async function startComputerServices(credentials) {
|
|
|
16985
16668
|
cdpPort
|
|
16986
16669
|
);
|
|
16987
16670
|
console.log(
|
|
16988
|
-
|
|
16671
|
+
chalk74.green(
|
|
16989
16672
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16990
16673
|
)
|
|
16991
16674
|
);
|
|
16992
16675
|
console.log();
|
|
16993
|
-
console.log(
|
|
16676
|
+
console.log(chalk74.green("\u2713 Computer connector active"));
|
|
16994
16677
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16995
16678
|
console.log(
|
|
16996
16679
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16997
16680
|
);
|
|
16998
16681
|
console.log();
|
|
16999
|
-
console.log(
|
|
16682
|
+
console.log(chalk74.dim("Press ^C twice to disconnect"));
|
|
17000
16683
|
console.log();
|
|
17001
16684
|
let sigintCount = 0;
|
|
17002
16685
|
await new Promise((resolve2) => {
|
|
@@ -17010,7 +16693,7 @@ async function startComputerServices(credentials) {
|
|
|
17010
16693
|
const onSigint = () => {
|
|
17011
16694
|
sigintCount++;
|
|
17012
16695
|
if (sigintCount === 1) {
|
|
17013
|
-
console.log(
|
|
16696
|
+
console.log(chalk74.dim("\nPress ^C again to disconnect and exit..."));
|
|
17014
16697
|
} else {
|
|
17015
16698
|
done();
|
|
17016
16699
|
}
|
|
@@ -17020,11 +16703,11 @@ async function startComputerServices(credentials) {
|
|
|
17020
16703
|
});
|
|
17021
16704
|
} finally {
|
|
17022
16705
|
console.log();
|
|
17023
|
-
console.log(
|
|
16706
|
+
console.log(chalk74.cyan("Stopping services..."));
|
|
17024
16707
|
wsgidav.kill("SIGTERM");
|
|
17025
16708
|
chrome.kill("SIGTERM");
|
|
17026
16709
|
await stopNgrokTunnels();
|
|
17027
|
-
console.log(
|
|
16710
|
+
console.log(chalk74.green("\u2713 Services stopped"));
|
|
17028
16711
|
}
|
|
17029
16712
|
}
|
|
17030
16713
|
|
|
@@ -17049,10 +16732,10 @@ async function getHeaders2() {
|
|
|
17049
16732
|
function renderHelpText(text) {
|
|
17050
16733
|
return text.replace(
|
|
17051
16734
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
17052
|
-
(_m, label, url) => `${label} (${
|
|
17053
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
16735
|
+
(_m, label, url) => `${label} (${chalk75.cyan(url)})`
|
|
16736
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk75.bold(content)).replace(
|
|
17054
16737
|
/^> (.+)$/gm,
|
|
17055
|
-
(_m, content) =>
|
|
16738
|
+
(_m, content) => chalk75.yellow(` ${content}`)
|
|
17056
16739
|
);
|
|
17057
16740
|
}
|
|
17058
16741
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -17077,7 +16760,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
17077
16760
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
17078
16761
|
if (!secretConfig.required) continue;
|
|
17079
16762
|
const value = await promptPassword(
|
|
17080
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
16763
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk75.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
17081
16764
|
);
|
|
17082
16765
|
if (!value) {
|
|
17083
16766
|
throw new Error("Cancelled");
|
|
@@ -17093,14 +16776,14 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
17093
16776
|
});
|
|
17094
16777
|
}
|
|
17095
16778
|
console.log(
|
|
17096
|
-
|
|
16779
|
+
chalk75.green(`
|
|
17097
16780
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
17098
16781
|
);
|
|
17099
16782
|
}
|
|
17100
16783
|
async function connectComputer(apiUrl, headers) {
|
|
17101
16784
|
await checkComputerDependencies();
|
|
17102
|
-
console.log(
|
|
17103
|
-
const computerClient =
|
|
16785
|
+
console.log(chalk75.cyan("Setting up computer connector..."));
|
|
16786
|
+
const computerClient = initClient15(computerConnectorContract, {
|
|
17104
16787
|
baseUrl: apiUrl,
|
|
17105
16788
|
baseHeaders: headers,
|
|
17106
16789
|
jsonQuery: false
|
|
@@ -17114,9 +16797,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
17114
16797
|
}
|
|
17115
16798
|
const credentials = createResult.body;
|
|
17116
16799
|
await startComputerServices(credentials);
|
|
17117
|
-
console.log(
|
|
16800
|
+
console.log(chalk75.cyan("Disconnecting computer connector..."));
|
|
17118
16801
|
await deleteConnector("computer");
|
|
17119
|
-
console.log(
|
|
16802
|
+
console.log(chalk75.green("\u2713 Disconnected computer"));
|
|
17120
16803
|
process.exit(0);
|
|
17121
16804
|
}
|
|
17122
16805
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -17155,8 +16838,8 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
17155
16838
|
);
|
|
17156
16839
|
}
|
|
17157
16840
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
17158
|
-
console.log(`Connecting ${
|
|
17159
|
-
const sessionsClient =
|
|
16841
|
+
console.log(`Connecting ${chalk75.cyan(connectorType)}...`);
|
|
16842
|
+
const sessionsClient = initClient15(connectorSessionsContract, {
|
|
17160
16843
|
baseUrl: apiUrl,
|
|
17161
16844
|
baseHeaders: headers,
|
|
17162
16845
|
jsonQuery: false
|
|
@@ -17171,15 +16854,15 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
17171
16854
|
}
|
|
17172
16855
|
const session = createResult.body;
|
|
17173
16856
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
17174
|
-
console.log(
|
|
17175
|
-
console.log(
|
|
16857
|
+
console.log(chalk75.green("\nSession created"));
|
|
16858
|
+
console.log(chalk75.cyan(`
|
|
17176
16859
|
To connect, visit: ${verificationUrl}`));
|
|
17177
16860
|
console.log(
|
|
17178
16861
|
`
|
|
17179
16862
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
17180
16863
|
);
|
|
17181
16864
|
console.log("\nWaiting for authorization...");
|
|
17182
|
-
const sessionClient =
|
|
16865
|
+
const sessionClient = initClient15(connectorSessionByIdContract, {
|
|
17183
16866
|
baseUrl: apiUrl,
|
|
17184
16867
|
baseHeaders: headers,
|
|
17185
16868
|
jsonQuery: false
|
|
@@ -17204,7 +16887,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
17204
16887
|
switch (status.status) {
|
|
17205
16888
|
case "complete":
|
|
17206
16889
|
console.log(
|
|
17207
|
-
|
|
16890
|
+
chalk75.green(`
|
|
17208
16891
|
|
|
17209
16892
|
${connectorType} connected successfully!`)
|
|
17210
16893
|
);
|
|
@@ -17216,13 +16899,13 @@ ${connectorType} connected successfully!`)
|
|
|
17216
16899
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
17217
16900
|
);
|
|
17218
16901
|
case "pending":
|
|
17219
|
-
process.stdout.write(
|
|
16902
|
+
process.stdout.write(chalk75.dim("."));
|
|
17220
16903
|
break;
|
|
17221
16904
|
}
|
|
17222
16905
|
}
|
|
17223
16906
|
throw new Error("Session timed out, please try again");
|
|
17224
16907
|
}
|
|
17225
|
-
var connectCommand = new
|
|
16908
|
+
var connectCommand = new Command85().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(
|
|
17226
16909
|
withErrorHandler(async (type2, options) => {
|
|
17227
16910
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17228
16911
|
if (!parseResult.success) {
|
|
@@ -17247,9 +16930,9 @@ var connectCommand = new Command90().name("connect").description("Connect a thir
|
|
|
17247
16930
|
);
|
|
17248
16931
|
|
|
17249
16932
|
// src/commands/connector/list.ts
|
|
17250
|
-
import { Command as
|
|
17251
|
-
import
|
|
17252
|
-
var
|
|
16933
|
+
import { Command as Command86 } from "commander";
|
|
16934
|
+
import chalk76 from "chalk";
|
|
16935
|
+
var listCommand13 = new Command86().name("list").alias("ls").description("List all connectors and their status").action(
|
|
17253
16936
|
withErrorHandler(async () => {
|
|
17254
16937
|
const result = await listConnectors();
|
|
17255
16938
|
const connectedMap = new Map(result.connectors.map((c28) => [c28.type, c28]));
|
|
@@ -17271,25 +16954,26 @@ var listCommand14 = new Command91().name("list").alias("ls").description("List a
|
|
|
17271
16954
|
statusText.padEnd(statusWidth),
|
|
17272
16955
|
"ACCOUNT"
|
|
17273
16956
|
].join(" ");
|
|
17274
|
-
console.log(
|
|
16957
|
+
console.log(chalk76.dim(header));
|
|
17275
16958
|
for (const type2 of allTypes) {
|
|
17276
16959
|
const connector = connectedMap.get(type2);
|
|
17277
|
-
const
|
|
17278
|
-
const
|
|
16960
|
+
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type2, connector.oauthScopes);
|
|
16961
|
+
const status = connector ? connector.needsReconnect ? chalk76.yellow("!".padEnd(statusWidth)) : scopeMismatch ? chalk76.yellow("!".padEnd(statusWidth)) : chalk76.green("\u2713".padEnd(statusWidth)) : chalk76.dim("-".padEnd(statusWidth));
|
|
16962
|
+
const account = connector?.needsReconnect ? chalk76.yellow("(reconnect needed)") : scopeMismatch ? chalk76.yellow("(permissions update available)") : connector?.externalUsername ? `@${connector.externalUsername}` : chalk76.dim("-");
|
|
17279
16963
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
17280
16964
|
console.log(row);
|
|
17281
16965
|
}
|
|
17282
16966
|
console.log();
|
|
17283
|
-
console.log(
|
|
17284
|
-
console.log(
|
|
16967
|
+
console.log(chalk76.dim("To connect a service:"));
|
|
16968
|
+
console.log(chalk76.dim(" vm0 connector connect <type>"));
|
|
17285
16969
|
})
|
|
17286
16970
|
);
|
|
17287
16971
|
|
|
17288
16972
|
// src/commands/connector/status.ts
|
|
17289
|
-
import { Command as
|
|
17290
|
-
import
|
|
16973
|
+
import { Command as Command87 } from "commander";
|
|
16974
|
+
import chalk77 from "chalk";
|
|
17291
16975
|
var LABEL_WIDTH = 16;
|
|
17292
|
-
var statusCommand8 = new
|
|
16976
|
+
var statusCommand8 = new Command87().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
17293
16977
|
withErrorHandler(async (type2) => {
|
|
17294
16978
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17295
16979
|
if (!parseResult.success) {
|
|
@@ -17299,11 +16983,11 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17299
16983
|
});
|
|
17300
16984
|
}
|
|
17301
16985
|
const connector = await getConnector(parseResult.data);
|
|
17302
|
-
console.log(`Connector: ${
|
|
16986
|
+
console.log(`Connector: ${chalk77.cyan(type2)}`);
|
|
17303
16987
|
console.log();
|
|
17304
16988
|
if (connector) {
|
|
17305
16989
|
console.log(
|
|
17306
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
16990
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk77.green("connected")}`
|
|
17307
16991
|
);
|
|
17308
16992
|
console.log(
|
|
17309
16993
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -17316,6 +17000,22 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17316
17000
|
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
17317
17001
|
);
|
|
17318
17002
|
}
|
|
17003
|
+
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
17004
|
+
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
17005
|
+
console.log(
|
|
17006
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${chalk77.yellow("update available")}`
|
|
17007
|
+
);
|
|
17008
|
+
if (diff.addedScopes.length > 0) {
|
|
17009
|
+
console.log(
|
|
17010
|
+
`${" Added:".padEnd(LABEL_WIDTH)}${diff.addedScopes.join(", ")}`
|
|
17011
|
+
);
|
|
17012
|
+
}
|
|
17013
|
+
if (diff.removedScopes.length > 0) {
|
|
17014
|
+
console.log(
|
|
17015
|
+
`${" Removed:".padEnd(LABEL_WIDTH)}${diff.removedScopes.join(", ")}`
|
|
17016
|
+
);
|
|
17017
|
+
}
|
|
17018
|
+
}
|
|
17319
17019
|
console.log(
|
|
17320
17020
|
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
17321
17021
|
);
|
|
@@ -17325,23 +17025,23 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17325
17025
|
);
|
|
17326
17026
|
}
|
|
17327
17027
|
console.log();
|
|
17328
|
-
console.log(
|
|
17329
|
-
console.log(
|
|
17028
|
+
console.log(chalk77.dim("To disconnect:"));
|
|
17029
|
+
console.log(chalk77.dim(` vm0 connector disconnect ${type2}`));
|
|
17330
17030
|
} else {
|
|
17331
17031
|
console.log(
|
|
17332
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17032
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk77.dim("not connected")}`
|
|
17333
17033
|
);
|
|
17334
17034
|
console.log();
|
|
17335
|
-
console.log(
|
|
17336
|
-
console.log(
|
|
17035
|
+
console.log(chalk77.dim("To connect:"));
|
|
17036
|
+
console.log(chalk77.dim(` vm0 connector connect ${type2}`));
|
|
17337
17037
|
}
|
|
17338
17038
|
})
|
|
17339
17039
|
);
|
|
17340
17040
|
|
|
17341
17041
|
// src/commands/connector/disconnect.ts
|
|
17342
|
-
import { Command as
|
|
17343
|
-
import
|
|
17344
|
-
var disconnectCommand = new
|
|
17042
|
+
import { Command as Command88 } from "commander";
|
|
17043
|
+
import chalk78 from "chalk";
|
|
17044
|
+
var disconnectCommand = new Command88().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
17345
17045
|
withErrorHandler(async (type2) => {
|
|
17346
17046
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17347
17047
|
if (!parseResult.success) {
|
|
@@ -17352,33 +17052,33 @@ var disconnectCommand = new Command93().name("disconnect").description("Disconne
|
|
|
17352
17052
|
}
|
|
17353
17053
|
const connectorType = parseResult.data;
|
|
17354
17054
|
await deleteConnector(connectorType);
|
|
17355
|
-
console.log(
|
|
17055
|
+
console.log(chalk78.green(`\u2713 Disconnected ${type2}`));
|
|
17356
17056
|
})
|
|
17357
17057
|
);
|
|
17358
17058
|
|
|
17359
17059
|
// src/commands/connector/index.ts
|
|
17360
|
-
var connectorCommand = new
|
|
17060
|
+
var connectorCommand = new Command89().name("connector").description("Manage third-party service connections").addCommand(listCommand13).addCommand(statusCommand8).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
17361
17061
|
|
|
17362
17062
|
// src/commands/onboard/index.ts
|
|
17363
|
-
import { Command as
|
|
17364
|
-
import
|
|
17063
|
+
import { Command as Command90 } from "commander";
|
|
17064
|
+
import chalk82 from "chalk";
|
|
17365
17065
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
17366
17066
|
import { existsSync as existsSync12 } from "fs";
|
|
17367
17067
|
|
|
17368
17068
|
// src/lib/ui/welcome-box.ts
|
|
17369
|
-
import
|
|
17069
|
+
import chalk79 from "chalk";
|
|
17370
17070
|
var gradientColors = [
|
|
17371
|
-
|
|
17071
|
+
chalk79.hex("#FFAB5E"),
|
|
17372
17072
|
// Line 1 - lightest
|
|
17373
|
-
|
|
17073
|
+
chalk79.hex("#FF9642"),
|
|
17374
17074
|
// Line 2
|
|
17375
|
-
|
|
17075
|
+
chalk79.hex("#FF8228"),
|
|
17376
17076
|
// Line 3
|
|
17377
|
-
|
|
17077
|
+
chalk79.hex("#FF6D0A"),
|
|
17378
17078
|
// Line 4
|
|
17379
|
-
|
|
17079
|
+
chalk79.hex("#E85D00"),
|
|
17380
17080
|
// Line 5
|
|
17381
|
-
|
|
17081
|
+
chalk79.hex("#CC4E00")
|
|
17382
17082
|
// Line 6 - darkest
|
|
17383
17083
|
];
|
|
17384
17084
|
var vm0LogoLines = [
|
|
@@ -17400,15 +17100,15 @@ function renderVm0Banner() {
|
|
|
17400
17100
|
function renderOnboardWelcome() {
|
|
17401
17101
|
renderVm0Banner();
|
|
17402
17102
|
console.log(` Build agentic workflows using natural language.`);
|
|
17403
|
-
console.log(` ${
|
|
17103
|
+
console.log(` ${chalk79.dim("Currently in beta, enjoy it free")}`);
|
|
17404
17104
|
console.log(
|
|
17405
|
-
` ${
|
|
17105
|
+
` ${chalk79.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
17406
17106
|
);
|
|
17407
17107
|
console.log();
|
|
17408
17108
|
}
|
|
17409
17109
|
|
|
17410
17110
|
// src/lib/ui/step-runner.ts
|
|
17411
|
-
import
|
|
17111
|
+
import chalk80 from "chalk";
|
|
17412
17112
|
function createStepRunner(options = true) {
|
|
17413
17113
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
17414
17114
|
const interactive = opts.interactive ?? true;
|
|
@@ -17423,25 +17123,25 @@ function createStepRunner(options = true) {
|
|
|
17423
17123
|
}
|
|
17424
17124
|
for (const [i, step] of completedSteps.entries()) {
|
|
17425
17125
|
if (step.failed) {
|
|
17426
|
-
console.log(
|
|
17126
|
+
console.log(chalk80.red(`\u2717 ${step.label}`));
|
|
17427
17127
|
} else {
|
|
17428
|
-
console.log(
|
|
17128
|
+
console.log(chalk80.green(`\u25CF ${step.label}`));
|
|
17429
17129
|
}
|
|
17430
17130
|
const isLastStep = i === completedSteps.length - 1;
|
|
17431
17131
|
if (!isLastStep || !isFinal) {
|
|
17432
|
-
console.log(
|
|
17132
|
+
console.log(chalk80.dim("\u2502"));
|
|
17433
17133
|
}
|
|
17434
17134
|
}
|
|
17435
17135
|
}
|
|
17436
17136
|
async function executeStep(label, fn, isFinal) {
|
|
17437
17137
|
let stepFailed = false;
|
|
17438
|
-
console.log(
|
|
17138
|
+
console.log(chalk80.yellow(`\u25CB ${label}`));
|
|
17439
17139
|
const ctx = {
|
|
17440
17140
|
connector() {
|
|
17441
|
-
console.log(
|
|
17141
|
+
console.log(chalk80.dim("\u2502"));
|
|
17442
17142
|
},
|
|
17443
17143
|
detail(message) {
|
|
17444
|
-
console.log(`${
|
|
17144
|
+
console.log(`${chalk80.dim("\u2502")} ${message}`);
|
|
17445
17145
|
},
|
|
17446
17146
|
async prompt(promptFn) {
|
|
17447
17147
|
return await promptFn();
|
|
@@ -17458,12 +17158,12 @@ function createStepRunner(options = true) {
|
|
|
17458
17158
|
redrawCompletedSteps(isFinal);
|
|
17459
17159
|
} else {
|
|
17460
17160
|
if (stepFailed) {
|
|
17461
|
-
console.log(
|
|
17161
|
+
console.log(chalk80.red(`\u2717 ${label}`));
|
|
17462
17162
|
} else {
|
|
17463
|
-
console.log(
|
|
17163
|
+
console.log(chalk80.green(`\u25CF ${label}`));
|
|
17464
17164
|
}
|
|
17465
17165
|
if (!isFinal) {
|
|
17466
|
-
console.log(
|
|
17166
|
+
console.log(chalk80.dim("\u2502"));
|
|
17467
17167
|
}
|
|
17468
17168
|
}
|
|
17469
17169
|
}
|
|
@@ -17587,8 +17287,12 @@ var ONBOARD_PROVIDER_TYPES = [
|
|
|
17587
17287
|
"minimax-api-key",
|
|
17588
17288
|
"deepseek-api-key"
|
|
17589
17289
|
];
|
|
17290
|
+
async function checkIsOrgAdmin() {
|
|
17291
|
+
const org = await getOrg();
|
|
17292
|
+
return org.role === "admin";
|
|
17293
|
+
}
|
|
17590
17294
|
async function checkModelProviderStatus() {
|
|
17591
|
-
const response = await
|
|
17295
|
+
const response = await listOrgModelProviders();
|
|
17592
17296
|
return {
|
|
17593
17297
|
hasProvider: response.modelProviders.length > 0,
|
|
17594
17298
|
providers: response.modelProviders
|
|
@@ -17608,7 +17312,7 @@ function getProviderChoices() {
|
|
|
17608
17312
|
});
|
|
17609
17313
|
}
|
|
17610
17314
|
async function setupModelProvider(type2, secret, options) {
|
|
17611
|
-
const response = await
|
|
17315
|
+
const response = await upsertOrgModelProvider({
|
|
17612
17316
|
type: type2,
|
|
17613
17317
|
secret,
|
|
17614
17318
|
selectedModel: options?.selectedModel
|
|
@@ -17623,7 +17327,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
17623
17327
|
|
|
17624
17328
|
// src/lib/domain/onboard/claude-setup.ts
|
|
17625
17329
|
import { spawn as spawn3 } from "child_process";
|
|
17626
|
-
import
|
|
17330
|
+
import chalk81 from "chalk";
|
|
17627
17331
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
17628
17332
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
17629
17333
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17660,12 +17364,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17660
17364
|
}
|
|
17661
17365
|
function handlePluginError(error, context) {
|
|
17662
17366
|
const displayContext = context ?? "Claude plugin";
|
|
17663
|
-
console.error(
|
|
17367
|
+
console.error(chalk81.red(`\u2717 Failed to install ${displayContext}`));
|
|
17664
17368
|
if (error instanceof Error) {
|
|
17665
|
-
console.error(
|
|
17369
|
+
console.error(chalk81.red(`\u2717 ${error.message}`));
|
|
17666
17370
|
}
|
|
17667
17371
|
console.error(
|
|
17668
|
-
|
|
17372
|
+
chalk81.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17669
17373
|
);
|
|
17670
17374
|
process.exit(1);
|
|
17671
17375
|
}
|
|
@@ -17708,7 +17412,7 @@ async function updateMarketplace() {
|
|
|
17708
17412
|
]);
|
|
17709
17413
|
if (!result.success) {
|
|
17710
17414
|
console.warn(
|
|
17711
|
-
|
|
17415
|
+
chalk81.yellow(
|
|
17712
17416
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17713
17417
|
)
|
|
17714
17418
|
);
|
|
@@ -17754,9 +17458,9 @@ async function handleAuthentication(ctx) {
|
|
|
17754
17458
|
onInitiating: () => {
|
|
17755
17459
|
},
|
|
17756
17460
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17757
|
-
step.detail(`Copy code: ${
|
|
17758
|
-
step.detail(`Open: ${
|
|
17759
|
-
step.detail(
|
|
17461
|
+
step.detail(`Copy code: ${chalk82.cyan.bold(code)}`);
|
|
17462
|
+
step.detail(`Open: ${chalk82.cyan(url)}`);
|
|
17463
|
+
step.detail(chalk82.dim(`Expires in ${expiresIn} minutes`));
|
|
17760
17464
|
},
|
|
17761
17465
|
onPolling: () => {
|
|
17762
17466
|
},
|
|
@@ -17774,9 +17478,17 @@ async function handleModelProvider(ctx) {
|
|
|
17774
17478
|
if (providerStatus.hasProvider) {
|
|
17775
17479
|
return;
|
|
17776
17480
|
}
|
|
17481
|
+
const isAdmin = await checkIsOrgAdmin();
|
|
17482
|
+
if (!isAdmin) {
|
|
17483
|
+
throw new Error("No model provider configured", {
|
|
17484
|
+
cause: new Error(
|
|
17485
|
+
"Contact your org admin to configure a model provider"
|
|
17486
|
+
)
|
|
17487
|
+
});
|
|
17488
|
+
}
|
|
17777
17489
|
if (!ctx.interactive) {
|
|
17778
17490
|
throw new Error("No model provider configured", {
|
|
17779
|
-
cause: new Error("Run 'vm0 model-provider setup' first")
|
|
17491
|
+
cause: new Error("Run 'vm0 org model-provider setup' first")
|
|
17780
17492
|
});
|
|
17781
17493
|
}
|
|
17782
17494
|
const choices = getProviderChoices();
|
|
@@ -17796,14 +17508,14 @@ async function handleModelProvider(ctx) {
|
|
|
17796
17508
|
const selectedChoice = choices.find((c28) => c28.type === providerType);
|
|
17797
17509
|
if (selectedChoice?.helpText) {
|
|
17798
17510
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17799
|
-
step.detail(
|
|
17511
|
+
step.detail(chalk82.dim(line));
|
|
17800
17512
|
}
|
|
17801
17513
|
}
|
|
17802
17514
|
const secret = await step.prompt(
|
|
17803
17515
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17804
17516
|
);
|
|
17805
17517
|
if (!secret) {
|
|
17806
|
-
console.log(
|
|
17518
|
+
console.log(chalk82.dim("Cancelled"));
|
|
17807
17519
|
process.exit(0);
|
|
17808
17520
|
}
|
|
17809
17521
|
let selectedModel;
|
|
@@ -17822,7 +17534,7 @@ async function handleModelProvider(ctx) {
|
|
|
17822
17534
|
() => promptSelect("Select model:", modelChoices)
|
|
17823
17535
|
);
|
|
17824
17536
|
if (modelSelection === void 0) {
|
|
17825
|
-
console.log(
|
|
17537
|
+
console.log(chalk82.dim("Cancelled"));
|
|
17826
17538
|
process.exit(0);
|
|
17827
17539
|
}
|
|
17828
17540
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17832,7 +17544,7 @@ async function handleModelProvider(ctx) {
|
|
|
17832
17544
|
});
|
|
17833
17545
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17834
17546
|
step.detail(
|
|
17835
|
-
|
|
17547
|
+
chalk82.green(
|
|
17836
17548
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17837
17549
|
)
|
|
17838
17550
|
);
|
|
@@ -17863,7 +17575,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17863
17575
|
agentName = inputName;
|
|
17864
17576
|
if (existsSync12(agentName)) {
|
|
17865
17577
|
step.detail(
|
|
17866
|
-
|
|
17578
|
+
chalk82.yellow(`${agentName}/ already exists, choose another name`)
|
|
17867
17579
|
);
|
|
17868
17580
|
} else {
|
|
17869
17581
|
folderExists = false;
|
|
@@ -17884,7 +17596,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17884
17596
|
}
|
|
17885
17597
|
}
|
|
17886
17598
|
await mkdir8(agentName, { recursive: true });
|
|
17887
|
-
step.detail(
|
|
17599
|
+
step.detail(chalk82.green(`Created ${agentName}/`));
|
|
17888
17600
|
});
|
|
17889
17601
|
return agentName;
|
|
17890
17602
|
}
|
|
@@ -17900,7 +17612,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17900
17612
|
shouldInstall = confirmed ?? true;
|
|
17901
17613
|
}
|
|
17902
17614
|
if (!shouldInstall) {
|
|
17903
|
-
step.detail(
|
|
17615
|
+
step.detail(chalk82.dim("Skipped"));
|
|
17904
17616
|
return;
|
|
17905
17617
|
}
|
|
17906
17618
|
const scope = "project";
|
|
@@ -17908,7 +17620,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17908
17620
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17909
17621
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17910
17622
|
step.detail(
|
|
17911
|
-
|
|
17623
|
+
chalk82.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17912
17624
|
);
|
|
17913
17625
|
pluginInstalled = true;
|
|
17914
17626
|
} catch (error) {
|
|
@@ -17919,18 +17631,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17919
17631
|
}
|
|
17920
17632
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17921
17633
|
console.log();
|
|
17922
|
-
console.log(
|
|
17634
|
+
console.log(chalk82.bold("Next step:"));
|
|
17923
17635
|
console.log();
|
|
17924
17636
|
if (pluginInstalled) {
|
|
17925
17637
|
console.log(
|
|
17926
|
-
` ${
|
|
17638
|
+
` ${chalk82.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17927
17639
|
);
|
|
17928
17640
|
} else {
|
|
17929
|
-
console.log(` ${
|
|
17641
|
+
console.log(` ${chalk82.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17930
17642
|
}
|
|
17931
17643
|
console.log();
|
|
17932
17644
|
}
|
|
17933
|
-
var onboardCommand = new
|
|
17645
|
+
var onboardCommand = new Command90().name("onboard").description("Guided setup for new VM0 users").option("-y, --yes", "Skip confirmation prompts").option("--name <name>", `Agent name (default: ${DEFAULT_AGENT_NAME})`).action(
|
|
17934
17646
|
withErrorHandler(async (options) => {
|
|
17935
17647
|
const interactive = isInteractive();
|
|
17936
17648
|
if (interactive) {
|
|
@@ -17955,21 +17667,21 @@ var onboardCommand = new Command95().name("onboard").description("Guided setup f
|
|
|
17955
17667
|
);
|
|
17956
17668
|
|
|
17957
17669
|
// src/commands/setup-claude/index.ts
|
|
17958
|
-
import { Command as
|
|
17959
|
-
import
|
|
17960
|
-
var setupClaudeCommand = new
|
|
17670
|
+
import { Command as Command91 } from "commander";
|
|
17671
|
+
import chalk83 from "chalk";
|
|
17672
|
+
var setupClaudeCommand = new Command91().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(
|
|
17961
17673
|
withErrorHandler(async (options) => {
|
|
17962
|
-
console.log(
|
|
17674
|
+
console.log(chalk83.dim("Installing VM0 Claude Plugin..."));
|
|
17963
17675
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17964
17676
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17965
17677
|
console.log(
|
|
17966
|
-
|
|
17678
|
+
chalk83.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17967
17679
|
);
|
|
17968
17680
|
console.log();
|
|
17969
17681
|
console.log("Next step:");
|
|
17970
17682
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17971
17683
|
console.log(
|
|
17972
|
-
|
|
17684
|
+
chalk83.cyan(
|
|
17973
17685
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17974
17686
|
)
|
|
17975
17687
|
);
|
|
@@ -17977,36 +17689,36 @@ var setupClaudeCommand = new Command96().name("setup-claude").description("Insta
|
|
|
17977
17689
|
);
|
|
17978
17690
|
|
|
17979
17691
|
// src/commands/dashboard/index.ts
|
|
17980
|
-
import { Command as
|
|
17981
|
-
import
|
|
17982
|
-
var dashboardCommand = new
|
|
17692
|
+
import { Command as Command92 } from "commander";
|
|
17693
|
+
import chalk84 from "chalk";
|
|
17694
|
+
var dashboardCommand = new Command92().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
17983
17695
|
console.log();
|
|
17984
|
-
console.log(
|
|
17696
|
+
console.log(chalk84.bold("VM0 Dashboard"));
|
|
17985
17697
|
console.log();
|
|
17986
|
-
console.log(
|
|
17987
|
-
console.log(
|
|
17698
|
+
console.log(chalk84.bold("Agents"));
|
|
17699
|
+
console.log(chalk84.dim(" List agents: ") + "vm0 agent list");
|
|
17988
17700
|
console.log();
|
|
17989
|
-
console.log(
|
|
17990
|
-
console.log(
|
|
17991
|
-
console.log(
|
|
17701
|
+
console.log(chalk84.bold("Runs"));
|
|
17702
|
+
console.log(chalk84.dim(" Recent runs: ") + "vm0 run list");
|
|
17703
|
+
console.log(chalk84.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
17992
17704
|
console.log();
|
|
17993
|
-
console.log(
|
|
17994
|
-
console.log(
|
|
17705
|
+
console.log(chalk84.bold("Schedules"));
|
|
17706
|
+
console.log(chalk84.dim(" List schedules: ") + "vm0 schedule list");
|
|
17995
17707
|
console.log();
|
|
17996
|
-
console.log(
|
|
17997
|
-
console.log(
|
|
17998
|
-
console.log(
|
|
17999
|
-
console.log(
|
|
17708
|
+
console.log(chalk84.bold("Account"));
|
|
17709
|
+
console.log(chalk84.dim(" Usage stats: ") + "vm0 usage");
|
|
17710
|
+
console.log(chalk84.dim(" List secrets: ") + "vm0 secret list");
|
|
17711
|
+
console.log(chalk84.dim(" List variables: ") + "vm0 variable list");
|
|
18000
17712
|
console.log();
|
|
18001
17713
|
console.log(
|
|
18002
|
-
|
|
17714
|
+
chalk84.dim("Not logged in? Run: ") + chalk84.cyan("vm0 auth login")
|
|
18003
17715
|
);
|
|
18004
17716
|
console.log();
|
|
18005
17717
|
});
|
|
18006
17718
|
|
|
18007
17719
|
// src/commands/preference/index.ts
|
|
18008
|
-
import { Command as
|
|
18009
|
-
import
|
|
17720
|
+
import { Command as Command93 } from "commander";
|
|
17721
|
+
import chalk85 from "chalk";
|
|
18010
17722
|
function detectTimezone2() {
|
|
18011
17723
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
18012
17724
|
}
|
|
@@ -18027,15 +17739,15 @@ function parseOnOff(flag, value) {
|
|
|
18027
17739
|
);
|
|
18028
17740
|
}
|
|
18029
17741
|
function displayPreferences(prefs) {
|
|
18030
|
-
console.log(
|
|
17742
|
+
console.log(chalk85.bold("Current preferences:"));
|
|
18031
17743
|
console.log(
|
|
18032
|
-
` Timezone: ${prefs.timezone ?
|
|
17744
|
+
` Timezone: ${prefs.timezone ? chalk85.cyan(prefs.timezone) : chalk85.dim("not set")}`
|
|
18033
17745
|
);
|
|
18034
17746
|
console.log(
|
|
18035
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17747
|
+
` Email notify: ${prefs.notifyEmail ? chalk85.green("on") : chalk85.dim("off")}`
|
|
18036
17748
|
);
|
|
18037
17749
|
console.log(
|
|
18038
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17750
|
+
` Slack notify: ${prefs.notifySlack ? chalk85.green("on") : chalk85.dim("off")}`
|
|
18039
17751
|
);
|
|
18040
17752
|
}
|
|
18041
17753
|
function buildUpdates(opts) {
|
|
@@ -18065,21 +17777,21 @@ function buildUpdates(opts) {
|
|
|
18065
17777
|
function printUpdateResult(updates, result) {
|
|
18066
17778
|
if (updates.timezone !== void 0) {
|
|
18067
17779
|
console.log(
|
|
18068
|
-
|
|
18069
|
-
`Timezone set to ${
|
|
17780
|
+
chalk85.green(
|
|
17781
|
+
`Timezone set to ${chalk85.cyan(result.timezone ?? updates.timezone)}`
|
|
18070
17782
|
)
|
|
18071
17783
|
);
|
|
18072
17784
|
}
|
|
18073
17785
|
if (updates.notifyEmail !== void 0) {
|
|
18074
17786
|
console.log(
|
|
18075
|
-
|
|
17787
|
+
chalk85.green(
|
|
18076
17788
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
18077
17789
|
)
|
|
18078
17790
|
);
|
|
18079
17791
|
}
|
|
18080
17792
|
if (updates.notifySlack !== void 0) {
|
|
18081
17793
|
console.log(
|
|
18082
|
-
|
|
17794
|
+
chalk85.green(
|
|
18083
17795
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
18084
17796
|
)
|
|
18085
17797
|
);
|
|
@@ -18088,7 +17800,7 @@ function printUpdateResult(updates, result) {
|
|
|
18088
17800
|
async function interactiveSetup(prefs) {
|
|
18089
17801
|
if (!prefs.timezone) {
|
|
18090
17802
|
const detectedTz = detectTimezone2();
|
|
18091
|
-
console.log(
|
|
17803
|
+
console.log(chalk85.dim(`
|
|
18092
17804
|
System timezone detected: ${detectedTz}`));
|
|
18093
17805
|
const tz = await promptText(
|
|
18094
17806
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -18099,7 +17811,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
18099
17811
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
18100
17812
|
}
|
|
18101
17813
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
18102
|
-
console.log(
|
|
17814
|
+
console.log(chalk85.green(`Timezone set to ${chalk85.cyan(tz.trim())}`));
|
|
18103
17815
|
}
|
|
18104
17816
|
}
|
|
18105
17817
|
if (!prefs.notifyEmail) {
|
|
@@ -18109,11 +17821,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
18109
17821
|
);
|
|
18110
17822
|
if (enable) {
|
|
18111
17823
|
await updateUserPreferences({ notifyEmail: true });
|
|
18112
|
-
console.log(
|
|
17824
|
+
console.log(chalk85.green("Email notifications enabled"));
|
|
18113
17825
|
}
|
|
18114
17826
|
}
|
|
18115
17827
|
}
|
|
18116
|
-
var preferenceCommand = new
|
|
17828
|
+
var preferenceCommand = new Command93().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(
|
|
18117
17829
|
withErrorHandler(async (opts) => {
|
|
18118
17830
|
const updates = buildUpdates(opts);
|
|
18119
17831
|
if (updates) {
|
|
@@ -18128,32 +17840,32 @@ var preferenceCommand = new Command98().name("preference").description("View or
|
|
|
18128
17840
|
} else if (!prefs.timezone) {
|
|
18129
17841
|
console.log();
|
|
18130
17842
|
console.log(
|
|
18131
|
-
`To set timezone: ${
|
|
17843
|
+
`To set timezone: ${chalk85.cyan("vm0 preference --timezone <timezone>")}`
|
|
18132
17844
|
);
|
|
18133
17845
|
console.log(
|
|
18134
|
-
|
|
17846
|
+
chalk85.dim("Example: vm0 preference --timezone America/New_York")
|
|
18135
17847
|
);
|
|
18136
17848
|
}
|
|
18137
17849
|
})
|
|
18138
17850
|
);
|
|
18139
17851
|
|
|
18140
17852
|
// src/commands/upgrade/index.ts
|
|
18141
|
-
import { Command as
|
|
18142
|
-
import
|
|
18143
|
-
var upgradeCommand = new
|
|
17853
|
+
import { Command as Command94 } from "commander";
|
|
17854
|
+
import chalk86 from "chalk";
|
|
17855
|
+
var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
18144
17856
|
withErrorHandler(async () => {
|
|
18145
17857
|
console.log("Checking for updates...");
|
|
18146
17858
|
const latestVersion = await getLatestVersion();
|
|
18147
17859
|
if (latestVersion === null) {
|
|
18148
17860
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18149
17861
|
}
|
|
18150
|
-
if (latestVersion === "9.
|
|
18151
|
-
console.log(
|
|
17862
|
+
if (latestVersion === "9.65.0") {
|
|
17863
|
+
console.log(chalk86.green(`\u2713 Already up to date (${"9.65.0"})`));
|
|
18152
17864
|
return;
|
|
18153
17865
|
}
|
|
18154
17866
|
console.log(
|
|
18155
|
-
|
|
18156
|
-
`Current version: ${"9.
|
|
17867
|
+
chalk86.yellow(
|
|
17868
|
+
`Current version: ${"9.65.0"} -> Latest version: ${latestVersion}`
|
|
18157
17869
|
)
|
|
18158
17870
|
);
|
|
18159
17871
|
console.log();
|
|
@@ -18161,26 +17873,26 @@ var upgradeCommand = new Command99().name("upgrade").description("Upgrade vm0 CL
|
|
|
18161
17873
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
18162
17874
|
if (packageManager === "unknown") {
|
|
18163
17875
|
console.log(
|
|
18164
|
-
|
|
17876
|
+
chalk86.yellow(
|
|
18165
17877
|
"Could not detect your package manager for auto-upgrade."
|
|
18166
17878
|
)
|
|
18167
17879
|
);
|
|
18168
17880
|
} else {
|
|
18169
17881
|
console.log(
|
|
18170
|
-
|
|
17882
|
+
chalk86.yellow(
|
|
18171
17883
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
18172
17884
|
)
|
|
18173
17885
|
);
|
|
18174
17886
|
}
|
|
18175
|
-
console.log(
|
|
18176
|
-
console.log(
|
|
17887
|
+
console.log(chalk86.yellow("Please upgrade manually:"));
|
|
17888
|
+
console.log(chalk86.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
18177
17889
|
return;
|
|
18178
17890
|
}
|
|
18179
17891
|
console.log(`Upgrading via ${packageManager}...`);
|
|
18180
17892
|
const success = await performUpgrade(packageManager);
|
|
18181
17893
|
if (success) {
|
|
18182
17894
|
console.log(
|
|
18183
|
-
|
|
17895
|
+
chalk86.green(`\u2713 Upgraded from ${"9.65.0"} to ${latestVersion}`)
|
|
18184
17896
|
);
|
|
18185
17897
|
return;
|
|
18186
17898
|
}
|
|
@@ -18193,8 +17905,8 @@ var upgradeCommand = new Command99().name("upgrade").description("Upgrade vm0 CL
|
|
|
18193
17905
|
);
|
|
18194
17906
|
|
|
18195
17907
|
// src/index.ts
|
|
18196
|
-
var program = new
|
|
18197
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
17908
|
+
var program = new Command95();
|
|
17909
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.65.0");
|
|
18198
17910
|
program.addCommand(authCommand);
|
|
18199
17911
|
program.addCommand(infoCommand);
|
|
18200
17912
|
program.addCommand(composeCommand);
|
|
@@ -18211,7 +17923,6 @@ program.addCommand(scheduleCommand);
|
|
|
18211
17923
|
program.addCommand(usageCommand);
|
|
18212
17924
|
program.addCommand(secretCommand);
|
|
18213
17925
|
program.addCommand(variableCommand);
|
|
18214
|
-
program.addCommand(modelProviderCommand2);
|
|
18215
17926
|
program.addCommand(connectorCommand);
|
|
18216
17927
|
program.addCommand(onboardCommand);
|
|
18217
17928
|
program.addCommand(setupClaudeCommand);
|