Repository navigation
Conversation
Teach the desktop client to navigate to opencode://session/<id> from a cold start and from a second instance. Invalid session links are ignored, and the existing project and console links are unchanged.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
Thanks for the clear write-up and the parser tests, @BlueBlock! v1 (the The v2 desktop app has its own deep-link handling ( |
Motivation
External companion tools (session managers, IDE integrations) need a supported way to open a specific session in the desktop client. Today the only option is the TUI CLI.
The plumbing already exists: protocol registration, second-instance forwarding, the renderer
opencode:deep-linkevent, and the/server/:serverKey/session/:idroute. This adds the missing session consumer and parser.Schema
opencode://session/<sessionID>The id must be one path segment, at most 256 characters, with no control characters, credentials, query, hash, extra segments,
., or... Invalid links are ignored.opencode://open-project,opencode://new-session, andopencode://console/authorizedare unchanged.Windows cold start copies
opencode://arguments fromprocess.argvinto the existing initial deep-link queue. A second instance and macOSopen-urlkeep the current path.Tests
Parser unit tests in
packages/app/src/pages/layout/helpers.test.tscover a valid id, an encoded space, the 256-character limit, and rejections for traversal, extra segments, query, hash, userinfo, over-long ids, control characters, encoded slashes, and unrelated hosts.bun test src/pages/layout/helpers.test.tspassed (29 tests).A Windows launch of the v2.0.26 desktop with the same parser behavior passed cold start, a running-instance handoff to a real local session, and the invalid-link cases. macOS
open-urlwas not run. This branch is currentdevand was not packaged again.