Builds on the v0.8.2 runtime. Four workstreams, all behind the §15 MCP door:
- Group rooms (Phase 1): migration 0026; N-way threads repo with a DM/room
count-guard; chat.send {room} + room.create/invite/leave tools; RoomMessage
-> room.message SSE; /api/claw-chat/rooms* APIs; Observer room badge.
- Per-claw door identity: door caller_agent resolves the X-ZeroClaw-Agent
header (set by the fork) to the specific claw, falling back to roster[0].
- Gated delegation bridge (Phase 3): clawmates__delegate door tool drives a
sibling via the existing /ws/chat ZeroClawDriveExecutor (not A2A); self-deny,
per-workspace hourly budget, audit trail, untrusted-banner result. Native
in-daemon delegation stays off (it would bypass the door).
- A2A tenant ingress (Phase 2): migration 0027 (workspace_a2a + a2a_tokens);
runtime_provision enable_a2a_server/publish_claw; routes/a2a.rs tenant-aware
proxy (per-workspace tokens, injected internal bearer, daemon stays internal,
cards URL-rewritten to the cm-api edge); a2a.invoked taxonomy.
Tests: cm-db room repos, cm-runtime chat tools, door units. sqlx cache updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
86 lines
2.6 KiB
Rust
86 lines
2.6 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use serde_json::Value;
|
|
use uuid::Uuid;
|
|
|
|
/// One gateway event with its journal sequence number. The wire contract
|
|
/// with the frontend (`frontend/src/lib/gateway/events.ts` mirrors it).
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct RunEventEnvelope {
|
|
pub seq: i64,
|
|
#[serde(flatten)]
|
|
pub event: RunEventBody,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(tag = "type", rename_all = "snake_case")]
|
|
pub enum RunEventBody {
|
|
RunStarted {
|
|
run_id: Uuid,
|
|
},
|
|
TextDelta {
|
|
delta: String,
|
|
},
|
|
StepStarted {
|
|
step_seq: i32,
|
|
tool: String,
|
|
input: Value,
|
|
},
|
|
StepFinished {
|
|
step_seq: i32,
|
|
status: String,
|
|
output: Value,
|
|
},
|
|
/// An inter-agent message this run sent via `chat.send` (§7.2). Journaled so
|
|
/// the world feed can surface agent-to-agent comms live (the A2A observer).
|
|
AgentMessage {
|
|
to_agent_id: String,
|
|
to_name: String,
|
|
text: String,
|
|
thread_id: String,
|
|
},
|
|
/// A message posted to an N-way group room (§7.2). `participant_ids` are the
|
|
/// other active members so the observer can fan the event to each of them.
|
|
RoomMessage {
|
|
thread_id: String,
|
|
subject: String,
|
|
text: String,
|
|
participant_ids: Vec<String>,
|
|
},
|
|
/// A gated action awaits human review (§15): carries the exact preview
|
|
/// of what will execute, surfaced as the approval card (§10).
|
|
ApprovalRequired {
|
|
approval_id: Uuid,
|
|
category: String,
|
|
action_type: String,
|
|
preview: Value,
|
|
},
|
|
/// The run is blocked until the pending approval is decided.
|
|
RunSuspended {
|
|
approval_id: Uuid,
|
|
},
|
|
RunCompleted {
|
|
message_id: String,
|
|
},
|
|
Error {
|
|
message: String,
|
|
},
|
|
}
|
|
|
|
impl RunEventBody {
|
|
/// Stable name stored in `run_events.event_type`.
|
|
pub fn type_name(&self) -> &'static str {
|
|
match self {
|
|
RunEventBody::RunStarted { .. } => "run_started",
|
|
RunEventBody::TextDelta { .. } => "text_delta",
|
|
RunEventBody::StepStarted { .. } => "step_started",
|
|
RunEventBody::StepFinished { .. } => "step_finished",
|
|
RunEventBody::AgentMessage { .. } => "agent_message",
|
|
RunEventBody::RoomMessage { .. } => "room_message",
|
|
RunEventBody::ApprovalRequired { .. } => "approval_required",
|
|
RunEventBody::RunSuspended { .. } => "run_suspended",
|
|
RunEventBody::RunCompleted { .. } => "run_completed",
|
|
RunEventBody::Error { .. } => "error",
|
|
}
|
|
}
|
|
}
|