Serve and preview backend+frontend artifacts#90
Draft
StpMax wants to merge 7 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-mountnow returns two shapes:kind="static"(existing HTML preview) andkind="proxy"(artifact has a running backend on a recorded port).launch_artifact_backendhelper to respawn the backend in its slug-keyed scratchpad venv, then persists the new port tometadata.json. Per-slugasyncio.Lockprevents double-launches on StrictMode/double-click.WorkspaceScopedPooladapter inscratchpad_runtime.pyto satisfy the helper'sScratchpadPoolLikeAPI.shutdown_launched_backends()reaps cowork-launched backends on app exit..anton/artifacts/...andartifacts/...prefixes; artifact scanning aligned with Anton'ssettings.artifacts_dir(.anton/artifacts/).Electron main
preview-proxy.ts: single loopback HTTP forwarder, stable port, lazily re-readsmetadata.jsonper request so backend restarts on a new port "just work". Strips hop-by-hop + upstream CORS headers and injects its own.preview:start-proxy/preview:stop-proxy, exposed onantontron.preview.Renderer
mountArtifactPreviewreturns the newkinddiscriminator +artifactDir/port.ArtifactViewerroutes 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.
Checklist: