Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:12:56.421Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

telemetry_events.rs

127 lines · 3.9 KB · rust
1//! See [Telemetry in Zed](https://zed.dev/docs/telemetry) for additional information.
2
3use semver::Version;
4use serde::{Deserialize, Serialize};
5use std::{collections::HashMap, fmt::Display, time::Duration};
6
7#[derive(Serialize, Deserialize, Debug, Clone)]
8pub struct EventRequestBody {
9    /// Identifier unique to each system Zed is installed on
10    pub system_id: Option<String>,
11    /// Identifier unique to each Zed installation (differs for stable, preview, dev)
12    pub installation_id: Option<String>,
13    /// Identifier unique to each logged in Zed user (randomly generated on first sign in)
14    /// Identifier unique to each Zed session (differs for each time you open Zed)
15    pub session_id: Option<String>,
16    pub metrics_id: Option<String>,
17    /// True for Zed staff, otherwise false
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub is_staff: Option<bool>,
20    /// Zed version number
21    pub app_version: String,
22    pub os_name: String,
23    pub os_version: Option<String>,
24    pub architecture: String,
25    /// Zed release channel (stable, preview, dev)
26    pub release_channel: Option<String>,
27    pub events: Vec<EventWrapper>,
28}
29
30impl EventRequestBody {
31    pub fn semver(&self) -> Option<Version> {
32        self.app_version.parse().ok()
33    }
34}
35
36#[derive(Serialize, Deserialize, Debug, Clone)]
37pub struct EventWrapper {
38    pub signed_in: bool,
39    /// Duration between this event's timestamp and the timestamp of the first event in the current batch
40    pub milliseconds_since_first_event: i64,
41    /// The event itself
42    #[serde(flatten)]
43    pub event: Event,
44}
45
46#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
47#[serde(rename_all = "snake_case")]
48pub enum AssistantKind {
49    Panel,
50    Inline,
51    InlineTerminal,
52}
53impl Display for AssistantKind {
54    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55        write!(
56            f,
57            "{}",
58            match self {
59                Self::Panel => "panel",
60                Self::Inline => "inline",
61                Self::InlineTerminal => "inline_terminal",
62            }
63        )
64    }
65}
66
67#[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)]
68#[serde(rename_all = "snake_case")]
69pub enum AssistantPhase {
70    #[default]
71    Response,
72    Invoked,
73    Accepted,
74    Rejected,
75}
76
77impl Display for AssistantPhase {
78    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
79        write!(
80            f,
81            "{}",
82            match self {
83                Self::Response => "response",
84                Self::Invoked => "invoked",
85                Self::Accepted => "accepted",
86                Self::Rejected => "rejected",
87            }
88        )
89    }
90}
91
92#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
93#[serde(tag = "type")]
94pub enum Event {
95    Flexible(FlexibleEvent),
96}
97
98#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
99pub struct FlexibleEvent {
100    pub event_type: String,
101    pub event_properties: HashMap<String, serde_json::Value>,
102}
103
104#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
105pub enum EditPredictionRating {
106    Positive,
107    Negative,
108}
109
110#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
111pub struct AssistantEventData {
112    /// Unique random identifier for each assistant tab (None for inline assist)
113    pub conversation_id: Option<String>,
114    /// Server-generated message ID (only supported for some providers)
115    pub message_id: Option<String>,
116    /// The kind of assistant (Panel, Inline)
117    pub kind: AssistantKind,
118    #[serde(default)]
119    pub phase: AssistantPhase,
120    /// Name of the AI model used (gpt-4o, claude-3-5-sonnet, etc)
121    pub model: String,
122    pub model_provider: String,
123    pub response_latency: Option<Duration>,
124    pub error_message: Option<String>,
125    pub language_name: Option<String>,
126}
127
Served at tenant.openagents/omega Member data and write actions are omitted.