vtcode_core/trace/mod.rs
1//! Agent Trace storage layer for VT Code.
2//!
3//! This module provides file-based storage for Agent Trace records,
4//! supporting reading/writing traces to `.vtcode/traces/` directory.
5//!
6//! # Overview
7//!
8//! Agent Trace is an open specification for tracking AI-generated code.
9//! See <https://agent-trace.dev/> for the full specification.
10//!
11//! # Usage
12//!
13//! ```rust,ignore
14//! use vtcode_core::trace::{TraceStore, TraceGenerator, TraceContext};
15//!
16//! // Create context for generating traces
17//! let ctx = TraceContext::new("claude-opus-4", "anthropic")
18//! .with_workspace_path("/my/workspace")
19//! .with_session_id("session-123")
20//! .with_turn_number(1);
21//!
22//! // Generate trace from diff tracker (after apply_patch)
23//! if let Some(trace) = TraceGenerator::from_diff_tracker(&tracker, &ctx) {
24//! // Store the trace
25//! let store = TraceStore::for_workspace("/my/workspace");
26//! store.write_trace(&trace)?;
27//! }
28//! ```
29
30mod generator;
31mod store;
32
33pub use generator::*;
34pub use store::*;
35
36// Re-export core types from vtcode-exec-events for convenience
37pub use vtcode_exec_events::trace::{
38 AGENT_TRACE_MIME_TYPE, AGENT_TRACE_VERSION, Contributor, ContributorType, HashAlgorithm,
39 RelatedResource, ToolInfo, TraceConversation, TraceFile, TraceMetadata, TraceRange,
40 TraceRecord, TraceRecordBuilder, VcsInfo, VcsType, VtCodeMetadata, compute_content_hash,
41 compute_content_hash_with, normalize_model_id,
42};