use super::flow_frame_engine::FlowFrameLoopStorePlan;
use super::terminalization::{TerminalizationOutcome, TerminalizationTarget};
use super::*;
use crate::machines::mob_machine as mob_dsl;
use crate::run::{MobMachineFlowRunCommand, MobRun, flow_run};
#[cfg(target_arch = "wasm32")]
use crate::tokio;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
pub enum MobState {
Creating = 0,
Running = 1,
Stopped = 2,
Completed = 3,
Destroyed = 4,
}
impl MobState {
pub fn as_str(self) -> &'static str {
match self {
Self::Creating => "Creating",
Self::Running => "Running",
Self::Stopped => "Stopped",
Self::Completed => "Completed",
Self::Destroyed => "Destroyed",
}
}
}
impl std::fmt::Display for MobState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MobOrchestratorSnapshot {
pub phase: MobState,
pub coordinator_bound: bool,
pub pending_spawn_count: u32,
pub active_flow_count: u32,
pub topology_revision: u32,
pub supervisor_active: bool,
}
impl Default for MobOrchestratorSnapshot {
fn default() -> Self {
Self {
phase: MobState::Creating,
coordinator_bound: false,
pending_spawn_count: 0,
active_flow_count: 0,
topology_revision: 0,
supervisor_active: false,
}
}
}
#[cfg(test)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct MobLifecycleSnapshot {
pub phase: MobState,
pub active_run_count: u32,
pub cleanup_pending: bool,
}
#[cfg(test)]
impl Default for MobLifecycleSnapshot {
fn default() -> Self {
Self {
phase: MobState::Running,
active_run_count: 0,
cleanup_pending: false,
}
}
}
#[cfg(test)]
#[derive(Debug, Clone, Default)]
pub(crate) struct MobDslT2Snapshot {
pub destroy_admitted: bool,
pub flow_authority_schema_version: u64,
pub owner_bridge_session_id: Option<crate::machines::mob_machine::SessionId>,
pub owner_bridge_destroy_on_archive: bool,
pub implicit_delegation_mob: bool,
pub supervisor_authority_peer_id: Option<crate::machines::mob_machine::PeerId>,
pub supervisor_authority_signing_key: Option<crate::machines::mob_machine::PeerSigningKey>,
pub supervisor_authority_epoch: Option<u64>,
pub supervisor_authority_protocol_version:
Option<crate::machines::mob_machine::SupervisorProtocolVersion>,
pub supervisor_pending_authority_peer_id: Option<crate::machines::mob_machine::PeerId>,
pub supervisor_pending_authority_signing_key:
Option<crate::machines::mob_machine::PeerSigningKey>,
pub supervisor_pending_authority_epoch: Option<u64>,
pub supervisor_pending_authority_protocol_version:
Option<crate::machines::mob_machine::SupervisorProtocolVersion>,
pub supervisor_pending_authority_operation_id: Option<String>,
pub supervisor_pending_authority_member_target_names:
std::collections::BTreeMap<crate::machines::mob_machine::PeerId, String>,
pub supervisor_pending_authority_member_target_addresses:
std::collections::BTreeMap<crate::machines::mob_machine::PeerId, String>,
pub supervisor_pending_authority_accepted_peer_ids:
std::collections::BTreeSet<crate::machines::mob_machine::PeerId>,
pub pending_recipient_trust: std::collections::BTreeSet<crate::machines::mob_machine::PeerId>,
pub host_binding_generations:
std::collections::BTreeMap<crate::machines::mob_machine::HostId, u64>,
pub host_binding_generation_highwater:
std::collections::BTreeMap<crate::machines::mob_machine::HostId, u64>,
pub confirmed_host_binding_revocations:
std::collections::BTreeSet<crate::machines::mob_machine::HostBindingGenerationTombstone>,
pub replacement_host_bind_endpoints: std::collections::BTreeMap<
crate::machines::mob_machine::HostId,
crate::machines::mob_machine::PeerAddress,
>,
pub replacement_host_binding_generations:
std::collections::BTreeMap<crate::machines::mob_machine::HostId, u64>,
pub member_state_markers: std::collections::BTreeMap<
crate::machines::mob_machine::AgentRuntimeId,
crate::machines::mob_machine::MobMemberState,
>,
pub wiring_edges: std::collections::BTreeSet<crate::machines::mob_machine::WiringEdge>,
pub external_peer_edges:
std::collections::BTreeSet<crate::machines::mob_machine::ExternalPeerEdge>,
pub external_peer_edges_by_key: std::collections::BTreeMap<
crate::machines::mob_machine::ExternalPeerKey,
crate::machines::mob_machine::ExternalPeerEdge,
>,
pub pending_respawn_topology:
std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub abandoned_respawn_topology: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::Generation,
>,
pub identity_to_runtime: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::AgentRuntimeId,
>,
pub identity_runtime_generations: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::Generation,
>,
pub identity_runtime_fence_tokens: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::FenceToken,
>,
pub member_profile_names:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub member_runtime_modes: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::SpawnPolicyRuntimeMode,
>,
pub member_peer_ids: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::PeerId,
>,
pub member_peer_endpoints: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::MemberPeerEndpoint,
>,
pub member_prior_peer_endpoints: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
std::collections::BTreeSet<crate::machines::mob_machine::MemberPeerEndpoint>,
>,
pub member_restore_failures:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub member_restore_failure_codes:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub runtime_retire_refusal_codes:
std::collections::BTreeMap<crate::machines::mob_machine::AgentRuntimeId, String>,
pub runtime_retire_refusal_reasons:
std::collections::BTreeMap<crate::machines::mob_machine::AgentRuntimeId, String>,
pub runtime_retire_pending_sessions: std::collections::BTreeMap<
crate::machines::mob_machine::AgentRuntimeId,
crate::machines::mob_machine::SessionId,
>,
pub remote_runtime_retired_ids:
std::collections::BTreeSet<crate::machines::mob_machine::AgentRuntimeId>,
pub remote_supervisor_revoked_ids:
std::collections::BTreeSet<crate::machines::mob_machine::AgentRuntimeId>,
pub member_revival_pending:
std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub member_kickoff_objective_ids:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub objective_owner_ids:
std::collections::BTreeMap<String, crate::machines::mob_machine::AgentIdentity>,
pub objective_outcomes: std::collections::BTreeMap<String, String>,
pub concluded_objective_ids: std::collections::BTreeSet<String>,
pub member_run_open:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, bool>,
pub member_in_flight_work:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, u64>,
pub member_progress_tokens:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub member_last_observed_at_ms:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, u64>,
pub member_last_progress_at_ms:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, u64>,
pub member_last_progress_event: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::MemberProgressEventKind,
>,
pub member_health_class: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::MemberHealthClass,
>,
pub member_session_bindings: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::SessionId,
>,
pub spawn_exec_phase: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::SpawnExecPhase,
>,
pub pending_spawn_sessions: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::SessionId,
>,
pub pending_session_ingress_detach_runtime_ids:
std::collections::BTreeSet<crate::machines::mob_machine::AgentRuntimeId>,
pub topology_epoch: u64,
pub spawn_policy_enabled: bool,
pub spawn_policy_revision: u64,
pub spawn_policy_resolution_revision:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, u64>,
pub spawn_policy_resolution_profiles:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub spawn_policy_resolution_runtime_modes: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
Option<crate::machines::mob_machine::SpawnPolicyRuntimeMode>,
>,
pub spawn_policy_resolution_absent:
std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub spawn_profile_authority_profile_names:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub spawn_profile_authority_models:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub spawn_profile_authority_material_digests:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub spawn_profile_authority_tool_config_digests:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub spawn_profile_authority_skills_digests:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub spawn_profile_authority_provider_params_digests:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, Option<String>>,
pub spawn_profile_authority_output_schema_digests:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, Option<String>>,
pub spawn_profile_authority_external_addressable:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, bool>,
pub orphan_budget: u64,
pub topology_default_policy: crate::machines::mob_machine::PolicyDecision,
pub external_member_rebind_capability: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::ExternalMemberRebindCapability,
>,
pub desired_members: std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub members_to_spawn: std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub members_to_retire: std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub pending_placed_spawn_ids: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::PlacedSpawnId,
>,
pub pending_placed_spawn_generations: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::Generation,
>,
pub pending_placed_spawn_fence_tokens: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::FenceToken,
>,
pub pending_placed_spawn_hosts: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::HostId,
>,
pub pending_autonomous_placed_spawns:
std::collections::BTreeSet<crate::machines::mob_machine::AgentIdentity>,
pub pending_placed_spawn_host_binding_generations:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, u64>,
pub pending_placed_spawn_spec_digests:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub pending_placed_spawn_provision_operation_ids:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub pending_placed_spawn_operation_owner_session_ids: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::SessionId,
>,
pub current_placed_spawn_ids: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::PlacedSpawnId,
>,
pub current_placed_spawn_host_binding_generations:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, u64>,
pub current_placed_spawn_provision_operation_ids:
std::collections::BTreeMap<crate::machines::mob_machine::AgentIdentity, String>,
pub current_placed_spawn_operation_owner_session_ids: std::collections::BTreeMap<
crate::machines::mob_machine::AgentIdentity,
crate::machines::mob_machine::SessionId,
>,
pub pending_placed_carrier_cleanup:
std::collections::BTreeSet<crate::machines::mob_machine::PlacedCarrierCleanupObligation>,
pub remote_turn_dispatch_sequence: u64,
pub committed_remote_turn_outcomes:
std::collections::BTreeSet<crate::machines::mob_machine::RemoteTurnObligation>,
pub resolved_remote_turn_outcomes:
std::collections::BTreeSet<crate::machines::mob_machine::RemoteTurnObligation>,
pub pending_placed_kickoff_outcomes:
std::collections::BTreeSet<crate::machines::mob_machine::PlacedKickoffObligation>,
pub resolved_placed_kickoff_outcomes:
std::collections::BTreeSet<crate::machines::mob_machine::PlacedKickoffObligation>,
}
#[derive(Debug, Clone, Default)]
pub(crate) struct MobStartupKickoffSnapshot {
pub pending_kickoff_member_ids: std::collections::BTreeSet<String>,
pub ready_runtime_ids: std::collections::BTreeSet<String>,
}
#[derive(Debug, Clone, Default)]
pub(crate) struct MobMemberMachineProjection {
pub runtime_id: Option<crate::machines::mob_machine::AgentRuntimeId>,
pub state_marker: Option<crate::machines::mob_machine::MobMemberState>,
pub live_runtime: bool,
pub bound_session_id: Option<crate::machines::mob_machine::SessionId>,
}
pub(super) struct SubmitWorkPayload {
pub runtime_id: AgentRuntimeId,
pub fence_token: FenceToken,
pub work_ref: WorkRef,
pub content: ContentInput,
pub origin: WorkOrigin,
pub injected_context: Vec<ContentInput>,
pub interaction_id: Option<meerkat_core::interaction::InteractionId>,
pub objective_id: Option<meerkat_core::interaction::ObjectiveId>,
pub handling_mode: meerkat_core::types::HandlingMode,
pub turn_metadata: Option<meerkat_core::lifecycle::run_primitive::RuntimeTurnMetadata>,
pub event_tx:
Option<tokio::sync::mpsc::Sender<meerkat_core::EventEnvelope<meerkat_core::AgentEvent>>>,
pub completion_tx: Option<oneshot::Sender<Result<(), MobError>>>,
pub llm_identity_applied_tx: Option<super::handle::MemberTurnLlmIdentityAppliedSender>,
pub ack_mode: crate::mob_machine::SubmitWorkAckMode,
}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub(super) struct HostOrphanReleaseKey {
pub(super) host_id: mob_dsl::HostId,
pub(super) binding_incarnation: u64,
pub(super) agent_identity: mob_dsl::AgentIdentity,
pub(super) generation: mob_dsl::Generation,
pub(super) fence_token: mob_dsl::FenceToken,
}
pub(super) struct MemberLiveOpenDelivery {
pub(super) open: super::bridge_protocol::LiveOpenResult,
pub(super) delivery_ack: oneshot::Sender<oneshot::Sender<Result<(), MobError>>>,
}
pub(super) enum PlacedBehaviorCompletion {
MemberHistory {
result: Result<super::member_history_proxy::MemberHistoryPageDomain, MobError>,
reply_tx:
oneshot::Sender<Result<super::member_history_proxy::MemberHistoryPageDomain, MobError>>,
},
LiveClose {
result: Result<super::bridge_protocol::LiveCloseStatus, MobError>,
reply_tx: oneshot::Sender<Result<super::bridge_protocol::LiveCloseStatus, MobError>>,
},
LiveStatus {
result: Result<super::member_live_proxy::MemberLiveStatusDomain, MobError>,
reply_tx:
oneshot::Sender<Result<super::member_live_proxy::MemberLiveStatusDomain, MobError>>,
},
}
pub(super) enum MobCommand {
Spawn {
spec: Box<super::handle::SpawnMemberSpec>,
spawn_source: super::handle::SpawnSource,
owner_bridge_session_id: Option<SessionId>,
ops_registry: Option<Arc<dyn meerkat_core::ops_lifecycle::OpsLifecycleRegistry>>,
reply_tx: oneshot::Sender<Result<super::handle::MemberSpawnReceipt, MobError>>,
},
SpawnProvisioned {
spawn_ticket: u64,
result: Result<super::handle::MemberSpawnReceipt, MobError>,
},
RevivePlacedMember {
agent_identity: AgentIdentity,
reason: String,
},
HostStatusPollCompleted {
host_id: String,
binding_epoch: u64,
binding_generation: u64,
binding_incarnation: u64,
result: Result<super::bridge_protocol::BridgeHostStatusResponse, crate::MobError>,
},
HostRuntimeIncarnationObserved {
expected_member: super::bridge_protocol::BridgeMemberIncarnation,
runtime_incarnation: super::bridge_protocol::BridgeHostRuntimeIncarnation,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
HostOrphanReleaseCompleted {
key: HostOrphanReleaseKey,
result: Result<crate::machines::mob_machine::MemberSessionDisposal, crate::MobError>,
},
PlacedBehaviorCompleted {
agent_identity: AgentIdentity,
expected_member: super::bridge_protocol::BridgeMemberIncarnation,
completion: PlacedBehaviorCompletion,
},
Retire {
agent_identity: AgentIdentity,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
Respawn {
agent_identity: AgentIdentity,
initial_message: Option<ContentInput>,
reply_tx: oneshot::Sender<
Result<super::handle::MemberRespawnReceipt, super::handle::MobRespawnError>,
>,
},
RetireAll {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
SubmitWork {
payload: Box<SubmitWorkPayload>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
SendPeerMessage {
from: AgentIdentity,
to: AgentIdentity,
content: ContentInput,
handling_mode: meerkat_core::types::HandlingMode,
reply_tx: oneshot::Sender<Result<meerkat_core::comms::SendReceipt, MobError>>,
},
DeclareMemberOutboundTaint {
identity: AgentIdentity,
taint: Option<meerkat_core::comms::SenderContentTaint>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
CancelAllWork {
runtime_id: AgentRuntimeId,
fence_token: FenceToken,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
#[cfg(feature = "runtime-adapter")]
KickoffOutcomeResolved {
agent_identity: AgentIdentity,
outcome: Result<
meerkat_runtime::completion::CompletionOutcome,
meerkat_runtime::completion::CompletionWaitError,
>,
ack_tx: oneshot::Sender<()>,
},
RunFlow {
flow_id: FlowId,
activation_params: serde_json::Value,
scoped_event_tx: Option<tokio::sync::mpsc::Sender<meerkat_core::ScopedAgentEvent>>,
reply_tx: oneshot::Sender<Result<RunId, MobError>>,
},
PreviewRunFlowAdmission {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
CancelFlow {
run_id: RunId,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
FlowStatus {
run_id: RunId,
reply_tx: oneshot::Sender<Result<Option<MobRun>, MobError>>,
},
CommitFlowRunCommand {
run_id: RunId,
command: Box<MobMachineFlowRunCommand>,
context: &'static str,
reply_tx: oneshot::Sender<Result<Option<Vec<flow_run::Effect>>, MobError>>,
},
CommitFlowTerminalization {
run_id: RunId,
flow_id: FlowId,
target: TerminalizationTarget,
command: Box<MobMachineFlowRunCommand>,
context: &'static str,
reply_tx: oneshot::Sender<Result<TerminalizationOutcome, MobError>>,
},
CommitFlowFrameStorePlan {
run_id: RunId,
plan: Box<FlowFrameLoopStorePlan>,
reply_tx: oneshot::Sender<Result<bool, MobError>>,
},
ProjectMachineInput {
input: Box<mob_dsl::MobMachineInput>,
reply_tx: oneshot::Sender<Result<mob_dsl::MobMachineState, MobError>>,
},
ApplyMachineInputEffects {
input: Box<mob_dsl::MobMachineInput>,
reply_tx: oneshot::Sender<Result<Vec<mob_dsl::MobMachineEffect>, MobError>>,
},
ValidateCommandAuthority {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
AdmitControlScope {
required: mob_dsl::ControlScope,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
PruneStaleMemberOperatorRequests {
reply_tx: oneshot::Sender<Result<u64, MobError>>,
},
ReserveRemoteTurnObligation {
intent: Box<crate::run::MobRunRemoteTurnIntent>,
reply_tx: oneshot::Sender<
Result<super::remote_flow_ticket::ReservedRemoteTurnIntent, MobError>,
>,
},
CommitRemoteTurnReceipt {
receipt: Box<crate::run::MobRunRemoteTurnReceipt>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
CloseRemoteTurnAfterTrackedCancel {
receipt: Box<crate::run::MobRunRemoteTurnReceipt>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
EnsureRemoteTurnRecord {
obligation: Box<crate::event::RemoteTurnObligationEvent>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
FinalizeRemoteTurnPrivacyCleanup {
cleanup: Box<super::remote_turn_reconciler::FinalizedRemoteTurnPrivacyCleanup>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ConvergeRecoveredFlowRun {
run_id: RunId,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ResolveRemoteTurnOutcome {
obligation: Box<mob_dsl::RemoteTurnObligation>,
record: super::bridge_protocol::BridgeTurnOutcomeRecord,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
AcknowledgeRemoteTurnOutcome {
obligation: Box<mob_dsl::RemoteTurnObligation>,
ack: super::bridge_protocol::BridgeTurnOutcomeAck,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
RequestPlacedCompletionCancellation {
obligation: Box<crate::event::PlacedCompletionObligationEvent>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ResolvePlacedCompletionOutcome {
obligation: Box<crate::event::PlacedCompletionObligationEvent>,
record: super::bridge_protocol::BridgeTurnOutcomeRecord,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ClosePlacedCompletionOutcome {
obligation: Box<crate::event::PlacedCompletionObligationEvent>,
closure: crate::event::PlacedCompletionClosureEvent,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
AcknowledgePlacedCompletionOutcome {
obligation: Box<crate::event::PlacedCompletionObligationEvent>,
ack: super::bridge_protocol::BridgeTurnOutcomeAck,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ResolvePlacedKickoffOutcome {
obligation: Box<crate::event::PlacedKickoffObligationEvent>,
record: super::bridge_protocol::BridgeTurnOutcomeRecord,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ResolvePlacedKickoffCancelled {
obligation: Box<crate::event::PlacedKickoffObligationEvent>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
AcknowledgePlacedKickoffOutcome {
obligation: Box<crate::event::PlacedKickoffObligationEvent>,
ack: super::bridge_protocol::BridgeTurnOutcomeAck,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
RejectPlacedKickoffBeforeAdmission {
obligation: Box<crate::event::PlacedKickoffObligationEvent>,
error: String,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
PreviewMachineInput {
input: Box<mob_dsl::MobMachineInput>,
reply_tx: oneshot::Sender<Result<mob_dsl::MobMachineState, MobError>>,
},
QueryMachineState {
reply_tx: oneshot::Sender<mob_dsl::MobMachineState>,
},
#[cfg(test)]
AuthorizeMemberTrustCleanupForTest {
edge: mob_dsl::WiringEdge,
reply_tx: oneshot::Sender<
Result<
crate::generated::protocol_mob_member_trust_unwiring::MobMemberTrustUnwiringObligation,
MobError,
>,
>,
},
#[cfg(test)]
StagePendingSpawnForRetireTest {
agent_identity: AgentIdentity,
pending_spawn_session_id: SessionId,
operation_id: meerkat_core::ops::OperationId,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ApplyExternalPeerReciprocalTrust {
key: mob_dsl::ExternalPeerKey,
target_comms: std::sync::Arc<dyn meerkat_core::agent::CommsRuntime>,
peer: meerkat_core::comms::TrustedPeerDescriptor,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ProjectMachineSignal {
signal: mob_dsl::MobMachineSignal,
},
RecordMissingMemberBridgeSession {
agent_identity: crate::ids::AgentIdentity,
bridge_session_id: SessionId,
},
FlowFinished {
run_id: RunId,
},
FlowCanceledCleanup {
run_id: RunId,
terminalized: bool,
},
#[cfg(test)]
FlowTrackerCounts {
reply_tx: oneshot::Sender<(usize, usize)>,
},
#[cfg(test)]
OrchestratorSnapshot {
reply_tx: oneshot::Sender<MobOrchestratorSnapshot>,
},
#[cfg(test)]
LifecycleSnapshot {
reply_tx: oneshot::Sender<MobLifecycleSnapshot>,
},
#[cfg(test)]
LifecycleNotificationBurst {
count: usize,
message: String,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
#[cfg(test)]
DslT2Snapshot {
reply_tx: oneshot::Sender<MobDslT2Snapshot>,
},
StartupKickoffSnapshot {
reply_tx: oneshot::Sender<MobStartupKickoffSnapshot>,
},
ProjectMemberList {
include_retiring: bool,
reply_tx: oneshot::Sender<Result<Vec<super::MobMemberListEntry>, crate::MobError>>,
},
ProjectMemberStatus {
agent_identity: crate::ids::AgentIdentity,
reply_tx: oneshot::Sender<Result<super::MobMemberSnapshot, crate::MobError>>,
},
ApplyIdentityDeclarationManifest {
manifest: Box<crate::identity::IdentityDeclarationManifest>,
reply_tx: oneshot::Sender<
Result<crate::identity::IdentityDeclarationManifestApplyOutcome, crate::MobError>,
>,
},
GetIdentityIntent {
agent_identity: crate::ids::AgentIdentity,
reply_tx: oneshot::Sender<
Result<
crate::identity::IdentityStoredObservation<crate::identity::IdentityIntentRecord>,
crate::MobError,
>,
>,
},
GetIdentityDeclarationReceipt {
scope_id: crate::identity::IdentityDeclarationScopeId,
operation_id: meerkat_core::ops::OperationId,
reply_tx: oneshot::Sender<
Result<
crate::identity::IdentityStoredObservation<
crate::identity::IdentityOperationReceipt,
>,
crate::MobError,
>,
>,
},
GetIdentityConvergenceStatus {
agent_identity: crate::ids::AgentIdentity,
reply_tx: oneshot::Sender<
Result<
crate::identity::IdentityStoredObservation<
crate::identity::IdentityConvergenceStatus,
>,
crate::MobError,
>,
>,
},
ConcludeObjective {
agent_identity: crate::ids::AgentIdentity,
objective_id: meerkat_core::interaction::ObjectiveId,
outcome: String,
reply_tx: oneshot::Sender<Result<(), crate::MobError>>,
},
BindObjectiveOwner {
owner_identity: crate::ids::AgentIdentity,
objective_id: meerkat_core::interaction::ObjectiveId,
reply_tx: oneshot::Sender<Result<(), crate::MobError>>,
},
MemberMachineProjection {
agent_identity: crate::ids::AgentIdentity,
reply_tx: oneshot::Sender<Result<MobMemberMachineProjection, crate::MobError>>,
},
MemberHistory {
agent_identity: crate::ids::AgentIdentity,
from_index: Option<u64>,
limit: Option<u32>,
reply_tx: oneshot::Sender<
Result<super::member_history_proxy::MemberHistoryPageDomain, crate::MobError>,
>,
},
HardCancelMember {
agent_identity: AgentIdentity,
reason: String,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
MemberLiveOpen {
agent_identity: AgentIdentity,
turning_mode: Option<super::bridge_protocol::RealtimeTurningMode>,
transport: Option<super::bridge_protocol::LiveOpenTransport>,
reply_tx: oneshot::Sender<Result<MemberLiveOpenDelivery, MobError>>,
},
MemberLiveClose {
agent_identity: AgentIdentity,
channel_id: String,
reply_tx: oneshot::Sender<Result<super::bridge_protocol::LiveCloseStatus, MobError>>,
},
MemberLiveStatus {
agent_identity: AgentIdentity,
channel_id: Option<String>,
reply_tx: oneshot::Sender<
Result<super::member_live_proxy::MemberLiveStatusDomain, MobError>,
>,
},
MemberLiveControl {
agent_identity: AgentIdentity,
channel_id: String,
verb: super::bridge_protocol::BridgeLiveControlVerb,
reply_tx:
oneshot::Sender<Result<super::bridge_protocol::BridgeLiveControlOutcome, MobError>>,
},
EnsureMemberEventPump {
agent_identity: AgentIdentity,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
EnsureMemberEventTap {
agent_identity: AgentIdentity,
reply_tx: oneshot::Sender<
Result<tokio::sync::mpsc::Receiver<crate::event::AttributedEvent>, MobError>,
>,
},
Stop {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ResumeLifecycle {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
Complete {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
Destroy {
reply_tx: oneshot::Sender<
Result<super::handle::MobDestroyReport, super::handle::MobDestroyError>,
>,
},
Reset {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
RotateSupervisor {
reply_tx: oneshot::Sender<Result<super::handle::SupervisorRotationReport, MobError>>,
},
BindHost {
request: Box<super::handle::HostBindRequest>,
reply_tx: oneshot::Sender<Result<super::handle::HostBindReport, MobError>>,
},
RevokeHost {
host_id: String,
reply_tx: oneshot::Sender<Result<super::handle::HostRevokeReport, MobError>>,
},
GrantScopes {
caller: crate::control_policy::MobControlPrincipal,
principal: meerkat_core::auth::PrincipalId,
scopes: std::collections::BTreeSet<mob_dsl::ControlScope>,
expires_at_ms: Option<u64>,
reply_tx: oneshot::Sender<Result<crate::control_policy::OperatorGrant, MobError>>,
},
RevokeScopes {
caller: crate::control_policy::MobControlPrincipal,
principal: meerkat_core::auth::PrincipalId,
scopes: Option<std::collections::BTreeSet<mob_dsl::ControlScope>>,
reply_tx: oneshot::Sender<Result<bool, MobError>>,
},
Grants {
caller: crate::control_policy::MobControlPrincipal,
reply_tx: oneshot::Sender<Result<Vec<crate::control_policy::OperatorGrant>, MobError>>,
},
PollEvents {
after_cursor: u64,
limit: usize,
reply_tx: oneshot::Sender<Result<Vec<crate::event::MobEvent>, MobError>>,
},
ReplayAllEvents {
reply_tx: oneshot::Sender<Result<Vec<crate::event::MobEvent>, MobError>>,
},
RecordOperatorActionProvenance {
tool_name: String,
authority_context: meerkat_core::service::MobToolAuthorityContext,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
ForceCancel {
agent_identity: AgentIdentity,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
Wire {
local: AgentIdentity,
target: super::handle::PeerTarget,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
WireMembersBatch {
edges: Vec<(AgentIdentity, AgentIdentity)>,
reply_tx: oneshot::Sender<Result<super::handle::MobWireMembersBatchReport, MobError>>,
},
Unwire {
local: AgentIdentity,
target: super::handle::PeerTarget,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
DriveRouteInstalls {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
SetSpawnPolicy {
policy: Option<Arc<dyn super::spawn_policy::SpawnPolicy>>,
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
Shutdown {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
#[cfg(any(test, feature = "test-support"))]
CrashStopPreservingDurableWorkForTest {
reply_tx: oneshot::Sender<Result<(), MobError>>,
},
QueryPhase {
reply_tx: oneshot::Sender<Result<MobState, MobError>>,
},
}
impl MobCommand {
pub(super) fn kind(&self) -> &'static str {
match self {
Self::Spawn { .. } => "Spawn",
Self::SpawnProvisioned { .. } => "SpawnProvisioned",
Self::RevivePlacedMember { .. } => "RevivePlacedMember",
Self::HostStatusPollCompleted { .. } => "HostStatusPollCompleted",
Self::HostRuntimeIncarnationObserved { .. } => "HostRuntimeIncarnationObserved",
Self::HostOrphanReleaseCompleted { .. } => "HostOrphanReleaseCompleted",
Self::PlacedBehaviorCompleted { .. } => "PlacedBehaviorCompleted",
Self::Retire { .. } => "Retire",
Self::Respawn { .. } => "Respawn",
Self::RetireAll { .. } => "RetireAll",
Self::SubmitWork { .. } => "SubmitWork",
Self::SendPeerMessage { .. } => "SendPeerMessage",
Self::DriveRouteInstalls { .. } => "DriveRouteInstalls",
Self::DeclareMemberOutboundTaint { .. } => "DeclareMemberOutboundTaint",
Self::CancelAllWork { .. } => "CancelAllWork",
#[cfg(feature = "runtime-adapter")]
Self::KickoffOutcomeResolved { .. } => "KickoffOutcomeResolved",
Self::RunFlow { .. } => "RunFlow",
Self::PreviewRunFlowAdmission { .. } => "PreviewRunFlowAdmission",
Self::CancelFlow { .. } => "CancelFlow",
Self::FlowStatus { .. } => "FlowStatus",
Self::CommitFlowRunCommand { .. } => "CommitFlowRunCommand",
Self::CommitFlowTerminalization { .. } => "CommitFlowTerminalization",
Self::CommitFlowFrameStorePlan { .. } => "CommitFlowFrameStorePlan",
Self::ProjectMachineInput { .. } => "ProjectMachineInput",
Self::ApplyMachineInputEffects { .. } => "ApplyMachineInputEffects",
Self::ValidateCommandAuthority { .. } => "ValidateCommandAuthority",
Self::AdmitControlScope { .. } => "AdmitControlScope",
Self::PruneStaleMemberOperatorRequests { .. } => "PruneStaleMemberOperatorRequests",
Self::ReserveRemoteTurnObligation { .. } => "ReserveRemoteTurnObligation",
Self::CommitRemoteTurnReceipt { .. } => "CommitRemoteTurnReceipt",
Self::CloseRemoteTurnAfterTrackedCancel { .. } => "CloseRemoteTurnAfterTrackedCancel",
Self::EnsureRemoteTurnRecord { .. } => "EnsureRemoteTurnRecord",
Self::FinalizeRemoteTurnPrivacyCleanup { .. } => "FinalizeRemoteTurnPrivacyCleanup",
Self::ConvergeRecoveredFlowRun { .. } => "ConvergeRecoveredFlowRun",
Self::ResolveRemoteTurnOutcome { .. } => "ResolveRemoteTurnOutcome",
Self::AcknowledgeRemoteTurnOutcome { .. } => "AcknowledgeRemoteTurnOutcome",
Self::RequestPlacedCompletionCancellation { .. } => {
"RequestPlacedCompletionCancellation"
}
Self::ResolvePlacedCompletionOutcome { .. } => "ResolvePlacedCompletionOutcome",
Self::ClosePlacedCompletionOutcome { .. } => "ClosePlacedCompletionOutcome",
Self::AcknowledgePlacedCompletionOutcome { .. } => "AcknowledgePlacedCompletionOutcome",
Self::ResolvePlacedKickoffOutcome { .. } => "ResolvePlacedKickoffOutcome",
Self::ResolvePlacedKickoffCancelled { .. } => "ResolvePlacedKickoffCancelled",
Self::AcknowledgePlacedKickoffOutcome { .. } => "AcknowledgePlacedKickoffOutcome",
Self::RejectPlacedKickoffBeforeAdmission { .. } => "RejectPlacedKickoffBeforeAdmission",
Self::PreviewMachineInput { .. } => "PreviewMachineInput",
Self::QueryMachineState { .. } => "QueryMachineState",
#[cfg(test)]
Self::AuthorizeMemberTrustCleanupForTest { .. } => "AuthorizeMemberTrustCleanupForTest",
#[cfg(test)]
Self::StagePendingSpawnForRetireTest { .. } => "StagePendingSpawnForRetireTest",
Self::ApplyExternalPeerReciprocalTrust { .. } => "ApplyExternalPeerReciprocalTrust",
Self::ProjectMachineSignal { .. } => "ProjectMachineSignal",
Self::RecordMissingMemberBridgeSession { .. } => "RecordMissingMemberBridgeSession",
Self::FlowFinished { .. } => "FlowFinished",
Self::FlowCanceledCleanup { .. } => "FlowCanceledCleanup",
#[cfg(test)]
Self::FlowTrackerCounts { .. } => "FlowTrackerCounts",
#[cfg(test)]
Self::OrchestratorSnapshot { .. } => "OrchestratorSnapshot",
#[cfg(test)]
Self::LifecycleSnapshot { .. } => "LifecycleSnapshot",
#[cfg(test)]
Self::LifecycleNotificationBurst { .. } => "LifecycleNotificationBurst",
#[cfg(test)]
Self::DslT2Snapshot { .. } => "DslT2Snapshot",
Self::StartupKickoffSnapshot { .. } => "StartupKickoffSnapshot",
Self::ProjectMemberList { .. } => "ProjectMemberList",
Self::ProjectMemberStatus { .. } => "ProjectMemberStatus",
Self::ApplyIdentityDeclarationManifest { .. } => "ApplyIdentityDeclarationManifest",
Self::GetIdentityIntent { .. } => "GetIdentityIntent",
Self::GetIdentityDeclarationReceipt { .. } => "GetIdentityDeclarationReceipt",
Self::GetIdentityConvergenceStatus { .. } => "GetIdentityConvergenceStatus",
Self::ConcludeObjective { .. } => "ConcludeObjective",
Self::BindObjectiveOwner { .. } => "BindObjectiveOwner",
Self::MemberMachineProjection { .. } => "MemberMachineProjection",
Self::Stop { .. } => "Stop",
Self::ResumeLifecycle { .. } => "ResumeLifecycle",
Self::Complete { .. } => "Complete",
Self::Destroy { .. } => "Destroy",
Self::Reset { .. } => "Reset",
Self::RotateSupervisor { .. } => "RotateSupervisor",
Self::BindHost { .. } => "BindHost",
Self::RevokeHost { .. } => "RevokeHost",
Self::GrantScopes { .. } => "GrantScopes",
Self::RevokeScopes { .. } => "RevokeScopes",
Self::Grants { .. } => "Grants",
Self::PollEvents { .. } => "PollEvents",
Self::ReplayAllEvents { .. } => "ReplayAllEvents",
Self::RecordOperatorActionProvenance { .. } => "RecordOperatorActionProvenance",
Self::ForceCancel { .. } => "ForceCancel",
Self::HardCancelMember { .. } => "HardCancelMember",
Self::MemberHistory { .. } => "MemberHistory",
Self::MemberLiveOpen { .. } => "MemberLiveOpen",
Self::MemberLiveClose { .. } => "MemberLiveClose",
Self::MemberLiveStatus { .. } => "MemberLiveStatus",
Self::MemberLiveControl { .. } => "MemberLiveControl",
Self::EnsureMemberEventPump { .. } => "EnsureMemberEventPump",
Self::EnsureMemberEventTap { .. } => "EnsureMemberEventTap",
Self::Wire { .. } => "Wire",
Self::WireMembersBatch { .. } => "WireMembersBatch",
Self::Unwire { .. } => "Unwire",
Self::SetSpawnPolicy { .. } => "SetSpawnPolicy",
Self::Shutdown { .. } => "Shutdown",
#[cfg(any(test, feature = "test-support"))]
Self::CrashStopPreservingDurableWorkForTest { .. } => {
"CrashStopPreservingDurableWorkForTest"
}
Self::QueryPhase { .. } => "QueryPhase",
}
}
}