@vm0/cli 9.24.0 → 9.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +579 -548
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ if (DSN) {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
Sentry.setContext("cli", {
|
|
64
|
-
version: "9.
|
|
64
|
+
version: "9.25.0",
|
|
65
65
|
command: process.argv.slice(2).join(" ")
|
|
66
66
|
});
|
|
67
67
|
Sentry.setContext("runtime", {
|
|
@@ -72,7 +72,7 @@ if (DSN) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/index.ts
|
|
75
|
-
import { Command as
|
|
75
|
+
import { Command as Command75 } from "commander";
|
|
76
76
|
|
|
77
77
|
// src/commands/auth/index.ts
|
|
78
78
|
import { Command as Command5 } from "commander";
|
|
@@ -1965,7 +1965,7 @@ var secretNameSchema = z14.string().min(1, "Secret name is required").max(255, "
|
|
|
1965
1965
|
/^[A-Z][A-Z0-9_]*$/,
|
|
1966
1966
|
"Secret name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
|
|
1967
1967
|
);
|
|
1968
|
-
var secretTypeSchema = z14.enum(["user", "model-provider"]);
|
|
1968
|
+
var secretTypeSchema = z14.enum(["user", "model-provider", "connector"]);
|
|
1969
1969
|
var secretResponseSchema = z14.object({
|
|
1970
1970
|
id: z14.string().uuid(),
|
|
1971
1971
|
name: z14.string(),
|
|
@@ -2594,12 +2594,9 @@ var c14 = initContract();
|
|
|
2594
2594
|
var sessionResponseSchema = z17.object({
|
|
2595
2595
|
id: z17.string(),
|
|
2596
2596
|
agentComposeId: z17.string(),
|
|
2597
|
-
agentComposeVersionId: z17.string().nullable(),
|
|
2598
2597
|
conversationId: z17.string().nullable(),
|
|
2599
2598
|
artifactName: z17.string().nullable(),
|
|
2600
|
-
vars: z17.record(z17.string(), z17.string()).nullable(),
|
|
2601
2599
|
secretNames: z17.array(z17.string()).nullable(),
|
|
2602
|
-
volumeVersions: z17.record(z17.string(), z17.string()).nullable(),
|
|
2603
2600
|
createdAt: z17.string(),
|
|
2604
2601
|
updatedAt: z17.string()
|
|
2605
2602
|
});
|
|
@@ -2700,8 +2697,7 @@ var deployScheduleRequestSchema = z18.object({
|
|
|
2700
2697
|
atTime: z18.string().optional(),
|
|
2701
2698
|
timezone: z18.string().default("UTC"),
|
|
2702
2699
|
prompt: z18.string().min(1, "Prompt required"),
|
|
2703
|
-
vars
|
|
2704
|
-
secrets: z18.record(z18.string(), z18.string()).optional(),
|
|
2700
|
+
// vars and secrets removed - now managed via platform tables
|
|
2705
2701
|
artifactName: z18.string().optional(),
|
|
2706
2702
|
artifactVersion: z18.string().optional(),
|
|
2707
2703
|
volumeVersions: z18.record(z18.string(), z18.string()).optional(),
|
|
@@ -3238,6 +3234,34 @@ var webhookComposeCompleteContract = c19.router({
|
|
|
3238
3234
|
// ../../packages/core/src/contracts/connectors.ts
|
|
3239
3235
|
import { z as z24 } from "zod";
|
|
3240
3236
|
var c20 = initContract();
|
|
3237
|
+
var CONNECTOR_TYPES = {
|
|
3238
|
+
github: {
|
|
3239
|
+
label: "GitHub",
|
|
3240
|
+
helpText: "Connect your GitHub account to access repositories and GitHub features",
|
|
3241
|
+
authMethods: {
|
|
3242
|
+
oauth: {
|
|
3243
|
+
label: "OAuth (Recommended)",
|
|
3244
|
+
helpText: "Sign in with GitHub to grant access.",
|
|
3245
|
+
secrets: {
|
|
3246
|
+
GITHUB_ACCESS_TOKEN: {
|
|
3247
|
+
label: "Access Token",
|
|
3248
|
+
required: true
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
},
|
|
3253
|
+
defaultAuthMethod: "oauth",
|
|
3254
|
+
environmentMapping: {
|
|
3255
|
+
GH_TOKEN: "$secrets.GITHUB_ACCESS_TOKEN",
|
|
3256
|
+
GITHUB_TOKEN: "$secrets.GITHUB_ACCESS_TOKEN"
|
|
3257
|
+
},
|
|
3258
|
+
oauth: {
|
|
3259
|
+
authorizationUrl: "https://github.com/login/oauth/authorize",
|
|
3260
|
+
tokenUrl: "https://github.com/login/oauth/access_token",
|
|
3261
|
+
scopes: ["repo"]
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3241
3265
|
var connectorTypeSchema = z24.enum(["github"]);
|
|
3242
3266
|
var connectorResponseSchema = z24.object({
|
|
3243
3267
|
id: z24.string().uuid(),
|
|
@@ -4579,6 +4603,43 @@ async function updateModelProviderModel(type, selectedModel) {
|
|
|
4579
4603
|
handleError(result, "Failed to update model provider");
|
|
4580
4604
|
}
|
|
4581
4605
|
|
|
4606
|
+
// src/lib/api/domains/connectors.ts
|
|
4607
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
4608
|
+
async function listConnectors() {
|
|
4609
|
+
const config = await getClientConfig();
|
|
4610
|
+
const client = initClient10(connectorsMainContract, config);
|
|
4611
|
+
const result = await client.list({ headers: {} });
|
|
4612
|
+
if (result.status === 200) {
|
|
4613
|
+
return result.body;
|
|
4614
|
+
}
|
|
4615
|
+
handleError(result, "Failed to list connectors");
|
|
4616
|
+
}
|
|
4617
|
+
async function deleteConnector(type) {
|
|
4618
|
+
const config = await getClientConfig();
|
|
4619
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
4620
|
+
const result = await client.delete({
|
|
4621
|
+
params: { type }
|
|
4622
|
+
});
|
|
4623
|
+
if (result.status === 204) {
|
|
4624
|
+
return;
|
|
4625
|
+
}
|
|
4626
|
+
handleError(result, `Connector "${type}" not found`);
|
|
4627
|
+
}
|
|
4628
|
+
async function getConnector(type) {
|
|
4629
|
+
const config = await getClientConfig();
|
|
4630
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
4631
|
+
const result = await client.get({
|
|
4632
|
+
params: { type }
|
|
4633
|
+
});
|
|
4634
|
+
if (result.status === 200) {
|
|
4635
|
+
return result.body;
|
|
4636
|
+
}
|
|
4637
|
+
if (result.status === 404) {
|
|
4638
|
+
return null;
|
|
4639
|
+
}
|
|
4640
|
+
handleError(result, `Failed to get connector "${type}"`);
|
|
4641
|
+
}
|
|
4642
|
+
|
|
4582
4643
|
// src/lib/api/domains/usage.ts
|
|
4583
4644
|
async function getUsage(options) {
|
|
4584
4645
|
const baseUrl = await getBaseUrl();
|
|
@@ -5840,7 +5901,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5840
5901
|
);
|
|
5841
5902
|
}
|
|
5842
5903
|
if (options.autoUpdate !== false) {
|
|
5843
|
-
await silentUpgradeAfterCommand("9.
|
|
5904
|
+
await silentUpgradeAfterCommand("9.25.0");
|
|
5844
5905
|
}
|
|
5845
5906
|
return result;
|
|
5846
5907
|
}
|
|
@@ -6956,7 +7017,7 @@ var CodexEventRenderer = class {
|
|
|
6956
7017
|
};
|
|
6957
7018
|
|
|
6958
7019
|
// src/lib/api/api-client.ts
|
|
6959
|
-
import { initClient as
|
|
7020
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
6960
7021
|
var ApiClient = class {
|
|
6961
7022
|
async getHeaders() {
|
|
6962
7023
|
const token = await getToken();
|
|
@@ -6982,7 +7043,7 @@ var ApiClient = class {
|
|
|
6982
7043
|
async getComposeByName(name, scope) {
|
|
6983
7044
|
const baseUrl = await this.getBaseUrl();
|
|
6984
7045
|
const headers = await this.getHeaders();
|
|
6985
|
-
const client =
|
|
7046
|
+
const client = initClient11(composesMainContract, {
|
|
6986
7047
|
baseUrl,
|
|
6987
7048
|
baseHeaders: headers,
|
|
6988
7049
|
jsonQuery: true
|
|
@@ -7003,7 +7064,7 @@ var ApiClient = class {
|
|
|
7003
7064
|
async getComposeById(id) {
|
|
7004
7065
|
const baseUrl = await this.getBaseUrl();
|
|
7005
7066
|
const headers = await this.getHeaders();
|
|
7006
|
-
const client =
|
|
7067
|
+
const client = initClient11(composesByIdContract, {
|
|
7007
7068
|
baseUrl,
|
|
7008
7069
|
baseHeaders: headers,
|
|
7009
7070
|
jsonQuery: true
|
|
@@ -7025,7 +7086,7 @@ var ApiClient = class {
|
|
|
7025
7086
|
async getComposeVersion(composeId, version) {
|
|
7026
7087
|
const baseUrl = await this.getBaseUrl();
|
|
7027
7088
|
const headers = await this.getHeaders();
|
|
7028
|
-
const client =
|
|
7089
|
+
const client = initClient11(composesVersionsContract, {
|
|
7029
7090
|
baseUrl,
|
|
7030
7091
|
baseHeaders: headers,
|
|
7031
7092
|
jsonQuery: true
|
|
@@ -7046,7 +7107,7 @@ var ApiClient = class {
|
|
|
7046
7107
|
async createOrUpdateCompose(body) {
|
|
7047
7108
|
const baseUrl = await this.getBaseUrl();
|
|
7048
7109
|
const headers = await this.getHeaders();
|
|
7049
|
-
const client =
|
|
7110
|
+
const client = initClient11(composesMainContract, {
|
|
7050
7111
|
baseUrl,
|
|
7051
7112
|
baseHeaders: headers,
|
|
7052
7113
|
jsonQuery: true
|
|
@@ -7069,7 +7130,7 @@ var ApiClient = class {
|
|
|
7069
7130
|
async createRun(body) {
|
|
7070
7131
|
const baseUrl = await this.getBaseUrl();
|
|
7071
7132
|
const headers = await this.getHeaders();
|
|
7072
|
-
const client =
|
|
7133
|
+
const client = initClient11(runsMainContract, {
|
|
7073
7134
|
baseUrl,
|
|
7074
7135
|
baseHeaders: headers,
|
|
7075
7136
|
jsonQuery: true
|
|
@@ -7085,7 +7146,7 @@ var ApiClient = class {
|
|
|
7085
7146
|
async getEvents(runId, options) {
|
|
7086
7147
|
const baseUrl = await this.getBaseUrl();
|
|
7087
7148
|
const headers = await this.getHeaders();
|
|
7088
|
-
const client =
|
|
7149
|
+
const client = initClient11(runEventsContract, {
|
|
7089
7150
|
baseUrl,
|
|
7090
7151
|
baseHeaders: headers,
|
|
7091
7152
|
jsonQuery: true
|
|
@@ -7107,7 +7168,7 @@ var ApiClient = class {
|
|
|
7107
7168
|
async getSystemLog(runId, options) {
|
|
7108
7169
|
const baseUrl = await this.getBaseUrl();
|
|
7109
7170
|
const headers = await this.getHeaders();
|
|
7110
|
-
const client =
|
|
7171
|
+
const client = initClient11(runSystemLogContract, {
|
|
7111
7172
|
baseUrl,
|
|
7112
7173
|
baseHeaders: headers,
|
|
7113
7174
|
jsonQuery: true
|
|
@@ -7130,7 +7191,7 @@ var ApiClient = class {
|
|
|
7130
7191
|
async getMetrics(runId, options) {
|
|
7131
7192
|
const baseUrl = await this.getBaseUrl();
|
|
7132
7193
|
const headers = await this.getHeaders();
|
|
7133
|
-
const client =
|
|
7194
|
+
const client = initClient11(runMetricsContract, {
|
|
7134
7195
|
baseUrl,
|
|
7135
7196
|
baseHeaders: headers,
|
|
7136
7197
|
jsonQuery: true
|
|
@@ -7153,7 +7214,7 @@ var ApiClient = class {
|
|
|
7153
7214
|
async getAgentEvents(runId, options) {
|
|
7154
7215
|
const baseUrl = await this.getBaseUrl();
|
|
7155
7216
|
const headers = await this.getHeaders();
|
|
7156
|
-
const client =
|
|
7217
|
+
const client = initClient11(runAgentEventsContract, {
|
|
7157
7218
|
baseUrl,
|
|
7158
7219
|
baseHeaders: headers,
|
|
7159
7220
|
jsonQuery: true
|
|
@@ -7176,7 +7237,7 @@ var ApiClient = class {
|
|
|
7176
7237
|
async getNetworkLogs(runId, options) {
|
|
7177
7238
|
const baseUrl = await this.getBaseUrl();
|
|
7178
7239
|
const headers = await this.getHeaders();
|
|
7179
|
-
const client =
|
|
7240
|
+
const client = initClient11(runNetworkLogsContract, {
|
|
7180
7241
|
baseUrl,
|
|
7181
7242
|
baseHeaders: headers,
|
|
7182
7243
|
jsonQuery: true
|
|
@@ -7202,7 +7263,7 @@ var ApiClient = class {
|
|
|
7202
7263
|
async getScope() {
|
|
7203
7264
|
const baseUrl = await this.getBaseUrl();
|
|
7204
7265
|
const headers = await this.getHeaders();
|
|
7205
|
-
const client =
|
|
7266
|
+
const client = initClient11(scopeContract, {
|
|
7206
7267
|
baseUrl,
|
|
7207
7268
|
baseHeaders: headers,
|
|
7208
7269
|
jsonQuery: true
|
|
@@ -7221,7 +7282,7 @@ var ApiClient = class {
|
|
|
7221
7282
|
async createScope(body) {
|
|
7222
7283
|
const baseUrl = await this.getBaseUrl();
|
|
7223
7284
|
const headers = await this.getHeaders();
|
|
7224
|
-
const client =
|
|
7285
|
+
const client = initClient11(scopeContract, {
|
|
7225
7286
|
baseUrl,
|
|
7226
7287
|
baseHeaders: headers,
|
|
7227
7288
|
jsonQuery: true
|
|
@@ -7240,7 +7301,7 @@ var ApiClient = class {
|
|
|
7240
7301
|
async updateScope(body) {
|
|
7241
7302
|
const baseUrl = await this.getBaseUrl();
|
|
7242
7303
|
const headers = await this.getHeaders();
|
|
7243
|
-
const client =
|
|
7304
|
+
const client = initClient11(scopeContract, {
|
|
7244
7305
|
baseUrl,
|
|
7245
7306
|
baseHeaders: headers,
|
|
7246
7307
|
jsonQuery: true
|
|
@@ -7260,7 +7321,7 @@ var ApiClient = class {
|
|
|
7260
7321
|
async getSession(sessionId) {
|
|
7261
7322
|
const baseUrl = await this.getBaseUrl();
|
|
7262
7323
|
const headers = await this.getHeaders();
|
|
7263
|
-
const client =
|
|
7324
|
+
const client = initClient11(sessionsByIdContract, {
|
|
7264
7325
|
baseUrl,
|
|
7265
7326
|
baseHeaders: headers,
|
|
7266
7327
|
jsonQuery: true
|
|
@@ -7282,7 +7343,7 @@ var ApiClient = class {
|
|
|
7282
7343
|
async getCheckpoint(checkpointId) {
|
|
7283
7344
|
const baseUrl = await this.getBaseUrl();
|
|
7284
7345
|
const headers = await this.getHeaders();
|
|
7285
|
-
const client =
|
|
7346
|
+
const client = initClient11(checkpointsByIdContract, {
|
|
7286
7347
|
baseUrl,
|
|
7287
7348
|
baseHeaders: headers,
|
|
7288
7349
|
jsonQuery: true
|
|
@@ -7303,7 +7364,7 @@ var ApiClient = class {
|
|
|
7303
7364
|
async prepareStorage(body) {
|
|
7304
7365
|
const baseUrl = await this.getBaseUrl();
|
|
7305
7366
|
const headers = await this.getHeaders();
|
|
7306
|
-
const client =
|
|
7367
|
+
const client = initClient11(storagesPrepareContract, {
|
|
7307
7368
|
baseUrl,
|
|
7308
7369
|
baseHeaders: headers,
|
|
7309
7370
|
jsonQuery: true
|
|
@@ -7322,7 +7383,7 @@ var ApiClient = class {
|
|
|
7322
7383
|
async commitStorage(body) {
|
|
7323
7384
|
const baseUrl = await this.getBaseUrl();
|
|
7324
7385
|
const headers = await this.getHeaders();
|
|
7325
|
-
const client =
|
|
7386
|
+
const client = initClient11(storagesCommitContract, {
|
|
7326
7387
|
baseUrl,
|
|
7327
7388
|
baseHeaders: headers,
|
|
7328
7389
|
jsonQuery: true
|
|
@@ -7341,7 +7402,7 @@ var ApiClient = class {
|
|
|
7341
7402
|
async getStorageDownload(query) {
|
|
7342
7403
|
const baseUrl = await this.getBaseUrl();
|
|
7343
7404
|
const headers = await this.getHeaders();
|
|
7344
|
-
const client =
|
|
7405
|
+
const client = initClient11(storagesDownloadContract, {
|
|
7345
7406
|
baseUrl,
|
|
7346
7407
|
baseHeaders: headers,
|
|
7347
7408
|
jsonQuery: true
|
|
@@ -7366,7 +7427,7 @@ var ApiClient = class {
|
|
|
7366
7427
|
async listStorages(query) {
|
|
7367
7428
|
const baseUrl = await this.getBaseUrl();
|
|
7368
7429
|
const headers = await this.getHeaders();
|
|
7369
|
-
const client =
|
|
7430
|
+
const client = initClient11(storagesListContract, {
|
|
7370
7431
|
baseUrl,
|
|
7371
7432
|
baseHeaders: headers,
|
|
7372
7433
|
jsonQuery: true
|
|
@@ -7381,11 +7442,12 @@ var ApiClient = class {
|
|
|
7381
7442
|
}
|
|
7382
7443
|
/**
|
|
7383
7444
|
* Deploy schedule (create or update)
|
|
7445
|
+
* Note: vars and secrets are now managed via platform tables (vm0 secret set, vm0 var set)
|
|
7384
7446
|
*/
|
|
7385
7447
|
async deploySchedule(body) {
|
|
7386
7448
|
const baseUrl = await this.getBaseUrl();
|
|
7387
7449
|
const headers = await this.getHeaders();
|
|
7388
|
-
const client =
|
|
7450
|
+
const client = initClient11(schedulesMainContract, {
|
|
7389
7451
|
baseUrl,
|
|
7390
7452
|
baseHeaders: headers,
|
|
7391
7453
|
jsonQuery: true
|
|
@@ -7404,7 +7466,7 @@ var ApiClient = class {
|
|
|
7404
7466
|
async listSchedules() {
|
|
7405
7467
|
const baseUrl = await this.getBaseUrl();
|
|
7406
7468
|
const headers = await this.getHeaders();
|
|
7407
|
-
const client =
|
|
7469
|
+
const client = initClient11(schedulesMainContract, {
|
|
7408
7470
|
baseUrl,
|
|
7409
7471
|
baseHeaders: headers,
|
|
7410
7472
|
jsonQuery: true
|
|
@@ -7423,7 +7485,7 @@ var ApiClient = class {
|
|
|
7423
7485
|
async getScheduleByName(params) {
|
|
7424
7486
|
const baseUrl = await this.getBaseUrl();
|
|
7425
7487
|
const headers = await this.getHeaders();
|
|
7426
|
-
const client =
|
|
7488
|
+
const client = initClient11(schedulesByNameContract, {
|
|
7427
7489
|
baseUrl,
|
|
7428
7490
|
baseHeaders: headers,
|
|
7429
7491
|
jsonQuery: true
|
|
@@ -7445,7 +7507,7 @@ var ApiClient = class {
|
|
|
7445
7507
|
async deleteSchedule(params) {
|
|
7446
7508
|
const baseUrl = await this.getBaseUrl();
|
|
7447
7509
|
const headers = await this.getHeaders();
|
|
7448
|
-
const client =
|
|
7510
|
+
const client = initClient11(schedulesByNameContract, {
|
|
7449
7511
|
baseUrl,
|
|
7450
7512
|
baseHeaders: headers,
|
|
7451
7513
|
jsonQuery: true
|
|
@@ -7467,7 +7529,7 @@ var ApiClient = class {
|
|
|
7467
7529
|
async enableSchedule(params) {
|
|
7468
7530
|
const baseUrl = await this.getBaseUrl();
|
|
7469
7531
|
const headers = await this.getHeaders();
|
|
7470
|
-
const client =
|
|
7532
|
+
const client = initClient11(schedulesEnableContract, {
|
|
7471
7533
|
baseUrl,
|
|
7472
7534
|
baseHeaders: headers,
|
|
7473
7535
|
jsonQuery: true
|
|
@@ -7489,7 +7551,7 @@ var ApiClient = class {
|
|
|
7489
7551
|
async disableSchedule(params) {
|
|
7490
7552
|
const baseUrl = await this.getBaseUrl();
|
|
7491
7553
|
const headers = await this.getHeaders();
|
|
7492
|
-
const client =
|
|
7554
|
+
const client = initClient11(schedulesEnableContract, {
|
|
7493
7555
|
baseUrl,
|
|
7494
7556
|
baseHeaders: headers,
|
|
7495
7557
|
jsonQuery: true
|
|
@@ -7511,7 +7573,7 @@ var ApiClient = class {
|
|
|
7511
7573
|
async listScheduleRuns(params) {
|
|
7512
7574
|
const baseUrl = await this.getBaseUrl();
|
|
7513
7575
|
const headers = await this.getHeaders();
|
|
7514
|
-
const client =
|
|
7576
|
+
const client = initClient11(scheduleRunsContract, {
|
|
7515
7577
|
baseUrl,
|
|
7516
7578
|
baseHeaders: headers,
|
|
7517
7579
|
jsonQuery: true
|
|
@@ -7536,7 +7598,7 @@ var ApiClient = class {
|
|
|
7536
7598
|
async listPublicAgents(query) {
|
|
7537
7599
|
const baseUrl = await this.getBaseUrl();
|
|
7538
7600
|
const headers = await this.getHeaders();
|
|
7539
|
-
const client =
|
|
7601
|
+
const client = initClient11(publicAgentsListContract, {
|
|
7540
7602
|
baseUrl,
|
|
7541
7603
|
baseHeaders: headers,
|
|
7542
7604
|
jsonQuery: true
|
|
@@ -7555,7 +7617,7 @@ var ApiClient = class {
|
|
|
7555
7617
|
async listPublicArtifacts(query) {
|
|
7556
7618
|
const baseUrl = await this.getBaseUrl();
|
|
7557
7619
|
const headers = await this.getHeaders();
|
|
7558
|
-
const client =
|
|
7620
|
+
const client = initClient11(publicArtifactsListContract, {
|
|
7559
7621
|
baseUrl,
|
|
7560
7622
|
baseHeaders: headers,
|
|
7561
7623
|
jsonQuery: true
|
|
@@ -7574,7 +7636,7 @@ var ApiClient = class {
|
|
|
7574
7636
|
async getPublicArtifact(id) {
|
|
7575
7637
|
const baseUrl = await this.getBaseUrl();
|
|
7576
7638
|
const headers = await this.getHeaders();
|
|
7577
|
-
const client =
|
|
7639
|
+
const client = initClient11(publicArtifactByIdContract, {
|
|
7578
7640
|
baseUrl,
|
|
7579
7641
|
baseHeaders: headers,
|
|
7580
7642
|
jsonQuery: true
|
|
@@ -7593,7 +7655,7 @@ var ApiClient = class {
|
|
|
7593
7655
|
async listPublicVolumes(query) {
|
|
7594
7656
|
const baseUrl = await this.getBaseUrl();
|
|
7595
7657
|
const headers = await this.getHeaders();
|
|
7596
|
-
const client =
|
|
7658
|
+
const client = initClient11(publicVolumesListContract, {
|
|
7597
7659
|
baseUrl,
|
|
7598
7660
|
baseHeaders: headers,
|
|
7599
7661
|
jsonQuery: true
|
|
@@ -7612,7 +7674,7 @@ var ApiClient = class {
|
|
|
7612
7674
|
async getPublicVolume(id) {
|
|
7613
7675
|
const baseUrl = await this.getBaseUrl();
|
|
7614
7676
|
const headers = await this.getHeaders();
|
|
7615
|
-
const client =
|
|
7677
|
+
const client = initClient11(publicVolumeByIdContract, {
|
|
7616
7678
|
baseUrl,
|
|
7617
7679
|
baseHeaders: headers,
|
|
7618
7680
|
jsonQuery: true
|
|
@@ -7651,7 +7713,7 @@ var ApiClient = class {
|
|
|
7651
7713
|
async listCredentials() {
|
|
7652
7714
|
const baseUrl = await this.getBaseUrl();
|
|
7653
7715
|
const headers = await this.getHeaders();
|
|
7654
|
-
const client =
|
|
7716
|
+
const client = initClient11(credentialsMainContract, {
|
|
7655
7717
|
baseUrl,
|
|
7656
7718
|
baseHeaders: headers,
|
|
7657
7719
|
jsonQuery: true
|
|
@@ -7670,7 +7732,7 @@ var ApiClient = class {
|
|
|
7670
7732
|
async getCredential(name) {
|
|
7671
7733
|
const baseUrl = await this.getBaseUrl();
|
|
7672
7734
|
const headers = await this.getHeaders();
|
|
7673
|
-
const client =
|
|
7735
|
+
const client = initClient11(credentialsByNameContract, {
|
|
7674
7736
|
baseUrl,
|
|
7675
7737
|
baseHeaders: headers,
|
|
7676
7738
|
jsonQuery: true
|
|
@@ -7691,7 +7753,7 @@ var ApiClient = class {
|
|
|
7691
7753
|
async setCredential(body) {
|
|
7692
7754
|
const baseUrl = await this.getBaseUrl();
|
|
7693
7755
|
const headers = await this.getHeaders();
|
|
7694
|
-
const client =
|
|
7756
|
+
const client = initClient11(credentialsMainContract, {
|
|
7695
7757
|
baseUrl,
|
|
7696
7758
|
baseHeaders: headers,
|
|
7697
7759
|
jsonQuery: true
|
|
@@ -7710,7 +7772,7 @@ var ApiClient = class {
|
|
|
7710
7772
|
async deleteCredential(name) {
|
|
7711
7773
|
const baseUrl = await this.getBaseUrl();
|
|
7712
7774
|
const headers = await this.getHeaders();
|
|
7713
|
-
const client =
|
|
7775
|
+
const client = initClient11(credentialsByNameContract, {
|
|
7714
7776
|
baseUrl,
|
|
7715
7777
|
baseHeaders: headers,
|
|
7716
7778
|
jsonQuery: true
|
|
@@ -7731,7 +7793,7 @@ var ApiClient = class {
|
|
|
7731
7793
|
async getRealtimeToken(runId) {
|
|
7732
7794
|
const baseUrl = await this.getBaseUrl();
|
|
7733
7795
|
const headers = await this.getHeaders();
|
|
7734
|
-
const client =
|
|
7796
|
+
const client = initClient11(realtimeTokenContract, {
|
|
7735
7797
|
baseUrl,
|
|
7736
7798
|
baseHeaders: headers,
|
|
7737
7799
|
jsonQuery: true
|
|
@@ -8282,7 +8344,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8282
8344
|
}
|
|
8283
8345
|
showNextSteps(result);
|
|
8284
8346
|
if (options.autoUpdate !== false) {
|
|
8285
|
-
await silentUpgradeAfterCommand("9.
|
|
8347
|
+
await silentUpgradeAfterCommand("9.25.0");
|
|
8286
8348
|
}
|
|
8287
8349
|
} catch (error) {
|
|
8288
8350
|
handleRunError(error, identifier);
|
|
@@ -8390,11 +8452,6 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8390
8452
|
"Secrets for ${{ secrets.xxx }} (repeatable, falls back to --env-file or env vars)",
|
|
8391
8453
|
collectKeyValue,
|
|
8392
8454
|
{}
|
|
8393
|
-
).option(
|
|
8394
|
-
"--volume-version <name=version>",
|
|
8395
|
-
"Volume version override (repeatable)",
|
|
8396
|
-
collectVolumeVersions,
|
|
8397
|
-
{}
|
|
8398
8455
|
).option(
|
|
8399
8456
|
"--experimental-realtime",
|
|
8400
8457
|
"Use realtime event streaming instead of polling (experimental)"
|
|
@@ -8423,7 +8480,6 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8423
8480
|
prompt,
|
|
8424
8481
|
vars: Object.keys(vars).length > 0 ? vars : void 0,
|
|
8425
8482
|
secrets: loadedSecrets,
|
|
8426
|
-
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
|
|
8427
8483
|
modelProvider: options.modelProvider || allOpts.modelProvider,
|
|
8428
8484
|
debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
|
|
8429
8485
|
});
|
|
@@ -9789,7 +9845,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9789
9845
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
|
|
9790
9846
|
async (prompt, options) => {
|
|
9791
9847
|
if (options.autoUpdate !== false) {
|
|
9792
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9848
|
+
const shouldExit = await checkAndUpgrade("9.25.0", prompt);
|
|
9793
9849
|
if (shouldExit) {
|
|
9794
9850
|
process.exit(0);
|
|
9795
9851
|
}
|
|
@@ -11102,7 +11158,7 @@ import { Command as Command51 } from "commander";
|
|
|
11102
11158
|
|
|
11103
11159
|
// src/commands/schedule/setup.ts
|
|
11104
11160
|
import { Command as Command45 } from "commander";
|
|
11105
|
-
import
|
|
11161
|
+
import chalk45 from "chalk";
|
|
11106
11162
|
|
|
11107
11163
|
// src/lib/domain/schedule-utils.ts
|
|
11108
11164
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -11214,22 +11270,6 @@ function toISODateTime(dateTimeStr) {
|
|
|
11214
11270
|
const date = new Date(isoStr);
|
|
11215
11271
|
return date.toISOString();
|
|
11216
11272
|
}
|
|
11217
|
-
function extractRequiredConfiguration(composeContent) {
|
|
11218
|
-
const result = {
|
|
11219
|
-
secrets: [],
|
|
11220
|
-
vars: [],
|
|
11221
|
-
credentials: []
|
|
11222
|
-
};
|
|
11223
|
-
if (!composeContent) {
|
|
11224
|
-
return result;
|
|
11225
|
-
}
|
|
11226
|
-
const refs = extractVariableReferences(composeContent);
|
|
11227
|
-
const grouped = groupVariablesBySource(refs);
|
|
11228
|
-
result.secrets = grouped.secrets.map((r) => r.name);
|
|
11229
|
-
result.vars = grouped.vars.map((r) => r.name);
|
|
11230
|
-
result.credentials = grouped.credentials.map((r) => r.name);
|
|
11231
|
-
return result;
|
|
11232
|
-
}
|
|
11233
11273
|
async function resolveScheduleByAgent(agentName) {
|
|
11234
11274
|
const { schedules } = await listSchedules();
|
|
11235
11275
|
const schedule = schedules.find((s) => s.composeName === agentName);
|
|
@@ -11243,117 +11283,6 @@ async function resolveScheduleByAgent(agentName) {
|
|
|
11243
11283
|
};
|
|
11244
11284
|
}
|
|
11245
11285
|
|
|
11246
|
-
// src/commands/schedule/gather-configuration.ts
|
|
11247
|
-
import chalk45 from "chalk";
|
|
11248
|
-
var defaultPromptDeps = {
|
|
11249
|
-
isInteractive,
|
|
11250
|
-
promptConfirm,
|
|
11251
|
-
promptText
|
|
11252
|
-
};
|
|
11253
|
-
function parseKeyValuePairs(pairs) {
|
|
11254
|
-
const result = {};
|
|
11255
|
-
for (const pair of pairs) {
|
|
11256
|
-
const eqIndex = pair.indexOf("=");
|
|
11257
|
-
if (eqIndex > 0) {
|
|
11258
|
-
const key = pair.slice(0, eqIndex);
|
|
11259
|
-
const value = pair.slice(eqIndex + 1);
|
|
11260
|
-
result[key] = value;
|
|
11261
|
-
}
|
|
11262
|
-
}
|
|
11263
|
-
return result;
|
|
11264
|
-
}
|
|
11265
|
-
async function handleExistingSecrets(existingSecretNames, deps) {
|
|
11266
|
-
if (existingSecretNames.length > 0 && deps.isInteractive()) {
|
|
11267
|
-
const keepSecrets = await deps.promptConfirm(
|
|
11268
|
-
`Keep existing secrets? (${existingSecretNames.join(", ")})`,
|
|
11269
|
-
true
|
|
11270
|
-
);
|
|
11271
|
-
if (keepSecrets) {
|
|
11272
|
-
return true;
|
|
11273
|
-
}
|
|
11274
|
-
console.log(
|
|
11275
|
-
chalk45.dim(
|
|
11276
|
-
" Note: Secrets will be cleared. Use 'vm0 secret set' to add platform secrets."
|
|
11277
|
-
)
|
|
11278
|
-
);
|
|
11279
|
-
return false;
|
|
11280
|
-
}
|
|
11281
|
-
return false;
|
|
11282
|
-
}
|
|
11283
|
-
async function handleVars(optionVars, existingVars, deps) {
|
|
11284
|
-
if (optionVars.length > 0) {
|
|
11285
|
-
return parseKeyValuePairs(optionVars);
|
|
11286
|
-
}
|
|
11287
|
-
if (existingVars && deps.isInteractive()) {
|
|
11288
|
-
const keepVars = await deps.promptConfirm(
|
|
11289
|
-
`Keep existing variables? (${Object.keys(existingVars).join(", ")})`,
|
|
11290
|
-
true
|
|
11291
|
-
);
|
|
11292
|
-
if (keepVars) {
|
|
11293
|
-
return { ...existingVars };
|
|
11294
|
-
}
|
|
11295
|
-
}
|
|
11296
|
-
return {};
|
|
11297
|
-
}
|
|
11298
|
-
function displayMissingRequirements(missingSecrets, missingVars) {
|
|
11299
|
-
if (missingSecrets.length > 0) {
|
|
11300
|
-
console.log(chalk45.yellow("\nAgent requires the following secrets:"));
|
|
11301
|
-
for (const name of missingSecrets) {
|
|
11302
|
-
console.log(chalk45.dim(` ${name}`));
|
|
11303
|
-
}
|
|
11304
|
-
console.log();
|
|
11305
|
-
console.log("Set secrets using the platform:");
|
|
11306
|
-
for (const name of missingSecrets) {
|
|
11307
|
-
console.log(chalk45.cyan(` vm0 secret set ${name} <value>`));
|
|
11308
|
-
}
|
|
11309
|
-
console.log();
|
|
11310
|
-
}
|
|
11311
|
-
if (missingVars.length > 0) {
|
|
11312
|
-
console.log(chalk45.yellow("\nAgent requires the following variables:"));
|
|
11313
|
-
for (const name of missingVars) {
|
|
11314
|
-
console.log(chalk45.dim(` ${name}`));
|
|
11315
|
-
}
|
|
11316
|
-
console.log();
|
|
11317
|
-
}
|
|
11318
|
-
}
|
|
11319
|
-
async function promptForMissingVars(missingVars, vars, deps) {
|
|
11320
|
-
for (const name of missingVars) {
|
|
11321
|
-
const value = await deps.promptText(
|
|
11322
|
-
`Enter value for var ${chalk45.cyan(name)}`,
|
|
11323
|
-
""
|
|
11324
|
-
);
|
|
11325
|
-
if (value) {
|
|
11326
|
-
vars[name] = value;
|
|
11327
|
-
}
|
|
11328
|
-
}
|
|
11329
|
-
}
|
|
11330
|
-
async function gatherConfiguration(params, deps = defaultPromptDeps) {
|
|
11331
|
-
const { required, optionVars, existingSchedule } = params;
|
|
11332
|
-
const existingSecretNames = existingSchedule?.secretNames ?? [];
|
|
11333
|
-
const existingVars = existingSchedule?.vars ?? null;
|
|
11334
|
-
const preserveExistingSecrets = await handleExistingSecrets(
|
|
11335
|
-
existingSecretNames,
|
|
11336
|
-
deps
|
|
11337
|
-
);
|
|
11338
|
-
const vars = await handleVars(optionVars, existingVars, deps);
|
|
11339
|
-
const effectiveExistingSecrets = preserveExistingSecrets ? existingSecretNames : [];
|
|
11340
|
-
const missingSecrets = required.secrets.filter(
|
|
11341
|
-
(name) => !effectiveExistingSecrets.includes(name)
|
|
11342
|
-
);
|
|
11343
|
-
const missingVars = required.vars.filter(
|
|
11344
|
-
(name) => !Object.keys(vars).includes(name)
|
|
11345
|
-
);
|
|
11346
|
-
if (missingSecrets.length === 0 && missingVars.length === 0) {
|
|
11347
|
-
return { vars, preserveExistingSecrets };
|
|
11348
|
-
}
|
|
11349
|
-
if (!deps.isInteractive()) {
|
|
11350
|
-
return { vars, preserveExistingSecrets };
|
|
11351
|
-
}
|
|
11352
|
-
displayMissingRequirements(missingSecrets, missingVars);
|
|
11353
|
-
await promptForMissingVars(missingVars, vars, deps);
|
|
11354
|
-
return { vars, preserveExistingSecrets };
|
|
11355
|
-
}
|
|
11356
|
-
|
|
11357
11286
|
// src/commands/schedule/setup.ts
|
|
11358
11287
|
var FREQUENCY_CHOICES = [
|
|
11359
11288
|
{ title: "Daily", value: "daily", description: "Run every day" },
|
|
@@ -11402,26 +11331,6 @@ function parseDayOption(day, frequency) {
|
|
|
11402
11331
|
}
|
|
11403
11332
|
return void 0;
|
|
11404
11333
|
}
|
|
11405
|
-
function expandEnvVars(value) {
|
|
11406
|
-
return value.replace(/\$\{([^}]+)\}/g, (match, varName) => {
|
|
11407
|
-
const envValue = process.env[varName];
|
|
11408
|
-
if (envValue === void 0) {
|
|
11409
|
-
console.warn(
|
|
11410
|
-
chalk46.yellow(` Warning: Environment variable ${varName} not set`)
|
|
11411
|
-
);
|
|
11412
|
-
return match;
|
|
11413
|
-
}
|
|
11414
|
-
return envValue;
|
|
11415
|
-
});
|
|
11416
|
-
}
|
|
11417
|
-
function expandEnvVarsInObject(obj) {
|
|
11418
|
-
if (!obj) return void 0;
|
|
11419
|
-
const result = {};
|
|
11420
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
11421
|
-
result[key] = expandEnvVars(value);
|
|
11422
|
-
}
|
|
11423
|
-
return result;
|
|
11424
|
-
}
|
|
11425
11334
|
function formatInTimezone(isoDate, timezone) {
|
|
11426
11335
|
const date = new Date(isoDate);
|
|
11427
11336
|
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
@@ -11450,9 +11359,6 @@ function parseFrequencyFromCron(cron) {
|
|
|
11450
11359
|
}
|
|
11451
11360
|
return null;
|
|
11452
11361
|
}
|
|
11453
|
-
function collect(value, previous) {
|
|
11454
|
-
return previous.concat([value]);
|
|
11455
|
-
}
|
|
11456
11362
|
function getExistingDefaults(existingSchedule) {
|
|
11457
11363
|
const defaults = {};
|
|
11458
11364
|
if (existingSchedule?.cronExpression) {
|
|
@@ -11474,7 +11380,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11474
11380
|
}
|
|
11475
11381
|
if (!isInteractive()) {
|
|
11476
11382
|
console.error(
|
|
11477
|
-
|
|
11383
|
+
chalk45.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
11478
11384
|
);
|
|
11479
11385
|
process.exit(1);
|
|
11480
11386
|
}
|
|
@@ -11494,7 +11400,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11494
11400
|
const day2 = parseDayOption(optionDay, frequency);
|
|
11495
11401
|
if (day2 === void 0) {
|
|
11496
11402
|
console.error(
|
|
11497
|
-
|
|
11403
|
+
chalk45.red(
|
|
11498
11404
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
11499
11405
|
)
|
|
11500
11406
|
);
|
|
@@ -11503,7 +11409,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11503
11409
|
return day2;
|
|
11504
11410
|
}
|
|
11505
11411
|
if (!isInteractive()) {
|
|
11506
|
-
console.error(
|
|
11412
|
+
console.error(chalk45.red("\u2717 --day is required for weekly/monthly"));
|
|
11507
11413
|
process.exit(1);
|
|
11508
11414
|
}
|
|
11509
11415
|
if (frequency === "weekly") {
|
|
@@ -11522,7 +11428,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11522
11428
|
if (!dayStr) return null;
|
|
11523
11429
|
const day = parseInt(dayStr, 10);
|
|
11524
11430
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
11525
|
-
console.error(
|
|
11431
|
+
console.error(chalk45.red("\u2717 Day must be between 1 and 31"));
|
|
11526
11432
|
process.exit(1);
|
|
11527
11433
|
}
|
|
11528
11434
|
return day;
|
|
@@ -11531,13 +11437,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
11531
11437
|
if (optionTime) {
|
|
11532
11438
|
const validation = validateTimeFormat(optionTime);
|
|
11533
11439
|
if (validation !== true) {
|
|
11534
|
-
console.error(
|
|
11440
|
+
console.error(chalk45.red(`\u2717 Invalid time: ${validation}`));
|
|
11535
11441
|
process.exit(1);
|
|
11536
11442
|
}
|
|
11537
11443
|
return optionTime;
|
|
11538
11444
|
}
|
|
11539
11445
|
if (!isInteractive()) {
|
|
11540
|
-
console.error(
|
|
11446
|
+
console.error(chalk45.red("\u2717 --time is required (HH:MM format)"));
|
|
11541
11447
|
process.exit(1);
|
|
11542
11448
|
}
|
|
11543
11449
|
return await promptText(
|
|
@@ -11550,7 +11456,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11550
11456
|
if (optionDay && optionTime) {
|
|
11551
11457
|
if (!validateDateFormat(optionDay)) {
|
|
11552
11458
|
console.error(
|
|
11553
|
-
|
|
11459
|
+
chalk45.red(
|
|
11554
11460
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
11555
11461
|
)
|
|
11556
11462
|
);
|
|
@@ -11558,16 +11464,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11558
11464
|
}
|
|
11559
11465
|
if (!validateTimeFormat(optionTime)) {
|
|
11560
11466
|
console.error(
|
|
11561
|
-
|
|
11467
|
+
chalk45.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
11562
11468
|
);
|
|
11563
11469
|
process.exit(1);
|
|
11564
11470
|
}
|
|
11565
11471
|
return `${optionDay} ${optionTime}`;
|
|
11566
11472
|
}
|
|
11567
11473
|
if (!isInteractive()) {
|
|
11568
|
-
console.error(
|
|
11474
|
+
console.error(chalk45.red("\u2717 One-time schedules require interactive mode"));
|
|
11569
11475
|
console.error(
|
|
11570
|
-
|
|
11476
|
+
chalk45.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
11571
11477
|
);
|
|
11572
11478
|
process.exit(1);
|
|
11573
11479
|
}
|
|
@@ -11598,7 +11504,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
11598
11504
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
11599
11505
|
if (optionPrompt) return optionPrompt;
|
|
11600
11506
|
if (!isInteractive()) {
|
|
11601
|
-
console.error(
|
|
11507
|
+
console.error(chalk45.red("\u2717 --prompt is required"));
|
|
11602
11508
|
process.exit(1);
|
|
11603
11509
|
}
|
|
11604
11510
|
return await promptText(
|
|
@@ -11609,8 +11515,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
11609
11515
|
async function resolveAgent(agentName) {
|
|
11610
11516
|
const compose = await getComposeByName(agentName);
|
|
11611
11517
|
if (!compose) {
|
|
11612
|
-
console.error(
|
|
11613
|
-
console.error(
|
|
11518
|
+
console.error(chalk45.red(`\u2717 Agent not found: ${agentName}`));
|
|
11519
|
+
console.error(chalk45.dim(" Make sure the agent is composed first"));
|
|
11614
11520
|
process.exit(1);
|
|
11615
11521
|
}
|
|
11616
11522
|
return {
|
|
@@ -11653,11 +11559,9 @@ async function buildAndDeploy(params) {
|
|
|
11653
11559
|
params.day
|
|
11654
11560
|
);
|
|
11655
11561
|
}
|
|
11656
|
-
const expandedVars = expandEnvVarsInObject(params.vars);
|
|
11657
|
-
const expandedSecrets = expandEnvVarsInObject(params.secrets);
|
|
11658
11562
|
console.log(
|
|
11659
11563
|
`
|
|
11660
|
-
Deploying schedule for agent ${
|
|
11564
|
+
Deploying schedule for agent ${chalk45.cyan(params.agentName)}...`
|
|
11661
11565
|
);
|
|
11662
11566
|
const deployResult = await deploySchedule({
|
|
11663
11567
|
name: params.scheduleName,
|
|
@@ -11666,19 +11570,17 @@ Deploying schedule for agent ${chalk46.cyan(params.agentName)}...`
|
|
|
11666
11570
|
atTime: atTimeISO,
|
|
11667
11571
|
timezone: params.timezone,
|
|
11668
11572
|
prompt: params.prompt,
|
|
11669
|
-
vars: expandedVars,
|
|
11670
|
-
secrets: expandedSecrets,
|
|
11671
11573
|
artifactName: params.artifactName
|
|
11672
11574
|
});
|
|
11673
11575
|
return deployResult;
|
|
11674
11576
|
}
|
|
11675
11577
|
function handleSetupError(error) {
|
|
11676
|
-
console.error(
|
|
11578
|
+
console.error(chalk45.red("\u2717 Failed to setup schedule"));
|
|
11677
11579
|
if (error instanceof Error) {
|
|
11678
11580
|
if (error.message.includes("Not authenticated")) {
|
|
11679
|
-
console.error(
|
|
11581
|
+
console.error(chalk45.dim(" Run: vm0 auth login"));
|
|
11680
11582
|
} else {
|
|
11681
|
-
console.error(
|
|
11583
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11682
11584
|
}
|
|
11683
11585
|
}
|
|
11684
11586
|
process.exit(1);
|
|
@@ -11686,56 +11588,56 @@ function handleSetupError(error) {
|
|
|
11686
11588
|
function displayDeployResult(agentName, deployResult) {
|
|
11687
11589
|
if (deployResult.created) {
|
|
11688
11590
|
console.log(
|
|
11689
|
-
|
|
11591
|
+
chalk45.green(`\u2713 Created schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11690
11592
|
);
|
|
11691
11593
|
} else {
|
|
11692
11594
|
console.log(
|
|
11693
|
-
|
|
11595
|
+
chalk45.green(`\u2713 Updated schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11694
11596
|
);
|
|
11695
11597
|
}
|
|
11696
|
-
console.log(
|
|
11598
|
+
console.log(chalk45.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
11697
11599
|
if (deployResult.schedule.cronExpression) {
|
|
11698
|
-
console.log(
|
|
11600
|
+
console.log(chalk45.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
11699
11601
|
if (deployResult.schedule.nextRunAt) {
|
|
11700
11602
|
const nextRun = formatInTimezone(
|
|
11701
11603
|
deployResult.schedule.nextRunAt,
|
|
11702
11604
|
deployResult.schedule.timezone
|
|
11703
11605
|
);
|
|
11704
|
-
console.log(
|
|
11606
|
+
console.log(chalk45.dim(` Next run: ${nextRun}`));
|
|
11705
11607
|
}
|
|
11706
11608
|
} else if (deployResult.schedule.atTime) {
|
|
11707
11609
|
const atTimeFormatted = formatInTimezone(
|
|
11708
11610
|
deployResult.schedule.atTime,
|
|
11709
11611
|
deployResult.schedule.timezone
|
|
11710
11612
|
);
|
|
11711
|
-
console.log(
|
|
11613
|
+
console.log(chalk45.dim(` At: ${atTimeFormatted}`));
|
|
11712
11614
|
}
|
|
11713
11615
|
}
|
|
11714
11616
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
11715
11617
|
try {
|
|
11716
11618
|
await enableSchedule({ name: scheduleName, composeId });
|
|
11717
11619
|
console.log(
|
|
11718
|
-
|
|
11620
|
+
chalk45.green(`\u2713 Enabled schedule for agent ${chalk45.cyan(agentName)}`)
|
|
11719
11621
|
);
|
|
11720
11622
|
} catch (error) {
|
|
11721
|
-
console.error(
|
|
11623
|
+
console.error(chalk45.yellow("\u26A0 Failed to enable schedule"));
|
|
11722
11624
|
if (error instanceof ApiRequestError) {
|
|
11723
11625
|
if (error.code === "SCHEDULE_PAST") {
|
|
11724
|
-
console.error(
|
|
11626
|
+
console.error(chalk45.dim(" Scheduled time has already passed"));
|
|
11725
11627
|
} else {
|
|
11726
|
-
console.error(
|
|
11628
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11727
11629
|
}
|
|
11728
11630
|
} else if (error instanceof Error) {
|
|
11729
|
-
console.error(
|
|
11631
|
+
console.error(chalk45.dim(` ${error.message}`));
|
|
11730
11632
|
}
|
|
11731
11633
|
console.log(
|
|
11732
|
-
` To enable manually: ${
|
|
11634
|
+
` To enable manually: ${chalk45.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
11733
11635
|
);
|
|
11734
11636
|
}
|
|
11735
11637
|
}
|
|
11736
11638
|
function showEnableHint(agentName) {
|
|
11737
11639
|
console.log();
|
|
11738
|
-
console.log(` To enable: ${
|
|
11640
|
+
console.log(` To enable: ${chalk45.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
11739
11641
|
}
|
|
11740
11642
|
async function handleScheduleEnabling(params) {
|
|
11741
11643
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -11756,13 +11658,12 @@ async function handleScheduleEnabling(params) {
|
|
|
11756
11658
|
showEnableHint(agentName);
|
|
11757
11659
|
}
|
|
11758
11660
|
}
|
|
11759
|
-
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--
|
|
11661
|
+
var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
11760
11662
|
try {
|
|
11761
|
-
const { composeId, scheduleName
|
|
11762
|
-
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
11663
|
+
const { composeId, scheduleName } = await resolveAgent(agentName);
|
|
11763
11664
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
11764
11665
|
console.log(
|
|
11765
|
-
|
|
11666
|
+
chalk45.dim(
|
|
11766
11667
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
11767
11668
|
)
|
|
11768
11669
|
);
|
|
@@ -11772,12 +11673,12 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11772
11673
|
defaults.frequency
|
|
11773
11674
|
);
|
|
11774
11675
|
if (!frequency) {
|
|
11775
|
-
console.log(
|
|
11676
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11776
11677
|
return;
|
|
11777
11678
|
}
|
|
11778
11679
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
11779
11680
|
if (!timing) {
|
|
11780
|
-
console.log(
|
|
11681
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11781
11682
|
return;
|
|
11782
11683
|
}
|
|
11783
11684
|
const { day, time, atTime } = timing;
|
|
@@ -11786,7 +11687,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11786
11687
|
existingSchedule?.timezone
|
|
11787
11688
|
);
|
|
11788
11689
|
if (!timezone) {
|
|
11789
|
-
console.log(
|
|
11690
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11790
11691
|
return;
|
|
11791
11692
|
}
|
|
11792
11693
|
const promptText_ = await gatherPromptText(
|
|
@@ -11794,16 +11695,9 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11794
11695
|
existingSchedule?.prompt
|
|
11795
11696
|
);
|
|
11796
11697
|
if (!promptText_) {
|
|
11797
|
-
console.log(
|
|
11698
|
+
console.log(chalk45.dim("Cancelled"));
|
|
11798
11699
|
return;
|
|
11799
11700
|
}
|
|
11800
|
-
const config = await gatherConfiguration({
|
|
11801
|
-
required: requiredConfig,
|
|
11802
|
-
optionSecrets: [],
|
|
11803
|
-
// Secrets are no longer passed via CLI
|
|
11804
|
-
optionVars: options.var || [],
|
|
11805
|
-
existingSchedule
|
|
11806
|
-
});
|
|
11807
11701
|
const deployResult = await buildAndDeploy({
|
|
11808
11702
|
scheduleName,
|
|
11809
11703
|
composeId,
|
|
@@ -11814,9 +11708,6 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11814
11708
|
atTime,
|
|
11815
11709
|
timezone,
|
|
11816
11710
|
prompt: promptText_,
|
|
11817
|
-
vars: Object.keys(config.vars).length > 0 ? config.vars : void 0,
|
|
11818
|
-
secrets: void 0,
|
|
11819
|
-
// Secrets managed via platform, not schedule
|
|
11820
11711
|
artifactName: options.artifactName
|
|
11821
11712
|
});
|
|
11822
11713
|
displayDeployResult(agentName, deployResult);
|
|
@@ -11835,14 +11726,14 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11835
11726
|
|
|
11836
11727
|
// src/commands/schedule/list.ts
|
|
11837
11728
|
import { Command as Command46 } from "commander";
|
|
11838
|
-
import
|
|
11729
|
+
import chalk46 from "chalk";
|
|
11839
11730
|
var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
11840
11731
|
try {
|
|
11841
11732
|
const result = await listSchedules();
|
|
11842
11733
|
if (result.schedules.length === 0) {
|
|
11843
|
-
console.log(
|
|
11734
|
+
console.log(chalk46.dim("No schedules found"));
|
|
11844
11735
|
console.log(
|
|
11845
|
-
|
|
11736
|
+
chalk46.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
11846
11737
|
);
|
|
11847
11738
|
return;
|
|
11848
11739
|
}
|
|
@@ -11862,10 +11753,10 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11862
11753
|
"STATUS".padEnd(8),
|
|
11863
11754
|
"NEXT RUN"
|
|
11864
11755
|
].join(" ");
|
|
11865
|
-
console.log(
|
|
11756
|
+
console.log(chalk46.dim(header));
|
|
11866
11757
|
for (const schedule of result.schedules) {
|
|
11867
11758
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
11868
|
-
const status = schedule.enabled ?
|
|
11759
|
+
const status = schedule.enabled ? chalk46.green("enabled") : chalk46.yellow("disabled");
|
|
11869
11760
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
11870
11761
|
const row = [
|
|
11871
11762
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -11877,12 +11768,12 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11877
11768
|
console.log(row);
|
|
11878
11769
|
}
|
|
11879
11770
|
} catch (error) {
|
|
11880
|
-
console.error(
|
|
11771
|
+
console.error(chalk46.red("\u2717 Failed to list schedules"));
|
|
11881
11772
|
if (error instanceof Error) {
|
|
11882
11773
|
if (error.message.includes("Not authenticated")) {
|
|
11883
|
-
console.error(
|
|
11774
|
+
console.error(chalk46.dim(" Run: vm0 auth login"));
|
|
11884
11775
|
} else {
|
|
11885
|
-
console.error(
|
|
11776
|
+
console.error(chalk46.dim(` ${error.message}`));
|
|
11886
11777
|
}
|
|
11887
11778
|
}
|
|
11888
11779
|
process.exit(1);
|
|
@@ -11891,44 +11782,44 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11891
11782
|
|
|
11892
11783
|
// src/commands/schedule/status.ts
|
|
11893
11784
|
import { Command as Command47 } from "commander";
|
|
11894
|
-
import
|
|
11785
|
+
import chalk47 from "chalk";
|
|
11895
11786
|
function formatDateTimeStyled(dateStr) {
|
|
11896
|
-
if (!dateStr) return
|
|
11787
|
+
if (!dateStr) return chalk47.dim("-");
|
|
11897
11788
|
const formatted = formatDateTime(dateStr);
|
|
11898
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
11789
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk47.dim("($1)"));
|
|
11899
11790
|
}
|
|
11900
11791
|
function formatTrigger(schedule) {
|
|
11901
11792
|
if (schedule.cronExpression) {
|
|
11902
11793
|
return schedule.cronExpression;
|
|
11903
11794
|
}
|
|
11904
11795
|
if (schedule.atTime) {
|
|
11905
|
-
return `${schedule.atTime} ${
|
|
11796
|
+
return `${schedule.atTime} ${chalk47.dim("(one-time)")}`;
|
|
11906
11797
|
}
|
|
11907
|
-
return
|
|
11798
|
+
return chalk47.dim("-");
|
|
11908
11799
|
}
|
|
11909
11800
|
function formatRunStatus2(status) {
|
|
11910
11801
|
switch (status) {
|
|
11911
11802
|
case "completed":
|
|
11912
|
-
return
|
|
11803
|
+
return chalk47.green(status);
|
|
11913
11804
|
case "failed":
|
|
11914
11805
|
case "timeout":
|
|
11915
|
-
return
|
|
11806
|
+
return chalk47.red(status);
|
|
11916
11807
|
case "running":
|
|
11917
|
-
return
|
|
11808
|
+
return chalk47.blue(status);
|
|
11918
11809
|
case "pending":
|
|
11919
|
-
return
|
|
11810
|
+
return chalk47.yellow(status);
|
|
11920
11811
|
default:
|
|
11921
11812
|
return status;
|
|
11922
11813
|
}
|
|
11923
11814
|
}
|
|
11924
11815
|
function printRunConfiguration(schedule) {
|
|
11925
|
-
const statusText = schedule.enabled ?
|
|
11816
|
+
const statusText = schedule.enabled ? chalk47.green("enabled") : chalk47.yellow("disabled");
|
|
11926
11817
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
11927
11818
|
console.log(
|
|
11928
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
11819
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk47.dim(`(${schedule.scopeSlug})`)}`
|
|
11929
11820
|
);
|
|
11930
11821
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
11931
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
11822
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk47.dim(promptPreview)}`);
|
|
11932
11823
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
11933
11824
|
console.log(
|
|
11934
11825
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -11965,7 +11856,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11965
11856
|
console.log();
|
|
11966
11857
|
console.log("Recent Runs:");
|
|
11967
11858
|
console.log(
|
|
11968
|
-
|
|
11859
|
+
chalk47.dim("RUN ID STATUS CREATED")
|
|
11969
11860
|
);
|
|
11970
11861
|
for (const run of runs) {
|
|
11971
11862
|
const id = run.id;
|
|
@@ -11976,19 +11867,19 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
11976
11867
|
}
|
|
11977
11868
|
} catch {
|
|
11978
11869
|
console.log();
|
|
11979
|
-
console.log(
|
|
11870
|
+
console.log(chalk47.dim("Recent Runs: (unable to fetch)"));
|
|
11980
11871
|
}
|
|
11981
11872
|
}
|
|
11982
11873
|
function handleStatusError(error, agentName) {
|
|
11983
|
-
console.error(
|
|
11874
|
+
console.error(chalk47.red("\u2717 Failed to get schedule status"));
|
|
11984
11875
|
if (error instanceof Error) {
|
|
11985
11876
|
if (error.message.includes("Not authenticated")) {
|
|
11986
|
-
console.error(
|
|
11877
|
+
console.error(chalk47.dim(" Run: vm0 auth login"));
|
|
11987
11878
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
11988
|
-
console.error(
|
|
11989
|
-
console.error(
|
|
11879
|
+
console.error(chalk47.dim(` No schedule found for agent "${agentName}"`));
|
|
11880
|
+
console.error(chalk47.dim(" Run: vm0 schedule list"));
|
|
11990
11881
|
} else {
|
|
11991
|
-
console.error(
|
|
11882
|
+
console.error(chalk47.dim(` ${error.message}`));
|
|
11992
11883
|
}
|
|
11993
11884
|
}
|
|
11994
11885
|
process.exit(1);
|
|
@@ -12003,8 +11894,8 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12003
11894
|
const { name, composeId } = resolved;
|
|
12004
11895
|
const schedule = await getScheduleByName({ name, composeId });
|
|
12005
11896
|
console.log();
|
|
12006
|
-
console.log(`Schedule for agent: ${
|
|
12007
|
-
console.log(
|
|
11897
|
+
console.log(`Schedule for agent: ${chalk47.cyan(agentName)}`);
|
|
11898
|
+
console.log(chalk47.dim("\u2501".repeat(50)));
|
|
12008
11899
|
printRunConfiguration(schedule);
|
|
12009
11900
|
printTimeSchedule(schedule);
|
|
12010
11901
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -12021,23 +11912,23 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12021
11912
|
|
|
12022
11913
|
// src/commands/schedule/delete.ts
|
|
12023
11914
|
import { Command as Command48 } from "commander";
|
|
12024
|
-
import
|
|
11915
|
+
import chalk48 from "chalk";
|
|
12025
11916
|
var deleteCommand = new Command48().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
12026
11917
|
try {
|
|
12027
11918
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12028
11919
|
if (!options.force) {
|
|
12029
11920
|
if (!isInteractive()) {
|
|
12030
11921
|
console.error(
|
|
12031
|
-
|
|
11922
|
+
chalk48.red("\u2717 --force required in non-interactive mode")
|
|
12032
11923
|
);
|
|
12033
11924
|
process.exit(1);
|
|
12034
11925
|
}
|
|
12035
11926
|
const confirmed = await promptConfirm(
|
|
12036
|
-
`Delete schedule for agent ${
|
|
11927
|
+
`Delete schedule for agent ${chalk48.cyan(agentName)}?`,
|
|
12037
11928
|
false
|
|
12038
11929
|
);
|
|
12039
11930
|
if (!confirmed) {
|
|
12040
|
-
console.log(
|
|
11931
|
+
console.log(chalk48.dim("Cancelled"));
|
|
12041
11932
|
return;
|
|
12042
11933
|
}
|
|
12043
11934
|
}
|
|
@@ -12046,20 +11937,20 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12046
11937
|
composeId: resolved.composeId
|
|
12047
11938
|
});
|
|
12048
11939
|
console.log(
|
|
12049
|
-
|
|
11940
|
+
chalk48.green(`\u2713 Deleted schedule for agent ${chalk48.cyan(agentName)}`)
|
|
12050
11941
|
);
|
|
12051
11942
|
} catch (error) {
|
|
12052
|
-
console.error(
|
|
11943
|
+
console.error(chalk48.red("\u2717 Failed to delete schedule"));
|
|
12053
11944
|
if (error instanceof Error) {
|
|
12054
11945
|
if (error.message.includes("Not authenticated")) {
|
|
12055
|
-
console.error(
|
|
11946
|
+
console.error(chalk48.dim(" Run: vm0 auth login"));
|
|
12056
11947
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12057
11948
|
console.error(
|
|
12058
|
-
|
|
11949
|
+
chalk48.dim(` No schedule found for agent "${agentName}"`)
|
|
12059
11950
|
);
|
|
12060
|
-
console.error(
|
|
11951
|
+
console.error(chalk48.dim(" Run: vm0 schedule list"));
|
|
12061
11952
|
} else {
|
|
12062
|
-
console.error(
|
|
11953
|
+
console.error(chalk48.dim(` ${error.message}`));
|
|
12063
11954
|
}
|
|
12064
11955
|
}
|
|
12065
11956
|
process.exit(1);
|
|
@@ -12068,7 +11959,7 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12068
11959
|
|
|
12069
11960
|
// src/commands/schedule/enable.ts
|
|
12070
11961
|
import { Command as Command49 } from "commander";
|
|
12071
|
-
import
|
|
11962
|
+
import chalk49 from "chalk";
|
|
12072
11963
|
var enableCommand = new Command49().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12073
11964
|
try {
|
|
12074
11965
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
@@ -12077,34 +11968,34 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12077
11968
|
composeId: resolved.composeId
|
|
12078
11969
|
});
|
|
12079
11970
|
console.log(
|
|
12080
|
-
|
|
11971
|
+
chalk49.green(`\u2713 Enabled schedule for agent ${chalk49.cyan(agentName)}`)
|
|
12081
11972
|
);
|
|
12082
11973
|
} catch (error) {
|
|
12083
|
-
console.error(
|
|
11974
|
+
console.error(chalk49.red("\u2717 Failed to enable schedule"));
|
|
12084
11975
|
if (error instanceof ApiRequestError) {
|
|
12085
11976
|
if (error.code === "SCHEDULE_PAST") {
|
|
12086
|
-
console.error(
|
|
12087
|
-
console.error(
|
|
11977
|
+
console.error(chalk49.dim(" Scheduled time has already passed"));
|
|
11978
|
+
console.error(chalk49.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
12088
11979
|
} else if (error.code === "NOT_FOUND") {
|
|
12089
11980
|
console.error(
|
|
12090
|
-
|
|
11981
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
12091
11982
|
);
|
|
12092
|
-
console.error(
|
|
11983
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
12093
11984
|
} else if (error.code === "UNAUTHORIZED") {
|
|
12094
|
-
console.error(
|
|
11985
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
12095
11986
|
} else {
|
|
12096
|
-
console.error(
|
|
11987
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
12097
11988
|
}
|
|
12098
11989
|
} else if (error instanceof Error) {
|
|
12099
11990
|
if (error.message.includes("Not authenticated")) {
|
|
12100
|
-
console.error(
|
|
11991
|
+
console.error(chalk49.dim(" Run: vm0 auth login"));
|
|
12101
11992
|
} else if (error.message.includes("No schedule found")) {
|
|
12102
11993
|
console.error(
|
|
12103
|
-
|
|
11994
|
+
chalk49.dim(` No schedule found for agent "${agentName}"`)
|
|
12104
11995
|
);
|
|
12105
|
-
console.error(
|
|
11996
|
+
console.error(chalk49.dim(" Run: vm0 schedule list"));
|
|
12106
11997
|
} else {
|
|
12107
|
-
console.error(
|
|
11998
|
+
console.error(chalk49.dim(` ${error.message}`));
|
|
12108
11999
|
}
|
|
12109
12000
|
}
|
|
12110
12001
|
process.exit(1);
|
|
@@ -12113,7 +12004,7 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12113
12004
|
|
|
12114
12005
|
// src/commands/schedule/disable.ts
|
|
12115
12006
|
import { Command as Command50 } from "commander";
|
|
12116
|
-
import
|
|
12007
|
+
import chalk50 from "chalk";
|
|
12117
12008
|
var disableCommand = new Command50().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12118
12009
|
try {
|
|
12119
12010
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
@@ -12122,20 +12013,20 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
12122
12013
|
composeId: resolved.composeId
|
|
12123
12014
|
});
|
|
12124
12015
|
console.log(
|
|
12125
|
-
|
|
12016
|
+
chalk50.green(`\u2713 Disabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
12126
12017
|
);
|
|
12127
12018
|
} catch (error) {
|
|
12128
|
-
console.error(
|
|
12019
|
+
console.error(chalk50.red("\u2717 Failed to disable schedule"));
|
|
12129
12020
|
if (error instanceof Error) {
|
|
12130
12021
|
if (error.message.includes("Not authenticated")) {
|
|
12131
|
-
console.error(
|
|
12022
|
+
console.error(chalk50.dim(" Run: vm0 auth login"));
|
|
12132
12023
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12133
12024
|
console.error(
|
|
12134
|
-
|
|
12025
|
+
chalk50.dim(` No schedule found for agent "${agentName}"`)
|
|
12135
12026
|
);
|
|
12136
|
-
console.error(
|
|
12027
|
+
console.error(chalk50.dim(" Run: vm0 schedule list"));
|
|
12137
12028
|
} else {
|
|
12138
|
-
console.error(
|
|
12029
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
12139
12030
|
}
|
|
12140
12031
|
}
|
|
12141
12032
|
process.exit(1);
|
|
@@ -12147,7 +12038,7 @@ var scheduleCommand = new Command51().name("schedule").description("Manage agent
|
|
|
12147
12038
|
|
|
12148
12039
|
// src/commands/usage/index.ts
|
|
12149
12040
|
import { Command as Command52 } from "commander";
|
|
12150
|
-
import
|
|
12041
|
+
import chalk51 from "chalk";
|
|
12151
12042
|
|
|
12152
12043
|
// src/lib/utils/duration-formatter.ts
|
|
12153
12044
|
function formatDuration(ms) {
|
|
@@ -12234,7 +12125,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12234
12125
|
endDate = new Date(untilMs);
|
|
12235
12126
|
} catch {
|
|
12236
12127
|
console.error(
|
|
12237
|
-
|
|
12128
|
+
chalk51.red(
|
|
12238
12129
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12239
12130
|
)
|
|
12240
12131
|
);
|
|
@@ -12249,7 +12140,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12249
12140
|
startDate = new Date(sinceMs);
|
|
12250
12141
|
} catch {
|
|
12251
12142
|
console.error(
|
|
12252
|
-
|
|
12143
|
+
chalk51.red(
|
|
12253
12144
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12254
12145
|
)
|
|
12255
12146
|
);
|
|
@@ -12259,13 +12150,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12259
12150
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
12260
12151
|
}
|
|
12261
12152
|
if (startDate >= endDate) {
|
|
12262
|
-
console.error(
|
|
12153
|
+
console.error(chalk51.red("\u2717 --since must be before --until"));
|
|
12263
12154
|
process.exit(1);
|
|
12264
12155
|
}
|
|
12265
12156
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
12266
12157
|
if (rangeMs > MAX_RANGE_MS) {
|
|
12267
12158
|
console.error(
|
|
12268
|
-
|
|
12159
|
+
chalk51.red(
|
|
12269
12160
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
12270
12161
|
)
|
|
12271
12162
|
);
|
|
@@ -12282,19 +12173,19 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12282
12173
|
);
|
|
12283
12174
|
console.log();
|
|
12284
12175
|
console.log(
|
|
12285
|
-
|
|
12176
|
+
chalk51.bold(
|
|
12286
12177
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
12287
12178
|
)
|
|
12288
12179
|
);
|
|
12289
12180
|
console.log();
|
|
12290
|
-
console.log(
|
|
12181
|
+
console.log(chalk51.dim("DATE RUNS RUN TIME"));
|
|
12291
12182
|
for (const day of filledDaily) {
|
|
12292
12183
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
12293
12184
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
12294
12185
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
12295
12186
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
12296
12187
|
}
|
|
12297
|
-
console.log(
|
|
12188
|
+
console.log(chalk51.dim("\u2500".repeat(29)));
|
|
12298
12189
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
12299
12190
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
12300
12191
|
console.log(
|
|
@@ -12304,13 +12195,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12304
12195
|
} catch (error) {
|
|
12305
12196
|
if (error instanceof Error) {
|
|
12306
12197
|
if (error.message.includes("Not authenticated")) {
|
|
12307
|
-
console.error(
|
|
12308
|
-
console.error(
|
|
12198
|
+
console.error(chalk51.red("\u2717 Not authenticated"));
|
|
12199
|
+
console.error(chalk51.dim(" Run: vm0 auth login"));
|
|
12309
12200
|
} else {
|
|
12310
|
-
console.error(
|
|
12201
|
+
console.error(chalk51.red(`\u2717 ${error.message}`));
|
|
12311
12202
|
}
|
|
12312
12203
|
} else {
|
|
12313
|
-
console.error(
|
|
12204
|
+
console.error(chalk51.red("\u2717 An unexpected error occurred"));
|
|
12314
12205
|
}
|
|
12315
12206
|
process.exit(1);
|
|
12316
12207
|
}
|
|
@@ -12321,40 +12212,40 @@ import { Command as Command56 } from "commander";
|
|
|
12321
12212
|
|
|
12322
12213
|
// src/commands/secret/list.ts
|
|
12323
12214
|
import { Command as Command53 } from "commander";
|
|
12324
|
-
import
|
|
12215
|
+
import chalk52 from "chalk";
|
|
12325
12216
|
var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(async () => {
|
|
12326
12217
|
try {
|
|
12327
12218
|
const result = await listSecrets();
|
|
12328
12219
|
if (result.secrets.length === 0) {
|
|
12329
|
-
console.log(
|
|
12220
|
+
console.log(chalk52.dim("No secrets found"));
|
|
12330
12221
|
console.log();
|
|
12331
12222
|
console.log("To add a secret:");
|
|
12332
|
-
console.log(
|
|
12223
|
+
console.log(chalk52.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
12333
12224
|
return;
|
|
12334
12225
|
}
|
|
12335
|
-
console.log(
|
|
12226
|
+
console.log(chalk52.bold("Secrets:"));
|
|
12336
12227
|
console.log();
|
|
12337
12228
|
for (const secret of result.secrets) {
|
|
12338
|
-
const typeIndicator = secret.type === "model-provider" ?
|
|
12339
|
-
console.log(` ${
|
|
12229
|
+
const typeIndicator = secret.type === "model-provider" ? chalk52.dim(" [model-provider]") : "";
|
|
12230
|
+
console.log(` ${chalk52.cyan(secret.name)}${typeIndicator}`);
|
|
12340
12231
|
if (secret.description) {
|
|
12341
|
-
console.log(` ${
|
|
12232
|
+
console.log(` ${chalk52.dim(secret.description)}`);
|
|
12342
12233
|
}
|
|
12343
12234
|
console.log(
|
|
12344
|
-
` ${
|
|
12235
|
+
` ${chalk52.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
12345
12236
|
);
|
|
12346
12237
|
console.log();
|
|
12347
12238
|
}
|
|
12348
|
-
console.log(
|
|
12239
|
+
console.log(chalk52.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
12349
12240
|
} catch (error) {
|
|
12350
12241
|
if (error instanceof Error) {
|
|
12351
12242
|
if (error.message.includes("Not authenticated")) {
|
|
12352
|
-
console.error(
|
|
12243
|
+
console.error(chalk52.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12353
12244
|
} else {
|
|
12354
|
-
console.error(
|
|
12245
|
+
console.error(chalk52.red(`\u2717 ${error.message}`));
|
|
12355
12246
|
}
|
|
12356
12247
|
} else {
|
|
12357
|
-
console.error(
|
|
12248
|
+
console.error(chalk52.red("\u2717 An unexpected error occurred"));
|
|
12358
12249
|
}
|
|
12359
12250
|
process.exit(1);
|
|
12360
12251
|
}
|
|
@@ -12362,7 +12253,7 @@ var listCommand6 = new Command53().name("list").alias("ls").description("List al
|
|
|
12362
12253
|
|
|
12363
12254
|
// src/commands/secret/set.ts
|
|
12364
12255
|
import { Command as Command54 } from "commander";
|
|
12365
|
-
import
|
|
12256
|
+
import chalk53 from "chalk";
|
|
12366
12257
|
var setCommand2 = new Command54().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
12367
12258
|
"-b, --body <value>",
|
|
12368
12259
|
"Secret value (required in non-interactive mode)"
|
|
@@ -12380,12 +12271,12 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12380
12271
|
value = prompted;
|
|
12381
12272
|
} else {
|
|
12382
12273
|
console.error(
|
|
12383
|
-
|
|
12274
|
+
chalk53.red("\u2717 --body is required in non-interactive mode")
|
|
12384
12275
|
);
|
|
12385
12276
|
console.log();
|
|
12386
12277
|
console.log("Usage:");
|
|
12387
12278
|
console.log(
|
|
12388
|
-
|
|
12279
|
+
chalk53.cyan(` vm0 secret set ${name} --body "your-secret-value"`)
|
|
12389
12280
|
);
|
|
12390
12281
|
process.exit(1);
|
|
12391
12282
|
}
|
|
@@ -12394,29 +12285,29 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12394
12285
|
value,
|
|
12395
12286
|
description: options.description
|
|
12396
12287
|
});
|
|
12397
|
-
console.log(
|
|
12288
|
+
console.log(chalk53.green(`\u2713 Secret "${secret.name}" saved`));
|
|
12398
12289
|
console.log();
|
|
12399
12290
|
console.log("Use in vm0.yaml:");
|
|
12400
|
-
console.log(
|
|
12401
|
-
console.log(
|
|
12291
|
+
console.log(chalk53.cyan(` environment:`));
|
|
12292
|
+
console.log(chalk53.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
12402
12293
|
} catch (error) {
|
|
12403
12294
|
if (error instanceof Error) {
|
|
12404
12295
|
if (error.message.includes("Not authenticated")) {
|
|
12405
12296
|
console.error(
|
|
12406
|
-
|
|
12297
|
+
chalk53.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12407
12298
|
);
|
|
12408
12299
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12409
|
-
console.error(
|
|
12300
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12410
12301
|
console.log();
|
|
12411
12302
|
console.log("Examples of valid secret names:");
|
|
12412
|
-
console.log(
|
|
12413
|
-
console.log(
|
|
12414
|
-
console.log(
|
|
12303
|
+
console.log(chalk53.dim(" MY_API_KEY"));
|
|
12304
|
+
console.log(chalk53.dim(" GITHUB_TOKEN"));
|
|
12305
|
+
console.log(chalk53.dim(" AWS_ACCESS_KEY_ID"));
|
|
12415
12306
|
} else {
|
|
12416
|
-
console.error(
|
|
12307
|
+
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12417
12308
|
}
|
|
12418
12309
|
} else {
|
|
12419
|
-
console.error(
|
|
12310
|
+
console.error(chalk53.red("\u2717 An unexpected error occurred"));
|
|
12420
12311
|
}
|
|
12421
12312
|
process.exit(1);
|
|
12422
12313
|
}
|
|
@@ -12425,19 +12316,19 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12425
12316
|
|
|
12426
12317
|
// src/commands/secret/delete.ts
|
|
12427
12318
|
import { Command as Command55 } from "commander";
|
|
12428
|
-
import
|
|
12319
|
+
import chalk54 from "chalk";
|
|
12429
12320
|
var deleteCommand2 = new Command55().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12430
12321
|
try {
|
|
12431
12322
|
try {
|
|
12432
12323
|
await getSecret(name);
|
|
12433
12324
|
} catch {
|
|
12434
|
-
console.error(
|
|
12325
|
+
console.error(chalk54.red(`\u2717 Secret "${name}" not found`));
|
|
12435
12326
|
process.exit(1);
|
|
12436
12327
|
}
|
|
12437
12328
|
if (!options.yes) {
|
|
12438
12329
|
if (!isInteractive()) {
|
|
12439
12330
|
console.error(
|
|
12440
|
-
|
|
12331
|
+
chalk54.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12441
12332
|
);
|
|
12442
12333
|
process.exit(1);
|
|
12443
12334
|
}
|
|
@@ -12446,21 +12337,21 @@ var deleteCommand2 = new Command55().name("delete").description("Delete a secret
|
|
|
12446
12337
|
false
|
|
12447
12338
|
);
|
|
12448
12339
|
if (!confirmed) {
|
|
12449
|
-
console.log(
|
|
12340
|
+
console.log(chalk54.dim("Cancelled"));
|
|
12450
12341
|
return;
|
|
12451
12342
|
}
|
|
12452
12343
|
}
|
|
12453
12344
|
await deleteSecret(name);
|
|
12454
|
-
console.log(
|
|
12345
|
+
console.log(chalk54.green(`\u2713 Secret "${name}" deleted`));
|
|
12455
12346
|
} catch (error) {
|
|
12456
12347
|
if (error instanceof Error) {
|
|
12457
12348
|
if (error.message.includes("Not authenticated")) {
|
|
12458
|
-
console.error(
|
|
12349
|
+
console.error(chalk54.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12459
12350
|
} else {
|
|
12460
|
-
console.error(
|
|
12351
|
+
console.error(chalk54.red(`\u2717 ${error.message}`));
|
|
12461
12352
|
}
|
|
12462
12353
|
} else {
|
|
12463
|
-
console.error(
|
|
12354
|
+
console.error(chalk54.red("\u2717 An unexpected error occurred"));
|
|
12464
12355
|
}
|
|
12465
12356
|
process.exit(1);
|
|
12466
12357
|
}
|
|
@@ -12474,7 +12365,7 @@ import { Command as Command60 } from "commander";
|
|
|
12474
12365
|
|
|
12475
12366
|
// src/commands/variable/list.ts
|
|
12476
12367
|
import { Command as Command57 } from "commander";
|
|
12477
|
-
import
|
|
12368
|
+
import chalk55 from "chalk";
|
|
12478
12369
|
function truncateValue(value, maxLength = 60) {
|
|
12479
12370
|
if (value.length <= maxLength) {
|
|
12480
12371
|
return value;
|
|
@@ -12485,35 +12376,35 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
12485
12376
|
try {
|
|
12486
12377
|
const result = await listVariables();
|
|
12487
12378
|
if (result.variables.length === 0) {
|
|
12488
|
-
console.log(
|
|
12379
|
+
console.log(chalk55.dim("No variables found"));
|
|
12489
12380
|
console.log();
|
|
12490
12381
|
console.log("To add a variable:");
|
|
12491
|
-
console.log(
|
|
12382
|
+
console.log(chalk55.cyan(" vm0 variable set MY_VAR <value>"));
|
|
12492
12383
|
return;
|
|
12493
12384
|
}
|
|
12494
|
-
console.log(
|
|
12385
|
+
console.log(chalk55.bold("Variables:"));
|
|
12495
12386
|
console.log();
|
|
12496
12387
|
for (const variable of result.variables) {
|
|
12497
12388
|
const displayValue = truncateValue(variable.value);
|
|
12498
|
-
console.log(` ${
|
|
12389
|
+
console.log(` ${chalk55.cyan(variable.name)} = ${displayValue}`);
|
|
12499
12390
|
if (variable.description) {
|
|
12500
|
-
console.log(` ${
|
|
12391
|
+
console.log(` ${chalk55.dim(variable.description)}`);
|
|
12501
12392
|
}
|
|
12502
12393
|
console.log(
|
|
12503
|
-
` ${
|
|
12394
|
+
` ${chalk55.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
12504
12395
|
);
|
|
12505
12396
|
console.log();
|
|
12506
12397
|
}
|
|
12507
|
-
console.log(
|
|
12398
|
+
console.log(chalk55.dim(`Total: ${result.variables.length} variable(s)`));
|
|
12508
12399
|
} catch (error) {
|
|
12509
12400
|
if (error instanceof Error) {
|
|
12510
12401
|
if (error.message.includes("Not authenticated")) {
|
|
12511
|
-
console.error(
|
|
12402
|
+
console.error(chalk55.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12512
12403
|
} else {
|
|
12513
|
-
console.error(
|
|
12404
|
+
console.error(chalk55.red(`\u2717 ${error.message}`));
|
|
12514
12405
|
}
|
|
12515
12406
|
} else {
|
|
12516
|
-
console.error(
|
|
12407
|
+
console.error(chalk55.red("\u2717 An unexpected error occurred"));
|
|
12517
12408
|
}
|
|
12518
12409
|
process.exit(1);
|
|
12519
12410
|
}
|
|
@@ -12521,7 +12412,7 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
12521
12412
|
|
|
12522
12413
|
// src/commands/variable/set.ts
|
|
12523
12414
|
import { Command as Command58 } from "commander";
|
|
12524
|
-
import
|
|
12415
|
+
import chalk56 from "chalk";
|
|
12525
12416
|
var setCommand3 = new Command58().name("set").description("Create or update a variable").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
12526
12417
|
async (name, value, options) => {
|
|
12527
12418
|
try {
|
|
@@ -12530,29 +12421,29 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12530
12421
|
value,
|
|
12531
12422
|
description: options.description
|
|
12532
12423
|
});
|
|
12533
|
-
console.log(
|
|
12424
|
+
console.log(chalk56.green(`\u2713 Variable "${variable.name}" saved`));
|
|
12534
12425
|
console.log();
|
|
12535
12426
|
console.log("Use in vm0.yaml:");
|
|
12536
|
-
console.log(
|
|
12537
|
-
console.log(
|
|
12427
|
+
console.log(chalk56.cyan(` environment:`));
|
|
12428
|
+
console.log(chalk56.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
12538
12429
|
} catch (error) {
|
|
12539
12430
|
if (error instanceof Error) {
|
|
12540
12431
|
if (error.message.includes("Not authenticated")) {
|
|
12541
12432
|
console.error(
|
|
12542
|
-
|
|
12433
|
+
chalk56.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12543
12434
|
);
|
|
12544
12435
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12545
|
-
console.error(
|
|
12436
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12546
12437
|
console.log();
|
|
12547
12438
|
console.log("Examples of valid variable names:");
|
|
12548
|
-
console.log(
|
|
12549
|
-
console.log(
|
|
12550
|
-
console.log(
|
|
12439
|
+
console.log(chalk56.dim(" MY_VAR"));
|
|
12440
|
+
console.log(chalk56.dim(" API_URL"));
|
|
12441
|
+
console.log(chalk56.dim(" DEBUG_MODE"));
|
|
12551
12442
|
} else {
|
|
12552
|
-
console.error(
|
|
12443
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12553
12444
|
}
|
|
12554
12445
|
} else {
|
|
12555
|
-
console.error(
|
|
12446
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
12556
12447
|
}
|
|
12557
12448
|
process.exit(1);
|
|
12558
12449
|
}
|
|
@@ -12561,14 +12452,14 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12561
12452
|
|
|
12562
12453
|
// src/commands/variable/delete.ts
|
|
12563
12454
|
import { Command as Command59 } from "commander";
|
|
12564
|
-
import
|
|
12455
|
+
import chalk57 from "chalk";
|
|
12565
12456
|
var deleteCommand3 = new Command59().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12566
12457
|
try {
|
|
12567
12458
|
try {
|
|
12568
12459
|
await getVariable(name);
|
|
12569
12460
|
} catch (error) {
|
|
12570
12461
|
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
12571
|
-
console.error(
|
|
12462
|
+
console.error(chalk57.red(`\u2717 Variable "${name}" not found`));
|
|
12572
12463
|
process.exit(1);
|
|
12573
12464
|
}
|
|
12574
12465
|
throw error;
|
|
@@ -12576,7 +12467,7 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12576
12467
|
if (!options.yes) {
|
|
12577
12468
|
if (!isInteractive()) {
|
|
12578
12469
|
console.error(
|
|
12579
|
-
|
|
12470
|
+
chalk57.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12580
12471
|
);
|
|
12581
12472
|
process.exit(1);
|
|
12582
12473
|
}
|
|
@@ -12585,21 +12476,21 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12585
12476
|
false
|
|
12586
12477
|
);
|
|
12587
12478
|
if (!confirmed) {
|
|
12588
|
-
console.log(
|
|
12479
|
+
console.log(chalk57.dim("Cancelled"));
|
|
12589
12480
|
return;
|
|
12590
12481
|
}
|
|
12591
12482
|
}
|
|
12592
12483
|
await deleteVariable(name);
|
|
12593
|
-
console.log(
|
|
12484
|
+
console.log(chalk57.green(`\u2713 Variable "${name}" deleted`));
|
|
12594
12485
|
} catch (error) {
|
|
12595
12486
|
if (error instanceof Error) {
|
|
12596
12487
|
if (error.message.includes("Not authenticated")) {
|
|
12597
|
-
console.error(
|
|
12488
|
+
console.error(chalk57.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12598
12489
|
} else {
|
|
12599
|
-
console.error(
|
|
12490
|
+
console.error(chalk57.red(`\u2717 ${error.message}`));
|
|
12600
12491
|
}
|
|
12601
12492
|
} else {
|
|
12602
|
-
console.error(
|
|
12493
|
+
console.error(chalk57.red("\u2717 An unexpected error occurred"));
|
|
12603
12494
|
}
|
|
12604
12495
|
process.exit(1);
|
|
12605
12496
|
}
|
|
@@ -12613,15 +12504,15 @@ import { Command as Command65 } from "commander";
|
|
|
12613
12504
|
|
|
12614
12505
|
// src/commands/model-provider/list.ts
|
|
12615
12506
|
import { Command as Command61 } from "commander";
|
|
12616
|
-
import
|
|
12507
|
+
import chalk58 from "chalk";
|
|
12617
12508
|
var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
12618
12509
|
try {
|
|
12619
12510
|
const result = await listModelProviders();
|
|
12620
12511
|
if (result.modelProviders.length === 0) {
|
|
12621
|
-
console.log(
|
|
12512
|
+
console.log(chalk58.dim("No model providers configured"));
|
|
12622
12513
|
console.log();
|
|
12623
12514
|
console.log("To add a model provider:");
|
|
12624
|
-
console.log(
|
|
12515
|
+
console.log(chalk58.cyan(" vm0 model-provider setup"));
|
|
12625
12516
|
return;
|
|
12626
12517
|
}
|
|
12627
12518
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -12635,16 +12526,16 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12635
12526
|
},
|
|
12636
12527
|
{}
|
|
12637
12528
|
);
|
|
12638
|
-
console.log(
|
|
12529
|
+
console.log(chalk58.bold("Model Providers:"));
|
|
12639
12530
|
console.log();
|
|
12640
12531
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
12641
|
-
console.log(` ${
|
|
12532
|
+
console.log(` ${chalk58.cyan(framework)}:`);
|
|
12642
12533
|
for (const provider of providers) {
|
|
12643
|
-
const defaultTag = provider.isDefault ?
|
|
12644
|
-
const modelTag = provider.selectedModel ?
|
|
12534
|
+
const defaultTag = provider.isDefault ? chalk58.green(" (default)") : "";
|
|
12535
|
+
const modelTag = provider.selectedModel ? chalk58.dim(` [${provider.selectedModel}]`) : "";
|
|
12645
12536
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
12646
12537
|
console.log(
|
|
12647
|
-
|
|
12538
|
+
chalk58.dim(
|
|
12648
12539
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
12649
12540
|
)
|
|
12650
12541
|
);
|
|
@@ -12652,17 +12543,17 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12652
12543
|
console.log();
|
|
12653
12544
|
}
|
|
12654
12545
|
console.log(
|
|
12655
|
-
|
|
12546
|
+
chalk58.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
12656
12547
|
);
|
|
12657
12548
|
} catch (error) {
|
|
12658
12549
|
if (error instanceof Error) {
|
|
12659
12550
|
if (error.message.includes("Not authenticated")) {
|
|
12660
|
-
console.error(
|
|
12551
|
+
console.error(chalk58.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12661
12552
|
} else {
|
|
12662
|
-
console.error(
|
|
12553
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12663
12554
|
}
|
|
12664
12555
|
} else {
|
|
12665
|
-
console.error(
|
|
12556
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
12666
12557
|
}
|
|
12667
12558
|
process.exit(1);
|
|
12668
12559
|
}
|
|
@@ -12670,15 +12561,15 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12670
12561
|
|
|
12671
12562
|
// src/commands/model-provider/setup.ts
|
|
12672
12563
|
import { Command as Command62 } from "commander";
|
|
12673
|
-
import
|
|
12564
|
+
import chalk59 from "chalk";
|
|
12674
12565
|
import prompts2 from "prompts";
|
|
12675
12566
|
function validateProviderType(typeStr) {
|
|
12676
12567
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
12677
|
-
console.error(
|
|
12568
|
+
console.error(chalk59.red(`\u2717 Invalid type "${typeStr}"`));
|
|
12678
12569
|
console.log();
|
|
12679
12570
|
console.log("Valid types:");
|
|
12680
12571
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12681
|
-
console.log(` ${
|
|
12572
|
+
console.log(` ${chalk59.cyan(t)} - ${config.label}`);
|
|
12682
12573
|
}
|
|
12683
12574
|
process.exit(1);
|
|
12684
12575
|
}
|
|
@@ -12690,11 +12581,11 @@ function validateModel(type, modelStr) {
|
|
|
12690
12581
|
return modelStr;
|
|
12691
12582
|
}
|
|
12692
12583
|
if (models && !models.includes(modelStr)) {
|
|
12693
|
-
console.error(
|
|
12584
|
+
console.error(chalk59.red(`\u2717 Invalid model "${modelStr}"`));
|
|
12694
12585
|
console.log();
|
|
12695
12586
|
console.log("Valid models:");
|
|
12696
12587
|
for (const m of models) {
|
|
12697
|
-
console.log(` ${
|
|
12588
|
+
console.log(` ${chalk59.cyan(m)}`);
|
|
12698
12589
|
}
|
|
12699
12590
|
process.exit(1);
|
|
12700
12591
|
}
|
|
@@ -12703,12 +12594,12 @@ function validateModel(type, modelStr) {
|
|
|
12703
12594
|
function validateAuthMethod(type, authMethodStr) {
|
|
12704
12595
|
const authMethods = getAuthMethodsForType(type);
|
|
12705
12596
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
12706
|
-
console.error(
|
|
12597
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
12707
12598
|
console.log();
|
|
12708
12599
|
console.log("Valid auth methods:");
|
|
12709
12600
|
if (authMethods) {
|
|
12710
12601
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12711
|
-
console.log(` ${
|
|
12602
|
+
console.log(` ${chalk59.cyan(method)} - ${config.label}`);
|
|
12712
12603
|
}
|
|
12713
12604
|
}
|
|
12714
12605
|
process.exit(1);
|
|
@@ -12718,7 +12609,7 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
12718
12609
|
function parseSecrets(type, authMethod, secretArgs) {
|
|
12719
12610
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12720
12611
|
if (!secretsConfig) {
|
|
12721
|
-
console.error(
|
|
12612
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12722
12613
|
process.exit(1);
|
|
12723
12614
|
}
|
|
12724
12615
|
const secretNames = Object.keys(secretsConfig);
|
|
@@ -12726,19 +12617,19 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12726
12617
|
if (secretArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
12727
12618
|
if (secretNames.length !== 1) {
|
|
12728
12619
|
console.error(
|
|
12729
|
-
|
|
12620
|
+
chalk59.red("\u2717 Must use KEY=VALUE format for multi-secret auth methods")
|
|
12730
12621
|
);
|
|
12731
12622
|
console.log();
|
|
12732
12623
|
console.log("Required secrets:");
|
|
12733
12624
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12734
12625
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
12735
|
-
console.log(` ${
|
|
12626
|
+
console.log(` ${chalk59.cyan(name)}${requiredNote}`);
|
|
12736
12627
|
}
|
|
12737
12628
|
process.exit(1);
|
|
12738
12629
|
}
|
|
12739
12630
|
const firstSecretName = secretNames[0];
|
|
12740
12631
|
if (!firstSecretName) {
|
|
12741
|
-
console.error(
|
|
12632
|
+
console.error(chalk59.red("\u2717 No secrets defined for this auth method"));
|
|
12742
12633
|
process.exit(1);
|
|
12743
12634
|
}
|
|
12744
12635
|
return { [firstSecretName]: firstArg };
|
|
@@ -12747,7 +12638,7 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12747
12638
|
for (const arg of secretArgs) {
|
|
12748
12639
|
const eqIndex = arg.indexOf("=");
|
|
12749
12640
|
if (eqIndex === -1) {
|
|
12750
|
-
console.error(
|
|
12641
|
+
console.error(chalk59.red(`\u2717 Invalid secret format "${arg}"`));
|
|
12751
12642
|
console.log();
|
|
12752
12643
|
console.log("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
12753
12644
|
process.exit(1);
|
|
@@ -12761,17 +12652,17 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12761
12652
|
function validateSecrets(type, authMethod, secrets) {
|
|
12762
12653
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12763
12654
|
if (!secretsConfig) {
|
|
12764
|
-
console.error(
|
|
12655
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12765
12656
|
process.exit(1);
|
|
12766
12657
|
}
|
|
12767
12658
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12768
12659
|
if (fieldConfig.required && !secrets[name]) {
|
|
12769
|
-
console.error(
|
|
12660
|
+
console.error(chalk59.red(`\u2717 Missing required secret: ${name}`));
|
|
12770
12661
|
console.log();
|
|
12771
12662
|
console.log("Required secrets:");
|
|
12772
12663
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12773
12664
|
if (fc.required) {
|
|
12774
|
-
console.log(` ${
|
|
12665
|
+
console.log(` ${chalk59.cyan(n)} - ${fc.label}`);
|
|
12775
12666
|
}
|
|
12776
12667
|
}
|
|
12777
12668
|
process.exit(1);
|
|
@@ -12779,12 +12670,12 @@ function validateSecrets(type, authMethod, secrets) {
|
|
|
12779
12670
|
}
|
|
12780
12671
|
for (const name of Object.keys(secrets)) {
|
|
12781
12672
|
if (!(name in secretsConfig)) {
|
|
12782
|
-
console.error(
|
|
12673
|
+
console.error(chalk59.red(`\u2717 Unknown secret: ${name}`));
|
|
12783
12674
|
console.log();
|
|
12784
12675
|
console.log("Valid secrets:");
|
|
12785
12676
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12786
12677
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
12787
|
-
console.log(` ${
|
|
12678
|
+
console.log(` ${chalk59.cyan(n)}${requiredNote}`);
|
|
12788
12679
|
}
|
|
12789
12680
|
process.exit(1);
|
|
12790
12681
|
}
|
|
@@ -12807,7 +12698,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12807
12698
|
const defaultAuthMethod = getDefaultAuthMethod(type);
|
|
12808
12699
|
const authMethods = getAuthMethodsForType(type);
|
|
12809
12700
|
if (!defaultAuthMethod || !authMethods) {
|
|
12810
|
-
console.error(
|
|
12701
|
+
console.error(chalk59.red(`\u2717 Provider "${type}" requires --auth-method`));
|
|
12811
12702
|
process.exit(1);
|
|
12812
12703
|
}
|
|
12813
12704
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -12815,7 +12706,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12815
12706
|
authMethod = authMethodNames[0];
|
|
12816
12707
|
} else {
|
|
12817
12708
|
console.error(
|
|
12818
|
-
|
|
12709
|
+
chalk59.red(
|
|
12819
12710
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
12820
12711
|
)
|
|
12821
12712
|
);
|
|
@@ -12824,13 +12715,13 @@ function handleNonInteractiveMode(options) {
|
|
|
12824
12715
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12825
12716
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
12826
12717
|
console.log(
|
|
12827
|
-
` ${
|
|
12718
|
+
` ${chalk59.cyan(method)} - ${config.label}${defaultNote}`
|
|
12828
12719
|
);
|
|
12829
12720
|
}
|
|
12830
12721
|
console.log();
|
|
12831
12722
|
console.log("Example:");
|
|
12832
12723
|
console.log(
|
|
12833
|
-
|
|
12724
|
+
chalk59.cyan(
|
|
12834
12725
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`
|
|
12835
12726
|
)
|
|
12836
12727
|
);
|
|
@@ -12850,7 +12741,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12850
12741
|
const secretArgs = options.secret;
|
|
12851
12742
|
const firstArg = secretArgs[0];
|
|
12852
12743
|
if (!firstArg) {
|
|
12853
|
-
console.error(
|
|
12744
|
+
console.error(chalk59.red("\u2717 Secret is required"));
|
|
12854
12745
|
process.exit(1);
|
|
12855
12746
|
}
|
|
12856
12747
|
let secret;
|
|
@@ -12899,7 +12790,7 @@ async function promptForModelSelection(type) {
|
|
|
12899
12790
|
if (selected === "__custom__") {
|
|
12900
12791
|
const placeholder = getCustomModelPlaceholder(type);
|
|
12901
12792
|
if (placeholder) {
|
|
12902
|
-
console.log(
|
|
12793
|
+
console.log(chalk59.dim(`Example: ${placeholder}`));
|
|
12903
12794
|
}
|
|
12904
12795
|
const customResponse = await prompts2(
|
|
12905
12796
|
{
|
|
@@ -12944,13 +12835,13 @@ function isSensitiveSecret(name) {
|
|
|
12944
12835
|
async function promptForSecrets(type, authMethod) {
|
|
12945
12836
|
const secretsConfig = getSecretsForAuthMethod(type, authMethod);
|
|
12946
12837
|
if (!secretsConfig) {
|
|
12947
|
-
console.error(
|
|
12838
|
+
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12948
12839
|
process.exit(1);
|
|
12949
12840
|
}
|
|
12950
12841
|
const secrets = {};
|
|
12951
12842
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12952
12843
|
if (fieldConfig.helpText) {
|
|
12953
|
-
console.log(
|
|
12844
|
+
console.log(chalk59.dim(fieldConfig.helpText));
|
|
12954
12845
|
}
|
|
12955
12846
|
const isSensitive = isSensitiveSecret(name);
|
|
12956
12847
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -12985,11 +12876,11 @@ async function promptForSecrets(type, authMethod) {
|
|
|
12985
12876
|
}
|
|
12986
12877
|
async function handleInteractiveMode() {
|
|
12987
12878
|
if (!isInteractive()) {
|
|
12988
|
-
console.error(
|
|
12879
|
+
console.error(chalk59.red("\u2717 Interactive mode requires a TTY"));
|
|
12989
12880
|
console.log();
|
|
12990
12881
|
console.log("Use non-interactive mode:");
|
|
12991
12882
|
console.log(
|
|
12992
|
-
|
|
12883
|
+
chalk59.cyan(' vm0 model-provider setup --type <type> --secret "<value>"')
|
|
12993
12884
|
);
|
|
12994
12885
|
process.exit(1);
|
|
12995
12886
|
}
|
|
@@ -13004,7 +12895,7 @@ async function handleInteractiveMode() {
|
|
|
13004
12895
|
title = `${title} \u2713`;
|
|
13005
12896
|
}
|
|
13006
12897
|
if (isExperimental) {
|
|
13007
|
-
title = `${title} ${
|
|
12898
|
+
title = `${title} ${chalk59.dim("(experimental)")}`;
|
|
13008
12899
|
}
|
|
13009
12900
|
return {
|
|
13010
12901
|
title,
|
|
@@ -13051,7 +12942,7 @@ async function handleInteractiveMode() {
|
|
|
13051
12942
|
}
|
|
13052
12943
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
13053
12944
|
console.log();
|
|
13054
|
-
console.log(
|
|
12945
|
+
console.log(chalk59.dim(config.helpText));
|
|
13055
12946
|
console.log();
|
|
13056
12947
|
if (hasAuthMethods(type)) {
|
|
13057
12948
|
const authMethod = await promptForAuthMethod(type);
|
|
@@ -13082,12 +12973,12 @@ async function handleInteractiveMode() {
|
|
|
13082
12973
|
function handleSetupError2(error) {
|
|
13083
12974
|
if (error instanceof Error) {
|
|
13084
12975
|
if (error.message.includes("Not authenticated")) {
|
|
13085
|
-
console.error(
|
|
12976
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13086
12977
|
} else {
|
|
13087
|
-
console.error(
|
|
12978
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
13088
12979
|
}
|
|
13089
12980
|
} else {
|
|
13090
|
-
console.error(
|
|
12981
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
13091
12982
|
}
|
|
13092
12983
|
process.exit(1);
|
|
13093
12984
|
}
|
|
@@ -13104,7 +12995,7 @@ async function promptSetAsDefault(type, framework, isDefault) {
|
|
|
13104
12995
|
);
|
|
13105
12996
|
if (response.setDefault) {
|
|
13106
12997
|
await setModelProviderDefault(type);
|
|
13107
|
-
console.log(
|
|
12998
|
+
console.log(chalk59.green(`\u2713 Default for ${framework} set to "${type}"`));
|
|
13108
12999
|
}
|
|
13109
13000
|
}
|
|
13110
13001
|
function collectSecrets(value, previous) {
|
|
@@ -13131,7 +13022,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13131
13022
|
model: options.model
|
|
13132
13023
|
});
|
|
13133
13024
|
} else if (options.type || secretArgs.length > 0) {
|
|
13134
|
-
console.error(
|
|
13025
|
+
console.error(chalk59.red("\u2717 Both --type and --secret are required"));
|
|
13135
13026
|
process.exit(1);
|
|
13136
13027
|
} else {
|
|
13137
13028
|
const result = await handleInteractiveMode();
|
|
@@ -13149,11 +13040,11 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13149
13040
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
13150
13041
|
if (!hasModelSelection(input.type)) {
|
|
13151
13042
|
console.log(
|
|
13152
|
-
|
|
13043
|
+
chalk59.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
13153
13044
|
);
|
|
13154
13045
|
} else {
|
|
13155
13046
|
console.log(
|
|
13156
|
-
|
|
13047
|
+
chalk59.green(
|
|
13157
13048
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
13158
13049
|
)
|
|
13159
13050
|
);
|
|
@@ -13178,7 +13069,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13178
13069
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
13179
13070
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
13180
13071
|
console.log(
|
|
13181
|
-
|
|
13072
|
+
chalk59.green(
|
|
13182
13073
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
13183
13074
|
)
|
|
13184
13075
|
);
|
|
@@ -13197,31 +13088,31 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13197
13088
|
|
|
13198
13089
|
// src/commands/model-provider/delete.ts
|
|
13199
13090
|
import { Command as Command63 } from "commander";
|
|
13200
|
-
import
|
|
13091
|
+
import chalk60 from "chalk";
|
|
13201
13092
|
var deleteCommand4 = new Command63().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
13202
13093
|
try {
|
|
13203
13094
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
13204
|
-
console.error(
|
|
13095
|
+
console.error(chalk60.red(`\u2717 Invalid type "${type}"`));
|
|
13205
13096
|
console.log();
|
|
13206
13097
|
console.log("Valid types:");
|
|
13207
13098
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13208
|
-
console.log(` ${
|
|
13099
|
+
console.log(` ${chalk60.cyan(t)} - ${config.label}`);
|
|
13209
13100
|
}
|
|
13210
13101
|
process.exit(1);
|
|
13211
13102
|
}
|
|
13212
13103
|
await deleteModelProvider(type);
|
|
13213
|
-
console.log(
|
|
13104
|
+
console.log(chalk60.green(`\u2713 Model provider "${type}" deleted`));
|
|
13214
13105
|
} catch (error) {
|
|
13215
13106
|
if (error instanceof Error) {
|
|
13216
13107
|
if (error.message.includes("not found")) {
|
|
13217
|
-
console.error(
|
|
13108
|
+
console.error(chalk60.red(`\u2717 Model provider "${type}" not found`));
|
|
13218
13109
|
} else if (error.message.includes("Not authenticated")) {
|
|
13219
|
-
console.error(
|
|
13110
|
+
console.error(chalk60.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13220
13111
|
} else {
|
|
13221
|
-
console.error(
|
|
13112
|
+
console.error(chalk60.red(`\u2717 ${error.message}`));
|
|
13222
13113
|
}
|
|
13223
13114
|
} else {
|
|
13224
|
-
console.error(
|
|
13115
|
+
console.error(chalk60.red("\u2717 An unexpected error occurred"));
|
|
13225
13116
|
}
|
|
13226
13117
|
process.exit(1);
|
|
13227
13118
|
}
|
|
@@ -13229,35 +13120,35 @@ var deleteCommand4 = new Command63().name("delete").description("Delete a model
|
|
|
13229
13120
|
|
|
13230
13121
|
// src/commands/model-provider/set-default.ts
|
|
13231
13122
|
import { Command as Command64 } from "commander";
|
|
13232
|
-
import
|
|
13123
|
+
import chalk61 from "chalk";
|
|
13233
13124
|
var setDefaultCommand = new Command64().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
|
|
13234
13125
|
try {
|
|
13235
13126
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
13236
|
-
console.error(
|
|
13127
|
+
console.error(chalk61.red(`\u2717 Invalid type "${type}"`));
|
|
13237
13128
|
console.log();
|
|
13238
13129
|
console.log("Valid types:");
|
|
13239
13130
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13240
|
-
console.log(` ${
|
|
13131
|
+
console.log(` ${chalk61.cyan(t)} - ${config.label}`);
|
|
13241
13132
|
}
|
|
13242
13133
|
process.exit(1);
|
|
13243
13134
|
}
|
|
13244
13135
|
const provider = await setModelProviderDefault(type);
|
|
13245
13136
|
console.log(
|
|
13246
|
-
|
|
13137
|
+
chalk61.green(
|
|
13247
13138
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
13248
13139
|
)
|
|
13249
13140
|
);
|
|
13250
13141
|
} catch (error) {
|
|
13251
13142
|
if (error instanceof Error) {
|
|
13252
13143
|
if (error.message.includes("not found")) {
|
|
13253
|
-
console.error(
|
|
13144
|
+
console.error(chalk61.red(`\u2717 Model provider "${type}" not found`));
|
|
13254
13145
|
} else if (error.message.includes("Not authenticated")) {
|
|
13255
|
-
console.error(
|
|
13146
|
+
console.error(chalk61.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13256
13147
|
} else {
|
|
13257
|
-
console.error(
|
|
13148
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
13258
13149
|
}
|
|
13259
13150
|
} else {
|
|
13260
|
-
console.error(
|
|
13151
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
13261
13152
|
}
|
|
13262
13153
|
process.exit(1);
|
|
13263
13154
|
}
|
|
@@ -13267,12 +13158,12 @@ var setDefaultCommand = new Command64().name("set-default").description("Set a m
|
|
|
13267
13158
|
var modelProviderCommand = new Command65().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
13268
13159
|
|
|
13269
13160
|
// src/commands/connector/index.ts
|
|
13270
|
-
import { Command as
|
|
13161
|
+
import { Command as Command70 } from "commander";
|
|
13271
13162
|
|
|
13272
13163
|
// src/commands/connector/connect.ts
|
|
13273
13164
|
import { Command as Command66 } from "commander";
|
|
13274
|
-
import
|
|
13275
|
-
import { initClient as
|
|
13165
|
+
import chalk62 from "chalk";
|
|
13166
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
13276
13167
|
function delay2(ms) {
|
|
13277
13168
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13278
13169
|
}
|
|
@@ -13293,15 +13184,15 @@ async function getHeaders2() {
|
|
|
13293
13184
|
var connectCommand = new Command66().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type) => {
|
|
13294
13185
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13295
13186
|
if (!parseResult.success) {
|
|
13296
|
-
console.error(
|
|
13187
|
+
console.error(chalk62.red(`Unknown connector type: ${type}`));
|
|
13297
13188
|
console.error("Available connectors: github");
|
|
13298
13189
|
process.exit(1);
|
|
13299
13190
|
}
|
|
13300
13191
|
const connectorType = parseResult.data;
|
|
13301
13192
|
const apiUrl = await getApiUrl();
|
|
13302
13193
|
const headers = await getHeaders2();
|
|
13303
|
-
console.log(`Connecting ${
|
|
13304
|
-
const sessionsClient =
|
|
13194
|
+
console.log(`Connecting ${chalk62.cyan(type)}...`);
|
|
13195
|
+
const sessionsClient = initClient12(connectorSessionsContract, {
|
|
13305
13196
|
baseUrl: apiUrl,
|
|
13306
13197
|
baseHeaders: headers,
|
|
13307
13198
|
jsonQuery: true
|
|
@@ -13313,22 +13204,21 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13313
13204
|
if (createResult.status !== 200) {
|
|
13314
13205
|
const errorBody = createResult.body;
|
|
13315
13206
|
console.error(
|
|
13316
|
-
|
|
13207
|
+
chalk62.red(`Failed to create session: ${errorBody.error?.message}`)
|
|
13317
13208
|
);
|
|
13318
13209
|
process.exit(1);
|
|
13319
13210
|
}
|
|
13320
13211
|
const session = createResult.body;
|
|
13321
13212
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13322
|
-
console.log(
|
|
13323
|
-
console.log(
|
|
13213
|
+
console.log(chalk62.green("\nSession created"));
|
|
13214
|
+
console.log(chalk62.cyan(`
|
|
13324
13215
|
To connect, visit: ${verificationUrl}`));
|
|
13325
|
-
console.log(`Session code: ${chalk63.bold(session.code)}`);
|
|
13326
13216
|
console.log(
|
|
13327
13217
|
`
|
|
13328
13218
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
13329
13219
|
);
|
|
13330
13220
|
console.log("\nWaiting for authorization...");
|
|
13331
|
-
const sessionClient =
|
|
13221
|
+
const sessionClient = initClient12(connectorSessionByIdContract, {
|
|
13332
13222
|
baseUrl: apiUrl,
|
|
13333
13223
|
baseHeaders: headers,
|
|
13334
13224
|
jsonQuery: true
|
|
@@ -13348,7 +13238,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13348
13238
|
if (statusResult.status !== 200) {
|
|
13349
13239
|
const errorBody = statusResult.body;
|
|
13350
13240
|
console.error(
|
|
13351
|
-
|
|
13241
|
+
chalk62.red(`
|
|
13352
13242
|
Failed to check status: ${errorBody.error?.message}`)
|
|
13353
13243
|
);
|
|
13354
13244
|
process.exit(1);
|
|
@@ -13356,17 +13246,17 @@ Failed to check status: ${errorBody.error?.message}`)
|
|
|
13356
13246
|
const status = statusResult.body;
|
|
13357
13247
|
switch (status.status) {
|
|
13358
13248
|
case "complete":
|
|
13359
|
-
console.log(
|
|
13249
|
+
console.log(chalk62.green(`
|
|
13360
13250
|
|
|
13361
13251
|
${type} connected successfully!`));
|
|
13362
13252
|
return;
|
|
13363
13253
|
case "expired":
|
|
13364
|
-
console.log(
|
|
13254
|
+
console.log(chalk62.red("\nSession expired. Please try again."));
|
|
13365
13255
|
process.exit(1);
|
|
13366
13256
|
break;
|
|
13367
13257
|
case "error":
|
|
13368
13258
|
console.log(
|
|
13369
|
-
|
|
13259
|
+
chalk62.red(
|
|
13370
13260
|
`
|
|
13371
13261
|
Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13372
13262
|
)
|
|
@@ -13374,37 +13264,178 @@ Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
|
13374
13264
|
process.exit(1);
|
|
13375
13265
|
break;
|
|
13376
13266
|
case "pending":
|
|
13377
|
-
process.stdout.write(
|
|
13267
|
+
process.stdout.write(chalk62.dim("."));
|
|
13378
13268
|
break;
|
|
13379
13269
|
}
|
|
13380
13270
|
}
|
|
13381
|
-
console.log(
|
|
13271
|
+
console.log(chalk62.red("\nSession timed out. Please try again."));
|
|
13382
13272
|
process.exit(1);
|
|
13383
13273
|
});
|
|
13384
13274
|
|
|
13275
|
+
// src/commands/connector/list.ts
|
|
13276
|
+
import { Command as Command67 } from "commander";
|
|
13277
|
+
import chalk63 from "chalk";
|
|
13278
|
+
var listCommand9 = new Command67().name("list").alias("ls").description("List all connectors and their status").action(async () => {
|
|
13279
|
+
try {
|
|
13280
|
+
const result = await listConnectors();
|
|
13281
|
+
const connectedMap = new Map(result.connectors.map((c25) => [c25.type, c25]));
|
|
13282
|
+
const allTypes = Object.keys(CONNECTOR_TYPES);
|
|
13283
|
+
const typeWidth = Math.max(4, ...allTypes.map((t) => t.length));
|
|
13284
|
+
const statusText = "STATUS";
|
|
13285
|
+
const statusWidth = statusText.length;
|
|
13286
|
+
const header = [
|
|
13287
|
+
"TYPE".padEnd(typeWidth),
|
|
13288
|
+
statusText.padEnd(statusWidth),
|
|
13289
|
+
"ACCOUNT"
|
|
13290
|
+
].join(" ");
|
|
13291
|
+
console.log(chalk63.dim(header));
|
|
13292
|
+
for (const type of allTypes) {
|
|
13293
|
+
const connector = connectedMap.get(type);
|
|
13294
|
+
const status = connector ? chalk63.green("\u2713".padEnd(statusWidth)) : chalk63.dim("-".padEnd(statusWidth));
|
|
13295
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk63.dim("-");
|
|
13296
|
+
const row = [type.padEnd(typeWidth), status, account].join(" ");
|
|
13297
|
+
console.log(row);
|
|
13298
|
+
}
|
|
13299
|
+
console.log();
|
|
13300
|
+
console.log(chalk63.dim("To connect a service:"));
|
|
13301
|
+
console.log(chalk63.dim(" vm0 connector connect <type>"));
|
|
13302
|
+
} catch (error) {
|
|
13303
|
+
if (error instanceof Error) {
|
|
13304
|
+
if (error.message.includes("Not authenticated")) {
|
|
13305
|
+
console.error(chalk63.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13306
|
+
} else {
|
|
13307
|
+
console.error(chalk63.red(`\u2717 ${error.message}`));
|
|
13308
|
+
}
|
|
13309
|
+
} else {
|
|
13310
|
+
console.error(chalk63.red("\u2717 An unexpected error occurred"));
|
|
13311
|
+
}
|
|
13312
|
+
process.exit(1);
|
|
13313
|
+
}
|
|
13314
|
+
});
|
|
13315
|
+
|
|
13316
|
+
// src/commands/connector/status.ts
|
|
13317
|
+
import { Command as Command68 } from "commander";
|
|
13318
|
+
import chalk64 from "chalk";
|
|
13319
|
+
var LABEL_WIDTH = 16;
|
|
13320
|
+
var statusCommand7 = new Command68().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(async (type) => {
|
|
13321
|
+
try {
|
|
13322
|
+
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13323
|
+
if (!parseResult.success) {
|
|
13324
|
+
console.error(chalk64.red(`\u2717 Unknown connector type: ${type}`));
|
|
13325
|
+
console.log();
|
|
13326
|
+
console.log("Available connectors:");
|
|
13327
|
+
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13328
|
+
console.log(` ${chalk64.cyan(t)} - ${config.label}`);
|
|
13329
|
+
}
|
|
13330
|
+
process.exit(1);
|
|
13331
|
+
}
|
|
13332
|
+
const connector = await getConnector(parseResult.data);
|
|
13333
|
+
console.log(`Connector: ${chalk64.cyan(type)}`);
|
|
13334
|
+
console.log();
|
|
13335
|
+
if (connector) {
|
|
13336
|
+
console.log(
|
|
13337
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk64.green("connected")}`
|
|
13338
|
+
);
|
|
13339
|
+
console.log(
|
|
13340
|
+
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
13341
|
+
);
|
|
13342
|
+
console.log(
|
|
13343
|
+
`${"Auth Method:".padEnd(LABEL_WIDTH)}${connector.authMethod}`
|
|
13344
|
+
);
|
|
13345
|
+
if (connector.oauthScopes && connector.oauthScopes.length > 0) {
|
|
13346
|
+
console.log(
|
|
13347
|
+
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
13348
|
+
);
|
|
13349
|
+
}
|
|
13350
|
+
console.log(
|
|
13351
|
+
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
13352
|
+
);
|
|
13353
|
+
if (connector.updatedAt !== connector.createdAt) {
|
|
13354
|
+
console.log(
|
|
13355
|
+
`${"Last Updated:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.updatedAt)}`
|
|
13356
|
+
);
|
|
13357
|
+
}
|
|
13358
|
+
console.log();
|
|
13359
|
+
console.log(chalk64.dim("To disconnect:"));
|
|
13360
|
+
console.log(chalk64.dim(` vm0 connector disconnect ${type}`));
|
|
13361
|
+
} else {
|
|
13362
|
+
console.log(
|
|
13363
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk64.dim("not connected")}`
|
|
13364
|
+
);
|
|
13365
|
+
console.log();
|
|
13366
|
+
console.log(chalk64.dim("To connect:"));
|
|
13367
|
+
console.log(chalk64.dim(` vm0 connector connect ${type}`));
|
|
13368
|
+
}
|
|
13369
|
+
} catch (error) {
|
|
13370
|
+
if (error instanceof Error) {
|
|
13371
|
+
if (error.message.includes("Not authenticated")) {
|
|
13372
|
+
console.error(chalk64.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13373
|
+
} else {
|
|
13374
|
+
console.error(chalk64.red(`\u2717 ${error.message}`));
|
|
13375
|
+
}
|
|
13376
|
+
} else {
|
|
13377
|
+
console.error(chalk64.red("\u2717 An unexpected error occurred"));
|
|
13378
|
+
}
|
|
13379
|
+
process.exit(1);
|
|
13380
|
+
}
|
|
13381
|
+
});
|
|
13382
|
+
|
|
13383
|
+
// src/commands/connector/disconnect.ts
|
|
13384
|
+
import { Command as Command69 } from "commander";
|
|
13385
|
+
import chalk65 from "chalk";
|
|
13386
|
+
var disconnectCommand = new Command69().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(async (type) => {
|
|
13387
|
+
try {
|
|
13388
|
+
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13389
|
+
if (!parseResult.success) {
|
|
13390
|
+
console.error(chalk65.red(`\u2717 Unknown connector type: ${type}`));
|
|
13391
|
+
console.log();
|
|
13392
|
+
console.log("Available connectors:");
|
|
13393
|
+
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13394
|
+
console.log(` ${chalk65.cyan(t)} - ${config.label}`);
|
|
13395
|
+
}
|
|
13396
|
+
process.exit(1);
|
|
13397
|
+
}
|
|
13398
|
+
await deleteConnector(parseResult.data);
|
|
13399
|
+
console.log(chalk65.green(`\u2713 Disconnected ${type}`));
|
|
13400
|
+
} catch (error) {
|
|
13401
|
+
if (error instanceof Error) {
|
|
13402
|
+
if (error.message.includes("not found")) {
|
|
13403
|
+
console.error(chalk65.red(`\u2717 Connector "${type}" is not connected`));
|
|
13404
|
+
} else if (error.message.includes("Not authenticated")) {
|
|
13405
|
+
console.error(chalk65.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13406
|
+
} else {
|
|
13407
|
+
console.error(chalk65.red(`\u2717 ${error.message}`));
|
|
13408
|
+
}
|
|
13409
|
+
} else {
|
|
13410
|
+
console.error(chalk65.red("\u2717 An unexpected error occurred"));
|
|
13411
|
+
}
|
|
13412
|
+
process.exit(1);
|
|
13413
|
+
}
|
|
13414
|
+
});
|
|
13415
|
+
|
|
13385
13416
|
// src/commands/connector/index.ts
|
|
13386
|
-
var connectorCommand = new
|
|
13417
|
+
var connectorCommand = new Command70().name("connector").description("Manage third-party service connections").addCommand(listCommand9).addCommand(statusCommand7).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
13387
13418
|
|
|
13388
13419
|
// src/commands/onboard/index.ts
|
|
13389
|
-
import { Command as
|
|
13390
|
-
import
|
|
13420
|
+
import { Command as Command71 } from "commander";
|
|
13421
|
+
import chalk69 from "chalk";
|
|
13391
13422
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13392
13423
|
import { existsSync as existsSync11 } from "fs";
|
|
13393
13424
|
|
|
13394
13425
|
// src/lib/ui/welcome-box.ts
|
|
13395
|
-
import
|
|
13426
|
+
import chalk66 from "chalk";
|
|
13396
13427
|
var gradientColors = [
|
|
13397
|
-
|
|
13428
|
+
chalk66.hex("#FFAB5E"),
|
|
13398
13429
|
// Line 1 - lightest
|
|
13399
|
-
|
|
13430
|
+
chalk66.hex("#FF9642"),
|
|
13400
13431
|
// Line 2
|
|
13401
|
-
|
|
13432
|
+
chalk66.hex("#FF8228"),
|
|
13402
13433
|
// Line 3
|
|
13403
|
-
|
|
13434
|
+
chalk66.hex("#FF6D0A"),
|
|
13404
13435
|
// Line 4
|
|
13405
|
-
|
|
13436
|
+
chalk66.hex("#E85D00"),
|
|
13406
13437
|
// Line 5
|
|
13407
|
-
|
|
13438
|
+
chalk66.hex("#CC4E00")
|
|
13408
13439
|
// Line 6 - darkest
|
|
13409
13440
|
];
|
|
13410
13441
|
var vm0LogoLines = [
|
|
@@ -13426,15 +13457,15 @@ function renderVm0Banner() {
|
|
|
13426
13457
|
function renderOnboardWelcome() {
|
|
13427
13458
|
renderVm0Banner();
|
|
13428
13459
|
console.log(` Build agentic workflows using natural language.`);
|
|
13429
|
-
console.log(` ${
|
|
13460
|
+
console.log(` ${chalk66.dim("Currently in beta, enjoy it free.")}`);
|
|
13430
13461
|
console.log(
|
|
13431
|
-
` ${
|
|
13462
|
+
` ${chalk66.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
13432
13463
|
);
|
|
13433
13464
|
console.log();
|
|
13434
13465
|
}
|
|
13435
13466
|
|
|
13436
13467
|
// src/lib/ui/step-runner.ts
|
|
13437
|
-
import
|
|
13468
|
+
import chalk67 from "chalk";
|
|
13438
13469
|
function createStepRunner(options = true) {
|
|
13439
13470
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
13440
13471
|
const interactive = opts.interactive ?? true;
|
|
@@ -13449,25 +13480,25 @@ function createStepRunner(options = true) {
|
|
|
13449
13480
|
}
|
|
13450
13481
|
for (const [i, step] of completedSteps.entries()) {
|
|
13451
13482
|
if (step.failed) {
|
|
13452
|
-
console.log(
|
|
13483
|
+
console.log(chalk67.red(`\u2717 ${step.label}`));
|
|
13453
13484
|
} else {
|
|
13454
|
-
console.log(
|
|
13485
|
+
console.log(chalk67.green(`\u25CF ${step.label}`));
|
|
13455
13486
|
}
|
|
13456
13487
|
const isLastStep = i === completedSteps.length - 1;
|
|
13457
13488
|
if (!isLastStep || !isFinal) {
|
|
13458
|
-
console.log(
|
|
13489
|
+
console.log(chalk67.dim("\u2502"));
|
|
13459
13490
|
}
|
|
13460
13491
|
}
|
|
13461
13492
|
}
|
|
13462
13493
|
async function executeStep(label, fn, isFinal) {
|
|
13463
13494
|
let stepFailed = false;
|
|
13464
|
-
console.log(
|
|
13495
|
+
console.log(chalk67.yellow(`\u25CB ${label}`));
|
|
13465
13496
|
const ctx = {
|
|
13466
13497
|
connector() {
|
|
13467
|
-
console.log(
|
|
13498
|
+
console.log(chalk67.dim("\u2502"));
|
|
13468
13499
|
},
|
|
13469
13500
|
detail(message) {
|
|
13470
|
-
console.log(`${
|
|
13501
|
+
console.log(`${chalk67.dim("\u2502")} ${message}`);
|
|
13471
13502
|
},
|
|
13472
13503
|
async prompt(promptFn) {
|
|
13473
13504
|
return await promptFn();
|
|
@@ -13484,12 +13515,12 @@ function createStepRunner(options = true) {
|
|
|
13484
13515
|
redrawCompletedSteps(isFinal);
|
|
13485
13516
|
} else {
|
|
13486
13517
|
if (stepFailed) {
|
|
13487
|
-
console.log(
|
|
13518
|
+
console.log(chalk67.red(`\u2717 ${label}`));
|
|
13488
13519
|
} else {
|
|
13489
|
-
console.log(
|
|
13520
|
+
console.log(chalk67.green(`\u25CF ${label}`));
|
|
13490
13521
|
}
|
|
13491
13522
|
if (!isFinal) {
|
|
13492
|
-
console.log(
|
|
13523
|
+
console.log(chalk67.dim("\u2502"));
|
|
13493
13524
|
}
|
|
13494
13525
|
}
|
|
13495
13526
|
}
|
|
@@ -13646,7 +13677,7 @@ async function setupModelProvider(type, secret, options) {
|
|
|
13646
13677
|
|
|
13647
13678
|
// src/lib/domain/onboard/claude-setup.ts
|
|
13648
13679
|
import { spawn as spawn3 } from "child_process";
|
|
13649
|
-
import
|
|
13680
|
+
import chalk68 from "chalk";
|
|
13650
13681
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
13651
13682
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
13652
13683
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -13683,12 +13714,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
13683
13714
|
}
|
|
13684
13715
|
function handlePluginError(error, context) {
|
|
13685
13716
|
const displayContext = context ?? "Claude plugin";
|
|
13686
|
-
console.error(
|
|
13717
|
+
console.error(chalk68.red(`Failed to install ${displayContext}`));
|
|
13687
13718
|
if (error instanceof Error) {
|
|
13688
|
-
console.error(
|
|
13719
|
+
console.error(chalk68.red(error.message));
|
|
13689
13720
|
}
|
|
13690
13721
|
console.error(
|
|
13691
|
-
|
|
13722
|
+
chalk68.dim("Please ensure Claude CLI is installed and accessible.")
|
|
13692
13723
|
);
|
|
13693
13724
|
process.exit(1);
|
|
13694
13725
|
}
|
|
@@ -13731,7 +13762,7 @@ async function updateMarketplace() {
|
|
|
13731
13762
|
]);
|
|
13732
13763
|
if (!result.success) {
|
|
13733
13764
|
console.warn(
|
|
13734
|
-
|
|
13765
|
+
chalk68.yellow(
|
|
13735
13766
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
13736
13767
|
)
|
|
13737
13768
|
);
|
|
@@ -13769,7 +13800,7 @@ async function handleAuthentication(ctx) {
|
|
|
13769
13800
|
return;
|
|
13770
13801
|
}
|
|
13771
13802
|
if (!ctx.interactive) {
|
|
13772
|
-
console.error(
|
|
13803
|
+
console.error(chalk69.red("Error: Not authenticated"));
|
|
13773
13804
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
13774
13805
|
process.exit(1);
|
|
13775
13806
|
}
|
|
@@ -13777,16 +13808,16 @@ async function handleAuthentication(ctx) {
|
|
|
13777
13808
|
onInitiating: () => {
|
|
13778
13809
|
},
|
|
13779
13810
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
13780
|
-
step.detail(`Copy code: ${
|
|
13781
|
-
step.detail(`Open: ${
|
|
13782
|
-
step.detail(
|
|
13811
|
+
step.detail(`Copy code: ${chalk69.cyan.bold(code)}`);
|
|
13812
|
+
step.detail(`Open: ${chalk69.cyan(url)}`);
|
|
13813
|
+
step.detail(chalk69.dim(`Expires in ${expiresIn} minutes`));
|
|
13783
13814
|
},
|
|
13784
13815
|
onPolling: () => {
|
|
13785
13816
|
},
|
|
13786
13817
|
onSuccess: () => {
|
|
13787
13818
|
},
|
|
13788
13819
|
onError: (error) => {
|
|
13789
|
-
console.error(
|
|
13820
|
+
console.error(chalk69.red(`
|
|
13790
13821
|
${error.message}`));
|
|
13791
13822
|
process.exit(1);
|
|
13792
13823
|
}
|
|
@@ -13800,7 +13831,7 @@ async function handleModelProvider(ctx) {
|
|
|
13800
13831
|
return;
|
|
13801
13832
|
}
|
|
13802
13833
|
if (!ctx.interactive) {
|
|
13803
|
-
console.error(
|
|
13834
|
+
console.error(chalk69.red("Error: No model provider configured"));
|
|
13804
13835
|
console.error("Run 'vm0 model-provider setup' first");
|
|
13805
13836
|
process.exit(1);
|
|
13806
13837
|
}
|
|
@@ -13821,14 +13852,14 @@ async function handleModelProvider(ctx) {
|
|
|
13821
13852
|
const selectedChoice = choices.find((c25) => c25.type === providerType);
|
|
13822
13853
|
if (selectedChoice?.helpText) {
|
|
13823
13854
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
13824
|
-
step.detail(
|
|
13855
|
+
step.detail(chalk69.dim(line));
|
|
13825
13856
|
}
|
|
13826
13857
|
}
|
|
13827
13858
|
const secret = await step.prompt(
|
|
13828
13859
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
13829
13860
|
);
|
|
13830
13861
|
if (!secret) {
|
|
13831
|
-
console.log(
|
|
13862
|
+
console.log(chalk69.dim("Cancelled"));
|
|
13832
13863
|
process.exit(0);
|
|
13833
13864
|
}
|
|
13834
13865
|
let selectedModel;
|
|
@@ -13847,7 +13878,7 @@ async function handleModelProvider(ctx) {
|
|
|
13847
13878
|
() => promptSelect("Select model:", modelChoices)
|
|
13848
13879
|
);
|
|
13849
13880
|
if (modelSelection === void 0) {
|
|
13850
|
-
console.log(
|
|
13881
|
+
console.log(chalk69.dim("Cancelled"));
|
|
13851
13882
|
process.exit(0);
|
|
13852
13883
|
}
|
|
13853
13884
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -13857,7 +13888,7 @@ async function handleModelProvider(ctx) {
|
|
|
13857
13888
|
});
|
|
13858
13889
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
13859
13890
|
step.detail(
|
|
13860
|
-
|
|
13891
|
+
chalk69.green(
|
|
13861
13892
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
13862
13893
|
)
|
|
13863
13894
|
);
|
|
@@ -13888,7 +13919,7 @@ async function handleAgentCreation(ctx) {
|
|
|
13888
13919
|
agentName = inputName;
|
|
13889
13920
|
if (existsSync11(agentName)) {
|
|
13890
13921
|
step.detail(
|
|
13891
|
-
|
|
13922
|
+
chalk69.yellow(`${agentName}/ already exists, choose another name`)
|
|
13892
13923
|
);
|
|
13893
13924
|
} else {
|
|
13894
13925
|
folderExists = false;
|
|
@@ -13897,22 +13928,22 @@ async function handleAgentCreation(ctx) {
|
|
|
13897
13928
|
} else {
|
|
13898
13929
|
if (!validateAgentName(agentName)) {
|
|
13899
13930
|
console.error(
|
|
13900
|
-
|
|
13931
|
+
chalk69.red(
|
|
13901
13932
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
13902
13933
|
)
|
|
13903
13934
|
);
|
|
13904
13935
|
process.exit(1);
|
|
13905
13936
|
}
|
|
13906
13937
|
if (existsSync11(agentName)) {
|
|
13907
|
-
console.error(
|
|
13938
|
+
console.error(chalk69.red(`${agentName}/ already exists`));
|
|
13908
13939
|
console.log();
|
|
13909
13940
|
console.log("Remove it first or choose a different name:");
|
|
13910
|
-
console.log(
|
|
13941
|
+
console.log(chalk69.cyan(` rm -rf ${agentName}`));
|
|
13911
13942
|
process.exit(1);
|
|
13912
13943
|
}
|
|
13913
13944
|
}
|
|
13914
13945
|
await mkdir8(agentName, { recursive: true });
|
|
13915
|
-
step.detail(
|
|
13946
|
+
step.detail(chalk69.green(`Created ${agentName}/`));
|
|
13916
13947
|
});
|
|
13917
13948
|
return agentName;
|
|
13918
13949
|
}
|
|
@@ -13928,7 +13959,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13928
13959
|
shouldInstall = confirmed ?? true;
|
|
13929
13960
|
}
|
|
13930
13961
|
if (!shouldInstall) {
|
|
13931
|
-
step.detail(
|
|
13962
|
+
step.detail(chalk69.dim("Skipped"));
|
|
13932
13963
|
return;
|
|
13933
13964
|
}
|
|
13934
13965
|
const scope = "project";
|
|
@@ -13936,7 +13967,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13936
13967
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
13937
13968
|
const result = await installVm0Plugin(scope, agentDir);
|
|
13938
13969
|
step.detail(
|
|
13939
|
-
|
|
13970
|
+
chalk69.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13940
13971
|
);
|
|
13941
13972
|
pluginInstalled = true;
|
|
13942
13973
|
} catch (error) {
|
|
@@ -13947,18 +13978,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13947
13978
|
}
|
|
13948
13979
|
function printNextSteps(agentName, pluginInstalled) {
|
|
13949
13980
|
console.log();
|
|
13950
|
-
console.log(
|
|
13981
|
+
console.log(chalk69.bold("Next step:"));
|
|
13951
13982
|
console.log();
|
|
13952
13983
|
if (pluginInstalled) {
|
|
13953
13984
|
console.log(
|
|
13954
|
-
` ${
|
|
13985
|
+
` ${chalk69.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
13955
13986
|
);
|
|
13956
13987
|
} else {
|
|
13957
|
-
console.log(` ${
|
|
13988
|
+
console.log(` ${chalk69.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
13958
13989
|
}
|
|
13959
13990
|
console.log();
|
|
13960
13991
|
}
|
|
13961
|
-
var onboardCommand = new
|
|
13992
|
+
var onboardCommand = new Command71().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(async (options) => {
|
|
13962
13993
|
const interactive = isInteractive();
|
|
13963
13994
|
if (interactive) {
|
|
13964
13995
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -13981,15 +14012,15 @@ var onboardCommand = new Command68().name("onboard").description("Guided setup f
|
|
|
13981
14012
|
});
|
|
13982
14013
|
|
|
13983
14014
|
// src/commands/setup-claude/index.ts
|
|
13984
|
-
import { Command as
|
|
13985
|
-
import
|
|
13986
|
-
var setupClaudeCommand = new
|
|
13987
|
-
console.log(
|
|
14015
|
+
import { Command as Command72 } from "commander";
|
|
14016
|
+
import chalk70 from "chalk";
|
|
14017
|
+
var setupClaudeCommand = new Command72().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(async (options) => {
|
|
14018
|
+
console.log(chalk70.dim("Installing VM0 Claude Plugin..."));
|
|
13988
14019
|
const scope = options.scope === "user" ? "user" : "project";
|
|
13989
14020
|
try {
|
|
13990
14021
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
13991
14022
|
console.log(
|
|
13992
|
-
|
|
14023
|
+
chalk70.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13993
14024
|
);
|
|
13994
14025
|
} catch (error) {
|
|
13995
14026
|
handlePluginError(error);
|
|
@@ -13998,19 +14029,19 @@ var setupClaudeCommand = new Command69().name("setup-claude").description("Insta
|
|
|
13998
14029
|
console.log("Next step:");
|
|
13999
14030
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
14000
14031
|
console.log(
|
|
14001
|
-
|
|
14032
|
+
chalk70.cyan(
|
|
14002
14033
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
14003
14034
|
)
|
|
14004
14035
|
);
|
|
14005
14036
|
});
|
|
14006
14037
|
|
|
14007
14038
|
// src/commands/dev-tool/index.ts
|
|
14008
|
-
import { Command as
|
|
14039
|
+
import { Command as Command74 } from "commander";
|
|
14009
14040
|
|
|
14010
14041
|
// src/commands/dev-tool/compose.ts
|
|
14011
|
-
import { Command as
|
|
14012
|
-
import
|
|
14013
|
-
import { initClient as
|
|
14042
|
+
import { Command as Command73 } from "commander";
|
|
14043
|
+
import chalk71 from "chalk";
|
|
14044
|
+
import { initClient as initClient13 } from "@ts-rest/core";
|
|
14014
14045
|
function sleep2(ms) {
|
|
14015
14046
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14016
14047
|
}
|
|
@@ -14019,7 +14050,7 @@ function timestamp() {
|
|
|
14019
14050
|
}
|
|
14020
14051
|
async function createComposeJob(githubUrl, overwrite) {
|
|
14021
14052
|
const config = await getClientConfig();
|
|
14022
|
-
const client =
|
|
14053
|
+
const client = initClient13(composeJobsMainContract, config);
|
|
14023
14054
|
const result = await client.create({
|
|
14024
14055
|
body: { githubUrl, overwrite }
|
|
14025
14056
|
});
|
|
@@ -14036,7 +14067,7 @@ async function createComposeJob(githubUrl, overwrite) {
|
|
|
14036
14067
|
}
|
|
14037
14068
|
async function getComposeJobStatus(jobId) {
|
|
14038
14069
|
const config = await getClientConfig();
|
|
14039
|
-
const client =
|
|
14070
|
+
const client = initClient13(composeJobsByIdContract, config);
|
|
14040
14071
|
const result = await client.getById({
|
|
14041
14072
|
params: { jobId }
|
|
14042
14073
|
});
|
|
@@ -14061,7 +14092,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14061
14092
|
const job = await getComposeJobStatus(jobId);
|
|
14062
14093
|
if (!jsonMode) {
|
|
14063
14094
|
console.log(
|
|
14064
|
-
|
|
14095
|
+
chalk71.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
14065
14096
|
);
|
|
14066
14097
|
}
|
|
14067
14098
|
if (job.status === "completed" || job.status === "failed") {
|
|
@@ -14071,7 +14102,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14071
14102
|
}
|
|
14072
14103
|
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
14073
14104
|
}
|
|
14074
|
-
var composeCommand2 = new
|
|
14105
|
+
var composeCommand2 = new Command73().name("compose").description("Test server-side GitHub compose API").argument("<github-url>", "GitHub URL to compose from").option("--overwrite", "Overwrite existing compose", false).option(
|
|
14075
14106
|
"--interval <seconds>",
|
|
14076
14107
|
"Polling interval in seconds",
|
|
14077
14108
|
(v) => parseInt(v, 10),
|
|
@@ -14094,7 +14125,7 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
14094
14125
|
options.overwrite
|
|
14095
14126
|
);
|
|
14096
14127
|
if (!options.json) {
|
|
14097
|
-
console.log(`Job ID: ${
|
|
14128
|
+
console.log(`Job ID: ${chalk71.cyan(jobId)}`);
|
|
14098
14129
|
console.log();
|
|
14099
14130
|
}
|
|
14100
14131
|
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
@@ -14128,7 +14159,7 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
14128
14159
|
);
|
|
14129
14160
|
} else {
|
|
14130
14161
|
console.error(
|
|
14131
|
-
|
|
14162
|
+
chalk71.red(
|
|
14132
14163
|
`\u2717 ${error instanceof Error ? error.message : String(error)}`
|
|
14133
14164
|
)
|
|
14134
14165
|
);
|
|
@@ -14139,21 +14170,21 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
14139
14170
|
);
|
|
14140
14171
|
function displayResult(job) {
|
|
14141
14172
|
if (job.status === "completed" && job.result) {
|
|
14142
|
-
console.log(
|
|
14143
|
-
console.log(` Compose ID: ${
|
|
14144
|
-
console.log(` Name: ${
|
|
14145
|
-
console.log(` Version: ${
|
|
14173
|
+
console.log(chalk71.green("\u2713 Compose completed!"));
|
|
14174
|
+
console.log(` Compose ID: ${chalk71.cyan(job.result.composeId)}`);
|
|
14175
|
+
console.log(` Name: ${chalk71.cyan(job.result.composeName)}`);
|
|
14176
|
+
console.log(` Version: ${chalk71.cyan(job.result.versionId.slice(0, 8))}`);
|
|
14146
14177
|
if (job.result.warnings.length > 0) {
|
|
14147
14178
|
console.log();
|
|
14148
|
-
console.log(
|
|
14179
|
+
console.log(chalk71.yellow(" Warnings:"));
|
|
14149
14180
|
for (const warning of job.result.warnings) {
|
|
14150
|
-
console.log(
|
|
14181
|
+
console.log(chalk71.yellow(` - ${warning}`));
|
|
14151
14182
|
}
|
|
14152
14183
|
}
|
|
14153
14184
|
} else if (job.status === "failed") {
|
|
14154
|
-
console.log(
|
|
14185
|
+
console.log(chalk71.red("\u2717 Compose failed!"));
|
|
14155
14186
|
if (job.error) {
|
|
14156
|
-
console.log(` Error: ${
|
|
14187
|
+
console.log(` Error: ${chalk71.red(job.error)}`);
|
|
14157
14188
|
}
|
|
14158
14189
|
} else {
|
|
14159
14190
|
console.log(`Status: ${job.status}`);
|
|
@@ -14161,11 +14192,11 @@ function displayResult(job) {
|
|
|
14161
14192
|
}
|
|
14162
14193
|
|
|
14163
14194
|
// src/commands/dev-tool/index.ts
|
|
14164
|
-
var devToolCommand = new
|
|
14195
|
+
var devToolCommand = new Command74().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
14165
14196
|
|
|
14166
14197
|
// src/index.ts
|
|
14167
|
-
var program = new
|
|
14168
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
14198
|
+
var program = new Command75();
|
|
14199
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.25.0");
|
|
14169
14200
|
program.addCommand(authCommand);
|
|
14170
14201
|
program.addCommand(infoCommand);
|
|
14171
14202
|
program.addCommand(composeCommand);
|