@vm0/cli 9.116.1 → 9.116.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.116.1",
3
+ "version": "9.116.3",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -37,6 +37,7 @@ import {
37
37
  deleteZeroVariable,
38
38
  deployZeroSchedule,
39
39
  disableZeroSchedule,
40
+ downloadSlackFile,
40
41
  enableZeroSchedule,
41
42
  extractSecretNamesFromApis,
42
43
  findMatchingPermissions,
@@ -130,7 +131,7 @@ import {
130
131
  upsertZeroOrgModelProvider,
131
132
  withErrorHandler,
132
133
  zeroAgentCustomSkillNameSchema
133
- } from "./chunk-5FGI5P6M.js";
134
+ } from "./chunk-PK7CJPFD.js";
134
135
 
135
136
  // src/zero.ts
136
137
  init_esm_shims();
@@ -4133,14 +4134,49 @@ Notes:
4133
4134
  )
4134
4135
  );
4135
4136
 
4137
+ // src/commands/zero/slack/download-file.ts
4138
+ init_esm_shims();
4139
+ import { join as join2 } from "path";
4140
+ import { tmpdir } from "os";
4141
+ function defaultOutPath(fileId) {
4142
+ return join2(tmpdir(), `slack-${fileId}`);
4143
+ }
4144
+ var downloadFileCommand = new Command().name("download-file").description("Download a Slack file by id using the bot token").argument("<file-id>", "Slack file id (e.g. F01234ABCD)").option(
4145
+ "-o, --out <path>",
4146
+ "Output path for the downloaded file (default: /tmp/slack-<file-id>)"
4147
+ ).addHelpText(
4148
+ "after",
4149
+ `
4150
+ Examples:
4151
+ Download to default temp path: zero slack download-file F01234ABCD
4152
+ Download to explicit path: zero slack download-file F01234ABCD -o /tmp/image.png
4153
+
4154
+ Output:
4155
+ Prints a JSON object to stdout on success:
4156
+ {"path":"/tmp/slack-F01234ABCD","mimetype":"image/png","size":12345}
4157
+
4158
+ Notes:
4159
+ - Uses the bot token on the server side; no user Slack token is needed
4160
+ - Streams the file bytes directly to disk`
4161
+ ).action(
4162
+ withErrorHandler(async (fileId, options) => {
4163
+ const outPath = options.out ?? defaultOutPath(fileId);
4164
+ const result = await downloadSlackFile(fileId, outPath);
4165
+ console.log(JSON.stringify(result));
4166
+ })
4167
+ );
4168
+
4136
4169
  // src/commands/zero/slack/index.ts
4137
- var zeroSlackCommand = new Command().name("slack").description("Send messages and upload files to Slack channels as the bot").addCommand(zeroSlackMessageCommand).addCommand(uploadFileCommand).addHelpText(
4170
+ var zeroSlackCommand = new Command().name("slack").description(
4171
+ "Send messages, upload files, and download files from Slack as the bot"
4172
+ ).addCommand(zeroSlackMessageCommand).addCommand(uploadFileCommand).addCommand(downloadFileCommand).addHelpText(
4138
4173
  "after",
4139
4174
  `
4140
4175
  Examples:
4141
4176
  Send a message: zero slack message send -c <channel-id> -t "Hello!"
4142
4177
  Reply in a thread: zero slack message send -c <channel-id> --thread <ts> -t "reply"
4143
- Upload a file: zero slack upload-file -f /tmp/report.pdf -c <channel-id>`
4178
+ Upload a file: zero slack upload-file -f /tmp/report.pdf -c <channel-id>
4179
+ Download a file: zero slack download-file <file-id> -o /tmp/out.png`
4144
4180
  );
4145
4181
 
4146
4182
  // src/commands/zero/variable/index.ts
@@ -4391,7 +4427,7 @@ init_esm_shims();
4391
4427
  // src/lib/skill-directory.ts
4392
4428
  init_esm_shims();
4393
4429
  import { readFileSync as readFileSync5, readdirSync } from "fs";
4394
- import { join as join2 } from "path";
4430
+ import { join as join3 } from "path";
4395
4431
  var IGNORED_NAMES = /* @__PURE__ */ new Set(["node_modules", ".git", ".DS_Store"]);
4396
4432
  function readSkillDirectory(dirPath) {
4397
4433
  const files = [];
@@ -4401,11 +4437,11 @@ function readSkillDirectory(dirPath) {
4401
4437
  if (entry.name.startsWith(".") || IGNORED_NAMES.has(entry.name)) continue;
4402
4438
  const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
4403
4439
  if (entry.isDirectory()) {
4404
- walk(join2(dir, entry.name), relPath);
4440
+ walk(join3(dir, entry.name), relPath);
4405
4441
  } else {
4406
4442
  files.push({
4407
4443
  path: relPath,
4408
- content: readFileSync5(join2(dir, entry.name), "utf-8")
4444
+ content: readFileSync5(join3(dir, entry.name), "utf-8")
4409
4445
  });
4410
4446
  }
4411
4447
  }
@@ -4997,12 +5033,12 @@ init_esm_shims();
4997
5033
  import { execFile } from "child_process";
4998
5034
  import { readFile, unlink } from "fs/promises";
4999
5035
  import { randomUUID } from "crypto";
5000
- import { join as join3 } from "path";
5001
- import { tmpdir } from "os";
5036
+ import { join as join4 } from "path";
5037
+ import { tmpdir as tmpdir2 } from "os";
5002
5038
  import { promisify } from "util";
5003
5039
  var execFileAsync = promisify(execFile);
5004
5040
  async function captureScreenshot() {
5005
- const tmpPath = join3(tmpdir(), `vm0-screenshot-${randomUUID()}.jpg`);
5041
+ const tmpPath = join4(tmpdir2(), `vm0-screenshot-${randomUUID()}.jpg`);
5006
5042
  try {
5007
5043
  await execFileAsync("screencapture", ["-x", "-t", "jpg", tmpPath]);
5008
5044
  const info = await getScreenInfo();
@@ -5031,7 +5067,7 @@ async function captureScreenshot() {
5031
5067
  }
5032
5068
  }
5033
5069
  async function captureRegionScreenshot(region) {
5034
- const tmpPath = join3(tmpdir(), `vm0-zoom-${randomUUID()}.jpg`);
5070
+ const tmpPath = join4(tmpdir2(), `vm0-zoom-${randomUUID()}.jpg`);
5035
5071
  try {
5036
5072
  const regionArg = `${region.x},${region.y},${region.width},${region.height}`;
5037
5073
  await execFileAsync("screencapture", [
@@ -5723,7 +5759,7 @@ var hostStopCommand = new Command().name("stop").description("Stop and unregiste
5723
5759
  // src/commands/zero/computer-use/client.ts
5724
5760
  init_esm_shims();
5725
5761
  import { writeFile, mkdir } from "fs/promises";
5726
- import { join as join4 } from "path";
5762
+ import { join as join5 } from "path";
5727
5763
 
5728
5764
  // src/lib/computer-use/client.ts
5729
5765
  init_esm_shims();
@@ -5791,7 +5827,7 @@ var clientScreenshotCommand = new Command().name("screenshot").description("Capt
5791
5827
  const dir = "/tmp/computer-use";
5792
5828
  await mkdir(dir, { recursive: true });
5793
5829
  const timestamp = Date.now();
5794
- const filePath = join4(dir, `screenshot-${timestamp}.${data.format}`);
5830
+ const filePath = join5(dir, `screenshot-${timestamp}.${data.format}`);
5795
5831
  const buffer = Buffer.from(data.image, "base64");
5796
5832
  await writeFile(filePath, buffer);
5797
5833
  process.stdout.write(`${filePath}
@@ -5819,7 +5855,7 @@ var clientZoomCommand = new Command().name("zoom").description("Capture a region
5819
5855
  const dir = "/tmp/computer-use";
5820
5856
  await mkdir(dir, { recursive: true });
5821
5857
  const timestamp = Date.now();
5822
- const filePath = join4(dir, `zoom-${timestamp}.${data.format}`);
5858
+ const filePath = join5(dir, `zoom-${timestamp}.${data.format}`);
5823
5859
  const buffer = Buffer.from(data.image, "base64");
5824
5860
  await writeFile(filePath, buffer);
5825
5861
  process.stdout.write(`${filePath}
@@ -6340,7 +6376,7 @@ function registerZeroCommands(prog, commands) {
6340
6376
  var program = new Command();
6341
6377
  program.name("zero").description(
6342
6378
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
6343
- ).version("9.116.1").addHelpText(
6379
+ ).version("9.116.3").addHelpText(
6344
6380
  "after",
6345
6381
  `
6346
6382
  Examples: