Compare commits

..
Author SHA1 Message Date
CodeWhale BotandClaude Sonnet 5.5 b3edc96bfb test(tui): real-terminal thinking stream, stop, restore and sign-in notice at four widths (CW-7876)
Adds a PTY scenario to the existing cucumber harness, compiled only on unix
with long-running-tests: stream thinking, stop, and restore at four terminal
widths, the one-time sign-in notice with Esc dismissal, and a saved choice to
hide thinking surviving the new default.

Checks: farm run 20261112T073916Z-ENG-TUI-rebased-pty4-b3fc94, 3 tests run,
3 passed (1 slow), 60 skipped, exit 0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 17:55:59 -08:00
CodeWhale BotandClaude Sonnet 5.5 c8ee444f88 fix(engine): a build with test-support loads the account only from a loopback account service (CW-7876)
CI builds the acceptance binary with `cargo build -p codewhale-cli --bin
codewhale --all-features`, but the workspace `cargo nextest run --workspace
--all-features` step that follows rebuilds target/debug/codewhale, and that
build unifies the engine test-support feature in (app-server's test-support
enables it, and the cli integration tests make cargo relink the binary). The
binary the real-terminal tests launch therefore has test-support on. To
reproduce: build that way, then run the cucumber test
account_preferences_notice_is_shown_once_per_sign_in_and_esc_dismisses_it.

Under test-support profile_constitution::capture never read the account, so the
loopback account service in the test was never asked and the one-time sign-in
notice never appeared; the test waited its full 80 seconds on Linux and macOS
and failed.

Under test-support the account is now loaded only when
CODEWHALE_CLOUD_API_BASE normalizes to a loopback host. An unset variable or a
non-loopback base (including the production base some secrets tests export for
the whole process) still skips the account, so a test-support build never sends
a stored bearer to a remote account service and a developer shell that exports
the variable cannot leak a real session into an engine turn. Builds without
test-support are unchanged. The comment that claimed unit tests never read
account credentials is removed.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-12 17:55:45 -08:00
CodeWhale BotandClaude Sonnet 5.5 eef869d2a6 fix(tui): a paused stream shows the thinking it already received (CW-7876)
When the provider paused mid-stream, reasoning already received stayed
unrendered until the next token arrived. The owed revision now renders on a
later display beat (render_owed_revision), so the transcript shows what has
arrived. Covered by a_paused_stream_renders_the_reasoning_it_already_received
and the PTY scenario.

Checks: farm tests run 20261112T061929Z-ENG-TUI-rebased-tests-d67557, 7557
passed / 10 skipped, exit 0; clippy run 20261112T061950Z-ENG-TUI-rebased-clippy-50d460
clean, exit 0; PTY run 20261112T073916Z-ENG-TUI-rebased-pty4-b3fc94, 3 of 3
passed.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-12 17:53:41 -08:00
CodeWhale BotandClaude Sonnet 5.5 20f437f42c fix(tui): the footer clock says thinking, like the transcript (CW-7876)
The footer phase word and clock said reasoning while the transcript header
said thinking. Both now say thinking, in the 12 locale packs that carried the
old word and the localization library; uk and ru keep their own wording. The
ui tests assert the new clock text.

Checks: farm tests run 20261112T061929Z-ENG-TUI-rebased-tests-d67557, 7557
passed / 10 skipped, exit 0; locale parity PASS; vocabulary check exit 0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-12 17:53:16 -08:00
CodeWhale BotandClaude Sonnet 5.5 bab86cd3f0 feat(settings): model thinking shows by default; a saved choice is kept (CW-7876)
Thinking traces are first-class: show_thinking now defaults to true in the
runtime Settings and the config schema, while thinking_default_expanded stays
false (live while streaming, collapsed once the answer starts). Docs, the
features.toml row, the zh-Hans docs, the config panel goldens and the derived
web json follow. A show_thinking value already present in settings.toml is
read as an explicit choice and kept. Note that earlier saves wrote the old
default into that file, so only installs without the key get the new default;
whether to migrate those is a founder decision recorded in the review packet.

Checks: farm tests run 20261112T061929Z-ENG-TUI-rebased-tests-d67557, 7557
passed / 10 skipped, exit 0, including feature_registry (2 passed); clippy run
20261112T061950Z-ENG-TUI-rebased-clippy-50d460 clean, exit 0; check-facts OK.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-12 17:52:57 -08:00
CodeWhale BotandClaude Sonnet 5.5 61144665b5 fix(tui): the sign-in notice is a one-time footer notice that Esc dismisses (CW-7876)
The "account preferences not loaded" notice was pushed into the transcript
on every refresh, so it repeated and scrolled away with the conversation.
It is now a standing footer notice shown once per sign-in
(account_preferences_notice_shown), and Esc dismisses it while idle. The
message names the remedy within 40 columns and carries meaning in words, not
colour. New string added to all 15 locale packs and the settings schema.

Checks: farm tests run 20261112T061929Z-ENG-TUI-rebased-tests-d67557, 7557
passed / 10 skipped, exit 0; clippy run 20261112T061950Z-ENG-TUI-rebased-clippy-50d460
clean, exit 0; PTY run 20261112T073916Z-ENG-TUI-rebased-pty4-b3fc94, 3 of 3
passed; locale parity PASS; vocabulary check exit 0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-12 17:52:47 -08:00
70 changed files with 996 additions and 3185 deletions

No files matched your search

-1
View File
@@ -3049,7 +3049,6 @@ fn start_cli_telemetry(
telemetry::init(consent);
telemetry::record(Event::SessionStart {
source: SessionSource::Unknown,
install_age: telemetry::install_age(),
});
Some(CliTelemetrySession {
started: std::time::Instant::now(),
-16
View File
@@ -484,22 +484,6 @@ pub fn public_model_identifier(model: &str) -> bool {
})
}
/// Case-insensitive form of [`public_model_identifier`] for ids that were
/// lowercased before the lookup.
#[must_use]
pub fn public_model_identifier_ignore_case(model: &str) -> bool {
let catalog = super::bundled_models_dev_catalog();
let matches = |id: &str| id.eq_ignore_ascii_case(model);
catalog.reviewed.intrinsic.keys().any(|id| matches(id))
|| catalog.models.keys().any(|id| matches(id))
|| catalog.providers.values().any(|provider| {
provider
.models
.iter()
.any(|(id, row)| matches(id) || matches(&row.id))
})
}
#[must_use]
pub fn official_deepseek_model_id(model: &str) -> Option<&'static str> {
bundled_reviewed()
+7 -1
View File
@@ -605,7 +605,7 @@ pub const SETTINGS_SCHEMA: &[SettingDef] = &[
def(
"show_thinking",
SettingKind::Bool(SHOW_THINKING),
"false",
"true",
ui(
TAB_APPEARANCE,
"display",
@@ -1546,6 +1546,12 @@ pub const SETTINGS_SCHEMA: &[SettingDef] = &[
"false",
None,
),
def(
"account_preferences_notice_shown",
SettingKind::String,
"",
None,
),
// Round 3 work-bar placement migration ran once (`top` → `bottom`).
def(
"work_surface_bottom_migrated",
+1 -1
View File
@@ -45,7 +45,7 @@ pub const SETUP_STATE_FILE_NAME: &str = "setup_state.json";
/// when the collection policy, schema, or disclosure materially changes. Prior
/// declines remain off. Keying it to the app version would re-prompt every
/// release, which is nagging with extra steps.
pub const TELEMETRY_NOTICE_VERSION: &str = "8";
pub const TELEMETRY_NOTICE_VERSION: &str = "6";
/// Canonical setup step ids. The ordering matches the first-run spine so a
/// `BTreeMap<SetupStep, _>` renders in wizard order.
-1
View File
@@ -11793,7 +11793,6 @@ fn record_model_turn_telemetry(
{
return;
}
let model = turn.last_parent_model.as_deref().unwrap_or(model);
let outcome = match status {
TurnOutcomeStatus::Completed => codewhale_telemetry::TurnOutcome::Ok,
TurnOutcomeStatus::Failed => codewhale_telemetry::TurnOutcome::Failed,
-1
View File
@@ -73,7 +73,6 @@ include!("tests/test_cases_18.rs");
include!("tests/test_cases_19.rs");
mod admission_gates;
mod model_turn_telemetry;
mod redacted_thinking;
mod runtime_state;
mod sse_turn_recovery;
@@ -1,31 +0,0 @@
use super::*;
#[test]
fn model_turn_telemetry_names_the_model_the_last_request_used() {
let mut turn = crate::core::turn::TurnContext::new(4);
turn.add_parent_usage(&Usage {
input_tokens: 10,
output_tokens: 5,
..Usage::default()
});
turn.note_parent_model("deepseek-v4pro");
record_model_turn_telemetry(
codewhale_config::ProviderKind::Deepseek,
"auto",
&turn,
TurnOutcomeStatus::Completed,
);
let reported = codewhale_telemetry::session_counters()
.usage_events()
.into_iter()
.any(|event| {
matches!(
event,
codewhale_telemetry::Event::ModelUsage { provider, model, .. }
if provider == "deepseek" && model == "deepseek-v4-pro"
)
});
assert!(reported, "the resolved wire model, not `auto`, is reported");
}
@@ -641,7 +641,6 @@ impl Engine {
job.response_settled(!response_stream_failed);
}
turn.add_parent_usage(&usage);
turn.note_parent_model(&stream_request.model);
turn.note_parent_prompt_len(
self.session.messages.len(),
crate::compaction::estimate_request_input_tokens(
-8
View File
@@ -93,9 +93,6 @@ pub struct TurnContext {
/// their own routed receipts.
pub parent_route_usage: Usage,
/// Model the most recent parent-route request was dispatched with.
pub last_parent_model: Option<String>,
/// Provider calls whose usage became ambiguous after dispatch (for
/// example an RLM timeout). A non-zero value makes cost coverage
/// explicitly incomplete instead of inventing a zero-usage receipt.
@@ -202,7 +199,6 @@ impl TurnContext {
..Usage::default()
},
parent_route_usage: Usage::default(),
last_parent_model: None,
routed_usage_dropped_records: 0,
latest_parent_input_tokens: None,
messages_len_at_last_parent_prompt: None,
@@ -279,10 +275,6 @@ impl TurnContext {
add_usage_to(&mut self.parent_route_usage, usage);
}
pub fn note_parent_model(&mut self, model: &str) {
self.last_parent_model = Some(model.to_string());
}
pub fn add_routed_usage_dropped_records(&mut self, dropped_records: u64) {
self.routed_usage_dropped_records = self
.routed_usage_dropped_records
+23 -7
View File
@@ -244,22 +244,38 @@ pub async fn capture(
if let Some(snapshot) = supplied {
return snapshot.render().map(Some);
}
// Unit tests never read an operator's account credentials. Transport tests
// exercise load_from with an explicitly isolated store instead.
#[cfg(not(any(test, feature = "test-support")))]
if let Some(snapshot) = load(profile).await? {
return snapshot.render().map(Some);
}
#[cfg(any(test, feature = "test-support"))]
{
let _ = profile;
if let Some(message) = TEST_ACCOUNT_LOAD_FAILURE.get() {
anyhow::bail!(message);
}
if !account_api_base_is_loopback() {
return Ok(crate::prompts::load_user_constitution_block());
}
}
if let Some(snapshot) = load(profile).await? {
return snapshot.render().map(Some);
}
Ok(crate::prompts::load_user_constitution_block())
}
#[cfg(any(test, feature = "test-support"))]
fn account_api_base_is_loopback() -> bool {
std::env::var(codewhale_secrets::account::ACCOUNT_API_BASE_ENV)
.ok()
.and_then(|value| normalize_runtime_account_api_base(&value))
.and_then(|base| reqwest::Url::parse(&base).ok())
.and_then(|url| url.host_str().map(str::to_owned))
.is_some_and(|host| {
host.eq_ignore_ascii_case("localhost")
|| host
.trim_start_matches('[')
.trim_end_matches(']')
.parse::<std::net::IpAddr>()
.is_ok_and(|address| address.is_loopback())
})
}
#[cfg(any(test, feature = "test-support"))]
thread_local! {
static TEST_ACCOUNT_LOAD_FAILURE: std::cell::Cell<Option<&'static str>> =
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "actiu",
"ExtensionPromptUnavailable": "Les instruccions de les extensions no estan disponibles; consulta /plugin show.",
"ProfileConstitutionUnavailableLocal": "No s'han pogut carregar les preferències del compte de Codewhale; aquest torn fa servir la configuració local. La clau del proveïdor continua funcionant; executa codewhale login per recuperar les preferències del compte.",
"AccountPreferencesNotLoaded": "Compte no carregat. Executa {command}. La clau del proveïdor continua funcionant.",
"ComposerOversizedSubmitHeld": "No s’ha enviat: el missatge supera els {limit} caràcters i no s’ha pogut desar en un fitxer de text enganxat ({error}). El text complet continua al camp d’entrada: escurça’l o habilita l’escriptura a .codewhale/pastes i torna a prémer Enter.",
"ComposerOversizedSubmitHeldShort": "No s’ha enviat: supera els {limit} caràcters; no s’ha desat el fitxer d’enganxat.",
"CmdPluginOwnerReport": "Amfitrió d’extensions:\n Estat: {state}\n Eines actives ({count}): {tools}",
@@ -1667,7 +1668,7 @@
"PhaseIdle": "inactiu",
"PhaseDraft": "esborrany",
"PhaseWorking": "treballant",
"PhaseReasoning": "raonant",
"PhaseReasoning": "pensant",
"PhaseReading": "llegint",
"PhaseUsingTool": "usant una eina",
"PhaseSubagents": "subagents en execució",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "aktiv",
"ExtensionPromptUnavailable": "Anweisungen von Erweiterungen sind nicht verfügbar; prüfe /plugin show.",
"ProfileConstitutionUnavailableLocal": "Die Codewhale-Kontoeinstellungen konnten nicht geladen werden; dieser Durchlauf nutzt deine lokalen Einstellungen. Dein Anbieter-Schlüssel funktioniert weiter; führe codewhale login aus, um die Kontoeinstellungen wiederherzustellen.",
"AccountPreferencesNotLoaded": "Konto nicht geladen. Führe {command} aus. Dein Anbieter-Schlüssel funktioniert weiter.",
"ComposerOversizedSubmitHeld": "Nicht gesendet: Diese Nachricht enthält mehr als {limit} Zeichen und konnte nicht als Einfügedatei gespeichert werden ({error}). Der vollständige Text steht noch im Eingabefeld: Kürze ihn oder mache .codewhale/pastes beschreibbar und drücke dann erneut Enter.",
"ComposerOversizedSubmitHeldShort": "Nicht gesendet: über {limit} Zeichen; Einfügedatei nicht gespeichert.",
"CmdPluginOwnerReport": "Erweiterungshost:\n Status: {state}\n Aktive Werkzeuge ({count}): {tools}",
@@ -1667,7 +1668,7 @@
"PhaseIdle": "ruhend",
"PhaseDraft": "entwurf",
"PhaseWorking": "arbeitet",
"PhaseReasoning": "überlegt",
"PhaseReasoning": "denkt nach",
"PhaseReading": "liest",
"PhaseUsingTool": "nutzt Tool",
"PhaseSubagents": "Subagenten laufen",
+5 -4
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "live",
"ExtensionPromptUnavailable": "Extension instructions are unavailable; inspect /plugin show.",
"ProfileConstitutionUnavailableLocal": "Codewhale account preferences could not be loaded, so this turn uses your local settings. Your provider key still works; run codewhale login to restore account preferences.",
"AccountPreferencesNotLoaded": "Account not loaded. Run {command}. Your provider key still works.",
"ComposerOversizedSubmitHeld": "Not sent: this message is over {limit} characters and could not be saved as a paste file ({error}). The full text is still in the composer: shorten it, or make .codewhale/pastes writable, then press Enter again.",
"ComposerOversizedSubmitHeldShort": "Not sent: over {limit} characters; paste file not saved.",
"CmdPluginOwnerReport": "Extension host:\n State: {state}\n Live tools ({count}): {tools}",
@@ -226,10 +227,10 @@
"TranscriptReasoningExpand": "expand",
"TranscriptThought": "Thought",
"TranscriptThoughtFor": "Thought for {duration}",
"TelemetryNoticeDefaultOn": "Usage reporting is on by default. Share aggregate version/platform, session, feature and error counts with Codewhale and PostHog (processor). Also counts providers, public catalog models, token totals, request counts, model wait time, prompt-size ranges, built-in tool use, how an exec session started and a coarse install-age range. No content or IP. docs/TELEMETRY.md Turn off: codewhale config set telemetry false",
"TelemetryNoticeDefaultOn": "Usage reporting is on by default. Share aggregate version/platform, session, feature and error counts with Codewhale and PostHog (processor). Also counts providers, public catalog models, token totals and built-in tool use. No content or IP. docs/TELEMETRY.md Turn off: codewhale config set telemetry false",
"TelemetryNoticeHeadline": "Codewhale usage reporting",
"TelemetryNoticeBody": "Codewhale counts: which version you run, OS and CPU family, session\nduration and outcome, and aggregate feature and error counters.\n\nIt also counts the providers and public catalog models you use, their\ntoken totals, request counts, time spent waiting on the model and\nprompt-size ranges, how often each built-in tool runs, how an exec\nsession was started, and a coarse install-age range.\n\nIt never collects your conversations, code, prompts, files, repo or\nbranch names, model content, or credentials — and it never sends a\nper-turn or per-tool timeline of agent activity.\n\nYou are identified only by a random ID stored on this machine, replaced\nevery 90 days. Change your mind any time:\n codewhale config set telemetry false\n\nFull schema, field by field: docs/TELEMETRY.md\n\nUsage reporting is on by default. Codewhale and PostHog process these counts when delivery is configured. No IP is collected.",
"TelemetryNoticeCompactBody": "Counts: version, OS/CPU, session\ntime/result, feature/error totals.\nAlso: provider/model, tokens, tools,\nrequests, wait time, prompt-size and\ninstall-age ranges, exec start.\nRandom local ID rotates every 90d.\nNever: chat/code/prompts/files/names;\nmodel content/credentials; turn/tools.\nSchema: docs/TELEMETRY.md\nOff: codewhale config set telemetry\nfalse\nUsage reporting is on by default. Codewhale and PostHog process these counts when delivery is configured. No IP is collected.",
"TelemetryNoticeBody": "Codewhale counts: which version you run, OS and CPU family, session\nduration and outcome, and aggregate feature and error counters.\n\nIt also counts the providers and public catalog models you use, their\ntoken totals, and how often each built-in tool runs.\n\nIt never collects your conversations, code, prompts, files, repo or\nbranch names, model content, or credentials — and it never sends a\nper-turn or per-tool timeline of agent activity.\n\nYou are identified only by a random ID stored on this machine, replaced\nevery 90 days. Change your mind any time:\n codewhale config set telemetry false\n\nFull schema, field by field: docs/TELEMETRY.md\n\nUsage reporting is on by default. Codewhale and PostHog process these counts when delivery is configured. No IP is collected.",
"TelemetryNoticeCompactBody": "Counts: version, OS/CPU, session\ntime/result, feature/error totals.\nAlso: provider/model, tokens, tools.\nRandom local ID rotates every 90d.\nNever: chat/code/prompts/files/names;\nmodel content/credentials; turn/tools.\nSchema: docs/TELEMETRY.md\nOff: codewhale config set telemetry\nfalse\nUsage reporting is on by default. Codewhale and PostHog process these counts when delivery is configured. No IP is collected.",
"TelemetryNoticeChoiceKeep": "Yes, keep anonymous counts",
"TelemetryNoticeChoiceDisable": "No, turn off tracking",
"TelemetryNoticeActionChoose": "choose",
@@ -1690,7 +1691,7 @@
"PhaseIdle": "idle",
"PhaseDraft": "draft",
"PhaseWorking": "working",
"PhaseReasoning": "reasoning",
"PhaseReasoning": "thinking",
"PhaseReading": "reading",
"PhaseUsingTool": "using tool",
"PhaseSubagents": "agents underway",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "activo",
"ExtensionPromptUnavailable": "Las instrucciones de las extensiones no están disponibles; revisa /plugin show.",
"ProfileConstitutionUnavailableLocal": "No se pudieron cargar las preferencias de la cuenta de Codewhale; este turno usa tu configuración local. Tu clave del proveedor sigue funcionando; ejecuta codewhale login para restaurar las preferencias de la cuenta.",
"AccountPreferencesNotLoaded": "Cuenta no cargada. Ejecuta {command}. Tu clave del proveedor sigue funcionando.",
"ComposerOversizedSubmitHeld": "No se envió: este mensaje supera los {limit} caracteres y no se pudo guardar en un archivo de texto pegado ({error}). El texto completo sigue en el campo de entrada: acórtalo o habilita la escritura en .codewhale/pastes y vuelve a presionar Enter.",
"ComposerOversizedSubmitHeldShort": "No se envió: supera los {limit} caracteres; no se guardó el archivo pegado.",
"CmdPluginOwnerReport": "Host de extensiones:\n Estado: {state}\n Herramientas activas ({count}): {tools}",
@@ -1690,7 +1691,7 @@
"PhaseIdle": "inactivo",
"PhaseDraft": "borrador",
"PhaseWorking": "trabajando",
"PhaseReasoning": "razonando",
"PhaseReasoning": "pensando",
"PhaseReading": "leyendo",
"PhaseUsingTool": "usando herramienta",
"PhaseSubagents": "subagentes en curso",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "actif",
"ExtensionPromptUnavailable": "Les instructions des extensions sont indisponibles ; consultez /plugin show.",
"ProfileConstitutionUnavailableLocal": "Les préférences du compte Codewhale n'ont pas pu être chargées ; ce tour utilise vos réglages locaux. Votre clé de fournisseur fonctionne toujours ; lancez codewhale login pour rétablir les préférences du compte.",
"AccountPreferencesNotLoaded": "Compte non chargé. Lancez {command}. Votre clé de fournisseur fonctionne toujours.",
"ComposerOversizedSubmitHeld": "Non envoyé : ce message dépasse {limit} caractères et n’a pas pu être enregistré dans un fichier de texte collé ({error}). Le texte intégral reste dans la zone de saisie : raccourcissez-le ou autorisez l’écriture dans .codewhale/pastes, puis appuyez à nouveau sur Enter.",
"ComposerOversizedSubmitHeldShort": "Non envoyé : plus de {limit} caractères ; fichier collé non enregistré.",
"CmdPluginOwnerReport": "Hôte des extensions :\n État : {state}\n Outils actifs ({count}) : {tools}",
@@ -1667,7 +1668,7 @@
"PhaseIdle": "inactif",
"PhaseDraft": "brouillon",
"PhaseWorking": "travail en cours",
"PhaseReasoning": "raisonnement",
"PhaseReasoning": "réflexion",
"PhaseReading": "lecture",
"PhaseUsingTool": "utilisation d'outil",
"PhaseSubagents": "sous-agents en cours",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "सक्रिय",
"ExtensionPromptUnavailable": "एक्सटेंशन के निर्देश उपलब्ध नहीं हैं; /plugin show से जाँचें।",
"ProfileConstitutionUnavailableLocal": "Codewhale खाते की प्राथमिकताएँ लोड नहीं हो सकीं, इसलिए यह टर्न आपकी स्थानीय सेटिंग्स का उपयोग करता है। आपकी प्रदाता कुंजी काम करती रहेगी; खाते की प्राथमिकताएँ वापस लाने के लिए codewhale login चलाएँ।",
"AccountPreferencesNotLoaded": "खाता लोड नहीं हुआ। {command} चलाएँ। आपकी प्रदाता कुंजी काम करती रहेगी।",
"ComposerOversizedSubmitHeld": "नहीं भेजा गया: इस संदेश में {limit} से अधिक वर्ण हैं और इसे पेस्ट फ़ाइल के रूप में सहेजा नहीं जा सका ({error})। पूरा पाठ अभी भी इनपुट बॉक्स में है: इसे छोटा करें या .codewhale/pastes में लिखने की अनुमति दें, फिर Enter दबाएँ।",
"ComposerOversizedSubmitHeldShort": "नहीं भेजा गया: {limit} से अधिक वर्ण; पेस्ट फ़ाइल सहेजी नहीं गई।",
"CmdPluginOwnerReport": "एक्सटेंशन होस्ट:\n स्थिति: {state}\n सक्रिय टूल ({count}): {tools}",
@@ -1667,7 +1668,7 @@
"PhaseIdle": "निष्क्रिय",
"PhaseDraft": "मसौदा",
"PhaseWorking": "काम चल रहा",
"PhaseReasoning": "तर्क चल रहा",
"PhaseReasoning": "सोच रहा",
"PhaseReading": "पढ़ रहा",
"PhaseUsingTool": "टूल इस्तेमाल हो रहा",
"PhaseSubagents": "सबएजेंट चल रहे हैं",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "aktif",
"ExtensionPromptUnavailable": "Instruksi ekstensi tidak tersedia; periksa /plugin show.",
"ProfileConstitutionUnavailableLocal": "Preferensi akun Codewhale tidak dapat dimuat, jadi giliran ini memakai pengaturan lokal. Kunci penyedia tetap berfungsi; jalankan codewhale login untuk memulihkan preferensi akun.",
"AccountPreferencesNotLoaded": "Akun tidak dimuat. Jalankan {command}. Kunci penyedia tetap berfungsi.",
"ComposerOversizedSubmitHeld": "Belum terkirim: pesan ini melebihi {limit} karakter dan tidak dapat disimpan sebagai berkas teks tempelan ({error}). Teks lengkap masih ada di kolom input: persingkat teks atau izinkan penulisan ke .codewhale/pastes, lalu tekan Enter lagi.",
"ComposerOversizedSubmitHeldShort": "Belum terkirim: melebihi {limit} karakter; berkas tempelan tidak tersimpan.",
"CmdPluginOwnerReport": "Host ekstensi:\n Status: {state}\n Alat aktif ({count}): {tools}",
@@ -1667,7 +1668,7 @@
"PhaseIdle": "diam",
"PhaseDraft": "draf",
"PhaseWorking": "bekerja",
"PhaseReasoning": "menalar",
"PhaseReasoning": "berpikir",
"PhaseReading": "membaca",
"PhaseUsingTool": "memakai tool",
"PhaseSubagents": "subagen berjalan",
+1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "稼働中",
"ExtensionPromptUnavailable": "拡張機能の指示を利用できません。/plugin show で確認してください。",
"ProfileConstitutionUnavailableLocal": "Codewhale アカウントの設定を読み込めなかったため、このターンはローカル設定を使います。プロバイダーキーはそのまま使えます。アカウント設定を戻すには codewhale login を実行してください。",
"AccountPreferencesNotLoaded": "アカウントを読み込めませんでした。{command} を実行してください。プロバイダーキーはそのまま使えます。",
"ComposerOversizedSubmitHeld": "未送信:メッセージが {limit} 文字を超えており、貼り付けファイルに保存できませんでした({error})。全文は入力欄に残っています。短くするか .codewhale/pastes を書き込み可能にしてから、もう一度 Enter を押してください。",
"ComposerOversizedSubmitHeldShort": "未送信:{limit} 文字超。貼り付けファイルは未保存です。",
"CmdPluginOwnerReport": "拡張機能ホスト:\n 状態: {state}\n 有効なツール ({count}): {tools}",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "실행 중",
"ExtensionPromptUnavailable": "확장 기능의 지침을 사용할 수 없습니다. /plugin show에서 확인하세요.",
"ProfileConstitutionUnavailableLocal": "Codewhale 계정 설정을 불러오지 못해 이번 턴은 로컬 설정을 사용합니다. 공급자 키는 계속 사용할 수 있으며, 계정 설정을 복원하려면 codewhale login을 실행하세요.",
"AccountPreferencesNotLoaded": "계정을 불러오지 못했습니다. {command}을 실행하세요. 공급자 키는 계속 사용할 수 있습니다.",
"ComposerOversizedSubmitHeld": "전송하지 못했습니다. 메시지가 {limit}자를 초과하며 붙여넣기 파일로 저장할 수 없습니다({error}). 전체 텍스트는 입력란에 그대로 있습니다. 내용을 줄이거나 .codewhale/pastes에 쓰기 권한을 부여한 뒤 Enter를 다시 누르세요.",
"ComposerOversizedSubmitHeldShort": "전송 안 됨: {limit}자 초과, 붙여넣기 파일 저장 실패.",
"CmdPluginOwnerReport": "확장 호스트:\n 상태: {state}\n 활성 도구 ({count}): {tools}",
@@ -1690,7 +1691,7 @@
"PhaseIdle": "유휴",
"PhaseDraft": "초안",
"PhaseWorking": "작업 중",
"PhaseReasoning": "추론 중",
"PhaseReasoning": "생각 중",
"PhaseReading": "읽는 중",
"PhaseUsingTool": "도구 사용 중",
"PhaseSubagents": "서브에이전트 실행 중",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "ativo",
"ExtensionPromptUnavailable": "As instruções das extensões não estão disponíveis; confira /plugin show.",
"ProfileConstitutionUnavailableLocal": "Não foi possível carregar as preferências da conta Codewhale; este turno usa suas configurações locais. Sua chave do provedor continua funcionando; execute codewhale login para restaurar as preferências da conta.",
"AccountPreferencesNotLoaded": "Conta não carregada. Execute {command}. Sua chave do provedor continua funcionando.",
"ComposerOversizedSubmitHeld": "Não enviado: esta mensagem excede {limit} caracteres e não pôde ser salva em um arquivo de texto colado ({error}). O texto completo continua no campo de entrada: reduza-o ou permita a gravação em .codewhale/pastes e pressione Enter novamente.",
"ComposerOversizedSubmitHeldShort": "Não enviado: acima de {limit} caracteres; arquivo colado não salvo.",
"CmdPluginOwnerReport": "Host de extensões:\n Estado: {state}\n Ferramentas ativas ({count}): {tools}",
@@ -1690,7 +1691,7 @@
"PhaseIdle": "ocioso",
"PhaseDraft": "rascunho",
"PhaseWorking": "trabalhando",
"PhaseReasoning": "raciocinando",
"PhaseReasoning": "pensando",
"PhaseReading": "lendo",
"PhaseUsingTool": "usando ferramenta",
"PhaseSubagents": "subagentes em andamento",
+1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "активен",
"ExtensionPromptUnavailable": "Инструкции расширений недоступны; проверьте /plugin show.",
"ProfileConstitutionUnavailableLocal": "Не удалось загрузить настройки аккаунта Codewhale, поэтому этот ход использует локальные настройки. Ключ провайдера продолжает работать; выполните codewhale login, чтобы вернуть настройки аккаунта.",
"AccountPreferencesNotLoaded": "Аккаунт не загружен. Выполните {command}. Ключ провайдера продолжает работать.",
"ComposerOversizedSubmitHeld": "Не отправлено: сообщение длиннее {limit} символов, и его не удалось сохранить в файл вставленного текста ({error}). Полный текст остался в поле ввода: сократите его или разрешите запись в .codewhale/pastes, затем снова нажмите Enter.",
"ComposerOversizedSubmitHeldShort": "Не отправлено: больше {limit} символов; файл вставки не сохранён.",
"CmdPluginOwnerReport": "Хост расширений:\n Состояние: {state}\n Активные инструменты ({count}): {tools}",
+1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "активний",
"ExtensionPromptUnavailable": "Інструкції розширень недоступні; перевірте /plugin show.",
"ProfileConstitutionUnavailableLocal": "Не вдалося завантажити налаштування облікового запису Codewhale, тому цей хід використовує локальні налаштування. Ключ провайдера й далі працює; виконайте codewhale login, щоб повернути налаштування облікового запису.",
"AccountPreferencesNotLoaded": "Обліковий запис не завантажено. Виконайте {command}. Ключ провайдера й далі працює.",
"ComposerOversizedSubmitHeld": "Не надіслано: повідомлення перевищує {limit} символів, і його не вдалося зберегти у файл вставленого тексту ({error}). Повний текст залишається в полі введення: скоротіть його або дозвольте запис у .codewhale/pastes, а потім знову натисніть Enter.",
"ComposerOversizedSubmitHeldShort": "Не надіслано: понад {limit} символів; файл вставки не збережено.",
"CmdPluginOwnerReport": "Хост розширень:\n Стан: {state}\n Активні інструменти ({count}): {tools}",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "đang chạy",
"ExtensionPromptUnavailable": "Không thể tải hướng dẫn của tiện ích mở rộng; kiểm tra /plugin show.",
"ProfileConstitutionUnavailableLocal": "Không thể tải tùy chọn tài khoản Codewhale nên lượt này dùng cài đặt cục bộ. Khóa nhà cung cấp của bạn vẫn hoạt động; chạy codewhale login để khôi phục tùy chọn tài khoản.",
"AccountPreferencesNotLoaded": "Chưa tải được tài khoản. Chạy {command}. Khóa nhà cung cấp của bạn vẫn hoạt động.",
"ComposerOversizedSubmitHeld": "Chưa gửi: tin nhắn vượt quá {limit} ký tự và không thể lưu thành tệp văn bản đã dán ({error}). Toàn bộ nội dung vẫn còn trong ô nhập: hãy rút ngắn hoặc cho phép ghi vào .codewhale/pastes, rồi nhấn Enter lần nữa.",
"ComposerOversizedSubmitHeldShort": "Chưa gửi: vượt quá {limit} ký tự; chưa lưu tệp dán.",
"CmdPluginOwnerReport": "Máy chủ tiện ích mở rộng:\n Trạng thái: {state}\n Công cụ đang hoạt động ({count}): {tools}",
@@ -1690,7 +1691,7 @@
"PhaseIdle": "rảnh",
"PhaseDraft": "nháp",
"PhaseWorking": "đang xử lý",
"PhaseReasoning": "đang suy luận",
"PhaseReasoning": "đang suy nghĩ",
"PhaseReading": "đang đọc",
"PhaseUsingTool": "đang dùng công cụ",
"PhaseSubagents": "đang chạy tác tử con",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "运行中",
"ExtensionPromptUnavailable": "扩展指令不可用;请通过 /plugin show 查看。",
"ProfileConstitutionUnavailableLocal": "无法加载 Codewhale 账号偏好,本轮改用本地设置。你的提供商密钥仍可正常使用;运行 codewhale login 可恢复账号偏好。",
"AccountPreferencesNotLoaded": "账号未加载。请运行 {command}。你的提供商密钥仍可正常使用。",
"ComposerOversizedSubmitHeld": "未发送:消息超过 {limit} 个字符,无法保存为粘贴文本文件({error})。完整文本仍保留在输入框中:请缩短内容,或允许写入 .codewhale/pastes,然后再次按 Enter。",
"ComposerOversizedSubmitHeldShort": "未发送:超过 {limit} 个字符;粘贴文件未保存。",
"CmdPluginOwnerReport": "扩展宿主:\n 状态:{state}\n 活动工具({count}):{tools}",
@@ -1690,7 +1691,7 @@
"PhaseIdle": "空闲",
"PhaseDraft": "草稿",
"PhaseWorking": "工作中",
"PhaseReasoning": "推理中",
"PhaseReasoning": "思考中",
"PhaseReading": "读取中",
"PhaseUsingTool": "使用工具中",
"PhaseSubagents": "智能体工作中",
+2 -1
View File
@@ -25,6 +25,7 @@
"TerminalDockLive": "執行中",
"ExtensionPromptUnavailable": "擴充功能指令無法使用;請透過 /plugin show 查看。",
"ProfileConstitutionUnavailableLocal": "無法載入 Codewhale 帳號偏好,本輪改用本機設定。你的服務商金鑰仍可正常使用;執行 codewhale login 可恢復帳號偏好。",
"AccountPreferencesNotLoaded": "帳號未載入。請執行 {command}。你的服務商金鑰仍可正常使用。",
"ComposerOversizedSubmitHeld": "未傳送:訊息超過 {limit} 個字元,無法儲存為貼上文字檔案({error})。完整文字仍保留在輸入框中:請縮短內容,或允許寫入 .codewhale/pastes,然後再次按 Enter。",
"ComposerOversizedSubmitHeldShort": "未傳送:超過 {limit} 個字元;貼上檔案未儲存。",
"CmdPluginOwnerReport": "擴充功能主機:\n 狀態:{state}\n 活動工具({count}):{tools}",
@@ -1688,7 +1689,7 @@
"PhaseIdle": "閒置",
"PhaseDraft": "草稿",
"PhaseWorking": "工作中",
"PhaseReasoning": "推理中",
"PhaseReasoning": "思考中",
"PhaseReading": "讀取中",
"PhaseUsingTool": "使用工具中",
"PhaseSubagents": "代理程式工作中",
+2
View File
@@ -714,6 +714,7 @@ pub enum MessageId {
ExtensionsInventorySkills,
ExtensionPromptUnavailable,
ProfileConstitutionUnavailableLocal,
AccountPreferencesNotLoaded,
ExtensionsMarketplaceDetail,
ExtensionsMarketplaceUnavailable,
ExtensionsMcpEmpty,
@@ -3651,6 +3652,7 @@ pub const ALL_MESSAGE_IDS: &[MessageId] = &[
MessageId::ExtensionsInventorySkills,
MessageId::ExtensionPromptUnavailable,
MessageId::ProfileConstitutionUnavailableLocal,
MessageId::AccountPreferencesNotLoaded,
MessageId::ExtensionsMarketplaceDetail,
MessageId::ExtensionsMarketplaceUnavailable,
MessageId::ExtensionsMcpEmpty,
+37 -6
View File
@@ -492,6 +492,8 @@ pub struct Settings {
/// One-time Operate-retirement toast has been shown. Same suppression
/// contract as `yolo_deprecation_shown`.
pub operate_deprecation_shown: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub account_preferences_notice_shown: Option<String>,
/// Round 3 (2026-09-01) moved the work bar under the composer. Every
/// settings.toml saved before that carries `work_surface_placement =
/// "top"` — the old default, persisted verbatim by ordinary saves, not a
@@ -650,9 +652,7 @@ impl Default for Settings {
mention_menu_limit: 128,
mention_walk_depth: 10,
mention_menu_behavior: "fuzzy".to_string(),
// Reasoning is useful when explicitly requested, but it should
// never displace the actual conversation in the default TUI.
show_thinking: false,
show_thinking: true,
thinking_default_expanded: false,
thinking_preview_lines: default_thinking_preview_lines(),
thinking_highlight: true,
@@ -694,6 +694,7 @@ impl Default for Settings {
feature_intro_shown: false,
yolo_deprecation_shown: false,
operate_deprecation_shown: false,
account_preferences_notice_shown: None,
legacy_operate_default: false,
work_surface_bottom_migrated: false,
behavioral_tip_impressions: std::collections::BTreeMap::new(),
@@ -3747,6 +3748,36 @@ mod tests {
assert_eq!(reloaded.permission_posture.as_deref(), Some("ask"));
}
#[test]
fn thinking_shows_by_default_and_a_saved_choice_survives_reload_and_other_saves() {
let _g = config_path_test_guard();
let tmp = tempfile::tempdir().expect("tempdir");
let settings_path = tmp.path().join("settings.toml");
let _config_override =
EnvVarRestore::set("DEEPSEEK_CONFIG_PATH", tmp.path().join("config.toml"));
let absent = Settings::load().expect("load without a settings file");
assert!(absent.show_thinking);
assert!(!absent.thinking_default_expanded);
assert!(!absent.is_set("show_thinking"));
std::fs::write(&settings_path, "theme = \"light\"\n").expect("settings without the key");
let unnamed = Settings::load().expect("load settings without the key");
assert!(unnamed.show_thinking);
assert!(!unnamed.is_set("show_thinking"));
for saved in [false, true] {
std::fs::write(&settings_path, format!("show_thinking = {saved}\n"))
.expect("saved choice");
let loaded = Settings::load().expect("load the saved choice");
assert_eq!(loaded.show_thinking, saved);
assert!(loaded.is_set("show_thinking"));
Settings::transact(|settings| settings.set("locale", "en")).expect("another save");
let reloaded = Settings::load().expect("reload after another save");
assert_eq!(reloaded.show_thinking, saved);
}
}
#[test]
fn settings_load_keeps_top_placement_chosen_after_the_bottom_migration() {
let _g = config_path_test_guard();
@@ -3886,7 +3917,7 @@ mod tests {
let mut settings = Settings::default();
// Density is calm by default; motion is an independent axis.
assert!(settings.calm_mode);
assert!(!settings.show_thinking);
settings.show_thinking = false;
let changed = settings.apply_preset("CALM").expect("calm preset applies");
assert_eq!(
@@ -3916,8 +3947,8 @@ mod tests {
assert!(settings.fancy_animations);
assert_eq!(settings.transcript_spacing, "spacious");
assert_eq!(settings.tool_collapse_mode, "compact");
// Thinking is opt-in so the transcript stays focused on the chat.
assert!(!settings.show_thinking);
assert!(settings.show_thinking);
assert!(!settings.thinking_default_expanded);
}
#[test]
-1
View File
@@ -344,7 +344,6 @@ mod tests {
};
handle.record(Event::SessionStart {
source: crate::SessionSource::Unknown,
install_age: None,
});
let waiter = std::thread::spawn(move || handle.persist_local());
assert!(matches!(rx.try_recv(), Ok(Message::Event(_))));
+1 -4
View File
@@ -10,7 +10,7 @@
use std::sync::Mutex;
use std::sync::atomic::{AtomicU32, Ordering};
use crate::event::{ContextSize, Counters, Errors, Event, ModelCounters, TurnWall};
use crate::event::{Counters, Errors, Event, ModelCounters, TurnWall};
/// One session's accumulated counts.
#[derive(Debug, Default)]
@@ -48,7 +48,6 @@ struct ModelSlot {
model: String,
counters: ModelCounters,
turn_wall: TurnWall,
context: ContextSize,
}
/// At most this many distinct provider and model pairs per session; later
@@ -187,7 +186,6 @@ impl SessionCounters {
model,
counters: ModelCounters::default(),
turn_wall: TurnWall::default(),
context: ContextSize::default(),
});
models.len() - 1
}
@@ -240,7 +238,6 @@ impl SessionCounters {
model: slot.model.clone(),
counters: slot.counters,
turn_wall: slot.turn_wall,
context: slot.context,
}));
}
if let Ok(tools) = self.tools.lock() {
+1 -72
View File
@@ -6,7 +6,7 @@ use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use crate::buffer;
use crate::event::{Arch, InstallAge, Libc, Os};
use crate::event::{Arch, Libc, Os};
/// How long an install id may live before it is replaced.
///
@@ -47,77 +47,6 @@ pub struct TelemetryState {
/// a permanently offline machine tries at most once per interval.
#[serde(default)]
pub last_flush: Option<String>,
/// The UTC day (`YYYY-MM-DD`) this state was first created. Local only: it
/// is read to pick an [`InstallAge`] bucket and is never sent.
#[serde(default)]
pub first_seen_day: Option<String>,
/// Set when this file predates `first_seen_day`, so its age is unknown and
/// is reported as the oldest bucket rather than as new.
#[serde(default)]
pub first_seen_unknown: bool,
}
enum StateRead {
Missing,
Unreadable,
Present(TelemetryState),
}
fn read_state_checked(root: &Path) -> StateRead {
match std::fs::read_to_string(buffer::state_path(root)) {
Ok(body) => serde_json::from_str::<TelemetryState>(&body)
.map_or(StateRead::Unreadable, StateRead::Present),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => StateRead::Missing,
Err(_) => StateRead::Unreadable,
}
}
/// Today's date in UTC.
#[must_use]
pub fn utc_today() -> chrono::NaiveDate {
chrono::Utc::now().date_naive()
}
/// Record the first-seen day if this state has none. A missing state file is a
/// new install; a file that has a recorded version but no day predates this
/// field and is marked unknown. An unreadable file is left untouched.
pub(crate) fn stamp_first_seen(root: &Path, today: chrono::NaiveDate) {
let mut state = match read_state_checked(root) {
StateRead::Unreadable => return,
StateRead::Missing => TelemetryState::default(),
StateRead::Present(state) => state,
};
if state.first_seen_day.is_some() || state.first_seen_unknown {
return;
}
if state.last_version.is_some() {
state.first_seen_unknown = true;
} else {
state.first_seen_day = Some(today.format("%Y-%m-%d").to_string());
}
let _ = write_state(root, &state);
}
/// The coarse age bucket for this installation, or `None` when the local state
/// cannot be read. A missing state is new.
pub(crate) fn install_age_at(root: &Path, today: chrono::NaiveDate) -> Option<InstallAge> {
let state = match read_state_checked(root) {
StateRead::Unreadable => return None,
StateRead::Missing => return Some(InstallAge::NewToday),
StateRead::Present(state) => state,
};
if state.first_seen_unknown {
return Some(InstallAge::Older);
}
let Some(day) = state.first_seen_day else {
return Some(InstallAge::NewToday);
};
let first = chrono::NaiveDate::parse_from_str(&day, "%Y-%m-%d").ok()?;
Some(match today.signed_duration_since(first).num_days() {
..=0 => InstallAge::NewToday,
1..=6 => InstallAge::UnderWeek,
_ => InstallAge::Older,
})
}
/// Read the install id, minting a fresh one if it is missing, unreadable,
+26 -122
View File
@@ -33,10 +33,10 @@ use serde::{Deserialize, Serialize};
/// Wire schema version. Bumped on any field add, remove, or retype; never
/// reused. `crates/telemetry/tests/golden/v1.json` pins what v1 was.
pub const SCHEMA_VERSION: u32 = 6;
pub const SCHEMA_VERSION: u32 = 4;
/// Default-on policy disclosure version. This is not human consent.
pub const NOTICE_VERSION: u32 = 8;
pub const NOTICE_VERSION: u32 = 6;
/// Which product surface produced a batch.
///
@@ -277,12 +277,6 @@ pub enum SessionSource {
/// Started under CI (`CI` or `GITHUB_ACTIONS` set), including the GitHub
/// Action, so automation is never counted as a person.
Ci,
/// `exec` started by Codewhale's own fleet dispatcher.
FleetWorker,
/// `exec` started from inside an agent's shell command.
Agent,
/// `exec` whose stdin or stdout is not a terminal.
Scripted,
}
impl SessionSource {
@@ -294,9 +288,6 @@ impl SessionSource {
Self::Api,
Self::Unknown,
Self::Ci,
Self::FleetWorker,
Self::Agent,
Self::Scripted,
];
/// The wire spelling.
@@ -309,37 +300,6 @@ impl SessionSource {
Self::Api => "api",
Self::Unknown => "unknown",
Self::Ci => "ci",
Self::FleetWorker => "fleet_worker",
Self::Agent => "agent",
Self::Scripted => "scripted",
}
}
}
/// How long this install has existed, as a coarse bucket. The first-seen date
/// itself never leaves the device.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum InstallAge {
/// First seen on the current UTC day.
NewToday,
/// First seen 1 to 6 UTC days ago.
UnderWeek,
/// First seen 7 or more UTC days ago, or before the date was recorded.
Older,
}
impl InstallAge {
/// Every value, for exhaustive iteration.
pub const ALL: &'static [Self] = &[Self::NewToday, Self::UnderWeek, Self::Older];
/// The wire spelling.
#[must_use]
pub fn as_str(self) -> &'static str {
match self {
Self::NewToday => "new_today",
Self::UnderWeek => "under_week",
Self::Older => "older",
}
}
}
@@ -406,20 +366,11 @@ pub enum ExitClass {
Panic,
/// Exited non-successfully without a signal or a panic.
Error,
/// The process ended without its shutdown report; its aggregates were
/// recovered from a local checkpoint at a later start.
Unclean,
}
impl ExitClass {
/// Every value, for exhaustive iteration.
pub const ALL: &'static [Self] = &[
Self::Clean,
Self::Signal,
Self::Panic,
Self::Error,
Self::Unclean,
];
pub const ALL: &'static [Self] = &[Self::Clean, Self::Signal, Self::Panic, Self::Error];
/// The wire spelling.
#[must_use]
@@ -429,7 +380,6 @@ impl ExitClass {
Self::Signal => "signal",
Self::Panic => "panic",
Self::Error => "error",
Self::Unclean => "unclean",
}
}
@@ -441,7 +391,6 @@ impl ExitClass {
Self::Signal => 1,
Self::Panic => 2,
Self::Error => 3,
Self::Unclean => 4,
}
}
@@ -452,7 +401,6 @@ impl ExitClass {
1 => Self::Signal,
2 => Self::Panic,
3 => Self::Error,
4 => Self::Unclean,
_ => Self::Clean,
}
}
@@ -691,9 +639,6 @@ pub enum Event {
SessionStart {
/// How it was started.
source: SessionSource,
/// Coarse install age. `null` when the local state cannot be read.
#[serde(default)]
install_age: Option<InstallAge>,
},
/// A session ended. Everything the session accumulated ships here, once.
SessionEnd {
@@ -751,9 +696,6 @@ pub enum Event {
counters: ModelCounters,
/// Turn wall-clock buckets for these turns.
turn_wall: TurnWall,
/// Requests by input size.
#[serde(default)]
context: ContextSize,
},
/// One session's calls of one tool.
ToolUsage {
@@ -783,16 +725,6 @@ pub struct ModelCounters {
pub cache_read_tokens: u64,
/// Input tokens written to the provider's prompt cache.
pub cache_write_tokens: u64,
/// Provider requests on the session's own route for this model.
#[serde(default)]
pub requests: u32,
/// Reasoning tokens as the provider reports them; a subset of
/// `output_tokens`, which is not reduced.
#[serde(default)]
pub reasoning_tokens: u64,
/// Whole seconds spent waiting on the model, summed over the session.
#[serde(default)]
pub generation_secs: u32,
}
impl ModelCounters {
@@ -805,44 +737,9 @@ impl ModelCounters {
"output_tokens",
"cache_read_tokens",
"cache_write_tokens",
"requests",
"reasoning_tokens",
"generation_secs",
];
}
/// Per-session count of model requests by input size, in tokens including
/// cache reads. Half-open intervals; K is 1024. A histogram, never a
/// per-request series.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct ContextSize {
/// Requests with `[0, 32768)` input tokens.
pub lt_32k: u32,
/// Requests with `[32768, 131072)` input tokens.
#[serde(rename = "32k_128k")]
pub k32_to_k128: u32,
/// Requests with `[131072, 262144)` input tokens.
#[serde(rename = "128k_256k")]
pub k128_to_k256: u32,
/// Requests with 262144 or more input tokens.
pub gte_256k: u32,
}
impl ContextSize {
/// Field names in wire spelling, in declaration order.
pub const FIELDS: &'static [&'static str] = &["lt_32k", "32k_128k", "128k_256k", "gte_256k"];
/// Record one request with `tokens` input tokens.
pub fn observe(&mut self, tokens: u64) {
match tokens {
0..32_768 => self.lt_32k = self.lt_32k.saturating_add(1),
32_768..131_072 => self.k32_to_k128 = self.k32_to_k128.saturating_add(1),
131_072..262_144 => self.k128_to_k256 = self.k128_to_k256.saturating_add(1),
_ => self.gte_256k = self.gte_256k.saturating_add(1),
}
}
}
/// First-party tool names reported by `tool_usage`. Any other name is
/// reported as `mcp` or `other`, so a plugin's or server's tool name never
/// leaves the machine.
@@ -933,22 +830,17 @@ pub fn is_reported_tool_name(value: &str) -> bool {
value == "mcp" || value == "other" || TOOL_NAMES.contains(&value)
}
/// The `model` value for a model id: the lowercased canonical id when the
/// bundled model catalog lists it, otherwise `other`. Official aliases and
/// compatibility spellings are resolved first. Custom, local and fine-tuned
/// model names therefore never leave the machine.
/// The `model` value for a model id: the lowercased id when the bundled model
/// catalog lists it, otherwise `other`. Custom, local and fine-tuned model
/// names therefore never leave the machine.
#[must_use]
pub fn reported_model_id(model: &str) -> String {
use codewhale_config::catalog::reviewed::{compatibility_alias, official_deepseek_model_id};
let id = model.trim().to_ascii_lowercase();
let canonical = official_deepseek_model_id(&id)
.or_else(|| compatibility_alias("canonical_model_name", &id))
.map(str::to_ascii_lowercase);
canonical
.into_iter()
.chain(std::iter::once(id))
.find(|candidate| is_catalogued_model(candidate))
.unwrap_or_else(|| "other".to_string())
if is_catalogued_model(&id) {
id
} else {
"other".to_string()
}
}
/// Whether `value` may appear as `model_usage.model`.
@@ -958,9 +850,21 @@ pub fn is_reported_model_id(value: &str) -> bool {
}
fn is_catalogued_model(id: &str) -> bool {
!id.is_empty()
&& id.len() <= 128
&& codewhale_config::catalog::reviewed::public_model_identifier_ignore_case(id)
if id.is_empty() || id.len() > 128 {
return false;
}
let catalog = codewhale_config::catalog::bundled_models_dev_catalog();
catalog.reviewed.intrinsic.contains_key(id)
|| catalog
.models
.keys()
.any(|key| key.eq_ignore_ascii_case(id))
|| catalog.providers.values().any(|provider| {
provider
.models
.keys()
.any(|key| key.eq_ignore_ascii_case(id))
})
}
impl Event {
+3 -12
View File
@@ -57,9 +57,9 @@ pub use decision::{
};
pub use envelope::reduce_panic_site;
pub use event::{
Arch, Batch, ColdStartBucket, ContextSize, Counters, DurationBucket, Errors, Event, ExitClass,
InstallAge, InstallKind, Libc, ModelCounters, NOTICE_VERSION, Os, ProductCounters,
SCHEMA_VERSION, SessionSource, Surface, TurnWall,
Arch, Batch, ColdStartBucket, Counters, DurationBucket, Errors, Event, ExitClass, InstallKind,
Libc, ModelCounters, NOTICE_VERSION, Os, ProductCounters, SCHEMA_VERSION, SessionSource,
Surface, TurnWall,
};
/// How long the shutdown flush may hold the process.
@@ -123,18 +123,9 @@ pub fn init(consent: TelemetryConsent) {
exit_class: AtomicU8::new(ExitClass::Clean.as_u8()),
});
envelope::stamp_first_seen(&root, envelope::utc_today());
record_install_or_upgrade(&root);
}
/// The coarse install-age bucket for this process's `session_start`, or `None`
/// when unarmed or when the local state cannot be read.
#[must_use]
pub fn install_age() -> Option<InstallAge> {
let armed = ARMED.get()?;
envelope::install_age_at(&armed.root, envelope::utc_today())
}
/// Note that this binary's version differs from the one last seen on this
/// machine, at most once per version.
///
+2 -4
View File
@@ -25,9 +25,7 @@ Codewhale counts: which version you run, OS and CPU family, session
duration and outcome, and aggregate feature and error counters.
It also counts the providers and public catalog models you use, their
token totals, request counts, time spent waiting on the model and
prompt-size ranges, how often each built-in tool runs, how an exec
session was started, and a coarse install-age range.
token totals, and how often each built-in tool runs.
It never collects your conversations, code, prompts, files, repo or
branch names, model content, or credentials — and it never sends a
@@ -43,7 +41,7 @@ Usage reporting is on by default. Codewhale and PostHog process these
counts when delivery is configured. No IP is collected.";
/// Concise disclosure for every armed runtime surface, including headless CLI.
pub const STARTUP_DISCLOSURE: &str = "Usage reporting is on by default: Codewhale and PostHog process aggregate version/platform, session, feature, error, model/token/request/wait-time/prompt-size, exec-start, install-age range and built-in tool counts when delivery is configured. No content or IP. Turn off: codewhale config set telemetry false. Details: codewhale config telemetry";
pub const STARTUP_DISCLOSURE: &str = "Usage reporting is on by default: Codewhale and PostHog process aggregate version/platform, session, feature, error, model/token and built-in tool counts when delivery is configured. No content or IP. Turn off: codewhale config set telemetry false. Details: codewhale config telemetry";
/// Present the policy once per revision without recording human acceptance.
/// Failure to save the display marker only causes a later repeat disclosure.
+11 -322
View File
@@ -121,12 +121,11 @@ fn every_event() -> Vec<Event> {
previous_version: Some("0.9.3-rc.1".to_string()),
},
Event::SessionStart {
source: SessionSource::FleetWorker,
install_age: Some(InstallAge::UnderWeek),
source: SessionSource::Resume,
},
Event::SessionEnd {
duration_bucket: DurationBucket::OneToTen,
exit_class: ExitClass::Unclean,
exit_class: ExitClass::Panic,
cold_start_bucket: Some(ColdStartBucket::Mid),
providers: vec!["custom".to_string(), "deepseek".to_string()],
counters: Counters {
@@ -184,9 +183,6 @@ fn every_event() -> Vec<Event> {
output_tokens: 9_120,
cache_read_tokens: 380_001,
cache_write_tokens: 0,
requests: 27,
reasoning_tokens: 2_310,
generation_secs: 412,
},
turn_wall: TurnWall {
lt_5s: 3,
@@ -194,12 +190,6 @@ fn every_event() -> Vec<Event> {
thirty_to_onetwenty: 2,
gte_120s: 0,
},
context: ContextSize {
lt_32k: 9,
k32_to_k128: 11,
k128_to_k256: 5,
gte_256k: 2,
},
},
Event::ToolUsage {
tool: "read_file".to_string(),
@@ -279,7 +269,6 @@ fn closed_enum_values() -> Vec<String> {
values.extend(Libc::ALL.iter().map(|v| v.as_str().to_string()));
values.extend(InstallKind::ALL.iter().map(|v| v.as_str().to_string()));
values.extend(SessionSource::ALL.iter().map(|v| v.as_str().to_string()));
values.extend(InstallAge::ALL.iter().map(|v| v.as_str().to_string()));
values.extend(DurationBucket::ALL.iter().map(|v| v.as_str().to_string()));
values.extend(ExitClass::ALL.iter().map(|v| v.as_str().to_string()));
values.extend(ColdStartBucket::ALL.iter().map(|v| v.as_str().to_string()));
@@ -1237,7 +1226,6 @@ fn probe_threshold_cannot_hide_an_over_cap_buffer() {
// only safe if `MAX_EVENTS` lines cannot fit under it.
let shortest = serde_json::to_string(&Event::SessionStart {
source: SessionSource::Api,
install_age: None,
})
.expect("serialize");
let floor = (shortest.len() as u64 + 1) * buffer::MAX_EVENTS as u64;
@@ -1458,7 +1446,6 @@ fn record_blocking_is_a_noop_when_unarmed() {
});
crate::record(Event::SessionStart {
source: SessionSource::Interactive,
install_age: None,
});
crate::set_exit_class(ExitClass::Panic);
assert_eq!(crate::exit_class(), ExitClass::Clean);
@@ -1672,7 +1659,6 @@ fn no_public_api_accepts_a_bare_bool() {
const TELEMETRY_DOC: &str = include_str!("../../../docs/TELEMETRY.md");
const GOLDEN_V4: &str = include_str!("../tests/golden/v4.json");
const GOLDEN_V6: &str = include_str!("../tests/golden/v6.json");
/// Extract the fenced ```jsonc blocks from the schema doc, in order.
fn jsonc_blocks(doc: &str) -> Vec<String> {
@@ -1878,12 +1864,13 @@ fn event_field_names_match_documented_schema() {
}
#[test]
fn golden_payload_v6() {
fn golden_payload_v4() {
assert_eq!(NOTICE_VERSION.to_string(), TELEMETRY_NOTICE_VERSION);
// `crates/telemetry/tests/golden/v6.json` is one fully-populated instance of
// the envelope and every event, and the batch the collector's own tests
// post. Any field add, remove, or retype fails here until the developer
// re-blesses it under a bumped `SCHEMA_VERSION`.
// `crates/telemetry/tests/golden/v4.json` is one fully-populated instance of
// the envelope and every event. Any field add, remove, or retype fails here
// until the developer re-blesses it under a bumped `SCHEMA_VERSION` — and it
// is also the artifact a future receiver author reads to know exactly what
// v1 was.
//
// Re-bless with: `CODEWHALE_BLESS_TELEMETRY_GOLDEN=1 cargo test -p codewhale-telemetry`
let batch = every_field_batch();
@@ -1891,81 +1878,22 @@ fn golden_payload_v6() {
batch.schema_version, SCHEMA_VERSION,
"the fixture must be built at the current schema version"
);
assert_eq!(SCHEMA_VERSION, 6);
let mut rendered = serde_json::to_string_pretty(&batch).expect("serialize");
rendered.push('\n');
if std::env::var("CODEWHALE_BLESS_TELEMETRY_GOLDEN").is_ok() {
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/golden/v6.json");
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/golden/v4.json");
std::fs::create_dir_all(path.parent().expect("parent")).expect("create golden dir");
std::fs::write(&path, &rendered).expect("write golden");
return;
}
assert_eq!(
rendered, GOLDEN_V6,
"the v6 payload changed; bump SCHEMA_VERSION and re-bless the golden file"
rendered, GOLDEN_V4,
"the v4 payload changed; bump SCHEMA_VERSION and re-bless the golden file"
);
}
#[test]
fn the_schema_4_golden_still_reads_back_with_the_new_fields_defaulted() {
let legacy: Batch = serde_json::from_str(GOLDEN_V4).expect("v4 golden parses");
assert_eq!(legacy.schema_version, 4);
for event in &legacy.events {
match event {
Event::SessionStart { install_age, .. } => assert_eq!(*install_age, None),
Event::ModelUsage {
counters, context, ..
} => {
assert_eq!(counters.requests, 0);
assert_eq!(counters.reasoning_tokens, 0);
assert_eq!(counters.generation_secs, 0);
assert_eq!(*context, ContextSize::default());
}
_ => {}
}
}
}
#[test]
fn context_buckets_are_half_open_at_32k_128k_and_256k() {
let mut size = ContextSize::default();
for tokens in [
0,
32_767,
32_768,
131_071,
131_072,
262_143,
262_144,
u64::MAX,
] {
size.observe(tokens);
}
assert_eq!(
size,
ContextSize {
lt_32k: 2,
k32_to_k128: 2,
k128_to_k256: 2,
gte_256k: 2,
}
);
let json = serde_json::to_value(size).expect("serialize");
let keys: Vec<&str> = json
.as_object()
.expect("object")
.keys()
.map(String::as_str)
.collect();
let mut expected: Vec<&str> = ContextSize::FIELDS.to_vec();
expected.sort_unstable();
let mut got = keys;
got.sort_unstable();
assert_eq!(got, expected);
}
#[test]
fn version_comparison_names_install_upgrade_and_downgrade() {
assert!(crate::version_is_older("0.9.3", "0.9.4"));
@@ -2066,242 +1994,3 @@ fn the_notice_summarizes_what_the_schema_collects_and_states_every_red_line() {
assert!(!body.contains("CODEWHALE_TELEMETRY=0"));
assert!(body.contains("docs/TELEMETRY.md"));
}
// ------------------------------------------------------------- model naming --
fn model_id_is_collector_shaped(id: &str) -> bool {
let bytes = id.as_bytes();
(1..=128).contains(&bytes.len())
&& bytes[0].is_ascii_lowercase() | bytes[0].is_ascii_digit()
&& bytes[1..].iter().all(|b| {
b.is_ascii_lowercase()
|| b.is_ascii_digit()
|| matches!(b, b'.' | b'_' | b':' | b'/' | b'@' | b'+' | b'-')
})
}
#[test]
fn reported_model_id_resolves_aliases_and_spellings() {
assert_eq!(reported_model_id("deepseek-v4-pro"), "deepseek-v4-pro");
assert_eq!(reported_model_id(" DeepSeek-V4-Pro "), "deepseek-v4-pro");
assert_eq!(reported_model_id("deepseek-v4pro"), "deepseek-v4-pro");
assert_eq!(
reported_model_id("deepseek-ai/deepseek-v4-pro"),
"deepseek-v4-pro"
);
assert_eq!(
reported_model_id("deepseek/deepseek-v4pro"),
"deepseek-v4-pro"
);
assert_eq!(reported_model_id("pro"), "deepseek-v4-pro");
assert_eq!(reported_model_id("flash"), "deepseek-flash");
assert_eq!(reported_model_id("auto"), "other");
assert_eq!(reported_model_id("my-private-finetune"), "other");
assert_eq!(reported_model_id(""), "other");
}
#[test]
fn reported_model_id_never_leaves_the_catalog() {
use codewhale_config::catalog::reviewed::{
bundled_reviewed, public_model_identifier_ignore_case,
};
let reviewed = bundled_reviewed();
let mut spellings: Vec<&str> = reviewed
.official_deepseek_aliases
.keys()
.chain(reviewed.go_aliases.keys())
.map(String::as_str)
.collect();
if let Some(group) = reviewed.compatibility_aliases.get("canonical_model_name") {
spellings.extend(group.keys().map(String::as_str));
}
assert!(spellings.len() > 20, "alias tables look empty");
for spelling in spellings {
let reported = reported_model_id(spelling);
assert!(is_reported_model_id(&reported), "{spelling} -> {reported}");
assert!(
model_id_is_collector_shaped(&reported),
"{spelling} -> {reported}"
);
}
for hostile in ["", "x/../y", "deepseek-v4-pro\n", "Ünï", &"a".repeat(300)] {
let reported = reported_model_id(hostile);
assert!(
reported == "other" || public_model_identifier_ignore_case(&reported),
"{hostile:?} -> {reported}"
);
}
}
#[test]
fn every_listed_model_and_provider_default_maps_to_a_catalogued_id() {
let catalog = codewhale_config::catalog::bundled_models_dev_catalog();
let mut missing = Vec::new();
let mut check = |origin: &str, id: &str| {
let reported = reported_model_id(id);
if reported == "other" || !model_id_is_collector_shaped(&reported) {
missing.push(format!("{origin}: {id}"));
}
};
for provider in catalog.providers.values() {
for (id, row) in &provider.models {
check("catalog", id);
check("catalog row", &row.id);
}
}
for id in catalog.models.keys() {
check("canonical", id);
}
let descriptors: Value = serde_json::from_str(
&std::fs::read_to_string(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../config/assets/provider_descriptors.json"),
)
.expect("provider descriptors"),
)
.expect("descriptors json");
let exceptions: &[&str] = &["antigravity", "custom", "openai-compatible", "ollama"];
for provider in descriptors["providers"].as_array().expect("providers") {
let id = provider["id"].as_str().expect("provider id");
let selectable = provider["selectable"].as_bool().unwrap_or(false);
let default = provider["default_model"].as_str().unwrap_or_default();
if selectable && !default.is_empty() && !exceptions.contains(&id) {
check(&format!("default for {id}"), default);
}
}
assert!(
missing.is_empty(),
"ids the catalog does not name:\n{}",
missing.join("\n")
);
}
// -------------------------------------------------------------- install age --
fn day(text: &str) -> chrono::NaiveDate {
chrono::NaiveDate::parse_from_str(text, "%Y-%m-%d").expect("date")
}
fn root_with_state(state: &str) -> (tempfile::TempDir, PathBuf) {
let home = temp_home();
let root = root_of(&home);
buffer::ensure_dir(&root).expect("create telemetry dir");
std::fs::write(buffer::state_path(&root), state).expect("write state");
(home, root)
}
#[test]
fn a_fresh_home_is_new_today_and_ages_by_utc_day() {
let home = temp_home();
let root = root_of(&home);
buffer::ensure_dir(&root).expect("create telemetry dir");
assert_eq!(
envelope::install_age_at(&root, day("2026-11-13")),
Some(InstallAge::NewToday)
);
envelope::stamp_first_seen(&root, day("2026-11-13"));
for (today, expected) in [
("2026-11-13", InstallAge::NewToday),
("2026-11-14", InstallAge::UnderWeek),
("2026-11-16", InstallAge::UnderWeek),
("2026-11-19", InstallAge::UnderWeek),
("2026-11-20", InstallAge::Older),
("2027-06-01", InstallAge::Older),
("2026-11-12", InstallAge::NewToday),
] {
assert_eq!(
envelope::install_age_at(&root, day(today)),
Some(expected),
"{today}"
);
}
envelope::stamp_first_seen(&root, day("2026-12-25"));
assert_eq!(
envelope::read_state(&root).first_seen_day.as_deref(),
Some("2026-11-13"),
"a second stamp never moves the first-seen day"
);
}
#[test]
fn a_state_written_before_the_day_existed_reads_older_never_new() {
let (_home, root) = root_with_state(r#"{"schema_version":4,"last_version":"0.10.2"}"#);
envelope::stamp_first_seen(&root, day("2026-11-13"));
let state = envelope::read_state(&root);
assert_eq!(state.first_seen_day, None);
assert!(state.first_seen_unknown);
assert_eq!(state.last_version.as_deref(), Some("0.10.2"));
for today in ["2026-11-13", "2026-11-14", "2030-01-01"] {
assert_eq!(
envelope::install_age_at(&root, day(today)),
Some(InstallAge::Older),
"{today}"
);
}
}
#[test]
fn unreadable_or_hostile_state_gives_null_and_is_not_overwritten() {
for body in [
"not json",
r#"{"first_seen_day":"9999-99-99"}"#,
r#"{"first_seen_day":"yesterday"}"#,
] {
let (_home, root) = root_with_state(body);
envelope::stamp_first_seen(&root, day("2026-11-13"));
assert_eq!(
envelope::install_age_at(&root, day("2026-11-13")),
None,
"{body}"
);
assert_eq!(
std::fs::read_to_string(buffer::state_path(&root)).expect("state"),
body,
"{body}"
);
}
}
#[test]
fn opting_out_erases_the_age_and_rotating_the_install_id_keeps_it() {
let home = temp_home();
let root = root_of(&home);
buffer::ensure_dir(&root).expect("create telemetry dir");
envelope::stamp_first_seen(&root, day("2026-01-01"));
assert_eq!(
envelope::install_age_at(&root, day("2026-11-13")),
Some(InstallAge::Older)
);
std::fs::write(
buffer::install_id_path(&root),
r#"{"schema_version":1,"install_id":"3f2a9c1e-0000-4000-8000-000000000001","rotated_at":"2020-01-01T00:00:00Z"}"#,
)
.expect("write expired id");
let rotated = envelope::read_or_create_install_id(&root).expect("rotate");
assert_ne!(rotated.install_id, "3f2a9c1e-0000-4000-8000-000000000001");
assert_eq!(
envelope::read_state(&root).first_seen_day.as_deref(),
Some("2026-01-01"),
"rotation does not touch the age"
);
buffer::wipe(&root).expect("wipe");
std::fs::remove_file(buffer::tombstone_path(&root)).expect("re-enable");
assert_eq!(
envelope::install_age_at(&root, day("2026-11-13")),
Some(InstallAge::NewToday)
);
envelope::stamp_first_seen(&root, day("2026-11-13"));
assert_eq!(
envelope::read_state(&root).first_seen_day.as_deref(),
Some("2026-11-13")
);
}
#[test]
fn the_first_seen_day_never_reaches_the_wire() {
let wire = serde_json::to_string(&every_field_batch()).expect("serialize");
assert!(!wire.contains("first_seen"));
}
-127
View File
@@ -1,127 +0,0 @@
{
"schema_version": 6,
"notice_version": 8,
"sent_at": "2026-08-03T18:04:11Z",
"install_id": "3f2a9c1e-0000-4000-8000-000000000001",
"app_version": "0.9.4",
"git_sha": "abcdef012345",
"surface": "control-plane",
"os": "macos",
"arch": "aarch64",
"libc": "none",
"tty": true,
"events": [
{
"event": "install_or_upgrade",
"kind": "upgrade",
"previous_version": "0.9.3-rc.1"
},
{
"event": "session_start",
"source": "fleet_worker",
"install_age": "under_week"
},
{
"event": "session_end",
"duration_bucket": "1m_10m",
"exit_class": "unclean",
"cold_start_bucket": "250_1000",
"providers": [
"custom",
"deepseek"
],
"counters": {
"turns": 14,
"tool_calls": 61,
"fleet_dispatch": 0,
"workflow_run": 0,
"subagent_spawn": 2,
"mcp_server_connected": 0,
"memory_search": 0,
"approval_modal_shown": 0,
"approval_auto_allowed": 0,
"command_palette_open": 3
},
"errors": {
"auth_preflight_failed": 0,
"provider_http_4xx": 0,
"provider_http_5xx": 1,
"tool_denied_by_policy": 0,
"tool_timeout": 0,
"network_error": 0
},
"turn_wall": {
"lt_5s": 9,
"5_30s": 4,
"30_120s": 1,
"gte_120s": 0
}
},
{
"event": "panic",
"site": "crates/tui/src/tui/ui.rs:8801:17"
},
{
"event": "product_usage",
"counters": {
"page_view": 1,
"docs_view": 0,
"install_copy": 0,
"download": 0,
"signup": 0,
"login": 0,
"session_create": 0,
"session_resume": 0,
"turn_submit": 0,
"turn_complete": 0,
"settings_open": 0,
"integration_connect": 0,
"error_shown": 0
}
},
{
"event": "operations_summary",
"requests": 10,
"errors": 1,
"duration_ms_total": 1500,
"duration_ms_max": 300,
"probes": 2,
"probes_failed": 0
},
{
"event": "model_usage",
"provider": "deepseek",
"model": "other",
"counters": {
"turns_ok": 12,
"turns_failed": 1,
"turns_interrupted": 0,
"input_tokens": 418230,
"output_tokens": 9120,
"cache_read_tokens": 380001,
"cache_write_tokens": 0,
"requests": 27,
"reasoning_tokens": 2310,
"generation_secs": 412
},
"turn_wall": {
"lt_5s": 3,
"5_30s": 8,
"30_120s": 2,
"gte_120s": 0
},
"context": {
"lt_32k": 9,
"32k_128k": 11,
"128k_256k": 5,
"gte_256k": 2
}
},
{
"event": "tool_usage",
"tool": "read_file",
"calls": 41,
"errors": 2
}
]
}
+1 -4
View File
@@ -2515,10 +2515,7 @@ fn arm_telemetry_with_setup(
};
codewhale_telemetry::init(consent.with_config_path(Some(store.path().to_path_buf())));
let _ = TELEMETRY_SESSION_START.set(std::time::Instant::now());
codewhale_telemetry::record(codewhale_telemetry::Event::SessionStart {
source,
install_age: codewhale_telemetry::install_age(),
});
codewhale_telemetry::record(codewhale_telemetry::Event::SessionStart { source });
}
fn arm_telemetry(cli: &Cli, command: Option<&Commands>) {
+54
View File
@@ -87,6 +87,27 @@ pub(crate) use types::{
WORKFLOW_DRAFT_INSTRUCTION_PREFIX,
};
const ACCOUNT_PREFERENCES_NOTICE: &str = "account-preferences-notice";
fn account_sign_in_marker(profile: Option<&str>) -> String {
use sha2::{Digest, Sha256};
let api_base = codewhale_engine::profile_constitution::runtime_account_api_base();
let session = codewhale_secrets::account::AccountSessionStore::new(
codewhale_secrets::Secrets::file_backed_read_only(),
profile,
&api_base,
)
.runtime_info_at(Utc::now())
.ok()
.and_then(|info| info.session_id)
.unwrap_or_default();
Sha256::digest(session.as_bytes())
.iter()
.take(8)
.map(|byte| format!("{byte:02x}"))
.collect()
}
// === Types ===
/// One login owns one mailbox. A cancelled task can only write its abandoned
@@ -2448,6 +2469,7 @@ pub struct App {
/// re-render per character. `None` means "no bump since the last
/// finalize" so the first chunk of a block always renders immediately.
pub thinking_revision_last_bump_at: Option<Instant>,
pub(crate) thinking_revision_owed: bool,
/// Newline-gated streaming collector state.
pub streaming_state: StreamingState,
/// Live approximate output tokens for the current assistant stream.
@@ -3791,6 +3813,38 @@ impl App {
);
}
pub(crate) fn notify_account_preferences_not_loaded(&mut self) {
let sign_in = account_sign_in_marker(self.config_profile.as_deref());
self.notify_account_preferences_not_loaded_for(&sign_in);
}
fn notify_account_preferences_not_loaded_for(&mut self, sign_in: &str) {
let first_for_sign_in = Settings::transact_opt(|settings| {
if settings.account_preferences_notice_shown.as_deref() == Some(sign_in) {
return Ok(None);
}
settings.account_preferences_notice_shown = Some(sign_in.to_string());
Ok(Some(()))
});
if matches!(first_for_sign_in, Ok(None)) {
return;
}
let text = self
.tr(MessageId::AccountPreferencesNotLoaded)
.replace("{command}", "codewhale login");
self.push_status_toast_record(StatusToast::standing(
text,
StatusToastLevel::Warning,
ACCOUNT_PREFERENCES_NOTICE,
));
}
pub(crate) fn dismiss_account_preferences_notice(&mut self) -> bool {
let before = self.status_toasts.len();
self.retire_event_notices(ACCOUNT_PREFERENCES_NOTICE);
self.status_toasts.len() != before
}
/// One-release migration notice for the Shift+Tab/Ctrl+T rebinding: users
/// pressing Shift+Tab expecting the old thinking cycle land here first.
fn notify_keybinding_migration_once(&mut self) {
+1
View File
@@ -1142,6 +1142,7 @@ impl App {
streaming_thinking_active_entry: None,
pending_thinking_translation_cells: HashMap::new(),
thinking_revision_last_bump_at: None,
thinking_revision_owed: false,
streaming_state: StreamingState::new(),
streaming_output_token_estimate: 0,
reasoning_buffer: String::new(),
+40
View File
@@ -184,6 +184,46 @@ fn feature_intro_shows_once_persists_then_is_idempotent() {
let _ = std::fs::remove_dir_all(&tmp);
}
#[test]
fn account_preferences_notice_shows_once_per_sign_in_and_can_be_dismissed() {
let _env_lock = lock_test_env();
let tmp = tempfile::tempdir().unwrap();
let config_path = tmp.path().join("config.toml");
let _env = EnvVarGuard::set(
"DEEPSEEK_CONFIG_PATH",
config_path.to_string_lossy().as_ref(),
);
let shown = |app: &App| {
let notice = app
.tr(MessageId::AccountPreferencesNotLoaded)
.replace("{command}", "codewhale login");
app.status_toasts
.iter()
.filter(|toast| toast.text == notice && toast.kind == StatusToastKind::Standing)
.count()
};
let mut app = App::new(test_options(false), &Config::default());
app.notify_account_preferences_not_loaded_for("first-sign-in");
app.notify_account_preferences_not_loaded_for("first-sign-in");
assert_eq!(shown(&app), 1);
assert_eq!(
Settings::load()
.expect("settings should load")
.account_preferences_notice_shown
.as_deref(),
Some("first-sign-in")
);
assert!(app.dismiss_account_preferences_notice());
assert_eq!(shown(&app), 0);
let mut later_session = App::new(test_options(false), &Config::default());
later_session.notify_account_preferences_not_loaded_for("first-sign-in");
assert_eq!(shown(&later_session), 0, "the same sign-in is told once");
later_session.notify_account_preferences_not_loaded_for("second-sign-in");
assert_eq!(shown(&later_session), 1, "a later sign-in is told again");
}
#[test]
fn initial_input_scenario() {
// Scenario consolidation of: initial_input_prefill_waits_for_manual_submit, initial_input_submit_marks_startup_dispatch
@@ -9,7 +9,7 @@
│ Background (default) ✎ │current terminal
│ Pet mode Off [ ] │saved terminal
│ Quiet transcript On [x] │startup terminal
│ Model reasoning in chat Off [ ] │source settings.toml
│ Model reasoning in chat On [x] │source settings.toml
│ Thinking Default Expanded Off [ ] │scope SAVED
│ Thinking Preview Lines 2 ✎ │apply applies on save
│ Thinking background highlight On [x] │kind choice
@@ -9,7 +9,7 @@
Background (default) ✎ SAVED █
Pet mode Off [ ] SAVED █
Quiet transcript On [x] SAVED █
Model reasoning in chat Off [ ] SAVED █
Model reasoning in chat On [x] SAVED █
Thinking Default Expanded Off [ ] SAVED █
Thinking Preview Lines 2 ✎ SAVED │
Thinking background highlight On [x] SAVED │
+46 -6
View File
@@ -30,15 +30,17 @@ use crate::tui::history::HistoryCell;
/// frame cap (see `frame_rate_limiter`) yet imperceptible as lag.
///
/// Correctness: this only skips *intermediate* repaints. Appended content is
/// never dropped — it lands in the cell immediately — and finalize always
/// forces a bump so the final reasoning text is fully rendered.
/// never dropped — it lands in the cell immediately — the display beat renders
/// a skipped bump once the window has passed, and finalize always forces a
/// bump so the final reasoning text is fully rendered.
const THINKING_REVISION_THROTTLE: Duration = Duration::from_millis(100);
/// Bump the active-cell revision for a streaming thinking mutation, but at
/// most once per [`THINKING_REVISION_THROTTLE`] window. Returns whether a bump
/// was actually emitted. Skipped bumps coalesce into the next one (or into the
/// forced finalize bump), so no content is ever lost — only redundant
/// intermediate re-wraps are dropped.
/// was actually emitted. Skipped bumps coalesce into the next one, into
/// [`render_owed_revision`] on a later display beat, or into the forced
/// finalize bump, so no content is ever lost — only redundant intermediate
/// re-wraps are dropped.
fn bump_thinking_revision_throttled(app: &mut App, now: Instant) -> bool {
let due = app
.thinking_revision_last_bump_at
@@ -47,9 +49,17 @@ fn bump_thinking_revision_throttled(app: &mut App, now: Instant) -> bool {
app.thinking_revision_last_bump_at = Some(now);
app.bump_active_cell_revision();
}
app.thinking_revision_owed = !due;
due
}
pub(super) fn render_owed_revision(app: &mut App, now: Instant) -> bool {
if app.streaming_thinking_active_entry.is_none() {
app.thinking_revision_owed = false;
}
app.thinking_revision_owed && bump_thinking_revision_throttled(app, now)
}
/// Ensure an in-flight Thinking entry exists in `active_cell` and return its
/// entry index. If no thinking entry is currently streaming, push a fresh one.
/// P2.3: thinking shares the active cell with subsequent tool calls so the
@@ -76,7 +86,8 @@ pub(super) fn ensure_active_entry(app: &mut App) -> usize {
/// committed to the cell immediately; the active-cell revision bump that
/// triggers a re-wrap of the live tail is debounced to at most one per
/// [`THINKING_REVISION_THROTTLE`] window (#1620). Skipped bumps coalesce into
/// the next append or the forced finalize bump, so no content is ever lost.
/// the next append, a later display beat or the forced finalize bump, so no
/// content is ever lost.
pub(super) fn append(app: &mut App, entry_idx: usize, text: &str) {
append_at(app, entry_idx, text, Instant::now());
}
@@ -308,6 +319,7 @@ pub(super) fn finalize_active_entry(app: &mut App, duration: Option<f32>, remain
// the debounce window so the next thinking block's first chunk renders
// immediately rather than being coalesced into a stale window.
app.thinking_revision_last_bump_at = None;
app.thinking_revision_owed = false;
app.bump_active_cell_revision();
true
}
@@ -426,6 +438,34 @@ mod tests {
);
}
#[test]
fn a_paused_stream_renders_the_reasoning_it_already_received() {
let mut app = test_app();
let entry = ensure_active_entry(&mut app);
app.thinking_revision_last_bump_at = None;
let t0 = Instant::now();
append_at(&mut app, entry, "first slice ", t0);
let shown = app.active_cell_revision;
append_at(&mut app, entry, "held back", t0 + Duration::from_millis(16));
assert_eq!(app.active_cell_revision, shown);
assert!(!render_owed_revision(
&mut app,
t0 + Duration::from_millis(32)
));
assert_eq!(app.active_cell_revision, shown);
assert!(render_owed_revision(
&mut app,
t0 + THINKING_REVISION_THROTTLE
));
assert_eq!(app.active_cell_revision, shown.wrapping_add(1));
assert!(!render_owed_revision(
&mut app,
t0 + THINKING_REVISION_THROTTLE * 3
));
assert_eq!(app.active_cell_revision, shown.wrapping_add(1));
}
/// #7123: a reasoning block that opens while the display beat still holds
/// an uncommitted slice of prose must not drop that slice. `start_block`
/// resets `StreamingState`, so the tail has to be delivered first.
+9 -11
View File
@@ -7232,14 +7232,16 @@ pub(crate) async fn run_event_loop(
continue;
}
// An idle operator can dismiss the persistent context warning
// without affecting vim or attachment handling. While a turn
// is active Esc retains its cancellation meaning.
// or the account preferences notice without affecting vim or
// attachment handling. While a turn is active Esc retains its
// cancellation meaning.
KeyCode::Esc
if !app.is_loading
&& app.input.is_empty()
&& !slash_menu_open
&& !mention_menu_open
&& app.dismiss_context_pressure_warning() =>
&& (app.dismiss_context_pressure_warning()
|| app.dismiss_account_preferences_notice()) =>
{
continue;
}
@@ -9326,14 +9328,10 @@ pub(super) fn apply_engine_status(app: &mut App, message: String) -> bool {
app.add_message(HistoryCell::System { content: message });
return true;
}
// The account-profile fallback notice is sent once per engine; keep it in
// the transcript so the next turn's status line cannot erase it.
let retain = app.tr(MessageId::ProfileConstitutionUnavailableLocal) == message.as_str();
if retain {
app.add_message(HistoryCell::System {
content: message.clone(),
});
if app.tr(MessageId::ProfileConstitutionUnavailableLocal) == message.as_str() {
app.notify_account_preferences_not_loaded();
return false;
}
app.status_message = Some(message);
retain
false
}
+4 -1
View File
@@ -1555,7 +1555,10 @@ pub(crate) fn commit_streaming_display_tick(
updated = true;
}
if app.streaming_state.has_pending_stream_text(0) {
if streaming_thinking::render_owed_revision(app, now) {
updated = true;
}
if app.streaming_state.has_pending_stream_text(0) || app.thinking_revision_owed {
stream_display_clock.note_delta(now);
}
+26 -8
View File
@@ -27343,7 +27343,7 @@ fn turn_inspector_switches_isolated_full_turn_pages_with_tagged_reasoning_and_ou
let latest = pager.body_text();
assert!(latest.contains("SECOND-PROMPT"), "{latest}");
assert!(latest.contains("[∿ reasoning 1/1 · running]"), "{latest}");
assert!(latest.contains("[∿ thinking 1/1 · running]"), "{latest}");
assert!(latest.contains("SECOND-THOUGHT"), "{latest}");
assert!(latest.contains("[◆ · running]"), "{latest}");
assert!(latest.contains("SECOND-ANSWER"), "{latest}");
@@ -27355,7 +27355,7 @@ fn turn_inspector_switches_isolated_full_turn_pages_with_tagged_reasoning_and_ou
for expected in [
"FIRST-PROMPT",
"keep this input line",
"[∿ reasoning 1/1 · Done]",
"[∿ thinking 1/1 · Done]",
"FIRST-THOUGHT",
"full reasoning tail",
"[⚙ using tool]",
@@ -35488,23 +35488,41 @@ fn extension_prompt_origin_keeps_denials_and_other_policy_holds() {
}
#[test]
fn account_profile_fallback_notice_stays_in_the_transcript() {
fn account_profile_fallback_notice_is_a_standing_notice_outside_the_transcript() {
let _home = SettingsHomeGuard::new();
let mut app = App::new(create_test_options(), &Config::default());
let notice = app
let engine_notice = app
.tr(MessageId::ProfileConstitutionUnavailableLocal)
.to_string();
let before = app.history.len();
assert!(super::event_loop::apply_engine_status(
let status_before = app.status_message.clone();
assert!(!super::event_loop::apply_engine_status(
&mut app,
notice.clone()
engine_notice
));
assert_eq!(app.history.len(), before);
assert_eq!(app.status_message, status_before);
assert!(!super::event_loop::apply_engine_status(
&mut app,
"Executing tools sequentially".into()
));
assert_eq!(app.history.len(), before + 1);
assert!(matches!(&app.history[before], HistoryCell::System { content } if *content == notice));
assert_eq!(app.history.len(), before);
let notice = app
.tr(MessageId::AccountPreferencesNotLoaded)
.replace("{command}", "codewhale login");
let standing = |app: &App| {
app.status_toasts
.iter()
.find(|toast| toast.text == notice)
.cloned()
};
app.sync_status_message_to_toasts();
let shown = standing(&app).expect("a later routine status does not erase the notice");
assert_eq!(shown.level, StatusToastLevel::Warning);
assert_eq!(shown.ttl_ms, None);
assert!(app.dismiss_account_preferences_notice());
assert!(standing(&app).is_none());
assert!(!app.dismiss_account_preferences_notice());
}
#[test]
+2
View File
@@ -32,6 +32,8 @@ mod plugin_e2e_acceptance;
mod screen_mode_inline_pty;
#[cfg(all(unix, feature = "long-running-tests"))]
mod search_text_pty;
#[cfg(all(unix, feature = "long-running-tests"))]
mod thinking_stream_pty;
mod tool_lifecycle_acceptance;
#[cfg(all(unix, feature = "long-running-tests"))]
mod work_bar_keys_pty;
@@ -0,0 +1,585 @@
use std::io::{BufRead, BufReader, Read, Write};
use std::net::{SocketAddr, TcpListener, TcpStream};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex, mpsc};
use std::time::{Duration, Instant};
use super::qa_harness::{
harness::{Harness, SealedWorkspace, make_sealed_workspace},
keys,
};
const WAIT: Duration = Duration::from_secs(20);
const MODEL: &str = "deepseek-v4-pro";
const PROMPTS: [&str; 2] = ["first slow fixture prompt", "second slow fixture prompt"];
const ANSWER: &str = "Fixture answer after thinking.";
const REASONING_LINES: usize = 6;
const NOTICE: &str = "Account not loaded. Run codewhale login.";
const RETIRED_TRANSCRIPT_NOTICE: &str = "could not be loaded";
fn reasoning_line(index: usize) -> String {
format!("thinking fixture line {index} of {REASONING_LINES}")
}
struct PacedProvider {
address: SocketAddr,
gate: mpsc::Sender<()>,
stop: Arc<AtomicBool>,
turns: Arc<AtomicUsize>,
profile_requests: Arc<AtomicUsize>,
acceptor: Option<std::thread::JoinHandle<()>>,
}
struct Served {
gates: Mutex<mpsc::Receiver<()>>,
stop: Arc<AtomicBool>,
turns: Arc<AtomicUsize>,
profile_requests: Arc<AtomicUsize>,
}
impl PacedProvider {
fn start() -> Self {
let listener = TcpListener::bind("127.0.0.1:0").expect("loopback provider");
let address = listener.local_addr().expect("loopback address");
let (gate, gates) = mpsc::channel();
let stop = Arc::new(AtomicBool::new(false));
let turns = Arc::new(AtomicUsize::new(0));
let profile_requests = Arc::new(AtomicUsize::new(0));
let served = Arc::new(Served {
gates: Mutex::new(gates),
stop: Arc::clone(&stop),
turns: Arc::clone(&turns),
profile_requests: Arc::clone(&profile_requests),
});
let acceptor = std::thread::spawn(move || {
for stream in listener.incoming() {
if served.stop.load(Ordering::Acquire) {
break;
}
let Ok(stream) = stream else { continue };
let served = Arc::clone(&served);
std::thread::spawn(move || {
let _ = serve(stream, &served);
});
}
});
Self {
address,
gate,
stop,
turns,
profile_requests,
acceptor: Some(acceptor),
}
}
fn model_base(&self) -> String {
format!("http://{}/v1", self.address)
}
fn account_base(&self) -> String {
format!("http://{}", self.address)
}
fn release(&self, gates: usize) {
for _ in 0..gates {
self.gate.send(()).expect("provider gate");
}
}
fn turns(&self) -> usize {
self.turns.load(Ordering::Acquire)
}
}
impl Drop for PacedProvider {
fn drop(&mut self) {
self.stop.store(true, Ordering::Release);
let _ = TcpStream::connect(self.address);
if let Some(acceptor) = self.acceptor.take() {
let _ = acceptor.join();
}
}
}
fn serve(stream: TcpStream, served: &Served) -> std::io::Result<()> {
stream.set_read_timeout(Some(Duration::from_secs(10)))?;
let mut reader = BufReader::new(stream.try_clone()?);
let mut stream = stream;
let mut request_line = String::new();
if reader.read_line(&mut request_line)? == 0 {
return Ok(());
}
let mut content_length = 0usize;
loop {
let mut header = String::new();
if reader.read_line(&mut header)? == 0 {
break;
}
let header = header.trim_end();
if header.is_empty() {
break;
}
if let Some((name, value)) = header.split_once(':')
&& name.eq_ignore_ascii_case("content-length")
{
content_length = value.trim().parse().unwrap_or(0);
}
}
let mut body = vec![0u8; content_length.min(8 * 1024 * 1024)];
reader.read_exact(&mut body)?;
let mut parts = request_line.split_whitespace();
let method = parts.next().unwrap_or_default();
let path = parts.next().unwrap_or_default();
if method == "GET" && path.ends_with("/models") {
return respond_json(
&mut stream,
"200 OK",
&serde_json::json!({"object":"list","data":[{"id":MODEL,"object":"model"}]}),
);
}
if path.starts_with("/api/") {
served.profile_requests.fetch_add(1, Ordering::AcqRel);
return respond_json(
&mut stream,
"401 Unauthorized",
&serde_json::json!({"error":"loopback fixture account is signed out"}),
);
}
if method != "POST" {
return respond_json(
&mut stream,
"404 Not Found",
&serde_json::json!({"error":"not served by the loopback fixture"}),
);
}
let request: serde_json::Value = serde_json::from_slice(&body).unwrap_or_default();
let streaming = request["stream"].as_bool().unwrap_or(false);
let with_tools = request["tools"]
.as_array()
.is_some_and(|tools| !tools.is_empty());
let text = String::from_utf8_lossy(&body);
let turn = PROMPTS
.iter()
.rposition(|prompt| text.contains(prompt))
.map(|index| index + 1);
let paced = streaming
&& with_tools
&& turn.is_some_and(|turn| {
served
.turns
.compare_exchange(turn - 1, turn, Ordering::AcqRel, Ordering::Acquire)
.is_ok()
});
if !streaming {
return respond_json(
&mut stream,
"200 OK",
&serde_json::json!({
"id":"loopback","object":"chat.completion","model":MODEL,
"choices":[{"index":0,"message":{"role":"assistant","content":"ok"},"finish_reason":"stop"}],
"usage":{"prompt_tokens":1,"completion_tokens":1,"total_tokens":2}
}),
);
}
stream.write_all(
b"HTTP/1.1 200 OK\r\ncontent-type: text/event-stream\r\ncache-control: no-cache\r\nconnection: close\r\n\r\n",
)?;
stream.flush()?;
if paced {
wait_for_gate(served)?;
for index in 1..=REASONING_LINES {
send_delta(
&mut stream,
serde_json::json!({"reasoning_content": format!("{}\n", reasoning_line(index))}),
)?;
}
wait_for_gate(served)?;
send_delta(&mut stream, serde_json::json!({"content": ANSWER}))?;
wait_for_gate(served)?;
} else {
send_delta(&mut stream, serde_json::json!({"content": "ok"}))?;
}
send_chunk(
&mut stream,
&serde_json::json!({
"id":"loopback","object":"chat.completion.chunk","model":MODEL,
"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],
"usage":{"prompt_tokens":8,"completion_tokens":4,"total_tokens":12}
}),
)?;
stream.write_all(b"data: [DONE]\n\n")?;
stream.flush()
}
fn wait_for_gate(served: &Served) -> std::io::Result<()> {
let gates = served.gates.lock().expect("provider gates");
loop {
if served.stop.load(Ordering::Acquire) {
return Err(std::io::ErrorKind::Interrupted.into());
}
match gates.recv_timeout(Duration::from_millis(100)) {
Ok(()) => return Ok(()),
Err(mpsc::RecvTimeoutError::Timeout) => {}
Err(mpsc::RecvTimeoutError::Disconnected) => {
return Err(std::io::ErrorKind::BrokenPipe.into());
}
}
}
}
fn send_delta(stream: &mut TcpStream, delta: serde_json::Value) -> std::io::Result<()> {
send_chunk(
stream,
&serde_json::json!({
"id":"loopback","object":"chat.completion.chunk","model":MODEL,
"choices":[{"index":0,"delta":delta,"finish_reason":null}]
}),
)
}
fn send_chunk(stream: &mut TcpStream, chunk: &serde_json::Value) -> std::io::Result<()> {
stream.write_all(format!("data: {chunk}\n\n").as_bytes())?;
stream.flush()
}
fn respond_json(
stream: &mut TcpStream,
status: &str,
body: &serde_json::Value,
) -> std::io::Result<()> {
let body = body.to_string();
stream.write_all(
format!(
"HTTP/1.1 {status}\r\ncontent-type: application/json\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{body}",
body.len()
)
.as_bytes(),
)?;
stream.flush()
}
fn prepare(workspace: &SealedWorkspace, provider: &PacedProvider, settings: Option<&str>) {
let state = workspace.home().join(".codewhale");
std::fs::write(state.join(".onboarded"), "").unwrap();
std::fs::write(
state.join("config.toml"),
format!(
"provider = \"deepseek\"\n[providers.deepseek]\nbase_url = {:?}\napi_key = \"loopback-only\"\nmodel = {MODEL:?}\n[notifications]\nmethod = \"off\"\ncompletion_sound = \"off\"\n",
provider.model_base()
),
)
.unwrap();
if let Some(settings) = settings {
std::fs::write(state.join("settings.toml"), settings).unwrap();
}
let trust = workspace.workspace().join(".deepseek");
std::fs::create_dir_all(&trust).unwrap();
std::fs::write(trust.join("trusted"), "").unwrap();
}
fn launch(
workspace: &SealedWorkspace,
provider: &PacedProvider,
(rows, cols): (u16, u16),
session: &str,
animated: bool,
) -> Harness {
let mut tui = Harness::builder(Harness::codewhale_binary())
.cwd(workspace.workspace())
.clear_env()
.seal_home(workspace.home())
.env("PATH", "/usr/bin:/bin:/usr/sbin:/sbin")
.env("SHELL", "/bin/sh")
.env("CODEWHALE_CLOUD_API_BASE", provider.account_base())
.env("CODEWHALE_DISABLE_MODELS_DEV_FETCH", "1")
.env("CODEWHALE_NO_UPDATE_CHECK", "1")
.env("NO_ANIMATIONS", if animated { "0" } else { "1" })
.args([
"--workspace",
workspace.workspace().to_str().unwrap(),
"--no-project-config",
"--skip-onboarding",
session,
])
.size(rows, cols)
.spawn()
.unwrap();
tui.wait_for_text("accept edits", WAIT)
.unwrap_or_else(|error| panic!("the dial chip never painted: {error}"));
tui
}
fn expect(tui: &mut Harness, what: &str, predicate: impl FnMut(&super::qa_harness::Frame) -> bool) {
if let Err(error) = tui.wait_for(predicate, WAIT) {
panic!("waiting for {what}: {error}");
}
}
fn settle(tui: &mut Harness) {
let deadline = Instant::now() + Duration::from_secs(2);
let mut quiet_since = Instant::now();
while Instant::now() < deadline && quiet_since.elapsed() < Duration::from_millis(300) {
if tui.pump() {
quiet_since = Instant::now();
}
std::thread::sleep(Duration::from_millis(20));
}
}
fn report(tui: &mut Harness, label: &str) {
let frame = tui.frame();
println!(
"--- {label} at {}x{} ---\n{}",
frame.cols(),
frame.rows(),
frame.debug_dump()
);
}
fn footer_row(tui: &mut Harness) -> (u16, String) {
let frame = tui.frame();
(0..frame.rows())
.rev()
.map(|row| (row, frame.row(row)))
.find(|(_, text)| text.contains("accept edits"))
.unwrap_or_else(|| panic!("no dial chip on screen:\n{}", frame.debug_dump()))
}
fn assert_status_and_water(tui: &mut Harness, label: &str) {
let (footer, status) = footer_row(tui);
let frame = tui.frame();
for retired in ["operate", "Operate", "Work bar"] {
assert!(
!frame.contains(retired),
"{label}: `{retired}` is on screen:\n{}",
frame.debug_dump()
);
}
assert!(status.contains("accept edits"), "{label}: {status}");
for row in 0..footer.saturating_sub(3) {
let text = frame.row(row);
let cells: Vec<char> = text.chars().collect();
let school = cells.windows(2).any(|pair| {
pair.iter()
.all(|cell| ('\u{2801}'..='\u{28FF}').contains(cell))
});
assert!(
!school && !text.contains(['˚', '°', '≈', '~']),
"{label}: ambient art on transcript row {row} `{text}`:\n{}",
frame.debug_dump()
);
}
}
fn thinking_rows(tui: &mut Harness) -> usize {
let frame = tui.frame();
(0..frame.rows())
.filter(|&row| frame.row(row).contains("Thinking…"))
.count()
}
fn stream_first_turn(tui: &mut Harness, provider: &PacedProvider, thinking_shown: bool) {
tui.type_line(PROMPTS[0]).unwrap();
expect(tui, "the first request and its interrupt hint", |frame| {
provider.turns() == 1 && frame.contains("Esc to interrupt")
});
std::thread::sleep(Duration::from_millis(900));
report(tui, "loading");
assert_status_and_water(tui, "loading");
provider.release(1);
let tail = reasoning_line(REASONING_LINES);
if thinking_shown {
expect(tui, "the live thinking block", |frame| {
frame.contains("Thinking…") && frame.contains(&tail)
});
} else {
expect(tui, "the thinking activity line", |frame| {
frame.contains("Thinking…")
});
}
std::thread::sleep(Duration::from_millis(1300));
report(tui, "thinking");
assert_status_and_water(tui, "thinking");
assert_eq!(thinking_rows(tui), 1, "one Thinking line");
let (_, status) = footer_row(tui);
assert!(
status.contains("thinking ") && !status.contains("reasoning"),
"the clock names the phase: {status}"
);
let frame = tui.frame();
assert!(!frame.contains("reasoning..."), "{}", frame.debug_dump());
assert_eq!(frame.contains(&tail), thinking_shown);
assert!(
!frame.contains(&reasoning_line(1)),
"a long trace stays inside its window:\n{}",
frame.debug_dump()
);
provider.release(1);
expect(tui, "the streamed answer", |frame| frame.contains(ANSWER));
report(tui, "answer");
let frame = tui.frame();
assert!(!frame.contains("Thinking…"), "{}", frame.debug_dump());
assert_eq!(frame.contains("Thought for "), thinking_shown);
assert!(!frame.contains(&tail), "{}", frame.debug_dump());
provider.release(1);
expect(tui, "the settled turn", |frame| {
!frame.contains("Esc to interrupt")
});
settle(tui);
report(tui, "settled");
assert_status_and_water(tui, "settled");
}
#[test]
fn thinking_streams_stops_and_restores_at_the_shipped_widths() {
for size in [(24, 80), (32, 100), (32, 120), (40, 140)] {
let workspace = make_sealed_workspace().unwrap();
let provider = PacedProvider::start();
prepare(&workspace, &provider, None);
let mut tui = launch(&workspace, &provider, size, "--fresh", true);
stream_first_turn(&mut tui, &provider, true);
tui.type_line(PROMPTS[1]).unwrap();
expect(&mut tui, "the second request", |_| provider.turns() == 2);
provider.release(1);
let tail = reasoning_line(REASONING_LINES);
expect(&mut tui, "thinking before the stop", |frame| {
frame.contains("Thinking…") && frame.contains(&tail)
});
tui.send(keys::key::esc()).unwrap();
expect(&mut tui, "the stopped turn", |frame| {
!frame.contains("Esc to interrupt") && !frame.contains("Thinking…")
});
settle(&mut tui);
report(&mut tui, "stopped");
assert_status_and_water(&mut tui, "stopped");
provider.release(2);
tui.send(keys::key::ctrl('u')).unwrap();
settle(&mut tui);
tui.send(keys::key::ctrl_d()).unwrap();
tui.wait_for_exit(Duration::from_secs(10));
tui.shutdown();
let mut tui = launch(&workspace, &provider, size, "--continue", false);
expect(&mut tui, "the restored conversation", |frame| {
frame.contains(ANSWER)
});
settle(&mut tui);
report(&mut tui, "restored");
assert_status_and_water(&mut tui, "restored");
let frame = tui.frame();
assert!(!frame.contains("Thinking…"), "{}", frame.debug_dump());
tui.shutdown();
}
}
#[test]
fn a_saved_choice_to_hide_thinking_survives_the_new_default() {
let workspace = make_sealed_workspace().unwrap();
let provider = PacedProvider::start();
prepare(&workspace, &provider, Some("show_thinking = false\n"));
let mut tui = launch(&workspace, &provider, (24, 80), "--fresh", false);
stream_first_turn(&mut tui, &provider, false);
let frame = tui.frame();
assert!(!frame.contains("Thought"), "{}", frame.debug_dump());
tui.shutdown();
let saved: toml::Value = toml::from_str(
&std::fs::read_to_string(workspace.home().join(".codewhale/settings.toml")).unwrap(),
)
.unwrap();
assert_eq!(saved["show_thinking"].as_bool(), Some(false));
}
fn sign_in(workspace: &SealedWorkspace, provider: &PacedProvider, session: &str) {
let path = workspace.home().join(".codewhale/secrets/secrets.json");
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
let secrets =
codewhale_secrets::Secrets::new(Arc::new(codewhale_secrets::FileKeyringStore::new(path)));
let bundle = serde_json::from_value(serde_json::json!({
"tokenType": "Bearer",
"accessToken": "loopback-access",
"refreshToken": "loopback-refresh",
"session": {"id": session},
"user": {"id": "loopback-account"}
}))
.unwrap();
codewhale_secrets::account::AccountSessionStore::new(secrets, None, &provider.account_base())
.save(bundle)
.unwrap();
}
fn run_ungated_turn(tui: &mut Harness, provider: &PacedProvider) {
provider.release(3);
tui.type_line(PROMPTS[0]).unwrap();
expect(tui, "the answer", |frame| frame.contains(ANSWER));
expect(tui, "the settled turn", |frame| {
!frame.contains("Esc to interrupt")
});
}
#[test]
fn account_preferences_notice_is_shown_once_per_sign_in_and_esc_dismisses_it() {
let workspace = make_sealed_workspace().unwrap();
let provider = PacedProvider::start();
prepare(&workspace, &provider, None);
sign_in(&workspace, &provider, "first-sign-in");
for cols in [80, 120] {
let workspace = make_sealed_workspace().unwrap();
let provider = PacedProvider::start();
prepare(&workspace, &provider, None);
sign_in(&workspace, &provider, "first-sign-in");
let mut tui = launch(&workspace, &provider, (32, cols), "--fresh", false);
run_ungated_turn(&mut tui, &provider);
expect(&mut tui, "the standing notice", |frame| {
frame.contains(NOTICE)
});
report(&mut tui, "account notice");
assert!(provider.profile_requests.load(Ordering::Acquire) > 0);
let (_, status) = footer_row(&mut tui);
assert!(
status.contains(NOTICE),
"the notice is footer chrome: {status}"
);
assert!(!tui.frame().contains(RETIRED_TRANSCRIPT_NOTICE));
tui.send(keys::key::esc()).unwrap();
expect(&mut tui, "the dismissed notice", |frame| {
!frame.contains(NOTICE)
});
report(&mut tui, "account notice dismissed");
tui.shutdown();
}
let mut tui = launch(&workspace, &provider, (32, 120), "--fresh", false);
run_ungated_turn(&mut tui, &provider);
expect(&mut tui, "the first notice", |frame| frame.contains(NOTICE));
tui.shutdown();
let mut tui = launch(&workspace, &provider, (32, 120), "--fresh", false);
provider.turns.store(0, Ordering::Release);
run_ungated_turn(&mut tui, &provider);
tui.wait_for_idle(Duration::from_secs(6), Duration::from_secs(30))
.unwrap();
report(&mut tui, "same sign-in, later session");
assert!(
!tui.frame().contains(NOTICE),
"the same sign-in is told once"
);
assert!(!tui.frame().contains(RETIRED_TRANSCRIPT_NOTICE));
tui.shutdown();
sign_in(&workspace, &provider, "second-sign-in");
let mut tui = launch(&workspace, &provider, (32, 120), "--fresh", false);
provider.turns.store(0, Ordering::Release);
run_ungated_turn(&mut tui, &provider);
expect(&mut tui, "the notice for a later sign-in", |frame| {
frame.contains(NOTICE)
});
report(&mut tui, "later sign-in");
tui.shutdown();
}
+4 -1
View File
@@ -2230,7 +2230,10 @@ Common settings keys:
`@`-mention completions are populated. `fuzzy` searches the workspace and
applies mention frecency. `browser` lists only the immediate children of the
currently typed directory segment in deterministic alphabetical order.
- `show_thinking` (on/off)
- `show_thinking` (on/off, default on): shows model thinking in the transcript,
live while it streams and collapsed under a `Thought for …` header once the
answer starts. Off hides it; answers and tools stay visible. A value already
saved in `settings.toml` is kept.
- `thinking_default_expanded` (on/off, default off): renders thinking blocks
expanded initially when `show_thinking` is enabled. Space still toggles the
selected block, and it decides only the blocks you have not touched: a block
+19 -59
View File
@@ -4,7 +4,7 @@
**Usage analytics are on by default in the current source.** The first
interactive launch gives a localized, nonblocking disclosure naming **Codewhale
and PostHog**, with a direct route to turn counting off. Notice version `8`
and PostHog**, with a direct route to turn counting off. Notice version `6`
describes this policy; displaying it is not recorded as human acceptance.
Missing an older acceptance record does not turn a fresh installation off.
Existing explicit opt-outs remain off across upgrades, and unreadable privacy
@@ -65,7 +65,7 @@ codewhale --telemetry false # the same kill switch, for one command
**`telemetry = false` in the config file is the opt-out.** It is a floor:
`--telemetry true` and `CODEWHALE_TELEMETRY=1` both lose to it, because a
setting you can undo by accident from a wrapper script is not a setting. It
deletes the random install id and the local first-seen day (so the install-age bucket starts over at `new_today` if you turn telemetry back on), truncates every buffered event and every dry-run
deletes the random install id, truncates every buffered event and every dry-run
record, and writes a tombstone. Appends, identity/state writes, and delivery all
share the wipe's ordering lock, so once opt-out returns no pre-opt-out write or
POST remains in flight. If any part of that wipe fails, the tombstone is still
@@ -104,7 +104,7 @@ Everything is under `$CODEWHALE_HOME/telemetry/` (`0700`), every file `0600`:
| `buffer.jsonl` | pending events, one JSON object per line |
| `buffer.jsonl.lock` | the sibling ordering lock shared by writes, delivery, arming, and wipe |
| `dryrun.jsonl` | where batches go when the endpoint is configured empty |
| `state.json` | the last app version seen, the last flush attempt, and the UTC day this state was first created. The date never leaves the device: only the `install_age` bucket is sent |
| `state.json` | the last app version seen and the last flush attempt |
| `install_id.json` | the random install id and when it was minted |
| `disabled` | the tombstone; present means nothing is appended or sent |
@@ -162,14 +162,10 @@ most once per flush point and never grows a queue.
## Event schema
`SCHEMA_VERSION = 6`. `notice_version = 8` identifies the disclosed default-on
policy; it does not assert human consent or that a notice was seen. Schema 6
adds, to `model_usage`, the request count, reasoning tokens, whole seconds spent
waiting on the model and a four-bucket input-size histogram; adds a coarse
install age and three exec start labels to `session_start`; and adds the
`unclean` exit class. Schema 4 added the `model_usage` and `tool_usage` events
and the `ci` session source. Schema-4 and schema-3 batches are still accepted
without the schema-6 fields. Schema-3 batches with `notice_version = 5` are still accepted without them, which
`SCHEMA_VERSION = 4`. `notice_version = 6` identifies the disclosed default-on
policy; it does not assert human consent or that a notice was seen. Schema 4
adds the `model_usage` and `tool_usage` events and the `ci` session source.
Schema-3 batches with `notice_version = 5` are still accepted without them, which
is what the web and desktop control-plane relay sends. The closed
v2 contract still accepts only `consent_version = 4`, retaining its original
explicit opt-in meaning. Fields cannot be mixed between versions. The unchanged
@@ -182,8 +178,8 @@ new fields, surfaces, and `product_usage` events.
```jsonc
{
"schema_version": 6,
"notice_version": 8,
"schema_version": 4,
"notice_version": 6,
"sent_at": "2026-08-03T18:04:11Z", // RFC3339 UTC, second precision
"install_id": "3f2a…", // uuid v4, rotates every 90 days
"app_version": "0.9.12",
@@ -200,7 +196,7 @@ new fields, surfaces, and `product_usage` events.
| Field | Type | Source anchor | Rule |
|---|---|---|---|
| `schema_version` | `u32` | const in `crates/telemetry/src/event.rs` | Bumped on any field add/remove/retype. Never reused. Pinned by a golden snapshot test. |
| `notice_version` | `u32` | policy constant in `crates/telemetry/src/event.rs` | Exactly `8` for schema 6; identifies the disclosed opt-out policy, not a human acceptance record. |
| `notice_version` | `u32` | policy constant in `crates/telemetry/src/event.rs` | Exactly `6` for schema 4; identifies the disclosed opt-out policy, not a human acceptance record. |
| `sent_at` | RFC3339 | `chrono::Utc::now()` | Second precision. Per-**batch** only — events carry no timestamps at all. |
| `install_id` | uuid v4 | `crates/telemetry/src/envelope.rs` | Random, never derived, rotated every 90 days. See "Where it lives" above. |
| `app_version` | string | `env!("CARGO_PKG_VERSION")`, as at `crates/telemetry/src/lib.rs:112` | Must match `^\d+\.\d+\.\d+(-[0-9A-Za-z.]+)?$`. |
@@ -288,27 +284,14 @@ Emitted once when `state.json`'s `last_version` differs from `app_version`.
### Event: `session_start`
```jsonc
{ "event": "session_start", "source": "interactive", "install_age": "older" }
{ "event": "session_start", "source": "interactive" }
```
`source` is `SessionSource` (`crates/telemetry/src/event.rs`), a closed enum declared in the telemetry crate: `interactive | resume | fork | api | unknown | ci | fleet_worker | agent | scripted`.
`source` is `SessionSource` (`crates/state/src/lib.rs:34-41`) stringified by `session_source_to_str` (`:1909-1917`): `interactive | resume | fork | api | unknown | ci`.
`ci` replaces the others whenever `CI` or `GITHUB_ACTIONS` is set to a true
value, including the Codewhale GitHub Action, so automated runs are never
counted as people. Only that boolean environment fact is read.
`fleet_worker`, `agent` and `scripted` separate automated `exec` sessions from
people. `fleet_worker` is an `exec` that Codewhale's own fleet dispatcher
started, `agent` is an `exec` started from inside an agent's shell command (only
the presence of a Codewhale-owned environment variable is read, never its
value), and `scripted` is an `exec` whose standard input or output is not a
terminal. When more than one applies the order is `fleet_worker`, `agent`, `ci`,
`scripted`. Other surfaces are unchanged.
`install_age` is `new_today | under_week | older | null`: a coarse bucket of how
long this installation has existed. It is computed on your device and only the
bucket leaves it; the date it comes from is stored only in the local state file
and never leaves the device. The same UTC day is `new_today`, 1 to 6 days is `under_week`, and 7 or more is `older`. An installation whose state predates this field reports `older`, never `new_today`. `null` means the local state could not be read.
### Event: `session_end`
The workhorse. Everything a session accumulated ships here, once.
@@ -334,11 +317,11 @@ The workhorse. Everything a session accumulated ships here, once.
**`duration_bucket`** — `chrono` delta from `app.session_started_at` (`crates/tui/src/tui/app.rs:1889`). Half-open, seconds: `lt_1m` (`d < 60`), `1m_10m` (`60 ≤ d < 600`), `10m_60m` (`600 ≤ d < 3600`), `gt_60m` (`d ≥ 3600`).
**`exit_class`** — `clean | signal | panic | error | unclean`. `unclean` means the process ended without its own shutdown report and its totals were recovered from a local checkpoint at a later start. **Derived from an explicit `AtomicU8`, never from an exit code.** `RunTerminationReason::Canceled` maps to exit 130 (`crates/engine/src/core/runtime_contract/termination.rs:53`), the same value the signal task uses (`crates/tui/src/lib.rs:682`, 128+SIGINT), so a code-based derivation would report every Esc-cancelled turn as a signal. The atomic is set by the panic hook (`crates/tui/src/lib.rs:1582`), by the signal task (`:678-696`) before `std::process::exit`, and on the clean path from `RunTerminationReason::is_success()` (`crates/engine/src/core/runtime_contract/termination.rs:44-46`) — `error` otherwise. Exit codes remain insufficient: an approval-required exit (3) and a terminal exec failure (1) need their actual termination classification.
**`exit_class`** — `clean | signal | panic | error`. **Derived from an explicit `AtomicU8`, never from an exit code.** `RunTerminationReason::Canceled` maps to exit 130 (`crates/engine/src/core/runtime_contract/termination.rs:53`), the same value the signal task uses (`crates/tui/src/lib.rs:682`, 128+SIGINT), so a code-based derivation would report every Esc-cancelled turn as a signal. The atomic is set by the panic hook (`crates/tui/src/lib.rs:1582`), by the signal task (`:678-696`) before `std::process::exit`, and on the clean path from `RunTerminationReason::is_success()` (`crates/engine/src/core/runtime_contract/termination.rs:44-46`) — `error` otherwise. Exit codes remain insufficient: an approval-required exit (3) and a terminal exec failure (1) need their actual termination classification.
**`cold_start_bucket`** — from `startup_trace::elapsed_ms()`, which reads `PROCESS_START` directly and is independent of the startup summary's buffer clear (`crates/runtime/src/startup_trace.rs:39-45`). Boundaries: `lt_250`, `250_1000`, `1000_3000`, `gte_3000`. Absent on non-TUI surfaces.
**`providers`** — sorted, deduplicated array of `ProviderKind::as_str()` (`crates/config/src/provider_kind.rs:295`, a `&'static str` from a closed enum; `Custom` yields the literal `"custom"`). **The API takes `ProviderKind` by value, never `&str`.** Do not call `ProviderKind::parse` or `parse_config_identity` (`:300`, `:330`) — those are for config-table resolution. **Do not read** `provider_identity_for_persistence()` (`crates/tui/src/tui/app.rs:5049`), `provider_id_for_persistence()` (`:5058`), `ExecStreamMeta.provider_id` (`crates/app-server/src/exec_agent.rs`), or `PlannedTurnRoute.effective_provider_label` (`crates/engine/src/turn_route_plan.rs:189-193`) — all four return the customer's own `[providers.<name>]` table key when the route is Custom. This is the single most likely leak in the feature: it is one field away from the natural seam and `/status` already prints it (`crates/tui/src/commands/groups/config/status.rs:24-28`). **No model id outside the bundled public catalog is ever sent, for any provider** — `crates/runtime/src/safe_label.rs:11-15` documents that a model id can be a path, a URL, or a deployment id that is itself a credential. Those are sent as `other`; see `model_usage`.
**`providers`** — sorted, deduplicated array of `ProviderKind::as_str()` (`crates/config/src/provider_kind.rs:295`, a `&'static str` from a closed enum; `Custom` yields the literal `"custom"`). **The API takes `ProviderKind` by value, never `&str`.** Do not call `ProviderKind::parse` or `parse_config_identity` (`:300`, `:330`) — those are for config-table resolution. **Do not read** `provider_identity_for_persistence()` (`crates/tui/src/tui/app.rs:5049`), `provider_id_for_persistence()` (`:5058`), `ExecStreamMeta.provider_id` (`crates/app-server/src/exec_agent.rs`), or `PlannedTurnRoute.effective_provider_label` (`crates/engine/src/turn_route_plan.rs:189-193`) — all four return the customer's own `[providers.<name>]` table key when the route is Custom. This is the single most likely leak in the feature: it is one field away from the natural seam and `/status` already prints it (`crates/tui/src/commands/groups/config/status.rs:24-28`). **No model id is ever sent, for any provider** — `crates/runtime/src/safe_label.rs:11-15` documents that a model id can be a path, a URL, or a deployment id that is itself a credential.
**`counters`** — closed field set. Every bump happens at the **call site**, never inside a conditionally-entered handler:
@@ -460,13 +443,9 @@ to make defaults, and whether prompt caching is working.
"input_tokens": 418230,
"output_tokens": 9120,
"cache_read_tokens": 380001,
"cache_write_tokens": 0,
"requests": 27,
"reasoning_tokens": 2310,
"generation_secs": 412
"cache_write_tokens": 0
},
"turn_wall": { "lt_5s": 3, "5_30s": 8, "30_120s": 2, "gte_120s": 0 },
"context": { "lt_32k": 9, "32k_128k": 11, "128k_256k": 5, "gte_256k": 2 }
"turn_wall": { "lt_5s": 3, "5_30s": 8, "30_120s": 2, "gte_120s": 0 }
}
```
@@ -479,25 +458,6 @@ cache reads. Turn counts are by outcome, and `turn_wall` buckets each turn's
wall time as `session_end` does. A session reports at most 16 provider and model
pairs; later pairs are counted under `other`. No per-turn timeline is sent.
Schema 6 adds four aggregates to each row:
- `requests` counts the model requests this session made on its own route for
that provider and model.
- `reasoning_tokens` is the part of `output_tokens` the provider reports as
reasoning. `output_tokens` is not reduced, and the value is `0` when the
provider does not report it.
- `generation_secs` is the total whole seconds the session spent waiting on the
model for those requests. It is one sum for the session; no per-request
duration is ever sent.
- `context` counts requests by input size, in tokens including cache reads:
`lt_32k` is under 32768, `32k_128k` is 32768 up to 131072, `128k_256k` is
131072 up to 262144, and `gte_256k` is 262144 or more. The four buckets add up
to `requests`. Each edge belongs to the higher bucket. No per-request size is
sent.
Until a client fills them these values are `0`. A schema-4 row carries none of
these fields.
### Event: `tool_usage`
One event per tool a session called, sent with `session_end`. It is how
@@ -548,7 +508,7 @@ configured ingest may forward validated schema-v3 / notice-v5 batches and
legacy schema-v2 / consent-v4 batches to
PostHog's [batch capture API](https://posthog.com/docs/api/capture). The only
permitted origins are `https://us.i.posthog.com` and `https://eu.i.posthog.com`.
Schema-v1, schema-v4 and schema-v6 batches cannot reach that path in this source. PostHog receives the same bounded
Schema-v1 and schema-v4 batches cannot reach that path in this source. PostHog receives the same bounded
envelope and event fields, the batch timestamp as its event timestamp, and
`codewhale:<install_id>` as its anonymous `distinct_id`. Events are named
`codewhale_install_or_upgrade`, `codewhale_session_start`,
@@ -598,7 +558,7 @@ It prints the daily series, a 7-day trend over complete UTC days, the freshness
### What is never collected — the public red-line list
Prompts; completions; tool arguments; diffs; patches; file contents; filenames; absolute or relative paths; git remotes; repo names; branch names; workspace commit SHAs; memory entries; chat history; API keys, tokens, cookies, or `Authorization` headers (including any boolean asserting a key exists); model ids that are not in Codewhale's bundled public model catalog (custom, local, fine-tuned or private model names are sent only as `other`); custom provider table names; MCP server names, commands, URLs, or tool names; plugin and configured tool names; approval rule text; error message bodies; panic message text; per-event timestamps; per-request durations or sizes; environment variable values; CI vendor or job names; parent process names; hostnames; container ids; the date an installation was first seen (only the install-age bucket leaves the device); keystrokes; clipboard; screenshots; microphone; camera; location; and any third-party ad or analytics SDK — there are none in the runtime binary and none may be added.
Prompts; completions; tool arguments; diffs; patches; file contents; filenames; absolute or relative paths; git remotes; repo names; branch names; workspace commit SHAs; memory entries; chat history; API keys, tokens, cookies, or `Authorization` headers (including any boolean asserting a key exists); model ids that are not in Codewhale's bundled public model catalog (custom, local, fine-tuned or private model names are sent only as `other`); custom provider table names; MCP server names, commands, URLs, or tool names; plugin and configured tool names; approval rule text; error message bodies; panic message text; per-event timestamps; keystrokes; clipboard; screenshots; microphone; camera; location; and any third-party ad or analytics SDK — there are none in the runtime binary and none may be added.
Two named traps for the implementer. `crates/state/src/lib.rs` persists `git_sha`, `git_branch`, `git_origin_url`, `cwd`, and `path` on the threads table (`:93, :399, :653`): a payload builder that accepts a `Thread` or `ThreadMeta` and derives `Serialize` breaches the contract in one line. **Never derive `Serialize` over an existing state type** — build every telemetry struct from scratch with explicit fields. And `crates/core/src/lib.rs:1389-1398` is the one place in the tree where the word `telemetry` sits inside a JSON object next to `prompt`, `base_url`, and `has_api_key`. It is the object someone will copy. Do not.
@@ -607,7 +567,7 @@ Two named traps for the implementer. `crates/state/src/lib.rs` persists `git_sha
## Website funnel aggregates in the source candidate
The website extension uses `FUNNEL_SCHEMA_VERSION = 5` and notice version `7`.
The Rust runtime is on `SCHEMA_VERSION = 6`, notice `8`; existing browser
The Rust runtime remains on `SCHEMA_VERSION = 4`, notice `6`; existing browser
schema `3`, notice `5`, and legacy schemas `1` and `2` retain their original
contracts. Displaying a newer notice never overrides an opt-out or establishes
human acceptance. Schema 5 is first-party only and does not activate PostHog.
+1 -1
View File
@@ -805,7 +805,7 @@ owner = "crates/tui/src/commands/groups/session/export.rs"
[[feature]]
id = "live-thinking"
name = "Live thinking"
summary = "/verbose toggles live model thinking in the transcript."
summary = "Model thinking shows live in the transcript, then collapses under a Thought header; /verbose shows it in full."
status = "stable"
surfaces = { tui = "stable" }
owner = "crates/tui/src/commands/groups/config/mod.rs"
+1 -1
View File
@@ -1152,7 +1152,7 @@ codewhale 还把用户偏好存储在:
- `mention_menu_limit`(整数,默认 `128`):输入区渲染可见窗口之前保留的 `@`-提及弹出候选最大数。可见行仍取决于终端高度。
- `mention_walk_depth`(整数,默认 `10`):`@`-提及补全遍历的最大工作区深度。在深度嵌套的工作区设为 `0` 表示无限深度;在非常大的仓库保持默认,除非需要。
- `mention_menu_behavior`(`fuzzy`、`browser`;默认 `fuzzy`):控制 `@`-提及补全如何填充。`fuzzy` 搜索工作区并应用提及 frecency。`browser` 只按确定性字母顺序列出当前输入目录段的直接子项。
- `show_thinking`(on/off)
- `show_thinking`(on/off,默认 on):在对话记录中显示模型思考,流式输出时实时显示,回答开始后折叠到“思考用时 …”标题下。设为 off 则隐藏思考;回答和工具仍然可见。`settings.toml` 中已保存的值保持不变。
- `thinking_default_expanded`(on/off,默认 off):启用 `show_thinking` 时,让思考块初始以展开状态渲染。Space 仍可切换所选块,并且它只决定你尚未动过的块:你自己展开或折叠过的块,即使之后更改这个设置,也会保持该状态。这在 Space 绑定可能被拦截的 SSH/tmux 环境中很有用。
- `thinking_preview_lines`(整数,默认 `2`):**折叠**的已完成思考仍显示多少正文行。`0` 仅头部;`10` 是较旧的完整显示。实时流式预览不变。用 Space 展开块,或设置 `thinking_default_expanded` 打开每个块。
- `help_expand_groups`(on/off,默认 off):让帮助/快捷键从每个组展开开始。默认折叠长尾(Grok 风格);输入过滤仍展开匹配。
+7 -8
View File
@@ -15,9 +15,9 @@ hostname is the only way in.
The current Engine source defaults usage analytics on under notice version 6, with a
clear opt-out. Prior explicit declines remain off; a missing acceptance record
is not treated as consent. Schema 6 carries `notice_version: 8` and schema 4 carries `notice_version: 6`; schema 3
is not treated as consent. Schema 4 carries `notice_version: 6`; schema 3
uses notice 5, and legacy schema 2 retains its original explicit
`consent_version: 4` contract. Schema 1, 4 and 6 batches are first-party
`consent_version: 4` contract. Schema 1 and schema 4 batches are first-party
only in this source. Local validation is not proof this updated Worker has been deployed. A user who wants
to contact nobody sets `telemetry_endpoint = ""`, which writes batches to
`$CODEWHALE_HOME/telemetry/dryrun.jsonl` instead.
@@ -38,7 +38,7 @@ require separate operator approval; none is established by the local tests.
Validated schema 3 batches carrying `notice_version: 5` and legacy schema 2
batches carrying explicit `consent_version: 4` can reach the processor. Schema 1
and schema 4 and 6 batches remain first-party only. Capture uses
and schema 4 batches remain first-party only. Capture uses
`/batch/`, fixed anonymous/no-geo controls, no incoming headers, no cookies,
no redirects, no response parsing, no retries, and a 1.5-second timeout.
PostHog failure is isolated from the successful Analytics Engine write.
@@ -143,21 +143,20 @@ take the next free slot.
| `blob8` | `tty` — `'true'` \| `'false'` |
| `blob9` | `install_kind` (`install_or_upgrade` only) |
| `blob10` | `previous_version` (`install_or_upgrade` only) |
| `blob11` | `session_source` (`session_start` only; schema 6 adds `fleet_worker`, `agent`, `scripted`) |
| `blob12` | `duration_bucket` (`session_end`); `install_age` (`session_start`, schema 6 only: `new_today`, `under_week`, `older`, `''` for null or older schemas) |
| `blob13` | `exit_class` (`session_end` only; schema 6 adds `unclean`) |
| `blob11` | `session_source` (`session_start` only) |
| `blob12` | `duration_bucket` (`session_end` only) |
| `blob13` | `exit_class` (`session_end` only) |
| `blob14` | `cold_start_bucket` (`session_end` only; `''` on surfaces that do not measure it) |
| `blob15` | `providers`, comma-joined, already sorted and deduplicated; the one `provider` on `model_usage` |
| `blob16` | `panic_site` (`panic`) — a `crates/…` path or the literal `<dep>`; `model` (`model_usage`); `tool` (`tool_usage`) |
| `blob17` | `sent_at` — the *batch* timestamp. Events carry none. |
| `blob18` | `aggregate_counters` — closed JSON counts, for `product_usage` or `operations_summary` |
| `blob19` | `schema_version` |
| `blob20` | `privacy_version`: notice8 for v6, notice7 for the v5 website funnel, notice6 for v4, notice5 for v3, consent4 for v2, empty for v1; `blob19` keeps their meanings distinct |
| `blob20` | `privacy_version`: notice6 for v4, notice5 for v3, consent4 for v2, empty for v1; `blob19` keeps their meanings distinct |
| `double1..10` | `counters`: `turns`, `tool_calls`, `fleet_dispatch`, `workflow_run`, `subagent_spawn`, `mcp_server_connected`, `memory_search`, `approval_modal_shown`, `approval_auto_allowed`, `command_palette_open` |
| `double11..16` | `errors`: `auth_preflight_failed`, `provider_http_4xx`, `provider_http_5xx`, `tool_denied_by_policy`, `tool_timeout`, `network_error` |
| `double17..20` | `turn_wall`: `lt_5s`, `5_30s`, `30_120s`, `gte_120s` |
| `double1..11` on `model_usage` | `turns_ok`, `turns_failed`, `turns_interrupted`, `input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_write_tokens`, then `turn_wall` `lt_5s`, `5_30s`, `30_120s`, `gte_120s` |
| `double12..18` on `model_usage` | schema 6 only, `0` on v4 rows (`blob19` tells them apart): `requests`, `reasoning_tokens`, `generation_secs` (whole seconds, session sum, u32), then input-size request counts `lt_32k`, `32k_128k`, `128k_256k`, `gte_256k` |
| `double1..2` on `tool_usage` | `calls`, `errors` |
Columns not relevant to an event are `''` / `0`. `tty` is a blob because the 20
+5 -5
View File
@@ -13,7 +13,7 @@ export const CAVEATS = [
"Runtime install means first initialized enabled telemetry state, not all installations or new people. IDs rotate every 90 days and are removed on opt-out.",
"Native success is observed model turns_ok, not a first-ever primary or useful task. Missing usage, same-process child activity and late cancellation can affect it.",
"Dates are received batch dates rather than exact event times. Offline, opted-out and dropped deliveries are absent; ingest has no replay deduplication guarantee.",
"Native IDs with an observed CI, fleet worker, agent or scripted start are excluded in full because the aggregate schema cannot assign model counts to individual sessions.",
"Native IDs with an observed CI start are excluded in full because the aggregate schema cannot assign model counts to individual sessions.",
];
function instant(value, field) {
@@ -72,7 +72,7 @@ export function buildFunnelReport(input, { now = new Date() } = {}) {
const installs = new Map(); const successes = new Map(); const started = new Set(); const ci = new Set();
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
for (const row of input.native_rows) {
if (!uuid.test(row.install_id) || !NATIVE_SURFACES.includes(row.surface) || ![1, 2, 3, 4, 6].includes(count(row.schema_version, "schema_version"))) throw new Error("invalid native identity, surface or version");
if (!uuid.test(row.install_id) || !NATIVE_SURFACES.includes(row.surface) || ![1, 2, 3, 4].includes(count(row.schema_version, "schema_version"))) throw new Error("invalid native identity, surface or version");
const at = instant(fresh(row.received_at), "received_at");
if (!within(at, from, to)) throw new Error("native row outside coverage");
if (newest === null || at > newest) newest = at;
@@ -82,11 +82,11 @@ export function buildFunnelReport(input, { now = new Date() } = {}) {
if (!["install", "upgrade", "downgrade"].includes(row.install_kind)) throw new Error("invalid install kind");
if (row.install_kind === "install" && (!installs.has(row.install_id) || at < installs.get(row.install_id))) installs.set(row.install_id, at);
} else if (row.event === "session_start") {
if (!["interactive", "resume", "fork", "api", "unknown", "ci", "fleet_worker", "agent", "scripted"].includes(row.session_source)) throw new Error("invalid session source");
if (["ci", "fleet_worker", "agent", "scripted"].includes(row.session_source)) ci.add(row.install_id);
if (!["interactive", "resume", "fork", "api", "unknown", "ci"].includes(row.session_source)) throw new Error("invalid session source");
if (row.session_source === "ci") ci.add(row.install_id);
started.add(row.install_id);
} else if (row.event === "model_usage") {
if (![4, 6].includes(count(row.schema_version, "schema_version"))) throw new Error("model usage requires v4 or v6");
if (count(row.schema_version, "schema_version") !== 4) throw new Error("model usage requires v4");
if (count(row.turns_ok, "turns_ok") > 0) {
const observations = successes.get(row.install_id) ?? []; observations.push(at); successes.set(row.install_id, observations);
}
+4 -14
View File
@@ -24,14 +24,7 @@
*/
import type { Batch, Event } from "./schema";
import {
CONTEXT_FIELDS,
COUNTER_FIELDS,
ERROR_FIELDS,
MODEL_COUNTER_FIELDS,
MODEL_COUNTER_FIELDS_V6_EXTRA,
TURN_WALL_FIELDS,
} from "./schema";
import { COUNTER_FIELDS, ERROR_FIELDS, MODEL_COUNTER_FIELDS, TURN_WALL_FIELDS } from "./schema";
/** The subset of `AnalyticsEngineDataset` this Worker uses. */
export interface DataPointSink {
@@ -65,7 +58,7 @@ export const BLOB_COLUMNS = [
"install_kind", // blob9
"previous_version", // blob10
"session_source", // blob11
"duration_bucket", // blob12 session_end; install_age on session_start (schema 6)
"duration_bucket", // blob12
"exit_class", // blob13
"cold_start_bucket", // blob14
"providers", // blob15 comma-joined, already sorted and deduplicated
@@ -73,7 +66,7 @@ export const BLOB_COLUMNS = [
"sent_at", // blob17 the batch timestamp; events carry none
"aggregate_counters", // blob18 closed product/operations JSON count object
"schema_version", // blob19
"privacy_version", // blob20: v3 to v6 notice, v2 consent, empty on v1; blob19 disambiguates
"privacy_version", // blob20: v3/v4 notice, v2 consent, empty on v1; blob19 disambiguates
] as const;
/**
@@ -118,7 +111,6 @@ function toDataPoint(batch: Batch, event: Event): DataPoint {
break;
case "session_start":
blobs[10] = event.source;
blobs[11] = event.install_age ?? "";
break;
case "session_end":
blobs[11] = event.duration_bucket;
@@ -149,10 +141,8 @@ function toDataPoint(batch: Batch, event: Event): DataPoint {
doubles = [
...MODEL_COUNTER_FIELDS.map((field) => event.counters[field]),
...TURN_WALL_FIELDS.map((field) => event.turn_wall[field]),
...MODEL_COUNTER_FIELDS_V6_EXTRA.map((field) => event.counters[field] ?? 0),
...CONTEXT_FIELDS.map((field) => event.context?.[field] ?? 0),
...EMPTY_DOUBLES.slice(MODEL_COUNTER_FIELDS.length + TURN_WALL_FIELDS.length),
];
doubles = [...doubles, ...EMPTY_DOUBLES.slice(doubles.length)];
break;
case "tool_usage":
blobs[15] = event.tool;
+21 -77
View File
@@ -22,8 +22,6 @@ export const SCHEMA_VERSION = 4;
/** Notice-v5 batches without `model_usage`, `tool_usage` or the `ci` source. */
export const V3_SCHEMA_VERSION = 3;
export const V6_SCHEMA_VERSION = 6;
export const FUNNEL_SCHEMA_VERSION = 5;
export const FUNNEL_NOTICE_VERSION = 7;
export const FUNNEL_COUNTER_FIELDS = [
@@ -36,8 +34,6 @@ export const FUNNEL_COUNTER_FIELDS = [
/** Disclosed default-on policy, not a record of human acceptance. */
export const NOTICE_VERSION = 6;
export const V6_NOTICE_VERSION = 8;
/** The notice version schema v3 batches carry. */
export const V3_NOTICE_VERSION = 5;
@@ -150,11 +146,6 @@ export const SESSION_SOURCES = [
"ci",
] as const;
export const V6_ONLY_SESSION_SOURCES = ["fleet_worker", "agent", "scripted"] as const;
export const V6_SESSION_SOURCES = [...SESSION_SOURCES, ...V6_ONLY_SESSION_SOURCES] as const;
export const INSTALL_AGES = ["new_today", "under_week", "older"] as const;
/** `DurationBucket` wire spellings. */
export const DURATION_BUCKETS = [
"lt_1m",
@@ -166,8 +157,6 @@ export const DURATION_BUCKETS = [
/** `ExitClass::as_str`. */
export const EXIT_CLASSES = ["clean", "signal", "panic", "error"] as const;
export const V6_EXIT_CLASSES = [...EXIT_CLASSES, "unclean"] as const;
/** `ColdStartBucket` wire spellings. */
export const COLD_START_BUCKETS = [
"lt_250",
@@ -222,19 +211,6 @@ export const MODEL_COUNTER_FIELDS = [
"cache_write_tokens",
] as const;
export const MODEL_COUNTER_FIELDS_V6_EXTRA = [
"requests",
"reasoning_tokens",
"generation_secs",
] as const;
export const V6_MODEL_COUNTER_FIELDS = [
...MODEL_COUNTER_FIELDS,
...MODEL_COUNTER_FIELDS_V6_EXTRA,
] as const;
export const CONTEXT_FIELDS = ["lt_32k", "32k_128k", "128k_256k", "gte_256k"] as const;
/** `event::TOOL_NAMES` plus the `mcp` and `other` buckets. */
export const TOOL_NAMES = [
"agent", "apply_patch", "authenticate", "bash", "code_execution", "create_goal",
@@ -310,12 +286,6 @@ export const EVENT_FIELDS: Readonly<Record<string, readonly string[]>> = {
funnel_usage: ["event", "counters"],
};
export const V6_EVENT_FIELDS: Readonly<Record<string, readonly string[]>> = {
...EVENT_FIELDS,
session_start: ["event", "source", "install_age"],
model_usage: ["event", "provider", "model", "counters", "turn_wall", "context"],
};
/** Every event discriminant, for the doc-match test. */
export const EVENT_NAMES = Object.keys(EVENT_FIELDS);
@@ -460,7 +430,7 @@ export type FunnelCounters = Record<(typeof FUNNEL_COUNTER_FIELDS)[number], numb
export type Event =
| { event: "install_or_upgrade"; kind: string; previous_version: string | null }
| { event: "session_start"; source: string; install_age?: string | null }
| { event: "session_start"; source: string }
| {
event: "session_end";
duration_bucket: string;
@@ -478,10 +448,8 @@ export type Event =
event: "model_usage";
provider: string;
model: string;
counters: Record<(typeof MODEL_COUNTER_FIELDS)[number], number> &
Partial<Record<(typeof MODEL_COUNTER_FIELDS_V6_EXTRA)[number], number>>;
counters: Record<(typeof MODEL_COUNTER_FIELDS)[number], number>;
turn_wall: TurnWall;
context?: Record<(typeof CONTEXT_FIELDS)[number], number>;
}
| { event: "tool_usage"; tool: string; calls: number; errors: number }
| ({ event: "operations_summary" } & Record<(typeof OPERATIONS_FIELDS)[number], number>);
@@ -578,28 +546,13 @@ function u32Map(
return null;
}
function u32Fields(
value: Record<string, unknown>,
fields: readonly string[],
where: string,
): string | null {
for (const field of fields) {
const item = value[field];
if (typeof item !== "number" || !Number.isInteger(item) || item < 0 || item > U32_MAX) {
return `${where}.${field}: not a u32`;
}
}
return null;
}
function validateEvent(value: unknown, where: string, v6 = false): string | null {
function validateEvent(value: unknown, where: string): string | null {
if (!isPlainObject(value)) return `${where}: not an object`;
const name = value.event;
const eventFields = v6 ? V6_EVENT_FIELDS : EVENT_FIELDS;
if (typeof name !== "string" || !Object.hasOwn(eventFields, name)) {
if (typeof name !== "string" || !Object.hasOwn(EVENT_FIELDS, name)) {
return `${where}: unknown event discriminant`;
}
const keyError = keysExactly(value, eventFields[name], `${where}(${name})`);
const keyError = keysExactly(value, EVENT_FIELDS[name], `${where}(${name})`);
if (keyError) return keyError;
switch (name) {
@@ -622,15 +575,8 @@ function validateEvent(value: unknown, where: string, v6 = false): string | null
}
return null;
}
case "session_start": {
const sourceError = enumString(
value.source,
v6 ? V6_SESSION_SOURCES : SESSION_SOURCES,
`${where}.source`,
);
if (sourceError || !v6 || value.install_age === null) return sourceError;
return enumString(value.install_age, INSTALL_AGES, `${where}.install_age`);
}
case "session_start":
return enumString(value.source, SESSION_SOURCES, `${where}.source`);
case "session_end": {
const bucketError = enumString(
value.duration_bucket,
@@ -640,7 +586,7 @@ function validateEvent(value: unknown, where: string, v6 = false): string | null
if (bucketError) return bucketError;
const exitError = enumString(
value.exit_class,
v6 ? V6_EXIT_CLASSES : EXIT_CLASSES,
EXIT_CLASSES,
`${where}.exit_class`,
);
if (exitError) return exitError;
@@ -692,14 +638,9 @@ function validateEvent(value: unknown, where: string, v6 = false): string | null
if (typeof value.model !== "string" || !MODEL_RE.test(value.model)) {
return `${where}.model: not a catalogued model id`;
}
const counterError = v6
? countMap(value.counters, V6_MODEL_COUNTER_FIELDS, `${where}.counters`, Number.MAX_SAFE_INTEGER) ??
u32Fields(value.counters as Record<string, unknown>, ["requests", "generation_secs"], `${where}.counters`)
: countMap(value.counters, MODEL_COUNTER_FIELDS, `${where}.counters`, Number.MAX_SAFE_INTEGER);
return (
counterError ??
u32Map(value.turn_wall, TURN_WALL_FIELDS, `${where}.turn_wall`) ??
(v6 ? u32Map(value.context, CONTEXT_FIELDS, `${where}.context`) : null)
countMap(value.counters, MODEL_COUNTER_FIELDS, `${where}.counters`, Number.MAX_SAFE_INTEGER) ??
u32Map(value.turn_wall, TURN_WALL_FIELDS, `${where}.turn_wall`)
);
}
case "tool_usage":
@@ -734,12 +675,15 @@ export function validateBatch(value: unknown): Accepted | Rejection {
const legacy = value.schema_version === 1;
const explicitConsent = value.schema_version === 2;
const v3 = value.schema_version === V3_SCHEMA_VERSION;
const v4 = value.schema_version === SCHEMA_VERSION;
const funnel = value.schema_version === FUNNEL_SCHEMA_VERSION;
const v6 = value.schema_version === V6_SCHEMA_VERSION;
const preUsage = legacy || explicitConsent || v3;
if (!legacy && !explicitConsent && !v3 && !v4 && !funnel && !v6) {
const preUsage = value.schema_version !== SCHEMA_VERSION && !funnel;
if (
!legacy &&
!explicitConsent &&
value.schema_version !== SCHEMA_VERSION &&
!funnel &&
value.schema_version !== V3_SCHEMA_VERSION
) {
return { ok: false, reason: "batch.schema_version: unsupported" };
}
const fields = legacy ? LEGACY_ENVELOPE_FIELDS : explicitConsent ? V2_ENVELOPE_FIELDS : ENVELOPE_FIELDS;
@@ -751,7 +695,7 @@ export function validateBatch(value: unknown): Accepted | Rejection {
if (
!legacy &&
!explicitConsent &&
value.notice_version !== (funnel ? FUNNEL_NOTICE_VERSION : v6 ? V6_NOTICE_VERSION : preUsage ? V3_NOTICE_VERSION : NOTICE_VERSION)
value.notice_version !== (funnel ? FUNNEL_NOTICE_VERSION : preUsage ? V3_NOTICE_VERSION : NOTICE_VERSION)
) {
return { ok: false, reason: "batch.notice_version: current policy required" };
}
@@ -809,7 +753,7 @@ export function validateBatch(value: unknown): Accepted | Rejection {
return { ok: false, reason: "events: aggregate product/operations events require schema v2 or v3" };
}
if (preUsage && (event.event === "model_usage" || event.event === "tool_usage")) {
return { ok: false, reason: "events: model_usage and tool_usage require schema v4 or later" };
return { ok: false, reason: "events: model_usage and tool_usage require schema v4" };
}
if (preUsage && event.event === "session_start" && event.source === "ci") {
return { ok: false, reason: "events: the ci session source requires schema v4" };
@@ -818,7 +762,7 @@ export function validateBatch(value: unknown): Accepted | Rejection {
return { ok: false, reason: "events: operations_summary requires control-plane surface" };
}
}
const eventError = validateEvent(event, `events[${index}]`, v6);
const eventError = validateEvent(event, `events[${index}]`);
if (eventError) return { ok: false, reason: eventError };
}
+3 -3
View File
@@ -97,12 +97,12 @@ describe("additive website funnel contract", () => {
}
});
it("keeps the historical goldens and v6 accepted, with runtime v4 and v6 first-party only", async () => {
it("keeps all four historical goldens accepted and runtime v4 first-party only", async () => {
const fetch = vi.fn(); vi.stubGlobal("fetch", fetch);
for (const version of [1, 2, 3, 4, 6]) {
for (const version of [1, 2, 3, 4]) {
const batch = JSON.parse(readFileSync(new URL(`../../crates/telemetry/tests/golden/v${version}.json`, import.meta.url), "utf8"));
expect(validateBatch(batch).ok, `v${version}`).toBe(true);
if (version !== 4 && version !== 6) continue;
if (version !== 4) continue;
const { env, written } = harness();
expect((await worker.fetch(postJson(batch), { ...env, POSTHOG_HOST: "https://us.i.posthog.com", POSTHOG_PROJECT_TOKEN: "phc_local_test_fixture", POSTHOG_IP_SAFE_EGRESS_VERIFIED: "true" })).status).toBe(204);
expect(written).toHaveLength(batch.events.length);
+1 -147
View File
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
import worker from "../src/index";
import { INGEST_PATH } from "../src/route";
import { BLOB_COLUMNS, DOUBLE_COLUMNS } from "../src/datapoint";
import { MAX_BODY_BYTES, SURFACES, validateBatch } from "../src/schema";
import { MAX_BODY_BYTES, SURFACES } from "../src/schema";
import { goldenBatch, harness, post, postJson } from "./support";
describe("method and route", () => {
@@ -473,149 +473,3 @@ describe("failing closed and quiet", () => {
}
});
});
describe("schema 6", () => {
const golden = (version: number): Record<string, any> =>
JSON.parse(
readFileSync(
new URL(`../../crates/telemetry/tests/golden/v${version}.json`, import.meta.url),
"utf8",
),
);
const event = (batch: Record<string, any>, name: string) =>
batch.events.find((item: Record<string, any>) => item.event === name);
it("accepts every historical golden and the v6 golden", () => {
for (const version of [1, 2, 3, 4, 6]) {
expect(validateBatch(golden(version)).ok, `v${version}`).toBe(true);
}
});
it("answers 204 to the v4 and v6 goldens", async () => {
for (const version of [4, 6]) {
const { env, written } = harness();
expect((await worker.fetch(postJson(golden(version)), env)).status).toBe(204);
expect(written).toHaveLength(golden(version).events.length);
}
});
it("requires notice 8 on v6 and refuses the v4 notice", () => {
const batch = golden(6);
batch.notice_version = 6;
expect(validateBatch(batch).ok).toBe(false);
expect(validateBatch({ ...golden(4), notice_version: 8 }).ok).toBe(false);
});
it("refuses a v4 batch carrying any v6 key or value", () => {
const mutations: Array<(batch: Record<string, any>) => void> = [
(batch) => { event(batch, "model_usage").context = event(golden(6), "model_usage").context; },
(batch) => { event(batch, "model_usage").counters.requests = 1; },
(batch) => { event(batch, "model_usage").counters.reasoning_tokens = 1; },
(batch) => { event(batch, "model_usage").counters.generation_secs = 1; },
(batch) => { event(batch, "session_start").install_age = "older"; },
(batch) => { event(batch, "session_start").source = "fleet_worker"; },
(batch) => { event(batch, "session_start").source = "agent"; },
(batch) => { event(batch, "session_start").source = "scripted"; },
(batch) => { event(batch, "session_end").exit_class = "unclean"; },
];
for (const [index, mutate] of mutations.entries()) {
const batch = golden(4);
mutate(batch);
expect(validateBatch(batch).ok, `mutation ${index}`).toBe(false);
}
});
it("refuses a v6 batch missing or adding a key", () => {
const mutations: Array<(batch: Record<string, any>) => void> = [
(batch) => { delete event(batch, "model_usage").context; },
(batch) => { delete event(batch, "model_usage").context["32k_128k"]; },
(batch) => { event(batch, "model_usage").context.gte_512k = 0; },
(batch) => { delete event(batch, "model_usage").counters.requests; },
(batch) => { delete event(batch, "model_usage").counters.reasoning_tokens; },
(batch) => { delete event(batch, "model_usage").counters.generation_secs; },
(batch) => { event(batch, "model_usage").counters.generation_ms = 1; },
(batch) => { event(batch, "model_usage").model_family = "x"; },
(batch) => { delete event(batch, "session_start").install_age; },
(batch) => { event(batch, "session_start").extra = "x"; },
(batch) => { event(batch, "session_end").counters.requests = 1; },
];
for (const [index, mutate] of mutations.entries()) {
const batch = golden(6);
mutate(batch);
expect(validateBatch(batch).ok, `mutation ${index}`).toBe(false);
}
});
it("refuses open values where v6 has a closed set or a count", () => {
const mutations: Array<(batch: Record<string, any>) => void> = [
(batch) => { event(batch, "session_start").install_age = "2026-11-01"; },
(batch) => { event(batch, "session_start").install_age = "OLDER"; },
(batch) => { event(batch, "session_start").source = "github-actions"; },
(batch) => { event(batch, "session_end").exit_class = "killed"; },
(batch) => { event(batch, "model_usage").counters.requests = 4294967296; },
(batch) => { event(batch, "model_usage").counters.requests = 1.5; },
(batch) => { event(batch, "model_usage").counters.generation_secs = -1; },
(batch) => { event(batch, "model_usage").counters.generation_secs = 4294967296; },
(batch) => { event(batch, "model_usage").counters.generation_secs = 1794528251123; },
(batch) => { event(batch, "model_usage").counters.reasoning_tokens = "7"; },
(batch) => { event(batch, "model_usage").context.lt_32k = 4294967296; },
(batch) => { event(batch, "model_usage").context.lt_32k = "1"; },
(batch) => { event(batch, "model_usage").model = "/Users/someone/model"; },
];
for (const [index, mutate] of mutations.entries()) {
const batch = golden(6);
mutate(batch);
expect(validateBatch(batch).ok, `mutation ${index}`).toBe(false);
}
});
it("accepts a null install_age and every v6 source and exit class", () => {
for (const source of ["interactive", "resume", "fork", "api", "unknown", "ci", "fleet_worker", "agent", "scripted"]) {
for (const age of ["new_today", "under_week", "older", null]) {
const batch = golden(6);
event(batch, "session_start").source = source;
event(batch, "session_start").install_age = age;
expect(validateBatch(batch).ok, `${source}/${age}`).toBe(true);
}
}
for (const exit of ["clean", "signal", "panic", "error", "unclean"]) {
const batch = golden(6);
event(batch, "session_end").exit_class = exit;
expect(validateBatch(batch).ok, exit).toBe(true);
}
});
it("writes v6 model_usage after the unchanged eleven doubles, and leaves v4 rows zero there", async () => {
const v6 = harness();
await worker.fetch(postJson(golden(6)), v6.env);
const row = v6.written.find((point) => point.blobs[0] === "model_usage")!;
expect(row.doubles).toEqual([
12, 1, 0, 418230, 9120, 380001, 0,
3, 8, 2, 0,
27, 2310, 412,
9, 11, 5, 2,
0, 0,
]);
expect(row.blobs[BLOB_COLUMNS.indexOf("schema_version")]).toBe("6");
const v4 = harness();
await worker.fetch(postJson(golden(4)), v4.env);
const old = v4.written.find((point) => point.blobs[0] === "model_usage")!;
expect(old.doubles).toEqual([
12, 1, 0, 418230, 9120, 380001, 0,
3, 8, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
]);
});
it("writes install_age to blob12 of session_start rows only", async () => {
const { env, written } = harness();
await worker.fetch(postJson(golden(6)), env);
const start = written.find((point) => point.blobs[0] === "session_start")!;
expect(start.blobs[BLOB_COLUMNS.indexOf("session_source")]).toBe("fleet_worker");
expect(start.blobs[BLOB_COLUMNS.indexOf("duration_bucket")]).toBe("under_week");
const end = written.find((point) => point.blobs[0] === "session_end")!;
expect(end.blobs[BLOB_COLUMNS.indexOf("exit_class")]).toBe("unclean");
expect(end.blobs[BLOB_COLUMNS.indexOf("duration_bucket")]).toBe("1m_10m");
});
});
@@ -49,19 +49,6 @@ describe("existing-pipeline owner funnel report", () => {
expect(buildFunnelReport(input, { now: NOW }).native.seven_day_initialization_cohort.unavailable_reason).toContain("incomplete");
});
it("excludes fleet worker, agent and scripted starts like CI, and accepts v6 model usage", () => {
for (const source of ["fleet_worker", "agent", "scripted"]) {
const input = receipt();
input.native_rows.push({ ...native("session_start", "2026-10-04T00:00:00Z"), session_source: source });
input.native_rows.push({ ...native("model_usage", "2026-10-04T00:00:00Z"), schema_version: 6 });
const report = buildFunnelReport(input, { now: NOW });
expect(report.native.excluded_ci_ids, source).toBe(1);
expect(report.native.observed_completed_ids, source).toBe(0);
}
const input = receipt(); input.native_rows.push({ ...native("model_usage", "2026-10-04T00:00:00Z"), schema_version: 5 });
expect(() => buildFunnelReport(input, { now: NOW })).toThrow(/version/);
});
it("does not compute a cohort fraction from sampled native records", () => {
const input = receipt(); input.native_rows[0].weight = 4;
expect(buildFunnelReport(input, { now: NOW }).native.seven_day_initialization_cohort).toMatchObject({ fraction: null, sampled: true });
+4 -21
View File
@@ -20,27 +20,23 @@ import {
BATCH_MAX_BYTES,
BATCH_MAX_EVENTS,
COLD_START_BUCKETS,
CONTEXT_FIELDS,
COUNTER_FIELDS,
DURATION_BUCKETS,
ENVELOPE_FIELDS,
ERROR_FIELDS,
EVENT_FIELDS,
EVENT_NAMES,
INSTALL_AGES,
EXIT_CLASSES,
INSTALL_KINDS,
LIBCS,
MAX_BODY_BYTES,
OSES,
PRODUCT_COUNTER_FIELDS,
OPERATIONS_FIELDS,
SCHEMA_VERSION,
SESSION_SOURCES,
SURFACES,
TURN_WALL_FIELDS,
V6_EVENT_FIELDS as EVENT_FIELDS,
V6_EXIT_CLASSES as EXIT_CLASSES,
V6_MODEL_COUNTER_FIELDS,
V6_NOTICE_VERSION,
V6_SCHEMA_VERSION as SCHEMA_VERSION,
V6_SESSION_SOURCES as SESSION_SOURCES,
} from "../src/schema";
import { DOC, goldenBatch } from "./support";
@@ -172,16 +168,6 @@ describe("the doc and the validator publish the same fields", () => {
expect([...documentedKeys(BLOCKS[3])].sort()).toEqual(expected);
});
it("agrees on the model_usage field set, nested objects included", () => {
const expected = [
...EVENT_FIELDS.model_usage,
...V6_MODEL_COUNTER_FIELDS,
...TURN_WALL_FIELDS,
...CONTEXT_FIELDS,
].sort();
expect([...documentedKeys(BLOCKS[7])].sort()).toEqual([...new Set(expected)].sort());
});
it("agrees on the panic field set", () => {
expect([...documentedKeys(BLOCKS[4])].sort()).toEqual(
[...EVENT_FIELDS.panic].sort(),
@@ -230,7 +216,6 @@ describe("the doc and the validator publish the same enums", () => {
["session source", SESSION_SOURCES],
["duration bucket", DURATION_BUCKETS],
["exit class", EXIT_CLASSES],
["install age", INSTALL_AGES],
["cold start bucket", COLD_START_BUCKETS],
] as const)("publishes every %s value it accepts", (_label, values) => {
for (const value of values) {
@@ -247,8 +232,6 @@ describe("the doc and the validator publish the same limits", () => {
expect(match).not.toBeNull();
expect(Number((match as RegExpMatchArray)[1])).toBe(SCHEMA_VERSION);
expect(goldenBatch().schema_version).toBe(1); // preserved legacy golden
const notice = DOC.match(/`notice_version\s*=\s*(\d+)`/);
expect(Number((notice as RegExpMatchArray)[1])).toBe(V6_NOTICE_VERSION);
});
it("agrees on the per-batch caps", () => {
-10
View File
@@ -2,16 +2,6 @@
## Unreleased — 0.2.0
- Add data displays: `DataSparkline`, `DataBars` and `DataTrend` (a braille
line chart). The words carry every value; the ink draws in from a caller
progress (`MotionStep::drawn`) and is at its end state under reduced or
still motion. Bars glide from their previous values.
- Add `DataDisplay`, the same displays as JSON an agent can send:
`DataDisplay::from_json` validates it (finite numbers, at most 1024 points
or 24 bars, labels up to 120 characters), `describe` says the same facts as
plain text, and `DATA_DISPLAY_SCHEMA` is its tool schema. Try
`cargo run --example data`.
- Reexport the shared avatar contract from Codewhale Protocol. Rendering and
artwork stay in this library. Protocol 0.10.3 registry proof must precede
this package publication.
-1
View File
@@ -57,7 +57,6 @@ Gallery names are the exact names accepted by the gallery example; the
| Engine `agent_roster.rs::render_agent_roster`, `widgets/workflow_panel.rs::row_receipt_text`, `gate_receipts.rs`; GPUI `usage.rs::TurnRow`, `workbar.rs::Readout`, `working_context.rs::ExecutionReceipt` | `Receipt`, `ReceiptTable`, `ReceiptValue`, `Cost`, formatting helpers | Primitive/composite | `receipt-row`, `receipt-table`, `receipt-table-compact`, `receipt-table-minimal`, `receipt-table-clipped` |
| Engine `diff_render.rs::BoundedDiffRender`, `render_diff_bounded`, `history/file_mutation.rs`; GPUI `review.rs::DiffRowKind`, `workspace/render/review.rs::ReviewRows` | `Diff`, `DiffLine`, `DiffKind`, `DiffGutter`, `DiffHighlight`, `parse_unified` | Primitive | `diff`, `diff-wrapped`, `diff-no-numbers`, `diff-highlighted`, `review-scene` |
| Engine `widgets/workflow_panel.rs::WorkflowPanel`, `WorkflowPanelRow`, `history/checklist.rs`; GPUI `plans.rs`, `workspace/render/workers.rs` | `WorkflowTree`, `TreeNode`, `TreeState`, `CountBar` | Primitive/composite | `workflow-tree`, `workflow-tree-selected`, `workflow-tree-clipped`, `workflow-tree-long`, `count-bars` |
| Kit-native; data from the host or an agent's JSON (CW-8202) | `DataSparkline`, `DataBars`, `DataBarItem`, `DataTrend`, `DataDisplay`, `DataDisplayView`, `DataWords`, `DATA_DISPLAY_SCHEMA`, `MotionStep::drawn` | Primitive | `data-sparkline`, `data-bars`, `data-bars-growing`, `data-trend`, `data-trend-drawing`, `data-from-agent` |
| Engine `approval/view.rs::ApprovalView`, `approval/elevation.rs::ElevationView`, `auto_review.rs`; GPUI `workspace/render/conversation.rs::Workspace::render_attention`, `workspace/render/review.rs::Workspace::render_restore_confirmation` | `ApprovalCard`, `ApprovalSubject`, `ApprovalState`, `ApprovalChoice`, `ApprovalPaint`, `DecisionBand`, `DecisionBandPlan`, `DecisionBandAction`, `DecisionBandSave`, `ReviewVerdict`, `ReviewAggregate` | Composite | `approval-command`, `approval-outside`, `approval-patch`, `approval-elevation`, `approval-clipped`, `approval-spoofed`, `approval-native-band`, `approval-native-band-collapsed`, `review-verdicts`, `review-aggregate` |
| GPUI `workspace/render/conversation.rs::Workspace::render_attention`, `workspace/render/files.rs::Workspace::render_artifact_column` | `AttentionQueue`, `AttentionItem`, `ArtifactShelf`, `Artifact` | Composite | `attention-queue`, `attention-focused`, `attention-narrow`, `attention-empty`, `artifact`, `artifact-shelf`, `artifact-narrow`, `artifact-unknown`, `artifact-empty` |
| Engine `views/mod.rs::ConfigView`, `ConfigRow`, `ConfigView::render_setting_detail`; GPUI `settings.rs::Spec`, `Applies`, `workspace/settings/mod.rs::Settings` | `SettingRow`, `SettingDetail`, `SettingWords` | Composite | `setting-row`, `setting-detail` |
-276
View File
@@ -1,276 +0,0 @@
//! Live data displays: `cargo run --example data`.
//!
//! A sparkline takes a new value every 400 ms, the trend draws in, and the
//! bars glide to new values every three seconds. r replays, m switches
//! between full and reduced motion, q or Escape exits.
//!
//! `--json FILE` shows one agent-sent [`DataDisplay`] instead.
//! `--text` prints the final frame and each display's plain description.
//! `--svg DIR` writes frames at fixed draw-in points.
use std::{
io,
path::PathBuf,
time::{Duration, Instant},
};
use codewhale_ratatui::{
DataBarItem, DataDisplay, DataWords, MotionEasing, MotionMode, MotionPolicy, MotionStep,
MotionTiming, Paint, Role, Theme,
testing::{self, Profile},
};
use crossterm::{
event::{self, Event, KeyCode, KeyEventKind},
execute,
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
};
use ratatui::{Terminal, backend::CrosstermBackend, buffer::Buffer, layout::Rect};
const TICK: Duration = Duration::from_millis(400);
const RESHUFFLE: Duration = Duration::from_secs(3);
const DRAW_IN: MotionTiming =
MotionTiming::space(Duration::from_millis(1_400), MotionEasing::EaseOut);
const GLIDE: MotionTiming = MotionTiming::PANEL;
struct Noise(u64);
impl Noise {
fn next(&mut self) -> f64 {
self.0 = self
.0
.wrapping_mul(6_364_136_223_846_793_005)
.wrapping_add(1);
(self.0 >> 33) as f64 / f64::from(1u32 << 31)
}
}
struct Board {
noise: Noise,
requests: Vec<f64>,
latency: Vec<f64>,
bars: DataDisplay,
bars_before: DataDisplay,
draw: MotionStep,
glide: MotionStep,
agent: Option<DataDisplay>,
}
fn crate_bars(noise: &mut Noise) -> DataDisplay {
DataDisplay::Bars {
label: "Tests by crate".into(),
unit: "tests".into(),
items: ["engine", "tui", "runtime", "protocol", "config"]
.into_iter()
.map(|name| DataBarItem::new(name, (40.0 + noise.next() * 400.0).round()))
.collect(),
}
}
impl Board {
fn new(agent: Option<DataDisplay>) -> Self {
let mut noise = Noise(7);
let latency = (0..96)
.map(|i| 80.0 + 45.0 * (f64::from(i) / 9.0).sin() + noise.next() * 30.0)
.collect();
let requests = (0..40).map(|_| 20.0 + noise.next() * 60.0).collect();
let bars = crate_bars(&mut noise);
Self {
noise,
requests,
latency,
bars_before: DataDisplay::Bars {
label: String::new(),
unit: String::new(),
items: Vec::new(),
},
bars,
draw: MotionStep::at_rest(0.0),
glide: MotionStep::at_rest(1.0),
agent,
}
}
fn replay(&mut self, now: Instant, policy: MotionPolicy) {
self.draw = MotionStep::at_rest(0.0);
self.draw.go(1.0, now, DRAW_IN, policy);
}
fn tick(&mut self) {
let last = self.requests.last().copied().unwrap_or(50.0);
let next = (last + (self.noise.next() - 0.5) * 30.0).clamp(5.0, 120.0);
self.requests.push(next.round());
if self.requests.len() > 200 {
self.requests.remove(0);
}
}
fn reshuffle(&mut self, now: Instant, policy: MotionPolicy) {
self.bars_before = std::mem::replace(&mut self.bars, crate_bars(&mut self.noise));
self.glide = MotionStep::at_rest(0.0);
self.glide.go(1.0, now, GLIDE, policy);
}
fn paint(&self, area: Rect, buf: &mut Buffer, theme: &Theme, draw: f32, glide: f32) {
buf.set_style(area, theme.bg(Role::Background));
let inner = Rect::new(
area.x + 2,
area.y + 1,
area.width.saturating_sub(4),
area.height.saturating_sub(2),
);
if let Some(agent) = &self.agent {
agent.view().drawn(draw).paint(inner, buf, theme);
return;
}
let row =
|y: u16, h: u16| Rect::new(inner.x, inner.y + y, inner.width, h).intersection(inner);
let requests = DataDisplay::Sparkline {
label: "Requests".into(),
unit: "rpm".into(),
values: self.requests.clone(),
};
let latency = DataDisplay::Trend {
label: "Latency".into(),
unit: "ms".into(),
values: self.latency.clone(),
rows: Some(9),
};
requests.view().drawn(draw).paint(row(0, 1), buf, theme);
latency.view().drawn(draw).paint(row(2, 9), buf, theme);
self.bars
.view()
.from(&self.bars_before)
.drawn(glide.min(draw))
.paint(row(12, 6), buf, theme);
}
fn displays(&self) -> Vec<DataDisplay> {
if let Some(agent) = &self.agent {
return vec![agent.clone()];
}
vec![
DataDisplay::Sparkline {
label: "Requests".into(),
unit: "rpm".into(),
values: self.requests.clone(),
},
DataDisplay::Trend {
label: "Latency".into(),
unit: "ms".into(),
values: self.latency.clone(),
rows: Some(9),
},
self.bars.clone(),
]
}
}
fn main() -> io::Result<()> {
let args: Vec<String> = std::env::args().skip(1).collect();
let value = |flag: &str| {
args.iter()
.position(|a| a == flag)
.and_then(|i| args.get(i + 1))
.cloned()
};
let agent = match value("--json") {
Some(path) => {
let json = std::fs::read_to_string(&path)?;
match DataDisplay::from_json(&json) {
Ok(shown) => Some(shown),
Err(e) => {
eprintln!("{path}: {e}");
std::process::exit(2);
}
}
}
None => None,
};
let board = Board::new(agent);
if args.iter().any(|a| a == "--text") {
let buf = testing::render(84, 20, |area, buf| {
board.paint(area, buf, &Profile::DarkTrue.theme(), 1.0, 1.0);
});
println!("{}", testing::text(&buf));
for shown in board.displays() {
println!("{}", shown.describe(&DataWords::default()));
}
return Ok(());
}
if let Some(dir) = value("--svg") {
let dir = PathBuf::from(dir);
std::fs::create_dir_all(&dir)?;
let theme = Profile::DarkTrue.theme();
for (i, at) in [0.2_f32, 0.5, 0.8, 1.0].into_iter().enumerate() {
let buf = testing::render(84, 20, |area, buf| board.paint(area, buf, &theme, at, at));
let path = dir.join(format!("data-{i}.svg"));
std::fs::write(&path, testing::svg(&buf, &theme))?;
println!("{}", path.display());
}
return Ok(());
}
run(board)
}
fn run(mut board: Board) -> io::Result<()> {
enable_raw_mode()?;
let mut out = io::stdout();
execute!(out, EnterAlternateScreen)?;
let mut terminal = Terminal::new(CrosstermBackend::new(out))?;
let theme = Theme::detect().tui();
let mut mode = MotionMode::Full;
let mut policy = MotionPolicy::new(mode, &theme);
let start = Instant::now();
board.replay(start, policy);
let (mut next_tick, mut next_shuffle) = (start + TICK, start + RESHUFFLE);
let result = loop {
let now = Instant::now();
if now >= next_tick {
board.tick();
next_tick = now + TICK;
}
if now >= next_shuffle {
board.reshuffle(now, policy);
next_shuffle = now + RESHUFFLE;
}
let (draw, glide) = (
board.draw.drawn(now, policy),
board.glide.drawn(now, policy),
);
terminal.draw(|f| board.paint(f.area(), f.buffer_mut(), &theme, draw, glide))?;
let due = [
board.draw.next_frame_at(now, policy),
board.glide.next_frame_at(now, policy),
]
.into_iter()
.flatten()
.chain([next_tick, next_shuffle])
.min()
.unwrap_or(next_tick);
if event::poll(due.saturating_duration_since(Instant::now()))?
&& let Event::Key(key) = event::read()?
&& key.kind != KeyEventKind::Release
{
match key.code {
KeyCode::Char('q') | KeyCode::Esc => break Ok(()),
KeyCode::Char('r') => board.replay(Instant::now(), policy),
KeyCode::Char('m') => {
mode = if mode == MotionMode::Full {
MotionMode::Reduced
} else {
MotionMode::Full
};
policy = MotionPolicy::new(mode, &theme);
}
_ => {}
}
}
};
disable_raw_mode()?;
execute!(terminal.backend_mut(), LeaveAlternateScreen)?;
result
}
File diff suppressed because it is too large. Load diff
-2
View File
@@ -59,12 +59,10 @@ pub use tabs::*;
pub use toggle::*;
// Package Display.
mod chart;
mod diff;
mod progress;
mod receipt;
mod tree;
pub use chart::*;
pub use diff::*;
pub use progress::*;
pub use receipt::*;
-8
View File
@@ -366,14 +366,6 @@ impl MotionStep {
}
}
/// Progress for a draw-in, in `0..=1`: eased where `policy` lets space
/// move, the target where it does not. Feed it to a data display's
/// `drawn`.
#[must_use]
pub fn drawn(&self, now: Instant, policy: MotionPolicy) -> f32 {
self.shown(now, policy, MotionChannel::Space)
}
/// A column between `from` and `to`: slide a marker, nudge a panel.
#[must_use]
pub fn offset(&self, now: Instant, policy: MotionPolicy, from: u16, to: u16) -> u16 {
@@ -1,360 +0,0 @@
---
source: src/components/chart.rs
assertion_line: 1242
expression: "testing::snapshot(12, |area, buf, theme|\n{\n let row = |y: u16, h: u16|\n { Rect::new(area.x, area.y + y, area.width, h).intersection(area) };\n DataSparkline::new(\"Requests\",\n &values).unit(\"rpm\").paint(row(0, 1), buf, theme);\n DataBars::new(\"Tokens by model\",\n &items).unit(\"tokens\").paint(row(2, 5), buf, theme);\n DataTrend::new(\"Latency\",\n &values).unit(\"ms\").rows(5).paint(row(7, 5), buf, theme);\n})"
---
== dark-truecolor · 40x12
Requests ▁▃▅▄▅▆▇███▆▅▄▃▂▁ now 45.6 rpm
Tokens by model
opus ██████████████████ 12.4k tokens
sonnet ███████████▌ 7900 tokens
haiku ████▌ 3100 tokens
cache 0 tokens
Latency now 45.6 ms
69.7 ms │ ⡠⠒⠑⠒⠒⠢⣀ ⡀⡠⠔⠉⠉⢢⡀
│⢀⠔⠁ ⢇ ⢀⠔⠉ ⠈⠑⢄
│⠁ ⠑⠢⡀ ⡠⠊
17.2 ms │ ⠈⠱⣀⣀⠤⠊⠊
---
r0 c0..8 fg=Foreground bg=Background bold
r0 c8..10 bg=Background
r0 c10..26 fg=Accent bg=Background
r0 c26..28 bg=Background
r0 c28..32 fg=Muted bg=Background
r0 c32..40 fg=Foreground bg=Background
r1 c0..40 bg=Background
r2 c0..15 fg=Foreground bg=Background bold
r2 c15..40 bg=Background
r3 c0..6 fg=Foreground bg=Background
r3 c6..8 bg=Background
r3 c8..26 fg=Accent bg=Background
r3 c26..28 bg=Background
r3 c28..40 fg=Muted bg=Background
r4 c0..6 fg=Foreground bg=Background
r4 c6..8 bg=Background
r4 c8..20 fg=Accent bg=Background
r4 c20..28 bg=Background
r4 c28..39 fg=Muted bg=Background
r4 c39..40 bg=Background
r5 c0..6 fg=Foreground bg=Background
r5 c6..8 bg=Background
r5 c8..13 fg=Accent bg=Background
r5 c13..28 bg=Background
r5 c28..39 fg=Muted bg=Background
r5 c39..40 bg=Background
r6 c0..6 fg=Foreground bg=Background
r6 c6..28 bg=Background
r6 c28..36 fg=Muted bg=Background
r6 c36..40 bg=Background
r7 c0..7 fg=Foreground bg=Background bold
r7 c7..9 bg=Background
r7 c9..13 fg=Muted bg=Background
r7 c13..20 fg=Foreground bg=Background
r7 c20..40 bg=Background
r8 c0..8 fg=Muted bg=Background
r8 c8..9 fg=Dim bg=Background
r8 c9..11 bg=Background
r8 c11..18 fg=Accent bg=Background
r8 c18..31 bg=Background
r8 c31..38 fg=Accent bg=Background
r8 c38..40 bg=Background
r9 c0..8 fg=Muted bg=Background
r9 c8..9 fg=Dim bg=Background
r9 c9..12 fg=Accent bg=Background
r9 c12..18 bg=Background
r9 c18..19 fg=Accent bg=Background
r9 c19..29 bg=Background
r9 c29..32 fg=Accent bg=Background
r9 c32..37 bg=Background
r9 c37..40 fg=Accent bg=Background
r10 c0..8 fg=Muted bg=Background
r10 c8..9 fg=Dim bg=Background
r10 c9..10 fg=Accent bg=Background
r10 c10..19 bg=Background
r10 c19..22 fg=Accent bg=Background
r10 c22..28 bg=Background
r10 c28..30 fg=Accent bg=Background
r10 c30..40 bg=Background
r11 c0..8 fg=Muted bg=Background
r11 c8..9 fg=Dim bg=Background
r11 c9..21 bg=Background
r11 c21..28 fg=Accent bg=Background
r11 c28..40 bg=Background
== dark-truecolor · 80x12
Requests ▂▁▁▁▁▁▂▂▂▃▃▄▅▆▆▆▇▇████▇▇▆▆▅▅ now 45.6 rpm min 17.2 rpm max 69.7 rpm
Tokens by model
opus ██████████████████████████████████████████████████████████ 12.4k tokens
sonnet █████████████████████████████████████ 7900 tokens
haiku ██████████████▌ 3100 tokens
cache 0 tokens
Latency now 45.6 ms min 17.2 ms max 69.7 ms
69.7 ms │ ⣀⠤⠒⠊⠑⠒⠒⠒⠒⠒⠒⠢⠤⢄⣀ ⣀ ⣀⡠⠤⠒⠒⠉⠉⠉⠉⠢⢄⣀⣀
│ ⣀⠤⠒⠉ ⠑⠤⣀ ⢀⡠⠒⠉ ⠉ ⠉⠑⠒⠤⣀
│⠉ ⠉⠑⠒⠤⢄⣀ ⡠⠔⠊⠁
17.2 ms │ ⠉⠑⢄⣀⣀⣀⣀⣀⠤⠤⠒⠊⠒⠊⠉
---
r0 c0..8 fg=Foreground bg=Background bold
r0 c8..10 bg=Background
r0 c10..38 fg=Accent bg=Background
r0 c38..40 bg=Background
r0 c40..44 fg=Muted bg=Background
r0 c44..52 fg=Foreground bg=Background
r0 c52..54 bg=Background
r0 c54..58 fg=Muted bg=Background
r0 c58..66 fg=Foreground bg=Background
r0 c66..68 bg=Background
r0 c68..72 fg=Muted bg=Background
r0 c72..80 fg=Foreground bg=Background
r1 c0..80 bg=Background
r2 c0..15 fg=Foreground bg=Background bold
r2 c15..80 bg=Background
r3 c0..6 fg=Foreground bg=Background
r3 c6..8 bg=Background
r3 c8..66 fg=Accent bg=Background
r3 c66..68 bg=Background
r3 c68..80 fg=Muted bg=Background
r4 c0..6 fg=Foreground bg=Background
r4 c6..8 bg=Background
r4 c8..45 fg=Accent bg=Background
r4 c45..68 bg=Background
r4 c68..79 fg=Muted bg=Background
r4 c79..80 bg=Background
r5 c0..6 fg=Foreground bg=Background
r5 c6..8 bg=Background
r5 c8..23 fg=Accent bg=Background
r5 c23..68 bg=Background
r5 c68..79 fg=Muted bg=Background
r5 c79..80 bg=Background
r6 c0..6 fg=Foreground bg=Background
r6 c6..68 bg=Background
r6 c68..76 fg=Muted bg=Background
r6 c76..80 bg=Background
r7 c0..7 fg=Foreground bg=Background bold
r7 c7..9 bg=Background
r7 c9..13 fg=Muted bg=Background
r7 c13..20 fg=Foreground bg=Background
r7 c20..22 bg=Background
r7 c22..26 fg=Muted bg=Background
r7 c26..33 fg=Foreground bg=Background
r7 c33..35 bg=Background
r7 c35..39 fg=Muted bg=Background
r7 c39..46 fg=Foreground bg=Background
r7 c46..80 bg=Background
r8 c0..8 fg=Muted bg=Background
r8 c8..9 fg=Dim bg=Background
r8 c9..14 bg=Background
r8 c14..29 fg=Accent bg=Background
r8 c29..60 bg=Background
r8 c60..61 fg=Accent bg=Background
r8 c61..62 bg=Background
r8 c62..75 fg=Accent bg=Background
r8 c75..80 bg=Background
r9 c0..8 fg=Muted bg=Background
r9 c8..9 fg=Dim bg=Background
r9 c9..10 bg=Background
r9 c10..14 fg=Accent bg=Background
r9 c14..29 bg=Background
r9 c29..32 fg=Accent bg=Background
r9 c32..56 bg=Background
r9 c56..60 fg=Accent bg=Background
r9 c60..61 bg=Background
r9 c61..62 fg=Accent bg=Background
r9 c62..75 bg=Background
r9 c75..80 fg=Accent bg=Background
r10 c0..8 fg=Muted bg=Background
r10 c8..9 fg=Dim bg=Background
r10 c9..10 fg=Accent bg=Background
r10 c10..32 bg=Background
r10 c32..38 fg=Accent bg=Background
r10 c38..53 bg=Background
r10 c53..57 fg=Accent bg=Background
r10 c57..80 bg=Background
r11 c0..8 fg=Muted bg=Background
r11 c8..9 fg=Dim bg=Background
r11 c9..38 bg=Background
r11 c38..53 fg=Accent bg=Background
r11 c53..80 bg=Background
== dark-truecolor · 120x12
Requests ▄▅▆▆▇██▇██▇▇▇▇▅▅▄▄▃▃▂▁▁▁▁▁▂▂▂▃▃▄▅▆▆▆▇▇████▇▇▆▆▅▅ now 45.6 rpm min 17.2 rpm max 69.7 rpm
Tokens by model
opus ██████████████████████████████████████████████████████████████████████████████████████████████████ 12.4k tokens
sonnet ██████████████████████████████████████████████████████████████▍ 7900 tokens
haiku ████████████████████████▌ 3100 tokens
cache 0 tokens
Latency now 45.6 ms min 17.2 ms max 69.7 ms
69.7 ms │ ⢀⣀⠤⠤⠒⠒⠊⠉⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠢⠤⠤⠤⣀⣀ ⣀⡀ ⣀⣀⠤⠤⠒⠒⠒⠊⠉⠉⠉⠉⠉⠉⠒⠤⢄⣀⣀⣀
│ ⢀⣀⠤⠔⠒⠉⠁ ⠉⠢⠤⣀⣀ ⣀⡠⠤⠒⠊⠉ ⠈⠉ ⠉⠉⠑⠒⠒⠤⠤⣀
│⠉⠁ ⠉⠉⠒⠒⠢⠤⢄⣀⣀ ⢀⣀⠤⠔⠊⠉
17.2 ms │ ⠉⠉⠑⠢⢄⣀⣀⣀⣀⣀⣀⣀⡠⠤⠤⠤⠒⠒⠊⠑⠒⠒⠉⠁
---
r0 c0..8 fg=Foreground bg=Background bold
r0 c8..10 bg=Background
r0 c10..58 fg=Accent bg=Background
r0 c58..60 bg=Background
r0 c60..64 fg=Muted bg=Background
r0 c64..72 fg=Foreground bg=Background
r0 c72..74 bg=Background
r0 c74..78 fg=Muted bg=Background
r0 c78..86 fg=Foreground bg=Background
r0 c86..88 bg=Background
r0 c88..92 fg=Muted bg=Background
r0 c92..100 fg=Foreground bg=Background
r0 c100..120 bg=Background
r1 c0..120 bg=Background
r2 c0..15 fg=Foreground bg=Background bold
r2 c15..120 bg=Background
r3 c0..6 fg=Foreground bg=Background
r3 c6..8 bg=Background
r3 c8..106 fg=Accent bg=Background
r3 c106..108 bg=Background
r3 c108..120 fg=Muted bg=Background
r4 c0..6 fg=Foreground bg=Background
r4 c6..8 bg=Background
r4 c8..71 fg=Accent bg=Background
r4 c71..108 bg=Background
r4 c108..119 fg=Muted bg=Background
r4 c119..120 bg=Background
r5 c0..6 fg=Foreground bg=Background
r5 c6..8 bg=Background
r5 c8..33 fg=Accent bg=Background
r5 c33..108 bg=Background
r5 c108..119 fg=Muted bg=Background
r5 c119..120 bg=Background
r6 c0..6 fg=Foreground bg=Background
r6 c6..108 bg=Background
r6 c108..116 fg=Muted bg=Background
r6 c116..120 bg=Background
r7 c0..7 fg=Foreground bg=Background bold
r7 c7..9 bg=Background
r7 c9..13 fg=Muted bg=Background
r7 c13..20 fg=Foreground bg=Background
r7 c20..22 bg=Background
r7 c22..26 fg=Muted bg=Background
r7 c26..33 fg=Foreground bg=Background
r7 c33..35 bg=Background
r7 c35..39 fg=Muted bg=Background
r7 c39..46 fg=Foreground bg=Background
r7 c46..120 bg=Background
r8 c0..8 fg=Muted bg=Background
r8 c8..9 fg=Dim bg=Background
r8 c9..16 bg=Background
r8 c16..40 fg=Accent bg=Background
r8 c40..89 bg=Background
r8 c89..91 fg=Accent bg=Background
r8 c91..92 bg=Background
r8 c92..112 fg=Accent bg=Background
r8 c112..120 bg=Background
r9 c0..8 fg=Muted bg=Background
r9 c8..9 fg=Dim bg=Background
r9 c9..10 bg=Background
r9 c10..17 fg=Accent bg=Background
r9 c17..40 bg=Background
r9 c40..45 fg=Accent bg=Background
r9 c45..83 bg=Background
r9 c83..89 fg=Accent bg=Background
r9 c89..90 bg=Background
r9 c90..92 fg=Accent bg=Background
r9 c92..112 bg=Background
r9 c112..120 fg=Accent bg=Background
r10 c0..8 fg=Muted bg=Background
r10 c8..9 fg=Dim bg=Background
r10 c9..11 fg=Accent bg=Background
r10 c11..45 bg=Background
r10 c45..54 fg=Accent bg=Background
r10 c54..77 bg=Background
r10 c77..83 fg=Accent bg=Background
r10 c83..120 bg=Background
r11 c0..8 fg=Muted bg=Background
r11 c8..9 fg=Dim bg=Background
r11 c9..54 bg=Background
r11 c54..78 fg=Accent bg=Background
r11 c78..120 bg=Background
== no-color · 40x12
Requests ▁▃▅▄▅▆▇███▆▅▄▃▂▁ now 45.6 rpm
Tokens by model
opus ██████████████████ 12.4k tokens
sonnet ███████████▌ 7900 tokens
haiku ████▌ 3100 tokens
cache 0 tokens
Latency now 45.6 ms
69.7 ms │ ⡠⠒⠑⠒⠒⠢⣀ ⡀⡠⠔⠉⠉⢢⡀
│⢀⠔⠁ ⢇ ⢀⠔⠉ ⠈⠑⢄
│⠁ ⠑⠢⡀ ⡠⠊
17.2 ms │ ⠈⠱⣀⣀⠤⠊⠊
== no-color · 80x12
Requests ▂▁▁▁▁▁▂▂▂▃▃▄▅▆▆▆▇▇████▇▇▆▆▅▅ now 45.6 rpm min 17.2 rpm max 69.7 rpm
Tokens by model
opus ██████████████████████████████████████████████████████████ 12.4k tokens
sonnet █████████████████████████████████████ 7900 tokens
haiku ██████████████▌ 3100 tokens
cache 0 tokens
Latency now 45.6 ms min 17.2 ms max 69.7 ms
69.7 ms │ ⣀⠤⠒⠊⠑⠒⠒⠒⠒⠒⠒⠢⠤⢄⣀ ⣀ ⣀⡠⠤⠒⠒⠉⠉⠉⠉⠢⢄⣀⣀
│ ⣀⠤⠒⠉ ⠑⠤⣀ ⢀⡠⠒⠉ ⠉ ⠉⠑⠒⠤⣀
│⠉ ⠉⠑⠒⠤⢄⣀ ⡠⠔⠊⠁
17.2 ms │ ⠉⠑⢄⣀⣀⣀⣀⣀⠤⠤⠒⠊⠒⠊⠉
== no-color · 120x12
Requests ▄▅▆▆▇██▇██▇▇▇▇▅▅▄▄▃▃▂▁▁▁▁▁▂▂▂▃▃▄▅▆▆▆▇▇████▇▇▆▆▅▅ now 45.6 rpm min 17.2 rpm max 69.7 rpm
Tokens by model
opus ██████████████████████████████████████████████████████████████████████████████████████████████████ 12.4k tokens
sonnet ██████████████████████████████████████████████████████████████▍ 7900 tokens
haiku ████████████████████████▌ 3100 tokens
cache 0 tokens
Latency now 45.6 ms min 17.2 ms max 69.7 ms
69.7 ms │ ⢀⣀⠤⠤⠒⠒⠊⠉⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠢⠤⠤⠤⣀⣀ ⣀⡀ ⣀⣀⠤⠤⠒⠒⠒⠊⠉⠉⠉⠉⠉⠉⠒⠤⢄⣀⣀⣀
│ ⢀⣀⠤⠔⠒⠉⠁ ⠉⠢⠤⣀⣀ ⣀⡠⠤⠒⠊⠉ ⠈⠉ ⠉⠉⠑⠒⠒⠤⠤⣀
│⠉⠁ ⠉⠉⠒⠒⠢⠤⢄⣀⣀ ⢀⣀⠤⠔⠊⠉
17.2 ms │ ⠉⠉⠑⠢⢄⣀⣀⣀⣀⣀⣀⣀⡠⠤⠤⠤⠒⠒⠊⠑⠒⠒⠉⠁
== ascii · 40x12
Requests _.---=####=--.__ now 45.6 rpm
Tokens by model
opus ################## 12.4k tokens
sonnet ############ 7900 tokens
haiku ##### 3100 tokens
cache 0 tokens
Latency now 45.6 ms
69.7 ms | ....... .....:.
|... : ... ...
|. ... ..
17.2 ms | .:.....
== ascii · 80x12
Requests _________..--===########==-- now 45.6 rpm min 17.2 rpm max 69.7 rpm
Tokens by model
opus ########################################################## 12.4k tokens
sonnet ##################################### 7900 tokens
haiku ############### 3100 tokens
cache 0 tokens
Latency now 45.6 ms min 17.2 ms max 69.7 ms
69.7 ms | ............... . .............
| .... ... .... . .....
|. ...... ....
17.2 ms | ...............
== ascii · 120x12
Requests --==##########----.._________..--===########==-- now 45.6 rpm min 17.2 rpm max 69.7 rpm
Tokens by model
opus ################################################################################################## 12.4k tokens
sonnet ############################################################### 7900 tokens
haiku ######################### 3100 tokens
cache 0 tokens
Latency now 45.6 ms min 17.2 ms max 69.7 ms
69.7 ms | ........................ .. ....................
| ....... ..... ...... .. ........
|.. ......... ......
17.2 ms | ........................
-118
View File
@@ -1,118 +0,0 @@
//! Gallery: data displays fully drawn, mid draw-in, empty and from agent JSON.
use ratatui::{buffer::Buffer, layout::Rect};
use super::Entry;
use crate::{DataBarItem, DataBars, DataDisplay, DataSparkline, DataTrend, Paint, Theme};
fn series() -> Vec<f64> {
(0..64)
.map(|i| 120.0 + 60.0 * (f64::from(i) / 6.0).sin() + f64::from((i * 7) % 11) * 3.0)
.collect()
}
fn items() -> Vec<DataBarItem> {
vec![
DataBarItem::new("engine", 412.0),
DataBarItem::new("tui", 268.0),
DataBarItem::new("runtime", 131.0),
DataBarItem::new("protocol", 44.0),
]
}
fn row(area: Rect, y: u16, h: u16) -> Rect {
Rect::new(area.x, area.y.saturating_add(y), area.width, h).intersection(area)
}
fn sparklines(area: Rect, buf: &mut Buffer, theme: &Theme) {
let values = series();
DataSparkline::new("Requests", &values)
.unit("rpm")
.paint(row(area, 0, 1), buf, theme);
DataSparkline::new("Requests", &values)
.unit("rpm")
.drawn(0.45)
.paint(row(area, 1, 1), buf, theme);
DataSparkline::new("Requests", &[]).paint(row(area, 2, 1), buf, theme);
}
fn bars(area: Rect, buf: &mut Buffer, theme: &Theme) {
let items = items();
DataBars::new("Tests by crate", &items).paint(row(area, 0, 5), buf, theme);
}
fn bars_growing(area: Rect, buf: &mut Buffer, theme: &Theme) {
let items = items();
DataBars::new("Tests by crate", &items)
.previous(&[300.0, 300.0, 300.0, 300.0])
.drawn(0.5)
.paint(row(area, 0, 5), buf, theme);
}
fn trend(area: Rect, buf: &mut Buffer, theme: &Theme) {
let values = series();
DataTrend::new("Latency", &values)
.unit("ms")
.rows(7)
.paint(area, buf, theme);
}
fn trend_drawing(area: Rect, buf: &mut Buffer, theme: &Theme) {
let values = series();
DataTrend::new("Latency", &values)
.unit("ms")
.rows(7)
.drawn(0.6)
.paint(area, buf, theme);
}
fn from_agent(area: Rect, buf: &mut Buffer, theme: &Theme) {
let shown = DataDisplay::from_json(
r#"{"kind":"bars","label":"Tokens this turn","unit":"tokens",
"items":[{"label":"read","value":18200},{"label":"wrote","value":2400},
{"label":"cached","value":61000}]}"#,
)
.expect("gallery fixture is a valid data display");
shown.view().paint(area, buf, theme);
}
pub(crate) fn entries() -> Vec<Entry> {
vec![
Entry {
name: "data-sparkline",
width: 80,
height: 3,
draw: sparklines,
},
Entry {
name: "data-bars",
width: 60,
height: 5,
draw: bars,
},
Entry {
name: "data-bars-growing",
width: 60,
height: 5,
draw: bars_growing,
},
Entry {
name: "data-trend",
width: 72,
height: 7,
draw: trend,
},
Entry {
name: "data-trend-drawing",
width: 72,
height: 7,
draw: trend_drawing,
},
Entry {
name: "data-from-agent",
width: 60,
height: 4,
draw: from_agent,
},
]
}
-2
View File
@@ -31,7 +31,6 @@ mod approval;
mod artifacts;
mod atmosphere;
mod attention;
mod chart;
mod chrome;
mod display;
mod habitat;
@@ -105,7 +104,6 @@ pub fn entries() -> Vec<Entry> {
lists::entries(),
chrome::entries(),
display::entries(),
chart::entries(),
approval::entries(),
motion::entries(),
workspace::entries(),
+10 -10
View File
@@ -89,8 +89,8 @@
"sources": [
{
"path": "docs/CONFIGURATION.md",
"sha256": "fb934929d28d87dd161a26c427ffa21595ac358d994a46806c53f84fd49cb0f8",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
"sha256": "00f8d3b2b40dc4145a78b5bf93bd6d4e96c83478fdb5b4e0b7316108926ba1b7",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
},
{
"path": "docs/PROVIDERS.md",
@@ -121,8 +121,8 @@
"sources": [
{
"path": "docs/CONFIGURATION.md",
"sha256": "fb934929d28d87dd161a26c427ffa21595ac358d994a46806c53f84fd49cb0f8",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
"sha256": "00f8d3b2b40dc4145a78b5bf93bd6d4e96c83478fdb5b4e0b7316108926ba1b7",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
},
{
"path": "docs/LEGACY_PATHS.md",
@@ -153,8 +153,8 @@
},
{
"path": "docs/CONFIGURATION.md",
"sha256": "fb934929d28d87dd161a26c427ffa21595ac358d994a46806c53f84fd49cb0f8",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
"sha256": "00f8d3b2b40dc4145a78b5bf93bd6d4e96c83478fdb5b4e0b7316108926ba1b7",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
}
]
},
@@ -296,8 +296,8 @@
},
{
"path": "docs/CONFIGURATION.md",
"sha256": "fb934929d28d87dd161a26c427ffa21595ac358d994a46806c53f84fd49cb0f8",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
"sha256": "00f8d3b2b40dc4145a78b5bf93bd6d4e96c83478fdb5b4e0b7316108926ba1b7",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
}
]
},
@@ -328,8 +328,8 @@
},
{
"path": "docs/CONFIGURATION.md",
"sha256": "fb934929d28d87dd161a26c427ffa21595ac358d994a46806c53f84fd49cb0f8",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
"sha256": "00f8d3b2b40dc4145a78b5bf93bd6d4e96c83478fdb5b4e0b7316108926ba1b7",
"content": "# Configuration\n\ncodewhale reads configuration from a TOML file plus environment variables.\nAt process startup it may also load literal built-in-provider credentials from\na workspace-local `.env` file. Use the tracked `.env.example` as the template;\ncopy it to `.env`, then add only credential values.\n\nA workspace is not configuration authority. Codewhale therefore ignores\nconfig/profile/home paths, provider/model/base-URL routing, MCP/plugin state,\napproval/sandbox/shell posture, executable paths, runtime settings, and every\nother non-credential `.env` entry. Variable expansion is rejected so a\nrepository cannot substitute an ambient secret into a credential value. Use\n`config.toml`, CLI flags, or values exported by the launching shell for those\nexplicit control-plane settings. `.env` is read from a stable regular-file\nhandle, is capped at 1 MiB, and symbolic links, reparse points, and multiply\nlinked files are rejected.\n\n## Reading and checking configuration from the CLI\n\n`codewhale config get <key>` reads scalar keys, whole tables such as `tools`,\nand nested paths such as `tools.user_input_timeout_seconds`. Displayed tables\nand nested values apply the same recursive credential redaction as `config dump`.\n\n`config set` supports its named scalar keys and the provider, route, and\nnotification commands. It refuses a key that nothing reads and suggests the\nnearest real key (`config set calm_mod on` names `calm_mode`). A settings.toml\nkey such as `calm_mode` or `tool_collapse` is validated and written to the\nuser-global settings.toml, not config.toml; `config get` reads it back from\nthere even when an old config.toml copy (which nothing reads) is still present,\nand names that copy so you can `config unset` it. Settings keys have no project\nscope, so `--project` refuses them. A config.toml key is checked against the\ntype its reader expects and stored as a TOML boolean or number where the\nreader needs one (`yolo = true`, `max_subagents = 4`); `reasoning_effort`\naccepts the same aliases as `/effort` (#6563). Other dotted writes fail before\nmodifying the file and name the TOML table to edit. For example, set a tools\ntimeout in the file as:\n\n```toml\n[tools]\nuser_input_timeout_seconds = 0\n```\n\n`codewhale config doctor` checks credential presence and endpoint shape, and\nwarns about each config.toml root key that nothing reads: a settings.toml key\nleft in config.toml is named as misplaced, and any other unread key gets a\ndid-you-mean. Keys read by any runtime reader are not reported. The warnings do\nnot fail the check, and a clean result does not validate every runtime setting's\nvalue (#6083, #6563).\n\n## Usage and execution statistics\n\n`codewhale stats` is an alias of `codewhale metrics`; both use the same local,\nread-only backend. Use `--json` for the structured `stats` report. For example:\n\n```sh\ncodewhale stats --days 7 --models 10 --tools 20 --roles 10\ncodewhale metrics --project /path/to/workspace --json\n```\n\n`--days N` accepts a positive number of days and conflicts with `--since`.\n`--since 24h` and the existing duration syntax remain available. `--models N`,\n`--tools N` and `--roles N` select the top positive N rows by known tokens,\nidentified tool executions and recorded Fleet tasks respectively. These limits\nonly shorten the display; they do not remove stored receipts.\n\nThe report separates saved-document and Runtime views, frozen native-source\nmoney and token subtotals by actual model, retained tool-result history\nestimates and outcomes, completed compaction observations, and recorded Fleet\nroles. USD and CNY stay separate. A cumulative correction replaces its proven\npredecessor; copied Session/Runtime receipts and inherited Runtime fork rows\nare not added as new provider work. Conflicting source versions are shown\nseparately and excluded from the subtotal. Saved legacy display totals remain\nvisible as document projections without being charged again globally.\n\nCoverage is explicit. A missing quote, usage receipt, tool outcome, output\nshape or recovery link is unknown, not zero. Empty scalar usage from older\ntransport records cannot prove a reported zero. Token counts describe known\nreported data; tool history tokens are estimates of retained text, not bytes\nproven to have been replayed on a provider request. Latest prepared-request\ncomponents and source-linked compaction/role economics are unavailable where\nthey were not captured. The report does not infer provider invoices or prove\ncomplete historical coverage.\n\n`--project WORKSPACE` filters current saved/thread/Fleet views. Original source\nworkspace is not yet captured, so native money and model subtotals are\nunavailable for that filter; mutable current metadata is not used to assign a\ncharge. Older receipt projections without reliable workspace scope are also\nunavailable under this filter. Without it, those legacy receipt views remain\nseparate fromLine truncated
}
]
},
+2 -2
View File
@@ -2,7 +2,7 @@
"format": "codewhale.features.v1",
"source": {
"path": "docs/features.toml",
"sha256": "4c4dfe17cea716328253c687d9d0665e1b24fc3b59d00f2a81cf1157dfea7072"
"sha256": "a63042dc25a658f626735cc40e7a7cf4c67eaa51bfbb037dc2820d083d10fe3a"
},
"features": [
{
@@ -1070,7 +1070,7 @@
{
"id": "live-thinking",
"name": "Live thinking",
"summary": "/verbose toggles live model thinking in the transcript.",
"summary": "Model thinking shows live in the transcript, then collapses under a Thought header; /verbose shows it in full.",
"status": "stable",
"surfaces": {
"tui": "stable"