Commit 010b31a
authored
fix(web): preview image deliverables (#149)
## Summary
- Render generated image outputs directly in the deliverables card and
an accessible full-size viewer.
- Keep preview fetches lazy, signed, bounded to 20 MiB, and isolated
from sandbox startup.
- Open generated images directly in the Files editor instead of
selecting their parent directory.
## Architecture
The web app exchanges the existing short-lived download capability for
an authenticated image blob. Object URLs stay browser-local and are
revoked on cleanup. File-open requests are transient UI state sent to
the trusted Code Server frame and acknowledged by the injected preview
bridge.
## Decisions
| Decision | Choice | Reasoning |
|---|---|---|
| Preview transport | Existing signed output URL | Preserves the R2
boundary and does not expose credentials |
| Loading | Intersection-observer lazy loading | Avoids fetching
off-screen images or waking the sandbox |
| Files handoff | Exact relative workspace path with frame
acknowledgement | Opens the file users selected and rejects traversal
paths |
| Viewer | Existing modal primitive | Preserves focus, Escape handling,
and screen-reader semantics |
## Edge cases
- Images over 20 MiB remain downloadable but are not loaded inline.
- Empty or non-image responses show a recoverable preview error.
- Unsafe filenames cannot be sent to the sandbox editor.
- Requests are scoped to the active thread and exact trusted iframe
origin.
## Checks
- [x] `pnpm turbo typecheck`
- [x] `pnpm turbo lint`
- [x] `pnpm turbo build`
- [ ] Production image deliverable QA after deployment1 parent 76c5447 commit 010b31a
8 files changed
Lines changed: 574 additions & 36 deletions
File tree
- apps/web
- src
- components
- chat
- preview
- lib
- api
- store
- packages/preview-bridge
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
0 commit comments