mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-07 05:56:41 +02:00
feat: add enriched transcript sync — Haiku summaries, session file enrichment
Add session intelligence pipeline for team transcript sync: - lib/transcript-sync.ts: parse history.jsonl, enrich with Claude session file data (tools_used, full turn count), sync marker management, 10-concurrent push with 5-concurrent Haiku summarization - lib/llm-summarize.ts: raw fetch() to Anthropic Messages API (no SDK dep), retry-after on 429, exponential backoff on 5xx, SHA-based eval-cache - lib/sync.ts: pushTranscript() and pullTranscripts() following existing patterns - 006_transcript_sync.sql: unique index on (team_id, session_id) for idempotent upsert, RLS changed from admin-only to team-wide read Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
-- 006_transcript_sync.sql — Unique index for idempotent transcript upsert + RLS fix.
|
||||
|
||||
-- Unique index on (team_id, session_id) for upsert via Prefer: resolution=merge-duplicates.
|
||||
-- session_id is a UUID from Claude Code — globally unique. No need for user_id in the key
|
||||
-- (which is nullable and breaks PostgreSQL unique index dedup on NULL values).
|
||||
create unique index if not exists idx_transcript_natural_key
|
||||
on session_transcripts(team_id, session_id);
|
||||
|
||||
-- Change transcript RLS from admin-only read to team-wide read.
|
||||
-- Matches the pattern used by eval_runs, retro_snapshots, qa_reports, ship_logs, greptile_triage.
|
||||
-- Opt-in transcript sync already requires user consent (sync_transcripts=true).
|
||||
drop policy if exists "admin_read" on session_transcripts;
|
||||
create policy "team_read" on session_transcripts for select using (
|
||||
team_id in (select team_id from team_members where user_id = auth.uid())
|
||||
);
|
||||
Reference in New Issue
Block a user