feat(vibe): add durable versioned session API

This commit is contained in:
kami
2026-08-01 23:09:09 +04:00
parent 515cab2f89
commit 51ef7c84db
10 changed files with 1494 additions and 24 deletions
+12
View File
@@ -708,4 +708,16 @@ export const MIGRATIONS: Migration[] = [
);
`,
},
{
// A material Vibe event is projected into the legacy listener inputs in
// the same transaction as its ledger write. This marker makes that bridge
// auditable and exactly-once even when a client retries an event id.
id: '20260801_vibe_event_projections',
sql: `
CREATE TABLE IF NOT EXISTS vibe_event_projections (
event_id UUID PRIMARY KEY REFERENCES vibe_events(id) ON DELETE CASCADE,
projected_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
`,
},
];
+8
View File
@@ -562,6 +562,14 @@ CREATE INDEX IF NOT EXISTS idx_vibe_events_session_occurred
CREATE INDEX IF NOT EXISTS idx_vibe_events_user_occurred
ON vibe_events (user_id, occurred_at DESC);
-- Exactly-once projection marker for material Vibe feedback. The immutable
-- event remains authoritative; this row proves its effect was applied to the
-- listener inputs without double-counting an idempotent client retry.
CREATE TABLE IF NOT EXISTS vibe_event_projections (
event_id UUID PRIMARY KEY REFERENCES vibe_events(id) ON DELETE CASCADE,
projected_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS vibe_plan_versions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
session_id UUID NOT NULL REFERENCES vibe_sessions(id) ON DELETE CASCADE,