import: share flat-directory discovery across importers
Commit

Add discoverSessionFiles (discover.go), a single home for the discovery rules every flat-directory importer repeated: resolver-rejected entries skipped, session-ID filter, lookback-window cutoff by transcript modtime, and path sort. Route claude, cursor, pi, factory, gemini, and copilot through it; each Discover drops from a ~30-line loop to a ~10-line call with a small resolver (jsonlSessionResolver for the <stem><ext> agents, a closure for cursor's nested layout and copilot's per-repo session.start filter).
codex keeps its own Discover — it walks a recursive date-sharded tree and filters by session_meta cwd, which the flat helper does not model.
Pure refactor: discovery behavior and results are unchanged (verified against the importtest fixtures and the existing per-agent Discover tests).
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com Entire-Checkpoint: 01c03669fe4d