|
10 | 10 | //! |
11 | 11 | //! Adding a new canonical state is a one-enum-variant + one `expected` arm + one `*_inputs` |
12 | 12 | //! arm change; the table test below enforces every surface agrees. |
| 13 | +use chrono::Utc; |
13 | 14 | use warp_cli::agent::Harness; |
14 | 15 |
|
15 | 16 | use super::{ |
16 | | - agent_icon_variant_for_run, agent_icon_variant_from_terminal_inputs, CLISessionInputs, |
17 | | - TerminalIconInputs, |
| 17 | + agent_conversation_entry_icon_variant, agent_icon_variant_for_run, |
| 18 | + agent_icon_variant_from_terminal_inputs, CLISessionInputs, TerminalIconInputs, |
| 19 | +}; |
| 20 | +use crate::ai::agent::conversation::{AIConversationId, ConversationStatus}; |
| 21 | +use crate::ai::agent_conversations_model::entry::{ |
| 22 | + AgentConversationBackingData, AgentConversationCapabilities, AgentConversationCreator, |
| 23 | + AgentConversationDisplayData, AgentConversationIdentity, |
| 24 | +}; |
| 25 | +use crate::ai::agent_conversations_model::{ |
| 26 | + AgentConversationEntry, AgentConversationEntryId, AgentConversationProvenance, |
| 27 | + AgentRunDisplayStatus, |
18 | 28 | }; |
19 | | -use crate::ai::agent::conversation::ConversationStatus; |
20 | 29 | use crate::terminal::CLIAgent; |
21 | 30 | use crate::ui_components::icon_with_status::IconWithStatusVariant; |
22 | 31 |
|
@@ -372,3 +381,58 @@ fn local_claude_vs_cloud_claude_differ_only_by_is_ambient() { |
372 | 381 | assert!(!local.is_ambient); |
373 | 382 | assert!(cloud.is_ambient); |
374 | 383 | } |
| 384 | + |
| 385 | +#[test] |
| 386 | +fn non_ambient_entry_uses_display_harness() { |
| 387 | + let conversation_id = AIConversationId::new(); |
| 388 | + let entry = AgentConversationEntry { |
| 389 | + id: AgentConversationEntryId::Conversation(conversation_id), |
| 390 | + identity: AgentConversationIdentity { |
| 391 | + local_conversation_id: Some(conversation_id), |
| 392 | + ambient_agent_task_id: None, |
| 393 | + server_conversation_token: None, |
| 394 | + session_id: None, |
| 395 | + }, |
| 396 | + provenance: AgentConversationProvenance::CloudSyncedConversation, |
| 397 | + display: AgentConversationDisplayData { |
| 398 | + title: "Codex conversation".to_string(), |
| 399 | + initial_query: None, |
| 400 | + created_at: Utc::now(), |
| 401 | + last_updated: Utc::now(), |
| 402 | + status: AgentRunDisplayStatus::ConversationSucceeded, |
| 403 | + creator: AgentConversationCreator::default(), |
| 404 | + request_usage: None, |
| 405 | + run_time: None, |
| 406 | + source: None, |
| 407 | + working_directory: None, |
| 408 | + environment_id: None, |
| 409 | + harness: Some(Harness::Codex), |
| 410 | + artifacts: Vec::new(), |
| 411 | + }, |
| 412 | + backing: AgentConversationBackingData { |
| 413 | + has_loaded_conversation: true, |
| 414 | + has_local_persisted_data: true, |
| 415 | + has_cloud_data: true, |
| 416 | + has_ambient_run: false, |
| 417 | + }, |
| 418 | + capabilities: AgentConversationCapabilities { |
| 419 | + can_open: true, |
| 420 | + can_copy_link: false, |
| 421 | + can_share: false, |
| 422 | + can_delete: false, |
| 423 | + can_fork_locally: false, |
| 424 | + can_cancel: false, |
| 425 | + }, |
| 426 | + }; |
| 427 | + |
| 428 | + let variant = agent_conversation_entry_icon_variant(&entry).unwrap(); |
| 429 | + assert_eq!( |
| 430 | + AgentIconFields::from_variant(&variant).unwrap(), |
| 431 | + AgentIconFields { |
| 432 | + is_cli: true, |
| 433 | + cli_agent: Some(CLIAgent::Codex), |
| 434 | + status: Some(ConversationStatus::Success), |
| 435 | + is_ambient: false, |
| 436 | + } |
| 437 | + ); |
| 438 | +} |
0 commit comments