@vm0/cli 9.163.2 → 9.164.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/zero.js CHANGED
@@ -152,7 +152,7 @@ import {
152
152
  zeroAgentCustomSkillNameSchema,
153
153
  zeroLocalAgentCommand,
154
154
  zeroTokenAllowsFeatureSwitch
155
- } from "./chunk-ZIKDZRII.js";
155
+ } from "./chunk-OIM3MDB5.js";
156
156
  import {
157
157
  __toESM,
158
158
  init_esm_shims
@@ -7158,218 +7158,16 @@ init_esm_shims();
7158
7158
  // src/commands/zero/shared/image-generate.ts
7159
7159
  init_esm_shims();
7160
7160
  import { readFileSync as readFileSync13 } from "fs";
7161
- function readPrompt(options, usageCommand) {
7162
- if (options.prompt?.trim()) {
7163
- return options.prompt.trim();
7164
- }
7165
- if (process.stdin.isTTY === false) {
7166
- const prompt = readFileSync13("/dev/stdin", "utf8").trim();
7167
- if (prompt.length > 0) {
7168
- return prompt;
7169
- }
7170
- }
7171
- throw new Error("--prompt is required", {
7172
- cause: new Error(`Usage: ${usageCommand} --prompt "A watercolor fox"`)
7173
- });
7174
- }
7175
- function parseCompression(value) {
7176
- if (value === void 0) {
7177
- return void 0;
7178
- }
7179
- const compression = Number(value);
7180
- if (!Number.isInteger(compression) || compression < 0 || compression > 100) {
7181
- throw new Error("--compression must be an integer from 0 to 100");
7182
- }
7183
- return compression;
7184
- }
7185
- function parseSeed(value) {
7186
- const seed = Number(value);
7187
- if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {
7188
- throw new InvalidArgumentError("seed must be a non-negative safe integer");
7189
- }
7190
- return seed;
7191
- }
7192
- function collectString(value, previous) {
7193
- return [...previous, value];
7194
- }
7195
- function parseInputFidelity(value) {
7196
- if (value === void 0) {
7197
- return void 0;
7198
- }
7199
- if (value !== "low" && value !== "high") {
7200
- throw new Error("--input-fidelity must be low or high");
7201
- }
7202
- return value;
7203
- }
7204
- function parseImagePromptStrength(value) {
7205
- if (value === void 0) {
7206
- return void 0;
7207
- }
7208
- const strength = Number(value);
7209
- if (!Number.isFinite(strength) || strength < 0 || strength > 1) {
7210
- throw new Error("--image-prompt-strength must be a number from 0 to 1");
7211
- }
7212
- return strength;
7213
- }
7214
- function createImageGenerateCommand(config) {
7215
- 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(
7216
- "--model <model>",
7217
- "Model: gpt-image-1 (default), gpt-image-2, gpt-image-1.5, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, or seedream4",
7218
- "gpt-image-1"
7219
- ).option(
7220
- "--size <size>",
7221
- "Image size: auto or WIDTHxHEIGHT; support varies by model",
7222
- "1024x1024"
7223
- ).option(
7224
- "--quality <quality>",
7225
- "Image quality: low, medium, high, or auto",
7226
- "medium"
7227
- ).option(
7228
- "--background <background>",
7229
- "Background: auto, opaque, or transparent when supported",
7230
- "auto"
7231
- ).option("--format <format>", "Output format: png, webp, or jpeg", "png").option("--compression <0-100>", "Output compression for jpeg/webp only").option(
7232
- "--moderation <moderation>",
7233
- "Moderation strictness: auto or low",
7234
- "auto"
7235
- ).option("--seed <integer>", "Deterministic seed for fal models", parseSeed).option("--safety-tolerance <level>", "fal safety tolerance: 1-6", "4").option("--enhance-prompt", "Enable fal prompt enhancement when supported").option(
7236
- "--image-url <url>",
7237
- "Source/mockup image URL for image-to-image; repeat for multi-image edit models",
7238
- collectString,
7239
- []
7240
- ).option(
7241
- "--mask-image-url <url>",
7242
- "Mask image URL for supported edit models"
7243
- ).option(
7244
- "--input-fidelity <low|high>",
7245
- "Source-image fidelity for GPT edit models"
7246
- ).option(
7247
- "--image-prompt-strength <0-1>",
7248
- "Reference strength override for Flux Redux"
7249
- ).option("--json", "Print metadata as JSON").addHelpText(
7250
- "after",
7251
- `
7252
- Examples:
7253
- ${config.examples}
7254
-
7255
- Output:
7256
- Prints the generated /f/ image file URL and metadata
7257
-
7258
- Notes:
7259
- - Authenticates via ZERO_TOKEN (requires file:write capability)
7260
- - Charges org credits after successful image generation
7261
- - Uses fal.ai for all image model execution
7262
-
7263
- Models:
7264
- - fal.ai: gpt-image-1 (default), gpt-image-2, gpt-image-1.5,
7265
- gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image,
7266
- seedream4.
7267
- GPT Image models bill by fal output image quality and size.
7268
- Other fal generations bill by output image or rounded-up output
7269
- megapixel, depending on the model.
7270
-
7271
- Options:
7272
- - Prompt: required, up to 32,000 characters; stdin is supported.
7273
- - Size: gpt-image-2 accepts auto or WIDTHxHEIGHT. Popular sizes include
7274
- 1024x1024,
7275
- 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160,
7276
- and 2160x3840. Custom sizes must have edges <= 3840px, both
7277
- edges divisible by 16, long:short ratio <= 3:1, and total pixels
7278
- between 655,360 and 8,294,400. gpt-image-1.5, gpt-image-1, and
7279
- gpt-image-1-mini use auto, 1024x1024, 1536x1024, or 1024x1536.
7280
- - Quality: low, medium, high, or auto. Low is fastest for drafts.
7281
- - Background: auto, opaque, or transparent when supported. gpt-image-2,
7282
- Flux, Qwen, and Seedream do not support transparent backgrounds.
7283
- - Format: png, jpeg, or webp for GPT Image models; png or jpeg for the
7284
- other fal models.
7285
- - fal-only controls: --seed, --safety-tolerance for Flux, and
7286
- --enhance-prompt for flux-pro-1.1. --compression and --moderation low are
7287
- not supported on the fal-backed image path.
7288
- - Image-to-image: pass --image-url to use the model's fal edit/redux endpoint.
7289
- Flux Redux accepts --image-prompt-strength to override the provider
7290
- default; GPT edit models accept --input-fidelity and supported models
7291
- accept --mask-image-url.`
7292
- ).action(
7293
- withErrorHandler(async (options, command) => {
7294
- const prompt = readPrompt(options, config.usageCommand);
7295
- const compression = parseCompression(options.compression);
7296
- const inputFidelity = parseInputFidelity(options.inputFidelity);
7297
- const imagePromptStrength = parseImagePromptStrength(
7298
- options.imagePromptStrength
7299
- );
7300
- const hasSourceImage = options.imageUrl.length > 0;
7301
- const size = hasSourceImage && command.getOptionValueSource("size") === "default" ? "auto" : options.size;
7302
- const result = await generateWebImage({
7303
- prompt,
7304
- model: options.model,
7305
- size,
7306
- quality: options.quality,
7307
- background: options.background,
7308
- outputFormat: options.format,
7309
- outputCompression: compression,
7310
- moderation: options.moderation,
7311
- seed: options.seed,
7312
- safetyTolerance: options.safetyTolerance,
7313
- enhancePrompt: options.enhancePrompt,
7314
- imageUrls: options.imageUrl,
7315
- maskImageUrl: options.maskImageUrl,
7316
- inputFidelity,
7317
- imagePromptStrength
7318
- });
7319
- if (options.json) {
7320
- console.log(JSON.stringify(result));
7321
- return;
7322
- }
7323
- console.log(source_default.green(`\u2713 Image generated: ${result.url}`));
7324
- console.log(source_default.dim(` File: ${result.filename}`));
7325
- console.log(source_default.dim(` Size: ${result.imageSize}`));
7326
- console.log(source_default.dim(` Quality: ${result.quality}`));
7327
- console.log(source_default.dim(` Format: ${result.outputFormat}`));
7328
- if (result.outputCompression !== void 0) {
7329
- console.log(source_default.dim(` Compression: ${result.outputCompression}`));
7330
- }
7331
- if (result.moderation) {
7332
- console.log(source_default.dim(` Moderation: ${result.moderation}`));
7333
- }
7334
- if (result.safetyTolerance) {
7335
- console.log(
7336
- source_default.dim(` Safety tolerance: ${result.safetyTolerance}`)
7337
- );
7338
- }
7339
- if (result.seed !== void 0) {
7340
- console.log(source_default.dim(` Seed: ${result.seed}`));
7341
- }
7342
- console.log(source_default.dim(` Credits charged: ${result.creditsCharged}`));
7343
- console.log(source_default.dim(` Model: ${result.model}`));
7344
- console.log(source_default.dim(` Provider: ${result.provider}`));
7345
- })
7346
- );
7347
- }
7348
7161
 
7349
- // src/commands/zero/built-in/generate/image.ts
7350
- var imageCommand = createImageGenerateCommand({
7351
- name: "image",
7352
- usageCommand: "zero built-in generate image",
7353
- examples: ` Generate image: zero built-in generate image --prompt "A watercolor fox"
7354
- Pipe prompt: cat prompt.txt | zero built-in generate image
7355
- GPT Image model: zero built-in generate image --model gpt-image-1.5 --prompt "A poster" --size 1024x1536 --quality high
7356
- Flux model: zero built-in generate image --model flux-pro-1.1 --prompt "A product hero shot" --seed 42
7357
- Image-to-image: zero built-in generate image --model flux-pro-1.1 --image-url https://example.com/mockup.png --prompt "Turn this mockup into a polished product shot"`
7358
- });
7359
-
7360
- // src/commands/zero/built-in/generate/open-design-artifacts.ts
7162
+ // src/commands/zero/shared/image-style-authoring.ts
7361
7163
  init_esm_shims();
7362
7164
 
7363
- // src/commands/zero/shared/open-design-artifact-generate.ts
7364
- init_esm_shims();
7365
- import { readFileSync as readFileSync14 } from "fs";
7366
-
7367
7165
  // src/commands/zero/shared/open-design-registry.ts
7368
7166
  init_esm_shims();
7369
7167
  var OPEN_DESIGN_REPO = "vm0-ai/open-design";
7370
7168
  var OPEN_DESIGN_COMMIT = "d021b04720ace133f1d6133d1487326f5fc28f07";
7371
- var VM0_REPO = "vm0-ai/vm0";
7372
- var NOTION_ILLUSTRATION_COMMIT = "12d5aa42de4323c034cfb6e8005c69304dd510e5";
7169
+ var VM0_SKILLS_REPO = "vm0-ai/vm0-skills";
7170
+ var NOTION_ILLUSTRATION_COMMIT = "b35373eb12112b1e7a0caa372a5cafe02e214dd1";
7373
7171
  var OPEN_DESIGN_REGISTRY_VERSION = `federated:${OPEN_DESIGN_REPO}@${OPEN_DESIGN_COMMIT}`;
7374
7172
  function sourceRef(repo, commit, path) {
7375
7173
  return {
@@ -7644,11 +7442,11 @@ var OPEN_DESIGN_REGISTRY = [
7644
7442
  name: "Notion Illustration",
7645
7443
  description: "Zero-native illustration style for hand-drawn product spot illustrations with simple ink contours and soft backgrounds.",
7646
7444
  source: sourceRef(
7647
- VM0_REPO,
7445
+ VM0_SKILLS_REPO,
7648
7446
  NOTION_ILLUSTRATION_COMMIT,
7649
- ".claude/skills/notion-illustration"
7447
+ "notion-illustration"
7650
7448
  ),
7651
- targets: ["website", "poster", "presentation", "report"],
7449
+ targets: ["image", "website", "poster", "presentation", "report"],
7652
7450
  tags: ["image", "illustration", "notion", "spot", "hand-drawn", "product"],
7653
7451
  triggers: [
7654
7452
  "illustration",
@@ -7747,7 +7545,7 @@ function selectOpenDesignCandidates(options) {
7747
7545
  commit: OPEN_DESIGN_COMMIT
7748
7546
  },
7749
7547
  {
7750
- repo: VM0_REPO,
7548
+ repo: VM0_SKILLS_REPO,
7751
7549
  commit: NOTION_ILLUSTRATION_COMMIT
7752
7550
  }
7753
7551
  ],
@@ -7798,6 +7596,351 @@ function selectOpenDesignCandidates(options) {
7798
7596
  };
7799
7597
  }
7800
7598
 
7599
+ // src/commands/zero/shared/image-style-authoring.ts
7600
+ var outputDir = "./opendesign/images";
7601
+ var artifactRules = [
7602
+ "Select the image style that best matches the prompt before generation.",
7603
+ "Resolve the selected style source before generating the image.",
7604
+ "Use the style skill's referenced assets and generation path when it provides one.",
7605
+ "Produce a single final image file and keep any temporary metadata under the output directory."
7606
+ ];
7607
+ function createStyledImageAuthoringPacket(options) {
7608
+ const candidateSlice = selectOpenDesignCandidates({
7609
+ target: "image",
7610
+ prompt: [options.prompt, ...options.details, ...artifactRules].join("\n")
7611
+ });
7612
+ const selectionSchema = {
7613
+ imageStyle: "string",
7614
+ skills: "string[]",
7615
+ rationale: "string"
7616
+ };
7617
+ const artifact = {
7618
+ outputMode: "primary-image",
7619
+ primaryArtifact: {
7620
+ kind: "image",
7621
+ path: `${outputDir}/`
7622
+ },
7623
+ supportingAssets: [
7624
+ {
7625
+ kind: "metadata",
7626
+ path: `${outputDir}/metadata.json`,
7627
+ optional: true
7628
+ }
7629
+ ],
7630
+ previewKind: "image",
7631
+ outputDir
7632
+ };
7633
+ const instructions = [
7634
+ "# Zero built-in generate image --styled",
7635
+ "",
7636
+ "This is a federated generation resource-selection packet for the current agent.",
7637
+ "Zero is not generating this image on the server yet. You select resources, resolve them, and generate the styled image.",
7638
+ "",
7639
+ "## User Prompt",
7640
+ options.prompt,
7641
+ "",
7642
+ "## Stage 1: Resource Selection",
7643
+ "- Choose an image style from the bundled federated registry slice below.",
7644
+ "- Choose only IDs present in this packet; do not invent registry IDs.",
7645
+ "- Prefer image-style resources with matching triggers, but the user prompt is the highest-priority signal.",
7646
+ "- Treat the selection JSON as internal working state, then continue to generation.",
7647
+ "",
7648
+ "## Selection Output Schema",
7649
+ "```json",
7650
+ JSON.stringify(selectionSchema, null, 2),
7651
+ "```",
7652
+ "",
7653
+ "## Candidate Registry Slice",
7654
+ `Registry: \`${candidateSlice.registryVersion}\``,
7655
+ "",
7656
+ "```json",
7657
+ JSON.stringify(candidateSlice.candidates, null, 2),
7658
+ "```",
7659
+ "",
7660
+ "## Stage 2: Resolve Selected Resources",
7661
+ "- Fetch or read the selected resource source before generation.",
7662
+ "- Source refs are pinned as `repo@commit:path`; use the commit in the packet for reproducibility.",
7663
+ "- For directory refs, inspect the most relevant files such as `SKILL.md`, references, examples, and templates.",
7664
+ "- If a source file cannot be fetched, state that limitation and fall back to the registry metadata for that resource.",
7665
+ "",
7666
+ "## Stage 3: Generate Image",
7667
+ "- Generate one production-quality image using the selected style.",
7668
+ "- Follow the selected style skill's generation path when it defines one.",
7669
+ "- If the style skill delegates to a model or connector, use that flow directly instead of restating the style text manually.",
7670
+ "",
7671
+ "## Artifact Output Model",
7672
+ `- Primary artifact: \`${artifact.primaryArtifact.kind}\` under \`${artifact.primaryArtifact.path}\`.`,
7673
+ `- Output mode: \`${artifact.outputMode}\`.`,
7674
+ "- Supporting metadata may live inside the same output directory when useful.",
7675
+ "",
7676
+ "## Requested Parameters",
7677
+ ...options.details.map((detail) => {
7678
+ return `- ${detail}`;
7679
+ }),
7680
+ "",
7681
+ "## Image Authoring Rules",
7682
+ ...artifactRules.map((rule) => {
7683
+ return `- ${rule}`;
7684
+ }),
7685
+ "",
7686
+ "## Verification",
7687
+ "- Verify the final image exists and is nonblank.",
7688
+ "- Check that the selected style's required reference anchors or source assets were used when applicable.",
7689
+ "- Report the final image URL or path and the selected registry resource ID."
7690
+ ].join("\n");
7691
+ return {
7692
+ type: "open-design-resource-selection",
7693
+ kind: "image",
7694
+ prompt: options.prompt,
7695
+ registryVersion: candidateSlice.registryVersion,
7696
+ artifact,
7697
+ selection: {
7698
+ candidates: candidateSlice.candidates,
7699
+ outputSchema: selectionSchema
7700
+ },
7701
+ authoring: {
7702
+ details: options.details,
7703
+ artifactRules
7704
+ },
7705
+ outputDir,
7706
+ instructions
7707
+ };
7708
+ }
7709
+
7710
+ // src/commands/zero/shared/image-generate.ts
7711
+ function readPrompt(options, usageCommand) {
7712
+ if (options.prompt?.trim()) {
7713
+ return options.prompt.trim();
7714
+ }
7715
+ if (process.stdin.isTTY === false) {
7716
+ const prompt = readFileSync13("/dev/stdin", "utf8").trim();
7717
+ if (prompt.length > 0) {
7718
+ return prompt;
7719
+ }
7720
+ }
7721
+ throw new Error("--prompt is required", {
7722
+ cause: new Error(`Usage: ${usageCommand} --prompt "A watercolor fox"`)
7723
+ });
7724
+ }
7725
+ function parseCompression(value) {
7726
+ if (value === void 0) {
7727
+ return void 0;
7728
+ }
7729
+ const compression = Number(value);
7730
+ if (!Number.isInteger(compression) || compression < 0 || compression > 100) {
7731
+ throw new Error("--compression must be an integer from 0 to 100");
7732
+ }
7733
+ return compression;
7734
+ }
7735
+ function parseSeed(value) {
7736
+ const seed = Number(value);
7737
+ if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {
7738
+ throw new InvalidArgumentError("seed must be a non-negative safe integer");
7739
+ }
7740
+ return seed;
7741
+ }
7742
+ function collectString(value, previous) {
7743
+ return [...previous, value];
7744
+ }
7745
+ function parseInputFidelity(value) {
7746
+ if (value === void 0) {
7747
+ return void 0;
7748
+ }
7749
+ if (value !== "low" && value !== "high") {
7750
+ throw new Error("--input-fidelity must be low or high");
7751
+ }
7752
+ return value;
7753
+ }
7754
+ function parseImagePromptStrength(value) {
7755
+ if (value === void 0) {
7756
+ return void 0;
7757
+ }
7758
+ const strength = Number(value);
7759
+ if (!Number.isFinite(strength) || strength < 0 || strength > 1) {
7760
+ throw new Error("--image-prompt-strength must be a number from 0 to 1");
7761
+ }
7762
+ return strength;
7763
+ }
7764
+ function createImageGenerateCommand(config) {
7765
+ 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(
7766
+ "--model <model>",
7767
+ "Model: gpt-image-1 (default), gpt-image-2, gpt-image-1.5, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, or seedream4",
7768
+ "gpt-image-1"
7769
+ ).option(
7770
+ "--size <size>",
7771
+ "Image size: auto or WIDTHxHEIGHT; support varies by model",
7772
+ "1024x1024"
7773
+ ).option(
7774
+ "--quality <quality>",
7775
+ "Image quality: low, medium, high, or auto",
7776
+ "medium"
7777
+ ).option(
7778
+ "--background <background>",
7779
+ "Background: auto, opaque, or transparent when supported",
7780
+ "auto"
7781
+ ).option("--format <format>", "Output format: png, webp, or jpeg", "png").option("--compression <0-100>", "Output compression for jpeg/webp only").option(
7782
+ "--moderation <moderation>",
7783
+ "Moderation strictness: auto or low",
7784
+ "auto"
7785
+ ).option("--seed <integer>", "Deterministic seed for fal models", parseSeed).option("--safety-tolerance <level>", "fal safety tolerance: 1-6", "4").option("--enhance-prompt", "Enable fal prompt enhancement when supported").option(
7786
+ "--image-url <url>",
7787
+ "Source/mockup image URL for image-to-image; repeat for multi-image edit models",
7788
+ collectString,
7789
+ []
7790
+ ).option(
7791
+ "--mask-image-url <url>",
7792
+ "Mask image URL for supported edit models"
7793
+ ).option(
7794
+ "--input-fidelity <low|high>",
7795
+ "Source-image fidelity for GPT edit models"
7796
+ ).option(
7797
+ "--image-prompt-strength <0-1>",
7798
+ "Reference strength override for Flux Redux"
7799
+ ).option(
7800
+ "--styled",
7801
+ "Print a resource-selection packet for styled image generation"
7802
+ ).option("--json", "Print metadata as JSON").addHelpText(
7803
+ "after",
7804
+ `
7805
+ Examples:
7806
+ ${config.examples}
7807
+
7808
+ Output:
7809
+ Prints the generated /f/ image file URL and metadata. With --styled, prints
7810
+ an Open Design resource-selection packet for the current agent.
7811
+
7812
+ Notes:
7813
+ - Authenticates via ZERO_TOKEN (requires file:write capability)
7814
+ - Charges org credits after successful image generation
7815
+ - Uses fal.ai for all image model execution
7816
+
7817
+ Models:
7818
+ - fal.ai: gpt-image-1 (default), gpt-image-2, gpt-image-1.5,
7819
+ gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image,
7820
+ seedream4.
7821
+ GPT Image models bill by fal output image quality and size.
7822
+ Other fal generations bill by output image or rounded-up output
7823
+ megapixel, depending on the model.
7824
+
7825
+ Options:
7826
+ - Prompt: required, up to 32,000 characters; stdin is supported.
7827
+ - Size: gpt-image-2 accepts auto or WIDTHxHEIGHT. Popular sizes include
7828
+ 1024x1024,
7829
+ 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160,
7830
+ and 2160x3840. Custom sizes must have edges <= 3840px, both
7831
+ edges divisible by 16, long:short ratio <= 3:1, and total pixels
7832
+ between 655,360 and 8,294,400. gpt-image-1.5, gpt-image-1, and
7833
+ gpt-image-1-mini use auto, 1024x1024, 1536x1024, or 1024x1536.
7834
+ - Quality: low, medium, high, or auto. Low is fastest for drafts.
7835
+ - Background: auto, opaque, or transparent when supported. gpt-image-2,
7836
+ Flux, Qwen, and Seedream do not support transparent backgrounds.
7837
+ - Format: png, jpeg, or webp for GPT Image models; png or jpeg for the
7838
+ other fal models.
7839
+ - fal-only controls: --seed, --safety-tolerance for Flux, and
7840
+ --enhance-prompt for flux-pro-1.1. --compression and --moderation low are
7841
+ not supported on the fal-backed image path.
7842
+ - Image-to-image: pass --image-url to use the model's fal edit/redux endpoint.
7843
+ Flux Redux accepts --image-prompt-strength to override the provider
7844
+ default; GPT edit models accept --input-fidelity and supported models
7845
+ accept --mask-image-url.
7846
+ - Styled mode: pass --styled to select an image style resource first. In this
7847
+ mode the agent resolves the selected style source and generates the image.`
7848
+ ).action(
7849
+ withErrorHandler(async (options, command) => {
7850
+ const prompt = readPrompt(options, config.usageCommand);
7851
+ if (options.styled) {
7852
+ const packet = createStyledImageAuthoringPacket({
7853
+ prompt,
7854
+ details: [
7855
+ `Model preference if direct image generation is used: ${options.model}`,
7856
+ `Requested size: ${options.size}`,
7857
+ `Requested quality: ${options.quality}`,
7858
+ `Requested background: ${options.background}`,
7859
+ `Requested format: ${options.format}`,
7860
+ `Source image URLs: ${options.imageUrl.length > 0 ? options.imageUrl.join(", ") : "none"}`,
7861
+ `Mask image URL: ${options.maskImageUrl ?? "none"}`
7862
+ ]
7863
+ });
7864
+ if (options.json) {
7865
+ console.log(JSON.stringify(packet));
7866
+ return;
7867
+ }
7868
+ console.log(packet.instructions);
7869
+ return;
7870
+ }
7871
+ const compression = parseCompression(options.compression);
7872
+ const inputFidelity = parseInputFidelity(options.inputFidelity);
7873
+ const imagePromptStrength = parseImagePromptStrength(
7874
+ options.imagePromptStrength
7875
+ );
7876
+ const hasSourceImage = options.imageUrl.length > 0;
7877
+ const size = hasSourceImage && command.getOptionValueSource("size") === "default" ? "auto" : options.size;
7878
+ const result = await generateWebImage({
7879
+ prompt,
7880
+ model: options.model,
7881
+ size,
7882
+ quality: options.quality,
7883
+ background: options.background,
7884
+ outputFormat: options.format,
7885
+ outputCompression: compression,
7886
+ moderation: options.moderation,
7887
+ seed: options.seed,
7888
+ safetyTolerance: options.safetyTolerance,
7889
+ enhancePrompt: options.enhancePrompt,
7890
+ imageUrls: options.imageUrl,
7891
+ maskImageUrl: options.maskImageUrl,
7892
+ inputFidelity,
7893
+ imagePromptStrength
7894
+ });
7895
+ if (options.json) {
7896
+ console.log(JSON.stringify(result));
7897
+ return;
7898
+ }
7899
+ console.log(source_default.green(`\u2713 Image generated: ${result.url}`));
7900
+ console.log(source_default.dim(` File: ${result.filename}`));
7901
+ console.log(source_default.dim(` Size: ${result.imageSize}`));
7902
+ console.log(source_default.dim(` Quality: ${result.quality}`));
7903
+ console.log(source_default.dim(` Format: ${result.outputFormat}`));
7904
+ if (result.outputCompression !== void 0) {
7905
+ console.log(source_default.dim(` Compression: ${result.outputCompression}`));
7906
+ }
7907
+ if (result.moderation) {
7908
+ console.log(source_default.dim(` Moderation: ${result.moderation}`));
7909
+ }
7910
+ if (result.safetyTolerance) {
7911
+ console.log(
7912
+ source_default.dim(` Safety tolerance: ${result.safetyTolerance}`)
7913
+ );
7914
+ }
7915
+ if (result.seed !== void 0) {
7916
+ console.log(source_default.dim(` Seed: ${result.seed}`));
7917
+ }
7918
+ console.log(source_default.dim(` Credits charged: ${result.creditsCharged}`));
7919
+ console.log(source_default.dim(` Model: ${result.model}`));
7920
+ console.log(source_default.dim(` Provider: ${result.provider}`));
7921
+ })
7922
+ );
7923
+ }
7924
+
7925
+ // src/commands/zero/built-in/generate/image.ts
7926
+ var imageCommand = createImageGenerateCommand({
7927
+ name: "image",
7928
+ usageCommand: "zero built-in generate image",
7929
+ examples: ` Generate image: zero built-in generate image --prompt "A watercolor fox"
7930
+ Pipe prompt: cat prompt.txt | zero built-in generate image
7931
+ Styled image: zero built-in generate image --styled --prompt "A product manager mapping a launch plan"
7932
+ GPT Image model: zero built-in generate image --model gpt-image-1.5 --prompt "A poster" --size 1024x1536 --quality high
7933
+ Flux model: zero built-in generate image --model flux-pro-1.1 --prompt "A product hero shot" --seed 42
7934
+ Image-to-image: zero built-in generate image --model flux-pro-1.1 --image-url https://example.com/mockup.png --prompt "Turn this mockup into a polished product shot"`
7935
+ });
7936
+
7937
+ // src/commands/zero/built-in/generate/open-design-artifacts.ts
7938
+ init_esm_shims();
7939
+
7940
+ // src/commands/zero/shared/open-design-artifact-generate.ts
7941
+ init_esm_shims();
7942
+ import { readFileSync as readFileSync14 } from "fs";
7943
+
7801
7944
  // src/commands/zero/shared/html-artifact-authoring.ts
7802
7945
  init_esm_shims();
7803
7946
  function slugify(value) {
@@ -7806,6 +7949,7 @@ function slugify(value) {
7806
7949
  }
7807
7950
  function titleForKind(kind) {
7808
7951
  const titles = {
7952
+ image: "image",
7809
7953
  presentation: "HTML presentation",
7810
7954
  website: "hosted website",
7811
7955
  "dashboard-design": "dashboard design prototype",
@@ -7822,8 +7966,8 @@ function outputDirForSite(site) {
7822
7966
  }
7823
7967
  function createHtmlArtifactAuthoringPacket(options) {
7824
7968
  const site = options.site ?? slugify(options.slugSource ?? options.prompt);
7825
- const outputDir = outputDirForSite(site);
7826
- const hostCommand = `zero host ${outputDir} --site ${site}${options.kind === "website" ? " --spa" : ""}`;
7969
+ const outputDir2 = outputDirForSite(site);
7970
+ const hostCommand = `zero host ${outputDir2} --site ${site}${options.kind === "website" ? " --spa" : ""}`;
7827
7971
  const title = titleForKind(options.kind);
7828
7972
  const candidateSlice = selectOpenDesignCandidates({
7829
7973
  target: options.kind,
@@ -7848,32 +7992,32 @@ function createHtmlArtifactAuthoringPacket(options) {
7848
7992
  outputMode: "primary-artifact-with-supporting-assets",
7849
7993
  primaryArtifact: {
7850
7994
  kind: options.kind,
7851
- path: `${outputDir}/index.html`
7995
+ path: `${outputDir2}/index.html`
7852
7996
  },
7853
7997
  supportingAssets: [
7854
7998
  {
7855
7999
  kind: "image",
7856
- path: `${outputDir}/assets/`,
8000
+ path: `${outputDir2}/assets/`,
7857
8001
  optional: true
7858
8002
  },
7859
8003
  {
7860
8004
  kind: "audio",
7861
- path: `${outputDir}/assets/`,
8005
+ path: `${outputDir2}/assets/`,
7862
8006
  optional: true
7863
8007
  },
7864
8008
  {
7865
8009
  kind: "video",
7866
- path: `${outputDir}/assets/`,
8010
+ path: `${outputDir2}/assets/`,
7867
8011
  optional: true
7868
8012
  },
7869
8013
  {
7870
8014
  kind: "metadata",
7871
- path: `${outputDir}/metadata.json`,
8015
+ path: `${outputDir2}/metadata.json`,
7872
8016
  optional: true
7873
8017
  }
7874
8018
  ],
7875
8019
  previewKind: "hosted-url",
7876
- outputDir
8020
+ outputDir: outputDir2
7877
8021
  };
7878
8022
  const instructions = [
7879
8023
  `# Zero built-in generate ${options.kind}`,
@@ -7919,8 +8063,8 @@ function createHtmlArtifactAuthoringPacket(options) {
7919
8063
  "- Treat the output directory as a project bundle when multiple media types are generated, while keeping the HTML entry point primary.",
7920
8064
  "",
7921
8065
  "## Output Contract",
7922
- `- Write the artifact under \`${outputDir}/\`.`,
7923
- `- The entry file must be \`${outputDir}/index.html\`.`,
8066
+ `- Write the artifact under \`${outputDir2}/\`.`,
8067
+ `- The entry file must be \`${outputDir2}/index.html\`.`,
7924
8068
  "- Keep every local asset inside the same output directory.",
7925
8069
  "- Do not reference files from another project path.",
7926
8070
  "- Use descriptive filenames and canonical HTML: close non-void tags and double-quote attributes.",
@@ -7971,7 +8115,7 @@ function createHtmlArtifactAuthoringPacket(options) {
7971
8115
  details: options.details,
7972
8116
  artifactRules: options.artifactRules
7973
8117
  },
7974
- outputDir,
8118
+ outputDir: outputDir2,
7975
8119
  site,
7976
8120
  hostCommand,
7977
8121
  instructions
@@ -9899,7 +10043,7 @@ function registerZeroCommands(prog, commands) {
9899
10043
  var program = new Command();
9900
10044
  program.name("zero").description(
9901
10045
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
9902
- ).version("9.163.2").addHelpText("after", () => {
10046
+ ).version("9.164.0").addHelpText("after", () => {
9903
10047
  return buildZeroHelpText();
9904
10048
  });
9905
10049
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {