@bendyline/gezel-mcp 1.2.10 → 1.2.12
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/harness.js +6 -3
- package/dist/server.js +94 -73
- package/package.json +5 -5
package/dist/harness.js
CHANGED
|
@@ -2465,7 +2465,8 @@ ${doc.markdown}`);
|
|
|
2465
2465
|
aspectRatio: z2.enum(IMAGE_ASPECT_RATIOS).optional(),
|
|
2466
2466
|
quality: z2.enum(IMAGE_QUALITIES).optional().describe("'draft', 'standard' (default) or 'high'."),
|
|
2467
2467
|
negativePrompt: z2.string().max(2e3).optional().describe("Things to keep out of the image."),
|
|
2468
|
-
inputImages: z2.array(z2.string().min(1)).max(4).optional().describe("Images to edit or combine: absolute paths, or paths relative to this folder.")
|
|
2468
|
+
inputImages: z2.array(z2.string().min(1)).max(4).optional().describe("Images to edit or combine: absolute paths, or paths relative to this folder."),
|
|
2469
|
+
style: z2.string().max(100).optional().describe("A look to draw in, by name.")
|
|
2469
2470
|
}
|
|
2470
2471
|
},
|
|
2471
2472
|
async (args) => guarded(async () => {
|
|
@@ -2490,7 +2491,8 @@ ${doc.markdown}`);
|
|
|
2490
2491
|
...args.aspectRatio ? { aspectRatio: args.aspectRatio } : {},
|
|
2491
2492
|
...args.quality ? { quality: args.quality } : {},
|
|
2492
2493
|
...args.negativePrompt ? { negativePrompt: args.negativePrompt } : {},
|
|
2493
|
-
...inputs.length > 0 ? { inputImages: inputs } : {}
|
|
2494
|
+
...inputs.length > 0 ? { inputImages: inputs } : {},
|
|
2495
|
+
...args.style ? { style: args.style } : {}
|
|
2494
2496
|
})
|
|
2495
2497
|
);
|
|
2496
2498
|
const artifactsDir = binding.info?.artifactsDir;
|
|
@@ -2499,9 +2501,10 @@ ${doc.markdown}`);
|
|
|
2499
2501
|
if (res.b64Png) content.push({ type: "image", data: res.b64Png, mimeType: "image/png" });
|
|
2500
2502
|
const skipped = res.meta.img2imgSkippedReason ? `This image engine can't edit images (${res.meta.img2imgSkippedReason}), so it ignored inputImages and made a new image from the prompt alone. To change an image, describe the whole picture you want. ` : "";
|
|
2501
2503
|
const settings = res.meta.settingsNotes?.length ? `Image settings: ${res.meta.settingsNotes.join(" ")} ` : "";
|
|
2504
|
+
const styles = res.styles?.length ? ` Styles this model has: ${res.styles.map((s) => s.name).join(", ")}.` : "";
|
|
2502
2505
|
content.push({
|
|
2503
2506
|
type: "text",
|
|
2504
|
-
text: `${skipped}${settings}Saved to ${saved} (${res.meta.widthPx}x${res.meta.heightPx}, ${res.meta.model}). Copy it into the folder with your own file tools if it belongs there
|
|
2507
|
+
text: `${skipped}${settings}Saved to ${saved} (${res.meta.widthPx}x${res.meta.heightPx}, ${res.meta.model}). Copy it into the folder with your own file tools if it belongs there.${styles}`
|
|
2505
2508
|
});
|
|
2506
2509
|
return { content };
|
|
2507
2510
|
})
|
package/dist/server.js
CHANGED
|
@@ -82,8 +82,10 @@ import {
|
|
|
82
82
|
askUserQuestionText,
|
|
83
83
|
assertCraftbookGraph,
|
|
84
84
|
asyncHandoffReleaseInstruction,
|
|
85
|
+
binaryDocumentWriteRefusalText,
|
|
85
86
|
coerceDeliverableKind,
|
|
86
87
|
composeCraftbookLaunch,
|
|
88
|
+
craftbookCheckup,
|
|
87
89
|
craftbookDocFormatFromEnv,
|
|
88
90
|
createTaskText,
|
|
89
91
|
crewMemberNamedIn,
|
|
@@ -96,6 +98,7 @@ import {
|
|
|
96
98
|
getTaskText,
|
|
97
99
|
inferDeliverableKind,
|
|
98
100
|
inferScriptScope,
|
|
101
|
+
isBinaryDocumentPath as isBinaryDocumentPath3,
|
|
99
102
|
isReservedShadowArtifactPath,
|
|
100
103
|
isTrustedConstrainedToolset,
|
|
101
104
|
listArtifactsText,
|
|
@@ -122,7 +125,7 @@ import {
|
|
|
122
125
|
searchResultText,
|
|
123
126
|
stepCheckedArtifactPaths,
|
|
124
127
|
stepInsertionIndex,
|
|
125
|
-
stepOwnerGezelId,
|
|
128
|
+
stepOwnerGezelId as stepOwnerGezelId2,
|
|
126
129
|
taskOwnedPrefixes,
|
|
127
130
|
taskPersonNoun,
|
|
128
131
|
taskScopedWriteDeniedMessage,
|
|
@@ -2493,42 +2496,27 @@ function createEntityResolvers(deps) {
|
|
|
2493
2496
|
return { resolveProjectId: resolveProjectId2, resolveGezelId: resolveGezelId2, availableGezelsHint: availableGezelsHint2, parseRef: parseRef2 };
|
|
2494
2497
|
}
|
|
2495
2498
|
|
|
2496
|
-
// src/
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
if (
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
}
|
|
2511
|
-
} else if (typeof args.width === "number" && args.width > AGENT_IMAGE_MAX_SIDE_PX) {
|
|
2512
|
-
next.width = AGENT_IMAGE_MAX_SIDE_PX;
|
|
2513
|
-
} else if (typeof args.height === "number" && args.height > AGENT_IMAGE_MAX_SIDE_PX) {
|
|
2514
|
-
next.height = AGENT_IMAGE_MAX_SIDE_PX;
|
|
2515
|
-
}
|
|
2516
|
-
if (originalSize && typeof next.width === "number" && typeof next.height === "number" && `${next.width}x${next.height}` !== originalSize) {
|
|
2517
|
-
changes.push(`size ${originalSize} -> ${next.width}x${next.height}`);
|
|
2518
|
-
} else if (args.width !== next.width && typeof next.width === "number") {
|
|
2519
|
-
changes.push(`width ${args.width} -> ${next.width}`);
|
|
2520
|
-
} else if (args.height !== next.height && typeof next.height === "number") {
|
|
2521
|
-
changes.push(`height ${args.height} -> ${next.height}`);
|
|
2499
|
+
// src/entry-step-start.ts
|
|
2500
|
+
import { isOwnerStep, stepOwnerGezelId } from "@bendyline/gezel";
|
|
2501
|
+
function entryStepStart(task) {
|
|
2502
|
+
const step = task.craftbook.steps.find((candidate) => candidate.id === task.activeStepId);
|
|
2503
|
+
const dispatched = {
|
|
2504
|
+
text: `Active step ${task.activeStepId ?? "(none)"} was dispatched to the recipe-selected specialist.`,
|
|
2505
|
+
underway: true
|
|
2506
|
+
};
|
|
2507
|
+
if (task.status !== "active" || !step) return dispatched;
|
|
2508
|
+
if (isOwnerStep(step)) {
|
|
2509
|
+
return {
|
|
2510
|
+
text: `Its first step "${step.name}" is the person's own step, so it waits for them.`,
|
|
2511
|
+
underway: false
|
|
2512
|
+
};
|
|
2522
2513
|
}
|
|
2514
|
+
if (stepOwnerGezelId(task, step)) return dispatched;
|
|
2523
2515
|
return {
|
|
2524
|
-
|
|
2525
|
-
|
|
2516
|
+
text: `Nobody was assigned to start its first step "${step.name}" (${step.id}): the step names no suggestedRole and the task belongs to the person, so it will sit idle. Assign it now with assign_task({ ref: "${task.ref}", assignee: "<a gezel's name or a role>" }), which starts the step. Do not invoke the recipe again. If you wrote this recipe, give each step a suggestedRole so the next run starts on its own.`,
|
|
2517
|
+
underway: false
|
|
2526
2518
|
};
|
|
2527
2519
|
}
|
|
2528
|
-
function quantizeImageSize(size) {
|
|
2529
|
-
const rounded = Math.round(size / SIZE_MULTIPLE) * SIZE_MULTIPLE;
|
|
2530
|
-
return Math.max(SIZE_MULTIPLE, Math.min(AGENT_IMAGE_MAX_SIDE_PX, rounded));
|
|
2531
|
-
}
|
|
2532
2520
|
|
|
2533
2521
|
// src/github-tools.ts
|
|
2534
2522
|
import { prioritizePullsForCurrentBranch } from "@bendyline/gezel";
|
|
@@ -4972,7 +4960,7 @@ async function staleStepMutationResult() {
|
|
|
4972
4960
|
sessionStepCompletion = activeStep.advanceWhen ? "automatic" : "manual";
|
|
4973
4961
|
sessionStepCheckedArtifacts = stepCheckedArtifactPaths(activeStep);
|
|
4974
4962
|
}
|
|
4975
|
-
const owner = activeStep ?
|
|
4963
|
+
const owner = activeStep ? stepOwnerGezelId2(task, activeStep) : void 0;
|
|
4976
4964
|
activeStepOwnedBySession = !!gezelId && owner === gezelId;
|
|
4977
4965
|
} catch {
|
|
4978
4966
|
return null;
|
|
@@ -6141,6 +6129,11 @@ function rasterImageWriteRefusal(path) {
|
|
|
6141
6129
|
isError: true
|
|
6142
6130
|
};
|
|
6143
6131
|
}
|
|
6132
|
+
function binaryDocumentWriteRefusal(path, drawer) {
|
|
6133
|
+
if (!isBinaryDocumentPath3(path)) return null;
|
|
6134
|
+
const hasTool = (name) => name === "copy_artifact_to_workspace" ? toolIsAuthorizedForThisSession(name) : authorizedToolNames?.has(canonicalToolName(name)) === true;
|
|
6135
|
+
return errorResult(binaryDocumentWriteRefusalText(path, { drawer, hasTool }));
|
|
6136
|
+
}
|
|
6144
6137
|
server.tool(
|
|
6145
6138
|
"write_file",
|
|
6146
6139
|
GEZEL_TOOL_DESCRIPTIONS2.write_file,
|
|
@@ -6158,7 +6151,7 @@ ${JSON.stringify(drawerPath)} is this task's working folder in the artifacts dra
|
|
|
6158
6151
|
content: [{ type: "text", text: notice }, ...written.content]
|
|
6159
6152
|
};
|
|
6160
6153
|
}
|
|
6161
|
-
const raster = rasterImageWriteRefusal(path);
|
|
6154
|
+
const raster = rasterImageWriteRefusal(path) ?? binaryDocumentWriteRefusal(path, "workspace");
|
|
6162
6155
|
if (raster) return raster;
|
|
6163
6156
|
const scoped = await taskScopedWriteRefusal(path, "workspace");
|
|
6164
6157
|
if (scoped) return scoped;
|
|
@@ -6278,7 +6271,7 @@ server.tool(
|
|
|
6278
6271
|
async ({ path, content, create }) => {
|
|
6279
6272
|
const stale = await staleStepMutationResult();
|
|
6280
6273
|
if (stale) return stale;
|
|
6281
|
-
const raster = rasterImageWriteRefusal(path);
|
|
6274
|
+
const raster = rasterImageWriteRefusal(path) ?? binaryDocumentWriteRefusal(path, "workspace");
|
|
6282
6275
|
if (raster) return raster;
|
|
6283
6276
|
const scoped = await taskScopedWriteRefusal(path, "workspace");
|
|
6284
6277
|
if (scoped) return scoped;
|
|
@@ -7646,7 +7639,7 @@ async function writeArtifactToolCall({
|
|
|
7646
7639
|
}) {
|
|
7647
7640
|
const stale = await staleStepMutationResult();
|
|
7648
7641
|
if (stale) return stale;
|
|
7649
|
-
const raster = rasterImageWriteRefusal(path);
|
|
7642
|
+
const raster = rasterImageWriteRefusal(path) ?? binaryDocumentWriteRefusal(path, "artifacts");
|
|
7650
7643
|
if (raster) return raster;
|
|
7651
7644
|
const scoped = await taskScopedWriteRefusal(path, "artifacts");
|
|
7652
7645
|
if (scoped) return scoped;
|
|
@@ -7759,8 +7752,7 @@ async function writeArtifactToolCall({
|
|
|
7759
7752
|
};
|
|
7760
7753
|
}
|
|
7761
7754
|
}
|
|
7762
|
-
|
|
7763
|
-
await api.writeProjectArtifact(projectId, clean, stored, {
|
|
7755
|
+
await api.writeProjectArtifact(projectId, clean, content, {
|
|
7764
7756
|
...gezelId ? { gezelId } : {},
|
|
7765
7757
|
...sessionId ? { sessionId } : {}
|
|
7766
7758
|
});
|
|
@@ -8268,11 +8260,18 @@ function craftbookSetupRequiredText(craftbookId, missing) {
|
|
|
8268
8260
|
}).join(", ");
|
|
8269
8261
|
return `SETUP REQUIRED for craftbook "${craftbookId}": install/configure ${needs} from the project's Craftbooks/Commands setup before invoking it. Do not create a substitute task, hand-write replacement steps, or silently change the requested output format.`;
|
|
8270
8262
|
}
|
|
8271
|
-
async function autoInstallTrustedCraftbookToolsets(project, requirements) {
|
|
8263
|
+
async function autoInstallTrustedCraftbookToolsets(project, requirements, missing) {
|
|
8272
8264
|
const installed = [];
|
|
8273
8265
|
const scope = { kind: "project", projectId: project };
|
|
8274
8266
|
const roster = await api.listInstalledToolsets(scope);
|
|
8267
|
+
const machineWide = new Set(
|
|
8268
|
+
(await api.listInstalledToolsets({ kind: "system" }).catch(() => ({ toolsets: [] }))).toolsets.map((entry) => entry.toolsetId)
|
|
8269
|
+
);
|
|
8270
|
+
const missingIds = new Set(missing.map((need) => need.toolsetId));
|
|
8275
8271
|
for (const need of requirements) {
|
|
8272
|
+
if (machineWide.has(need.toolsetId)) continue;
|
|
8273
|
+
const projectCopy = roster.toolsets.some((entry) => entry.toolsetId === need.toolsetId);
|
|
8274
|
+
if (!projectCopy && !missingIds.has(need.toolsetId)) continue;
|
|
8276
8275
|
const detail = await api.getCatalogItem("toolset", need.toolsetId, {
|
|
8277
8276
|
...need.sourceId ? { source: need.sourceId } : {}
|
|
8278
8277
|
});
|
|
@@ -8385,7 +8384,8 @@ async function launchCraftbookTask(args) {
|
|
|
8385
8384
|
const declaredRequirements = declaredCraftbook?.manifest.kind === "craftbook-template" ? declaredCraftbook.manifest.toolsets ?? missing : missing;
|
|
8386
8385
|
const installed = await autoInstallTrustedCraftbookToolsets(
|
|
8387
8386
|
args.project,
|
|
8388
|
-
declaredRequirements.filter((need) => !need.optional)
|
|
8387
|
+
declaredRequirements.filter((need) => !need.optional),
|
|
8388
|
+
missing
|
|
8389
8389
|
);
|
|
8390
8390
|
if (installed.length > 0) {
|
|
8391
8391
|
projectCraftbooks = await api.listProjectCraftbooks(args.project);
|
|
@@ -8725,6 +8725,7 @@ async function runInvokeCraftbook({
|
|
|
8725
8725
|
}
|
|
8726
8726
|
const created = launch.task;
|
|
8727
8727
|
const stepCount = created.craftbook.steps.length;
|
|
8728
|
+
const start = entryStepStart(created);
|
|
8728
8729
|
const installedText = launch.installed.length > 0 ? ` Installed or upgraded project toolset${launch.installed.length === 1 ? "" : "s"}: ${launch.installed.join(", ")}.` : "";
|
|
8729
8730
|
const versionText = launch.kind === "created" && launch.ignoredVersion ? ` Version "${launch.ignoredVersion}" is not one this craftbook offers, so the latest ran.` : "";
|
|
8730
8731
|
const idempotentText = launched.reused ? " This identical craftbook invocation already succeeded in the current root turn; reused its task instead of creating a duplicate." : "";
|
|
@@ -8743,7 +8744,7 @@ async function runInvokeCraftbook({
|
|
|
8743
8744
|
}
|
|
8744
8745
|
},
|
|
8745
8746
|
{
|
|
8746
|
-
text: `Invoked craftbook "${craftbookId}" \u2014 task ${created.ref} (${stepCount} step(s)).
|
|
8747
|
+
text: `Invoked craftbook "${craftbookId}" \u2014 task ${created.ref} (${stepCount} step(s)). ${start.text}${installedText}${versionText}${idempotentText}${start.underway ? ` Tell the person that ${taskPersonNoun(created)} is underway.` : ""} ${PLAIN_WORDS_RELAY}`
|
|
8747
8748
|
}
|
|
8748
8749
|
);
|
|
8749
8750
|
} catch (err) {
|
|
@@ -8777,6 +8778,13 @@ async function runInvokeCraftbook({
|
|
|
8777
8778
|
}
|
|
8778
8779
|
}
|
|
8779
8780
|
async function resolveCraftbookTarget(args) {
|
|
8781
|
+
const target = await resolveOptionalCraftbookTarget(args);
|
|
8782
|
+
if (target) return target;
|
|
8783
|
+
throw new Error(
|
|
8784
|
+
"no craftbook target: pass `craftbook` (a local template id) or `task` (a task ref), or run inside a craftbook-editing or task session."
|
|
8785
|
+
);
|
|
8786
|
+
}
|
|
8787
|
+
async function resolveOptionalCraftbookTarget(args) {
|
|
8780
8788
|
if (args.task) {
|
|
8781
8789
|
const parsed = await parseRef(args.task);
|
|
8782
8790
|
const target = {
|
|
@@ -8798,9 +8806,7 @@ async function resolveCraftbookTarget(args) {
|
|
|
8798
8806
|
const parsed = await parseRef(sessionTaskRef);
|
|
8799
8807
|
return { kind: "task", projectId: parsed.projectId, num: parsed.num, ref: sessionTaskRef };
|
|
8800
8808
|
}
|
|
8801
|
-
|
|
8802
|
-
"no craftbook target: pass `craftbook` (a local template id) or `task` (a task ref), or run inside a craftbook-editing or task session."
|
|
8803
|
-
);
|
|
8809
|
+
return null;
|
|
8804
8810
|
}
|
|
8805
8811
|
function describeTarget(t) {
|
|
8806
8812
|
return t.kind === "task" ? `task ${t.ref}` : `craftbook ${t.id}`;
|
|
@@ -8885,14 +8891,17 @@ server.tool(
|
|
|
8885
8891
|
return cbResult(doc.content);
|
|
8886
8892
|
}
|
|
8887
8893
|
const book = await loadTargetCraftbook(t);
|
|
8888
|
-
const
|
|
8894
|
+
const template = t.kind === "craftbook" ? (await api.getCraftbook(t.id).catch(() => null))?.craftbook : null;
|
|
8895
|
+
const scripts = t.kind === "task" ? (await api.getTask(t.projectId, t.num)).craftbook.scripts : template?.scripts;
|
|
8896
|
+
const checkup = template && template.id === sessionCraftbookId ? craftbookCheckup(template).map((finding) => finding.message) : null;
|
|
8889
8897
|
return cbResult(
|
|
8890
8898
|
JSON.stringify(
|
|
8891
8899
|
{
|
|
8892
8900
|
target: describeTarget(t),
|
|
8893
8901
|
entryStepId: book.entryStepId,
|
|
8894
8902
|
steps: book.steps,
|
|
8895
|
-
...scripts ? { scripts: Object.keys(scripts) } : {}
|
|
8903
|
+
...scripts ? { scripts: Object.keys(scripts) } : {},
|
|
8904
|
+
...checkup ? { checkup } : {}
|
|
8896
8905
|
},
|
|
8897
8906
|
null,
|
|
8898
8907
|
2
|
|
@@ -8911,13 +8920,13 @@ server.tool(
|
|
|
8911
8920
|
},
|
|
8912
8921
|
async ({ task, craftbook, create, content, format }) => {
|
|
8913
8922
|
try {
|
|
8914
|
-
|
|
8923
|
+
const t = create ? null : await resolveOptionalCraftbookTarget({ task, craftbook });
|
|
8924
|
+
if (!t) {
|
|
8915
8925
|
const res2 = await api.createCraftbookDocument({ content, ...format ? { format } : {} });
|
|
8916
8926
|
return cbResult(
|
|
8917
8927
|
`Created craftbook "${res2.craftbook.name}" (${res2.craftbook.id}) \u2014 ${res2.gatedSteps} of ${res2.stepCount} steps are gated. Invoke it with invoke_craftbook({ craftbookId: "${res2.craftbook.id}" }).`
|
|
8918
8928
|
);
|
|
8919
8929
|
}
|
|
8920
|
-
const t = await resolveCraftbookTarget({ task, craftbook });
|
|
8921
8930
|
if (t.kind === "task") {
|
|
8922
8931
|
const res2 = await api.putTaskCraftbookDocument(t.projectId, t.num, {
|
|
8923
8932
|
content,
|
|
@@ -10661,7 +10670,7 @@ async function runStartProject(input, tool) {
|
|
|
10661
10670
|
if (binaryRequest) {
|
|
10662
10671
|
return runBinaryDocumentProject({ ...brief, taskTitle, kickoffMessage }, binaryRequest, tool);
|
|
10663
10672
|
}
|
|
10664
|
-
const routed = await routeBriefToProjectType(
|
|
10673
|
+
const routed = await routeBriefToProjectType({ name, about, taskDescription });
|
|
10665
10674
|
if (routed) {
|
|
10666
10675
|
const typed = await runTypedKickoff(brief, routed, {
|
|
10667
10676
|
cacheTool: tool,
|
|
@@ -11029,7 +11038,7 @@ async function runFlatProject(input, cacheTool) {
|
|
|
11029
11038
|
cacheTool
|
|
11030
11039
|
);
|
|
11031
11040
|
}
|
|
11032
|
-
const routed = await routeBriefToProjectType(
|
|
11041
|
+
const routed = await routeBriefToProjectType({ name, about, taskDescription });
|
|
11033
11042
|
if (routed) {
|
|
11034
11043
|
const typed = await runTypedKickoff(brief, routed, {
|
|
11035
11044
|
cacheTool,
|
|
@@ -12538,9 +12547,10 @@ function inferGeneratedImageSaveAs(prompt) {
|
|
|
12538
12547
|
return /\blogo\b/i.test(prompt) ? "assets/logo.png" : void 0;
|
|
12539
12548
|
}
|
|
12540
12549
|
var promptGuidesShown = /* @__PURE__ */ new Set();
|
|
12550
|
+
var imageStylesShown = /* @__PURE__ */ new Set();
|
|
12541
12551
|
server.tool(
|
|
12542
12552
|
"generate_image",
|
|
12543
|
-
"Generate or edit an image from a plain-sentence description; set `aspectRatio` for its shape. When called with just a prompt, produces a fresh image. When `inputImages` is supplied, the prompt acts as an edit/transform on the source(s) \u2014 e.g. 'just like this one but yellow', 'add a hat', 'compose these together'. Routes through whichever image engine the user has selected: the local stable-diffusion.cpp sidecar (default;
|
|
12553
|
+
"Generate or edit an image from a plain-sentence description; set `aspectRatio` for its shape. When called with just a prompt, produces a fresh image. When `inputImages` is supplied, the prompt acts as an edit/transform on the source(s) \u2014 e.g. 'just like this one but yellow', 'add a hat', 'compose these together'. Routes through whichever image engine the user has selected: the local stable-diffusion.cpp sidecar (default; an editing model such as Qwen Image Edit or FLUX.2 Klein follows the prompt as an instruction on up to three sources), Google Nano Banana 2 (multi-image edits / compositing), or OpenAI GPT Image 2 (edit / compositing). Output PNG is written to the project's `artifacts/generated/` folder and can be read back via `read_artifact`. If the prompt is for a logo and `saveAs` is omitted, the workspace copy defaults to `assets/logo.png` so HTML/CSS can reference a stable path. For shape and size pass `aspectRatio` ('9:16' for a phone wallpaper or story, '16:9' for a banner or slide, '4:5' for a portrait post) and `quality` ('draft' for a quick look, 'high' for a large print); the service fits both to the model. Use width and height only when the user named exact pixels, and omit steps. Write the prompt as sentences describing subject, setting, light and style; put any words the image must show in quotes. **Tip:** to iterate on an image you just generated, pass its `artifactPath` (returned by the previous call) \u2014 far cheaper than re-encoding the bytes. Cloud providers may surface a one-time confirmation card to the user before each call (the user can choose Always allow to silence it). On error the tool returns a message directing the user to the Image generation settings.",
|
|
12544
12554
|
{
|
|
12545
12555
|
prompt: z8.string().min(1).describe("What the image should depict, or what edit to apply when `inputImages` is set."),
|
|
12546
12556
|
negativePrompt: z8.string().optional().describe("Concepts to avoid."),
|
|
@@ -12572,10 +12582,16 @@ server.tool(
|
|
|
12572
12582
|
})
|
|
12573
12583
|
])
|
|
12574
12584
|
).optional().describe(
|
|
12575
|
-
"Source images for edit / reference-driven generation. Cloud providers accept multiple references for compositing; the local
|
|
12585
|
+
"Source images for edit / reference-driven generation. Cloud providers accept multiple references for compositing; the local engine picks an installed editing model, which takes up to three, and older local models use only the first (img2img). When no installed model can edit, the sources are dropped and the result notes that the image was generated from the prompt alone. Prefer `artifactPath` over base64 when the image lives in the project."
|
|
12576
12586
|
),
|
|
12577
12587
|
strength: z8.number().min(0).max(1).optional().describe(
|
|
12578
|
-
"Edit strength when `inputImages` is supplied (0 = preserve source, 1 = ignore it). Local
|
|
12588
|
+
"Edit strength when `inputImages` is supplied (0 = preserve source, 1 = ignore it). Local img2img models only; editing models and cloud providers ignore it."
|
|
12589
|
+
),
|
|
12590
|
+
requireEdit: z8.boolean().optional().describe(
|
|
12591
|
+
"Set true when the result must be a change to `inputImages`: fail instead of drawing from the prompt alone when no installed model can edit."
|
|
12592
|
+
),
|
|
12593
|
+
style: z8.string().optional().describe(
|
|
12594
|
+
'A look to draw in, by name. Use only when the person asked for one; the result names the styles this model has. With a style, leave medium words such as "photo" out of the prompt: they work against it.'
|
|
12579
12595
|
),
|
|
12580
12596
|
saveAs: z8.string().optional().describe(
|
|
12581
12597
|
"Workspace-relative path to write the image at (e.g. `logo.png` or `assets/hero.png`). When set, the image lands there instead of the default seed-keyed name \u2014 useful when another gezel will reference the file later (HTML `<img src>`, CSS `url(...)`, etc.) and needs a predictable path. Must be a relative path with no `..` segments and a `.png` / `.jpg` / `.jpeg` / `.webp` extension. Existing files at the same path are overwritten."
|
|
@@ -12583,25 +12599,27 @@ server.tool(
|
|
|
12583
12599
|
},
|
|
12584
12600
|
async (args) => {
|
|
12585
12601
|
try {
|
|
12586
|
-
const
|
|
12587
|
-
const cloud = !args.model?.startsWith("remote:") && ["copilot", "codex-cli", "google-ai", "openai"].includes(config.imageProvider ?? "sd-cpp");
|
|
12588
|
-
const normalized = normalizeGenerateImageToolArgs(args, cloud ? "cloud" : "local");
|
|
12589
|
-
const imageArgs = normalized.args;
|
|
12590
|
-
const saveAs = imageArgs.saveAs || inferGeneratedImageSaveAs(imageArgs.prompt);
|
|
12602
|
+
const saveAs = args.saveAs || inferGeneratedImageSaveAs(args.prompt);
|
|
12591
12603
|
const res = await api.generateImage({
|
|
12592
|
-
prompt:
|
|
12593
|
-
...
|
|
12594
|
-
...
|
|
12595
|
-
...
|
|
12596
|
-
...
|
|
12597
|
-
...
|
|
12598
|
-
...
|
|
12599
|
-
...
|
|
12600
|
-
...
|
|
12601
|
-
...
|
|
12602
|
-
...
|
|
12604
|
+
prompt: args.prompt,
|
|
12605
|
+
...args.negativePrompt ? { negativePrompt: args.negativePrompt } : {},
|
|
12606
|
+
...args.model ? { model: args.model } : {},
|
|
12607
|
+
...args.width ? { width: args.width } : {},
|
|
12608
|
+
...args.height ? { height: args.height } : {},
|
|
12609
|
+
...args.aspectRatio ? { aspectRatio: args.aspectRatio } : {},
|
|
12610
|
+
...args.quality ? { quality: args.quality } : {},
|
|
12611
|
+
...args.steps ? { steps: args.steps } : {},
|
|
12612
|
+
...args.seed !== void 0 ? { seed: args.seed } : {},
|
|
12613
|
+
...args.inputImages && args.inputImages.length > 0 ? { inputImages: args.inputImages } : {},
|
|
12614
|
+
...args.strength !== void 0 ? { strength: args.strength } : {},
|
|
12615
|
+
...args.requireEdit ? { requireEdit: true } : {},
|
|
12616
|
+
...args.style ? { style: args.style } : {},
|
|
12603
12617
|
...saveAs ? { saveAs } : {},
|
|
12604
12618
|
capStepsAtRecommended: true,
|
|
12619
|
+
// The daemon holds the size to about a megapixel only when a local
|
|
12620
|
+
// engine serves the call. Only it knows which provider that is: a
|
|
12621
|
+
// session token cannot read the config.
|
|
12622
|
+
capSizeForAgent: true,
|
|
12605
12623
|
projectId,
|
|
12606
12624
|
// Pin agent + session so the cloud-image cost-confirmation
|
|
12607
12625
|
// gate can synthesize a question scoped to the right
|
|
@@ -12615,19 +12633,22 @@ server.tool(
|
|
|
12615
12633
|
// Playwright `browser_screenshot` tools use.
|
|
12616
12634
|
inline: true
|
|
12617
12635
|
});
|
|
12618
|
-
const { meta, artifactPath, workspacePath, b64Png, promptGuide } = res;
|
|
12636
|
+
const { meta, artifactPath, workspacePath, b64Png, promptGuide, styles } = res;
|
|
12619
12637
|
const workspaceLine = workspacePath ? `
|
|
12620
12638
|
|
|
12621
12639
|
To display this image in HTML, copy this exact tag verbatim \u2014 do not add any prefix, do not change the filename:
|
|
12622
12640
|
\`<img src="${workspacePath}">\`
|
|
12623
12641
|
|
|
12624
12642
|
If you are working on a website/logo task and an HTML file already exists, your next tool call should patch that HTML with this exact tag using \`replace_in_file\` or \`write_file\`. Do not call \`generate_image\` again for the same missing image; the image asset already exists.` : "\n\nNOTE: workspace copy was skipped (project has an external workingDir not approved for writes). To reference from HTML, copy the image into the workspace yourself first via `write_file`.";
|
|
12625
|
-
const normalizedLine = normalized.note ? ` ${normalized.note}` : "";
|
|
12626
12643
|
const settingsLine = meta.settingsNotes?.length ? ` Image settings: ${meta.settingsNotes.join(" ")}` : "";
|
|
12627
12644
|
const skippedLine = meta.img2imgSkippedReason ? ` NOTE: the source image was not used \u2014 ${meta.img2imgSkippedReason}; the image was generated from the prompt alone.` : "";
|
|
12628
12645
|
const guideLine = promptGuide && !promptGuidesShown.has(meta.model) ? ` For your next prompt: ${promptGuide}` : "";
|
|
12629
12646
|
if (promptGuide) promptGuidesShown.add(meta.model);
|
|
12630
|
-
const
|
|
12647
|
+
const appliedStyle = meta.loras?.find((l) => styles?.some((s) => s.id === l.id));
|
|
12648
|
+
const styleLine = appliedStyle ? ` Style: ${appliedStyle.name}.` : "";
|
|
12649
|
+
const stylesLine = styles?.length && !imageStylesShown.has(meta.model) ? ` Styles this model has: ${styles.map((s) => s.name).join(", ")}.` : "";
|
|
12650
|
+
if (styles?.length) imageStylesShown.add(meta.model);
|
|
12651
|
+
const summary = `Generated ${meta.widthPx}\xD7${meta.heightPx} image with ${meta.model} (seed ${meta.seed}, ${meta.steps} steps, ${meta.durationMs}ms).${styleLine}${settingsLine}${skippedLine}${guideLine}${stylesLine} The user already sees this image inline below the tool call \u2014 DO NOT embed it again as Markdown (e.g. \`\`); just refer to it by name in your reply when needed. To iterate on it, pass \`{ inputImages: [{ artifactPath: "${artifactPath}" }] }\` to a follow-up generate_image call. To read its bytes, call \`read_artifact\` with path \`${artifactPath}\`.${workspaceLine}`;
|
|
12631
12652
|
const content = [{ type: "text", text: summary }];
|
|
12632
12653
|
if (b64Png) {
|
|
12633
12654
|
content.push({ type: "image", data: b64Png, mimeType: "image/png" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"description": "Gezel's Model Context Protocol server: gives gezels and other MCP clients access to memory, workspace files, artifacts, tasks, and team tools.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"!dist/**/*.map"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@bendyline/gezel": "1.2.
|
|
60
|
-
"@bendyline/gezel-client": "1.2.
|
|
61
|
-
"@modelcontextprotocol/sdk": "1.
|
|
59
|
+
"@bendyline/gezel": "1.2.12",
|
|
60
|
+
"@bendyline/gezel-client": "1.2.12",
|
|
61
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
62
62
|
"typescript": "^6.0.3",
|
|
63
|
-
"zod": "
|
|
63
|
+
"zod": "4.6.7"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^24.13.3",
|