Files
OmniRoute/src/lib/db/migrations/128_auto_candidate_overrides.sql
Diego Rodrigues de Sa e Souza 51b118c2d3 feat(routing): read-only auto/* candidate transparency + per-API-key exclusions (#7819) (#7839)
Level 1: GET /v1/auto-combo/{channel}/candidates lists an auto/* channel's
candidate pool with live reachability (provider circuit breaker via
getStatus()/canExecute(), connection cooldown, model lockout).

Level 2: per-API-key candidate exclusions, persisted in a new
auto_candidate_overrides table and enforced at the virtualFactory.ts
candidate-pool chokepoint via a pure, fail-open filter — mirrors the #7622/
#7646 precedent exactly (zero touches to the frozen combo.ts god-file).

Levels 3 (weights/ordering) and 4 (policy pin) are deferred to a follow-up
issue, as is the dashboard UI (Step 4) and its i18n strings.
2026-07-20 10:09:01 -03:00

17 lines
692 B
SQL

-- #7819 (Level 2) — per-API-key candidate exclusions for `auto/*` channels.
-- OmniRoute is single-tenant (no `users` table); `api_key_id` is the closest
-- real per-caller identity this app has. One row per excluded candidate
-- connection for a given API key + auto channel.
CREATE TABLE IF NOT EXISTS auto_candidate_overrides (
id TEXT PRIMARY KEY,
api_key_id TEXT NOT NULL,
auto_channel TEXT NOT NULL,
connection_id TEXT NOT NULL,
excluded INTEGER NOT NULL DEFAULT 1,
created_at TEXT NOT NULL,
UNIQUE(api_key_id, auto_channel, connection_id)
);
CREATE INDEX IF NOT EXISTS idx_auto_candidate_overrides_key_channel
ON auto_candidate_overrides(api_key_id, auto_channel);