@bunny-agent/daemon 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.
- package/dist/bundle.mjs +86 -14
- package/dist/index.js +86 -14
- package/dist/nextjs.js +86 -14
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -289035,6 +289035,33 @@ var generateImageSchema = {
|
|
|
289035
289035
|
required: ["prompt"],
|
|
289036
289036
|
additionalProperties: false
|
|
289037
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
|
+
}
|
|
289038
289065
|
async function resolveB64(item, apiKey) {
|
|
289039
289066
|
if (item.b64_json)
|
|
289040
289067
|
return item.b64_json;
|
|
@@ -289046,12 +289073,20 @@ async function resolveB64(item, apiKey) {
|
|
|
289046
289073
|
return item.imageBase64;
|
|
289047
289074
|
if (item.base64)
|
|
289048
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;
|
|
289049
289082
|
if (typeof item.image === "string")
|
|
289050
289083
|
return item.image;
|
|
289051
289084
|
if (item.image?.b64_json)
|
|
289052
289085
|
return item.image.b64_json;
|
|
289053
289086
|
if (item.image?.base64)
|
|
289054
289087
|
return item.image.base64;
|
|
289088
|
+
if (item.image?.data)
|
|
289089
|
+
return item.image.data;
|
|
289055
289090
|
const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
|
|
289056
289091
|
if (url) {
|
|
289057
289092
|
const headers = {};
|
|
@@ -289069,16 +289104,24 @@ function pickImageItem(response) {
|
|
|
289069
289104
|
if (!value2 || typeof value2 !== "object")
|
|
289070
289105
|
return void 0;
|
|
289071
289106
|
const obj = value2;
|
|
289107
|
+
const image = readImage(obj.image);
|
|
289108
|
+
const inlineData = readInlineData(obj.inlineData);
|
|
289109
|
+
const inline_data = readInlineData(obj.inline_data);
|
|
289072
289110
|
return {
|
|
289073
|
-
b64_json: obj.b64_json ?? obj.b64Json,
|
|
289074
|
-
b64Json: obj.b64Json,
|
|
289075
|
-
url: obj.url ?? obj.imageUrl,
|
|
289076
|
-
image_base64: obj.image_base64 ?? obj.imageBase64,
|
|
289077
|
-
imageBase64: obj.imageBase64,
|
|
289078
|
-
image_url: obj.image_url ?? obj.imageUrl,
|
|
289079
|
-
imageUrl: obj.imageUrl,
|
|
289080
|
-
base64: obj.base64,
|
|
289081
|
-
|
|
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
|
|
289082
289125
|
};
|
|
289083
289126
|
};
|
|
289084
289127
|
const asItem = (value2) => {
|
|
@@ -289089,7 +289132,7 @@ function pickImageItem(response) {
|
|
|
289089
289132
|
}
|
|
289090
289133
|
if (typeof value2 === "object") {
|
|
289091
289134
|
const normalized = tryFromObject(value2);
|
|
289092
|
-
if (normalized)
|
|
289135
|
+
if (normalized && hasImagePayload(normalized))
|
|
289093
289136
|
return normalized;
|
|
289094
289137
|
}
|
|
289095
289138
|
return void 0;
|
|
@@ -289132,8 +289175,7 @@ function pickImageItem(response) {
|
|
|
289132
289175
|
continue;
|
|
289133
289176
|
const normalized = tryFromObject(current);
|
|
289134
289177
|
if (normalized) {
|
|
289135
|
-
|
|
289136
|
-
if (hasUsefulField)
|
|
289178
|
+
if (hasImagePayload(normalized))
|
|
289137
289179
|
return normalized;
|
|
289138
289180
|
}
|
|
289139
289181
|
if (Array.isArray(current)) {
|
|
@@ -289278,6 +289320,27 @@ var editImageSchema = {
|
|
|
289278
289320
|
type: "string",
|
|
289279
289321
|
enum: ["low", "medium", "high", "auto"],
|
|
289280
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."
|
|
289281
289344
|
}
|
|
289282
289345
|
},
|
|
289283
289346
|
required: ["image", "prompt"],
|
|
@@ -289314,12 +289377,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289314
289377
|
name: "edit_image",
|
|
289315
289378
|
label: "edit image",
|
|
289316
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.",
|
|
289317
|
-
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",
|
|
289318
289381
|
promptGuidelines: [
|
|
289319
289382
|
"Use edit_image when the user wants to modify, retouch, or transform an existing image.",
|
|
289320
289383
|
"The prompt should describe the full desired final image, not just the change.",
|
|
289321
289384
|
"Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
|
|
289322
|
-
"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."
|
|
289323
289387
|
],
|
|
289324
289388
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
289325
289389
|
parameters: editImageSchema,
|
|
@@ -289332,6 +289396,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289332
289396
|
const maskPath = p.mask;
|
|
289333
289397
|
const size = p.size;
|
|
289334
289398
|
const quality = p.quality;
|
|
289399
|
+
const aspectRatio = p.aspectRatio;
|
|
289400
|
+
const imageSize = p.imageSize;
|
|
289335
289401
|
const rawFilename = p.filename;
|
|
289336
289402
|
const safePrompt = buildPolicySafeEditPrompt(prompt);
|
|
289337
289403
|
const resolvedImage = resolve14(cwd, imagePath);
|
|
@@ -289363,6 +289429,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289363
289429
|
if (quality && quality !== "auto") {
|
|
289364
289430
|
fields.push({ name: "quality", value: quality });
|
|
289365
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
|
+
}
|
|
289366
289438
|
const files = [
|
|
289367
289439
|
{
|
|
289368
289440
|
name: "image",
|
package/dist/index.js
CHANGED
|
@@ -289031,6 +289031,33 @@ var generateImageSchema = {
|
|
|
289031
289031
|
required: ["prompt"],
|
|
289032
289032
|
additionalProperties: false
|
|
289033
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
|
+
}
|
|
289034
289061
|
async function resolveB64(item, apiKey) {
|
|
289035
289062
|
if (item.b64_json)
|
|
289036
289063
|
return item.b64_json;
|
|
@@ -289042,12 +289069,20 @@ async function resolveB64(item, apiKey) {
|
|
|
289042
289069
|
return item.imageBase64;
|
|
289043
289070
|
if (item.base64)
|
|
289044
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;
|
|
289045
289078
|
if (typeof item.image === "string")
|
|
289046
289079
|
return item.image;
|
|
289047
289080
|
if (item.image?.b64_json)
|
|
289048
289081
|
return item.image.b64_json;
|
|
289049
289082
|
if (item.image?.base64)
|
|
289050
289083
|
return item.image.base64;
|
|
289084
|
+
if (item.image?.data)
|
|
289085
|
+
return item.image.data;
|
|
289051
289086
|
const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
|
|
289052
289087
|
if (url) {
|
|
289053
289088
|
const headers = {};
|
|
@@ -289065,16 +289100,24 @@ function pickImageItem(response) {
|
|
|
289065
289100
|
if (!value2 || typeof value2 !== "object")
|
|
289066
289101
|
return void 0;
|
|
289067
289102
|
const obj = value2;
|
|
289103
|
+
const image = readImage(obj.image);
|
|
289104
|
+
const inlineData = readInlineData(obj.inlineData);
|
|
289105
|
+
const inline_data = readInlineData(obj.inline_data);
|
|
289068
289106
|
return {
|
|
289069
|
-
b64_json: obj.b64_json ?? obj.b64Json,
|
|
289070
|
-
b64Json: obj.b64Json,
|
|
289071
|
-
url: obj.url ?? obj.imageUrl,
|
|
289072
|
-
image_base64: obj.image_base64 ?? obj.imageBase64,
|
|
289073
|
-
imageBase64: obj.imageBase64,
|
|
289074
|
-
image_url: obj.image_url ?? obj.imageUrl,
|
|
289075
|
-
imageUrl: obj.imageUrl,
|
|
289076
|
-
base64: obj.base64,
|
|
289077
|
-
|
|
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
|
|
289078
289121
|
};
|
|
289079
289122
|
};
|
|
289080
289123
|
const asItem = (value2) => {
|
|
@@ -289085,7 +289128,7 @@ function pickImageItem(response) {
|
|
|
289085
289128
|
}
|
|
289086
289129
|
if (typeof value2 === "object") {
|
|
289087
289130
|
const normalized = tryFromObject(value2);
|
|
289088
|
-
if (normalized)
|
|
289131
|
+
if (normalized && hasImagePayload(normalized))
|
|
289089
289132
|
return normalized;
|
|
289090
289133
|
}
|
|
289091
289134
|
return void 0;
|
|
@@ -289128,8 +289171,7 @@ function pickImageItem(response) {
|
|
|
289128
289171
|
continue;
|
|
289129
289172
|
const normalized = tryFromObject(current);
|
|
289130
289173
|
if (normalized) {
|
|
289131
|
-
|
|
289132
|
-
if (hasUsefulField)
|
|
289174
|
+
if (hasImagePayload(normalized))
|
|
289133
289175
|
return normalized;
|
|
289134
289176
|
}
|
|
289135
289177
|
if (Array.isArray(current)) {
|
|
@@ -289274,6 +289316,27 @@ var editImageSchema = {
|
|
|
289274
289316
|
type: "string",
|
|
289275
289317
|
enum: ["low", "medium", "high", "auto"],
|
|
289276
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."
|
|
289277
289340
|
}
|
|
289278
289341
|
},
|
|
289279
289342
|
required: ["image", "prompt"],
|
|
@@ -289310,12 +289373,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289310
289373
|
name: "edit_image",
|
|
289311
289374
|
label: "edit image",
|
|
289312
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.",
|
|
289313
|
-
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",
|
|
289314
289377
|
promptGuidelines: [
|
|
289315
289378
|
"Use edit_image when the user wants to modify, retouch, or transform an existing image.",
|
|
289316
289379
|
"The prompt should describe the full desired final image, not just the change.",
|
|
289317
289380
|
"Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
|
|
289318
|
-
"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."
|
|
289319
289383
|
],
|
|
289320
289384
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
289321
289385
|
parameters: editImageSchema,
|
|
@@ -289328,6 +289392,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289328
289392
|
const maskPath = p.mask;
|
|
289329
289393
|
const size = p.size;
|
|
289330
289394
|
const quality = p.quality;
|
|
289395
|
+
const aspectRatio = p.aspectRatio;
|
|
289396
|
+
const imageSize = p.imageSize;
|
|
289331
289397
|
const rawFilename = p.filename;
|
|
289332
289398
|
const safePrompt = buildPolicySafeEditPrompt(prompt);
|
|
289333
289399
|
const resolvedImage = resolve14(cwd, imagePath);
|
|
@@ -289359,6 +289425,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289359
289425
|
if (quality && quality !== "auto") {
|
|
289360
289426
|
fields.push({ name: "quality", value: quality });
|
|
289361
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
|
+
}
|
|
289362
289434
|
const files = [
|
|
289363
289435
|
{
|
|
289364
289436
|
name: "image",
|
package/dist/nextjs.js
CHANGED
|
@@ -289027,6 +289027,33 @@ var generateImageSchema = {
|
|
|
289027
289027
|
required: ["prompt"],
|
|
289028
289028
|
additionalProperties: false
|
|
289029
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
|
+
}
|
|
289030
289057
|
async function resolveB64(item, apiKey) {
|
|
289031
289058
|
if (item.b64_json)
|
|
289032
289059
|
return item.b64_json;
|
|
@@ -289038,12 +289065,20 @@ async function resolveB64(item, apiKey) {
|
|
|
289038
289065
|
return item.imageBase64;
|
|
289039
289066
|
if (item.base64)
|
|
289040
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;
|
|
289041
289074
|
if (typeof item.image === "string")
|
|
289042
289075
|
return item.image;
|
|
289043
289076
|
if (item.image?.b64_json)
|
|
289044
289077
|
return item.image.b64_json;
|
|
289045
289078
|
if (item.image?.base64)
|
|
289046
289079
|
return item.image.base64;
|
|
289080
|
+
if (item.image?.data)
|
|
289081
|
+
return item.image.data;
|
|
289047
289082
|
const url = item.url ?? item.image_url ?? item.imageUrl ?? item.image?.url;
|
|
289048
289083
|
if (url) {
|
|
289049
289084
|
const headers = {};
|
|
@@ -289061,16 +289096,24 @@ function pickImageItem(response) {
|
|
|
289061
289096
|
if (!value2 || typeof value2 !== "object")
|
|
289062
289097
|
return void 0;
|
|
289063
289098
|
const obj = value2;
|
|
289099
|
+
const image = readImage(obj.image);
|
|
289100
|
+
const inlineData = readInlineData(obj.inlineData);
|
|
289101
|
+
const inline_data = readInlineData(obj.inline_data);
|
|
289064
289102
|
return {
|
|
289065
|
-
b64_json: obj.b64_json ?? obj.b64Json,
|
|
289066
|
-
b64Json: obj.b64Json,
|
|
289067
|
-
url: obj.url ?? obj.imageUrl,
|
|
289068
|
-
image_base64: obj.image_base64 ?? obj.imageBase64,
|
|
289069
|
-
imageBase64: obj.imageBase64,
|
|
289070
|
-
image_url: obj.image_url ?? obj.imageUrl,
|
|
289071
|
-
imageUrl: obj.imageUrl,
|
|
289072
|
-
base64: obj.base64,
|
|
289073
|
-
|
|
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
|
|
289074
289117
|
};
|
|
289075
289118
|
};
|
|
289076
289119
|
const asItem = (value2) => {
|
|
@@ -289081,7 +289124,7 @@ function pickImageItem(response) {
|
|
|
289081
289124
|
}
|
|
289082
289125
|
if (typeof value2 === "object") {
|
|
289083
289126
|
const normalized = tryFromObject(value2);
|
|
289084
|
-
if (normalized)
|
|
289127
|
+
if (normalized && hasImagePayload(normalized))
|
|
289085
289128
|
return normalized;
|
|
289086
289129
|
}
|
|
289087
289130
|
return void 0;
|
|
@@ -289124,8 +289167,7 @@ function pickImageItem(response) {
|
|
|
289124
289167
|
continue;
|
|
289125
289168
|
const normalized = tryFromObject(current);
|
|
289126
289169
|
if (normalized) {
|
|
289127
|
-
|
|
289128
|
-
if (hasUsefulField)
|
|
289170
|
+
if (hasImagePayload(normalized))
|
|
289129
289171
|
return normalized;
|
|
289130
289172
|
}
|
|
289131
289173
|
if (Array.isArray(current)) {
|
|
@@ -289270,6 +289312,27 @@ var editImageSchema = {
|
|
|
289270
289312
|
type: "string",
|
|
289271
289313
|
enum: ["low", "medium", "high", "auto"],
|
|
289272
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."
|
|
289273
289336
|
}
|
|
289274
289337
|
},
|
|
289275
289338
|
required: ["image", "prompt"],
|
|
@@ -289306,12 +289369,13 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289306
289369
|
name: "edit_image",
|
|
289307
289370
|
label: "edit image",
|
|
289308
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.",
|
|
289309
|
-
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",
|
|
289310
289373
|
promptGuidelines: [
|
|
289311
289374
|
"Use edit_image when the user wants to modify, retouch, or transform an existing image.",
|
|
289312
289375
|
"The prompt should describe the full desired final image, not just the change.",
|
|
289313
289376
|
"Provide the source image path. Use a mask image (PNG with transparent areas) to control where edits happen.",
|
|
289314
|
-
"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."
|
|
289315
289379
|
],
|
|
289316
289380
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
289317
289381
|
parameters: editImageSchema,
|
|
@@ -289324,6 +289388,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289324
289388
|
const maskPath = p.mask;
|
|
289325
289389
|
const size = p.size;
|
|
289326
289390
|
const quality = p.quality;
|
|
289391
|
+
const aspectRatio = p.aspectRatio;
|
|
289392
|
+
const imageSize = p.imageSize;
|
|
289327
289393
|
const rawFilename = p.filename;
|
|
289328
289394
|
const safePrompt = buildPolicySafeEditPrompt(prompt);
|
|
289329
289395
|
const resolvedImage = resolve14(cwd, imagePath);
|
|
@@ -289355,6 +289421,12 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
289355
289421
|
if (quality && quality !== "auto") {
|
|
289356
289422
|
fields.push({ name: "quality", value: quality });
|
|
289357
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
|
+
}
|
|
289358
289430
|
const files = [
|
|
289359
289431
|
{
|
|
289360
289432
|
name: "image",
|