CliSubprocessCore.Session is the normalized long-lived provider session
runtime.
It adds provider command construction, stdout/stderr decoding, normalized event sequencing, and subscriber fanout above the shared transport substrate.
Start A Session
ref = make_ref()
{:ok, session, info} =
CliSubprocessCore.Session.start_session(
provider: :claude,
prompt: "Explain the latest failing test",
subscriber: {self(), ref}
)Session Delivery
Tagged subscribers receive:
{session_event_tag, ref, {:event, %CliSubprocessCore.Event{}}}
Use CliSubprocessCore.Session.extract_event/2 instead of hard-coding the
outer mailbox shape.
Transport Snapshot
Session.info/1 exposes transport data through a sanitized public snapshot:
info.transport.infois recognized byTransportInfoinfo.transport.infoomits lower runtime handles such as BEAM pids, OS pids, ports, and transport modulesinfo.transport.statusreflects the normalized transport status
That keeps the core session API stable while the local session-bearing lane now runs on the Execution Plane-owned process transport seam.
Placement
Pass execution_surface when the provider session should run somewhere other
than the default local subprocess:
{:ok, session, info} =
CliSubprocessCore.Session.start_session(
provider: :antigravity,
prompt: "Hello from SSH",
execution_surface: [
surface_kind: :ssh_exec,
transport_options: [destination: "buildbox.example"]
]
)Lifecycle Calls
The core session API exposes:
send/2send_input/3end_input/1interrupt/1close/1subscribe/2subscribe/3unsubscribe/2info/1
These calls delegate to the transport substrate but keep provider-facing semantics and event normalization in the core.