@vm0/cli 9.64.2 → 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 +299 -560
- 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
|
/**
|
|
@@ -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",
|
|
@@ -8364,77 +8425,11 @@ async function deleteVariable(name) {
|
|
|
8364
8425
|
handleError(result, `Variable "${name}" not found`);
|
|
8365
8426
|
}
|
|
8366
8427
|
|
|
8367
|
-
// src/lib/api/domains/model-providers.ts
|
|
8368
|
-
import { initClient as initClient9 } from "@ts-rest/core";
|
|
8369
|
-
async function listModelProviders() {
|
|
8370
|
-
const config = await getClientConfig();
|
|
8371
|
-
const client = initClient9(modelProvidersMainContract, config);
|
|
8372
|
-
const result = await client.list({ headers: {} });
|
|
8373
|
-
if (result.status === 200) {
|
|
8374
|
-
return result.body;
|
|
8375
|
-
}
|
|
8376
|
-
handleError(result, "Failed to list model providers");
|
|
8377
|
-
}
|
|
8378
|
-
async function upsertModelProvider(body) {
|
|
8379
|
-
const config = await getClientConfig();
|
|
8380
|
-
const client = initClient9(modelProvidersMainContract, config);
|
|
8381
|
-
const result = await client.upsert({ body });
|
|
8382
|
-
if (result.status === 200 || result.status === 201) {
|
|
8383
|
-
return result.body;
|
|
8384
|
-
}
|
|
8385
|
-
handleError(result, "Failed to set model provider");
|
|
8386
|
-
}
|
|
8387
|
-
async function checkModelProviderSecret(type2) {
|
|
8388
|
-
const config = await getClientConfig();
|
|
8389
|
-
const client = initClient9(modelProvidersCheckContract, config);
|
|
8390
|
-
const result = await client.check({
|
|
8391
|
-
params: { type: type2 }
|
|
8392
|
-
});
|
|
8393
|
-
if (result.status === 200) {
|
|
8394
|
-
return result.body;
|
|
8395
|
-
}
|
|
8396
|
-
handleError(result, "Failed to check secret");
|
|
8397
|
-
}
|
|
8398
|
-
async function deleteModelProvider(type2) {
|
|
8399
|
-
const config = await getClientConfig();
|
|
8400
|
-
const client = initClient9(modelProvidersByTypeContract, config);
|
|
8401
|
-
const result = await client.delete({
|
|
8402
|
-
params: { type: type2 }
|
|
8403
|
-
});
|
|
8404
|
-
if (result.status === 204) {
|
|
8405
|
-
return;
|
|
8406
|
-
}
|
|
8407
|
-
handleError(result, `Model provider "${type2}" not found`);
|
|
8408
|
-
}
|
|
8409
|
-
async function setModelProviderDefault(type2) {
|
|
8410
|
-
const config = await getClientConfig();
|
|
8411
|
-
const client = initClient9(modelProvidersSetDefaultContract, config);
|
|
8412
|
-
const result = await client.setDefault({
|
|
8413
|
-
params: { type: type2 }
|
|
8414
|
-
});
|
|
8415
|
-
if (result.status === 200) {
|
|
8416
|
-
return result.body;
|
|
8417
|
-
}
|
|
8418
|
-
handleError(result, "Failed to set default model provider");
|
|
8419
|
-
}
|
|
8420
|
-
async function updateModelProviderModel(type2, selectedModel) {
|
|
8421
|
-
const config = await getClientConfig();
|
|
8422
|
-
const client = initClient9(modelProvidersUpdateModelContract, config);
|
|
8423
|
-
const result = await client.updateModel({
|
|
8424
|
-
params: { type: type2 },
|
|
8425
|
-
body: { selectedModel }
|
|
8426
|
-
});
|
|
8427
|
-
if (result.status === 200) {
|
|
8428
|
-
return result.body;
|
|
8429
|
-
}
|
|
8430
|
-
handleError(result, "Failed to update model provider");
|
|
8431
|
-
}
|
|
8432
|
-
|
|
8433
8428
|
// src/lib/api/domains/org-model-providers.ts
|
|
8434
|
-
import { initClient as
|
|
8429
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
8435
8430
|
async function listOrgModelProviders() {
|
|
8436
8431
|
const config = await getClientConfig();
|
|
8437
|
-
const client =
|
|
8432
|
+
const client = initClient9(orgModelProvidersMainContract, config);
|
|
8438
8433
|
const result = await client.list({ headers: {} });
|
|
8439
8434
|
if (result.status === 200) {
|
|
8440
8435
|
return result.body;
|
|
@@ -8443,7 +8438,7 @@ async function listOrgModelProviders() {
|
|
|
8443
8438
|
}
|
|
8444
8439
|
async function upsertOrgModelProvider(body) {
|
|
8445
8440
|
const config = await getClientConfig();
|
|
8446
|
-
const client =
|
|
8441
|
+
const client = initClient9(orgModelProvidersMainContract, config);
|
|
8447
8442
|
const result = await client.upsert({ body });
|
|
8448
8443
|
if (result.status === 200 || result.status === 201) {
|
|
8449
8444
|
return result.body;
|
|
@@ -8452,7 +8447,7 @@ async function upsertOrgModelProvider(body) {
|
|
|
8452
8447
|
}
|
|
8453
8448
|
async function deleteOrgModelProvider(type2) {
|
|
8454
8449
|
const config = await getClientConfig();
|
|
8455
|
-
const client =
|
|
8450
|
+
const client = initClient9(orgModelProvidersByTypeContract, config);
|
|
8456
8451
|
const result = await client.delete({
|
|
8457
8452
|
params: { type: type2 }
|
|
8458
8453
|
});
|
|
@@ -8463,7 +8458,7 @@ async function deleteOrgModelProvider(type2) {
|
|
|
8463
8458
|
}
|
|
8464
8459
|
async function setOrgModelProviderDefault(type2) {
|
|
8465
8460
|
const config = await getClientConfig();
|
|
8466
|
-
const client =
|
|
8461
|
+
const client = initClient9(orgModelProvidersSetDefaultContract, config);
|
|
8467
8462
|
const result = await client.setDefault({
|
|
8468
8463
|
params: { type: type2 }
|
|
8469
8464
|
});
|
|
@@ -8474,7 +8469,7 @@ async function setOrgModelProviderDefault(type2) {
|
|
|
8474
8469
|
}
|
|
8475
8470
|
async function updateOrgModelProviderModel(type2, selectedModel) {
|
|
8476
8471
|
const config = await getClientConfig();
|
|
8477
|
-
const client =
|
|
8472
|
+
const client = initClient9(orgModelProvidersUpdateModelContract, config);
|
|
8478
8473
|
const result = await client.updateModel({
|
|
8479
8474
|
params: { type: type2 },
|
|
8480
8475
|
body: { selectedModel }
|
|
@@ -8486,10 +8481,10 @@ async function updateOrgModelProviderModel(type2, selectedModel) {
|
|
|
8486
8481
|
}
|
|
8487
8482
|
|
|
8488
8483
|
// src/lib/api/domains/connectors.ts
|
|
8489
|
-
import { initClient as
|
|
8484
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
8490
8485
|
async function listConnectors() {
|
|
8491
8486
|
const config = await getClientConfig();
|
|
8492
|
-
const client =
|
|
8487
|
+
const client = initClient10(connectorsMainContract, config);
|
|
8493
8488
|
const result = await client.list({ headers: {} });
|
|
8494
8489
|
if (result.status === 200) {
|
|
8495
8490
|
return result.body;
|
|
@@ -8498,7 +8493,7 @@ async function listConnectors() {
|
|
|
8498
8493
|
}
|
|
8499
8494
|
async function deleteConnector(type2) {
|
|
8500
8495
|
const config = await getClientConfig();
|
|
8501
|
-
const client =
|
|
8496
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
8502
8497
|
const result = await client.delete({
|
|
8503
8498
|
params: { type: type2 }
|
|
8504
8499
|
});
|
|
@@ -8509,7 +8504,7 @@ async function deleteConnector(type2) {
|
|
|
8509
8504
|
}
|
|
8510
8505
|
async function getConnector(type2) {
|
|
8511
8506
|
const config = await getClientConfig();
|
|
8512
|
-
const client =
|
|
8507
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
8513
8508
|
const result = await client.get({
|
|
8514
8509
|
params: { type: type2 }
|
|
8515
8510
|
});
|
|
@@ -8552,10 +8547,10 @@ async function getUsage(options) {
|
|
|
8552
8547
|
}
|
|
8553
8548
|
|
|
8554
8549
|
// src/lib/api/domains/user-preferences.ts
|
|
8555
|
-
import { initClient as
|
|
8550
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
8556
8551
|
async function getUserPreferences() {
|
|
8557
8552
|
const config = await getClientConfig();
|
|
8558
|
-
const client =
|
|
8553
|
+
const client = initClient11(userPreferencesContract, config);
|
|
8559
8554
|
const result = await client.get({ headers: {} });
|
|
8560
8555
|
if (result.status === 200) {
|
|
8561
8556
|
return result.body;
|
|
@@ -8564,7 +8559,7 @@ async function getUserPreferences() {
|
|
|
8564
8559
|
}
|
|
8565
8560
|
async function updateUserPreferences(body) {
|
|
8566
8561
|
const config = await getClientConfig();
|
|
8567
|
-
const client =
|
|
8562
|
+
const client = initClient11(userPreferencesContract, config);
|
|
8568
8563
|
const result = await client.update({ body });
|
|
8569
8564
|
if (result.status === 200) {
|
|
8570
8565
|
return result.body;
|
|
@@ -8573,10 +8568,10 @@ async function updateUserPreferences(body) {
|
|
|
8573
8568
|
}
|
|
8574
8569
|
|
|
8575
8570
|
// src/lib/api/domains/org-secrets.ts
|
|
8576
|
-
import { initClient as
|
|
8571
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
8577
8572
|
async function listOrgSecrets() {
|
|
8578
8573
|
const config = await getClientConfig();
|
|
8579
|
-
const client =
|
|
8574
|
+
const client = initClient12(orgSecretsMainContract, config);
|
|
8580
8575
|
const result = await client.list({ headers: {} });
|
|
8581
8576
|
if (result.status === 200) {
|
|
8582
8577
|
return result.body;
|
|
@@ -8585,7 +8580,7 @@ async function listOrgSecrets() {
|
|
|
8585
8580
|
}
|
|
8586
8581
|
async function setOrgSecret(body) {
|
|
8587
8582
|
const config = await getClientConfig();
|
|
8588
|
-
const client =
|
|
8583
|
+
const client = initClient12(orgSecretsMainContract, config);
|
|
8589
8584
|
const result = await client.set({ body });
|
|
8590
8585
|
if (result.status === 200 || result.status === 201) {
|
|
8591
8586
|
return result.body;
|
|
@@ -8594,7 +8589,7 @@ async function setOrgSecret(body) {
|
|
|
8594
8589
|
}
|
|
8595
8590
|
async function deleteOrgSecret(name) {
|
|
8596
8591
|
const config = await getClientConfig();
|
|
8597
|
-
const client =
|
|
8592
|
+
const client = initClient12(orgSecretsByNameContract, config);
|
|
8598
8593
|
const result = await client.delete({
|
|
8599
8594
|
params: { name }
|
|
8600
8595
|
});
|
|
@@ -8605,10 +8600,10 @@ async function deleteOrgSecret(name) {
|
|
|
8605
8600
|
}
|
|
8606
8601
|
|
|
8607
8602
|
// src/lib/api/domains/org-variables.ts
|
|
8608
|
-
import { initClient as
|
|
8603
|
+
import { initClient as initClient13 } from "@ts-rest/core";
|
|
8609
8604
|
async function listOrgVariables() {
|
|
8610
8605
|
const config = await getClientConfig();
|
|
8611
|
-
const client =
|
|
8606
|
+
const client = initClient13(orgVariablesMainContract, config);
|
|
8612
8607
|
const result = await client.list({ headers: {} });
|
|
8613
8608
|
if (result.status === 200) {
|
|
8614
8609
|
return result.body;
|
|
@@ -8617,7 +8612,7 @@ async function listOrgVariables() {
|
|
|
8617
8612
|
}
|
|
8618
8613
|
async function setOrgVariable(body) {
|
|
8619
8614
|
const config = await getClientConfig();
|
|
8620
|
-
const client =
|
|
8615
|
+
const client = initClient13(orgVariablesMainContract, config);
|
|
8621
8616
|
const result = await client.set({ body });
|
|
8622
8617
|
if (result.status === 200 || result.status === 201) {
|
|
8623
8618
|
return result.body;
|
|
@@ -8626,7 +8621,7 @@ async function setOrgVariable(body) {
|
|
|
8626
8621
|
}
|
|
8627
8622
|
async function deleteOrgVariable(name) {
|
|
8628
8623
|
const config = await getClientConfig();
|
|
8629
|
-
const client =
|
|
8624
|
+
const client = initClient13(orgVariablesByNameContract, config);
|
|
8630
8625
|
const result = await client.delete({
|
|
8631
8626
|
params: { name }
|
|
8632
8627
|
});
|
|
@@ -9982,7 +9977,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9982
9977
|
options.autoUpdate = false;
|
|
9983
9978
|
}
|
|
9984
9979
|
if (options.autoUpdate !== false) {
|
|
9985
|
-
await startSilentUpgrade("9.
|
|
9980
|
+
await startSilentUpgrade("9.65.0");
|
|
9986
9981
|
}
|
|
9987
9982
|
try {
|
|
9988
9983
|
let result;
|
|
@@ -10804,7 +10799,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10804
10799
|
withErrorHandler(
|
|
10805
10800
|
async (identifier, prompt, options) => {
|
|
10806
10801
|
if (options.autoUpdate !== false) {
|
|
10807
|
-
await startSilentUpgrade("9.
|
|
10802
|
+
await startSilentUpgrade("9.65.0");
|
|
10808
10803
|
}
|
|
10809
10804
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10810
10805
|
let composeId;
|
|
@@ -12524,7 +12519,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
12524
12519
|
withErrorHandler(
|
|
12525
12520
|
async (prompt, options) => {
|
|
12526
12521
|
if (options.autoUpdate !== false) {
|
|
12527
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12522
|
+
const shouldExit = await checkAndUpgrade("9.65.0", prompt);
|
|
12528
12523
|
if (shouldExit) {
|
|
12529
12524
|
process.exit(0);
|
|
12530
12525
|
}
|
|
@@ -12710,7 +12705,7 @@ import { Command as Command40 } from "commander";
|
|
|
12710
12705
|
import chalk36 from "chalk";
|
|
12711
12706
|
|
|
12712
12707
|
// src/lib/api/api-client.ts
|
|
12713
|
-
import { initClient as
|
|
12708
|
+
import { initClient as initClient14 } from "@ts-rest/core";
|
|
12714
12709
|
var ApiClient = class {
|
|
12715
12710
|
async getHeaders() {
|
|
12716
12711
|
const token = await getActiveToken();
|
|
@@ -12736,7 +12731,7 @@ var ApiClient = class {
|
|
|
12736
12731
|
async getComposeByName(name, org) {
|
|
12737
12732
|
const baseUrl = await this.getBaseUrl();
|
|
12738
12733
|
const headers = await this.getHeaders();
|
|
12739
|
-
const client =
|
|
12734
|
+
const client = initClient14(composesMainContract, {
|
|
12740
12735
|
baseUrl,
|
|
12741
12736
|
baseHeaders: headers,
|
|
12742
12737
|
jsonQuery: false
|
|
@@ -12757,7 +12752,7 @@ var ApiClient = class {
|
|
|
12757
12752
|
async getComposeById(id) {
|
|
12758
12753
|
const baseUrl = await this.getBaseUrl();
|
|
12759
12754
|
const headers = await this.getHeaders();
|
|
12760
|
-
const client =
|
|
12755
|
+
const client = initClient14(composesByIdContract, {
|
|
12761
12756
|
baseUrl,
|
|
12762
12757
|
baseHeaders: headers,
|
|
12763
12758
|
jsonQuery: false
|
|
@@ -12779,7 +12774,7 @@ var ApiClient = class {
|
|
|
12779
12774
|
async getComposeVersion(composeId, version) {
|
|
12780
12775
|
const baseUrl = await this.getBaseUrl();
|
|
12781
12776
|
const headers = await this.getHeaders();
|
|
12782
|
-
const client =
|
|
12777
|
+
const client = initClient14(composesVersionsContract, {
|
|
12783
12778
|
baseUrl,
|
|
12784
12779
|
baseHeaders: headers,
|
|
12785
12780
|
jsonQuery: false
|
|
@@ -12800,7 +12795,7 @@ var ApiClient = class {
|
|
|
12800
12795
|
async createOrUpdateCompose(body) {
|
|
12801
12796
|
const baseUrl = await this.getBaseUrl();
|
|
12802
12797
|
const headers = await this.getHeaders();
|
|
12803
|
-
const client =
|
|
12798
|
+
const client = initClient14(composesMainContract, {
|
|
12804
12799
|
baseUrl,
|
|
12805
12800
|
baseHeaders: headers,
|
|
12806
12801
|
jsonQuery: false
|
|
@@ -12823,7 +12818,7 @@ var ApiClient = class {
|
|
|
12823
12818
|
async createRun(body) {
|
|
12824
12819
|
const baseUrl = await this.getBaseUrl();
|
|
12825
12820
|
const headers = await this.getHeaders();
|
|
12826
|
-
const client =
|
|
12821
|
+
const client = initClient14(runsMainContract, {
|
|
12827
12822
|
baseUrl,
|
|
12828
12823
|
baseHeaders: headers,
|
|
12829
12824
|
jsonQuery: false
|
|
@@ -12838,7 +12833,7 @@ var ApiClient = class {
|
|
|
12838
12833
|
}
|
|
12839
12834
|
async getEvents(runId, options) {
|
|
12840
12835
|
const config = await getClientConfig();
|
|
12841
|
-
const client =
|
|
12836
|
+
const client = initClient14(runEventsContract, config);
|
|
12842
12837
|
const result = await client.getEvents({
|
|
12843
12838
|
params: { id: runId },
|
|
12844
12839
|
query: {
|
|
@@ -12855,7 +12850,7 @@ var ApiClient = class {
|
|
|
12855
12850
|
}
|
|
12856
12851
|
async getSystemLog(runId, options) {
|
|
12857
12852
|
const config = await getClientConfig();
|
|
12858
|
-
const client =
|
|
12853
|
+
const client = initClient14(runSystemLogContract, config);
|
|
12859
12854
|
const result = await client.getSystemLog({
|
|
12860
12855
|
params: { id: runId },
|
|
12861
12856
|
query: {
|
|
@@ -12873,7 +12868,7 @@ var ApiClient = class {
|
|
|
12873
12868
|
}
|
|
12874
12869
|
async getMetrics(runId, options) {
|
|
12875
12870
|
const config = await getClientConfig();
|
|
12876
|
-
const client =
|
|
12871
|
+
const client = initClient14(runMetricsContract, config);
|
|
12877
12872
|
const result = await client.getMetrics({
|
|
12878
12873
|
params: { id: runId },
|
|
12879
12874
|
query: {
|
|
@@ -12891,7 +12886,7 @@ var ApiClient = class {
|
|
|
12891
12886
|
}
|
|
12892
12887
|
async getAgentEvents(runId, options) {
|
|
12893
12888
|
const config = await getClientConfig();
|
|
12894
|
-
const client =
|
|
12889
|
+
const client = initClient14(runAgentEventsContract, config);
|
|
12895
12890
|
const result = await client.getAgentEvents({
|
|
12896
12891
|
params: { id: runId },
|
|
12897
12892
|
query: {
|
|
@@ -12909,7 +12904,7 @@ var ApiClient = class {
|
|
|
12909
12904
|
}
|
|
12910
12905
|
async getNetworkLogs(runId, options) {
|
|
12911
12906
|
const config = await getClientConfig();
|
|
12912
|
-
const client =
|
|
12907
|
+
const client = initClient14(runNetworkLogsContract, config);
|
|
12913
12908
|
const result = await client.getNetworkLogs({
|
|
12914
12909
|
params: { id: runId },
|
|
12915
12910
|
query: {
|
|
@@ -12931,7 +12926,7 @@ var ApiClient = class {
|
|
|
12931
12926
|
async getOrg() {
|
|
12932
12927
|
const baseUrl = await this.getBaseUrl();
|
|
12933
12928
|
const headers = await this.getHeaders();
|
|
12934
|
-
const client =
|
|
12929
|
+
const client = initClient14(orgContract, {
|
|
12935
12930
|
baseUrl,
|
|
12936
12931
|
baseHeaders: headers,
|
|
12937
12932
|
jsonQuery: false
|
|
@@ -12950,7 +12945,7 @@ var ApiClient = class {
|
|
|
12950
12945
|
async updateOrg(body) {
|
|
12951
12946
|
const baseUrl = await this.getBaseUrl();
|
|
12952
12947
|
const headers = await this.getHeaders();
|
|
12953
|
-
const client =
|
|
12948
|
+
const client = initClient14(orgContract, {
|
|
12954
12949
|
baseUrl,
|
|
12955
12950
|
baseHeaders: headers,
|
|
12956
12951
|
jsonQuery: false
|
|
@@ -12970,7 +12965,7 @@ var ApiClient = class {
|
|
|
12970
12965
|
async getSession(sessionId) {
|
|
12971
12966
|
const baseUrl = await this.getBaseUrl();
|
|
12972
12967
|
const headers = await this.getHeaders();
|
|
12973
|
-
const client =
|
|
12968
|
+
const client = initClient14(sessionsByIdContract, {
|
|
12974
12969
|
baseUrl,
|
|
12975
12970
|
baseHeaders: headers,
|
|
12976
12971
|
jsonQuery: false
|
|
@@ -12991,7 +12986,7 @@ var ApiClient = class {
|
|
|
12991
12986
|
*/
|
|
12992
12987
|
async getCheckpoint(checkpointId) {
|
|
12993
12988
|
const config = await getClientConfig();
|
|
12994
|
-
const client =
|
|
12989
|
+
const client = initClient14(checkpointsByIdContract, config);
|
|
12995
12990
|
const result = await client.getById({
|
|
12996
12991
|
params: { id: checkpointId }
|
|
12997
12992
|
});
|
|
@@ -13008,7 +13003,7 @@ var ApiClient = class {
|
|
|
13008
13003
|
async prepareStorage(body) {
|
|
13009
13004
|
const baseUrl = await this.getBaseUrl();
|
|
13010
13005
|
const headers = await this.getHeaders();
|
|
13011
|
-
const client =
|
|
13006
|
+
const client = initClient14(storagesPrepareContract, {
|
|
13012
13007
|
baseUrl,
|
|
13013
13008
|
baseHeaders: headers,
|
|
13014
13009
|
jsonQuery: false
|
|
@@ -13027,7 +13022,7 @@ var ApiClient = class {
|
|
|
13027
13022
|
async commitStorage(body) {
|
|
13028
13023
|
const baseUrl = await this.getBaseUrl();
|
|
13029
13024
|
const headers = await this.getHeaders();
|
|
13030
|
-
const client =
|
|
13025
|
+
const client = initClient14(storagesCommitContract, {
|
|
13031
13026
|
baseUrl,
|
|
13032
13027
|
baseHeaders: headers,
|
|
13033
13028
|
jsonQuery: false
|
|
@@ -13046,7 +13041,7 @@ var ApiClient = class {
|
|
|
13046
13041
|
async getStorageDownload(query) {
|
|
13047
13042
|
const baseUrl = await this.getBaseUrl();
|
|
13048
13043
|
const headers = await this.getHeaders();
|
|
13049
|
-
const client =
|
|
13044
|
+
const client = initClient14(storagesDownloadContract, {
|
|
13050
13045
|
baseUrl,
|
|
13051
13046
|
baseHeaders: headers,
|
|
13052
13047
|
jsonQuery: false
|
|
@@ -13071,7 +13066,7 @@ var ApiClient = class {
|
|
|
13071
13066
|
async listStorages(query) {
|
|
13072
13067
|
const baseUrl = await this.getBaseUrl();
|
|
13073
13068
|
const headers = await this.getHeaders();
|
|
13074
|
-
const client =
|
|
13069
|
+
const client = initClient14(storagesListContract, {
|
|
13075
13070
|
baseUrl,
|
|
13076
13071
|
baseHeaders: headers,
|
|
13077
13072
|
jsonQuery: false
|
|
@@ -13091,7 +13086,7 @@ var ApiClient = class {
|
|
|
13091
13086
|
async deploySchedule(body) {
|
|
13092
13087
|
const baseUrl = await this.getBaseUrl();
|
|
13093
13088
|
const headers = await this.getHeaders();
|
|
13094
|
-
const client =
|
|
13089
|
+
const client = initClient14(schedulesMainContract, {
|
|
13095
13090
|
baseUrl,
|
|
13096
13091
|
baseHeaders: headers,
|
|
13097
13092
|
jsonQuery: false
|
|
@@ -13110,7 +13105,7 @@ var ApiClient = class {
|
|
|
13110
13105
|
async listSchedules() {
|
|
13111
13106
|
const baseUrl = await this.getBaseUrl();
|
|
13112
13107
|
const headers = await this.getHeaders();
|
|
13113
|
-
const client =
|
|
13108
|
+
const client = initClient14(schedulesMainContract, {
|
|
13114
13109
|
baseUrl,
|
|
13115
13110
|
baseHeaders: headers,
|
|
13116
13111
|
jsonQuery: false
|
|
@@ -13129,7 +13124,7 @@ var ApiClient = class {
|
|
|
13129
13124
|
async getScheduleByName(params) {
|
|
13130
13125
|
const baseUrl = await this.getBaseUrl();
|
|
13131
13126
|
const headers = await this.getHeaders();
|
|
13132
|
-
const client =
|
|
13127
|
+
const client = initClient14(schedulesByNameContract, {
|
|
13133
13128
|
baseUrl,
|
|
13134
13129
|
baseHeaders: headers,
|
|
13135
13130
|
jsonQuery: false
|
|
@@ -13151,7 +13146,7 @@ var ApiClient = class {
|
|
|
13151
13146
|
async deleteSchedule(params) {
|
|
13152
13147
|
const baseUrl = await this.getBaseUrl();
|
|
13153
13148
|
const headers = await this.getHeaders();
|
|
13154
|
-
const client =
|
|
13149
|
+
const client = initClient14(schedulesByNameContract, {
|
|
13155
13150
|
baseUrl,
|
|
13156
13151
|
baseHeaders: headers,
|
|
13157
13152
|
jsonQuery: false
|
|
@@ -13173,7 +13168,7 @@ var ApiClient = class {
|
|
|
13173
13168
|
async enableSchedule(params) {
|
|
13174
13169
|
const baseUrl = await this.getBaseUrl();
|
|
13175
13170
|
const headers = await this.getHeaders();
|
|
13176
|
-
const client =
|
|
13171
|
+
const client = initClient14(schedulesEnableContract, {
|
|
13177
13172
|
baseUrl,
|
|
13178
13173
|
baseHeaders: headers,
|
|
13179
13174
|
jsonQuery: false
|
|
@@ -13195,7 +13190,7 @@ var ApiClient = class {
|
|
|
13195
13190
|
async disableSchedule(params) {
|
|
13196
13191
|
const baseUrl = await this.getBaseUrl();
|
|
13197
13192
|
const headers = await this.getHeaders();
|
|
13198
|
-
const client =
|
|
13193
|
+
const client = initClient14(schedulesEnableContract, {
|
|
13199
13194
|
baseUrl,
|
|
13200
13195
|
baseHeaders: headers,
|
|
13201
13196
|
jsonQuery: false
|
|
@@ -13217,7 +13212,7 @@ var ApiClient = class {
|
|
|
13217
13212
|
async listScheduleRuns(params) {
|
|
13218
13213
|
const baseUrl = await this.getBaseUrl();
|
|
13219
13214
|
const headers = await this.getHeaders();
|
|
13220
|
-
const client =
|
|
13215
|
+
const client = initClient14(scheduleRunsContract, {
|
|
13221
13216
|
baseUrl,
|
|
13222
13217
|
baseHeaders: headers,
|
|
13223
13218
|
jsonQuery: false
|
|
@@ -13325,7 +13320,7 @@ var ApiClient = class {
|
|
|
13325
13320
|
}
|
|
13326
13321
|
async searchLogs(options) {
|
|
13327
13322
|
const config = await getClientConfig();
|
|
13328
|
-
const client =
|
|
13323
|
+
const client = initClient14(logsSearchContract, config);
|
|
13329
13324
|
const result = await client.searchLogs({
|
|
13330
13325
|
query: {
|
|
13331
13326
|
keyword: options.keyword,
|
|
@@ -14182,7 +14177,7 @@ import { Command as Command58 } from "commander";
|
|
|
14182
14177
|
import chalk53 from "chalk";
|
|
14183
14178
|
import prompts3 from "prompts";
|
|
14184
14179
|
|
|
14185
|
-
// src/
|
|
14180
|
+
// src/lib/domain/model-provider/shared.ts
|
|
14186
14181
|
import chalk52 from "chalk";
|
|
14187
14182
|
import prompts2 from "prompts";
|
|
14188
14183
|
function validateProviderType(typeStr) {
|
|
@@ -14274,7 +14269,7 @@ function validateSecrets(type2, authMethod, secrets) {
|
|
|
14274
14269
|
}
|
|
14275
14270
|
function handleNonInteractiveMode(options) {
|
|
14276
14271
|
const type2 = validateProviderType(options.type);
|
|
14277
|
-
const cmdPrefix = options.commandPrefix ?? "vm0 model-provider setup";
|
|
14272
|
+
const cmdPrefix = options.commandPrefix ?? "vm0 org model-provider setup";
|
|
14278
14273
|
let selectedModel;
|
|
14279
14274
|
if (options.model) {
|
|
14280
14275
|
selectedModel = validateModel(type2, options.model);
|
|
@@ -15195,7 +15190,7 @@ var initCommand4 = new Command68().name("init").description("Initialize a new VM
|
|
|
15195
15190
|
console.log();
|
|
15196
15191
|
console.log("Next steps:");
|
|
15197
15192
|
console.log(
|
|
15198
|
-
` 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")}`
|
|
15199
15194
|
);
|
|
15200
15195
|
console.log(
|
|
15201
15196
|
` 2. Edit ${chalk60.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
@@ -16535,297 +16530,13 @@ var deleteCommand4 = new Command83().name("delete").description("Delete a variab
|
|
|
16535
16530
|
// src/commands/variable/index.ts
|
|
16536
16531
|
var variableCommand = new Command84().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand12).addCommand(setCommand5).addCommand(deleteCommand4);
|
|
16537
16532
|
|
|
16538
|
-
// src/commands/
|
|
16533
|
+
// src/commands/connector/index.ts
|
|
16539
16534
|
import { Command as Command89 } from "commander";
|
|
16540
16535
|
|
|
16541
|
-
// src/commands/
|
|
16536
|
+
// src/commands/connector/connect.ts
|
|
16542
16537
|
import { Command as Command85 } from "commander";
|
|
16543
|
-
import chalk74 from "chalk";
|
|
16544
|
-
var listCommand13 = new Command85().name("list").alias("ls").description("List all model providers").action(
|
|
16545
|
-
withErrorHandler(async () => {
|
|
16546
|
-
const result = await listModelProviders();
|
|
16547
|
-
if (result.modelProviders.length === 0) {
|
|
16548
|
-
console.log(chalk74.dim("No model providers configured"));
|
|
16549
|
-
console.log();
|
|
16550
|
-
console.log("To add a model provider:");
|
|
16551
|
-
console.log(chalk74.cyan(" vm0 model-provider setup"));
|
|
16552
|
-
return;
|
|
16553
|
-
}
|
|
16554
|
-
const byFramework = result.modelProviders.reduce(
|
|
16555
|
-
(acc, p) => {
|
|
16556
|
-
const fw = p.framework;
|
|
16557
|
-
if (!acc[fw]) {
|
|
16558
|
-
acc[fw] = [];
|
|
16559
|
-
}
|
|
16560
|
-
acc[fw].push(p);
|
|
16561
|
-
return acc;
|
|
16562
|
-
},
|
|
16563
|
-
{}
|
|
16564
|
-
);
|
|
16565
|
-
console.log(chalk74.bold("Model Providers:"));
|
|
16566
|
-
console.log();
|
|
16567
|
-
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
16568
|
-
console.log(` ${chalk74.cyan(framework)}:`);
|
|
16569
|
-
for (const provider of providers) {
|
|
16570
|
-
const defaultTag = provider.isDefault ? chalk74.green(" (default)") : "";
|
|
16571
|
-
const modelTag = provider.selectedModel ? chalk74.dim(` [${provider.selectedModel}]`) : "";
|
|
16572
|
-
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
16573
|
-
console.log(
|
|
16574
|
-
chalk74.dim(
|
|
16575
|
-
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
16576
|
-
)
|
|
16577
|
-
);
|
|
16578
|
-
}
|
|
16579
|
-
console.log();
|
|
16580
|
-
}
|
|
16581
|
-
console.log(
|
|
16582
|
-
chalk74.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
16583
|
-
);
|
|
16584
|
-
})
|
|
16585
|
-
);
|
|
16586
|
-
|
|
16587
|
-
// src/commands/model-provider/setup.ts
|
|
16588
|
-
import { Command as Command86 } from "commander";
|
|
16589
16538
|
import chalk75 from "chalk";
|
|
16590
|
-
import
|
|
16591
|
-
async function handleInteractiveMode2() {
|
|
16592
|
-
if (!isInteractive()) {
|
|
16593
|
-
throw new Error("Interactive mode requires a TTY", {
|
|
16594
|
-
cause: new Error(
|
|
16595
|
-
'Use non-interactive mode: vm0 model-provider setup --type <type> --secret "<value>"'
|
|
16596
|
-
)
|
|
16597
|
-
});
|
|
16598
|
-
}
|
|
16599
|
-
const { modelProviders: configuredProviders } = await listModelProviders();
|
|
16600
|
-
const configuredTypes = new Set(configuredProviders.map((p) => p.type));
|
|
16601
|
-
const annotatedChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
16602
|
-
([type3, config2]) => {
|
|
16603
|
-
const isConfigured = configuredTypes.has(type3);
|
|
16604
|
-
const isExperimental = hasAuthMethods(type3);
|
|
16605
|
-
let title = config2.label;
|
|
16606
|
-
if (isConfigured) {
|
|
16607
|
-
title = `${title} \u2713`;
|
|
16608
|
-
}
|
|
16609
|
-
if (isExperimental) {
|
|
16610
|
-
title = `${title} ${chalk75.dim("(experimental)")}`;
|
|
16611
|
-
}
|
|
16612
|
-
return {
|
|
16613
|
-
title,
|
|
16614
|
-
value: type3
|
|
16615
|
-
};
|
|
16616
|
-
}
|
|
16617
|
-
);
|
|
16618
|
-
const typeResponse = await prompts4(
|
|
16619
|
-
{
|
|
16620
|
-
type: "select",
|
|
16621
|
-
name: "type",
|
|
16622
|
-
message: "Select provider type:",
|
|
16623
|
-
choices: annotatedChoices
|
|
16624
|
-
},
|
|
16625
|
-
{ onCancel: () => process.exit(0) }
|
|
16626
|
-
);
|
|
16627
|
-
const type2 = typeResponse.type;
|
|
16628
|
-
const checkResult = await checkModelProviderSecret(type2);
|
|
16629
|
-
if (checkResult.exists) {
|
|
16630
|
-
console.log();
|
|
16631
|
-
console.log(`"${type2}" is already configured`);
|
|
16632
|
-
console.log();
|
|
16633
|
-
const actionResponse = await prompts4(
|
|
16634
|
-
{
|
|
16635
|
-
type: "select",
|
|
16636
|
-
name: "action",
|
|
16637
|
-
message: "",
|
|
16638
|
-
choices: [
|
|
16639
|
-
{ title: "Keep existing secret", value: "keep" },
|
|
16640
|
-
{ title: "Update secret", value: "update" }
|
|
16641
|
-
]
|
|
16642
|
-
},
|
|
16643
|
-
{ onCancel: () => process.exit(0) }
|
|
16644
|
-
);
|
|
16645
|
-
if (actionResponse.action === "keep") {
|
|
16646
|
-
const selectedModel2 = await promptForModelSelection(type2);
|
|
16647
|
-
return {
|
|
16648
|
-
type: type2,
|
|
16649
|
-
keepExistingSecret: true,
|
|
16650
|
-
selectedModel: selectedModel2,
|
|
16651
|
-
isInteractiveMode: true
|
|
16652
|
-
};
|
|
16653
|
-
}
|
|
16654
|
-
}
|
|
16655
|
-
const config = MODEL_PROVIDER_TYPES[type2];
|
|
16656
|
-
console.log();
|
|
16657
|
-
console.log(chalk75.dim(config.helpText));
|
|
16658
|
-
console.log();
|
|
16659
|
-
if (hasAuthMethods(type2)) {
|
|
16660
|
-
const authMethod = await promptForAuthMethod(type2);
|
|
16661
|
-
const secrets = await promptForSecrets(type2, authMethod);
|
|
16662
|
-
const selectedModel2 = await promptForModelSelection(type2);
|
|
16663
|
-
return {
|
|
16664
|
-
type: type2,
|
|
16665
|
-
authMethod,
|
|
16666
|
-
secrets,
|
|
16667
|
-
selectedModel: selectedModel2,
|
|
16668
|
-
isInteractiveMode: true
|
|
16669
|
-
};
|
|
16670
|
-
}
|
|
16671
|
-
const secretLabel = "secretLabel" in config ? config.secretLabel : "secret";
|
|
16672
|
-
const secretResponse = await prompts4(
|
|
16673
|
-
{
|
|
16674
|
-
type: "password",
|
|
16675
|
-
name: "secret",
|
|
16676
|
-
message: `Enter your ${secretLabel}:`,
|
|
16677
|
-
validate: (value) => value.length > 0 || `${secretLabel} is required`
|
|
16678
|
-
},
|
|
16679
|
-
{ onCancel: () => process.exit(0) }
|
|
16680
|
-
);
|
|
16681
|
-
const secret = secretResponse.secret;
|
|
16682
|
-
const selectedModel = await promptForModelSelection(type2);
|
|
16683
|
-
return { type: type2, secret, selectedModel, isInteractiveMode: true };
|
|
16684
|
-
}
|
|
16685
|
-
async function promptSetAsDefault2(type2, framework, isDefault) {
|
|
16686
|
-
if (isDefault) return;
|
|
16687
|
-
const response = await prompts4(
|
|
16688
|
-
{
|
|
16689
|
-
type: "confirm",
|
|
16690
|
-
name: "setDefault",
|
|
16691
|
-
message: "Set this provider as default?",
|
|
16692
|
-
initial: false
|
|
16693
|
-
},
|
|
16694
|
-
{ onCancel: () => process.exit(0) }
|
|
16695
|
-
);
|
|
16696
|
-
if (response.setDefault) {
|
|
16697
|
-
await setModelProviderDefault(type2);
|
|
16698
|
-
console.log(chalk75.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
16699
|
-
}
|
|
16700
|
-
}
|
|
16701
|
-
var setupCommand3 = new Command86().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
16702
|
-
"-s, --secret <value>",
|
|
16703
|
-
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
16704
|
-
collectSecrets,
|
|
16705
|
-
[]
|
|
16706
|
-
).option(
|
|
16707
|
-
"-a, --auth-method <method>",
|
|
16708
|
-
"Auth method (required for multi-auth providers like aws-bedrock)"
|
|
16709
|
-
).option("-m, --model <model>", "Model selection (for non-interactive mode)").action(
|
|
16710
|
-
withErrorHandler(
|
|
16711
|
-
async (options) => {
|
|
16712
|
-
let input;
|
|
16713
|
-
const secretArgs = options.secret ?? [];
|
|
16714
|
-
if (options.type && secretArgs.length > 0) {
|
|
16715
|
-
input = handleNonInteractiveMode({
|
|
16716
|
-
type: options.type,
|
|
16717
|
-
secret: secretArgs,
|
|
16718
|
-
authMethod: options.authMethod,
|
|
16719
|
-
model: options.model
|
|
16720
|
-
});
|
|
16721
|
-
} else if (options.type || secretArgs.length > 0) {
|
|
16722
|
-
throw new Error("Both --type and --secret are required");
|
|
16723
|
-
} else {
|
|
16724
|
-
const result = await handleInteractiveMode2();
|
|
16725
|
-
if (result === null) {
|
|
16726
|
-
return;
|
|
16727
|
-
}
|
|
16728
|
-
input = result;
|
|
16729
|
-
}
|
|
16730
|
-
if (input.keepExistingSecret) {
|
|
16731
|
-
const provider2 = await updateModelProviderModel(
|
|
16732
|
-
input.type,
|
|
16733
|
-
input.selectedModel
|
|
16734
|
-
);
|
|
16735
|
-
const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
|
|
16736
|
-
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
16737
|
-
if (!hasModelSelection(input.type)) {
|
|
16738
|
-
console.log(
|
|
16739
|
-
chalk75.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
16740
|
-
);
|
|
16741
|
-
} else {
|
|
16742
|
-
console.log(
|
|
16743
|
-
chalk75.green(
|
|
16744
|
-
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
16745
|
-
)
|
|
16746
|
-
);
|
|
16747
|
-
}
|
|
16748
|
-
if (input.isInteractiveMode) {
|
|
16749
|
-
await promptSetAsDefault2(
|
|
16750
|
-
input.type,
|
|
16751
|
-
provider2.framework,
|
|
16752
|
-
provider2.isDefault
|
|
16753
|
-
);
|
|
16754
|
-
}
|
|
16755
|
-
return;
|
|
16756
|
-
}
|
|
16757
|
-
const { provider, created } = await upsertModelProvider({
|
|
16758
|
-
type: input.type,
|
|
16759
|
-
secret: input.secret,
|
|
16760
|
-
authMethod: input.authMethod,
|
|
16761
|
-
secrets: input.secrets,
|
|
16762
|
-
selectedModel: input.selectedModel
|
|
16763
|
-
});
|
|
16764
|
-
const action = created ? "created" : "updated";
|
|
16765
|
-
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
16766
|
-
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
16767
|
-
console.log(
|
|
16768
|
-
chalk75.green(
|
|
16769
|
-
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
16770
|
-
)
|
|
16771
|
-
);
|
|
16772
|
-
if (input.isInteractiveMode) {
|
|
16773
|
-
await promptSetAsDefault2(
|
|
16774
|
-
input.type,
|
|
16775
|
-
provider.framework,
|
|
16776
|
-
provider.isDefault
|
|
16777
|
-
);
|
|
16778
|
-
}
|
|
16779
|
-
}
|
|
16780
|
-
)
|
|
16781
|
-
);
|
|
16782
|
-
|
|
16783
|
-
// src/commands/model-provider/delete.ts
|
|
16784
|
-
import { Command as Command87 } from "commander";
|
|
16785
|
-
import chalk76 from "chalk";
|
|
16786
|
-
var deleteCommand5 = new Command87().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(
|
|
16787
|
-
withErrorHandler(async (type2) => {
|
|
16788
|
-
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
16789
|
-
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
16790
|
-
throw new Error(`Invalid type "${type2}"`, {
|
|
16791
|
-
cause: new Error(`Valid types: ${validTypes}`)
|
|
16792
|
-
});
|
|
16793
|
-
}
|
|
16794
|
-
await deleteModelProvider(type2);
|
|
16795
|
-
console.log(chalk76.green(`\u2713 Model provider "${type2}" deleted`));
|
|
16796
|
-
})
|
|
16797
|
-
);
|
|
16798
|
-
|
|
16799
|
-
// src/commands/model-provider/set-default.ts
|
|
16800
|
-
import { Command as Command88 } from "commander";
|
|
16801
|
-
import chalk77 from "chalk";
|
|
16802
|
-
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(
|
|
16803
|
-
withErrorHandler(async (type2) => {
|
|
16804
|
-
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
16805
|
-
const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(", ");
|
|
16806
|
-
throw new Error(`Invalid type "${type2}"`, {
|
|
16807
|
-
cause: new Error(`Valid types: ${validTypes}`)
|
|
16808
|
-
});
|
|
16809
|
-
}
|
|
16810
|
-
const provider = await setModelProviderDefault(type2);
|
|
16811
|
-
console.log(
|
|
16812
|
-
chalk77.green(
|
|
16813
|
-
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
16814
|
-
)
|
|
16815
|
-
);
|
|
16816
|
-
})
|
|
16817
|
-
);
|
|
16818
|
-
|
|
16819
|
-
// src/commands/model-provider/index.ts
|
|
16820
|
-
var modelProviderCommand2 = new Command89().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand13).addCommand(setupCommand3).addCommand(deleteCommand5).addCommand(setDefaultCommand2);
|
|
16821
|
-
|
|
16822
|
-
// src/commands/connector/index.ts
|
|
16823
|
-
import { Command as Command94 } from "commander";
|
|
16824
|
-
|
|
16825
|
-
// src/commands/connector/connect.ts
|
|
16826
|
-
import { Command as Command90 } from "commander";
|
|
16827
|
-
import chalk79 from "chalk";
|
|
16828
|
-
import { initClient as initClient16 } from "@ts-rest/core";
|
|
16539
|
+
import { initClient as initClient15 } from "@ts-rest/core";
|
|
16829
16540
|
|
|
16830
16541
|
// src/commands/connector/lib/computer/start-services.ts
|
|
16831
16542
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -16833,7 +16544,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16833
16544
|
import { createServer } from "net";
|
|
16834
16545
|
import { homedir as homedir4 } from "os";
|
|
16835
16546
|
import { join as join12 } from "path";
|
|
16836
|
-
import
|
|
16547
|
+
import chalk74 from "chalk";
|
|
16837
16548
|
|
|
16838
16549
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16839
16550
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16907,7 +16618,7 @@ async function checkComputerDependencies() {
|
|
|
16907
16618
|
}
|
|
16908
16619
|
}
|
|
16909
16620
|
async function startComputerServices(credentials) {
|
|
16910
|
-
console.log(
|
|
16621
|
+
console.log(chalk74.cyan("Starting computer connector services..."));
|
|
16911
16622
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16912
16623
|
if (!wsgidavBinary) {
|
|
16913
16624
|
throw new Error(
|
|
@@ -16934,7 +16645,7 @@ async function startComputerServices(credentials) {
|
|
|
16934
16645
|
);
|
|
16935
16646
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16936
16647
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16937
|
-
console.log(
|
|
16648
|
+
console.log(chalk74.green("\u2713 WebDAV server started"));
|
|
16938
16649
|
const chrome = spawn2(
|
|
16939
16650
|
chromeBinary,
|
|
16940
16651
|
[
|
|
@@ -16948,7 +16659,7 @@ async function startComputerServices(credentials) {
|
|
|
16948
16659
|
);
|
|
16949
16660
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16950
16661
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16951
|
-
console.log(
|
|
16662
|
+
console.log(chalk74.green("\u2713 Chrome started"));
|
|
16952
16663
|
try {
|
|
16953
16664
|
await startNgrokTunnels(
|
|
16954
16665
|
credentials.ngrokToken,
|
|
@@ -16957,18 +16668,18 @@ async function startComputerServices(credentials) {
|
|
|
16957
16668
|
cdpPort
|
|
16958
16669
|
);
|
|
16959
16670
|
console.log(
|
|
16960
|
-
|
|
16671
|
+
chalk74.green(
|
|
16961
16672
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16962
16673
|
)
|
|
16963
16674
|
);
|
|
16964
16675
|
console.log();
|
|
16965
|
-
console.log(
|
|
16676
|
+
console.log(chalk74.green("\u2713 Computer connector active"));
|
|
16966
16677
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16967
16678
|
console.log(
|
|
16968
16679
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16969
16680
|
);
|
|
16970
16681
|
console.log();
|
|
16971
|
-
console.log(
|
|
16682
|
+
console.log(chalk74.dim("Press ^C twice to disconnect"));
|
|
16972
16683
|
console.log();
|
|
16973
16684
|
let sigintCount = 0;
|
|
16974
16685
|
await new Promise((resolve2) => {
|
|
@@ -16982,7 +16693,7 @@ async function startComputerServices(credentials) {
|
|
|
16982
16693
|
const onSigint = () => {
|
|
16983
16694
|
sigintCount++;
|
|
16984
16695
|
if (sigintCount === 1) {
|
|
16985
|
-
console.log(
|
|
16696
|
+
console.log(chalk74.dim("\nPress ^C again to disconnect and exit..."));
|
|
16986
16697
|
} else {
|
|
16987
16698
|
done();
|
|
16988
16699
|
}
|
|
@@ -16992,11 +16703,11 @@ async function startComputerServices(credentials) {
|
|
|
16992
16703
|
});
|
|
16993
16704
|
} finally {
|
|
16994
16705
|
console.log();
|
|
16995
|
-
console.log(
|
|
16706
|
+
console.log(chalk74.cyan("Stopping services..."));
|
|
16996
16707
|
wsgidav.kill("SIGTERM");
|
|
16997
16708
|
chrome.kill("SIGTERM");
|
|
16998
16709
|
await stopNgrokTunnels();
|
|
16999
|
-
console.log(
|
|
16710
|
+
console.log(chalk74.green("\u2713 Services stopped"));
|
|
17000
16711
|
}
|
|
17001
16712
|
}
|
|
17002
16713
|
|
|
@@ -17021,10 +16732,10 @@ async function getHeaders2() {
|
|
|
17021
16732
|
function renderHelpText(text) {
|
|
17022
16733
|
return text.replace(
|
|
17023
16734
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
17024
|
-
(_m, label, url) => `${label} (${
|
|
17025
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
16735
|
+
(_m, label, url) => `${label} (${chalk75.cyan(url)})`
|
|
16736
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk75.bold(content)).replace(
|
|
17026
16737
|
/^> (.+)$/gm,
|
|
17027
|
-
(_m, content) =>
|
|
16738
|
+
(_m, content) => chalk75.yellow(` ${content}`)
|
|
17028
16739
|
);
|
|
17029
16740
|
}
|
|
17030
16741
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -17049,7 +16760,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
17049
16760
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
17050
16761
|
if (!secretConfig.required) continue;
|
|
17051
16762
|
const value = await promptPassword(
|
|
17052
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
16763
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk75.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
17053
16764
|
);
|
|
17054
16765
|
if (!value) {
|
|
17055
16766
|
throw new Error("Cancelled");
|
|
@@ -17065,14 +16776,14 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
17065
16776
|
});
|
|
17066
16777
|
}
|
|
17067
16778
|
console.log(
|
|
17068
|
-
|
|
16779
|
+
chalk75.green(`
|
|
17069
16780
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
17070
16781
|
);
|
|
17071
16782
|
}
|
|
17072
16783
|
async function connectComputer(apiUrl, headers) {
|
|
17073
16784
|
await checkComputerDependencies();
|
|
17074
|
-
console.log(
|
|
17075
|
-
const computerClient =
|
|
16785
|
+
console.log(chalk75.cyan("Setting up computer connector..."));
|
|
16786
|
+
const computerClient = initClient15(computerConnectorContract, {
|
|
17076
16787
|
baseUrl: apiUrl,
|
|
17077
16788
|
baseHeaders: headers,
|
|
17078
16789
|
jsonQuery: false
|
|
@@ -17086,9 +16797,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
17086
16797
|
}
|
|
17087
16798
|
const credentials = createResult.body;
|
|
17088
16799
|
await startComputerServices(credentials);
|
|
17089
|
-
console.log(
|
|
16800
|
+
console.log(chalk75.cyan("Disconnecting computer connector..."));
|
|
17090
16801
|
await deleteConnector("computer");
|
|
17091
|
-
console.log(
|
|
16802
|
+
console.log(chalk75.green("\u2713 Disconnected computer"));
|
|
17092
16803
|
process.exit(0);
|
|
17093
16804
|
}
|
|
17094
16805
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -17127,8 +16838,8 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
17127
16838
|
);
|
|
17128
16839
|
}
|
|
17129
16840
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
17130
|
-
console.log(`Connecting ${
|
|
17131
|
-
const sessionsClient =
|
|
16841
|
+
console.log(`Connecting ${chalk75.cyan(connectorType)}...`);
|
|
16842
|
+
const sessionsClient = initClient15(connectorSessionsContract, {
|
|
17132
16843
|
baseUrl: apiUrl,
|
|
17133
16844
|
baseHeaders: headers,
|
|
17134
16845
|
jsonQuery: false
|
|
@@ -17143,15 +16854,15 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
17143
16854
|
}
|
|
17144
16855
|
const session = createResult.body;
|
|
17145
16856
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
17146
|
-
console.log(
|
|
17147
|
-
console.log(
|
|
16857
|
+
console.log(chalk75.green("\nSession created"));
|
|
16858
|
+
console.log(chalk75.cyan(`
|
|
17148
16859
|
To connect, visit: ${verificationUrl}`));
|
|
17149
16860
|
console.log(
|
|
17150
16861
|
`
|
|
17151
16862
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
17152
16863
|
);
|
|
17153
16864
|
console.log("\nWaiting for authorization...");
|
|
17154
|
-
const sessionClient =
|
|
16865
|
+
const sessionClient = initClient15(connectorSessionByIdContract, {
|
|
17155
16866
|
baseUrl: apiUrl,
|
|
17156
16867
|
baseHeaders: headers,
|
|
17157
16868
|
jsonQuery: false
|
|
@@ -17176,7 +16887,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
17176
16887
|
switch (status.status) {
|
|
17177
16888
|
case "complete":
|
|
17178
16889
|
console.log(
|
|
17179
|
-
|
|
16890
|
+
chalk75.green(`
|
|
17180
16891
|
|
|
17181
16892
|
${connectorType} connected successfully!`)
|
|
17182
16893
|
);
|
|
@@ -17188,13 +16899,13 @@ ${connectorType} connected successfully!`)
|
|
|
17188
16899
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
17189
16900
|
);
|
|
17190
16901
|
case "pending":
|
|
17191
|
-
process.stdout.write(
|
|
16902
|
+
process.stdout.write(chalk75.dim("."));
|
|
17192
16903
|
break;
|
|
17193
16904
|
}
|
|
17194
16905
|
}
|
|
17195
16906
|
throw new Error("Session timed out, please try again");
|
|
17196
16907
|
}
|
|
17197
|
-
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(
|
|
17198
16909
|
withErrorHandler(async (type2, options) => {
|
|
17199
16910
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17200
16911
|
if (!parseResult.success) {
|
|
@@ -17219,9 +16930,9 @@ var connectCommand = new Command90().name("connect").description("Connect a thir
|
|
|
17219
16930
|
);
|
|
17220
16931
|
|
|
17221
16932
|
// src/commands/connector/list.ts
|
|
17222
|
-
import { Command as
|
|
17223
|
-
import
|
|
17224
|
-
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(
|
|
17225
16936
|
withErrorHandler(async () => {
|
|
17226
16937
|
const result = await listConnectors();
|
|
17227
16938
|
const connectedMap = new Map(result.connectors.map((c28) => [c28.type, c28]));
|
|
@@ -17243,25 +16954,26 @@ var listCommand14 = new Command91().name("list").alias("ls").description("List a
|
|
|
17243
16954
|
statusText.padEnd(statusWidth),
|
|
17244
16955
|
"ACCOUNT"
|
|
17245
16956
|
].join(" ");
|
|
17246
|
-
console.log(
|
|
16957
|
+
console.log(chalk76.dim(header));
|
|
17247
16958
|
for (const type2 of allTypes) {
|
|
17248
16959
|
const connector = connectedMap.get(type2);
|
|
17249
|
-
const
|
|
17250
|
-
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("-");
|
|
17251
16963
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
17252
16964
|
console.log(row);
|
|
17253
16965
|
}
|
|
17254
16966
|
console.log();
|
|
17255
|
-
console.log(
|
|
17256
|
-
console.log(
|
|
16967
|
+
console.log(chalk76.dim("To connect a service:"));
|
|
16968
|
+
console.log(chalk76.dim(" vm0 connector connect <type>"));
|
|
17257
16969
|
})
|
|
17258
16970
|
);
|
|
17259
16971
|
|
|
17260
16972
|
// src/commands/connector/status.ts
|
|
17261
|
-
import { Command as
|
|
17262
|
-
import
|
|
16973
|
+
import { Command as Command87 } from "commander";
|
|
16974
|
+
import chalk77 from "chalk";
|
|
17263
16975
|
var LABEL_WIDTH = 16;
|
|
17264
|
-
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(
|
|
17265
16977
|
withErrorHandler(async (type2) => {
|
|
17266
16978
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17267
16979
|
if (!parseResult.success) {
|
|
@@ -17271,11 +16983,11 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17271
16983
|
});
|
|
17272
16984
|
}
|
|
17273
16985
|
const connector = await getConnector(parseResult.data);
|
|
17274
|
-
console.log(`Connector: ${
|
|
16986
|
+
console.log(`Connector: ${chalk77.cyan(type2)}`);
|
|
17275
16987
|
console.log();
|
|
17276
16988
|
if (connector) {
|
|
17277
16989
|
console.log(
|
|
17278
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
16990
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk77.green("connected")}`
|
|
17279
16991
|
);
|
|
17280
16992
|
console.log(
|
|
17281
16993
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -17288,6 +17000,22 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17288
17000
|
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
17289
17001
|
);
|
|
17290
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
|
+
}
|
|
17291
17019
|
console.log(
|
|
17292
17020
|
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
17293
17021
|
);
|
|
@@ -17297,23 +17025,23 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17297
17025
|
);
|
|
17298
17026
|
}
|
|
17299
17027
|
console.log();
|
|
17300
|
-
console.log(
|
|
17301
|
-
console.log(
|
|
17028
|
+
console.log(chalk77.dim("To disconnect:"));
|
|
17029
|
+
console.log(chalk77.dim(` vm0 connector disconnect ${type2}`));
|
|
17302
17030
|
} else {
|
|
17303
17031
|
console.log(
|
|
17304
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17032
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk77.dim("not connected")}`
|
|
17305
17033
|
);
|
|
17306
17034
|
console.log();
|
|
17307
|
-
console.log(
|
|
17308
|
-
console.log(
|
|
17035
|
+
console.log(chalk77.dim("To connect:"));
|
|
17036
|
+
console.log(chalk77.dim(` vm0 connector connect ${type2}`));
|
|
17309
17037
|
}
|
|
17310
17038
|
})
|
|
17311
17039
|
);
|
|
17312
17040
|
|
|
17313
17041
|
// src/commands/connector/disconnect.ts
|
|
17314
|
-
import { Command as
|
|
17315
|
-
import
|
|
17316
|
-
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(
|
|
17317
17045
|
withErrorHandler(async (type2) => {
|
|
17318
17046
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17319
17047
|
if (!parseResult.success) {
|
|
@@ -17324,33 +17052,33 @@ var disconnectCommand = new Command93().name("disconnect").description("Disconne
|
|
|
17324
17052
|
}
|
|
17325
17053
|
const connectorType = parseResult.data;
|
|
17326
17054
|
await deleteConnector(connectorType);
|
|
17327
|
-
console.log(
|
|
17055
|
+
console.log(chalk78.green(`\u2713 Disconnected ${type2}`));
|
|
17328
17056
|
})
|
|
17329
17057
|
);
|
|
17330
17058
|
|
|
17331
17059
|
// src/commands/connector/index.ts
|
|
17332
|
-
var connectorCommand = new
|
|
17060
|
+
var connectorCommand = new Command89().name("connector").description("Manage third-party service connections").addCommand(listCommand13).addCommand(statusCommand8).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
17333
17061
|
|
|
17334
17062
|
// src/commands/onboard/index.ts
|
|
17335
|
-
import { Command as
|
|
17336
|
-
import
|
|
17063
|
+
import { Command as Command90 } from "commander";
|
|
17064
|
+
import chalk82 from "chalk";
|
|
17337
17065
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
17338
17066
|
import { existsSync as existsSync12 } from "fs";
|
|
17339
17067
|
|
|
17340
17068
|
// src/lib/ui/welcome-box.ts
|
|
17341
|
-
import
|
|
17069
|
+
import chalk79 from "chalk";
|
|
17342
17070
|
var gradientColors = [
|
|
17343
|
-
|
|
17071
|
+
chalk79.hex("#FFAB5E"),
|
|
17344
17072
|
// Line 1 - lightest
|
|
17345
|
-
|
|
17073
|
+
chalk79.hex("#FF9642"),
|
|
17346
17074
|
// Line 2
|
|
17347
|
-
|
|
17075
|
+
chalk79.hex("#FF8228"),
|
|
17348
17076
|
// Line 3
|
|
17349
|
-
|
|
17077
|
+
chalk79.hex("#FF6D0A"),
|
|
17350
17078
|
// Line 4
|
|
17351
|
-
|
|
17079
|
+
chalk79.hex("#E85D00"),
|
|
17352
17080
|
// Line 5
|
|
17353
|
-
|
|
17081
|
+
chalk79.hex("#CC4E00")
|
|
17354
17082
|
// Line 6 - darkest
|
|
17355
17083
|
];
|
|
17356
17084
|
var vm0LogoLines = [
|
|
@@ -17372,15 +17100,15 @@ function renderVm0Banner() {
|
|
|
17372
17100
|
function renderOnboardWelcome() {
|
|
17373
17101
|
renderVm0Banner();
|
|
17374
17102
|
console.log(` Build agentic workflows using natural language.`);
|
|
17375
|
-
console.log(` ${
|
|
17103
|
+
console.log(` ${chalk79.dim("Currently in beta, enjoy it free")}`);
|
|
17376
17104
|
console.log(
|
|
17377
|
-
` ${
|
|
17105
|
+
` ${chalk79.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
17378
17106
|
);
|
|
17379
17107
|
console.log();
|
|
17380
17108
|
}
|
|
17381
17109
|
|
|
17382
17110
|
// src/lib/ui/step-runner.ts
|
|
17383
|
-
import
|
|
17111
|
+
import chalk80 from "chalk";
|
|
17384
17112
|
function createStepRunner(options = true) {
|
|
17385
17113
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
17386
17114
|
const interactive = opts.interactive ?? true;
|
|
@@ -17395,25 +17123,25 @@ function createStepRunner(options = true) {
|
|
|
17395
17123
|
}
|
|
17396
17124
|
for (const [i, step] of completedSteps.entries()) {
|
|
17397
17125
|
if (step.failed) {
|
|
17398
|
-
console.log(
|
|
17126
|
+
console.log(chalk80.red(`\u2717 ${step.label}`));
|
|
17399
17127
|
} else {
|
|
17400
|
-
console.log(
|
|
17128
|
+
console.log(chalk80.green(`\u25CF ${step.label}`));
|
|
17401
17129
|
}
|
|
17402
17130
|
const isLastStep = i === completedSteps.length - 1;
|
|
17403
17131
|
if (!isLastStep || !isFinal) {
|
|
17404
|
-
console.log(
|
|
17132
|
+
console.log(chalk80.dim("\u2502"));
|
|
17405
17133
|
}
|
|
17406
17134
|
}
|
|
17407
17135
|
}
|
|
17408
17136
|
async function executeStep(label, fn, isFinal) {
|
|
17409
17137
|
let stepFailed = false;
|
|
17410
|
-
console.log(
|
|
17138
|
+
console.log(chalk80.yellow(`\u25CB ${label}`));
|
|
17411
17139
|
const ctx = {
|
|
17412
17140
|
connector() {
|
|
17413
|
-
console.log(
|
|
17141
|
+
console.log(chalk80.dim("\u2502"));
|
|
17414
17142
|
},
|
|
17415
17143
|
detail(message) {
|
|
17416
|
-
console.log(`${
|
|
17144
|
+
console.log(`${chalk80.dim("\u2502")} ${message}`);
|
|
17417
17145
|
},
|
|
17418
17146
|
async prompt(promptFn) {
|
|
17419
17147
|
return await promptFn();
|
|
@@ -17430,12 +17158,12 @@ function createStepRunner(options = true) {
|
|
|
17430
17158
|
redrawCompletedSteps(isFinal);
|
|
17431
17159
|
} else {
|
|
17432
17160
|
if (stepFailed) {
|
|
17433
|
-
console.log(
|
|
17161
|
+
console.log(chalk80.red(`\u2717 ${label}`));
|
|
17434
17162
|
} else {
|
|
17435
|
-
console.log(
|
|
17163
|
+
console.log(chalk80.green(`\u25CF ${label}`));
|
|
17436
17164
|
}
|
|
17437
17165
|
if (!isFinal) {
|
|
17438
|
-
console.log(
|
|
17166
|
+
console.log(chalk80.dim("\u2502"));
|
|
17439
17167
|
}
|
|
17440
17168
|
}
|
|
17441
17169
|
}
|
|
@@ -17559,8 +17287,12 @@ var ONBOARD_PROVIDER_TYPES = [
|
|
|
17559
17287
|
"minimax-api-key",
|
|
17560
17288
|
"deepseek-api-key"
|
|
17561
17289
|
];
|
|
17290
|
+
async function checkIsOrgAdmin() {
|
|
17291
|
+
const org = await getOrg();
|
|
17292
|
+
return org.role === "admin";
|
|
17293
|
+
}
|
|
17562
17294
|
async function checkModelProviderStatus() {
|
|
17563
|
-
const response = await
|
|
17295
|
+
const response = await listOrgModelProviders();
|
|
17564
17296
|
return {
|
|
17565
17297
|
hasProvider: response.modelProviders.length > 0,
|
|
17566
17298
|
providers: response.modelProviders
|
|
@@ -17580,7 +17312,7 @@ function getProviderChoices() {
|
|
|
17580
17312
|
});
|
|
17581
17313
|
}
|
|
17582
17314
|
async function setupModelProvider(type2, secret, options) {
|
|
17583
|
-
const response = await
|
|
17315
|
+
const response = await upsertOrgModelProvider({
|
|
17584
17316
|
type: type2,
|
|
17585
17317
|
secret,
|
|
17586
17318
|
selectedModel: options?.selectedModel
|
|
@@ -17595,7 +17327,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
17595
17327
|
|
|
17596
17328
|
// src/lib/domain/onboard/claude-setup.ts
|
|
17597
17329
|
import { spawn as spawn3 } from "child_process";
|
|
17598
|
-
import
|
|
17330
|
+
import chalk81 from "chalk";
|
|
17599
17331
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
17600
17332
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
17601
17333
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17632,12 +17364,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17632
17364
|
}
|
|
17633
17365
|
function handlePluginError(error, context) {
|
|
17634
17366
|
const displayContext = context ?? "Claude plugin";
|
|
17635
|
-
console.error(
|
|
17367
|
+
console.error(chalk81.red(`\u2717 Failed to install ${displayContext}`));
|
|
17636
17368
|
if (error instanceof Error) {
|
|
17637
|
-
console.error(
|
|
17369
|
+
console.error(chalk81.red(`\u2717 ${error.message}`));
|
|
17638
17370
|
}
|
|
17639
17371
|
console.error(
|
|
17640
|
-
|
|
17372
|
+
chalk81.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17641
17373
|
);
|
|
17642
17374
|
process.exit(1);
|
|
17643
17375
|
}
|
|
@@ -17680,7 +17412,7 @@ async function updateMarketplace() {
|
|
|
17680
17412
|
]);
|
|
17681
17413
|
if (!result.success) {
|
|
17682
17414
|
console.warn(
|
|
17683
|
-
|
|
17415
|
+
chalk81.yellow(
|
|
17684
17416
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17685
17417
|
)
|
|
17686
17418
|
);
|
|
@@ -17726,9 +17458,9 @@ async function handleAuthentication(ctx) {
|
|
|
17726
17458
|
onInitiating: () => {
|
|
17727
17459
|
},
|
|
17728
17460
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17729
|
-
step.detail(`Copy code: ${
|
|
17730
|
-
step.detail(`Open: ${
|
|
17731
|
-
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`));
|
|
17732
17464
|
},
|
|
17733
17465
|
onPolling: () => {
|
|
17734
17466
|
},
|
|
@@ -17746,9 +17478,17 @@ async function handleModelProvider(ctx) {
|
|
|
17746
17478
|
if (providerStatus.hasProvider) {
|
|
17747
17479
|
return;
|
|
17748
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
|
+
}
|
|
17749
17489
|
if (!ctx.interactive) {
|
|
17750
17490
|
throw new Error("No model provider configured", {
|
|
17751
|
-
cause: new Error("Run 'vm0 model-provider setup' first")
|
|
17491
|
+
cause: new Error("Run 'vm0 org model-provider setup' first")
|
|
17752
17492
|
});
|
|
17753
17493
|
}
|
|
17754
17494
|
const choices = getProviderChoices();
|
|
@@ -17768,14 +17508,14 @@ async function handleModelProvider(ctx) {
|
|
|
17768
17508
|
const selectedChoice = choices.find((c28) => c28.type === providerType);
|
|
17769
17509
|
if (selectedChoice?.helpText) {
|
|
17770
17510
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17771
|
-
step.detail(
|
|
17511
|
+
step.detail(chalk82.dim(line));
|
|
17772
17512
|
}
|
|
17773
17513
|
}
|
|
17774
17514
|
const secret = await step.prompt(
|
|
17775
17515
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17776
17516
|
);
|
|
17777
17517
|
if (!secret) {
|
|
17778
|
-
console.log(
|
|
17518
|
+
console.log(chalk82.dim("Cancelled"));
|
|
17779
17519
|
process.exit(0);
|
|
17780
17520
|
}
|
|
17781
17521
|
let selectedModel;
|
|
@@ -17794,7 +17534,7 @@ async function handleModelProvider(ctx) {
|
|
|
17794
17534
|
() => promptSelect("Select model:", modelChoices)
|
|
17795
17535
|
);
|
|
17796
17536
|
if (modelSelection === void 0) {
|
|
17797
|
-
console.log(
|
|
17537
|
+
console.log(chalk82.dim("Cancelled"));
|
|
17798
17538
|
process.exit(0);
|
|
17799
17539
|
}
|
|
17800
17540
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17804,7 +17544,7 @@ async function handleModelProvider(ctx) {
|
|
|
17804
17544
|
});
|
|
17805
17545
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17806
17546
|
step.detail(
|
|
17807
|
-
|
|
17547
|
+
chalk82.green(
|
|
17808
17548
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17809
17549
|
)
|
|
17810
17550
|
);
|
|
@@ -17835,7 +17575,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17835
17575
|
agentName = inputName;
|
|
17836
17576
|
if (existsSync12(agentName)) {
|
|
17837
17577
|
step.detail(
|
|
17838
|
-
|
|
17578
|
+
chalk82.yellow(`${agentName}/ already exists, choose another name`)
|
|
17839
17579
|
);
|
|
17840
17580
|
} else {
|
|
17841
17581
|
folderExists = false;
|
|
@@ -17856,7 +17596,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17856
17596
|
}
|
|
17857
17597
|
}
|
|
17858
17598
|
await mkdir8(agentName, { recursive: true });
|
|
17859
|
-
step.detail(
|
|
17599
|
+
step.detail(chalk82.green(`Created ${agentName}/`));
|
|
17860
17600
|
});
|
|
17861
17601
|
return agentName;
|
|
17862
17602
|
}
|
|
@@ -17872,7 +17612,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17872
17612
|
shouldInstall = confirmed ?? true;
|
|
17873
17613
|
}
|
|
17874
17614
|
if (!shouldInstall) {
|
|
17875
|
-
step.detail(
|
|
17615
|
+
step.detail(chalk82.dim("Skipped"));
|
|
17876
17616
|
return;
|
|
17877
17617
|
}
|
|
17878
17618
|
const scope = "project";
|
|
@@ -17880,7 +17620,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17880
17620
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17881
17621
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17882
17622
|
step.detail(
|
|
17883
|
-
|
|
17623
|
+
chalk82.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17884
17624
|
);
|
|
17885
17625
|
pluginInstalled = true;
|
|
17886
17626
|
} catch (error) {
|
|
@@ -17891,18 +17631,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17891
17631
|
}
|
|
17892
17632
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17893
17633
|
console.log();
|
|
17894
|
-
console.log(
|
|
17634
|
+
console.log(chalk82.bold("Next step:"));
|
|
17895
17635
|
console.log();
|
|
17896
17636
|
if (pluginInstalled) {
|
|
17897
17637
|
console.log(
|
|
17898
|
-
` ${
|
|
17638
|
+
` ${chalk82.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17899
17639
|
);
|
|
17900
17640
|
} else {
|
|
17901
|
-
console.log(` ${
|
|
17641
|
+
console.log(` ${chalk82.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17902
17642
|
}
|
|
17903
17643
|
console.log();
|
|
17904
17644
|
}
|
|
17905
|
-
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(
|
|
17906
17646
|
withErrorHandler(async (options) => {
|
|
17907
17647
|
const interactive = isInteractive();
|
|
17908
17648
|
if (interactive) {
|
|
@@ -17927,21 +17667,21 @@ var onboardCommand = new Command95().name("onboard").description("Guided setup f
|
|
|
17927
17667
|
);
|
|
17928
17668
|
|
|
17929
17669
|
// src/commands/setup-claude/index.ts
|
|
17930
|
-
import { Command as
|
|
17931
|
-
import
|
|
17932
|
-
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(
|
|
17933
17673
|
withErrorHandler(async (options) => {
|
|
17934
|
-
console.log(
|
|
17674
|
+
console.log(chalk83.dim("Installing VM0 Claude Plugin..."));
|
|
17935
17675
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17936
17676
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17937
17677
|
console.log(
|
|
17938
|
-
|
|
17678
|
+
chalk83.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17939
17679
|
);
|
|
17940
17680
|
console.log();
|
|
17941
17681
|
console.log("Next step:");
|
|
17942
17682
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17943
17683
|
console.log(
|
|
17944
|
-
|
|
17684
|
+
chalk83.cyan(
|
|
17945
17685
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17946
17686
|
)
|
|
17947
17687
|
);
|
|
@@ -17949,36 +17689,36 @@ var setupClaudeCommand = new Command96().name("setup-claude").description("Insta
|
|
|
17949
17689
|
);
|
|
17950
17690
|
|
|
17951
17691
|
// src/commands/dashboard/index.ts
|
|
17952
|
-
import { Command as
|
|
17953
|
-
import
|
|
17954
|
-
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(() => {
|
|
17955
17695
|
console.log();
|
|
17956
|
-
console.log(
|
|
17696
|
+
console.log(chalk84.bold("VM0 Dashboard"));
|
|
17957
17697
|
console.log();
|
|
17958
|
-
console.log(
|
|
17959
|
-
console.log(
|
|
17698
|
+
console.log(chalk84.bold("Agents"));
|
|
17699
|
+
console.log(chalk84.dim(" List agents: ") + "vm0 agent list");
|
|
17960
17700
|
console.log();
|
|
17961
|
-
console.log(
|
|
17962
|
-
console.log(
|
|
17963
|
-
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>");
|
|
17964
17704
|
console.log();
|
|
17965
|
-
console.log(
|
|
17966
|
-
console.log(
|
|
17705
|
+
console.log(chalk84.bold("Schedules"));
|
|
17706
|
+
console.log(chalk84.dim(" List schedules: ") + "vm0 schedule list");
|
|
17967
17707
|
console.log();
|
|
17968
|
-
console.log(
|
|
17969
|
-
console.log(
|
|
17970
|
-
console.log(
|
|
17971
|
-
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");
|
|
17972
17712
|
console.log();
|
|
17973
17713
|
console.log(
|
|
17974
|
-
|
|
17714
|
+
chalk84.dim("Not logged in? Run: ") + chalk84.cyan("vm0 auth login")
|
|
17975
17715
|
);
|
|
17976
17716
|
console.log();
|
|
17977
17717
|
});
|
|
17978
17718
|
|
|
17979
17719
|
// src/commands/preference/index.ts
|
|
17980
|
-
import { Command as
|
|
17981
|
-
import
|
|
17720
|
+
import { Command as Command93 } from "commander";
|
|
17721
|
+
import chalk85 from "chalk";
|
|
17982
17722
|
function detectTimezone2() {
|
|
17983
17723
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17984
17724
|
}
|
|
@@ -17999,15 +17739,15 @@ function parseOnOff(flag, value) {
|
|
|
17999
17739
|
);
|
|
18000
17740
|
}
|
|
18001
17741
|
function displayPreferences(prefs) {
|
|
18002
|
-
console.log(
|
|
17742
|
+
console.log(chalk85.bold("Current preferences:"));
|
|
18003
17743
|
console.log(
|
|
18004
|
-
` Timezone: ${prefs.timezone ?
|
|
17744
|
+
` Timezone: ${prefs.timezone ? chalk85.cyan(prefs.timezone) : chalk85.dim("not set")}`
|
|
18005
17745
|
);
|
|
18006
17746
|
console.log(
|
|
18007
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17747
|
+
` Email notify: ${prefs.notifyEmail ? chalk85.green("on") : chalk85.dim("off")}`
|
|
18008
17748
|
);
|
|
18009
17749
|
console.log(
|
|
18010
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17750
|
+
` Slack notify: ${prefs.notifySlack ? chalk85.green("on") : chalk85.dim("off")}`
|
|
18011
17751
|
);
|
|
18012
17752
|
}
|
|
18013
17753
|
function buildUpdates(opts) {
|
|
@@ -18037,21 +17777,21 @@ function buildUpdates(opts) {
|
|
|
18037
17777
|
function printUpdateResult(updates, result) {
|
|
18038
17778
|
if (updates.timezone !== void 0) {
|
|
18039
17779
|
console.log(
|
|
18040
|
-
|
|
18041
|
-
`Timezone set to ${
|
|
17780
|
+
chalk85.green(
|
|
17781
|
+
`Timezone set to ${chalk85.cyan(result.timezone ?? updates.timezone)}`
|
|
18042
17782
|
)
|
|
18043
17783
|
);
|
|
18044
17784
|
}
|
|
18045
17785
|
if (updates.notifyEmail !== void 0) {
|
|
18046
17786
|
console.log(
|
|
18047
|
-
|
|
17787
|
+
chalk85.green(
|
|
18048
17788
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
18049
17789
|
)
|
|
18050
17790
|
);
|
|
18051
17791
|
}
|
|
18052
17792
|
if (updates.notifySlack !== void 0) {
|
|
18053
17793
|
console.log(
|
|
18054
|
-
|
|
17794
|
+
chalk85.green(
|
|
18055
17795
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
18056
17796
|
)
|
|
18057
17797
|
);
|
|
@@ -18060,7 +17800,7 @@ function printUpdateResult(updates, result) {
|
|
|
18060
17800
|
async function interactiveSetup(prefs) {
|
|
18061
17801
|
if (!prefs.timezone) {
|
|
18062
17802
|
const detectedTz = detectTimezone2();
|
|
18063
|
-
console.log(
|
|
17803
|
+
console.log(chalk85.dim(`
|
|
18064
17804
|
System timezone detected: ${detectedTz}`));
|
|
18065
17805
|
const tz = await promptText(
|
|
18066
17806
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -18071,7 +17811,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
18071
17811
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
18072
17812
|
}
|
|
18073
17813
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
18074
|
-
console.log(
|
|
17814
|
+
console.log(chalk85.green(`Timezone set to ${chalk85.cyan(tz.trim())}`));
|
|
18075
17815
|
}
|
|
18076
17816
|
}
|
|
18077
17817
|
if (!prefs.notifyEmail) {
|
|
@@ -18081,11 +17821,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
18081
17821
|
);
|
|
18082
17822
|
if (enable) {
|
|
18083
17823
|
await updateUserPreferences({ notifyEmail: true });
|
|
18084
|
-
console.log(
|
|
17824
|
+
console.log(chalk85.green("Email notifications enabled"));
|
|
18085
17825
|
}
|
|
18086
17826
|
}
|
|
18087
17827
|
}
|
|
18088
|
-
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(
|
|
18089
17829
|
withErrorHandler(async (opts) => {
|
|
18090
17830
|
const updates = buildUpdates(opts);
|
|
18091
17831
|
if (updates) {
|
|
@@ -18100,32 +17840,32 @@ var preferenceCommand = new Command98().name("preference").description("View or
|
|
|
18100
17840
|
} else if (!prefs.timezone) {
|
|
18101
17841
|
console.log();
|
|
18102
17842
|
console.log(
|
|
18103
|
-
`To set timezone: ${
|
|
17843
|
+
`To set timezone: ${chalk85.cyan("vm0 preference --timezone <timezone>")}`
|
|
18104
17844
|
);
|
|
18105
17845
|
console.log(
|
|
18106
|
-
|
|
17846
|
+
chalk85.dim("Example: vm0 preference --timezone America/New_York")
|
|
18107
17847
|
);
|
|
18108
17848
|
}
|
|
18109
17849
|
})
|
|
18110
17850
|
);
|
|
18111
17851
|
|
|
18112
17852
|
// src/commands/upgrade/index.ts
|
|
18113
|
-
import { Command as
|
|
18114
|
-
import
|
|
18115
|
-
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(
|
|
18116
17856
|
withErrorHandler(async () => {
|
|
18117
17857
|
console.log("Checking for updates...");
|
|
18118
17858
|
const latestVersion = await getLatestVersion();
|
|
18119
17859
|
if (latestVersion === null) {
|
|
18120
17860
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18121
17861
|
}
|
|
18122
|
-
if (latestVersion === "9.
|
|
18123
|
-
console.log(
|
|
17862
|
+
if (latestVersion === "9.65.0") {
|
|
17863
|
+
console.log(chalk86.green(`\u2713 Already up to date (${"9.65.0"})`));
|
|
18124
17864
|
return;
|
|
18125
17865
|
}
|
|
18126
17866
|
console.log(
|
|
18127
|
-
|
|
18128
|
-
`Current version: ${"9.
|
|
17867
|
+
chalk86.yellow(
|
|
17868
|
+
`Current version: ${"9.65.0"} -> Latest version: ${latestVersion}`
|
|
18129
17869
|
)
|
|
18130
17870
|
);
|
|
18131
17871
|
console.log();
|
|
@@ -18133,26 +17873,26 @@ var upgradeCommand = new Command99().name("upgrade").description("Upgrade vm0 CL
|
|
|
18133
17873
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
18134
17874
|
if (packageManager === "unknown") {
|
|
18135
17875
|
console.log(
|
|
18136
|
-
|
|
17876
|
+
chalk86.yellow(
|
|
18137
17877
|
"Could not detect your package manager for auto-upgrade."
|
|
18138
17878
|
)
|
|
18139
17879
|
);
|
|
18140
17880
|
} else {
|
|
18141
17881
|
console.log(
|
|
18142
|
-
|
|
17882
|
+
chalk86.yellow(
|
|
18143
17883
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
18144
17884
|
)
|
|
18145
17885
|
);
|
|
18146
17886
|
}
|
|
18147
|
-
console.log(
|
|
18148
|
-
console.log(
|
|
17887
|
+
console.log(chalk86.yellow("Please upgrade manually:"));
|
|
17888
|
+
console.log(chalk86.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
18149
17889
|
return;
|
|
18150
17890
|
}
|
|
18151
17891
|
console.log(`Upgrading via ${packageManager}...`);
|
|
18152
17892
|
const success = await performUpgrade(packageManager);
|
|
18153
17893
|
if (success) {
|
|
18154
17894
|
console.log(
|
|
18155
|
-
|
|
17895
|
+
chalk86.green(`\u2713 Upgraded from ${"9.65.0"} to ${latestVersion}`)
|
|
18156
17896
|
);
|
|
18157
17897
|
return;
|
|
18158
17898
|
}
|
|
@@ -18165,8 +17905,8 @@ var upgradeCommand = new Command99().name("upgrade").description("Upgrade vm0 CL
|
|
|
18165
17905
|
);
|
|
18166
17906
|
|
|
18167
17907
|
// src/index.ts
|
|
18168
|
-
var program = new
|
|
18169
|
-
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");
|
|
18170
17910
|
program.addCommand(authCommand);
|
|
18171
17911
|
program.addCommand(infoCommand);
|
|
18172
17912
|
program.addCommand(composeCommand);
|
|
@@ -18183,7 +17923,6 @@ program.addCommand(scheduleCommand);
|
|
|
18183
17923
|
program.addCommand(usageCommand);
|
|
18184
17924
|
program.addCommand(secretCommand);
|
|
18185
17925
|
program.addCommand(variableCommand);
|
|
18186
|
-
program.addCommand(modelProviderCommand2);
|
|
18187
17926
|
program.addCommand(connectorCommand);
|
|
18188
17927
|
program.addCommand(onboardCommand);
|
|
18189
17928
|
program.addCommand(setupClaudeCommand);
|