@bunny-agent/daemon 0.9.32 → 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.
package/dist/bundle.mjs CHANGED
@@ -288994,20 +288994,37 @@ var generateImageSchema = {
288994
288994
  size: {
288995
288995
  type: "string",
288996
288996
  enum: [
288997
+ "auto",
288998
+ "1024x1024",
288999
+ "1536x1024",
289000
+ "1024x1536",
288997
289001
  "256x256",
288998
289002
  "512x512",
288999
- "1024x1024",
289000
289003
  "1792x1024",
289001
- "1024x1792",
289002
- "1280x1280",
289003
- "1568x1056",
289004
- "1056x1568",
289005
- "1472x1088",
289006
- "1088x1472",
289007
- "1728x960",
289008
- "960x1728"
289004
+ "1024x1792"
289009
289005
  ],
289010
- description: "Image dimensions. Common: 1024x1024 (square), 1280x1280, 1568x1056 (landscape), 1056x1568 (portrait), 1728x960 (wide), 960x1728 (tall)."
289006
+ description: "Image dimensions. Supported values: auto, 1024x1024, 1536x1024, 1024x1536, 256x256, 512x512, 1792x1024, 1024x1792."
289007
+ },
289008
+ aspectRatio: {
289009
+ type: "string",
289010
+ enum: [
289011
+ "1:1",
289012
+ "3:2",
289013
+ "2:3",
289014
+ "3:4",
289015
+ "4:3",
289016
+ "4:5",
289017
+ "5:4",
289018
+ "9:16",
289019
+ "16:9",
289020
+ "21:9"
289021
+ ],
289022
+ description: "Image aspect ratio. Use this instead of size for models that support it when exact proportions matter. Supported values: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9."
289023
+ },
289024
+ imageSize: {
289025
+ type: "string",
289026
+ enum: ["1K", "2K", "4K"],
289027
+ description: "Image resolution for models that support K-resolution output. Use this for requests like 2K or 4K."
289011
289028
  },
289012
289029
  quality: {
289013
289030
  type: "string",
@@ -289018,6 +289035,33 @@ var generateImageSchema = {
289018
289035
  required: ["prompt"],
289019
289036
  additionalProperties: false
289020
289037
  };
289038
+ 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));
289039
+ function readString(value2) {
289040
+ return typeof value2 === "string" && value2.length > 0 ? value2 : void 0;
289041
+ }
289042
+ function readInlineData(value2) {
289043
+ if (!value2 || typeof value2 !== "object")
289044
+ return void 0;
289045
+ const obj = value2;
289046
+ return {
289047
+ data: readString(obj.data),
289048
+ mimeType: readString(obj.mimeType),
289049
+ mime_type: readString(obj.mime_type)
289050
+ };
289051
+ }
289052
+ function readImage(value2) {
289053
+ if (typeof value2 === "string" && value2.length > 0)
289054
+ return value2;
289055
+ if (!value2 || typeof value2 !== "object")
289056
+ return void 0;
289057
+ const obj = value2;
289058
+ return {
289059
+ base64: readString(obj.base64),
289060
+ b64_json: readString(obj.b64_json),
289061
+ url: readString(obj.url),
289062
+ data: readString(obj.data)
289063
+ };
289064
+ }
289021
289065
  async function resolveB64(item, apiKey) {
289022
289066
  if (item.b64_json)
289023
289067
  return item.b64_json;
@@ -289029,12 +289073,20 @@ async function resolveB64(item, apiKey) {
289029
289073
  return item.imageBase64;
289030
289074
  if (item.base64)
289031
289075
  return item.base64;
289076
+ if (item.data)
289077
+ return item.data;
289078
+ if (item.inlineData?.data)
289079
+ return item.inlineData.data;
289080
+ if (item.inline_data?.data)
289081
+ return item.inline_data.data;
289032
289082
  if (typeof item.image === "string")
289033
289083
  return item.image;
289034
289084
  if (item.image?.b64_json)
289035
289085
  return item.image.b64_json;
289036
289086
  if (item.image?.base64)
289037
289087
  return item.image.base64;
289088
+ if (item.image?.data)
289089
+ return item.image.data;
289038
289090
  const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
289039
289091
  if (url) {
289040
289092
  const headers = {};
@@ -289052,16 +289104,24 @@ function pickImageItem(response) {
289052
289104
  if (!value2 || typeof value2 !== "object")
289053
289105
  return void 0;
289054
289106
  const obj = value2;
289107
+ const image = readImage(obj.image);
289108
+ const inlineData = readInlineData(obj.inlineData);
289109
+ const inline_data = readInlineData(obj.inline_data);
289055
289110
  return {
289056
- b64_json: obj.b64_json ?? obj.b64Json,
289057
- b64Json: obj.b64Json,
289058
- url: obj.url ?? obj.imageUrl,
289059
- image_base64: obj.image_base64 ?? obj.imageBase64,
289060
- imageBase64: obj.imageBase64,
289061
- image_url: obj.image_url ?? obj.imageUrl,
289062
- imageUrl: obj.imageUrl,
289063
- base64: obj.base64,
289064
- image: obj.image
289111
+ b64_json: readString(obj.b64_json) ?? readString(obj.b64Json),
289112
+ b64Json: readString(obj.b64Json),
289113
+ url: readString(obj.url) ?? readString(obj.imageUrl),
289114
+ image_base64: readString(obj.image_base64) ?? readString(obj.imageBase64),
289115
+ imageBase64: readString(obj.imageBase64),
289116
+ image_url: readString(obj.image_url) ?? readString(obj.imageUrl),
289117
+ imageUrl: readString(obj.imageUrl),
289118
+ base64: readString(obj.base64),
289119
+ data: readString(obj.data),
289120
+ mimeType: readString(obj.mimeType),
289121
+ mime_type: readString(obj.mime_type),
289122
+ inlineData,
289123
+ inline_data,
289124
+ image
289065
289125
  };
289066
289126
  };
289067
289127
  const asItem = (value2) => {
@@ -289072,7 +289132,7 @@ function pickImageItem(response) {
289072
289132
  }
289073
289133
  if (typeof value2 === "object") {
289074
289134
  const normalized = tryFromObject(value2);
289075
- if (normalized)
289135
+ if (normalized && hasImagePayload(normalized))
289076
289136
  return normalized;
289077
289137
  }
289078
289138
  return void 0;
@@ -289115,8 +289175,7 @@ function pickImageItem(response) {
289115
289175
  continue;
289116
289176
  const normalized = tryFromObject(current);
289117
289177
  if (normalized) {
289118
- 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));
289119
- if (hasUsefulField)
289178
+ if (hasImagePayload(normalized))
289120
289179
  return normalized;
289121
289180
  }
289122
289181
  if (Array.isArray(current)) {
@@ -289162,19 +289221,23 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
289162
289221
  name: "generate_image",
289163
289222
  label: "generate image",
289164
289223
  description: "Generate an image from a text prompt. Saves the image to disk and returns the file path.",
289165
- promptSnippet: "generate_image(prompt, filename?, size?, quality?) - generate an image from text",
289224
+ promptSnippet: "generate_image(prompt, filename?, size?, aspectRatio?, imageSize?, quality?) - generate an image from text",
289166
289225
  promptGuidelines: [
289167
289226
  "Use generate_image when the user asks to create, draw, or visualize something.",
289168
289227
  "Be descriptive in the prompt \u2014 more detail produces better results.",
289169
- "Provide a filename with extension, e.g. 'cat.png'."
289228
+ "Provide a filename with extension, e.g. 'cat.png'.",
289229
+ "Use aspectRatio (e.g. '3:4') when the requested output needs specific proportions.",
289230
+ "Use imageSize (e.g. '2K') when the user requests 1K, 2K, or 4K resolution."
289170
289231
  ],
289171
289232
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
289172
289233
  parameters: generateImageSchema,
289173
289234
  async execute(_toolCallId, params, signal, _onUpdate) {
289174
289235
  const p = params;
289175
289236
  const prompt = p.prompt;
289176
- const size = p.size ?? "1024x1024";
289237
+ const size = p.size;
289177
289238
  const quality = p.quality ?? "auto";
289239
+ const aspectRatio = p.aspectRatio;
289240
+ const imageSize = p.imageSize;
289178
289241
  const rawFilename = p.filename;
289179
289242
  const filename = rawFilename ? extname2(rawFilename) ? rawFilename : `${rawFilename}.png` : `image_${Date.now()}.png`;
289180
289243
  const filePath = join35(cwd, filename.replace(/[^a-zA-Z0-9_\-./]/g, "_"));
@@ -289190,10 +289253,12 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
289190
289253
  model: imageModelId,
289191
289254
  prompt,
289192
289255
  n: 1,
289193
- size,
289194
289256
  quality,
289195
289257
  response_format: "b64_json",
289196
- output_format: "png"
289258
+ output_format: "png",
289259
+ ...aspectRatio ? { aspect_ratio: aspectRatio } : {},
289260
+ ...imageSize ? { image_size: imageSize } : {},
289261
+ ...size ? { size } : !aspectRatio && !imageSize ? { size: "1024x1024" } : {}
289197
289262
  }),
289198
289263
  signal
289199
289264
  });
@@ -289255,6 +289320,27 @@ var editImageSchema = {
289255
289320
  type: "string",
289256
289321
  enum: ["low", "medium", "high", "auto"],
289257
289322
  description: "Image quality. Optional; omit or set auto to let model decide."
289323
+ },
289324
+ aspectRatio: {
289325
+ type: "string",
289326
+ enum: [
289327
+ "1:1",
289328
+ "3:2",
289329
+ "2:3",
289330
+ "3:4",
289331
+ "4:3",
289332
+ "4:5",
289333
+ "5:4",
289334
+ "9:16",
289335
+ "16:9",
289336
+ "21:9"
289337
+ ],
289338
+ description: "Gemini image aspect ratio. Use this instead of size for Gemini image edit models when exact proportions matter."
289339
+ },
289340
+ imageSize: {
289341
+ type: "string",
289342
+ enum: ["1K", "2K", "4K"],
289343
+ description: "Gemini output resolution for image edit models that support K-resolution output."
289258
289344
  }
289259
289345
  },
289260
289346
  required: ["image", "prompt"],
@@ -289291,12 +289377,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289291
289377
  name: "edit_image",
289292
289378
  label: "edit image",
289293
289379
  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.",
289294
- promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?) - edit an existing image",
289380
+ promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?, aspectRatio?, imageSize?) - edit an existing image",
289295
289381
  promptGuidelines: [
289296
289382
  "Use edit_image when the user wants to modify, retouch, or transform an existing image.",
289297
289383
  "The prompt should describe the full desired final image, not just the change.",
289298
289384
  "Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
289299
- "Without a mask, the model decides what to change based on the prompt."
289385
+ "Without a mask, the model decides what to change based on the prompt.",
289386
+ "For Gemini image edit models, use aspectRatio and imageSize when the user asks for those controls."
289300
289387
  ],
289301
289388
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
289302
289389
  parameters: editImageSchema,
@@ -289309,6 +289396,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289309
289396
  const maskPath = p.mask;
289310
289397
  const size = p.size;
289311
289398
  const quality = p.quality;
289399
+ const aspectRatio = p.aspectRatio;
289400
+ const imageSize = p.imageSize;
289312
289401
  const rawFilename = p.filename;
289313
289402
  const safePrompt = buildPolicySafeEditPrompt(prompt);
289314
289403
  const resolvedImage = resolve14(cwd, imagePath);
@@ -289340,6 +289429,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289340
289429
  if (quality && quality !== "auto") {
289341
289430
  fields.push({ name: "quality", value: quality });
289342
289431
  }
289432
+ if (aspectRatio) {
289433
+ fields.push({ name: "aspect_ratio", value: aspectRatio });
289434
+ }
289435
+ if (imageSize) {
289436
+ fields.push({ name: "image_size", value: imageSize });
289437
+ }
289343
289438
  const files = [
289344
289439
  {
289345
289440
  name: "image",
package/dist/index.js CHANGED
@@ -288990,20 +288990,37 @@ var generateImageSchema = {
288990
288990
  size: {
288991
288991
  type: "string",
288992
288992
  enum: [
288993
+ "auto",
288994
+ "1024x1024",
288995
+ "1536x1024",
288996
+ "1024x1536",
288993
288997
  "256x256",
288994
288998
  "512x512",
288995
- "1024x1024",
288996
288999
  "1792x1024",
288997
- "1024x1792",
288998
- "1280x1280",
288999
- "1568x1056",
289000
- "1056x1568",
289001
- "1472x1088",
289002
- "1088x1472",
289003
- "1728x960",
289004
- "960x1728"
289000
+ "1024x1792"
289005
289001
  ],
289006
- description: "Image dimensions. Common: 1024x1024 (square), 1280x1280, 1568x1056 (landscape), 1056x1568 (portrait), 1728x960 (wide), 960x1728 (tall)."
289002
+ description: "Image dimensions. Supported values: auto, 1024x1024, 1536x1024, 1024x1536, 256x256, 512x512, 1792x1024, 1024x1792."
289003
+ },
289004
+ aspectRatio: {
289005
+ type: "string",
289006
+ enum: [
289007
+ "1:1",
289008
+ "3:2",
289009
+ "2:3",
289010
+ "3:4",
289011
+ "4:3",
289012
+ "4:5",
289013
+ "5:4",
289014
+ "9:16",
289015
+ "16:9",
289016
+ "21:9"
289017
+ ],
289018
+ description: "Image aspect ratio. Use this instead of size for models that support it when exact proportions matter. Supported values: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9."
289019
+ },
289020
+ imageSize: {
289021
+ type: "string",
289022
+ enum: ["1K", "2K", "4K"],
289023
+ description: "Image resolution for models that support K-resolution output. Use this for requests like 2K or 4K."
289007
289024
  },
289008
289025
  quality: {
289009
289026
  type: "string",
@@ -289014,6 +289031,33 @@ var generateImageSchema = {
289014
289031
  required: ["prompt"],
289015
289032
  additionalProperties: false
289016
289033
  };
289034
+ 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));
289035
+ function readString(value2) {
289036
+ return typeof value2 === "string" && value2.length > 0 ? value2 : void 0;
289037
+ }
289038
+ function readInlineData(value2) {
289039
+ if (!value2 || typeof value2 !== "object")
289040
+ return void 0;
289041
+ const obj = value2;
289042
+ return {
289043
+ data: readString(obj.data),
289044
+ mimeType: readString(obj.mimeType),
289045
+ mime_type: readString(obj.mime_type)
289046
+ };
289047
+ }
289048
+ function readImage(value2) {
289049
+ if (typeof value2 === "string" && value2.length > 0)
289050
+ return value2;
289051
+ if (!value2 || typeof value2 !== "object")
289052
+ return void 0;
289053
+ const obj = value2;
289054
+ return {
289055
+ base64: readString(obj.base64),
289056
+ b64_json: readString(obj.b64_json),
289057
+ url: readString(obj.url),
289058
+ data: readString(obj.data)
289059
+ };
289060
+ }
289017
289061
  async function resolveB64(item, apiKey) {
289018
289062
  if (item.b64_json)
289019
289063
  return item.b64_json;
@@ -289025,12 +289069,20 @@ async function resolveB64(item, apiKey) {
289025
289069
  return item.imageBase64;
289026
289070
  if (item.base64)
289027
289071
  return item.base64;
289072
+ if (item.data)
289073
+ return item.data;
289074
+ if (item.inlineData?.data)
289075
+ return item.inlineData.data;
289076
+ if (item.inline_data?.data)
289077
+ return item.inline_data.data;
289028
289078
  if (typeof item.image === "string")
289029
289079
  return item.image;
289030
289080
  if (item.image?.b64_json)
289031
289081
  return item.image.b64_json;
289032
289082
  if (item.image?.base64)
289033
289083
  return item.image.base64;
289084
+ if (item.image?.data)
289085
+ return item.image.data;
289034
289086
  const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
289035
289087
  if (url) {
289036
289088
  const headers = {};
@@ -289048,16 +289100,24 @@ function pickImageItem(response) {
289048
289100
  if (!value2 || typeof value2 !== "object")
289049
289101
  return void 0;
289050
289102
  const obj = value2;
289103
+ const image = readImage(obj.image);
289104
+ const inlineData = readInlineData(obj.inlineData);
289105
+ const inline_data = readInlineData(obj.inline_data);
289051
289106
  return {
289052
- b64_json: obj.b64_json ?? obj.b64Json,
289053
- b64Json: obj.b64Json,
289054
- url: obj.url ?? obj.imageUrl,
289055
- image_base64: obj.image_base64 ?? obj.imageBase64,
289056
- imageBase64: obj.imageBase64,
289057
- image_url: obj.image_url ?? obj.imageUrl,
289058
- imageUrl: obj.imageUrl,
289059
- base64: obj.base64,
289060
- image: obj.image
289107
+ b64_json: readString(obj.b64_json) ?? readString(obj.b64Json),
289108
+ b64Json: readString(obj.b64Json),
289109
+ url: readString(obj.url) ?? readString(obj.imageUrl),
289110
+ image_base64: readString(obj.image_base64) ?? readString(obj.imageBase64),
289111
+ imageBase64: readString(obj.imageBase64),
289112
+ image_url: readString(obj.image_url) ?? readString(obj.imageUrl),
289113
+ imageUrl: readString(obj.imageUrl),
289114
+ base64: readString(obj.base64),
289115
+ data: readString(obj.data),
289116
+ mimeType: readString(obj.mimeType),
289117
+ mime_type: readString(obj.mime_type),
289118
+ inlineData,
289119
+ inline_data,
289120
+ image
289061
289121
  };
289062
289122
  };
289063
289123
  const asItem = (value2) => {
@@ -289068,7 +289128,7 @@ function pickImageItem(response) {
289068
289128
  }
289069
289129
  if (typeof value2 === "object") {
289070
289130
  const normalized = tryFromObject(value2);
289071
- if (normalized)
289131
+ if (normalized && hasImagePayload(normalized))
289072
289132
  return normalized;
289073
289133
  }
289074
289134
  return void 0;
@@ -289111,8 +289171,7 @@ function pickImageItem(response) {
289111
289171
  continue;
289112
289172
  const normalized = tryFromObject(current);
289113
289173
  if (normalized) {
289114
- 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));
289115
- if (hasUsefulField)
289174
+ if (hasImagePayload(normalized))
289116
289175
  return normalized;
289117
289176
  }
289118
289177
  if (Array.isArray(current)) {
@@ -289158,19 +289217,23 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
289158
289217
  name: "generate_image",
289159
289218
  label: "generate image",
289160
289219
  description: "Generate an image from a text prompt. Saves the image to disk and returns the file path.",
289161
- promptSnippet: "generate_image(prompt, filename?, size?, quality?) - generate an image from text",
289220
+ promptSnippet: "generate_image(prompt, filename?, size?, aspectRatio?, imageSize?, quality?) - generate an image from text",
289162
289221
  promptGuidelines: [
289163
289222
  "Use generate_image when the user asks to create, draw, or visualize something.",
289164
289223
  "Be descriptive in the prompt \u2014 more detail produces better results.",
289165
- "Provide a filename with extension, e.g. 'cat.png'."
289224
+ "Provide a filename with extension, e.g. 'cat.png'.",
289225
+ "Use aspectRatio (e.g. '3:4') when the requested output needs specific proportions.",
289226
+ "Use imageSize (e.g. '2K') when the user requests 1K, 2K, or 4K resolution."
289166
289227
  ],
289167
289228
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
289168
289229
  parameters: generateImageSchema,
289169
289230
  async execute(_toolCallId, params, signal, _onUpdate) {
289170
289231
  const p = params;
289171
289232
  const prompt = p.prompt;
289172
- const size = p.size ?? "1024x1024";
289233
+ const size = p.size;
289173
289234
  const quality = p.quality ?? "auto";
289235
+ const aspectRatio = p.aspectRatio;
289236
+ const imageSize = p.imageSize;
289174
289237
  const rawFilename = p.filename;
289175
289238
  const filename = rawFilename ? extname2(rawFilename) ? rawFilename : `${rawFilename}.png` : `image_${Date.now()}.png`;
289176
289239
  const filePath = join35(cwd, filename.replace(/[^a-zA-Z0-9_\-./]/g, "_"));
@@ -289186,10 +289249,12 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
289186
289249
  model: imageModelId,
289187
289250
  prompt,
289188
289251
  n: 1,
289189
- size,
289190
289252
  quality,
289191
289253
  response_format: "b64_json",
289192
- output_format: "png"
289254
+ output_format: "png",
289255
+ ...aspectRatio ? { aspect_ratio: aspectRatio } : {},
289256
+ ...imageSize ? { image_size: imageSize } : {},
289257
+ ...size ? { size } : !aspectRatio && !imageSize ? { size: "1024x1024" } : {}
289193
289258
  }),
289194
289259
  signal
289195
289260
  });
@@ -289251,6 +289316,27 @@ var editImageSchema = {
289251
289316
  type: "string",
289252
289317
  enum: ["low", "medium", "high", "auto"],
289253
289318
  description: "Image quality. Optional; omit or set auto to let model decide."
289319
+ },
289320
+ aspectRatio: {
289321
+ type: "string",
289322
+ enum: [
289323
+ "1:1",
289324
+ "3:2",
289325
+ "2:3",
289326
+ "3:4",
289327
+ "4:3",
289328
+ "4:5",
289329
+ "5:4",
289330
+ "9:16",
289331
+ "16:9",
289332
+ "21:9"
289333
+ ],
289334
+ description: "Gemini image aspect ratio. Use this instead of size for Gemini image edit models when exact proportions matter."
289335
+ },
289336
+ imageSize: {
289337
+ type: "string",
289338
+ enum: ["1K", "2K", "4K"],
289339
+ description: "Gemini output resolution for image edit models that support K-resolution output."
289254
289340
  }
289255
289341
  },
289256
289342
  required: ["image", "prompt"],
@@ -289287,12 +289373,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289287
289373
  name: "edit_image",
289288
289374
  label: "edit image",
289289
289375
  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.",
289290
- promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?) - edit an existing image",
289376
+ promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?, aspectRatio?, imageSize?) - edit an existing image",
289291
289377
  promptGuidelines: [
289292
289378
  "Use edit_image when the user wants to modify, retouch, or transform an existing image.",
289293
289379
  "The prompt should describe the full desired final image, not just the change.",
289294
289380
  "Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
289295
- "Without a mask, the model decides what to change based on the prompt."
289381
+ "Without a mask, the model decides what to change based on the prompt.",
289382
+ "For Gemini image edit models, use aspectRatio and imageSize when the user asks for those controls."
289296
289383
  ],
289297
289384
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
289298
289385
  parameters: editImageSchema,
@@ -289305,6 +289392,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289305
289392
  const maskPath = p.mask;
289306
289393
  const size = p.size;
289307
289394
  const quality = p.quality;
289395
+ const aspectRatio = p.aspectRatio;
289396
+ const imageSize = p.imageSize;
289308
289397
  const rawFilename = p.filename;
289309
289398
  const safePrompt = buildPolicySafeEditPrompt(prompt);
289310
289399
  const resolvedImage = resolve14(cwd, imagePath);
@@ -289336,6 +289425,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289336
289425
  if (quality && quality !== "auto") {
289337
289426
  fields.push({ name: "quality", value: quality });
289338
289427
  }
289428
+ if (aspectRatio) {
289429
+ fields.push({ name: "aspect_ratio", value: aspectRatio });
289430
+ }
289431
+ if (imageSize) {
289432
+ fields.push({ name: "image_size", value: imageSize });
289433
+ }
289339
289434
  const files = [
289340
289435
  {
289341
289436
  name: "image",
package/dist/nextjs.js CHANGED
@@ -288986,20 +288986,37 @@ var generateImageSchema = {
288986
288986
  size: {
288987
288987
  type: "string",
288988
288988
  enum: [
288989
+ "auto",
288990
+ "1024x1024",
288991
+ "1536x1024",
288992
+ "1024x1536",
288989
288993
  "256x256",
288990
288994
  "512x512",
288991
- "1024x1024",
288992
288995
  "1792x1024",
288993
- "1024x1792",
288994
- "1280x1280",
288995
- "1568x1056",
288996
- "1056x1568",
288997
- "1472x1088",
288998
- "1088x1472",
288999
- "1728x960",
289000
- "960x1728"
288996
+ "1024x1792"
289001
288997
  ],
289002
- description: "Image dimensions. Common: 1024x1024 (square), 1280x1280, 1568x1056 (landscape), 1056x1568 (portrait), 1728x960 (wide), 960x1728 (tall)."
288998
+ description: "Image dimensions. Supported values: auto, 1024x1024, 1536x1024, 1024x1536, 256x256, 512x512, 1792x1024, 1024x1792."
288999
+ },
289000
+ aspectRatio: {
289001
+ type: "string",
289002
+ enum: [
289003
+ "1:1",
289004
+ "3:2",
289005
+ "2:3",
289006
+ "3:4",
289007
+ "4:3",
289008
+ "4:5",
289009
+ "5:4",
289010
+ "9:16",
289011
+ "16:9",
289012
+ "21:9"
289013
+ ],
289014
+ description: "Image aspect ratio. Use this instead of size for models that support it when exact proportions matter. Supported values: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9."
289015
+ },
289016
+ imageSize: {
289017
+ type: "string",
289018
+ enum: ["1K", "2K", "4K"],
289019
+ description: "Image resolution for models that support K-resolution output. Use this for requests like 2K or 4K."
289003
289020
  },
289004
289021
  quality: {
289005
289022
  type: "string",
@@ -289010,6 +289027,33 @@ var generateImageSchema = {
289010
289027
  required: ["prompt"],
289011
289028
  additionalProperties: false
289012
289029
  };
289030
+ 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));
289031
+ function readString(value2) {
289032
+ return typeof value2 === "string" && value2.length > 0 ? value2 : void 0;
289033
+ }
289034
+ function readInlineData(value2) {
289035
+ if (!value2 || typeof value2 !== "object")
289036
+ return void 0;
289037
+ const obj = value2;
289038
+ return {
289039
+ data: readString(obj.data),
289040
+ mimeType: readString(obj.mimeType),
289041
+ mime_type: readString(obj.mime_type)
289042
+ };
289043
+ }
289044
+ function readImage(value2) {
289045
+ if (typeof value2 === "string" && value2.length > 0)
289046
+ return value2;
289047
+ if (!value2 || typeof value2 !== "object")
289048
+ return void 0;
289049
+ const obj = value2;
289050
+ return {
289051
+ base64: readString(obj.base64),
289052
+ b64_json: readString(obj.b64_json),
289053
+ url: readString(obj.url),
289054
+ data: readString(obj.data)
289055
+ };
289056
+ }
289013
289057
  async function resolveB64(item, apiKey) {
289014
289058
  if (item.b64_json)
289015
289059
  return item.b64_json;
@@ -289021,12 +289065,20 @@ async function resolveB64(item, apiKey) {
289021
289065
  return item.imageBase64;
289022
289066
  if (item.base64)
289023
289067
  return item.base64;
289068
+ if (item.data)
289069
+ return item.data;
289070
+ if (item.inlineData?.data)
289071
+ return item.inlineData.data;
289072
+ if (item.inline_data?.data)
289073
+ return item.inline_data.data;
289024
289074
  if (typeof item.image === "string")
289025
289075
  return item.image;
289026
289076
  if (item.image?.b64_json)
289027
289077
  return item.image.b64_json;
289028
289078
  if (item.image?.base64)
289029
289079
  return item.image.base64;
289080
+ if (item.image?.data)
289081
+ return item.image.data;
289030
289082
  const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
289031
289083
  if (url) {
289032
289084
  const headers = {};
@@ -289044,16 +289096,24 @@ function pickImageItem(response) {
289044
289096
  if (!value2 || typeof value2 !== "object")
289045
289097
  return void 0;
289046
289098
  const obj = value2;
289099
+ const image = readImage(obj.image);
289100
+ const inlineData = readInlineData(obj.inlineData);
289101
+ const inline_data = readInlineData(obj.inline_data);
289047
289102
  return {
289048
- b64_json: obj.b64_json ?? obj.b64Json,
289049
- b64Json: obj.b64Json,
289050
- url: obj.url ?? obj.imageUrl,
289051
- image_base64: obj.image_base64 ?? obj.imageBase64,
289052
- imageBase64: obj.imageBase64,
289053
- image_url: obj.image_url ?? obj.imageUrl,
289054
- imageUrl: obj.imageUrl,
289055
- base64: obj.base64,
289056
- image: obj.image
289103
+ b64_json: readString(obj.b64_json) ?? readString(obj.b64Json),
289104
+ b64Json: readString(obj.b64Json),
289105
+ url: readString(obj.url) ?? readString(obj.imageUrl),
289106
+ image_base64: readString(obj.image_base64) ?? readString(obj.imageBase64),
289107
+ imageBase64: readString(obj.imageBase64),
289108
+ image_url: readString(obj.image_url) ?? readString(obj.imageUrl),
289109
+ imageUrl: readString(obj.imageUrl),
289110
+ base64: readString(obj.base64),
289111
+ data: readString(obj.data),
289112
+ mimeType: readString(obj.mimeType),
289113
+ mime_type: readString(obj.mime_type),
289114
+ inlineData,
289115
+ inline_data,
289116
+ image
289057
289117
  };
289058
289118
  };
289059
289119
  const asItem = (value2) => {
@@ -289064,7 +289124,7 @@ function pickImageItem(response) {
289064
289124
  }
289065
289125
  if (typeof value2 === "object") {
289066
289126
  const normalized = tryFromObject(value2);
289067
- if (normalized)
289127
+ if (normalized && hasImagePayload(normalized))
289068
289128
  return normalized;
289069
289129
  }
289070
289130
  return void 0;
@@ -289107,8 +289167,7 @@ function pickImageItem(response) {
289107
289167
  continue;
289108
289168
  const normalized = tryFromObject(current);
289109
289169
  if (normalized) {
289110
- 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));
289111
- if (hasUsefulField)
289170
+ if (hasImagePayload(normalized))
289112
289171
  return normalized;
289113
289172
  }
289114
289173
  if (Array.isArray(current)) {
@@ -289154,19 +289213,23 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
289154
289213
  name: "generate_image",
289155
289214
  label: "generate image",
289156
289215
  description: "Generate an image from a text prompt. Saves the image to disk and returns the file path.",
289157
- promptSnippet: "generate_image(prompt, filename?, size?, quality?) - generate an image from text",
289216
+ promptSnippet: "generate_image(prompt, filename?, size?, aspectRatio?, imageSize?, quality?) - generate an image from text",
289158
289217
  promptGuidelines: [
289159
289218
  "Use generate_image when the user asks to create, draw, or visualize something.",
289160
289219
  "Be descriptive in the prompt \u2014 more detail produces better results.",
289161
- "Provide a filename with extension, e.g. 'cat.png'."
289220
+ "Provide a filename with extension, e.g. 'cat.png'.",
289221
+ "Use aspectRatio (e.g. '3:4') when the requested output needs specific proportions.",
289222
+ "Use imageSize (e.g. '2K') when the user requests 1K, 2K, or 4K resolution."
289162
289223
  ],
289163
289224
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
289164
289225
  parameters: generateImageSchema,
289165
289226
  async execute(_toolCallId, params, signal, _onUpdate) {
289166
289227
  const p = params;
289167
289228
  const prompt = p.prompt;
289168
- const size = p.size ?? "1024x1024";
289229
+ const size = p.size;
289169
289230
  const quality = p.quality ?? "auto";
289231
+ const aspectRatio = p.aspectRatio;
289232
+ const imageSize = p.imageSize;
289170
289233
  const rawFilename = p.filename;
289171
289234
  const filename = rawFilename ? extname2(rawFilename) ? rawFilename : `${rawFilename}.png` : `image_${Date.now()}.png`;
289172
289235
  const filePath = join35(cwd, filename.replace(/[^a-zA-Z0-9_\-./]/g, "_"));
@@ -289182,10 +289245,12 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
289182
289245
  model: imageModelId,
289183
289246
  prompt,
289184
289247
  n: 1,
289185
- size,
289186
289248
  quality,
289187
289249
  response_format: "b64_json",
289188
- output_format: "png"
289250
+ output_format: "png",
289251
+ ...aspectRatio ? { aspect_ratio: aspectRatio } : {},
289252
+ ...imageSize ? { image_size: imageSize } : {},
289253
+ ...size ? { size } : !aspectRatio && !imageSize ? { size: "1024x1024" } : {}
289189
289254
  }),
289190
289255
  signal
289191
289256
  });
@@ -289247,6 +289312,27 @@ var editImageSchema = {
289247
289312
  type: "string",
289248
289313
  enum: ["low", "medium", "high", "auto"],
289249
289314
  description: "Image quality. Optional; omit or set auto to let model decide."
289315
+ },
289316
+ aspectRatio: {
289317
+ type: "string",
289318
+ enum: [
289319
+ "1:1",
289320
+ "3:2",
289321
+ "2:3",
289322
+ "3:4",
289323
+ "4:3",
289324
+ "4:5",
289325
+ "5:4",
289326
+ "9:16",
289327
+ "16:9",
289328
+ "21:9"
289329
+ ],
289330
+ description: "Gemini image aspect ratio. Use this instead of size for Gemini image edit models when exact proportions matter."
289331
+ },
289332
+ imageSize: {
289333
+ type: "string",
289334
+ enum: ["1K", "2K", "4K"],
289335
+ description: "Gemini output resolution for image edit models that support K-resolution output."
289250
289336
  }
289251
289337
  },
289252
289338
  required: ["image", "prompt"],
@@ -289283,12 +289369,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289283
289369
  name: "edit_image",
289284
289370
  label: "edit image",
289285
289371
  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.",
289286
- promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?) - edit an existing image",
289372
+ promptSnippet: "edit_image(image, prompt, mask?, filename?, size?, quality?, aspectRatio?, imageSize?) - edit an existing image",
289287
289373
  promptGuidelines: [
289288
289374
  "Use edit_image when the user wants to modify, retouch, or transform an existing image.",
289289
289375
  "The prompt should describe the full desired final image, not just the change.",
289290
289376
  "Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
289291
- "Without a mask, the model decides what to change based on the prompt."
289377
+ "Without a mask, the model decides what to change based on the prompt.",
289378
+ "For Gemini image edit models, use aspectRatio and imageSize when the user asks for those controls."
289292
289379
  ],
289293
289380
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
289294
289381
  parameters: editImageSchema,
@@ -289301,6 +289388,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289301
289388
  const maskPath = p.mask;
289302
289389
  const size = p.size;
289303
289390
  const quality = p.quality;
289391
+ const aspectRatio = p.aspectRatio;
289392
+ const imageSize = p.imageSize;
289304
289393
  const rawFilename = p.filename;
289305
289394
  const safePrompt = buildPolicySafeEditPrompt(prompt);
289306
289395
  const resolvedImage = resolve14(cwd, imagePath);
@@ -289332,6 +289421,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
289332
289421
  if (quality && quality !== "auto") {
289333
289422
  fields.push({ name: "quality", value: quality });
289334
289423
  }
289424
+ if (aspectRatio) {
289425
+ fields.push({ name: "aspect_ratio", value: aspectRatio });
289426
+ }
289427
+ if (imageSize) {
289428
+ fields.push({ name: "image_size", value: imageSize });
289429
+ }
289335
289430
  const files = [
289336
289431
  {
289337
289432
  name: "image",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunny-agent/daemon",
3
- "version": "0.9.32",
3
+ "version": "0.9.34",
4
4
  "description": "BunnyAgent Daemon - Unified API gateway for sandbox services (file, git, volumes)",
5
5
  "type": "module",
6
6
  "bin": {