40 Commits

Author SHA1 Message Date
mahmoud
b561446870
fix(deps): clear the dependency audit gate (#26)
The overrides pinned exact versions that later advisories flagged. Raise
each to its lowest patched release and cover the packages shadcn, wrangler,
and the AI SDK pin transitively. `braces` has no patched release upstream
and only reaches the project through the shadcn CLI, so the audit script
ignores that one advisory until one ships.

Vitest moves to 4.1.12 for GHSA-82fw-gwwq-j7x9.
2026-10-19 23:37:06 +02:00
realZachi
fd92c2ac88 Add GPT-6 Astra to AI provider catalogs 2026-09-04 21:17:00 +02:00
realZachi
542f55704b feat(ai): protect live generations from project switches and page exits
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
2026-08-26 11:55:30 +02:00
realZachi
3a90b0431c Sample rendered colors for share preview backdrop 2026-08-20 20:33:49 +02:00
mahmoud
bc1fb094a4
feat(share): project share links with short URLs and OG previews (#21)
* 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.
2026-08-20 19:37:22 +02:00
mahmoud
5bccd8338b
feat(ai): add OpenCode Zen and Go providers (#18)
* 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
2026-08-20 01:10:05 +02:00
mahmoud
94cfcac978
feat(persistence): store images as disk-backed blobs and load workspaces lazily (#20)
* 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>
2026-08-19 04:48:08 +02:00
mahmoud
709a6b7a9a
feat(ai): experimental HTML screen mode and Grok 4.6 (#19)
* 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
2026-08-19 02:40:26 +02:00
mahmoud
ca6b2e556b
feat(ai): reduce screenshot generation token usage (#17) 2026-08-11 22:52:10 +02:00
mahmoud
4feeab6b4b
feat(ai): add ChatGPT Codex bridge (#15)
* feat(ai): add ChatGPT Codex bridge

* fix(ai): harden Codex bridge lifecycle
2026-08-09 01:49:57 +02:00
realZachi
df11c24c56 feat(ai): integrate normalizeAiCopy and normalizeAiHighlights for text processing
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.
2026-08-08 20:06:33 +02:00
realZachi
7ac3492499 fix(ai): show Gemini thoughts, stop the run band jumping, name the latest action
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>
2026-08-08 19:45:32 +02:00
realZachi
0c28ead7d8 feat(ai): replace run dialog with a floating run band
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>
2026-08-08 19:29:13 +02:00
realZachi
ef84986709 feat(ai): add OpenRouter support and enhance AI provider catalog
- 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.
2026-08-08 18:07:30 +02:00
realZachi
a7d6a4e13a docs: enhance AI generation documentation and prompt batching instructions
- 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`.
2026-08-08 16:41:27 +02:00
realZachi
24c8837b98 feat: add support for spanning mockups across screens
- 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.
2026-08-08 15:16:38 +02:00
realZachi
77382a978d build: deploy editor separately on Cloudflare 2026-08-04 00:02:54 +02:00
realZachi
7275bdcd62 docs: clarify public browser key handling 2026-08-04 00:01:36 +02:00
realZachi
3aa9a53362 feat: enhance AI provider key management and UI
- 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.
2026-08-04 00:00:45 +02:00
realZachi
1d90f6f8c8 feat: rebrand app as Shotluma 2026-08-04 00:00:36 +02:00
realZachi
1efb5f7886 fix: allow max reasoning effort for OpenAI GPT-5.6 models
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 14:22:44 +02:00
realZachi
706b57355d feat: implement empty initial project state and adjust sidebar behavior for new projects 2026-07-31 19:59:27 +02:00
realZachi
8132c094ab feat: enhance overlay asset generation with budget management and chroma key improvements
- 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.
2026-07-26 02:41:52 +02:00
realZachi
00a9080f8d feat: introduce overlay asset generation and management in AI workflow
- 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.
2026-07-26 02:03:05 +02:00
realZachi
73797f5bb1 feat: enhance reasoning effort management for AI models
- 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.
2026-07-24 03:13:10 +02:00
realZachi
24ca4fc7c9 feat: refine reasoning effort handling in AI models
- 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.
2026-07-24 02:42:13 +02:00
realZachi
3fab6a1c3f feat: enhance AI model selection and reasoning effort handling
- 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.
2026-07-24 02:16:30 +02:00
realZachi
29e7f78783 feat: add xAI provider support to AI SDK
- 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.
2026-07-24 02:00:06 +02:00
realZachi
f11f688094 docs: showcase Frameflow with product demos 2026-07-23 22:00:12 +02:00
realZachi
edda863374 chore: update architecture and UI guidelines to remove hard limits on complexity and stylesheet size 2026-07-23 21:48:59 +02:00
realZachi
5009f29362 feat: add icon functionality with IconPicker and IconGraphic components
- Introduced IconPicker for selecting icons from a catalog with search functionality.
- Added IconGraphic component to render selected icons with customizable properties.
- Enhanced CanvasElementView to support icon elements, including rendering and toolbar controls.
- Updated ElementToolbar to include icon-specific settings and controls.
- Created new icon-related types and integrated them into the existing CanvasElement structure.
- Implemented icon addition functionality in the editor actions.
- Styled new components and integrated them into the sidebar and properties panel.
- Added new icons to the icon catalog for better selection options.
2026-07-23 20:47:20 +02:00
realZachi
e16688f126 feat: add editor screenshot to README for better visual representation 2026-07-23 19:50:02 +02:00
realZachi
cb7b373223 feat(ai): enhance branding support with app name and logo integration in user messages and generation process 2026-07-23 18:26:01 +02:00
realZachi
0bd9cc3b39 feat(ai): add opt-in local run logging 2026-07-23 17:26:38 +02:00
realZachi
1b475013b1 fix: normalize editor typography 2026-07-23 17:19:03 +02:00
realZachi
44c4457232 feat: support projects with zero slides and enhance UI for empty states 2026-07-23 16:56:58 +02:00
realZachi
0912d72e6d feat: integrate multiple AI providers and enhance security measures
- Updated SECURITY.md to clarify the handling of AI provider keys and deployment guidelines.
- Modified bun.lock and package.json to include new AI SDK dependencies for Alibaba, Anthropic, Google, and OpenAI.
- Refactored architecture documentation to reflect changes in AI provider integration and proxy usage.
- Revised ai-generation documentation to outline the new direct browser calls to AI providers.
- Enhanced the AI generation logic in runner.ts to support multiple AI providers and their respective models.
- Implemented AiProviderControls component to manage provider and model selection in the UI.
- Added CSS styles for new AI provider controls and warnings.
- Created provider catalog and configuration files to manage AI provider keys and availability.
- Developed unit tests for provider catalog and configuration to ensure correct functionality.
2026-07-23 16:18:51 +02:00
realZachi
a530ee2f63 refactor: update UI text and labels to English for consistency
- Translated various UI labels and tooltips from German to English in Sidebar, PropertiesPanel, and other components.
- Updated text presets in use-editor-actions to reflect English phrases.
- Changed error messages in persistence and utils to English.
- Modified shape groups and font categories to use English terms.
- Adjusted mockup labels for device options to English.
- Added unit tests for AI prompt language to ensure English requirements are enforced.
2026-07-23 15:51:46 +02:00
realZachi
d0791e32af docs: define agentic contribution standards 2026-07-23 15:23:27 +02:00
realZachi
f30b569ef4 docs: prepare open source contributor guide 2026-07-23 14:35:17 +02:00