@vm0/cli 4.26.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +262 -202
- 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() {
|
|
@@ -12370,7 +12370,7 @@ var agentDefinitionSchema = external_exports.object({
|
|
|
12370
12370
|
* is routed through mitmproxy -> VM0 Proxy for decryption.
|
|
12371
12371
|
* Default: false (plaintext secrets in env vars)
|
|
12372
12372
|
*/
|
|
12373
|
-
|
|
12373
|
+
experimental_network_security: external_exports.boolean().optional().default(false),
|
|
12374
12374
|
/**
|
|
12375
12375
|
* Path to instructions file (e.g., AGENTS.md).
|
|
12376
12376
|
* Auto-uploaded as volume and mounted at /home/user/.claude/CLAUDE.md
|
|
@@ -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
|
|
@@ -14038,6 +14038,50 @@ function validateAgentCompose(config2) {
|
|
|
14038
14038
|
}
|
|
14039
14039
|
}
|
|
14040
14040
|
}
|
|
14041
|
+
if (agent.experimental_secrets !== void 0) {
|
|
14042
|
+
if (!Array.isArray(agent.experimental_secrets)) {
|
|
14043
|
+
return {
|
|
14044
|
+
valid: false,
|
|
14045
|
+
error: "agent.experimental_secrets must be an array of strings"
|
|
14046
|
+
};
|
|
14047
|
+
}
|
|
14048
|
+
for (const item of agent.experimental_secrets) {
|
|
14049
|
+
if (typeof item !== "string") {
|
|
14050
|
+
return {
|
|
14051
|
+
valid: false,
|
|
14052
|
+
error: "Each entry in experimental_secrets must be a string"
|
|
14053
|
+
};
|
|
14054
|
+
}
|
|
14055
|
+
if (item.length === 0) {
|
|
14056
|
+
return {
|
|
14057
|
+
valid: false,
|
|
14058
|
+
error: "experimental_secrets entries cannot be empty strings"
|
|
14059
|
+
};
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
}
|
|
14063
|
+
if (agent.experimental_vars !== void 0) {
|
|
14064
|
+
if (!Array.isArray(agent.experimental_vars)) {
|
|
14065
|
+
return {
|
|
14066
|
+
valid: false,
|
|
14067
|
+
error: "agent.experimental_vars must be an array of strings"
|
|
14068
|
+
};
|
|
14069
|
+
}
|
|
14070
|
+
for (const item of agent.experimental_vars) {
|
|
14071
|
+
if (typeof item !== "string") {
|
|
14072
|
+
return {
|
|
14073
|
+
valid: false,
|
|
14074
|
+
error: "Each entry in experimental_vars must be a string"
|
|
14075
|
+
};
|
|
14076
|
+
}
|
|
14077
|
+
if (item.length === 0) {
|
|
14078
|
+
return {
|
|
14079
|
+
valid: false,
|
|
14080
|
+
error: "experimental_vars entries cannot be empty strings"
|
|
14081
|
+
};
|
|
14082
|
+
}
|
|
14083
|
+
}
|
|
14084
|
+
}
|
|
14041
14085
|
const agentVolumes = agent.volumes;
|
|
14042
14086
|
if (agentVolumes && Array.isArray(agentVolumes) && agentVolumes.length > 0) {
|
|
14043
14087
|
const volumesSection = cfg.volumes;
|
|
@@ -14482,6 +14526,33 @@ async function uploadSkill(skillUrl) {
|
|
|
14482
14526
|
}
|
|
14483
14527
|
|
|
14484
14528
|
// src/commands/compose.ts
|
|
14529
|
+
function transformExperimentalShorthand(agent) {
|
|
14530
|
+
const experimentalSecrets = agent.experimental_secrets;
|
|
14531
|
+
const experimentalVars = agent.experimental_vars;
|
|
14532
|
+
if (!experimentalSecrets && !experimentalVars) {
|
|
14533
|
+
return;
|
|
14534
|
+
}
|
|
14535
|
+
const environment = agent.environment || {};
|
|
14536
|
+
if (experimentalSecrets) {
|
|
14537
|
+
for (const secretName of experimentalSecrets) {
|
|
14538
|
+
if (!(secretName in environment)) {
|
|
14539
|
+
environment[secretName] = "${{ secrets." + secretName + " }}";
|
|
14540
|
+
}
|
|
14541
|
+
}
|
|
14542
|
+
delete agent.experimental_secrets;
|
|
14543
|
+
}
|
|
14544
|
+
if (experimentalVars) {
|
|
14545
|
+
for (const varName of experimentalVars) {
|
|
14546
|
+
if (!(varName in environment)) {
|
|
14547
|
+
environment[varName] = "${{ vars." + varName + " }}";
|
|
14548
|
+
}
|
|
14549
|
+
}
|
|
14550
|
+
delete agent.experimental_vars;
|
|
14551
|
+
}
|
|
14552
|
+
if (Object.keys(environment).length > 0) {
|
|
14553
|
+
agent.environment = environment;
|
|
14554
|
+
}
|
|
14555
|
+
}
|
|
14485
14556
|
var composeCommand = new Command().name("compose").description("Create or update agent compose").argument("<config-file>", "Path to config YAML file").action(async (configFile) => {
|
|
14486
14557
|
try {
|
|
14487
14558
|
if (!existsSync3(configFile)) {
|
|
@@ -14495,7 +14566,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14495
14566
|
} catch (error43) {
|
|
14496
14567
|
console.error(chalk2.red("\u2717 Invalid YAML format"));
|
|
14497
14568
|
if (error43 instanceof Error) {
|
|
14498
|
-
console.error(chalk2.
|
|
14569
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14499
14570
|
}
|
|
14500
14571
|
process.exit(1);
|
|
14501
14572
|
}
|
|
@@ -14506,6 +14577,9 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14506
14577
|
}
|
|
14507
14578
|
const cfg = config2;
|
|
14508
14579
|
const agentsConfig = cfg.agents;
|
|
14580
|
+
for (const agentConfig of Object.values(agentsConfig)) {
|
|
14581
|
+
transformExperimentalShorthand(agentConfig);
|
|
14582
|
+
}
|
|
14509
14583
|
for (const [name, agentConfig] of Object.entries(agentsConfig)) {
|
|
14510
14584
|
const image = agentConfig.image;
|
|
14511
14585
|
if (image) {
|
|
@@ -14527,14 +14601,14 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14527
14601
|
if (defaultImage) {
|
|
14528
14602
|
agent.image = defaultImage;
|
|
14529
14603
|
console.log(
|
|
14530
|
-
chalk2.
|
|
14604
|
+
chalk2.dim(` Auto-configured image: ${defaultImage}`)
|
|
14531
14605
|
);
|
|
14532
14606
|
}
|
|
14533
14607
|
}
|
|
14534
14608
|
if (!agent.working_dir) {
|
|
14535
14609
|
agent.working_dir = defaults.workingDir;
|
|
14536
14610
|
console.log(
|
|
14537
|
-
chalk2.
|
|
14611
|
+
chalk2.dim(
|
|
14538
14612
|
` Auto-configured working_dir: ${defaults.workingDir}`
|
|
14539
14613
|
)
|
|
14540
14614
|
);
|
|
@@ -14544,7 +14618,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14544
14618
|
if (agent.instructions) {
|
|
14545
14619
|
const instructionsPath = agent.instructions;
|
|
14546
14620
|
const provider = agent.provider;
|
|
14547
|
-
console.log(
|
|
14621
|
+
console.log(`Uploading instructions: ${instructionsPath}`);
|
|
14548
14622
|
try {
|
|
14549
14623
|
const result = await uploadInstructions(
|
|
14550
14624
|
agentName,
|
|
@@ -14560,17 +14634,17 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14560
14634
|
} catch (error43) {
|
|
14561
14635
|
console.error(chalk2.red(`\u2717 Failed to upload instructions`));
|
|
14562
14636
|
if (error43 instanceof Error) {
|
|
14563
|
-
console.error(chalk2.
|
|
14637
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14564
14638
|
}
|
|
14565
14639
|
process.exit(1);
|
|
14566
14640
|
}
|
|
14567
14641
|
}
|
|
14568
14642
|
if (agent.skills && Array.isArray(agent.skills)) {
|
|
14569
14643
|
const skillUrls = agent.skills;
|
|
14570
|
-
console.log(
|
|
14644
|
+
console.log(`Uploading ${skillUrls.length} skill(s)...`);
|
|
14571
14645
|
for (const skillUrl of skillUrls) {
|
|
14572
14646
|
try {
|
|
14573
|
-
console.log(chalk2.
|
|
14647
|
+
console.log(chalk2.dim(` Downloading: ${skillUrl}`));
|
|
14574
14648
|
const result = await uploadSkill(skillUrl);
|
|
14575
14649
|
console.log(
|
|
14576
14650
|
chalk2.green(
|
|
@@ -14580,13 +14654,13 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14580
14654
|
} catch (error43) {
|
|
14581
14655
|
console.error(chalk2.red(`\u2717 Failed to upload skill: ${skillUrl}`));
|
|
14582
14656
|
if (error43 instanceof Error) {
|
|
14583
|
-
console.error(chalk2.
|
|
14657
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14584
14658
|
}
|
|
14585
14659
|
process.exit(1);
|
|
14586
14660
|
}
|
|
14587
14661
|
}
|
|
14588
14662
|
}
|
|
14589
|
-
console.log(
|
|
14663
|
+
console.log("Uploading compose...");
|
|
14590
14664
|
const response = await apiClient.createOrUpdateCompose({
|
|
14591
14665
|
content: config2
|
|
14592
14666
|
});
|
|
@@ -14596,8 +14670,8 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14596
14670
|
} else {
|
|
14597
14671
|
console.log(chalk2.green(`\u2713 Compose version exists: ${response.name}`));
|
|
14598
14672
|
}
|
|
14599
|
-
console.log(chalk2.
|
|
14600
|
-
console.log(chalk2.
|
|
14673
|
+
console.log(chalk2.dim(` Compose ID: ${response.composeId}`));
|
|
14674
|
+
console.log(chalk2.dim(` Version: ${shortVersionId}`));
|
|
14601
14675
|
console.log();
|
|
14602
14676
|
console.log(" Run your agent:");
|
|
14603
14677
|
console.log(
|
|
@@ -14611,10 +14685,10 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14611
14685
|
console.error(chalk2.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
14612
14686
|
} else if (error43.message.includes("Failed to create compose")) {
|
|
14613
14687
|
console.error(chalk2.red("\u2717 Failed to create compose"));
|
|
14614
|
-
console.error(chalk2.
|
|
14688
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14615
14689
|
} else {
|
|
14616
14690
|
console.error(chalk2.red("\u2717 Failed to create compose"));
|
|
14617
|
-
console.error(chalk2.
|
|
14691
|
+
console.error(chalk2.dim(` ${error43.message}`));
|
|
14618
14692
|
}
|
|
14619
14693
|
} else {
|
|
14620
14694
|
console.error(chalk2.red("\u2717 An unexpected error occurred"));
|
|
@@ -14958,12 +15032,12 @@ var EventRenderer = class {
|
|
|
14958
15032
|
* Called immediately after run is created, before polling events
|
|
14959
15033
|
*/
|
|
14960
15034
|
static renderRunStarted(info) {
|
|
14961
|
-
console.log(chalk3.
|
|
14962
|
-
console.log(` Run ID: ${chalk3.
|
|
15035
|
+
console.log(chalk3.bold("\u25B6 Run started"));
|
|
15036
|
+
console.log(` Run ID: ${chalk3.dim(info.runId)}`);
|
|
14963
15037
|
if (info.sandboxId) {
|
|
14964
|
-
console.log(` Sandbox: ${chalk3.
|
|
15038
|
+
console.log(` Sandbox: ${chalk3.dim(info.sandboxId)}`);
|
|
14965
15039
|
}
|
|
14966
|
-
console.log(chalk3.
|
|
15040
|
+
console.log(chalk3.dim(` (use "vm0 logs ${info.runId}" to view logs)`));
|
|
14967
15041
|
console.log();
|
|
14968
15042
|
}
|
|
14969
15043
|
/**
|
|
@@ -14996,7 +15070,7 @@ var EventRenderer = class {
|
|
|
14996
15070
|
*/
|
|
14997
15071
|
static render(event, options) {
|
|
14998
15072
|
const timestampPrefix = options?.showTimestamp ? `[${this.formatTimestamp(event.timestamp)}] ` : "";
|
|
14999
|
-
const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.
|
|
15073
|
+
const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.dim(
|
|
15000
15074
|
this.formatElapsed(options.previousTimestamp, event.timestamp)
|
|
15001
15075
|
) : "";
|
|
15002
15076
|
switch (event.type) {
|
|
@@ -15026,29 +15100,25 @@ var EventRenderer = class {
|
|
|
15026
15100
|
console.log("");
|
|
15027
15101
|
console.log(chalk3.green("\u2713 Run completed successfully"));
|
|
15028
15102
|
if (result) {
|
|
15029
|
-
console.log(` Checkpoint: ${chalk3.
|
|
15030
|
-
console.log(` Session: ${chalk3.
|
|
15031
|
-
console.log(` Conversation: ${chalk3.
|
|
15103
|
+
console.log(` Checkpoint: ${chalk3.dim(result.checkpointId)}`);
|
|
15104
|
+
console.log(` Session: ${chalk3.dim(result.agentSessionId)}`);
|
|
15105
|
+
console.log(` Conversation: ${chalk3.dim(result.conversationId)}`);
|
|
15032
15106
|
if (result.artifact && Object.keys(result.artifact).length > 0) {
|
|
15033
15107
|
console.log(` Artifact:`);
|
|
15034
15108
|
for (const [name, version2] of Object.entries(result.artifact)) {
|
|
15035
|
-
console.log(
|
|
15036
|
-
` ${name}: ${chalk3.gray(this.formatVersion(version2))}`
|
|
15037
|
-
);
|
|
15109
|
+
console.log(` ${name}: ${chalk3.dim(this.formatVersion(version2))}`);
|
|
15038
15110
|
}
|
|
15039
15111
|
}
|
|
15040
15112
|
if (result.volumes && Object.keys(result.volumes).length > 0) {
|
|
15041
15113
|
console.log(` Volumes:`);
|
|
15042
15114
|
for (const [name, version2] of Object.entries(result.volumes)) {
|
|
15043
|
-
console.log(
|
|
15044
|
-
` ${name}: ${chalk3.gray(this.formatVersion(version2))}`
|
|
15045
|
-
);
|
|
15115
|
+
console.log(` ${name}: ${chalk3.dim(this.formatVersion(version2))}`);
|
|
15046
15116
|
}
|
|
15047
15117
|
}
|
|
15048
15118
|
}
|
|
15049
15119
|
if (options?.verbose && options?.startTimestamp) {
|
|
15050
15120
|
const totalTime = this.formatTotalTime(options.startTimestamp, now);
|
|
15051
|
-
console.log(` Total time: ${chalk3.
|
|
15121
|
+
console.log(` Total time: ${chalk3.dim(totalTime)}`);
|
|
15052
15122
|
}
|
|
15053
15123
|
}
|
|
15054
15124
|
/**
|
|
@@ -15060,38 +15130,36 @@ var EventRenderer = class {
|
|
|
15060
15130
|
console.log(chalk3.red("\u2717 Run failed"));
|
|
15061
15131
|
console.log(` Error: ${chalk3.red(error43 || "Unknown error")}`);
|
|
15062
15132
|
console.log(
|
|
15063
|
-
chalk3.
|
|
15133
|
+
chalk3.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
15064
15134
|
);
|
|
15065
15135
|
}
|
|
15066
15136
|
static renderInit(event, prefix, suffix) {
|
|
15067
15137
|
const providerStr = String(event.data.provider || "claude-code");
|
|
15068
15138
|
const displayName = isSupportedProvider(providerStr) ? getProviderDisplayName(providerStr) : providerStr;
|
|
15069
|
-
console.log(
|
|
15070
|
-
|
|
15071
|
-
);
|
|
15072
|
-
console.log(` Session: ${chalk3.gray(String(event.data.sessionId || ""))}`);
|
|
15139
|
+
console.log(prefix + "[init]" + suffix + ` Starting ${displayName} agent`);
|
|
15140
|
+
console.log(` Session: ${chalk3.dim(String(event.data.sessionId || ""))}`);
|
|
15073
15141
|
if (event.data.model) {
|
|
15074
|
-
console.log(` Model: ${chalk3.
|
|
15142
|
+
console.log(` Model: ${chalk3.dim(String(event.data.model))}`);
|
|
15075
15143
|
}
|
|
15076
15144
|
console.log(
|
|
15077
|
-
` Tools: ${chalk3.
|
|
15145
|
+
` Tools: ${chalk3.dim(
|
|
15078
15146
|
Array.isArray(event.data.tools) ? event.data.tools.join(", ") : String(event.data.tools || "")
|
|
15079
15147
|
)}`
|
|
15080
15148
|
);
|
|
15081
15149
|
}
|
|
15082
15150
|
static renderText(event, prefix, suffix) {
|
|
15083
15151
|
const text = String(event.data.text || "");
|
|
15084
|
-
console.log(prefix +
|
|
15152
|
+
console.log(prefix + "[text]" + suffix + " " + text);
|
|
15085
15153
|
}
|
|
15086
15154
|
static renderToolUse(event, prefix, suffix) {
|
|
15087
15155
|
const tool = String(event.data.tool || "");
|
|
15088
|
-
console.log(prefix +
|
|
15156
|
+
console.log(prefix + "[tool_use]" + suffix + " " + tool);
|
|
15089
15157
|
const input = event.data.input;
|
|
15090
15158
|
if (input && typeof input === "object") {
|
|
15091
15159
|
for (const [key, value] of Object.entries(input)) {
|
|
15092
15160
|
if (value !== void 0 && value !== null) {
|
|
15093
15161
|
const displayValue = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value);
|
|
15094
|
-
console.log(` ${key}: ${chalk3.
|
|
15162
|
+
console.log(` ${key}: ${chalk3.dim(displayValue)}`);
|
|
15095
15163
|
}
|
|
15096
15164
|
}
|
|
15097
15165
|
}
|
|
@@ -15102,7 +15170,7 @@ var EventRenderer = class {
|
|
|
15102
15170
|
const color = isError ? chalk3.red : chalk3.green;
|
|
15103
15171
|
console.log(prefix + color("[tool_result]") + suffix + " " + status);
|
|
15104
15172
|
const result = String(event.data.result || "");
|
|
15105
|
-
console.log(` ${chalk3.
|
|
15173
|
+
console.log(` ${chalk3.dim(result)}`);
|
|
15106
15174
|
}
|
|
15107
15175
|
static renderResult(event, prefix, suffix) {
|
|
15108
15176
|
const success2 = Boolean(event.data.success);
|
|
@@ -15111,11 +15179,11 @@ var EventRenderer = class {
|
|
|
15111
15179
|
console.log(prefix + color("[result]") + suffix + " " + status);
|
|
15112
15180
|
const durationMs = Number(event.data.durationMs || 0);
|
|
15113
15181
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
15114
|
-
console.log(` Duration: ${chalk3.
|
|
15182
|
+
console.log(` Duration: ${chalk3.dim(durationSec + "s")}`);
|
|
15115
15183
|
const cost = Number(event.data.cost || 0);
|
|
15116
|
-
console.log(` Cost: ${chalk3.
|
|
15184
|
+
console.log(` Cost: ${chalk3.dim("$" + cost.toFixed(4))}`);
|
|
15117
15185
|
const numTurns = Number(event.data.numTurns || 0);
|
|
15118
|
-
console.log(` Turns: ${chalk3.
|
|
15186
|
+
console.log(` Turns: ${chalk3.dim(String(numTurns))}`);
|
|
15119
15187
|
const usage = event.data.usage;
|
|
15120
15188
|
if (usage && typeof usage === "object") {
|
|
15121
15189
|
const inputTokens = Number(usage.input_tokens || 0);
|
|
@@ -15127,7 +15195,7 @@ var EventRenderer = class {
|
|
|
15127
15195
|
return String(count);
|
|
15128
15196
|
};
|
|
15129
15197
|
console.log(
|
|
15130
|
-
` Tokens: ${chalk3.
|
|
15198
|
+
` Tokens: ${chalk3.dim(
|
|
15131
15199
|
`input=${formatTokens(inputTokens)} output=${formatTokens(outputTokens)}`
|
|
15132
15200
|
)}`
|
|
15133
15201
|
);
|
|
@@ -15183,7 +15251,7 @@ var CodexEventRenderer = class {
|
|
|
15183
15251
|
}
|
|
15184
15252
|
}
|
|
15185
15253
|
static renderThreadStarted(event) {
|
|
15186
|
-
console.log(
|
|
15254
|
+
console.log(`[thread.started] ${event.thread_id}`);
|
|
15187
15255
|
}
|
|
15188
15256
|
static renderTurnCompleted(event) {
|
|
15189
15257
|
if (event.usage) {
|
|
@@ -15192,7 +15260,7 @@ var CodexEventRenderer = class {
|
|
|
15192
15260
|
const cached2 = event.usage.cached_input_tokens || 0;
|
|
15193
15261
|
const cachedStr = cached2 ? ` (${cached2} cached)` : "";
|
|
15194
15262
|
console.log(
|
|
15195
|
-
|
|
15263
|
+
"[turn.completed]" + chalk4.dim(` ${input} in / ${output} out${cachedStr}`)
|
|
15196
15264
|
);
|
|
15197
15265
|
}
|
|
15198
15266
|
}
|
|
@@ -15207,25 +15275,25 @@ var CodexEventRenderer = class {
|
|
|
15207
15275
|
const itemType = item.type;
|
|
15208
15276
|
const eventType = event.type;
|
|
15209
15277
|
if (itemType === "reasoning" && item.text) {
|
|
15210
|
-
console.log(
|
|
15278
|
+
console.log(`[reasoning] ${item.text}`);
|
|
15211
15279
|
return;
|
|
15212
15280
|
}
|
|
15213
15281
|
if (itemType === "agent_message" && item.text) {
|
|
15214
|
-
console.log(
|
|
15282
|
+
console.log(`[message] ${item.text}`);
|
|
15215
15283
|
return;
|
|
15216
15284
|
}
|
|
15217
15285
|
if (itemType === "command_execution") {
|
|
15218
15286
|
if (eventType === "item.started" && item.command) {
|
|
15219
|
-
console.log(
|
|
15287
|
+
console.log(`[exec] ${item.command}`);
|
|
15220
15288
|
} else if (eventType === "item.completed") {
|
|
15221
15289
|
const output = item.aggregated_output || "";
|
|
15222
15290
|
const exitCode = item.exit_code ?? 0;
|
|
15223
15291
|
if (output) {
|
|
15224
15292
|
const lines = output.split("\n").filter((l) => l.trim());
|
|
15225
15293
|
const preview = lines.slice(0, 3).join("\n ");
|
|
15226
|
-
const more = lines.length > 3 ? chalk4.
|
|
15294
|
+
const more = lines.length > 3 ? chalk4.dim(` ... (${lines.length - 3} more lines)`) : "";
|
|
15227
15295
|
console.log(
|
|
15228
|
-
|
|
15296
|
+
"[output]" + (exitCode !== 0 ? chalk4.red(` exit=${exitCode}`) : "")
|
|
15229
15297
|
);
|
|
15230
15298
|
if (preview) {
|
|
15231
15299
|
console.log(" " + preview + more);
|
|
@@ -15247,7 +15315,7 @@ var CodexEventRenderer = class {
|
|
|
15247
15315
|
if (itemType === "file_edit" || itemType === "file_write" || itemType === "file_read") {
|
|
15248
15316
|
const action = itemType.replace("file_", "");
|
|
15249
15317
|
if (eventType === "item.started" && item.path) {
|
|
15250
|
-
console.log(
|
|
15318
|
+
console.log(`[${action}] ${item.path}`);
|
|
15251
15319
|
}
|
|
15252
15320
|
return;
|
|
15253
15321
|
}
|
|
@@ -15382,7 +15450,7 @@ async function pollEvents(runId, options) {
|
|
|
15382
15450
|
complete = true;
|
|
15383
15451
|
console.error(chalk5.red("\n\u2717 Run timed out"));
|
|
15384
15452
|
console.error(
|
|
15385
|
-
chalk5.
|
|
15453
|
+
chalk5.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
15386
15454
|
);
|
|
15387
15455
|
result = { succeeded: false, runId };
|
|
15388
15456
|
}
|
|
@@ -15393,15 +15461,15 @@ async function pollEvents(runId, options) {
|
|
|
15393
15461
|
return result;
|
|
15394
15462
|
}
|
|
15395
15463
|
function logVerbosePreFlight(action, details) {
|
|
15396
|
-
console.log(
|
|
15397
|
-
${action}...`)
|
|
15464
|
+
console.log(`
|
|
15465
|
+
${action}...`);
|
|
15398
15466
|
for (const { label, value } of details) {
|
|
15399
15467
|
if (value !== void 0) {
|
|
15400
|
-
console.log(chalk5.
|
|
15468
|
+
console.log(chalk5.dim(` ${label}: ${value}`));
|
|
15401
15469
|
}
|
|
15402
15470
|
}
|
|
15403
15471
|
console.log();
|
|
15404
|
-
console.log(
|
|
15472
|
+
console.log("Executing in sandbox...");
|
|
15405
15473
|
console.log();
|
|
15406
15474
|
}
|
|
15407
15475
|
function showNextSteps(result) {
|
|
@@ -15458,7 +15526,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15458
15526
|
let composeContent;
|
|
15459
15527
|
if (isUUID(name)) {
|
|
15460
15528
|
if (verbose) {
|
|
15461
|
-
console.log(chalk5.
|
|
15529
|
+
console.log(chalk5.dim(` Using compose ID: ${identifier}`));
|
|
15462
15530
|
}
|
|
15463
15531
|
try {
|
|
15464
15532
|
const compose = await apiClient.getComposeById(name);
|
|
@@ -15472,20 +15540,20 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15472
15540
|
}
|
|
15473
15541
|
} else {
|
|
15474
15542
|
if (verbose) {
|
|
15475
|
-
console.log(chalk5.
|
|
15543
|
+
console.log(chalk5.dim(` Resolving agent name: ${name}`));
|
|
15476
15544
|
}
|
|
15477
15545
|
try {
|
|
15478
15546
|
const compose = await apiClient.getComposeByName(name);
|
|
15479
15547
|
composeId = compose.id;
|
|
15480
15548
|
composeContent = compose.content;
|
|
15481
15549
|
if (verbose) {
|
|
15482
|
-
console.log(chalk5.
|
|
15550
|
+
console.log(chalk5.dim(` Resolved to compose ID: ${composeId}`));
|
|
15483
15551
|
}
|
|
15484
15552
|
} catch (error43) {
|
|
15485
15553
|
if (error43 instanceof Error) {
|
|
15486
15554
|
console.error(chalk5.red(`\u2717 Agent not found: ${name}`));
|
|
15487
15555
|
console.error(
|
|
15488
|
-
chalk5.
|
|
15556
|
+
chalk5.dim(
|
|
15489
15557
|
" Make sure you've composed the agent with: vm0 compose"
|
|
15490
15558
|
)
|
|
15491
15559
|
);
|
|
@@ -15496,7 +15564,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15496
15564
|
let agentComposeVersionId;
|
|
15497
15565
|
if (version2 && version2 !== "latest") {
|
|
15498
15566
|
if (verbose) {
|
|
15499
|
-
console.log(chalk5.
|
|
15567
|
+
console.log(chalk5.dim(` Resolving version: ${version2}`));
|
|
15500
15568
|
}
|
|
15501
15569
|
try {
|
|
15502
15570
|
const versionInfo = await apiClient.getComposeVersion(
|
|
@@ -15506,7 +15574,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15506
15574
|
agentComposeVersionId = versionInfo.versionId;
|
|
15507
15575
|
if (verbose) {
|
|
15508
15576
|
console.log(
|
|
15509
|
-
chalk5.
|
|
15577
|
+
chalk5.dim(
|
|
15510
15578
|
` Resolved to version ID: ${agentComposeVersionId.slice(0, 8)}...`
|
|
15511
15579
|
)
|
|
15512
15580
|
);
|
|
@@ -15515,7 +15583,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15515
15583
|
if (error43 instanceof Error) {
|
|
15516
15584
|
console.error(chalk5.red(`\u2717 Version not found: ${version2}`));
|
|
15517
15585
|
console.error(
|
|
15518
|
-
chalk5.
|
|
15586
|
+
chalk5.dim(" Make sure the version hash is correct.")
|
|
15519
15587
|
);
|
|
15520
15588
|
}
|
|
15521
15589
|
process.exit(1);
|
|
@@ -15526,22 +15594,20 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15526
15594
|
const secretNames = extractSecretNames(composeContent);
|
|
15527
15595
|
const secrets = loadValues(options.secrets, secretNames);
|
|
15528
15596
|
if (verbose && varNames.length > 0) {
|
|
15529
|
-
console.log(chalk5.
|
|
15597
|
+
console.log(chalk5.dim(` Required vars: ${varNames.join(", ")}`));
|
|
15530
15598
|
if (vars) {
|
|
15531
15599
|
console.log(
|
|
15532
|
-
chalk5.
|
|
15600
|
+
chalk5.dim(` Loaded vars: ${Object.keys(vars).join(", ")}`)
|
|
15533
15601
|
);
|
|
15534
15602
|
}
|
|
15535
15603
|
}
|
|
15536
15604
|
if (verbose && secretNames.length > 0) {
|
|
15537
15605
|
console.log(
|
|
15538
|
-
chalk5.
|
|
15606
|
+
chalk5.dim(` Required secrets: ${secretNames.join(", ")}`)
|
|
15539
15607
|
);
|
|
15540
15608
|
if (secrets) {
|
|
15541
15609
|
console.log(
|
|
15542
|
-
chalk5.
|
|
15543
|
-
` Loaded secrets: ${Object.keys(secrets).join(", ")}`
|
|
15544
|
-
)
|
|
15610
|
+
chalk5.dim(` Loaded secrets: ${Object.keys(secrets).join(", ")}`)
|
|
15545
15611
|
);
|
|
15546
15612
|
}
|
|
15547
15613
|
}
|
|
@@ -15580,7 +15646,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15580
15646
|
if (response.status === "failed") {
|
|
15581
15647
|
console.error(chalk5.red("\u2717 Run preparation failed"));
|
|
15582
15648
|
if (response.error) {
|
|
15583
|
-
console.error(chalk5.
|
|
15649
|
+
console.error(chalk5.dim(` ${response.error}`));
|
|
15584
15650
|
}
|
|
15585
15651
|
process.exit(1);
|
|
15586
15652
|
}
|
|
@@ -15605,13 +15671,13 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15605
15671
|
} else if (error43.message.includes("not found")) {
|
|
15606
15672
|
console.error(chalk5.red(`\u2717 Agent not found: ${identifier}`));
|
|
15607
15673
|
console.error(
|
|
15608
|
-
chalk5.
|
|
15674
|
+
chalk5.dim(
|
|
15609
15675
|
" Make sure you've composed the agent with: vm0 compose"
|
|
15610
15676
|
)
|
|
15611
15677
|
);
|
|
15612
15678
|
} else {
|
|
15613
15679
|
console.error(chalk5.red("\u2717 Run failed"));
|
|
15614
|
-
console.error(chalk5.
|
|
15680
|
+
console.error(chalk5.dim(` ${error43.message}`));
|
|
15615
15681
|
}
|
|
15616
15682
|
} else {
|
|
15617
15683
|
console.error(chalk5.red("\u2717 An unexpected error occurred"));
|
|
@@ -15635,7 +15701,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
15635
15701
|
console.error(
|
|
15636
15702
|
chalk5.red(`\u2717 Invalid checkpoint ID format: ${checkpointId}`)
|
|
15637
15703
|
);
|
|
15638
|
-
console.error(chalk5.
|
|
15704
|
+
console.error(chalk5.dim(" Checkpoint ID must be a valid UUID"));
|
|
15639
15705
|
process.exit(1);
|
|
15640
15706
|
}
|
|
15641
15707
|
if (verbose) {
|
|
@@ -15656,7 +15722,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
15656
15722
|
if (response.status === "failed") {
|
|
15657
15723
|
console.error(chalk5.red("\u2717 Run preparation failed"));
|
|
15658
15724
|
if (response.error) {
|
|
15659
|
-
console.error(chalk5.
|
|
15725
|
+
console.error(chalk5.dim(` ${response.error}`));
|
|
15660
15726
|
}
|
|
15661
15727
|
process.exit(1);
|
|
15662
15728
|
}
|
|
@@ -15682,7 +15748,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
15682
15748
|
console.error(chalk5.red(`\u2717 Checkpoint not found: ${checkpointId}`));
|
|
15683
15749
|
} else {
|
|
15684
15750
|
console.error(chalk5.red("\u2717 Resume failed"));
|
|
15685
|
-
console.error(chalk5.
|
|
15751
|
+
console.error(chalk5.dim(` ${error43.message}`));
|
|
15686
15752
|
}
|
|
15687
15753
|
} else {
|
|
15688
15754
|
console.error(chalk5.red("\u2717 An unexpected error occurred"));
|
|
@@ -15708,7 +15774,7 @@ runCmd.command("continue").description(
|
|
|
15708
15774
|
console.error(
|
|
15709
15775
|
chalk5.red(`\u2717 Invalid agent session ID format: ${agentSessionId}`)
|
|
15710
15776
|
);
|
|
15711
|
-
console.error(chalk5.
|
|
15777
|
+
console.error(chalk5.dim(" Agent session ID must be a valid UUID"));
|
|
15712
15778
|
process.exit(1);
|
|
15713
15779
|
}
|
|
15714
15780
|
if (verbose) {
|
|
@@ -15730,7 +15796,7 @@ runCmd.command("continue").description(
|
|
|
15730
15796
|
if (response.status === "failed") {
|
|
15731
15797
|
console.error(chalk5.red("\u2717 Run preparation failed"));
|
|
15732
15798
|
if (response.error) {
|
|
15733
|
-
console.error(chalk5.
|
|
15799
|
+
console.error(chalk5.dim(` ${response.error}`));
|
|
15734
15800
|
}
|
|
15735
15801
|
process.exit(1);
|
|
15736
15802
|
}
|
|
@@ -15758,7 +15824,7 @@ runCmd.command("continue").description(
|
|
|
15758
15824
|
);
|
|
15759
15825
|
} else {
|
|
15760
15826
|
console.error(chalk5.red("\u2717 Continue failed"));
|
|
15761
|
-
console.error(chalk5.
|
|
15827
|
+
console.error(chalk5.dim(` ${error43.message}`));
|
|
15762
15828
|
}
|
|
15763
15829
|
} else {
|
|
15764
15830
|
console.error(chalk5.red("\u2717 An unexpected error occurred"));
|
|
@@ -15835,7 +15901,7 @@ var initCommand = new Command3().name("init").description("Initialize a volume i
|
|
|
15835
15901
|
chalk6.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
15836
15902
|
);
|
|
15837
15903
|
console.log(
|
|
15838
|
-
chalk6.
|
|
15904
|
+
chalk6.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
15839
15905
|
);
|
|
15840
15906
|
return;
|
|
15841
15907
|
}
|
|
@@ -15843,26 +15909,26 @@ var initCommand = new Command3().name("init").description("Initialize a volume i
|
|
|
15843
15909
|
if (!isValidStorageName(volumeName)) {
|
|
15844
15910
|
console.error(chalk6.red(`\u2717 Invalid volume name: "${dirName}"`));
|
|
15845
15911
|
console.error(
|
|
15846
|
-
chalk6.
|
|
15912
|
+
chalk6.dim(
|
|
15847
15913
|
" Volume names must be 3-64 characters, lowercase alphanumeric with hyphens"
|
|
15848
15914
|
)
|
|
15849
15915
|
);
|
|
15850
15916
|
console.error(
|
|
15851
|
-
chalk6.
|
|
15917
|
+
chalk6.dim(" Example: my-dataset, user-data-v2, training-set-2024")
|
|
15852
15918
|
);
|
|
15853
15919
|
process.exit(1);
|
|
15854
15920
|
}
|
|
15855
15921
|
await writeStorageConfig(volumeName, cwd);
|
|
15856
15922
|
console.log(chalk6.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
15857
15923
|
console.log(
|
|
15858
|
-
chalk6.
|
|
15924
|
+
chalk6.dim(
|
|
15859
15925
|
`\u2713 Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
15860
15926
|
)
|
|
15861
15927
|
);
|
|
15862
15928
|
} catch (error43) {
|
|
15863
15929
|
console.error(chalk6.red("\u2717 Failed to initialize volume"));
|
|
15864
15930
|
if (error43 instanceof Error) {
|
|
15865
|
-
console.error(chalk6.
|
|
15931
|
+
console.error(chalk6.dim(` ${error43.message}`));
|
|
15866
15932
|
}
|
|
15867
15933
|
process.exit(1);
|
|
15868
15934
|
}
|
|
@@ -15887,13 +15953,13 @@ var pushCommand = new Command4().name("push").description("Push local files to c
|
|
|
15887
15953
|
const config2 = await readStorageConfig(cwd);
|
|
15888
15954
|
if (!config2) {
|
|
15889
15955
|
console.error(chalk7.red("\u2717 No volume initialized in this directory"));
|
|
15890
|
-
console.error(chalk7.
|
|
15956
|
+
console.error(chalk7.dim(" Run: vm0 volume init"));
|
|
15891
15957
|
process.exit(1);
|
|
15892
15958
|
}
|
|
15893
|
-
console.log(
|
|
15959
|
+
console.log(`Pushing volume: ${config2.name}`);
|
|
15894
15960
|
const result = await directUpload(config2.name, "volume", cwd, {
|
|
15895
15961
|
onProgress: (message) => {
|
|
15896
|
-
console.log(chalk7.
|
|
15962
|
+
console.log(chalk7.dim(message));
|
|
15897
15963
|
},
|
|
15898
15964
|
force: options.force
|
|
15899
15965
|
});
|
|
@@ -15905,13 +15971,13 @@ var pushCommand = new Command4().name("push").description("Push local files to c
|
|
|
15905
15971
|
} else {
|
|
15906
15972
|
console.log(chalk7.green("\u2713 Upload complete"));
|
|
15907
15973
|
}
|
|
15908
|
-
console.log(chalk7.
|
|
15909
|
-
console.log(chalk7.
|
|
15910
|
-
console.log(chalk7.
|
|
15974
|
+
console.log(chalk7.dim(` Version: ${shortVersion}`));
|
|
15975
|
+
console.log(chalk7.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
15976
|
+
console.log(chalk7.dim(` Size: ${formatBytes(result.size)}`));
|
|
15911
15977
|
} catch (error43) {
|
|
15912
15978
|
console.error(chalk7.red("\u2717 Push failed"));
|
|
15913
15979
|
if (error43 instanceof Error) {
|
|
15914
|
-
console.error(chalk7.
|
|
15980
|
+
console.error(chalk7.dim(` ${error43.message}`));
|
|
15915
15981
|
}
|
|
15916
15982
|
process.exit(1);
|
|
15917
15983
|
}
|
|
@@ -15928,7 +15994,7 @@ import * as tar3 from "tar";
|
|
|
15928
15994
|
// src/lib/pull-utils.ts
|
|
15929
15995
|
import chalk8 from "chalk";
|
|
15930
15996
|
async function handleEmptyStorageResponse(cwd) {
|
|
15931
|
-
console.log(chalk8.
|
|
15997
|
+
console.log(chalk8.dim("Syncing local files..."));
|
|
15932
15998
|
const removedCount = await removeExtraFiles(cwd, /* @__PURE__ */ new Set());
|
|
15933
15999
|
if (removedCount > 0) {
|
|
15934
16000
|
console.log(chalk8.green(`\u2713 Removed ${removedCount} files not in remote`));
|
|
@@ -15951,17 +16017,15 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
15951
16017
|
const config2 = await readStorageConfig(cwd);
|
|
15952
16018
|
if (!config2) {
|
|
15953
16019
|
console.error(chalk9.red("\u2717 No volume initialized in this directory"));
|
|
15954
|
-
console.error(chalk9.
|
|
16020
|
+
console.error(chalk9.dim(" Run: vm0 volume init"));
|
|
15955
16021
|
process.exit(1);
|
|
15956
16022
|
}
|
|
15957
16023
|
if (versionId) {
|
|
15958
|
-
console.log(
|
|
15959
|
-
chalk9.cyan(`Pulling volume: ${config2.name} (version: ${versionId})`)
|
|
15960
|
-
);
|
|
16024
|
+
console.log(`Pulling volume: ${config2.name} (version: ${versionId})`);
|
|
15961
16025
|
} else {
|
|
15962
|
-
console.log(
|
|
16026
|
+
console.log(`Pulling volume: ${config2.name}`);
|
|
15963
16027
|
}
|
|
15964
|
-
console.log(chalk9.
|
|
16028
|
+
console.log(chalk9.dim("Getting download URL..."));
|
|
15965
16029
|
let url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=volume`;
|
|
15966
16030
|
if (versionId) {
|
|
15967
16031
|
url2 += `&version=${encodeURIComponent(versionId)}`;
|
|
@@ -15971,12 +16035,12 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
15971
16035
|
if (response.status === 404) {
|
|
15972
16036
|
console.error(chalk9.red(`\u2717 Volume "${config2.name}" not found`));
|
|
15973
16037
|
console.error(
|
|
15974
|
-
chalk9.
|
|
16038
|
+
chalk9.dim(
|
|
15975
16039
|
" Make sure the volume name is correct in .vm0/storage.yaml"
|
|
15976
16040
|
)
|
|
15977
16041
|
);
|
|
15978
16042
|
console.error(
|
|
15979
|
-
chalk9.
|
|
16043
|
+
chalk9.dim(" Or push the volume first with: vm0 volume push")
|
|
15980
16044
|
);
|
|
15981
16045
|
} else {
|
|
15982
16046
|
const error43 = await response.json();
|
|
@@ -15992,7 +16056,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
15992
16056
|
if (!downloadInfo.url) {
|
|
15993
16057
|
throw new Error("No download URL returned");
|
|
15994
16058
|
}
|
|
15995
|
-
console.log(chalk9.
|
|
16059
|
+
console.log(chalk9.dim("Downloading from S3..."));
|
|
15996
16060
|
const s3Response = await fetch(downloadInfo.url);
|
|
15997
16061
|
if (!s3Response.ok) {
|
|
15998
16062
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
@@ -16003,7 +16067,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
16003
16067
|
const tmpDir = fs6.mkdtempSync(path8.join(os4.tmpdir(), "vm0-"));
|
|
16004
16068
|
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
16005
16069
|
await fs6.promises.writeFile(tarPath, tarBuffer);
|
|
16006
|
-
console.log(chalk9.
|
|
16070
|
+
console.log(chalk9.dim("Syncing local files..."));
|
|
16007
16071
|
const remoteFiles = await listTarFiles(tarPath);
|
|
16008
16072
|
const remoteFilesSet = new Set(
|
|
16009
16073
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -16014,7 +16078,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
16014
16078
|
chalk9.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
16015
16079
|
);
|
|
16016
16080
|
}
|
|
16017
|
-
console.log(chalk9.
|
|
16081
|
+
console.log(chalk9.dim("Extracting files..."));
|
|
16018
16082
|
await tar3.extract({
|
|
16019
16083
|
file: tarPath,
|
|
16020
16084
|
cwd,
|
|
@@ -16026,7 +16090,7 @@ var pullCommand = new Command5().name("pull").description("Pull cloud files to l
|
|
|
16026
16090
|
} catch (error43) {
|
|
16027
16091
|
console.error(chalk9.red("\u2717 Pull failed"));
|
|
16028
16092
|
if (error43 instanceof Error) {
|
|
16029
|
-
console.error(chalk9.
|
|
16093
|
+
console.error(chalk9.dim(` ${error43.message}`));
|
|
16030
16094
|
}
|
|
16031
16095
|
process.exit(1);
|
|
16032
16096
|
}
|
|
@@ -16048,7 +16112,7 @@ var statusCommand = new Command6().name("status").description("Show status of cl
|
|
|
16048
16112
|
const config2 = await readStorageConfig(cwd);
|
|
16049
16113
|
if (!config2) {
|
|
16050
16114
|
console.error(chalk10.red("\u2717 No volume initialized in this directory"));
|
|
16051
|
-
console.error(chalk10.
|
|
16115
|
+
console.error(chalk10.dim(" Run: vm0 volume init"));
|
|
16052
16116
|
process.exit(1);
|
|
16053
16117
|
}
|
|
16054
16118
|
if (config2.type !== "volume") {
|
|
@@ -16057,16 +16121,16 @@ var statusCommand = new Command6().name("status").description("Show status of cl
|
|
|
16057
16121
|
"\u2717 This directory is initialized as an artifact, not a volume"
|
|
16058
16122
|
)
|
|
16059
16123
|
);
|
|
16060
|
-
console.error(chalk10.
|
|
16124
|
+
console.error(chalk10.dim(" Use: vm0 artifact status"));
|
|
16061
16125
|
process.exit(1);
|
|
16062
16126
|
}
|
|
16063
|
-
console.log(
|
|
16127
|
+
console.log(`Checking volume: ${config2.name}`);
|
|
16064
16128
|
const url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=volume`;
|
|
16065
16129
|
const response = await apiClient.get(url2);
|
|
16066
16130
|
if (!response.ok) {
|
|
16067
16131
|
if (response.status === 404) {
|
|
16068
16132
|
console.error(chalk10.red("\u2717 Not found on remote"));
|
|
16069
|
-
console.error(chalk10.
|
|
16133
|
+
console.error(chalk10.dim(" Run: vm0 volume push"));
|
|
16070
16134
|
} else {
|
|
16071
16135
|
const error43 = await response.json();
|
|
16072
16136
|
throw new Error(error43.error?.message || "Status check failed");
|
|
@@ -16077,17 +16141,17 @@ var statusCommand = new Command6().name("status").description("Show status of cl
|
|
|
16077
16141
|
const shortVersion = info.versionId.slice(0, 8);
|
|
16078
16142
|
if (info.empty) {
|
|
16079
16143
|
console.log(chalk10.green("\u2713 Found (empty)"));
|
|
16080
|
-
console.log(chalk10.
|
|
16144
|
+
console.log(chalk10.dim(` Version: ${shortVersion}`));
|
|
16081
16145
|
} else {
|
|
16082
16146
|
console.log(chalk10.green("\u2713 Found"));
|
|
16083
|
-
console.log(chalk10.
|
|
16084
|
-
console.log(chalk10.
|
|
16085
|
-
console.log(chalk10.
|
|
16147
|
+
console.log(chalk10.dim(` Version: ${shortVersion}`));
|
|
16148
|
+
console.log(chalk10.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
16149
|
+
console.log(chalk10.dim(` Size: ${formatBytes3(info.size)}`));
|
|
16086
16150
|
}
|
|
16087
16151
|
} catch (error43) {
|
|
16088
16152
|
console.error(chalk10.red("\u2717 Status check failed"));
|
|
16089
16153
|
if (error43 instanceof Error) {
|
|
16090
|
-
console.error(chalk10.
|
|
16154
|
+
console.error(chalk10.dim(` ${error43.message}`));
|
|
16091
16155
|
}
|
|
16092
16156
|
process.exit(1);
|
|
16093
16157
|
}
|
|
@@ -16122,13 +16186,13 @@ var initCommand2 = new Command8().name("init").description("Initialize an artifa
|
|
|
16122
16186
|
)
|
|
16123
16187
|
);
|
|
16124
16188
|
console.log(
|
|
16125
|
-
chalk11.
|
|
16189
|
+
chalk11.dim(
|
|
16126
16190
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
16127
16191
|
)
|
|
16128
16192
|
);
|
|
16129
16193
|
}
|
|
16130
16194
|
console.log(
|
|
16131
|
-
chalk11.
|
|
16195
|
+
chalk11.dim(`Config file: ${path9.join(cwd, ".vm0", "storage.yaml")}`)
|
|
16132
16196
|
);
|
|
16133
16197
|
return;
|
|
16134
16198
|
}
|
|
@@ -16136,26 +16200,26 @@ var initCommand2 = new Command8().name("init").description("Initialize an artifa
|
|
|
16136
16200
|
if (!isValidStorageName(artifactName)) {
|
|
16137
16201
|
console.error(chalk11.red(`\u2717 Invalid artifact name: "${dirName}"`));
|
|
16138
16202
|
console.error(
|
|
16139
|
-
chalk11.
|
|
16203
|
+
chalk11.dim(
|
|
16140
16204
|
" Artifact names must be 3-64 characters, lowercase alphanumeric with hyphens"
|
|
16141
16205
|
)
|
|
16142
16206
|
);
|
|
16143
16207
|
console.error(
|
|
16144
|
-
chalk11.
|
|
16208
|
+
chalk11.dim(" Example: my-project, user-workspace, code-artifact")
|
|
16145
16209
|
);
|
|
16146
16210
|
process.exit(1);
|
|
16147
16211
|
}
|
|
16148
16212
|
await writeStorageConfig(artifactName, cwd, "artifact");
|
|
16149
16213
|
console.log(chalk11.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
16150
16214
|
console.log(
|
|
16151
|
-
chalk11.
|
|
16215
|
+
chalk11.dim(
|
|
16152
16216
|
`\u2713 Config saved to ${path9.join(cwd, ".vm0", "storage.yaml")}`
|
|
16153
16217
|
)
|
|
16154
16218
|
);
|
|
16155
16219
|
} catch (error43) {
|
|
16156
16220
|
console.error(chalk11.red("\u2717 Failed to initialize artifact"));
|
|
16157
16221
|
if (error43 instanceof Error) {
|
|
16158
|
-
console.error(chalk11.
|
|
16222
|
+
console.error(chalk11.dim(` ${error43.message}`));
|
|
16159
16223
|
}
|
|
16160
16224
|
process.exit(1);
|
|
16161
16225
|
}
|
|
@@ -16180,7 +16244,7 @@ var pushCommand2 = new Command9().name("push").description("Push local files to
|
|
|
16180
16244
|
const config2 = await readStorageConfig(cwd);
|
|
16181
16245
|
if (!config2) {
|
|
16182
16246
|
console.error(chalk12.red("\u2717 No artifact initialized in this directory"));
|
|
16183
|
-
console.error(chalk12.
|
|
16247
|
+
console.error(chalk12.dim(" Run: vm0 artifact init"));
|
|
16184
16248
|
process.exit(1);
|
|
16185
16249
|
}
|
|
16186
16250
|
if (config2.type !== "artifact") {
|
|
@@ -16189,13 +16253,13 @@ var pushCommand2 = new Command9().name("push").description("Push local files to
|
|
|
16189
16253
|
`\u2717 This directory is initialized as a volume, not an artifact`
|
|
16190
16254
|
)
|
|
16191
16255
|
);
|
|
16192
|
-
console.error(chalk12.
|
|
16256
|
+
console.error(chalk12.dim(" Use: vm0 volume push"));
|
|
16193
16257
|
process.exit(1);
|
|
16194
16258
|
}
|
|
16195
|
-
console.log(
|
|
16259
|
+
console.log(`Pushing artifact: ${config2.name}`);
|
|
16196
16260
|
const result = await directUpload(config2.name, "artifact", cwd, {
|
|
16197
16261
|
onProgress: (message) => {
|
|
16198
|
-
console.log(chalk12.
|
|
16262
|
+
console.log(chalk12.dim(message));
|
|
16199
16263
|
},
|
|
16200
16264
|
force: options.force
|
|
16201
16265
|
});
|
|
@@ -16207,13 +16271,13 @@ var pushCommand2 = new Command9().name("push").description("Push local files to
|
|
|
16207
16271
|
} else {
|
|
16208
16272
|
console.log(chalk12.green("\u2713 Upload complete"));
|
|
16209
16273
|
}
|
|
16210
|
-
console.log(chalk12.
|
|
16211
|
-
console.log(chalk12.
|
|
16212
|
-
console.log(chalk12.
|
|
16274
|
+
console.log(chalk12.dim(` Version: ${shortVersion}`));
|
|
16275
|
+
console.log(chalk12.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
16276
|
+
console.log(chalk12.dim(` Size: ${formatBytes4(result.size)}`));
|
|
16213
16277
|
} catch (error43) {
|
|
16214
16278
|
console.error(chalk12.red("\u2717 Push failed"));
|
|
16215
16279
|
if (error43 instanceof Error) {
|
|
16216
|
-
console.error(chalk12.
|
|
16280
|
+
console.error(chalk12.dim(` ${error43.message}`));
|
|
16217
16281
|
}
|
|
16218
16282
|
process.exit(1);
|
|
16219
16283
|
}
|
|
@@ -16239,7 +16303,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16239
16303
|
const config2 = await readStorageConfig(cwd);
|
|
16240
16304
|
if (!config2) {
|
|
16241
16305
|
console.error(chalk13.red("\u2717 No artifact initialized in this directory"));
|
|
16242
|
-
console.error(chalk13.
|
|
16306
|
+
console.error(chalk13.dim(" Run: vm0 artifact init"));
|
|
16243
16307
|
process.exit(1);
|
|
16244
16308
|
}
|
|
16245
16309
|
if (config2.type !== "artifact") {
|
|
@@ -16248,19 +16312,15 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16248
16312
|
`\u2717 This directory is initialized as a volume, not an artifact`
|
|
16249
16313
|
)
|
|
16250
16314
|
);
|
|
16251
|
-
console.error(chalk13.
|
|
16315
|
+
console.error(chalk13.dim(" Use: vm0 volume pull"));
|
|
16252
16316
|
process.exit(1);
|
|
16253
16317
|
}
|
|
16254
16318
|
if (versionId) {
|
|
16255
|
-
console.log(
|
|
16256
|
-
chalk13.cyan(
|
|
16257
|
-
`Pulling artifact: ${config2.name} (version: ${versionId})`
|
|
16258
|
-
)
|
|
16259
|
-
);
|
|
16319
|
+
console.log(`Pulling artifact: ${config2.name} (version: ${versionId})`);
|
|
16260
16320
|
} else {
|
|
16261
|
-
console.log(
|
|
16321
|
+
console.log(`Pulling artifact: ${config2.name}`);
|
|
16262
16322
|
}
|
|
16263
|
-
console.log(chalk13.
|
|
16323
|
+
console.log(chalk13.dim("Getting download URL..."));
|
|
16264
16324
|
let url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=artifact`;
|
|
16265
16325
|
if (versionId) {
|
|
16266
16326
|
url2 += `&version=${encodeURIComponent(versionId)}`;
|
|
@@ -16270,12 +16330,12 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16270
16330
|
if (response.status === 404) {
|
|
16271
16331
|
console.error(chalk13.red(`\u2717 Artifact "${config2.name}" not found`));
|
|
16272
16332
|
console.error(
|
|
16273
|
-
chalk13.
|
|
16333
|
+
chalk13.dim(
|
|
16274
16334
|
" Make sure the artifact name is correct in .vm0/storage.yaml"
|
|
16275
16335
|
)
|
|
16276
16336
|
);
|
|
16277
16337
|
console.error(
|
|
16278
|
-
chalk13.
|
|
16338
|
+
chalk13.dim(" Or push the artifact first with: vm0 artifact push")
|
|
16279
16339
|
);
|
|
16280
16340
|
} else {
|
|
16281
16341
|
const error43 = await response.json();
|
|
@@ -16291,7 +16351,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16291
16351
|
if (!downloadInfo.url) {
|
|
16292
16352
|
throw new Error("No download URL returned");
|
|
16293
16353
|
}
|
|
16294
|
-
console.log(chalk13.
|
|
16354
|
+
console.log(chalk13.dim("Downloading from S3..."));
|
|
16295
16355
|
const s3Response = await fetch(downloadInfo.url);
|
|
16296
16356
|
if (!s3Response.ok) {
|
|
16297
16357
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
@@ -16302,7 +16362,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16302
16362
|
const tmpDir = fs7.mkdtempSync(path10.join(os5.tmpdir(), "vm0-"));
|
|
16303
16363
|
const tarPath = path10.join(tmpDir, "artifact.tar.gz");
|
|
16304
16364
|
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
16305
|
-
console.log(chalk13.
|
|
16365
|
+
console.log(chalk13.dim("Syncing local files..."));
|
|
16306
16366
|
const remoteFiles = await listTarFiles(tarPath);
|
|
16307
16367
|
const remoteFilesSet = new Set(
|
|
16308
16368
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -16313,7 +16373,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16313
16373
|
chalk13.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
16314
16374
|
);
|
|
16315
16375
|
}
|
|
16316
|
-
console.log(chalk13.
|
|
16376
|
+
console.log(chalk13.dim("Extracting files..."));
|
|
16317
16377
|
await tar4.extract({
|
|
16318
16378
|
file: tarPath,
|
|
16319
16379
|
cwd,
|
|
@@ -16325,7 +16385,7 @@ var pullCommand2 = new Command10().name("pull").description("Pull cloud artifact
|
|
|
16325
16385
|
} catch (error43) {
|
|
16326
16386
|
console.error(chalk13.red("\u2717 Pull failed"));
|
|
16327
16387
|
if (error43 instanceof Error) {
|
|
16328
|
-
console.error(chalk13.
|
|
16388
|
+
console.error(chalk13.dim(` ${error43.message}`));
|
|
16329
16389
|
}
|
|
16330
16390
|
process.exit(1);
|
|
16331
16391
|
}
|
|
@@ -16347,7 +16407,7 @@ var statusCommand2 = new Command11().name("status").description("Show status of
|
|
|
16347
16407
|
const config2 = await readStorageConfig(cwd);
|
|
16348
16408
|
if (!config2) {
|
|
16349
16409
|
console.error(chalk14.red("\u2717 No artifact initialized in this directory"));
|
|
16350
|
-
console.error(chalk14.
|
|
16410
|
+
console.error(chalk14.dim(" Run: vm0 artifact init"));
|
|
16351
16411
|
process.exit(1);
|
|
16352
16412
|
}
|
|
16353
16413
|
if (config2.type !== "artifact") {
|
|
@@ -16356,16 +16416,16 @@ var statusCommand2 = new Command11().name("status").description("Show status of
|
|
|
16356
16416
|
"\u2717 This directory is initialized as a volume, not an artifact"
|
|
16357
16417
|
)
|
|
16358
16418
|
);
|
|
16359
|
-
console.error(chalk14.
|
|
16419
|
+
console.error(chalk14.dim(" Use: vm0 volume status"));
|
|
16360
16420
|
process.exit(1);
|
|
16361
16421
|
}
|
|
16362
|
-
console.log(
|
|
16422
|
+
console.log(`Checking artifact: ${config2.name}`);
|
|
16363
16423
|
const url2 = `/api/storages/download?name=${encodeURIComponent(config2.name)}&type=artifact`;
|
|
16364
16424
|
const response = await apiClient.get(url2);
|
|
16365
16425
|
if (!response.ok) {
|
|
16366
16426
|
if (response.status === 404) {
|
|
16367
16427
|
console.error(chalk14.red("\u2717 Not found on remote"));
|
|
16368
|
-
console.error(chalk14.
|
|
16428
|
+
console.error(chalk14.dim(" Run: vm0 artifact push"));
|
|
16369
16429
|
} else {
|
|
16370
16430
|
const error43 = await response.json();
|
|
16371
16431
|
throw new Error(error43.error?.message || "Status check failed");
|
|
@@ -16376,17 +16436,17 @@ var statusCommand2 = new Command11().name("status").description("Show status of
|
|
|
16376
16436
|
const shortVersion = info.versionId.slice(0, 8);
|
|
16377
16437
|
if (info.empty) {
|
|
16378
16438
|
console.log(chalk14.green("\u2713 Found (empty)"));
|
|
16379
|
-
console.log(chalk14.
|
|
16439
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
16380
16440
|
} else {
|
|
16381
16441
|
console.log(chalk14.green("\u2713 Found"));
|
|
16382
|
-
console.log(chalk14.
|
|
16383
|
-
console.log(chalk14.
|
|
16384
|
-
console.log(chalk14.
|
|
16442
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
16443
|
+
console.log(chalk14.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
16444
|
+
console.log(chalk14.dim(` Size: ${formatBytes6(info.size)}`));
|
|
16385
16445
|
}
|
|
16386
16446
|
} catch (error43) {
|
|
16387
16447
|
console.error(chalk14.red("\u2717 Status check failed"));
|
|
16388
16448
|
if (error43 instanceof Error) {
|
|
16389
|
-
console.error(chalk14.
|
|
16449
|
+
console.error(chalk14.dim(` ${error43.message}`));
|
|
16390
16450
|
}
|
|
16391
16451
|
process.exit(1);
|
|
16392
16452
|
}
|
|
@@ -16505,7 +16565,7 @@ async function checkAndUpgrade(currentVersion, prompt) {
|
|
|
16505
16565
|
console.log();
|
|
16506
16566
|
console.log(chalk15.red("Upgrade failed. Please run manually:"));
|
|
16507
16567
|
console.log(chalk15.cyan(` npm install -g ${PACKAGE_NAME}@latest`));
|
|
16508
|
-
console.log(chalk15.
|
|
16568
|
+
console.log(chalk15.dim(" # or"));
|
|
16509
16569
|
console.log(chalk15.cyan(` pnpm add -g ${PACKAGE_NAME}@latest`));
|
|
16510
16570
|
console.log();
|
|
16511
16571
|
console.log("Then re-run:");
|
|
@@ -16718,7 +16778,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
16718
16778
|
);
|
|
16719
16779
|
if (serverVersion && existsSync7(artifactDir)) {
|
|
16720
16780
|
console.log();
|
|
16721
|
-
console.log(chalk16.
|
|
16781
|
+
console.log(chalk16.bold("Pulling updated artifact:"));
|
|
16722
16782
|
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
16723
16783
|
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
16724
16784
|
try {
|
|
@@ -16730,19 +16790,19 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
16730
16790
|
} catch (error43) {
|
|
16731
16791
|
console.error(chalk16.red(`\u2717 Artifact pull failed`));
|
|
16732
16792
|
if (error43 instanceof Error) {
|
|
16733
|
-
console.error(chalk16.
|
|
16793
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16734
16794
|
}
|
|
16735
16795
|
}
|
|
16736
16796
|
}
|
|
16737
16797
|
}
|
|
16738
16798
|
var cookCmd = new Command13().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
16739
16799
|
cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
16740
|
-
const shouldExit = await checkAndUpgrade("4.
|
|
16800
|
+
const shouldExit = await checkAndUpgrade("4.27.0", prompt);
|
|
16741
16801
|
if (shouldExit) {
|
|
16742
16802
|
process.exit(0);
|
|
16743
16803
|
}
|
|
16744
16804
|
const cwd = process.cwd();
|
|
16745
|
-
console.log(chalk16.
|
|
16805
|
+
console.log(chalk16.bold(`Reading config: ${CONFIG_FILE3}`));
|
|
16746
16806
|
if (!existsSync7(CONFIG_FILE3)) {
|
|
16747
16807
|
console.error(chalk16.red(`\u2717 Config file not found: ${CONFIG_FILE3}`));
|
|
16748
16808
|
process.exit(1);
|
|
@@ -16754,7 +16814,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16754
16814
|
} catch (error43) {
|
|
16755
16815
|
console.error(chalk16.red("\u2717 Invalid YAML format"));
|
|
16756
16816
|
if (error43 instanceof Error) {
|
|
16757
|
-
console.error(chalk16.
|
|
16817
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16758
16818
|
}
|
|
16759
16819
|
process.exit(1);
|
|
16760
16820
|
}
|
|
@@ -16789,7 +16849,7 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16789
16849
|
}
|
|
16790
16850
|
if (config2.volumes && Object.keys(config2.volumes).length > 0) {
|
|
16791
16851
|
console.log();
|
|
16792
|
-
console.log(chalk16.
|
|
16852
|
+
console.log(chalk16.bold("Processing volumes:"));
|
|
16793
16853
|
for (const volumeConfig of Object.values(config2.volumes)) {
|
|
16794
16854
|
const volumeDir = path11.join(cwd, volumeConfig.name);
|
|
16795
16855
|
if (!existsSync7(volumeDir)) {
|
|
@@ -16819,14 +16879,14 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16819
16879
|
} catch (error43) {
|
|
16820
16880
|
console.error(chalk16.red(`\u2717 Failed`));
|
|
16821
16881
|
if (error43 instanceof Error) {
|
|
16822
|
-
console.error(chalk16.
|
|
16882
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16823
16883
|
}
|
|
16824
16884
|
process.exit(1);
|
|
16825
16885
|
}
|
|
16826
16886
|
}
|
|
16827
16887
|
}
|
|
16828
16888
|
console.log();
|
|
16829
|
-
console.log(chalk16.
|
|
16889
|
+
console.log(chalk16.bold("Processing artifact:"));
|
|
16830
16890
|
const artifactDir = path11.join(cwd, ARTIFACT_DIR);
|
|
16831
16891
|
try {
|
|
16832
16892
|
if (!existsSync7(artifactDir)) {
|
|
@@ -16851,12 +16911,12 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16851
16911
|
} catch (error43) {
|
|
16852
16912
|
console.error(chalk16.red(`\u2717 Failed`));
|
|
16853
16913
|
if (error43 instanceof Error) {
|
|
16854
|
-
console.error(chalk16.
|
|
16914
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16855
16915
|
}
|
|
16856
16916
|
process.exit(1);
|
|
16857
16917
|
}
|
|
16858
16918
|
console.log();
|
|
16859
|
-
console.log(chalk16.
|
|
16919
|
+
console.log(chalk16.bold("Composing agent:"));
|
|
16860
16920
|
printCommand(`vm0 compose ${CONFIG_FILE3}`);
|
|
16861
16921
|
try {
|
|
16862
16922
|
await execVm0Command(["compose", CONFIG_FILE3], {
|
|
@@ -16866,13 +16926,13 @@ cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
|
16866
16926
|
} catch (error43) {
|
|
16867
16927
|
console.error(chalk16.red(`\u2717 Compose failed`));
|
|
16868
16928
|
if (error43 instanceof Error) {
|
|
16869
|
-
console.error(chalk16.
|
|
16929
|
+
console.error(chalk16.dim(` ${error43.message}`));
|
|
16870
16930
|
}
|
|
16871
16931
|
process.exit(1);
|
|
16872
16932
|
}
|
|
16873
16933
|
if (prompt) {
|
|
16874
16934
|
console.log();
|
|
16875
|
-
console.log(chalk16.
|
|
16935
|
+
console.log(chalk16.bold("Running agent:"));
|
|
16876
16936
|
printCommand(
|
|
16877
16937
|
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
16878
16938
|
);
|
|
@@ -16915,7 +16975,7 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
|
|
|
16915
16975
|
const state = await loadCookState();
|
|
16916
16976
|
if (!state.lastRunId) {
|
|
16917
16977
|
console.error(chalk16.red("\u2717 No previous run found"));
|
|
16918
|
-
console.error(chalk16.
|
|
16978
|
+
console.error(chalk16.dim(" Run 'vm0 cook <prompt>' first"));
|
|
16919
16979
|
process.exit(1);
|
|
16920
16980
|
}
|
|
16921
16981
|
const args = ["logs", state.lastRunId];
|
|
@@ -16954,7 +17014,7 @@ cookCmd.command("continue").description(
|
|
|
16954
17014
|
const state = await loadCookState();
|
|
16955
17015
|
if (!state.lastSessionId) {
|
|
16956
17016
|
console.error(chalk16.red("\u2717 No previous session found"));
|
|
16957
|
-
console.error(chalk16.
|
|
17017
|
+
console.error(chalk16.dim(" Run 'vm0 cook <prompt>' first"));
|
|
16958
17018
|
process.exit(1);
|
|
16959
17019
|
}
|
|
16960
17020
|
const cwd = process.cwd();
|
|
@@ -16986,7 +17046,7 @@ cookCmd.command("resume").description(
|
|
|
16986
17046
|
const state = await loadCookState();
|
|
16987
17047
|
if (!state.lastCheckpointId) {
|
|
16988
17048
|
console.error(chalk16.red("\u2717 No previous checkpoint found"));
|
|
16989
|
-
console.error(chalk16.
|
|
17049
|
+
console.error(chalk16.dim(" Run 'vm0 cook <prompt>' first"));
|
|
16990
17050
|
process.exit(1);
|
|
16991
17051
|
}
|
|
16992
17052
|
const cwd = process.cwd();
|
|
@@ -17101,7 +17161,7 @@ var buildCommand = new Command14().name("build").description("Build a custom ima
|
|
|
17101
17161
|
);
|
|
17102
17162
|
process.exit(1);
|
|
17103
17163
|
}
|
|
17104
|
-
console.log(chalk17.
|
|
17164
|
+
console.log(chalk17.bold(`Building image: ${scope.slug}/${name}`));
|
|
17105
17165
|
console.log();
|
|
17106
17166
|
const buildInfo = await apiClient.createImage({
|
|
17107
17167
|
dockerfile,
|
|
@@ -17109,7 +17169,7 @@ var buildCommand = new Command14().name("build").description("Build a custom ima
|
|
|
17109
17169
|
deleteExisting
|
|
17110
17170
|
});
|
|
17111
17171
|
const { imageId, buildId, versionId } = buildInfo;
|
|
17112
|
-
console.log(chalk17.
|
|
17172
|
+
console.log(chalk17.dim(` Build ID: ${buildId}`));
|
|
17113
17173
|
console.log();
|
|
17114
17174
|
let logsOffset = 0;
|
|
17115
17175
|
let status = "building";
|
|
@@ -17125,7 +17185,7 @@ var buildCommand = new Command14().name("build").description("Build a custom ima
|
|
|
17125
17185
|
}
|
|
17126
17186
|
const statusData = await statusResponse.json();
|
|
17127
17187
|
for (const log of statusData.logs) {
|
|
17128
|
-
console.log(chalk17.
|
|
17188
|
+
console.log(chalk17.dim(` ${log}`));
|
|
17129
17189
|
}
|
|
17130
17190
|
logsOffset = statusData.logsOffset;
|
|
17131
17191
|
status = statusData.status;
|
|
@@ -17175,7 +17235,7 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17175
17235
|
const data = await response.json();
|
|
17176
17236
|
const { images } = data;
|
|
17177
17237
|
if (images.length === 0) {
|
|
17178
|
-
console.log(chalk18.
|
|
17238
|
+
console.log(chalk18.dim("No images found."));
|
|
17179
17239
|
console.log();
|
|
17180
17240
|
console.log("Build your first image:");
|
|
17181
17241
|
console.log(
|
|
@@ -17197,11 +17257,11 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17197
17257
|
latestVersions.set(alias, latestReady?.versionId || null);
|
|
17198
17258
|
}
|
|
17199
17259
|
console.log(
|
|
17200
|
-
chalk18.
|
|
17260
|
+
chalk18.dim(
|
|
17201
17261
|
`${"NAME".padEnd(40)} ${"STATUS".padEnd(12)} ${"CREATED".padEnd(20)}`
|
|
17202
17262
|
)
|
|
17203
17263
|
);
|
|
17204
|
-
console.log(chalk18.
|
|
17264
|
+
console.log(chalk18.dim("-".repeat(72)));
|
|
17205
17265
|
for (const image of images) {
|
|
17206
17266
|
const statusColor = image.status === "ready" ? chalk18.green : image.status === "building" ? chalk18.yellow : chalk18.red;
|
|
17207
17267
|
const createdAt = new Date(image.createdAt).toLocaleString();
|
|
@@ -17210,7 +17270,7 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17210
17270
|
const shortVersion = formatVersionIdForDisplay(image.versionId);
|
|
17211
17271
|
displayName = `${image.alias}:${shortVersion}`;
|
|
17212
17272
|
if (image.status === "ready" && latestVersions.get(image.alias) === image.versionId) {
|
|
17213
|
-
displayName = `${displayName} ${chalk18.cyan("
|
|
17273
|
+
displayName = `${displayName} ${chalk18.cyan("latest")}`;
|
|
17214
17274
|
}
|
|
17215
17275
|
}
|
|
17216
17276
|
console.log(
|
|
@@ -17221,7 +17281,7 @@ var listCommand = new Command15().name("list").alias("ls").description("List you
|
|
|
17221
17281
|
}
|
|
17222
17282
|
}
|
|
17223
17283
|
console.log();
|
|
17224
|
-
console.log(chalk18.
|
|
17284
|
+
console.log(chalk18.dim(`Total: ${images.length} version(s)`));
|
|
17225
17285
|
} catch (error43) {
|
|
17226
17286
|
if (error43 instanceof Error) {
|
|
17227
17287
|
if (error43.message.includes("Not authenticated")) {
|
|
@@ -17311,7 +17371,7 @@ var deleteCommand = new Command16().name("delete").alias("rm").description("Dele
|
|
|
17311
17371
|
});
|
|
17312
17372
|
});
|
|
17313
17373
|
if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
|
|
17314
|
-
console.log(chalk19.
|
|
17374
|
+
console.log(chalk19.dim("Cancelled."));
|
|
17315
17375
|
return;
|
|
17316
17376
|
}
|
|
17317
17377
|
}
|
|
@@ -17366,17 +17426,17 @@ var versionsCommand = new Command17().name("versions").description("List all ver
|
|
|
17366
17426
|
console.log(chalk20.bold(`Versions of ${name}:`));
|
|
17367
17427
|
console.log();
|
|
17368
17428
|
console.log(
|
|
17369
|
-
chalk20.
|
|
17429
|
+
chalk20.dim(
|
|
17370
17430
|
`${"VERSION".padEnd(20)} ${"STATUS".padEnd(12)} ${"CREATED".padEnd(24)}`
|
|
17371
17431
|
)
|
|
17372
17432
|
);
|
|
17373
|
-
console.log(chalk20.
|
|
17433
|
+
console.log(chalk20.dim("-".repeat(56)));
|
|
17374
17434
|
for (const version2 of versions) {
|
|
17375
17435
|
const statusColor = version2.status === "ready" ? chalk20.green : version2.status === "building" ? chalk20.yellow : chalk20.red;
|
|
17376
17436
|
const createdAt = new Date(version2.createdAt).toLocaleString();
|
|
17377
17437
|
let versionDisplay = version2.versionId ? formatVersionIdForDisplay(version2.versionId) : "(legacy)";
|
|
17378
17438
|
if (version2.status === "ready" && version2.versionId === latestVersionId) {
|
|
17379
|
-
versionDisplay = `${versionDisplay} ${chalk20.cyan("
|
|
17439
|
+
versionDisplay = `${versionDisplay} ${chalk20.cyan("latest")}`;
|
|
17380
17440
|
}
|
|
17381
17441
|
console.log(
|
|
17382
17442
|
`${versionDisplay.padEnd(20)} ${statusColor(version2.status.padEnd(12))} ${createdAt.padEnd(24)}`
|
|
@@ -17386,14 +17446,14 @@ var versionsCommand = new Command17().name("versions").description("List all ver
|
|
|
17386
17446
|
}
|
|
17387
17447
|
}
|
|
17388
17448
|
console.log();
|
|
17389
|
-
console.log(chalk20.
|
|
17449
|
+
console.log(chalk20.dim(`Total: ${versions.length} version(s)`));
|
|
17390
17450
|
console.log();
|
|
17391
|
-
console.log(chalk20.
|
|
17392
|
-
console.log(chalk20.
|
|
17451
|
+
console.log(chalk20.dim("Usage:"));
|
|
17452
|
+
console.log(chalk20.dim(` image: "${name}" # uses latest`));
|
|
17393
17453
|
if (latestVersionId) {
|
|
17394
17454
|
const shortVersion = formatVersionIdForDisplay(latestVersionId);
|
|
17395
17455
|
console.log(
|
|
17396
|
-
chalk20.
|
|
17456
|
+
chalk20.dim(
|
|
17397
17457
|
` image: "${name}:${shortVersion}" # pin to specific version`
|
|
17398
17458
|
)
|
|
17399
17459
|
);
|
|
@@ -17495,7 +17555,7 @@ function formatNetworkLog(entry) {
|
|
|
17495
17555
|
} else {
|
|
17496
17556
|
latencyColor = chalk21.red;
|
|
17497
17557
|
}
|
|
17498
|
-
return `[${entry.timestamp}] ${
|
|
17558
|
+
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
17559
|
}
|
|
17500
17560
|
function renderAgentEvent(event, provider) {
|
|
17501
17561
|
const eventData = event.eventData;
|
|
@@ -17580,7 +17640,7 @@ async function showAgentEvents(runId, options) {
|
|
|
17580
17640
|
if (response.hasMore) {
|
|
17581
17641
|
console.log();
|
|
17582
17642
|
console.log(
|
|
17583
|
-
chalk21.
|
|
17643
|
+
chalk21.dim(
|
|
17584
17644
|
`Showing ${response.events.length} events. Use --limit to see more.`
|
|
17585
17645
|
)
|
|
17586
17646
|
);
|
|
@@ -17596,7 +17656,7 @@ async function showSystemLog(runId, options) {
|
|
|
17596
17656
|
if (response.hasMore) {
|
|
17597
17657
|
console.log();
|
|
17598
17658
|
console.log(
|
|
17599
|
-
chalk21.
|
|
17659
|
+
chalk21.dim("More log entries available. Use --limit to see more.")
|
|
17600
17660
|
);
|
|
17601
17661
|
}
|
|
17602
17662
|
}
|
|
@@ -17612,7 +17672,7 @@ async function showMetrics(runId, options) {
|
|
|
17612
17672
|
if (response.hasMore) {
|
|
17613
17673
|
console.log();
|
|
17614
17674
|
console.log(
|
|
17615
|
-
chalk21.
|
|
17675
|
+
chalk21.dim(
|
|
17616
17676
|
`Showing ${response.metrics.length} metrics. Use --limit to see more.`
|
|
17617
17677
|
)
|
|
17618
17678
|
);
|
|
@@ -17634,7 +17694,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
17634
17694
|
if (response.hasMore) {
|
|
17635
17695
|
console.log();
|
|
17636
17696
|
console.log(
|
|
17637
|
-
chalk21.
|
|
17697
|
+
chalk21.dim(
|
|
17638
17698
|
`Showing ${response.networkLogs.length} network logs. Use --limit to see more.`
|
|
17639
17699
|
)
|
|
17640
17700
|
);
|
|
@@ -17650,7 +17710,7 @@ function handleError(error43, runId) {
|
|
|
17650
17710
|
console.error(chalk21.red(error43.message));
|
|
17651
17711
|
} else {
|
|
17652
17712
|
console.error(chalk21.red("Failed to fetch logs"));
|
|
17653
|
-
console.error(chalk21.
|
|
17713
|
+
console.error(chalk21.dim(` ${error43.message}`));
|
|
17654
17714
|
}
|
|
17655
17715
|
} else {
|
|
17656
17716
|
console.error(chalk21.red("An unexpected error occurred"));
|
|
@@ -17666,7 +17726,7 @@ import chalk22 from "chalk";
|
|
|
17666
17726
|
var statusCommand3 = new Command20().name("status").description("View current scope status").action(async () => {
|
|
17667
17727
|
try {
|
|
17668
17728
|
const scope = await apiClient.getScope();
|
|
17669
|
-
console.log(chalk22.
|
|
17729
|
+
console.log(chalk22.bold("Scope Information:"));
|
|
17670
17730
|
console.log(` Slug: ${chalk22.green(scope.slug)}`);
|
|
17671
17731
|
console.log(` Type: ${scope.type}`);
|
|
17672
17732
|
if (scope.displayName) {
|
|
@@ -17686,7 +17746,7 @@ var statusCommand3 = new Command20().name("status").description("View current sc
|
|
|
17686
17746
|
console.log(chalk22.cyan(" vm0 scope set <slug>"));
|
|
17687
17747
|
console.log();
|
|
17688
17748
|
console.log("Example:");
|
|
17689
|
-
console.log(chalk22.
|
|
17749
|
+
console.log(chalk22.dim(" vm0 scope set myusername"));
|
|
17690
17750
|
} else {
|
|
17691
17751
|
console.error(chalk22.red(`\u2717 ${error43.message}`));
|
|
17692
17752
|
}
|
|
@@ -17854,9 +17914,9 @@ var initCommand3 = new Command23().name("init").description("Initialize a new VM
|
|
|
17854
17914
|
if (!agentName || !validateAgentName(agentName)) {
|
|
17855
17915
|
console.log(chalk24.red("\u2717 Invalid agent name"));
|
|
17856
17916
|
console.log(
|
|
17857
|
-
chalk24.
|
|
17917
|
+
chalk24.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
17858
17918
|
);
|
|
17859
|
-
console.log(chalk24.
|
|
17919
|
+
console.log(chalk24.dim(" Must start and end with letter or number"));
|
|
17860
17920
|
process.exit(1);
|
|
17861
17921
|
}
|
|
17862
17922
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
@@ -17871,15 +17931,15 @@ var initCommand3 = new Command23().name("init").description("Initialize a new VM
|
|
|
17871
17931
|
` 1. Get your Claude Code token: ${chalk24.cyan("claude setup-token")}`
|
|
17872
17932
|
);
|
|
17873
17933
|
console.log(` 2. Set the environment variable (or add to .env file):`);
|
|
17874
|
-
console.log(chalk24.
|
|
17934
|
+
console.log(chalk24.dim(` export CLAUDE_CODE_OAUTH_TOKEN=<your-token>`));
|
|
17875
17935
|
console.log(` 3. Run your agent: ${chalk24.cyan('vm0 cook "your prompt"')}`);
|
|
17876
17936
|
});
|
|
17877
17937
|
|
|
17878
17938
|
// src/index.ts
|
|
17879
17939
|
var program = new Command24();
|
|
17880
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.
|
|
17940
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.27.0");
|
|
17881
17941
|
program.command("info").description("Display environment information").action(async () => {
|
|
17882
|
-
console.log(chalk25.
|
|
17942
|
+
console.log(chalk25.bold("System Information:"));
|
|
17883
17943
|
console.log(`Node Version: ${process.version}`);
|
|
17884
17944
|
console.log(`Platform: ${process.platform}`);
|
|
17885
17945
|
console.log(`Architecture: ${process.arch}`);
|