cmux NEXT: keep outside agent links reopenable
Merged
TE
13d ago+120+120+012345678901234567890123456789-28-28-01234567890123456789
Fixes #22609
Leo wrote:
- Session id alphabets differ. The daemon publishes
agent_session_id as up to 256 bytes of [A-Za-z0-9._:-] (agent_types.rs, sdk-schema.json). DeepLink.isAgentSession accepts at most 200 bytes and no :, and so do the webview link regexes (links.ts, replyHref.ts).
- The adopted chat tab skips the connection check.
tab(resuming:) / locateTab do not require a connected daemon the way terminal candidates do.
- The adoption map is memory-only (
AgentTabs.swift). After a relaunch, a restored chat tab that resumed an outside session no longer answers its link.
- Focus from public ids. Agent-Session trailers put session ids in public commit history, so an OS-opened
cmux://agent/... link must not leave the agent input focused.
This one PR keeps the native DeepLink grammar, webview reply and Markdown link classifiers, and the shared agent-link schema aligned at 256 bytes with :. It persists outside-chat adoption ownership, rejects restored adopted tabs while their daemon is disconnected or on another host, and marks externally opened agent links background so they cannot capture the next keystroke.
Validation:
git diff --checkpassed.- Direct Bun grammar probe passed for ordinary links, colon-bearing sessions, 256-byte sessions, and 257-byte rejection.
bun test test/markdown-cmux-app-links.test.tswas attempted but the checkout lacks@base-ui/utils/useIsoLayoutEffectfromtest/preload.ts; native Swift tests/builds are deferred to PR CI/fleet per policy.
No capture: this changes link parsing, adoption routing, and external focus policy; no native UI surface or layout changes.
Agent session: big-red