Skip to main content

Module worktrees

Module worktrees 

Source
Expand description

The cross-window worktree registry engine.

Maintains the live, authoritative set of repos/worktrees open across every VS Code window, fed by a first-party companion extension that reports from each window over the daemon’s control socket. The resident daemon is the rendezvous point the per-window extension sandbox cannot replace: each window can see only its own workspace.workspaceFolders, so a single process aggregating those registrations is the only cross-window source of truth. See ADR-0040.

This is the standalone engine, analogous to crate::browser and crate::snowflake; the daemon adapter lives in crate::daemon::services::worktrees.

Like the Snowflake engine this is cheap and in-memory — no async setup, no secret persisted. The registry lives behind a std::sync::Mutex that is never held across an .await (the Snowflake rule); every op is pure CPU under the lock, so liveness reaping happens inline on each read rather than from a background task.

Structs§

RegisterRequest
A register request from a companion extension.
WindowEntry
One open window’s live registration. Serialized verbatim into list / status payloads; consumers compute age from last_seen (RFC 3339).
WorktreesRegistry
The cross-window worktree registry: the in-memory, TTL-reaped set of open windows. Hosted by WorktreesService.