A pluggable transcript provider. Implementors locate their transcript files for a project and parse only the content appended/changed since the last run. The shared [`ingest_source`] driver handles offset persistence and idempotent session/message upserts. `Send + Sync` is required so boxed sources can be driven from detached background tasks (e.g. the serve-side startup sweep).
| 97 | /// `Send + Sync` is required so boxed sources can be driven from detached |
| 98 | /// background tasks (e.g. the serve-side startup sweep). |
| 99 | pub trait TranscriptSource: Send + Sync { |
| 100 | /// Stable provider id stored on every session/message row (e.g. `"claude"`). |
| 101 | fn provider(&self) -> &'static str; |
| 102 | |
| 103 | /// Candidate transcript files to consider for `project_root`. May scan |
| 104 | /// per-project and/or OS-specific global directories. Non-existent paths |
| 105 | /// are tolerated by the driver. |
| 106 | fn transcript_paths(&self, project_root: &Path) -> Vec<PathBuf>; |
| 107 | |
| 108 | /// Parse only the new content of `path` given the previously stored cursor. |
| 109 | /// |
| 110 | /// Returns `None` to mean "ingest nothing and do not advance the cursor" |
| 111 | /// (unreadable file, hot-path byte cap exceeded, or the transcript does not |
| 112 | /// belong to `project_root`). Returns `Some` with a possibly-empty message |
| 113 | /// list otherwise; an empty list still advances the cursor (e.g. only |
| 114 | /// non-message lines were appended). |
| 115 | fn parse_new( |
| 116 | &self, |
| 117 | path: &Path, |
| 118 | prev: StoredCursor, |
| 119 | project_root: &Path, |
| 120 | max_new_bytes: Option<u64>, |
| 121 | ) -> Option<ParsedTranscript>; |
| 122 | } |
| 123 | |
| 124 | /// Drive a single source to completion against `db`, ingesting every transcript |
| 125 | /// it locates for `project_root`. Fail-open: per-file errors are swallowed. |
nothing calls this directly
no outgoing calls
no test coverage detected