Skip to content

feat(desktop): open a session via opencode:// deep link - #54153

Closed
BlueBlock wants to merge 1 commit into
anomalyco:devfrom
BlueBlock:feat/desktop-session-deeplink-dev
Closed

BlueBlock wants to merge 1 commit into
anomalyco:devfrom
BlueBlock:feat/desktop-session-deeplink-dev

Conversation

@BlueBlock

Copy link
Copy Markdown

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-link event, and the /server/:serverKey/session/:id route. 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, and opencode://console/authorized are unchanged.

Windows cold start copies opencode:// arguments from process.argv into the existing initial deep-link queue. A second instance and macOS open-url keep the current path.

Tests

Parser unit tests in packages/app/src/pages/layout/helpers.test.ts cover 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.ts passed (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-url was not run. This branch is current dev and was not packaged again.

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.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot closed this Oct 9, 2026
@opencode-agent

opencode-agent Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the clear write-up and the parser tests, @BlueBlock!

v1 (the dev branch) only takes critical fixes, and a new opencode://session/<id> deep link is a feature, so it can't go in here.

The v2 desktop app has its own deep-link handling (packages/desktop/src/renderer/startup/deep-links.ts and packages/desktop/src/main/lifecycle/ on the v2 branch). If you'd still like to add session deep links, you could open a pull request against v2. It's a separate implementation, so the change would need to be redone there rather than ported directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant