Download this file
| 1 | -- Lookups (spec 2026-11-26-assistant-abilities §4): each search backend's |
| 2 | -- queries per UTC calendar month, against the operator's monthly cap. |
| 3 | CREATE TABLE chat_web_search_usage (backend text, month text, used integer NOT NULL DEFAULT 0, PRIMARY KEY (backend, month)); |
| 4 | -- Each lookup: its turn, attempt and order, the call it answered, its |
| 5 | -- state (running, shown or failed), the queries and reads as JSON, the |
| 6 | -- answer and sources, its code. Page text is never stored. |
| 7 | CREATE TABLE chat_lookups (id text PRIMARY KEY, person text NOT NULL, turn_id text NOT NULL, attempt integer NOT NULL, |
| 8 | seq integer NOT NULL, call_id text NOT NULL, state text NOT NULL, queries text, reads text, answer text, |
| 9 | sources text, code text, created_at datetime NOT NULL); |
| 10 | CREATE INDEX chat_lookup_turn ON chat_lookups(turn_id, attempt, seq); |
| 11 | CREATE INDEX chat_lookup_person ON chat_lookups(person, created_at); |
| 12 | |