@vm0/cli 1.9.0 → 1.11.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 +103 -41
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12366,6 +12366,10 @@ var ApiClient = class {
|
|
|
12366
12366
|
}
|
|
12367
12367
|
return await response.json();
|
|
12368
12368
|
}
|
|
12369
|
+
/**
|
|
12370
|
+
* Create a run with unified request format
|
|
12371
|
+
* Supports new runs, checkpoint resume, and session continue
|
|
12372
|
+
*/
|
|
12369
12373
|
async createRun(body) {
|
|
12370
12374
|
const baseUrl = await this.getBaseUrl();
|
|
12371
12375
|
const headers = await this.getHeaders();
|
|
@@ -12399,34 +12403,6 @@ var ApiClient = class {
|
|
|
12399
12403
|
}
|
|
12400
12404
|
return await response.json();
|
|
12401
12405
|
}
|
|
12402
|
-
async resumeRun(body) {
|
|
12403
|
-
const baseUrl = await this.getBaseUrl();
|
|
12404
|
-
const headers = await this.getHeaders();
|
|
12405
|
-
const response = await fetch(`${baseUrl}/api/agent/runs/resume`, {
|
|
12406
|
-
method: "POST",
|
|
12407
|
-
headers,
|
|
12408
|
-
body: JSON.stringify(body)
|
|
12409
|
-
});
|
|
12410
|
-
if (!response.ok) {
|
|
12411
|
-
const error43 = await response.json();
|
|
12412
|
-
throw new Error(error43.error?.message || "Failed to resume run");
|
|
12413
|
-
}
|
|
12414
|
-
return await response.json();
|
|
12415
|
-
}
|
|
12416
|
-
async continueSession(body) {
|
|
12417
|
-
const baseUrl = await this.getBaseUrl();
|
|
12418
|
-
const headers = await this.getHeaders();
|
|
12419
|
-
const response = await fetch(`${baseUrl}/api/agent/runs/continue`, {
|
|
12420
|
-
method: "POST",
|
|
12421
|
-
headers,
|
|
12422
|
-
body: JSON.stringify(body)
|
|
12423
|
-
});
|
|
12424
|
-
if (!response.ok) {
|
|
12425
|
-
const error43 = await response.json();
|
|
12426
|
-
throw new Error(error43.error?.message || "Failed to continue session");
|
|
12427
|
-
}
|
|
12428
|
-
return await response.json();
|
|
12429
|
-
}
|
|
12430
12406
|
async getAgentSession(id) {
|
|
12431
12407
|
const baseUrl = await this.getBaseUrl();
|
|
12432
12408
|
const headers = await this.getHeaders();
|
|
@@ -12842,7 +12818,11 @@ var ClaudeEventParser = class {
|
|
|
12842
12818
|
agentConfigId: event.agentConfigId,
|
|
12843
12819
|
agentName: event.agentName,
|
|
12844
12820
|
prompt: event.prompt,
|
|
12845
|
-
templateVars: event.templateVars
|
|
12821
|
+
templateVars: event.templateVars,
|
|
12822
|
+
resumedFromCheckpointId: event.resumedFromCheckpointId,
|
|
12823
|
+
continuedFromSessionId: event.continuedFromSessionId,
|
|
12824
|
+
artifact: event.artifact,
|
|
12825
|
+
volumes: event.volumes
|
|
12846
12826
|
}
|
|
12847
12827
|
};
|
|
12848
12828
|
}
|
|
@@ -12854,7 +12834,9 @@ var ClaudeEventParser = class {
|
|
|
12854
12834
|
runId: event.runId,
|
|
12855
12835
|
checkpointId: event.checkpointId,
|
|
12856
12836
|
agentSessionId: event.agentSessionId,
|
|
12857
|
-
|
|
12837
|
+
conversationId: event.conversationId,
|
|
12838
|
+
artifact: event.artifact,
|
|
12839
|
+
volumes: event.volumes
|
|
12858
12840
|
}
|
|
12859
12841
|
};
|
|
12860
12842
|
}
|
|
@@ -12979,6 +12961,7 @@ var EventRenderer = class {
|
|
|
12979
12961
|
if (event.data.agentName) {
|
|
12980
12962
|
console.log(` Agent: ${chalk3.gray(String(event.data.agentName))}`);
|
|
12981
12963
|
}
|
|
12964
|
+
this.renderArtifactAndVolumes(event.data);
|
|
12982
12965
|
}
|
|
12983
12966
|
static renderVm0Result(event) {
|
|
12984
12967
|
console.log(chalk3.green("[vm0_result]") + " \u2713 Run completed successfully");
|
|
@@ -12988,8 +12971,29 @@ var EventRenderer = class {
|
|
|
12988
12971
|
console.log(
|
|
12989
12972
|
` Session: ${chalk3.gray(String(event.data.agentSessionId || ""))}`
|
|
12990
12973
|
);
|
|
12991
|
-
|
|
12992
|
-
|
|
12974
|
+
console.log(
|
|
12975
|
+
` Conversation: ${chalk3.gray(String(event.data.conversationId || ""))}`
|
|
12976
|
+
);
|
|
12977
|
+
this.renderArtifactAndVolumes(event.data);
|
|
12978
|
+
}
|
|
12979
|
+
/**
|
|
12980
|
+
* Render artifact and volumes info
|
|
12981
|
+
* Used by both vm0_start and vm0_result events
|
|
12982
|
+
*/
|
|
12983
|
+
static renderArtifactAndVolumes(data) {
|
|
12984
|
+
const artifact = data.artifact;
|
|
12985
|
+
if (artifact && Object.keys(artifact).length > 0) {
|
|
12986
|
+
console.log(` Artifact:`);
|
|
12987
|
+
for (const [name, version2] of Object.entries(artifact)) {
|
|
12988
|
+
console.log(` ${name}: ${chalk3.gray(version2)}`);
|
|
12989
|
+
}
|
|
12990
|
+
}
|
|
12991
|
+
const volumes = data.volumes;
|
|
12992
|
+
if (volumes && Object.keys(volumes).length > 0) {
|
|
12993
|
+
console.log(` Volumes:`);
|
|
12994
|
+
for (const [name, version2] of Object.entries(volumes)) {
|
|
12995
|
+
console.log(` ${name}: ${chalk3.gray(version2)}`);
|
|
12996
|
+
}
|
|
12993
12997
|
}
|
|
12994
12998
|
}
|
|
12995
12999
|
static renderVm0Error(event) {
|
|
@@ -13021,6 +13025,16 @@ function collectVars(value, previous) {
|
|
|
13021
13025
|
}
|
|
13022
13026
|
return { ...previous, [key]: val };
|
|
13023
13027
|
}
|
|
13028
|
+
function collectVolumeVersions(value, previous) {
|
|
13029
|
+
const [volumeName, ...versionParts] = value.split("=");
|
|
13030
|
+
const version2 = versionParts.join("=");
|
|
13031
|
+
if (!volumeName || version2 === void 0 || version2 === "") {
|
|
13032
|
+
throw new Error(
|
|
13033
|
+
`Invalid volume-version format: ${value} (expected volumeName=version)`
|
|
13034
|
+
);
|
|
13035
|
+
}
|
|
13036
|
+
return { ...previous, [volumeName]: version2 };
|
|
13037
|
+
}
|
|
13024
13038
|
function isUUID(str) {
|
|
13025
13039
|
return /^[0-9a-f-]{36}$/i.test(str);
|
|
13026
13040
|
}
|
|
@@ -13073,6 +13087,14 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13073
13087
|
).option("--artifact-name <name>", "Artifact storage name (required for run)").option(
|
|
13074
13088
|
"--artifact-version <hash>",
|
|
13075
13089
|
"Artifact version hash (defaults to latest)"
|
|
13090
|
+
).option(
|
|
13091
|
+
"--volume-version <name=version>",
|
|
13092
|
+
"Volume version override (repeatable, format: volumeName=version)",
|
|
13093
|
+
collectVolumeVersions,
|
|
13094
|
+
{}
|
|
13095
|
+
).option(
|
|
13096
|
+
"--conversation <id>",
|
|
13097
|
+
"Resume from conversation ID (for fine-grained control)"
|
|
13076
13098
|
).option(
|
|
13077
13099
|
"-t, --timeout <seconds>",
|
|
13078
13100
|
"Polling timeout in seconds (default: 120)",
|
|
@@ -13131,6 +13153,16 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13131
13153
|
chalk4.gray(` Artifact version: ${options.artifactVersion}`)
|
|
13132
13154
|
);
|
|
13133
13155
|
}
|
|
13156
|
+
if (Object.keys(options.volumeVersion).length > 0) {
|
|
13157
|
+
console.log(
|
|
13158
|
+
chalk4.gray(
|
|
13159
|
+
` Volume versions: ${JSON.stringify(options.volumeVersion)}`
|
|
13160
|
+
)
|
|
13161
|
+
);
|
|
13162
|
+
}
|
|
13163
|
+
if (options.conversation) {
|
|
13164
|
+
console.log(chalk4.gray(` Conversation: ${options.conversation}`));
|
|
13165
|
+
}
|
|
13134
13166
|
console.log();
|
|
13135
13167
|
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13136
13168
|
console.log();
|
|
@@ -13139,7 +13171,9 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13139
13171
|
prompt,
|
|
13140
13172
|
templateVars: Object.keys(options.vars).length > 0 ? options.vars : void 0,
|
|
13141
13173
|
artifactName: options.artifactName,
|
|
13142
|
-
artifactVersion: options.artifactVersion
|
|
13174
|
+
artifactVersion: options.artifactVersion,
|
|
13175
|
+
volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
|
|
13176
|
+
conversationId: options.conversation
|
|
13143
13177
|
});
|
|
13144
13178
|
await pollEvents(response.runId, timeoutSeconds);
|
|
13145
13179
|
} catch (error43) {
|
|
@@ -13165,11 +13199,17 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
13165
13199
|
}
|
|
13166
13200
|
);
|
|
13167
13201
|
runCmd.command("resume").description("Resume an agent run from a checkpoint (uses all snapshot data)").argument("<checkpointId>", "Checkpoint ID to resume from").argument("<prompt>", "Prompt for the resumed agent").option(
|
|
13202
|
+
"--volume-version <name=version>",
|
|
13203
|
+
"Volume version override (repeatable)",
|
|
13204
|
+
collectVolumeVersions,
|
|
13205
|
+
{}
|
|
13206
|
+
).option(
|
|
13168
13207
|
"-t, --timeout <seconds>",
|
|
13169
13208
|
"Polling timeout in seconds (default: 120)",
|
|
13170
13209
|
String(DEFAULT_TIMEOUT_SECONDS)
|
|
13171
13210
|
).action(
|
|
13172
|
-
async (checkpointId, prompt, options) => {
|
|
13211
|
+
async (checkpointId, prompt, options, command) => {
|
|
13212
|
+
const allOpts = command.optsWithGlobals();
|
|
13173
13213
|
const timeoutSeconds = parseInt(options.timeout, 10);
|
|
13174
13214
|
if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
|
|
13175
13215
|
console.error(
|
|
@@ -13188,12 +13228,20 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
13188
13228
|
console.log(chalk4.blue("\nResuming agent run from checkpoint..."));
|
|
13189
13229
|
console.log(chalk4.gray(` Checkpoint ID: ${checkpointId}`));
|
|
13190
13230
|
console.log(chalk4.gray(` Prompt: ${prompt}`));
|
|
13231
|
+
if (Object.keys(allOpts.volumeVersion).length > 0) {
|
|
13232
|
+
console.log(
|
|
13233
|
+
chalk4.gray(
|
|
13234
|
+
` Volume overrides: ${JSON.stringify(allOpts.volumeVersion)}`
|
|
13235
|
+
)
|
|
13236
|
+
);
|
|
13237
|
+
}
|
|
13191
13238
|
console.log();
|
|
13192
13239
|
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13193
13240
|
console.log();
|
|
13194
|
-
const response = await apiClient.
|
|
13241
|
+
const response = await apiClient.createRun({
|
|
13195
13242
|
checkpointId,
|
|
13196
|
-
prompt
|
|
13243
|
+
prompt,
|
|
13244
|
+
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
|
|
13197
13245
|
});
|
|
13198
13246
|
await pollEvents(response.runId, timeoutSeconds);
|
|
13199
13247
|
} catch (error43) {
|
|
@@ -13218,11 +13266,17 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
|
|
|
13218
13266
|
runCmd.command("continue").description(
|
|
13219
13267
|
"Continue an agent run from a session (uses latest artifact version)"
|
|
13220
13268
|
).argument("<agentSessionId>", "Agent session ID to continue from").argument("<prompt>", "Prompt for the continued agent").option(
|
|
13269
|
+
"--volume-version <name=version>",
|
|
13270
|
+
"Volume version override (repeatable)",
|
|
13271
|
+
collectVolumeVersions,
|
|
13272
|
+
{}
|
|
13273
|
+
).option(
|
|
13221
13274
|
"-t, --timeout <seconds>",
|
|
13222
13275
|
"Polling timeout in seconds (default: 120)",
|
|
13223
13276
|
String(DEFAULT_TIMEOUT_SECONDS)
|
|
13224
13277
|
).action(
|
|
13225
|
-
async (agentSessionId, prompt, options) => {
|
|
13278
|
+
async (agentSessionId, prompt, options, command) => {
|
|
13279
|
+
const allOpts = command.optsWithGlobals();
|
|
13226
13280
|
const timeoutSeconds = parseInt(options.timeout, 10);
|
|
13227
13281
|
if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
|
|
13228
13282
|
console.error(
|
|
@@ -13242,12 +13296,20 @@ runCmd.command("continue").description(
|
|
|
13242
13296
|
console.log(chalk4.gray(` Session ID: ${agentSessionId}`));
|
|
13243
13297
|
console.log(chalk4.gray(` Prompt: ${prompt}`));
|
|
13244
13298
|
console.log(chalk4.gray(` Note: Using latest artifact version`));
|
|
13299
|
+
if (Object.keys(allOpts.volumeVersion).length > 0) {
|
|
13300
|
+
console.log(
|
|
13301
|
+
chalk4.gray(
|
|
13302
|
+
` Volume overrides: ${JSON.stringify(allOpts.volumeVersion)}`
|
|
13303
|
+
)
|
|
13304
|
+
);
|
|
13305
|
+
}
|
|
13245
13306
|
console.log();
|
|
13246
13307
|
console.log(chalk4.blue("Executing in sandbox..."));
|
|
13247
13308
|
console.log();
|
|
13248
|
-
const response = await apiClient.
|
|
13249
|
-
agentSessionId,
|
|
13250
|
-
prompt
|
|
13309
|
+
const response = await apiClient.createRun({
|
|
13310
|
+
sessionId: agentSessionId,
|
|
13311
|
+
prompt,
|
|
13312
|
+
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
|
|
13251
13313
|
});
|
|
13252
13314
|
await pollEvents(response.runId, timeoutSeconds);
|
|
13253
13315
|
} catch (error43) {
|
|
@@ -13900,7 +13962,7 @@ var artifactCommand = new Command10().name("artifact").description("Manage cloud
|
|
|
13900
13962
|
|
|
13901
13963
|
// src/index.ts
|
|
13902
13964
|
var program = new Command11();
|
|
13903
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("1.
|
|
13965
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("1.11.0");
|
|
13904
13966
|
program.command("hello").description("Say hello from the App").action(() => {
|
|
13905
13967
|
console.log(chalk11.blue("Welcome to the VM0 CLI!"));
|
|
13906
13968
|
console.log(chalk11.green(`Core says: ${FOO}`));
|