Skip to main content

Module project

Module project 

Source
Expand description

PiProjector — maps a ConversationView back to a Pi PiSession.

This is the inverse of crate::provider::session_to_view: where session_to_view reads a Pi JSONL session into a provider-agnostic view, PiProjector serializes that view back into Pi’s on-disk shape (a SessionHeader plus a list of Entry).

The projector consumes provider-specific data the forward path stashed under Turn.extra["pi"]api/provider, stopReason, toolCallId, bash-execution metadata, custom-message markers, and synthetic-turn structures (compaction, branchSummary, custom, customMessage). For ConversationViews from non-Pi sources, the projector synthesizes sensible defaults (api: “anthropic”, stop_reason: “stop”, etc.).

Foreign-namespace extras (Turn.extra["claude"], Turn.extra["gemini"], …) are dropped — they have no meaning in Pi’s format and would pollute the JSONL.

Structs§

PiProjector
Project a ConversationView into a Pi PiSession.