mirror of
https://github.com/openai/codex.git
synced 2026-09-03 14:59:03 +00:00
Summary - Emit `codex_plugin_install_requested` when a validated plugin install request is made, before the user accepts or declines the elicitation. - Record the exact model-visible plugin ID, remote plugin ID, required connector IDs, stable suggestion ID, and `endpoint_recommendation` vs `legacy_discovery` source. - Keep `suggest_reason` out of telemetry and leave connector-only install requests unchanged. Rollout - Backend/schema dependency: https://github.com/openai/openai/pull/1065270 - Land the backend PR before this producer starts sending the event. Validation - `just test -p codex-analytics` (83 passed) - `just test -p codex-core request_plugin_install` (17 passed) - `just fix -p codex-analytics` - `just fix -p codex-core` - `just fmt` - `git diff --check`
96 lines
2.9 KiB
Rust
96 lines
2.9 KiB
Rust
mod accepted_lines;
|
|
#[cfg(debug_assertions)]
|
|
mod analytics_capture;
|
|
mod client;
|
|
mod events;
|
|
mod facts;
|
|
mod reducer;
|
|
|
|
use std::time::SystemTime;
|
|
use std::time::UNIX_EPOCH;
|
|
|
|
pub use accepted_lines::accepted_line_fingerprints_from_unified_diff;
|
|
pub use accepted_lines::fingerprint_hash;
|
|
pub use client::AnalyticsEventsClient;
|
|
pub use events::AppServerRpcTransport;
|
|
pub use events::GuardianApprovalRequestSource;
|
|
pub use events::GuardianReviewAnalyticsResult;
|
|
pub use events::GuardianReviewDecision;
|
|
pub use events::GuardianReviewEventParams;
|
|
pub use events::GuardianReviewFailureReason;
|
|
pub use events::GuardianReviewSessionAnalyticsParams;
|
|
pub use events::GuardianReviewSessionKind;
|
|
pub use events::GuardianReviewTerminalStatus;
|
|
pub use events::GuardianReviewTrackContext;
|
|
pub use events::GuardianReviewedAction;
|
|
pub use facts::AcceptedLineFingerprint;
|
|
pub use facts::AnalyticsJsonRpcError;
|
|
pub use facts::AppInvocation;
|
|
pub use facts::CodexCompactionEvent;
|
|
pub use facts::CodexErrKind;
|
|
pub use facts::CodexGoalEvent;
|
|
pub use facts::CodexTurnSteerEvent;
|
|
pub use facts::CompactionImplementation;
|
|
pub use facts::CompactionPhase;
|
|
pub use facts::CompactionReason;
|
|
pub use facts::CompactionStatus;
|
|
pub use facts::CompactionStrategy;
|
|
pub use facts::CompactionTrigger;
|
|
pub use facts::ExternalAgentConfigImportCompletedInput;
|
|
pub use facts::ExternalAgentConfigImportFailureInput;
|
|
pub use facts::GoalEventKind;
|
|
pub use facts::HookRunFact;
|
|
pub use facts::InputError;
|
|
pub use facts::InvocationType;
|
|
pub use facts::PluginInstallRequestSource;
|
|
pub use facts::PluginInstallRequested;
|
|
pub use facts::PluginInstallRequestedPlugin;
|
|
pub use facts::SkillInvocation;
|
|
pub use facts::SubAgentThreadStartedInput;
|
|
pub use facts::ThreadInitializationMode;
|
|
pub use facts::TrackEventsContext;
|
|
pub use facts::TurnCodexErrorFact;
|
|
pub use facts::TurnProfile;
|
|
pub use facts::TurnProfileFact;
|
|
pub use facts::TurnResolvedConfigFact;
|
|
pub use facts::TurnStatus;
|
|
pub use facts::TurnSteerRejectionReason;
|
|
pub use facts::TurnSteerRequestError;
|
|
pub use facts::TurnSteerResult;
|
|
pub use facts::TurnTokenUsageFact;
|
|
pub use facts::build_track_events_context;
|
|
|
|
#[cfg(test)]
|
|
mod analytics_client_tests;
|
|
|
|
pub fn now_unix_seconds() -> u64 {
|
|
SystemTime::now()
|
|
.duration_since(UNIX_EPOCH)
|
|
.unwrap_or_default()
|
|
.as_secs()
|
|
}
|
|
|
|
pub fn now_unix_millis() -> u64 {
|
|
u64::try_from(
|
|
SystemTime::now()
|
|
.duration_since(UNIX_EPOCH)
|
|
.unwrap_or_default()
|
|
.as_millis(),
|
|
)
|
|
.unwrap_or(u64::MAX)
|
|
}
|
|
|
|
pub(crate) fn serialize_enum_as_string<T: serde::Serialize>(value: &T) -> Option<String> {
|
|
serde_json::to_value(value)
|
|
.ok()
|
|
.and_then(|value| value.as_str().map(str::to_string))
|
|
}
|
|
|
|
pub(crate) fn usize_to_u64(value: usize) -> u64 {
|
|
u64::try_from(value).unwrap_or(u64::MAX)
|
|
}
|
|
|
|
pub(crate) fn option_i64_to_u64(value: Option<i64>) -> Option<u64> {
|
|
value.and_then(|value| u64::try_from(value).ok())
|
|
}
|