101 lines
3.3 KiB
Rust
101 lines
3.3 KiB
Rust
//! Domain events published on the [`crate::ports::EventBus`] and relayed to the
|
|
//! presentation layer (ARCHITECTURE §3.2).
|
|
|
|
use crate::ids::{AgentId, ProjectId, SessionId, SkillId, TemplateId};
|
|
use crate::template::TemplateVersion;
|
|
|
|
/// Events emitted by the domain/application as state changes occur.
|
|
///
|
|
/// Deliberately *not* `Serialize`/`Deserialize`: events are an in-process
|
|
/// concern relayed to IPC by an infrastructure adapter, which owns the wire
|
|
/// format. `PtyOutput` in particular is usually short-circuited to a Tauri
|
|
/// channel rather than serialised here.
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum DomainEvent {
|
|
/// A project was created.
|
|
ProjectCreated {
|
|
/// The new project.
|
|
project_id: ProjectId,
|
|
},
|
|
/// An agent was launched in a terminal.
|
|
AgentLaunched {
|
|
/// The agent.
|
|
agent_id: AgentId,
|
|
/// The session it runs in.
|
|
session_id: SessionId,
|
|
},
|
|
/// An agent's process exited.
|
|
AgentExited {
|
|
/// The agent.
|
|
agent_id: AgentId,
|
|
/// Exit code.
|
|
code: i32,
|
|
},
|
|
/// A template was updated (content changed, version bumped).
|
|
TemplateUpdated {
|
|
/// The template.
|
|
template_id: TemplateId,
|
|
/// New version.
|
|
version: TemplateVersion,
|
|
},
|
|
/// A synchronized agent is behind its template.
|
|
AgentDriftDetected {
|
|
/// The drifting agent.
|
|
agent_id: AgentId,
|
|
/// Version the agent is currently at.
|
|
from: TemplateVersion,
|
|
/// Version available from the template.
|
|
to: TemplateVersion,
|
|
},
|
|
/// A synchronized agent received its template update.
|
|
AgentSynced {
|
|
/// The agent.
|
|
agent_id: AgentId,
|
|
/// Version it was brought up to.
|
|
to: TemplateVersion,
|
|
},
|
|
/// A skill was assigned to (or unassigned from) an agent.
|
|
SkillAssigned {
|
|
/// The agent whose skill set changed.
|
|
agent_id: AgentId,
|
|
/// The skill involved.
|
|
skill_id: SkillId,
|
|
/// `true` if assigned, `false` if unassigned.
|
|
assigned: bool,
|
|
},
|
|
/// A tab's layout changed.
|
|
LayoutChanged {
|
|
/// The project whose layout changed.
|
|
project_id: ProjectId,
|
|
},
|
|
/// A remote host connection was established.
|
|
RemoteConnected {
|
|
/// The project on that remote.
|
|
project_id: ProjectId,
|
|
},
|
|
/// Git state for a project changed.
|
|
GitStateChanged {
|
|
/// The project.
|
|
project_id: ProjectId,
|
|
},
|
|
/// An orchestrator request (dropped under `.ideai/requests/`) was processed
|
|
/// by IdeA on behalf of a requester agent (ARCHITECTURE §14.3). Relayed so the
|
|
/// frontend can surface orchestration activity; the resulting cell/tab opens
|
|
/// off the [`AgentLaunched`](Self::AgentLaunched) event for `spawn_agent`.
|
|
OrchestratorRequestProcessed {
|
|
/// Id of the requesting (orchestrator) agent — the request subdirectory.
|
|
requester_id: String,
|
|
/// The action that was processed (`spawn_agent`, `stop_agent`, …).
|
|
action: String,
|
|
/// Whether IdeA handled it successfully.
|
|
ok: bool,
|
|
},
|
|
/// Raw PTY output (usually routed to a dedicated channel, not this bus).
|
|
PtyOutput {
|
|
/// The session.
|
|
session_id: SessionId,
|
|
/// Output bytes.
|
|
bytes: Vec<u8>,
|
|
},
|
|
}
|