@vm0/cli 1.9.0 → 1.10.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.
Files changed (2) hide show
  1. package/index.js +71 -37
  2. 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();
@@ -13021,6 +12997,16 @@ function collectVars(value, previous) {
13021
12997
  }
13022
12998
  return { ...previous, [key]: val };
13023
12999
  }
13000
+ function collectVolumeVersions(value, previous) {
13001
+ const [volumeName, ...versionParts] = value.split("=");
13002
+ const version2 = versionParts.join("=");
13003
+ if (!volumeName || version2 === void 0 || version2 === "") {
13004
+ throw new Error(
13005
+ `Invalid volume-version format: ${value} (expected volumeName=version)`
13006
+ );
13007
+ }
13008
+ return { ...previous, [volumeName]: version2 };
13009
+ }
13024
13010
  function isUUID(str) {
13025
13011
  return /^[0-9a-f-]{36}$/i.test(str);
13026
13012
  }
@@ -13073,6 +13059,14 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13073
13059
  ).option("--artifact-name <name>", "Artifact storage name (required for run)").option(
13074
13060
  "--artifact-version <hash>",
13075
13061
  "Artifact version hash (defaults to latest)"
13062
+ ).option(
13063
+ "--volume-version <name=version>",
13064
+ "Volume version override (repeatable, format: volumeName=version)",
13065
+ collectVolumeVersions,
13066
+ {}
13067
+ ).option(
13068
+ "--conversation <id>",
13069
+ "Resume from conversation ID (for fine-grained control)"
13076
13070
  ).option(
13077
13071
  "-t, --timeout <seconds>",
13078
13072
  "Polling timeout in seconds (default: 120)",
@@ -13131,6 +13125,16 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13131
13125
  chalk4.gray(` Artifact version: ${options.artifactVersion}`)
13132
13126
  );
13133
13127
  }
13128
+ if (Object.keys(options.volumeVersion).length > 0) {
13129
+ console.log(
13130
+ chalk4.gray(
13131
+ ` Volume versions: ${JSON.stringify(options.volumeVersion)}`
13132
+ )
13133
+ );
13134
+ }
13135
+ if (options.conversation) {
13136
+ console.log(chalk4.gray(` Conversation: ${options.conversation}`));
13137
+ }
13134
13138
  console.log();
13135
13139
  console.log(chalk4.blue("Executing in sandbox..."));
13136
13140
  console.log();
@@ -13139,7 +13143,9 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13139
13143
  prompt,
13140
13144
  templateVars: Object.keys(options.vars).length > 0 ? options.vars : void 0,
13141
13145
  artifactName: options.artifactName,
13142
- artifactVersion: options.artifactVersion
13146
+ artifactVersion: options.artifactVersion,
13147
+ volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
13148
+ conversationId: options.conversation
13143
13149
  });
13144
13150
  await pollEvents(response.runId, timeoutSeconds);
13145
13151
  } catch (error43) {
@@ -13165,11 +13171,17 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13165
13171
  }
13166
13172
  );
13167
13173
  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(
13174
+ "--volume-version <name=version>",
13175
+ "Volume version override (repeatable)",
13176
+ collectVolumeVersions,
13177
+ {}
13178
+ ).option(
13168
13179
  "-t, --timeout <seconds>",
13169
13180
  "Polling timeout in seconds (default: 120)",
13170
13181
  String(DEFAULT_TIMEOUT_SECONDS)
13171
13182
  ).action(
13172
- async (checkpointId, prompt, options) => {
13183
+ async (checkpointId, prompt, options, command) => {
13184
+ const allOpts = command.optsWithGlobals();
13173
13185
  const timeoutSeconds = parseInt(options.timeout, 10);
13174
13186
  if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
13175
13187
  console.error(
@@ -13188,12 +13200,20 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
13188
13200
  console.log(chalk4.blue("\nResuming agent run from checkpoint..."));
13189
13201
  console.log(chalk4.gray(` Checkpoint ID: ${checkpointId}`));
13190
13202
  console.log(chalk4.gray(` Prompt: ${prompt}`));
13203
+ if (Object.keys(allOpts.volumeVersion).length > 0) {
13204
+ console.log(
13205
+ chalk4.gray(
13206
+ ` Volume overrides: ${JSON.stringify(allOpts.volumeVersion)}`
13207
+ )
13208
+ );
13209
+ }
13191
13210
  console.log();
13192
13211
  console.log(chalk4.blue("Executing in sandbox..."));
13193
13212
  console.log();
13194
- const response = await apiClient.resumeRun({
13213
+ const response = await apiClient.createRun({
13195
13214
  checkpointId,
13196
- prompt
13215
+ prompt,
13216
+ volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
13197
13217
  });
13198
13218
  await pollEvents(response.runId, timeoutSeconds);
13199
13219
  } catch (error43) {
@@ -13218,11 +13238,17 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
13218
13238
  runCmd.command("continue").description(
13219
13239
  "Continue an agent run from a session (uses latest artifact version)"
13220
13240
  ).argument("<agentSessionId>", "Agent session ID to continue from").argument("<prompt>", "Prompt for the continued agent").option(
13241
+ "--volume-version <name=version>",
13242
+ "Volume version override (repeatable)",
13243
+ collectVolumeVersions,
13244
+ {}
13245
+ ).option(
13221
13246
  "-t, --timeout <seconds>",
13222
13247
  "Polling timeout in seconds (default: 120)",
13223
13248
  String(DEFAULT_TIMEOUT_SECONDS)
13224
13249
  ).action(
13225
- async (agentSessionId, prompt, options) => {
13250
+ async (agentSessionId, prompt, options, command) => {
13251
+ const allOpts = command.optsWithGlobals();
13226
13252
  const timeoutSeconds = parseInt(options.timeout, 10);
13227
13253
  if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
13228
13254
  console.error(
@@ -13242,12 +13268,20 @@ runCmd.command("continue").description(
13242
13268
  console.log(chalk4.gray(` Session ID: ${agentSessionId}`));
13243
13269
  console.log(chalk4.gray(` Prompt: ${prompt}`));
13244
13270
  console.log(chalk4.gray(` Note: Using latest artifact version`));
13271
+ if (Object.keys(allOpts.volumeVersion).length > 0) {
13272
+ console.log(
13273
+ chalk4.gray(
13274
+ ` Volume overrides: ${JSON.stringify(allOpts.volumeVersion)}`
13275
+ )
13276
+ );
13277
+ }
13245
13278
  console.log();
13246
13279
  console.log(chalk4.blue("Executing in sandbox..."));
13247
13280
  console.log();
13248
- const response = await apiClient.continueSession({
13249
- agentSessionId,
13250
- prompt
13281
+ const response = await apiClient.createRun({
13282
+ sessionId: agentSessionId,
13283
+ prompt,
13284
+ volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
13251
13285
  });
13252
13286
  await pollEvents(response.runId, timeoutSeconds);
13253
13287
  } catch (error43) {
@@ -13900,7 +13934,7 @@ var artifactCommand = new Command10().name("artifact").description("Manage cloud
13900
13934
 
13901
13935
  // src/index.ts
13902
13936
  var program = new Command11();
13903
- program.name("vm0").description("VM0 CLI - A modern build tool").version("1.9.0");
13937
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("1.10.0");
13904
13938
  program.command("hello").description("Say hello from the App").action(() => {
13905
13939
  console.log(chalk11.blue("Welcome to the VM0 CLI!"));
13906
13940
  console.log(chalk11.green(`Core says: ${FOO}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",