2026-11-02 08:19:04 +00:00
|
|
|
//! Value contracts for the single-worker actor prototype.
|
|
|
|
|
|
2026-11-02 09:08:49 +00:00
|
|
|
use runa_core::ImplementationId;
|
feat!: add structured actor state and messages
Introduce owned portable values with distinct actor references, bounded Rune conversion, JSON REPL literals, and nested reference completion. Preserve isolation and atomic transitions across state, messages, effects, migration, inspection, and TCP clients.
BREAKING CHANGE: protocol v3 replaces integer state and kind/value/target_ref messages with tagged values. Rune handlers now take (state, message) and return (new_state, [(actor_reference, message)]). The REPL send command accepts one JSON message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 15:56:03 +00:00
|
|
|
pub use runa_core::{ActorRef, Value};
|
2026-11-02 08:19:04 +00:00
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
|
pub struct MailboxId(pub u64);
|
|
|
|
|
|
feat!: add structured actor state and messages
Introduce owned portable values with distinct actor references, bounded Rune conversion, JSON REPL literals, and nested reference completion. Preserve isolation and atomic transitions across state, messages, effects, migration, inspection, and TCP clients.
BREAKING CHANGE: protocol v3 replaces integer state and kind/value/target_ref messages with tagged values. Rune handlers now take (state, message) and return (new_state, [(actor_reference, message)]). The REPL send command accepts one JSON message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 15:56:03 +00:00
|
|
|
pub type Message = Value;
|
2026-11-02 08:19:04 +00:00
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
|
|
|
pub enum Status {
|
|
|
|
|
Idle,
|
|
|
|
|
Running,
|
|
|
|
|
Awaiting,
|
2026-11-02 11:35:29 +00:00
|
|
|
Paused,
|
2026-11-02 08:19:04 +00:00
|
|
|
Stopped,
|
|
|
|
|
Failed(String),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub struct ActorSnapshot {
|
2026-11-02 14:19:25 +00:00
|
|
|
pub actor_ref: ActorRef,
|
2026-11-02 08:19:04 +00:00
|
|
|
pub mailbox: MailboxId,
|
|
|
|
|
pub implementation: ImplementationId,
|
|
|
|
|
pub incarnation: u64,
|
feat!: add structured actor state and messages
Introduce owned portable values with distinct actor references, bounded Rune conversion, JSON REPL literals, and nested reference completion. Preserve isolation and atomic transitions across state, messages, effects, migration, inspection, and TCP clients.
BREAKING CHANGE: protocol v3 replaces integer state and kind/value/target_ref messages with tagged values. Rune handlers now take (state, message) and return (new_state, [(actor_reference, message)]). The REPL send command accepts one JSON message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 15:56:03 +00:00
|
|
|
pub state: Value,
|
2026-11-02 08:19:04 +00:00
|
|
|
pub status: Status,
|
2026-11-02 12:11:11 +00:00
|
|
|
pub execution: Option<ExecutionSnapshot>,
|
2026-11-02 08:19:04 +00:00
|
|
|
pub queued: Vec<Message>,
|
|
|
|
|
pub reserved: Option<Message>,
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-02 12:11:11 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
|
|
|
pub struct ExecutionSnapshot {
|
|
|
|
|
pub vm_steps: u64,
|
|
|
|
|
pub instruction_pointer: usize,
|
|
|
|
|
pub call_depth: usize,
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-02 08:19:04 +00:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum Event {
|
2026-11-02 14:19:25 +00:00
|
|
|
Spawned(ActorRef),
|
|
|
|
|
Committed(ActorRef),
|
|
|
|
|
Failed(ActorRef, String),
|
|
|
|
|
Stopped(ActorRef),
|
|
|
|
|
Restarted(ActorRef),
|
|
|
|
|
Paused(ActorRef),
|
|
|
|
|
Resumed(ActorRef),
|
|
|
|
|
InvocationCancelled(ActorRef),
|
|
|
|
|
BehaviorInstalled(ActorRef, ImplementationId),
|
feat!: add structured actor state and messages
Introduce owned portable values with distinct actor references, bounded Rune conversion, JSON REPL literals, and nested reference completion. Preserve isolation and atomic transitions across state, messages, effects, migration, inspection, and TCP clients.
BREAKING CHANGE: protocol v3 replaces integer state and kind/value/target_ref messages with tagged values. Rune handlers now take (state, message) and return (new_state, [(actor_reference, message)]). The REPL send command accepts one JSON message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 15:56:03 +00:00
|
|
|
StateMigrated(ActorRef, Value, Value),
|
2026-11-02 08:19:04 +00:00
|
|
|
}
|