| 1 | //! Typed, validated templates. Load before host observations or permission mutation. |
| 2 | use codewhale_command_contract::facets::CommandPresentationContext; |
| 3 | use std::borrow::Cow; |
| 4 | |
| 5 | #[derive(Debug, Clone, Copy)] |
| 6 | pub enum PermissionsText { |
| 7 | AppliesHere, |
| 8 | BlockedEmpty, |
| 9 | BlockedEntry, |
| 10 | BlockedHeader, |
| 11 | BlockedHint, |
| 12 | BlockedStatusApprovable, |
| 13 | BlockedStatusApproved, |
| 14 | BlockedStatusNotApprovable, |
| 15 | FileEmpty, |
| 16 | FileMissing, |
| 17 | FilePresent, |
| 18 | InactiveHere, |
| 19 | ListHeader, |
| 20 | MatchAnyInvocation, |
| 21 | MatchCommandPrefix, |
| 22 | MatchExactCommand, |
| 23 | MatchExactPath, |
| 24 | NoRules, |
| 25 | OperationFailed, |
| 26 | PostureAsk, |
| 27 | PostureAcceptEdits, |
| 28 | PostureAuto, |
| 29 | PostureBypass, |
| 30 | PostureHeader, |
| 31 | PostureNever, |
| 32 | ReceiptsNote, |
| 33 | RemovePreview, |
| 34 | Removed, |
| 35 | RuleEntry, |
| 36 | RuleNotFound, |
| 37 | ScopeGlobal, |
| 38 | ScopeRepo, |
| 39 | Usage, |
| 40 | } |
| 41 | |
| 42 | pub struct PermissionsMessages { |
| 43 | permissions_applies_here: String, |
| 44 | permissions_blocked_empty: String, |
| 45 | permissions_blocked_entry: String, |
| 46 | permissions_blocked_header: String, |
| 47 | permissions_blocked_hint: String, |
| 48 | permissions_blocked_status_approvable: String, |
| 49 | permissions_blocked_status_approved: String, |
| 50 | permissions_blocked_status_not_approvable: String, |
| 51 | permissions_file_empty: String, |
| 52 | permissions_file_missing: String, |
| 53 | permissions_file_present: String, |
| 54 | permissions_inactive_here: String, |
| 55 | permissions_list_header: String, |
| 56 | permissions_match_any_invocation: String, |
| 57 | permissions_match_command_prefix: String, |
| 58 | permissions_match_exact_command: String, |
| 59 | permissions_match_exact_path: String, |
| 60 | permissions_no_rules: String, |
| 61 | permissions_operation_failed: String, |
| 62 | permissions_posture_ask: String, |
| 63 | permissions_posture_accept_edits: String, |
| 64 | permissions_posture_auto: String, |
| 65 | permissions_posture_bypass: String, |
| 66 | permissions_posture_header: String, |
| 67 | permissions_posture_never: String, |
| 68 | permissions_receipts_note: String, |
| 69 | permissions_remove_preview: String, |
| 70 | permissions_removed: String, |
| 71 | permissions_rule_entry: String, |
| 72 | permissions_rule_not_found: String, |
| 73 | permissions_scope_global: String, |
| 74 | permissions_scope_repo: String, |
| 75 | permissions_usage: String, |
| 76 | } |
| 77 | |
| 78 | impl PermissionsMessages { |
| 79 | pub fn load(presentation: &dyn CommandPresentationContext) -> Result<Self, String> { |
| 80 | Ok(Self { |
| 81 | permissions_applies_here: presentation.translate("permissions_applies_here", &[])?, |
| 82 | permissions_blocked_empty: presentation.translate("permissions_blocked_empty", &[])?, |
| 83 | permissions_blocked_entry: presentation.translate( |
| 84 | "permissions_blocked_entry", |
| 85 | &[ |
| 86 | ("id", "{id}"), |
| 87 | ("index", "{index}"), |
| 88 | ("reason", "{reason}"), |
| 89 | ("rule", "{rule}"), |
| 90 | ("status", "{status}"), |
| 91 | ("summary", "{summary}"), |
| 92 | ("tool", "{tool}"), |
| 93 | ], |
| 94 | )?, |
| 95 | permissions_blocked_header: presentation |
| 96 | .translate("permissions_blocked_header", &[("count", "{count}")])?, |
| 97 | permissions_blocked_hint: presentation.translate("permissions_blocked_hint", &[])?, |
| 98 | permissions_blocked_status_approvable: presentation |
| 99 | .translate("permissions_blocked_status_approvable", &[])?, |
| 100 | permissions_blocked_status_approved: presentation |
| 101 | .translate("permissions_blocked_status_approved", &[])?, |
| 102 | permissions_blocked_status_not_approvable: presentation |
| 103 | .translate("permissions_blocked_status_not_approvable", &[])?, |
| 104 | permissions_file_empty: presentation.translate("permissions_file_empty", &[])?, |
| 105 | permissions_file_missing: presentation.translate("permissions_file_missing", &[])?, |
| 106 | permissions_file_present: presentation.translate("permissions_file_present", &[])?, |
| 107 | permissions_inactive_here: presentation.translate("permissions_inactive_here", &[])?, |
| 108 | permissions_list_header: presentation.translate( |
| 109 | "permissions_list_header", |
| 110 | &[ |
| 111 | ("count", "{count}"), |
| 112 | ("file_state", "{file_state}"), |
| 113 | ("path", "{path}"), |
| 114 | ], |
| 115 | )?, |
| 116 | permissions_match_any_invocation: presentation |
| 117 | .translate("permissions_match_any_invocation", &[])?, |
| 118 | permissions_match_command_prefix: presentation.translate( |
| 119 | "permissions_match_command_prefix", |
| 120 | &[("command", "{command}")], |
| 121 | )?, |
| 122 | permissions_match_exact_command: presentation.translate( |
| 123 | "permissions_match_exact_command", |
| 124 | &[("command", "{command}")], |
| 125 | )?, |
| 126 | permissions_match_exact_path: presentation |
| 127 | .translate("permissions_match_exact_path", &[("path", "{path}")])?, |
| 128 | permissions_no_rules: presentation.translate("permissions_no_rules", &[])?, |
| 129 | permissions_operation_failed: presentation |
| 130 | .translate("permissions_operation_failed", &[("error", "{error}")])?, |
| 131 | permissions_posture_ask: presentation.translate("permissions_posture_ask", &[])?, |
| 132 | permissions_posture_accept_edits: presentation |
| 133 | .translate("permissions_posture_accept_edits", &[])?, |
| 134 | permissions_posture_auto: presentation.translate("permissions_posture_auto", &[])?, |
| 135 | permissions_posture_bypass: presentation |
| 136 | .translate("permissions_posture_bypass", &[])?, |
| 137 | permissions_posture_header: presentation |
| 138 | .translate("permissions_posture_header", &[("posture", "{posture}")])?, |
| 139 | permissions_posture_never: presentation.translate("permissions_posture_never", &[])?, |
| 140 | permissions_receipts_note: presentation.translate( |
| 141 | "permissions_receipts_note", |
| 142 | &[("audit_path", "{audit_path}")], |
| 143 | )?, |
| 144 | permissions_remove_preview: presentation.translate( |
| 145 | "permissions_remove_preview", |
| 146 | &[ |
| 147 | ("command", "{command}"), |
| 148 | ("index", "{index}"), |
| 149 | ("rule", "{rule}"), |
| 150 | ], |
| 151 | )?, |
| 152 | permissions_removed: presentation.translate( |
| 153 | "permissions_removed", |
| 154 | &[ |
| 155 | ("action", "{action}"), |
| 156 | ("index", "{index}"), |
| 157 | ("tool", "{tool}"), |
| 158 | ], |
| 159 | )?, |
| 160 | permissions_rule_entry: presentation.translate( |
| 161 | "permissions_rule_entry", |
| 162 | &[ |
| 163 | ("action", "{action}"), |
| 164 | ("applicability", "{applicability}"), |
| 165 | ("index", "{index}"), |
| 166 | ("matcher", "{matcher}"), |
| 167 | ("scope", "{scope}"), |
| 168 | ("tool", "{tool}"), |
| 169 | ], |
| 170 | )?, |
| 171 | permissions_rule_not_found: presentation |
| 172 | .translate("permissions_rule_not_found", &[("index", "{index}")])?, |
| 173 | permissions_scope_global: presentation.translate("permissions_scope_global", &[])?, |
| 174 | permissions_scope_repo: presentation |
| 175 | .translate("permissions_scope_repo", &[("workspace", "{workspace}")])?, |
| 176 | permissions_usage: presentation.translate("permissions_usage", &[])?, |
| 177 | }) |
| 178 | } |
| 179 | pub fn text(&self, id: PermissionsText) -> Cow<'static, str> { |
| 180 | Cow::Owned( |
| 181 | match id { |
| 182 | PermissionsText::AppliesHere => &self.permissions_applies_here, |
| 183 | PermissionsText::BlockedEmpty => &self.permissions_blocked_empty, |
| 184 | PermissionsText::BlockedEntry => &self.permissions_blocked_entry, |
| 185 | PermissionsText::BlockedHeader => &self.permissions_blocked_header, |
| 186 | PermissionsText::BlockedHint => &self.permissions_blocked_hint, |
| 187 | PermissionsText::BlockedStatusApprovable => { |
| 188 | &self.permissions_blocked_status_approvable |
| 189 | } |
| 190 | PermissionsText::BlockedStatusApproved => &self.permissions_blocked_status_approved, |
| 191 | PermissionsText::BlockedStatusNotApprovable => { |
| 192 | &self.permissions_blocked_status_not_approvable |
| 193 | } |
| 194 | PermissionsText::FileEmpty => &self.permissions_file_empty, |
| 195 | PermissionsText::FileMissing => &self.permissions_file_missing, |
| 196 | PermissionsText::FilePresent => &self.permissions_file_present, |
| 197 | PermissionsText::InactiveHere => &self.permissions_inactive_here, |
| 198 | PermissionsText::ListHeader => &self.permissions_list_header, |
| 199 | PermissionsText::MatchAnyInvocation => &self.permissions_match_any_invocation, |
| 200 | PermissionsText::MatchCommandPrefix => &self.permissions_match_command_prefix, |
| 201 | PermissionsText::MatchExactCommand => &self.permissions_match_exact_command, |
| 202 | PermissionsText::MatchExactPath => &self.permissions_match_exact_path, |
| 203 | PermissionsText::NoRules => &self.permissions_no_rules, |
| 204 | PermissionsText::OperationFailed => &self.permissions_operation_failed, |
| 205 | PermissionsText::PostureAsk => &self.permissions_posture_ask, |
| 206 | PermissionsText::PostureAcceptEdits => &self.permissions_posture_accept_edits, |
| 207 | PermissionsText::PostureAuto => &self.permissions_posture_auto, |
| 208 | PermissionsText::PostureBypass => &self.permissions_posture_bypass, |
| 209 | PermissionsText::PostureHeader => &self.permissions_posture_header, |
| 210 | PermissionsText::PostureNever => &self.permissions_posture_never, |
| 211 | PermissionsText::ReceiptsNote => &self.permissions_receipts_note, |
| 212 | PermissionsText::RemovePreview => &self.permissions_remove_preview, |
| 213 | PermissionsText::Removed => &self.permissions_removed, |
| 214 | PermissionsText::RuleEntry => &self.permissions_rule_entry, |
| 215 | PermissionsText::RuleNotFound => &self.permissions_rule_not_found, |
| 216 | PermissionsText::ScopeGlobal => &self.permissions_scope_global, |
| 217 | PermissionsText::ScopeRepo => &self.permissions_scope_repo, |
| 218 | PermissionsText::Usage => &self.permissions_usage, |
| 219 | } |
| 220 | .clone(), |
| 221 | ) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | #[derive(Debug, Clone, Copy)] |
| 226 | pub enum StatusText { |
| 227 | AppModeAgent, |
| 228 | AppModePlan, |
| 229 | SessionMetricsCache, |
| 230 | SessionMetricsInput, |
| 231 | SessionMetricsLlm, |
| 232 | SessionMetricsStatusLine, |
| 233 | SessionMetricsStep, |
| 234 | SessionMetricsSteps, |
| 235 | SessionMetricsTokensPerSecond, |
| 236 | SessionMetricsTools, |
| 237 | SessionMetricsTtft, |
| 238 | SessionMetricsTurn, |
| 239 | SessionMetricsTurns, |
| 240 | SessionsTimeDaysAgo, |
| 241 | SessionsTimeHoursAgo, |
| 242 | SessionsTimeJustNow, |
| 243 | SessionsTimeMinutesAgo, |
| 244 | SnapshotsDisabledTooLarge, |
| 245 | SnapshotsDisabledTooManyFiles, |
| 246 | SnapshotsDisabledUnsafeLocation, |
| 247 | SnapshotsFailing, |
| 248 | SnapshotsHistoryRepaired, |
| 249 | StatusApprovalAsk, |
| 250 | StatusApprovalAcceptEdits, |
| 251 | StatusApprovalAuto, |
| 252 | StatusApprovalFullAccess, |
| 253 | StatusApprovalNever, |
| 254 | StatusCacheNotReported, |
| 255 | StatusCacheSummary, |
| 256 | StatusCatalogFetched, |
| 257 | StatusCatalogLive, |
| 258 | StatusCatalogOfferings, |
| 259 | StatusCatalogRefreshFailed, |
| 260 | StatusCatalogStale, |
| 261 | StatusCloudFactsOff, |
| 262 | StatusContextSourceCatalog, |
| 263 | StatusContextSourceConfigured, |
| 264 | StatusContextSourceConfiguredModel, |
| 265 | StatusContextSourceFallback, |
| 266 | StatusContextSourceKimiSafeFloor, |
| 267 | StatusContextSourceModelHint, |
| 268 | StatusContextSourceProviderReported, |
| 269 | StatusContextUsage, |
| 270 | StatusFleetDrifted, |
| 271 | StatusLabelCatalog, |
| 272 | StatusLabelCloudFacts, |
| 273 | StatusLabelContextWindow, |
| 274 | StatusLabelDirectory, |
| 275 | StatusLabelFleet, |
| 276 | StatusLabelMcp, |
| 277 | StatusLabelMode, |
| 278 | StatusLabelProjectDocs, |
| 279 | StatusLabelRoute, |
| 280 | StatusLabelSafety, |
| 281 | StatusLabelSession, |
| 282 | StatusLabelSessionCost, |
| 283 | StatusLabelSessionTokens, |
| 284 | StatusLabelToolOutputs, |
| 285 | StatusLabelWindowOverride, |
| 286 | StatusLabelWindowSource, |
| 287 | StatusMcpConfigured, |
| 288 | StatusModelNotInRoster, |
| 289 | StatusPointers, |
| 290 | StatusPostureSummary, |
| 291 | StatusProjectDocsNone, |
| 292 | StatusRouteSummary, |
| 293 | StatusSafetyDisabled, |
| 294 | StatusSafetyDisabledSetuidAllowed, |
| 295 | StatusSafetyDisabledSetuidBlocked, |
| 296 | StatusSafetyExternal, |
| 297 | StatusSafetyReadOnly, |
| 298 | StatusSafetyReadOnlyUnenforced, |
| 299 | StatusSafetyWorkspaceWriteNetworkOff, |
| 300 | StatusSafetyWorkspaceWriteNetworkOn, |
| 301 | StatusSafetyWorkspaceWriteUnenforcedNetworkOff, |
| 302 | StatusSafetyWorkspaceWriteUnenforcedNetworkOn, |
| 303 | StatusSessionNotSaved, |
| 304 | StatusSessionSummary, |
| 305 | StatusSessionTokensSummary, |
| 306 | StatusShellOff, |
| 307 | StatusShellOn, |
| 308 | StatusToolArtifacts, |
| 309 | StatusToolCompactReceipts, |
| 310 | StatusToolNone, |
| 311 | StatusToolRawPressure, |
| 312 | StatusTrustedWorkspace, |
| 313 | StatusWindowOverrideActiveProvider, |
| 314 | StatusWindowOverrideProvider, |
| 315 | StatusWorkspace, |
| 316 | } |
| 317 | |
| 318 | pub struct StatusMessages { |
| 319 | app_mode_agent: String, |
| 320 | app_mode_plan: String, |
| 321 | session_metrics_cache: String, |
| 322 | session_metrics_input: String, |
| 323 | session_metrics_llm: String, |
| 324 | session_metrics_status_line: String, |
| 325 | session_metrics_step: String, |
| 326 | session_metrics_steps: String, |
| 327 | session_metrics_tokens_per_second: String, |
| 328 | session_metrics_tools: String, |
| 329 | session_metrics_ttft: String, |
| 330 | session_metrics_turn: String, |
| 331 | session_metrics_turns: String, |
| 332 | sessions_time_days_ago: String, |
| 333 | sessions_time_hours_ago: String, |
| 334 | sessions_time_just_now: String, |
| 335 | sessions_time_minutes_ago: String, |
| 336 | snapshots_disabled_too_large: String, |
| 337 | snapshots_disabled_too_many_files: String, |
| 338 | snapshots_disabled_unsafe_location: String, |
| 339 | snapshots_failing: String, |
| 340 | snapshots_history_repaired: String, |
| 341 | status_approval_ask: String, |
| 342 | status_approval_accept_edits: String, |
| 343 | status_approval_auto: String, |
| 344 | status_approval_full_access: String, |
| 345 | status_approval_never: String, |
| 346 | status_cache_not_reported: String, |
| 347 | status_cache_summary: String, |
| 348 | status_catalog_fetched: String, |
| 349 | status_catalog_live: String, |
| 350 | status_catalog_offerings: String, |
| 351 | status_catalog_refresh_failed: String, |
| 352 | status_catalog_stale: String, |
| 353 | status_cloud_facts_off: String, |
| 354 | status_context_source_catalog: String, |
| 355 | status_context_source_configured: String, |
| 356 | status_context_source_configured_model: String, |
| 357 | status_context_source_fallback: String, |
| 358 | status_context_source_kimi_safe_floor: String, |
| 359 | status_context_source_model_hint: String, |
| 360 | status_context_source_provider_reported: String, |
| 361 | status_context_usage: String, |
| 362 | status_fleet_drifted: String, |
| 363 | status_label_catalog: String, |
| 364 | status_label_cloud_facts: String, |
| 365 | status_label_context_window: String, |
| 366 | status_label_directory: String, |
| 367 | status_label_fleet: String, |
| 368 | status_label_mcp: String, |
| 369 | status_label_mode: String, |
| 370 | status_label_project_docs: String, |
| 371 | status_label_route: String, |
| 372 | status_label_safety: String, |
| 373 | status_label_session: String, |
| 374 | status_label_session_cost: String, |
| 375 | status_label_session_tokens: String, |
| 376 | status_label_tool_outputs: String, |
| 377 | status_label_window_override: String, |
| 378 | status_label_window_source: String, |
| 379 | status_mcp_configured: String, |
| 380 | status_model_not_in_roster: String, |
| 381 | status_pointers: String, |
| 382 | status_posture_summary: String, |
| 383 | status_project_docs_none: String, |
| 384 | status_route_summary: String, |
| 385 | status_safety_disabled: String, |
| 386 | status_safety_disabled_setuid_allowed: String, |
| 387 | status_safety_disabled_setuid_blocked: String, |
| 388 | status_safety_external: String, |
| 389 | status_safety_read_only: String, |
| 390 | status_safety_read_only_unenforced: String, |
| 391 | status_safety_workspace_write_network_off: String, |
| 392 | status_safety_workspace_write_network_on: String, |
| 393 | status_safety_workspace_write_unenforced_network_off: String, |
| 394 | status_safety_workspace_write_unenforced_network_on: String, |
| 395 | status_session_not_saved: String, |
| 396 | status_session_summary: String, |
| 397 | status_session_tokens_summary: String, |
| 398 | status_shell_off: String, |
| 399 | status_shell_on: String, |
| 400 | status_tool_artifacts: String, |
| 401 | status_tool_compact_receipts: String, |
| 402 | status_tool_none: String, |
| 403 | status_tool_raw_pressure: String, |
| 404 | status_trusted_workspace: String, |
| 405 | status_window_override_active_provider: String, |
| 406 | status_window_override_provider: String, |
| 407 | status_workspace: String, |
| 408 | } |
| 409 | |
| 410 | impl StatusMessages { |
| 411 | pub fn load(presentation: &dyn CommandPresentationContext) -> Result<Self, String> { |
| 412 | Ok(Self { |
| 413 | app_mode_agent: presentation.translate("app_mode_agent", &[])?, |
| 414 | app_mode_plan: presentation.translate("app_mode_plan", &[])?, |
| 415 | session_metrics_cache: presentation.translate("session_metrics_cache", &[])?, |
| 416 | session_metrics_input: presentation.translate("session_metrics_input", &[])?, |
| 417 | session_metrics_llm: presentation.translate("session_metrics_llm", &[])?, |
| 418 | session_metrics_status_line: presentation |
| 419 | .translate("session_metrics_status_line", &[("metrics", "{metrics}")])?, |
| 420 | session_metrics_step: presentation.translate("session_metrics_step", &[])?, |
| 421 | session_metrics_steps: presentation.translate("session_metrics_steps", &[])?, |
| 422 | session_metrics_tokens_per_second: presentation |
| 423 | .translate("session_metrics_tokens_per_second", &[])?, |
| 424 | session_metrics_tools: presentation.translate("session_metrics_tools", &[])?, |
| 425 | session_metrics_ttft: presentation.translate("session_metrics_ttft", &[])?, |
| 426 | session_metrics_turn: presentation.translate("session_metrics_turn", &[])?, |
| 427 | session_metrics_turns: presentation.translate("session_metrics_turns", &[])?, |
| 428 | sessions_time_days_ago: presentation |
| 429 | .translate("sessions_time_days_ago", &[("count", "{count}")])?, |
| 430 | sessions_time_hours_ago: presentation |
| 431 | .translate("sessions_time_hours_ago", &[("count", "{count}")])?, |
| 432 | sessions_time_just_now: presentation.translate("sessions_time_just_now", &[])?, |
| 433 | sessions_time_minutes_ago: presentation |
| 434 | .translate("sessions_time_minutes_ago", &[("count", "{count}")])?, |
| 435 | snapshots_disabled_too_large: presentation.translate( |
| 436 | "snapshots_disabled_too_large", |
| 437 | &[ |
| 438 | ("config_key", "{config_key}"), |
| 439 | ("limit", "{limit}"), |
| 440 | ("workspace", "{workspace}"), |
| 441 | ], |
| 442 | )?, |
| 443 | snapshots_disabled_too_many_files: presentation.translate( |
| 444 | "snapshots_disabled_too_many_files", |
| 445 | &[("limit", "{limit}"), ("workspace", "{workspace}")], |
| 446 | )?, |
| 447 | snapshots_disabled_unsafe_location: presentation.translate( |
| 448 | "snapshots_disabled_unsafe_location", |
| 449 | &[("workspace", "{workspace}")], |
| 450 | )?, |
| 451 | snapshots_failing: presentation.translate( |
| 452 | "snapshots_failing", |
| 453 | &[("limit", "{limit}"), ("workspace", "{workspace}")], |
| 454 | )?, |
| 455 | snapshots_history_repaired: presentation.translate( |
| 456 | "snapshots_history_repaired", |
| 457 | &[("workspace", "{workspace}")], |
| 458 | )?, |
| 459 | status_approval_ask: presentation.translate("status_approval_ask", &[])?, |
| 460 | status_approval_accept_edits: presentation |
| 461 | .translate("status_approval_accept_edits", &[])?, |
| 462 | status_approval_auto: presentation.translate("status_approval_auto", &[])?, |
| 463 | status_approval_full_access: presentation |
| 464 | .translate("status_approval_full_access", &[])?, |
| 465 | status_approval_never: presentation.translate("status_approval_never", &[])?, |
| 466 | status_cache_not_reported: presentation.translate("status_cache_not_reported", &[])?, |
| 467 | status_cache_summary: presentation.translate( |
| 468 | "status_cache_summary", |
| 469 | &[("hit", "{hit}"), ("miss", "{miss}")], |
| 470 | )?, |
| 471 | status_catalog_fetched: presentation |
| 472 | .translate("status_catalog_fetched", &[("age", "{age}")])?, |
| 473 | status_catalog_live: presentation.translate("status_catalog_live", &[])?, |
| 474 | status_catalog_offerings: presentation |
| 475 | .translate("status_catalog_offerings", &[("count", "{count}")])?, |
| 476 | status_catalog_refresh_failed: presentation |
| 477 | .translate("status_catalog_refresh_failed", &[])?, |
| 478 | status_catalog_stale: presentation.translate("status_catalog_stale", &[])?, |
| 479 | status_cloud_facts_off: presentation.translate("status_cloud_facts_off", &[])?, |
| 480 | status_context_source_catalog: presentation |
| 481 | .translate("status_context_source_catalog", &[])?, |
| 482 | status_context_source_configured: presentation |
| 483 | .translate("status_context_source_configured", &[])?, |
| 484 | status_context_source_configured_model: presentation |
| 485 | .translate("status_context_source_configured_model", &[])?, |
| 486 | status_context_source_fallback: presentation |
| 487 | .translate("status_context_source_fallback", &[])?, |
| 488 | status_context_source_kimi_safe_floor: presentation |
| 489 | .translate("status_context_source_kimi_safe_floor", &[])?, |
| 490 | status_context_source_model_hint: presentation |
| 491 | .translate("status_context_source_model_hint", &[])?, |
| 492 | status_context_source_provider_reported: presentation |
| 493 | .translate("status_context_source_provider_reported", &[])?, |
| 494 | status_context_usage: presentation.translate( |
| 495 | "status_context_usage", |
| 496 | &[ |
| 497 | ("max", "{max}"), |
| 498 | ("percent", "{percent}"), |
| 499 | ("used", "{used}"), |
| 500 | ], |
| 501 | )?, |
| 502 | status_fleet_drifted: presentation.translate( |
| 503 | "status_fleet_drifted", |
| 504 | &[("count", "{count}"), ("fleet", "{fleet}"), ("ids", "{ids}")], |
| 505 | )?, |
| 506 | status_label_catalog: presentation.translate("status_label_catalog", &[])?, |
| 507 | status_label_cloud_facts: presentation.translate("status_label_cloud_facts", &[])?, |
| 508 | status_label_context_window: presentation |
| 509 | .translate("status_label_context_window", &[])?, |
| 510 | status_label_directory: presentation.translate("status_label_directory", &[])?, |
| 511 | status_label_fleet: presentation.translate("status_label_fleet", &[])?, |
| 512 | status_label_mcp: presentation.translate("status_label_mcp", &[])?, |
| 513 | status_label_mode: presentation.translate("status_label_mode", &[])?, |
| 514 | status_label_project_docs: presentation.translate("status_label_project_docs", &[])?, |
| 515 | status_label_route: presentation.translate("status_label_route", &[])?, |
| 516 | status_label_safety: presentation.translate("status_label_safety", &[])?, |
| 517 | status_label_session: presentation.translate("status_label_session", &[])?, |
| 518 | status_label_session_cost: presentation.translate("status_label_session_cost", &[])?, |
| 519 | status_label_session_tokens: presentation |
| 520 | .translate("status_label_session_tokens", &[])?, |
| 521 | status_label_tool_outputs: presentation.translate("status_label_tool_outputs", &[])?, |
| 522 | status_label_window_override: presentation |
| 523 | .translate("status_label_window_override", &[])?, |
| 524 | status_label_window_source: presentation |
| 525 | .translate("status_label_window_source", &[])?, |
| 526 | status_mcp_configured: presentation |
| 527 | .translate("status_mcp_configured", &[("count", "{count}")])?, |
| 528 | status_model_not_in_roster: presentation.translate( |
| 529 | "status_model_not_in_roster", |
| 530 | &[("model", "{model}"), ("provider", "{provider}")], |
| 531 | )?, |
| 532 | status_pointers: presentation.translate("status_pointers", &[])?, |
| 533 | status_posture_summary: presentation.translate( |
| 534 | "status_posture_summary", |
| 535 | &[ |
| 536 | ("approval", "{approval}"), |
| 537 | ("mode", "{mode}"), |
| 538 | ("shell", "{shell}"), |
| 539 | ("trust", "{trust}"), |
| 540 | ], |
| 541 | )?, |
| 542 | status_project_docs_none: presentation.translate("status_project_docs_none", &[])?, |
| 543 | status_route_summary: presentation.translate( |
| 544 | "status_route_summary", |
| 545 | &[ |
| 546 | ("model", "{model}"), |
| 547 | ("provider", "{provider}"), |
| 548 | ("reasoning", "{reasoning}"), |
| 549 | ], |
| 550 | )?, |
| 551 | status_safety_disabled: presentation.translate("status_safety_disabled", &[])?, |
| 552 | status_safety_disabled_setuid_allowed: presentation |
| 553 | .translate("status_safety_disabled_setuid_allowed", &[])?, |
| 554 | status_safety_disabled_setuid_blocked: presentation |
| 555 | .translate("status_safety_disabled_setuid_blocked", &[])?, |
| 556 | status_safety_external: presentation.translate("status_safety_external", &[])?, |
| 557 | status_safety_read_only: presentation.translate("status_safety_read_only", &[])?, |
| 558 | status_safety_read_only_unenforced: presentation |
| 559 | .translate("status_safety_read_only_unenforced", &[])?, |
| 560 | status_safety_workspace_write_network_off: presentation |
| 561 | .translate("status_safety_workspace_write_network_off", &[])?, |
| 562 | status_safety_workspace_write_network_on: presentation |
| 563 | .translate("status_safety_workspace_write_network_on", &[])?, |
| 564 | status_safety_workspace_write_unenforced_network_off: presentation |
| 565 | .translate("status_safety_workspace_write_unenforced_network_off", &[])?, |
| 566 | status_safety_workspace_write_unenforced_network_on: presentation |
| 567 | .translate("status_safety_workspace_write_unenforced_network_on", &[])?, |
| 568 | status_session_not_saved: presentation.translate("status_session_not_saved", &[])?, |
| 569 | status_session_summary: presentation.translate( |
| 570 | "status_session_summary", |
| 571 | &[ |
| 572 | ("cells", "{cells}"), |
| 573 | ("messages", "{messages}"), |
| 574 | ("session", "{session}"), |
| 575 | ], |
| 576 | )?, |
| 577 | status_session_tokens_summary: presentation.translate( |
| 578 | "status_session_tokens_summary", |
| 579 | &[ |
| 580 | ("cache", "{cache}"), |
| 581 | ("input", "{input}"), |
| 582 | ("output", "{output}"), |
| 583 | ("total", "{total}"), |
| 584 | ], |
| 585 | )?, |
| 586 | status_shell_off: presentation.translate("status_shell_off", &[])?, |
| 587 | status_shell_on: presentation.translate("status_shell_on", &[])?, |
| 588 | status_tool_artifacts: presentation.translate( |
| 589 | "status_tool_artifacts", |
| 590 | &[("bytes", "{bytes}"), ("count", "{count}")], |
| 591 | )?, |
| 592 | status_tool_compact_receipts: presentation |
| 593 | .translate("status_tool_compact_receipts", &[("count", "{count}")])?, |
| 594 | status_tool_none: presentation.translate("status_tool_none", &[])?, |
| 595 | status_tool_raw_pressure: presentation.translate( |
| 596 | "status_tool_raw_pressure", |
| 597 | &[("chars", "{chars}"), ("count", "{count}")], |
| 598 | )?, |
| 599 | status_trusted_workspace: presentation.translate("status_trusted_workspace", &[])?, |
| 600 | status_window_override_active_provider: presentation |
| 601 | .translate("status_window_override_active_provider", &[])?, |
| 602 | status_window_override_provider: presentation |
| 603 | .translate("status_window_override_provider", &[("table", "{table}")])?, |
| 604 | status_workspace: presentation.translate("status_workspace", &[])?, |
| 605 | }) |
| 606 | } |
| 607 | pub fn text(&self, id: StatusText) -> Cow<'static, str> { |
| 608 | Cow::Owned( |
| 609 | match id { |
| 610 | StatusText::AppModeAgent => &self.app_mode_agent, |
| 611 | StatusText::AppModePlan => &self.app_mode_plan, |
| 612 | StatusText::SessionMetricsCache => &self.session_metrics_cache, |
| 613 | StatusText::SessionMetricsInput => &self.session_metrics_input, |
| 614 | StatusText::SessionMetricsLlm => &self.session_metrics_llm, |
| 615 | StatusText::SessionMetricsStatusLine => &self.session_metrics_status_line, |
| 616 | StatusText::SessionMetricsStep => &self.session_metrics_step, |
| 617 | StatusText::SessionMetricsSteps => &self.session_metrics_steps, |
| 618 | StatusText::SessionMetricsTokensPerSecond => { |
| 619 | &self.session_metrics_tokens_per_second |
| 620 | } |
| 621 | StatusText::SessionMetricsTools => &self.session_metrics_tools, |
| 622 | StatusText::SessionMetricsTtft => &self.session_metrics_ttft, |
| 623 | StatusText::SessionMetricsTurn => &self.session_metrics_turn, |
| 624 | StatusText::SessionMetricsTurns => &self.session_metrics_turns, |
| 625 | StatusText::SessionsTimeDaysAgo => &self.sessions_time_days_ago, |
| 626 | StatusText::SessionsTimeHoursAgo => &self.sessions_time_hours_ago, |
| 627 | StatusText::SessionsTimeJustNow => &self.sessions_time_just_now, |
| 628 | StatusText::SessionsTimeMinutesAgo => &self.sessions_time_minutes_ago, |
| 629 | StatusText::SnapshotsDisabledTooLarge => &self.snapshots_disabled_too_large, |
| 630 | StatusText::SnapshotsDisabledTooManyFiles => { |
| 631 | &self.snapshots_disabled_too_many_files |
| 632 | } |
| 633 | StatusText::SnapshotsDisabledUnsafeLocation => { |
| 634 | &self.snapshots_disabled_unsafe_location |
| 635 | } |
| 636 | StatusText::SnapshotsFailing => &self.snapshots_failing, |
| 637 | StatusText::SnapshotsHistoryRepaired => &self.snapshots_history_repaired, |
| 638 | StatusText::StatusApprovalAsk => &self.status_approval_ask, |
| 639 | StatusText::StatusApprovalAcceptEdits => &self.status_approval_accept_edits, |
| 640 | StatusText::StatusApprovalAuto => &self.status_approval_auto, |
| 641 | StatusText::StatusApprovalFullAccess => &self.status_approval_full_access, |
| 642 | StatusText::StatusApprovalNever => &self.status_approval_never, |
| 643 | StatusText::StatusCacheNotReported => &self.status_cache_not_reported, |
| 644 | StatusText::StatusCacheSummary => &self.status_cache_summary, |
| 645 | StatusText::StatusCatalogFetched => &self.status_catalog_fetched, |
| 646 | StatusText::StatusCatalogLive => &self.status_catalog_live, |
| 647 | StatusText::StatusCatalogOfferings => &self.status_catalog_offerings, |
| 648 | StatusText::StatusCatalogRefreshFailed => &self.status_catalog_refresh_failed, |
| 649 | StatusText::StatusCatalogStale => &self.status_catalog_stale, |
| 650 | StatusText::StatusCloudFactsOff => &self.status_cloud_facts_off, |
| 651 | StatusText::StatusContextSourceCatalog => &self.status_context_source_catalog, |
| 652 | StatusText::StatusContextSourceConfigured => &self.status_context_source_configured, |
| 653 | StatusText::StatusContextSourceConfiguredModel => { |
| 654 | &self.status_context_source_configured_model |
| 655 | } |
| 656 | StatusText::StatusContextSourceFallback => &self.status_context_source_fallback, |
| 657 | StatusText::StatusContextSourceKimiSafeFloor => { |
| 658 | &self.status_context_source_kimi_safe_floor |
| 659 | } |
| 660 | StatusText::StatusContextSourceModelHint => &self.status_context_source_model_hint, |
| 661 | StatusText::StatusContextSourceProviderReported => { |
| 662 | &self.status_context_source_provider_reported |
| 663 | } |
| 664 | StatusText::StatusContextUsage => &self.status_context_usage, |
| 665 | StatusText::StatusFleetDrifted => &self.status_fleet_drifted, |
| 666 | StatusText::StatusLabelCatalog => &self.status_label_catalog, |
| 667 | StatusText::StatusLabelCloudFacts => &self.status_label_cloud_facts, |
| 668 | StatusText::StatusLabelContextWindow => &self.status_label_context_window, |
| 669 | StatusText::StatusLabelDirectory => &self.status_label_directory, |
| 670 | StatusText::StatusLabelFleet => &self.status_label_fleet, |
| 671 | StatusText::StatusLabelMcp => &self.status_label_mcp, |
| 672 | StatusText::StatusLabelMode => &self.status_label_mode, |
| 673 | StatusText::StatusLabelProjectDocs => &self.status_label_project_docs, |
| 674 | StatusText::StatusLabelRoute => &self.status_label_route, |
| 675 | StatusText::StatusLabelSafety => &self.status_label_safety, |
| 676 | StatusText::StatusLabelSession => &self.status_label_session, |
| 677 | StatusText::StatusLabelSessionCost => &self.status_label_session_cost, |
| 678 | StatusText::StatusLabelSessionTokens => &self.status_label_session_tokens, |
| 679 | StatusText::StatusLabelToolOutputs => &self.status_label_tool_outputs, |
| 680 | StatusText::StatusLabelWindowOverride => &self.status_label_window_override, |
| 681 | StatusText::StatusLabelWindowSource => &self.status_label_window_source, |
| 682 | StatusText::StatusMcpConfigured => &self.status_mcp_configured, |
| 683 | StatusText::StatusModelNotInRoster => &self.status_model_not_in_roster, |
| 684 | StatusText::StatusPointers => &self.status_pointers, |
| 685 | StatusText::StatusPostureSummary => &self.status_posture_summary, |
| 686 | StatusText::StatusProjectDocsNone => &self.status_project_docs_none, |
| 687 | StatusText::StatusRouteSummary => &self.status_route_summary, |
| 688 | StatusText::StatusSafetyDisabled => &self.status_safety_disabled, |
| 689 | StatusText::StatusSafetyDisabledSetuidAllowed => { |
| 690 | &self.status_safety_disabled_setuid_allowed |
| 691 | } |
| 692 | StatusText::StatusSafetyDisabledSetuidBlocked => { |
| 693 | &self.status_safety_disabled_setuid_blocked |
| 694 | } |
| 695 | StatusText::StatusSafetyExternal => &self.status_safety_external, |
| 696 | StatusText::StatusSafetyReadOnly => &self.status_safety_read_only, |
| 697 | StatusText::StatusSafetyReadOnlyUnenforced => { |
| 698 | &self.status_safety_read_only_unenforced |
| 699 | } |
| 700 | StatusText::StatusSafetyWorkspaceWriteNetworkOff => { |
| 701 | &self.status_safety_workspace_write_network_off |
| 702 | } |
| 703 | StatusText::StatusSafetyWorkspaceWriteNetworkOn => { |
| 704 | &self.status_safety_workspace_write_network_on |
| 705 | } |
| 706 | StatusText::StatusSafetyWorkspaceWriteUnenforcedNetworkOff => { |
| 707 | &self.status_safety_workspace_write_unenforced_network_off |
| 708 | } |
| 709 | StatusText::StatusSafetyWorkspaceWriteUnenforcedNetworkOn => { |
| 710 | &self.status_safety_workspace_write_unenforced_network_on |
| 711 | } |
| 712 | StatusText::StatusSessionNotSaved => &self.status_session_not_saved, |
| 713 | StatusText::StatusSessionSummary => &self.status_session_summary, |
| 714 | StatusText::StatusSessionTokensSummary => &self.status_session_tokens_summary, |
| 715 | StatusText::StatusShellOff => &self.status_shell_off, |
| 716 | StatusText::StatusShellOn => &self.status_shell_on, |
| 717 | StatusText::StatusToolArtifacts => &self.status_tool_artifacts, |
| 718 | StatusText::StatusToolCompactReceipts => &self.status_tool_compact_receipts, |
| 719 | StatusText::StatusToolNone => &self.status_tool_none, |
| 720 | StatusText::StatusToolRawPressure => &self.status_tool_raw_pressure, |
| 721 | StatusText::StatusTrustedWorkspace => &self.status_trusted_workspace, |
| 722 | StatusText::StatusWindowOverrideActiveProvider => { |
| 723 | &self.status_window_override_active_provider |
| 724 | } |
| 725 | StatusText::StatusWindowOverrideProvider => &self.status_window_override_provider, |
| 726 | StatusText::StatusWorkspace => &self.status_workspace, |
| 727 | } |
| 728 | .clone(), |
| 729 | ) |
| 730 | } |
| 731 | } |
| 732 |