Skip to main content

Module trace

Module trace 

Source
Expand description

Agent Trace specification types for AI code attribution.

This module implements the Agent Trace specification v0.1.0, providing vendor-neutral types for recording AI contributions alongside human authorship in version-controlled codebases.

§Overview

Agent Trace defines how to track which code came from AI versus humans with:

  • Line-level granularity for attribution
  • Conversation linkage for provenance
  • VCS integration for revision tracking
  • Extensible metadata for vendor-specific data

§Example

use vtcode_exec_events::trace::*;
use uuid::Uuid;
use chrono::Utc;

let trace = TraceRecord {
    version: AGENT_TRACE_VERSION.to_string(),
    id: Uuid::new_v4(),
    timestamp: Utc::now(),
    vcs: Some(VcsInfo {
        vcs_type: VcsType::Git,
        revision: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0".to_string(),
    }),
    tool: Some(ToolInfo {
        name: "vtcode".to_string(),
        version: Some(env!("CARGO_PKG_VERSION").to_string()),
    }),
    files: vec![],
    metadata: None,
};

Structs§

Contributor
The contributor that produced a code contribution.
RelatedResource
A related resource linked to a conversation.
ToolInfo
Information about the tool that generated the trace.
TraceContext
Information needed to create a trace from file changes.
TraceConversation
A conversation that contributed code to a file.
TraceFile
A file with attributed conversation ranges.
TraceMetadata
Additional metadata for trace records.
TraceRange
A range of lines with attribution information.
TraceRecord
A complete Agent Trace record tracking AI contributions to code.
TraceRecordBuilder
Builder for constructing trace records incrementally.
VcsInfo
Version control system information.
VtCodeMetadata
VT Code specific metadata in traces.

Enums§

ContributorType
Type of contributor for code attribution.
HashAlgorithm
Hash algorithm for content hashes.
VcsType
Supported version control system types.

Constants§

AGENT_TRACE_MIME_TYPE
MIME type for Agent Trace records.
AGENT_TRACE_VERSION
Current Agent Trace specification version.

Functions§

compute_content_hash
Compute a content hash using the default algorithm (MurmurHash3).
compute_content_hash_with
Compute a content hash using the specified algorithm.
normalize_model_id
Convert a model string to models.dev convention format.