pub struct HarnessSessionService { /* private fields */ }Expand description
Stateful persisted-session service. Each instance owns its follow subscriptions; discovery and loading remain read-only.
Implementations§
Source§impl HarnessSessionService
impl HarnessSessionService
Sourcepub fn with_reduction_store_root(self, root: impl Into<PathBuf>) -> Self
pub fn with_reduction_store_root(self, root: impl Into<PathBuf>) -> Self
Override the trusted, service-owned store used for durable reduction
bundles. Embedders and tests use this to keep all writes inside an
explicitly selected root; the CLI otherwise uses the normal
$SUPERCODE_HOME/sessions location.
Sourcepub fn observe_subagent_approvals(
&mut self,
queue: Arc<Mutex<Vec<QueuedApproval>>>,
)
pub fn observe_subagent_approvals( &mut self, queue: Arc<Mutex<Vec<QueuedApproval>>>, )
ORCH-9: publish the parent’s own subagent-approval queue into
harness.v1.approvals.list.
This is the SAME Arc an crate::Agent pushes into
(Agent::pending_child_approvals), so a host that runs supercode’s own
loop beside this service surfaces those requests through the uniform
door without copying them anywhere.
Sourcepub fn approvals(&self, query: &ApprovalsQuery) -> Vec<ApprovalRow>
pub fn approvals(&self, query: &ApprovalsQuery) -> Vec<ApprovalRow>
ORCH-9: every approval request this service can see, newest last.
Two sources, both live: the requests outstanding on the open runtime
connections, and supercode’s own queued subagent approvals. There is
no file or database source at the pinned harness versions (see
crate::approvals), so a stored or proposal row is never produced.
Sourcepub fn session_index_notifier(&self) -> Arc<Notify> ⓘ
pub fn session_index_notifier(&self) -> Arc<Notify> ⓘ
Return the edge-triggered wakeup used by session-index filesystem subscriptions. Transports can await this instead of polling indexes.
Sourcepub fn handle(&mut self, request: Value) -> Value
pub fn handle(&mut self, request: Value) -> Value
Handle one JSON-RPC 2.0 request and return one JSON-RPC response.
Sourcepub async fn handle_async(&mut self, request: Value) -> Value
pub async fn handle_async(&mut self, request: Value) -> Value
Handle either a persisted-session request or an asynchronous live runtime request.
Sourcepub fn poll(&mut self) -> Vec<Value>
pub fn poll(&mut self) -> Vec<Value>
Poll all active subscriptions once and return zero or more JSON-RPC notifications. Recoverable follower errors are delivered as events.
Sourcepub async fn poll_session_runtime_states(&mut self) -> Vec<Value>
pub async fn poll_session_runtime_states(&mut self) -> Vec<Value>
Report each followed session’s live-runtime lifecycle state on that session’s own subscription, emitting only when the state changes.
A growing transcript is not evidence that an agent is working, so the
state comes from the live-runtime registry and nowhere else. A followed
session with no registered Supercode runtime — a harness running outside
Supercode — reports persisted, which says plainly that its activity is
unknown rather than guessing at it. These events carry no sequence
number and no transcript content; they never interleave with the
content follower’s sequenced stream.
Sourcepub async fn poll_session_activities(&mut self) -> Vec<Value>
pub async fn poll_session_activities(&mut self) -> Vec<Value>
Poll normalized activity subscriptions, emitting only proven state transitions. Every subscription is bulk-sampled so stock-harness process and registry discovery happens once per UI, not once per row.
Sourcepub fn poll_session_indexes(&mut self) -> Vec<Value>
pub fn poll_session_indexes(&mut self) -> Vec<Value>
Drain native-store invalidations and emit revisioned descriptor deltas. An idle subscription performs no catalog or transcript reads between its minute-scale recovery reconciliations.
Sourcepub async fn poll_runtimes(&mut self) -> Vec<Value>
pub async fn poll_runtimes(&mut self) -> Vec<Value>
Non-blockingly sample one event from every connected live runtime.
Sourcepub fn runtime_open(request: &Value) -> Option<RuntimeOpen>
pub fn runtime_open(request: &Value) -> Option<RuntimeOpen>
Recognize the one request family whose waiting happens entirely outside this service’s state, and hand a transport the half it can run off the task that owns the service.
Opening a runtime is the only door here that waits on a foreign
program: it spawns the harness’s own binary and completes that
program’s protocol handshake, which takes as long as the program takes
to answer. A transport that awaited the whole request inline would
stop reading its own input for that whole time, so ONE slow launch
would queue every later request on the same server — including reads
like sessions.discover that touch no runtime at all. Splitting the
request lets the transport spawn RuntimeOpen::open and keep
reading, then pay only the short bookkeeping half
(Self::register_open_runtime) when the runtime is up.
None for every other method: those are answered by
Self::handle_async as before.
Sourcepub async fn finish_runtime_open(&mut self, opened: OpenedRuntime) -> Value
pub async fn finish_runtime_open(&mut self, opened: OpenedRuntime) -> Value
Answer a request split out by Self::runtime_open and already
awaited by RuntimeOpen::open: register the runtime this service now
owns and build its JSON-RPC response.