import { C as CATALOG_MODEL_STATUSES } from './paths-2M_UxD_H.js';
import { s as sqliteTable, t as text, i as integer, a as index } from './indexes-aYlULWG3.js';
import { u as unique } from './unique-constraint-BM-Apx1H.js';
import { s as sql } from './utils-BvHPJOVk.js';

//#region ../core/dist/store/schema/cleo-global/models-catalog.js
/**
* Global-scope `cleo.db` — **models.dev catalog SSoT** (`models_catalog`, 1 table).
*
* E8-CATALOG-CURATION (epic T11694 · task T11733). This table is the queryable,
* `cleo health`-visible home for the **provider+model capability catalog** that
* today lives only as a disk JSON cache (`llm-catalog/`) and a tiny bundled
* `curated-models.json`. Each row is ONE model — its full models.dev wire
* capability set (modalities, cost, limits, reasoning/tool-call flags, status,
* release date) — so the catalog becomes the SSoT (DB table) with the disk cache
* demoted to an offline/degraded fallback MIRROR (T11737).
*
* It is the catalog half of the "catalog-driven models, NO hardcoded" North Star
* spine: the resolver default model derives from this table sorted by
* `release_date` DESC (T11944), killing the hardcoded `claude-haiku-4-5` literal —
* the static literal survives ONLY as the offline-only last-resort floor when this
* table is empty/unseeded.
*
* ## NOT the `accounts` credential pool — do not confuse the two
*
* `accounts` (T11709) holds machine-wide LLM CREDENTIALS (the pool the runner picks
* from). THIS table holds CATALOG DATA (model capabilities) — no secrets, no
* encryption. They share the cleo-global scope and the E10 typing conventions, but
* carry orthogonal data. The catalog is freely readable; credentials are sealed.
*
* ## E10 typing (mirrors sibling `accounts.ts` / `services.ts`)
*
* - Booleans (`attachment`/`reasoning`/`temperature`/`interleaved`/`tool_call`) use
*   `integer({mode:'boolean'})` (CHECK `(0, 1)` in the migration).
* - `modalities` / `cost` are JSON blobs serialized to TEXT (documented json pattern).
* - `release_date` is TEXT `YYYY-MM-DD` with a GLOB date check; `seeded_at` is a TEXT
*   ISO-8601 timestamp.
* - `status` is a named enum ({@link CATALOG_MODEL_STATUSES}, minted in contracts).
*
* ## Active selection — `release_date`-sorted, latest wins
*
* The resolver default and any "newest model for provider X" query reads this table
* ordered by `(provider_id, release_date DESC)` — the `idx_models_catalog_provider_release`
* index backs that scan. No raw partial unique index is required (unlike `accounts`'
* active-pointer); `id` is the natural PK and `(provider_id, models_dev_id)` is a
* natural unique key for the upsert.
*
* @task T11733
* @epic T11694
* @see ../../../../migrations/drizzle-cleo-global — the forward migration
* @see ../../../llm/catalog-seeder.ts — the seeder that populates this table (T11734)
* @see ../../../llm/catalog-resolver.ts — the table-first read chokepoint (T11737)
* @see ./accounts.ts — the sibling credential-pool table this directory mirrors
*/
/**
* `models_catalog` — the machine-wide provider+model capability catalog table.
*
* One row per model. The catalog SSoT: seeded from the shipped offline
* `curated-catalog.json` (T11734), read table-first via `resolveCatalogEntry()`
* (T11737), and consulted by the resolver default (latest `release_date` wins —
* T11944). `id` is the model id (PK); `(provider_id, models_dev_id)` is the natural
* upsert key.
*
* @task T11733
*/
var modelsCatalog = sqliteTable("models_catalog", {
	id: text("id").primaryKey(),
	providerId: text("provider_id").notNull(),
	name: text("name").notNull(),
	family: text("family").notNull(),
	attachment: integer("attachment", { mode: "boolean" }).notNull().default(false),
	reasoning: integer("reasoning", { mode: "boolean" }).notNull().default(false),
	temperature: integer("temperature", { mode: "boolean" }).notNull().default(true),
	interleaved: integer("interleaved", { mode: "boolean" }).notNull().default(false),
	toolCall: integer("tool_call", { mode: "boolean" }).notNull().default(false),
	modalities: text("modalities").notNull().default("{\"input\":[\"text\"],\"output\":[\"text\"]}"),
	cost: text("cost").notNull().default("{}"),
	contextLimit: integer("context_limit"),
	outputLimit: integer("output_limit"),
	status: text("status", { enum: CATALOG_MODEL_STATUSES }).notNull().default("stable"),
	releaseDate: text("release_date").notNull(),
	modelsDevId: text("models_dev_id").notNull(),
	source: text("source").notNull().default("seed"),
	seededAt: text("seeded_at").notNull().default(sql`(datetime('now'))`)
}, (table) => [
	unique("ux_models_catalog_provider_modeldev").on(table.providerId, table.modelsDevId),
	index("idx_models_catalog_provider_release").on(table.providerId, table.releaseDate),
	index("idx_models_catalog_provider_status").on(table.providerId, table.status)
]);

export { modelsCatalog as m };
//# sourceMappingURL=models-catalog-DG3aPok8.js.map
