Conversation
|
I'd love to see this feature added |
|
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. |
|
Hi @Brendonovich, could you consider reopening this PR? It addresses #44167, which is still open. The branch on my fork is updated against |
The Info tab now opens on a Projects tree: every project opencode knows about, with its sessions loaded only when the group is expanded. Why the counts looked wrong: the status line reported index totals while calling them sessions. The index only describes external transcripts, so it could never agree with opencode's own session count, which also includes natively created sessions this plugin never imported. Audited both directions first - 0 dangling, 0 orphaned - so nothing was actually lost. The line now reports sources / imported / pending alongside opencode sessions / native / projects, each labelled for what it counts. Panels gain a ree type (lib/registry.ts): collapsible groups plus a children(groupID) resolver. snapshot() strips children before serialising, so it stays server-side and runs only for a group the user actually opened - a plugin listing hundreds of sessions would otherwise build all of them on every five-second poll. Served by a new GET /api/plugins/:id/panel/:key/children. Sessions are read from opencode's own project/session tables rather than the index, so native sessions appear beside imported ones, each card labelled opencode / Claude Code / Codex / dsh from metadata.imported.source. Project editing via a three-dot menu: rename, add a folder or remote URL, and merge into another project. The menu is appended to document.body and suppresses the poll while open, because a refresh rebuilds the pane wholesale and would close it mid-click. Merging re-points session rows and cannot be undone from the UI, so it snapshots the database with VACUUM INTO first - a plain copy would risk a torn file, since WAL keeps committed pages in the -wal sidecar. Each edit ends by asking for a restart, since opencode reads its project list at startup. Clicking a session opens its transcript here, not in the app. The desktop app's deep-link parser accepts only open-project and new-session, with no session-scoped route, so 'Open in opencode' opens the project and the transcript is rendered in the dashboard rather than pretending to hand off. A shared redirect-capable card for this and task-queue is deferred until anomalyco/opencode#45103 lands; building it now would only encode the current limitation. Verified: 12 HTTP checks over a real server (snapshot shape, children endpoint, 400s for missing group / unknown panel / unknown plugin, ':' in a project id round-tripping, CSS shipped); 15 checks of rename/add/merge against a copy of the real database, confirming no sessions are lost, the backup is a valid database still holding the pre-merge state, and self/unknown merges are refused; the deep link proven to leave no shell metacharacter unencoded. The live database was never opened for writing and is unchanged at 349 sessions.
Issue for this PR
Closes #44167
Type of change
What does this PR do?
Adds
opencode://open-session?server=...&session=...links for existing Desktop sessions. The app resolves the configured server plus canonical session lineage before navigating.Adds Copy link to the custom session-tab context menu introduced by #46116. It copies the public URL on Desktop and an absolute web URL in the browser, with localized success/error feedback.
Desktop forwards protocol URLs from both initial startup arguments and second-instance delivery. Deep-link handling is serialized so launches are processed in delivery order, while a single argument batch uses its last supported URL.
This complements #44137: that PR creates a new session from an external URL, while this one opens an existing Desktop session.
How did you verify your code works?
bun test --conditions=solid --preload ./happydom.ts ./src/pages/layout/helpers.test.tsfrompackages/app(33 passed)bun test ./src/main/deep-links.test.tsfrompackages/desktop(2 passed)bun run typecheckfrompackages/appandpackages/desktop(passed)bun turbo typecheckvia the pre-push hook after merging upstreamdev(30 tasks passed)Screenshots / recordings
The session-tab context menu now contains Rename, Copy link, and Close tab. No screenshot is attached.
Checklist