Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.2.1 - 2026-11-22

- Use an image attached to the chat as a reference: `upload_reference` shows a card in Claude where you choose, drop or paste the image on a computer or phone, and the card sends the reference ID back. Claude cannot pass a chat attachment to a tool, and the hosted server cannot read local paths.
- GIF requests accept reference images. They are sent to the OpenAI edits endpoint with the frame settings, and the next version of such a GIF keeps the original's references.
- A hosted server cannot scale an animated GIF, so a GIF request whose size the model does not render natively is refused before submission, with the size to request instead (for example 608x1088 for a tall GIF of up to 12 frames). Locally such GIFs are still scaled.
- A blocked job whose generated file was saved can be previewed with `view_image` and downloaded from the job view, as the web panel already allowed.
- The Cloudflare generation queue runs up to 20 jobs at once instead of 4.

## 0.2.0 — 2026-11-20

- Deploy image-queue to your own Cloudflare account with `pnpm cloudflare:setup`: D1, R2, a generation queue, a custom domain, Cloudflare Access with Managed OAuth and the Worker secrets in one repeatable command. See [docs/cloudflare.md](docs/cloudflare.md) and [ADR-0020](docs/decisions/0020-remote-mcp-behind-cloudflare-access.md).
Expand Down
2 changes: 1 addition & 1 deletion docs/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ node scripts/cloudflare-acceptance.mjs
## Limits

- The Codex file queue and its local workers cannot run on Cloudflare. Cloud jobs use the API.
- `add_reference` reads local files, so it does not work against the hosted endpoint. Upload references in the panel instead.
- `add_reference` reads local files, so it does not work against the hosted endpoint. Claude also cannot pass an image attached to the chat to a tool. Ask Claude to use a reference instead: it calls `upload_reference`, which shows a card where you choose, drop or paste the image on a computer or phone. The card uploads it, scaling photos over 3 MB down to 2048 px, and sends the reference ID back to Claude.
- The hosted MCP endpoint is stateless. It always lists the MCP Apps views (request, image and gallery), because it never sees the client's initialize request.
- All allowed users share one workspace.
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Step-by-step setup and client connection instructions are in [Cloudflare deploym
pnpm build:cloudflare
```

The application includes a D1/R2 storage adapter and migrations. Cloudflare thumbnail generation uses the IMAGES binding; generated thumbnails are cached in R2 by content hash. API generation runs from the `image-queue-generation` Cloudflare Queue: a request creates the job and returns at once, and the queue consumer runs one job per invocation without automatic retries, so a client time limit cannot interrupt a paid attempt. A job whose lock is held by another operation is offered again every 10 seconds for about five minutes; nothing is sent to the provider until the lock is taken. D1 locks carry a 20-minute lease, longer than a consumer's 15-minute limit, so a lock left by a stopped Worker is released. See [ADR-0020](decisions/0020-remote-mcp-behind-cloudflare-access.md).
The application includes a D1/R2 storage adapter and migrations. Cloudflare thumbnail generation uses the IMAGES binding; generated thumbnails are cached in R2 by content hash. API generation runs from the `image-queue-generation` Cloudflare Queue: a request creates the job and returns at once, and the queue consumer runs one job per invocation without automatic retries, so a client time limit cannot interrupt a paid attempt. Up to 20 jobs run at once (`max_concurrency` of the queue consumer in `wrangler.jsonc`); each one is a separate billed provider call. A job whose lock is held by another operation is offered again every 10 seconds for about five minutes; nothing is sent to the provider until the lock is taken. D1 locks carry a 20-minute lease, longer than a consumer's 15-minute limit, so a lock left by a stopped Worker is released. See [ADR-0020](decisions/0020-remote-mcp-behind-cloudflare-access.md).

Before deploying, create the D1 database, the R2 bucket and the queue, replace the local D1 ID in `wrangler.jsonc`, apply the files in `migrations/` in order, and attach a custom domain. The Worker is not served on `workers.dev` or preview URLs. Configure `IMAGE_QUEUE_STORAGE_DRIVER=cloudflare`, `IMAGE_QUEUE_CF_ACCESS_TEAM_DOMAIN` (for example `team.cloudflareaccess.com`), `IMAGE_QUEUE_CF_ACCESS_AUDIENCE` (the Access application's AUD tag) and `IMAGE_QUEUE_ACCESS_ALLOWED_EMAILS` (comma-separated). Provider API keys are Cloudflare platform secrets using the prefixed names above; use a dedicated key with a monthly spend limit.

Expand Down
2 changes: 1 addition & 1 deletion docs/model-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Sources:

The OpenAI Platform playground also offers "Extra high" and "Max" complexity for 2.6 Sunburst. The API reference and the guide list only low, medium and high, so the profiles follow the API documentation.

An API request may set `outputFormat` to a value in that model's `outputFormats`. Omitting it stores PNG. The same request may set `frameCount` (2–16) and `frameDurationMs` (20–2000) only for GIF. SVG cannot be combined with reference images or frame settings, and each SVG job is its own generation with `n=1`. GIF output with reference images is not supported by this application yet. Queue requests cannot set a format or frame timing. Quality, complexity and output format are refused for queue requests and for models that do not list them. A transparent background is refused unless the format is PNG or WebP.
An API request may set `outputFormat` to a value in that model's `outputFormats`. Omitting it stores PNG. The same request may set `frameCount` (2–16) and `frameDurationMs` (20–2000) only for GIF. SVG cannot be combined with reference images or frame settings, and each SVG job is its own generation with `n=1`. GIF output may include reference images; they guide the animation. Queue requests cannot set a format or frame timing. Quality, complexity and output format are refused for queue requests and for models that do not list them. A transparent background is refused unless the format is PNG or WebP.

PNG, WebP and JPEG results are fitted to the requested exact size in that format. GIF keeps its animation when it can be fitted without upscaling; otherwise the generated animation is stored and the job records why fitting failed. SVG is stored as generated, and its width and height are the provider size. Exact sizes that are off the 16-pixel grid or below the minimum pixel count, such as 256 × 256 sprites, are generated at the smallest covering size and fitted down; sizes above the limits are refused, never upscaled.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "image-queue",
"version": "0.2.0",
"version": "0.2.1",
"description": "Local-first image queue and generation workspace",
"scripts": {
"dev": "next dev --hostname 127.0.0.1 --port 3215",
Expand Down
9 changes: 9 additions & 0 deletions scripts/build-mcp-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ const imageScript = imageBuild.outputFiles[0].text.replaceAll("</script", "<\\/s
const imageHtml = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><style>${baseCss}p{margin:0}[role=status]{font-weight:var(--font-weight-semibold,600)}#source{margin-top:2px;color:${secondaryText};font-size:var(--font-text-sm-size,13px);line-height:var(--font-text-sm-line-height,1.5)}#source:empty{display:none}.image-frame{position:relative;width:fit-content;max-width:100%;margin-top:12px}img{display:block;max-width:100%;max-height:420px;object-fit:contain;border-radius:var(--border-radius-lg,12px);touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}#draft-point{pointer-events:none}.note-region{position:absolute;box-sizing:border-box;border:2px dashed white;outline:1px solid #222;pointer-events:none}.note-pin{position:absolute;z-index:1;box-sizing:border-box;display:grid;place-items:center;width:24px;height:24px;min-width:24px;min-height:24px;padding:0;transform:translate(-50%,-50%);border:2px solid var(--color-background-primary,Canvas);border-radius:50%;background:var(--color-background-inverse,CanvasText);color:var(--color-text-inverse,Canvas);font:inherit;font-size:var(--font-text-xs-size,12px);font-weight:var(--font-weight-semibold,600);line-height:1;box-shadow:0 1px 3px rgb(0 0 0/.35)}.note-pin[hidden]{display:none}#versions{display:flex;gap:8px;overflow:auto;margin-top:12px}#versions[hidden]{display:none}.label,#note-form label{font-size:var(--font-text-sm-size,13px);font-weight:var(--font-weight-medium,500)}.hint{color:${secondaryText};font-size:var(--font-text-sm-size,13px);line-height:var(--font-text-sm-line-height,1.5)}.saved{margin-top:16px}.saved:not(:has(li)),.saved[hidden],#note-form[hidden],#no-corrections[hidden]{display:none}#no-corrections{margin-top:12px}#notes{margin:4px 0 0;padding-left:20px}#note-form{display:grid;gap:8px;margin-top:16px}#note-form .hint{margin-top:-4px}#note-text::placeholder{color:${secondaryText}}#note-text{box-sizing:border-box;width:100%;min-height:72px;padding:8px 12px;border:1px solid var(--color-border-primary,color-mix(in srgb,currentColor 35%,transparent));border-radius:var(--border-radius-md,8px);background:var(--color-background-secondary,transparent);color:inherit;font:inherit;resize:vertical}.note-actions{display:flex;flex-wrap:wrap;gap:8px}#queue-notes{margin-top:12px}#queue-notes[hidden],#clear-point[hidden]{display:none}${buttonCss("button:not(.note-pin)")}button:not(.note-pin){min-width:44px}li{margin:4px 0;overflow-wrap:anywhere}</style></head><body><p role="status">Loading image…</p><p id="source"></p><div class="image-frame"><img id="preview" hidden alt="Image"><div id="pins"></div><span id="draft-point" class="note-pin" hidden aria-hidden="true">+</span></div><nav id="versions" aria-label="Image versions"></nav><p class="hint" id="no-corrections" hidden>Changes cannot be requested for this kind of image.</p><form id="note-form"><label for="note-text">Next version</label><p class="hint" id="note-hint">Describe a change and save it. If it is about one place, tap that place on the image first. Request next version then generates a new image with your saved changes.</p><textarea id="note-text" required maxlength="4000" placeholder="What should change?" aria-describedby="note-hint"></textarea><div class="note-actions"><button id="save-note" type="submit">Save change</button><button id="clear-point" type="button" hidden>Apply to whole image</button></div></form><div class="saved"><p class="label" id="notes-title">Saved changes</p><ol id="notes" aria-labelledby="notes-title"></ol><button id="queue-notes" class="primary" type="button" hidden>Request next version</button></div><script>${imageScript}</script></body></html>`;
reportViewSize("image", imageHtml);
await writeFile("src/mcp/views/image-html.ts", `// Generated by scripts/build-mcp-views.ts\nexport const imageViewHtml = ${JSON.stringify(imageHtml)};\nexport const imageViewVersion = ${JSON.stringify(viewVersion(imageHtml))};\n`);

const referenceBuild = await build({
entryPoints: ["src/mcp/views/reference.ts"], bundle: true, write: false,
format: "iife", platform: "browser", minify: true,
});
const referenceScript = referenceBuild.outputFiles[0].text.replaceAll("</script", "<\\/script");
const referenceHtml = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><style>${baseCss}p{margin:0}[role=status]{font-weight:var(--font-weight-semibold,600)}.hint{margin-top:4px;color:${secondaryText};font-size:var(--font-text-sm-size,13px);line-height:var(--font-text-sm-line-height,1.5)}#drop{display:grid;justify-items:start;gap:8px;margin-top:12px;padding:16px;border:var(--border-width-regular,1px) dashed var(--color-border-primary,color-mix(in srgb,currentColor 35%,transparent));border-radius:var(--border-radius-lg,12px)}#drop[data-over]{background:var(--color-background-secondary,color-mix(in srgb,currentColor 8%,transparent))}#file{display:none}${buttonCss("button")}ol{margin:12px 0 0;padding-left:20px}ol:empty{display:none}li{margin:4px 0;overflow-wrap:anywhere;font-size:var(--font-text-sm-size,13px)}</style></head><body><p role="status">Connecting to image-queue…</p><p class="hint">Claude cannot pass a file attached to the chat to image-queue, so choose the same image here. PNG, JPEG or WebP; large photos are scaled down to 2048 px.</p><div id="drop"><button id="choose" class="primary" type="button" disabled>Choose image</button><p class="hint">or drop or paste it here</p><input id="file" type="file" accept="image/png,image/jpeg,image/webp" multiple></div><ol id="uploaded" aria-label="Uploaded references"></ol><script>${referenceScript}</script></body></html>`;
reportViewSize("reference", referenceHtml);
await writeFile("src/mcp/views/reference-html.ts", `// Generated by scripts/build-mcp-views.ts\nexport const referenceViewHtml = ${JSON.stringify(referenceHtml)};\nexport const referenceViewVersion = ${JSON.stringify(viewVersion(referenceHtml))};\n`);
2 changes: 1 addition & 1 deletion skills/image-queue/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Changing a setting alone is not approval for extra generations. Submit the image

## Prepare an accurate request

Choose the intended project from `list_projects`. Read available models and their supported options rather than guessing dimensions or capabilities. For queue requests use the requested `aspectRatio`, or exact `width` and `height` when the user needs them. For API requests use the returned size profile, `transparency`, `qualities`, `complexities` and `outputFormats`; pass `quality`, `complexity` or `outputFormat` only for API requests and only with a listed value. Omit `outputFormat` for PNG. Transparent output is PNG or WebP only. GIF may set `frameCount` (2–16) and `frameDurationMs` (20–2000). SVG cannot include reference images or frame settings. GIF output with reference images is not supported by this application yet. `count` (1–10) creates that many independent jobs; replay the same idempotency key and count to get the same jobs. `request_images` counts the expanded jobs toward 20. Capabilities under `documentedOnly`, and every capability of a model with `generationVerified: false`, come from provider documentation without a generation receipt: check the delivered file. The final raster may be fitted down from a supported provider size; GIF keeps its animation when fitting is possible, and SVG is stored as generated. Do not promise a native size or invent support for transparency.
Choose the intended project from `list_projects`. Read available models and their supported options rather than guessing dimensions or capabilities. For queue requests use the requested `aspectRatio`, or exact `width` and `height` when the user needs them. For API requests use the returned size profile, `transparency`, `qualities`, `complexities` and `outputFormats`; pass `quality`, `complexity` or `outputFormat` only for API requests and only with a listed value. Omit `outputFormat` for PNG. Transparent output is PNG or WebP only. GIF may set `frameCount` (2–16) and `frameDurationMs` (20–2000). SVG cannot include reference images or frame settings. GIF output may include reference images; they guide the animation. `count` (1–10) creates that many independent jobs; replay the same idempotency key and count to get the same jobs. `request_images` counts the expanded jobs toward 20. Capabilities under `documentedOnly`, and every capability of a model with `generationVerified: false`, come from provider documentation without a generation receipt: check the delivered file. The final raster may be fitted down from a supported provider size; GIF keeps its animation when fitting is possible, and SVG is stored as generated. Do not promise a native size or invent support for transparency.

Keep the user's prompt literal. Add style instructions only when requested or approved. Do not silently shorten or rewrite a failed prompt to get a different result. Keep provider-native controls separate from prompt text.

Expand Down
2 changes: 1 addition & 1 deletion src/app/website/setup-prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CopyButton } from "@/components/copy-button";
export const setupPrompt = `Set up image-queue on this Mac. Work locally, not in the cloud. If local file access and shell commands are unavailable, stop and explain what I need to enable.

1. Check git, Node.js 24 or newer, pnpm 10.28.2, and the Codex CLI. Tell me what is missing before installing anything. Ask before each tool installation. Do not use sudo without explaining why and receiving my approval.
2. Check https://github.com/corgicorner/image-queue for release v0.2.0. If that release is unavailable, stop and tell me; do not silently install main or a different version.
2. Check https://github.com/corgicorner/image-queue for release v0.2.1. If that release is unavailable, stop and tell me; do not silently install main or a different version.
3. Install that release into ~/image-queue. If the folder already exists, stop and ask me. Do not overwrite it.
4. Run pnpm install --frozen-lockfile, pnpm build and pnpm build:mcp in that folder. Start with pnpm start and verify http://127.0.0.1:3215 responds. If the port is occupied, identify the process and ask me; do not stop it.
5. Run codex login status. If I am not signed in with ChatGPT, explain the step I must complete myself. Never read authentication files, request credentials in chat, or change my existing login. Do not use an API-key login as a substitute for my ChatGPT plan.
Expand Down
6 changes: 3 additions & 3 deletions src/components/workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ export function Workspace({
: unique;
}, [selectedModel]);
const vectorFormats = orderedFormats.some(value => value === "gif" || value === "svg");
const formatBlocked = (value: string) => (value === "gif" || value === "svg") && (transparent || refs.length > 0);
const formatBlocked = (value: string) => ((value === "gif" || value === "svg") && transparent) || (value === "svg" && refs.length > 0);
useEffect(() => {
if (source !== "api" && Number(variants) > 4) setVariants("4");
}, [source, variants]);
Expand All @@ -977,11 +977,11 @@ export function Workspace({
: outputFormat === "gif" || outputFormat === "svg"
? "Transparent background is available with PNG or WebP output."
: transparent && refs.length
? "Transparent background requires PNG or WebP output. GIF output with reference images is not supported by this application yet. SVG output cannot be combined with reference images."
? "Transparent background requires PNG or WebP output. SVG output cannot be combined with reference images."
: transparent
? "Transparent background requires PNG or WebP output."
: refs.length
? "GIF output with reference images is not supported by this application yet. SVG output cannot be combined with reference images."
? "SVG output cannot be combined with reference images."
: "";
const referencesById = useMemo(() => new Map(data.references.map(reference => [reference.id, reference])), [data.references]);
const selectedRefs = refs.flatMap(id => {
Expand Down
8 changes: 8 additions & 0 deletions src/core/job-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ export const jobStatusLabels: Record<Job["status"], string> = {
export function isReserved(job: Pick<Job, "source" | "status" | "claim">) {
return job.source === "queue" && job.status === "running" && job.claim?.reserved === true;
}

/**
* A finished image, or a generated one that could not be adapted to the
* requested size: that file was saved and blocked only for review.
*/
export function hasSavedResult(job: Pick<Job, "status" | "blobKey">) {
return job.status === "done" || (job.status === "blocked" && Boolean(job.blobKey));
}
Loading
Loading