Expand description
Deep-link dispatch for red ui <uri> (ADR 0051, issue #1046, PRD #1041).
The default red ui <uri> (no --server) prefers the installed desktop
app via the redui:// URL scheme and falls back to the served browser
bridge (super::ui_bridge) when no handler is registered. This module
owns the decision, the canonicalised deep-link string, and the OS
handoff — all behind a DeepLinkEnv seam so both branches (handoff vs
fallback) and the deep-link URL are unit-testable without touching the OS.
The dispatched redui://?connect=<canonical-uri> URL carries the target
only — never a credential. Auth handoff is a separate slice (ADR 0051: the
token crosses via a local secret channel, never the deep-link URL).
Structs§
- OsDeep
Link Env - The production
DeepLinkEnv: probes the OS for theredui://handler and opens URLs via the platform default handler.
Enums§
- Dispatch
Mode - Which dispatch path
red uishould take, before consulting the OS. - Dispatch
Outcome - What the caller (
red ui) should do once dispatch has run.
Traits§
- Deep
Link Env - The OS-touching seam dispatch runs over: probing whether the
redui://handler is registered, and opening a URL with the platform handler. Both branches ofdispatchare driven through this trait so tests assert the decision and the emitted deep-link string without any OS state.
Functions§
- build_
deep_ link - Build the
redui://?connect=<canonical-uri>deep link (ADR 0051). The canonical URI is percent-encoded so query-breaking characters (spaces,&,?,#, …) survive, while the readable URI shape (file:///…,red://…) is preserved. The link carries the target only — never a token. - build_
deep_ link_ with_ handoff - Build a deep link that also tells the desktop app where to fetch the
held credential from (issue #1048). The
handoffquery value is the loopback handoff URL —http://127.0.0.1:<port>/handoff/<nonce>— which carries the single-use nonce, never the secret. The desktop app fetches the token from there over the local secret channel; nothing sensitive rides the deep link, so the token never lands inps, shell history, or URL logs. - canonicalize_
target_ uri - Canonicalise a
red uitarget URI for embedding in the deep link. - dispatch
- Decide-and-dispatch. Pure decision logic over the
DeepLinkEnvseam: