btv.session
btv.session.reconnect(spec)
btv.session.reconnect(spec) — swap the current client onto spec. spec is:
{
transport = { kind = “spawn”, argv = { “ssh”, “host”, “bemtvi”, “–daemon” } }
– structured, no shell
or { kind = “spawn”, cmd = “ssh host bemtvi –daemon” } – sh -c line
or { kind = “quic”, addr = “bemtvi://host:port/token?cert=…” },
config_source = “remote” | “local”, – optional; default “remote” (§D)
keep_buffers = true | false, – optional; default false
}
config_source (§D) picks whose config the swapped session runs, independent of the
transport: "remote" (default) materializes the daemon’s config + plugins locally and
keeps shada on the daemon; "local" keeps THIS machine’s init.lua / plugins and the
daemon backs only the fs / process / LSP seams (the dev-container shape — local editor
settings, the container’s toolchain). Either way the client-owned system-plugin tier (§A)
is re-seeded, so a connector persists across the swap regardless. "merged" (local UI
config layered over the remote’s project config) is RESERVED but not implemented yet — it
fails loud rather than silently picking one side.
Prefer argv (a list run WITHOUT a shell, so nothing can be smuggled through shell
metacharacters); cmd is the sh -c convenience for ssh/docker one-liners (as safe as
its origin — this runs in the LOCAL VM, which already has arbitrary execution). The client
carries the system-plugin tier (§A) forward across the swap and feeds the command into the
reconnecting dialer so a dropped link re-runs it. Fails LOUD on a malformed spec (a bad
transport is a bug, not a silent no-op); a provisioning / spawn FAILURE surfaces later and
leaves the current session intact (the client resolves fully, then swaps). Returns nothing.
Defined in btv.lua.