* fix: anchor corner resize to the opposite edge
* fix: pin the bottom edge when resizing from top handles
The opposite-edge anchor only adjusted x and width, so nw and ne left the
top edge fixed instead of the bottom. Measure the element's rendered height
during the drag (text rewraps, mockups keep an aspect ratio) and move y by
the height change.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Mahmoud <mahmoud.ali-khan@gmx.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ai): send x-opencode-session on every OpenCode request
OpenCode Go and Zen require a stable per-conversation session id in the
x-opencode-session header so the gateway can route traffic and reuse prompt
caches (https://opencode.ai/docs/go/#where-can-i-use-it). Without it the
gateway answers "Request is missing x-opencode-session and cannot be routed
efficiently" and the run fails.
- build one module-scope session id per browser session and pass it through
headers to all four OpenCode dialects (responses, chat, messages, google),
which also covers the vision describer
- forward the header through the hosted Cloudflare Worker proxy, whose
allowlist previously stripped it; the Vite dev proxy already forwarded it
* fix(ai): keep the OpenCode session id stable across reloads
The module-scope session id was regenerated on every full page load, so
reloads dropped the stable identity the OpenCode gateway needs for routing
and prompt caching.
Read the id from sessionStorage, generate one when none is stored, and
persist it; a fresh tab still gets its own id, which keeps sharding traffic
across clients. Storage that is unavailable or throws falls back to a
per-page-load id instead of failing the request.
The prompts asked for a highlight in "most headlines" and called a
flat single-color headline generic, so every generated screen ended up
with its closing words pilled or underlined - period included.
Cap word highlights at two screens per set (hero plus one earned
claim), point emphasis at type contrast first, and tell the model to
pick the word that carries the claim instead of the trailing one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019hVAeQ62iAy7ZX675CmmaF
A running AI generation used to survive a project switch invisibly: the
run band unmounted without aborting, and because the slide/upload refs
are shared, the remaining tool calls wrote their screens into the newly
opened project (which then even adopted the generated app name). Leaving
the page killed a run without any warning or later explanation.
- useAiWorkflow now owns the run lifecycle: the modal registers a cancel
handle, controller writes are gated on the registered run, and
handleProjectReplaced unconditionally cancels before refs swap.
- Project switch, creation, and duplication during a run first ask via
the new AiRunCancelDialog; deletion is disabled until the run ends.
- beforeunload warns while (and only while) a run is active.
- Saves during a run mark the project with interruptedGeneration; the
marker is cleared by a save after the run ends and otherwise consumed
on the next load with a one-time toast explaining the unfinished
screens.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fjKLZWb1cqRDEW86V7HJm
The generator's story arc reserves slide 1 for the single strongest
benefit and slide 2 for the differentiator, and its copywriting rules
lean on pains the app removes. The copy-prompt now requests exactly
those, orders features by importance, widens the word budget to fit,
and forbids invented claims or ratings alongside invented features.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JUx2FJ86zfq7hEimRxM5W2
A generate run now renames the project to the app name typed in the AI modal,
deduplicated against the other projects the same way new projects are ("Aurora"
-> "Aurora 2"). The rename only happens while the title is still one the app
assigned itself - the seed project, an untitled one, or "New Project 3" - so a
title the user typed is never overwritten. Edit runs carry no app name and
leave the title alone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fjKLZWb1cqRDEW86V7HJm
Drop the "bold" mission framing and the saturated-background bias so the
generated set adapts the palette, mood, and shape language of the uploaded
screenshots instead of imposing one. Prefer cohesion over forced archetype
variety across screens.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fjKLZWb1cqRDEW86V7HJm
* feat(share): add project share links with short URLs and OG previews
Projects can be shared as links from the project menu. The share payload is
the whole project as deflate-raw compressed JSON with every image inlined,
capped at export resolution and re-encoded as WebP when smaller.
Short /s/<id> links store the payload opaquely in Cloudflare KV (90-day TTL,
10 MB cap) through a share API running as the script of the existing
shotluma-app Worker; /s/<id> also serves per-share Open Graph tags with a
client-rendered 1200x630 unfurl image composed from the live artboards.
When the share API is unreachable the link degrades to a self-contained
#share= fragment that carries the payload itself.
Opening a link imports an independent local copy, so the recipient can edit
or delete without affecting the sender. Share payloads are treated as
untrusted input: decoding re-sanitizes AI screen markup and rich text, drops
malformed records and unsafe image schemes, and caps decompressed size. The
import consumes the URL exactly once and is cached module-wide because React
StrictMode double-invokes the hydration effect in development.
* fix(share): harden share flow after review
- Add request timeouts to all share API calls so a stalled Worker degrades
to the inline fallback instead of hanging the dialog or the import.
- Strip the static og:/twitter: tags from index.html before injecting
per-share tags; crawlers honor the first tag they see. Propagate a failed
asset fetch instead of serving its body as a 200 page.
- Reject oversized uploads from the content-length header before buffering,
add x-content-type-options: nosniff to stored-bytes responses, and add an
optional per-IP rate-limit binding for share writes.
- Settle the one-shot shared import after it is applied so a re-run of the
hydration effect cannot re-apply the imported project, and surface a toast
when hydration fails after the share fragment was already consumed.
- Track clipboard failures separately in the share dialog, keep the link
visible, and offer a selectable fallback field.
- Give dropped project-name words a visible ellipsis in the OG preview.
- Document the #s= fragment as a consumed compatibility format.
* feat(ai): add OpenCode Zen and Go providers
Add OpenCode as a key-based provider with shared Zen/Go credentials, a same-origin CORS proxy, runtime model catalogs, and a vision-model fallback that describes screenshots for text-only coding models.
* fix(ai): keep OpenCode Zen/Go path prefixes when proxying
Absolute /v1/... suffixes were resolved against the OpenCode origin and dropped /zen and /zen/go. Join relative to those prefixes in the worker and Vite rewrites.
* chore(deps): bump nanoid override to 3.3.18
Clear GHSA-2v37-7h3g-55p8 so bun audit can pass. The previous 3.3.17 pin is now reported as vulnerable.
* fix(ai): surface run status events and cache image descriptions across steps
OpenCode text-only models describe screenshots with a vision model before
generating. The modal dropped 'status' run events, so the band showed
'Starting up …' for the whole describe phase, and each tool-loop step
re-described every image from scratch because the description cache lived
only one prepare call.
* refactor(ai): enhance OpenCode model handling and proxy functionality
* fix: allow images to be used in devices
* fix(ai): defer vision fallback, harden image cache keys, and remount model browser per provider
Address CodeRabbit review on #18:
- resolve the OpenCode vision describer only once a prepared step contains
an image, so text-only models run image-free requests without a fallback
- relay tool preview images whenever the vision fallback is active, not
only for chat-dialect models
- hash full binary payloads for image description cache keys so distinct
same-length images are described separately
- build the unavailable-transport error from the selected provider
- remount AiCatalogModelBrowser per provider so catalogs never leak
between OpenRouter and OpenCode gateways
- bound the OpenCode catalog fetch with a 10s timeout and guard the
catalog-revision state update after unmount
- correct the worker key-handling doc and the vision-default comment
* feat(persistence): store images as disk-backed blobs and load workspaces lazily
Project documents no longer embed images as base64 data URLs. Image bytes
now live as Blobs in a content-addressed IndexedDB asset store (SHA-256
ids), documents persist blob-asset: references, and the app renders
object URLs — so image data stays out of the JS heap and identical
images deduplicate across projects. Legacy documents migrate
transparently on load and persist references on the next save.
Startup no longer deserializes every project via getAll(): a cursor walk
builds the project list one document at a time and only the active
project is fully retained, so tab memory peaks at one project instead of
the sum of all of them.
Uploads store their file Blob directly (with a data URL fallback when
Blob storage is unavailable), AI attachments register blob assets while
keeping data URL provider payloads, and overlay reference images are
converted back to base64 on demand. Deleting a project sweeps blobs no
surviving project references.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: address review findings on run guarding and cache retention
- Mark the AI generate run active before awaiting attachment preparation
so a second click cannot start a parallel run, the close guard applies
during preparation, cancellation is honored before the run starts, and
preparation failures surface in the error view.
- Drop the data-URL-to-asset-id memo map; it pinned full base64 strings
in the heap for the tab lifetime, contradicting the goal of this
change. Re-hashing the rare inline data URL on save is cheaper.
- Guard openDatabase's failure path against a late error clearing a
newer cached database promise after a retry.
- Document the deliberate session-lifetime asset retention (unsaved
state and undo history) and the cross-tab sweep limitation.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat(ai): add experimental HTML screen mode and Grok 4.6
Let the model author whole screens as sanitized HTML instead of element tools, and surface Grok 4.6 as the default xAI model.
* chore: bump version to 0.4.0
* test(ai): cover new controller surface in slide-tools mock
* fix(ai): harden HTML screen mode after review
Strip non-fragment url() from SVG presentation attributes, collapse
root-selector chains that @scope cannot match, defer a new screen's first
preview until its slideId exists, and only count successfully created
HTML screens.
* fix(app): use shared button for project creation and quiet test warnings
* chore(deps): update @ai-sdk/xai for grok-4.6
* fix(ai): treat CSS comments as selector separators in scope rewrite
* feat(editor): redesign empty canvas with phone preview
Lead with AI generation and a lightweight phone skeleton so the empty stage feels product-shaped instead of a generic add prompt.
* feat(ai): simplify generate modal header copy
Drop the icon chrome for a clearer title-and-subtitle header, with supporting styles for the close control and copy-prompt action.
Updated the shadcn package in both package.json and bun.lock files to version 4.16.2. Modified the AiRunBand component to include a new CSS class for improved styling, ensuring the latest activity is visually distinct. Added a test to verify the presence of the new class in the rendered output.
Added normalization functions to improve text handling in the AI tools. The `normalizeAiCopy` function processes text to ensure proper line breaks, while `normalizeAiHighlights` standardizes highlight formatting. Updated relevant components to utilize these functions, enhancing the consistency and readability of text elements in the application. Removed unnecessary tool call count state from the AiGenerateModal and AiRunBand components to streamline the UI.
Added a new feature to release assistant prose and reasoning one word at a time, enhancing the smoothness of the output stream. Introduced a constant for word delay and a function to apply the smoothing transformation during AI model execution. This change aims to improve the readability of the output by preventing abrupt jumps in the text display.
html-to-image snapshots an artboard by inlining it into one SVG data URL and
rasterising that through an <img>. WebKit stops resolving the images nested in
such a snapshot once the embedded payload passes a few hundred kilobytes: text,
shapes and backgrounds still paint, but every uploaded screenshot and device
frame in that artboard comes out empty. A raw camera-resolution upload is several
megabytes once base64-encoded, so one mockup is enough to cross the ceiling.
Each source is now re-encoded at the size it actually occupies in the exported
PNG, which keeps a snapshot one or two orders of magnitude smaller without
giving up resolution the export could have used. The sizing arithmetic lives in
export-image-sizing.ts, the canvas work in export-image-payload.ts, and the
substituted sources are restored after the run.
Also primes each artboard with one unencoded toCanvas pass, because WebKit
otherwise rasterises the first capture before its nested images are ready.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three problems with the run band, one of them a real provider bug.
Gemini showed "Starting up …" for an entire run. Reasoning visibility is a
separate switch from reasoning effort, and the providers are asymmetric: OpenAI's
Responses API defaults reasoningSummary to 'detailed' once an effort is set,
while @ai-sdk/google reads includeThoughts only from providerOptions.google with
no fallback from the portable reasoning value. We never sent it, so Gemini
thought, billed those tokens, and returned no summaries. Because prompt.ts also
forbids turn-by-turn narration, reasoning is the only live prose during a run —
without it the band had nothing to show. A test now asserts includeThoughts
reaches Google's actual request body, alongside the effort it must not override.
The band resized on almost every delta because the prose box had a min-height and
no upper bound. Its height is now fixed at four lines, bottom-anchored, so older
text scrolls out of view upward instead of moving the whole band. Measured
constant at 196px across one short line, one wrapping line, three lines, and six
overflowing lines.
"18 actions" reported only that something happened. The footer now names the
latest tool detail ("18 Preview checked"), which for a model that streams no
reasoning is the only live signal there is.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The run phase reused the generate dialog shrunk to 320x320, which forced four
streams into two scroll areas: tool calls got the loudest surface for the least
informative lines, reasoning was sliced to a 160-character window and pasted
next to the spinner, and assistant prose piled up as one block whose sentences
collided ("...Noah set.Art direction is set:").
The run now renders as a band over the canvas. Assistant prose and reasoning
share one area at reading size, accumulated per sentence by run-narration so no
scroll area appears and two steps never merge into one line. Tool calls are
reduced to their latest human-readable detail. A screen rail shows the plan the
model declares via the new declare_plan tool, reconciled against the screens
actually built so a drifting run cannot make the rail claim it finished early.
The band is also the result and error surface, so no run hands control back to
the centered dialog.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Integrated OpenRouter as a new AI provider, allowing direct calls to its API.
- Updated the AI provider catalog to include OpenRouter models and reasoning efforts.
- Implemented dynamic model resolution for OpenRouter, enabling runtime fetching of available models.
- Enhanced UI components to support OpenRouter selection and browsing of models.
- Updated tests to validate the new OpenRouter functionality and ensure compatibility with existing providers.
- Updated the nanoid dependency in both package.json and bun.lock files.
- Expanded AI prompt instructions to include detailed copywriting guidelines and story arc structure for slide presentations.
- Added tests for new AI prompt features related to copywriting and story arc.
- Added a section on prompt caching and cost optimization, detailing provider-specific cache routing for Anthropic, OpenAI, and Google Gemini.
- Updated the AI generation invariants to emphasize the importance of batching tool calls to reduce input token costs.
- Clarified the usage of the `inspect_slide` tool, indicating it is rarely needed due to existing mutation results.
- Improved instructions in the prompt to encourage batching of tool calls and final passes for efficiency.
- Introduced a new file for per-provider cache routing in `src/ai/prompt-caching.ts`.
- Introduced a new `spansScreens` property for device elements, allowing mockups to continue seamlessly onto adjacent screens.
- Implemented a `SpanGhostItem` component to visually represent the continuation of spanning mockups in the editor.
- Updated relevant components and tests to support and validate the new spanning functionality.
- Enhanced the UI with a toggle button for enabling/disabling the spanning feature.
- Changed button class names to include 'export-button' for better clarity.
- Removed unnecessary styles from base.css and theme.css, optimizing button appearance.
- Added new styles for the .ai-modal-generate class to enhance button visuals and interactions.
- Changed the default AI provider from Google to Moonshot and updated the model from Gemini 3.6 Flash to Kimi K3.
- Adjusted related tests and UI components to reflect the new default settings.
- Enhanced the AI provider controls to display the updated model and reasoning effort correctly.
- Updated the AI generation process to allow API keys to be entered directly in the browser and stored in localStorage, with optional fallback to `.env.local` for local development.
- Improved the user interface to manage API keys, including a new dialog for entering keys and updated messaging to clarify key requirements.
- Refactored components to utilize the new key management system, ensuring a seamless experience for users when configuring AI providers.
- Enhanced documentation to reflect changes in key handling and security practices.
- Introduced a new test suite for AI prompt space usage, ensuring compositions fill the tall canvas and flagging dead zones as defects.
- Updated prompt guidelines to emphasize the importance of utilizing the full canvas height and addressing large empty areas as defects.
- Updated overlay asset generation to include a per-run budget, limiting the number of `create_overlay_asset` calls to prevent excessive usage of the OpenAI API.
- Enhanced the chroma key processing to measure the actual backdrop color dynamically, improving the accuracy of background removal.
- Added new tests to validate the budget management and chroma key detection functionalities.
- Updated documentation to reflect the new budget constraints and improved chroma key workflow, ensuring clarity for users on the overlay asset generation process.
- Added support for generating overlay assets using OpenAI's gpt-image-2, allowing for custom graphics like badges and stickers.
- Implemented new functions in the AI controller to manage overlay assets, including asset registration and background removal.
- Enhanced the AI generation modal to include an option for enabling overlay assets, with corresponding UI updates for user interaction.
- Updated documentation to reflect the new overlay asset workflow and its integration within the AI generation process.
- Added tests to validate the functionality of overlay asset generation and ensure proper integration with existing tools.
- Updated the @ai-sdk/anthropic dependency in package.json and bun.lock to version 4.0.20 for improved functionality.
- Added new models 'claude-opus-5' and updated descriptions for existing models in the provider catalog.
- Enhanced tests to validate the inclusion of new models in the AI provider catalog.
- Added new font sources including 'Inter Tight', 'Outfit', 'Plus Jakarta Sans', 'Sora', 'Anton', 'Archivo Black', 'Libre Baskerville', 'Cormorant Garamond', and 'JetBrains Mono' to package.json and bun.lock.
- Updated font options in data.ts and tool-schemas.ts to include the new fonts, enhancing the variety of available typography.
- Modified main.tsx to import styles for the new fonts, ensuring they are available for use in the application.
- Enhanced prompt.ts to provide descriptions for the new fonts, improving documentation and user guidance.
- Introduced 'max' as a new reasoning effort option for the Moonshot/Kimi K3 model, allowing for more granular control.
- Updated relevant functions and types to accommodate the new reasoning effort, ensuring compatibility with the AI SDK.
- Enhanced tests to validate the new reasoning effort options and their integration within the AI provider catalog.
- Adjusted documentation to reflect changes in reasoning effort handling and model-specific options.
- Updated reasoning effort logic to default to 'high' when supported by the selected model, otherwise 'medium'.
- Removed 'provider-default' option from reasoning efforts to streamline user experience.
- Enhanced tests to validate new reasoning effort defaults and clamping behavior.
- Adjusted documentation to reflect changes in reasoning effort selection and defaults.
- Refactored export functions to accept a new ExportTarget type, allowing for exporting in specified formats or all formats.
- Updated AppHeader and ExportMenu components to reflect changes in export handling.
- Enhanced useSlideExport hook to manage exporting multiple formats and provide progress feedback.
- Improved user interface for export options, including clearer labeling and additional export choices.
- Added ImageDropzone component for improved file upload experience, supporting drag-and-drop and click-to-upload.
- Implemented LogoPreview component to display uploaded logos with a remove option.
- Refactored file handling in IdleContent to accommodate multiple file uploads for logos and screenshots.
- Updated styles for dropzone and logo display to enhance user interface and interaction.
- Introduced utility function to convert files to ImageDrafts for better state management.
- Updated the AI generation modal to include a model picker grouped by provider, with reasoning effort displayed as secondary chips.
- Introduced new utility functions `findAiModelById` and `clampAiReasoningEffort` to manage model selection and reasoning effort constraints.
- Refactored provider controls to streamline model selection and reasoning effort changes.
- Enhanced tests to cover new functionality and ensure proper integration of reasoning efforts.
- Updated documentation to reflect changes in the AI model selection process.
- Introduced xAI as a new AI provider in the application.
- Updated environment variables to include VITE_XAI_API_KEY.
- Modified relevant documentation to reflect the addition of xAI.
- Enhanced provider catalog and configuration to support xAI's models and reasoning efforts.
- Updated tests to ensure proper integration of the new provider.