feat(deep-link): Phase 2 — CLI dispatch, bootstrap integration, TUI notification, --init wizard#5052
Merged
Conversation
…otification, --init wizard Implements spec-066 Phase 2 (closes #5013): - src/url_scheme/prompt.rs: `confirm_prompt` / `ConfirmResult` — INV-NOTTY (no-TTY → Discarded) and interactive y/N gate before prompt injection - src/url_scheme/register.rs: Linux (.desktop + xdg-mime), macOS (manual instructions), Windows (reg.exe) scheme registration; `url-scheme register/unregister/status` commands - src/cli.rs: `url-open <URI>` and `url-scheme register/unregister/status` subcommands; hidden `--deep-link-prompt` / `--deep-link-uri` bootstrap fields - src/runner.rs: `handle_url_open` — INV-LOOP guard (ZEPH_URL_OPEN_DEPTH), URI parse, CWD validation, model validation, confirm gate, CLI field stash; `url-scheme` commands wired in main dispatch - src/tui_bridge.rs: `TuiRunParams::deep_link_uri` field; `run_tui_agent` emits AgentEvent::Status notification within 1 s of warmup, auto-clears after 3 s (spec-066 §9) - src/init/mod.rs: `step_deep_link` wizard step — scheme registration toggle and `confirm_before_prompt` preference; OS registration triggered in `step_review_and_write` after config write - crates/zeph-core/src/agent/builder.rs: `with_initial_message` builder method All code gated behind `#[cfg(feature = "deep-link")]`. 10817 tests pass; fmt, clippy, RUSTFLAGS=-D warnings clean.
P1: remove erroneous `return` from UrlOpen match arm — `run()` now falls through to the normal agent bootstrap path after `handle_url_open` succeeds. C1 (INV-TRUST): invoke `ContentSanitizer::sanitize` with `ContentSourceKind::McpResponse` (ExternalUntrusted) on the deep-link prompt before passing it to `with_initial_message`. Injection patterns are flagged and the prompt is wrapped in the external-data spotlighting envelope. S1: add `tracing::warn!` documenting that the validated model name is not yet wired into the session (provider switching deferred to Phase 3). M1: consolidate three `Config::load` calls in `handle_url_open` into one at the top of the function. M2: move the TUI deep-link notification task from `tokio::spawn` (dropped handle) to `forwarders.spawn` (tracked in the existing JoinSet, aborted on TUI/agent exit). M3: correct `SAFETY` comment — tokio runtime is active; the actual guarantee is that no concurrent code reads ZEPH_URL_OPEN_DEPTH on this call path. M4: add three unit tests — `deep_link_prompt_sanitizer_applies_mcp_response_source` (C1 coverage), `model_error_message_lists_known_providers`, and `model_error_message_none_configured` (unknown-model error path coverage). 10823 tests pass; fmt, clippy, RUSTFLAGS=-D warnings clean.
- Extract deep-link notification task into a helper function to bring run_tui_agent under the 100-line clippy limit - Add cfg_attr allow(unused_mut) on runner::run for builds without the deep-link feature where mut cli is unnecessary - Remove broken intra-doc link to private QueuedMessage type in AgentBuilder::with_initial_message doc comment
bug-ops
force-pushed
the
deep-link-phase-2
branch
from
June 7, 2026 23:18
e8872b9 to
de6d71a
Compare
bug-ops
enabled auto-merge (squash)
June 7, 2026 23:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
url-open <URI>CLI subcommand dispatcheszeph://deep links with INV-LOOP guard (ZEPH_URL_OPEN_DEPTH), URI parse, CWD validation, confirm gate, and prompt injection into the agent bootstrap pathurl-scheme register/unregister/statussubcommands for Linux (.desktop+xdg-mime), macOS (manual instructions), Windows (reg.exe)--initwizard gains astep_deep_linksection — scheme registration toggle andconfirm_before_promptpreferenceAgentBuilder::with_initial_messagebuilder method added inzeph-core#[cfg(feature = "deep-link")]Closes #5013
Security invariants implemented
ZEPH_URL_OPEN_DEPTH=1env guard prevents re-entrant dispatchContentSanitizer::sanitizewithContentSourceKind::McpResponse(ExternalUntrusted + spotlighting) beforewith_initial_messagevalidate_deep_link_cwd(absolute, canonicalize, denylist, allowlist) from Phase 1 used on every dispatchTest plan
cargo nextest run --workspace --features deep-link --lib --bins— 10823 PASScargo +nightly fmt --check— cleancargo clippy --all-targets --features deep-link -p zeph -- -D warnings— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features deep-link --locked— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— clean (confirmed)RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --features deep-link -p zeph— cleanxdg-mime+ macOS manual) — pending (requires TTY session)--tui --features tui,deep-link)Known Phase 2 scope gaps (deferred to Phase 3)
modelURI parameter is validated but not wired to provider override (Phase 3)prefer_acp = auto/alwaysis parsed but treated asNever(Phase 3).appwrapper auto-registration (Phase 3, OQ-1)