Skip to content

Serve and preview backend+frontend artifacts#90

Draft
StpMax wants to merge 7 commits into
mainfrom
feat/stateless_backend_show
Draft

Serve and preview backend+frontend artifacts#90
StpMax wants to merge 7 commits into
mainfrom
feat/stateless_backend_show

Conversation

@StpMax
Copy link
Copy Markdown

@StpMax StpMax commented May 14, 2026

Description

Adds support for previewing backend+frontend artifacts (fullstack-stateless-app / fullstack-stateful-app) inside the artifact viewer, with auto-relaunch of dead backends.

Server

  • /artifacts/preview-mount now returns two shapes: kind="static" (existing HTML preview) and kind="proxy" (artifact has a running backend on a recorded port).
  • If the recorded port is dead, calls Anton's launch_artifact_backend helper to respawn the backend in its slug-keyed scratchpad venv, then persists the new port to metadata.json. Per-slug asyncio.Lock prevents double-launches on StrictMode/double-click.
  • New WorkspaceScopedPool adapter in scratchpad_runtime.py to satisfy the helper's ScratchpadPoolLike API.
  • shutdown_launched_backends() reaps cowork-launched backends on app exit.
  • Path resolver tolerates .anton/artifacts/... and artifacts/... prefixes; artifact scanning aligned with Anton's settings.artifacts_dir (.anton/artifacts/).

Electron main

  • New preview-proxy.ts: single loopback HTTP forwarder, stable port, lazily re-reads metadata.json per request so backend restarts on a new port "just work". Strips hop-by-hop + upstream CORS headers and injects its own.
  • IPC: preview:start-proxy / preview:stop-proxy, exposed on antontron.preview.

Renderer

  • mountArtifactPreview returns the new kind discriminator + artifactDir/port.
  • ArtifactViewer routes backend artifacts through the proxy, disables Publish for them (with tooltip), and treats the artifact folder (not the entry HTML) as the "Open in OS" target.

Screenshots

Type of change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ⚡ New feature (non-breaking change which adds functionality)
  • 🚨 Hotfix (non-breaking change which fixes an issue)
  • 📢 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📄 This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked my code and corrected any misspellings

Comment thread server/routes/artifacts.py Fixed
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.

2 participants