mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-04 11:38:10 +01:00
* feat(ai): drafting runs only on readers' own keys; ratchet against free-tier background AI The hourly drafter spent the site's free models. Remove the free-chain path (freeAsk, backgroundMay); drafting now takes an Ask built from a reader key (lib/byok-ask.ts). /api/cron/drafts is gone; /api/cron/auto-updates drafts only for readers who opted in, on their stored key, capped per day (013). test/no-free-background-ai walks the import graph from every cron route and fails on any path to the free chain; proven by mutation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * feat(updates): Update news now for every reader; AI summaries and auto-updates on the reader's own key - Bottleneck, company and desk pages: "Update news now" sweeps the web (no AI, signed out too, rate-limited, 15-min cooldown) and lists the leads. - "Summarise with AI" drafts up to three on the reader's key (browser or sealed); without one it explains the free AI is kept for questions and opens the key panel. - /account/settings#auto-updates: opt-in hourly drafting on the stored key, daily cap with a token estimate (3.4k/draft, measured). - Honest copy: /data/freshness reports drafting as on demand, /review, /data AI spend, desk and docs say drafting runs only on readers' keys. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
20 lines
780 B
PL/PgSQL
20 lines
780 B
PL/PgSQL
BEGIN;
|
|
|
|
-- Automatic AI updates, spent on the READER's own key (lib/auto-updates.ts).
|
|
--
|
|
-- A reader who opts in at /account/settings#auto-updates lets the hourly run
|
|
-- draft new leads on their bottlenecks with the key they saved. This ledger is
|
|
-- how the run keeps to the daily cap they chose: one row per reader per UTC
|
|
-- day, counting the leads that reached their model. The site's free models
|
|
-- never draft; there is no row here for them.
|
|
CREATE TABLE IF NOT EXISTS research_auto_draft_days (
|
|
actor_id text NOT NULL,
|
|
day date NOT NULL,
|
|
drafts integer NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (actor_id, day)
|
|
);
|
|
|
|
COMMENT ON TABLE research_auto_draft_days IS 'Per-reader daily count of automatic drafts made on that reader''s own AI key, against the cap they set.';
|
|
|
|
COMMIT;
|