Skip to main content

vct_core/models/
grok.rs

1//! Minimal Grok CLI session telemetry shapes used by the local parser.
2
3use serde::Deserialize;
4
5/// Aggregate telemetry stored in each Grok CLI session's `signals.json`.
6///
7/// Grok records a current context-window gauge rather than billed token
8/// buckets. Unknown fields are intentionally ignored so new telemetry does
9/// not break older VCT releases.
10#[derive(Debug, Default, Deserialize)]
11#[serde(default, rename_all = "camelCase")]
12pub struct GrokSignals {
13    /// Resolved model used for session attribution.
14    pub primary_model_id: String,
15    /// Models observed in the session, used only when the primary model is absent.
16    pub models_used: Vec<String>,
17    /// Current number of tokens occupying the context window.
18    pub context_tokens_used: u64,
19}
20
21/// Session metadata stored beside `signals.json` in `summary.json`.
22#[derive(Debug, Default, Deserialize)]
23#[serde(default)]
24pub struct GrokSummary {
25    /// Stable session identity and working directory.
26    pub info: GrokSessionInfo,
27    /// Last session update time in RFC 3339 format.
28    pub updated_at: String,
29    /// Fallback last-activity time in RFC 3339 format.
30    pub last_active_at: String,
31    /// Alias or model id used only when signals omit model attribution.
32    pub current_model_id: String,
33    /// Git remotes recorded for the working tree.
34    pub git_remotes: Vec<String>,
35}
36
37/// Identity fields nested under `summary.json`'s `info` object.
38#[derive(Debug, Default, Deserialize)]
39#[serde(default)]
40pub struct GrokSessionInfo {
41    /// Grok session id.
42    pub id: String,
43    /// Session working directory.
44    pub cwd: String,
45}