@vm0/cli 9.125.0 → 9.125.2

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-WAL2RDDA.js";
68
+ } from "./chunk-IDHPMIOP.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.125.0"}`));
401
+ console.log(source_default.bold(`VM0 CLI v${"9.125.2"}`));
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.125.0");
4294
+ await startSilentUpgrade("9.125.2");
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.125.0");
4384
+ await startSilentUpgrade("9.125.2");
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.125.0") {
6397
- console.log(source_default.green(`\u2713 Already up to date (${"9.125.0"})`));
6396
+ if (latestVersion === "9.125.2") {
6397
+ console.log(source_default.green(`\u2713 Already up to date (${"9.125.2"})`));
6398
6398
  return;
6399
6399
  }
6400
6400
  console.log(
6401
6401
  source_default.yellow(
6402
- `Current version: ${"9.125.0"} -> Latest version: ${latestVersion}`
6402
+ `Current version: ${"9.125.2"} -> 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.125.0"} to ${latestVersion}`)
6429
+ source_default.green(`\u2713 Upgraded from ${"9.125.2"} 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.125.0");
6496
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.125.2");
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.125.0",
3
+ "version": "9.125.2",
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,
@@ -127,7 +128,7 @@ import {
127
128
  upsertZeroOrgModelProvider,
128
129
  withErrorHandler,
129
130
  zeroAgentCustomSkillNameSchema
130
- } from "./chunk-WAL2RDDA.js";
131
+ } from "./chunk-IDHPMIOP.js";
131
132
  import {
132
133
  __toESM,
133
134
  init_esm_shims
@@ -4950,6 +4951,7 @@ Examples:
4950
4951
  // src/commands/zero/search/index.ts
4951
4952
  init_esm_shims();
4952
4953
  var SUPPORTED_SOURCES = ["logs", "chat", "slack"];
4954
+ var SEVEN_DAYS_MS2 = 7 * 24 * 60 * 60 * 1e3;
4953
4955
  var SEARCH_EXPLAINER = `
4954
4956
  Available sources:
4955
4957
  logs full agent event stream (tool calls, tokens, system events) from agent runs
@@ -4981,6 +4983,26 @@ query parameters instead.`;
4981
4983
  function collectSource(value, previous) {
4982
4984
  return [...previous, value];
4983
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
+ }
4984
5006
  async function runLogsSource(query, options) {
4985
5007
  const logsOptions = {
4986
5008
  afterContext: options.afterContext,
@@ -4993,8 +5015,67 @@ async function runLogsSource(query, options) {
4993
5015
  };
4994
5016
  await runLogsSearch(query, logsOptions);
4995
5017
  }
4996
- async function runChatSource(_query, _options) {
4997
- throw new Error("zero search --source chat: not yet implemented");
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);
4998
5079
  }
4999
5080
  async function runSlackSource(query, _options) {
5000
5081
  console.log(buildSlackRecipe(query));
@@ -6522,7 +6603,7 @@ function registerZeroCommands(prog, commands) {
6522
6603
  var program = new Command();
6523
6604
  program.name("zero").description(
6524
6605
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
6525
- ).version("9.125.0").addHelpText(
6606
+ ).version("9.125.2").addHelpText(
6526
6607
  "after",
6527
6608
  `
6528
6609
  Examples: