1use chrono::{DateTime, Utc};
31use serde::{Deserialize, Serialize};
32use serde_json::Value;
33
34use crate::{ThreadEvent, ThreadItemDetails, ToolCallStatus};
35
36pub const ATIF_SCHEMA_VERSION: &str = "ATIF-v1.4";
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct Trajectory {
46 pub schema_version: String,
48 pub session_id: String,
50 pub agent: AtifAgent,
52 pub steps: Vec<Step>,
54 #[serde(skip_serializing_if = "Option::is_none")]
56 pub notes: Option<String>,
57 #[serde(skip_serializing_if = "Option::is_none")]
59 pub final_metrics: Option<FinalMetrics>,
60 #[serde(skip_serializing_if = "Option::is_none")]
62 pub extra: Option<Value>,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct AtifAgent {
68 pub name: String,
70 pub version: String,
72 #[serde(skip_serializing_if = "Option::is_none")]
74 pub model_name: Option<String>,
75 #[serde(skip_serializing_if = "Option::is_none")]
77 pub extra: Option<Value>,
78}
79
80impl AtifAgent {
81 pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self {
83 Self {
84 name: name.into(),
85 version: version.into(),
86 model_name: None,
87 extra: None,
88 }
89 }
90
91 pub fn vtcode() -> Self {
93 Self::new("vtcode", env!("CARGO_PKG_VERSION"))
94 }
95
96 pub fn with_model(mut self, model: impl Into<String>) -> Self {
98 self.model_name = Some(model.into());
99 self
100 }
101}
102
103#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
105#[serde(rename_all = "lowercase")]
106pub enum StepSource {
107 System,
109 User,
111 Agent,
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117pub struct Step {
118 pub step_id: u64,
120 #[serde(skip_serializing_if = "Option::is_none")]
122 pub timestamp: Option<String>,
123 pub source: StepSource,
125 #[serde(skip_serializing_if = "Option::is_none")]
127 pub model_name: Option<String>,
128 #[serde(skip_serializing_if = "Option::is_none")]
130 pub message: Option<String>,
131 #[serde(skip_serializing_if = "Option::is_none")]
133 pub reasoning_content: Option<String>,
134 #[serde(skip_serializing_if = "Option::is_none")]
136 pub tool_calls: Option<Vec<AtifToolCall>>,
137 #[serde(skip_serializing_if = "Option::is_none")]
139 pub observation: Option<Observation>,
140 #[serde(skip_serializing_if = "Option::is_none")]
142 pub metrics: Option<StepMetrics>,
143 #[serde(skip_serializing_if = "Option::is_none")]
145 pub extra: Option<Value>,
146}
147
148impl Step {
149 pub fn user(step_id: u64, message: impl Into<String>) -> Self {
151 Self {
152 step_id,
153 timestamp: Some(Utc::now().to_rfc3339()),
154 source: StepSource::User,
155 model_name: None,
156 message: Some(message.into()),
157 reasoning_content: None,
158 tool_calls: None,
159 observation: None,
160 metrics: None,
161 extra: None,
162 }
163 }
164
165 pub fn agent(step_id: u64, message: impl Into<String>) -> Self {
167 Self {
168 step_id,
169 timestamp: Some(Utc::now().to_rfc3339()),
170 source: StepSource::Agent,
171 model_name: None,
172 message: Some(message.into()),
173 reasoning_content: None,
174 tool_calls: None,
175 observation: None,
176 metrics: None,
177 extra: None,
178 }
179 }
180
181 pub fn system(step_id: u64, message: impl Into<String>) -> Self {
183 Self {
184 step_id,
185 timestamp: Some(Utc::now().to_rfc3339()),
186 source: StepSource::System,
187 model_name: None,
188 message: Some(message.into()),
189 reasoning_content: None,
190 tool_calls: None,
191 observation: None,
192 metrics: None,
193 extra: None,
194 }
195 }
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200pub struct AtifToolCall {
201 pub tool_call_id: String,
203 pub function_name: String,
205 #[serde(skip_serializing_if = "Option::is_none")]
207 pub arguments: Option<Value>,
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize)]
212pub struct Observation {
213 pub results: Vec<ObservationResult>,
215}
216
217#[derive(Debug, Clone, Serialize, Deserialize)]
219pub struct ObservationResult {
220 pub source_call_id: String,
222 pub content: String,
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize)]
228pub struct StepMetrics {
229 #[serde(skip_serializing_if = "Option::is_none")]
231 pub prompt_tokens: Option<u64>,
232 #[serde(skip_serializing_if = "Option::is_none")]
234 pub completion_tokens: Option<u64>,
235 #[serde(skip_serializing_if = "Option::is_none")]
237 pub cached_tokens: Option<u64>,
238 #[serde(skip_serializing_if = "Option::is_none")]
240 pub cost_usd: Option<f64>,
241 #[serde(skip_serializing_if = "Option::is_none")]
243 pub logprobs: Option<Vec<f64>>,
244 #[serde(skip_serializing_if = "Option::is_none")]
246 pub completion_token_ids: Option<Vec<u64>>,
247 #[serde(skip_serializing_if = "Option::is_none")]
249 pub prompt_token_ids: Option<Vec<u64>>,
250 #[serde(skip_serializing_if = "Option::is_none")]
252 pub extra: Option<Value>,
253}
254
255impl StepMetrics {
256 pub fn from_usage(usage: &crate::Usage) -> Self {
258 Self {
259 prompt_tokens: Some(usage.input_tokens),
260 completion_tokens: Some(usage.output_tokens),
261 cached_tokens: if usage.cached_input_tokens > 0 {
262 Some(usage.cached_input_tokens)
263 } else {
264 None
265 },
266 cost_usd: None,
267 logprobs: None,
268 completion_token_ids: None,
269 prompt_token_ids: None,
270 extra: if usage.cache_creation_tokens > 0 {
271 Some(serde_json::json!({
272 "cache_creation_tokens": usage.cache_creation_tokens
273 }))
274 } else {
275 None
276 },
277 }
278 }
279}
280
281#[derive(Debug, Clone, Default, Serialize, Deserialize)]
283pub struct FinalMetrics {
284 #[serde(skip_serializing_if = "Option::is_none")]
286 pub total_prompt_tokens: Option<u64>,
287 #[serde(skip_serializing_if = "Option::is_none")]
289 pub total_completion_tokens: Option<u64>,
290 #[serde(skip_serializing_if = "Option::is_none")]
292 pub total_cached_tokens: Option<u64>,
293 #[serde(skip_serializing_if = "Option::is_none")]
295 pub total_cost_usd: Option<f64>,
296 #[serde(skip_serializing_if = "Option::is_none")]
298 pub total_steps: Option<u64>,
299 #[serde(skip_serializing_if = "Option::is_none")]
301 pub extra: Option<Value>,
302}
303
304pub struct AtifTrajectoryBuilder {
316 agent: AtifAgent,
317 session_id: Option<String>,
318 steps: Vec<Step>,
319 next_step_id: u64,
320 total_input_tokens: u64,
322 total_output_tokens: u64,
323 total_cached_tokens: u64,
324 num_turns: usize,
325 pending_tool_calls: Vec<PendingToolCall>,
327}
328
329struct PendingToolCall {
330 call_id: String,
331 tool_call_id: Option<String>,
332 tool_name: String,
333 arguments: Option<Value>,
334 timestamp: String,
335}
336
337impl AtifTrajectoryBuilder {
338 pub fn new(agent: AtifAgent) -> Self {
340 Self {
341 agent,
342 session_id: None,
343 steps: Vec::new(),
344 next_step_id: 1,
345 total_input_tokens: 0,
346 total_output_tokens: 0,
347 total_cached_tokens: 0,
348 num_turns: 0,
349 pending_tool_calls: Vec::new(),
350 }
351 }
352
353 pub fn set_session_id(&mut self, id: impl Into<String>) {
356 self.session_id = Some(id.into());
357 }
358
359 pub fn process_event(&mut self, event: &ThreadEvent) {
361 self.process_event_at(event, Utc::now());
362 }
363
364 pub fn process_event_at(&mut self, event: &ThreadEvent, ts: DateTime<Utc>) {
366 let ts_str = ts.to_rfc3339();
367 match event {
368 ThreadEvent::ThreadStarted(e) => {
369 if self.session_id.is_none() {
370 self.session_id = Some(e.thread_id.clone());
371 }
372 }
373 ThreadEvent::ThreadCompleted(e) => {
374 if self.session_id.is_none() {
375 self.session_id = Some(e.session_id.clone());
376 }
377 self.total_input_tokens =
379 self.total_input_tokens.saturating_add(e.usage.input_tokens);
380 self.total_output_tokens = self
381 .total_output_tokens
382 .saturating_add(e.usage.output_tokens);
383 self.total_cached_tokens = self
384 .total_cached_tokens
385 .saturating_add(e.usage.cached_input_tokens);
386 self.num_turns = e.num_turns;
387 }
388 ThreadEvent::TurnCompleted(e) => {
389 self.total_input_tokens =
390 self.total_input_tokens.saturating_add(e.usage.input_tokens);
391 self.total_output_tokens = self
392 .total_output_tokens
393 .saturating_add(e.usage.output_tokens);
394 self.total_cached_tokens = self
395 .total_cached_tokens
396 .saturating_add(e.usage.cached_input_tokens);
397 self.num_turns += 1;
398
399 let mut step = Step::system(self.next_step_id, "turn_completed");
400 step.timestamp = Some(ts_str);
401 step.metrics = Some(StepMetrics::from_usage(&e.usage));
402 self.push_step(step);
403 }
404 ThreadEvent::TurnFailed(e) => {
405 if let Some(usage) = &e.usage {
406 self.total_input_tokens =
407 self.total_input_tokens.saturating_add(usage.input_tokens);
408 self.total_output_tokens =
409 self.total_output_tokens.saturating_add(usage.output_tokens);
410 }
411 let mut step = Step::system(self.next_step_id, &e.message);
412 step.timestamp = Some(ts_str);
413 step.metrics = e.usage.as_ref().map(StepMetrics::from_usage);
414 self.push_step(step);
415 }
416 ThreadEvent::ItemCompleted(e) => {
417 self.process_item_completed(&e.item.id, &e.item.details, &ts_str);
418 }
419 ThreadEvent::ThreadCompactBoundary(e) => {
420 let msg = format!(
421 "context_compaction: {} messages -> {} messages ({})",
422 e.original_message_count,
423 e.compacted_message_count,
424 e.trigger.as_str()
425 );
426 let mut step = Step::system(self.next_step_id, msg);
427 step.timestamp = Some(ts_str);
428 self.push_step(step);
429 }
430 ThreadEvent::Error(e) => {
431 let mut step = Step::system(self.next_step_id, &e.message);
432 step.timestamp = Some(ts_str);
433 self.push_step(step);
434 }
435 ThreadEvent::TurnStarted(_)
437 | ThreadEvent::ItemStarted(_)
438 | ThreadEvent::ItemUpdated(_)
439 | ThreadEvent::PlanDelta(_) => {}
440 }
441 }
442
443 fn process_item_completed(&mut self, item_id: &str, details: &ThreadItemDetails, ts: &str) {
444 match details {
445 ThreadItemDetails::AgentMessage(msg) => {
446 let mut step = Step::agent(self.next_step_id, &msg.text);
447 step.timestamp = Some(ts.to_string());
448 self.push_step(step);
449 }
450 ThreadItemDetails::Plan(plan) => {
451 let mut step = Step::agent(self.next_step_id, &plan.text);
452 step.timestamp = Some(ts.to_string());
453 step.extra = Some(serde_json::json!({ "vtcode_item_type": "plan" }));
454 self.push_step(step);
455 }
456 ThreadItemDetails::Reasoning(r) => {
457 let mut step = Step::agent(self.next_step_id, "");
458 step.timestamp = Some(ts.to_string());
459 step.reasoning_content = Some(r.text.clone());
460 step.message = None;
461 self.push_step(step);
462 }
463 ThreadItemDetails::ToolInvocation(inv) => {
464 self.pending_tool_calls.push(PendingToolCall {
466 call_id: item_id.to_string(),
467 tool_call_id: inv.tool_call_id.clone(),
468 tool_name: inv.tool_name.clone(),
469 arguments: inv.arguments.clone(),
470 timestamp: ts.to_string(),
471 });
472 }
473 ThreadItemDetails::ToolOutput(output) => {
474 let pending_idx = self
476 .pending_tool_calls
477 .iter()
478 .position(|p| p.call_id == output.call_id);
479
480 let (tool_name, arguments, tool_call_id, inv_ts) = if let Some(idx) = pending_idx {
481 let p = self.pending_tool_calls.remove(idx);
482 (p.tool_name, p.arguments, p.tool_call_id, p.timestamp)
483 } else {
484 (
485 "unknown".to_string(),
486 None,
487 output.tool_call_id.clone(),
488 ts.to_string(),
489 )
490 };
491
492 let call_id = tool_call_id
493 .clone()
494 .unwrap_or_else(|| output.call_id.clone());
495
496 let mut step = Step::agent(self.next_step_id, "");
497 step.timestamp = Some(inv_ts);
498 step.message = None;
499 step.tool_calls = Some(vec![AtifToolCall {
500 tool_call_id: call_id.clone(),
501 function_name: tool_name,
502 arguments,
503 }]);
504
505 let status_suffix = match output.status {
506 ToolCallStatus::Failed => " [FAILED]",
507 ToolCallStatus::InProgress => " [IN_PROGRESS]",
508 ToolCallStatus::Completed => "",
509 };
510 let content = format!("{}{}", output.output, status_suffix);
511 step.observation = Some(Observation {
512 results: vec![ObservationResult {
513 source_call_id: call_id,
514 content,
515 }],
516 });
517 self.push_step(step);
518 }
519 ThreadItemDetails::CommandExecution(cmd) => {
520 let call_id = item_id.to_string();
521 let mut step = Step::agent(self.next_step_id, "");
522 step.timestamp = Some(ts.to_string());
523 step.message = None;
524 step.tool_calls = Some(vec![AtifToolCall {
525 tool_call_id: call_id.clone(),
526 function_name: "command_execution".to_string(),
527 arguments: Some(serde_json::json!({
528 "command": cmd.command,
529 "arguments": cmd.arguments,
530 })),
531 }]);
532 step.observation = Some(Observation {
533 results: vec![ObservationResult {
534 source_call_id: call_id,
535 content: cmd.aggregated_output.clone(),
536 }],
537 });
538 if let Some(exit_code) = cmd.exit_code {
539 step.extra = Some(serde_json::json!({ "exit_code": exit_code }));
540 }
541 self.push_step(step);
542 }
543 ThreadItemDetails::McpToolCall(mcp) => {
544 let call_id = item_id.to_string();
545 let mut step = Step::agent(self.next_step_id, "");
546 step.timestamp = Some(ts.to_string());
547 step.message = None;
548 step.tool_calls = Some(vec![AtifToolCall {
549 tool_call_id: call_id.clone(),
550 function_name: mcp.tool_name.clone(),
551 arguments: mcp.arguments.clone(),
552 }]);
553 if let Some(result) = &mcp.result {
554 step.observation = Some(Observation {
555 results: vec![ObservationResult {
556 source_call_id: call_id,
557 content: result.clone(),
558 }],
559 });
560 }
561 self.push_step(step);
562 }
563 ThreadItemDetails::FileChange(fc) => {
564 let changes: Vec<String> = fc
565 .changes
566 .iter()
567 .map(|c| format!("{}: {:?}", c.path, c.kind))
568 .collect();
569 let msg = format!("file_changes: {}", changes.join(", "));
570 let mut step = Step::system(self.next_step_id, msg);
571 step.timestamp = Some(ts.to_string());
572 self.push_step(step);
573 }
574 ThreadItemDetails::WebSearch(ws) => {
575 let mut step = Step::system(self.next_step_id, format!("web_search: {}", ws.query));
576 step.timestamp = Some(ts.to_string());
577 if let Some(results) = &ws.results {
578 step.observation = Some(Observation {
579 results: results
580 .iter()
581 .enumerate()
582 .map(|(i, r)| ObservationResult {
583 source_call_id: format!("search_{i}"),
584 content: r.clone(),
585 })
586 .collect(),
587 });
588 }
589 self.push_step(step);
590 }
591 ThreadItemDetails::Harness(h) => {
592 let msg = format!("harness: {:?}", h.event);
593 let mut step = Step::system(self.next_step_id, msg);
594 step.timestamp = Some(ts.to_string());
595 if let Some(m) = &h.message {
596 step.extra = Some(serde_json::json!({ "harness_message": m }));
597 }
598 self.push_step(step);
599 }
600 ThreadItemDetails::Error(e) => {
601 let mut step = Step::system(self.next_step_id, &e.message);
602 step.timestamp = Some(ts.to_string());
603 self.push_step(step);
604 }
605 }
606 }
607
608 fn push_step(&mut self, step: Step) {
609 self.next_step_id = step.step_id + 1;
610 self.steps.push(step);
611 }
612
613 pub fn finish(self, override_metrics: Option<FinalMetrics>) -> Trajectory {
618 let final_metrics = override_metrics.unwrap_or_else(|| FinalMetrics {
619 total_prompt_tokens: Some(self.total_input_tokens),
620 total_completion_tokens: Some(self.total_output_tokens),
621 total_cached_tokens: if self.total_cached_tokens > 0 {
622 Some(self.total_cached_tokens)
623 } else {
624 None
625 },
626 total_cost_usd: None,
627 total_steps: Some(self.steps.len() as u64),
628 extra: Some(serde_json::json!({ "num_turns": self.num_turns })),
629 });
630
631 Trajectory {
632 schema_version: ATIF_SCHEMA_VERSION.to_string(),
633 session_id: self
634 .session_id
635 .unwrap_or_else(|| uuid::Uuid::new_v4().to_string()),
636 agent: self.agent,
637 steps: self.steps,
638 notes: None,
639 final_metrics: Some(final_metrics),
640 extra: None,
641 }
642 }
643
644 pub fn step_count(&self) -> usize {
646 self.steps.len()
647 }
648}
649
650impl crate::EventEmitter for AtifTrajectoryBuilder {
651 fn emit(&mut self, event: &ThreadEvent) {
652 self.process_event(event);
653 }
654}
655
656#[cfg(test)]
657mod tests {
658 use super::*;
659 use crate::{
660 AgentMessageItem, ItemCompletedEvent, ThreadItem, ThreadStartedEvent, ToolInvocationItem,
661 ToolOutputItem, TurnCompletedEvent, Usage,
662 };
663
664 fn fixed_ts() -> DateTime<Utc> {
665 "2025-01-15T10:30:00Z".parse().unwrap()
666 }
667
668 #[test]
669 fn trajectory_round_trip() {
670 let trajectory = Trajectory {
671 schema_version: ATIF_SCHEMA_VERSION.to_string(),
672 session_id: "test-session".to_string(),
673 agent: AtifAgent::vtcode(),
674 steps: vec![Step::user(1, "hello")],
675 notes: None,
676 final_metrics: None,
677 extra: None,
678 };
679
680 let json = serde_json::to_string_pretty(&trajectory).unwrap();
681 let restored: Trajectory = serde_json::from_str(&json).unwrap();
682 assert_eq!(restored.schema_version, ATIF_SCHEMA_VERSION);
683 assert_eq!(restored.session_id, "test-session");
684 assert_eq!(restored.steps.len(), 1);
685 }
686
687 #[test]
688 fn builder_thread_started_sets_session_id() {
689 let mut builder = AtifTrajectoryBuilder::new(AtifAgent::vtcode());
690 let event = ThreadEvent::ThreadStarted(ThreadStartedEvent {
691 thread_id: "thread-abc".to_string(),
692 });
693 builder.process_event_at(&event, fixed_ts());
694 let trajectory = builder.finish(None);
695 assert_eq!(trajectory.session_id, "thread-abc");
696 }
697
698 #[test]
699 fn builder_agent_message_step() {
700 let mut builder = AtifTrajectoryBuilder::new(AtifAgent::vtcode());
701 let event = ThreadEvent::ItemCompleted(ItemCompletedEvent {
702 item: ThreadItem {
703 id: "msg-1".to_string(),
704 details: ThreadItemDetails::AgentMessage(AgentMessageItem {
705 text: "Hello, world!".to_string(),
706 }),
707 },
708 });
709 builder.process_event_at(&event, fixed_ts());
710 let trajectory = builder.finish(None);
711
712 assert_eq!(trajectory.steps.len(), 1);
713 let step = &trajectory.steps[0];
714 assert_eq!(step.step_id, 1);
715 assert_eq!(step.source, StepSource::Agent);
716 assert_eq!(step.message.as_deref(), Some("Hello, world!"));
717 }
718
719 #[test]
720 fn builder_tool_invocation_with_output() {
721 let mut builder = AtifTrajectoryBuilder::new(AtifAgent::vtcode());
722 let ts = fixed_ts();
723
724 let inv_event = ThreadEvent::ItemCompleted(ItemCompletedEvent {
726 item: ThreadItem {
727 id: "tool_1".to_string(),
728 details: ThreadItemDetails::ToolInvocation(ToolInvocationItem {
729 tool_name: "read_file".to_string(),
730 arguments: Some(serde_json::json!({"path": "README.md"})),
731 tool_call_id: Some("tc_0".to_string()),
732 status: ToolCallStatus::Completed,
733 }),
734 },
735 });
736 builder.process_event_at(&inv_event, ts);
737
738 let out_event = ThreadEvent::ItemCompleted(ItemCompletedEvent {
740 item: ThreadItem {
741 id: "tool_1:output".to_string(),
742 details: ThreadItemDetails::ToolOutput(ToolOutputItem {
743 call_id: "tool_1".to_string(),
744 tool_call_id: Some("tc_0".to_string()),
745 spool_path: None,
746 output: "file contents here".to_string(),
747 exit_code: Some(0),
748 status: ToolCallStatus::Completed,
749 }),
750 },
751 });
752 builder.process_event_at(&out_event, ts);
753
754 let trajectory = builder.finish(None);
755 assert_eq!(trajectory.steps.len(), 1);
757 let step = &trajectory.steps[0];
758 assert_eq!(step.source, StepSource::Agent);
759
760 let calls = step.tool_calls.as_ref().unwrap();
761 assert_eq!(calls.len(), 1);
762 assert_eq!(calls[0].function_name, "read_file");
763 assert_eq!(calls[0].tool_call_id, "tc_0");
764
765 let obs = step.observation.as_ref().unwrap();
766 assert_eq!(obs.results.len(), 1);
767 assert_eq!(obs.results[0].content, "file contents here");
768 }
769
770 #[test]
771 fn builder_turn_completed_accumulates_metrics() {
772 let mut builder = AtifTrajectoryBuilder::new(AtifAgent::vtcode());
773 let event = ThreadEvent::TurnCompleted(TurnCompletedEvent {
774 usage: Usage {
775 input_tokens: 500,
776 cached_input_tokens: 100,
777 cache_creation_tokens: 0,
778 output_tokens: 200,
779 },
780 });
781 builder.process_event_at(&event, fixed_ts());
782
783 let trajectory = builder.finish(None);
784 let fm = trajectory.final_metrics.as_ref().unwrap();
785 assert_eq!(fm.total_prompt_tokens, Some(500));
786 assert_eq!(fm.total_completion_tokens, Some(200));
787 assert_eq!(fm.total_cached_tokens, Some(100));
788 }
789
790 #[test]
791 fn step_metrics_from_usage() {
792 let usage = Usage {
793 input_tokens: 1000,
794 cached_input_tokens: 200,
795 cache_creation_tokens: 50,
796 output_tokens: 300,
797 };
798 let metrics = StepMetrics::from_usage(&usage);
799 assert_eq!(metrics.prompt_tokens, Some(1000));
800 assert_eq!(metrics.completion_tokens, Some(300));
801 assert_eq!(metrics.cached_tokens, Some(200));
802 assert!(metrics.extra.is_some());
803 }
804
805 #[test]
806 fn builder_implements_event_emitter() {
807 let mut builder = AtifTrajectoryBuilder::new(AtifAgent::vtcode());
808 let event = ThreadEvent::ThreadStarted(ThreadStartedEvent {
809 thread_id: "t-1".to_string(),
810 });
811 crate::EventEmitter::emit(&mut builder, &event);
813 assert_eq!(builder.step_count(), 0); }
815
816 #[test]
817 fn skips_lifecycle_events() {
818 let mut builder = AtifTrajectoryBuilder::new(AtifAgent::vtcode());
819 builder.process_event(&ThreadEvent::TurnStarted(crate::TurnStartedEvent {}));
820 assert_eq!(builder.step_count(), 0);
821 }
822}