Repository navigation
Share any HTML file from the editor and the remote preview - #27608
Conversation
HTML could only be shared as an artifact from a local file:// browser tab. The editor offered Share only for Markdown, and the document preview that renders HTML on SSH and paired hosts had no Share at all. The editor now shares HTML files too, and the document preview's toolbar gets the same Share button, reading the page from its owning host. Both use one source key per file per host, so either surface finds the link the other published. Co-Authored-By: Claude <noreply@anthropic.com>
…rant's host The editor, the rendered preview and a local browser tab each built their own share key, so one file could publish to several links: a Windows path spelled C:/ in one place and C:\ in another, and the preview keyed from whichever host the workspace resolved to at render time, not the host it was reading from. One key function now serves every surface, with main's formats (local path, the CLI's SSH key, ['editor', env, host, path] with the 'remote' fallback) and Windows drive/UNC paths spelled with backslashes. The preview's grant handle keeps the location it was minted for. Share reads the page through that location and keys from it, so a later host change can't move either; an SSH grant keeps its connection id, so its read fails closed instead of reading a local file. Publishing prepares the request once per click, before sign-in and the auth retry, so a retry publishes what the user clicked Share on. Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Re-sharing an existing Windows file may leave its old public link stale, and sharing the same runtime file from the editor and preview may create separate links. Resolve or explicitly accept these link-identity risks before merging. Pre-merge checks ·
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c5ae48c5-f21d-4290-821e-e6764770d0ea
📒 Files selected for processing (19)
src/renderer/src/components/artifacts/artifact-publish-flow.test.tssrc/renderer/src/components/artifacts/artifact-publish-flow.tssrc/renderer/src/components/browser-pane/describe-page/browser-artifact-upload.tssrc/renderer/src/components/browser-pane/workspace-doc/HtmlDocPreview.toolbar.test.tsxsrc/renderer/src/components/browser-pane/workspace-doc/HtmlDocPreview.tsxsrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-artifact-share.test.tssrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-artifact-share.tsxsrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-toolbar.tsxsrc/renderer/src/components/editor/EditorPanel.tsxsrc/renderer/src/components/editor/EditorPanelHeader.test.tsxsrc/renderer/src/components/editor/EditorPanelHeader.tsxsrc/renderer/src/components/editor/EditorPanelShell.tsxsrc/renderer/src/components/editor/editor-artifact-upload.test.tssrc/renderer/src/components/editor/editor-artifact-upload.tssrc/renderer/src/components/editor/markdown-artifact-upload.tssrc/renderer/src/lib/doc-preview-grants.test.tssrc/renderer/src/lib/doc-preview-grants.tssrc/renderer/src/lib/file-artifact-source-key.test.tssrc/renderer/src/lib/file-artifact-source-key.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/editor/markdown-artifact-upload.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| return /^[A-Za-z]:[\\/]/.test(filePath) || /^[\\/]{2}/.test(filePath) | ||
| ? filePath.replaceAll('/', '\\') | ||
| : filePath |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Preserve updates to existing Windows links.
If a Windows editor tab previously published with a forward-slash sourceKey, this conversion assigns the same file a new backslash key. Re-sharing then creates a second link instead of updating the existing link. The old public link retains stale content. Preserve or migrate the previous key when publishing these files. The PR description also identifies this compatibility case.
| if (owner.runtimeEnvironmentId || (owner.executionHostId && owner.executionHostId !== 'local')) { | ||
| return JSON.stringify([ | ||
| 'editor', | ||
| owner.runtimeEnvironmentId, | ||
| owner.executionHostId ?? 'remote', | ||
| path | ||
| ]) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Use one key for legacy editor tabs and runtime previews.
When an editor tab has runtimeEnvironmentId: 'server-1' but no recorded route, this branch produces ["editor","server-1","remote",path]. A preview grant for that file on server-1 produces ["editor","server-1","runtime:server-1",path]. Sharing the two surfaces therefore creates separate links for the same file and host. Align the fallback with the preview identity while retaining a way to update links already published under the fallback key.
…orkspaces A preview of an SSH workspace a paired server proxies mints its grant on that SSH target, so it already keys the file the same way the editor does; the new test locks that in. Also corrects the SSH read comment: the connection id is kept because dropping it would read the path on this machine. Co-Authored-By: Claude <noreply@anthropic.com>
Review status (quick review loop, 2026-10-12)The problem this PR fixes. Before it, only Markdown files had a Share button in the editor, and the HTML preview of a file on a remote workspace had none. Different surfaces also built the link's identity for the same file differently. A Windows path spelled What changes for you. Any HTML file can be shared from the editor header and from the remote HTML preview. Every surface (editor, preview, browser tab, and the chat visual in #27634) gives one file on one host the same link, so sharing it again updates that link instead of creating a new one. The preview shares the file from the host its preview was opened on, even if the selected host changes later. One visible difference: a Windows file previously shared under a This round. Fresh reviewers went through the whole diff, and one architecture pass covered all three stacked PRs. Then a readiness check ran on the final diff.
Verified.
Not verified.
|
…#28110) HtmlDocPreview.tsx reached 403 lines on main (#27608 + #27875), over the 400-line limit for .tsx, so lint and the pre-commit hook fail on any branch that merges main. The focus handoff effect moves unchanged into use-doc-preview-guest-focus.ts. Co-authored-by: Orca Worker <orca-worker@localhost>
…#28110) HtmlDocPreview.tsx reached 403 lines on main (#27608 + #27875), over the 400-line limit for .tsx, so lint and the pre-commit hook fail on any branch that merges main. The focus handoff effect moves unchanged into use-doc-preview-guest-focus.ts. Co-authored-by: Orca Worker <orca-worker@localhost> (cherry picked from commit 5e83ca0)
ELI5
Today you can share an HTML page as an artifact only from a local browser tab. This adds the same Share button to HTML files open in the editor and to the rendered HTML preview Orca uses for files on other hosts. It also makes every place that shares a file use the same link for it.
What Changed
The problem:
.htmlfile.C:/repo/a.htmlin one place andC:\repo\a.htmlin another got two different links. Re-sharing from the other surface created a second artifact instead of updating the first.After:
Mechanism:
fileArtifactSourceKey(owner, filePath)inlib/file-artifact-source-key.ts). It keeps main's key formats: a plain path for local files, the CLI's key for SSH,['editor', environment, host, path]for paired hosts, and'remote'in place of the host when the tab never recorded one. Windows drive and network-share paths are always spelled with backslashes, using the rule the browser tab already used forfile://URLs. The editor, the preview and the local browser tab all call it.markdown-artifact-upload.ts→editor-artifact-upload.ts). HTML is recognised by.html/.htm, so files that only highlight as HTML, like.jsp, aren't offered.readRuntimeFilePreview) and keys from the same location. It never looks the host up again.createRequest()runs once per click, before account connect and the retry loop.No main-process or host change: publishing already runs in the desktop's own process from the bytes the renderer hands it.
Why
This is the first step of STA-10097 / STA-10098: an HTML page an agent makes in chat should be a regular file that you can open, edit and share like any other. A follow-up PR moves chat HTML into the workspace and drops the separate chat-visual viewer. For that to include sharing on remote hosts, the regular HTML surfaces need Share and one shared key, which is this PR.
Alternatives considered:
Linked Issue
STA-10097, STA-10098 (Linear)
Visual Proof
Live check on the M4Air at head
745b0011590(all three PRs together): a hidden, isolated dev build with real Claude, plus a second isolated Orca paired to it as a remote host.An
.htmlfile open in the editor has Share in its header (the share icon left of the...menu):On a paired remote host, opening the file gives the HTML preview tab, and its toolbar has Share:
On the remote host, Share showed the same popover as on the local machine. That rig had no Orca account and sharing was off, so the popover asked for both.
Not checked live: an actual publish (needs a signed-in account) and an SSH-owned preview.
Testing
Unit tests:
file-artifact-source-key.test.ts: the editor, the preview and a local browser tab produce the same key for the same file. Covers local, paired, SSH, WindowsC:/vsC:\, and the'remote'fallback.doc-preview-artifact-share.test.ts: the preview reads from the grant's server; an SSH grant keeps its connection id, so the read fails closed and never reads locally; binary and unreachable cases; Share appears only for HTML with a minted grant.doc-preview-grants.test.ts: the handle keeps the minted location after the workspace resolves to another host, until the grant is released.HtmlDocPreview.toolbar.test.tsx: the toolbar's Share uses the minted grant's location, not the host the workspace resolves to later.artifact-publish-flow.test.ts: the request is built once, before sign-in, and the auth retry publishes that same request.editor-artifact-upload.test.ts,EditorPanelHeader.test.tsx: which files are shareable, and the button shows for any shareable document, not on diffs.Also passed:
tc:web, oxlint, changed-code quality gates, and the rest oforca-ci-checks(its bun-basedtypecheck:cican't run on this machine).I manually tested these changes locally (editor and remote-preview Share, live on head
745b0011590; no publish, no account)Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
mainno longer serves SSH file reads in the desktop app (refactor(ipc): filesystem and repo handlers are local or runtime only #27609, refactor(providers): delete the SSH git and filesystem providers and relay-only wiring #27644), so after merge an SSH preview doesn't render and its Share shows the existing "couldn't read" error.C:/…) now uses the backslash key. Re-sharing it creates a new link instead of updating the old one.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)