@vm0/cli 9.64.2 → 9.65.1
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 +328 -592
- 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.1",
|
|
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.1",
|
|
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.1"}`));
|
|
679
679
|
console.log();
|
|
680
680
|
const config = await loadConfig();
|
|
681
681
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1291,7 +1291,8 @@ var orgDefaultAgentContract = c3.router({
|
|
|
1291
1291
|
400: apiErrorSchema,
|
|
1292
1292
|
401: apiErrorSchema,
|
|
1293
1293
|
403: apiErrorSchema,
|
|
1294
|
-
404: apiErrorSchema
|
|
1294
|
+
404: apiErrorSchema,
|
|
1295
|
+
409: apiErrorSchema
|
|
1295
1296
|
},
|
|
1296
1297
|
summary: "Set or unset the default agent for an org"
|
|
1297
1298
|
}
|
|
@@ -1720,9 +1721,22 @@ var logsSearchContract = c4.router({
|
|
|
1720
1721
|
var queueEntrySchema = z7.object({
|
|
1721
1722
|
position: z7.number(),
|
|
1722
1723
|
agentName: z7.string().nullable(),
|
|
1724
|
+
agentDisplayName: z7.string().nullable(),
|
|
1723
1725
|
userEmail: z7.string().nullable(),
|
|
1724
1726
|
createdAt: z7.string(),
|
|
1725
|
-
|
|
1727
|
+
isOwner: z7.boolean(),
|
|
1728
|
+
runId: z7.string().nullable(),
|
|
1729
|
+
prompt: z7.string().nullable(),
|
|
1730
|
+
triggerSource: z7.enum(["schedule", "chat", "api"]).nullable(),
|
|
1731
|
+
sessionLink: z7.string().nullable()
|
|
1732
|
+
});
|
|
1733
|
+
var runningTaskSchema = z7.object({
|
|
1734
|
+
runId: z7.string().nullable(),
|
|
1735
|
+
agentName: z7.string(),
|
|
1736
|
+
agentDisplayName: z7.string().nullable(),
|
|
1737
|
+
userEmail: z7.string(),
|
|
1738
|
+
startedAt: z7.string().nullable(),
|
|
1739
|
+
isOwner: z7.boolean()
|
|
1726
1740
|
});
|
|
1727
1741
|
var concurrencyInfoSchema = z7.object({
|
|
1728
1742
|
tier: orgTierSchema,
|
|
@@ -1732,7 +1746,9 @@ var concurrencyInfoSchema = z7.object({
|
|
|
1732
1746
|
});
|
|
1733
1747
|
var queueResponseSchema = z7.object({
|
|
1734
1748
|
concurrency: concurrencyInfoSchema,
|
|
1735
|
-
queue: z7.array(queueEntrySchema)
|
|
1749
|
+
queue: z7.array(queueEntrySchema),
|
|
1750
|
+
runningTasks: z7.array(runningTaskSchema),
|
|
1751
|
+
estimatedTimePerRun: z7.number().nullable()
|
|
1736
1752
|
});
|
|
1737
1753
|
var runsQueueContract = c4.router({
|
|
1738
1754
|
/**
|
|
@@ -3493,7 +3509,7 @@ var deployScheduleRequestSchema = z19.object({
|
|
|
3493
3509
|
intervalSeconds: z19.number().int().min(0).optional(),
|
|
3494
3510
|
timezone: z19.string().default("UTC"),
|
|
3495
3511
|
prompt: z19.string().min(1, "Prompt required"),
|
|
3496
|
-
// vars and secrets removed - now managed via
|
|
3512
|
+
// vars and secrets removed - now managed via server-side tables
|
|
3497
3513
|
artifactName: z19.string().optional(),
|
|
3498
3514
|
artifactVersion: z19.string().optional(),
|
|
3499
3515
|
volumeVersions: z19.record(z19.string(), z19.string()).optional(),
|
|
@@ -3761,23 +3777,19 @@ var runnerRealtimeTokenContract = c17.router({
|
|
|
3761
3777
|
}
|
|
3762
3778
|
});
|
|
3763
3779
|
|
|
3764
|
-
// ../../packages/core/src/contracts/
|
|
3780
|
+
// ../../packages/core/src/contracts/logs.ts
|
|
3765
3781
|
import { z as z21 } from "zod";
|
|
3766
3782
|
var paginationSchema = z21.object({
|
|
3767
3783
|
hasMore: z21.boolean(),
|
|
3768
|
-
nextCursor: z21.string().nullable()
|
|
3784
|
+
nextCursor: z21.string().nullable(),
|
|
3785
|
+
totalPages: z21.number()
|
|
3769
3786
|
});
|
|
3770
3787
|
var listQuerySchema = z21.object({
|
|
3771
3788
|
cursor: z21.string().optional(),
|
|
3772
3789
|
limit: z21.coerce.number().min(1).max(100).default(20)
|
|
3773
3790
|
});
|
|
3774
3791
|
var c18 = initContract();
|
|
3775
|
-
var
|
|
3776
|
-
hasMore: z21.boolean(),
|
|
3777
|
-
nextCursor: z21.string().nullable(),
|
|
3778
|
-
totalPages: z21.number()
|
|
3779
|
-
});
|
|
3780
|
-
var platformLogStatusSchema = z21.enum([
|
|
3792
|
+
var logStatusSchema = z21.enum([
|
|
3781
3793
|
"queued",
|
|
3782
3794
|
"pending",
|
|
3783
3795
|
"running",
|
|
@@ -3786,33 +3798,33 @@ var platformLogStatusSchema = z21.enum([
|
|
|
3786
3798
|
"timeout",
|
|
3787
3799
|
"cancelled"
|
|
3788
3800
|
]);
|
|
3789
|
-
var
|
|
3801
|
+
var logEntrySchema = z21.object({
|
|
3790
3802
|
id: z21.uuid(),
|
|
3791
3803
|
sessionId: z21.string().nullable(),
|
|
3792
3804
|
agentName: z21.string(),
|
|
3793
3805
|
displayName: z21.string().nullable(),
|
|
3794
3806
|
orgSlug: z21.string().nullable(),
|
|
3795
3807
|
framework: z21.string().nullable(),
|
|
3796
|
-
status:
|
|
3808
|
+
status: logStatusSchema,
|
|
3797
3809
|
createdAt: z21.string(),
|
|
3798
3810
|
startedAt: z21.string().nullable(),
|
|
3799
3811
|
completedAt: z21.string().nullable()
|
|
3800
3812
|
});
|
|
3801
|
-
var
|
|
3802
|
-
data: z21.array(
|
|
3803
|
-
pagination:
|
|
3813
|
+
var logsListResponseSchema = z21.object({
|
|
3814
|
+
data: z21.array(logEntrySchema),
|
|
3815
|
+
pagination: paginationSchema
|
|
3804
3816
|
});
|
|
3805
3817
|
var artifactSchema = z21.object({
|
|
3806
3818
|
name: z21.string().nullable(),
|
|
3807
3819
|
version: z21.string().nullable()
|
|
3808
3820
|
});
|
|
3809
|
-
var
|
|
3821
|
+
var logDetailSchema = z21.object({
|
|
3810
3822
|
id: z21.uuid(),
|
|
3811
3823
|
sessionId: z21.string().nullable(),
|
|
3812
3824
|
agentName: z21.string(),
|
|
3813
3825
|
displayName: z21.string().nullable(),
|
|
3814
3826
|
framework: z21.string().nullable(),
|
|
3815
|
-
status:
|
|
3827
|
+
status: logStatusSchema,
|
|
3816
3828
|
prompt: z21.string(),
|
|
3817
3829
|
error: z21.string().nullable(),
|
|
3818
3830
|
createdAt: z21.string(),
|
|
@@ -3820,7 +3832,7 @@ var platformLogDetailSchema = z21.object({
|
|
|
3820
3832
|
completedAt: z21.string().nullable(),
|
|
3821
3833
|
artifact: artifactSchema
|
|
3822
3834
|
});
|
|
3823
|
-
var
|
|
3835
|
+
var logsListContract = c18.router({
|
|
3824
3836
|
list: {
|
|
3825
3837
|
method: "GET",
|
|
3826
3838
|
path: "/api/app/logs",
|
|
@@ -3829,16 +3841,16 @@ var platformLogsListContract = c18.router({
|
|
|
3829
3841
|
agent: z21.string().optional(),
|
|
3830
3842
|
name: z21.string().optional(),
|
|
3831
3843
|
org: z21.string().optional(),
|
|
3832
|
-
status:
|
|
3844
|
+
status: logStatusSchema.optional()
|
|
3833
3845
|
}),
|
|
3834
3846
|
responses: {
|
|
3835
|
-
200:
|
|
3847
|
+
200: logsListResponseSchema,
|
|
3836
3848
|
401: apiErrorSchema
|
|
3837
3849
|
},
|
|
3838
3850
|
summary: "List agent run logs with pagination"
|
|
3839
3851
|
}
|
|
3840
3852
|
});
|
|
3841
|
-
var
|
|
3853
|
+
var logsByIdContract = c18.router({
|
|
3842
3854
|
getById: {
|
|
3843
3855
|
method: "GET",
|
|
3844
3856
|
path: "/api/app/logs/:id",
|
|
@@ -3847,7 +3859,7 @@ var platformLogsByIdContract = c18.router({
|
|
|
3847
3859
|
id: z21.string().uuid("Invalid log ID")
|
|
3848
3860
|
}),
|
|
3849
3861
|
responses: {
|
|
3850
|
-
200:
|
|
3862
|
+
200: logDetailSchema,
|
|
3851
3863
|
401: apiErrorSchema,
|
|
3852
3864
|
404: apiErrorSchema
|
|
3853
3865
|
},
|
|
@@ -3858,7 +3870,7 @@ var artifactDownloadResponseSchema = z21.object({
|
|
|
3858
3870
|
url: z21.url(),
|
|
3859
3871
|
expiresAt: z21.string()
|
|
3860
3872
|
});
|
|
3861
|
-
var
|
|
3873
|
+
var artifactDownloadContract = c18.router({
|
|
3862
3874
|
getDownloadUrl: {
|
|
3863
3875
|
method: "GET",
|
|
3864
3876
|
path: "/api/app/artifacts/download",
|
|
@@ -6600,6 +6612,31 @@ function getConnectorDerivedNames(secretName) {
|
|
|
6600
6612
|
}
|
|
6601
6613
|
return null;
|
|
6602
6614
|
}
|
|
6615
|
+
function getConnectorOAuthConfig(type2) {
|
|
6616
|
+
const config = CONNECTOR_TYPES[type2];
|
|
6617
|
+
return "oauth" in config ? config.oauth : void 0;
|
|
6618
|
+
}
|
|
6619
|
+
function hasRequiredScopes(connectorType, storedScopes) {
|
|
6620
|
+
const oauthConfig = getConnectorOAuthConfig(connectorType);
|
|
6621
|
+
if (!oauthConfig) return true;
|
|
6622
|
+
if (oauthConfig.scopes.length === 0) return true;
|
|
6623
|
+
if (!storedScopes) return false;
|
|
6624
|
+
const storedSet = new Set(storedScopes);
|
|
6625
|
+
return oauthConfig.scopes.every((s) => storedSet.has(s));
|
|
6626
|
+
}
|
|
6627
|
+
function getScopeDiff(connectorType, storedScopes) {
|
|
6628
|
+
const oauthConfig = getConnectorOAuthConfig(connectorType);
|
|
6629
|
+
const currentScopes = oauthConfig?.scopes ?? [];
|
|
6630
|
+
const stored = storedScopes ?? [];
|
|
6631
|
+
const storedSet = new Set(stored);
|
|
6632
|
+
const currentSet = new Set(currentScopes);
|
|
6633
|
+
return {
|
|
6634
|
+
addedScopes: currentScopes.filter((s) => !storedSet.has(s)),
|
|
6635
|
+
removedScopes: stored.filter((s) => !currentSet.has(s)),
|
|
6636
|
+
currentScopes,
|
|
6637
|
+
storedScopes: stored
|
|
6638
|
+
};
|
|
6639
|
+
}
|
|
6603
6640
|
var connectorResponseSchema = z23.object({
|
|
6604
6641
|
id: z23.uuid().nullable(),
|
|
6605
6642
|
type: connectorTypeSchema,
|
|
@@ -6662,6 +6699,27 @@ var connectorsByTypeContract = c20.router({
|
|
|
6662
6699
|
summary: "Disconnect a connector"
|
|
6663
6700
|
}
|
|
6664
6701
|
});
|
|
6702
|
+
var scopeDiffResponseSchema = z23.object({
|
|
6703
|
+
addedScopes: z23.array(z23.string()),
|
|
6704
|
+
removedScopes: z23.array(z23.string()),
|
|
6705
|
+
currentScopes: z23.array(z23.string()),
|
|
6706
|
+
storedScopes: z23.array(z23.string())
|
|
6707
|
+
});
|
|
6708
|
+
var connectorScopeDiffContract = c20.router({
|
|
6709
|
+
getScopeDiff: {
|
|
6710
|
+
method: "GET",
|
|
6711
|
+
path: "/api/connectors/:type/scope-diff",
|
|
6712
|
+
headers: authHeadersSchema,
|
|
6713
|
+
pathParams: z23.object({ type: connectorTypeSchema }),
|
|
6714
|
+
responses: {
|
|
6715
|
+
200: scopeDiffResponseSchema,
|
|
6716
|
+
401: apiErrorSchema,
|
|
6717
|
+
404: apiErrorSchema,
|
|
6718
|
+
500: apiErrorSchema
|
|
6719
|
+
},
|
|
6720
|
+
summary: "Get scope diff for a connector"
|
|
6721
|
+
}
|
|
6722
|
+
});
|
|
6665
6723
|
var connectorSessionStatusSchema = z23.enum([
|
|
6666
6724
|
"pending",
|
|
6667
6725
|
"complete",
|
|
@@ -7546,19 +7604,19 @@ var FEATURE_SWITCHES = {
|
|
|
7546
7604
|
maintainer: "ethan@vm0.ai",
|
|
7547
7605
|
enabled: true
|
|
7548
7606
|
},
|
|
7549
|
-
["
|
|
7607
|
+
["agents" /* Agents */]: {
|
|
7550
7608
|
maintainer: "ethan@vm0.ai",
|
|
7551
7609
|
enabled: true
|
|
7552
7610
|
},
|
|
7553
|
-
["
|
|
7611
|
+
["secrets" /* Secrets */]: {
|
|
7554
7612
|
maintainer: "ethan@vm0.ai",
|
|
7555
7613
|
enabled: false
|
|
7556
7614
|
},
|
|
7557
|
-
["
|
|
7615
|
+
["artifacts" /* Artifacts */]: {
|
|
7558
7616
|
maintainer: "ethan@vm0.ai",
|
|
7559
7617
|
enabled: false
|
|
7560
7618
|
},
|
|
7561
|
-
["
|
|
7619
|
+
["apiKeys" /* ApiKeys */]: {
|
|
7562
7620
|
maintainer: "ethan@vm0.ai",
|
|
7563
7621
|
enabled: false
|
|
7564
7622
|
},
|
|
@@ -8364,77 +8422,11 @@ async function deleteVariable(name) {
|
|
|
8364
8422
|
handleError(result, `Variable "${name}" not found`);
|
|
8365
8423
|
}
|
|
8366
8424
|
|
|
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
8425
|
// src/lib/api/domains/org-model-providers.ts
|
|
8434
|
-
import { initClient as
|
|
8426
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
8435
8427
|
async function listOrgModelProviders() {
|
|
8436
8428
|
const config = await getClientConfig();
|
|
8437
|
-
const client =
|
|
8429
|
+
const client = initClient9(orgModelProvidersMainContract, config);
|
|
8438
8430
|
const result = await client.list({ headers: {} });
|
|
8439
8431
|
if (result.status === 200) {
|
|
8440
8432
|
return result.body;
|
|
@@ -8443,7 +8435,7 @@ async function listOrgModelProviders() {
|
|
|
8443
8435
|
}
|
|
8444
8436
|
async function upsertOrgModelProvider(body) {
|
|
8445
8437
|
const config = await getClientConfig();
|
|
8446
|
-
const client =
|
|
8438
|
+
const client = initClient9(orgModelProvidersMainContract, config);
|
|
8447
8439
|
const result = await client.upsert({ body });
|
|
8448
8440
|
if (result.status === 200 || result.status === 201) {
|
|
8449
8441
|
return result.body;
|
|
@@ -8452,7 +8444,7 @@ async function upsertOrgModelProvider(body) {
|
|
|
8452
8444
|
}
|
|
8453
8445
|
async function deleteOrgModelProvider(type2) {
|
|
8454
8446
|
const config = await getClientConfig();
|
|
8455
|
-
const client =
|
|
8447
|
+
const client = initClient9(orgModelProvidersByTypeContract, config);
|
|
8456
8448
|
const result = await client.delete({
|
|
8457
8449
|
params: { type: type2 }
|
|
8458
8450
|
});
|
|
@@ -8463,7 +8455,7 @@ async function deleteOrgModelProvider(type2) {
|
|
|
8463
8455
|
}
|
|
8464
8456
|
async function setOrgModelProviderDefault(type2) {
|
|
8465
8457
|
const config = await getClientConfig();
|
|
8466
|
-
const client =
|
|
8458
|
+
const client = initClient9(orgModelProvidersSetDefaultContract, config);
|
|
8467
8459
|
const result = await client.setDefault({
|
|
8468
8460
|
params: { type: type2 }
|
|
8469
8461
|
});
|
|
@@ -8474,7 +8466,7 @@ async function setOrgModelProviderDefault(type2) {
|
|
|
8474
8466
|
}
|
|
8475
8467
|
async function updateOrgModelProviderModel(type2, selectedModel) {
|
|
8476
8468
|
const config = await getClientConfig();
|
|
8477
|
-
const client =
|
|
8469
|
+
const client = initClient9(orgModelProvidersUpdateModelContract, config);
|
|
8478
8470
|
const result = await client.updateModel({
|
|
8479
8471
|
params: { type: type2 },
|
|
8480
8472
|
body: { selectedModel }
|
|
@@ -8486,10 +8478,10 @@ async function updateOrgModelProviderModel(type2, selectedModel) {
|
|
|
8486
8478
|
}
|
|
8487
8479
|
|
|
8488
8480
|
// src/lib/api/domains/connectors.ts
|
|
8489
|
-
import { initClient as
|
|
8481
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
8490
8482
|
async function listConnectors() {
|
|
8491
8483
|
const config = await getClientConfig();
|
|
8492
|
-
const client =
|
|
8484
|
+
const client = initClient10(connectorsMainContract, config);
|
|
8493
8485
|
const result = await client.list({ headers: {} });
|
|
8494
8486
|
if (result.status === 200) {
|
|
8495
8487
|
return result.body;
|
|
@@ -8498,7 +8490,7 @@ async function listConnectors() {
|
|
|
8498
8490
|
}
|
|
8499
8491
|
async function deleteConnector(type2) {
|
|
8500
8492
|
const config = await getClientConfig();
|
|
8501
|
-
const client =
|
|
8493
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
8502
8494
|
const result = await client.delete({
|
|
8503
8495
|
params: { type: type2 }
|
|
8504
8496
|
});
|
|
@@ -8509,7 +8501,7 @@ async function deleteConnector(type2) {
|
|
|
8509
8501
|
}
|
|
8510
8502
|
async function getConnector(type2) {
|
|
8511
8503
|
const config = await getClientConfig();
|
|
8512
|
-
const client =
|
|
8504
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
8513
8505
|
const result = await client.get({
|
|
8514
8506
|
params: { type: type2 }
|
|
8515
8507
|
});
|
|
@@ -8552,10 +8544,10 @@ async function getUsage(options) {
|
|
|
8552
8544
|
}
|
|
8553
8545
|
|
|
8554
8546
|
// src/lib/api/domains/user-preferences.ts
|
|
8555
|
-
import { initClient as
|
|
8547
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
8556
8548
|
async function getUserPreferences() {
|
|
8557
8549
|
const config = await getClientConfig();
|
|
8558
|
-
const client =
|
|
8550
|
+
const client = initClient11(userPreferencesContract, config);
|
|
8559
8551
|
const result = await client.get({ headers: {} });
|
|
8560
8552
|
if (result.status === 200) {
|
|
8561
8553
|
return result.body;
|
|
@@ -8564,7 +8556,7 @@ async function getUserPreferences() {
|
|
|
8564
8556
|
}
|
|
8565
8557
|
async function updateUserPreferences(body) {
|
|
8566
8558
|
const config = await getClientConfig();
|
|
8567
|
-
const client =
|
|
8559
|
+
const client = initClient11(userPreferencesContract, config);
|
|
8568
8560
|
const result = await client.update({ body });
|
|
8569
8561
|
if (result.status === 200) {
|
|
8570
8562
|
return result.body;
|
|
@@ -8573,10 +8565,10 @@ async function updateUserPreferences(body) {
|
|
|
8573
8565
|
}
|
|
8574
8566
|
|
|
8575
8567
|
// src/lib/api/domains/org-secrets.ts
|
|
8576
|
-
import { initClient as
|
|
8568
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
8577
8569
|
async function listOrgSecrets() {
|
|
8578
8570
|
const config = await getClientConfig();
|
|
8579
|
-
const client =
|
|
8571
|
+
const client = initClient12(orgSecretsMainContract, config);
|
|
8580
8572
|
const result = await client.list({ headers: {} });
|
|
8581
8573
|
if (result.status === 200) {
|
|
8582
8574
|
return result.body;
|
|
@@ -8585,7 +8577,7 @@ async function listOrgSecrets() {
|
|
|
8585
8577
|
}
|
|
8586
8578
|
async function setOrgSecret(body) {
|
|
8587
8579
|
const config = await getClientConfig();
|
|
8588
|
-
const client =
|
|
8580
|
+
const client = initClient12(orgSecretsMainContract, config);
|
|
8589
8581
|
const result = await client.set({ body });
|
|
8590
8582
|
if (result.status === 200 || result.status === 201) {
|
|
8591
8583
|
return result.body;
|
|
@@ -8594,7 +8586,7 @@ async function setOrgSecret(body) {
|
|
|
8594
8586
|
}
|
|
8595
8587
|
async function deleteOrgSecret(name) {
|
|
8596
8588
|
const config = await getClientConfig();
|
|
8597
|
-
const client =
|
|
8589
|
+
const client = initClient12(orgSecretsByNameContract, config);
|
|
8598
8590
|
const result = await client.delete({
|
|
8599
8591
|
params: { name }
|
|
8600
8592
|
});
|
|
@@ -8605,10 +8597,10 @@ async function deleteOrgSecret(name) {
|
|
|
8605
8597
|
}
|
|
8606
8598
|
|
|
8607
8599
|
// src/lib/api/domains/org-variables.ts
|
|
8608
|
-
import { initClient as
|
|
8600
|
+
import { initClient as initClient13 } from "@ts-rest/core";
|
|
8609
8601
|
async function listOrgVariables() {
|
|
8610
8602
|
const config = await getClientConfig();
|
|
8611
|
-
const client =
|
|
8603
|
+
const client = initClient13(orgVariablesMainContract, config);
|
|
8612
8604
|
const result = await client.list({ headers: {} });
|
|
8613
8605
|
if (result.status === 200) {
|
|
8614
8606
|
return result.body;
|
|
@@ -8617,7 +8609,7 @@ async function listOrgVariables() {
|
|
|
8617
8609
|
}
|
|
8618
8610
|
async function setOrgVariable(body) {
|
|
8619
8611
|
const config = await getClientConfig();
|
|
8620
|
-
const client =
|
|
8612
|
+
const client = initClient13(orgVariablesMainContract, config);
|
|
8621
8613
|
const result = await client.set({ body });
|
|
8622
8614
|
if (result.status === 200 || result.status === 201) {
|
|
8623
8615
|
return result.body;
|
|
@@ -8626,7 +8618,7 @@ async function setOrgVariable(body) {
|
|
|
8626
8618
|
}
|
|
8627
8619
|
async function deleteOrgVariable(name) {
|
|
8628
8620
|
const config = await getClientConfig();
|
|
8629
|
-
const client =
|
|
8621
|
+
const client = initClient13(orgVariablesByNameContract, config);
|
|
8630
8622
|
const result = await client.delete({
|
|
8631
8623
|
params: { name }
|
|
8632
8624
|
});
|
|
@@ -9780,9 +9772,9 @@ function mergeSkillVariables(agent, variables) {
|
|
|
9780
9772
|
agent.environment = environment;
|
|
9781
9773
|
}
|
|
9782
9774
|
}
|
|
9783
|
-
function
|
|
9775
|
+
function getAppUrl(apiUrl) {
|
|
9784
9776
|
const url = new URL(apiUrl);
|
|
9785
|
-
url.hostname = url.hostname.replace("www", "
|
|
9777
|
+
url.hostname = url.hostname.replace("www", "app");
|
|
9786
9778
|
return url.origin;
|
|
9787
9779
|
}
|
|
9788
9780
|
async function checkAndPromptMissingItems(config, options) {
|
|
@@ -9815,7 +9807,7 @@ async function checkAndPromptMissingItems(config, options) {
|
|
|
9815
9807
|
return { missingSecrets: [], missingVars: [] };
|
|
9816
9808
|
}
|
|
9817
9809
|
const apiUrl = await getApiUrl();
|
|
9818
|
-
const
|
|
9810
|
+
const appUrl = getAppUrl(apiUrl);
|
|
9819
9811
|
const params = new URLSearchParams();
|
|
9820
9812
|
if (missingSecrets.length > 0) {
|
|
9821
9813
|
params.set("secrets", missingSecrets.join(","));
|
|
@@ -9823,7 +9815,7 @@ async function checkAndPromptMissingItems(config, options) {
|
|
|
9823
9815
|
if (missingVars.length > 0) {
|
|
9824
9816
|
params.set("vars", missingVars.join(","));
|
|
9825
9817
|
}
|
|
9826
|
-
const setupUrl = `${
|
|
9818
|
+
const setupUrl = `${appUrl}/environment-variables-setup?${params.toString()}`;
|
|
9827
9819
|
if (!options.json) {
|
|
9828
9820
|
console.log();
|
|
9829
9821
|
console.log(
|
|
@@ -9982,7 +9974,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9982
9974
|
options.autoUpdate = false;
|
|
9983
9975
|
}
|
|
9984
9976
|
if (options.autoUpdate !== false) {
|
|
9985
|
-
await startSilentUpgrade("9.
|
|
9977
|
+
await startSilentUpgrade("9.65.1");
|
|
9986
9978
|
}
|
|
9987
9979
|
try {
|
|
9988
9980
|
let result;
|
|
@@ -10804,7 +10796,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10804
10796
|
withErrorHandler(
|
|
10805
10797
|
async (identifier, prompt, options) => {
|
|
10806
10798
|
if (options.autoUpdate !== false) {
|
|
10807
|
-
await startSilentUpgrade("9.
|
|
10799
|
+
await startSilentUpgrade("9.65.1");
|
|
10808
10800
|
}
|
|
10809
10801
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10810
10802
|
let composeId;
|
|
@@ -12524,7 +12516,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
12524
12516
|
withErrorHandler(
|
|
12525
12517
|
async (prompt, options) => {
|
|
12526
12518
|
if (options.autoUpdate !== false) {
|
|
12527
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12519
|
+
const shouldExit = await checkAndUpgrade("9.65.1", prompt);
|
|
12528
12520
|
if (shouldExit) {
|
|
12529
12521
|
process.exit(0);
|
|
12530
12522
|
}
|
|
@@ -12710,7 +12702,7 @@ import { Command as Command40 } from "commander";
|
|
|
12710
12702
|
import chalk36 from "chalk";
|
|
12711
12703
|
|
|
12712
12704
|
// src/lib/api/api-client.ts
|
|
12713
|
-
import { initClient as
|
|
12705
|
+
import { initClient as initClient14 } from "@ts-rest/core";
|
|
12714
12706
|
var ApiClient = class {
|
|
12715
12707
|
async getHeaders() {
|
|
12716
12708
|
const token = await getActiveToken();
|
|
@@ -12736,7 +12728,7 @@ var ApiClient = class {
|
|
|
12736
12728
|
async getComposeByName(name, org) {
|
|
12737
12729
|
const baseUrl = await this.getBaseUrl();
|
|
12738
12730
|
const headers = await this.getHeaders();
|
|
12739
|
-
const client =
|
|
12731
|
+
const client = initClient14(composesMainContract, {
|
|
12740
12732
|
baseUrl,
|
|
12741
12733
|
baseHeaders: headers,
|
|
12742
12734
|
jsonQuery: false
|
|
@@ -12757,7 +12749,7 @@ var ApiClient = class {
|
|
|
12757
12749
|
async getComposeById(id) {
|
|
12758
12750
|
const baseUrl = await this.getBaseUrl();
|
|
12759
12751
|
const headers = await this.getHeaders();
|
|
12760
|
-
const client =
|
|
12752
|
+
const client = initClient14(composesByIdContract, {
|
|
12761
12753
|
baseUrl,
|
|
12762
12754
|
baseHeaders: headers,
|
|
12763
12755
|
jsonQuery: false
|
|
@@ -12779,7 +12771,7 @@ var ApiClient = class {
|
|
|
12779
12771
|
async getComposeVersion(composeId, version) {
|
|
12780
12772
|
const baseUrl = await this.getBaseUrl();
|
|
12781
12773
|
const headers = await this.getHeaders();
|
|
12782
|
-
const client =
|
|
12774
|
+
const client = initClient14(composesVersionsContract, {
|
|
12783
12775
|
baseUrl,
|
|
12784
12776
|
baseHeaders: headers,
|
|
12785
12777
|
jsonQuery: false
|
|
@@ -12800,7 +12792,7 @@ var ApiClient = class {
|
|
|
12800
12792
|
async createOrUpdateCompose(body) {
|
|
12801
12793
|
const baseUrl = await this.getBaseUrl();
|
|
12802
12794
|
const headers = await this.getHeaders();
|
|
12803
|
-
const client =
|
|
12795
|
+
const client = initClient14(composesMainContract, {
|
|
12804
12796
|
baseUrl,
|
|
12805
12797
|
baseHeaders: headers,
|
|
12806
12798
|
jsonQuery: false
|
|
@@ -12823,7 +12815,7 @@ var ApiClient = class {
|
|
|
12823
12815
|
async createRun(body) {
|
|
12824
12816
|
const baseUrl = await this.getBaseUrl();
|
|
12825
12817
|
const headers = await this.getHeaders();
|
|
12826
|
-
const client =
|
|
12818
|
+
const client = initClient14(runsMainContract, {
|
|
12827
12819
|
baseUrl,
|
|
12828
12820
|
baseHeaders: headers,
|
|
12829
12821
|
jsonQuery: false
|
|
@@ -12838,7 +12830,7 @@ var ApiClient = class {
|
|
|
12838
12830
|
}
|
|
12839
12831
|
async getEvents(runId, options) {
|
|
12840
12832
|
const config = await getClientConfig();
|
|
12841
|
-
const client =
|
|
12833
|
+
const client = initClient14(runEventsContract, config);
|
|
12842
12834
|
const result = await client.getEvents({
|
|
12843
12835
|
params: { id: runId },
|
|
12844
12836
|
query: {
|
|
@@ -12855,7 +12847,7 @@ var ApiClient = class {
|
|
|
12855
12847
|
}
|
|
12856
12848
|
async getSystemLog(runId, options) {
|
|
12857
12849
|
const config = await getClientConfig();
|
|
12858
|
-
const client =
|
|
12850
|
+
const client = initClient14(runSystemLogContract, config);
|
|
12859
12851
|
const result = await client.getSystemLog({
|
|
12860
12852
|
params: { id: runId },
|
|
12861
12853
|
query: {
|
|
@@ -12873,7 +12865,7 @@ var ApiClient = class {
|
|
|
12873
12865
|
}
|
|
12874
12866
|
async getMetrics(runId, options) {
|
|
12875
12867
|
const config = await getClientConfig();
|
|
12876
|
-
const client =
|
|
12868
|
+
const client = initClient14(runMetricsContract, config);
|
|
12877
12869
|
const result = await client.getMetrics({
|
|
12878
12870
|
params: { id: runId },
|
|
12879
12871
|
query: {
|
|
@@ -12891,7 +12883,7 @@ var ApiClient = class {
|
|
|
12891
12883
|
}
|
|
12892
12884
|
async getAgentEvents(runId, options) {
|
|
12893
12885
|
const config = await getClientConfig();
|
|
12894
|
-
const client =
|
|
12886
|
+
const client = initClient14(runAgentEventsContract, config);
|
|
12895
12887
|
const result = await client.getAgentEvents({
|
|
12896
12888
|
params: { id: runId },
|
|
12897
12889
|
query: {
|
|
@@ -12909,7 +12901,7 @@ var ApiClient = class {
|
|
|
12909
12901
|
}
|
|
12910
12902
|
async getNetworkLogs(runId, options) {
|
|
12911
12903
|
const config = await getClientConfig();
|
|
12912
|
-
const client =
|
|
12904
|
+
const client = initClient14(runNetworkLogsContract, config);
|
|
12913
12905
|
const result = await client.getNetworkLogs({
|
|
12914
12906
|
params: { id: runId },
|
|
12915
12907
|
query: {
|
|
@@ -12931,7 +12923,7 @@ var ApiClient = class {
|
|
|
12931
12923
|
async getOrg() {
|
|
12932
12924
|
const baseUrl = await this.getBaseUrl();
|
|
12933
12925
|
const headers = await this.getHeaders();
|
|
12934
|
-
const client =
|
|
12926
|
+
const client = initClient14(orgContract, {
|
|
12935
12927
|
baseUrl,
|
|
12936
12928
|
baseHeaders: headers,
|
|
12937
12929
|
jsonQuery: false
|
|
@@ -12950,7 +12942,7 @@ var ApiClient = class {
|
|
|
12950
12942
|
async updateOrg(body) {
|
|
12951
12943
|
const baseUrl = await this.getBaseUrl();
|
|
12952
12944
|
const headers = await this.getHeaders();
|
|
12953
|
-
const client =
|
|
12945
|
+
const client = initClient14(orgContract, {
|
|
12954
12946
|
baseUrl,
|
|
12955
12947
|
baseHeaders: headers,
|
|
12956
12948
|
jsonQuery: false
|
|
@@ -12970,7 +12962,7 @@ var ApiClient = class {
|
|
|
12970
12962
|
async getSession(sessionId) {
|
|
12971
12963
|
const baseUrl = await this.getBaseUrl();
|
|
12972
12964
|
const headers = await this.getHeaders();
|
|
12973
|
-
const client =
|
|
12965
|
+
const client = initClient14(sessionsByIdContract, {
|
|
12974
12966
|
baseUrl,
|
|
12975
12967
|
baseHeaders: headers,
|
|
12976
12968
|
jsonQuery: false
|
|
@@ -12991,7 +12983,7 @@ var ApiClient = class {
|
|
|
12991
12983
|
*/
|
|
12992
12984
|
async getCheckpoint(checkpointId) {
|
|
12993
12985
|
const config = await getClientConfig();
|
|
12994
|
-
const client =
|
|
12986
|
+
const client = initClient14(checkpointsByIdContract, config);
|
|
12995
12987
|
const result = await client.getById({
|
|
12996
12988
|
params: { id: checkpointId }
|
|
12997
12989
|
});
|
|
@@ -13008,7 +13000,7 @@ var ApiClient = class {
|
|
|
13008
13000
|
async prepareStorage(body) {
|
|
13009
13001
|
const baseUrl = await this.getBaseUrl();
|
|
13010
13002
|
const headers = await this.getHeaders();
|
|
13011
|
-
const client =
|
|
13003
|
+
const client = initClient14(storagesPrepareContract, {
|
|
13012
13004
|
baseUrl,
|
|
13013
13005
|
baseHeaders: headers,
|
|
13014
13006
|
jsonQuery: false
|
|
@@ -13027,7 +13019,7 @@ var ApiClient = class {
|
|
|
13027
13019
|
async commitStorage(body) {
|
|
13028
13020
|
const baseUrl = await this.getBaseUrl();
|
|
13029
13021
|
const headers = await this.getHeaders();
|
|
13030
|
-
const client =
|
|
13022
|
+
const client = initClient14(storagesCommitContract, {
|
|
13031
13023
|
baseUrl,
|
|
13032
13024
|
baseHeaders: headers,
|
|
13033
13025
|
jsonQuery: false
|
|
@@ -13046,7 +13038,7 @@ var ApiClient = class {
|
|
|
13046
13038
|
async getStorageDownload(query) {
|
|
13047
13039
|
const baseUrl = await this.getBaseUrl();
|
|
13048
13040
|
const headers = await this.getHeaders();
|
|
13049
|
-
const client =
|
|
13041
|
+
const client = initClient14(storagesDownloadContract, {
|
|
13050
13042
|
baseUrl,
|
|
13051
13043
|
baseHeaders: headers,
|
|
13052
13044
|
jsonQuery: false
|
|
@@ -13071,7 +13063,7 @@ var ApiClient = class {
|
|
|
13071
13063
|
async listStorages(query) {
|
|
13072
13064
|
const baseUrl = await this.getBaseUrl();
|
|
13073
13065
|
const headers = await this.getHeaders();
|
|
13074
|
-
const client =
|
|
13066
|
+
const client = initClient14(storagesListContract, {
|
|
13075
13067
|
baseUrl,
|
|
13076
13068
|
baseHeaders: headers,
|
|
13077
13069
|
jsonQuery: false
|
|
@@ -13086,12 +13078,12 @@ var ApiClient = class {
|
|
|
13086
13078
|
}
|
|
13087
13079
|
/**
|
|
13088
13080
|
* Deploy schedule (create or update)
|
|
13089
|
-
* Note: vars and secrets are now managed via
|
|
13081
|
+
* Note: vars and secrets are now managed via server-side tables (vm0 secret set, vm0 var set)
|
|
13090
13082
|
*/
|
|
13091
13083
|
async deploySchedule(body) {
|
|
13092
13084
|
const baseUrl = await this.getBaseUrl();
|
|
13093
13085
|
const headers = await this.getHeaders();
|
|
13094
|
-
const client =
|
|
13086
|
+
const client = initClient14(schedulesMainContract, {
|
|
13095
13087
|
baseUrl,
|
|
13096
13088
|
baseHeaders: headers,
|
|
13097
13089
|
jsonQuery: false
|
|
@@ -13110,7 +13102,7 @@ var ApiClient = class {
|
|
|
13110
13102
|
async listSchedules() {
|
|
13111
13103
|
const baseUrl = await this.getBaseUrl();
|
|
13112
13104
|
const headers = await this.getHeaders();
|
|
13113
|
-
const client =
|
|
13105
|
+
const client = initClient14(schedulesMainContract, {
|
|
13114
13106
|
baseUrl,
|
|
13115
13107
|
baseHeaders: headers,
|
|
13116
13108
|
jsonQuery: false
|
|
@@ -13129,7 +13121,7 @@ var ApiClient = class {
|
|
|
13129
13121
|
async getScheduleByName(params) {
|
|
13130
13122
|
const baseUrl = await this.getBaseUrl();
|
|
13131
13123
|
const headers = await this.getHeaders();
|
|
13132
|
-
const client =
|
|
13124
|
+
const client = initClient14(schedulesByNameContract, {
|
|
13133
13125
|
baseUrl,
|
|
13134
13126
|
baseHeaders: headers,
|
|
13135
13127
|
jsonQuery: false
|
|
@@ -13151,7 +13143,7 @@ var ApiClient = class {
|
|
|
13151
13143
|
async deleteSchedule(params) {
|
|
13152
13144
|
const baseUrl = await this.getBaseUrl();
|
|
13153
13145
|
const headers = await this.getHeaders();
|
|
13154
|
-
const client =
|
|
13146
|
+
const client = initClient14(schedulesByNameContract, {
|
|
13155
13147
|
baseUrl,
|
|
13156
13148
|
baseHeaders: headers,
|
|
13157
13149
|
jsonQuery: false
|
|
@@ -13173,7 +13165,7 @@ var ApiClient = class {
|
|
|
13173
13165
|
async enableSchedule(params) {
|
|
13174
13166
|
const baseUrl = await this.getBaseUrl();
|
|
13175
13167
|
const headers = await this.getHeaders();
|
|
13176
|
-
const client =
|
|
13168
|
+
const client = initClient14(schedulesEnableContract, {
|
|
13177
13169
|
baseUrl,
|
|
13178
13170
|
baseHeaders: headers,
|
|
13179
13171
|
jsonQuery: false
|
|
@@ -13195,7 +13187,7 @@ var ApiClient = class {
|
|
|
13195
13187
|
async disableSchedule(params) {
|
|
13196
13188
|
const baseUrl = await this.getBaseUrl();
|
|
13197
13189
|
const headers = await this.getHeaders();
|
|
13198
|
-
const client =
|
|
13190
|
+
const client = initClient14(schedulesEnableContract, {
|
|
13199
13191
|
baseUrl,
|
|
13200
13192
|
baseHeaders: headers,
|
|
13201
13193
|
jsonQuery: false
|
|
@@ -13217,7 +13209,7 @@ var ApiClient = class {
|
|
|
13217
13209
|
async listScheduleRuns(params) {
|
|
13218
13210
|
const baseUrl = await this.getBaseUrl();
|
|
13219
13211
|
const headers = await this.getHeaders();
|
|
13220
|
-
const client =
|
|
13212
|
+
const client = initClient14(scheduleRunsContract, {
|
|
13221
13213
|
baseUrl,
|
|
13222
13214
|
baseHeaders: headers,
|
|
13223
13215
|
jsonQuery: false
|
|
@@ -13325,7 +13317,7 @@ var ApiClient = class {
|
|
|
13325
13317
|
}
|
|
13326
13318
|
async searchLogs(options) {
|
|
13327
13319
|
const config = await getClientConfig();
|
|
13328
|
-
const client =
|
|
13320
|
+
const client = initClient14(logsSearchContract, config);
|
|
13329
13321
|
const result = await client.searchLogs({
|
|
13330
13322
|
query: {
|
|
13331
13323
|
keyword: options.keyword,
|
|
@@ -14182,7 +14174,7 @@ import { Command as Command58 } from "commander";
|
|
|
14182
14174
|
import chalk53 from "chalk";
|
|
14183
14175
|
import prompts3 from "prompts";
|
|
14184
14176
|
|
|
14185
|
-
// src/
|
|
14177
|
+
// src/lib/domain/model-provider/shared.ts
|
|
14186
14178
|
import chalk52 from "chalk";
|
|
14187
14179
|
import prompts2 from "prompts";
|
|
14188
14180
|
function validateProviderType(typeStr) {
|
|
@@ -14274,7 +14266,7 @@ function validateSecrets(type2, authMethod, secrets) {
|
|
|
14274
14266
|
}
|
|
14275
14267
|
function handleNonInteractiveMode(options) {
|
|
14276
14268
|
const type2 = validateProviderType(options.type);
|
|
14277
|
-
const cmdPrefix = options.commandPrefix ?? "vm0 model-provider setup";
|
|
14269
|
+
const cmdPrefix = options.commandPrefix ?? "vm0 org model-provider setup";
|
|
14278
14270
|
let selectedModel;
|
|
14279
14271
|
if (options.model) {
|
|
14280
14272
|
selectedModel = validateModel(type2, options.model);
|
|
@@ -15195,7 +15187,7 @@ var initCommand4 = new Command68().name("init").description("Initialize a new VM
|
|
|
15195
15187
|
console.log();
|
|
15196
15188
|
console.log("Next steps:");
|
|
15197
15189
|
console.log(
|
|
15198
|
-
` 1. Set up model provider (one-time): ${chalk60.cyan("vm0 model-provider setup")}`
|
|
15190
|
+
` 1. Set up model provider (one-time): ${chalk60.cyan("vm0 org model-provider setup")}`
|
|
15199
15191
|
);
|
|
15200
15192
|
console.log(
|
|
15201
15193
|
` 2. Edit ${chalk60.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
@@ -16535,297 +16527,13 @@ var deleteCommand4 = new Command83().name("delete").description("Delete a variab
|
|
|
16535
16527
|
// src/commands/variable/index.ts
|
|
16536
16528
|
var variableCommand = new Command84().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand12).addCommand(setCommand5).addCommand(deleteCommand4);
|
|
16537
16529
|
|
|
16538
|
-
// src/commands/
|
|
16530
|
+
// src/commands/connector/index.ts
|
|
16539
16531
|
import { Command as Command89 } from "commander";
|
|
16540
16532
|
|
|
16541
|
-
// src/commands/
|
|
16533
|
+
// src/commands/connector/connect.ts
|
|
16542
16534
|
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
16535
|
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";
|
|
16536
|
+
import { initClient as initClient15 } from "@ts-rest/core";
|
|
16829
16537
|
|
|
16830
16538
|
// src/commands/connector/lib/computer/start-services.ts
|
|
16831
16539
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -16833,7 +16541,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16833
16541
|
import { createServer } from "net";
|
|
16834
16542
|
import { homedir as homedir4 } from "os";
|
|
16835
16543
|
import { join as join12 } from "path";
|
|
16836
|
-
import
|
|
16544
|
+
import chalk74 from "chalk";
|
|
16837
16545
|
|
|
16838
16546
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16839
16547
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16907,7 +16615,7 @@ async function checkComputerDependencies() {
|
|
|
16907
16615
|
}
|
|
16908
16616
|
}
|
|
16909
16617
|
async function startComputerServices(credentials) {
|
|
16910
|
-
console.log(
|
|
16618
|
+
console.log(chalk74.cyan("Starting computer connector services..."));
|
|
16911
16619
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16912
16620
|
if (!wsgidavBinary) {
|
|
16913
16621
|
throw new Error(
|
|
@@ -16934,7 +16642,7 @@ async function startComputerServices(credentials) {
|
|
|
16934
16642
|
);
|
|
16935
16643
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16936
16644
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16937
|
-
console.log(
|
|
16645
|
+
console.log(chalk74.green("\u2713 WebDAV server started"));
|
|
16938
16646
|
const chrome = spawn2(
|
|
16939
16647
|
chromeBinary,
|
|
16940
16648
|
[
|
|
@@ -16948,7 +16656,7 @@ async function startComputerServices(credentials) {
|
|
|
16948
16656
|
);
|
|
16949
16657
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16950
16658
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16951
|
-
console.log(
|
|
16659
|
+
console.log(chalk74.green("\u2713 Chrome started"));
|
|
16952
16660
|
try {
|
|
16953
16661
|
await startNgrokTunnels(
|
|
16954
16662
|
credentials.ngrokToken,
|
|
@@ -16957,18 +16665,18 @@ async function startComputerServices(credentials) {
|
|
|
16957
16665
|
cdpPort
|
|
16958
16666
|
);
|
|
16959
16667
|
console.log(
|
|
16960
|
-
|
|
16668
|
+
chalk74.green(
|
|
16961
16669
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16962
16670
|
)
|
|
16963
16671
|
);
|
|
16964
16672
|
console.log();
|
|
16965
|
-
console.log(
|
|
16673
|
+
console.log(chalk74.green("\u2713 Computer connector active"));
|
|
16966
16674
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16967
16675
|
console.log(
|
|
16968
16676
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16969
16677
|
);
|
|
16970
16678
|
console.log();
|
|
16971
|
-
console.log(
|
|
16679
|
+
console.log(chalk74.dim("Press ^C twice to disconnect"));
|
|
16972
16680
|
console.log();
|
|
16973
16681
|
let sigintCount = 0;
|
|
16974
16682
|
await new Promise((resolve2) => {
|
|
@@ -16982,7 +16690,7 @@ async function startComputerServices(credentials) {
|
|
|
16982
16690
|
const onSigint = () => {
|
|
16983
16691
|
sigintCount++;
|
|
16984
16692
|
if (sigintCount === 1) {
|
|
16985
|
-
console.log(
|
|
16693
|
+
console.log(chalk74.dim("\nPress ^C again to disconnect and exit..."));
|
|
16986
16694
|
} else {
|
|
16987
16695
|
done();
|
|
16988
16696
|
}
|
|
@@ -16992,11 +16700,11 @@ async function startComputerServices(credentials) {
|
|
|
16992
16700
|
});
|
|
16993
16701
|
} finally {
|
|
16994
16702
|
console.log();
|
|
16995
|
-
console.log(
|
|
16703
|
+
console.log(chalk74.cyan("Stopping services..."));
|
|
16996
16704
|
wsgidav.kill("SIGTERM");
|
|
16997
16705
|
chrome.kill("SIGTERM");
|
|
16998
16706
|
await stopNgrokTunnels();
|
|
16999
|
-
console.log(
|
|
16707
|
+
console.log(chalk74.green("\u2713 Services stopped"));
|
|
17000
16708
|
}
|
|
17001
16709
|
}
|
|
17002
16710
|
|
|
@@ -17021,10 +16729,10 @@ async function getHeaders2() {
|
|
|
17021
16729
|
function renderHelpText(text) {
|
|
17022
16730
|
return text.replace(
|
|
17023
16731
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
17024
|
-
(_m, label, url) => `${label} (${
|
|
17025
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
16732
|
+
(_m, label, url) => `${label} (${chalk75.cyan(url)})`
|
|
16733
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk75.bold(content)).replace(
|
|
17026
16734
|
/^> (.+)$/gm,
|
|
17027
|
-
(_m, content) =>
|
|
16735
|
+
(_m, content) => chalk75.yellow(` ${content}`)
|
|
17028
16736
|
);
|
|
17029
16737
|
}
|
|
17030
16738
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -17049,7 +16757,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
17049
16757
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
17050
16758
|
if (!secretConfig.required) continue;
|
|
17051
16759
|
const value = await promptPassword(
|
|
17052
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
16760
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk75.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
17053
16761
|
);
|
|
17054
16762
|
if (!value) {
|
|
17055
16763
|
throw new Error("Cancelled");
|
|
@@ -17065,14 +16773,14 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
17065
16773
|
});
|
|
17066
16774
|
}
|
|
17067
16775
|
console.log(
|
|
17068
|
-
|
|
16776
|
+
chalk75.green(`
|
|
17069
16777
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
17070
16778
|
);
|
|
17071
16779
|
}
|
|
17072
16780
|
async function connectComputer(apiUrl, headers) {
|
|
17073
16781
|
await checkComputerDependencies();
|
|
17074
|
-
console.log(
|
|
17075
|
-
const computerClient =
|
|
16782
|
+
console.log(chalk75.cyan("Setting up computer connector..."));
|
|
16783
|
+
const computerClient = initClient15(computerConnectorContract, {
|
|
17076
16784
|
baseUrl: apiUrl,
|
|
17077
16785
|
baseHeaders: headers,
|
|
17078
16786
|
jsonQuery: false
|
|
@@ -17086,9 +16794,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
17086
16794
|
}
|
|
17087
16795
|
const credentials = createResult.body;
|
|
17088
16796
|
await startComputerServices(credentials);
|
|
17089
|
-
console.log(
|
|
16797
|
+
console.log(chalk75.cyan("Disconnecting computer connector..."));
|
|
17090
16798
|
await deleteConnector("computer");
|
|
17091
|
-
console.log(
|
|
16799
|
+
console.log(chalk75.green("\u2713 Disconnected computer"));
|
|
17092
16800
|
process.exit(0);
|
|
17093
16801
|
}
|
|
17094
16802
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -17127,8 +16835,8 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
17127
16835
|
);
|
|
17128
16836
|
}
|
|
17129
16837
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
17130
|
-
console.log(`Connecting ${
|
|
17131
|
-
const sessionsClient =
|
|
16838
|
+
console.log(`Connecting ${chalk75.cyan(connectorType)}...`);
|
|
16839
|
+
const sessionsClient = initClient15(connectorSessionsContract, {
|
|
17132
16840
|
baseUrl: apiUrl,
|
|
17133
16841
|
baseHeaders: headers,
|
|
17134
16842
|
jsonQuery: false
|
|
@@ -17143,15 +16851,15 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
17143
16851
|
}
|
|
17144
16852
|
const session = createResult.body;
|
|
17145
16853
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
17146
|
-
console.log(
|
|
17147
|
-
console.log(
|
|
16854
|
+
console.log(chalk75.green("\nSession created"));
|
|
16855
|
+
console.log(chalk75.cyan(`
|
|
17148
16856
|
To connect, visit: ${verificationUrl}`));
|
|
17149
16857
|
console.log(
|
|
17150
16858
|
`
|
|
17151
16859
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
17152
16860
|
);
|
|
17153
16861
|
console.log("\nWaiting for authorization...");
|
|
17154
|
-
const sessionClient =
|
|
16862
|
+
const sessionClient = initClient15(connectorSessionByIdContract, {
|
|
17155
16863
|
baseUrl: apiUrl,
|
|
17156
16864
|
baseHeaders: headers,
|
|
17157
16865
|
jsonQuery: false
|
|
@@ -17176,7 +16884,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
17176
16884
|
switch (status.status) {
|
|
17177
16885
|
case "complete":
|
|
17178
16886
|
console.log(
|
|
17179
|
-
|
|
16887
|
+
chalk75.green(`
|
|
17180
16888
|
|
|
17181
16889
|
${connectorType} connected successfully!`)
|
|
17182
16890
|
);
|
|
@@ -17188,13 +16896,13 @@ ${connectorType} connected successfully!`)
|
|
|
17188
16896
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
17189
16897
|
);
|
|
17190
16898
|
case "pending":
|
|
17191
|
-
process.stdout.write(
|
|
16899
|
+
process.stdout.write(chalk75.dim("."));
|
|
17192
16900
|
break;
|
|
17193
16901
|
}
|
|
17194
16902
|
}
|
|
17195
16903
|
throw new Error("Session timed out, please try again");
|
|
17196
16904
|
}
|
|
17197
|
-
var connectCommand = new
|
|
16905
|
+
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
16906
|
withErrorHandler(async (type2, options) => {
|
|
17199
16907
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17200
16908
|
if (!parseResult.success) {
|
|
@@ -17219,9 +16927,9 @@ var connectCommand = new Command90().name("connect").description("Connect a thir
|
|
|
17219
16927
|
);
|
|
17220
16928
|
|
|
17221
16929
|
// src/commands/connector/list.ts
|
|
17222
|
-
import { Command as
|
|
17223
|
-
import
|
|
17224
|
-
var
|
|
16930
|
+
import { Command as Command86 } from "commander";
|
|
16931
|
+
import chalk76 from "chalk";
|
|
16932
|
+
var listCommand13 = new Command86().name("list").alias("ls").description("List all connectors and their status").action(
|
|
17225
16933
|
withErrorHandler(async () => {
|
|
17226
16934
|
const result = await listConnectors();
|
|
17227
16935
|
const connectedMap = new Map(result.connectors.map((c28) => [c28.type, c28]));
|
|
@@ -17243,25 +16951,26 @@ var listCommand14 = new Command91().name("list").alias("ls").description("List a
|
|
|
17243
16951
|
statusText.padEnd(statusWidth),
|
|
17244
16952
|
"ACCOUNT"
|
|
17245
16953
|
].join(" ");
|
|
17246
|
-
console.log(
|
|
16954
|
+
console.log(chalk76.dim(header));
|
|
17247
16955
|
for (const type2 of allTypes) {
|
|
17248
16956
|
const connector = connectedMap.get(type2);
|
|
17249
|
-
const
|
|
17250
|
-
const
|
|
16957
|
+
const scopeMismatch = connector !== void 0 && connector.authMethod === "oauth" && !hasRequiredScopes(type2, connector.oauthScopes);
|
|
16958
|
+
const status = connector ? connector.needsReconnect ? chalk76.yellow("!".padEnd(statusWidth)) : scopeMismatch ? chalk76.yellow("!".padEnd(statusWidth)) : chalk76.green("\u2713".padEnd(statusWidth)) : chalk76.dim("-".padEnd(statusWidth));
|
|
16959
|
+
const account = connector?.needsReconnect ? chalk76.yellow("(reconnect needed)") : scopeMismatch ? chalk76.yellow("(permissions update available)") : connector?.externalUsername ? `@${connector.externalUsername}` : chalk76.dim("-");
|
|
17251
16960
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
17252
16961
|
console.log(row);
|
|
17253
16962
|
}
|
|
17254
16963
|
console.log();
|
|
17255
|
-
console.log(
|
|
17256
|
-
console.log(
|
|
16964
|
+
console.log(chalk76.dim("To connect a service:"));
|
|
16965
|
+
console.log(chalk76.dim(" vm0 connector connect <type>"));
|
|
17257
16966
|
})
|
|
17258
16967
|
);
|
|
17259
16968
|
|
|
17260
16969
|
// src/commands/connector/status.ts
|
|
17261
|
-
import { Command as
|
|
17262
|
-
import
|
|
16970
|
+
import { Command as Command87 } from "commander";
|
|
16971
|
+
import chalk77 from "chalk";
|
|
17263
16972
|
var LABEL_WIDTH = 16;
|
|
17264
|
-
var statusCommand8 = new
|
|
16973
|
+
var statusCommand8 = new Command87().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
17265
16974
|
withErrorHandler(async (type2) => {
|
|
17266
16975
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17267
16976
|
if (!parseResult.success) {
|
|
@@ -17271,11 +16980,11 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17271
16980
|
});
|
|
17272
16981
|
}
|
|
17273
16982
|
const connector = await getConnector(parseResult.data);
|
|
17274
|
-
console.log(`Connector: ${
|
|
16983
|
+
console.log(`Connector: ${chalk77.cyan(type2)}`);
|
|
17275
16984
|
console.log();
|
|
17276
16985
|
if (connector) {
|
|
17277
16986
|
console.log(
|
|
17278
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
16987
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk77.green("connected")}`
|
|
17279
16988
|
);
|
|
17280
16989
|
console.log(
|
|
17281
16990
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -17288,6 +16997,22 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17288
16997
|
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
17289
16998
|
);
|
|
17290
16999
|
}
|
|
17000
|
+
if (connector.authMethod === "oauth" && !hasRequiredScopes(parseResult.data, connector.oauthScopes)) {
|
|
17001
|
+
const diff = getScopeDiff(parseResult.data, connector.oauthScopes);
|
|
17002
|
+
console.log(
|
|
17003
|
+
`${"Permissions:".padEnd(LABEL_WIDTH)}${chalk77.yellow("update available")}`
|
|
17004
|
+
);
|
|
17005
|
+
if (diff.addedScopes.length > 0) {
|
|
17006
|
+
console.log(
|
|
17007
|
+
`${" Added:".padEnd(LABEL_WIDTH)}${diff.addedScopes.join(", ")}`
|
|
17008
|
+
);
|
|
17009
|
+
}
|
|
17010
|
+
if (diff.removedScopes.length > 0) {
|
|
17011
|
+
console.log(
|
|
17012
|
+
`${" Removed:".padEnd(LABEL_WIDTH)}${diff.removedScopes.join(", ")}`
|
|
17013
|
+
);
|
|
17014
|
+
}
|
|
17015
|
+
}
|
|
17291
17016
|
console.log(
|
|
17292
17017
|
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
17293
17018
|
);
|
|
@@ -17297,23 +17022,23 @@ var statusCommand8 = new Command92().name("status").description("Show detailed s
|
|
|
17297
17022
|
);
|
|
17298
17023
|
}
|
|
17299
17024
|
console.log();
|
|
17300
|
-
console.log(
|
|
17301
|
-
console.log(
|
|
17025
|
+
console.log(chalk77.dim("To disconnect:"));
|
|
17026
|
+
console.log(chalk77.dim(` vm0 connector disconnect ${type2}`));
|
|
17302
17027
|
} else {
|
|
17303
17028
|
console.log(
|
|
17304
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17029
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk77.dim("not connected")}`
|
|
17305
17030
|
);
|
|
17306
17031
|
console.log();
|
|
17307
|
-
console.log(
|
|
17308
|
-
console.log(
|
|
17032
|
+
console.log(chalk77.dim("To connect:"));
|
|
17033
|
+
console.log(chalk77.dim(` vm0 connector connect ${type2}`));
|
|
17309
17034
|
}
|
|
17310
17035
|
})
|
|
17311
17036
|
);
|
|
17312
17037
|
|
|
17313
17038
|
// src/commands/connector/disconnect.ts
|
|
17314
|
-
import { Command as
|
|
17315
|
-
import
|
|
17316
|
-
var disconnectCommand = new
|
|
17039
|
+
import { Command as Command88 } from "commander";
|
|
17040
|
+
import chalk78 from "chalk";
|
|
17041
|
+
var disconnectCommand = new Command88().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
17317
17042
|
withErrorHandler(async (type2) => {
|
|
17318
17043
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
17319
17044
|
if (!parseResult.success) {
|
|
@@ -17324,33 +17049,33 @@ var disconnectCommand = new Command93().name("disconnect").description("Disconne
|
|
|
17324
17049
|
}
|
|
17325
17050
|
const connectorType = parseResult.data;
|
|
17326
17051
|
await deleteConnector(connectorType);
|
|
17327
|
-
console.log(
|
|
17052
|
+
console.log(chalk78.green(`\u2713 Disconnected ${type2}`));
|
|
17328
17053
|
})
|
|
17329
17054
|
);
|
|
17330
17055
|
|
|
17331
17056
|
// src/commands/connector/index.ts
|
|
17332
|
-
var connectorCommand = new
|
|
17057
|
+
var connectorCommand = new Command89().name("connector").description("Manage third-party service connections").addCommand(listCommand13).addCommand(statusCommand8).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
17333
17058
|
|
|
17334
17059
|
// src/commands/onboard/index.ts
|
|
17335
|
-
import { Command as
|
|
17336
|
-
import
|
|
17060
|
+
import { Command as Command90 } from "commander";
|
|
17061
|
+
import chalk82 from "chalk";
|
|
17337
17062
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
17338
17063
|
import { existsSync as existsSync12 } from "fs";
|
|
17339
17064
|
|
|
17340
17065
|
// src/lib/ui/welcome-box.ts
|
|
17341
|
-
import
|
|
17066
|
+
import chalk79 from "chalk";
|
|
17342
17067
|
var gradientColors = [
|
|
17343
|
-
|
|
17068
|
+
chalk79.hex("#FFAB5E"),
|
|
17344
17069
|
// Line 1 - lightest
|
|
17345
|
-
|
|
17070
|
+
chalk79.hex("#FF9642"),
|
|
17346
17071
|
// Line 2
|
|
17347
|
-
|
|
17072
|
+
chalk79.hex("#FF8228"),
|
|
17348
17073
|
// Line 3
|
|
17349
|
-
|
|
17074
|
+
chalk79.hex("#FF6D0A"),
|
|
17350
17075
|
// Line 4
|
|
17351
|
-
|
|
17076
|
+
chalk79.hex("#E85D00"),
|
|
17352
17077
|
// Line 5
|
|
17353
|
-
|
|
17078
|
+
chalk79.hex("#CC4E00")
|
|
17354
17079
|
// Line 6 - darkest
|
|
17355
17080
|
];
|
|
17356
17081
|
var vm0LogoLines = [
|
|
@@ -17372,15 +17097,15 @@ function renderVm0Banner() {
|
|
|
17372
17097
|
function renderOnboardWelcome() {
|
|
17373
17098
|
renderVm0Banner();
|
|
17374
17099
|
console.log(` Build agentic workflows using natural language.`);
|
|
17375
|
-
console.log(` ${
|
|
17100
|
+
console.log(` ${chalk79.dim("Currently in beta, enjoy it free")}`);
|
|
17376
17101
|
console.log(
|
|
17377
|
-
` ${
|
|
17102
|
+
` ${chalk79.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
17378
17103
|
);
|
|
17379
17104
|
console.log();
|
|
17380
17105
|
}
|
|
17381
17106
|
|
|
17382
17107
|
// src/lib/ui/step-runner.ts
|
|
17383
|
-
import
|
|
17108
|
+
import chalk80 from "chalk";
|
|
17384
17109
|
function createStepRunner(options = true) {
|
|
17385
17110
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
17386
17111
|
const interactive = opts.interactive ?? true;
|
|
@@ -17395,25 +17120,25 @@ function createStepRunner(options = true) {
|
|
|
17395
17120
|
}
|
|
17396
17121
|
for (const [i, step] of completedSteps.entries()) {
|
|
17397
17122
|
if (step.failed) {
|
|
17398
|
-
console.log(
|
|
17123
|
+
console.log(chalk80.red(`\u2717 ${step.label}`));
|
|
17399
17124
|
} else {
|
|
17400
|
-
console.log(
|
|
17125
|
+
console.log(chalk80.green(`\u25CF ${step.label}`));
|
|
17401
17126
|
}
|
|
17402
17127
|
const isLastStep = i === completedSteps.length - 1;
|
|
17403
17128
|
if (!isLastStep || !isFinal) {
|
|
17404
|
-
console.log(
|
|
17129
|
+
console.log(chalk80.dim("\u2502"));
|
|
17405
17130
|
}
|
|
17406
17131
|
}
|
|
17407
17132
|
}
|
|
17408
17133
|
async function executeStep(label, fn, isFinal) {
|
|
17409
17134
|
let stepFailed = false;
|
|
17410
|
-
console.log(
|
|
17135
|
+
console.log(chalk80.yellow(`\u25CB ${label}`));
|
|
17411
17136
|
const ctx = {
|
|
17412
17137
|
connector() {
|
|
17413
|
-
console.log(
|
|
17138
|
+
console.log(chalk80.dim("\u2502"));
|
|
17414
17139
|
},
|
|
17415
17140
|
detail(message) {
|
|
17416
|
-
console.log(`${
|
|
17141
|
+
console.log(`${chalk80.dim("\u2502")} ${message}`);
|
|
17417
17142
|
},
|
|
17418
17143
|
async prompt(promptFn) {
|
|
17419
17144
|
return await promptFn();
|
|
@@ -17430,12 +17155,12 @@ function createStepRunner(options = true) {
|
|
|
17430
17155
|
redrawCompletedSteps(isFinal);
|
|
17431
17156
|
} else {
|
|
17432
17157
|
if (stepFailed) {
|
|
17433
|
-
console.log(
|
|
17158
|
+
console.log(chalk80.red(`\u2717 ${label}`));
|
|
17434
17159
|
} else {
|
|
17435
|
-
console.log(
|
|
17160
|
+
console.log(chalk80.green(`\u25CF ${label}`));
|
|
17436
17161
|
}
|
|
17437
17162
|
if (!isFinal) {
|
|
17438
|
-
console.log(
|
|
17163
|
+
console.log(chalk80.dim("\u2502"));
|
|
17439
17164
|
}
|
|
17440
17165
|
}
|
|
17441
17166
|
}
|
|
@@ -17559,8 +17284,12 @@ var ONBOARD_PROVIDER_TYPES = [
|
|
|
17559
17284
|
"minimax-api-key",
|
|
17560
17285
|
"deepseek-api-key"
|
|
17561
17286
|
];
|
|
17287
|
+
async function checkIsOrgAdmin() {
|
|
17288
|
+
const org = await getOrg();
|
|
17289
|
+
return org.role === "admin";
|
|
17290
|
+
}
|
|
17562
17291
|
async function checkModelProviderStatus() {
|
|
17563
|
-
const response = await
|
|
17292
|
+
const response = await listOrgModelProviders();
|
|
17564
17293
|
return {
|
|
17565
17294
|
hasProvider: response.modelProviders.length > 0,
|
|
17566
17295
|
providers: response.modelProviders
|
|
@@ -17580,7 +17309,7 @@ function getProviderChoices() {
|
|
|
17580
17309
|
});
|
|
17581
17310
|
}
|
|
17582
17311
|
async function setupModelProvider(type2, secret, options) {
|
|
17583
|
-
const response = await
|
|
17312
|
+
const response = await upsertOrgModelProvider({
|
|
17584
17313
|
type: type2,
|
|
17585
17314
|
secret,
|
|
17586
17315
|
selectedModel: options?.selectedModel
|
|
@@ -17595,7 +17324,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
17595
17324
|
|
|
17596
17325
|
// src/lib/domain/onboard/claude-setup.ts
|
|
17597
17326
|
import { spawn as spawn3 } from "child_process";
|
|
17598
|
-
import
|
|
17327
|
+
import chalk81 from "chalk";
|
|
17599
17328
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
17600
17329
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
17601
17330
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17632,12 +17361,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17632
17361
|
}
|
|
17633
17362
|
function handlePluginError(error, context) {
|
|
17634
17363
|
const displayContext = context ?? "Claude plugin";
|
|
17635
|
-
console.error(
|
|
17364
|
+
console.error(chalk81.red(`\u2717 Failed to install ${displayContext}`));
|
|
17636
17365
|
if (error instanceof Error) {
|
|
17637
|
-
console.error(
|
|
17366
|
+
console.error(chalk81.red(`\u2717 ${error.message}`));
|
|
17638
17367
|
}
|
|
17639
17368
|
console.error(
|
|
17640
|
-
|
|
17369
|
+
chalk81.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17641
17370
|
);
|
|
17642
17371
|
process.exit(1);
|
|
17643
17372
|
}
|
|
@@ -17680,7 +17409,7 @@ async function updateMarketplace() {
|
|
|
17680
17409
|
]);
|
|
17681
17410
|
if (!result.success) {
|
|
17682
17411
|
console.warn(
|
|
17683
|
-
|
|
17412
|
+
chalk81.yellow(
|
|
17684
17413
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17685
17414
|
)
|
|
17686
17415
|
);
|
|
@@ -17726,9 +17455,9 @@ async function handleAuthentication(ctx) {
|
|
|
17726
17455
|
onInitiating: () => {
|
|
17727
17456
|
},
|
|
17728
17457
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17729
|
-
step.detail(`Copy code: ${
|
|
17730
|
-
step.detail(`Open: ${
|
|
17731
|
-
step.detail(
|
|
17458
|
+
step.detail(`Copy code: ${chalk82.cyan.bold(code)}`);
|
|
17459
|
+
step.detail(`Open: ${chalk82.cyan(url)}`);
|
|
17460
|
+
step.detail(chalk82.dim(`Expires in ${expiresIn} minutes`));
|
|
17732
17461
|
},
|
|
17733
17462
|
onPolling: () => {
|
|
17734
17463
|
},
|
|
@@ -17746,9 +17475,17 @@ async function handleModelProvider(ctx) {
|
|
|
17746
17475
|
if (providerStatus.hasProvider) {
|
|
17747
17476
|
return;
|
|
17748
17477
|
}
|
|
17478
|
+
const isAdmin = await checkIsOrgAdmin();
|
|
17479
|
+
if (!isAdmin) {
|
|
17480
|
+
throw new Error("No model provider configured", {
|
|
17481
|
+
cause: new Error(
|
|
17482
|
+
"Contact your org admin to configure a model provider"
|
|
17483
|
+
)
|
|
17484
|
+
});
|
|
17485
|
+
}
|
|
17749
17486
|
if (!ctx.interactive) {
|
|
17750
17487
|
throw new Error("No model provider configured", {
|
|
17751
|
-
cause: new Error("Run 'vm0 model-provider setup' first")
|
|
17488
|
+
cause: new Error("Run 'vm0 org model-provider setup' first")
|
|
17752
17489
|
});
|
|
17753
17490
|
}
|
|
17754
17491
|
const choices = getProviderChoices();
|
|
@@ -17768,14 +17505,14 @@ async function handleModelProvider(ctx) {
|
|
|
17768
17505
|
const selectedChoice = choices.find((c28) => c28.type === providerType);
|
|
17769
17506
|
if (selectedChoice?.helpText) {
|
|
17770
17507
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17771
|
-
step.detail(
|
|
17508
|
+
step.detail(chalk82.dim(line));
|
|
17772
17509
|
}
|
|
17773
17510
|
}
|
|
17774
17511
|
const secret = await step.prompt(
|
|
17775
17512
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17776
17513
|
);
|
|
17777
17514
|
if (!secret) {
|
|
17778
|
-
console.log(
|
|
17515
|
+
console.log(chalk82.dim("Cancelled"));
|
|
17779
17516
|
process.exit(0);
|
|
17780
17517
|
}
|
|
17781
17518
|
let selectedModel;
|
|
@@ -17794,7 +17531,7 @@ async function handleModelProvider(ctx) {
|
|
|
17794
17531
|
() => promptSelect("Select model:", modelChoices)
|
|
17795
17532
|
);
|
|
17796
17533
|
if (modelSelection === void 0) {
|
|
17797
|
-
console.log(
|
|
17534
|
+
console.log(chalk82.dim("Cancelled"));
|
|
17798
17535
|
process.exit(0);
|
|
17799
17536
|
}
|
|
17800
17537
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17804,7 +17541,7 @@ async function handleModelProvider(ctx) {
|
|
|
17804
17541
|
});
|
|
17805
17542
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17806
17543
|
step.detail(
|
|
17807
|
-
|
|
17544
|
+
chalk82.green(
|
|
17808
17545
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17809
17546
|
)
|
|
17810
17547
|
);
|
|
@@ -17835,7 +17572,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17835
17572
|
agentName = inputName;
|
|
17836
17573
|
if (existsSync12(agentName)) {
|
|
17837
17574
|
step.detail(
|
|
17838
|
-
|
|
17575
|
+
chalk82.yellow(`${agentName}/ already exists, choose another name`)
|
|
17839
17576
|
);
|
|
17840
17577
|
} else {
|
|
17841
17578
|
folderExists = false;
|
|
@@ -17856,7 +17593,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17856
17593
|
}
|
|
17857
17594
|
}
|
|
17858
17595
|
await mkdir8(agentName, { recursive: true });
|
|
17859
|
-
step.detail(
|
|
17596
|
+
step.detail(chalk82.green(`Created ${agentName}/`));
|
|
17860
17597
|
});
|
|
17861
17598
|
return agentName;
|
|
17862
17599
|
}
|
|
@@ -17872,7 +17609,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17872
17609
|
shouldInstall = confirmed ?? true;
|
|
17873
17610
|
}
|
|
17874
17611
|
if (!shouldInstall) {
|
|
17875
|
-
step.detail(
|
|
17612
|
+
step.detail(chalk82.dim("Skipped"));
|
|
17876
17613
|
return;
|
|
17877
17614
|
}
|
|
17878
17615
|
const scope = "project";
|
|
@@ -17880,7 +17617,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17880
17617
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17881
17618
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17882
17619
|
step.detail(
|
|
17883
|
-
|
|
17620
|
+
chalk82.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17884
17621
|
);
|
|
17885
17622
|
pluginInstalled = true;
|
|
17886
17623
|
} catch (error) {
|
|
@@ -17891,18 +17628,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17891
17628
|
}
|
|
17892
17629
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17893
17630
|
console.log();
|
|
17894
|
-
console.log(
|
|
17631
|
+
console.log(chalk82.bold("Next step:"));
|
|
17895
17632
|
console.log();
|
|
17896
17633
|
if (pluginInstalled) {
|
|
17897
17634
|
console.log(
|
|
17898
|
-
` ${
|
|
17635
|
+
` ${chalk82.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17899
17636
|
);
|
|
17900
17637
|
} else {
|
|
17901
|
-
console.log(` ${
|
|
17638
|
+
console.log(` ${chalk82.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17902
17639
|
}
|
|
17903
17640
|
console.log();
|
|
17904
17641
|
}
|
|
17905
|
-
var onboardCommand = new
|
|
17642
|
+
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
17643
|
withErrorHandler(async (options) => {
|
|
17907
17644
|
const interactive = isInteractive();
|
|
17908
17645
|
if (interactive) {
|
|
@@ -17927,21 +17664,21 @@ var onboardCommand = new Command95().name("onboard").description("Guided setup f
|
|
|
17927
17664
|
);
|
|
17928
17665
|
|
|
17929
17666
|
// src/commands/setup-claude/index.ts
|
|
17930
|
-
import { Command as
|
|
17931
|
-
import
|
|
17932
|
-
var setupClaudeCommand = new
|
|
17667
|
+
import { Command as Command91 } from "commander";
|
|
17668
|
+
import chalk83 from "chalk";
|
|
17669
|
+
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
17670
|
withErrorHandler(async (options) => {
|
|
17934
|
-
console.log(
|
|
17671
|
+
console.log(chalk83.dim("Installing VM0 Claude Plugin..."));
|
|
17935
17672
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17936
17673
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17937
17674
|
console.log(
|
|
17938
|
-
|
|
17675
|
+
chalk83.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17939
17676
|
);
|
|
17940
17677
|
console.log();
|
|
17941
17678
|
console.log("Next step:");
|
|
17942
17679
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17943
17680
|
console.log(
|
|
17944
|
-
|
|
17681
|
+
chalk83.cyan(
|
|
17945
17682
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17946
17683
|
)
|
|
17947
17684
|
);
|
|
@@ -17949,36 +17686,36 @@ var setupClaudeCommand = new Command96().name("setup-claude").description("Insta
|
|
|
17949
17686
|
);
|
|
17950
17687
|
|
|
17951
17688
|
// src/commands/dashboard/index.ts
|
|
17952
|
-
import { Command as
|
|
17953
|
-
import
|
|
17954
|
-
var dashboardCommand = new
|
|
17689
|
+
import { Command as Command92 } from "commander";
|
|
17690
|
+
import chalk84 from "chalk";
|
|
17691
|
+
var dashboardCommand = new Command92().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
17955
17692
|
console.log();
|
|
17956
|
-
console.log(
|
|
17693
|
+
console.log(chalk84.bold("VM0 Dashboard"));
|
|
17957
17694
|
console.log();
|
|
17958
|
-
console.log(
|
|
17959
|
-
console.log(
|
|
17695
|
+
console.log(chalk84.bold("Agents"));
|
|
17696
|
+
console.log(chalk84.dim(" List agents: ") + "vm0 agent list");
|
|
17960
17697
|
console.log();
|
|
17961
|
-
console.log(
|
|
17962
|
-
console.log(
|
|
17963
|
-
console.log(
|
|
17698
|
+
console.log(chalk84.bold("Runs"));
|
|
17699
|
+
console.log(chalk84.dim(" Recent runs: ") + "vm0 run list");
|
|
17700
|
+
console.log(chalk84.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
17964
17701
|
console.log();
|
|
17965
|
-
console.log(
|
|
17966
|
-
console.log(
|
|
17702
|
+
console.log(chalk84.bold("Schedules"));
|
|
17703
|
+
console.log(chalk84.dim(" List schedules: ") + "vm0 schedule list");
|
|
17967
17704
|
console.log();
|
|
17968
|
-
console.log(
|
|
17969
|
-
console.log(
|
|
17970
|
-
console.log(
|
|
17971
|
-
console.log(
|
|
17705
|
+
console.log(chalk84.bold("Account"));
|
|
17706
|
+
console.log(chalk84.dim(" Usage stats: ") + "vm0 usage");
|
|
17707
|
+
console.log(chalk84.dim(" List secrets: ") + "vm0 secret list");
|
|
17708
|
+
console.log(chalk84.dim(" List variables: ") + "vm0 variable list");
|
|
17972
17709
|
console.log();
|
|
17973
17710
|
console.log(
|
|
17974
|
-
|
|
17711
|
+
chalk84.dim("Not logged in? Run: ") + chalk84.cyan("vm0 auth login")
|
|
17975
17712
|
);
|
|
17976
17713
|
console.log();
|
|
17977
17714
|
});
|
|
17978
17715
|
|
|
17979
17716
|
// src/commands/preference/index.ts
|
|
17980
|
-
import { Command as
|
|
17981
|
-
import
|
|
17717
|
+
import { Command as Command93 } from "commander";
|
|
17718
|
+
import chalk85 from "chalk";
|
|
17982
17719
|
function detectTimezone2() {
|
|
17983
17720
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17984
17721
|
}
|
|
@@ -17999,15 +17736,15 @@ function parseOnOff(flag, value) {
|
|
|
17999
17736
|
);
|
|
18000
17737
|
}
|
|
18001
17738
|
function displayPreferences(prefs) {
|
|
18002
|
-
console.log(
|
|
17739
|
+
console.log(chalk85.bold("Current preferences:"));
|
|
18003
17740
|
console.log(
|
|
18004
|
-
` Timezone: ${prefs.timezone ?
|
|
17741
|
+
` Timezone: ${prefs.timezone ? chalk85.cyan(prefs.timezone) : chalk85.dim("not set")}`
|
|
18005
17742
|
);
|
|
18006
17743
|
console.log(
|
|
18007
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17744
|
+
` Email notify: ${prefs.notifyEmail ? chalk85.green("on") : chalk85.dim("off")}`
|
|
18008
17745
|
);
|
|
18009
17746
|
console.log(
|
|
18010
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17747
|
+
` Slack notify: ${prefs.notifySlack ? chalk85.green("on") : chalk85.dim("off")}`
|
|
18011
17748
|
);
|
|
18012
17749
|
}
|
|
18013
17750
|
function buildUpdates(opts) {
|
|
@@ -18037,21 +17774,21 @@ function buildUpdates(opts) {
|
|
|
18037
17774
|
function printUpdateResult(updates, result) {
|
|
18038
17775
|
if (updates.timezone !== void 0) {
|
|
18039
17776
|
console.log(
|
|
18040
|
-
|
|
18041
|
-
`Timezone set to ${
|
|
17777
|
+
chalk85.green(
|
|
17778
|
+
`Timezone set to ${chalk85.cyan(result.timezone ?? updates.timezone)}`
|
|
18042
17779
|
)
|
|
18043
17780
|
);
|
|
18044
17781
|
}
|
|
18045
17782
|
if (updates.notifyEmail !== void 0) {
|
|
18046
17783
|
console.log(
|
|
18047
|
-
|
|
17784
|
+
chalk85.green(
|
|
18048
17785
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
18049
17786
|
)
|
|
18050
17787
|
);
|
|
18051
17788
|
}
|
|
18052
17789
|
if (updates.notifySlack !== void 0) {
|
|
18053
17790
|
console.log(
|
|
18054
|
-
|
|
17791
|
+
chalk85.green(
|
|
18055
17792
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
18056
17793
|
)
|
|
18057
17794
|
);
|
|
@@ -18060,7 +17797,7 @@ function printUpdateResult(updates, result) {
|
|
|
18060
17797
|
async function interactiveSetup(prefs) {
|
|
18061
17798
|
if (!prefs.timezone) {
|
|
18062
17799
|
const detectedTz = detectTimezone2();
|
|
18063
|
-
console.log(
|
|
17800
|
+
console.log(chalk85.dim(`
|
|
18064
17801
|
System timezone detected: ${detectedTz}`));
|
|
18065
17802
|
const tz = await promptText(
|
|
18066
17803
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -18071,7 +17808,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
18071
17808
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
18072
17809
|
}
|
|
18073
17810
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
18074
|
-
console.log(
|
|
17811
|
+
console.log(chalk85.green(`Timezone set to ${chalk85.cyan(tz.trim())}`));
|
|
18075
17812
|
}
|
|
18076
17813
|
}
|
|
18077
17814
|
if (!prefs.notifyEmail) {
|
|
@@ -18081,11 +17818,11 @@ System timezone detected: ${detectedTz}`));
|
|
|
18081
17818
|
);
|
|
18082
17819
|
if (enable) {
|
|
18083
17820
|
await updateUserPreferences({ notifyEmail: true });
|
|
18084
|
-
console.log(
|
|
17821
|
+
console.log(chalk85.green("Email notifications enabled"));
|
|
18085
17822
|
}
|
|
18086
17823
|
}
|
|
18087
17824
|
}
|
|
18088
|
-
var preferenceCommand = new
|
|
17825
|
+
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
17826
|
withErrorHandler(async (opts) => {
|
|
18090
17827
|
const updates = buildUpdates(opts);
|
|
18091
17828
|
if (updates) {
|
|
@@ -18100,32 +17837,32 @@ var preferenceCommand = new Command98().name("preference").description("View or
|
|
|
18100
17837
|
} else if (!prefs.timezone) {
|
|
18101
17838
|
console.log();
|
|
18102
17839
|
console.log(
|
|
18103
|
-
`To set timezone: ${
|
|
17840
|
+
`To set timezone: ${chalk85.cyan("vm0 preference --timezone <timezone>")}`
|
|
18104
17841
|
);
|
|
18105
17842
|
console.log(
|
|
18106
|
-
|
|
17843
|
+
chalk85.dim("Example: vm0 preference --timezone America/New_York")
|
|
18107
17844
|
);
|
|
18108
17845
|
}
|
|
18109
17846
|
})
|
|
18110
17847
|
);
|
|
18111
17848
|
|
|
18112
17849
|
// src/commands/upgrade/index.ts
|
|
18113
|
-
import { Command as
|
|
18114
|
-
import
|
|
18115
|
-
var upgradeCommand = new
|
|
17850
|
+
import { Command as Command94 } from "commander";
|
|
17851
|
+
import chalk86 from "chalk";
|
|
17852
|
+
var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
18116
17853
|
withErrorHandler(async () => {
|
|
18117
17854
|
console.log("Checking for updates...");
|
|
18118
17855
|
const latestVersion = await getLatestVersion();
|
|
18119
17856
|
if (latestVersion === null) {
|
|
18120
17857
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18121
17858
|
}
|
|
18122
|
-
if (latestVersion === "9.
|
|
18123
|
-
console.log(
|
|
17859
|
+
if (latestVersion === "9.65.1") {
|
|
17860
|
+
console.log(chalk86.green(`\u2713 Already up to date (${"9.65.1"})`));
|
|
18124
17861
|
return;
|
|
18125
17862
|
}
|
|
18126
17863
|
console.log(
|
|
18127
|
-
|
|
18128
|
-
`Current version: ${"9.
|
|
17864
|
+
chalk86.yellow(
|
|
17865
|
+
`Current version: ${"9.65.1"} -> Latest version: ${latestVersion}`
|
|
18129
17866
|
)
|
|
18130
17867
|
);
|
|
18131
17868
|
console.log();
|
|
@@ -18133,26 +17870,26 @@ var upgradeCommand = new Command99().name("upgrade").description("Upgrade vm0 CL
|
|
|
18133
17870
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
18134
17871
|
if (packageManager === "unknown") {
|
|
18135
17872
|
console.log(
|
|
18136
|
-
|
|
17873
|
+
chalk86.yellow(
|
|
18137
17874
|
"Could not detect your package manager for auto-upgrade."
|
|
18138
17875
|
)
|
|
18139
17876
|
);
|
|
18140
17877
|
} else {
|
|
18141
17878
|
console.log(
|
|
18142
|
-
|
|
17879
|
+
chalk86.yellow(
|
|
18143
17880
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
18144
17881
|
)
|
|
18145
17882
|
);
|
|
18146
17883
|
}
|
|
18147
|
-
console.log(
|
|
18148
|
-
console.log(
|
|
17884
|
+
console.log(chalk86.yellow("Please upgrade manually:"));
|
|
17885
|
+
console.log(chalk86.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
18149
17886
|
return;
|
|
18150
17887
|
}
|
|
18151
17888
|
console.log(`Upgrading via ${packageManager}...`);
|
|
18152
17889
|
const success = await performUpgrade(packageManager);
|
|
18153
17890
|
if (success) {
|
|
18154
17891
|
console.log(
|
|
18155
|
-
|
|
17892
|
+
chalk86.green(`\u2713 Upgraded from ${"9.65.1"} to ${latestVersion}`)
|
|
18156
17893
|
);
|
|
18157
17894
|
return;
|
|
18158
17895
|
}
|
|
@@ -18165,8 +17902,8 @@ var upgradeCommand = new Command99().name("upgrade").description("Upgrade vm0 CL
|
|
|
18165
17902
|
);
|
|
18166
17903
|
|
|
18167
17904
|
// src/index.ts
|
|
18168
|
-
var program = new
|
|
18169
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
17905
|
+
var program = new Command95();
|
|
17906
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.65.1");
|
|
18170
17907
|
program.addCommand(authCommand);
|
|
18171
17908
|
program.addCommand(infoCommand);
|
|
18172
17909
|
program.addCommand(composeCommand);
|
|
@@ -18183,7 +17920,6 @@ program.addCommand(scheduleCommand);
|
|
|
18183
17920
|
program.addCommand(usageCommand);
|
|
18184
17921
|
program.addCommand(secretCommand);
|
|
18185
17922
|
program.addCommand(variableCommand);
|
|
18186
|
-
program.addCommand(modelProviderCommand2);
|
|
18187
17923
|
program.addCommand(connectorCommand);
|
|
18188
17924
|
program.addCommand(onboardCommand);
|
|
18189
17925
|
program.addCommand(setupClaudeCommand);
|