Skip to main content

Crate toolpath_convo

Crate toolpath_convo 

Source
Expand description

§toolpath-convo

Provider-agnostic conversation types and traits for AI coding tools.

This crate defines a common vocabulary for representing conversations from any AI coding assistant (Claude, Codex, OpenCode, etc.) without coupling consumer code to provider-specific data formats.

§Overview

Types define the common data model:

TypeWhat it represents
TurnA single conversational turn (text, thinking, tool uses, model, tokens)
RoleWho produced the turn: User, Assistant, System, Other(String)
ConversationViewA complete conversation: ordered turns + timestamps
ConversationMetaLightweight metadata (no turns loaded)
ToolInvocationA tool call within a turn
ToolResultThe result of a tool call
TokenUsageInput/output token counts
WatcherEventEither a Turn or a Progress event

Traits define how providers expose their data:

TraitWhat it does
ConversationProviderList and load conversations from any source
ConversationWatcherPoll for new conversational events

§Usage

use toolpath_convo::{ConversationView, ConversationProvider, Role};

// Provider crates implement ConversationProvider.
// Consumer code works against the trait:
fn show_conversation(provider: &dyn ConversationProvider) {
    let view = provider.load_conversation("/path/to/project", "session-id")
        .unwrap();

    if let Some(title) = view.title(80) {
        println!("# {}", title);
    }

    for turn in &view.turns {
        println!("[{}] {}", turn.role, turn.text);
    }
}

§Provider implementations

ProviderCrate
Claude Codetoolpath-claude

§Part of Toolpath

This crate is part of the Toolpath workspace. See also:

Structs§

ConversationMeta
Lightweight metadata for a conversation (no turns loaded).
ConversationView
A complete conversation from any provider.
TokenUsage
Token usage for a single turn.
ToolInvocation
A tool invocation within a turn.
ToolResult
The result of a tool invocation.
Turn
A single turn in a conversation, from any provider.

Enums§

ConvoError
Errors from conversation provider operations.
Role
Who produced a turn.
WatcherEvent
Events emitted by a ConversationWatcher.

Traits§

ConversationProvider
Trait for converting provider-specific conversation data into the generic ConversationView.
ConversationWatcher
Trait for polling conversation updates from any provider.

Type Aliases§

Result