Repository navigation
feat: add code image rendering - #2
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
vitehub-drop | 2bd8ba2 | Jul 31 2026, 02:43 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e588cb6bb0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79df4e05bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { expiresAt, key } = createCodeImageObject() | ||
| const [storageError, stored] = await blob.put(key, image, { |
There was a problem hiding this comment.
Exclude temporary renders from upload statistics
Every successful /api/code request stores another blob under this key, while server/api/stats.get.ts counts every object returned by blob.list() without excluding code-images/. Consequently the homepage's “files uploaded by agents” count rises for code renders and falls again after cleanup, even though these are not uploaded files; filter this prefix from the statistic or use the existing permanent-upload counter.
Useful? React with 👍 / 👎.
| language: v.optional(v.string()), | ||
| theme: v.optional(v.string()), |
There was a problem hiding this comment.
Validate option names before opening the browser
When a caller supplies an unsupported but correctly typed value such as {"language":"typescript"} or an empty theme, this schema accepts it and starts a Browser Run session; selectRayOption() then fails to find the option, and the route reports a 502 as though Ray were unavailable. Since the supported case-sensitive names are part of the API reference, reject unknown names here with a 400 before acquiring the expensive browser session.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24628ab039
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize |
There was a problem hiding this comment.
Tear down preview resources when pull requests close
When an internal pull request is merged or closed, this workflow does not run because the pull_request trigger only includes opened, reopened, and synchronize. I checked the repository's only preview workflow: its Ensure isolated resources and deploy steps create a per-PR R2 bucket, queue, Worker, and hourly Cron deployment, but there is no corresponding teardown path, so every closed PR leaves those billable/quota-consuming resources active indefinitely; handle the closed event and remove the preview deployment and resources.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a17b35634
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }) | ||
| const frame = session.page.locator("#frame") | ||
| await frame.waitFor({ state: "visible" }) | ||
| return await frame.screenshot({ type: "png" }) |
There was a problem hiding this comment.
Bound the rendered frame dimensions
A request containing thousands of short lines can remain under the 20,000-character limit while making Ray's #frame hundreds of thousands of pixels tall. Taking an unconstrained element screenshot then exceeds Chromium's image dimensions or consumes excessive browser memory, so an otherwise schema-valid request returns 502 after acquiring a Browser Run session; limit line count/rendered dimensions or scale the frame before capturing it.
Useful? React with 👍 / 👎.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
vitehub-drop-preview | 2bd8ba2 | Jul 31 2026, 02:43 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b638d9b09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { CODE_IMAGE_PREFIX, isExpiredCodeImage } from "../utils/code-images" | ||
|
|
||
| export default defineSchedule({ | ||
| cron: "0 * * * *", |
There was a problem hiding this comment.
Enforce the returned five-minute expiry
For a render created just after an hourly tick, /api/code returns an expiresAt only five minutes away, but this is the sole deletion mechanism and it will not run again for nearly an hour. The supposedly expired URL therefore remains accessible for roughly 55 additional minutes, which can expose submitted source longer than callers are told; run cleanup at least every five minutes or reject expired keys when serving them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73b7070f99
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "language": "C++", | ||
| "theme": "Nuxt", |
There was a problem hiding this comment.
Use Ray IDs in the homepage request example
When a user copies this newly added curl example, "C++" and "Nuxt" are submitted as display names, but the renderer now compares these values literally with Ray's case-sensitive IDs in assertRayOption; the request therefore returns a 502 instead of the advertised image. Use the corresponding IDs, as the README and skill examples do, or omit these optional fields.
Useful? React with 👍 / 👎.
…'s thread card, relative times, shared copy buttons, a doc header that copies at once, who dropped it, the folder's drops, and comark's side outline (#228) * chore(deps): run on ViteHub main 69dde88 and comark-ui main af08c87, with the open fixes as patches ViteHub's main renamed the backend keys, so the D1 database and the Cloudflare and memory Realtime use `driver: "cloudflare"` / `"memory"`, and Vercel Blob is `driver: "vercel"`. The fixes still open upstream ride along as patches built from their heads on the pinned main: vite-hub/vitehub#4785 and #4788 in @vite-hub/ui, #4794 in @vite-hub/comments, onmax/comark-ui#453 in comark-time and comark-properties. ViteHub Content now renders with the same comark-ui as Drop, so one copy carries the patches. * fix(viewer): one frame around a new comment, ViteHub's sm thread card, a crisp +, and each person once in the toolbar The new-comment bubble is the box's frame, so the box passes `frame="none"` and the bubble shows the focus: the bordered one takes the accented border, the shadow-ring one a 22% ring (Drop comment #14). The dock's box and thread pass `size="sm"`, which brings the reply field, the 14px rows and the image shape from ViteHub, so the copies of those styles go (Drop comments #2, #7). The + of the pill is an inline SVG snapped to whole pixels while closed (Drop comment #13). The comments toolbar on Drop's own pages leaves out its faces and cursors, since the review dock already shows who's here (Drop comment #11). The frame's pop-out timing comes from ViteHub's `commentLeaveMs`. * feat: times and copy buttons come from ViteHub, and the doc's Updated row reads relative `TimeAgo` goes for ViteHub's `RelativeTime`: relative under 3 weeks, then the date, with the full date in a tooltip, short words in the lists. app.vue gives it Drop's one clock, so the words and Drop's countdowns move together (Drop comment #10). The copy buttons are ViteHub's `CopyButton`, whose icons cross-fade both ways, on Drop's 1.4 s (`DropCopyButton`); Drop's `icon-in` animation goes (Drop comments #6, #12). The Updated row writes the version's full instant in comark-time's markup, and a box that had no date of its own now gets the relative-dates script too. The CSP allows comark-properties' `scripts` as they are, and the markdown cache integrity moves to drop.24. * fix: load the icon swap with every copy button, keep the Updated row's render stable, and follow ViteHub's renamed drivers in tests The parts' stylesheet loads only with the viewer, so DropCopyButton brings @vite-hub/ui/icon-swap.css itself. The Updated row's tooltip id comes from the version's time instead of a random one, so a warm render matches a cold one. The blob and rate limit tests use the `cloudflare` and `memory` drivers, and the area test checks ViteHub's grey saved areas (Drop comment #1). * chore(deps): move to ViteHub main 20ab822, where #4788 and #4794 landed, and comark-ui main a410d81 vite-hub/vitehub#4788 (the 130 ms pop-out and commentLeaveMs) and #4794 (overlay presence: false, one face per person) merged, so their patches go and @vite-hub/comments runs unpatched. The @vite-hub/ui patch now carries #4785 alone, built on 20ab822. comark-properties' patch follows #453's latest head. comark-ui's pin is #456's head, the same tree as its main. * test(viewer): give the guest lookup composer test 30 s, as its siblings have, since it starts two Vite servers and a browser * chore(deps): move to comark-ui 5ed5886, where #453, #456 and #457 landed, and drop the comark-time and comark-properties patches 5ed5886 is #458's head, the newest commit pkg.pr.new published; its packages match main 1ef8c09, since pkg.pr.new skips pushes to main. * fix(viewer): comments reach Comark's zoom, now a modal dialog, and an Escape a popover takes stays in the page comark-ui#457 opens the zoom with showModal(), which made Drop's comment layer inert: no pin could land on a zoomed screenshot. The layer moves into the dialog while it's open, hides the page's own marks there, and returns on close. * feat(doc): Copy writes from the doc's frame, Dropped by shows the person and their agent, and the folder opens a list of its drops The header's Copy is built once and toggles data-copied and data-pending with ViteHub's icon swap, so a press is never lost to a rebuild. Its Markdown loads once per version when the pointer or focus reaches it (doc-intent), and the click writes it in the frame; it says Markdown copied, or Couldn't copy in the frame, and reports a refusal to the client-error log. The shortcut and menus copy the same text, and show on the button too. Dropped by reads [avatar] Max · [logo] Claude Code, with what it came through, the model and the reasoning level on hover (dropDetail now carries owner). Signed-in readers get the folder's newest drops in a popover (GET /api/drops?folder=&limit=). The save menu and the folder list are native popovers placed with anchor positioning. * test(nodes): a folder lists its newest few with limit, and a drop's detail says whose it is * fix(doc): Dropped by's pictures and the folder button keep the facts' row height * chore(doc): keep the folder row's type private, as knip asks * chore(deps): RelativeTime's length prop is format, from vite-hub/vitehub#4785 at 4aab7d9c style would be the native attribute in a template, so style="short" never reached the prop. The patch takes the rename (prop, RelativeTimeFormat) and Drop's lists pass format="short". * ci: install Playwright's Firefox for the Firefox browser tests * test(doc): wait for the popovers' toggle event before reading aria-expanded and focus * fix(ui): textareas grow with field-sizing: content, so the Nuxt UI autoresize patch goes * feat(doc): the outline is comark-outline's side outline, which follows the section being read and reaches the bottom (Drop comment #5) * fix(drops): Yesterday and This week start at midnight on a day with a daylight-saving change * fix(review): review.js writes thread times with Intl.RelativeTimeFormat * docs(agents): the browser support floor and the native-first rule * chore(deps): move to ViteHub main ccf6574, where #4785 landed, and drop the @vite-hub/ui patch * fix: the doc header's folder list follows a moved doc, and Marker ink drawn on a zoom stays visible while the comment is written * fix: Marker ink kept on a zoom shows only on the screenshot it was drawn on * fix: kept Marker ink comes back with its own screenshot in the zoom, keyed by the zoomed element * fix: only signed-in readers see whose doc it is; a public link doesn't name the person who shared it * fix: Copy prompt uses Drop's copy button, so its check animates like every other copy
* chore(deps): run on ViteHub main 69dde88 and comark-ui main af08c87, with the open fixes as patches ViteHub's main renamed the backend keys, so the D1 database and the Cloudflare and memory Realtime use `driver: "cloudflare"` / `"memory"`, and Vercel Blob is `driver: "vercel"`. The fixes still open upstream ride along as patches built from their heads on the pinned main: vite-hub/vitehub#4785 and #4788 in @vite-hub/ui, #4794 in @vite-hub/comments, onmax/comark-ui#453 in comark-time and comark-properties. ViteHub Content now renders with the same comark-ui as Drop, so one copy carries the patches. * fix(viewer): one frame around a new comment, ViteHub's sm thread card, a crisp +, and each person once in the toolbar The new-comment bubble is the box's frame, so the box passes `frame="none"` and the bubble shows the focus: the bordered one takes the accented border, the shadow-ring one a 22% ring (Drop comment #14). The dock's box and thread pass `size="sm"`, which brings the reply field, the 14px rows and the image shape from ViteHub, so the copies of those styles go (Drop comments #2, #7). The + of the pill is an inline SVG snapped to whole pixels while closed (Drop comment #13). The comments toolbar on Drop's own pages leaves out its faces and cursors, since the review dock already shows who's here (Drop comment #11). The frame's pop-out timing comes from ViteHub's `commentLeaveMs`. * feat: times and copy buttons come from ViteHub, and the doc's Updated row reads relative `TimeAgo` goes for ViteHub's `RelativeTime`: relative under 3 weeks, then the date, with the full date in a tooltip, short words in the lists. app.vue gives it Drop's one clock, so the words and Drop's countdowns move together (Drop comment #10). The copy buttons are ViteHub's `CopyButton`, whose icons cross-fade both ways, on Drop's 1.4 s (`DropCopyButton`); Drop's `icon-in` animation goes (Drop comments #6, #12). The Updated row writes the version's full instant in comark-time's markup, and a box that had no date of its own now gets the relative-dates script too. The CSP allows comark-properties' `scripts` as they are, and the markdown cache integrity moves to drop.24. * fix: load the icon swap with every copy button, keep the Updated row's render stable, and follow ViteHub's renamed drivers in tests The parts' stylesheet loads only with the viewer, so DropCopyButton brings @vite-hub/ui/icon-swap.css itself. The Updated row's tooltip id comes from the version's time instead of a random one, so a warm render matches a cold one. The blob and rate limit tests use the `cloudflare` and `memory` drivers, and the area test checks ViteHub's grey saved areas (Drop comment #1). * chore(deps): move to ViteHub main 20ab822, where #4788 and #4794 landed, and comark-ui main a410d81 vite-hub/vitehub#4788 (the 130 ms pop-out and commentLeaveMs) and #4794 (overlay presence: false, one face per person) merged, so their patches go and @vite-hub/comments runs unpatched. The @vite-hub/ui patch now carries #4785 alone, built on 20ab822. comark-properties' patch follows #453's latest head. comark-ui's pin is #456's head, the same tree as its main. * test(viewer): give the guest lookup composer test 30 s, as its siblings have, since it starts two Vite servers and a browser * chore(deps): move to comark-ui 5ed5886, where #453, #456 and #457 landed, and drop the comark-time and comark-properties patches 5ed5886 is #458's head, the newest commit pkg.pr.new published; its packages match main 1ef8c09, since pkg.pr.new skips pushes to main. * fix(viewer): comments reach Comark's zoom, now a modal dialog, and an Escape a popover takes stays in the page comark-ui#457 opens the zoom with showModal(), which made Drop's comment layer inert: no pin could land on a zoomed screenshot. The layer moves into the dialog while it's open, hides the page's own marks there, and returns on close. * feat(doc): Copy writes from the doc's frame, Dropped by shows the person and their agent, and the folder opens a list of its drops The header's Copy is built once and toggles data-copied and data-pending with ViteHub's icon swap, so a press is never lost to a rebuild. Its Markdown loads once per version when the pointer or focus reaches it (doc-intent), and the click writes it in the frame; it says Markdown copied, or Couldn't copy in the frame, and reports a refusal to the client-error log. The shortcut and menus copy the same text, and show on the button too. Dropped by reads [avatar] Max · [logo] Claude Code, with what it came through, the model and the reasoning level on hover (dropDetail now carries owner). Signed-in readers get the folder's newest drops in a popover (GET /api/drops?folder=&limit=). The save menu and the folder list are native popovers placed with anchor positioning. * test(nodes): a folder lists its newest few with limit, and a drop's detail says whose it is * fix(doc): Dropped by's pictures and the folder button keep the facts' row height * chore(doc): keep the folder row's type private, as knip asks * chore(deps): RelativeTime's length prop is format, from vite-hub/vitehub#4785 at 4aab7d9c style would be the native attribute in a template, so style="short" never reached the prop. The patch takes the rename (prop, RelativeTimeFormat) and Drop's lists pass format="short". * ci: install Playwright's Firefox for the Firefox browser tests * test(doc): wait for the popovers' toggle event before reading aria-expanded and focus * fix(ui): textareas grow with field-sizing: content, so the Nuxt UI autoresize patch goes * feat(doc): the outline is comark-outline's side outline, which follows the section being read and reaches the bottom (Drop comment #5) * fix(drops): Yesterday and This week start at midnight on a day with a daylight-saving change * fix(review): review.js writes thread times with Intl.RelativeTimeFormat * docs(agents): the browser support floor and the native-first rule * chore(deps): move to ViteHub main ccf6574, where #4785 landed, and drop the @vite-hub/ui patch * fix: the doc header's folder list follows a moved doc, and Marker ink drawn on a zoom stays visible while the comment is written * fix: Marker ink kept on a zoom shows only on the screenshot it was drawn on * fix: kept Marker ink comes back with its own screenshot in the zoom, keyed by the zoomed element * fix: swap the copy icons without @vite-hub/ui/icon-swap.css vite-hub/vitehub#4917 removes icon-swap.css. DropCopyButton keeps vite-hub/ui's CopyButton, which swaps its icon with SwapIcon, and the doc header frame draws its own cross-fade. Pins every @vite-hub package to that branch's preview. * Fix formatting for the copy icon swap * Load the real copy icon stylesheet in viewer tests --------- Co-authored-by: vite-hub[bot] <320448255+vite-hub[bot]@users.noreply.github.com>
Summary
POST /api/codefor rendering validated source text through Ray.so with a named ViteHub Browser Definition/api/filesremains permanentBrowserDownloadfromvite-hub/browserthrough fix(browser): own Playwright public types vitehub#879, removing Drop’s directplaywright-coredependency and browser patchWRANGLER_CI_OVERRIDE_NAME, without a repository scriptvitehub-dropskill support for configurable code-image exports without changing the existing file-upload landing contentWhy
Agents preparing posts need code images long enough for the publishing service to fetch them, but iterative renders do not need permanent storage. Drop keeps uploaded files permanent while treating generated code images as temporary objects that can be downloaded and re-uploaded through
/api/fileswhen a durable URL is needed.ViteHub owns the Browser session and its Playwright-compatible controller, so applications should name returned values through the ViteHub API instead of installing and importing
playwright-corethemselves.Checks
pnpm typecheckBrowserDownloadwithout a consumer-owned Playwright dependencyvitehub-dropandvitehub-drop-previewDROP_URL=https://vitehub-drop-preview.maximogarciamtnez.workers.dev pnpm test:e2e:deployedplaywright-coreversion owned beneath@vite-hub/browser.output/server/wrangler.jsoncontains the Browser, storage, rate-limit, queue, and hourly schedule bindings