Skip to main content

scv_core/
event.rs

1//! What the runtime reports while a turn runs.
2
3use async_trait::async_trait;
4use serde_json::Value;
5
6use crate::{AgentError, ToolOutput};
7
8#[derive(Debug, Clone)]
9pub enum CoreEvent {
10    AssistantDelta {
11        content: String,
12    },
13    AssistantCompleted {
14        content: String,
15    },
16    ToolProposed {
17        call_id: String,
18        name: String,
19        arguments: Value,
20    },
21    ToolStarted {
22        call_id: String,
23        name: String,
24    },
25    /// Status lines a running tool reported, for display only.
26    ToolProgress {
27        call_id: String,
28        text: String,
29    },
30    ToolCompleted {
31        call_id: String,
32        name: String,
33        output: ToolOutput,
34    },
35    ContextCompacted {
36        before_tokens: usize,
37        after_tokens: usize,
38        removed_messages: usize,
39    },
40    SessionTrimmed {
41        removed_messages: usize,
42        history_bytes: usize,
43    },
44}
45
46#[async_trait]
47pub trait EventSink: Send + Sync {
48    async fn emit(&self, event: CoreEvent) -> Result<(), AgentError>;
49}