Repository navigation
refactor(desktop): simplify deep links and open sessions by id - #64180
Brendonovich wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Looks sound. I couldn't run it: it's Desktop/Electron-only, and there's no way to launch the app or send it opencode:// links here. So I read the code and ran the package checks. bun test in packages/desktop passes. tsc -b is clean. bun typecheck couldn't run because this sandbox has bun 1.4.2 and the repo wants 1.4.4.
The launch link is captured at the top of the entry module and handed over to the lifecycle listener in the same synchronous step, so no open-url can fall between the two. The console return keeps its old targeting: the originating window, else the last focused one. No references to the removed RPCs, events or modules are left.
Public API: no SDK, server, plugin, config or CLI surface changes. The Desktop IPC is internal: AppReadyDeepLinks and AppAcknowledgeDeepLinks become AppTakeDeepLink, and the DeepLinksOpened event becomes DeepLinkReceived. The URL scheme gains opencode://session/<id> and drops open-project and new-session, which nothing handled since #43789.
No blocking concerns.
|
How |
059d8f0 to
4841549
Compare
Summary
Simplifies how Desktop main hands deep links to the renderer, and adds
opencode://session/<id>. Rebased on #65332, which brought backopen-projectandnew-sessionin the app (packages/app/src/shell/deep-links); this PR keeps those links working and routes session links through the same machine.Deep links after this PR:
opencode://open-project?directory=<path>opencode://new-session?directory=<path>&prompt=<text>opencode://session/<id>opencode://console/authorized?window=<id>What changes:
AppTakeDeepLinks, once when the app starts listening and again on eachDeepLinkReceived. The first app window to take them gets them. This replacesAppReadyDeepLinks,AppAcknowledgeDeepLinks,DeepLinksOpenedand main's delivery/acknowledgement machine (src/main/deep-links/machine.ts).captureLaunchLinks(argv on Windows/Linux, earlyopen-urlon macOS).onDeepLinksis now a small bridge overtakeDeepLinks/onDeepLink(src/renderer/startup/deep-links.ts).src/shared/deep-links.tskeeps only the Console return parser that main uses.Not behind a feature flag: session links only act when an external
opencode://session/...link is opened.Known limits (agreed as edge cases): servers are checked one after another, so a slow remote delays later ones; a session found nowhere only logs a console warning.
Recording
Recorded before the rebase. The session behavior is the same; it now runs through the app's deep-link machine.
Cold launch with
opencode://session/<local id>opens the local session:1-cold-launch-local.mp4
App running on Home: a link to a session that only exists on a second server ("Remote box") opens it; a local session link opens a second tab; an unknown ID opens nothing:
2-running-multi-server.mp4
Validation
bun typecheckandbun run typecheck:tscinpackages/desktop;bun typecheckinpackages/appbun testinpackages/desktop;bun test src/shell/deep-linksinpackages/appAdded by the opencode bot (AI-generated).
Fixes #44167
Related: #53529, #55106