Files
CatoandClaude Opus 5.5 b2dea2fcef feat(ask): fast, any AI via shared ai-kit BYOK, one-click claim verification (#89)
* feat(ask): fast, any-AI via shared ai-kit BYOK, and one-click claim verification

- BYOK on @bitbaum/ai-kit/byok (1.12.0): ten OpenAI-shaped vendors incl.
  Anthropic and Gemini, streamed with tools; drops @anthropic-ai/sdk and the
  local byok-shared copy. Signed-in keys sealed server-side (ai-kit/seal,
  SUBSTRATA_BYOK_SECRET, research_ai_keys); signed-out keys stay in the browser.
  Model picker reads the vendor's live catalogue. Panel in Ask and /account/settings#ai.
- Speed: status before any lookup, parallel tool calls, 3-round cap, page-only
  questions skip tools, free-chain link cooldown after 429s, parallel web reads,
  trimmed history.
- Verify: Check this on every Figure, event rows, bottleneck facts, company lede.
  Reads the cited source + searches the web in parallel before the model, answers
  Supported/Contradicted/Outdated/Unverifiable with quoted passages and links.
- /api/factcheck now runs the same agent loop.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ask): claim context for list values, computed figures check via their method, no web search for bare numbers

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:10:02 -07:00

19 lines
674 B
PL/PgSQL

BEGIN;
-- A signed-in reader's own AI key, sealed (AES-256-GCM, @bitbaum/ai-kit/seal)
-- with SUBSTRATA_BYOK_SECRET. The database alone cannot read it. One key per
-- reader: the vendor and model they chose, and the last four characters so
-- the settings page can say which key is saved without ever showing it.
CREATE TABLE IF NOT EXISTS research_ai_keys (
actor_id text PRIMARY KEY,
vendor text NOT NULL,
model text NOT NULL,
sealed text NOT NULL,
key_hint text NOT NULL,
updated_at timestamptz NOT NULL DEFAULT now()
);
COMMENT ON TABLE research_ai_keys IS 'Per-reader BYOK key for Ask, sealed with SUBSTRATA_BYOK_SECRET. Private to the reader.';
COMMIT;