Skip to main content

gemini_live_harness/
notification.rs

1//! Durable notification queue records.
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// Durable delivery state for a queued harness notification.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub enum NotificationStatus {
10    Queued,
11    Delivered,
12    Acknowledged,
13}
14
15/// Notification categories used by the harness.
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
17#[serde(rename_all = "camelCase")]
18pub enum NotificationKind {
19    TaskSucceeded,
20    TaskFailed,
21    TaskCancelled,
22    TaskInterrupted,
23    Generic,
24}
25
26/// Persisted notification record stored under `notifications/`.
27#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct HarnessNotification {
30    pub id: String,
31    pub kind: NotificationKind,
32    pub created_at_ms: u64,
33    pub updated_at_ms: u64,
34    pub status: NotificationStatus,
35    #[serde(default)]
36    pub task_id: Option<String>,
37    pub title: String,
38    pub body: String,
39    #[serde(default)]
40    pub payload: Option<Value>,
41    #[serde(default)]
42    pub delivered_at_ms: Option<u64>,
43    #[serde(default)]
44    pub acknowledged_at_ms: Option<u64>,
45}
46
47/// Request to enqueue a durable notification.
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
49#[serde(rename_all = "camelCase")]
50pub struct NewNotification {
51    pub kind: NotificationKind,
52    #[serde(default)]
53    pub task_id: Option<String>,
54    pub title: String,
55    pub body: String,
56    #[serde(default)]
57    pub payload: Option<Value>,
58}