@vm0/cli 9.32.0 → 9.34.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 +739 -556
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ if (DSN) {
|
|
|
45
45
|
Sentry.init({
|
|
46
46
|
dsn: DSN,
|
|
47
47
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
48
|
-
release: "9.
|
|
48
|
+
release: "9.34.0",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.34.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -75,7 +75,7 @@ if (DSN) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// src/index.ts
|
|
78
|
-
import { Command as
|
|
78
|
+
import { Command as Command77 } from "commander";
|
|
79
79
|
|
|
80
80
|
// src/commands/auth/index.ts
|
|
81
81
|
import { Command as Command5 } from "commander";
|
|
@@ -605,7 +605,7 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
|
|
|
605
605
|
// src/commands/info/index.ts
|
|
606
606
|
var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
|
|
607
607
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
608
|
-
console.log(chalk7.bold(`VM0 CLI v${"9.
|
|
608
|
+
console.log(chalk7.bold(`VM0 CLI v${"9.34.0"}`));
|
|
609
609
|
console.log();
|
|
610
610
|
const config = await loadConfig();
|
|
611
611
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -740,7 +740,7 @@ var runnerGroupSchema = z3.string().regex(
|
|
|
740
740
|
var jobSchema = z3.object({
|
|
741
741
|
runId: z3.string().uuid(),
|
|
742
742
|
prompt: z3.string(),
|
|
743
|
-
agentComposeVersionId: z3.string(),
|
|
743
|
+
agentComposeVersionId: z3.string().nullable(),
|
|
744
744
|
vars: z3.record(z3.string(), z3.string()).nullable(),
|
|
745
745
|
secretNames: z3.array(z3.string()).nullable(),
|
|
746
746
|
checkpointId: z3.string().uuid().nullable()
|
|
@@ -799,7 +799,7 @@ var storedExecutionContextSchema = z3.object({
|
|
|
799
799
|
var executionContextSchema = z3.object({
|
|
800
800
|
runId: z3.string().uuid(),
|
|
801
801
|
prompt: z3.string(),
|
|
802
|
-
agentComposeVersionId: z3.string(),
|
|
802
|
+
agentComposeVersionId: z3.string().nullable(),
|
|
803
803
|
vars: z3.record(z3.string(), z3.string()).nullable(),
|
|
804
804
|
secretNames: z3.array(z3.string()).nullable(),
|
|
805
805
|
checkpointId: z3.string().uuid().nullable(),
|
|
@@ -1013,6 +1013,27 @@ var composesByIdContract = c2.router({
|
|
|
1013
1013
|
404: apiErrorSchema
|
|
1014
1014
|
},
|
|
1015
1015
|
summary: "Get agent compose by ID"
|
|
1016
|
+
},
|
|
1017
|
+
/**
|
|
1018
|
+
* DELETE /api/agent/composes/:id
|
|
1019
|
+
* Delete agent compose and all associated resources (versions, schedules, permissions, etc.)
|
|
1020
|
+
* Returns 409 Conflict if agent has running or pending runs
|
|
1021
|
+
*/
|
|
1022
|
+
delete: {
|
|
1023
|
+
method: "DELETE",
|
|
1024
|
+
path: "/api/agent/composes/:id",
|
|
1025
|
+
headers: authHeadersSchema,
|
|
1026
|
+
pathParams: z4.object({
|
|
1027
|
+
id: z4.string().uuid("Compose ID is required")
|
|
1028
|
+
}),
|
|
1029
|
+
body: c2.noBody(),
|
|
1030
|
+
responses: {
|
|
1031
|
+
204: c2.noBody(),
|
|
1032
|
+
401: apiErrorSchema,
|
|
1033
|
+
404: apiErrorSchema,
|
|
1034
|
+
409: apiErrorSchema
|
|
1035
|
+
},
|
|
1036
|
+
summary: "Delete agent compose"
|
|
1016
1037
|
}
|
|
1017
1038
|
});
|
|
1018
1039
|
var composesVersionsContract = c2.router({
|
|
@@ -1113,7 +1134,7 @@ var createRunResponseSchema = z5.object({
|
|
|
1113
1134
|
});
|
|
1114
1135
|
var getRunResponseSchema = z5.object({
|
|
1115
1136
|
runId: z5.string(),
|
|
1116
|
-
agentComposeVersionId: z5.string(),
|
|
1137
|
+
agentComposeVersionId: z5.string().nullable(),
|
|
1117
1138
|
status: runStatusSchema,
|
|
1118
1139
|
prompt: z5.string(),
|
|
1119
1140
|
vars: z5.record(z5.string(), z5.string()).optional(),
|
|
@@ -4520,6 +4541,17 @@ async function createOrUpdateCompose(body) {
|
|
|
4520
4541
|
}
|
|
4521
4542
|
handleError(result, "Failed to create compose");
|
|
4522
4543
|
}
|
|
4544
|
+
async function deleteCompose(id) {
|
|
4545
|
+
const config = await getClientConfig();
|
|
4546
|
+
const client = initClient(composesByIdContract, config);
|
|
4547
|
+
const result = await client.delete({
|
|
4548
|
+
params: { id }
|
|
4549
|
+
});
|
|
4550
|
+
if (result.status === 204) {
|
|
4551
|
+
return;
|
|
4552
|
+
}
|
|
4553
|
+
handleError(result, "Failed to delete agent");
|
|
4554
|
+
}
|
|
4523
4555
|
|
|
4524
4556
|
// src/lib/api/domains/runs.ts
|
|
4525
4557
|
import { initClient as initClient2 } from "@ts-rest/core";
|
|
@@ -6233,7 +6265,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
6233
6265
|
options.autoUpdate = false;
|
|
6234
6266
|
}
|
|
6235
6267
|
if (options.autoUpdate !== false) {
|
|
6236
|
-
await startSilentUpgrade("9.
|
|
6268
|
+
await startSilentUpgrade("9.34.0");
|
|
6237
6269
|
}
|
|
6238
6270
|
try {
|
|
6239
6271
|
let result;
|
|
@@ -8430,7 +8462,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8430
8462
|
async (identifier, prompt, options) => {
|
|
8431
8463
|
try {
|
|
8432
8464
|
if (options.autoUpdate !== false) {
|
|
8433
|
-
await startSilentUpgrade("9.
|
|
8465
|
+
await startSilentUpgrade("9.34.0");
|
|
8434
8466
|
}
|
|
8435
8467
|
const { scope, name, version } = parseIdentifier(identifier);
|
|
8436
8468
|
if (scope && !options.experimentalSharedAgent) {
|
|
@@ -10006,7 +10038,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
10006
10038
|
).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(
|
|
10007
10039
|
async (prompt, options) => {
|
|
10008
10040
|
if (options.autoUpdate !== false) {
|
|
10009
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
10041
|
+
const shouldExit = await checkAndUpgrade("9.34.0", prompt);
|
|
10010
10042
|
if (shouldExit) {
|
|
10011
10043
|
process.exit(0);
|
|
10012
10044
|
}
|
|
@@ -10232,6 +10264,32 @@ var cookCommand = cookAction;
|
|
|
10232
10264
|
// src/commands/logs/index.ts
|
|
10233
10265
|
import { Command as Command31 } from "commander";
|
|
10234
10266
|
import chalk37 from "chalk";
|
|
10267
|
+
|
|
10268
|
+
// src/lib/utils/paginate.ts
|
|
10269
|
+
async function paginate(options) {
|
|
10270
|
+
const { fetchPage, getTimestamp, targetCount, initialSince } = options;
|
|
10271
|
+
const collected = [];
|
|
10272
|
+
let since = initialSince;
|
|
10273
|
+
let hasMore = true;
|
|
10274
|
+
while (hasMore) {
|
|
10275
|
+
const response = await fetchPage(since);
|
|
10276
|
+
collected.push(...response.items);
|
|
10277
|
+
hasMore = response.hasMore;
|
|
10278
|
+
if (targetCount !== "all" && collected.length >= targetCount) {
|
|
10279
|
+
return collected.slice(0, targetCount);
|
|
10280
|
+
}
|
|
10281
|
+
if (response.items.length > 0) {
|
|
10282
|
+
const lastItem = response.items[response.items.length - 1];
|
|
10283
|
+
since = getTimestamp(lastItem);
|
|
10284
|
+
} else {
|
|
10285
|
+
hasMore = false;
|
|
10286
|
+
}
|
|
10287
|
+
}
|
|
10288
|
+
return collected;
|
|
10289
|
+
}
|
|
10290
|
+
|
|
10291
|
+
// src/commands/logs/index.ts
|
|
10292
|
+
var PAGE_LIMIT = 100;
|
|
10235
10293
|
function buildPlatformLogsUrl(apiUrl, runId) {
|
|
10236
10294
|
const url = new URL(apiUrl);
|
|
10237
10295
|
const hostname = url.hostname;
|
|
@@ -10327,13 +10385,20 @@ function getLogType(options) {
|
|
|
10327
10385
|
var logsCommand2 = new Command31().name("logs").description("View logs for an agent run").argument("<runId>", "Run ID to fetch logs for").option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
|
|
10328
10386
|
"--since <time>",
|
|
10329
10387
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z, 1705312200)"
|
|
10330
|
-
).option("--tail <n>", "Show last N entries (default: 5
|
|
10388
|
+
).option("--tail <n>", "Show last N entries (default: 5)").option("--head <n>", "Show first N entries").option("--all", "Fetch all log entries").action(
|
|
10331
10389
|
async (runId, options) => {
|
|
10332
10390
|
try {
|
|
10333
10391
|
const logType = getLogType(options);
|
|
10334
|
-
|
|
10392
|
+
const countModes = [
|
|
10393
|
+
options.tail !== void 0,
|
|
10394
|
+
options.head !== void 0,
|
|
10395
|
+
options.all === true
|
|
10396
|
+
].filter(Boolean).length;
|
|
10397
|
+
if (countModes > 1) {
|
|
10335
10398
|
console.error(
|
|
10336
|
-
chalk37.red(
|
|
10399
|
+
chalk37.red(
|
|
10400
|
+
"Options --tail, --head, and --all are mutually exclusive"
|
|
10401
|
+
)
|
|
10337
10402
|
);
|
|
10338
10403
|
process.exit(1);
|
|
10339
10404
|
}
|
|
@@ -10341,26 +10406,38 @@ var logsCommand2 = new Command31().name("logs").description("View logs for an ag
|
|
|
10341
10406
|
if (options.since) {
|
|
10342
10407
|
since = parseTime(options.since);
|
|
10343
10408
|
}
|
|
10409
|
+
const isAll = options.all === true;
|
|
10344
10410
|
const isHead = options.head !== void 0;
|
|
10345
|
-
const
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10411
|
+
const isTail = options.tail !== void 0;
|
|
10412
|
+
let targetCount;
|
|
10413
|
+
if (isAll) {
|
|
10414
|
+
targetCount = "all";
|
|
10415
|
+
} else if (isHead) {
|
|
10416
|
+
targetCount = Math.max(1, parseInt(options.head, 10));
|
|
10417
|
+
} else if (isTail) {
|
|
10418
|
+
targetCount = Math.max(1, parseInt(options.tail, 10));
|
|
10419
|
+
} else {
|
|
10420
|
+
targetCount = 5;
|
|
10421
|
+
}
|
|
10349
10422
|
const order = isHead ? "asc" : "desc";
|
|
10350
10423
|
const apiUrl = await getApiUrl();
|
|
10351
10424
|
const platformUrl = buildPlatformLogsUrl(apiUrl, runId);
|
|
10352
10425
|
switch (logType) {
|
|
10353
10426
|
case "agent":
|
|
10354
|
-
await showAgentEvents(
|
|
10427
|
+
await showAgentEvents(
|
|
10428
|
+
runId,
|
|
10429
|
+
{ since, targetCount, order },
|
|
10430
|
+
platformUrl
|
|
10431
|
+
);
|
|
10355
10432
|
break;
|
|
10356
10433
|
case "system":
|
|
10357
|
-
await showSystemLog(runId, { since,
|
|
10434
|
+
await showSystemLog(runId, { since, targetCount, order });
|
|
10358
10435
|
break;
|
|
10359
10436
|
case "metrics":
|
|
10360
|
-
await showMetrics(runId, { since,
|
|
10437
|
+
await showMetrics(runId, { since, targetCount, order });
|
|
10361
10438
|
break;
|
|
10362
10439
|
case "network":
|
|
10363
|
-
await showNetworkLogs(runId, { since,
|
|
10440
|
+
await showNetworkLogs(runId, { since, targetCount, order });
|
|
10364
10441
|
break;
|
|
10365
10442
|
}
|
|
10366
10443
|
} catch (error) {
|
|
@@ -10370,62 +10447,106 @@ var logsCommand2 = new Command31().name("logs").description("View logs for an ag
|
|
|
10370
10447
|
}
|
|
10371
10448
|
);
|
|
10372
10449
|
async function showAgentEvents(runId, options, platformUrl) {
|
|
10373
|
-
const
|
|
10374
|
-
|
|
10450
|
+
const firstResponse = await apiClient.getAgentEvents(runId, {
|
|
10451
|
+
since: options.since,
|
|
10452
|
+
limit: PAGE_LIMIT,
|
|
10453
|
+
order: options.order
|
|
10454
|
+
});
|
|
10455
|
+
if (firstResponse.events.length === 0) {
|
|
10375
10456
|
console.log(chalk37.yellow("No agent events found for this run"));
|
|
10376
10457
|
return;
|
|
10377
10458
|
}
|
|
10378
|
-
const
|
|
10459
|
+
const framework = firstResponse.framework;
|
|
10460
|
+
let allEvents;
|
|
10461
|
+
if (!firstResponse.hasMore || options.targetCount !== "all" && firstResponse.events.length >= options.targetCount) {
|
|
10462
|
+
allEvents = options.targetCount === "all" ? firstResponse.events : firstResponse.events.slice(0, options.targetCount);
|
|
10463
|
+
} else {
|
|
10464
|
+
const lastEvent = firstResponse.events[firstResponse.events.length - 1];
|
|
10465
|
+
const firstPageTimestamp = lastEvent ? new Date(lastEvent.createdAt).getTime() : void 0;
|
|
10466
|
+
const remainingEvents = await paginate({
|
|
10467
|
+
fetchPage: async (since) => {
|
|
10468
|
+
const response = await apiClient.getAgentEvents(runId, {
|
|
10469
|
+
since,
|
|
10470
|
+
limit: PAGE_LIMIT,
|
|
10471
|
+
order: options.order
|
|
10472
|
+
});
|
|
10473
|
+
return { items: response.events, hasMore: response.hasMore };
|
|
10474
|
+
},
|
|
10475
|
+
getTimestamp: (event) => new Date(event.createdAt).getTime(),
|
|
10476
|
+
targetCount: options.targetCount === "all" ? "all" : options.targetCount - firstResponse.events.length,
|
|
10477
|
+
initialSince: firstPageTimestamp
|
|
10478
|
+
});
|
|
10479
|
+
allEvents = [...firstResponse.events, ...remainingEvents];
|
|
10480
|
+
if (options.targetCount !== "all" && allEvents.length > options.targetCount) {
|
|
10481
|
+
allEvents = allEvents.slice(0, options.targetCount);
|
|
10482
|
+
}
|
|
10483
|
+
}
|
|
10484
|
+
const events = options.order === "desc" ? [...allEvents].reverse() : allEvents;
|
|
10379
10485
|
const renderer = createLogRenderer(true);
|
|
10380
10486
|
for (const event of events) {
|
|
10381
|
-
renderAgentEvent(event,
|
|
10382
|
-
}
|
|
10383
|
-
if (response.hasMore) {
|
|
10384
|
-
console.log();
|
|
10385
|
-
console.log(
|
|
10386
|
-
chalk37.dim(
|
|
10387
|
-
`Showing ${response.events.length} events. Use --tail to see more.`
|
|
10388
|
-
)
|
|
10389
|
-
);
|
|
10487
|
+
renderAgentEvent(event, framework, renderer);
|
|
10390
10488
|
}
|
|
10391
10489
|
console.log(chalk37.dim(`View on platform: ${platformUrl}`));
|
|
10392
10490
|
}
|
|
10393
10491
|
async function showSystemLog(runId, options) {
|
|
10394
|
-
const
|
|
10492
|
+
const limit = options.targetCount === "all" ? PAGE_LIMIT : Math.min(options.targetCount, PAGE_LIMIT);
|
|
10493
|
+
const response = await apiClient.getSystemLog(runId, {
|
|
10494
|
+
since: options.since,
|
|
10495
|
+
limit,
|
|
10496
|
+
order: options.order
|
|
10497
|
+
});
|
|
10395
10498
|
if (!response.systemLog) {
|
|
10396
10499
|
console.log(chalk37.yellow("No system log found for this run"));
|
|
10397
10500
|
return;
|
|
10398
10501
|
}
|
|
10399
10502
|
console.log(response.systemLog);
|
|
10400
|
-
if (response.hasMore) {
|
|
10401
|
-
console.log();
|
|
10402
|
-
console.log(
|
|
10403
|
-
chalk37.dim("More log entries available. Use --tail to see more.")
|
|
10404
|
-
);
|
|
10405
|
-
}
|
|
10406
10503
|
}
|
|
10407
10504
|
async function showMetrics(runId, options) {
|
|
10408
|
-
const
|
|
10409
|
-
|
|
10505
|
+
const firstResponse = await apiClient.getMetrics(runId, {
|
|
10506
|
+
since: options.since,
|
|
10507
|
+
limit: PAGE_LIMIT,
|
|
10508
|
+
order: options.order
|
|
10509
|
+
});
|
|
10510
|
+
if (firstResponse.metrics.length === 0) {
|
|
10410
10511
|
console.log(chalk37.yellow("No metrics found for this run"));
|
|
10411
10512
|
return;
|
|
10412
10513
|
}
|
|
10413
|
-
|
|
10514
|
+
let allMetrics;
|
|
10515
|
+
if (!firstResponse.hasMore || options.targetCount !== "all" && firstResponse.metrics.length >= options.targetCount) {
|
|
10516
|
+
allMetrics = options.targetCount === "all" ? firstResponse.metrics : firstResponse.metrics.slice(0, options.targetCount);
|
|
10517
|
+
} else {
|
|
10518
|
+
const lastMetric = firstResponse.metrics[firstResponse.metrics.length - 1];
|
|
10519
|
+
const firstPageTimestamp = lastMetric ? new Date(lastMetric.ts).getTime() : void 0;
|
|
10520
|
+
const remainingMetrics = await paginate({
|
|
10521
|
+
fetchPage: async (since) => {
|
|
10522
|
+
const response = await apiClient.getMetrics(runId, {
|
|
10523
|
+
since,
|
|
10524
|
+
limit: PAGE_LIMIT,
|
|
10525
|
+
order: options.order
|
|
10526
|
+
});
|
|
10527
|
+
return { items: response.metrics, hasMore: response.hasMore };
|
|
10528
|
+
},
|
|
10529
|
+
getTimestamp: (metric) => new Date(metric.ts).getTime(),
|
|
10530
|
+
targetCount: options.targetCount === "all" ? "all" : options.targetCount - firstResponse.metrics.length,
|
|
10531
|
+
initialSince: firstPageTimestamp
|
|
10532
|
+
});
|
|
10533
|
+
allMetrics = [...firstResponse.metrics, ...remainingMetrics];
|
|
10534
|
+
if (options.targetCount !== "all" && allMetrics.length > options.targetCount) {
|
|
10535
|
+
allMetrics = allMetrics.slice(0, options.targetCount);
|
|
10536
|
+
}
|
|
10537
|
+
}
|
|
10538
|
+
const metrics = options.order === "desc" ? [...allMetrics].reverse() : allMetrics;
|
|
10414
10539
|
for (const metric of metrics) {
|
|
10415
10540
|
console.log(formatMetric(metric));
|
|
10416
10541
|
}
|
|
10417
|
-
if (response.hasMore) {
|
|
10418
|
-
console.log();
|
|
10419
|
-
console.log(
|
|
10420
|
-
chalk37.dim(
|
|
10421
|
-
`Showing ${response.metrics.length} metrics. Use --tail to see more.`
|
|
10422
|
-
)
|
|
10423
|
-
);
|
|
10424
|
-
}
|
|
10425
10542
|
}
|
|
10426
10543
|
async function showNetworkLogs(runId, options) {
|
|
10427
|
-
const
|
|
10428
|
-
|
|
10544
|
+
const firstResponse = await apiClient.getNetworkLogs(runId, {
|
|
10545
|
+
since: options.since,
|
|
10546
|
+
limit: PAGE_LIMIT,
|
|
10547
|
+
order: options.order
|
|
10548
|
+
});
|
|
10549
|
+
if (firstResponse.networkLogs.length === 0) {
|
|
10429
10550
|
console.log(
|
|
10430
10551
|
chalk37.yellow(
|
|
10431
10552
|
"No network logs found for this run. Network logs are only captured when experimental_firewall is enabled on an experimental_runner"
|
|
@@ -10433,18 +10554,34 @@ async function showNetworkLogs(runId, options) {
|
|
|
10433
10554
|
);
|
|
10434
10555
|
return;
|
|
10435
10556
|
}
|
|
10436
|
-
|
|
10557
|
+
let allNetworkLogs;
|
|
10558
|
+
if (!firstResponse.hasMore || options.targetCount !== "all" && firstResponse.networkLogs.length >= options.targetCount) {
|
|
10559
|
+
allNetworkLogs = options.targetCount === "all" ? firstResponse.networkLogs : firstResponse.networkLogs.slice(0, options.targetCount);
|
|
10560
|
+
} else {
|
|
10561
|
+
const lastLog = firstResponse.networkLogs[firstResponse.networkLogs.length - 1];
|
|
10562
|
+
const firstPageTimestamp = lastLog ? new Date(lastLog.timestamp).getTime() : void 0;
|
|
10563
|
+
const remainingLogs = await paginate({
|
|
10564
|
+
fetchPage: async (since) => {
|
|
10565
|
+
const response = await apiClient.getNetworkLogs(runId, {
|
|
10566
|
+
since,
|
|
10567
|
+
limit: PAGE_LIMIT,
|
|
10568
|
+
order: options.order
|
|
10569
|
+
});
|
|
10570
|
+
return { items: response.networkLogs, hasMore: response.hasMore };
|
|
10571
|
+
},
|
|
10572
|
+
getTimestamp: (entry) => new Date(entry.timestamp).getTime(),
|
|
10573
|
+
targetCount: options.targetCount === "all" ? "all" : options.targetCount - firstResponse.networkLogs.length,
|
|
10574
|
+
initialSince: firstPageTimestamp
|
|
10575
|
+
});
|
|
10576
|
+
allNetworkLogs = [...firstResponse.networkLogs, ...remainingLogs];
|
|
10577
|
+
if (options.targetCount !== "all" && allNetworkLogs.length > options.targetCount) {
|
|
10578
|
+
allNetworkLogs = allNetworkLogs.slice(0, options.targetCount);
|
|
10579
|
+
}
|
|
10580
|
+
}
|
|
10581
|
+
const networkLogs = options.order === "desc" ? [...allNetworkLogs].reverse() : allNetworkLogs;
|
|
10437
10582
|
for (const entry of networkLogs) {
|
|
10438
10583
|
console.log(formatNetworkLog(entry));
|
|
10439
10584
|
}
|
|
10440
|
-
if (response.hasMore) {
|
|
10441
|
-
console.log();
|
|
10442
|
-
console.log(
|
|
10443
|
-
chalk37.dim(
|
|
10444
|
-
`Showing ${response.networkLogs.length} network logs. Use --tail to see more.`
|
|
10445
|
-
)
|
|
10446
|
-
);
|
|
10447
|
-
}
|
|
10448
10585
|
}
|
|
10449
10586
|
function handleError2(error, runId) {
|
|
10450
10587
|
if (error instanceof Error) {
|
|
@@ -10572,7 +10709,7 @@ var setCommand = new Command33().name("set").description("Set your scope slug").
|
|
|
10572
10709
|
var scopeCommand = new Command34().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand4).addCommand(setCommand);
|
|
10573
10710
|
|
|
10574
10711
|
// src/commands/agent/index.ts
|
|
10575
|
-
import { Command as
|
|
10712
|
+
import { Command as Command44 } from "commander";
|
|
10576
10713
|
|
|
10577
10714
|
// src/commands/agent/clone.ts
|
|
10578
10715
|
import { Command as Command35 } from "commander";
|
|
@@ -10694,10 +10831,56 @@ var cloneCommand3 = new Command35().name("clone").description("Clone agent compo
|
|
|
10694
10831
|
}
|
|
10695
10832
|
});
|
|
10696
10833
|
|
|
10697
|
-
// src/commands/agent/
|
|
10834
|
+
// src/commands/agent/delete.ts
|
|
10698
10835
|
import { Command as Command36 } from "commander";
|
|
10699
10836
|
import chalk41 from "chalk";
|
|
10700
|
-
var
|
|
10837
|
+
var deleteCommand = new Command36().name("delete").alias("rm").description("Delete an agent").argument("<name>", "Agent name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
10838
|
+
try {
|
|
10839
|
+
const compose = await getComposeByName(name);
|
|
10840
|
+
if (!compose) {
|
|
10841
|
+
console.error(chalk41.red(`\u2717 Agent '${name}' not found`));
|
|
10842
|
+
console.error(chalk41.dim(" Run: vm0 agent list"));
|
|
10843
|
+
process.exit(1);
|
|
10844
|
+
}
|
|
10845
|
+
if (!options.yes) {
|
|
10846
|
+
if (!isInteractive()) {
|
|
10847
|
+
console.error(
|
|
10848
|
+
chalk41.red("\u2717 --yes flag is required in non-interactive mode")
|
|
10849
|
+
);
|
|
10850
|
+
process.exit(1);
|
|
10851
|
+
}
|
|
10852
|
+
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
10853
|
+
if (!confirmed) {
|
|
10854
|
+
console.log(chalk41.dim("Cancelled"));
|
|
10855
|
+
return;
|
|
10856
|
+
}
|
|
10857
|
+
}
|
|
10858
|
+
await deleteCompose(compose.id);
|
|
10859
|
+
console.log(chalk41.green(`\u2713 Agent '${name}' deleted`));
|
|
10860
|
+
} catch (error) {
|
|
10861
|
+
if (error instanceof Error) {
|
|
10862
|
+
if (error.message.includes("Not authenticated")) {
|
|
10863
|
+
console.error(chalk41.red("\u2717 Not authenticated"));
|
|
10864
|
+
console.error(chalk41.dim(" Run: vm0 auth login"));
|
|
10865
|
+
} else if (error.message.includes("currently running")) {
|
|
10866
|
+
console.error(
|
|
10867
|
+
chalk41.red("\u2717 Cannot delete agent: agent is currently running")
|
|
10868
|
+
);
|
|
10869
|
+
console.error(chalk41.dim(" Run: vm0 run list"));
|
|
10870
|
+
} else {
|
|
10871
|
+
console.error(chalk41.red(`\u2717 ${error.message}`));
|
|
10872
|
+
}
|
|
10873
|
+
} else {
|
|
10874
|
+
console.error(chalk41.red("\u2717 An unexpected error occurred"));
|
|
10875
|
+
}
|
|
10876
|
+
process.exit(1);
|
|
10877
|
+
}
|
|
10878
|
+
});
|
|
10879
|
+
|
|
10880
|
+
// src/commands/agent/list.ts
|
|
10881
|
+
import { Command as Command37 } from "commander";
|
|
10882
|
+
import chalk42 from "chalk";
|
|
10883
|
+
var listCommand4 = new Command37().name("list").alias("ls").description("List all agent composes").action(
|
|
10701
10884
|
withErrorHandler(async () => {
|
|
10702
10885
|
const response = await httpGet("/api/agent/composes/list");
|
|
10703
10886
|
if (!response.ok) {
|
|
@@ -10706,9 +10889,9 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10706
10889
|
}
|
|
10707
10890
|
const data = await response.json();
|
|
10708
10891
|
if (data.composes.length === 0) {
|
|
10709
|
-
console.log(
|
|
10892
|
+
console.log(chalk42.dim("No agent composes found"));
|
|
10710
10893
|
console.log(
|
|
10711
|
-
|
|
10894
|
+
chalk42.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
10712
10895
|
);
|
|
10713
10896
|
return;
|
|
10714
10897
|
}
|
|
@@ -10716,9 +10899,9 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10716
10899
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
10717
10900
|
" "
|
|
10718
10901
|
);
|
|
10719
|
-
console.log(
|
|
10902
|
+
console.log(chalk42.dim(header));
|
|
10720
10903
|
for (const compose of data.composes) {
|
|
10721
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
10904
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk42.dim("-");
|
|
10722
10905
|
const row = [
|
|
10723
10906
|
compose.name.padEnd(nameWidth),
|
|
10724
10907
|
versionShort,
|
|
@@ -10730,8 +10913,8 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10730
10913
|
);
|
|
10731
10914
|
|
|
10732
10915
|
// src/commands/agent/status.ts
|
|
10733
|
-
import { Command as
|
|
10734
|
-
import
|
|
10916
|
+
import { Command as Command38 } from "commander";
|
|
10917
|
+
import chalk43 from "chalk";
|
|
10735
10918
|
|
|
10736
10919
|
// src/lib/domain/source-derivation.ts
|
|
10737
10920
|
import * as fs9 from "fs/promises";
|
|
@@ -10855,27 +11038,27 @@ function formatVariableSources(sources) {
|
|
|
10855
11038
|
if (sources.secrets.length > 0) {
|
|
10856
11039
|
console.log(` Secrets:`);
|
|
10857
11040
|
for (const secret of sources.secrets) {
|
|
10858
|
-
const sourceInfo =
|
|
11041
|
+
const sourceInfo = chalk43.dim(`(${secret.source})`);
|
|
10859
11042
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
10860
11043
|
}
|
|
10861
11044
|
}
|
|
10862
11045
|
if (sources.vars.length > 0) {
|
|
10863
11046
|
console.log(` Vars:`);
|
|
10864
11047
|
for (const v of sources.vars) {
|
|
10865
|
-
const sourceInfo =
|
|
11048
|
+
const sourceInfo = chalk43.dim(`(${v.source})`);
|
|
10866
11049
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
10867
11050
|
}
|
|
10868
11051
|
}
|
|
10869
11052
|
if (sources.credentials.length > 0) {
|
|
10870
11053
|
console.log(` Credentials:`);
|
|
10871
11054
|
for (const cred of sources.credentials) {
|
|
10872
|
-
const sourceInfo =
|
|
11055
|
+
const sourceInfo = chalk43.dim(`(${cred.source})`);
|
|
10873
11056
|
console.log(` - ${cred.name.padEnd(20)} ${sourceInfo}`);
|
|
10874
11057
|
}
|
|
10875
11058
|
}
|
|
10876
11059
|
}
|
|
10877
11060
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
10878
|
-
console.log(` ${
|
|
11061
|
+
console.log(` ${chalk43.cyan(agentName)}:`);
|
|
10879
11062
|
console.log(` Framework: ${agent.framework}`);
|
|
10880
11063
|
if (agent.image) {
|
|
10881
11064
|
console.log(` Image: ${agent.image}`);
|
|
@@ -10894,16 +11077,16 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
10894
11077
|
}
|
|
10895
11078
|
}
|
|
10896
11079
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
10897
|
-
console.log(
|
|
10898
|
-
console.log(
|
|
11080
|
+
console.log(chalk43.bold("Name:") + ` ${name}`);
|
|
11081
|
+
console.log(chalk43.bold("Version:") + ` ${versionId}`);
|
|
10899
11082
|
console.log();
|
|
10900
|
-
console.log(
|
|
11083
|
+
console.log(chalk43.bold("Agents:"));
|
|
10901
11084
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
10902
11085
|
const agentSources = variableSources?.get(agentName);
|
|
10903
11086
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
10904
11087
|
}
|
|
10905
11088
|
}
|
|
10906
|
-
var statusCommand5 = new
|
|
11089
|
+
var statusCommand5 = new Command38().name("status").description("Show status of agent compose").argument(
|
|
10907
11090
|
"<name[:version]>",
|
|
10908
11091
|
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
10909
11092
|
).option("--no-sources", "Skip fetching skills to determine variable sources").action(async (argument, options) => {
|
|
@@ -10920,8 +11103,8 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10920
11103
|
}
|
|
10921
11104
|
const compose = await getComposeByName(name);
|
|
10922
11105
|
if (!compose) {
|
|
10923
|
-
console.error(
|
|
10924
|
-
console.error(
|
|
11106
|
+
console.error(chalk43.red(`\u2717 Agent compose not found: ${name}`));
|
|
11107
|
+
console.error(chalk43.dim(" Run: vm0 agent list"));
|
|
10925
11108
|
process.exit(1);
|
|
10926
11109
|
}
|
|
10927
11110
|
let resolvedVersionId = compose.headVersionId;
|
|
@@ -10932,9 +11115,9 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10932
11115
|
resolvedVersionId = versionInfo.versionId;
|
|
10933
11116
|
} catch (error) {
|
|
10934
11117
|
if (error instanceof Error && error.message.includes("not found")) {
|
|
10935
|
-
console.error(
|
|
11118
|
+
console.error(chalk43.red(`\u2717 Version not found: ${version}`));
|
|
10936
11119
|
console.error(
|
|
10937
|
-
|
|
11120
|
+
chalk43.dim(
|
|
10938
11121
|
` HEAD version: ${compose.headVersionId?.slice(0, 8)}`
|
|
10939
11122
|
)
|
|
10940
11123
|
);
|
|
@@ -10947,7 +11130,7 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10947
11130
|
}
|
|
10948
11131
|
}
|
|
10949
11132
|
if (!resolvedVersionId || !compose.content) {
|
|
10950
|
-
console.error(
|
|
11133
|
+
console.error(chalk43.red(`\u2717 No version found for: ${name}`));
|
|
10951
11134
|
process.exit(1);
|
|
10952
11135
|
}
|
|
10953
11136
|
const content = compose.content;
|
|
@@ -10958,7 +11141,7 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10958
11141
|
});
|
|
10959
11142
|
} catch {
|
|
10960
11143
|
console.error(
|
|
10961
|
-
|
|
11144
|
+
chalk43.yellow(
|
|
10962
11145
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
10963
11146
|
)
|
|
10964
11147
|
);
|
|
@@ -10970,12 +11153,12 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10970
11153
|
variableSources
|
|
10971
11154
|
);
|
|
10972
11155
|
} catch (error) {
|
|
10973
|
-
console.error(
|
|
11156
|
+
console.error(chalk43.red("\u2717 Failed to get agent compose status"));
|
|
10974
11157
|
if (error instanceof Error) {
|
|
10975
11158
|
if (error.message.includes("Not authenticated")) {
|
|
10976
|
-
console.error(
|
|
11159
|
+
console.error(chalk43.dim(" Run: vm0 auth login"));
|
|
10977
11160
|
} else {
|
|
10978
|
-
console.error(
|
|
11161
|
+
console.error(chalk43.dim(` ${error.message}`));
|
|
10979
11162
|
}
|
|
10980
11163
|
}
|
|
10981
11164
|
process.exit(1);
|
|
@@ -10983,9 +11166,9 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10983
11166
|
});
|
|
10984
11167
|
|
|
10985
11168
|
// src/commands/agent/public.ts
|
|
10986
|
-
import { Command as
|
|
10987
|
-
import
|
|
10988
|
-
var publicCommand = new
|
|
11169
|
+
import { Command as Command39 } from "commander";
|
|
11170
|
+
import chalk44 from "chalk";
|
|
11171
|
+
var publicCommand = new Command39().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").option(
|
|
10989
11172
|
"--experimental-shared-agent",
|
|
10990
11173
|
"Enable experimental agent sharing feature"
|
|
10991
11174
|
).action(
|
|
@@ -10993,18 +11176,18 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
10993
11176
|
async (name, options) => {
|
|
10994
11177
|
if (!options.experimentalSharedAgent) {
|
|
10995
11178
|
console.error(
|
|
10996
|
-
|
|
11179
|
+
chalk44.red(
|
|
10997
11180
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
10998
11181
|
)
|
|
10999
11182
|
);
|
|
11000
11183
|
console.error();
|
|
11001
11184
|
console.error(
|
|
11002
|
-
|
|
11185
|
+
chalk44.dim(" Agent sharing is an experimental feature.")
|
|
11003
11186
|
);
|
|
11004
11187
|
console.error();
|
|
11005
11188
|
console.error("Example:");
|
|
11006
11189
|
console.error(
|
|
11007
|
-
|
|
11190
|
+
chalk44.cyan(
|
|
11008
11191
|
` vm0 agent public ${name} --experimental-shared-agent`
|
|
11009
11192
|
)
|
|
11010
11193
|
);
|
|
@@ -11012,7 +11195,7 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
11012
11195
|
}
|
|
11013
11196
|
const compose = await getComposeByName(name);
|
|
11014
11197
|
if (!compose) {
|
|
11015
|
-
console.error(
|
|
11198
|
+
console.error(chalk44.red(`\u2717 Agent not found: ${name}`));
|
|
11016
11199
|
process.exit(1);
|
|
11017
11200
|
}
|
|
11018
11201
|
const scope = await getScope();
|
|
@@ -11023,7 +11206,7 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
11023
11206
|
if (!response.ok) {
|
|
11024
11207
|
const error = await response.json();
|
|
11025
11208
|
if (response.status === 409) {
|
|
11026
|
-
console.log(
|
|
11209
|
+
console.log(chalk44.yellow(`Agent "${name}" is already public`));
|
|
11027
11210
|
return;
|
|
11028
11211
|
}
|
|
11029
11212
|
throw new Error(
|
|
@@ -11031,11 +11214,11 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
11031
11214
|
);
|
|
11032
11215
|
}
|
|
11033
11216
|
const fullName = `${scope.slug}/${name}`;
|
|
11034
|
-
console.log(
|
|
11217
|
+
console.log(chalk44.green(`\u2713 Agent "${name}" is now public`));
|
|
11035
11218
|
console.log();
|
|
11036
11219
|
console.log("Others can now run your agent with:");
|
|
11037
11220
|
console.log(
|
|
11038
|
-
|
|
11221
|
+
chalk44.cyan(
|
|
11039
11222
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
11040
11223
|
)
|
|
11041
11224
|
);
|
|
@@ -11044,9 +11227,9 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
11044
11227
|
);
|
|
11045
11228
|
|
|
11046
11229
|
// src/commands/agent/private.ts
|
|
11047
|
-
import { Command as
|
|
11048
|
-
import
|
|
11049
|
-
var privateCommand = new
|
|
11230
|
+
import { Command as Command40 } from "commander";
|
|
11231
|
+
import chalk45 from "chalk";
|
|
11232
|
+
var privateCommand = new Command40().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").option(
|
|
11050
11233
|
"--experimental-shared-agent",
|
|
11051
11234
|
"Enable experimental agent sharing feature"
|
|
11052
11235
|
).action(
|
|
@@ -11054,18 +11237,18 @@ var privateCommand = new Command39().name("private").description("Make an agent
|
|
|
11054
11237
|
async (name, options) => {
|
|
11055
11238
|
if (!options.experimentalSharedAgent) {
|
|
11056
11239
|
console.error(
|
|
11057
|
-
|
|
11240
|
+
chalk45.red(
|
|
11058
11241
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11059
11242
|
)
|
|
11060
11243
|
);
|
|
11061
11244
|
console.error();
|
|
11062
11245
|
console.error(
|
|
11063
|
-
|
|
11246
|
+
chalk45.dim(" Agent sharing is an experimental feature.")
|
|
11064
11247
|
);
|
|
11065
11248
|
console.error();
|
|
11066
11249
|
console.error("Example:");
|
|
11067
11250
|
console.error(
|
|
11068
|
-
|
|
11251
|
+
chalk45.cyan(
|
|
11069
11252
|
` vm0 agent private ${name} --experimental-shared-agent`
|
|
11070
11253
|
)
|
|
11071
11254
|
);
|
|
@@ -11073,7 +11256,7 @@ var privateCommand = new Command39().name("private").description("Make an agent
|
|
|
11073
11256
|
}
|
|
11074
11257
|
const compose = await getComposeByName(name);
|
|
11075
11258
|
if (!compose) {
|
|
11076
|
-
console.error(
|
|
11259
|
+
console.error(chalk45.red(`\u2717 Agent not found: ${name}`));
|
|
11077
11260
|
process.exit(1);
|
|
11078
11261
|
}
|
|
11079
11262
|
const response = await httpDelete(
|
|
@@ -11082,22 +11265,22 @@ var privateCommand = new Command39().name("private").description("Make an agent
|
|
|
11082
11265
|
if (!response.ok) {
|
|
11083
11266
|
const error = await response.json();
|
|
11084
11267
|
if (response.status === 404) {
|
|
11085
|
-
console.log(
|
|
11268
|
+
console.log(chalk45.yellow(`Agent "${name}" is already private`));
|
|
11086
11269
|
return;
|
|
11087
11270
|
}
|
|
11088
11271
|
throw new Error(
|
|
11089
11272
|
error.error?.message || "Failed to make agent private"
|
|
11090
11273
|
);
|
|
11091
11274
|
}
|
|
11092
|
-
console.log(
|
|
11275
|
+
console.log(chalk45.green(`\u2713 Agent "${name}" is now private`));
|
|
11093
11276
|
}
|
|
11094
11277
|
)
|
|
11095
11278
|
);
|
|
11096
11279
|
|
|
11097
11280
|
// src/commands/agent/share.ts
|
|
11098
|
-
import { Command as
|
|
11099
|
-
import
|
|
11100
|
-
var shareCommand = new
|
|
11281
|
+
import { Command as Command41 } from "commander";
|
|
11282
|
+
import chalk46 from "chalk";
|
|
11283
|
+
var shareCommand = new Command41().name("share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").option(
|
|
11101
11284
|
"--experimental-shared-agent",
|
|
11102
11285
|
"Enable experimental agent sharing feature"
|
|
11103
11286
|
).action(
|
|
@@ -11105,18 +11288,18 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11105
11288
|
async (name, options) => {
|
|
11106
11289
|
if (!options.experimentalSharedAgent) {
|
|
11107
11290
|
console.error(
|
|
11108
|
-
|
|
11291
|
+
chalk46.red(
|
|
11109
11292
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11110
11293
|
)
|
|
11111
11294
|
);
|
|
11112
11295
|
console.error();
|
|
11113
11296
|
console.error(
|
|
11114
|
-
|
|
11297
|
+
chalk46.dim(" Agent sharing is an experimental feature.")
|
|
11115
11298
|
);
|
|
11116
11299
|
console.error();
|
|
11117
11300
|
console.error("Example:");
|
|
11118
11301
|
console.error(
|
|
11119
|
-
|
|
11302
|
+
chalk46.cyan(
|
|
11120
11303
|
` vm0 agent share ${name} --email ${options.email} --experimental-shared-agent`
|
|
11121
11304
|
)
|
|
11122
11305
|
);
|
|
@@ -11124,7 +11307,7 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11124
11307
|
}
|
|
11125
11308
|
const compose = await getComposeByName(name);
|
|
11126
11309
|
if (!compose) {
|
|
11127
|
-
console.error(
|
|
11310
|
+
console.error(chalk46.red(`\u2717 Agent not found: ${name}`));
|
|
11128
11311
|
process.exit(1);
|
|
11129
11312
|
}
|
|
11130
11313
|
const scope = await getScope();
|
|
@@ -11136,7 +11319,7 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11136
11319
|
const error = await response.json();
|
|
11137
11320
|
if (response.status === 409) {
|
|
11138
11321
|
console.log(
|
|
11139
|
-
|
|
11322
|
+
chalk46.yellow(
|
|
11140
11323
|
`Agent "${name}" is already shared with ${options.email}`
|
|
11141
11324
|
)
|
|
11142
11325
|
);
|
|
@@ -11146,12 +11329,12 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11146
11329
|
}
|
|
11147
11330
|
const fullName = `${scope.slug}/${name}`;
|
|
11148
11331
|
console.log(
|
|
11149
|
-
|
|
11332
|
+
chalk46.green(`\u2713 Agent "${name}" shared with ${options.email}`)
|
|
11150
11333
|
);
|
|
11151
11334
|
console.log();
|
|
11152
11335
|
console.log("They can now run your agent with:");
|
|
11153
11336
|
console.log(
|
|
11154
|
-
|
|
11337
|
+
chalk46.cyan(
|
|
11155
11338
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
11156
11339
|
)
|
|
11157
11340
|
);
|
|
@@ -11160,9 +11343,9 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11160
11343
|
);
|
|
11161
11344
|
|
|
11162
11345
|
// src/commands/agent/unshare.ts
|
|
11163
|
-
import { Command as
|
|
11164
|
-
import
|
|
11165
|
-
var unshareCommand = new
|
|
11346
|
+
import { Command as Command42 } from "commander";
|
|
11347
|
+
import chalk47 from "chalk";
|
|
11348
|
+
var unshareCommand = new Command42().name("unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").option(
|
|
11166
11349
|
"--experimental-shared-agent",
|
|
11167
11350
|
"Enable experimental agent sharing feature"
|
|
11168
11351
|
).action(
|
|
@@ -11170,18 +11353,18 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11170
11353
|
async (name, options) => {
|
|
11171
11354
|
if (!options.experimentalSharedAgent) {
|
|
11172
11355
|
console.error(
|
|
11173
|
-
|
|
11356
|
+
chalk47.red(
|
|
11174
11357
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11175
11358
|
)
|
|
11176
11359
|
);
|
|
11177
11360
|
console.error();
|
|
11178
11361
|
console.error(
|
|
11179
|
-
|
|
11362
|
+
chalk47.dim(" Agent sharing is an experimental feature.")
|
|
11180
11363
|
);
|
|
11181
11364
|
console.error();
|
|
11182
11365
|
console.error("Example:");
|
|
11183
11366
|
console.error(
|
|
11184
|
-
|
|
11367
|
+
chalk47.cyan(
|
|
11185
11368
|
` vm0 agent unshare ${name} --email ${options.email} --experimental-shared-agent`
|
|
11186
11369
|
)
|
|
11187
11370
|
);
|
|
@@ -11189,7 +11372,7 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11189
11372
|
}
|
|
11190
11373
|
const compose = await getComposeByName(name);
|
|
11191
11374
|
if (!compose) {
|
|
11192
|
-
console.error(
|
|
11375
|
+
console.error(chalk47.red(`\u2717 Agent not found: ${name}`));
|
|
11193
11376
|
process.exit(1);
|
|
11194
11377
|
}
|
|
11195
11378
|
const response = await httpDelete(
|
|
@@ -11199,7 +11382,7 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11199
11382
|
const error = await response.json();
|
|
11200
11383
|
if (response.status === 404) {
|
|
11201
11384
|
console.log(
|
|
11202
|
-
|
|
11385
|
+
chalk47.yellow(
|
|
11203
11386
|
`Agent "${name}" is not shared with ${options.email}`
|
|
11204
11387
|
)
|
|
11205
11388
|
);
|
|
@@ -11208,16 +11391,16 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11208
11391
|
throw new Error(error.error?.message || "Failed to unshare agent");
|
|
11209
11392
|
}
|
|
11210
11393
|
console.log(
|
|
11211
|
-
|
|
11394
|
+
chalk47.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
|
|
11212
11395
|
);
|
|
11213
11396
|
}
|
|
11214
11397
|
)
|
|
11215
11398
|
);
|
|
11216
11399
|
|
|
11217
11400
|
// src/commands/agent/permission.ts
|
|
11218
|
-
import { Command as
|
|
11219
|
-
import
|
|
11220
|
-
var permissionCommand = new
|
|
11401
|
+
import { Command as Command43 } from "commander";
|
|
11402
|
+
import chalk48 from "chalk";
|
|
11403
|
+
var permissionCommand = new Command43().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").option(
|
|
11221
11404
|
"--experimental-shared-agent",
|
|
11222
11405
|
"Enable experimental agent sharing feature"
|
|
11223
11406
|
).action(
|
|
@@ -11225,18 +11408,18 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11225
11408
|
async (name, options) => {
|
|
11226
11409
|
if (!options.experimentalSharedAgent) {
|
|
11227
11410
|
console.error(
|
|
11228
|
-
|
|
11411
|
+
chalk48.red(
|
|
11229
11412
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11230
11413
|
)
|
|
11231
11414
|
);
|
|
11232
11415
|
console.error();
|
|
11233
11416
|
console.error(
|
|
11234
|
-
|
|
11417
|
+
chalk48.dim(" Agent sharing is an experimental feature.")
|
|
11235
11418
|
);
|
|
11236
11419
|
console.error();
|
|
11237
11420
|
console.error("Example:");
|
|
11238
11421
|
console.error(
|
|
11239
|
-
|
|
11422
|
+
chalk48.cyan(
|
|
11240
11423
|
` vm0 agent permission ${name} --experimental-shared-agent`
|
|
11241
11424
|
)
|
|
11242
11425
|
);
|
|
@@ -11244,7 +11427,7 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11244
11427
|
}
|
|
11245
11428
|
const compose = await getComposeByName(name);
|
|
11246
11429
|
if (!compose) {
|
|
11247
|
-
console.error(
|
|
11430
|
+
console.error(chalk48.red(`\u2717 Agent not found: ${name}`));
|
|
11248
11431
|
process.exit(1);
|
|
11249
11432
|
}
|
|
11250
11433
|
const response = await httpGet(
|
|
@@ -11256,16 +11439,16 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11256
11439
|
}
|
|
11257
11440
|
const data = await response.json();
|
|
11258
11441
|
if (data.permissions.length === 0) {
|
|
11259
|
-
console.log(
|
|
11442
|
+
console.log(chalk48.dim("No permissions set (private agent)"));
|
|
11260
11443
|
return;
|
|
11261
11444
|
}
|
|
11262
11445
|
console.log(
|
|
11263
|
-
|
|
11446
|
+
chalk48.dim(
|
|
11264
11447
|
"TYPE EMAIL PERMISSION GRANTED"
|
|
11265
11448
|
)
|
|
11266
11449
|
);
|
|
11267
11450
|
console.log(
|
|
11268
|
-
|
|
11451
|
+
chalk48.dim(
|
|
11269
11452
|
"------- ----------------------------- ---------- ----------"
|
|
11270
11453
|
)
|
|
11271
11454
|
);
|
|
@@ -11281,11 +11464,11 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11281
11464
|
);
|
|
11282
11465
|
|
|
11283
11466
|
// src/commands/agent/index.ts
|
|
11284
|
-
var agentCommand = new
|
|
11467
|
+
var agentCommand = new Command44().name("agent").description("Manage agent composes").addCommand(cloneCommand3).addCommand(deleteCommand).addCommand(listCommand4).addCommand(statusCommand5).addCommand(publicCommand).addCommand(privateCommand).addCommand(shareCommand).addCommand(unshareCommand).addCommand(permissionCommand);
|
|
11285
11468
|
|
|
11286
11469
|
// src/commands/init/index.ts
|
|
11287
|
-
import { Command as
|
|
11288
|
-
import
|
|
11470
|
+
import { Command as Command45 } from "commander";
|
|
11471
|
+
import chalk49 from "chalk";
|
|
11289
11472
|
import path15 from "path";
|
|
11290
11473
|
import { existsSync as existsSync11 } from "fs";
|
|
11291
11474
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -11323,14 +11506,14 @@ function checkExistingFiles() {
|
|
|
11323
11506
|
if (existsSync11(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
11324
11507
|
return existingFiles;
|
|
11325
11508
|
}
|
|
11326
|
-
var initCommand3 = new
|
|
11509
|
+
var initCommand3 = new Command45().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(async (options) => {
|
|
11327
11510
|
const existingFiles = checkExistingFiles();
|
|
11328
11511
|
if (existingFiles.length > 0 && !options.force) {
|
|
11329
11512
|
for (const file of existingFiles) {
|
|
11330
|
-
console.error(
|
|
11513
|
+
console.error(chalk49.red(`\u2717 ${file} already exists`));
|
|
11331
11514
|
}
|
|
11332
11515
|
console.error();
|
|
11333
|
-
console.error(`To overwrite: ${
|
|
11516
|
+
console.error(`To overwrite: ${chalk49.cyan("vm0 init --force")}`);
|
|
11334
11517
|
process.exit(1);
|
|
11335
11518
|
}
|
|
11336
11519
|
let agentName;
|
|
@@ -11338,9 +11521,9 @@ var initCommand3 = new Command44().name("init").description("Initialize a new VM
|
|
|
11338
11521
|
agentName = options.name.trim();
|
|
11339
11522
|
} else if (!isInteractive()) {
|
|
11340
11523
|
console.error(
|
|
11341
|
-
|
|
11524
|
+
chalk49.red("\u2717 --name flag is required in non-interactive mode")
|
|
11342
11525
|
);
|
|
11343
|
-
console.error(
|
|
11526
|
+
console.error(chalk49.dim(" Usage: vm0 init --name <agent-name>"));
|
|
11344
11527
|
process.exit(1);
|
|
11345
11528
|
} else {
|
|
11346
11529
|
const dirName = path15.basename(process.cwd());
|
|
@@ -11356,47 +11539,47 @@ var initCommand3 = new Command44().name("init").description("Initialize a new VM
|
|
|
11356
11539
|
}
|
|
11357
11540
|
);
|
|
11358
11541
|
if (name === void 0) {
|
|
11359
|
-
console.log(
|
|
11542
|
+
console.log(chalk49.dim("Cancelled"));
|
|
11360
11543
|
return;
|
|
11361
11544
|
}
|
|
11362
11545
|
agentName = name;
|
|
11363
11546
|
}
|
|
11364
11547
|
if (!agentName || !validateAgentName(agentName)) {
|
|
11365
|
-
console.error(
|
|
11548
|
+
console.error(chalk49.red("\u2717 Invalid agent name"));
|
|
11366
11549
|
console.error(
|
|
11367
|
-
|
|
11550
|
+
chalk49.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
11368
11551
|
);
|
|
11369
|
-
console.error(
|
|
11552
|
+
console.error(chalk49.dim(" Must start and end with letter or number"));
|
|
11370
11553
|
process.exit(1);
|
|
11371
11554
|
}
|
|
11372
11555
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
11373
11556
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
11374
|
-
console.log(
|
|
11557
|
+
console.log(chalk49.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
11375
11558
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
11376
11559
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
11377
|
-
console.log(
|
|
11560
|
+
console.log(chalk49.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
11378
11561
|
console.log();
|
|
11379
11562
|
console.log("Next steps:");
|
|
11380
11563
|
console.log(
|
|
11381
|
-
` 1. Set up model provider (one-time): ${
|
|
11564
|
+
` 1. Set up model provider (one-time): ${chalk49.cyan("vm0 model-provider setup")}`
|
|
11382
11565
|
);
|
|
11383
11566
|
console.log(
|
|
11384
|
-
` 2. Edit ${
|
|
11567
|
+
` 2. Edit ${chalk49.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
11385
11568
|
);
|
|
11386
11569
|
console.log(
|
|
11387
|
-
` Or install Claude plugin: ${
|
|
11570
|
+
` Or install Claude plugin: ${chalk49.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
11388
11571
|
);
|
|
11389
11572
|
console.log(
|
|
11390
|
-
` 3. Run your agent: ${
|
|
11573
|
+
` 3. Run your agent: ${chalk49.cyan(`vm0 cook "let's start working"`)}`
|
|
11391
11574
|
);
|
|
11392
11575
|
});
|
|
11393
11576
|
|
|
11394
11577
|
// src/commands/schedule/index.ts
|
|
11395
|
-
import { Command as
|
|
11578
|
+
import { Command as Command52 } from "commander";
|
|
11396
11579
|
|
|
11397
11580
|
// src/commands/schedule/setup.ts
|
|
11398
|
-
import { Command as
|
|
11399
|
-
import
|
|
11581
|
+
import { Command as Command46 } from "commander";
|
|
11582
|
+
import chalk50 from "chalk";
|
|
11400
11583
|
|
|
11401
11584
|
// src/lib/domain/schedule-utils.ts
|
|
11402
11585
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -11618,7 +11801,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11618
11801
|
}
|
|
11619
11802
|
if (!isInteractive()) {
|
|
11620
11803
|
console.error(
|
|
11621
|
-
|
|
11804
|
+
chalk50.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
11622
11805
|
);
|
|
11623
11806
|
process.exit(1);
|
|
11624
11807
|
}
|
|
@@ -11638,7 +11821,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11638
11821
|
const day2 = parseDayOption(optionDay, frequency);
|
|
11639
11822
|
if (day2 === void 0) {
|
|
11640
11823
|
console.error(
|
|
11641
|
-
|
|
11824
|
+
chalk50.red(
|
|
11642
11825
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
11643
11826
|
)
|
|
11644
11827
|
);
|
|
@@ -11647,7 +11830,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11647
11830
|
return day2;
|
|
11648
11831
|
}
|
|
11649
11832
|
if (!isInteractive()) {
|
|
11650
|
-
console.error(
|
|
11833
|
+
console.error(chalk50.red("\u2717 --day is required for weekly/monthly"));
|
|
11651
11834
|
process.exit(1);
|
|
11652
11835
|
}
|
|
11653
11836
|
if (frequency === "weekly") {
|
|
@@ -11666,7 +11849,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11666
11849
|
if (!dayStr) return null;
|
|
11667
11850
|
const day = parseInt(dayStr, 10);
|
|
11668
11851
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
11669
|
-
console.error(
|
|
11852
|
+
console.error(chalk50.red("\u2717 Day must be between 1 and 31"));
|
|
11670
11853
|
process.exit(1);
|
|
11671
11854
|
}
|
|
11672
11855
|
return day;
|
|
@@ -11675,13 +11858,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
11675
11858
|
if (optionTime) {
|
|
11676
11859
|
const validation = validateTimeFormat(optionTime);
|
|
11677
11860
|
if (validation !== true) {
|
|
11678
|
-
console.error(
|
|
11861
|
+
console.error(chalk50.red(`\u2717 Invalid time: ${validation}`));
|
|
11679
11862
|
process.exit(1);
|
|
11680
11863
|
}
|
|
11681
11864
|
return optionTime;
|
|
11682
11865
|
}
|
|
11683
11866
|
if (!isInteractive()) {
|
|
11684
|
-
console.error(
|
|
11867
|
+
console.error(chalk50.red("\u2717 --time is required (HH:MM format)"));
|
|
11685
11868
|
process.exit(1);
|
|
11686
11869
|
}
|
|
11687
11870
|
return await promptText(
|
|
@@ -11694,7 +11877,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11694
11877
|
if (optionDay && optionTime) {
|
|
11695
11878
|
if (!validateDateFormat(optionDay)) {
|
|
11696
11879
|
console.error(
|
|
11697
|
-
|
|
11880
|
+
chalk50.red(
|
|
11698
11881
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
11699
11882
|
)
|
|
11700
11883
|
);
|
|
@@ -11702,16 +11885,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11702
11885
|
}
|
|
11703
11886
|
if (!validateTimeFormat(optionTime)) {
|
|
11704
11887
|
console.error(
|
|
11705
|
-
|
|
11888
|
+
chalk50.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
11706
11889
|
);
|
|
11707
11890
|
process.exit(1);
|
|
11708
11891
|
}
|
|
11709
11892
|
return `${optionDay} ${optionTime}`;
|
|
11710
11893
|
}
|
|
11711
11894
|
if (!isInteractive()) {
|
|
11712
|
-
console.error(
|
|
11895
|
+
console.error(chalk50.red("\u2717 One-time schedules require interactive mode"));
|
|
11713
11896
|
console.error(
|
|
11714
|
-
|
|
11897
|
+
chalk50.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
11715
11898
|
);
|
|
11716
11899
|
process.exit(1);
|
|
11717
11900
|
}
|
|
@@ -11742,7 +11925,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
11742
11925
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
11743
11926
|
if (optionPrompt) return optionPrompt;
|
|
11744
11927
|
if (!isInteractive()) {
|
|
11745
|
-
console.error(
|
|
11928
|
+
console.error(chalk50.red("\u2717 --prompt is required"));
|
|
11746
11929
|
process.exit(1);
|
|
11747
11930
|
}
|
|
11748
11931
|
return await promptText(
|
|
@@ -11753,8 +11936,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
11753
11936
|
async function resolveAgent(agentName) {
|
|
11754
11937
|
const compose = await getComposeByName(agentName);
|
|
11755
11938
|
if (!compose) {
|
|
11756
|
-
console.error(
|
|
11757
|
-
console.error(
|
|
11939
|
+
console.error(chalk50.red(`\u2717 Agent not found: ${agentName}`));
|
|
11940
|
+
console.error(chalk50.dim(" Make sure the agent is composed first"));
|
|
11758
11941
|
process.exit(1);
|
|
11759
11942
|
}
|
|
11760
11943
|
return {
|
|
@@ -11799,7 +11982,7 @@ async function buildAndDeploy(params) {
|
|
|
11799
11982
|
}
|
|
11800
11983
|
console.log(
|
|
11801
11984
|
`
|
|
11802
|
-
Deploying schedule for agent ${
|
|
11985
|
+
Deploying schedule for agent ${chalk50.cyan(params.agentName)}...`
|
|
11803
11986
|
);
|
|
11804
11987
|
const deployResult = await deploySchedule({
|
|
11805
11988
|
name: params.scheduleName,
|
|
@@ -11815,56 +11998,56 @@ Deploying schedule for agent ${chalk49.cyan(params.agentName)}...`
|
|
|
11815
11998
|
function displayDeployResult(agentName, deployResult) {
|
|
11816
11999
|
if (deployResult.created) {
|
|
11817
12000
|
console.log(
|
|
11818
|
-
|
|
12001
|
+
chalk50.green(`\u2713 Created schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11819
12002
|
);
|
|
11820
12003
|
} else {
|
|
11821
12004
|
console.log(
|
|
11822
|
-
|
|
12005
|
+
chalk50.green(`\u2713 Updated schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11823
12006
|
);
|
|
11824
12007
|
}
|
|
11825
|
-
console.log(
|
|
12008
|
+
console.log(chalk50.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
11826
12009
|
if (deployResult.schedule.cronExpression) {
|
|
11827
|
-
console.log(
|
|
12010
|
+
console.log(chalk50.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
11828
12011
|
if (deployResult.schedule.nextRunAt) {
|
|
11829
12012
|
const nextRun = formatInTimezone(
|
|
11830
12013
|
deployResult.schedule.nextRunAt,
|
|
11831
12014
|
deployResult.schedule.timezone
|
|
11832
12015
|
);
|
|
11833
|
-
console.log(
|
|
12016
|
+
console.log(chalk50.dim(` Next run: ${nextRun}`));
|
|
11834
12017
|
}
|
|
11835
12018
|
} else if (deployResult.schedule.atTime) {
|
|
11836
12019
|
const atTimeFormatted = formatInTimezone(
|
|
11837
12020
|
deployResult.schedule.atTime,
|
|
11838
12021
|
deployResult.schedule.timezone
|
|
11839
12022
|
);
|
|
11840
|
-
console.log(
|
|
12023
|
+
console.log(chalk50.dim(` At: ${atTimeFormatted}`));
|
|
11841
12024
|
}
|
|
11842
12025
|
}
|
|
11843
12026
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
11844
12027
|
try {
|
|
11845
12028
|
await enableSchedule({ name: scheduleName, composeId });
|
|
11846
12029
|
console.log(
|
|
11847
|
-
|
|
12030
|
+
chalk50.green(`\u2713 Enabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11848
12031
|
);
|
|
11849
12032
|
} catch (error) {
|
|
11850
|
-
console.error(
|
|
12033
|
+
console.error(chalk50.yellow("\u26A0 Failed to enable schedule"));
|
|
11851
12034
|
if (error instanceof ApiRequestError) {
|
|
11852
12035
|
if (error.code === "SCHEDULE_PAST") {
|
|
11853
|
-
console.error(
|
|
12036
|
+
console.error(chalk50.dim(" Scheduled time has already passed"));
|
|
11854
12037
|
} else {
|
|
11855
|
-
console.error(
|
|
12038
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11856
12039
|
}
|
|
11857
12040
|
} else if (error instanceof Error) {
|
|
11858
|
-
console.error(
|
|
12041
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11859
12042
|
}
|
|
11860
12043
|
console.log(
|
|
11861
|
-
` To enable manually: ${
|
|
12044
|
+
` To enable manually: ${chalk50.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
11862
12045
|
);
|
|
11863
12046
|
}
|
|
11864
12047
|
}
|
|
11865
12048
|
function showEnableHint(agentName) {
|
|
11866
12049
|
console.log();
|
|
11867
|
-
console.log(` To enable: ${
|
|
12050
|
+
console.log(` To enable: ${chalk50.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
11868
12051
|
}
|
|
11869
12052
|
async function handleScheduleEnabling(params) {
|
|
11870
12053
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -11885,12 +12068,12 @@ async function handleScheduleEnabling(params) {
|
|
|
11885
12068
|
showEnableHint(agentName);
|
|
11886
12069
|
}
|
|
11887
12070
|
}
|
|
11888
|
-
var setupCommand = new
|
|
12071
|
+
var setupCommand = new Command46().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(
|
|
11889
12072
|
withErrorHandler(async (agentName, options) => {
|
|
11890
12073
|
const { composeId, scheduleName } = await resolveAgent(agentName);
|
|
11891
12074
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
11892
12075
|
console.log(
|
|
11893
|
-
|
|
12076
|
+
chalk50.dim(
|
|
11894
12077
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
11895
12078
|
)
|
|
11896
12079
|
);
|
|
@@ -11900,12 +12083,12 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11900
12083
|
defaults.frequency
|
|
11901
12084
|
);
|
|
11902
12085
|
if (!frequency) {
|
|
11903
|
-
console.log(
|
|
12086
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11904
12087
|
return;
|
|
11905
12088
|
}
|
|
11906
12089
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
11907
12090
|
if (!timing) {
|
|
11908
|
-
console.log(
|
|
12091
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11909
12092
|
return;
|
|
11910
12093
|
}
|
|
11911
12094
|
const { day, time, atTime } = timing;
|
|
@@ -11914,7 +12097,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11914
12097
|
existingSchedule?.timezone
|
|
11915
12098
|
);
|
|
11916
12099
|
if (!timezone) {
|
|
11917
|
-
console.log(
|
|
12100
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11918
12101
|
return;
|
|
11919
12102
|
}
|
|
11920
12103
|
const promptText_ = await gatherPromptText(
|
|
@@ -11922,7 +12105,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11922
12105
|
existingSchedule?.prompt
|
|
11923
12106
|
);
|
|
11924
12107
|
if (!promptText_) {
|
|
11925
|
-
console.log(
|
|
12108
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11926
12109
|
return;
|
|
11927
12110
|
}
|
|
11928
12111
|
const deployResult = await buildAndDeploy({
|
|
@@ -11950,15 +12133,15 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11950
12133
|
);
|
|
11951
12134
|
|
|
11952
12135
|
// src/commands/schedule/list.ts
|
|
11953
|
-
import { Command as
|
|
11954
|
-
import
|
|
11955
|
-
var listCommand5 = new
|
|
12136
|
+
import { Command as Command47 } from "commander";
|
|
12137
|
+
import chalk51 from "chalk";
|
|
12138
|
+
var listCommand5 = new Command47().name("list").alias("ls").description("List all schedules").action(
|
|
11956
12139
|
withErrorHandler(async () => {
|
|
11957
12140
|
const result = await listSchedules();
|
|
11958
12141
|
if (result.schedules.length === 0) {
|
|
11959
|
-
console.log(
|
|
12142
|
+
console.log(chalk51.dim("No schedules found"));
|
|
11960
12143
|
console.log(
|
|
11961
|
-
|
|
12144
|
+
chalk51.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
11962
12145
|
);
|
|
11963
12146
|
return;
|
|
11964
12147
|
}
|
|
@@ -11978,10 +12161,10 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11978
12161
|
"STATUS".padEnd(8),
|
|
11979
12162
|
"NEXT RUN"
|
|
11980
12163
|
].join(" ");
|
|
11981
|
-
console.log(
|
|
12164
|
+
console.log(chalk51.dim(header));
|
|
11982
12165
|
for (const schedule of result.schedules) {
|
|
11983
12166
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
11984
|
-
const status = schedule.enabled ?
|
|
12167
|
+
const status = schedule.enabled ? chalk51.green("enabled") : chalk51.yellow("disabled");
|
|
11985
12168
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
11986
12169
|
const row = [
|
|
11987
12170
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -11996,45 +12179,45 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11996
12179
|
);
|
|
11997
12180
|
|
|
11998
12181
|
// src/commands/schedule/status.ts
|
|
11999
|
-
import { Command as
|
|
12000
|
-
import
|
|
12182
|
+
import { Command as Command48 } from "commander";
|
|
12183
|
+
import chalk52 from "chalk";
|
|
12001
12184
|
function formatDateTimeStyled(dateStr) {
|
|
12002
|
-
if (!dateStr) return
|
|
12185
|
+
if (!dateStr) return chalk52.dim("-");
|
|
12003
12186
|
const formatted = formatDateTime(dateStr);
|
|
12004
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
12187
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk52.dim("($1)"));
|
|
12005
12188
|
}
|
|
12006
12189
|
function formatTrigger(schedule) {
|
|
12007
12190
|
if (schedule.cronExpression) {
|
|
12008
12191
|
return schedule.cronExpression;
|
|
12009
12192
|
}
|
|
12010
12193
|
if (schedule.atTime) {
|
|
12011
|
-
return `${schedule.atTime} ${
|
|
12194
|
+
return `${schedule.atTime} ${chalk52.dim("(one-time)")}`;
|
|
12012
12195
|
}
|
|
12013
|
-
return
|
|
12196
|
+
return chalk52.dim("-");
|
|
12014
12197
|
}
|
|
12015
12198
|
function formatRunStatus2(status) {
|
|
12016
12199
|
switch (status) {
|
|
12017
12200
|
case "completed":
|
|
12018
|
-
return
|
|
12201
|
+
return chalk52.green(status);
|
|
12019
12202
|
case "failed":
|
|
12020
12203
|
case "timeout":
|
|
12021
|
-
return
|
|
12204
|
+
return chalk52.red(status);
|
|
12022
12205
|
case "running":
|
|
12023
|
-
return
|
|
12206
|
+
return chalk52.cyan(status);
|
|
12024
12207
|
case "pending":
|
|
12025
|
-
return
|
|
12208
|
+
return chalk52.yellow(status);
|
|
12026
12209
|
default:
|
|
12027
12210
|
return status;
|
|
12028
12211
|
}
|
|
12029
12212
|
}
|
|
12030
12213
|
function printRunConfiguration(schedule) {
|
|
12031
|
-
const statusText = schedule.enabled ?
|
|
12214
|
+
const statusText = schedule.enabled ? chalk52.green("enabled") : chalk52.yellow("disabled");
|
|
12032
12215
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
12033
12216
|
console.log(
|
|
12034
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
12217
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk52.dim(`(${schedule.scopeSlug})`)}`
|
|
12035
12218
|
);
|
|
12036
12219
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
12037
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
12220
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk52.dim(promptPreview)}`);
|
|
12038
12221
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
12039
12222
|
console.log(
|
|
12040
12223
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -12071,7 +12254,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
12071
12254
|
console.log();
|
|
12072
12255
|
console.log("Recent Runs:");
|
|
12073
12256
|
console.log(
|
|
12074
|
-
|
|
12257
|
+
chalk52.dim("RUN ID STATUS CREATED")
|
|
12075
12258
|
);
|
|
12076
12259
|
for (const run of runs) {
|
|
12077
12260
|
const id = run.id;
|
|
@@ -12082,24 +12265,24 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
12082
12265
|
}
|
|
12083
12266
|
} catch {
|
|
12084
12267
|
console.log();
|
|
12085
|
-
console.log(
|
|
12268
|
+
console.log(chalk52.dim("Recent Runs: (unable to fetch)"));
|
|
12086
12269
|
}
|
|
12087
12270
|
}
|
|
12088
12271
|
function handleStatusError(error, agentName) {
|
|
12089
|
-
console.error(
|
|
12272
|
+
console.error(chalk52.red("\u2717 Failed to get schedule status"));
|
|
12090
12273
|
if (error instanceof Error) {
|
|
12091
12274
|
if (error.message.includes("Not authenticated")) {
|
|
12092
|
-
console.error(
|
|
12275
|
+
console.error(chalk52.dim(" Run: vm0 auth login"));
|
|
12093
12276
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
12094
|
-
console.error(
|
|
12095
|
-
console.error(
|
|
12277
|
+
console.error(chalk52.dim(` No schedule found for agent "${agentName}"`));
|
|
12278
|
+
console.error(chalk52.dim(" Run: vm0 schedule list"));
|
|
12096
12279
|
} else {
|
|
12097
|
-
console.error(
|
|
12280
|
+
console.error(chalk52.dim(` ${error.message}`));
|
|
12098
12281
|
}
|
|
12099
12282
|
}
|
|
12100
12283
|
process.exit(1);
|
|
12101
12284
|
}
|
|
12102
|
-
var statusCommand6 = new
|
|
12285
|
+
var statusCommand6 = new Command48().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
12103
12286
|
"-l, --limit <number>",
|
|
12104
12287
|
"Number of recent runs to show (0 to hide)",
|
|
12105
12288
|
"5"
|
|
@@ -12109,8 +12292,8 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12109
12292
|
const { name, composeId } = resolved;
|
|
12110
12293
|
const schedule = await getScheduleByName({ name, composeId });
|
|
12111
12294
|
console.log();
|
|
12112
|
-
console.log(`Schedule for agent: ${
|
|
12113
|
-
console.log(
|
|
12295
|
+
console.log(`Schedule for agent: ${chalk52.cyan(agentName)}`);
|
|
12296
|
+
console.log(chalk52.dim("\u2501".repeat(50)));
|
|
12114
12297
|
printRunConfiguration(schedule);
|
|
12115
12298
|
printTimeSchedule(schedule);
|
|
12116
12299
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -12126,24 +12309,24 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12126
12309
|
});
|
|
12127
12310
|
|
|
12128
12311
|
// src/commands/schedule/delete.ts
|
|
12129
|
-
import { Command as
|
|
12130
|
-
import
|
|
12131
|
-
var
|
|
12312
|
+
import { Command as Command49 } from "commander";
|
|
12313
|
+
import chalk53 from "chalk";
|
|
12314
|
+
var deleteCommand2 = new Command49().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
12132
12315
|
try {
|
|
12133
12316
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12134
12317
|
if (!options.force) {
|
|
12135
12318
|
if (!isInteractive()) {
|
|
12136
12319
|
console.error(
|
|
12137
|
-
|
|
12320
|
+
chalk53.red("\u2717 --force required in non-interactive mode")
|
|
12138
12321
|
);
|
|
12139
12322
|
process.exit(1);
|
|
12140
12323
|
}
|
|
12141
12324
|
const confirmed = await promptConfirm(
|
|
12142
|
-
`Delete schedule for agent ${
|
|
12325
|
+
`Delete schedule for agent ${chalk53.cyan(agentName)}?`,
|
|
12143
12326
|
false
|
|
12144
12327
|
);
|
|
12145
12328
|
if (!confirmed) {
|
|
12146
|
-
console.log(
|
|
12329
|
+
console.log(chalk53.dim("Cancelled"));
|
|
12147
12330
|
return;
|
|
12148
12331
|
}
|
|
12149
12332
|
}
|
|
@@ -12152,20 +12335,20 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12152
12335
|
composeId: resolved.composeId
|
|
12153
12336
|
});
|
|
12154
12337
|
console.log(
|
|
12155
|
-
|
|
12338
|
+
chalk53.green(`\u2713 Deleted schedule for agent ${chalk53.cyan(agentName)}`)
|
|
12156
12339
|
);
|
|
12157
12340
|
} catch (error) {
|
|
12158
|
-
console.error(
|
|
12341
|
+
console.error(chalk53.red("\u2717 Failed to delete schedule"));
|
|
12159
12342
|
if (error instanceof Error) {
|
|
12160
12343
|
if (error.message.includes("Not authenticated")) {
|
|
12161
|
-
console.error(
|
|
12344
|
+
console.error(chalk53.dim(" Run: vm0 auth login"));
|
|
12162
12345
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12163
12346
|
console.error(
|
|
12164
|
-
|
|
12347
|
+
chalk53.dim(` No schedule found for agent "${agentName}"`)
|
|
12165
12348
|
);
|
|
12166
|
-
console.error(
|
|
12349
|
+
console.error(chalk53.dim(" Run: vm0 schedule list"));
|
|
12167
12350
|
} else {
|
|
12168
|
-
console.error(
|
|
12351
|
+
console.error(chalk53.dim(` ${error.message}`));
|
|
12169
12352
|
}
|
|
12170
12353
|
}
|
|
12171
12354
|
process.exit(1);
|
|
@@ -12173,9 +12356,9 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12173
12356
|
});
|
|
12174
12357
|
|
|
12175
12358
|
// src/commands/schedule/enable.ts
|
|
12176
|
-
import { Command as
|
|
12177
|
-
import
|
|
12178
|
-
var enableCommand = new
|
|
12359
|
+
import { Command as Command50 } from "commander";
|
|
12360
|
+
import chalk54 from "chalk";
|
|
12361
|
+
var enableCommand = new Command50().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12179
12362
|
try {
|
|
12180
12363
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12181
12364
|
await enableSchedule({
|
|
@@ -12183,34 +12366,34 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12183
12366
|
composeId: resolved.composeId
|
|
12184
12367
|
});
|
|
12185
12368
|
console.log(
|
|
12186
|
-
|
|
12369
|
+
chalk54.green(`\u2713 Enabled schedule for agent ${chalk54.cyan(agentName)}`)
|
|
12187
12370
|
);
|
|
12188
12371
|
} catch (error) {
|
|
12189
|
-
console.error(
|
|
12372
|
+
console.error(chalk54.red("\u2717 Failed to enable schedule"));
|
|
12190
12373
|
if (error instanceof ApiRequestError) {
|
|
12191
12374
|
if (error.code === "SCHEDULE_PAST") {
|
|
12192
|
-
console.error(
|
|
12193
|
-
console.error(
|
|
12375
|
+
console.error(chalk54.dim(" Scheduled time has already passed"));
|
|
12376
|
+
console.error(chalk54.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
12194
12377
|
} else if (error.code === "NOT_FOUND") {
|
|
12195
12378
|
console.error(
|
|
12196
|
-
|
|
12379
|
+
chalk54.dim(` No schedule found for agent "${agentName}"`)
|
|
12197
12380
|
);
|
|
12198
|
-
console.error(
|
|
12381
|
+
console.error(chalk54.dim(" Run: vm0 schedule list"));
|
|
12199
12382
|
} else if (error.code === "UNAUTHORIZED") {
|
|
12200
|
-
console.error(
|
|
12383
|
+
console.error(chalk54.dim(" Run: vm0 auth login"));
|
|
12201
12384
|
} else {
|
|
12202
|
-
console.error(
|
|
12385
|
+
console.error(chalk54.dim(` ${error.message}`));
|
|
12203
12386
|
}
|
|
12204
12387
|
} else if (error instanceof Error) {
|
|
12205
12388
|
if (error.message.includes("Not authenticated")) {
|
|
12206
|
-
console.error(
|
|
12389
|
+
console.error(chalk54.dim(" Run: vm0 auth login"));
|
|
12207
12390
|
} else if (error.message.includes("No schedule found")) {
|
|
12208
12391
|
console.error(
|
|
12209
|
-
|
|
12392
|
+
chalk54.dim(` No schedule found for agent "${agentName}"`)
|
|
12210
12393
|
);
|
|
12211
|
-
console.error(
|
|
12394
|
+
console.error(chalk54.dim(" Run: vm0 schedule list"));
|
|
12212
12395
|
} else {
|
|
12213
|
-
console.error(
|
|
12396
|
+
console.error(chalk54.dim(` ${error.message}`));
|
|
12214
12397
|
}
|
|
12215
12398
|
}
|
|
12216
12399
|
process.exit(1);
|
|
@@ -12218,9 +12401,9 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12218
12401
|
});
|
|
12219
12402
|
|
|
12220
12403
|
// src/commands/schedule/disable.ts
|
|
12221
|
-
import { Command as
|
|
12222
|
-
import
|
|
12223
|
-
var disableCommand = new
|
|
12404
|
+
import { Command as Command51 } from "commander";
|
|
12405
|
+
import chalk55 from "chalk";
|
|
12406
|
+
var disableCommand = new Command51().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12224
12407
|
try {
|
|
12225
12408
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12226
12409
|
await disableSchedule({
|
|
@@ -12228,20 +12411,20 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
12228
12411
|
composeId: resolved.composeId
|
|
12229
12412
|
});
|
|
12230
12413
|
console.log(
|
|
12231
|
-
|
|
12414
|
+
chalk55.green(`\u2713 Disabled schedule for agent ${chalk55.cyan(agentName)}`)
|
|
12232
12415
|
);
|
|
12233
12416
|
} catch (error) {
|
|
12234
|
-
console.error(
|
|
12417
|
+
console.error(chalk55.red("\u2717 Failed to disable schedule"));
|
|
12235
12418
|
if (error instanceof Error) {
|
|
12236
12419
|
if (error.message.includes("Not authenticated")) {
|
|
12237
|
-
console.error(
|
|
12420
|
+
console.error(chalk55.dim(" Run: vm0 auth login"));
|
|
12238
12421
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12239
12422
|
console.error(
|
|
12240
|
-
|
|
12423
|
+
chalk55.dim(` No schedule found for agent "${agentName}"`)
|
|
12241
12424
|
);
|
|
12242
|
-
console.error(
|
|
12425
|
+
console.error(chalk55.dim(" Run: vm0 schedule list"));
|
|
12243
12426
|
} else {
|
|
12244
|
-
console.error(
|
|
12427
|
+
console.error(chalk55.dim(` ${error.message}`));
|
|
12245
12428
|
}
|
|
12246
12429
|
}
|
|
12247
12430
|
process.exit(1);
|
|
@@ -12249,11 +12432,11 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
12249
12432
|
});
|
|
12250
12433
|
|
|
12251
12434
|
// src/commands/schedule/index.ts
|
|
12252
|
-
var scheduleCommand = new
|
|
12435
|
+
var scheduleCommand = new Command52().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand5).addCommand(statusCommand6).addCommand(deleteCommand2).addCommand(enableCommand).addCommand(disableCommand);
|
|
12253
12436
|
|
|
12254
12437
|
// src/commands/usage/index.ts
|
|
12255
|
-
import { Command as
|
|
12256
|
-
import
|
|
12438
|
+
import { Command as Command53 } from "commander";
|
|
12439
|
+
import chalk56 from "chalk";
|
|
12257
12440
|
|
|
12258
12441
|
// src/lib/utils/duration-formatter.ts
|
|
12259
12442
|
function formatDuration(ms) {
|
|
@@ -12326,7 +12509,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
12326
12509
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
12327
12510
|
return result;
|
|
12328
12511
|
}
|
|
12329
|
-
var usageCommand = new
|
|
12512
|
+
var usageCommand = new Command53().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
12330
12513
|
"--until <date>",
|
|
12331
12514
|
"End date (ISO format or relative, defaults to now)"
|
|
12332
12515
|
).action(async (options) => {
|
|
@@ -12340,7 +12523,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12340
12523
|
endDate = new Date(untilMs);
|
|
12341
12524
|
} catch {
|
|
12342
12525
|
console.error(
|
|
12343
|
-
|
|
12526
|
+
chalk56.red(
|
|
12344
12527
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12345
12528
|
)
|
|
12346
12529
|
);
|
|
@@ -12355,7 +12538,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12355
12538
|
startDate = new Date(sinceMs);
|
|
12356
12539
|
} catch {
|
|
12357
12540
|
console.error(
|
|
12358
|
-
|
|
12541
|
+
chalk56.red(
|
|
12359
12542
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12360
12543
|
)
|
|
12361
12544
|
);
|
|
@@ -12365,13 +12548,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12365
12548
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
12366
12549
|
}
|
|
12367
12550
|
if (startDate >= endDate) {
|
|
12368
|
-
console.error(
|
|
12551
|
+
console.error(chalk56.red("\u2717 --since must be before --until"));
|
|
12369
12552
|
process.exit(1);
|
|
12370
12553
|
}
|
|
12371
12554
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
12372
12555
|
if (rangeMs > MAX_RANGE_MS) {
|
|
12373
12556
|
console.error(
|
|
12374
|
-
|
|
12557
|
+
chalk56.red(
|
|
12375
12558
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
12376
12559
|
)
|
|
12377
12560
|
);
|
|
@@ -12388,19 +12571,19 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12388
12571
|
);
|
|
12389
12572
|
console.log();
|
|
12390
12573
|
console.log(
|
|
12391
|
-
|
|
12574
|
+
chalk56.bold(
|
|
12392
12575
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
12393
12576
|
)
|
|
12394
12577
|
);
|
|
12395
12578
|
console.log();
|
|
12396
|
-
console.log(
|
|
12579
|
+
console.log(chalk56.dim("DATE RUNS RUN TIME"));
|
|
12397
12580
|
for (const day of filledDaily) {
|
|
12398
12581
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
12399
12582
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
12400
12583
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
12401
12584
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
12402
12585
|
}
|
|
12403
|
-
console.log(
|
|
12586
|
+
console.log(chalk56.dim("\u2500".repeat(29)));
|
|
12404
12587
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
12405
12588
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
12406
12589
|
console.log(
|
|
@@ -12410,72 +12593,72 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12410
12593
|
} catch (error) {
|
|
12411
12594
|
if (error instanceof Error) {
|
|
12412
12595
|
if (error.message.includes("Not authenticated")) {
|
|
12413
|
-
console.error(
|
|
12414
|
-
console.error(
|
|
12596
|
+
console.error(chalk56.red("\u2717 Not authenticated"));
|
|
12597
|
+
console.error(chalk56.dim(" Run: vm0 auth login"));
|
|
12415
12598
|
} else {
|
|
12416
|
-
console.error(
|
|
12599
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12417
12600
|
}
|
|
12418
12601
|
} else {
|
|
12419
|
-
console.error(
|
|
12602
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
12420
12603
|
}
|
|
12421
12604
|
process.exit(1);
|
|
12422
12605
|
}
|
|
12423
12606
|
});
|
|
12424
12607
|
|
|
12425
12608
|
// src/commands/secret/index.ts
|
|
12426
|
-
import { Command as
|
|
12609
|
+
import { Command as Command57 } from "commander";
|
|
12427
12610
|
|
|
12428
12611
|
// src/commands/secret/list.ts
|
|
12429
|
-
import { Command as
|
|
12430
|
-
import
|
|
12431
|
-
var listCommand6 = new
|
|
12612
|
+
import { Command as Command54 } from "commander";
|
|
12613
|
+
import chalk57 from "chalk";
|
|
12614
|
+
var listCommand6 = new Command54().name("list").alias("ls").description("List all secrets").action(
|
|
12432
12615
|
withErrorHandler(async () => {
|
|
12433
12616
|
const result = await listSecrets();
|
|
12434
12617
|
if (result.secrets.length === 0) {
|
|
12435
|
-
console.log(
|
|
12618
|
+
console.log(chalk57.dim("No secrets found"));
|
|
12436
12619
|
console.log();
|
|
12437
12620
|
console.log("To add a secret:");
|
|
12438
|
-
console.log(
|
|
12621
|
+
console.log(chalk57.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
12439
12622
|
return;
|
|
12440
12623
|
}
|
|
12441
|
-
console.log(
|
|
12624
|
+
console.log(chalk57.bold("Secrets:"));
|
|
12442
12625
|
console.log();
|
|
12443
12626
|
for (const secret of result.secrets) {
|
|
12444
12627
|
let typeIndicator = "";
|
|
12445
12628
|
let derivedLine = null;
|
|
12446
12629
|
if (secret.type === "model-provider") {
|
|
12447
|
-
typeIndicator =
|
|
12630
|
+
typeIndicator = chalk57.dim(" [model-provider]");
|
|
12448
12631
|
} else if (secret.type === "connector") {
|
|
12449
12632
|
const derived = getConnectorDerivedNames(secret.name);
|
|
12450
12633
|
if (derived) {
|
|
12451
|
-
typeIndicator =
|
|
12452
|
-
derivedLine =
|
|
12634
|
+
typeIndicator = chalk57.dim(` [${derived.connectorLabel} connector]`);
|
|
12635
|
+
derivedLine = chalk57.dim(
|
|
12453
12636
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
12454
12637
|
);
|
|
12455
12638
|
} else {
|
|
12456
|
-
typeIndicator =
|
|
12639
|
+
typeIndicator = chalk57.dim(" [connector]");
|
|
12457
12640
|
}
|
|
12458
12641
|
}
|
|
12459
|
-
console.log(` ${
|
|
12642
|
+
console.log(` ${chalk57.cyan(secret.name)}${typeIndicator}`);
|
|
12460
12643
|
if (derivedLine) {
|
|
12461
12644
|
console.log(` ${derivedLine}`);
|
|
12462
12645
|
}
|
|
12463
12646
|
if (secret.description) {
|
|
12464
|
-
console.log(` ${
|
|
12647
|
+
console.log(` ${chalk57.dim(secret.description)}`);
|
|
12465
12648
|
}
|
|
12466
12649
|
console.log(
|
|
12467
|
-
` ${
|
|
12650
|
+
` ${chalk57.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
12468
12651
|
);
|
|
12469
12652
|
console.log();
|
|
12470
12653
|
}
|
|
12471
|
-
console.log(
|
|
12654
|
+
console.log(chalk57.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
12472
12655
|
})
|
|
12473
12656
|
);
|
|
12474
12657
|
|
|
12475
12658
|
// src/commands/secret/set.ts
|
|
12476
|
-
import { Command as
|
|
12477
|
-
import
|
|
12478
|
-
var setCommand2 = new
|
|
12659
|
+
import { Command as Command55 } from "commander";
|
|
12660
|
+
import chalk58 from "chalk";
|
|
12661
|
+
var setCommand2 = new Command55().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
12479
12662
|
"-b, --body <value>",
|
|
12480
12663
|
"Secret value (required in non-interactive mode)"
|
|
12481
12664
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -12492,12 +12675,12 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12492
12675
|
value = prompted;
|
|
12493
12676
|
} else {
|
|
12494
12677
|
console.error(
|
|
12495
|
-
|
|
12678
|
+
chalk58.red("\u2717 --body is required in non-interactive mode")
|
|
12496
12679
|
);
|
|
12497
12680
|
console.error();
|
|
12498
12681
|
console.error("Usage:");
|
|
12499
12682
|
console.error(
|
|
12500
|
-
|
|
12683
|
+
chalk58.cyan(` vm0 secret set ${name} --body "your-secret-value"`)
|
|
12501
12684
|
);
|
|
12502
12685
|
process.exit(1);
|
|
12503
12686
|
}
|
|
@@ -12506,29 +12689,29 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12506
12689
|
value,
|
|
12507
12690
|
description: options.description
|
|
12508
12691
|
});
|
|
12509
|
-
console.log(
|
|
12692
|
+
console.log(chalk58.green(`\u2713 Secret "${secret.name}" saved`));
|
|
12510
12693
|
console.log();
|
|
12511
12694
|
console.log("Use in vm0.yaml:");
|
|
12512
|
-
console.log(
|
|
12513
|
-
console.log(
|
|
12695
|
+
console.log(chalk58.cyan(` environment:`));
|
|
12696
|
+
console.log(chalk58.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
12514
12697
|
} catch (error) {
|
|
12515
12698
|
if (error instanceof Error) {
|
|
12516
12699
|
if (error.message.includes("Not authenticated")) {
|
|
12517
12700
|
console.error(
|
|
12518
|
-
|
|
12701
|
+
chalk58.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12519
12702
|
);
|
|
12520
12703
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12521
|
-
console.error(
|
|
12704
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12522
12705
|
console.error();
|
|
12523
12706
|
console.error("Examples of valid secret names:");
|
|
12524
|
-
console.error(
|
|
12525
|
-
console.error(
|
|
12526
|
-
console.error(
|
|
12707
|
+
console.error(chalk58.dim(" MY_API_KEY"));
|
|
12708
|
+
console.error(chalk58.dim(" GITHUB_TOKEN"));
|
|
12709
|
+
console.error(chalk58.dim(" AWS_ACCESS_KEY_ID"));
|
|
12527
12710
|
} else {
|
|
12528
|
-
console.error(
|
|
12711
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12529
12712
|
}
|
|
12530
12713
|
} else {
|
|
12531
|
-
console.error(
|
|
12714
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
12532
12715
|
}
|
|
12533
12716
|
process.exit(1);
|
|
12534
12717
|
}
|
|
@@ -12536,20 +12719,20 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12536
12719
|
);
|
|
12537
12720
|
|
|
12538
12721
|
// src/commands/secret/delete.ts
|
|
12539
|
-
import { Command as
|
|
12540
|
-
import
|
|
12541
|
-
var
|
|
12722
|
+
import { Command as Command56 } from "commander";
|
|
12723
|
+
import chalk59 from "chalk";
|
|
12724
|
+
var deleteCommand3 = new Command56().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12542
12725
|
try {
|
|
12543
12726
|
try {
|
|
12544
12727
|
await getSecret(name);
|
|
12545
12728
|
} catch {
|
|
12546
|
-
console.error(
|
|
12729
|
+
console.error(chalk59.red(`\u2717 Secret "${name}" not found`));
|
|
12547
12730
|
process.exit(1);
|
|
12548
12731
|
}
|
|
12549
12732
|
if (!options.yes) {
|
|
12550
12733
|
if (!isInteractive()) {
|
|
12551
12734
|
console.error(
|
|
12552
|
-
|
|
12735
|
+
chalk59.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12553
12736
|
);
|
|
12554
12737
|
process.exit(1);
|
|
12555
12738
|
}
|
|
@@ -12558,72 +12741,72 @@ var deleteCommand2 = new Command55().name("delete").description("Delete a secret
|
|
|
12558
12741
|
false
|
|
12559
12742
|
);
|
|
12560
12743
|
if (!confirmed) {
|
|
12561
|
-
console.log(
|
|
12744
|
+
console.log(chalk59.dim("Cancelled"));
|
|
12562
12745
|
return;
|
|
12563
12746
|
}
|
|
12564
12747
|
}
|
|
12565
12748
|
await deleteSecret(name);
|
|
12566
|
-
console.log(
|
|
12749
|
+
console.log(chalk59.green(`\u2713 Secret "${name}" deleted`));
|
|
12567
12750
|
} catch (error) {
|
|
12568
12751
|
if (error instanceof Error) {
|
|
12569
12752
|
if (error.message.includes("Not authenticated")) {
|
|
12570
|
-
console.error(
|
|
12753
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12571
12754
|
} else {
|
|
12572
|
-
console.error(
|
|
12755
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
12573
12756
|
}
|
|
12574
12757
|
} else {
|
|
12575
|
-
console.error(
|
|
12758
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
12576
12759
|
}
|
|
12577
12760
|
process.exit(1);
|
|
12578
12761
|
}
|
|
12579
12762
|
});
|
|
12580
12763
|
|
|
12581
12764
|
// src/commands/secret/index.ts
|
|
12582
|
-
var secretCommand = new
|
|
12765
|
+
var secretCommand = new Command57().name("secret").description("Manage stored secrets for agent runs").addCommand(listCommand6).addCommand(setCommand2).addCommand(deleteCommand3);
|
|
12583
12766
|
|
|
12584
12767
|
// src/commands/variable/index.ts
|
|
12585
|
-
import { Command as
|
|
12768
|
+
import { Command as Command61 } from "commander";
|
|
12586
12769
|
|
|
12587
12770
|
// src/commands/variable/list.ts
|
|
12588
|
-
import { Command as
|
|
12589
|
-
import
|
|
12771
|
+
import { Command as Command58 } from "commander";
|
|
12772
|
+
import chalk60 from "chalk";
|
|
12590
12773
|
function truncateValue(value, maxLength = 60) {
|
|
12591
12774
|
if (value.length <= maxLength) {
|
|
12592
12775
|
return value;
|
|
12593
12776
|
}
|
|
12594
12777
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
12595
12778
|
}
|
|
12596
|
-
var listCommand7 = new
|
|
12779
|
+
var listCommand7 = new Command58().name("list").alias("ls").description("List all variables").action(
|
|
12597
12780
|
withErrorHandler(async () => {
|
|
12598
12781
|
const result = await listVariables();
|
|
12599
12782
|
if (result.variables.length === 0) {
|
|
12600
|
-
console.log(
|
|
12783
|
+
console.log(chalk60.dim("No variables found"));
|
|
12601
12784
|
console.log();
|
|
12602
12785
|
console.log("To add a variable:");
|
|
12603
|
-
console.log(
|
|
12786
|
+
console.log(chalk60.cyan(" vm0 variable set MY_VAR <value>"));
|
|
12604
12787
|
return;
|
|
12605
12788
|
}
|
|
12606
|
-
console.log(
|
|
12789
|
+
console.log(chalk60.bold("Variables:"));
|
|
12607
12790
|
console.log();
|
|
12608
12791
|
for (const variable of result.variables) {
|
|
12609
12792
|
const displayValue = truncateValue(variable.value);
|
|
12610
|
-
console.log(` ${
|
|
12793
|
+
console.log(` ${chalk60.cyan(variable.name)} = ${displayValue}`);
|
|
12611
12794
|
if (variable.description) {
|
|
12612
|
-
console.log(` ${
|
|
12795
|
+
console.log(` ${chalk60.dim(variable.description)}`);
|
|
12613
12796
|
}
|
|
12614
12797
|
console.log(
|
|
12615
|
-
` ${
|
|
12798
|
+
` ${chalk60.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
12616
12799
|
);
|
|
12617
12800
|
console.log();
|
|
12618
12801
|
}
|
|
12619
|
-
console.log(
|
|
12802
|
+
console.log(chalk60.dim(`Total: ${result.variables.length} variable(s)`));
|
|
12620
12803
|
})
|
|
12621
12804
|
);
|
|
12622
12805
|
|
|
12623
12806
|
// src/commands/variable/set.ts
|
|
12624
|
-
import { Command as
|
|
12625
|
-
import
|
|
12626
|
-
var setCommand3 = new
|
|
12807
|
+
import { Command as Command59 } from "commander";
|
|
12808
|
+
import chalk61 from "chalk";
|
|
12809
|
+
var setCommand3 = new Command59().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(
|
|
12627
12810
|
async (name, value, options) => {
|
|
12628
12811
|
try {
|
|
12629
12812
|
const variable = await setVariable({
|
|
@@ -12631,29 +12814,29 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12631
12814
|
value,
|
|
12632
12815
|
description: options.description
|
|
12633
12816
|
});
|
|
12634
|
-
console.log(
|
|
12817
|
+
console.log(chalk61.green(`\u2713 Variable "${variable.name}" saved`));
|
|
12635
12818
|
console.log();
|
|
12636
12819
|
console.log("Use in vm0.yaml:");
|
|
12637
|
-
console.log(
|
|
12638
|
-
console.log(
|
|
12820
|
+
console.log(chalk61.cyan(` environment:`));
|
|
12821
|
+
console.log(chalk61.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
12639
12822
|
} catch (error) {
|
|
12640
12823
|
if (error instanceof Error) {
|
|
12641
12824
|
if (error.message.includes("Not authenticated")) {
|
|
12642
12825
|
console.error(
|
|
12643
|
-
|
|
12826
|
+
chalk61.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12644
12827
|
);
|
|
12645
12828
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12646
|
-
console.error(
|
|
12829
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
12647
12830
|
console.error();
|
|
12648
12831
|
console.error("Examples of valid variable names:");
|
|
12649
|
-
console.error(
|
|
12650
|
-
console.error(
|
|
12651
|
-
console.error(
|
|
12832
|
+
console.error(chalk61.dim(" MY_VAR"));
|
|
12833
|
+
console.error(chalk61.dim(" API_URL"));
|
|
12834
|
+
console.error(chalk61.dim(" DEBUG_MODE"));
|
|
12652
12835
|
} else {
|
|
12653
|
-
console.error(
|
|
12836
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
12654
12837
|
}
|
|
12655
12838
|
} else {
|
|
12656
|
-
console.error(
|
|
12839
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
12657
12840
|
}
|
|
12658
12841
|
process.exit(1);
|
|
12659
12842
|
}
|
|
@@ -12661,15 +12844,15 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12661
12844
|
);
|
|
12662
12845
|
|
|
12663
12846
|
// src/commands/variable/delete.ts
|
|
12664
|
-
import { Command as
|
|
12665
|
-
import
|
|
12666
|
-
var
|
|
12847
|
+
import { Command as Command60 } from "commander";
|
|
12848
|
+
import chalk62 from "chalk";
|
|
12849
|
+
var deleteCommand4 = new Command60().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12667
12850
|
try {
|
|
12668
12851
|
try {
|
|
12669
12852
|
await getVariable(name);
|
|
12670
12853
|
} catch (error) {
|
|
12671
12854
|
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
12672
|
-
console.error(
|
|
12855
|
+
console.error(chalk62.red(`\u2717 Variable "${name}" not found`));
|
|
12673
12856
|
process.exit(1);
|
|
12674
12857
|
}
|
|
12675
12858
|
throw error;
|
|
@@ -12677,7 +12860,7 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12677
12860
|
if (!options.yes) {
|
|
12678
12861
|
if (!isInteractive()) {
|
|
12679
12862
|
console.error(
|
|
12680
|
-
|
|
12863
|
+
chalk62.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12681
12864
|
);
|
|
12682
12865
|
process.exit(1);
|
|
12683
12866
|
}
|
|
@@ -12686,43 +12869,43 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12686
12869
|
false
|
|
12687
12870
|
);
|
|
12688
12871
|
if (!confirmed) {
|
|
12689
|
-
console.log(
|
|
12872
|
+
console.log(chalk62.dim("Cancelled"));
|
|
12690
12873
|
return;
|
|
12691
12874
|
}
|
|
12692
12875
|
}
|
|
12693
12876
|
await deleteVariable(name);
|
|
12694
|
-
console.log(
|
|
12877
|
+
console.log(chalk62.green(`\u2713 Variable "${name}" deleted`));
|
|
12695
12878
|
} catch (error) {
|
|
12696
12879
|
if (error instanceof Error) {
|
|
12697
12880
|
if (error.message.includes("Not authenticated")) {
|
|
12698
|
-
console.error(
|
|
12881
|
+
console.error(chalk62.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12699
12882
|
} else {
|
|
12700
|
-
console.error(
|
|
12883
|
+
console.error(chalk62.red(`\u2717 ${error.message}`));
|
|
12701
12884
|
}
|
|
12702
12885
|
} else {
|
|
12703
|
-
console.error(
|
|
12886
|
+
console.error(chalk62.red("\u2717 An unexpected error occurred"));
|
|
12704
12887
|
}
|
|
12705
12888
|
process.exit(1);
|
|
12706
12889
|
}
|
|
12707
12890
|
});
|
|
12708
12891
|
|
|
12709
12892
|
// src/commands/variable/index.ts
|
|
12710
|
-
var variableCommand = new
|
|
12893
|
+
var variableCommand = new Command61().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand7).addCommand(setCommand3).addCommand(deleteCommand4);
|
|
12711
12894
|
|
|
12712
12895
|
// src/commands/model-provider/index.ts
|
|
12713
|
-
import { Command as
|
|
12896
|
+
import { Command as Command66 } from "commander";
|
|
12714
12897
|
|
|
12715
12898
|
// src/commands/model-provider/list.ts
|
|
12716
|
-
import { Command as
|
|
12717
|
-
import
|
|
12718
|
-
var listCommand8 = new
|
|
12899
|
+
import { Command as Command62 } from "commander";
|
|
12900
|
+
import chalk63 from "chalk";
|
|
12901
|
+
var listCommand8 = new Command62().name("list").alias("ls").description("List all model providers").action(
|
|
12719
12902
|
withErrorHandler(async () => {
|
|
12720
12903
|
const result = await listModelProviders();
|
|
12721
12904
|
if (result.modelProviders.length === 0) {
|
|
12722
|
-
console.log(
|
|
12905
|
+
console.log(chalk63.dim("No model providers configured"));
|
|
12723
12906
|
console.log();
|
|
12724
12907
|
console.log("To add a model provider:");
|
|
12725
|
-
console.log(
|
|
12908
|
+
console.log(chalk63.cyan(" vm0 model-provider setup"));
|
|
12726
12909
|
return;
|
|
12727
12910
|
}
|
|
12728
12911
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -12736,16 +12919,16 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12736
12919
|
},
|
|
12737
12920
|
{}
|
|
12738
12921
|
);
|
|
12739
|
-
console.log(
|
|
12922
|
+
console.log(chalk63.bold("Model Providers:"));
|
|
12740
12923
|
console.log();
|
|
12741
12924
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
12742
|
-
console.log(` ${
|
|
12925
|
+
console.log(` ${chalk63.cyan(framework)}:`);
|
|
12743
12926
|
for (const provider of providers) {
|
|
12744
|
-
const defaultTag = provider.isDefault ?
|
|
12745
|
-
const modelTag = provider.selectedModel ?
|
|
12927
|
+
const defaultTag = provider.isDefault ? chalk63.green(" (default)") : "";
|
|
12928
|
+
const modelTag = provider.selectedModel ? chalk63.dim(` [${provider.selectedModel}]`) : "";
|
|
12746
12929
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
12747
12930
|
console.log(
|
|
12748
|
-
|
|
12931
|
+
chalk63.dim(
|
|
12749
12932
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
12750
12933
|
)
|
|
12751
12934
|
);
|
|
@@ -12753,22 +12936,22 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12753
12936
|
console.log();
|
|
12754
12937
|
}
|
|
12755
12938
|
console.log(
|
|
12756
|
-
|
|
12939
|
+
chalk63.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
12757
12940
|
);
|
|
12758
12941
|
})
|
|
12759
12942
|
);
|
|
12760
12943
|
|
|
12761
12944
|
// src/commands/model-provider/setup.ts
|
|
12762
|
-
import { Command as
|
|
12763
|
-
import
|
|
12945
|
+
import { Command as Command63 } from "commander";
|
|
12946
|
+
import chalk64 from "chalk";
|
|
12764
12947
|
import prompts2 from "prompts";
|
|
12765
12948
|
function validateProviderType(typeStr) {
|
|
12766
12949
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
12767
|
-
console.error(
|
|
12950
|
+
console.error(chalk64.red(`\u2717 Invalid type "${typeStr}"`));
|
|
12768
12951
|
console.error();
|
|
12769
12952
|
console.error("Valid types:");
|
|
12770
12953
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12771
|
-
console.error(` ${
|
|
12954
|
+
console.error(` ${chalk64.cyan(t)} - ${config.label}`);
|
|
12772
12955
|
}
|
|
12773
12956
|
process.exit(1);
|
|
12774
12957
|
}
|
|
@@ -12780,11 +12963,11 @@ function validateModel(type2, modelStr) {
|
|
|
12780
12963
|
return modelStr;
|
|
12781
12964
|
}
|
|
12782
12965
|
if (models && !models.includes(modelStr)) {
|
|
12783
|
-
console.error(
|
|
12966
|
+
console.error(chalk64.red(`\u2717 Invalid model "${modelStr}"`));
|
|
12784
12967
|
console.error();
|
|
12785
12968
|
console.error("Valid models:");
|
|
12786
12969
|
for (const m of models) {
|
|
12787
|
-
console.error(` ${
|
|
12970
|
+
console.error(` ${chalk64.cyan(m)}`);
|
|
12788
12971
|
}
|
|
12789
12972
|
process.exit(1);
|
|
12790
12973
|
}
|
|
@@ -12793,12 +12976,12 @@ function validateModel(type2, modelStr) {
|
|
|
12793
12976
|
function validateAuthMethod(type2, authMethodStr) {
|
|
12794
12977
|
const authMethods = getAuthMethodsForType(type2);
|
|
12795
12978
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
12796
|
-
console.error(
|
|
12979
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
12797
12980
|
console.error();
|
|
12798
12981
|
console.error("Valid auth methods:");
|
|
12799
12982
|
if (authMethods) {
|
|
12800
12983
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12801
|
-
console.error(` ${
|
|
12984
|
+
console.error(` ${chalk64.cyan(method)} - ${config.label}`);
|
|
12802
12985
|
}
|
|
12803
12986
|
}
|
|
12804
12987
|
process.exit(1);
|
|
@@ -12808,7 +12991,7 @@ function validateAuthMethod(type2, authMethodStr) {
|
|
|
12808
12991
|
function parseSecrets(type2, authMethod, secretArgs) {
|
|
12809
12992
|
const secretsConfig = getSecretsForAuthMethod(type2, authMethod);
|
|
12810
12993
|
if (!secretsConfig) {
|
|
12811
|
-
console.error(
|
|
12994
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12812
12995
|
process.exit(1);
|
|
12813
12996
|
}
|
|
12814
12997
|
const secretNames = Object.keys(secretsConfig);
|
|
@@ -12816,19 +12999,19 @@ function parseSecrets(type2, authMethod, secretArgs) {
|
|
|
12816
12999
|
if (secretArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
12817
13000
|
if (secretNames.length !== 1) {
|
|
12818
13001
|
console.error(
|
|
12819
|
-
|
|
13002
|
+
chalk64.red("\u2717 Must use KEY=VALUE format for multi-secret auth methods")
|
|
12820
13003
|
);
|
|
12821
13004
|
console.error();
|
|
12822
13005
|
console.error("Required secrets:");
|
|
12823
13006
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12824
13007
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
12825
|
-
console.error(` ${
|
|
13008
|
+
console.error(` ${chalk64.cyan(name)}${requiredNote}`);
|
|
12826
13009
|
}
|
|
12827
13010
|
process.exit(1);
|
|
12828
13011
|
}
|
|
12829
13012
|
const firstSecretName = secretNames[0];
|
|
12830
13013
|
if (!firstSecretName) {
|
|
12831
|
-
console.error(
|
|
13014
|
+
console.error(chalk64.red("\u2717 No secrets defined for this auth method"));
|
|
12832
13015
|
process.exit(1);
|
|
12833
13016
|
}
|
|
12834
13017
|
return { [firstSecretName]: firstArg };
|
|
@@ -12837,7 +13020,7 @@ function parseSecrets(type2, authMethod, secretArgs) {
|
|
|
12837
13020
|
for (const arg of secretArgs) {
|
|
12838
13021
|
const eqIndex = arg.indexOf("=");
|
|
12839
13022
|
if (eqIndex === -1) {
|
|
12840
|
-
console.error(
|
|
13023
|
+
console.error(chalk64.red(`\u2717 Invalid secret format "${arg}"`));
|
|
12841
13024
|
console.error();
|
|
12842
13025
|
console.error("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
12843
13026
|
process.exit(1);
|
|
@@ -12851,17 +13034,17 @@ function parseSecrets(type2, authMethod, secretArgs) {
|
|
|
12851
13034
|
function validateSecrets(type2, authMethod, secrets) {
|
|
12852
13035
|
const secretsConfig = getSecretsForAuthMethod(type2, authMethod);
|
|
12853
13036
|
if (!secretsConfig) {
|
|
12854
|
-
console.error(
|
|
13037
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12855
13038
|
process.exit(1);
|
|
12856
13039
|
}
|
|
12857
13040
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12858
13041
|
if (fieldConfig.required && !secrets[name]) {
|
|
12859
|
-
console.error(
|
|
13042
|
+
console.error(chalk64.red(`\u2717 Missing required secret: ${name}`));
|
|
12860
13043
|
console.error();
|
|
12861
13044
|
console.error("Required secrets:");
|
|
12862
13045
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12863
13046
|
if (fc.required) {
|
|
12864
|
-
console.error(` ${
|
|
13047
|
+
console.error(` ${chalk64.cyan(n)} - ${fc.label}`);
|
|
12865
13048
|
}
|
|
12866
13049
|
}
|
|
12867
13050
|
process.exit(1);
|
|
@@ -12869,12 +13052,12 @@ function validateSecrets(type2, authMethod, secrets) {
|
|
|
12869
13052
|
}
|
|
12870
13053
|
for (const name of Object.keys(secrets)) {
|
|
12871
13054
|
if (!(name in secretsConfig)) {
|
|
12872
|
-
console.error(
|
|
13055
|
+
console.error(chalk64.red(`\u2717 Unknown secret: ${name}`));
|
|
12873
13056
|
console.error();
|
|
12874
13057
|
console.error("Valid secrets:");
|
|
12875
13058
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12876
13059
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
12877
|
-
console.error(` ${
|
|
13060
|
+
console.error(` ${chalk64.cyan(n)}${requiredNote}`);
|
|
12878
13061
|
}
|
|
12879
13062
|
process.exit(1);
|
|
12880
13063
|
}
|
|
@@ -12897,7 +13080,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12897
13080
|
const defaultAuthMethod = getDefaultAuthMethod(type2);
|
|
12898
13081
|
const authMethods = getAuthMethodsForType(type2);
|
|
12899
13082
|
if (!defaultAuthMethod || !authMethods) {
|
|
12900
|
-
console.error(
|
|
13083
|
+
console.error(chalk64.red(`\u2717 Provider "${type2}" requires --auth-method`));
|
|
12901
13084
|
process.exit(1);
|
|
12902
13085
|
}
|
|
12903
13086
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -12905,7 +13088,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12905
13088
|
authMethod = authMethodNames[0];
|
|
12906
13089
|
} else {
|
|
12907
13090
|
console.error(
|
|
12908
|
-
|
|
13091
|
+
chalk64.red(
|
|
12909
13092
|
`\u2717 --auth-method is required for "${type2}" (multiple auth methods available)`
|
|
12910
13093
|
)
|
|
12911
13094
|
);
|
|
@@ -12914,13 +13097,13 @@ function handleNonInteractiveMode(options) {
|
|
|
12914
13097
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12915
13098
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
12916
13099
|
console.error(
|
|
12917
|
-
` ${
|
|
13100
|
+
` ${chalk64.cyan(method)} - ${config.label}${defaultNote}`
|
|
12918
13101
|
);
|
|
12919
13102
|
}
|
|
12920
13103
|
console.error();
|
|
12921
13104
|
console.error("Example:");
|
|
12922
13105
|
console.error(
|
|
12923
|
-
|
|
13106
|
+
chalk64.cyan(
|
|
12924
13107
|
` vm0 model-provider setup --type ${type2} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`
|
|
12925
13108
|
)
|
|
12926
13109
|
);
|
|
@@ -12940,7 +13123,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12940
13123
|
const secretArgs = options.secret;
|
|
12941
13124
|
const firstArg = secretArgs[0];
|
|
12942
13125
|
if (!firstArg) {
|
|
12943
|
-
console.error(
|
|
13126
|
+
console.error(chalk64.red("\u2717 Secret is required"));
|
|
12944
13127
|
process.exit(1);
|
|
12945
13128
|
}
|
|
12946
13129
|
let secret;
|
|
@@ -12989,7 +13172,7 @@ async function promptForModelSelection(type2) {
|
|
|
12989
13172
|
if (selected === "__custom__") {
|
|
12990
13173
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
12991
13174
|
if (placeholder) {
|
|
12992
|
-
console.log(
|
|
13175
|
+
console.log(chalk64.dim(`Example: ${placeholder}`));
|
|
12993
13176
|
}
|
|
12994
13177
|
const customResponse = await prompts2(
|
|
12995
13178
|
{
|
|
@@ -13034,13 +13217,13 @@ function isSensitiveSecret(name) {
|
|
|
13034
13217
|
async function promptForSecrets(type2, authMethod) {
|
|
13035
13218
|
const secretsConfig = getSecretsForAuthMethod(type2, authMethod);
|
|
13036
13219
|
if (!secretsConfig) {
|
|
13037
|
-
console.error(
|
|
13220
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
13038
13221
|
process.exit(1);
|
|
13039
13222
|
}
|
|
13040
13223
|
const secrets = {};
|
|
13041
13224
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
13042
13225
|
if (fieldConfig.helpText) {
|
|
13043
|
-
console.log(
|
|
13226
|
+
console.log(chalk64.dim(fieldConfig.helpText));
|
|
13044
13227
|
}
|
|
13045
13228
|
const isSensitive = isSensitiveSecret(name);
|
|
13046
13229
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -13075,11 +13258,11 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
13075
13258
|
}
|
|
13076
13259
|
async function handleInteractiveMode() {
|
|
13077
13260
|
if (!isInteractive()) {
|
|
13078
|
-
console.error(
|
|
13261
|
+
console.error(chalk64.red("\u2717 Interactive mode requires a TTY"));
|
|
13079
13262
|
console.error();
|
|
13080
13263
|
console.error("Use non-interactive mode:");
|
|
13081
13264
|
console.error(
|
|
13082
|
-
|
|
13265
|
+
chalk64.cyan(' vm0 model-provider setup --type <type> --secret "<value>"')
|
|
13083
13266
|
);
|
|
13084
13267
|
process.exit(1);
|
|
13085
13268
|
}
|
|
@@ -13094,7 +13277,7 @@ async function handleInteractiveMode() {
|
|
|
13094
13277
|
title = `${title} \u2713`;
|
|
13095
13278
|
}
|
|
13096
13279
|
if (isExperimental) {
|
|
13097
|
-
title = `${title} ${
|
|
13280
|
+
title = `${title} ${chalk64.dim("(experimental)")}`;
|
|
13098
13281
|
}
|
|
13099
13282
|
return {
|
|
13100
13283
|
title,
|
|
@@ -13141,7 +13324,7 @@ async function handleInteractiveMode() {
|
|
|
13141
13324
|
}
|
|
13142
13325
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
13143
13326
|
console.log();
|
|
13144
|
-
console.log(
|
|
13327
|
+
console.log(chalk64.dim(config.helpText));
|
|
13145
13328
|
console.log();
|
|
13146
13329
|
if (hasAuthMethods(type2)) {
|
|
13147
13330
|
const authMethod = await promptForAuthMethod(type2);
|
|
@@ -13182,13 +13365,13 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
13182
13365
|
);
|
|
13183
13366
|
if (response.setDefault) {
|
|
13184
13367
|
await setModelProviderDefault(type2);
|
|
13185
|
-
console.log(
|
|
13368
|
+
console.log(chalk64.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
13186
13369
|
}
|
|
13187
13370
|
}
|
|
13188
13371
|
function collectSecrets(value, previous) {
|
|
13189
13372
|
return previous.concat([value]);
|
|
13190
13373
|
}
|
|
13191
|
-
var setupCommand2 = new
|
|
13374
|
+
var setupCommand2 = new Command63().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
13192
13375
|
"-s, --secret <value>",
|
|
13193
13376
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
13194
13377
|
collectSecrets,
|
|
@@ -13209,7 +13392,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13209
13392
|
model: options.model
|
|
13210
13393
|
});
|
|
13211
13394
|
} else if (options.type || secretArgs.length > 0) {
|
|
13212
|
-
console.error(
|
|
13395
|
+
console.error(chalk64.red("\u2717 Both --type and --secret are required"));
|
|
13213
13396
|
process.exit(1);
|
|
13214
13397
|
} else {
|
|
13215
13398
|
const result = await handleInteractiveMode();
|
|
@@ -13227,11 +13410,11 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13227
13410
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
13228
13411
|
if (!hasModelSelection(input.type)) {
|
|
13229
13412
|
console.log(
|
|
13230
|
-
|
|
13413
|
+
chalk64.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
13231
13414
|
);
|
|
13232
13415
|
} else {
|
|
13233
13416
|
console.log(
|
|
13234
|
-
|
|
13417
|
+
chalk64.green(
|
|
13235
13418
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
13236
13419
|
)
|
|
13237
13420
|
);
|
|
@@ -13256,7 +13439,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13256
13439
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
13257
13440
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
13258
13441
|
console.log(
|
|
13259
|
-
|
|
13442
|
+
chalk64.green(
|
|
13260
13443
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
13261
13444
|
)
|
|
13262
13445
|
);
|
|
@@ -13272,82 +13455,82 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13272
13455
|
);
|
|
13273
13456
|
|
|
13274
13457
|
// src/commands/model-provider/delete.ts
|
|
13275
|
-
import { Command as
|
|
13276
|
-
import
|
|
13277
|
-
var
|
|
13458
|
+
import { Command as Command64 } from "commander";
|
|
13459
|
+
import chalk65 from "chalk";
|
|
13460
|
+
var deleteCommand5 = new Command64().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type2) => {
|
|
13278
13461
|
try {
|
|
13279
13462
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
13280
|
-
console.error(
|
|
13463
|
+
console.error(chalk65.red(`\u2717 Invalid type "${type2}"`));
|
|
13281
13464
|
console.log();
|
|
13282
13465
|
console.log("Valid types:");
|
|
13283
13466
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13284
|
-
console.log(` ${
|
|
13467
|
+
console.log(` ${chalk65.cyan(t)} - ${config.label}`);
|
|
13285
13468
|
}
|
|
13286
13469
|
process.exit(1);
|
|
13287
13470
|
}
|
|
13288
13471
|
await deleteModelProvider(type2);
|
|
13289
|
-
console.log(
|
|
13472
|
+
console.log(chalk65.green(`\u2713 Model provider "${type2}" deleted`));
|
|
13290
13473
|
} catch (error) {
|
|
13291
13474
|
if (error instanceof Error) {
|
|
13292
13475
|
if (error.message.includes("not found")) {
|
|
13293
|
-
console.error(
|
|
13476
|
+
console.error(chalk65.red(`\u2717 Model provider "${type2}" not found`));
|
|
13294
13477
|
} else if (error.message.includes("Not authenticated")) {
|
|
13295
|
-
console.error(
|
|
13478
|
+
console.error(chalk65.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13296
13479
|
} else {
|
|
13297
|
-
console.error(
|
|
13480
|
+
console.error(chalk65.red(`\u2717 ${error.message}`));
|
|
13298
13481
|
}
|
|
13299
13482
|
} else {
|
|
13300
|
-
console.error(
|
|
13483
|
+
console.error(chalk65.red("\u2717 An unexpected error occurred"));
|
|
13301
13484
|
}
|
|
13302
13485
|
process.exit(1);
|
|
13303
13486
|
}
|
|
13304
13487
|
});
|
|
13305
13488
|
|
|
13306
13489
|
// src/commands/model-provider/set-default.ts
|
|
13307
|
-
import { Command as
|
|
13308
|
-
import
|
|
13309
|
-
var setDefaultCommand = new
|
|
13490
|
+
import { Command as Command65 } from "commander";
|
|
13491
|
+
import chalk66 from "chalk";
|
|
13492
|
+
var setDefaultCommand = new Command65().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type2) => {
|
|
13310
13493
|
try {
|
|
13311
13494
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
13312
|
-
console.error(
|
|
13495
|
+
console.error(chalk66.red(`\u2717 Invalid type "${type2}"`));
|
|
13313
13496
|
console.log();
|
|
13314
13497
|
console.log("Valid types:");
|
|
13315
13498
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13316
|
-
console.log(` ${
|
|
13499
|
+
console.log(` ${chalk66.cyan(t)} - ${config.label}`);
|
|
13317
13500
|
}
|
|
13318
13501
|
process.exit(1);
|
|
13319
13502
|
}
|
|
13320
13503
|
const provider = await setModelProviderDefault(type2);
|
|
13321
13504
|
console.log(
|
|
13322
|
-
|
|
13505
|
+
chalk66.green(
|
|
13323
13506
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
13324
13507
|
)
|
|
13325
13508
|
);
|
|
13326
13509
|
} catch (error) {
|
|
13327
13510
|
if (error instanceof Error) {
|
|
13328
13511
|
if (error.message.includes("not found")) {
|
|
13329
|
-
console.error(
|
|
13512
|
+
console.error(chalk66.red(`\u2717 Model provider "${type2}" not found`));
|
|
13330
13513
|
} else if (error.message.includes("Not authenticated")) {
|
|
13331
|
-
console.error(
|
|
13514
|
+
console.error(chalk66.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13332
13515
|
} else {
|
|
13333
|
-
console.error(
|
|
13516
|
+
console.error(chalk66.red(`\u2717 ${error.message}`));
|
|
13334
13517
|
}
|
|
13335
13518
|
} else {
|
|
13336
|
-
console.error(
|
|
13519
|
+
console.error(chalk66.red("\u2717 An unexpected error occurred"));
|
|
13337
13520
|
}
|
|
13338
13521
|
process.exit(1);
|
|
13339
13522
|
}
|
|
13340
13523
|
});
|
|
13341
13524
|
|
|
13342
13525
|
// src/commands/model-provider/index.ts
|
|
13343
|
-
var modelProviderCommand = new
|
|
13526
|
+
var modelProviderCommand = new Command66().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand5).addCommand(setDefaultCommand);
|
|
13344
13527
|
|
|
13345
13528
|
// src/commands/connector/index.ts
|
|
13346
|
-
import { Command as
|
|
13529
|
+
import { Command as Command71 } from "commander";
|
|
13347
13530
|
|
|
13348
13531
|
// src/commands/connector/connect.ts
|
|
13349
|
-
import { Command as
|
|
13350
|
-
import
|
|
13532
|
+
import { Command as Command67 } from "commander";
|
|
13533
|
+
import chalk67 from "chalk";
|
|
13351
13534
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
13352
13535
|
function delay2(ms) {
|
|
13353
13536
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -13366,18 +13549,18 @@ async function getHeaders2() {
|
|
|
13366
13549
|
}
|
|
13367
13550
|
return headers;
|
|
13368
13551
|
}
|
|
13369
|
-
var connectCommand = new
|
|
13552
|
+
var connectCommand = new Command67().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type2) => {
|
|
13370
13553
|
try {
|
|
13371
13554
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13372
13555
|
if (!parseResult.success) {
|
|
13373
|
-
console.error(
|
|
13556
|
+
console.error(chalk67.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13374
13557
|
console.error("Available connectors: github");
|
|
13375
13558
|
process.exit(1);
|
|
13376
13559
|
}
|
|
13377
13560
|
const connectorType = parseResult.data;
|
|
13378
13561
|
const apiUrl = await getApiUrl();
|
|
13379
13562
|
const headers = await getHeaders2();
|
|
13380
|
-
console.log(`Connecting ${
|
|
13563
|
+
console.log(`Connecting ${chalk67.cyan(type2)}...`);
|
|
13381
13564
|
const sessionsClient = initClient12(connectorSessionsContract, {
|
|
13382
13565
|
baseUrl: apiUrl,
|
|
13383
13566
|
baseHeaders: headers,
|
|
@@ -13390,14 +13573,14 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13390
13573
|
if (createResult.status !== 200) {
|
|
13391
13574
|
const errorBody = createResult.body;
|
|
13392
13575
|
console.error(
|
|
13393
|
-
|
|
13576
|
+
chalk67.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
|
|
13394
13577
|
);
|
|
13395
13578
|
process.exit(1);
|
|
13396
13579
|
}
|
|
13397
13580
|
const session = createResult.body;
|
|
13398
13581
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13399
|
-
console.log(
|
|
13400
|
-
console.log(
|
|
13582
|
+
console.log(chalk67.green("\nSession created"));
|
|
13583
|
+
console.log(chalk67.cyan(`
|
|
13401
13584
|
To connect, visit: ${verificationUrl}`));
|
|
13402
13585
|
console.log(
|
|
13403
13586
|
`
|
|
@@ -13424,7 +13607,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13424
13607
|
if (statusResult.status !== 200) {
|
|
13425
13608
|
const errorBody = statusResult.body;
|
|
13426
13609
|
console.error(
|
|
13427
|
-
|
|
13610
|
+
chalk67.red(
|
|
13428
13611
|
`
|
|
13429
13612
|
\u2717 Failed to check status: ${errorBody.error?.message}`
|
|
13430
13613
|
)
|
|
@@ -13434,17 +13617,17 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13434
13617
|
const status = statusResult.body;
|
|
13435
13618
|
switch (status.status) {
|
|
13436
13619
|
case "complete":
|
|
13437
|
-
console.log(
|
|
13620
|
+
console.log(chalk67.green(`
|
|
13438
13621
|
|
|
13439
13622
|
${type2} connected successfully!`));
|
|
13440
13623
|
return;
|
|
13441
13624
|
case "expired":
|
|
13442
|
-
console.error(
|
|
13625
|
+
console.error(chalk67.red("\n\u2717 Session expired, please try again"));
|
|
13443
13626
|
process.exit(1);
|
|
13444
13627
|
break;
|
|
13445
13628
|
case "error":
|
|
13446
13629
|
console.error(
|
|
13447
|
-
|
|
13630
|
+
chalk67.red(
|
|
13448
13631
|
`
|
|
13449
13632
|
\u2717 Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13450
13633
|
)
|
|
@@ -13452,29 +13635,29 @@ ${type2} connected successfully!`));
|
|
|
13452
13635
|
process.exit(1);
|
|
13453
13636
|
break;
|
|
13454
13637
|
case "pending":
|
|
13455
|
-
process.stdout.write(
|
|
13638
|
+
process.stdout.write(chalk67.dim("."));
|
|
13456
13639
|
break;
|
|
13457
13640
|
}
|
|
13458
13641
|
}
|
|
13459
|
-
console.error(
|
|
13642
|
+
console.error(chalk67.red("\n\u2717 Session timed out, please try again"));
|
|
13460
13643
|
process.exit(1);
|
|
13461
13644
|
} catch (error) {
|
|
13462
13645
|
if (error instanceof Error) {
|
|
13463
|
-
console.error(
|
|
13646
|
+
console.error(chalk67.red(`\u2717 ${error.message}`));
|
|
13464
13647
|
if (error.cause instanceof Error) {
|
|
13465
|
-
console.error(
|
|
13648
|
+
console.error(chalk67.dim(` Cause: ${error.cause.message}`));
|
|
13466
13649
|
}
|
|
13467
13650
|
} else {
|
|
13468
|
-
console.error(
|
|
13651
|
+
console.error(chalk67.red("\u2717 An unexpected error occurred"));
|
|
13469
13652
|
}
|
|
13470
13653
|
process.exit(1);
|
|
13471
13654
|
}
|
|
13472
13655
|
});
|
|
13473
13656
|
|
|
13474
13657
|
// src/commands/connector/list.ts
|
|
13475
|
-
import { Command as
|
|
13476
|
-
import
|
|
13477
|
-
var listCommand9 = new
|
|
13658
|
+
import { Command as Command68 } from "commander";
|
|
13659
|
+
import chalk68 from "chalk";
|
|
13660
|
+
var listCommand9 = new Command68().name("list").alias("ls").description("List all connectors and their status").action(
|
|
13478
13661
|
withErrorHandler(async () => {
|
|
13479
13662
|
const result = await listConnectors();
|
|
13480
13663
|
const connectedMap = new Map(result.connectors.map((c24) => [c24.type, c24]));
|
|
@@ -13487,42 +13670,42 @@ var listCommand9 = new Command67().name("list").alias("ls").description("List al
|
|
|
13487
13670
|
statusText.padEnd(statusWidth),
|
|
13488
13671
|
"ACCOUNT"
|
|
13489
13672
|
].join(" ");
|
|
13490
|
-
console.log(
|
|
13673
|
+
console.log(chalk68.dim(header));
|
|
13491
13674
|
for (const type2 of allTypes) {
|
|
13492
13675
|
const connector = connectedMap.get(type2);
|
|
13493
|
-
const status = connector ?
|
|
13494
|
-
const account = connector?.externalUsername ? `@${connector.externalUsername}` :
|
|
13676
|
+
const status = connector ? chalk68.green("\u2713".padEnd(statusWidth)) : chalk68.dim("-".padEnd(statusWidth));
|
|
13677
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk68.dim("-");
|
|
13495
13678
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
13496
13679
|
console.log(row);
|
|
13497
13680
|
}
|
|
13498
13681
|
console.log();
|
|
13499
|
-
console.log(
|
|
13500
|
-
console.log(
|
|
13682
|
+
console.log(chalk68.dim("To connect a service:"));
|
|
13683
|
+
console.log(chalk68.dim(" vm0 connector connect <type>"));
|
|
13501
13684
|
})
|
|
13502
13685
|
);
|
|
13503
13686
|
|
|
13504
13687
|
// src/commands/connector/status.ts
|
|
13505
|
-
import { Command as
|
|
13506
|
-
import
|
|
13688
|
+
import { Command as Command69 } from "commander";
|
|
13689
|
+
import chalk69 from "chalk";
|
|
13507
13690
|
var LABEL_WIDTH = 16;
|
|
13508
|
-
var statusCommand7 = new
|
|
13691
|
+
var statusCommand7 = new Command69().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
13509
13692
|
withErrorHandler(async (type2) => {
|
|
13510
13693
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13511
13694
|
if (!parseResult.success) {
|
|
13512
|
-
console.error(
|
|
13695
|
+
console.error(chalk69.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13513
13696
|
console.error();
|
|
13514
13697
|
console.error("Available connectors:");
|
|
13515
13698
|
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13516
|
-
console.error(` ${
|
|
13699
|
+
console.error(` ${chalk69.cyan(t)} - ${config.label}`);
|
|
13517
13700
|
}
|
|
13518
13701
|
process.exit(1);
|
|
13519
13702
|
}
|
|
13520
13703
|
const connector = await getConnector(parseResult.data);
|
|
13521
|
-
console.log(`Connector: ${
|
|
13704
|
+
console.log(`Connector: ${chalk69.cyan(type2)}`);
|
|
13522
13705
|
console.log();
|
|
13523
13706
|
if (connector) {
|
|
13524
13707
|
console.log(
|
|
13525
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
13708
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk69.green("connected")}`
|
|
13526
13709
|
);
|
|
13527
13710
|
console.log(
|
|
13528
13711
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -13544,78 +13727,78 @@ var statusCommand7 = new Command68().name("status").description("Show detailed s
|
|
|
13544
13727
|
);
|
|
13545
13728
|
}
|
|
13546
13729
|
console.log();
|
|
13547
|
-
console.log(
|
|
13548
|
-
console.log(
|
|
13730
|
+
console.log(chalk69.dim("To disconnect:"));
|
|
13731
|
+
console.log(chalk69.dim(` vm0 connector disconnect ${type2}`));
|
|
13549
13732
|
} else {
|
|
13550
13733
|
console.log(
|
|
13551
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
13734
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk69.dim("not connected")}`
|
|
13552
13735
|
);
|
|
13553
13736
|
console.log();
|
|
13554
|
-
console.log(
|
|
13555
|
-
console.log(
|
|
13737
|
+
console.log(chalk69.dim("To connect:"));
|
|
13738
|
+
console.log(chalk69.dim(` vm0 connector connect ${type2}`));
|
|
13556
13739
|
}
|
|
13557
13740
|
})
|
|
13558
13741
|
);
|
|
13559
13742
|
|
|
13560
13743
|
// src/commands/connector/disconnect.ts
|
|
13561
|
-
import { Command as
|
|
13562
|
-
import
|
|
13563
|
-
var disconnectCommand = new
|
|
13744
|
+
import { Command as Command70 } from "commander";
|
|
13745
|
+
import chalk70 from "chalk";
|
|
13746
|
+
var disconnectCommand = new Command70().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(async (type2) => {
|
|
13564
13747
|
try {
|
|
13565
13748
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13566
13749
|
if (!parseResult.success) {
|
|
13567
|
-
console.error(
|
|
13750
|
+
console.error(chalk70.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13568
13751
|
console.error();
|
|
13569
13752
|
console.error("Available connectors:");
|
|
13570
13753
|
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13571
|
-
console.error(` ${
|
|
13754
|
+
console.error(` ${chalk70.cyan(t)} - ${config.label}`);
|
|
13572
13755
|
}
|
|
13573
13756
|
process.exit(1);
|
|
13574
13757
|
}
|
|
13575
13758
|
await deleteConnector(parseResult.data);
|
|
13576
|
-
console.log(
|
|
13759
|
+
console.log(chalk70.green(`\u2713 Disconnected ${type2}`));
|
|
13577
13760
|
} catch (error) {
|
|
13578
13761
|
if (error instanceof Error) {
|
|
13579
13762
|
if (error.message.includes("not found")) {
|
|
13580
|
-
console.error(
|
|
13763
|
+
console.error(chalk70.red(`\u2717 Connector "${type2}" is not connected`));
|
|
13581
13764
|
} else if (error.message.includes("Not authenticated")) {
|
|
13582
|
-
console.error(
|
|
13765
|
+
console.error(chalk70.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13583
13766
|
} else {
|
|
13584
|
-
console.error(
|
|
13767
|
+
console.error(chalk70.red(`\u2717 ${error.message}`));
|
|
13585
13768
|
if (error.cause instanceof Error) {
|
|
13586
|
-
console.error(
|
|
13769
|
+
console.error(chalk70.dim(` Cause: ${error.cause.message}`));
|
|
13587
13770
|
}
|
|
13588
13771
|
}
|
|
13589
13772
|
} else {
|
|
13590
|
-
console.error(
|
|
13773
|
+
console.error(chalk70.red("\u2717 An unexpected error occurred"));
|
|
13591
13774
|
}
|
|
13592
13775
|
process.exit(1);
|
|
13593
13776
|
}
|
|
13594
13777
|
});
|
|
13595
13778
|
|
|
13596
13779
|
// src/commands/connector/index.ts
|
|
13597
|
-
var connectorCommand = new
|
|
13780
|
+
var connectorCommand = new Command71().name("connector").description("Manage third-party service connections").addCommand(listCommand9).addCommand(statusCommand7).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
13598
13781
|
|
|
13599
13782
|
// src/commands/onboard/index.ts
|
|
13600
|
-
import { Command as
|
|
13601
|
-
import
|
|
13783
|
+
import { Command as Command72 } from "commander";
|
|
13784
|
+
import chalk74 from "chalk";
|
|
13602
13785
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13603
13786
|
import { existsSync as existsSync12 } from "fs";
|
|
13604
13787
|
|
|
13605
13788
|
// src/lib/ui/welcome-box.ts
|
|
13606
|
-
import
|
|
13789
|
+
import chalk71 from "chalk";
|
|
13607
13790
|
var gradientColors = [
|
|
13608
|
-
|
|
13791
|
+
chalk71.hex("#FFAB5E"),
|
|
13609
13792
|
// Line 1 - lightest
|
|
13610
|
-
|
|
13793
|
+
chalk71.hex("#FF9642"),
|
|
13611
13794
|
// Line 2
|
|
13612
|
-
|
|
13795
|
+
chalk71.hex("#FF8228"),
|
|
13613
13796
|
// Line 3
|
|
13614
|
-
|
|
13797
|
+
chalk71.hex("#FF6D0A"),
|
|
13615
13798
|
// Line 4
|
|
13616
|
-
|
|
13799
|
+
chalk71.hex("#E85D00"),
|
|
13617
13800
|
// Line 5
|
|
13618
|
-
|
|
13801
|
+
chalk71.hex("#CC4E00")
|
|
13619
13802
|
// Line 6 - darkest
|
|
13620
13803
|
];
|
|
13621
13804
|
var vm0LogoLines = [
|
|
@@ -13637,15 +13820,15 @@ function renderVm0Banner() {
|
|
|
13637
13820
|
function renderOnboardWelcome() {
|
|
13638
13821
|
renderVm0Banner();
|
|
13639
13822
|
console.log(` Build agentic workflows using natural language.`);
|
|
13640
|
-
console.log(` ${
|
|
13823
|
+
console.log(` ${chalk71.dim("Currently in beta, enjoy it free")}`);
|
|
13641
13824
|
console.log(
|
|
13642
|
-
` ${
|
|
13825
|
+
` ${chalk71.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
13643
13826
|
);
|
|
13644
13827
|
console.log();
|
|
13645
13828
|
}
|
|
13646
13829
|
|
|
13647
13830
|
// src/lib/ui/step-runner.ts
|
|
13648
|
-
import
|
|
13831
|
+
import chalk72 from "chalk";
|
|
13649
13832
|
function createStepRunner(options = true) {
|
|
13650
13833
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
13651
13834
|
const interactive = opts.interactive ?? true;
|
|
@@ -13660,25 +13843,25 @@ function createStepRunner(options = true) {
|
|
|
13660
13843
|
}
|
|
13661
13844
|
for (const [i, step] of completedSteps.entries()) {
|
|
13662
13845
|
if (step.failed) {
|
|
13663
|
-
console.log(
|
|
13846
|
+
console.log(chalk72.red(`\u2717 ${step.label}`));
|
|
13664
13847
|
} else {
|
|
13665
|
-
console.log(
|
|
13848
|
+
console.log(chalk72.green(`\u25CF ${step.label}`));
|
|
13666
13849
|
}
|
|
13667
13850
|
const isLastStep = i === completedSteps.length - 1;
|
|
13668
13851
|
if (!isLastStep || !isFinal) {
|
|
13669
|
-
console.log(
|
|
13852
|
+
console.log(chalk72.dim("\u2502"));
|
|
13670
13853
|
}
|
|
13671
13854
|
}
|
|
13672
13855
|
}
|
|
13673
13856
|
async function executeStep(label, fn, isFinal) {
|
|
13674
13857
|
let stepFailed = false;
|
|
13675
|
-
console.log(
|
|
13858
|
+
console.log(chalk72.yellow(`\u25CB ${label}`));
|
|
13676
13859
|
const ctx = {
|
|
13677
13860
|
connector() {
|
|
13678
|
-
console.log(
|
|
13861
|
+
console.log(chalk72.dim("\u2502"));
|
|
13679
13862
|
},
|
|
13680
13863
|
detail(message) {
|
|
13681
|
-
console.log(`${
|
|
13864
|
+
console.log(`${chalk72.dim("\u2502")} ${message}`);
|
|
13682
13865
|
},
|
|
13683
13866
|
async prompt(promptFn) {
|
|
13684
13867
|
return await promptFn();
|
|
@@ -13695,12 +13878,12 @@ function createStepRunner(options = true) {
|
|
|
13695
13878
|
redrawCompletedSteps(isFinal);
|
|
13696
13879
|
} else {
|
|
13697
13880
|
if (stepFailed) {
|
|
13698
|
-
console.log(
|
|
13881
|
+
console.log(chalk72.red(`\u2717 ${label}`));
|
|
13699
13882
|
} else {
|
|
13700
|
-
console.log(
|
|
13883
|
+
console.log(chalk72.green(`\u25CF ${label}`));
|
|
13701
13884
|
}
|
|
13702
13885
|
if (!isFinal) {
|
|
13703
|
-
console.log(
|
|
13886
|
+
console.log(chalk72.dim("\u2502"));
|
|
13704
13887
|
}
|
|
13705
13888
|
}
|
|
13706
13889
|
}
|
|
@@ -13860,7 +14043,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
13860
14043
|
|
|
13861
14044
|
// src/lib/domain/onboard/claude-setup.ts
|
|
13862
14045
|
import { spawn as spawn3 } from "child_process";
|
|
13863
|
-
import
|
|
14046
|
+
import chalk73 from "chalk";
|
|
13864
14047
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
13865
14048
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
13866
14049
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -13897,12 +14080,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
13897
14080
|
}
|
|
13898
14081
|
function handlePluginError(error, context) {
|
|
13899
14082
|
const displayContext = context ?? "Claude plugin";
|
|
13900
|
-
console.error(
|
|
14083
|
+
console.error(chalk73.red(`\u2717 Failed to install ${displayContext}`));
|
|
13901
14084
|
if (error instanceof Error) {
|
|
13902
|
-
console.error(
|
|
14085
|
+
console.error(chalk73.red(`\u2717 ${error.message}`));
|
|
13903
14086
|
}
|
|
13904
14087
|
console.error(
|
|
13905
|
-
|
|
14088
|
+
chalk73.dim("Please ensure Claude CLI is installed and accessible.")
|
|
13906
14089
|
);
|
|
13907
14090
|
process.exit(1);
|
|
13908
14091
|
}
|
|
@@ -13945,7 +14128,7 @@ async function updateMarketplace() {
|
|
|
13945
14128
|
]);
|
|
13946
14129
|
if (!result.success) {
|
|
13947
14130
|
console.warn(
|
|
13948
|
-
|
|
14131
|
+
chalk73.yellow(
|
|
13949
14132
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
13950
14133
|
)
|
|
13951
14134
|
);
|
|
@@ -13983,7 +14166,7 @@ async function handleAuthentication(ctx) {
|
|
|
13983
14166
|
return;
|
|
13984
14167
|
}
|
|
13985
14168
|
if (!ctx.interactive) {
|
|
13986
|
-
console.error(
|
|
14169
|
+
console.error(chalk74.red("\u2717 Not authenticated"));
|
|
13987
14170
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
13988
14171
|
process.exit(1);
|
|
13989
14172
|
}
|
|
@@ -13991,19 +14174,19 @@ async function handleAuthentication(ctx) {
|
|
|
13991
14174
|
onInitiating: () => {
|
|
13992
14175
|
},
|
|
13993
14176
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
13994
|
-
step.detail(`Copy code: ${
|
|
13995
|
-
step.detail(`Open: ${
|
|
13996
|
-
step.detail(
|
|
14177
|
+
step.detail(`Copy code: ${chalk74.cyan.bold(code)}`);
|
|
14178
|
+
step.detail(`Open: ${chalk74.cyan(url)}`);
|
|
14179
|
+
step.detail(chalk74.dim(`Expires in ${expiresIn} minutes`));
|
|
13997
14180
|
},
|
|
13998
14181
|
onPolling: () => {
|
|
13999
14182
|
},
|
|
14000
14183
|
onSuccess: () => {
|
|
14001
14184
|
},
|
|
14002
14185
|
onError: (error) => {
|
|
14003
|
-
console.error(
|
|
14186
|
+
console.error(chalk74.red(`
|
|
14004
14187
|
\u2717 ${error.message}`));
|
|
14005
14188
|
if (error.cause instanceof Error) {
|
|
14006
|
-
console.error(
|
|
14189
|
+
console.error(chalk74.dim(` Cause: ${error.cause.message}`));
|
|
14007
14190
|
}
|
|
14008
14191
|
process.exit(1);
|
|
14009
14192
|
}
|
|
@@ -14017,7 +14200,7 @@ async function handleModelProvider(ctx) {
|
|
|
14017
14200
|
return;
|
|
14018
14201
|
}
|
|
14019
14202
|
if (!ctx.interactive) {
|
|
14020
|
-
console.error(
|
|
14203
|
+
console.error(chalk74.red("\u2717 No model provider configured"));
|
|
14021
14204
|
console.error("Run 'vm0 model-provider setup' first");
|
|
14022
14205
|
process.exit(1);
|
|
14023
14206
|
}
|
|
@@ -14038,14 +14221,14 @@ async function handleModelProvider(ctx) {
|
|
|
14038
14221
|
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
14039
14222
|
if (selectedChoice?.helpText) {
|
|
14040
14223
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
14041
|
-
step.detail(
|
|
14224
|
+
step.detail(chalk74.dim(line));
|
|
14042
14225
|
}
|
|
14043
14226
|
}
|
|
14044
14227
|
const secret = await step.prompt(
|
|
14045
14228
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
14046
14229
|
);
|
|
14047
14230
|
if (!secret) {
|
|
14048
|
-
console.log(
|
|
14231
|
+
console.log(chalk74.dim("Cancelled"));
|
|
14049
14232
|
process.exit(0);
|
|
14050
14233
|
}
|
|
14051
14234
|
let selectedModel;
|
|
@@ -14064,7 +14247,7 @@ async function handleModelProvider(ctx) {
|
|
|
14064
14247
|
() => promptSelect("Select model:", modelChoices)
|
|
14065
14248
|
);
|
|
14066
14249
|
if (modelSelection === void 0) {
|
|
14067
|
-
console.log(
|
|
14250
|
+
console.log(chalk74.dim("Cancelled"));
|
|
14068
14251
|
process.exit(0);
|
|
14069
14252
|
}
|
|
14070
14253
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -14074,7 +14257,7 @@ async function handleModelProvider(ctx) {
|
|
|
14074
14257
|
});
|
|
14075
14258
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
14076
14259
|
step.detail(
|
|
14077
|
-
|
|
14260
|
+
chalk74.green(
|
|
14078
14261
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
14079
14262
|
)
|
|
14080
14263
|
);
|
|
@@ -14105,7 +14288,7 @@ async function handleAgentCreation(ctx) {
|
|
|
14105
14288
|
agentName = inputName;
|
|
14106
14289
|
if (existsSync12(agentName)) {
|
|
14107
14290
|
step.detail(
|
|
14108
|
-
|
|
14291
|
+
chalk74.yellow(`${agentName}/ already exists, choose another name`)
|
|
14109
14292
|
);
|
|
14110
14293
|
} else {
|
|
14111
14294
|
folderExists = false;
|
|
@@ -14114,22 +14297,22 @@ async function handleAgentCreation(ctx) {
|
|
|
14114
14297
|
} else {
|
|
14115
14298
|
if (!validateAgentName(agentName)) {
|
|
14116
14299
|
console.error(
|
|
14117
|
-
|
|
14300
|
+
chalk74.red(
|
|
14118
14301
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
14119
14302
|
)
|
|
14120
14303
|
);
|
|
14121
14304
|
process.exit(1);
|
|
14122
14305
|
}
|
|
14123
14306
|
if (existsSync12(agentName)) {
|
|
14124
|
-
console.error(
|
|
14307
|
+
console.error(chalk74.red(`\u2717 ${agentName}/ already exists`));
|
|
14125
14308
|
console.error();
|
|
14126
14309
|
console.error("Remove it first or choose a different name:");
|
|
14127
|
-
console.error(
|
|
14310
|
+
console.error(chalk74.cyan(` rm -rf ${agentName}`));
|
|
14128
14311
|
process.exit(1);
|
|
14129
14312
|
}
|
|
14130
14313
|
}
|
|
14131
14314
|
await mkdir8(agentName, { recursive: true });
|
|
14132
|
-
step.detail(
|
|
14315
|
+
step.detail(chalk74.green(`Created ${agentName}/`));
|
|
14133
14316
|
});
|
|
14134
14317
|
return agentName;
|
|
14135
14318
|
}
|
|
@@ -14145,7 +14328,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
14145
14328
|
shouldInstall = confirmed ?? true;
|
|
14146
14329
|
}
|
|
14147
14330
|
if (!shouldInstall) {
|
|
14148
|
-
step.detail(
|
|
14331
|
+
step.detail(chalk74.dim("Skipped"));
|
|
14149
14332
|
return;
|
|
14150
14333
|
}
|
|
14151
14334
|
const scope = "project";
|
|
@@ -14153,7 +14336,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
14153
14336
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
14154
14337
|
const result = await installVm0Plugin(scope, agentDir);
|
|
14155
14338
|
step.detail(
|
|
14156
|
-
|
|
14339
|
+
chalk74.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
14157
14340
|
);
|
|
14158
14341
|
pluginInstalled = true;
|
|
14159
14342
|
} catch (error) {
|
|
@@ -14164,18 +14347,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
14164
14347
|
}
|
|
14165
14348
|
function printNextSteps(agentName, pluginInstalled) {
|
|
14166
14349
|
console.log();
|
|
14167
|
-
console.log(
|
|
14350
|
+
console.log(chalk74.bold("Next step:"));
|
|
14168
14351
|
console.log();
|
|
14169
14352
|
if (pluginInstalled) {
|
|
14170
14353
|
console.log(
|
|
14171
|
-
` ${
|
|
14354
|
+
` ${chalk74.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
14172
14355
|
);
|
|
14173
14356
|
} else {
|
|
14174
|
-
console.log(` ${
|
|
14357
|
+
console.log(` ${chalk74.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
14175
14358
|
}
|
|
14176
14359
|
console.log();
|
|
14177
14360
|
}
|
|
14178
|
-
var onboardCommand = new
|
|
14361
|
+
var onboardCommand = new Command72().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) => {
|
|
14179
14362
|
try {
|
|
14180
14363
|
const interactive = isInteractive();
|
|
14181
14364
|
if (interactive) {
|
|
@@ -14198,33 +14381,33 @@ var onboardCommand = new Command71().name("onboard").description("Guided setup f
|
|
|
14198
14381
|
printNextSteps(agentName, pluginInstalled);
|
|
14199
14382
|
} catch (error) {
|
|
14200
14383
|
if (error instanceof Error) {
|
|
14201
|
-
console.error(
|
|
14384
|
+
console.error(chalk74.red(`\u2717 ${error.message}`));
|
|
14202
14385
|
if (error.cause instanceof Error) {
|
|
14203
|
-
console.error(
|
|
14386
|
+
console.error(chalk74.dim(` Cause: ${error.cause.message}`));
|
|
14204
14387
|
}
|
|
14205
14388
|
} else {
|
|
14206
|
-
console.error(
|
|
14389
|
+
console.error(chalk74.red("\u2717 An unexpected error occurred"));
|
|
14207
14390
|
}
|
|
14208
14391
|
process.exit(1);
|
|
14209
14392
|
}
|
|
14210
14393
|
});
|
|
14211
14394
|
|
|
14212
14395
|
// src/commands/setup-claude/index.ts
|
|
14213
|
-
import { Command as
|
|
14214
|
-
import
|
|
14215
|
-
var setupClaudeCommand = new
|
|
14396
|
+
import { Command as Command73 } from "commander";
|
|
14397
|
+
import chalk75 from "chalk";
|
|
14398
|
+
var setupClaudeCommand = new Command73().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(
|
|
14216
14399
|
withErrorHandler(async (options) => {
|
|
14217
|
-
console.log(
|
|
14400
|
+
console.log(chalk75.dim("Installing VM0 Claude Plugin..."));
|
|
14218
14401
|
const scope = options.scope === "user" ? "user" : "project";
|
|
14219
14402
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
14220
14403
|
console.log(
|
|
14221
|
-
|
|
14404
|
+
chalk75.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
14222
14405
|
);
|
|
14223
14406
|
console.log();
|
|
14224
14407
|
console.log("Next step:");
|
|
14225
14408
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
14226
14409
|
console.log(
|
|
14227
|
-
|
|
14410
|
+
chalk75.cyan(
|
|
14228
14411
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
14229
14412
|
)
|
|
14230
14413
|
);
|
|
@@ -14232,39 +14415,39 @@ var setupClaudeCommand = new Command72().name("setup-claude").description("Insta
|
|
|
14232
14415
|
);
|
|
14233
14416
|
|
|
14234
14417
|
// src/commands/dashboard/index.ts
|
|
14235
|
-
import { Command as
|
|
14236
|
-
import
|
|
14237
|
-
var dashboardCommand = new
|
|
14418
|
+
import { Command as Command74 } from "commander";
|
|
14419
|
+
import chalk76 from "chalk";
|
|
14420
|
+
var dashboardCommand = new Command74().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
14238
14421
|
console.log();
|
|
14239
|
-
console.log(
|
|
14422
|
+
console.log(chalk76.bold("VM0 Dashboard"));
|
|
14240
14423
|
console.log();
|
|
14241
|
-
console.log(
|
|
14242
|
-
console.log(
|
|
14424
|
+
console.log(chalk76.bold("Agents"));
|
|
14425
|
+
console.log(chalk76.dim(" List agents: ") + "vm0 agent list");
|
|
14243
14426
|
console.log();
|
|
14244
|
-
console.log(
|
|
14245
|
-
console.log(
|
|
14246
|
-
console.log(
|
|
14427
|
+
console.log(chalk76.bold("Runs"));
|
|
14428
|
+
console.log(chalk76.dim(" Recent runs: ") + "vm0 run list");
|
|
14429
|
+
console.log(chalk76.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
14247
14430
|
console.log();
|
|
14248
|
-
console.log(
|
|
14249
|
-
console.log(
|
|
14431
|
+
console.log(chalk76.bold("Schedules"));
|
|
14432
|
+
console.log(chalk76.dim(" List schedules: ") + "vm0 schedule list");
|
|
14250
14433
|
console.log();
|
|
14251
|
-
console.log(
|
|
14252
|
-
console.log(
|
|
14253
|
-
console.log(
|
|
14254
|
-
console.log(
|
|
14434
|
+
console.log(chalk76.bold("Account"));
|
|
14435
|
+
console.log(chalk76.dim(" Usage stats: ") + "vm0 usage");
|
|
14436
|
+
console.log(chalk76.dim(" List secrets: ") + "vm0 secret list");
|
|
14437
|
+
console.log(chalk76.dim(" List variables: ") + "vm0 variable list");
|
|
14255
14438
|
console.log();
|
|
14256
14439
|
console.log(
|
|
14257
|
-
|
|
14440
|
+
chalk76.dim("Not logged in? Run: ") + chalk76.cyan("vm0 auth login")
|
|
14258
14441
|
);
|
|
14259
14442
|
console.log();
|
|
14260
14443
|
});
|
|
14261
14444
|
|
|
14262
14445
|
// src/commands/dev-tool/index.ts
|
|
14263
|
-
import { Command as
|
|
14446
|
+
import { Command as Command76 } from "commander";
|
|
14264
14447
|
|
|
14265
14448
|
// src/commands/dev-tool/compose.ts
|
|
14266
|
-
import { Command as
|
|
14267
|
-
import
|
|
14449
|
+
import { Command as Command75 } from "commander";
|
|
14450
|
+
import chalk77 from "chalk";
|
|
14268
14451
|
import { initClient as initClient13 } from "@ts-rest/core";
|
|
14269
14452
|
function sleep2(ms) {
|
|
14270
14453
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -14316,7 +14499,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14316
14499
|
const job = await getComposeJobStatus(jobId);
|
|
14317
14500
|
if (!jsonMode) {
|
|
14318
14501
|
console.log(
|
|
14319
|
-
|
|
14502
|
+
chalk77.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
14320
14503
|
);
|
|
14321
14504
|
}
|
|
14322
14505
|
if (job.status === "completed" || job.status === "failed") {
|
|
@@ -14326,7 +14509,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14326
14509
|
}
|
|
14327
14510
|
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
14328
14511
|
}
|
|
14329
|
-
var composeCommand2 = new
|
|
14512
|
+
var composeCommand2 = new Command75().name("compose").description("Test server-side GitHub compose API").argument("<github-url>", "GitHub URL to compose from").option("--overwrite", "Overwrite existing compose", false).option(
|
|
14330
14513
|
"--interval <seconds>",
|
|
14331
14514
|
"Polling interval in seconds",
|
|
14332
14515
|
(v) => parseInt(v, 10),
|
|
@@ -14375,7 +14558,7 @@ var composeCommand2 = new Command74().name("compose").description("Test server-s
|
|
|
14375
14558
|
githubUrl,
|
|
14376
14559
|
options.overwrite
|
|
14377
14560
|
);
|
|
14378
|
-
console.log(`Job ID: ${
|
|
14561
|
+
console.log(`Job ID: ${chalk77.cyan(jobId)}`);
|
|
14379
14562
|
console.log();
|
|
14380
14563
|
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
14381
14564
|
const finalJob2 = await getComposeJobStatus(jobId);
|
|
@@ -14396,21 +14579,21 @@ var composeCommand2 = new Command74().name("compose").description("Test server-s
|
|
|
14396
14579
|
);
|
|
14397
14580
|
function displayResult(job) {
|
|
14398
14581
|
if (job.status === "completed" && job.result) {
|
|
14399
|
-
console.log(
|
|
14400
|
-
console.log(` Compose ID: ${
|
|
14401
|
-
console.log(` Name: ${
|
|
14402
|
-
console.log(` Version: ${
|
|
14582
|
+
console.log(chalk77.green("\u2713 Compose completed!"));
|
|
14583
|
+
console.log(` Compose ID: ${chalk77.cyan(job.result.composeId)}`);
|
|
14584
|
+
console.log(` Name: ${chalk77.cyan(job.result.composeName)}`);
|
|
14585
|
+
console.log(` Version: ${chalk77.cyan(job.result.versionId.slice(0, 8))}`);
|
|
14403
14586
|
if (job.result.warnings.length > 0) {
|
|
14404
14587
|
console.log();
|
|
14405
|
-
console.log(
|
|
14588
|
+
console.log(chalk77.yellow(" Warnings:"));
|
|
14406
14589
|
for (const warning of job.result.warnings) {
|
|
14407
|
-
console.log(
|
|
14590
|
+
console.log(chalk77.yellow(` - ${warning}`));
|
|
14408
14591
|
}
|
|
14409
14592
|
}
|
|
14410
14593
|
} else if (job.status === "failed") {
|
|
14411
|
-
console.error(
|
|
14594
|
+
console.error(chalk77.red("\u2717 Compose failed"));
|
|
14412
14595
|
if (job.error) {
|
|
14413
|
-
console.error(` Error: ${
|
|
14596
|
+
console.error(` Error: ${chalk77.red(job.error)}`);
|
|
14414
14597
|
}
|
|
14415
14598
|
} else {
|
|
14416
14599
|
console.log(`Status: ${job.status}`);
|
|
@@ -14418,11 +14601,11 @@ function displayResult(job) {
|
|
|
14418
14601
|
}
|
|
14419
14602
|
|
|
14420
14603
|
// src/commands/dev-tool/index.ts
|
|
14421
|
-
var devToolCommand = new
|
|
14604
|
+
var devToolCommand = new Command76().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
14422
14605
|
|
|
14423
14606
|
// src/index.ts
|
|
14424
|
-
var program = new
|
|
14425
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
14607
|
+
var program = new Command77();
|
|
14608
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.34.0");
|
|
14426
14609
|
program.addCommand(authCommand);
|
|
14427
14610
|
program.addCommand(infoCommand);
|
|
14428
14611
|
program.addCommand(composeCommand);
|