@vm0/cli 9.124.3 → 9.125.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 CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  source_default,
66
66
  volumeConfigSchema,
67
67
  withErrorHandler
68
- } from "./chunk-ISA6IES3.js";
68
+ } from "./chunk-WAL2RDDA.js";
69
69
  import {
70
70
  __toESM,
71
71
  init_esm_shims
@@ -398,7 +398,7 @@ function getConfigPath() {
398
398
  return join(homedir(), ".vm0", "config.json");
399
399
  }
400
400
  var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
401
- console.log(source_default.bold(`VM0 CLI v${"9.124.3"}`));
401
+ console.log(source_default.bold(`VM0 CLI v${"9.125.0"}`));
402
402
  console.log();
403
403
  const config = await loadConfig();
404
404
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -4291,7 +4291,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4291
4291
  options.autoUpdate = false;
4292
4292
  }
4293
4293
  if (options.autoUpdate !== false) {
4294
- await startSilentUpgrade("9.124.3");
4294
+ await startSilentUpgrade("9.125.0");
4295
4295
  }
4296
4296
  try {
4297
4297
  let result;
@@ -4381,7 +4381,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
4381
4381
  withErrorHandler(
4382
4382
  async (identifier, prompt, options) => {
4383
4383
  if (options.autoUpdate !== false) {
4384
- await startSilentUpgrade("9.124.3");
4384
+ await startSilentUpgrade("9.125.0");
4385
4385
  }
4386
4386
  const { name, version } = parseIdentifier(identifier);
4387
4387
  let composeId;
@@ -6393,13 +6393,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6393
6393
  if (latestVersion === null) {
6394
6394
  throw new Error("Could not check for updates. Please try again later.");
6395
6395
  }
6396
- if (latestVersion === "9.124.3") {
6397
- console.log(source_default.green(`\u2713 Already up to date (${"9.124.3"})`));
6396
+ if (latestVersion === "9.125.0") {
6397
+ console.log(source_default.green(`\u2713 Already up to date (${"9.125.0"})`));
6398
6398
  return;
6399
6399
  }
6400
6400
  console.log(
6401
6401
  source_default.yellow(
6402
- `Current version: ${"9.124.3"} -> Latest version: ${latestVersion}`
6402
+ `Current version: ${"9.125.0"} -> Latest version: ${latestVersion}`
6403
6403
  )
6404
6404
  );
6405
6405
  console.log();
@@ -6426,7 +6426,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
6426
6426
  const success = await performUpgrade(packageManager);
6427
6427
  if (success) {
6428
6428
  console.log(
6429
- source_default.green(`\u2713 Upgraded from ${"9.124.3"} to ${latestVersion}`)
6429
+ source_default.green(`\u2713 Upgraded from ${"9.125.0"} to ${latestVersion}`)
6430
6430
  );
6431
6431
  return;
6432
6432
  }
@@ -6493,7 +6493,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
6493
6493
 
6494
6494
  // src/index.ts
6495
6495
  var program = new Command();
6496
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.124.3");
6496
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.125.0");
6497
6497
  program.addCommand(authCommand);
6498
6498
  program.addCommand(infoCommand);
6499
6499
  program.addCommand(composeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.124.3",
3
+ "version": "9.125.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -123,10 +123,11 @@ import {
123
123
  updateZeroOrg,
124
124
  updateZeroOrgModelProviderModel,
125
125
  updateZeroUserPreferences,
126
+ uploadWebFile,
126
127
  upsertZeroOrgModelProvider,
127
128
  withErrorHandler,
128
129
  zeroAgentCustomSkillNameSchema
129
- } from "./chunk-ISA6IES3.js";
130
+ } from "./chunk-WAL2RDDA.js";
130
131
  import {
131
132
  __toESM,
132
133
  init_esm_shims
@@ -4788,6 +4789,37 @@ function renderResults(response) {
4788
4789
  );
4789
4790
  }
4790
4791
  }
4792
+ async function runLogsSearch(keyword, options) {
4793
+ const { before, after } = parseContextOptions(options);
4794
+ if (options.run && !isUUID(options.run)) {
4795
+ console.error(
4796
+ source_default.red(`\u2717 Invalid run ID "${options.run}" \u2014 expected a UUID`)
4797
+ );
4798
+ console.error(source_default.dim(" Run: zero logs list to find run IDs"));
4799
+ process.exit(1);
4800
+ }
4801
+ const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
4802
+ const limit = parseLimit2(options.limit);
4803
+ const response = await searchZeroLogs({
4804
+ keyword,
4805
+ agent: options.agent,
4806
+ runId: options.run,
4807
+ since,
4808
+ limit,
4809
+ before,
4810
+ after
4811
+ });
4812
+ if (response.results.length === 0) {
4813
+ console.log(source_default.dim("No matches found"));
4814
+ console.log(
4815
+ source_default.dim(
4816
+ " Try a broader search with --since 30d or a different keyword"
4817
+ )
4818
+ );
4819
+ return;
4820
+ }
4821
+ renderResults(response);
4822
+ }
4791
4823
  var searchCommand2 = new Command().name("search").description("Search agent events across runs").argument("<keyword>", "Search keyword").option("-A, --after-context <n>", "Show n events after each match").option("-B, --before-context <n>", "Show n events before each match").option("-C, --context <n>", "Show n events before and after each match").option("--agent <name>", "Filter by agent name").option("--run <id>", "Filter by specific run ID").option("--since <time>", "Search logs since (default: 7d)").option("--limit <n>", "Maximum number of matches (default: 20)").addHelpText(
4792
4824
  "after",
4793
4825
  `
@@ -4797,35 +4829,7 @@ Examples:
4797
4829
  zero logs search "failed" --since 30d --limit 50`
4798
4830
  ).action(
4799
4831
  withErrorHandler(async (keyword, options) => {
4800
- const { before, after } = parseContextOptions(options);
4801
- if (options.run && !isUUID(options.run)) {
4802
- console.error(
4803
- source_default.red(`\u2717 Invalid run ID "${options.run}" \u2014 expected a UUID`)
4804
- );
4805
- console.error(source_default.dim(" Run: zero logs list to find run IDs"));
4806
- process.exit(1);
4807
- }
4808
- const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
4809
- const limit = parseLimit2(options.limit);
4810
- const response = await searchZeroLogs({
4811
- keyword,
4812
- agent: options.agent,
4813
- runId: options.run,
4814
- since,
4815
- limit,
4816
- before,
4817
- after
4818
- });
4819
- if (response.results.length === 0) {
4820
- console.log(source_default.dim("No matches found"));
4821
- console.log(
4822
- source_default.dim(
4823
- " Try a broader search with --since 30d or a different keyword"
4824
- )
4825
- );
4826
- return;
4827
- }
4828
- renderResults(response);
4832
+ await runLogsSearch(keyword, options);
4829
4833
  })
4830
4834
  );
4831
4835
 
@@ -4943,6 +4947,93 @@ Examples:
4943
4947
  )
4944
4948
  );
4945
4949
 
4950
+ // src/commands/zero/search/index.ts
4951
+ init_esm_shims();
4952
+ var SUPPORTED_SOURCES = ["logs", "chat", "slack"];
4953
+ var SEARCH_EXPLAINER = `
4954
+ Available sources:
4955
+ logs full agent event stream (tool calls, tokens, system events) from agent runs
4956
+ chat user/assistant text messages as shown in the web chat UI
4957
+ slack returns a recipe for calling the Slack API directly; requires the Slack connector
4958
+
4959
+ Usage: zero search <query> --source <logs|chat|slack> [flags]
4960
+ Run 'zero search --help' for all flags.`;
4961
+ function buildSlackRecipe(query) {
4962
+ const encoded = encodeURIComponent(query);
4963
+ return `The \`slack\` source does not call Slack from this CLI. Run the
4964
+ following inside an agent sandbox that has $SLACK_TOKEN available:
4965
+
4966
+ curl -H "Authorization: Bearer $SLACK_TOKEN" \\
4967
+ "https://slack.com/api/search.messages?query=${encoded}"
4968
+
4969
+ If you don't have $SLACK_TOKEN, check the connector status:
4970
+ zero connector status slack
4971
+
4972
+ To verify the token and network policy end-to-end:
4973
+ zero doctor check-connector --env-name SLACK_TOKEN
4974
+
4975
+ Slack API docs: https://api.slack.com/methods/search.messages
4976
+
4977
+ Note: CLI-local flags (--limit, --since, -A/-B/-C) are ignored for the
4978
+ slack source. Pass equivalents to Slack's API via count= / highlight=
4979
+ query parameters instead.`;
4980
+ }
4981
+ function collectSource(value, previous) {
4982
+ return [...previous, value];
4983
+ }
4984
+ async function runLogsSource(query, options) {
4985
+ const logsOptions = {
4986
+ afterContext: options.afterContext,
4987
+ beforeContext: options.beforeContext,
4988
+ context: options.context,
4989
+ agent: options.agent,
4990
+ run: options.run,
4991
+ since: options.since,
4992
+ limit: options.limit
4993
+ };
4994
+ await runLogsSearch(query, logsOptions);
4995
+ }
4996
+ async function runChatSource(_query, _options) {
4997
+ throw new Error("zero search --source chat: not yet implemented");
4998
+ }
4999
+ async function runSlackSource(query, _options) {
5000
+ console.log(buildSlackRecipe(query));
5001
+ }
5002
+ var zeroSearchCommand = new Command().name("search").description("Search logs, chat, or get a recipe for external sources").argument("<query>", "Search query").option(
5003
+ "--source <type>",
5004
+ "Source to search: logs | chat | slack (pass once)",
5005
+ collectSource,
5006
+ []
5007
+ ).option("--agent <name>", "Filter by agent name").option("--run <id>", "Filter by run ID").option("--since <time>", "Time window (e.g., 7d, 2h)").option("--limit <n>", "Maximum number of matches").option("-A, --after-context <n>", "Show n items after each match").option("-B, --before-context <n>", "Show n items before each match").option("-C, --context <n>", "Show n items before and after each match").addHelpText("after", SEARCH_EXPLAINER).action(
5008
+ withErrorHandler(async (query, options) => {
5009
+ const sources = options.source;
5010
+ if (sources.length === 0) {
5011
+ console.log(SEARCH_EXPLAINER);
5012
+ return;
5013
+ }
5014
+ if (sources.length > 1) {
5015
+ throw new Error("Only one --source is allowed.");
5016
+ }
5017
+ const source = sources[0];
5018
+ if (!SUPPORTED_SOURCES.includes(source)) {
5019
+ throw new Error(
5020
+ `Unknown --source "${source}". Expected one of: ${SUPPORTED_SOURCES.join(", ")}`
5021
+ );
5022
+ }
5023
+ switch (source) {
5024
+ case "logs":
5025
+ await runLogsSource(query, options);
5026
+ return;
5027
+ case "chat":
5028
+ await runChatSource(query, options);
5029
+ return;
5030
+ case "slack":
5031
+ await runSlackSource(query, options);
5032
+ return;
5033
+ }
5034
+ })
5035
+ );
5036
+
4946
5037
  // src/commands/zero/developer-support.ts
4947
5038
  init_esm_shims();
4948
5039
  var zeroDeveloperSupportCommand = new Command().name("developer-support").description("Submit a diagnostic report to the dev team").requiredOption("--title <text>", "Issue title").requiredOption("--description <text>", "Diagnostic description").option("--consent-code <code>", "User-provided verification code").addHelpText(
@@ -6335,11 +6426,41 @@ Notes:
6335
6426
  })
6336
6427
  );
6337
6428
 
6429
+ // src/commands/zero/web/upload-file.ts
6430
+ init_esm_shims();
6431
+ var uploadFileCommand2 = new Command().name("upload-file").description("Upload a local file and print a 7-day presigned URL").requiredOption("-f, --file <path>", "Local file path to upload").option("--content-type <mime>", "Override inferred content type").addHelpText(
6432
+ "after",
6433
+ `
6434
+ Examples:
6435
+ Upload a file: zero web upload-file -f /tmp/report.pdf
6436
+ Override content-type: zero web upload-file -f /tmp/data --content-type text/csv
6437
+
6438
+ Output:
6439
+ Prints a JSON object to stdout on success:
6440
+ {"id":"...","filename":"...","contentType":"...","size":N,"url":"https://..."}
6441
+
6442
+ Notes:
6443
+ - Authenticates via ZERO_TOKEN (requires file:write capability)
6444
+ - Returned URL is a presigned GET valid for 7 days
6445
+ - Max file size: 10 MB
6446
+ - Allowed types: png / jpeg / gif / webp / svg / mp4 / webm / mov / pdf / txt / csv / md / json`
6447
+ ).action(
6448
+ withErrorHandler(
6449
+ async (options) => {
6450
+ const result = await uploadWebFile(options.file, {
6451
+ contentType: options.contentType
6452
+ });
6453
+ console.log(JSON.stringify(result));
6454
+ }
6455
+ )
6456
+ );
6457
+
6338
6458
  // src/commands/zero/web/index.ts
6339
- var zeroWebCommand = new Command().name("web").description("Download files uploaded via the web chat UI").addCommand(downloadFileCommand2).addHelpText(
6459
+ var zeroWebCommand = new Command().name("web").description("Upload and download files via the web chat endpoint").addCommand(downloadFileCommand2).addCommand(uploadFileCommand2).addHelpText(
6340
6460
  "after",
6341
6461
  `
6342
6462
  Examples:
6463
+ Upload a file: zero web upload-file -f /tmp/report.pdf
6343
6464
  Download a file: zero web download-file <file-id> -o /tmp/out.pdf`
6344
6465
  );
6345
6466
 
@@ -6352,6 +6473,7 @@ var COMMAND_CAPABILITY_MAP = {
6352
6473
  schedule: "schedule:read",
6353
6474
  doctor: null,
6354
6475
  logs: "agent-run:read",
6476
+ search: "chat-message:read",
6355
6477
  chat: "chat-message:write",
6356
6478
  slack: "slack:write",
6357
6479
  whoami: null,
@@ -6374,6 +6496,7 @@ var DEFAULT_COMMANDS = [
6374
6496
  zeroSlackCommand,
6375
6497
  zeroVariableCommand,
6376
6498
  zeroLogsCommand,
6499
+ zeroSearchCommand,
6377
6500
  zeroWhoamiCommand,
6378
6501
  zeroSkillCommand,
6379
6502
  zeroDeveloperSupportCommand,
@@ -6399,7 +6522,7 @@ function registerZeroCommands(prog, commands) {
6399
6522
  var program = new Command();
6400
6523
  program.name("zero").description(
6401
6524
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
6402
- ).version("9.124.3").addHelpText(
6525
+ ).version("9.125.0").addHelpText(
6403
6526
  "after",
6404
6527
  `
6405
6528
  Examples: