@vm0/cli 9.124.3 → 9.125.1

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-HUFHEBPZ.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.1"}`));
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.1");
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.1");
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.1") {
6397
+ console.log(source_default.green(`\u2713 Already up to date (${"9.125.1"})`));
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.1"} -> 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.1"} 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.1");
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.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -105,6 +105,7 @@ import {
105
105
  resolveZeroScheduleByAgent,
106
106
  saveConfig,
107
107
  searchConnectors,
108
+ searchZeroChat,
108
109
  searchZeroLogs,
109
110
  sendChatMessage,
110
111
  sendSlackMessage,
@@ -123,10 +124,11 @@ import {
123
124
  updateZeroOrg,
124
125
  updateZeroOrgModelProviderModel,
125
126
  updateZeroUserPreferences,
127
+ uploadWebFile,
126
128
  upsertZeroOrgModelProvider,
127
129
  withErrorHandler,
128
130
  zeroAgentCustomSkillNameSchema
129
- } from "./chunk-ISA6IES3.js";
131
+ } from "./chunk-HUFHEBPZ.js";
130
132
  import {
131
133
  __toESM,
132
134
  init_esm_shims
@@ -4788,6 +4790,37 @@ function renderResults(response) {
4788
4790
  );
4789
4791
  }
4790
4792
  }
4793
+ async function runLogsSearch(keyword, options) {
4794
+ const { before, after } = parseContextOptions(options);
4795
+ if (options.run && !isUUID(options.run)) {
4796
+ console.error(
4797
+ source_default.red(`\u2717 Invalid run ID "${options.run}" \u2014 expected a UUID`)
4798
+ );
4799
+ console.error(source_default.dim(" Run: zero logs list to find run IDs"));
4800
+ process.exit(1);
4801
+ }
4802
+ const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS;
4803
+ const limit = parseLimit2(options.limit);
4804
+ const response = await searchZeroLogs({
4805
+ keyword,
4806
+ agent: options.agent,
4807
+ runId: options.run,
4808
+ since,
4809
+ limit,
4810
+ before,
4811
+ after
4812
+ });
4813
+ if (response.results.length === 0) {
4814
+ console.log(source_default.dim("No matches found"));
4815
+ console.log(
4816
+ source_default.dim(
4817
+ " Try a broader search with --since 30d or a different keyword"
4818
+ )
4819
+ );
4820
+ return;
4821
+ }
4822
+ renderResults(response);
4823
+ }
4791
4824
  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
4825
  "after",
4793
4826
  `
@@ -4797,35 +4830,7 @@ Examples:
4797
4830
  zero logs search "failed" --since 30d --limit 50`
4798
4831
  ).action(
4799
4832
  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);
4833
+ await runLogsSearch(keyword, options);
4829
4834
  })
4830
4835
  );
4831
4836
 
@@ -4943,6 +4948,173 @@ Examples:
4943
4948
  )
4944
4949
  );
4945
4950
 
4951
+ // src/commands/zero/search/index.ts
4952
+ init_esm_shims();
4953
+ var SUPPORTED_SOURCES = ["logs", "chat", "slack"];
4954
+ var SEVEN_DAYS_MS2 = 7 * 24 * 60 * 60 * 1e3;
4955
+ var SEARCH_EXPLAINER = `
4956
+ Available sources:
4957
+ logs full agent event stream (tool calls, tokens, system events) from agent runs
4958
+ chat user/assistant text messages as shown in the web chat UI
4959
+ slack returns a recipe for calling the Slack API directly; requires the Slack connector
4960
+
4961
+ Usage: zero search <query> --source <logs|chat|slack> [flags]
4962
+ Run 'zero search --help' for all flags.`;
4963
+ function buildSlackRecipe(query) {
4964
+ const encoded = encodeURIComponent(query);
4965
+ return `The \`slack\` source does not call Slack from this CLI. Run the
4966
+ following inside an agent sandbox that has $SLACK_TOKEN available:
4967
+
4968
+ curl -H "Authorization: Bearer $SLACK_TOKEN" \\
4969
+ "https://slack.com/api/search.messages?query=${encoded}"
4970
+
4971
+ If you don't have $SLACK_TOKEN, check the connector status:
4972
+ zero connector status slack
4973
+
4974
+ To verify the token and network policy end-to-end:
4975
+ zero doctor check-connector --env-name SLACK_TOKEN
4976
+
4977
+ Slack API docs: https://api.slack.com/methods/search.messages
4978
+
4979
+ Note: CLI-local flags (--limit, --since, -A/-B/-C) are ignored for the
4980
+ slack source. Pass equivalents to Slack's API via count= / highlight=
4981
+ query parameters instead.`;
4982
+ }
4983
+ function collectSource(value, previous) {
4984
+ return [...previous, value];
4985
+ }
4986
+ function parseContextOptions2(options) {
4987
+ const contextN = options.context ? parseInt(options.context, 10) : 0;
4988
+ const before = options.beforeContext ? parseInt(options.beforeContext, 10) : contextN;
4989
+ const after = options.afterContext ? parseInt(options.afterContext, 10) : contextN;
4990
+ if (isNaN(before) || before < 0 || before > 10) {
4991
+ throw new Error("--before-context must be between 0 and 10");
4992
+ }
4993
+ if (isNaN(after) || after < 0 || after > 10) {
4994
+ throw new Error("--after-context must be between 0 and 10");
4995
+ }
4996
+ return { before, after };
4997
+ }
4998
+ function parseLimit3(value) {
4999
+ if (!value) return void 0;
5000
+ const limit = parseInt(value, 10);
5001
+ if (isNaN(limit) || limit < 1 || limit > 50) {
5002
+ throw new Error("--limit must be between 1 and 50");
5003
+ }
5004
+ return limit;
5005
+ }
5006
+ async function runLogsSource(query, options) {
5007
+ const logsOptions = {
5008
+ afterContext: options.afterContext,
5009
+ beforeContext: options.beforeContext,
5010
+ context: options.context,
5011
+ agent: options.agent,
5012
+ run: options.run,
5013
+ since: options.since,
5014
+ limit: options.limit
5015
+ };
5016
+ await runLogsSearch(query, logsOptions);
5017
+ }
5018
+ function formatTimestamp(iso) {
5019
+ return new Date(iso).toISOString().replace(/\.\d{3}Z$/, "Z");
5020
+ }
5021
+ function renderChatMessage(msg, isMatch) {
5022
+ const marker = isMatch ? source_default.yellow("\u25B8") : source_default.dim("\xB7");
5023
+ const header = `${marker} ${source_default.dim(msg.role)} ${source_default.dim(formatTimestamp(msg.createdAt))}`;
5024
+ console.log(header);
5025
+ console.log(isMatch ? msg.content : source_default.dim(msg.content));
5026
+ }
5027
+ function renderChatResults(response) {
5028
+ let isFirst = true;
5029
+ for (const result of response.results) {
5030
+ if (!isFirst) console.log();
5031
+ isFirst = false;
5032
+ console.log(
5033
+ source_default.bold(
5034
+ `\u2500\u2500 Thread ${result.chatThreadId} (${result.agentName}) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`
5035
+ )
5036
+ );
5037
+ for (const msg of result.contextBefore) {
5038
+ renderChatMessage(msg, false);
5039
+ }
5040
+ renderChatMessage(result.matchedMessage, true);
5041
+ for (const msg of result.contextAfter) {
5042
+ renderChatMessage(msg, false);
5043
+ }
5044
+ }
5045
+ if (response.hasMore) {
5046
+ console.log();
5047
+ console.log(
5048
+ source_default.dim(
5049
+ ` Showing first ${response.results.length} matches. Use --limit to see more.`
5050
+ )
5051
+ );
5052
+ }
5053
+ }
5054
+ async function runChatSource(query, options) {
5055
+ if (options.run) {
5056
+ throw new Error("--run is not supported with --source chat");
5057
+ }
5058
+ const { before, after } = parseContextOptions2(options);
5059
+ const limit = parseLimit3(options.limit);
5060
+ const since = options.since ? parseTime(options.since) : Date.now() - SEVEN_DAYS_MS2;
5061
+ const response = await searchZeroChat({
5062
+ keyword: query,
5063
+ agent: options.agent,
5064
+ since,
5065
+ limit,
5066
+ before,
5067
+ after
5068
+ });
5069
+ if (response.results.length === 0) {
5070
+ console.log(source_default.dim("No matches found"));
5071
+ console.log(
5072
+ source_default.dim(
5073
+ " Try a broader search with --since 30d or a different keyword"
5074
+ )
5075
+ );
5076
+ return;
5077
+ }
5078
+ renderChatResults(response);
5079
+ }
5080
+ async function runSlackSource(query, _options) {
5081
+ console.log(buildSlackRecipe(query));
5082
+ }
5083
+ var zeroSearchCommand = new Command().name("search").description("Search logs, chat, or get a recipe for external sources").argument("<query>", "Search query").option(
5084
+ "--source <type>",
5085
+ "Source to search: logs | chat | slack (pass once)",
5086
+ collectSource,
5087
+ []
5088
+ ).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(
5089
+ withErrorHandler(async (query, options) => {
5090
+ const sources = options.source;
5091
+ if (sources.length === 0) {
5092
+ console.log(SEARCH_EXPLAINER);
5093
+ return;
5094
+ }
5095
+ if (sources.length > 1) {
5096
+ throw new Error("Only one --source is allowed.");
5097
+ }
5098
+ const source = sources[0];
5099
+ if (!SUPPORTED_SOURCES.includes(source)) {
5100
+ throw new Error(
5101
+ `Unknown --source "${source}". Expected one of: ${SUPPORTED_SOURCES.join(", ")}`
5102
+ );
5103
+ }
5104
+ switch (source) {
5105
+ case "logs":
5106
+ await runLogsSource(query, options);
5107
+ return;
5108
+ case "chat":
5109
+ await runChatSource(query, options);
5110
+ return;
5111
+ case "slack":
5112
+ await runSlackSource(query, options);
5113
+ return;
5114
+ }
5115
+ })
5116
+ );
5117
+
4946
5118
  // src/commands/zero/developer-support.ts
4947
5119
  init_esm_shims();
4948
5120
  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 +6507,41 @@ Notes:
6335
6507
  })
6336
6508
  );
6337
6509
 
6510
+ // src/commands/zero/web/upload-file.ts
6511
+ init_esm_shims();
6512
+ 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(
6513
+ "after",
6514
+ `
6515
+ Examples:
6516
+ Upload a file: zero web upload-file -f /tmp/report.pdf
6517
+ Override content-type: zero web upload-file -f /tmp/data --content-type text/csv
6518
+
6519
+ Output:
6520
+ Prints a JSON object to stdout on success:
6521
+ {"id":"...","filename":"...","contentType":"...","size":N,"url":"https://..."}
6522
+
6523
+ Notes:
6524
+ - Authenticates via ZERO_TOKEN (requires file:write capability)
6525
+ - Returned URL is a presigned GET valid for 7 days
6526
+ - Max file size: 10 MB
6527
+ - Allowed types: png / jpeg / gif / webp / svg / mp4 / webm / mov / pdf / txt / csv / md / json`
6528
+ ).action(
6529
+ withErrorHandler(
6530
+ async (options) => {
6531
+ const result = await uploadWebFile(options.file, {
6532
+ contentType: options.contentType
6533
+ });
6534
+ console.log(JSON.stringify(result));
6535
+ }
6536
+ )
6537
+ );
6538
+
6338
6539
  // 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(
6540
+ var zeroWebCommand = new Command().name("web").description("Upload and download files via the web chat endpoint").addCommand(downloadFileCommand2).addCommand(uploadFileCommand2).addHelpText(
6340
6541
  "after",
6341
6542
  `
6342
6543
  Examples:
6544
+ Upload a file: zero web upload-file -f /tmp/report.pdf
6343
6545
  Download a file: zero web download-file <file-id> -o /tmp/out.pdf`
6344
6546
  );
6345
6547
 
@@ -6352,6 +6554,7 @@ var COMMAND_CAPABILITY_MAP = {
6352
6554
  schedule: "schedule:read",
6353
6555
  doctor: null,
6354
6556
  logs: "agent-run:read",
6557
+ search: "chat-message:read",
6355
6558
  chat: "chat-message:write",
6356
6559
  slack: "slack:write",
6357
6560
  whoami: null,
@@ -6374,6 +6577,7 @@ var DEFAULT_COMMANDS = [
6374
6577
  zeroSlackCommand,
6375
6578
  zeroVariableCommand,
6376
6579
  zeroLogsCommand,
6580
+ zeroSearchCommand,
6377
6581
  zeroWhoamiCommand,
6378
6582
  zeroSkillCommand,
6379
6583
  zeroDeveloperSupportCommand,
@@ -6399,7 +6603,7 @@ function registerZeroCommands(prog, commands) {
6399
6603
  var program = new Command();
6400
6604
  program.name("zero").description(
6401
6605
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
6402
- ).version("9.124.3").addHelpText(
6606
+ ).version("9.125.1").addHelpText(
6403
6607
  "after",
6404
6608
  `
6405
6609
  Examples: