Skip to content

feat(desktop): register codeg:// URL scheme to open a conversation - #725

Open
changexbc wants to merge 1 commit into
xintaofei:mainfrom
changexbc:feat/desktop-url-scheme
Open

feat(desktop): register codeg:// URL scheme to open a conversation#725
changexbc wants to merge 1 commit into
xintaofei:mainfrom
changexbc:feat/desktop-url-scheme

Conversation

@changexbc

Copy link
Copy Markdown

Why

The desktop app never registered a system URL scheme (CFBundleURLTypes / protocol handler). External tools can launch Codeg (open -b app.codeg) but cannot jump to a specific conversation tab.

In-app markdown already uses codeg://session/<id> as a mention badge. This PR makes that form a real OS deep link.

What

  • Register the codeg custom scheme via tauri-plugin-deep-link (macOS / Windows / Linux).
  • Resolve:
    • codeg://session/<id> — Codeg numeric PK or the agent's external_id (Grok UUID, Codex thread id, …)
    • codeg://workspace?conversationId=<id> — same lookup; folderId / agent optional
    • codeg://open — just show the workspace
  • Ignore in-app mention badges (codeg://agent/…, codeg://commit/…, codeg://embedded/…).
  • Warm start: reuse workspace://focus-conversation (same path as the pet panel).
  • Cold start: bake the lookup into /workspace?folderId=&conversationId=&agent= so the existing DeepLinkBootstrap opens the tab after hydration (an event emitted before the webview subscribes would be dropped).
  • Second-instance argv on Windows/Linux is forwarded through the single-instance plugin.

Docs: docs/url-scheme.md.

Examples

open "codeg://session/214"
open "codeg://session/<grok-or-codex-session-id>"
window.location.href = "codeg://session/214"

Tests

  • Parser / argv / lookup unit tests in src-tauri/src/deep_link.rs (numeric id, external id, path traversal, workspace query mismatch).
  • cargo test --features test-utils --lib deep_link
  • cargo clippy --lib --features test-utils -- -D warnings

Not available in codeg-server / browser-only mode — that path already has the /workspace?… query string.

The desktop app did not register a system URL scheme, so external tools
could launch Codeg but not jump to a specific session. Register `codeg://`,
resolve `codeg://session/<id>` against the live conversation table (numeric
PK or the agent's external_id), and reuse the existing focus-conversation
event for a warm start. A cold start bakes the lookup into the main window
query string so DeepLinkBootstrap opens the tab after hydration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant