GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(desktop): open a session via opencode:// deep link by BlueBlock · Pull Request #54187 · anomalyco/opencode Conversation
|
|
The following comment was made by an LLM, it may be inaccurate: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I couldn't verify this end to end. It needs the packaged Electron app with the opencode:// handler registered, and that isn't available here. The parser tests pass (4/4) and packages/desktop type-checks cleanly. I also read through the main-to-renderer delivery path and ran the parser on a few extra inputs.
Public API: this adds the opencode://session/<id> URL form and a sessionHref export from @opencode/app/desktop. Both are additions, so the change is backwards compatible.
Concerns, most important first (details inline):
? or invisible characters get through into the route.src/main. The parser should live in src/shared.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const restoreWindows = windows.restore | ||
| const pendingDeepLinks: string[] = [] | ||
| const initialDeepLinks = process.argv.filter((arg) => arg.startsWith("opencode://")) | ||
| const pendingDeepLinks = [...initialDeepLinks] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
emitDeepLinks (below) pushes every URL into pendingDeepLinks, even when it was delivered live to a window over IPC. Each renderer drains this queue on boot through consumeInitialDeepLinks. Before this PR nothing acted on the queued links. With SessionDeepLinks in place, a session link opened while the app is running will navigate the next window you open (or a reload) to that same session again. Please only queue links that no window received, or clear them once they've been delivered.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| if (!id || id.length > 256 || id === "." || id === "..") return | ||
| if (id.includes("/") || id.includes("\\") || sessionControl.test(id)) return |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This list of rejected characters still lets through IDs that break the route. opencode://session/ses%3F1 decodes to ses?1, and sessionHref inserts it unencoded, so it becomes /session/ses?1. A zero-width space (%E2%80%8B) is also accepted. Matching against the actual session ID format (e.g. /^[A-Za-z0-9_-]{1,256}$/) would replace most of these checks and close those gaps.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| }) | ||
|
|
||
| createEffect(() => { | ||
| const server = servers.visible[0] ?? servers.list[0] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The session is always opened on servers.visible[0] ?? servers.list[0]. With extension or remote servers in the list, the ID may belong to a different server, and the user lands on a broken session page. At minimum, please target the local sidecar explicitly. Also, when several IDs are queued, the loop calls navigate for each one, and only the last navigation has any effect.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| import { ServerConnection, sessionHref, useServers } from "@opencode/app/desktop" | ||
| import { useNavigate } from "@solidjs/router" | ||
| import { createEffect, createSignal, onCleanup, onMount } from "solid-js" | ||
| import { sessionDeepLink } from "../../main/lifecycle/deep-link" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The renderer imports from src/main/lifecycle. packages/desktop/AGENTS.md keeps renderer and main separate, so please move the shared parser into src/shared/ and import it from both sides.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Queue a cold-start link until a window exists, and do not replay a link that a live window already received. Accept only session ids made of letters, numbers, underscore, and hyphen. Open the local server once.
c26f2d0 to
a433bb4
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.