Skip to content

feat(artifacts): open artifacts in a dedicated minimal-permission window - #255

Merged
BerryUIKI merged 3 commits into
mainfrom
feature/artifact-window
Nov 5, 2026
Merged

BerryUIKI merged 3 commits into
mainfrom
feature/artifact-window

Conversation

@BerryUIKI

Copy link
Copy Markdown
Owner

Summary

Adds the second half of M3: artifacts can open in their own WebView.

  • New open_artifact_window command (registered in lib.rs) fetches the stored artifact via ArtifactService::get and opens or focuses a window labeled artifact-<id> loading artifact.html.
  • The validated payload is injected through a Tauri initialization script as a JSON string and parsed with JSON.parse; the escaping is unit-tested.
  • artifact.html / src/artifact-main.tsx are a separate Vite multi-page entry. The built artifact chunk is ~1 KB and does not import desktopApi or app-shell code.
  • capabilities/artifact-window.json grants only core:default to artifact-* windows.
  • The main-window artifact detail gains an Open in window action with toast error feedback.

Security notes

  • The window renders only predefined React components; no model-generated HTML.
  • Residual risk (documented in docs/ARTIFACT_SYSTEM.md): Tauri application commands are not ACL-gated per window in this setup, so isolation relies on the dedicated entry having no privileged code paths plus the minimal capability set.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --workspace — artifact window escaping and artifact lookup tests
  • pnpm typecheck
  • eslint on changed files
  • node node_modules/vitest/vitest.mjs run --pool=forks — 14 files, 59 tests
  • pnpm build — emits dist/artifact.html and assets/artifact-*.js

Not manually exercised in the desktop shell; the window itself requires a running Tauri app.

- build an initialization script that embeds the validated payload as JSON and parses it with JSON.parse
- open or focus an artifact-* WebView loading artifact.html
- expose open_artifact_window and add artifact retrieval to the repository and service
- cover payload escaping and artifact lookup in tests
- add the artifact.html entry and window component, bundled separately from the app shell
- add an Open in window action with error feedback
- build both entries through Vite multi-page input
- test the window component, page action, and updated flows
- describe the dedicated artifact entry, payload injection, and core:default capability
- note the residual app-command ACL limitation
- mark temporary window creation and permission isolation on the roadmap
@BerryUIKI
BerryUIKI merged commit 1175996 into main Nov 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant