feat: let extensions take over files the browser tab downloads #4223
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4223"
general
weight: 0.35
greptile-apps[bot]
Description
BrowserDownloadExtensiontoBeutl.Extensibility, so an extension can take over a file that a page in the browser tab offers and add it to the editor in its own way. The first consumer is the text-to-speech extension: Yukkuri voice sites synthesize speech in the page and hand it over as ablob:/data:URL whose file name does not carry the spoken line, so the extension has to read the line from the page and place the speech with its character and caption.BrowserDownloadExtensionin turn throughClaim(BrowserDownloadOffer). A claim can carry aPageScript, a JavaScript expression the browser evaluates in the offering page at once (also for a file held back behind another prompt, so it reads that file's own page; a file that a frame of a page still loading offers is claimed once that page is on display), and aDescription, which the download prompt shows in place of the file name.resources/downloadswithout the download options and callsImportAsyncwith the file, the offer and the page data. The browser wraps the expression in an envelope of its own, soPageDatais the page's string exactly on WebView2 and WebKit alike; a failing or silent page givesnullafter five seconds.ImportAsyncreturnsfalseto fall back to the usual single-element import, an exception shows the existing "saved, but timeline import failed" message, and canceling in the prompt reports a cancellation.EditViewModelnow also answersIExtensionProvider, so editor components can offer work to extensions through the lease-backed interface.docs/extension-authoring/browser-downloads.md.Screenshots / Render output
Nothing changes without a
BrowserDownloadExtension. With one that claims the offer, the second line of the download prompt shows the claim's description instead of the file name (the file name moves to that line's tooltip), and confirming skips the download options panel. The extension's own UI is shown in the text-to-speech extension's PR linked below.Affected areas
Beutl.Engine(rendering / scene / track)Beutl.ProjectSystem(project / document persistence)Beutl.Editor,Beutl.Editor.Components,Beutl.Controls)Beutl.Extensibility(plugin abstractions)Beutl.NodeGraph(node editor)Beutl.FFmpegIpc/Beutl.FFmpegWorker(media IPC boundary)Beutl.Api(server API client)Breaking changes
None. The extension kind, its records and the
IExtensionProvidereditor service are additions.Raises the format floor?
No.
Test plan
tests/Beutl.HeadlessUITests/BrowserDownloadExtensionTests.cs: a claimed generated file is read from its page when offered (WebView2's quoted envelope, WebKit's plain one, a string that is itself quoted, the stringnull, and a value that is not a string), shows the claim's description, skips the options, lands inresources/downloadsand reachesImportAsyncwith its offer and page data; a declined import falls back to one element; an offer no extension claims keeps the options; a scene that was never saved offers nothing to extensions; a failing import and a failing page script are reported while the file stays; a file held behind an earlier prompt keeps the data its own page showed; a file from a frame of the next page is not claimed for the page being left, and one from a frame of a page still loading is claimed for that page once it is shown; canceling during the import reports a cancellation and keeps the file.tests/Beutl.PublicApiContractTests/BrowserDownloadExtensionAuthoringContractTests.cs: a plugin-authored extension claims, imports, and has its arguments checked.BrowserDownloadExtensionTests,WebBrowserDownloadTests,EditViewModelServicesTestsandBrowserReviewLifecycleTests(151 passed) and the new contract tests (3 passed) on macOS.2.99.99-browserdownload.1) runs the text-to-speech extension's import tests, which place real speech with a PsdTachie character and a caption.Fixed issues / References
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Browser extensions can now claim eligible downloads, show a description during confirmation, and import saved files into the project. If an extension declines or cannot import a file, the existing download flow remains available.
Documentation
Added a guide explaining how to create browser download extensions, including offer eligibility, confirmation, page data, and import behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->