Repository navigation
Conversation
…rver The other half of #61: a photo of the bridge, the product or the tram being talked about shows it better than any summary. Claude names what to picture; GET /api/image searches Wikimedia Commons (no key, reusable licences), then Openverse, prefers a landscape result for the 16:9 screen, and returns a path on this server plus title, credit and licence. The page loads pictures only from GET /api/image/raw, which serves only URLs /api/image found in the last hour (not an open proxy), fetched with page.js's per-hop address checks, capped at 8 MB, and only as JPEG, PNG, WebP or GIF: an SVG served from Cue's own origin could run script if opened directly. Both routes need AGENT_TOKEN. The credit shows small under the picture, as the licences ask. Sources are a list in image.js, so Google Custom Search could be added as one; it needs a key and a search-engine ID, which is Tyler's call. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, for #61 numbers-to-chart: four quarterly numbers read out, then a bar chart. picture-helps: "what does Pena Palace even look like?", then a photo. Each has quiet ticks around it, so a visual everywhere doesn't score. First run (claude-haiku-5-5, low, 2026-11-13): 5/5, $0.002. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Commons has no safe-search: "breast" gave close-up nudity in its top results. Queries and results (title, description, tags) with explicit, anatomical or gory words are refused, and the prompt rules them out. - The server now fetches the picture while searching and keeps the bytes (30 at most, an hour each); /api/image/raw?id= serves only those and fetches nothing itself. A pick that fails (gone, too big, an SVG) falls through to the next of the first three, so a found image always loads. - Relevance first: the top result stays unless it's much taller than wide, and banners wider than 2.2:1 don't count as wide. "Taylor Swift" picked her logo before; now a portrait. - Commons originals that are TIFFs are no longer skipped (the thumbnail is a JPEG; the fetch checks the real type). - Openverse: commercial-use licences only (the default is mostly NC), its own thumbnail instead of the original, and "CC BY 2.0" / "CC0" / "Public domain" in the credit. - Credits decode entities and end in an ellipsis when cut; the page's decode wait has a 5 s limit. - Prompt: names both sources; says a missing image means none was found. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #69
Stacked on #66 (show_visual); this PR's own commits are 7b77f5c, f0b94a4 and 06a792c.
Why
Tyler (#61) wants Cue to "grab images" instead of leaning on words. A photo of the bridge, the product or the tram being discussed shows it faster than any summary.
Change
show_imagetool (agent.js): Claude gives a plain query ("Golden Gate Bridge") and an optional title. One new tool line in the prompt (things a photo can show; never private people); the "one visual per turn" line from Add show_visual: Claude draws SVG charts and stats, shown sandboxed #66 now names it too.GET /api/image?q=(server.js, newimage.js): searches Wikimedia Commons (no key, reusable licences), then Openverse; returns a path on this server with title, credit, licence and source./api/imagefetches the picture itself throughpage.js'sfetchPublic(per-hop address checks, now exported), capped at 8 MB, JPEG/PNG/WebP/GIF only (an SVG from Cue's own origin could run script if opened directly). If a pick fails, it tries the next of the first three. It keeps the bytes (30 at most, an hour each).GET /api/image/raw?id=serves only those kept pictures, withnosniffanddefault-src 'none', and fetches nothing itself.mature=falseand commercial-use licences only.AGENT_TOKEN. The bot page never loads an image host directly.public/views/image.js,image.css: the picture on ink, the credit small in mono under it.image.js'sSOURCES; it needs a key and a search-engine ID, which is Tyler's decision, so it isn't added.scripts/check.mjs:/api/imageneeds the token and refuses an unsafe query;/rawserves only kept ids.Screenshots
A titled picture, and an untitled one with a caption over it (real Commons results through
/api/image/raw):Verified
npm run checkpasses./raw?id=1→ 248 KB JPEG./api/thinkmocked rendered them through/raw, and the browser made no request to any host but the server and Google Fonts.evals/transcripts/numbers-to-chart.jsonandpicture-helps.json(new): a chart, a picture, and quiet ticks around them. Replay on claude-haiku-5-5, low, run twice (before and after the fixes): 5/5 both times (2 helpful, 3 right-quiet), $0.002; Claude pickedshow_image("Pena Palace, Sintra")for "what does it even look like?".Review
Opus review of ed49d13 (now 7b77f5c after rebases): no SSRF, open-proxy or XSS hole found. Its findings are fixed in 06a792c: Commons nudity (safety filter plus a prompt rule), a logo picked over a portrait and banners counted as wide, no fallback when a pick fails (it now fetches while searching and tries the next result), TIFF originals skipped, Openverse NC licences and full-size originals, entity decoding, and the prompt naming one source. Not changed:
show_imagekeepsstate.busywhile it searches (up to ~20 s in the worst case), which also rules out an older image landing over a newer view. Wikimedia's user-agent policy asks for contact details; we send a generic one, so it may need one if Commons starts refusing.🤖 Generated with Claude Code