@bunny-agent/runner-cli 0.9.33 → 0.9.34

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.
Files changed (2) hide show
  1. package/dist/bundle.mjs +86 -14
  2. package/package.json +5 -5
package/dist/bundle.mjs CHANGED
@@ -1429,6 +1429,33 @@ var generateImageSchema = {
1429
1429
  required: ["prompt"],
1430
1430
  additionalProperties: false
1431
1431
  };
1432
+ var hasImagePayload = (item) => Boolean(item.b64_json ?? item.b64Json ?? item.image_base64 ?? item.imageBase64 ?? item.base64 ?? item.data ?? item.inlineData?.data ?? item.inline_data?.data ?? item.url ?? item.image_url ?? item.imageUrl ?? (typeof item.image === "string" ? item.image : item.image?.b64_json ?? item.image?.base64 ?? item.image?.data ?? item.image?.url));
1433
+ function readString(value) {
1434
+ return typeof value === "string" && value.length > 0 ? value : void 0;
1435
+ }
1436
+ function readInlineData(value) {
1437
+ if (!value || typeof value !== "object")
1438
+ return void 0;
1439
+ const obj = value;
1440
+ return {
1441
+ data: readString(obj.data),
1442
+ mimeType: readString(obj.mimeType),
1443
+ mime_type: readString(obj.mime_type)
1444
+ };
1445
+ }
1446
+ function readImage(value) {
1447
+ if (typeof value === "string" && value.length > 0)
1448
+ return value;
1449
+ if (!value || typeof value !== "object")
1450
+ return void 0;
1451
+ const obj = value;
1452
+ return {
1453
+ base64: readString(obj.base64),
1454
+ b64_json: readString(obj.b64_json),
1455
+ url: readString(obj.url),
1456
+ data: readString(obj.data)
1457
+ };
1458
+ }
1432
1459
  async function resolveB64(item, apiKey) {
1433
1460
  if (item.b64_json)
1434
1461
  return item.b64_json;
@@ -1440,12 +1467,20 @@ async function resolveB64(item, apiKey) {
1440
1467
  return item.imageBase64;
1441
1468
  if (item.base64)
1442
1469
  return item.base64;
1470
+ if (item.data)
1471
+ return item.data;
1472
+ if (item.inlineData?.data)
1473
+ return item.inlineData.data;
1474
+ if (item.inline_data?.data)
1475
+ return item.inline_data.data;
1443
1476
  if (typeof item.image === "string")
1444
1477
  return item.image;
1445
1478
  if (item.image?.b64_json)
1446
1479
  return item.image.b64_json;
1447
1480
  if (item.image?.base64)
1448
1481
  return item.image.base64;
1482
+ if (item.image?.data)
1483
+ return item.image.data;
1449
1484
  const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
1450
1485
  if (url) {
1451
1486
  const headers = {};
@@ -1463,16 +1498,24 @@ function pickImageItem(response) {
1463
1498
  if (!value || typeof value !== "object")
1464
1499
  return void 0;
1465
1500
  const obj = value;
1501
+ const image = readImage(obj.image);
1502
+ const inlineData = readInlineData(obj.inlineData);
1503
+ const inline_data = readInlineData(obj.inline_data);
1466
1504
  return {
1467
- b64_json: obj.b64_json ?? obj.b64Json,
1468
- b64Json: obj.b64Json,
1469
- url: obj.url ?? obj.imageUrl,
1470
- image_base64: obj.image_base64 ?? obj.imageBase64,
1471
- imageBase64: obj.imageBase64,
1472
- image_url: obj.image_url ?? obj.imageUrl,
1473
- imageUrl: obj.imageUrl,
1474
- base64: obj.base64,
1475
- image: obj.image
1505
+ b64_json: readString(obj.b64_json) ?? readString(obj.b64Json),
1506
+ b64Json: readString(obj.b64Json),
1507
+ url: readString(obj.url) ?? readString(obj.imageUrl),
1508
+ image_base64: readString(obj.image_base64) ?? readString(obj.imageBase64),
1509
+ imageBase64: readString(obj.imageBase64),
1510
+ image_url: readString(obj.image_url) ?? readString(obj.imageUrl),
1511
+ imageUrl: readString(obj.imageUrl),
1512
+ base64: readString(obj.base64),
1513
+ data: readString(obj.data),
1514
+ mimeType: readString(obj.mimeType),
1515
+ mime_type: readString(obj.mime_type),
1516
+ inlineData,
1517
+ inline_data,
1518
+ image
1476
1519
  };
1477
1520
  };
1478
1521
  const asItem = (value) => {
@@ -1483,7 +1526,7 @@ function pickImageItem(response) {
1483
1526
  }
1484
1527
  if (typeof value === "object") {
1485
1528
  const normalized = tryFromObject(value);
1486
- if (normalized)
1529
+ if (normalized && hasImagePayload(normalized))
1487
1530
  return normalized;
1488
1531
  }
1489
1532
  return void 0;
@@ -1526,8 +1569,7 @@ function pickImageItem(response) {
1526
1569
  continue;
1527
1570
  const normalized = tryFromObject(current);
1528
1571
  if (normalized) {
1529
- const hasUsefulField = Boolean(normalized.b64_json ?? normalized.b64Json ?? normalized.image_base64 ?? normalized.imageBase64 ?? normalized.base64 ?? normalized.url ?? normalized.image_url ?? normalized.imageUrl ?? (typeof normalized.image === "string" ? normalized.image : normalized.image?.b64_json ?? normalized.image?.base64 ?? normalized.image?.url));
1530
- if (hasUsefulField)
1572
+ if (hasImagePayload(normalized))
1531
1573
  return normalized;
1532
1574
  }
1533
1575
  if (Array.isArray(current)) {
@@ -1672,6 +1714,27 @@ var editImageSchema = {
1672
1714
  type: "string",
1673
1715
  enum: ["low", "medium", "high", "auto"],
1674
1716
  description: "Image quality. Optional; omit or set auto to let model decide."
1717
+ },
1718
+ aspectRatio: {
1719
+ type: "string",
1720
+ enum: [
1721
+ "1:1",
1722
+ "3:2",
1723
+ "2:3",
1724
+ "3:4",
1725
+ "4:3",
1726
+ "4:5",
1727
+ "5:4",
1728
+ "9:16",
1729
+ "16:9",
1730
+ "21:9"
1731
+ ],
1732
+ description: "Gemini image aspect ratio. Use this instead of size for Gemini image edit models when exact proportions matter."
1733
+ },
1734
+ imageSize: {
1735
+ type: "string",
1736
+ enum: ["1K", "2K", "4K"],
1737
+ description: "Gemini output resolution for image edit models that support K-resolution output."
1675
1738
  }
1676
1739
  },
1677
1740
  required: ["image", "prompt"],
@@ -1708,12 +1771,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
1708
1771
  name: "edit_image",
1709
1772
  label: "edit image",
1710
1773
  description: "Edit an existing image based on a text prompt. Optionally use a mask to control which areas to modify. Saves the result to disk and returns the file path.",
1711
- promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?) - edit an existing image",
1774
+ promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?, aspectRatio?, imageSize?) - edit an existing image",
1712
1775
  promptGuidelines: [
1713
1776
  "Use edit_image when the user wants to modify, retouch, or transform an existing image.",
1714
1777
  "The prompt should describe the full desired final image, not just the change.",
1715
1778
  "Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
1716
- "Without a mask, the model decides what to change based on the prompt."
1779
+ "Without a mask, the model decides what to change based on the prompt.",
1780
+ "For Gemini image edit models, use aspectRatio and imageSize when the user asks for those controls."
1717
1781
  ],
1718
1782
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
1719
1783
  parameters: editImageSchema,
@@ -1726,6 +1790,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
1726
1790
  const maskPath = p.mask;
1727
1791
  const size = p.size;
1728
1792
  const quality = p.quality;
1793
+ const aspectRatio = p.aspectRatio;
1794
+ const imageSize = p.imageSize;
1729
1795
  const rawFilename = p.filename;
1730
1796
  const safePrompt = buildPolicySafeEditPrompt(prompt);
1731
1797
  const resolvedImage = resolve4(cwd, imagePath);
@@ -1757,6 +1823,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
1757
1823
  if (quality && quality !== "auto") {
1758
1824
  fields.push({ name: "quality", value: quality });
1759
1825
  }
1826
+ if (aspectRatio) {
1827
+ fields.push({ name: "aspect_ratio", value: aspectRatio });
1828
+ }
1829
+ if (imageSize) {
1830
+ fields.push({ name: "image_size", value: imageSize });
1831
+ }
1760
1832
  const files = [
1761
1833
  {
1762
1834
  name: "image",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunny-agent/runner-cli",
3
- "version": "0.9.33",
3
+ "version": "0.9.34",
4
4
  "description": "BunnyAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,11 +54,11 @@
54
54
  "typescript": "^5.3.0",
55
55
  "vitest": "^1.6.1",
56
56
  "@bunny-agent/runner-harness": "0.1.1-beta.0",
57
- "@bunny-agent/runner-claude": "0.6.2",
58
- "@bunny-agent/runner-codex": "0.6.2",
59
- "@bunny-agent/runner-gemini": "0.6.2",
60
57
  "@bunny-agent/runner-opencode": "0.6.2",
61
- "@bunny-agent/runner-pi": "0.6.4-beta.0"
58
+ "@bunny-agent/runner-pi": "0.6.4-beta.0",
59
+ "@bunny-agent/runner-codex": "0.6.2",
60
+ "@bunny-agent/runner-claude": "0.6.2",
61
+ "@bunny-agent/runner-gemini": "0.6.2"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "tsc && pnpm bundle",