Skip to content

connect-to-cdp

Programmatic helper to launch (or attach to) a CDP-enabled Obsidian instance with the runtime helper namespace bootstrapped, for ad-hoc real-app debugging.

A single connectToCdp call resolves the owned-instance config, opens a vault, and bootstraps window.__obsidianIntegrationTesting (so evalWrapper, the base lib helpers, errorToString, getObsidianModule, … are available), then hands back a disposable CdpConnection exposing the chosen CDP port, a raw CdpConnection.invoke and the rich CdpConnection.evalInObsidian.

Interface Description
CdpConnection A live connection to a CDP-enabled Obsidian instance with the runtime helper namespace bootstrapped. Implements AsyncDisposable, so await using conn = await connectToCdp(…) disposes it (killing an owned instance and — for a throw-away temp vault — removing its directory) automatically.
ConnectToCdpOptions Options for connectToCdp.
Function Description
connectToCdp Launches (or attaches to) a CDP-enabled Obsidian instance, opens a vault, and bootstraps the runtime helper namespace, returning a disposable connection.