@vm0/cli 9.143.0 → 9.144.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.143.0",
3
+ "version": "9.144.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  enableZeroSchedule,
36
36
  extractSecretNamesFromApis,
37
37
  findMatchingPermissions,
38
+ generateWebImage,
38
39
  generateWebVoice,
39
40
  getActiveOrg,
40
41
  getApiUrl,
@@ -127,7 +128,7 @@ import {
127
128
  upsertZeroOrgModelProvider,
128
129
  withErrorHandler,
129
130
  zeroAgentCustomSkillNameSchema
130
- } from "./chunk-FEQSPUBX.js";
131
+ } from "./chunk-CFIYV4PA.js";
131
132
  import {
132
133
  __toESM,
133
134
  init_esm_shims
@@ -2726,6 +2727,9 @@ How connectors work:
2726
2727
  // src/commands/zero/doctor/generate.ts
2727
2728
  init_esm_shims();
2728
2729
  var BUILT_IN_GENERATION_OPTIONS = {
2730
+ image: {
2731
+ description: "If the user did not explicitly request a specific connector or provider, you can use the official generation capability. Run `zero official generate image -h` for options."
2732
+ },
2729
2733
  voice: {
2730
2734
  description: "If the user did not explicitly request a specific connector or provider, you can use the official generation capability. Run `zero official generate voice -h` for options."
2731
2735
  }
@@ -7133,18 +7137,98 @@ init_esm_shims();
7133
7137
  // src/commands/zero/official/generate/index.ts
7134
7138
  init_esm_shims();
7135
7139
 
7140
+ // src/commands/zero/official/generate/image.ts
7141
+ init_esm_shims();
7142
+
7143
+ // src/commands/zero/shared/image-generate.ts
7144
+ init_esm_shims();
7145
+ import { readFileSync as readFileSync10 } from "fs";
7146
+ function readPrompt(options, usageCommand) {
7147
+ if (options.prompt?.trim()) {
7148
+ return options.prompt.trim();
7149
+ }
7150
+ if (process.stdin.isTTY === false) {
7151
+ const prompt = readFileSync10("/dev/stdin", "utf8").trim();
7152
+ if (prompt.length > 0) {
7153
+ return prompt;
7154
+ }
7155
+ }
7156
+ throw new Error("--prompt is required", {
7157
+ cause: new Error(`Usage: ${usageCommand} --prompt "A watercolor fox"`)
7158
+ });
7159
+ }
7160
+ function createImageGenerateCommand(config) {
7161
+ return new Command().name(config.name).description("Generate a billed image file from a prompt").option("--prompt <text>", "Image prompt; can also be piped via stdin").option(
7162
+ "--size <size>",
7163
+ "Image size: 1024x1024, 1024x1536, or 1536x1024",
7164
+ "1024x1024"
7165
+ ).option(
7166
+ "--quality <quality>",
7167
+ "Image quality: low, medium, high, or auto",
7168
+ "medium"
7169
+ ).option(
7170
+ "--background <background>",
7171
+ "Background: auto, opaque, or transparent",
7172
+ "auto"
7173
+ ).option("--format <format>", "Output format: png, webp, or jpeg", "png").option("--json", "Print metadata as JSON").addHelpText(
7174
+ "after",
7175
+ `
7176
+ Examples:
7177
+ ${config.examples}
7178
+
7179
+ Output:
7180
+ Prints the generated /f/ image file URL and metadata
7181
+
7182
+ Notes:
7183
+ - Authenticates via ZERO_TOKEN (requires file:write capability)
7184
+ - Charges org credits after successful image generation
7185
+ - Uses OpenAI gpt-image-2 and bills returned usage tokens`
7186
+ ).action(
7187
+ withErrorHandler(async (options) => {
7188
+ const prompt = readPrompt(options, config.usageCommand);
7189
+ const result = await generateWebImage({
7190
+ prompt,
7191
+ size: options.size,
7192
+ quality: options.quality,
7193
+ background: options.background,
7194
+ outputFormat: options.format
7195
+ });
7196
+ if (options.json) {
7197
+ console.log(JSON.stringify(result));
7198
+ return;
7199
+ }
7200
+ console.log(source_default.green(`\u2713 Image generated: ${result.url}`));
7201
+ console.log(source_default.dim(` File: ${result.filename}`));
7202
+ console.log(source_default.dim(` Size: ${result.imageSize}`));
7203
+ console.log(source_default.dim(` Quality: ${result.quality}`));
7204
+ console.log(source_default.dim(` Format: ${result.outputFormat}`));
7205
+ console.log(source_default.dim(` Credits charged: ${result.creditsCharged}`));
7206
+ console.log(source_default.dim(` Model: ${result.model}`));
7207
+ })
7208
+ );
7209
+ }
7210
+
7211
+ // src/commands/zero/official/generate/image.ts
7212
+ var imageCommand = createImageGenerateCommand({
7213
+ name: "image",
7214
+ usageCommand: "zero official generate image",
7215
+ examples: ` Generate image: zero official generate image --prompt "A watercolor fox"
7216
+ Pipe prompt: cat prompt.txt | zero official generate image
7217
+ Pick size/quality: zero official generate image --prompt "A poster" --size 1024x1536 --quality high`
7218
+ });
7219
+
7136
7220
  // src/commands/zero/official/generate/voice.ts
7137
7221
  init_esm_shims();
7138
7222
 
7139
7223
  // src/commands/zero/shared/voice-generate.ts
7140
7224
  init_esm_shims();
7141
- import { readFileSync as readFileSync10 } from "fs";
7225
+ import { readFileSync as readFileSync11 } from "fs";
7142
7226
  function readText(options, usageCommand) {
7143
7227
  if (options.text?.trim()) {
7144
7228
  return options.text.trim();
7145
7229
  }
7146
7230
  if (process.stdin.isTTY === false) {
7147
- const text = readFileSync10("/dev/stdin", "utf8").trim();
7231
+ const text = readFileSync11("/dev/stdin", "utf8").trim();
7148
7232
  if (text.length > 0) {
7149
7233
  return text;
7150
7234
  }
@@ -7199,10 +7283,11 @@ var voiceCommand = createVoiceGenerateCommand({
7199
7283
  });
7200
7284
 
7201
7285
  // src/commands/zero/official/generate/index.ts
7202
- var generateCommand2 = new Command().name("generate").description("Generate assets with official Zero services").addCommand(voiceCommand).addHelpText(
7286
+ var generateCommand2 = new Command().name("generate").description("Generate assets with official Zero services").addCommand(imageCommand).addCommand(voiceCommand).addHelpText(
7203
7287
  "after",
7204
7288
  `
7205
7289
  Examples:
7290
+ Generate image: zero official generate image --prompt "A watercolor fox"
7206
7291
  Generate speech: zero official generate voice --text "Hello"`
7207
7292
  );
7208
7293
 
@@ -7211,6 +7296,7 @@ var zeroOfficialCommand = new Command().name("official").description("Use offici
7211
7296
  "after",
7212
7297
  `
7213
7298
  Examples:
7299
+ Generate image: zero official generate image --prompt "A watercolor fox"
7214
7300
  Generate speech: zero official generate voice --text "Hello"`
7215
7301
  );
7216
7302
 
@@ -7364,7 +7450,7 @@ function registerZeroCommands(prog, commands) {
7364
7450
  var program = new Command();
7365
7451
  program.name("zero").description(
7366
7452
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
7367
- ).version("9.143.0").addHelpText(
7453
+ ).version("9.144.1").addHelpText(
7368
7454
  "after",
7369
7455
  `
7370
7456
  Examples:
@@ -7377,6 +7463,7 @@ Examples:
7377
7463
  Set up a schedule? zero schedule setup --help
7378
7464
  Update yourself? zero agent --help
7379
7465
  Manage custom skills? zero skill --help
7466
+ Generate image? zero official generate image --help
7380
7467
  Generate voice? zero official generate voice --help
7381
7468
  Check your identity? zero whoami`
7382
7469
  );