@vm0/cli 4.26.0 → 4.26.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 +187 -201
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -88,7 +88,7 @@ function delay(ms) {
|
|
|
88
88
|
}
|
|
89
89
|
async function authenticate(apiUrl) {
|
|
90
90
|
const targetApiUrl = apiUrl ?? await getApiUrl();
|
|
91
|
-
console.log(
|
|
91
|
+
console.log("Initiating authentication...");
|
|
92
92
|
const deviceAuth = await requestDeviceCode(targetApiUrl);
|
|
93
93
|
console.log(chalk.green("\nDevice code generated"));
|
|
94
94
|
const verificationUrl = `${targetApiUrl}/cli-auth`;
|
|
@@ -99,7 +99,7 @@ To authenticate, visit: ${verificationUrl}`));
|
|
|
99
99
|
`
|
|
100
100
|
The code expires in ${Math.floor(deviceAuth.expires_in / 60)} minutes.`
|
|
101
101
|
);
|
|
102
|
-
console.log(
|
|
102
|
+
console.log("\nWaiting for authentication...");
|
|
103
103
|
const startTime = Date.now();
|
|
104
104
|
const maxWaitTime = deviceAuth.expires_in * 1e3;
|
|
105
105
|
const pollInterval = (deviceAuth.interval || 5) * 1e3;
|
|
@@ -123,7 +123,7 @@ The code expires in ${Math.floor(deviceAuth.expires_in / 60)} minutes.`
|
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
if (tokenResult.error === "authorization_pending") {
|
|
126
|
-
process.stdout.write(chalk.
|
|
126
|
+
process.stdout.write(chalk.dim("."));
|
|
127
127
|
continue;
|
|
128
128
|
}
|
|
129
129
|
if (tokenResult.error === "expired_token") {
|
|
@@ -160,7 +160,7 @@ async function checkAuthStatus() {
|
|
|
160
160
|
console.log("Run 'vm0 auth login' to authenticate.");
|
|
161
161
|
}
|
|
162
162
|
if (process.env.VM0_TOKEN) {
|
|
163
|
-
console.log(
|
|
163
|
+
console.log("Using token from VM0_TOKEN environment variable");
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
async function setupToken() {
|
|
@@ -13886,8 +13886,8 @@ function isProviderSupported(provider) {
|
|
|
13886
13886
|
function getDefaultImage(provider) {
|
|
13887
13887
|
const defaults = PROVIDER_DEFAULTS[provider];
|
|
13888
13888
|
if (!defaults) return void 0;
|
|
13889
|
-
const
|
|
13890
|
-
return
|
|
13889
|
+
const isDevelopment = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
13890
|
+
return isDevelopment ? defaults.image.development : defaults.image.production;
|
|
13891
13891
|
}
|
|
13892
13892
|
|
|
13893
13893
|
// src/lib/yaml-validator.ts
|
|
@@ -14495,7 +14495,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14495
14495
|
} catch (error43) {
|
|
14496
14496
|
console.error(chalk2.red("\u2717 Invalid YAML format"));
|
|
14497
14497
|
if (error43 instanceof Error) {
|
|
14498
|
-
console.error(chalk2.
|
|
14498
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14499
14499
|
}
|
|
14500
14500
|
process.exit(1);
|
|
14501
14501
|
}
|
|
@@ -14527,14 +14527,14 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14527
14527
|
if (defaultImage) {
|
|
14528
14528
|
agent.image = defaultImage;
|
|
14529
14529
|
console.log(
|
|
14530
|
-
chalk2.
|
|
14530
|
+
chalk2.dim(` Auto-configured image: ${defaultImage}`)
|
|
14531
14531
|
);
|
|
14532
14532
|
}
|
|
14533
14533
|
}
|
|
14534
14534
|
if (!agent.working_dir) {
|
|
14535
14535
|
agent.working_dir = defaults.workingDir;
|
|
14536
14536
|
console.log(
|
|
14537
|
-
chalk2.
|
|
14537
|
+
chalk2.dim(
|
|
14538
14538
|
` Auto-configured working_dir: ${defaults.workingDir}`
|
|
14539
14539
|
)
|
|
14540
14540
|
);
|
|
@@ -14544,7 +14544,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14544
14544
|
if (agent.instructions) {
|
|
14545
14545
|
const instructionsPath = agent.instructions;
|
|
14546
14546
|
const provider = agent.provider;
|
|
14547
|
-
console.log(
|
|
14547
|
+
console.log(`Uploading instructions: ${instructionsPath}`);
|
|
14548
14548
|
try {
|
|
14549
14549
|
const result = await uploadInstructions(
|
|
14550
14550
|
agentName,
|
|
@@ -14560,17 +14560,17 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14560
14560
|
} catch (error43) {
|
|
14561
14561
|
console.error(chalk2.red(`\u2717 Failed to upload instructions`));
|
|
14562
14562
|
if (error43 instanceof Error) {
|
|
14563
|
-
console.error(chalk2.
|
|
14563
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14564
14564
|
}
|
|
14565
14565
|
process.exit(1);
|
|
14566
14566
|
}
|
|
14567
14567
|
}
|
|
14568
14568
|
if (agent.skills && Array.isArray(agent.skills)) {
|
|
14569
14569
|
const skillUrls = agent.skills;
|
|
14570
|
-
console.log(
|
|
14570
|
+
console.log(`Uploading ${skillUrls.length} skill(s)...`);
|
|
14571
14571
|
for (const skillUrl of skillUrls) {
|
|
14572
14572
|
try {
|
|
14573
|
-
console.log(chalk2.
|
|
14573
|
+
console.log(chalk2.dim(` Downloading: ${skillUrl}`));
|
|
14574
14574
|
const result = await uploadSkill(skillUrl);
|
|
14575
14575
|
console.log(
|
|
14576
14576
|
chalk2.green(
|
|
@@ -14580,13 +14580,13 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14580
14580
|
} catch (error43) {
|
|
14581
14581
|
console.error(chalk2.red(`\u2717 Failed to upload skill: ${skillUrl}`));
|
|
14582
14582
|
if (error43 instanceof Error) {
|
|
14583
|
-
console.error(chalk2.
|
|
14583
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14584
14584
|
}
|
|
14585
14585
|
process.exit(1);
|
|
14586
14586
|
}
|
|
14587
14587
|
}
|
|
14588
14588
|
}
|
|
14589
|
-
console.log(
|
|
14589
|
+
console.log("Uploading compose...");
|
|
14590
14590
|
const response = await apiClient.createOrUpdateCompose({
|
|
14591
14591
|
content: config2
|
|
14592
14592
|
});
|
|
@@ -14596,8 +14596,8 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14596
14596
|
} else {
|
|
14597
14597
|
console.log(chalk2.green(`\u2713 Compose version exists: ${response.name}`));
|
|
14598
14598
|
}
|
|
14599
|
-
console.log(chalk2.
|
|
14600
|
-
console.log(chalk2.
|
|
14599
|
+
console.log(chalk2.dim(` Compose ID: ${response.composeId}`));
|
|
14600
|
+
console.log(chalk2.dim(` Version: ${shortVersionId}`));
|
|
14601
14601
|
console.log();
|
|
14602
14602
|
console.log(" Run your agent:");
|
|
14603
14603
|
console.log(
|
|
@@ -14611,10 +14611,10 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14611
14611
|
console.error(chalk2.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
14612
14612
|
} else if (error43.message.includes("Failed to create compose")) {
|
|
14613
14613
|
console.error(chalk2.red("\u2717 Failed to create compose"));
|
|
14614
|
-
console.error(chalk2.
|
|
14614
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14615
14615
|
} else {
|
|
14616
14616
|
console.error(chalk2.red("\u2717 Failed to create compose"));
|
|
14617
|
-
console.error(chalk2.
|
|
14617
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14618
14618
|
}
|
|
14619
14619
|
} else {
|
|
14620
14620
|
console.error(chalk2.red("\u2717 An unexpected error occurred"));
|
|
@@ -14958,12 +14958,12 @@ var EventRenderer = class {
|
|
|
14958
14958
|
* Called immediately after run is created, before polling events
|
|
14959
14959
|
*/
|
|
14960
14960
|
static renderRunStarted(info) {
|
|
14961
|
-
console.log(chalk3.
|
|
14962
|
-
console.log(` Run ID: ${chalk3.
|
|
14961
|
+
console.log(chalk3.bold("\u25B6 Run started"));
|
|
14962
|
+
console.log(` Run ID: ${chalk3.dim(info.runId)}`);
|
|
14963
14963
|
if (info.sandboxId) {
|
|
14964
|
-
console.log(` Sandbox: ${chalk3.
|
|
14964
|
+
console.log(` Sandbox: ${chalk3.dim(info.sandboxId)}`);
|
|
14965
14965
|
}
|
|
14966
|
-
console.log(chalk3.
|
|
14966
|
+
console.log(chalk3.dim(` (use "vm0 logs ${info.runId}" to view logs)`));
|
|
14967
14967
|
console.log();
|
|
14968
14968
|
}
|
|
14969
14969
|
/**
|
|
@@ -14996,7 +14996,7 @@ var EventRenderer = class {
|
|
|
14996
14996
|
*/
|
|
14997
14997
|
static render(event, options) {
|
|
14998
14998
|
const timestampPrefix = options?.showTimestamp ? `[${this.formatTimestamp(event.timestamp)}] ` : "";
|
|
14999
|
-
const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.
|
|
14999
|
+
const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.dim(
|
|
15000
15000
|
this.formatElapsed(options.previousTimestamp, event.timestamp)
|
|
15001
15001
|
) : "";
|
|
15002
15002
|
switch (event.type) {
|
|
@@ -15026,29 +15026,25 @@ var EventRenderer = class {
|
|
|
15026
15026
|
console.log("");
|
|
15027
15027
|
console.log(chalk3.green("\u2713 Run completed successfully"));
|
|
15028
15028
|
if (result) {
|
|
15029
|
-
console.log(` Checkpoint: ${chalk3.
|
|
15030
|
-
console.log(` Session: ${chalk3.
|
|
15031
|
-
console.log(` Conversation: ${chalk3.
|
|
15029
|
+
console.log(` Checkpoint: ${chalk3.dim(result.checkpointId)}`);
|
|
15030
|
+
console.log(` Session: ${chalk3.dim(result.agentSessionId)}`);
|
|
15031
|
+
console.log(` Conversation: ${chalk3.dim(result.conversationId)}`);
|
|
15032
15032
|
if (result.artifact && Object.keys(result.artifact).length > 0) {
|
|
15033
15033
|
console.log(` Artifact:`);
|
|
15034
15034
|
for (const [name, version2] of Object.entries(result.artifact)) {
|
|
15035
|
-
console.log(
|
|
15036
|
-
` ${name}: ${chalk3.gray(this.formatVersion(version2))}`
|
|
15037
|
-
);
|
|
15035
|
+
console.log(` ${name}: ${chalk3.dim(this.formatVersion(version2))}`);
|
|
15038
15036
|
}
|
|
15039
15037
|
}
|
|
15040
15038
|
if (result.volumes && Object.keys(result.volumes).length > 0) {
|
|
15041
15039
|
console.log(` Volumes:`);
|
|
15042
15040
|
for (const [name, version2] of Object.entries(result.volumes)) {
|
|
15043
|
-
console.log(
|
|
15044
|
-
` ${name}: ${chalk3.gray(this.formatVersion(version2))}`
|
|
15045
|
-
);
|
|
15041
|
+
console.log(` ${name}: ${chalk3.dim(this.formatVersion(version2))}`);
|
|
15046
15042
|
}
|
|
15047
15043
|
}
|
|
15048
15044
|
}
|
|
15049
15045
|
if (options?.verbose && options?.startTimestamp) {
|
|
15050
15046
|
const totalTime = this.formatTotalTime(options.startTimestamp, now);
|
|
15051
|
-
console.log(` Total time: ${chalk3.
|
|
15047
|
+
console.log(` Total time: ${chalk3.dim(totalTime)}`);
|
|
15052
15048
|
}
|
|
15053
15049
|
}
|
|
15054
15050
|
/**
|
|
@@ -15060,38 +15056,36 @@ var EventRenderer = class {
|
|
|
15060
15056
|
console.log(chalk3.red("\u2717 Run failed"));
|
|
15061
15057
|
console.log(` Error: ${chalk3.red(error43 || "Unknown error")}`);
|
|
15062
15058
|
console.log(
|
|
15063
|
-
chalk3.
|
|
15059
|
+
chalk3.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
15064
15060
|
);
|
|
15065
15061
|
}
|
|
15066
15062
|
static renderInit(event, prefix, suffix) {
|
|
15067
15063
|
const providerStr = String(event.data.provider || "claude-code");
|
|
15068
15064
|
const displayName = isSupportedProvider(providerStr) ? getProviderDisplayName(providerStr) : providerStr;
|
|
15069
|
-
console.log(
|
|
15070
|
-
|
|
15071
|
-
);
|
|
15072
|
-
console.log(` Session: ${chalk3.gray(String(event.data.sessionId || ""))}`);
|
|
15065
|
+
console.log(prefix + "[init]" + suffix + ` Starting ${displayName} agent`);
|
|
15066
|
+
console.log(` Session: ${chalk3.dim(String(event.data.sessionId || ""))}`);
|
|
15073
15067
|
if (event.data.model) {
|
|
15074
|
-
console.log(` Model: ${chalk3.
|
|
15068
|
+
console.log(` Model: ${chalk3.dim(String(event.data.model))}`);
|
|
15075
15069
|
}
|
|
15076
15070
|
console.log(
|
|
15077
|
-
` Tools: ${chalk3.
|
|
15071
|
+
` Tools: ${chalk3.dim(
|
|
15078
15072
|
Array.isArray(event.data.tools) ? event.data.tools.join(", ") : String(event.data.tools || "")
|
|
15079
15073
|
)}`
|
|
15080
15074
|
);
|
|
15081
15075
|
}
|
|
15082
15076
|
static renderText(event, prefix, suffix) {
|
|
15083
15077
|
const text = String(event.data.text || "");
|
|
15084
|
-
console.log(prefix +
|
|
15078
|
+
console.log(prefix + "[text]" + suffix + " " + text);
|
|
15085
15079
|
}
|
|
15086
15080
|
static renderToolUse(event, prefix, suffix) {
|
|
15087
15081
|
const tool = String(event.data.tool || "");
|
|
15088
|
-
console.log(prefix +
|
|
15082
|
+
console.log(prefix + "[tool_use]" + suffix + " " + tool);
|
|
15089
15083
|
const input = event.data.input;
|
|
15090
15084
|
if (input && typeof input === "object") {
|
|
15091
15085
|
for (const [key, value] of Object.entries(input)) {
|
|
15092
15086
|
if (value !== void 0 && value !== null) {
|
|
15093
15087
|
const displayValue = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value);
|
|
15094
|
-
console.log(` ${key}: ${chalk3.
|
|
15088
|
+
console.log(` ${key}: ${chalk3.dim(displayValue)}`);
|
|
15095
15089
|
}
|
|
15096
15090
|
}
|
|
15097
15091
|
}
|
|
@@ -15102,7 +15096,7 @@ var EventRenderer = class {
|
|
|
15102
15096
|
const color = isError ? chalk3.red : chalk3.green;
|
|
15103
15097
|
console.log(prefix + color("[tool_result]") + suffix + " " + status);
|
|
15104
15098
|
const result = String(event.data.result || "");
|
|
15105
|
-
console.log(` ${chalk3.
|
|
15099
|
+
console.log(` ${chalk3.dim(result)}`);
|
|
15106
15100
|
}
|
|
15107
15101
|
static renderResult(event, prefix, suffix) {
|
|
15108
15102
|
const success2 = Boolean(event.data.success);
|
|
@@ -15111,11 +15105,11 @@ var EventRenderer = class {
|
|
|
15111
15105
|
console.log(prefix + color("[result]") + suffix + " " + status);
|
|
15112
15106
|
const durationMs = Number(event.data.durationMs || 0);
|
|
15113
15107
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
15114
|
-
console.log(` Duration: ${chalk3.
|
|
15108
|
+
console.log(` Duration: ${chalk3.dim(durationSec + "s")}`);
|
|
15115
15109
|
const cost = Number(event.data.cost || 0);
|
|
15116
|
-
console.log(` Cost: ${chalk3.
|
|
15110
|
+
console.log(` Cost: ${chalk3.dim("$" + cost.toFixed(4))}`);
|
|
15117
15111
|
const numTurns = Number(event.data.numTurns || 0);
|
|
15118
|
-
console.log(` Turns: ${chalk3.
|
|
15112
|
+
console.log(` Turns: ${chalk3.dim(String(numTurns))}`);
|
|
15119
15113
|
const usage = event.data.usage;
|
|
15120
15114
|
if (usage && typeof usage === "object") {
|
|
15121
15115
|
const inputTokens = Number(usage.input_tokens || 0);
|
|
@@ -15127,7 +15121,7 @@ var EventRenderer = class {
|
|
|
15127
15121
|
return String(count);
|
|
15128
15122
|
};
|
|
15129
15123
|
console.log(
|
|
15130
|
-
` Tokens: ${chalk3.
|
|
15124
|
+
` Tokens: ${chalk3.dim(
|
|
15131
15125
|
`input=${formatTokens(inputTokens)} output=${formatTokens(outputTokens)}`
|
|
15132
15126
|
)}`
|
|
15133
15127
|
);
|
|
@@ -15183,7 +15177,7 @@ var CodexEventRenderer = class {
|
|
|
15183
15177
|
}
|
|
15184
15178
|
}
|
|
15185
15179
|
static renderThreadStarted(event) {
|
|
15186
|
-
console.log(
|
|
15180
|
+
console.log(`[thread.started] ${event.thread_id}`);
|
|
15187
15181
|
}
|
|
15188
15182
|
static renderTurnCompleted(event) {
|
|
15189
15183
|
if (event.usage) {
|
|
@@ -15192,7 +15186,7 @@ var CodexEventRenderer = class {
|
|
|
15192
15186
|
const cached2 = event.usage.cached_input_tokens || 0;
|
|
15193
15187
|
const cachedStr = cached2 ? ` (${cached2} cached)` : "";
|
|
15194
15188
|
console.log(
|
|
15195
|
-
|
|
15189
|
+
"[turn.completed]" + chalk4.dim(` ${input} in / ${output} out${cachedStr}`)
|
|
15196
15190
|
);
|
|
15197
15191
|
}
|
|
15198
15192
|
}
|
|
@@ -15207,25 +15201,25 @@ var CodexEventRenderer = class {
|
|
|
15207
15201
|
const itemType = item.type;
|
|
15208
15202
|
const eventType = event.type;
|
|
15209
15203
|
if (itemType === "reasoning" && item.text) {
|
|
15210
|
-
console.log(
|
|
15204
|
+
console.log(`[reasoning] ${item.text}`);
|
|
15211
15205
|
return;
|
|
15212
15206
|
}
|
|
15213
15207
|
if (itemType === "agent_message" && item.text) {
|
|
15214
|
-
console.log(
|
|
15208
|
+
console.log(`[message] ${item.text}`);
|
|
15215
15209
|
return;
|
|
15216
15210
|
}
|
|
15217
15211
|
if (itemType === "command_execution") {
|
|
15218
15212
|
if (eventType === "item.started" && item.command) {
|
|
15219
|
-
console.log(
|
|
15213
|
+
console.log(`[exec] ${item.command}`);
|
|
15220
15214
|
} else if (eventType === "item.completed") {
|
|
15221
15215
|
const output = item.aggregated_output || "";
|
|
15222
15216
|
const exitCode = item.exit_code ?? 0;
|
|
15223
15217
|
if (output) {
|
|
15224
15218
|
const lines = output.split("\n").filter((l) => l.trim());
|
|
15225
15219
|
const preview = lines.slice(0, 3).join("\n ");
|
|
15226
|
-
const more = lines.length > 3 ? chalk4.
|
|
15220
|
+
const more = lines.length > 3 ? chalk4.dim(` ... (${lines.length - 3} more lines)`) : "";
|
|
15227
15221
|
console.log(
|
|
15228
|
-
|
|
15222
|
+
"[output]" + (exitCode !== 0 ? chalk4.red(` exit=${exitCode}`) : "")
|
|
15229
15223
|
);
|
|
15230
15224
|
if (preview) {
|
|
15231
15225
|
console.log(" " + preview + more);
|
|
@@ -15247,7 +15241,7 @@ var CodexEventRenderer = class {
|
|
|
15247
15241
|
if (itemType === "file_edit" || itemType === "file_write" || itemType === "file_read") {
|
|
15248
15242
|
const action = itemType.replace("file_", "");
|
|
15249
15243
|
if (eventType === "item.started" && item.path) {
|
|
15250
|
-
console.log(
|
|
15244
|
+
console.log(`[${action}] ${item.path}`);
|
|
15251
15245
|
}
|
|
15252
15246
|
return;
|
|
15253
15247
|
}
|
|
@@ -15382,7 +15376,7 @@ async function pollEvents(runId, options) {
|
|
|
15382
15376
|
complete = true;
|
|
15383
15377
|
console.error(chalk5.red("\n\u2717 Run timed out"));
|
|
15384
15378
|
console.error(
|
|
15385
|
-
chalk5.
|
|
15379
|
+
chalk5.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
15386
15380
|
);
|
|
15387
15381
|
result = { succeeded: false, runId };
|
|
15388
15382
|
}
|
|
@@ -15393,15 +15387,15 @@ async function pollEvents(runId, options) {
|
|
|
15393
15387
|
return result;
|
|
15394
15388
|
}
|
|
15395
15389
|
function logVerbosePreFlight(action, details) {
|
|
15396
|
-
console.log(
|
|
15397
|
-
${action}...`)
|
|
15390
|
+
console.log(`
|
|
15391
|
+
${action}...`);
|
|
15398
15392
|
for (const { label, value } of details) {
|
|
15399
15393
|
if (value !== void 0) {
|
|
15400
|
-
console.log(chalk5.
|
|
15394
|
+
console.log(chalk5.dim(` ${label}: ${value}`));
|
|
15401
15395
|
}
|
|
15402
15396
|
}
|
|
15403
15397
|
console.log();
|
|
15404
|
-
console.log(
|
|
15398
|
+
console.log("Executing in sandbox...");
|
|
15405
15399
|
console.log();
|
|
15406
15400
|
}
|
|
15407
15401
|
function showNextSteps(result) {
|
|
@@ -15458,7 +15452,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15458
15452
|
let composeContent;
|
|
15459
15453
|
if (isUUID(name)) {
|
|
15460
15454
|
if (verbose) {
|
|
15461
|
-
console.log(chalk5.
|
|
15455
|
+
console.log(chalk5.dim(` Using compose ID: ${identifier}`));
|
|
15462
15456
|
}
|
|
15463
15457
|
try {
|
|
15464
15458
|
const compose = await apiClient.getComposeById(name);
|
|
@@ -15472,20 +15466,20 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15472
15466
|
}
|
|
15473
15467
|
} else {
|
|
15474
15468
|
if (verbose) {
|
|
15475
|
-
console.log(chalk5.
|
|
15469
|
+
console.log(chalk5.dim(` Resolving agent name: ${name}`));
|
|
15476
15470
|
}
|
|
15477
15471
|
try {
|
|
15478
15472
|
const compose = await apiClient.getComposeByName(name);
|
|
15479
15473
|
composeId = compose.id;
|
|
15480
15474
|
composeContent = compose.content;
|
|
15481
15475
|
if (verbose) {
|
|
15482
|
-
console.log(chalk5.
|
|
15476
|
+
console.log(chalk5.dim(` Resolved to compose ID: ${composeId}`));
|
|
15483
15477
|
}
|
|
15484
15478
|
} catch (error43) {
|
|
15485
15479
|
if (error43 instanceof Error) {
|
|
15486
15480
|
console.error(chalk5.red(`\u2717 Agent not found: ${name}`));
|
|
15487
15481
|
console.error(
|
|
15488
|
-
chalk5.
|
|
15482
|
+
chalk5.dim(
|
|
15489
15483
|
" Make sure you've composed the agent with: vm0 compose"
|
|
15490
15484
|
)
|
|
15491
15485
|
);
|
|
@@ -15496,7 +15490,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15496
15490
|
let agentComposeVersionId;
|
|
15497
15491
|
if (version2 && version2 !== "latest") {
|
|
15498
15492
|
if (verbose) {
|
|
15499
|
-
console.log(chalk5.
|
|
15493
|
+
console.log(chalk5.dim(` Resolving version: ${version2}`));
|
|
15500
15494
|
}
|
|
15501
15495
|
try {
|
|
15502
15496
|
const versionInfo = await apiClient.getComposeVersion(
|
|
@@ -15506,7 +15500,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15506
15500
|
agentComposeVersionId = versionInfo.versionId;
|
|
15507
15501
|
if (verbose) {
|
|
15508
15502
|
console.log(
|
|
15509
|
-
chalk5.
|
|
15503
|
+
chalk5.dim(
|
|
15510
15504
|
` Resolved to version ID: ${agentComposeVersionId.slice(0, 8)}...`
|
|
15511
15505
|
)
|
|
15512
15506
|
);
|
|
@@ -15515,7 +15509,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15515
15509
|
if (error43 instanceof Error) {
|
|
15516
15510
|
console.error(chalk5.red(`\u2717 Version not found: ${version2}`));
|
|
15517
15511
|
console.error(
|
|
15518
|
-
chalk5.
|
|
15512
|
+
chalk5.dim(" Make sure the version hash is correct.")
|
|
15519
15513
|
);
|
|
15520
15514
|
}
|
|
15521
15515
|
process.exit(1);
|
|
@@ -15526,22 +15520,20 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15526
15520
|
const secretNames = extractSecretNames(composeContent);
|
|
15527
15521
|
const secrets = loadValues(options.secrets, secretNames);
|
|
15528
15522
|
if (verbose && varNames.length > 0) {
|
|
15529
|
-
console.log(chalk5.
|
|
15523
|
+
console.log(chalk5.dim(` Required vars: ${varNames.join(", ")}`));
|
|
15530
15524
|
if (vars) {
|
|
15531
15525
|
console.log(
|
|
15532
|
-
chalk5.
|
|
15526
|
+
chalk5.dim(` Loaded vars: ${Object.keys(vars).join(", ")}`)
|
|
15533
15527
|
);
|
|
15534
15528
|
}
|
|
15535
15529
|
}
|
|
15536
15530
|
if (verbose && secretNames.length > 0) {
|
|
15537
15531
|
console.log(
|
|
15538
|
-
chalk5.
|
|
15532
|
+
chalk5.dim(` Required secrets: ${secretNames.join(", ")}`)
|
|
15539
15533
|
);
|
|
15540
15534
|
if (secrets) {
|
|
15541
15535
|
console.log(
|
|
15542
|
-
chalk5.
|
|
15543
|
-
` Loaded secrets: ${Object.keys(secrets).join(", ")}`
|
|
15544
|
-
)
|
|
15536
|
+
chalk5.dim(` Loaded secrets: ${Object.keys(secrets).join(", ")}`)
|
|
15545
15537
|
);
|
|
15546
15538
|
}
|
|
15547
15539
|
}
|
|
@@ -15580,7 +15572,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15580
15572
|
if (response.status === "failed") {
|
|
15581
15573
|
console.error(chalk5.red("\u2717 Run preparation failed"));
|
|
15582
15574
|
if (response.error) {
|
|
15583
|
-
console.error(chalk5.
|
|
15575
|
+
console.error(chalk5.dim(` ${response.error}`));
|
|
15584
15576
|
}
|
|
15585
15577
|
process.exit(1);
|
|
15586
15578
|
}
|
|
@@ -15605,13 +15597,13 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15605
15597
|
} else if (error43.message.includes("not found")) {
|
|
15606
15598
|
console.error(chalk5.red(`\u2717 Agent not found: ${identifier}`));
|
|
15607
15599
|
console.error(
|
|
15608
|
-
chalk5.
|
|
15600
|
+
chalk5.dim(
|
|
15609
15601
|
" Make sure you've composed the agent with: vm0 compose"
|
|
15610
15602
|
)
|
|
15611
15603
|
);
|
|
15612
15604
|
} else {
|
|
15613
15605
|
console.error(chalk5.red("\u2717 Run failed"));
|
|
15614
|
-
console.error(chalk5.
|
|
15606
|
+
console.error(chalk5.dim(` ${error43.message}`));
|
|
15615
15607
|
}
|
|
15616
15608
|
} else {
|
|
15617
15609
|
console.error(chalk5.red("\u2717 An unexpected error occurred"));
|
|
@@ -15635,7 +15627,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
15635
15627
|
console.error(
|
|
15636
15628
|
chalk5.red(`\u2717 Invalid checkpoint ID format: ${checkpointId}`)
|
|
15637
15629
|
);
|
|
15638
|
-
console.error(chalk5.
|
|
15630
|
+
console.error(chalk5.dim(" Checkpoint ID must be a valid UUID"));
|
|
15639
15631
|
process.exit(1);
|
|
15640
15632
|
}
|
|
15641
15633
|
if (verbose) {
|
|
@@ -15656,7 +15648,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
15656
15648
|
if (response.status === "failed") {
|
|
15657
15649
|
console.error(chalk5.red("\u2717 Run preparation failed"));
|
|
15658
15650
|
if (response.error) {
|
|
15659
|
-
console.error(chalk5.
|
|
15651
|
+
console.error(chalk5.dim(` ${response.error}`));
|
|
15660
15652
|
}
|
|
15661
15653
|
process.exit(1);
|
|
15662
15654
|
}
|
|
@@ -15682,7 +15674,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
15682
15674
|
console.error(chalk5.red(`\u2717 Checkpoint not found: ${checkpointId}`));
|
|
15683
15675
|
} else {
|
|
15684
15676
|
console.error(chalk5.red("\u2717 Resume failed"));
|
|
15685
|
-
console.error(chalk5.
|
|
15677
|
+
console.error(chalk5.dim(` ${error43.message}`));
|
|
15686
15678
|
}
|
|
15687
15679
|
} else {
|
|
15688
15680
|
console.error(chalk5.red("\u2717 An unexpected error occurred"));
|
|
@@ -15708,7 +15700,7 @@ runCmd.command("continue").description(
|
|
|
15708
15700
|
console.error(
|
|
15709
15701
|
chalk5.red(`\u2717 Invalid agent session ID format: ${agentSessionId}`)
|
|
15710
15702
|
);
|
|
15711
|
-
console.error(chalk5.
|
|
15703
|
+
console.error(chalk5.dim(" Agent session ID must be a valid UUID"));
|
|
15712
15704
|
process.exit(1);
|
|
15713
15705
|
}
|
|
15714
15706
|
if (verbose) {
|
|
@@ -15730,7 +15722,7 @@ runCmd.command("continue").description(
|
|
|
15730
15722
|
if (response.status === "failed") {
|
|
15731
15723
|
console.error(chalk5.red("\u2717 Run preparation failed"));
|
|
15732
15724
|
if (response.error) {
|
|
15733
|
-
console.error(chalk5.
|
|
15725
|
+
console.error(chalk5.dim(` ${response.error}`));
|
|
15734
15726
|
}
|
|
15735
15727
|
process.exit(1);
|
|
15736
15728
|
}
|
|
@@ -15758,7 +15750,7 @@ runCmd.command("continue").description(
|
|
|
15758
15750
|
);
|
|
15759
15751
|
} else {
|
|
15760
15752
|
console.error(chalk5.red("\u2717 Continue failed"));
|
|
15761
|
-
console.error(chalk5.
|
|
15753
|
+
console.error(chalk5.dim(` ${error43.message}`));
|
|
15762
15754
|
}
|
|
15763
15755
|
} else {
|
|
15764
15756
|
console.error(chalk5.red("\u2717 An unexpected error occurred"));
|
|
@@ -15835,7 +15827,7 @@ var initCommand = new Command3().name("init").description("Initialize a volume i
|
|
|
15835
15827
|
chalk6.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
15836
15828
|
);
|
|
15837
15829
|
console.log(
|
|
15838
|
-
chalk6.
|
|
15830
|
+
chalk6.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
15839
15831
|
);
|
|
15840
15832
|
return;
|
|
15841
15833
|
}
|
|
@@ -15843,26 +15835,26 @@ var initCommand = new Command3().name("init").description("Initialize a volume i
|
|
|
15843
15835
|
if (!isValidStorageName(volumeName)) {
|
|
15844
15836
|
console.error(chalk6.red(`\u2717 Invalid volume name: "${dirName}"`));
|
|
15845
15837
|
console.error(
|
|
15846
|
-
chalk6.
|
|
15838
|
+
chalk6.dim(
|
|
15847
15839
|
" Volume names must be 3-64 characters, lowercase alphanumeric with hyphens"
|
|
15848
15840
|
)
|
|
15849
15841
|
);
|
|
15850
15842
|
console.error(
|
|
15851
|
-
chalk6.
|
|
15843
|
+
chalk6.dim(" Example: my-dataset, user-data-v2, training-set-2024")
|
|
15852
15844
|
);
|
|
15853
15845
|
process.exit(1);
|
|
15854
15846
|
}
|
|
15855
15847
|
await writeStorageConfig(volumeName, cwd);
|
|
15856
15848
|
console.log(chalk6.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
15857
15849
|
console.log(
|
|
15858
|
-
chalk6.
|
|
15850
|
+
chalk6.dim(
|
|
15859
15851
|
`\u2713 Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
15860
15852
|
)
|
|
15861
15853
|
);
|
|
15862
15854
|
} catch (error43) {
|
|
15863
15855
|
console.error(chalk6.red("\u2717 Failed to initialize volume"));
|
|
15864
15856
|
if (error43 instanceof Error) {
|
|
15865
|
-
console.error(chalk6.
|
|
15857
|
+
console.error(chalk6.dim(` ${error43.message}`));
|
|
15866
15858
|
}
|
|
15867
15859
|
process.exit(1);
|
|
15868
15860
|
}
|
|
@@ -15887,13 +15879,13 @@ var pushCommand = new Command4().name("push").description("Push local files to c
|
|
|
15887
15879
|
const config2 = await readStorageConfig(cwd);
|
|
15888
15880
|
if (!config2) {
|
|
15889
15881
|
console.error(chalk7.red("\u2717 No volume initialized in this directory"));
|
|
15890
|
-
console.error(chalk7.
|
|
15882
|
+
console.error(chalk7.dim(" Run: vm0 volume init"));
|
|
15891
15883
|
process.exit(1);
|
|
15892
15884
|
}
|
|
15893
|
-
console.log(
|
|
15885
|
+
console.log(`Pushing volume: ${config2.name}`);
|
|
15894
15886
|
const result = await directUpload(config2.name, "volume", cwd, {
|
|
15895
15887
|
onProgress: (message) => {
|
|
15896
|
-
console.log(chalk7.
|
|
15888
|
+
console.log(chalk7.dim(message));
|
|
15897
15889
|
},
|
|
15898
15890
|
force: options.force
|
|
15899
15891
|
});
|
|
@@ -15905,13 +15897,13 @@ var pushCommand = new Command4().name("push").description("Push local files to c
|
|
|
15905
15897
|
} else {
|
|
15906
15898
|
console.log(chalk7.green("\u2713 Upload complete"));
|
|
15907
15899
|
}
|
|
15908
|
-
console.log(chalk7.
|
|
15909
|
-
console.log(chalk7.
|
|
15910
|
-
console.log(chalk7.
|
|
15900
|
+
console.log(chalk7.dim(` Version: ${shortVersion}`));
|
|
15901
|
+
console.log(chalk7.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
15902
|
+
console.log(chalk7.dim(` Size: ${formatBytes(result.size)}`));
|
|
15911
15903
|
} catch (error43) {
|
|
15912
15904
|
console.error(chalk7.red("\u2717 Push failed"));
|
|
15913
15905
|
if (error43 instanceof Error) {
|
|
15914
|
-
console.error(chalk7.
|
|
15906
|
+
console.error(chalk7.dim(` ${error43.message}`));
|
|
15915
15907
|
}
|
|
15916
15908
|
process.exit(1);
|
|
15917
15909
|
}
|
|
@@ -15928,7 +15920,7 @@ import * as tar3 from "tar";
|
|
|
15928
15920
|
// src/lib/pull-utils.ts
|
|
15929
15921
|
import chalk8 from "chalk";
|
|
15930
15922
|
async function handleEmptyStorageResponse(cwd) {
|
|
15931
|
-
console.log(chalk8.
|
|
15923
|
+
console.log(chalk8.dim("Syncing local files..."));
|
|
15932
15924
|
const removedCount = await removeExtraFiles(cwd, /* @__PURE__ */ new Set());
|
|
15933
15925
|
if (removedCount > 0) {
|
|
15934
15926
|
console.log(chalk8.green(`\u2713 Removed ${removedCount} files not in remote`));
|
|
@@ -15951,17 +15943,15 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
15951
15943
|
const config2 = await readStorageConfig(cwd);
|
|
15952
15944
|
if (!config2) {
|
|
15953
15945
|
console.error(chalk9.red("\u2717 No volume initialized in this directory"));
|
|
15954
|
-
console.error(chalk9.
|
|
15946
|
+
console.error(chalk9.dim(" Run: vm0 volume init"));
|
|
15955
15947
|
process.exit(1);
|
|
15956
15948
|
}
|
|
15957
15949
|
if (versionId) {
|
|
15958
|
-
console.log(
|
|
15959
|
-
chalk9.cyan(`Pulling volume: ${config2.name} (version: ${versionId})`)
|
|
15960
|
-
);
|
|
15950
|
+
console.log(`Pulling volume: ${config2.name} (version: ${versionId})`);
|
|
15961
15951
|
} else {
|
|
15962
|
-
console.log(
|
|
15952
|
+
console.log(`Pulling volume: ${config2.name}`);
|
|
15963
15953
|
}
|
|
15964
|
-
console.log(chalk9.
|
|
15954
|
+
console.log(chalk9.dim("Getting download URL..."));
|
|
15965
15955
|
let url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=volume`;
|
|
15966
15956
|
if (versionId) {
|
|
15967
15957
|
url2 += `&version=${encodeURIComponent(versionId)}`;
|
|
@@ -15971,12 +15961,12 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
15971
15961
|
if (response.status === 404) {
|
|
15972
15962
|
console.error(chalk9.red(`\u2717 Volume "${config2.name}" not found`));
|
|
15973
15963
|
console.error(
|
|
15974
|
-
chalk9.
|
|
15964
|
+
chalk9.dim(
|
|
15975
15965
|
" Make sure the volume name is correct in .vm0/storage.yaml"
|
|
15976
15966
|
)
|
|
15977
15967
|
);
|
|
15978
15968
|
console.error(
|
|
15979
|
-
chalk9.
|
|
15969
|
+
chalk9.dim(" Or push the volume first with: vm0 volume push")
|
|
15980
15970
|
);
|
|
15981
15971
|
} else {
|
|
15982
15972
|
const error43 = await response.json();
|
|
@@ -15992,7 +15982,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
15992
15982
|
if (!downloadInfo.url) {
|
|
15993
15983
|
throw new Error("No download URL returned");
|
|
15994
15984
|
}
|
|
15995
|
-
console.log(chalk9.
|
|
15985
|
+
console.log(chalk9.dim("Downloading from S3..."));
|
|
15996
15986
|
const s3Response = await fetch(downloadInfo.url);
|
|
15997
15987
|
if (!s3Response.ok) {
|
|
15998
15988
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
@@ -16003,7 +15993,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
16003
15993
|
const tmpDir = fs6.mkdtempSync(path8.join(os4.tmpdir(), "vm0-"));
|
|
16004
15994
|
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
16005
15995
|
await fs6.promises.writeFile(tarPath, tarBuffer);
|
|
16006
|
-
console.log(chalk9.
|
|
15996
|
+
console.log(chalk9.dim("Syncing local files..."));
|
|
16007
15997
|
const remoteFiles = await listTarFiles(tarPath);
|
|
16008
15998
|
const remoteFilesSet = new Set(
|
|
16009
15999
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -16014,7 +16004,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
16014
16004
|
chalk9.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
16015
16005
|
);
|
|
16016
16006
|
}
|
|
16017
|
-
console.log(chalk9.
|
|
16007
|
+
console.log(chalk9.dim("Extracting files..."));
|
|
16018
16008
|
await tar3.extract({
|
|
16019
16009
|
file: tarPath,
|
|
16020
16010
|
cwd,
|
|
@@ -16026,7 +16016,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
16026
16016
|
} catch (error43) {
|
|
16027
16017
|
console.error(chalk9.red("\u2717 Pull failed"));
|
|
16028
16018
|
if (error43 instanceof Error) {
|
|
16029
|
-
console.error(chalk9.
|
|
16019
|
+
console.error(chalk9.dim(` ${error43.message}`));
|
|
16030
16020
|
}
|
|
16031
16021
|
process.exit(1);
|
|
16032
16022
|
}
|
|
@@ -16048,7 +16038,7 @@ var statusCommand = new Command6().name("status").description("Show status of cl
|
|
|
16048
16038
|
const config2 = await readStorageConfig(cwd);
|
|
16049
16039
|
if (!config2) {
|
|
16050
16040
|
console.error(chalk10.red("\u2717 No volume initialized in this directory"));
|
|
16051
|
-
console.error(chalk10.
|
|
16041
|
+
console.error(chalk10.dim(" Run: vm0 volume init"));
|
|
16052
16042
|
process.exit(1);
|
|
16053
16043
|
}
|
|
16054
16044
|
if (config2.type !== "volume") {
|
|
@@ -16057,16 +16047,16 @@ var statusCommand = new Command6().name("status").description("Show status of cl
|
|
|
16057
16047
|
"\u2717 This directory is initialized as an artifact, not a volume"
|
|
16058
16048
|
)
|
|
16059
16049
|
);
|
|
16060
|
-
console.error(chalk10.
|
|
16050
|
+
console.error(chalk10.dim(" Use: vm0 artifact status"));
|
|
16061
16051
|
process.exit(1);
|
|
16062
16052
|
}
|
|
16063
|
-
console.log(
|
|
16053
|
+
console.log(`Checking volume: ${config2.name}`);
|
|
16064
16054
|
const url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=volume`;
|
|
16065
16055
|
const response = await apiClient.get(url2);
|
|
16066
16056
|
if (!response.ok) {
|
|
16067
16057
|
if (response.status === 404) {
|
|
16068
16058
|
console.error(chalk10.red("\u2717 Not found on remote"));
|
|
16069
|
-
console.error(chalk10.
|
|
16059
|
+
console.error(chalk10.dim(" Run: vm0 volume push"));
|
|
16070
16060
|
} else {
|
|
16071
16061
|
const error43 = await response.json();
|
|
16072
16062
|
throw new Error(error43.error?.message || "Status check failed");
|
|
@@ -16077,17 +16067,17 @@ var statusCommand = new Command6().name("status").description("Show status of cl
|
|
|
16077
16067
|
const shortVersion = info.versionId.slice(0, 8);
|
|
16078
16068
|
if (info.empty) {
|
|
16079
16069
|
console.log(chalk10.green("\u2713 Found (empty)"));
|
|
16080
|
-
console.log(chalk10.
|
|
16070
|
+
console.log(chalk10.dim(` Version: ${shortVersion}`));
|
|
16081
16071
|
} else {
|
|
16082
16072
|
console.log(chalk10.green("\u2713 Found"));
|
|
16083
|
-
console.log(chalk10.
|
|
16084
|
-
console.log(chalk10.
|
|
16085
|
-
console.log(chalk10.
|
|
16073
|
+
console.log(chalk10.dim(` Version: ${shortVersion}`));
|
|
16074
|
+
console.log(chalk10.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
16075
|
+
console.log(chalk10.dim(` Size: ${formatBytes3(info.size)}`));
|
|
16086
16076
|
}
|
|
16087
16077
|
} catch (error43) {
|
|
16088
16078
|
console.error(chalk10.red("\u2717 Status check failed"));
|
|
16089
16079
|
if (error43 instanceof Error) {
|
|
16090
|
-
console.error(chalk10.
|
|
16080
|
+
console.error(chalk10.dim(` ${error43.message}`));
|
|
16091
16081
|
}
|
|
16092
16082
|
process.exit(1);
|
|
16093
16083
|
}
|
|
@@ -16122,13 +16112,13 @@ var initCommand2 = new Command8().name("init").description("Initialize an artifa
|
|
|
16122
16112
|
)
|
|
16123
16113
|
);
|
|
16124
16114
|
console.log(
|
|
16125
|
-
chalk11.
|
|
16115
|
+
chalk11.dim(
|
|
16126
16116
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
16127
16117
|
)
|
|
16128
16118
|
);
|
|
16129
16119
|
}
|
|
16130
16120
|
console.log(
|
|
16131
|
-
chalk11.
|
|
16121
|
+
chalk11.dim(`Config file: ${path9.join(cwd, ".vm0", "storage.yaml")}`)
|
|
16132
16122
|
);
|
|
16133
16123
|
return;
|
|
16134
16124
|
}
|
|
@@ -16136,26 +16126,26 @@ var initCommand2 = new Command8().name("init").description("Initialize an artifa
|
|
|
16136
16126
|
if (!isValidStorageName(artifactName)) {
|
|
16137
16127
|
console.error(chalk11.red(`\u2717 Invalid artifact name: "${dirName}"`));
|
|
16138
16128
|
console.error(
|
|
16139
|
-
chalk11.
|
|
16129
|
+
chalk11.dim(
|
|
16140
16130
|
" Artifact names must be 3-64 characters, lowercase alphanumeric with hyphens"
|
|
16141
16131
|
)
|
|
16142
16132
|
);
|
|
16143
16133
|
console.error(
|
|
16144
|
-
chalk11.
|
|
16134
|
+
chalk11.dim(" Example: my-project, user-workspace, code-artifact")
|
|
16145
16135
|
);
|
|
16146
16136
|
process.exit(1);
|
|
16147
16137
|
}
|
|
16148
16138
|
await writeStorageConfig(artifactName, cwd, "artifact");
|
|
16149
16139
|
console.log(chalk11.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
16150
16140
|
console.log(
|
|
16151
|
-
chalk11.
|
|
16141
|
+
chalk11.dim(
|
|
16152
16142
|
`\u2713 Config saved to ${path9.join(cwd, ".vm0", "storage.yaml")}`
|
|
16153
16143
|
)
|
|
16154
16144
|
);
|
|
16155
16145
|
} catch (error43) {
|
|
16156
16146
|
console.error(chalk11.red("\u2717 Failed to initialize artifact"));
|
|
16157
16147
|
if (error43 instanceof Error) {
|
|
16158
|
-
console.error(chalk11.
|
|
16148
|
+
console.error(chalk11.dim(` ${error43.message}`));
|
|
16159
16149
|
}
|
|
16160
16150
|
process.exit(1);
|
|
16161
16151
|
}
|
|
@@ -16180,7 +16170,7 @@ var pushCommand2 = new Command9().name("push").description("Push local files to
|
|
|
16180
16170
|
const config2 = await readStorageConfig(cwd);
|
|
16181
16171
|
if (!config2) {
|
|
16182
16172
|
console.error(chalk12.red("\u2717 No artifact initialized in this directory"));
|
|
16183
|
-
console.error(chalk12.
|
|
16173
|
+
console.error(chalk12.dim(" Run: vm0 artifact init"));
|
|
16184
16174
|
process.exit(1);
|
|
16185
16175
|
}
|
|
16186
16176
|
if (config2.type !== "artifact") {
|
|
@@ -16189,13 +16179,13 @@ var pushCommand2 = new Command9().name("push").description("Push local files to
|
|
|
16189
16179
|
`\u2717 This directory is initialized as a volume, not an artifact`
|
|
16190
16180
|
)
|
|
16191
16181
|
);
|
|
16192
|
-
console.error(chalk12.
|
|
16182
|
+
console.error(chalk12.dim(" Use: vm0 volume push"));
|
|
16193
16183
|
process.exit(1);
|
|
16194
16184
|
}
|
|
16195
|
-
console.log(
|
|
16185
|
+
console.log(`Pushing artifact: ${config2.name}`);
|
|
16196
16186
|
const result = await directUpload(config2.name, "artifact", cwd, {
|
|
16197
16187
|
onProgress: (message) => {
|
|
16198
|
-
console.log(chalk12.
|
|
16188
|
+
console.log(chalk12.dim(message));
|
|
16199
16189
|
},
|
|
16200
16190
|
force: options.force
|
|
16201
16191
|
});
|
|
@@ -16207,13 +16197,13 @@ var pushCommand2 = new Command9().name("push").description("Push local files to
|
|
|
16207
16197
|
} else {
|
|
16208
16198
|
console.log(chalk12.green("\u2713 Upload complete"));
|
|
16209
16199
|
}
|
|
16210
|
-
console.log(chalk12.
|
|
16211
|
-
console.log(chalk12.
|
|
16212
|
-
console.log(chalk12.
|
|
16200
|
+
console.log(chalk12.dim(` Version: ${shortVersion}`));
|
|
16201
|
+
console.log(chalk12.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
16202
|
+
console.log(chalk12.dim(` Size: ${formatBytes4(result.size)}`));
|
|
16213
16203
|
} catch (error43) {
|
|
16214
16204
|
console.error(chalk12.red("\u2717 Push failed"));
|
|
16215
16205
|
if (error43 instanceof Error) {
|
|
16216
|
-
console.error(chalk12.
|
|
16206
|
+
console.error(chalk12.dim(` ${error43.message}`));
|
|
16217
16207
|
}
|
|
16218
16208
|
process.exit(1);
|
|
16219
16209
|
}
|
|
@@ -16239,7 +16229,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16239
16229
|
const config2 = await readStorageConfig(cwd);
|
|
16240
16230
|
if (!config2) {
|
|
16241
16231
|
console.error(chalk13.red("\u2717 No artifact initialized in this directory"));
|
|
16242
|
-
console.error(chalk13.
|
|
16232
|
+
console.error(chalk13.dim(" Run: vm0 artifact init"));
|
|
16243
16233
|
process.exit(1);
|
|
16244
16234
|
}
|
|
16245
16235
|
if (config2.type !== "artifact") {
|
|
@@ -16248,19 +16238,15 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16248
16238
|
`\u2717 This directory is initialized as a volume, not an artifact`
|
|
16249
16239
|
)
|
|
16250
16240
|
);
|
|
16251
|
-
console.error(chalk13.
|
|
16241
|
+
console.error(chalk13.dim(" Use: vm0 volume pull"));
|
|
16252
16242
|
process.exit(1);
|
|
16253
16243
|
}
|
|
16254
16244
|
if (versionId) {
|
|
16255
|
-
console.log(
|
|
16256
|
-
chalk13.cyan(
|
|
16257
|
-
`Pulling artifact: ${config2.name} (version: ${versionId})`
|
|
16258
|
-
)
|
|
16259
|
-
);
|
|
16245
|
+
console.log(`Pulling artifact: ${config2.name} (version: ${versionId})`);
|
|
16260
16246
|
} else {
|
|
16261
|
-
console.log(
|
|
16247
|
+
console.log(`Pulling artifact: ${config2.name}`);
|
|
16262
16248
|
}
|
|
16263
|
-
console.log(chalk13.
|
|
16249
|
+
console.log(chalk13.dim("Getting download URL..."));
|
|
16264
16250
|
let url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=artifact`;
|
|
16265
16251
|
if (versionId) {
|
|
16266
16252
|
url2 += `&version=${encodeURIComponent(versionId)}`;
|
|
@@ -16270,12 +16256,12 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16270
16256
|
if (response.status === 404) {
|
|
16271
16257
|
console.error(chalk13.red(`\u2717 Artifact "${config2.name}" not found`));
|
|
16272
16258
|
console.error(
|
|
16273
|
-
chalk13.
|
|
16259
|
+
chalk13.dim(
|
|
16274
16260
|
" Make sure the artifact name is correct in .vm0/storage.yaml"
|
|
16275
16261
|
)
|
|
16276
16262
|
);
|
|
16277
16263
|
console.error(
|
|
16278
|
-
chalk13.
|
|
16264
|
+
chalk13.dim(" Or push the artifact first with: vm0 artifact push")
|
|
16279
16265
|
);
|
|
16280
16266
|
} else {
|
|
16281
16267
|
const error43 = await response.json();
|
|
@@ -16291,7 +16277,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16291
16277
|
if (!downloadInfo.url) {
|
|
16292
16278
|
throw new Error("No download URL returned");
|
|
16293
16279
|
}
|
|
16294
|
-
console.log(chalk13.
|
|
16280
|
+
console.log(chalk13.dim("Downloading from S3..."));
|
|
16295
16281
|
const s3Response = await fetch(downloadInfo.url);
|
|
16296
16282
|
if (!s3Response.ok) {
|
|
16297
16283
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
@@ -16302,7 +16288,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16302
16288
|
const tmpDir = fs7.mkdtempSync(path10.join(os5.tmpdir(), "vm0-"));
|
|
16303
16289
|
const tarPath = path10.join(tmpDir, "artifact.tar.gz");
|
|
16304
16290
|
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
16305
|
-
console.log(chalk13.
|
|
16291
|
+
console.log(chalk13.dim("Syncing local files..."));
|
|
16306
16292
|
const remoteFiles = await listTarFiles(tarPath);
|
|
16307
16293
|
const remoteFilesSet = new Set(
|
|
16308
16294
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -16313,7 +16299,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16313
16299
|
chalk13.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
16314
16300
|
);
|
|
16315
16301
|
}
|
|
16316
|
-
console.log(chalk13.
|
|
16302
|
+
console.log(chalk13.dim("Extracting files..."));
|
|
16317
16303
|
await tar4.extract({
|
|
16318
16304
|
file: tarPath,
|
|
16319
16305
|
cwd,
|
|
@@ -16325,7 +16311,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16325
16311
|
} catch (error43) {
|
|
16326
16312
|
console.error(chalk13.red("\u2717 Pull failed"));
|
|
16327
16313
|
if (error43 instanceof Error) {
|
|
16328
|
-
console.error(chalk13.
|
|
16314
|
+
console.error(chalk13.dim(` ${error43.message}`));
|
|
16329
16315
|
}
|
|
16330
16316
|
process.exit(1);
|
|
16331
16317
|
}
|
|
@@ -16347,7 +16333,7 @@ var statusCommand2 = new Command11().name("status").description("Show status of
|
|
|
16347
16333
|
const config2 = await readStorageConfig(cwd);
|
|
16348
16334
|
if (!config2) {
|
|
16349
16335
|
console.error(chalk14.red("\u2717 No artifact initialized in this directory"));
|
|
16350
|
-
console.error(chalk14.
|
|
16336
|
+
console.error(chalk14.dim(" Run: vm0 artifact init"));
|
|
16351
16337
|
process.exit(1);
|
|
16352
16338
|
}
|
|
16353
16339
|
if (config2.type !== "artifact") {
|
|
@@ -16356,16 +16342,16 @@ var statusCommand2 = new Command11().name("status").description("Show status of
|
|
|
16356
16342
|
"\u2717 This directory is initialized as a volume, not an artifact"
|
|
16357
16343
|
)
|
|
16358
16344
|
);
|
|
16359
|
-
console.error(chalk14.
|
|
16345
|
+
console.error(chalk14.dim(" Use: vm0 volume status"));
|
|
16360
16346
|
process.exit(1);
|
|
16361
16347
|
}
|
|
16362
|
-
console.log(
|
|
16348
|
+
console.log(`Checking artifact: ${config2.name}`);
|
|
16363
16349
|
const url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=artifact`;
|
|
16364
16350
|
const response = await apiClient.get(url2);
|
|
16365
16351
|
if (!response.ok) {
|
|
16366
16352
|
if (response.status === 404) {
|
|
16367
16353
|
console.error(chalk14.red("\u2717 Not found on remote"));
|
|
16368
|
-
console.error(chalk14.
|
|
16354
|
+
console.error(chalk14.dim(" Run: vm0 artifact push"));
|
|
16369
16355
|
} else {
|
|
16370
16356
|
const error43 = await response.json();
|
|
16371
16357
|
throw new Error(error43.error?.message || "Status check failed");
|
|
@@ -16376,17 +16362,17 @@ var statusCommand2 = new Command11().name("status").description("Show status of
|
|
|
16376
16362
|
const shortVersion = info.versionId.slice(0, 8);
|
|
16377
16363
|
if (info.empty) {
|
|
16378
16364
|
console.log(chalk14.green("\u2713 Found (empty)"));
|
|
16379
|
-
console.log(chalk14.
|
|
16365
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
16380
16366
|
} else {
|
|
16381
16367
|
console.log(chalk14.green("\u2713 Found"));
|
|
16382
|
-
console.log(chalk14.
|
|
16383
|
-
console.log(chalk14.
|
|
16384
|
-
console.log(chalk14.
|
|
16368
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
16369
|
+
console.log(chalk14.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
16370
|
+
console.log(chalk14.dim(` Size: ${formatBytes6(info.size)}`));
|
|
16385
16371
|
}
|
|
16386
16372
|
} catch (error43) {
|
|
16387
16373
|
console.error(chalk14.red("\u2717 Status check failed"));
|
|
16388
16374
|
if (error43 instanceof Error) {
|
|
16389
|
-
console.error(chalk14.
|
|
16375
|
+
console.error(chalk14.dim(` ${error43.message}`));
|
|
16390
16376
|
}
|
|
16391
16377
|
process.exit(1);
|
|
16392
16378
|
}
|
|
@@ -16505,7 +16491,7 @@ async function checkAndUpgrade(currentVersion, prompt) {
|
|
|
16505
16491
|
console.log();
|
|
16506
16492
|
console.log(chalk15.red("Upgrade failed. Please run manually:"));
|
|
16507
16493
|
console.log(chalk15.cyan(` npm install -g ${PACKAGE_NAME}@latest`));
|
|
16508
|
-
console.log(chalk15.
|
|
16494
|
+
console.log(chalk15.dim(" # or"));
|
|
16509
16495
|
console.log(chalk15.cyan(` pnpm add -g ${PACKAGE_NAME}@latest`));
|
|
16510
16496
|
console.log();
|
|
16511
16497
|
console.log("Then re-run:");
|
|
@@ -16718,7 +16704,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
16718
16704
|
);
|
|
16719
16705
|
if (serverVersion && existsSync7(artifactDir)) {
|
|
16720
16706
|
console.log();
|
|
16721
|
-
console.log(chalk16.
|
|
16707
|
+
console.log(chalk16.bold("Pulling updated artifact:"));
|
|
16722
16708
|
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
16723
16709
|
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
16724
16710
|
try {
|
|
@@ -16730,19 +16716,19 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
16730
16716
|
} catch (error43) {
|
|
16731
16717
|
console.error(chalk16.red(`\u2717 Artifact pull failed`));
|
|
16732
16718
|
if (error43 instanceof Error) {
|
|
16733
|
-
console.error(chalk16.
|
|
16719
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16734
16720
|
}
|
|
16735
16721
|
}
|
|
16736
16722
|
}
|
|
16737
16723
|
}
|
|
16738
16724
|
var cookCmd = new Command13().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
16739
16725
|
cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
16740
|
-
const shouldExit = await checkAndUpgrade("4.26.
|
|
16726
|
+
const shouldExit = await checkAndUpgrade("4.26.1", prompt);
|
|
16741
16727
|
if (shouldExit) {
|
|
16742
16728
|
process.exit(0);
|
|
16743
16729
|
}
|
|
16744
16730
|
const cwd = process.cwd();
|
|
16745
|
-
console.log(chalk16.
|
|
16731
|
+
console.log(chalk16.bold(`Reading config: ${CONFIG_FILE3}`));
|
|
16746
16732
|
if (!existsSync7(CONFIG_FILE3)) {
|
|
16747
16733
|
console.error(chalk16.red(`\u2717 Config file not found: ${CONFIG_FILE3}`));
|
|
16748
16734
|
process.exit(1);
|
|
@@ -16754,7 +16740,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16754
16740
|
} catch (error43) {
|
|
16755
16741
|
console.error(chalk16.red("\u2717 Invalid YAML format"));
|
|
16756
16742
|
if (error43 instanceof Error) {
|
|
16757
|
-
console.error(chalk16.
|
|
16743
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16758
16744
|
}
|
|
16759
16745
|
process.exit(1);
|
|
16760
16746
|
}
|
|
@@ -16789,7 +16775,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16789
16775
|
}
|
|
16790
16776
|
if (config2.volumes && Object.keys(config2.volumes).length > 0) {
|
|
16791
16777
|
console.log();
|
|
16792
|
-
console.log(chalk16.
|
|
16778
|
+
console.log(chalk16.bold("Processing volumes:"));
|
|
16793
16779
|
for (const volumeConfig of Object.values(config2.volumes)) {
|
|
16794
16780
|
const volumeDir = path11.join(cwd, volumeConfig.name);
|
|
16795
16781
|
if (!existsSync7(volumeDir)) {
|
|
@@ -16819,14 +16805,14 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16819
16805
|
} catch (error43) {
|
|
16820
16806
|
console.error(chalk16.red(`\u2717 Failed`));
|
|
16821
16807
|
if (error43 instanceof Error) {
|
|
16822
|
-
console.error(chalk16.
|
|
16808
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16823
16809
|
}
|
|
16824
16810
|
process.exit(1);
|
|
16825
16811
|
}
|
|
16826
16812
|
}
|
|
16827
16813
|
}
|
|
16828
16814
|
console.log();
|
|
16829
|
-
console.log(chalk16.
|
|
16815
|
+
console.log(chalk16.bold("Processing artifact:"));
|
|
16830
16816
|
const artifactDir = path11.join(cwd, ARTIFACT_DIR);
|
|
16831
16817
|
try {
|
|
16832
16818
|
if (!existsSync7(artifactDir)) {
|
|
@@ -16851,12 +16837,12 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16851
16837
|
} catch (error43) {
|
|
16852
16838
|
console.error(chalk16.red(`\u2717 Failed`));
|
|
16853
16839
|
if (error43 instanceof Error) {
|
|
16854
|
-
console.error(chalk16.
|
|
16840
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16855
16841
|
}
|
|
16856
16842
|
process.exit(1);
|
|
16857
16843
|
}
|
|
16858
16844
|
console.log();
|
|
16859
|
-
console.log(chalk16.
|
|
16845
|
+
console.log(chalk16.bold("Composing agent:"));
|
|
16860
16846
|
printCommand(`vm0 compose ${CONFIG_FILE3}`);
|
|
16861
16847
|
try {
|
|
16862
16848
|
await execVm0Command(["compose", CONFIG_FILE3], {
|
|
@@ -16866,13 +16852,13 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16866
16852
|
} catch (error43) {
|
|
16867
16853
|
console.error(chalk16.red(`\u2717 Compose failed`));
|
|
16868
16854
|
if (error43 instanceof Error) {
|
|
16869
|
-
console.error(chalk16.
|
|
16855
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16870
16856
|
}
|
|
16871
16857
|
process.exit(1);
|
|
16872
16858
|
}
|
|
16873
16859
|
if (prompt) {
|
|
16874
16860
|
console.log();
|
|
16875
|
-
console.log(chalk16.
|
|
16861
|
+
console.log(chalk16.bold("Running agent:"));
|
|
16876
16862
|
printCommand(
|
|
16877
16863
|
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
16878
16864
|
);
|
|
@@ -16915,7 +16901,7 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
|
|
|
16915
16901
|
const state = await loadCookState();
|
|
16916
16902
|
if (!state.lastRunId) {
|
|
16917
16903
|
console.error(chalk16.red("\u2717 No previous run found"));
|
|
16918
|
-
console.error(chalk16.
|
|
16904
|
+
console.error(chalk16.dim(" Run 'vm0 cook <prompt>' first"));
|
|
16919
16905
|
process.exit(1);
|
|
16920
16906
|
}
|
|
16921
16907
|
const args = ["logs", state.lastRunId];
|
|
@@ -16954,7 +16940,7 @@ cookCmd.command("continue").description(
|
|
|
16954
16940
|
const state = await loadCookState();
|
|
16955
16941
|
if (!state.lastSessionId) {
|
|
16956
16942
|
console.error(chalk16.red("\u2717 No previous session found"));
|
|
16957
|
-
console.error(chalk16.
|
|
16943
|
+
console.error(chalk16.dim(" Run 'vm0 cook <prompt>' first"));
|
|
16958
16944
|
process.exit(1);
|
|
16959
16945
|
}
|
|
16960
16946
|
const cwd = process.cwd();
|
|
@@ -16986,7 +16972,7 @@ cookCmd.command("resume").description(
|
|
|
16986
16972
|
const state = await loadCookState();
|
|
16987
16973
|
if (!state.lastCheckpointId) {
|
|
16988
16974
|
console.error(chalk16.red("\u2717 No previous checkpoint found"));
|
|
16989
|
-
console.error(chalk16.
|
|
16975
|
+
console.error(chalk16.dim(" Run 'vm0 cook <prompt>' first"));
|
|
16990
16976
|
process.exit(1);
|
|
16991
16977
|
}
|
|
16992
16978
|
const cwd = process.cwd();
|
|
@@ -17101,7 +17087,7 @@ var buildCommand = new Command14().name("build").description("Build a custom ima
|
|
|
17101
17087
|
);
|
|
17102
17088
|
process.exit(1);
|
|
17103
17089
|
}
|
|
17104
|
-
console.log(chalk17.
|
|
17090
|
+
console.log(chalk17.bold(`Building image: ${scope.slug}/${name}`));
|
|
17105
17091
|
console.log();
|
|
17106
17092
|
const buildInfo = await apiClient.createImage({
|
|
17107
17093
|
dockerfile,
|
|
@@ -17109,7 +17095,7 @@ var buildCommand = new Command14().name("build").description("Build a custom ima
|
|
|
17109
17095
|
deleteExisting
|
|
17110
17096
|
});
|
|
17111
17097
|
const { imageId, buildId, versionId } = buildInfo;
|
|
17112
|
-
console.log(chalk17.
|
|
17098
|
+
console.log(chalk17.dim(` Build ID: ${buildId}`));
|
|
17113
17099
|
console.log();
|
|
17114
17100
|
let logsOffset = 0;
|
|
17115
17101
|
let status = "building";
|
|
@@ -17125,7 +17111,7 @@ var buildCommand = new Command14().name("build").description("Build a custom ima
|
|
|
17125
17111
|
}
|
|
17126
17112
|
const statusData = await statusResponse.json();
|
|
17127
17113
|
for (const log of statusData.logs) {
|
|
17128
|
-
console.log(chalk17.
|
|
17114
|
+
console.log(chalk17.dim(` ${log}`));
|
|
17129
17115
|
}
|
|
17130
17116
|
logsOffset = statusData.logsOffset;
|
|
17131
17117
|
status = statusData.status;
|
|
@@ -17175,7 +17161,7 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17175
17161
|
const data = await response.json();
|
|
17176
17162
|
const { images } = data;
|
|
17177
17163
|
if (images.length === 0) {
|
|
17178
|
-
console.log(chalk18.
|
|
17164
|
+
console.log(chalk18.dim("No images found."));
|
|
17179
17165
|
console.log();
|
|
17180
17166
|
console.log("Build your first image:");
|
|
17181
17167
|
console.log(
|
|
@@ -17197,11 +17183,11 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17197
17183
|
latestVersions.set(alias, latestReady?.versionId || null);
|
|
17198
17184
|
}
|
|
17199
17185
|
console.log(
|
|
17200
|
-
chalk18.
|
|
17186
|
+
chalk18.dim(
|
|
17201
17187
|
`${"NAME".padEnd(40)} ${"STATUS".padEnd(12)} ${"CREATED".padEnd(20)}`
|
|
17202
17188
|
)
|
|
17203
17189
|
);
|
|
17204
|
-
console.log(chalk18.
|
|
17190
|
+
console.log(chalk18.dim("-".repeat(72)));
|
|
17205
17191
|
for (const image of images) {
|
|
17206
17192
|
const statusColor = image.status === "ready" ? chalk18.green : image.status === "building" ? chalk18.yellow : chalk18.red;
|
|
17207
17193
|
const createdAt = new Date(image.createdAt).toLocaleString();
|
|
@@ -17210,7 +17196,7 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17210
17196
|
const shortVersion = formatVersionIdForDisplay(image.versionId);
|
|
17211
17197
|
displayName = `${image.alias}:${shortVersion}`;
|
|
17212
17198
|
if (image.status === "ready" && latestVersions.get(image.alias) === image.versionId) {
|
|
17213
|
-
displayName = `${displayName} ${chalk18.cyan("
|
|
17199
|
+
displayName = `${displayName} ${chalk18.cyan("latest")}`;
|
|
17214
17200
|
}
|
|
17215
17201
|
}
|
|
17216
17202
|
console.log(
|
|
@@ -17221,7 +17207,7 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17221
17207
|
}
|
|
17222
17208
|
}
|
|
17223
17209
|
console.log();
|
|
17224
|
-
console.log(chalk18.
|
|
17210
|
+
console.log(chalk18.dim(`Total: ${images.length} version(s)`));
|
|
17225
17211
|
} catch (error43) {
|
|
17226
17212
|
if (error43 instanceof Error) {
|
|
17227
17213
|
if (error43.message.includes("Not authenticated")) {
|
|
@@ -17311,7 +17297,7 @@ var deleteCommand = new Command16().name("delete").alias("rm").description("Dele
|
|
|
17311
17297
|
});
|
|
17312
17298
|
});
|
|
17313
17299
|
if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
|
|
17314
|
-
console.log(chalk19.
|
|
17300
|
+
console.log(chalk19.dim("Cancelled."));
|
|
17315
17301
|
return;
|
|
17316
17302
|
}
|
|
17317
17303
|
}
|
|
@@ -17366,17 +17352,17 @@ var versionsCommand = new Command17().name("versions").description("List all ver
|
|
|
17366
17352
|
console.log(chalk20.bold(`Versions of ${name}:`));
|
|
17367
17353
|
console.log();
|
|
17368
17354
|
console.log(
|
|
17369
|
-
chalk20.
|
|
17355
|
+
chalk20.dim(
|
|
17370
17356
|
`${"VERSION".padEnd(20)} ${"STATUS".padEnd(12)} ${"CREATED".padEnd(24)}`
|
|
17371
17357
|
)
|
|
17372
17358
|
);
|
|
17373
|
-
console.log(chalk20.
|
|
17359
|
+
console.log(chalk20.dim("-".repeat(56)));
|
|
17374
17360
|
for (const version2 of versions) {
|
|
17375
17361
|
const statusColor = version2.status === "ready" ? chalk20.green : version2.status === "building" ? chalk20.yellow : chalk20.red;
|
|
17376
17362
|
const createdAt = new Date(version2.createdAt).toLocaleString();
|
|
17377
17363
|
let versionDisplay = version2.versionId ? formatVersionIdForDisplay(version2.versionId) : "(legacy)";
|
|
17378
17364
|
if (version2.status === "ready" && version2.versionId === latestVersionId) {
|
|
17379
|
-
versionDisplay = `${versionDisplay} ${chalk20.cyan("
|
|
17365
|
+
versionDisplay = `${versionDisplay} ${chalk20.cyan("latest")}`;
|
|
17380
17366
|
}
|
|
17381
17367
|
console.log(
|
|
17382
17368
|
`${versionDisplay.padEnd(20)} ${statusColor(version2.status.padEnd(12))} ${createdAt.padEnd(24)}`
|
|
@@ -17386,14 +17372,14 @@ var versionsCommand = new Command17().name("versions").description("List all ver
|
|
|
17386
17372
|
}
|
|
17387
17373
|
}
|
|
17388
17374
|
console.log();
|
|
17389
|
-
console.log(chalk20.
|
|
17375
|
+
console.log(chalk20.dim(`Total: ${versions.length} version(s)`));
|
|
17390
17376
|
console.log();
|
|
17391
|
-
console.log(chalk20.
|
|
17392
|
-
console.log(chalk20.
|
|
17377
|
+
console.log(chalk20.dim("Usage:"));
|
|
17378
|
+
console.log(chalk20.dim(` image: "${name}" # uses latest`));
|
|
17393
17379
|
if (latestVersionId) {
|
|
17394
17380
|
const shortVersion = formatVersionIdForDisplay(latestVersionId);
|
|
17395
17381
|
console.log(
|
|
17396
|
-
chalk20.
|
|
17382
|
+
chalk20.dim(
|
|
17397
17383
|
` image: "${name}:${shortVersion}" # pin to specific version`
|
|
17398
17384
|
)
|
|
17399
17385
|
);
|
|
@@ -17495,7 +17481,7 @@ function formatNetworkLog(entry) {
|
|
|
17495
17481
|
} else {
|
|
17496
17482
|
latencyColor = chalk21.red;
|
|
17497
17483
|
}
|
|
17498
|
-
return `[${entry.timestamp}] ${
|
|
17484
|
+
return `[${entry.timestamp}] ${entry.method.padEnd(6)} ${statusColor(entry.status)} ${latencyColor(entry.latency_ms + "ms")} ${formatBytes7(entry.request_size)}/${formatBytes7(entry.response_size)} ${chalk21.dim(entry.url)}`;
|
|
17499
17485
|
}
|
|
17500
17486
|
function renderAgentEvent(event, provider) {
|
|
17501
17487
|
const eventData = event.eventData;
|
|
@@ -17580,7 +17566,7 @@ async function showAgentEvents(runId, options) {
|
|
|
17580
17566
|
if (response.hasMore) {
|
|
17581
17567
|
console.log();
|
|
17582
17568
|
console.log(
|
|
17583
|
-
chalk21.
|
|
17569
|
+
chalk21.dim(
|
|
17584
17570
|
`Showing ${response.events.length} events. Use --limit to see more.`
|
|
17585
17571
|
)
|
|
17586
17572
|
);
|
|
@@ -17596,7 +17582,7 @@ async function showSystemLog(runId, options) {
|
|
|
17596
17582
|
if (response.hasMore) {
|
|
17597
17583
|
console.log();
|
|
17598
17584
|
console.log(
|
|
17599
|
-
chalk21.
|
|
17585
|
+
chalk21.dim("More log entries available. Use --limit to see more.")
|
|
17600
17586
|
);
|
|
17601
17587
|
}
|
|
17602
17588
|
}
|
|
@@ -17612,7 +17598,7 @@ async function showMetrics(runId, options) {
|
|
|
17612
17598
|
if (response.hasMore) {
|
|
17613
17599
|
console.log();
|
|
17614
17600
|
console.log(
|
|
17615
|
-
chalk21.
|
|
17601
|
+
chalk21.dim(
|
|
17616
17602
|
`Showing ${response.metrics.length} metrics. Use --limit to see more.`
|
|
17617
17603
|
)
|
|
17618
17604
|
);
|
|
@@ -17634,7 +17620,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
17634
17620
|
if (response.hasMore) {
|
|
17635
17621
|
console.log();
|
|
17636
17622
|
console.log(
|
|
17637
|
-
chalk21.
|
|
17623
|
+
chalk21.dim(
|
|
17638
17624
|
`Showing ${response.networkLogs.length} network logs. Use --limit to see more.`
|
|
17639
17625
|
)
|
|
17640
17626
|
);
|
|
@@ -17650,7 +17636,7 @@ function handleError(error43, runId) {
|
|
|
17650
17636
|
console.error(chalk21.red(error43.message));
|
|
17651
17637
|
} else {
|
|
17652
17638
|
console.error(chalk21.red("Failed to fetch logs"));
|
|
17653
|
-
console.error(chalk21.
|
|
17639
|
+
console.error(chalk21.dim(` ${error43.message}`));
|
|
17654
17640
|
}
|
|
17655
17641
|
} else {
|
|
17656
17642
|
console.error(chalk21.red("An unexpected error occurred"));
|
|
@@ -17666,7 +17652,7 @@ import chalk22 from "chalk";
|
|
|
17666
17652
|
var statusCommand3 = new Command20().name("status").description("View current scope status").action(async () => {
|
|
17667
17653
|
try {
|
|
17668
17654
|
const scope = await apiClient.getScope();
|
|
17669
|
-
console.log(chalk22.
|
|
17655
|
+
console.log(chalk22.bold("Scope Information:"));
|
|
17670
17656
|
console.log(` Slug: ${chalk22.green(scope.slug)}`);
|
|
17671
17657
|
console.log(` Type: ${scope.type}`);
|
|
17672
17658
|
if (scope.displayName) {
|
|
@@ -17686,7 +17672,7 @@ var statusCommand3 = new Command20().name("status").description("View current sc
|
|
|
17686
17672
|
console.log(chalk22.cyan(" vm0 scope set <slug>"));
|
|
17687
17673
|
console.log();
|
|
17688
17674
|
console.log("Example:");
|
|
17689
|
-
console.log(chalk22.
|
|
17675
|
+
console.log(chalk22.dim(" vm0 scope set myusername"));
|
|
17690
17676
|
} else {
|
|
17691
17677
|
console.error(chalk22.red(`\u2717 ${error43.message}`));
|
|
17692
17678
|
}
|
|
@@ -17854,9 +17840,9 @@ var initCommand3 = new Command23().name("init").description("Initialize a new VM
|
|
|
17854
17840
|
if (!agentName || !validateAgentName(agentName)) {
|
|
17855
17841
|
console.log(chalk24.red("\u2717 Invalid agent name"));
|
|
17856
17842
|
console.log(
|
|
17857
|
-
chalk24.
|
|
17843
|
+
chalk24.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
17858
17844
|
);
|
|
17859
|
-
console.log(chalk24.
|
|
17845
|
+
console.log(chalk24.dim(" Must start and end with letter or number"));
|
|
17860
17846
|
process.exit(1);
|
|
17861
17847
|
}
|
|
17862
17848
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
@@ -17871,15 +17857,15 @@ var initCommand3 = new Command23().name("init").description("Initialize a new VM
|
|
|
17871
17857
|
` 1. Get your Claude Code token: ${chalk24.cyan("claude setup-token")}`
|
|
17872
17858
|
);
|
|
17873
17859
|
console.log(` 2. Set the environment variable (or add to .env file):`);
|
|
17874
|
-
console.log(chalk24.
|
|
17860
|
+
console.log(chalk24.dim(` export CLAUDE_CODE_OAUTH_TOKEN=<your-token>`));
|
|
17875
17861
|
console.log(` 3. Run your agent: ${chalk24.cyan('vm0 cook "your prompt"')}`);
|
|
17876
17862
|
});
|
|
17877
17863
|
|
|
17878
17864
|
// src/index.ts
|
|
17879
17865
|
var program = new Command24();
|
|
17880
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.26.
|
|
17866
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.26.1");
|
|
17881
17867
|
program.command("info").description("Display environment information").action(async () => {
|
|
17882
|
-
console.log(chalk25.
|
|
17868
|
+
console.log(chalk25.bold("System Information:"));
|
|
17883
17869
|
console.log(`Node Version: ${process.version}`);
|
|
17884
17870
|
console.log(`Platform: ${process.platform}`);
|
|
17885
17871
|
console.log(`Architecture: ${process.arch}`);
|