feat(ai-core): provider abstraction for Session Notes + Clips#31
Merged
Conversation
New @pairux/ai-core package — the compute-plane contract for PairUX Pro AI Session Notes and AI Clips (PRD "Replay"). - AiProvider interface: summarizeSession() + selectClips(), text in / validated out - Two drivers: anthropic (managed key or BYOK) and ollama (fully local) - Zod schemas (SessionNote, ClipCandidate[]) as the single source of truth - One-shot auto-repair on malformed replies, then StructuredOutputError so the caller can fall back to manual mode (the PRD's clip-selection contract) - Only transcript text ever crosses a provider boundary; no SDK dependency — the desktop host injects a structurally-typed Anthropic client - Managed default model is Haiku 4.5 to keep the Pro unit economics in envelope (review finding F3) Standalone package — does not touch existing apps. Verified in isolation: typecheck, eslint (0 warnings), build, and 37 unit tests all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
CI "Lint" job failed on `pnpm format:check`; CodeQL flagged two ReDoS-prone regexes. Both are in this package. - parse.ts: replace the ```-fence and first-bracket regexes with linear index scans (indexOf / char loop) — no backtracking on adversarial model output - providers/ollama.ts: strip trailing slashes with a char loop instead of /\/+$/ - run Prettier over the package (printWidth 100, es5 trailing commas) to satisfy format:check No behavior change; 37 tests still pass, typecheck + eslint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
@pairux/ai-core— the compute-plane contract the desktop host calls into for AI Session Notes and AI Clips (PRD "Replay"). Transcript text in, validated structured output out.AiProviderinterface:summarizeSession()+selectClips()anthropic(managed key or BYOK) andollama(fully local)SessionNote,ClipCandidate[]) as the single source of truthStructuredOutputErrorso the caller can fall back to manual mode — the PRD's clip-selection contractTranscriptInput(text + metadata); no@anthropic-ai/sdkdependency — the host injects a structurally-typed clientScope / blast radius
Standalone new package. Does not touch
apps/web|desktop|mobile, so it can't affect existing builds. Only other change is thepnpm-lock.yamlentry for the new workspace package.Verification
Run in isolation (
pnpm --filter @pairux/ai-core …):typecheck(tsc, repo's strict config) — passlint(eslintstrictTypeChecked) — pass, 0 warningsbuild(tsc → dist) — passtest(vitest) — 37/37 passNot in this PR (next steps)
Foundation only. Still to come per the PRD: recording (P0-1), local Whisper transcription (P0-2), the ffmpeg clip renderer + review UI (P0-4), and wiring
ai-coreintoapps/desktop. Also unresolved from the review: consent/legal (F5) and the desktop performance targets (F6).🤖 Generated with Claude Code