backdraw 2.1.1 → 2.1.2

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/README.md CHANGED
@@ -8,6 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/backdraw"><img src="https://img.shields.io/npm/v/backdraw" alt="npm version"></a>
11
+ <a href="https://glama.ai/mcp/servers/devtalh/backdraw"><img src="https://glama.ai/mcp/servers/devtalh/backdraw/badges/score.svg" alt="devtalh/backdraw MCP server"></a>
11
12
  </p>
12
13
 
13
14
  <p align="center">
@@ -416,7 +417,7 @@ themselves stay in your images folder.
416
417
 
417
418
  | Tool | Parameters (default) | What it does |
418
419
  |---|---|---|
419
- | `generate_image` | `prompt` (required), `aspect_ratio`, `transparent_background` (false), `reference_images`, `reference_collection`, `reference_files`, `conversation_url`, `auto_reattach` (false), `send_as_is` (false), `output_dir`, `wait_seconds` (45), `include_preview` (true) | Starts a new chat in your Project (or continues `conversation_url`) and generates or edits an image. |
420
+ | `generate_image` | `prompt` (required), `aspect_ratio`, `transparent_background` (false), `reference_images`, `reference_collection`, `reference_files`, `conversation_url`, `auto_reattach` (false), `send_as_is` (false), `output_dir`, `filename_hint`, `wait_seconds` (45), `include_preview` (true) | Starts a new chat in your Project (or continues `conversation_url`) and generates or edits an image. |
420
421
  | `job_status` | `job_id`, `wait_seconds` (45), `include_preview` (true) | Waits for a job and reports it. Without `job_id`: the bridge status (Chrome connected, selected Project, images folder, queue, recent jobs). |
421
422
  | `cancel_job` | `job_id` (required) | Cancels a queued or running job. If ChatGPT is already generating, it presses Stop in the background tab. |
422
423
  | `fetch_images` | `conversation_url` (required), `aspect_ratio`, `output_dir`, `wait_seconds` (45), `include_preview` (true) | Downloads the images of the latest answer in an existing chat, without sending anything. |
@@ -434,6 +435,8 @@ themselves stay in your images folder.
434
435
  - `send_as_is`: send the prompt word for word, without the short instruction Backdraw adds (e.g. to
435
436
  answer a question ChatGPT asked).
436
437
  - `output_dir`: also copy the result into this folder; the images folder always keeps a copy.
438
+ - `filename_hint`: a few words naming the subject, used for the file name instead of the start of
439
+ the prompt (handy when the prompt opens with instructions about the reference images).
437
440
  - `wait_seconds`: 0 to 900.
438
441
 
439
442
  What a result can say:
package/README.tr.md CHANGED
@@ -8,6 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/backdraw"><img src="https://img.shields.io/npm/v/backdraw" alt="npm sürümü"></a>
11
+ <a href="https://glama.ai/mcp/servers/devtalh/backdraw"><img src="https://glama.ai/mcp/servers/devtalh/backdraw/badges/score.svg" alt="devtalh/backdraw MCP sunucusu"></a>
11
12
  </p>
12
13
 
13
14
  <p align="center">
@@ -426,7 +427,7 @@ klasöründe kalır.
426
427
 
427
428
  | Araç | Parametreler (varsayılan) | Ne yapar |
428
429
  |---|---|---|
429
- | `generate_image` | `prompt` (zorunlu), `aspect_ratio`, `transparent_background` (false), `reference_images`, `reference_collection`, `reference_files`, `conversation_url`, `auto_reattach` (false), `send_as_is` (false), `output_dir`, `wait_seconds` (45), `include_preview` (true) | Projende yeni bir sohbet başlatır (ya da `conversation_url`'deki sohbete devam eder) ve görsel üretir veya düzenler. |
430
+ | `generate_image` | `prompt` (zorunlu), `aspect_ratio`, `transparent_background` (false), `reference_images`, `reference_collection`, `reference_files`, `conversation_url`, `auto_reattach` (false), `send_as_is` (false), `output_dir`, `filename_hint`, `wait_seconds` (45), `include_preview` (true) | Projende yeni bir sohbet başlatır (ya da `conversation_url`'deki sohbete devam eder) ve görsel üretir veya düzenler. |
430
431
  | `job_status` | `job_id`, `wait_seconds` (45), `include_preview` (true) | Bir işi bekler ve durumunu bildirir. `job_id` olmadan köprünün durumunu verir (Chrome bağlı mı, seçili Proje, görsel klasörü, kuyruk, son işler). |
431
432
  | `cancel_job` | `job_id` (zorunlu) | Kuyruktaki ya da çalışan bir işi iptal eder. ChatGPT üretmeye başladıysa arka plan sekmesinde Durdur'a basar. |
432
433
  | `fetch_images` | `conversation_url` (zorunlu), `aspect_ratio`, `output_dir`, `wait_seconds` (45), `include_preview` (true) | Var olan bir sohbetin son cevabındaki görselleri, hiçbir şey göndermeden indirir. |
@@ -445,6 +446,8 @@ klasöründe kalır.
445
446
  - `send_as_is`: istemi, Backdraw'ın eklediği kısa talimat olmadan, olduğu gibi gönderir (örneğin
446
447
  ChatGPT'nin sorduğu bir soruyu yanıtlamak için).
447
448
  - `output_dir`: sonucu bu klasöre de kopyalar; görsel klasöründe her zaman bir kopya kalır.
449
+ - `filename_hint`: konuyu anlatan birkaç kelime; dosya adı istemin başı yerine bundan üretilir
450
+ (istem referans görsellerle ilgili talimatlarla başlıyorsa işe yarar).
448
451
  - `wait_seconds`: 0 ile 900 arası.
449
452
 
450
453
  Bir sonuç şunları söyleyebilir:
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "name": "Backdraw",
4
4
  "short_name": "Backdraw",
5
- "version": "2.1.1",
5
+ "version": "2.1.2",
6
6
  "description": "__MSG_extDescription__",
7
7
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtu/jyAJ3e3hnNrNGCxfzvHLOp80L9c3j71jmQV2ymY1DbPfZNJUdrszM3dnk6SFlm/X42F/e1Pf9RoQqMKujWr7KRTtH257vBMmLbk8Eo0LytpGP0F8WOQIcp5TxLZgvqSlGTjdbB2QFJt+uisJFE8Y3nWnZpsmejes0m9NObpqBc7Q1tzZrDAnh6gzddyF8fkYU/gS2Qtu5Vd2YbRiVN18tUUh2Bb+QuXlTlzOE1JQ49A9qRTmXejtcn943ZaQ0aucooNQU4hZAFVUT+25UhzuGMZDFzZALqL19hP0EP4Erm1yitjICvR5yK/7nYObGa3LynEeH7dDJ+qoJaf4TEQIDAQAB",
8
8
  "default_locale": "en",
package/host.js CHANGED
@@ -199,6 +199,8 @@ function createJob(p) {
199
199
  // outputDir: legacy clients, the host writes a copy there. copyTo: the MCP server copies itself
200
200
  // (it runs in the caller's context, so the copy lands where the caller can see it).
201
201
  outputDir: p.outputDir || null, copyTo: p.copyTo || null, copies: [],
202
+ // Names the saved files instead of the prompt (whose opening may be instructions, not the subject).
203
+ filenameHint: String(p.filenameHint || '').trim().slice(0, 200) || null,
202
204
  references: refs.map(r => ({ name: r.name, bytes: Math.round(r.data.length * 0.75) })), autoReattach: !!p.autoReattach,
203
205
  timeoutSec: clamp(Number(p.timeoutSec) || 600, 60, 1800),
204
206
  createdAt: now(), startedAt: null, finishedAt: null,
@@ -323,9 +325,9 @@ function uniquePath(dir, base, ext) {
323
325
  function saveImages(job, images, title) {
324
326
  fs.mkdirSync(config.outputDir, { recursive: true });
325
327
  fs.mkdirSync(shared.PREVIEW_DIR, { recursive: true });
326
- // Named after the prompt; when only collecting (no prompt) ChatGPT's chat title is used instead.
328
+ // Named after filename_hint, else the prompt; when only collecting (no prompt) ChatGPT's chat title.
327
329
  const usefulTitle = title && !/^(chatgpt\b|generate an image|update the image)/i.test(title.trim()) ? title : '';
328
- const base = `${stamp()}_${slugify(job.prompt || usefulTitle)}`;
330
+ const base = `${stamp()}_${slugify(job.filenameHint || job.prompt || usefulTitle)}`;
329
331
  return images.map((img, i) => {
330
332
  const buf = Buffer.from(img.data || '', 'base64');
331
333
  if (buf.length < 100) throw new Error('empty image data');
package/lib/results.js CHANGED
@@ -15,6 +15,9 @@ const checkAgain = id => `Call job_status with job_id="${id}" and wait_seconds=$
15
15
  // A prompt that asks to change an existing image rather than draw a new one.
16
16
  const EDIT_INTENT = /\b(edit(s|ed|ing)?|modif(y|ies|ied|ying)|retouch(es|ed|ing)?|inpaint(s|ed|ing)?|change only|only change|change [a-z ]{1,30} only|keep (everything|it|the rest)|pixel-identical|same (pose|image|drawing|character))\b|düzenle|değiştir|aynı (kalsın|bırak|tut)|koru(yarak)?\b/i;
17
17
 
18
+ const SHOW_IMAGE = 'Show the image to the user in the chat: if you can display or share a local file with the user, do that with the Saved path above ' +
19
+ '(any preview attached here is a small copy for you to check); otherwise give that path clearly.';
20
+
18
21
  const neutral = (pct, against) => `Similarity to ${against}: ${pct}% (a local edit keeps ~95-100%, a redraw is usually under 60%).`;
19
22
 
20
23
  function editCheckLines(job) {
@@ -156,6 +159,8 @@ function resultLines(job) {
156
159
  for (const im of job.images || []) lines.push(...imageLines(job, im));
157
160
  for (const c of job.copies || []) lines.push(`Copied to: ${c}`);
158
161
  if (job.copyError) lines.push(`Could not copy into output_dir: ${job.copyError}`);
162
+ // Clients differ: some show the attached preview only as a small icon, so ask for the file itself.
163
+ if (job.status === 'succeeded' && (job.images || []).length) lines.push(SHOW_IMAGE);
159
164
  lines.push(...editCheckLines(job));
160
165
  if (job.assistantText) {
161
166
  lines.push(job.status === 'succeeded' ? `ChatGPT's text: ${job.assistantText.slice(0, 1500)}` : `ChatGPT's reply:\n${job.assistantText.slice(0, 3000)}`);
@@ -167,4 +172,4 @@ function resultLines(job) {
167
172
  return lines;
168
173
  }
169
174
 
170
- module.exports = { FINAL, DEFAULT_WAIT, EDIT_INTENT, waitSeconds, editCheckLines, imageLines, referenceLines, resultLines };
175
+ module.exports = { FINAL, DEFAULT_WAIT, EDIT_INTENT, SHOW_IMAGE, waitSeconds, editCheckLines, imageLines, referenceLines, resultLines };
package/mcp-server.js CHANGED
@@ -19,12 +19,14 @@ const INSTRUCTIONS = `Generates images with the user's own ChatGPT account (alre
19
19
  - To EDIT an image or keep a character consistent, pass the image file(s) in reference_images (e.g. a file saved by an earlier call). A fresh chat with reference_images is the most reliable way to edit; long revision chains via conversation_url make ChatGPT lose track of earlier images.
20
20
  - For a specific shape (banner, avatar, phone wallpaper) pass aspect_ratio instead of describing the size in the prompt; for stickers/logos/icons that need a see-through background pass transparent_background=true and read the transparency line in the result.
21
21
  - When the user mentions one of their Backdraw collections (reference images they saved from the web in Chrome), call list_collections if needed and pass reference_collection to generate_image.
22
+ - The saved file is named after the start of the prompt. When the prompt opens with something other than the subject (e.g. instructions about the reference images), pass filename_hint with a few words naming what the user asked for.
22
23
  - Read every result line: NEEDS REFERENCE IMAGE means ChatGPT could not reach the image to edit; CHATGPT REPLIED WITHOUT AN IMAGE shows ChatGPT's own text. Never resend the identical prompt in a loop; follow the next step given in the result.
23
24
  - An EDIT CHECK warning means ChatGPT drew a new picture instead of editing; tell the user and retry with reference_images in a fresh chat if an exact edit is needed.
24
25
  - The work happens in a background Chrome tab; never tell the user to switch tabs unless a result says NEEDS USER ACTION.
25
26
  - NEEDS USER ACTION means ChatGPT shows a login or human-verification (CAPTCHA) page: ask the user to open the ChatGPT tab in Chrome and finish it themselves. Never try to get around it. The job continues automatically afterwards (check with job_status).
26
27
  - If no project is selected, call list_projects, then select_project with the user's images project.
27
28
  - If a job timed out but has a conversation link, fetch_images can still download the result later; pass the job's aspect_ratio again so it is cropped the same way.
29
+ - After SUCCESS, show the saved image to the user in the chat: if you can display or share a local file with the user, do that with the saved path (the preview in the result is a small copy for you to check); otherwise give the saved path clearly.
28
30
  - Report the saved file path(s) and the ChatGPT conversation link to the user.`;
29
31
 
30
32
  // Shared by the tools that wait for a job.
@@ -78,6 +80,11 @@ const TOOLS = [
78
80
  type: 'string',
79
81
  description: "Optional folder to also copy the image(s) into, e.g. the current project's assets folder (absolute path preferred). The central images folder always keeps a copy.",
80
82
  },
83
+ filename_hint: {
84
+ type: 'string',
85
+ description: "Optional few words naming the subject (e.g. 'red fox mascot'), used for the saved file name instead of the start of the prompt. " +
86
+ 'Pass it when the prompt opens with something else, such as instructions about the reference images.',
87
+ },
81
88
  wait_seconds: WAIT_SECONDS,
82
89
  include_preview: { type: 'boolean', default: true, description: 'Attach a downscaled preview of the result so you can check it.' },
83
90
  send_as_is: { type: 'boolean', default: false, description: 'Send the prompt verbatim, without the short instruction the bridge adds (useful to answer a question ChatGPT asked).' },
@@ -302,6 +309,7 @@ async function generateImage(args, call) {
302
309
  prompt, references, autoReattach: !!args.auto_reattach, sendAsIs: !!args.send_as_is,
303
310
  aspect: args.aspect_ratio, transparent: !!args.transparent_background,
304
311
  copyTo: args.output_dir ? path.resolve(String(args.output_dir)) : undefined,
312
+ filenameHint: args.filename_hint ? String(args.filename_hint) : undefined,
305
313
  startUrl: args.conversation_url ? String(args.conversation_url) : undefined,
306
314
  referenceCollection: args.reference_collection ? String(args.reference_collection) : undefined,
307
315
  // A single file name as a string works too, like reference_images.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backdraw",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Local MCP server, native messaging host and Chrome extension that let Claude generate images with your own signed-in ChatGPT account in a background tab.",
5
5
  "mcpName": "io.github.devtalh/backdraw",
6
6
  "license": "MIT",