@vm0/cli 3.1.0 → 3.2.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 +51 -30
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12336,11 +12336,11 @@ var ApiClient = class {
12336
12336
  }
12337
12337
  return apiUrl;
12338
12338
  }
12339
- async getConfigByName(name) {
12339
+ async getComposeByName(name) {
12340
12340
  const baseUrl = await this.getBaseUrl();
12341
12341
  const headers = await this.getHeaders();
12342
12342
  const response = await fetch(
12343
- `${baseUrl}/api/agent/configs?name=${encodeURIComponent(name)}`,
12343
+ `${baseUrl}/api/agent/composes?name=${encodeURIComponent(name)}`,
12344
12344
  {
12345
12345
  method: "GET",
12346
12346
  headers
@@ -12348,21 +12348,21 @@ var ApiClient = class {
12348
12348
  );
12349
12349
  if (!response.ok) {
12350
12350
  const error43 = await response.json();
12351
- throw new Error(error43.error?.message || `Config not found: ${name}`);
12351
+ throw new Error(error43.error?.message || `Compose not found: ${name}`);
12352
12352
  }
12353
12353
  return await response.json();
12354
12354
  }
12355
- async createOrUpdateConfig(body) {
12355
+ async createOrUpdateCompose(body) {
12356
12356
  const baseUrl = await this.getBaseUrl();
12357
12357
  const headers = await this.getHeaders();
12358
- const response = await fetch(`${baseUrl}/api/agent/configs`, {
12358
+ const response = await fetch(`${baseUrl}/api/agent/composes`, {
12359
12359
  method: "POST",
12360
12360
  headers,
12361
12361
  body: JSON.stringify(body)
12362
12362
  });
12363
12363
  if (!response.ok) {
12364
12364
  const error43 = await response.json();
12365
- throw new Error(error43.error?.message || "Failed to create config");
12365
+ throw new Error(error43.error?.message || "Failed to create compose");
12366
12366
  }
12367
12367
  return await response.json();
12368
12368
  }
@@ -12480,7 +12480,7 @@ function validateVolumeConfig(volumeKey, volumeConfig) {
12480
12480
  }
12481
12481
  return null;
12482
12482
  }
12483
- function validateAgentConfig(config2) {
12483
+ function validateAgentCompose(config2) {
12484
12484
  if (!config2 || typeof config2 !== "object") {
12485
12485
  return { valid: false, error: "Config must be an object" };
12486
12486
  }
@@ -12637,7 +12637,7 @@ function expandEnvVarsInObject(obj) {
12637
12637
  }
12638
12638
 
12639
12639
  // src/commands/build.ts
12640
- var buildCommand = new Command().name("build").description("Create or update agent configuration").argument("<config-file>", "Path to config YAML file").action(async (configFile) => {
12640
+ var buildCommand = new Command().name("build").description("Create or update agent compose").argument("<config-file>", "Path to config YAML file").action(async (configFile) => {
12641
12641
  try {
12642
12642
  if (!existsSync2(configFile)) {
12643
12643
  console.error(chalk2.red(`\u2717 Config file not found: ${configFile}`));
@@ -12672,19 +12672,19 @@ var buildCommand = new Command().name("build").description("Create or update age
12672
12672
  process.exit(1);
12673
12673
  }
12674
12674
  config2 = expandEnvVarsInObject(config2);
12675
- const validation = validateAgentConfig(config2);
12675
+ const validation = validateAgentCompose(config2);
12676
12676
  if (!validation.valid) {
12677
12677
  console.error(chalk2.red(`\u2717 ${validation.error}`));
12678
12678
  process.exit(1);
12679
12679
  }
12680
- console.log(chalk2.blue("Uploading configuration..."));
12681
- const response = await apiClient.createOrUpdateConfig({ config: config2 });
12680
+ console.log(chalk2.blue("Uploading compose..."));
12681
+ const response = await apiClient.createOrUpdateCompose({ config: config2 });
12682
12682
  if (response.action === "created") {
12683
- console.log(chalk2.green(`\u2713 Config created: ${response.name}`));
12683
+ console.log(chalk2.green(`\u2713 Compose created: ${response.name}`));
12684
12684
  } else {
12685
- console.log(chalk2.green(`\u2713 Config updated: ${response.name}`));
12685
+ console.log(chalk2.green(`\u2713 Compose updated: ${response.name}`));
12686
12686
  }
12687
- console.log(chalk2.gray(` Config ID: ${response.configId}`));
12687
+ console.log(chalk2.gray(` Compose ID: ${response.composeId}`));
12688
12688
  console.log();
12689
12689
  console.log(" Run your agent:");
12690
12690
  console.log(
@@ -12696,11 +12696,11 @@ var buildCommand = new Command().name("build").description("Create or update age
12696
12696
  if (error43 instanceof Error) {
12697
12697
  if (error43.message.includes("Not authenticated")) {
12698
12698
  console.error(chalk2.red("\u2717 Not authenticated. Run: vm0 auth login"));
12699
- } else if (error43.message.includes("Failed to create config")) {
12700
- console.error(chalk2.red("\u2717 Failed to create config"));
12699
+ } else if (error43.message.includes("Failed to create compose")) {
12700
+ console.error(chalk2.red("\u2717 Failed to create compose"));
12701
12701
  console.error(chalk2.gray(` ${error43.message}`));
12702
12702
  } else {
12703
- console.error(chalk2.red("\u2717 Failed to create config"));
12703
+ console.error(chalk2.red("\u2717 Failed to create compose"));
12704
12704
  console.error(chalk2.gray(` ${error43.message}`));
12705
12705
  }
12706
12706
  } else {
@@ -12827,7 +12827,7 @@ var ClaudeEventParser = class {
12827
12827
  timestamp: new Date(event.timestamp),
12828
12828
  data: {
12829
12829
  runId: event.runId,
12830
- agentConfigId: event.agentConfigId,
12830
+ agentComposeId: event.agentComposeId,
12831
12831
  agentName: event.agentName,
12832
12832
  prompt: event.prompt,
12833
12833
  templateVars: event.templateVars,
@@ -13097,6 +13097,7 @@ var DEFAULT_TIMEOUT_SECONDS = 120;
13097
13097
  async function pollEvents(runId, timeoutSeconds, options) {
13098
13098
  let nextSequence = -1;
13099
13099
  let complete = false;
13100
+ let runSucceeded = true;
13100
13101
  const pollIntervalMs = 500;
13101
13102
  const timeoutMs = timeoutSeconds * 1e3;
13102
13103
  const startTime = Date.now();
@@ -13128,8 +13129,12 @@ async function pollEvents(runId, timeoutSeconds, options) {
13128
13129
  startTimestamp
13129
13130
  });
13130
13131
  previousTimestamp = parsed.timestamp;
13131
- if (parsed.type === "vm0_result" || parsed.type === "vm0_error") {
13132
+ if (parsed.type === "vm0_result") {
13132
13133
  complete = true;
13134
+ runSucceeded = true;
13135
+ } else if (parsed.type === "vm0_error") {
13136
+ complete = true;
13137
+ runSucceeded = false;
13133
13138
  }
13134
13139
  }
13135
13140
  }
@@ -13138,6 +13143,7 @@ async function pollEvents(runId, timeoutSeconds, options) {
13138
13143
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
13139
13144
  }
13140
13145
  }
13146
+ return runSucceeded;
13141
13147
  }
13142
13148
  function logVerbosePreFlight(action, details) {
13143
13149
  console.log(chalk4.blue(`
@@ -13194,21 +13200,21 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13194
13200
  }
13195
13201
  const verbose = options.verbose;
13196
13202
  try {
13197
- let configId;
13203
+ let composeId;
13198
13204
  if (isUUID(identifier)) {
13199
- configId = identifier;
13205
+ composeId = identifier;
13200
13206
  if (verbose) {
13201
- console.log(chalk4.gray(` Using config ID: ${configId}`));
13207
+ console.log(chalk4.gray(` Using compose ID: ${composeId}`));
13202
13208
  }
13203
13209
  } else {
13204
13210
  if (verbose) {
13205
13211
  console.log(chalk4.gray(` Resolving agent name: ${identifier}`));
13206
13212
  }
13207
13213
  try {
13208
- const config2 = await apiClient.getConfigByName(identifier);
13209
- configId = config2.id;
13214
+ const compose = await apiClient.getComposeByName(identifier);
13215
+ composeId = compose.id;
13210
13216
  if (verbose) {
13211
- console.log(chalk4.gray(` Resolved to config ID: ${configId}`));
13217
+ console.log(chalk4.gray(` Resolved to compose ID: ${composeId}`));
13212
13218
  }
13213
13219
  } catch (error43) {
13214
13220
  if (error43 instanceof Error) {
@@ -13239,7 +13245,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13239
13245
  ]);
13240
13246
  }
13241
13247
  const response = await apiClient.createRun({
13242
- agentConfigId: configId,
13248
+ agentComposeId: composeId,
13243
13249
  prompt,
13244
13250
  templateVars: Object.keys(options.vars).length > 0 ? options.vars : void 0,
13245
13251
  artifactName: options.artifactName,
@@ -13247,7 +13253,12 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13247
13253
  volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
13248
13254
  conversationId: options.conversation
13249
13255
  });
13250
- await pollEvents(response.runId, timeoutSeconds, { verbose });
13256
+ const succeeded = await pollEvents(response.runId, timeoutSeconds, {
13257
+ verbose
13258
+ });
13259
+ if (!succeeded) {
13260
+ process.exit(1);
13261
+ }
13251
13262
  } catch (error43) {
13252
13263
  if (error43 instanceof Error) {
13253
13264
  if (error43.message.includes("Not authenticated")) {
@@ -13313,7 +13324,12 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
13313
13324
  prompt,
13314
13325
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
13315
13326
  });
13316
- await pollEvents(response.runId, timeoutSeconds, { verbose });
13327
+ const succeeded = await pollEvents(response.runId, timeoutSeconds, {
13328
+ verbose
13329
+ });
13330
+ if (!succeeded) {
13331
+ process.exit(1);
13332
+ }
13317
13333
  } catch (error43) {
13318
13334
  if (error43 instanceof Error) {
13319
13335
  if (error43.message.includes("Not authenticated")) {
@@ -13379,7 +13395,12 @@ runCmd.command("continue").description(
13379
13395
  prompt,
13380
13396
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
13381
13397
  });
13382
- await pollEvents(response.runId, timeoutSeconds, { verbose });
13398
+ const succeeded = await pollEvents(response.runId, timeoutSeconds, {
13399
+ verbose
13400
+ });
13401
+ if (!succeeded) {
13402
+ process.exit(1);
13403
+ }
13383
13404
  } catch (error43) {
13384
13405
  if (error43 instanceof Error) {
13385
13406
  if (error43.message.includes("Not authenticated")) {
@@ -14106,7 +14127,7 @@ var artifactCommand = new Command10().name("artifact").description("Manage cloud
14106
14127
 
14107
14128
  // src/index.ts
14108
14129
  var program = new Command11();
14109
- program.name("vm0").description("VM0 CLI - A modern build tool").version("3.1.0");
14130
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("3.2.0");
14110
14131
  program.command("hello").description("Say hello from the App").action(() => {
14111
14132
  console.log(chalk11.blue("Welcome to the VM0 CLI!"));
14112
14133
  console.log(chalk11.green(`Core says: ${FOO}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",