import: share per-turn splitting across line-based importers
Commit

Add splitLineTurns (linesplit.go): the per-turn scaffolding every JSONL importer repeated — scan for user-prompt starts, bound each turn by the next, truncate to the [0,end) buffer the agents' token helpers consume, and assemble the Turn. Each importer now passes an isPrompt predicate and a build callback that fills the agent-specific fields by calling that agent's own parsing (CalculateTokenUsage/CalculateTotalTokenUsage, ExtractModel, ExtractUserContent, pijsonl, etc.); the duplicated loops are gone.
Routes claude, cursor, pi, factory, codex, and copilot through it. Net ~125 fewer lines across the importers. gemini stays per-session (single JSON document, not newline-delimited).
The per-format prompt detectors remain: per-turn import needs each prompt's line offset (to bound token usage in the agent's native offset space), which no agent method exposes — so detection still scans raw lines. Pure refactor; behavior unchanged, verified against the importtest fixtures and existing tests.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com Entire-Checkpoint: 873ca152414f