// enums.mbt — every string-literal union of the upstream contract as a
// MoonBit enum with `to_wire`/`of_wire`. Wire strings are verbatim upstream.
// Upstream names only LodyActivityKind / LodyGoalStatus / LodyGoalAction;
// the remaining enum names are transliterations of the inline unions (the
// unions themselves are upstream, only the MoonBit type name is ours).
///|
/// Wire vocabulary of `LodyActivityMeta.kind` (`src/session.ts`).
pub(all) enum LodyActivityKind {
ContextCompaction
Retry
} derive(Eq, Debug)
///|
pub fn LodyActivityKind::to_wire(self : LodyActivityKind) -> String {
match self {
ContextCompaction => "context_compaction"
Retry => "retry"
}
}
///|
pub fn LodyActivityKind::of_wire(
wire : String,
) -> Result[LodyActivityKind, String] {
match wire {
"context_compaction" => Ok(ContextCompaction)
"retry" => Ok(Retry)
_ => Err("unknown lody activity kind: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodyTaskMeta.kind` (subagent / background / scheduled
/// task lifecycles).
pub(all) enum LodyTaskKind {
Subagent
Background
Scheduled
} derive(Eq, Debug)
///|
pub fn LodyTaskKind::to_wire(self : LodyTaskKind) -> String {
match self {
Subagent => "subagent"
Background => "background"
Scheduled => "scheduled"
}
}
///|
pub fn LodyTaskKind::of_wire(wire : String) -> Result[LodyTaskKind, String] {
match wire {
"subagent" => Ok(Subagent)
"background" => Ok(Background)
"scheduled" => Ok(Scheduled)
_ => Err("unknown lody task kind: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodyTaskMeta.status` (task track: pending /
/// in_progress / completed / failed). Deliberately NOT shared with the
/// subagent-list status vocabulary — upstream keeps the two disjoint.
pub(all) enum LodyTaskStatus {
Pending
InProgress
Completed
Failed
} derive(Eq, Debug)
///|
pub fn LodyTaskStatus::to_wire(self : LodyTaskStatus) -> String {
match self {
Pending => "pending"
InProgress => "in_progress"
Completed => "completed"
Failed => "failed"
}
}
///|
pub fn LodyTaskStatus::of_wire(wire : String) -> Result[LodyTaskStatus, String] {
match wire {
"pending" => Ok(Pending)
"in_progress" => Ok(InProgress)
"completed" => Ok(Completed)
"failed" => Ok(Failed)
_ => Err("unknown lody task status: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySubagentTask.status` (`_lody/subagents/list`
/// track: running / completed / failed / timed_out / killed / lost).
/// Deliberately NOT shared with `LodyTaskStatus` — upstream keeps the two
/// status vocabularies disjoint.
pub(all) enum LodySubagentStatus {
Running
Completed
Failed
TimedOut
Killed
Lost
} derive(Eq, Debug)
///|
pub fn LodySubagentStatus::to_wire(self : LodySubagentStatus) -> String {
match self {
Running => "running"
Completed => "completed"
Failed => "failed"
TimedOut => "timed_out"
Killed => "killed"
Lost => "lost"
}
}
///|
pub fn LodySubagentStatus::of_wire(
wire : String,
) -> Result[LodySubagentStatus, String] {
match wire {
"running" => Ok(Running)
"completed" => Ok(Completed)
"failed" => Ok(Failed)
"timed_out" => Ok(TimedOut)
"killed" => Ok(Killed)
"lost" => Ok(Lost)
_ => Err("unknown lody subagent status: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodyGoalSnapshot.status`.
pub(all) enum LodyGoalStatus {
Active
Paused
Blocked
Limited
Complete
} derive(Eq, Debug)
///|
pub fn LodyGoalStatus::to_wire(self : LodyGoalStatus) -> String {
match self {
Active => "active"
Paused => "paused"
Blocked => "blocked"
Limited => "limited"
Complete => "complete"
}
}
///|
pub fn LodyGoalStatus::of_wire(wire : String) -> Result[LodyGoalStatus, String] {
match wire {
"active" => Ok(Active)
"paused" => Ok(Paused)
"blocked" => Ok(Blocked)
"limited" => Ok(Limited)
"complete" => Ok(Complete)
_ => Err("unknown lody goal status: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodyGoalCapability.actions` (goal control verbs).
pub(all) enum LodyGoalAction {
Set
Pause
Resume
Clear
} derive(Eq, Debug)
///|
pub fn LodyGoalAction::to_wire(self : LodyGoalAction) -> String {
match self {
Set => "set"
Pause => "pause"
Resume => "resume"
Clear => "clear"
}
}
///|
pub fn LodyGoalAction::of_wire(wire : String) -> Result[LodyGoalAction, String] {
match wire {
"set" => Ok(Set)
"pause" => Ok(Pause)
"resume" => Ok(Resume)
"clear" => Ok(Clear)
_ => Err("unknown lody goal action: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodyNotice.level`.
pub(all) enum LodyNoticeLevel {
Info
Warning
Error
} derive(Eq, Debug)
///|
pub fn LodyNoticeLevel::to_wire(self : LodyNoticeLevel) -> String {
match self {
Info => "info"
Warning => "warning"
Error => "error"
}
}
///|
pub fn LodyNoticeLevel::of_wire(
wire : String,
) -> Result[LodyNoticeLevel, String] {
match wire {
"info" => Ok(Info)
"warning" => Ok(Warning)
"error" => Ok(Error)
_ => Err("unknown lody notice level: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySessionMeta.titleSource`.
pub(all) enum LodyTitleSource {
Explicit
Generated
Fallback
Unset
} derive(Eq, Debug)
///|
pub fn LodyTitleSource::to_wire(self : LodyTitleSource) -> String {
match self {
Explicit => "explicit"
Generated => "generated"
Fallback => "fallback"
Unset => "unset"
}
}
///|
pub fn LodyTitleSource::of_wire(
wire : String,
) -> Result[LodyTitleSource, String] {
match wire {
"explicit" => Ok(Explicit)
"generated" => Ok(Generated)
"fallback" => Ok(Fallback)
"unset" => Ok(Unset)
_ => Err("unknown lody title source: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySessionMeta.messagePhase` (commentary vs final
/// answer).
pub(all) enum LodyMessagePhase {
Commentary
FinalAnswer
} derive(Eq, Debug)
///|
pub fn LodyMessagePhase::to_wire(self : LodyMessagePhase) -> String {
match self {
Commentary => "commentary"
FinalAnswer => "final_answer"
}
}
///|
pub fn LodyMessagePhase::of_wire(
wire : String,
) -> Result[LodyMessagePhase, String] {
match wire {
"commentary" => Ok(Commentary)
"final_answer" => Ok(FinalAnswer)
_ => Err("unknown lody message phase: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySteerResponse.outcome`.
pub(all) enum LodySteerOutcome {
Injected
Failed
} derive(Eq, Debug)
///|
pub fn LodySteerOutcome::to_wire(self : LodySteerOutcome) -> String {
match self {
Injected => "injected"
Failed => "failed"
}
}
///|
pub fn LodySteerOutcome::of_wire(
wire : String,
) -> Result[LodySteerOutcome, String] {
match wire {
"injected" => Ok(Injected)
"failed" => Ok(Failed)
_ => Err("unknown lody steer outcome: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySteeringCapability.transport`.
pub(all) enum LodySteeringTransport {
Request
Prompt
} derive(Eq, Debug)
///|
pub fn LodySteeringTransport::to_wire(self : LodySteeringTransport) -> String {
match self {
Request => "request"
Prompt => "prompt"
}
}
///|
pub fn LodySteeringTransport::of_wire(
wire : String,
) -> Result[LodySteeringTransport, String] {
match wire {
"request" => Ok(Request)
"prompt" => Ok(Prompt)
_ => Err("unknown lody steering transport: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySteeringCapability.upstreamTurn`.
pub(all) enum LodySteeringUpstreamTurn {
Same
Handoff
} derive(Eq, Debug)
///|
pub fn LodySteeringUpstreamTurn::to_wire(
self : LodySteeringUpstreamTurn,
) -> String {
match self {
Same => "same"
Handoff => "handoff"
}
}
///|
pub fn LodySteeringUpstreamTurn::of_wire(
wire : String,
) -> Result[LodySteeringUpstreamTurn, String] {
match wire {
"same" => Ok(Same)
"handoff" => Ok(Handoff)
_ => Err("unknown lody steering upstream turn: \"\{wire}\"")
}
}
///|
/// Wire vocabulary of `LodySteeringCapability.configPolicy`.
pub(all) enum LodySteeringConfigPolicy {
Active
Apply
} derive(Eq, Debug)
///|
pub fn LodySteeringConfigPolicy::to_wire(
self : LodySteeringConfigPolicy,
) -> String {
match self {
Active => "active"
Apply => "apply"
}
}
///|
pub fn LodySteeringConfigPolicy::of_wire(
wire : String,
) -> Result[LodySteeringConfigPolicy, String] {
match wire {
"active" => Ok(Active)
"apply" => Ok(Apply)
_ => Err("unknown lody steering config policy: \"\{wire}\"")
}
}