@vm0/cli 9.1.0 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +189 -373
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command48 } from "commander";
|
|
5
5
|
import chalk48 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/lib/api/auth.ts
|
|
@@ -12,20 +12,27 @@ import { homedir } from "os";
|
|
|
12
12
|
import { join } from "path";
|
|
13
13
|
import { readFile, writeFile, mkdir, unlink } from "fs/promises";
|
|
14
14
|
import { existsSync } from "fs";
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
function getConfigDir() {
|
|
16
|
+
return join(homedir(), ".vm0");
|
|
17
|
+
}
|
|
18
|
+
function getConfigFile() {
|
|
19
|
+
return join(getConfigDir(), "config.json");
|
|
20
|
+
}
|
|
17
21
|
async function loadConfig() {
|
|
18
|
-
|
|
22
|
+
const configFile = getConfigFile();
|
|
23
|
+
if (!existsSync(configFile)) {
|
|
19
24
|
return {};
|
|
20
25
|
}
|
|
21
|
-
const content = await readFile(
|
|
26
|
+
const content = await readFile(configFile, "utf8");
|
|
22
27
|
return JSON.parse(content);
|
|
23
28
|
}
|
|
24
29
|
async function saveConfig(config) {
|
|
25
|
-
|
|
30
|
+
const configDir = getConfigDir();
|
|
31
|
+
const configFile = getConfigFile();
|
|
32
|
+
await mkdir(configDir, { recursive: true });
|
|
26
33
|
const existing = await loadConfig();
|
|
27
34
|
const merged = { ...existing, ...config };
|
|
28
|
-
await writeFile(
|
|
35
|
+
await writeFile(configFile, JSON.stringify(merged, null, 2), "utf8");
|
|
29
36
|
}
|
|
30
37
|
async function getToken() {
|
|
31
38
|
if (process.env.VM0_TOKEN) {
|
|
@@ -43,8 +50,9 @@ async function getApiUrl() {
|
|
|
43
50
|
return config.apiUrl ?? "https://www.vm0.ai";
|
|
44
51
|
}
|
|
45
52
|
async function clearConfig() {
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
const configFile = getConfigFile();
|
|
54
|
+
if (existsSync(configFile)) {
|
|
55
|
+
await unlink(configFile);
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -182,8 +190,14 @@ async function setupToken() {
|
|
|
182
190
|
);
|
|
183
191
|
}
|
|
184
192
|
|
|
185
|
-
// src/commands/
|
|
193
|
+
// src/commands/auth/login.ts
|
|
186
194
|
import { Command } from "commander";
|
|
195
|
+
var loginCommand = new Command().name("login").description("Log in to VM0 (use VM0_API_URL env var to set API URL)").action(async () => {
|
|
196
|
+
await authenticate();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// src/commands/compose.ts
|
|
200
|
+
import { Command as Command2 } from "commander";
|
|
187
201
|
import chalk2 from "chalk";
|
|
188
202
|
import { readFile as readFile4 } from "fs/promises";
|
|
189
203
|
import { existsSync as existsSync3 } from "fs";
|
|
@@ -711,7 +725,8 @@ var runsMainContract = c3.router({
|
|
|
711
725
|
201: createRunResponseSchema,
|
|
712
726
|
400: apiErrorSchema,
|
|
713
727
|
401: apiErrorSchema,
|
|
714
|
-
404: apiErrorSchema
|
|
728
|
+
404: apiErrorSchema,
|
|
729
|
+
429: apiErrorSchema
|
|
715
730
|
},
|
|
716
731
|
summary: "Create and execute agent run"
|
|
717
732
|
}
|
|
@@ -2296,8 +2311,10 @@ var publicApiErrorTypeSchema = z18.enum([
|
|
|
2296
2311
|
// Auth failure (401)
|
|
2297
2312
|
"not_found_error",
|
|
2298
2313
|
// Resource missing (404)
|
|
2299
|
-
"conflict_error"
|
|
2314
|
+
"conflict_error",
|
|
2300
2315
|
// Resource conflict (409)
|
|
2316
|
+
"rate_limit_error"
|
|
2317
|
+
// Rate limit exceeded (429)
|
|
2301
2318
|
]);
|
|
2302
2319
|
var publicApiErrorSchema = z18.object({
|
|
2303
2320
|
error: z18.object({
|
|
@@ -2545,9 +2562,7 @@ var createRunRequestSchema = z21.object({
|
|
|
2545
2562
|
// volume_name -> version
|
|
2546
2563
|
});
|
|
2547
2564
|
var runListQuerySchema = listQuerySchema.extend({
|
|
2548
|
-
|
|
2549
|
-
status: publicRunStatusSchema.optional(),
|
|
2550
|
-
since: timestampSchema.optional()
|
|
2565
|
+
status: publicRunStatusSchema.optional()
|
|
2551
2566
|
});
|
|
2552
2567
|
var publicRunsListContract = c17.router({
|
|
2553
2568
|
list: {
|
|
@@ -2561,7 +2576,7 @@ var publicRunsListContract = c17.router({
|
|
|
2561
2576
|
500: publicApiErrorSchema
|
|
2562
2577
|
},
|
|
2563
2578
|
summary: "List runs",
|
|
2564
|
-
description: "List runs with optional filtering by
|
|
2579
|
+
description: "List runs with optional filtering by status"
|
|
2565
2580
|
},
|
|
2566
2581
|
create: {
|
|
2567
2582
|
method: "POST",
|
|
@@ -2574,6 +2589,7 @@ var publicRunsListContract = c17.router({
|
|
|
2574
2589
|
400: publicApiErrorSchema,
|
|
2575
2590
|
401: publicApiErrorSchema,
|
|
2576
2591
|
404: publicApiErrorSchema,
|
|
2592
|
+
429: publicApiErrorSchema,
|
|
2577
2593
|
500: publicApiErrorSchema
|
|
2578
2594
|
},
|
|
2579
2595
|
summary: "Create run",
|
|
@@ -4231,7 +4247,7 @@ function getSecretsFromComposeContent(content) {
|
|
|
4231
4247
|
const grouped = groupVariablesBySource(refs);
|
|
4232
4248
|
return new Set(grouped.secrets.map((r) => r.name));
|
|
4233
4249
|
}
|
|
4234
|
-
var composeCommand = new
|
|
4250
|
+
var composeCommand = new Command2().name("compose").description("Create or update agent compose (e.g., vm0.yaml)").argument("<agent-yaml>", "Path to agent YAML file").option("-y, --yes", "Skip confirmation prompts for skill requirements").action(async (configFile, options) => {
|
|
4235
4251
|
try {
|
|
4236
4252
|
if (!existsSync3(configFile)) {
|
|
4237
4253
|
console.error(chalk2.red(`\u2717 Config file not found: ${configFile}`));
|
|
@@ -4435,7 +4451,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4435
4451
|
});
|
|
4436
4452
|
|
|
4437
4453
|
// src/commands/run/run.ts
|
|
4438
|
-
import { Command as
|
|
4454
|
+
import { Command as Command3, Option } from "commander";
|
|
4439
4455
|
import chalk6 from "chalk";
|
|
4440
4456
|
|
|
4441
4457
|
// src/lib/events/event-renderer.ts
|
|
@@ -4454,25 +4470,6 @@ var EventRenderer = class {
|
|
|
4454
4470
|
console.log(chalk3.dim(` (use "vm0 logs ${info.runId}" to view logs)`));
|
|
4455
4471
|
console.log();
|
|
4456
4472
|
}
|
|
4457
|
-
/**
|
|
4458
|
-
* Format elapsed time between two timestamps
|
|
4459
|
-
* Returns [+Nms] for < 1000ms, [+N.Ns] for >= 1000ms
|
|
4460
|
-
*/
|
|
4461
|
-
static formatElapsed(previous, current) {
|
|
4462
|
-
const elapsedMs = current.getTime() - previous.getTime();
|
|
4463
|
-
if (elapsedMs < 1e3) {
|
|
4464
|
-
return `[+${elapsedMs}ms]`;
|
|
4465
|
-
}
|
|
4466
|
-
return `[+${(elapsedMs / 1e3).toFixed(1)}s]`;
|
|
4467
|
-
}
|
|
4468
|
-
/**
|
|
4469
|
-
* Format total elapsed time
|
|
4470
|
-
* Returns N.Ns format
|
|
4471
|
-
*/
|
|
4472
|
-
static formatTotalTime(start, end) {
|
|
4473
|
-
const elapsedMs = end.getTime() - start.getTime();
|
|
4474
|
-
return `${(elapsedMs / 1e3).toFixed(1)}s`;
|
|
4475
|
-
}
|
|
4476
4473
|
/**
|
|
4477
4474
|
* Format timestamp for display (without milliseconds, matching metrics format)
|
|
4478
4475
|
*/
|
|
@@ -4484,24 +4481,21 @@ var EventRenderer = class {
|
|
|
4484
4481
|
*/
|
|
4485
4482
|
static render(event, options) {
|
|
4486
4483
|
const timestampPrefix = options?.showTimestamp ? `[${this.formatTimestamp(event.timestamp)}] ` : "";
|
|
4487
|
-
const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.dim(
|
|
4488
|
-
this.formatElapsed(options.previousTimestamp, event.timestamp)
|
|
4489
|
-
) : "";
|
|
4490
4484
|
switch (event.type) {
|
|
4491
4485
|
case "init":
|
|
4492
|
-
this.renderInit(event, timestampPrefix
|
|
4486
|
+
this.renderInit(event, timestampPrefix);
|
|
4493
4487
|
break;
|
|
4494
4488
|
case "text":
|
|
4495
|
-
this.renderText(event, timestampPrefix
|
|
4489
|
+
this.renderText(event, timestampPrefix);
|
|
4496
4490
|
break;
|
|
4497
4491
|
case "tool_use":
|
|
4498
|
-
this.renderToolUse(event, timestampPrefix
|
|
4492
|
+
this.renderToolUse(event, timestampPrefix);
|
|
4499
4493
|
break;
|
|
4500
4494
|
case "tool_result":
|
|
4501
|
-
this.renderToolResult(event, timestampPrefix
|
|
4495
|
+
this.renderToolResult(event, timestampPrefix);
|
|
4502
4496
|
break;
|
|
4503
4497
|
case "result":
|
|
4504
|
-
this.renderResult(event, timestampPrefix
|
|
4498
|
+
this.renderResult(event, timestampPrefix);
|
|
4505
4499
|
break;
|
|
4506
4500
|
}
|
|
4507
4501
|
}
|
|
@@ -4509,8 +4503,7 @@ var EventRenderer = class {
|
|
|
4509
4503
|
* Render run completed state
|
|
4510
4504
|
* Note: This is run lifecycle status, not an event
|
|
4511
4505
|
*/
|
|
4512
|
-
static renderRunCompleted(result
|
|
4513
|
-
const now = /* @__PURE__ */ new Date();
|
|
4506
|
+
static renderRunCompleted(result) {
|
|
4514
4507
|
console.log("");
|
|
4515
4508
|
console.log(chalk3.green("\u2713 Run completed successfully"));
|
|
4516
4509
|
if (result) {
|
|
@@ -4530,10 +4523,6 @@ var EventRenderer = class {
|
|
|
4530
4523
|
}
|
|
4531
4524
|
}
|
|
4532
4525
|
}
|
|
4533
|
-
if (options?.verbose && options?.startTimestamp) {
|
|
4534
|
-
const totalTime = this.formatTotalTime(options.startTimestamp, now);
|
|
4535
|
-
console.log(` Total time: ${chalk3.dim(totalTime)}`);
|
|
4536
|
-
}
|
|
4537
4526
|
}
|
|
4538
4527
|
/**
|
|
4539
4528
|
* Render run failed state
|
|
@@ -4547,10 +4536,10 @@ var EventRenderer = class {
|
|
|
4547
4536
|
chalk3.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
4548
4537
|
);
|
|
4549
4538
|
}
|
|
4550
|
-
static renderInit(event, prefix
|
|
4539
|
+
static renderInit(event, prefix) {
|
|
4551
4540
|
const frameworkStr = String(event.data.framework || "claude-code");
|
|
4552
4541
|
const displayName = isSupportedFramework(frameworkStr) ? getFrameworkDisplayName(frameworkStr) : frameworkStr;
|
|
4553
|
-
console.log(prefix +
|
|
4542
|
+
console.log(prefix + `[init] Starting ${displayName} agent`);
|
|
4554
4543
|
console.log(` Session: ${chalk3.dim(String(event.data.sessionId || ""))}`);
|
|
4555
4544
|
if (event.data.model) {
|
|
4556
4545
|
console.log(` Model: ${chalk3.dim(String(event.data.model))}`);
|
|
@@ -4561,13 +4550,13 @@ var EventRenderer = class {
|
|
|
4561
4550
|
)}`
|
|
4562
4551
|
);
|
|
4563
4552
|
}
|
|
4564
|
-
static renderText(event, prefix
|
|
4553
|
+
static renderText(event, prefix) {
|
|
4565
4554
|
const text = String(event.data.text || "");
|
|
4566
|
-
console.log(prefix + "[text]
|
|
4555
|
+
console.log(prefix + "[text] " + text);
|
|
4567
4556
|
}
|
|
4568
|
-
static renderToolUse(event, prefix
|
|
4557
|
+
static renderToolUse(event, prefix) {
|
|
4569
4558
|
const tool = String(event.data.tool || "");
|
|
4570
|
-
console.log(prefix + "[tool_use]
|
|
4559
|
+
console.log(prefix + "[tool_use] " + tool);
|
|
4571
4560
|
const input = event.data.input;
|
|
4572
4561
|
if (input && typeof input === "object") {
|
|
4573
4562
|
for (const [key, value] of Object.entries(input)) {
|
|
@@ -4578,17 +4567,17 @@ var EventRenderer = class {
|
|
|
4578
4567
|
}
|
|
4579
4568
|
}
|
|
4580
4569
|
}
|
|
4581
|
-
static renderToolResult(event, prefix
|
|
4570
|
+
static renderToolResult(event, prefix) {
|
|
4582
4571
|
const isError = Boolean(event.data.isError);
|
|
4583
4572
|
const status = isError ? "Error" : "Completed";
|
|
4584
|
-
console.log(prefix + "[tool_result]
|
|
4573
|
+
console.log(prefix + "[tool_result] " + status);
|
|
4585
4574
|
const result = String(event.data.result || "");
|
|
4586
4575
|
console.log(` ${chalk3.dim(result)}`);
|
|
4587
4576
|
}
|
|
4588
|
-
static renderResult(event, prefix
|
|
4577
|
+
static renderResult(event, prefix) {
|
|
4589
4578
|
const success = Boolean(event.data.success);
|
|
4590
4579
|
const status = success ? "\u2713 completed successfully" : "\u2717 failed";
|
|
4591
|
-
console.log(prefix + "[result]
|
|
4580
|
+
console.log(prefix + "[result] " + status);
|
|
4592
4581
|
const durationMs = Number(event.data.durationMs || 0);
|
|
4593
4582
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
4594
4583
|
console.log(` Duration: ${chalk3.dim(durationSec + "s")}`);
|
|
@@ -5952,15 +5941,7 @@ function getRunChannelName(runId) {
|
|
|
5952
5941
|
|
|
5953
5942
|
// src/lib/realtime/stream-events.ts
|
|
5954
5943
|
async function streamEvents(runId, options) {
|
|
5955
|
-
const {
|
|
5956
|
-
verbose,
|
|
5957
|
-
startTimestamp,
|
|
5958
|
-
onEvent,
|
|
5959
|
-
onRunCompleted,
|
|
5960
|
-
onRunFailed,
|
|
5961
|
-
onTimeout
|
|
5962
|
-
} = options;
|
|
5963
|
-
let previousTimestamp = startTimestamp;
|
|
5944
|
+
const { onEvent, onRunCompleted, onRunFailed, onTimeout } = options;
|
|
5964
5945
|
const ablyClient = createRealtimeClient(async () => {
|
|
5965
5946
|
return apiClient.getRealtimeToken(runId);
|
|
5966
5947
|
});
|
|
@@ -5997,20 +5978,12 @@ async function streamEvents(runId, options) {
|
|
|
5997
5978
|
}
|
|
5998
5979
|
nextExpectedSequence = Math.max(nextExpectedSequence, seq + 1);
|
|
5999
5980
|
}
|
|
6000
|
-
|
|
6001
|
-
verbose,
|
|
6002
|
-
previousTimestamp,
|
|
6003
|
-
startTimestamp
|
|
6004
|
-
});
|
|
5981
|
+
onEvent(event);
|
|
6005
5982
|
}
|
|
6006
5983
|
} else if (message.name === "status") {
|
|
6007
5984
|
const data = message.data;
|
|
6008
5985
|
if (data.status === "completed") {
|
|
6009
|
-
onRunCompleted(data.result
|
|
6010
|
-
verbose,
|
|
6011
|
-
previousTimestamp,
|
|
6012
|
-
startTimestamp
|
|
6013
|
-
});
|
|
5986
|
+
onRunCompleted(data.result);
|
|
6014
5987
|
result = {
|
|
6015
5988
|
succeeded: true,
|
|
6016
5989
|
runId,
|
|
@@ -6119,28 +6092,18 @@ function parseIdentifier(identifier) {
|
|
|
6119
6092
|
}
|
|
6120
6093
|
return { scope, name: rest };
|
|
6121
6094
|
}
|
|
6122
|
-
function renderEvent(event
|
|
6095
|
+
function renderEvent(event) {
|
|
6123
6096
|
const eventData = event;
|
|
6124
6097
|
const parsed = parseEvent(eventData);
|
|
6125
6098
|
if (parsed) {
|
|
6126
|
-
EventRenderer.render(parsed
|
|
6127
|
-
verbose: options.verbose,
|
|
6128
|
-
previousTimestamp: options.previousTimestamp,
|
|
6129
|
-
startTimestamp: options.startTimestamp
|
|
6130
|
-
});
|
|
6131
|
-
return parsed.timestamp;
|
|
6099
|
+
EventRenderer.render(parsed);
|
|
6132
6100
|
}
|
|
6133
|
-
return options.previousTimestamp;
|
|
6134
6101
|
}
|
|
6135
|
-
async function streamRealtimeEvents(runId
|
|
6136
|
-
const startTimestamp = options.startTimestamp;
|
|
6137
|
-
const verbose = options.verbose;
|
|
6102
|
+
async function streamRealtimeEvents(runId) {
|
|
6138
6103
|
return streamEvents(runId, {
|
|
6139
|
-
verbose,
|
|
6140
|
-
startTimestamp,
|
|
6141
6104
|
onEvent: renderEvent,
|
|
6142
|
-
onRunCompleted: (result
|
|
6143
|
-
EventRenderer.renderRunCompleted(result
|
|
6105
|
+
onRunCompleted: (result) => {
|
|
6106
|
+
EventRenderer.renderRunCompleted(result);
|
|
6144
6107
|
},
|
|
6145
6108
|
onRunFailed: (error, rid) => {
|
|
6146
6109
|
EventRenderer.renderRunFailed(error, rid);
|
|
@@ -6153,14 +6116,11 @@ async function streamRealtimeEvents(runId, options) {
|
|
|
6153
6116
|
}
|
|
6154
6117
|
});
|
|
6155
6118
|
}
|
|
6156
|
-
async function pollEvents(runId
|
|
6119
|
+
async function pollEvents(runId) {
|
|
6157
6120
|
let nextSequence = -1;
|
|
6158
6121
|
let complete = false;
|
|
6159
6122
|
let result = { succeeded: true, runId };
|
|
6160
6123
|
const pollIntervalMs = 1e3;
|
|
6161
|
-
const startTimestamp = options.startTimestamp;
|
|
6162
|
-
let previousTimestamp = startTimestamp;
|
|
6163
|
-
const verbose = options.verbose;
|
|
6164
6124
|
while (!complete) {
|
|
6165
6125
|
const response = await getEvents(runId, {
|
|
6166
6126
|
since: nextSequence
|
|
@@ -6172,12 +6132,7 @@ async function pollEvents(runId, options) {
|
|
|
6172
6132
|
} else {
|
|
6173
6133
|
const parsed = parseEvent(eventData);
|
|
6174
6134
|
if (parsed) {
|
|
6175
|
-
EventRenderer.render(parsed
|
|
6176
|
-
verbose,
|
|
6177
|
-
previousTimestamp,
|
|
6178
|
-
startTimestamp
|
|
6179
|
-
});
|
|
6180
|
-
previousTimestamp = parsed.timestamp;
|
|
6135
|
+
EventRenderer.render(parsed);
|
|
6181
6136
|
}
|
|
6182
6137
|
}
|
|
6183
6138
|
}
|
|
@@ -6185,11 +6140,7 @@ async function pollEvents(runId, options) {
|
|
|
6185
6140
|
const runStatus = response.run.status;
|
|
6186
6141
|
if (runStatus === "completed") {
|
|
6187
6142
|
complete = true;
|
|
6188
|
-
EventRenderer.renderRunCompleted(response.run.result
|
|
6189
|
-
verbose,
|
|
6190
|
-
previousTimestamp,
|
|
6191
|
-
startTimestamp
|
|
6192
|
-
});
|
|
6143
|
+
EventRenderer.renderRunCompleted(response.run.result);
|
|
6193
6144
|
result = {
|
|
6194
6145
|
succeeded: true,
|
|
6195
6146
|
runId,
|
|
@@ -6214,18 +6165,6 @@ async function pollEvents(runId, options) {
|
|
|
6214
6165
|
}
|
|
6215
6166
|
return result;
|
|
6216
6167
|
}
|
|
6217
|
-
function logVerbosePreFlight(action, details) {
|
|
6218
|
-
console.log(`
|
|
6219
|
-
${action}...`);
|
|
6220
|
-
for (const { label, value } of details) {
|
|
6221
|
-
if (value !== void 0) {
|
|
6222
|
-
console.log(chalk5.dim(` ${label}: ${value}`));
|
|
6223
|
-
}
|
|
6224
|
-
}
|
|
6225
|
-
console.log();
|
|
6226
|
-
console.log("Executing in sandbox...");
|
|
6227
|
-
console.log();
|
|
6228
|
-
}
|
|
6229
6168
|
function showNextSteps(result) {
|
|
6230
6169
|
const { runId, sessionId, checkpointId } = result;
|
|
6231
6170
|
console.log();
|
|
@@ -6248,7 +6187,7 @@ function showNextSteps(result) {
|
|
|
6248
6187
|
}
|
|
6249
6188
|
|
|
6250
6189
|
// src/commands/run/run.ts
|
|
6251
|
-
var mainRunCommand = new
|
|
6190
|
+
var mainRunCommand = new Command3().name("run").description("Run an agent").argument(
|
|
6252
6191
|
"<agent-name>",
|
|
6253
6192
|
"Agent reference: [scope/]name[:version] (e.g., 'my-agent', 'lancy/my-agent:abc123', 'my-agent:latest')"
|
|
6254
6193
|
).argument("<prompt>", "Prompt for the agent").option(
|
|
@@ -6275,33 +6214,23 @@ var mainRunCommand = new Command2().name("run").description("Run an agent").argu
|
|
|
6275
6214
|
).option(
|
|
6276
6215
|
"--conversation <id>",
|
|
6277
6216
|
"Resume from conversation ID (for fine-grained control)"
|
|
6278
|
-
).option(
|
|
6217
|
+
).option(
|
|
6279
6218
|
"--experimental-realtime",
|
|
6280
6219
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6281
6220
|
).option(
|
|
6282
6221
|
"--model-provider <type>",
|
|
6283
6222
|
"Override model provider (e.g., anthropic-api-key)"
|
|
6284
6223
|
).addOption(new Option("--debug-no-mock-claude").hideHelp()).action(
|
|
6285
|
-
// eslint-disable-next-line complexity -- TODO: refactor complex function
|
|
6286
6224
|
async (identifier, prompt, options) => {
|
|
6287
|
-
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6288
|
-
const verbose = options.verbose;
|
|
6289
6225
|
try {
|
|
6290
6226
|
const { scope, name, version } = parseIdentifier(identifier);
|
|
6291
6227
|
let composeId;
|
|
6292
6228
|
let composeContent;
|
|
6293
6229
|
if (isUUID(name)) {
|
|
6294
|
-
if (verbose) {
|
|
6295
|
-
console.log(chalk6.dim(` Using compose ID: ${identifier}`));
|
|
6296
|
-
}
|
|
6297
6230
|
const compose = await getComposeById(name);
|
|
6298
6231
|
composeId = compose.id;
|
|
6299
6232
|
composeContent = compose.content;
|
|
6300
6233
|
} else {
|
|
6301
|
-
if (verbose) {
|
|
6302
|
-
const displayRef = scope ? `${scope}/${name}` : name;
|
|
6303
|
-
console.log(chalk6.dim(` Resolving agent: ${displayRef}`));
|
|
6304
|
-
}
|
|
6305
6234
|
const compose = await getComposeByName(name, scope);
|
|
6306
6235
|
if (!compose) {
|
|
6307
6236
|
console.error(chalk6.red(`\u2717 Agent not found: ${identifier}`));
|
|
@@ -6314,25 +6243,12 @@ var mainRunCommand = new Command2().name("run").description("Run an agent").argu
|
|
|
6314
6243
|
}
|
|
6315
6244
|
composeId = compose.id;
|
|
6316
6245
|
composeContent = compose.content;
|
|
6317
|
-
if (verbose) {
|
|
6318
|
-
console.log(chalk6.dim(` Resolved to compose ID: ${composeId}`));
|
|
6319
|
-
}
|
|
6320
6246
|
}
|
|
6321
6247
|
let agentComposeVersionId;
|
|
6322
6248
|
if (version && version !== "latest") {
|
|
6323
|
-
if (verbose) {
|
|
6324
|
-
console.log(chalk6.dim(` Resolving version: ${version}`));
|
|
6325
|
-
}
|
|
6326
6249
|
try {
|
|
6327
6250
|
const versionInfo = await getComposeVersion(composeId, version);
|
|
6328
6251
|
agentComposeVersionId = versionInfo.versionId;
|
|
6329
|
-
if (verbose) {
|
|
6330
|
-
console.log(
|
|
6331
|
-
chalk6.dim(
|
|
6332
|
-
` Resolved to version ID: ${agentComposeVersionId.slice(0, 8)}...`
|
|
6333
|
-
)
|
|
6334
|
-
);
|
|
6335
|
-
}
|
|
6336
6252
|
} catch {
|
|
6337
6253
|
throw new Error(`Version not found: ${version}`);
|
|
6338
6254
|
}
|
|
@@ -6345,45 +6261,6 @@ var mainRunCommand = new Command2().name("run").description("Run an agent").argu
|
|
|
6345
6261
|
secretNames,
|
|
6346
6262
|
options.envFile
|
|
6347
6263
|
);
|
|
6348
|
-
if (verbose && varNames.length > 0) {
|
|
6349
|
-
console.log(chalk6.dim(` Required vars: ${varNames.join(", ")}`));
|
|
6350
|
-
if (vars) {
|
|
6351
|
-
console.log(
|
|
6352
|
-
chalk6.dim(` Loaded vars: ${Object.keys(vars).join(", ")}`)
|
|
6353
|
-
);
|
|
6354
|
-
}
|
|
6355
|
-
}
|
|
6356
|
-
if (verbose && secretNames.length > 0) {
|
|
6357
|
-
console.log(
|
|
6358
|
-
chalk6.dim(` Required secrets: ${secretNames.join(", ")}`)
|
|
6359
|
-
);
|
|
6360
|
-
if (secrets) {
|
|
6361
|
-
console.log(
|
|
6362
|
-
chalk6.dim(` Loaded secrets: ${Object.keys(secrets).join(", ")}`)
|
|
6363
|
-
);
|
|
6364
|
-
}
|
|
6365
|
-
}
|
|
6366
|
-
if (verbose) {
|
|
6367
|
-
logVerbosePreFlight("Creating agent run", [
|
|
6368
|
-
{ label: "Prompt", value: prompt },
|
|
6369
|
-
{ label: "Version", value: version || "latest (HEAD)" },
|
|
6370
|
-
{
|
|
6371
|
-
label: "Variables",
|
|
6372
|
-
value: vars && Object.keys(vars).length > 0 ? JSON.stringify(vars) : void 0
|
|
6373
|
-
},
|
|
6374
|
-
{
|
|
6375
|
-
label: "Secrets",
|
|
6376
|
-
value: secrets && Object.keys(secrets).length > 0 ? `${Object.keys(secrets).length} loaded` : void 0
|
|
6377
|
-
},
|
|
6378
|
-
{ label: "Artifact", value: options.artifactName },
|
|
6379
|
-
{ label: "Artifact version", value: options.artifactVersion },
|
|
6380
|
-
{
|
|
6381
|
-
label: "Volume versions",
|
|
6382
|
-
value: Object.keys(options.volumeVersion).length > 0 ? JSON.stringify(options.volumeVersion) : void 0
|
|
6383
|
-
},
|
|
6384
|
-
{ label: "Conversation", value: options.conversation }
|
|
6385
|
-
]);
|
|
6386
|
-
}
|
|
6387
6264
|
const response = await createRun({
|
|
6388
6265
|
// Use agentComposeVersionId if resolved, otherwise use agentComposeId (resolves to HEAD)
|
|
6389
6266
|
...agentComposeVersionId ? { agentComposeVersionId } : { agentComposeId: composeId },
|
|
@@ -6408,13 +6285,7 @@ var mainRunCommand = new Command2().name("run").description("Run an agent").argu
|
|
|
6408
6285
|
runId: response.runId,
|
|
6409
6286
|
sandboxId: response.sandboxId
|
|
6410
6287
|
});
|
|
6411
|
-
const result = options.experimentalRealtime ? await streamRealtimeEvents(response.runId
|
|
6412
|
-
verbose,
|
|
6413
|
-
startTimestamp
|
|
6414
|
-
}) : await pollEvents(response.runId, {
|
|
6415
|
-
verbose,
|
|
6416
|
-
startTimestamp
|
|
6417
|
-
});
|
|
6288
|
+
const result = options.experimentalRealtime ? await streamRealtimeEvents(response.runId) : await pollEvents(response.runId);
|
|
6418
6289
|
if (!result.succeeded) {
|
|
6419
6290
|
process.exit(1);
|
|
6420
6291
|
}
|
|
@@ -6456,9 +6327,9 @@ var mainRunCommand = new Command2().name("run").description("Run an agent").argu
|
|
|
6456
6327
|
);
|
|
6457
6328
|
|
|
6458
6329
|
// src/commands/run/resume.ts
|
|
6459
|
-
import { Command as
|
|
6330
|
+
import { Command as Command4, Option as Option2 } from "commander";
|
|
6460
6331
|
import chalk7 from "chalk";
|
|
6461
|
-
var resumeCommand = new
|
|
6332
|
+
var resumeCommand = new Command4().name("resume").description("Resume an agent run from a checkpoint (uses all snapshot data)").argument("<checkpointId>", "Checkpoint ID to resume from").argument("<prompt>", "Prompt for the resumed agent").option(
|
|
6462
6333
|
"--env-file <path>",
|
|
6463
6334
|
"Load environment variables from file (priority: CLI flags > file > env vars)"
|
|
6464
6335
|
).option(
|
|
@@ -6476,18 +6347,15 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6476
6347
|
"Volume version override (repeatable)",
|
|
6477
6348
|
collectVolumeVersions,
|
|
6478
6349
|
{}
|
|
6479
|
-
).option(
|
|
6350
|
+
).option(
|
|
6480
6351
|
"--experimental-realtime",
|
|
6481
6352
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6482
6353
|
).option(
|
|
6483
6354
|
"--model-provider <type>",
|
|
6484
6355
|
"Override model provider (e.g., anthropic-api-key)"
|
|
6485
6356
|
).addOption(new Option2("--debug-no-mock-claude").hideHelp()).action(
|
|
6486
|
-
// eslint-disable-next-line complexity -- TODO: refactor complex function
|
|
6487
6357
|
async (checkpointId, prompt, options, command) => {
|
|
6488
|
-
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6489
6358
|
const allOpts = command.optsWithGlobals();
|
|
6490
|
-
const verbose = options.verbose || allOpts.verbose;
|
|
6491
6359
|
const vars = { ...allOpts.vars, ...options.vars };
|
|
6492
6360
|
const secrets = { ...allOpts.secrets, ...options.secrets };
|
|
6493
6361
|
try {
|
|
@@ -6502,24 +6370,6 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6502
6370
|
const requiredSecretNames = checkpointInfo.agentComposeSnapshot.secretNames || [];
|
|
6503
6371
|
const envFile = options.envFile || allOpts.envFile;
|
|
6504
6372
|
const loadedSecrets = loadValues(secrets, requiredSecretNames, envFile);
|
|
6505
|
-
if (verbose) {
|
|
6506
|
-
logVerbosePreFlight("Resuming agent run from checkpoint", [
|
|
6507
|
-
{ label: "Checkpoint ID", value: checkpointId },
|
|
6508
|
-
{ label: "Prompt", value: prompt },
|
|
6509
|
-
{
|
|
6510
|
-
label: "Variables",
|
|
6511
|
-
value: Object.keys(vars).length > 0 ? JSON.stringify(vars) : void 0
|
|
6512
|
-
},
|
|
6513
|
-
{
|
|
6514
|
-
label: "Secrets",
|
|
6515
|
-
value: loadedSecrets && Object.keys(loadedSecrets).length > 0 ? `${Object.keys(loadedSecrets).length} loaded` : void 0
|
|
6516
|
-
},
|
|
6517
|
-
{
|
|
6518
|
-
label: "Volume overrides",
|
|
6519
|
-
value: Object.keys(allOpts.volumeVersion).length > 0 ? JSON.stringify(allOpts.volumeVersion) : void 0
|
|
6520
|
-
}
|
|
6521
|
-
]);
|
|
6522
|
-
}
|
|
6523
6373
|
const response = await createRun({
|
|
6524
6374
|
checkpointId,
|
|
6525
6375
|
prompt,
|
|
@@ -6541,13 +6391,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6541
6391
|
sandboxId: response.sandboxId
|
|
6542
6392
|
});
|
|
6543
6393
|
const experimentalRealtime = options.experimentalRealtime || allOpts.experimentalRealtime;
|
|
6544
|
-
const result = experimentalRealtime ? await streamRealtimeEvents(response.runId
|
|
6545
|
-
verbose,
|
|
6546
|
-
startTimestamp
|
|
6547
|
-
}) : await pollEvents(response.runId, {
|
|
6548
|
-
verbose,
|
|
6549
|
-
startTimestamp
|
|
6550
|
-
});
|
|
6394
|
+
const result = experimentalRealtime ? await streamRealtimeEvents(response.runId) : await pollEvents(response.runId);
|
|
6551
6395
|
if (!result.succeeded) {
|
|
6552
6396
|
process.exit(1);
|
|
6553
6397
|
}
|
|
@@ -6581,9 +6425,9 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6581
6425
|
);
|
|
6582
6426
|
|
|
6583
6427
|
// src/commands/run/continue.ts
|
|
6584
|
-
import { Command as
|
|
6428
|
+
import { Command as Command5, Option as Option3 } from "commander";
|
|
6585
6429
|
import chalk8 from "chalk";
|
|
6586
|
-
var continueCommand = new
|
|
6430
|
+
var continueCommand = new Command5().name("continue").description(
|
|
6587
6431
|
"Continue an agent run from a session (uses latest artifact version)"
|
|
6588
6432
|
).argument("<agentSessionId>", "Agent session ID to continue from").argument("<prompt>", "Prompt for the continued agent").option(
|
|
6589
6433
|
"--env-file <path>",
|
|
@@ -6603,18 +6447,15 @@ var continueCommand = new Command4().name("continue").description(
|
|
|
6603
6447
|
"Volume version override (repeatable)",
|
|
6604
6448
|
collectVolumeVersions,
|
|
6605
6449
|
{}
|
|
6606
|
-
).option(
|
|
6450
|
+
).option(
|
|
6607
6451
|
"--experimental-realtime",
|
|
6608
6452
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6609
6453
|
).option(
|
|
6610
6454
|
"--model-provider <type>",
|
|
6611
6455
|
"Override model provider (e.g., anthropic-api-key)"
|
|
6612
6456
|
).addOption(new Option3("--debug-no-mock-claude").hideHelp()).action(
|
|
6613
|
-
// eslint-disable-next-line complexity -- TODO: refactor complex function
|
|
6614
6457
|
async (agentSessionId, prompt, options, command) => {
|
|
6615
|
-
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6616
6458
|
const allOpts = command.optsWithGlobals();
|
|
6617
|
-
const verbose = options.verbose || allOpts.verbose;
|
|
6618
6459
|
const vars = { ...allOpts.vars, ...options.vars };
|
|
6619
6460
|
const secrets = { ...allOpts.secrets, ...options.secrets };
|
|
6620
6461
|
try {
|
|
@@ -6629,25 +6470,6 @@ var continueCommand = new Command4().name("continue").description(
|
|
|
6629
6470
|
const requiredSecretNames = sessionInfo.secretNames || [];
|
|
6630
6471
|
const envFile = options.envFile || allOpts.envFile;
|
|
6631
6472
|
const loadedSecrets = loadValues(secrets, requiredSecretNames, envFile);
|
|
6632
|
-
if (verbose) {
|
|
6633
|
-
logVerbosePreFlight("Continuing agent run from session", [
|
|
6634
|
-
{ label: "Session ID", value: agentSessionId },
|
|
6635
|
-
{ label: "Prompt", value: prompt },
|
|
6636
|
-
{ label: "Note", value: "Using latest artifact version" },
|
|
6637
|
-
{
|
|
6638
|
-
label: "Variables",
|
|
6639
|
-
value: Object.keys(vars).length > 0 ? JSON.stringify(vars) : void 0
|
|
6640
|
-
},
|
|
6641
|
-
{
|
|
6642
|
-
label: "Secrets",
|
|
6643
|
-
value: loadedSecrets && Object.keys(loadedSecrets).length > 0 ? `${Object.keys(loadedSecrets).length} loaded` : void 0
|
|
6644
|
-
},
|
|
6645
|
-
{
|
|
6646
|
-
label: "Volume overrides",
|
|
6647
|
-
value: Object.keys(allOpts.volumeVersion).length > 0 ? JSON.stringify(allOpts.volumeVersion) : void 0
|
|
6648
|
-
}
|
|
6649
|
-
]);
|
|
6650
|
-
}
|
|
6651
6473
|
const response = await createRun({
|
|
6652
6474
|
sessionId: agentSessionId,
|
|
6653
6475
|
prompt,
|
|
@@ -6669,13 +6491,7 @@ var continueCommand = new Command4().name("continue").description(
|
|
|
6669
6491
|
sandboxId: response.sandboxId
|
|
6670
6492
|
});
|
|
6671
6493
|
const experimentalRealtime = options.experimentalRealtime || allOpts.experimentalRealtime;
|
|
6672
|
-
const result = experimentalRealtime ? await streamRealtimeEvents(response.runId
|
|
6673
|
-
verbose,
|
|
6674
|
-
startTimestamp
|
|
6675
|
-
}) : await pollEvents(response.runId, {
|
|
6676
|
-
verbose,
|
|
6677
|
-
startTimestamp
|
|
6678
|
-
});
|
|
6494
|
+
const result = experimentalRealtime ? await streamRealtimeEvents(response.runId) : await pollEvents(response.runId);
|
|
6679
6495
|
if (!result.succeeded) {
|
|
6680
6496
|
process.exit(1);
|
|
6681
6497
|
}
|
|
@@ -6716,10 +6532,10 @@ mainRunCommand.addCommand(continueCommand);
|
|
|
6716
6532
|
var runCommand = mainRunCommand;
|
|
6717
6533
|
|
|
6718
6534
|
// src/commands/volume/index.ts
|
|
6719
|
-
import { Command as
|
|
6535
|
+
import { Command as Command12 } from "commander";
|
|
6720
6536
|
|
|
6721
6537
|
// src/commands/volume/init.ts
|
|
6722
|
-
import { Command as
|
|
6538
|
+
import { Command as Command6 } from "commander";
|
|
6723
6539
|
import chalk9 from "chalk";
|
|
6724
6540
|
import path6 from "path";
|
|
6725
6541
|
|
|
@@ -6728,8 +6544,8 @@ import { readFile as readFile5, writeFile as writeFile4, mkdir as mkdir4 } from
|
|
|
6728
6544
|
import { existsSync as existsSync5 } from "fs";
|
|
6729
6545
|
import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
|
|
6730
6546
|
import path5 from "path";
|
|
6731
|
-
var
|
|
6732
|
-
var
|
|
6547
|
+
var CONFIG_DIR = ".vm0";
|
|
6548
|
+
var CONFIG_FILE = "storage.yaml";
|
|
6733
6549
|
function isValidStorageName(name) {
|
|
6734
6550
|
if (name.length < 3 || name.length > 64) {
|
|
6735
6551
|
return false;
|
|
@@ -6738,8 +6554,8 @@ function isValidStorageName(name) {
|
|
|
6738
6554
|
return pattern.test(name) && !name.includes("--");
|
|
6739
6555
|
}
|
|
6740
6556
|
async function readStorageConfig(basePath = process.cwd()) {
|
|
6741
|
-
const configPath = path5.join(basePath,
|
|
6742
|
-
const legacyConfigPath = path5.join(basePath,
|
|
6557
|
+
const configPath = path5.join(basePath, CONFIG_DIR, CONFIG_FILE);
|
|
6558
|
+
const legacyConfigPath = path5.join(basePath, CONFIG_DIR, "volume.yaml");
|
|
6743
6559
|
let actualPath = null;
|
|
6744
6560
|
if (existsSync5(configPath)) {
|
|
6745
6561
|
actualPath = configPath;
|
|
@@ -6757,8 +6573,8 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
6757
6573
|
return config;
|
|
6758
6574
|
}
|
|
6759
6575
|
async function writeStorageConfig(storageName, basePath = process.cwd(), type = "volume") {
|
|
6760
|
-
const configDir = path5.join(basePath,
|
|
6761
|
-
const configPath = path5.join(configDir,
|
|
6576
|
+
const configDir = path5.join(basePath, CONFIG_DIR);
|
|
6577
|
+
const configPath = path5.join(configDir, CONFIG_FILE);
|
|
6762
6578
|
if (!existsSync5(configDir)) {
|
|
6763
6579
|
await mkdir4(configDir, { recursive: true });
|
|
6764
6580
|
}
|
|
@@ -6771,7 +6587,7 @@ async function writeStorageConfig(storageName, basePath = process.cwd(), type =
|
|
|
6771
6587
|
}
|
|
6772
6588
|
|
|
6773
6589
|
// src/commands/volume/init.ts
|
|
6774
|
-
var initCommand = new
|
|
6590
|
+
var initCommand = new Command6().name("init").description("Initialize a volume in the current directory").option("-n, --name <name>", "Volume name (required in non-interactive mode)").action(async (options) => {
|
|
6775
6591
|
try {
|
|
6776
6592
|
const cwd = process.cwd();
|
|
6777
6593
|
const dirName = path6.basename(cwd);
|
|
@@ -6843,9 +6659,9 @@ var initCommand = new Command5().name("init").description("Initialize a volume i
|
|
|
6843
6659
|
});
|
|
6844
6660
|
|
|
6845
6661
|
// src/commands/volume/push.ts
|
|
6846
|
-
import { Command as
|
|
6662
|
+
import { Command as Command7 } from "commander";
|
|
6847
6663
|
import chalk10 from "chalk";
|
|
6848
|
-
var pushCommand = new
|
|
6664
|
+
var pushCommand = new Command7().name("push").description("Push local files to cloud volume").option(
|
|
6849
6665
|
"-f, --force",
|
|
6850
6666
|
"Force upload even if content unchanged (recreate archive)"
|
|
6851
6667
|
).action(async (options) => {
|
|
@@ -6889,7 +6705,7 @@ var pushCommand = new Command6().name("push").description("Push local files to c
|
|
|
6889
6705
|
});
|
|
6890
6706
|
|
|
6891
6707
|
// src/commands/volume/pull.ts
|
|
6892
|
-
import { Command as
|
|
6708
|
+
import { Command as Command8 } from "commander";
|
|
6893
6709
|
import chalk12 from "chalk";
|
|
6894
6710
|
import path7 from "path";
|
|
6895
6711
|
import * as fs6 from "fs";
|
|
@@ -6909,7 +6725,7 @@ async function handleEmptyStorageResponse(cwd) {
|
|
|
6909
6725
|
}
|
|
6910
6726
|
|
|
6911
6727
|
// src/commands/volume/pull.ts
|
|
6912
|
-
var pullCommand = new
|
|
6728
|
+
var pullCommand = new Command8().name("pull").description("Pull cloud files to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(async (versionId) => {
|
|
6913
6729
|
try {
|
|
6914
6730
|
const cwd = process.cwd();
|
|
6915
6731
|
const config = await readStorageConfig(cwd);
|
|
@@ -6982,9 +6798,9 @@ var pullCommand = new Command7().name("pull").description("Pull cloud files to l
|
|
|
6982
6798
|
});
|
|
6983
6799
|
|
|
6984
6800
|
// src/commands/volume/status.ts
|
|
6985
|
-
import { Command as
|
|
6801
|
+
import { Command as Command9 } from "commander";
|
|
6986
6802
|
import chalk13 from "chalk";
|
|
6987
|
-
var statusCommand = new
|
|
6803
|
+
var statusCommand = new Command9().name("status").description("Show status of cloud volume").action(async () => {
|
|
6988
6804
|
try {
|
|
6989
6805
|
const cwd = process.cwd();
|
|
6990
6806
|
const config = await readStorageConfig(cwd);
|
|
@@ -7036,9 +6852,9 @@ var statusCommand = new Command8().name("status").description("Show status of cl
|
|
|
7036
6852
|
});
|
|
7037
6853
|
|
|
7038
6854
|
// src/commands/volume/list.ts
|
|
7039
|
-
import { Command as
|
|
6855
|
+
import { Command as Command10 } from "commander";
|
|
7040
6856
|
import chalk14 from "chalk";
|
|
7041
|
-
var listCommand = new
|
|
6857
|
+
var listCommand = new Command10().name("list").alias("ls").description("List all remote volumes").action(async () => {
|
|
7042
6858
|
try {
|
|
7043
6859
|
const items = await listStorages({ type: "volume" });
|
|
7044
6860
|
if (items.length === 0) {
|
|
@@ -7087,7 +6903,7 @@ var listCommand = new Command9().name("list").alias("ls").description("List all
|
|
|
7087
6903
|
});
|
|
7088
6904
|
|
|
7089
6905
|
// src/commands/volume/clone.ts
|
|
7090
|
-
import { Command as
|
|
6906
|
+
import { Command as Command11 } from "commander";
|
|
7091
6907
|
import chalk16 from "chalk";
|
|
7092
6908
|
|
|
7093
6909
|
// src/lib/storage/clone-utils.ts
|
|
@@ -7157,7 +6973,7 @@ async function cloneStorage(name, type, destination, options = {}) {
|
|
|
7157
6973
|
}
|
|
7158
6974
|
|
|
7159
6975
|
// src/commands/volume/clone.ts
|
|
7160
|
-
var cloneCommand = new
|
|
6976
|
+
var cloneCommand = new Command11().name("clone").description("Clone a remote volume to local directory (latest version)").argument("<name>", "Volume name to clone").argument("[destination]", "Destination directory (default: volume name)").action(async (name, destination) => {
|
|
7161
6977
|
try {
|
|
7162
6978
|
const targetDir = destination || name;
|
|
7163
6979
|
console.log(`Cloning volume: ${name}`);
|
|
@@ -7180,16 +6996,16 @@ var cloneCommand = new Command10().name("clone").description("Clone a remote vol
|
|
|
7180
6996
|
});
|
|
7181
6997
|
|
|
7182
6998
|
// src/commands/volume/index.ts
|
|
7183
|
-
var volumeCommand = new
|
|
6999
|
+
var volumeCommand = new Command12().name("volume").description("Manage volumes (defined in compose, not versioned after run)").addCommand(initCommand).addCommand(pushCommand).addCommand(pullCommand).addCommand(statusCommand).addCommand(listCommand).addCommand(cloneCommand);
|
|
7184
7000
|
|
|
7185
7001
|
// src/commands/artifact/index.ts
|
|
7186
|
-
import { Command as
|
|
7002
|
+
import { Command as Command19 } from "commander";
|
|
7187
7003
|
|
|
7188
7004
|
// src/commands/artifact/init.ts
|
|
7189
|
-
import { Command as
|
|
7005
|
+
import { Command as Command13 } from "commander";
|
|
7190
7006
|
import chalk17 from "chalk";
|
|
7191
7007
|
import path9 from "path";
|
|
7192
|
-
var initCommand2 = new
|
|
7008
|
+
var initCommand2 = new Command13().name("init").description("Initialize an artifact in the current directory").option(
|
|
7193
7009
|
"-n, --name <name>",
|
|
7194
7010
|
"Artifact name (required in non-interactive mode)"
|
|
7195
7011
|
).action(async (options) => {
|
|
@@ -7279,9 +7095,9 @@ var initCommand2 = new Command12().name("init").description("Initialize an artif
|
|
|
7279
7095
|
});
|
|
7280
7096
|
|
|
7281
7097
|
// src/commands/artifact/push.ts
|
|
7282
|
-
import { Command as
|
|
7098
|
+
import { Command as Command14 } from "commander";
|
|
7283
7099
|
import chalk18 from "chalk";
|
|
7284
|
-
var pushCommand2 = new
|
|
7100
|
+
var pushCommand2 = new Command14().name("push").description("Push local files to cloud artifact").option(
|
|
7285
7101
|
"-f, --force",
|
|
7286
7102
|
"Force upload even if content unchanged (recreate archive)"
|
|
7287
7103
|
).action(async (options) => {
|
|
@@ -7330,13 +7146,13 @@ var pushCommand2 = new Command13().name("push").description("Push local files to
|
|
|
7330
7146
|
});
|
|
7331
7147
|
|
|
7332
7148
|
// src/commands/artifact/pull.ts
|
|
7333
|
-
import { Command as
|
|
7149
|
+
import { Command as Command15 } from "commander";
|
|
7334
7150
|
import chalk19 from "chalk";
|
|
7335
7151
|
import path10 from "path";
|
|
7336
7152
|
import * as fs8 from "fs";
|
|
7337
7153
|
import * as os6 from "os";
|
|
7338
7154
|
import * as tar5 from "tar";
|
|
7339
|
-
var pullCommand2 = new
|
|
7155
|
+
var pullCommand2 = new Command15().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(async (versionId) => {
|
|
7340
7156
|
try {
|
|
7341
7157
|
const cwd = process.cwd();
|
|
7342
7158
|
const config = await readStorageConfig(cwd);
|
|
@@ -7414,9 +7230,9 @@ var pullCommand2 = new Command14().name("pull").description("Pull cloud artifact
|
|
|
7414
7230
|
});
|
|
7415
7231
|
|
|
7416
7232
|
// src/commands/artifact/status.ts
|
|
7417
|
-
import { Command as
|
|
7233
|
+
import { Command as Command16 } from "commander";
|
|
7418
7234
|
import chalk20 from "chalk";
|
|
7419
|
-
var statusCommand2 = new
|
|
7235
|
+
var statusCommand2 = new Command16().name("status").description("Show status of cloud artifact").action(async () => {
|
|
7420
7236
|
try {
|
|
7421
7237
|
const cwd = process.cwd();
|
|
7422
7238
|
const config = await readStorageConfig(cwd);
|
|
@@ -7464,9 +7280,9 @@ var statusCommand2 = new Command15().name("status").description("Show status of
|
|
|
7464
7280
|
});
|
|
7465
7281
|
|
|
7466
7282
|
// src/commands/artifact/list.ts
|
|
7467
|
-
import { Command as
|
|
7283
|
+
import { Command as Command17 } from "commander";
|
|
7468
7284
|
import chalk21 from "chalk";
|
|
7469
|
-
var listCommand2 = new
|
|
7285
|
+
var listCommand2 = new Command17().name("list").alias("ls").description("List all remote artifacts").action(async () => {
|
|
7470
7286
|
try {
|
|
7471
7287
|
const items = await listStorages({ type: "artifact" });
|
|
7472
7288
|
if (items.length === 0) {
|
|
@@ -7517,9 +7333,9 @@ var listCommand2 = new Command16().name("list").alias("ls").description("List al
|
|
|
7517
7333
|
});
|
|
7518
7334
|
|
|
7519
7335
|
// src/commands/artifact/clone.ts
|
|
7520
|
-
import { Command as
|
|
7336
|
+
import { Command as Command18 } from "commander";
|
|
7521
7337
|
import chalk22 from "chalk";
|
|
7522
|
-
var cloneCommand2 = new
|
|
7338
|
+
var cloneCommand2 = new Command18().name("clone").description("Clone a remote artifact to local directory (latest version)").argument("<name>", "Artifact name to clone").argument("[destination]", "Destination directory (default: artifact name)").action(async (name, destination) => {
|
|
7523
7339
|
try {
|
|
7524
7340
|
const targetDir = destination || name;
|
|
7525
7341
|
console.log(`Cloning artifact: ${name}`);
|
|
@@ -7542,10 +7358,10 @@ var cloneCommand2 = new Command17().name("clone").description("Clone a remote ar
|
|
|
7542
7358
|
});
|
|
7543
7359
|
|
|
7544
7360
|
// src/commands/artifact/index.ts
|
|
7545
|
-
var artifactCommand = new
|
|
7361
|
+
var artifactCommand = new Command19().name("artifact").description("Manage artifacts (specified at run, versioned after run)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand2);
|
|
7546
7362
|
|
|
7547
7363
|
// src/commands/cook.ts
|
|
7548
|
-
import { Command as
|
|
7364
|
+
import { Command as Command20, Option as Option4 } from "commander";
|
|
7549
7365
|
import chalk24 from "chalk";
|
|
7550
7366
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
7551
7367
|
import { existsSync as existsSync8 } from "fs";
|
|
@@ -7698,8 +7514,8 @@ import { homedir as homedir2 } from "os";
|
|
|
7698
7514
|
import { join as join6 } from "path";
|
|
7699
7515
|
import { readFile as readFile6, writeFile as writeFile5, mkdir as mkdir5 } from "fs/promises";
|
|
7700
7516
|
import { existsSync as existsSync7 } from "fs";
|
|
7701
|
-
var
|
|
7702
|
-
var COOK_STATE_FILE = join6(
|
|
7517
|
+
var CONFIG_DIR2 = join6(homedir2(), ".vm0");
|
|
7518
|
+
var COOK_STATE_FILE = join6(CONFIG_DIR2, "cook.json");
|
|
7703
7519
|
var STALE_THRESHOLD_MS = 48 * 60 * 60 * 1e3;
|
|
7704
7520
|
async function loadCookStateFile() {
|
|
7705
7521
|
if (!existsSync7(COOK_STATE_FILE)) {
|
|
@@ -7738,7 +7554,7 @@ async function loadCookState() {
|
|
|
7738
7554
|
};
|
|
7739
7555
|
}
|
|
7740
7556
|
async function saveCookState(state) {
|
|
7741
|
-
await mkdir5(
|
|
7557
|
+
await mkdir5(CONFIG_DIR2, { recursive: true });
|
|
7742
7558
|
const file = await loadCookStateFile();
|
|
7743
7559
|
const ppid = String(process.ppid);
|
|
7744
7560
|
const now = Date.now();
|
|
@@ -7759,7 +7575,7 @@ async function saveCookState(state) {
|
|
|
7759
7575
|
}
|
|
7760
7576
|
|
|
7761
7577
|
// src/commands/cook.ts
|
|
7762
|
-
var
|
|
7578
|
+
var CONFIG_FILE2 = "vm0.yaml";
|
|
7763
7579
|
var ARTIFACT_DIR = "artifact";
|
|
7764
7580
|
function printCommand(cmd) {
|
|
7765
7581
|
console.log(chalk24.dim(`> ${cmd}`));
|
|
@@ -7906,7 +7722,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
7906
7722
|
}
|
|
7907
7723
|
}
|
|
7908
7724
|
}
|
|
7909
|
-
var cookCmd = new
|
|
7725
|
+
var cookCmd = new Command20().name("cook").description("Quick start: prepare, compose and run agent from vm0.yaml");
|
|
7910
7726
|
cookCmd.argument("[prompt]", "Prompt for the agent").option(
|
|
7911
7727
|
"--env-file <path>",
|
|
7912
7728
|
"Load environment variables from file (priority: CLI flags > file > env vars)"
|
|
@@ -7914,20 +7730,20 @@ cookCmd.argument("[prompt]", "Prompt for the agent").option(
|
|
|
7914
7730
|
// eslint-disable-next-line complexity -- TODO: refactor complex function
|
|
7915
7731
|
async (prompt, options) => {
|
|
7916
7732
|
if (!options.noAutoUpdate) {
|
|
7917
|
-
const shouldExit = await checkAndUpgrade("9.1
|
|
7733
|
+
const shouldExit = await checkAndUpgrade("9.2.1", prompt);
|
|
7918
7734
|
if (shouldExit) {
|
|
7919
7735
|
process.exit(0);
|
|
7920
7736
|
}
|
|
7921
7737
|
}
|
|
7922
7738
|
const cwd = process.cwd();
|
|
7923
|
-
console.log(chalk24.bold(`Reading config: ${
|
|
7924
|
-
if (!existsSync8(
|
|
7925
|
-
console.error(chalk24.red(`\u2717 Config file not found: ${
|
|
7739
|
+
console.log(chalk24.bold(`Reading config: ${CONFIG_FILE2}`));
|
|
7740
|
+
if (!existsSync8(CONFIG_FILE2)) {
|
|
7741
|
+
console.error(chalk24.red(`\u2717 Config file not found: ${CONFIG_FILE2}`));
|
|
7926
7742
|
process.exit(1);
|
|
7927
7743
|
}
|
|
7928
7744
|
let config;
|
|
7929
7745
|
try {
|
|
7930
|
-
const content = await readFile7(
|
|
7746
|
+
const content = await readFile7(CONFIG_FILE2, "utf8");
|
|
7931
7747
|
config = parseYaml4(content);
|
|
7932
7748
|
} catch (error) {
|
|
7933
7749
|
console.error(chalk24.red("\u2717 Invalid YAML format"));
|
|
@@ -8048,7 +7864,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").option(
|
|
|
8048
7864
|
}
|
|
8049
7865
|
console.log();
|
|
8050
7866
|
console.log(chalk24.bold("Composing agent:"));
|
|
8051
|
-
const composeArgs = options.yes ? ["compose", "--yes",
|
|
7867
|
+
const composeArgs = options.yes ? ["compose", "--yes", CONFIG_FILE2] : ["compose", CONFIG_FILE2];
|
|
8052
7868
|
printCommand(`vm0 ${composeArgs.join(" ")}`);
|
|
8053
7869
|
try {
|
|
8054
7870
|
await execVm0Command(composeArgs, {
|
|
@@ -8242,7 +8058,7 @@ cookCmd.command("resume").description(
|
|
|
8242
8058
|
var cookCommand = cookCmd;
|
|
8243
8059
|
|
|
8244
8060
|
// src/commands/logs/index.ts
|
|
8245
|
-
import { Command as
|
|
8061
|
+
import { Command as Command21 } from "commander";
|
|
8246
8062
|
import chalk25 from "chalk";
|
|
8247
8063
|
|
|
8248
8064
|
// src/lib/utils/time-parser.ts
|
|
@@ -8360,7 +8176,7 @@ function getLogType(options) {
|
|
|
8360
8176
|
if (options.network) return "network";
|
|
8361
8177
|
return "agent";
|
|
8362
8178
|
}
|
|
8363
|
-
var logsCommand = new
|
|
8179
|
+
var logsCommand = new Command21().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(
|
|
8364
8180
|
"--since <time>",
|
|
8365
8181
|
"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z, 1705312200)"
|
|
8366
8182
|
).option("--tail <n>", "Show last N entries (default: 5, max: 100)").option("--head <n>", "Show first N entries (max: 100)").action(
|
|
@@ -8496,12 +8312,12 @@ function handleError2(error, runId) {
|
|
|
8496
8312
|
}
|
|
8497
8313
|
|
|
8498
8314
|
// src/commands/scope/index.ts
|
|
8499
|
-
import { Command as
|
|
8315
|
+
import { Command as Command24 } from "commander";
|
|
8500
8316
|
|
|
8501
8317
|
// src/commands/scope/status.ts
|
|
8502
|
-
import { Command as
|
|
8318
|
+
import { Command as Command22 } from "commander";
|
|
8503
8319
|
import chalk26 from "chalk";
|
|
8504
|
-
var statusCommand3 = new
|
|
8320
|
+
var statusCommand3 = new Command22().name("status").description("View current scope status").action(async () => {
|
|
8505
8321
|
try {
|
|
8506
8322
|
const scope = await getScope();
|
|
8507
8323
|
console.log(chalk26.bold("Scope Information:"));
|
|
@@ -8533,9 +8349,9 @@ var statusCommand3 = new Command21().name("status").description("View current sc
|
|
|
8533
8349
|
});
|
|
8534
8350
|
|
|
8535
8351
|
// src/commands/scope/set.ts
|
|
8536
|
-
import { Command as
|
|
8352
|
+
import { Command as Command23 } from "commander";
|
|
8537
8353
|
import chalk27 from "chalk";
|
|
8538
|
-
var setCommand = new
|
|
8354
|
+
var setCommand = new Command23().name("set").description("Set your scope slug").argument("<slug>", "The scope slug (e.g., your username)").option("--force", "Force change existing scope (may break references)").action(async (slug, options) => {
|
|
8539
8355
|
try {
|
|
8540
8356
|
let existingScope;
|
|
8541
8357
|
try {
|
|
@@ -8600,15 +8416,15 @@ var setCommand = new Command22().name("set").description("Set your scope slug").
|
|
|
8600
8416
|
});
|
|
8601
8417
|
|
|
8602
8418
|
// src/commands/scope/index.ts
|
|
8603
|
-
var scopeCommand = new
|
|
8419
|
+
var scopeCommand = new Command24().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand3).addCommand(setCommand);
|
|
8604
8420
|
|
|
8605
8421
|
// src/commands/agent/index.ts
|
|
8606
|
-
import { Command as
|
|
8422
|
+
import { Command as Command27 } from "commander";
|
|
8607
8423
|
|
|
8608
8424
|
// src/commands/agent/list.ts
|
|
8609
|
-
import { Command as
|
|
8425
|
+
import { Command as Command25 } from "commander";
|
|
8610
8426
|
import chalk28 from "chalk";
|
|
8611
|
-
var listCommand3 = new
|
|
8427
|
+
var listCommand3 = new Command25().name("list").alias("ls").description("List all agent composes").action(async () => {
|
|
8612
8428
|
try {
|
|
8613
8429
|
const response = await httpGet("/api/agent/composes/list");
|
|
8614
8430
|
if (!response.ok) {
|
|
@@ -8651,7 +8467,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
8651
8467
|
});
|
|
8652
8468
|
|
|
8653
8469
|
// src/commands/agent/status.ts
|
|
8654
|
-
import { Command as
|
|
8470
|
+
import { Command as Command26 } from "commander";
|
|
8655
8471
|
import chalk29 from "chalk";
|
|
8656
8472
|
|
|
8657
8473
|
// src/lib/domain/source-derivation.ts
|
|
@@ -8824,7 +8640,7 @@ function formatComposeOutput(name, versionId, content, variableSources) {
|
|
|
8824
8640
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
8825
8641
|
}
|
|
8826
8642
|
}
|
|
8827
|
-
var statusCommand4 = new
|
|
8643
|
+
var statusCommand4 = new Command26().name("status").description("Show status of agent compose").argument(
|
|
8828
8644
|
"<name[:version]>",
|
|
8829
8645
|
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
8830
8646
|
).option("--no-sources", "Skip fetching skills to determine variable sources").action(async (argument, options) => {
|
|
@@ -8904,10 +8720,10 @@ var statusCommand4 = new Command25().name("status").description("Show status of
|
|
|
8904
8720
|
});
|
|
8905
8721
|
|
|
8906
8722
|
// src/commands/agent/index.ts
|
|
8907
|
-
var agentCommand = new
|
|
8723
|
+
var agentCommand = new Command27().name("agent").description("Manage agent composes").addCommand(listCommand3).addCommand(statusCommand4);
|
|
8908
8724
|
|
|
8909
8725
|
// src/commands/init.ts
|
|
8910
|
-
import { Command as
|
|
8726
|
+
import { Command as Command28 } from "commander";
|
|
8911
8727
|
import chalk30 from "chalk";
|
|
8912
8728
|
import path13 from "path";
|
|
8913
8729
|
import { existsSync as existsSync9 } from "fs";
|
|
@@ -8946,7 +8762,7 @@ function checkExistingFiles() {
|
|
|
8946
8762
|
if (existsSync9(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
8947
8763
|
return existingFiles;
|
|
8948
8764
|
}
|
|
8949
|
-
var initCommand3 = new
|
|
8765
|
+
var initCommand3 = new Command28().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) => {
|
|
8950
8766
|
const existingFiles = checkExistingFiles();
|
|
8951
8767
|
if (existingFiles.length > 0 && !options.force) {
|
|
8952
8768
|
for (const file of existingFiles) {
|
|
@@ -9012,10 +8828,10 @@ var initCommand3 = new Command27().name("init").description("Initialize a new VM
|
|
|
9012
8828
|
});
|
|
9013
8829
|
|
|
9014
8830
|
// src/commands/schedule/index.ts
|
|
9015
|
-
import { Command as
|
|
8831
|
+
import { Command as Command35 } from "commander";
|
|
9016
8832
|
|
|
9017
8833
|
// src/commands/schedule/setup.ts
|
|
9018
|
-
import { Command as
|
|
8834
|
+
import { Command as Command29 } from "commander";
|
|
9019
8835
|
import chalk32 from "chalk";
|
|
9020
8836
|
|
|
9021
8837
|
// src/lib/domain/schedule-utils.ts
|
|
@@ -9680,7 +9496,7 @@ async function handleScheduleEnabling(params) {
|
|
|
9680
9496
|
showEnableHint(agentName);
|
|
9681
9497
|
}
|
|
9682
9498
|
}
|
|
9683
|
-
var setupCommand = new
|
|
9499
|
+
var setupCommand = new Command29().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("--var <name=value>", "Variable (can be repeated)", collect, []).option("--secret <name=value>", "Secret (can be repeated)", collect, []).option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
|
|
9684
9500
|
try {
|
|
9685
9501
|
const { composeId, scheduleName, composeContent } = await resolveAgent(agentName);
|
|
9686
9502
|
const requiredConfig = extractRequiredConfiguration(composeContent);
|
|
@@ -9756,9 +9572,9 @@ var setupCommand = new Command28().name("setup").description("Create or edit a s
|
|
|
9756
9572
|
});
|
|
9757
9573
|
|
|
9758
9574
|
// src/commands/schedule/list.ts
|
|
9759
|
-
import { Command as
|
|
9575
|
+
import { Command as Command30 } from "commander";
|
|
9760
9576
|
import chalk33 from "chalk";
|
|
9761
|
-
var listCommand4 = new
|
|
9577
|
+
var listCommand4 = new Command30().name("list").alias("ls").description("List all schedules").action(async () => {
|
|
9762
9578
|
try {
|
|
9763
9579
|
const result = await listSchedules();
|
|
9764
9580
|
if (result.schedules.length === 0) {
|
|
@@ -9812,7 +9628,7 @@ var listCommand4 = new Command29().name("list").alias("ls").description("List al
|
|
|
9812
9628
|
});
|
|
9813
9629
|
|
|
9814
9630
|
// src/commands/schedule/status.ts
|
|
9815
|
-
import { Command as
|
|
9631
|
+
import { Command as Command31 } from "commander";
|
|
9816
9632
|
import chalk34 from "chalk";
|
|
9817
9633
|
function formatDateTimeStyled(dateStr) {
|
|
9818
9634
|
if (!dateStr) return chalk34.dim("-");
|
|
@@ -9915,7 +9731,7 @@ function handleStatusError(error, agentName) {
|
|
|
9915
9731
|
}
|
|
9916
9732
|
process.exit(1);
|
|
9917
9733
|
}
|
|
9918
|
-
var statusCommand5 = new
|
|
9734
|
+
var statusCommand5 = new Command31().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
9919
9735
|
"-l, --limit <number>",
|
|
9920
9736
|
"Number of recent runs to show (0 to hide)",
|
|
9921
9737
|
"5"
|
|
@@ -9941,9 +9757,9 @@ var statusCommand5 = new Command30().name("status").description("Show detailed s
|
|
|
9941
9757
|
});
|
|
9942
9758
|
|
|
9943
9759
|
// src/commands/schedule/delete.ts
|
|
9944
|
-
import { Command as
|
|
9760
|
+
import { Command as Command32 } from "commander";
|
|
9945
9761
|
import chalk35 from "chalk";
|
|
9946
|
-
var deleteCommand = new
|
|
9762
|
+
var deleteCommand = new Command32().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
9947
9763
|
try {
|
|
9948
9764
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
9949
9765
|
if (!options.force) {
|
|
@@ -9988,9 +9804,9 @@ var deleteCommand = new Command31().name("delete").alias("rm").description("Dele
|
|
|
9988
9804
|
});
|
|
9989
9805
|
|
|
9990
9806
|
// src/commands/schedule/enable.ts
|
|
9991
|
-
import { Command as
|
|
9807
|
+
import { Command as Command33 } from "commander";
|
|
9992
9808
|
import chalk36 from "chalk";
|
|
9993
|
-
var enableCommand = new
|
|
9809
|
+
var enableCommand = new Command33().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
9994
9810
|
try {
|
|
9995
9811
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
9996
9812
|
await enableSchedule({
|
|
@@ -10033,9 +9849,9 @@ var enableCommand = new Command32().name("enable").description("Enable a schedul
|
|
|
10033
9849
|
});
|
|
10034
9850
|
|
|
10035
9851
|
// src/commands/schedule/disable.ts
|
|
10036
|
-
import { Command as
|
|
9852
|
+
import { Command as Command34 } from "commander";
|
|
10037
9853
|
import chalk37 from "chalk";
|
|
10038
|
-
var disableCommand = new
|
|
9854
|
+
var disableCommand = new Command34().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
10039
9855
|
try {
|
|
10040
9856
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
10041
9857
|
await disableSchedule({
|
|
@@ -10064,10 +9880,10 @@ var disableCommand = new Command33().name("disable").description("Disable a sche
|
|
|
10064
9880
|
});
|
|
10065
9881
|
|
|
10066
9882
|
// src/commands/schedule/index.ts
|
|
10067
|
-
var scheduleCommand = new
|
|
9883
|
+
var scheduleCommand = new Command35().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand4).addCommand(statusCommand5).addCommand(deleteCommand).addCommand(enableCommand).addCommand(disableCommand);
|
|
10068
9884
|
|
|
10069
9885
|
// src/commands/usage.ts
|
|
10070
|
-
import { Command as
|
|
9886
|
+
import { Command as Command36 } from "commander";
|
|
10071
9887
|
import chalk38 from "chalk";
|
|
10072
9888
|
|
|
10073
9889
|
// src/lib/utils/duration-formatter.ts
|
|
@@ -10141,7 +9957,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
10141
9957
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
10142
9958
|
return result;
|
|
10143
9959
|
}
|
|
10144
|
-
var usageCommand = new
|
|
9960
|
+
var usageCommand = new Command36().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
10145
9961
|
"--until <date>",
|
|
10146
9962
|
"End date (ISO format or relative, defaults to now)"
|
|
10147
9963
|
).action(async (options) => {
|
|
@@ -10238,12 +10054,12 @@ var usageCommand = new Command35().name("usage").description("View usage statist
|
|
|
10238
10054
|
});
|
|
10239
10055
|
|
|
10240
10056
|
// src/commands/credential/index.ts
|
|
10241
|
-
import { Command as
|
|
10057
|
+
import { Command as Command40 } from "commander";
|
|
10242
10058
|
|
|
10243
10059
|
// src/commands/credential/list.ts
|
|
10244
|
-
import { Command as
|
|
10060
|
+
import { Command as Command37 } from "commander";
|
|
10245
10061
|
import chalk39 from "chalk";
|
|
10246
|
-
var listCommand5 = new
|
|
10062
|
+
var listCommand5 = new Command37().name("list").alias("ls").description("List all credentials").action(async () => {
|
|
10247
10063
|
try {
|
|
10248
10064
|
const result = await listCredentials();
|
|
10249
10065
|
if (result.credentials.length === 0) {
|
|
@@ -10284,9 +10100,9 @@ var listCommand5 = new Command36().name("list").alias("ls").description("List al
|
|
|
10284
10100
|
});
|
|
10285
10101
|
|
|
10286
10102
|
// src/commands/credential/set.ts
|
|
10287
|
-
import { Command as
|
|
10103
|
+
import { Command as Command38 } from "commander";
|
|
10288
10104
|
import chalk40 from "chalk";
|
|
10289
|
-
var setCommand2 = new
|
|
10105
|
+
var setCommand2 = new Command38().name("set").description("Create or update a credential").argument("<name>", "Credential name (uppercase, e.g., MY_API_KEY)").argument("<value>", "Credential value").option("-d, --description <description>", "Optional description").action(
|
|
10290
10106
|
async (name, value, options) => {
|
|
10291
10107
|
try {
|
|
10292
10108
|
const credential = await setCredential({
|
|
@@ -10324,9 +10140,9 @@ var setCommand2 = new Command37().name("set").description("Create or update a cr
|
|
|
10324
10140
|
);
|
|
10325
10141
|
|
|
10326
10142
|
// src/commands/credential/delete.ts
|
|
10327
|
-
import { Command as
|
|
10143
|
+
import { Command as Command39 } from "commander";
|
|
10328
10144
|
import chalk41 from "chalk";
|
|
10329
|
-
var deleteCommand2 = new
|
|
10145
|
+
var deleteCommand2 = new Command39().name("delete").description("Delete a credential").argument("<name>", "Credential name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
10330
10146
|
try {
|
|
10331
10147
|
try {
|
|
10332
10148
|
await getCredential(name);
|
|
@@ -10367,15 +10183,15 @@ var deleteCommand2 = new Command38().name("delete").description("Delete a creden
|
|
|
10367
10183
|
});
|
|
10368
10184
|
|
|
10369
10185
|
// src/commands/credential/index.ts
|
|
10370
|
-
var credentialCommand = new
|
|
10186
|
+
var credentialCommand = new Command40().name("credential").description("Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
10371
10187
|
|
|
10372
10188
|
// src/commands/model-provider/index.ts
|
|
10373
|
-
import { Command as
|
|
10189
|
+
import { Command as Command45 } from "commander";
|
|
10374
10190
|
|
|
10375
10191
|
// src/commands/model-provider/list.ts
|
|
10376
|
-
import { Command as
|
|
10192
|
+
import { Command as Command41 } from "commander";
|
|
10377
10193
|
import chalk42 from "chalk";
|
|
10378
|
-
var listCommand6 = new
|
|
10194
|
+
var listCommand6 = new Command41().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
10379
10195
|
try {
|
|
10380
10196
|
const result = await listModelProviders();
|
|
10381
10197
|
if (result.modelProviders.length === 0) {
|
|
@@ -10429,7 +10245,7 @@ var listCommand6 = new Command40().name("list").alias("ls").description("List al
|
|
|
10429
10245
|
});
|
|
10430
10246
|
|
|
10431
10247
|
// src/commands/model-provider/setup.ts
|
|
10432
|
-
import { Command as
|
|
10248
|
+
import { Command as Command42 } from "commander";
|
|
10433
10249
|
import chalk43 from "chalk";
|
|
10434
10250
|
import prompts2 from "prompts";
|
|
10435
10251
|
var providerChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
@@ -10438,7 +10254,7 @@ var providerChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
|
10438
10254
|
value: type
|
|
10439
10255
|
})
|
|
10440
10256
|
);
|
|
10441
|
-
var setupCommand2 = new
|
|
10257
|
+
var setupCommand2 = new Command42().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
10442
10258
|
"-c, --credential <credential>",
|
|
10443
10259
|
"Credential value (for non-interactive mode)"
|
|
10444
10260
|
).option("--convert", "Convert existing user credential to model provider").action(
|
|
@@ -10559,9 +10375,9 @@ var setupCommand2 = new Command41().name("setup").description("Configure a model
|
|
|
10559
10375
|
);
|
|
10560
10376
|
|
|
10561
10377
|
// src/commands/model-provider/delete.ts
|
|
10562
|
-
import { Command as
|
|
10378
|
+
import { Command as Command43 } from "commander";
|
|
10563
10379
|
import chalk44 from "chalk";
|
|
10564
|
-
var deleteCommand3 = new
|
|
10380
|
+
var deleteCommand3 = new Command43().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
10565
10381
|
try {
|
|
10566
10382
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
10567
10383
|
console.error(chalk44.red(`\u2717 Invalid type "${type}"`));
|
|
@@ -10591,9 +10407,9 @@ var deleteCommand3 = new Command42().name("delete").description("Delete a model
|
|
|
10591
10407
|
});
|
|
10592
10408
|
|
|
10593
10409
|
// src/commands/model-provider/set-default.ts
|
|
10594
|
-
import { Command as
|
|
10410
|
+
import { Command as Command44 } from "commander";
|
|
10595
10411
|
import chalk45 from "chalk";
|
|
10596
|
-
var setDefaultCommand = new
|
|
10412
|
+
var setDefaultCommand = new Command44().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
|
|
10597
10413
|
try {
|
|
10598
10414
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
10599
10415
|
console.error(chalk45.red(`\u2717 Invalid type "${type}"`));
|
|
@@ -10627,17 +10443,17 @@ var setDefaultCommand = new Command43().name("set-default").description("Set a m
|
|
|
10627
10443
|
});
|
|
10628
10444
|
|
|
10629
10445
|
// src/commands/model-provider/index.ts
|
|
10630
|
-
var modelProviderCommand = new
|
|
10446
|
+
var modelProviderCommand = new Command45().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand6).addCommand(setupCommand2).addCommand(deleteCommand3).addCommand(setDefaultCommand);
|
|
10631
10447
|
|
|
10632
10448
|
// src/commands/onboard.ts
|
|
10633
|
-
import { Command as
|
|
10449
|
+
import { Command as Command47 } from "commander";
|
|
10634
10450
|
import chalk47 from "chalk";
|
|
10635
10451
|
import prompts3 from "prompts";
|
|
10636
10452
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
10637
10453
|
import { existsSync as existsSync10 } from "fs";
|
|
10638
10454
|
|
|
10639
10455
|
// src/commands/setup-claude.ts
|
|
10640
|
-
import { Command as
|
|
10456
|
+
import { Command as Command46 } from "commander";
|
|
10641
10457
|
import chalk46 from "chalk";
|
|
10642
10458
|
import { mkdir as mkdir7, writeFile as writeFile7 } from "fs/promises";
|
|
10643
10459
|
import path14 from "path";
|
|
@@ -10849,7 +10665,10 @@ Write results to the artifact directory.
|
|
|
10849
10665
|
- Provide exact templates for output files
|
|
10850
10666
|
- Include example output in the instructions
|
|
10851
10667
|
`;
|
|
10852
|
-
var setupClaudeCommand = new
|
|
10668
|
+
var setupClaudeCommand = new Command46().name("setup-claude").description("Add/update Claude skill for agent building").option(
|
|
10669
|
+
"--agent-dir <dir>",
|
|
10670
|
+
"Agent directory (shown in next step instructions)"
|
|
10671
|
+
).action(async (options) => {
|
|
10853
10672
|
console.log(chalk46.dim("Installing vm0-agent-builder skill..."));
|
|
10854
10673
|
await mkdir7(SKILL_DIR, { recursive: true });
|
|
10855
10674
|
await writeFile7(path14.join(SKILL_DIR, "SKILL.md"), SKILL_CONTENT);
|
|
@@ -10858,9 +10677,10 @@ var setupClaudeCommand = new Command45().name("setup-claude").description("Add/u
|
|
|
10858
10677
|
);
|
|
10859
10678
|
console.log();
|
|
10860
10679
|
console.log("Next step:");
|
|
10680
|
+
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
10861
10681
|
console.log(
|
|
10862
10682
|
chalk46.cyan(
|
|
10863
|
-
|
|
10683
|
+
` ${cdPrefix}claude "/vm0-agent-builder I want to build an agent that..."`
|
|
10864
10684
|
)
|
|
10865
10685
|
);
|
|
10866
10686
|
});
|
|
@@ -10868,7 +10688,7 @@ var setupClaudeCommand = new Command45().name("setup-claude").description("Add/u
|
|
|
10868
10688
|
// src/commands/onboard.ts
|
|
10869
10689
|
var DEMO_AGENT_DIR = "vm0-demo-agent";
|
|
10870
10690
|
var DEMO_AGENT_NAME = "vm0-demo-agent";
|
|
10871
|
-
var onboardCommand = new
|
|
10691
|
+
var onboardCommand = new Command47().name("onboard").description("Guided setup for new VM0 users").option("-y, --yes", "Skip confirmation prompts").option(
|
|
10872
10692
|
"--method <method>",
|
|
10873
10693
|
"Agent building method: claude or manual",
|
|
10874
10694
|
void 0
|
|
@@ -10879,25 +10699,21 @@ var onboardCommand = new Command46().name("onboard").description("Guided setup f
|
|
|
10879
10699
|
} else {
|
|
10880
10700
|
console.log(chalk47.dim("Authentication required..."));
|
|
10881
10701
|
console.log();
|
|
10882
|
-
await
|
|
10702
|
+
await loginCommand.parseAsync([], { from: "user" });
|
|
10883
10703
|
}
|
|
10884
10704
|
try {
|
|
10885
10705
|
const result = await listModelProviders();
|
|
10886
10706
|
if (result.modelProviders.length > 0) {
|
|
10887
10707
|
console.log(chalk47.green("Done Model provider configured"));
|
|
10888
10708
|
} else {
|
|
10889
|
-
console.log(chalk47.
|
|
10890
|
-
console.log();
|
|
10891
|
-
console.log("Run the following to set up:");
|
|
10892
|
-
console.log(chalk47.cyan(" vm0 model-provider setup"));
|
|
10709
|
+
console.log(chalk47.dim("Model provider setup required..."));
|
|
10893
10710
|
console.log();
|
|
10711
|
+
await setupCommand2.parseAsync([], { from: "user" });
|
|
10894
10712
|
}
|
|
10895
|
-
} catch
|
|
10896
|
-
|
|
10897
|
-
console.log(
|
|
10898
|
-
chalk47.yellow(`! Could not check model provider status: ${message}`)
|
|
10899
|
-
);
|
|
10713
|
+
} catch {
|
|
10714
|
+
console.log(chalk47.dim("Setting up model provider..."));
|
|
10900
10715
|
console.log();
|
|
10716
|
+
await setupCommand2.parseAsync([], { from: "user" });
|
|
10901
10717
|
}
|
|
10902
10718
|
let createAgent = options.yes;
|
|
10903
10719
|
if (!createAgent && isInteractive()) {
|
|
@@ -10959,7 +10775,9 @@ var onboardCommand = new Command46().name("onboard").description("Guided setup f
|
|
|
10959
10775
|
if (method === "claude") {
|
|
10960
10776
|
process.chdir(DEMO_AGENT_DIR);
|
|
10961
10777
|
try {
|
|
10962
|
-
await setupClaudeCommand.parseAsync([], {
|
|
10778
|
+
await setupClaudeCommand.parseAsync(["--agent-dir", DEMO_AGENT_DIR], {
|
|
10779
|
+
from: "user"
|
|
10780
|
+
});
|
|
10963
10781
|
} finally {
|
|
10964
10782
|
process.chdir(originalDir);
|
|
10965
10783
|
}
|
|
@@ -10975,8 +10793,8 @@ var onboardCommand = new Command46().name("onboard").description("Guided setup f
|
|
|
10975
10793
|
});
|
|
10976
10794
|
|
|
10977
10795
|
// src/index.ts
|
|
10978
|
-
var program = new
|
|
10979
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.1
|
|
10796
|
+
var program = new Command48();
|
|
10797
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.2.1");
|
|
10980
10798
|
program.command("info").description("Display environment information").action(async () => {
|
|
10981
10799
|
console.log(chalk48.bold("System Information:"));
|
|
10982
10800
|
console.log(`Node Version: ${process.version}`);
|
|
@@ -10986,9 +10804,7 @@ program.command("info").description("Display environment information").action(as
|
|
|
10986
10804
|
console.log(`API Host: ${apiUrl}`);
|
|
10987
10805
|
});
|
|
10988
10806
|
var authCommand = program.command("auth").description("Authenticate vm0");
|
|
10989
|
-
authCommand.
|
|
10990
|
-
await authenticate();
|
|
10991
|
-
});
|
|
10807
|
+
authCommand.addCommand(loginCommand);
|
|
10992
10808
|
authCommand.command("logout").description("Log out of VM0").action(async () => {
|
|
10993
10809
|
await logout();
|
|
10994
10810
|
});
|