import type { ArchitectsDb } from '../types.js';
export declare const ARCHITECTS_SCHEMA = "\nCREATE TABLE IF NOT EXISTS architects_blueprints (\n  id             TEXT PRIMARY KEY,\n  strike_team_id TEXT,\n  title          TEXT NOT NULL,\n  workflow_id    TEXT,\n  status         TEXT NOT NULL DEFAULT 'active'\n    CHECK(status IN ('draft','active','converging','done','archived')),\n  variables      TEXT NOT NULL DEFAULT '{}',\n  worklist_id    TEXT,\n  created_at     TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE IF NOT EXISTS architects_worklists (\n  id           TEXT PRIMARY KEY,\n  blueprint_id TEXT NOT NULL,\n  title        TEXT NOT NULL,\n  created_at   TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE IF NOT EXISTS architects_work_items (\n  id                    TEXT PRIMARY KEY,\n  worklist_id           TEXT NOT NULL,\n  title                 TEXT NOT NULL,\n  parent_work_item_id   TEXT,\n  correlation_id        TEXT,\n  ancestry_path         TEXT NOT NULL DEFAULT '[]',\n  status                TEXT NOT NULL DEFAULT 'todo'\n    CHECK(status IN ('todo','claimed','in_progress','done','failed','blocked','cancelled')),\n  depends_on            TEXT NOT NULL DEFAULT '[]',\n  assigned_operative_id TEXT,\n  construction_lock_id  TEXT,\n  branch                TEXT,\n  merged_at             TEXT,\n  created_at            TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE IF NOT EXISTS architects_construction_locks (\n  id            TEXT PRIMARY KEY,\n  work_item_id  TEXT NOT NULL,\n  operative_id  TEXT NOT NULL,\n  acquired_at   TEXT NOT NULL DEFAULT (datetime('now')),\n  released_at   TEXT,\n  lease_duration_ms INTEGER NOT NULL DEFAULT 300000,\n  lease_renewed_at  INTEGER,\n  lease_expires_at  INTEGER NOT NULL DEFAULT 0,\n  hook_ref      TEXT\n);\n\nCREATE TABLE IF NOT EXISTS architects_relay_messages (\n  id                TEXT PRIMARY KEY,\n  from_operative_id TEXT NOT NULL,\n  to_operative_id   TEXT,\n  strike_team_id    TEXT,\n  subject           TEXT NOT NULL,\n  body              TEXT NOT NULL,\n  sent_at           TEXT NOT NULL DEFAULT (datetime('now')),\n  read_at           TEXT,\n  priority          TEXT NOT NULL DEFAULT 'normal'\n    CHECK(priority IN ('normal','urgent'))\n);\n\nCREATE TABLE IF NOT EXISTS architects_convergence_runs (\n  id             TEXT PRIMARY KEY,\n  worklist_id    TEXT NOT NULL,\n  strategy       TEXT NOT NULL DEFAULT 'bisecting'\n    CHECK(strategy IN ('sequential','bisecting')),\n  work_item_ids  TEXT NOT NULL DEFAULT '[]',\n  status         TEXT NOT NULL DEFAULT 'running'\n    CHECK(status IN ('running','merged','failed','bisecting','deferred')),\n  failed_item_id TEXT,\n  started_at     TEXT NOT NULL DEFAULT (datetime('now')),\n  completed_at   TEXT\n);\n\nCREATE TABLE IF NOT EXISTS architects_dispatch_queue (\n  id             TEXT PRIMARY KEY,\n  operative_id   TEXT NOT NULL,\n  work_item_id   TEXT NOT NULL,\n  scheduled_at   TEXT NOT NULL DEFAULT (datetime('now')),\n  dispatched_at  TEXT,\n  status         TEXT NOT NULL DEFAULT 'queued'\n    CHECK(status IN ('queued','dispatched','failed'))\n);\n\nCREATE INDEX IF NOT EXISTS idx_arch_items_worklist   ON architects_work_items(worklist_id, status);\nCREATE INDEX IF NOT EXISTS idx_arch_items_operative  ON architects_work_items(assigned_operative_id);\nCREATE INDEX IF NOT EXISTS idx_arch_locks_item       ON architects_construction_locks(work_item_id, released_at);\nCREATE INDEX IF NOT EXISTS idx_arch_blueprints_team   ON architects_blueprints(strike_team_id, worklist_id);\nCREATE INDEX IF NOT EXISTS idx_arch_relay_to_op      ON architects_relay_messages(to_operative_id, read_at);\nCREATE INDEX IF NOT EXISTS idx_arch_relay_to_team    ON architects_relay_messages(strike_team_id, read_at);\n";
export declare function initArchitectsSchema(db: ArchitectsDb): void;
