pub struct SessionActivationRouter { /* private fields */ }Expand description
One router per owning runtime/AppState. All keys are logical Session ids.
Implementations§
Source§impl SessionActivationRouter
impl SessionActivationRouter
pub fn new() -> Arc<Self> ⓘ
Sourcepub async fn set_spawner(&self, spawner: Arc<dyn SessionActivationSpawner>)
pub async fn set_spawner(&self, spawner: Arc<dyn SessionActivationSpawner>)
Late-bind the real server/SDK reservation adapter after its dependency graph has been assembled.
Sourcepub async fn current_run_id(&self, target_session_id: &str) -> Option<String>
pub async fn current_run_id(&self, target_session_id: &str) -> Option<String>
Snapshot the current logical run, including its terminal handoff.
Sourcepub fn set_inbox(&self, inbox: Arc<dyn SessionInboxPort>)
pub fn set_inbox(&self, inbox: Arc<dyn SessionInboxPort>)
Bind the durable inbox used by abandoned-run reconciliation.
Sourcepub async fn reconcile_wake(
&self,
target_session_id: &str,
now: DateTime<Utc>,
) -> Result<SessionWakeReconcileResult, SessionActivationError>
pub async fn reconcile_wake( &self, target_session_id: &str, now: DateTime<Utc>, ) -> Result<SessionWakeReconcileResult, SessionActivationError>
Reconcile one target against a storage-locked proof of claimable work. A later claim still CAS-checks the lease and activation policy. The router keeps only a bounded retry guard, never queue truth.
Sourcepub async fn register_run(
self: &Arc<Self>,
target_session_id: &str,
run_id: &str,
) -> Result<SessionRunRegistration, SessionRunRegistrationError>
pub async fn register_run( self: &Arc<Self>, target_session_id: &str, run_id: &str, ) -> Result<SessionRunRegistration, SessionRunRegistrationError>
Register an execution created by any entry point. The returned receiver is a safe-point wake signal; the loop also drains the durable inbox at every round boundary, so missed/coalesced notifications do not lose data.
Sourcepub async fn register_session_run(
self: &Arc<Self>,
session: &Session,
run_id: &str,
) -> Result<SessionRunRegistration, SessionRunRegistrationError>
pub async fn register_session_run( self: &Arc<Self>, session: &Session, run_id: &str, ) -> Result<SessionRunRegistration, SessionRunRegistrationError>
Register from the actual execution’s Session, enabling birth-fenced steer. This is a trusted host entrypoint, not model-supplied authority.
Sourcepub async fn revoke_supervisor_loop_control(
&self,
target: &str,
grant_id: &Uuid,
) -> bool
pub async fn revoke_supervisor_loop_control( &self, target: &str, grant_id: &Uuid, ) -> bool
Host revocation shares the target publication fence with physical writes. It does not stop another run or retain a grant after owner exit.
Sourcepub async fn attach_delivery_sink(
&self,
target_session_id: &str,
sink: UnboundedSender<u64>,
) -> Option<String>
pub async fn attach_delivery_sink( &self, target_session_id: &str, sink: UnboundedSender<u64>, ) -> Option<String>
Bind an external actor driver to the current logical-session owner.
Returns the active run id used to correlate every forwarded claim and confirmation. A pending generation is pushed immediately, closing the delivery-before-bind race without making this in-memory signal durable.
Sourcepub async fn detach_delivery_sink(&self, target_session_id: &str, run_id: &str)
pub async fn detach_delivery_sink(&self, target_session_id: &str, run_id: &str)
Remove a driver only when it still belongs to the same activation run. A stale driver can therefore never unbind its successor.
Sourcepub async fn owns_run(&self, target_session_id: &str, run_id: &str) -> bool
pub async fn owns_run(&self, target_session_id: &str, run_id: &str) -> bool
True only while this exact activation run remains the logical owner.
Sourcepub async fn begin_finalization(&self, target_session_id: &str, run_id: &str)
pub async fn begin_finalization(&self, target_session_id: &str, run_id: &str)
Mark the current run as finalizing before its runner slot becomes
available. Deliveries racing this interval are retained in
latest_generation and handed to one successor by
finish_finalization.
Sourcepub async fn finish_finalization(
&self,
target_session_id: &str,
run_id: &str,
admitted_generation: u64,
) -> Result<Option<SessionActivationDisposition>, SessionActivationError>
pub async fn finish_finalization( &self, target_session_id: &str, run_id: &str, admitted_generation: u64, ) -> Result<Option<SessionActivationDisposition>, SessionActivationError>
Release the terminal owner and, if the durable transcript cursor is behind a concurrently delivered inbox generation, reserve and launch exactly one successor using the injected real runtime adapter.