Skip to main content

Module provider

Module provider 

Source
Expand description

ConversationProvider bridge: map Pi sessions to toolpath_convo::ConversationView.

Walks PiSession.entries in file order. Each Entry::Message becomes a Turn; metadata-only entries like ModelChange / ThinkingLevelChange / Label buffer and attach to the next message’s extra["pi"]. Compaction, BranchSummary, Custom, and CustomMessage emit synthetic turns with appropriate roles.

Tool-result correlation is a two-pass process: we record tool-call ids as assistant turns are built, then in a second pass populate matching tool invocations’ .result fields (and any sibling DelegatedWork.result).

Functions§

classify_tool
Classify a Pi tool name into toolpath’s category ontology.
native_name
Reverse of classify_tool: pick Pi’s preferred native tool name for a generic ToolCategory, disambiguating by call args when multiple Pi tools share the same category.
session_to_view
Convert a PiSession into a provider-agnostic ConversationView.