feat(maestro): async structured session spawn
Register a structured session immediately with `activity: Starting` and run the ACP handshake in a background task. The HTTP caller gets an instant response; the user can begin typing a prompt while the adapter boots. - Add `ActivityState::Starting` to the protocol - Open the event log eagerly so the structured WS can connect during boot (empty transcript + idle state) - `queue_acp_prompt` stashes a prompt while `Starting`; the background task drains it on successful handshake - `apply_structured_activity` skips overwriting `Starting` - `subscribe_acp_projection` allows connecting during `Starting` - TUI/CLI map `Starting` to idle colour / "starting" label Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
47654aa434
commit
8d35f7f8c8
@@ -175,6 +175,10 @@ pub enum ActivityState {
|
||||
AwaitingInput,
|
||||
/// An agent reported a failure, or a structured session/turn failed.
|
||||
Error,
|
||||
/// The ACP adapter is booting; the session is registered but cannot accept
|
||||
/// prompts yet. Older clients that do not know this variant degrade it to
|
||||
/// `Idle` via the lenient deserializer — acceptable.
|
||||
Starting,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for ActivityState {
|
||||
@@ -187,6 +191,7 @@ impl<'de> Deserialize<'de> for ActivityState {
|
||||
"Active" => Self::Active,
|
||||
"AwaitingInput" => Self::AwaitingInput,
|
||||
"Error" => Self::Error,
|
||||
"Starting" => Self::Starting,
|
||||
// Known or not, any other spelling degrades to the neutral default
|
||||
_ => Self::Idle,
|
||||
})
|
||||
@@ -225,9 +230,10 @@ where
|
||||
"Idle" => Ok(ActivityState::Idle),
|
||||
"AwaitingInput" => Ok(ActivityState::AwaitingInput),
|
||||
"Error" => Ok(ActivityState::Error),
|
||||
"Starting" => Ok(ActivityState::Starting),
|
||||
other => Err(D::Error::unknown_variant(
|
||||
other,
|
||||
&["Active", "Idle", "AwaitingInput", "Error"],
|
||||
&["Active", "Idle", "AwaitingInput", "Error", "Starting"],
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user