Skip to main content

Controller

Struct Controller 

Source
pub struct Controller {
    pub config: HelConfig,
    pub state: HelState,
}

Fields§

§config: HelConfig§state: HelState

Implementations§

Source§

impl Controller

Source

pub fn resolve_aws_resource_options( &self, target_id: &str, executor: &impl CommandExecutor, ) -> Result<Vec<SessionResourceAllocation>>

Source

pub fn reconnect_command(&self, session_id: &str) -> Result<CommandSpec>

Source

pub fn resource_probe(&self, session_id: &str) -> Result<SessionResourceProbe>

Source

pub fn deployment_capacity_targets(&self) -> Vec<DeploymentCapacityTarget>

Source

pub fn test_target( &self, target_id: &str, executor: &impl CommandExecutor, ) -> Result<()>

Source§

impl Controller

Source

pub async fn checkpoint_session( &mut self, session_id: &str, ) -> Result<CheckpointMetadata>

Materialize and locally verify a complete session checkpoint while the target remains live. A failed export or transfer leaves the previous archive and target untouched.

Source

pub async fn checkpoint_session_controlled( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), ) -> Result<CheckpointMetadata>

Source

pub async fn create_recovery_checkpoint_managed_controlled( &self, session_id: &str, manager: &SessionManagerControl, executor: &(impl CommandExecutor + Sync), ) -> Result<CheckpointArtifact>

Create, checksum, and durably install a recovery archive before allowing the relay to garbage-collect through its event frontier.

Source§

impl Controller

Source

pub async fn close_session(&mut self, session_id: &str) -> Result<()>

Checkpoint, ask the harness to close, and only then tear down the exact provisioned target. Checkpoint failure is deliberately non-destructive.

Source

pub async fn close_session_controlled( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), ) -> Result<()>

Source

pub async fn close_session_managed_controlled( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), manager: &SessionManagerControl, ) -> Result<bool>

Source

pub async fn recover_interrupted_close_managed( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), manager: &SessionManagerControl, ) -> Result<bool>

Resume the durable closing state after a controller restart. If the relay had accepted Close, wait for it and destroy through the exact installed checkpoint gate. If it had not, take a fresh checkpoint; the previously installed archive may have become stale after EOF released its barrier.

Source

pub fn cleanup_stopped_target( &mut self, session_id: &str, executor: &impl CommandExecutor, ) -> Result<()>

Finish storage cleanup for a stopped Podman target retained by the quiescence transition. The locator stays durable until every command succeeds, making daemon restart and explicit retry idempotent.

Source

pub fn force_stop( &mut self, session_id: &str, executor: &impl CommandExecutor, ) -> Result<bool>

Tear down the current target without taking a fresh checkpoint, then leave the logical session resumable from its latest verified archive.

Source

pub fn destroy_session_controlled( &mut self, session_id: &str, executor: &impl CommandExecutor, ) -> Result<()>

Permanently destroy an inactive session and every artifact Hel owns for it. External cleanup happens before the durable record is dropped so failures remain visible and retryable.

Source

pub fn force_destroy_session( &mut self, session_id: &str, executor: &impl CommandExecutor, ) -> Result<()>

Permanently destroy a session from any state, without checkpointing and without requiring a recovery archive.

Unlike Controller::destroy_session_controlled, this accepts active states: it tears the live target down with the same close plan a verified close uses, so the owning process group dies before any files go. External cleanup happens before the durable record is dropped so failures stay visible and retryable; the recovery archive is removed, which is what makes the destruction irreversible.

Source§

impl Controller

Source

pub async fn prepare_move_session_controlled( &self, selection: MoveSelection, executor: &(impl CommandExecutor + Sync), ) -> Result<MovePreparation>

Source

pub async fn move_session_managed_controlled( &mut self, request: MoveSessionRequest, executor: &(impl CommandExecutor + Sync), manager: &SessionManagerControl, ) -> Result<MoveOutcome>

Called with one daemon lifecycle and recovery reservation already held.

Source

pub async fn recover_move_managed_controlled( &mut self, operation: MoveOperation, executor: &(impl CommandExecutor + Sync), manager: &SessionManagerControl, ) -> Result<MoveOutcome>

Source§

impl Controller

Source

pub async fn provision_session_controlled( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), ) -> Result<()>

Source

pub async fn provision_session_controlled_with_commit( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), grant_commit: impl FnOnce() -> Result<()>, ) -> Result<()>

Source

pub async fn provision_session_with( &mut self, session_id: &str, executor: &(impl CommandExecutor + Sync), ) -> Result<()>

Source

pub fn mark_worker_connected( &mut self, session_id: &str, native_session_id: Option<String>, ) -> Result<()>

Source§

impl Controller

Source

pub fn scan_orphan_workers( &self, executor: &impl CommandExecutor, ) -> RecoveryScan

Find managed resources which are not represented by the controller’s current state. Labels/tags establish Hel ownership; the worker marker supplies profile and bundle metadata when it is available.

Source

pub async fn adopt_orphan_worker( &mut self, session_id: &str, target_id: &str, profile_override: Option<&str>, bundle_override: Option<&str>, executor: &impl CommandExecutor, ) -> Result<()>

Source

pub fn destroy_orphan_worker( &self, session_id: &str, target_id: &str, confirmation: &str, executor: &impl CommandExecutor, ) -> Result<()>

Source§

impl Controller

Source

pub fn preflight_resume_repository_sources( &self, session_id: &str, target_id: &str, executor: &(impl CommandExecutor + Sync), ) -> Result<ResumeRepositorySourcePreflight>

Prove that each configured repository source still supplies the commit boundary its checkpoint bundle expects, before provisioning anything.

Source

pub fn replace_resume_repository_origin( &mut self, session_id: &str, repository_id: &str, replacement: &str, executor: &(impl CommandExecutor + Sync), ) -> Result<ResumeRepositorySourcePreflight>

Validate a replacement first, then atomically save it and check the remaining sources so multi-repository bundles can report the next moved repository without ever provisioning a partial target.

Source§

impl Controller

Source

pub async fn resume_session_with_options( &mut self, session_id: &str, profile_id: &str, target_id: &str, additional_mounts: Option<Vec<AdditionalMount>>, resource_allocation: Option<SessionResourceAllocation>, ) -> Result<MaterializedSession>

Resume a stopped logical session on any configured profile and target. Cross-harness resume restores Git and canonical history, starts a fresh native session, and supplies the prior transcript as its first context turn.

Source

pub async fn resume_session_with_options_and_queue_disposition( &mut self, session_id: &str, profile_id: &str, target_id: &str, additional_mounts: Option<Vec<AdditionalMount>>, resource_allocation: Option<SessionResourceAllocation>, discard_queue: bool, ) -> Result<MaterializedSession>

Source

pub async fn resume_session_controlled( &mut self, session_id: &str, profile_id: &str, target_id: &str, options: SessionResumeOptions, executor: &(impl CommandExecutor + Sync), ) -> Result<MaterializedSession>

Source

pub async fn resume_session_controlled_with_repository_preflight( &mut self, session_id: &str, profile_id: &str, target_id: &str, options: SessionResumeOptions, repository_preflight: Option<ResumeRepositorySourceReceipt>, executor: &(impl CommandExecutor + Sync), ) -> Result<MaterializedSession>

Source§

impl Controller

Source

pub fn stage_reviewer_profile( &self, session_id: &str, profile_id: &str, generation: u64, ) -> Result<ReviewerLaunchConfig>

Copy profile_id’s home into the session worker’s reviewer directory and describe how the worker should launch it.

generation distinguishes reviewer lifetimes: bumping it tells the worker to start a new conversation instead of reloading the last one.

Source

pub fn stage_reviewer_profile_with_mcp( &self, session_id: &str, profile_id: &str, generation: u64, mcp_servers: &[ReviewMcpServer], dispatch_tool: bool, ) -> Result<ReviewerLaunchConfig>

Stage a reviewer that also gets mcp_servers, which is how a turn review attaches its analyzer tools.

dispatch_tool adds the review supervisor’s own tool, which is this worker’s binary in another mode. Only the controller knows where that binary and its socket sit on the target, so it is built here rather than by the caller.

Source

pub fn stage_reviewer_profile_controlled( &self, session_id: &str, profile_id: &str, generation: u64, mcp_servers: &[ReviewMcpServer], executor: &impl CommandExecutor, ) -> Result<ReviewerLaunchConfig>

Source§

impl Controller

Source

pub fn diagnose_worker(&self, session_id: &str) -> Option<String>

Probe the installed binary and collect the dead worker’s exit record and log tail after a session becomes unreachable. Best-effort; returns None when the target no longer exists or has no diagnostics.

Source

pub fn diagnose_worker_controlled( &self, session_id: &str, executor: &impl CommandExecutor, ) -> Option<String>

Source

pub fn worker_recovery_plan( &self, session_id: &str, ) -> Result<WorkerRecoveryPlan>

A non-destructive liveness probe plus commands that replace a confirmed dead session worker without touching its durable relay files. The session manager runs both off its async actor.

Source

pub fn project_memory_sync_target( &self, session_id: &str, ) -> Result<ProjectMemorySyncTarget>

Source§

impl Controller

Source

pub async fn upgrade_session_worker( &self, session_id: &str, executor: &(impl CommandExecutor + Sync), manager: &SessionManagerControl, reported_build: Option<&str>, ) -> Result<WorkerUpgradeOutcome>

Replace a session’s worker with the binary this controller would install, when the session is quiet and its worker is a different build.

reported_build is the digest the worker gave the observer that asked for this. It only saves work: a match returns before anything is leased. The decision that matters is taken again under the lease, against a snapshot read from the worker itself, because a session can start working between an observation and this call.

Source§

impl Controller

Source

pub fn validate_project_directory( &self, target_id: &str, directory: &Path, executor: &impl CommandExecutor, ) -> Result<()>

Verify a bare project before leaving the project-directory dialog.

Source

pub fn resolve_session_project_source( &self, session_id: &str, executor: &impl CommandExecutor, ) -> Result<ProjectSourceIdentity>

Resolves a session’s canonical project without doing process work on a UI loop. Raw checkouts use their Git origin when available, then their canonical Git root or local directory.

Source§

impl Controller

Source

pub fn load() -> Result<Self>

Source

pub fn reload(&mut self) -> Result<()>

Source

pub fn complete_mount_source( &self, target_id: &str, prefix: &str, executor: &impl CommandExecutor, ) -> Result<Vec<String>>

Complete a mount source at the same host that will run the container.

Source

pub fn validate_mount_source( &self, target_id: &str, source: &Path, executor: &impl CommandExecutor, ) -> Result<Option<String>>

Verify a mount source on the host where Mjolnir will consume it, and report the filesystem reason it must be attached read-only, if there is one.

The probe runs in the same round trip as the existence check so the editor learns both answers without a second wait. A probe that cannot answer reports no reason: provisioning decides that authoritatively.

Source

pub fn register_session_with_resources( &mut self, profile_id: &str, bundle_id: &str, target_id: &str, title: impl Into<String>, options: SessionLaunchOptions, ) -> Result<String>

Source

pub fn rename_session( &mut self, session_id: &str, title: &str, ) -> Result<String>

Source

pub fn rename_profile_id(&mut self, old_id: &str, new_id: &str) -> Result<()>

Source

pub fn rename_target_id(&mut self, old_id: &str, new_id: &str) -> Result<()>

Source

pub fn recover_config_id_rename() -> Result<bool>

Finish a profile/target id rename interrupted between the atomic config replacement and SQLite transaction. Each step is idempotent, so a second crash leaves the same intent available for the next startup.

Source

pub fn update_session_container_settings( &mut self, session_id: &str, cpus: Option<String>, memory: Option<String>, additional_mounts: Vec<AdditionalMount>, mount_history: Vec<PathBuf>, ) -> Result<()>

Record the per-session container size overrides and attached directories. Nothing is applied to a running container: the values are read the next time the session’s container is created.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more