@rubytech/taskmaster 1.9.2 → 1.9.3
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.
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { createSubsystemLogger } from "../../logging/subsystem.js";
|
|
2
|
-
import { fetchWithTimeout, normalizeBaseUrl, readErrorResponse } from "../../media-understanding/providers/shared.js";
|
|
2
|
+
import { fetchWithTimeout, normalizeBaseUrl, readErrorResponse, } from "../../media-understanding/providers/shared.js";
|
|
3
3
|
const log = createSubsystemLogger("image-gen");
|
|
4
|
+
/** Show first 4 and last 4 characters of a key, mask everything in between. */
|
|
5
|
+
function maskKey(key) {
|
|
6
|
+
if (key.length <= 12)
|
|
7
|
+
return `${key.slice(0, 4)}...`;
|
|
8
|
+
return `${key.slice(0, 4)}...${key.slice(-4)}`;
|
|
9
|
+
}
|
|
4
10
|
/* ------------------------------------------------------------------ */
|
|
5
11
|
/* Constants */
|
|
6
12
|
/* ------------------------------------------------------------------ */
|
|
7
13
|
const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
8
14
|
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
9
|
-
const GEMINI_IMAGE_MODELS = new Set([
|
|
10
|
-
"gemini-2.5-flash-image",
|
|
11
|
-
"gemini-3-pro-image-preview",
|
|
12
|
-
]);
|
|
15
|
+
const GEMINI_IMAGE_MODELS = new Set(["gemini-2.5-flash-image", "gemini-3-pro-image-preview"]);
|
|
13
16
|
/* ------------------------------------------------------------------ */
|
|
14
17
|
/* Model detection */
|
|
15
18
|
/* ------------------------------------------------------------------ */
|
|
@@ -47,7 +50,7 @@ export async function generateImageGemini(params) {
|
|
|
47
50
|
const res = await fetchWithTimeout(url, { method: "POST", headers, body: JSON.stringify(body) }, timeoutMs, fetchFn);
|
|
48
51
|
if (!res.ok) {
|
|
49
52
|
const detail = await readErrorResponse(res);
|
|
50
|
-
log.error("gemini HTTP error", { status: res.status, detail });
|
|
53
|
+
log.error("gemini HTTP error", { status: res.status, key: maskKey(params.apiKey), detail });
|
|
51
54
|
const suffix = detail ? `: ${detail}` : "";
|
|
52
55
|
throw new Error(`Image generation failed (HTTP ${res.status})${suffix}`);
|
|
53
56
|
}
|
|
@@ -125,7 +128,7 @@ export async function generateImageImagen(params) {
|
|
|
125
128
|
const res = await fetchWithTimeout(url, { method: "POST", headers, body: JSON.stringify(body) }, timeoutMs, fetchFn);
|
|
126
129
|
if (!res.ok) {
|
|
127
130
|
const detail = await readErrorResponse(res);
|
|
128
|
-
log.error("imagen HTTP error", { status: res.status, detail });
|
|
131
|
+
log.error("imagen HTTP error", { status: res.status, key: maskKey(params.apiKey), detail });
|
|
129
132
|
const suffix = detail ? `: ${detail}` : "";
|
|
130
133
|
throw new Error(`Image generation failed (HTTP ${res.status})${suffix}`);
|
|
131
134
|
}
|
|
@@ -8,6 +8,15 @@ import { sanitizeToolResultImages } from "../tool-images.js";
|
|
|
8
8
|
import { readNumberParam, readStringParam } from "./common.js";
|
|
9
9
|
const log = createSubsystemLogger("image-gen");
|
|
10
10
|
/* ------------------------------------------------------------------ */
|
|
11
|
+
/* Helpers */
|
|
12
|
+
/* ------------------------------------------------------------------ */
|
|
13
|
+
/** Show first 4 and last 4 characters of a key, mask everything in between. */
|
|
14
|
+
function maskKey(key) {
|
|
15
|
+
if (key.length <= 12)
|
|
16
|
+
return `${key.slice(0, 4)}...`;
|
|
17
|
+
return `${key.slice(0, 4)}...${key.slice(-4)}`;
|
|
18
|
+
}
|
|
19
|
+
/* ------------------------------------------------------------------ */
|
|
11
20
|
/* Constants */
|
|
12
21
|
/* ------------------------------------------------------------------ */
|
|
13
22
|
const SUPPORTED_MODELS = new Set([
|
|
@@ -47,7 +56,9 @@ export function createImageGenerateTool(options) {
|
|
|
47
56
|
parameters: Type.Object({
|
|
48
57
|
prompt: Type.String({ description: "The image generation prompt." }),
|
|
49
58
|
model: Type.Optional(Type.String({ description: "Model ID. Default: gemini-2.5-flash-image." })),
|
|
50
|
-
aspectRatio: Type.Optional(Type.String({
|
|
59
|
+
aspectRatio: Type.Optional(Type.String({
|
|
60
|
+
description: "e.g. 1:1, 16:9, 9:16, 3:4, 4:3. Gemini also supports 2:3, 3:2, 4:5, 5:4, 21:9.",
|
|
61
|
+
})),
|
|
51
62
|
resolution: Type.Optional(Type.String({ description: "1K, 2K, or 4K (4K: gemini-3-pro-image-preview only)." })),
|
|
52
63
|
numberOfImages: Type.Optional(Type.Number({ description: "1-4 images per request. Imagen models only." })),
|
|
53
64
|
personGeneration: Type.Optional(Type.String({ description: "dont_allow, allow_adult, allow_all. Imagen models only." })),
|
|
@@ -73,6 +84,7 @@ export function createImageGenerateTool(options) {
|
|
|
73
84
|
agentDir: options?.agentDir,
|
|
74
85
|
});
|
|
75
86
|
const apiKey = requireApiKey(auth, "google");
|
|
87
|
+
log.info("resolved google API key", { source: auth.source, key: maskKey(apiKey) });
|
|
76
88
|
/* --- Call the appropriate backend ---------------------------- */
|
|
77
89
|
const isGemini = isGeminiImageModel(modelRaw);
|
|
78
90
|
const result = isGemini
|
package/dist/build-info.json
CHANGED