The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
Remove cheap model profiles (#12683)
Dotta4b6de5327e8e
diff --git a/cli/src/__tests__/admin-asset-skill-parity.test.ts b/cli/src/__tests__/admin-asset-skill-parity.test.tsindex 7fc9d81d06..71aff9f7cf 100644--- a/cli/src/__tests__/admin-asset-skill-parity.test.ts+++ b/cli/src/__tests__/admin-asset-skill-parity.test.ts@@ -90,7 +90,6 @@ describe("admin, asset, and skill parity commands", () => {await run(["adapter", "config-schema", "codex_local"]);await run(["adapter", "ui-parser", "codex_local"]);await run(["adapter", "models", "codex_local", "--company-id", COMPANY_ID, "--refresh", "--environment-id", "env-1"]);- await run(["adapter", "model-profiles", "codex_local", "--company-id", COMPANY_ID]);await run(["adapter", "detect-model", "codex_local", "--company-id", COMPANY_ID]);await run(["adapter", "test-environment", "codex_local", "--company-id", COMPANY_ID, "--payload-json", "{}"]);await run(["adapter", "delete", "codex_local"]);@@ -107,7 +106,6 @@ describe("admin, asset, and skill parity commands", () => {["GET", "http://localhost:3100/api/adapters/codex_local/config-schema"],["GET", "http://localhost:3100/api/adapters/codex_local/ui-parser.js"],["GET", `http://localhost:3100/api/companies/${COMPANY_ID}/adapters/codex_local/models?refresh=true&environmentId=env-1`],- ["GET", `http://localhost:3100/api/companies/${COMPANY_ID}/adapters/codex_local/model-profiles`],["GET", `http://localhost:3100/api/companies/${COMPANY_ID}/adapters/codex_local/detect-model`],["POST", `http://localhost:3100/api/companies/${COMPANY_ID}/adapters/codex_local/test-environment`],["DELETE", "http://localhost:3100/api/adapters/codex_local"],diff --git a/cli/src/commands/client/adapter.ts b/cli/src/commands/client/adapter.tsindex 227248d3ae..a4df9ad10a 100644--- a/cli/src/commands/client/adapter.ts+++ b/cli/src/commands/client/adapter.ts@@ -122,7 +122,6 @@ export function registerAdapterCommands(program: Command): void {{ includeCompany: false },);- addCompanyAdapterGet(adapter, "model-profiles", "List adapter model profiles", "model-profiles");addCompanyAdapterGet(adapter, "detect-model", "Detect adapter model", "detect-model");addCompanyAdapterPost(adapter, "test-environment", "Test adapter environment configuration", "test-environment");}diff --git a/doc/CLI.md b/doc/CLI.mdindex aa6a0ad616..971648137e 100644--- a/doc/CLI.md+++ b/doc/CLI.md@@ -899,7 +899,6 @@ npx paperclipai adapter delete <adapter-type>npx paperclipai adapter config-schema <adapter-type>npx paperclipai adapter ui-parser <adapter-type>npx paperclipai adapter models <adapter-type> --company-id <company-id> [--refresh] [--environment-id <id>]-npx paperclipai adapter model-profiles <adapter-type> --company-id <company-id>npx paperclipai adapter detect-model <adapter-type> --company-id <company-id>npx paperclipai adapter test-environment <adapter-type> --company-id <company-id> --payload-json '{...}'```diff --git a/doc/SPEC-implementation.md b/doc/SPEC-implementation.mdindex 1d223016bc..3e5c857105 100644--- a/doc/SPEC-implementation.md+++ b/doc/SPEC-implementation.md@@ -157,7 +157,7 @@ Invariant: every business record belongs to exactly one company.- `capabilities` text null- `adapter_type` text; built-ins include `process`, `http`, `claude_local`, `codex_local`, `gemini_local`, `opencode_local`, `pi_local`, `cursor`, `hermes_local`, `hermes_gateway`, and `openclaw_gateway`- `adapter_config` jsonb not null-- `runtime_config` jsonb not null default `{}`; may include Paperclip runtime policy such as `modelProfiles.cheap.adapterConfig` for an optional low-cost model lane that does not change the primary adapter config+- `runtime_config` jsonb not null default `{}`; contains Paperclip runtime policy such as heartbeat scheduling and debug settings- `default_environment_id` uuid fk `environments.id` null- `context_mode` enum: `thin | fat` default `thin`- `budget_monthly_cents` int not null default 0@@ -1203,11 +1203,11 @@ Behavior:- `thin`: send IDs and pointers only; agent fetches context via API- `fat`: include current assignments, goal summary, budget snapshot, and recent comments-## 11.5 Recovery Model Profiles+## 11.5 Recovery Work Classes-The optional `modelProfiles.cheap` lane is not a retry worker lane. Paperclip may request the cheap profile only for status-only recovery coordination, and those wakes must include guard context that prevents deliverable work and document/plan updates (`allowDeliverableWork: false`, `allowDocumentUpdates: false`, `resumeRequiresNormalModel: true`).+Status-only recovery coordination must include guard context that prevents deliverable work and document or plan updates (`allowDeliverableWork: false`, `allowDocumentUpdates: false`, `resumeRequiresNormalModel: true`). Recovery work classes do not select or change the agent model.-Failed source-work retries, process-loss retries, transient/scheduled retries, max-turn continuations, source-assignee continuations, and downstream source-work child/requeue/resume contexts must use the normal/original model lane. If cheap recovery repairs liveness while actual work remains, the next live continuation path must be a separate normal-model worker run with cheap hints scrubbed.+Failed source-work retries, process-loss retries, transient or scheduled retries, max-turn continuations, source-assignee continuations, and downstream source-work child, requeue, or resume contexts use the agent's configured model. If status-only recovery repairs liveness while actual work remains, the next live continuation path must be a separate worker run.## 11.6 Scheduler Rulesdiff --git a/doc/execution-semantics.md b/doc/execution-semantics.mdindex d47d34ae9d..42eace4e4c 100644--- a/doc/execution-semantics.md+++ b/doc/execution-semantics.md@@ -573,11 +573,11 @@ An accepted interaction supersedes a continuation park recorded before that acceThis keeps the post-decomposition umbrella (§7) on a real waiting path instead of relying on `parentId` rollup, which §6 does not treat as a dependency.-### 9.3 Recovery model-profile lane+### 9.3 Recovery work classes-Cheap model profiles are only for status-only operational recovery overhead. Paperclip may request `modelProfile: "cheap"` for bounded recovery-owner work that updates task liveness, clears bad status, records a disposition, or asks for human/manager intervention. Those wakes must carry guard context such as `allowDeliverableWork: false`, `allowDocumentUpdates: false`, and `resumeRequiresNormalModel: true`.+Status-only operational recovery can update task liveness, clear bad status, record a disposition, or ask for human or manager intervention. Those wakes must carry guard context such as `allowDeliverableWork: false`, `allowDocumentUpdates: false`, and `resumeRequiresNormalModel: true`. The recovery work class does not select or change the agent model.-Automatic retries that can continue source work must use the original/normal model lane. This includes failed source-work retries, process-loss retries, transient/scheduled retries, max-turn continuations, source-assignee continuations, assigned-todo dispatch recovery, and any run that can update repo files, issue documents, plans, work products, or attachments. When a cheap status-only recovery determines that actual work remains, it must hand back to a normal-model worker run before source work or persistent deliverable updates resume. Cheap recovery hints must be scrubbed from copied retry, resume, child, and downstream source-work contexts.+Automatic retries that can continue source work use the agent's configured model. This includes failed source-work retries, process-loss retries, transient or scheduled retries, max-turn continuations, source-assignee continuations, assigned-todo dispatch recovery, and any run that can update repo files, task documents, plans, work products, or attachments. When status-only recovery determines that actual work remains, it must hand back to a worker run before source work or persistent deliverable updates resume.## 10. Startup and Periodic Reconciliationdiff --git a/packages/adapter-utils/src/index.ts b/packages/adapter-utils/src/index.tsindex b718d327c0..82b9bebb3d 100644--- a/packages/adapter-utils/src/index.ts+++ b/packages/adapter-utils/src/index.ts@@ -25,8 +25,6 @@ export type {AdapterSkillContext,AdapterSessionCodec,AdapterModel,- AdapterModelProfileKey,- AdapterModelProfileDefinition,HireApprovedPayload,HireApprovedHookResult,ConfigFieldOption,diff --git a/packages/adapter-utils/src/types.ts b/packages/adapter-utils/src/types.tsindex c9ee155d16..ac37db2ad2 100644--- a/packages/adapter-utils/src/types.ts+++ b/packages/adapter-utils/src/types.ts@@ -232,16 +232,6 @@ export interface AdapterModel {label: string;}-export type AdapterModelProfileKey = "cheap";--export interface AdapterModelProfileDefinition {- key: AdapterModelProfileKey;- label: string;- description?: string;- adapterConfig: Record<string, unknown>;- source?: "adapter_default" | "discovered";-}-export type AdapterEnvironmentCheckLevel = "info" | "warn" | "error";export interface AdapterEnvironmentCheck {@@ -458,8 +448,6 @@ export interface ServerAdapterModule {runtimeToolDelivery?: AdapterRuntimeToolDelivery;models?: AdapterModel[];listModels?: () => Promise<AdapterModel[]>;- modelProfiles?: AdapterModelProfileDefinition[];- listModelProfiles?: () => Promise<AdapterModelProfileDefinition[]>;/*** Optional explicit refresh hook for model discovery.* Use this when the adapter caches discovered models and needs a bypass path@@ -673,14 +661,6 @@ export interface CreateConfigValues {promptTemplate: string;model: string;thinkingEffort: string;- /**- * Optional cheap model profile config for new agents on adapters that- * support model profiles. Persisted under- * `runtimeConfig.modelProfiles.cheap.adapterConfig`, never on the primary- * `adapterConfig`.- */- cheapModel?: string;- cheapModelEnabled?: boolean;chrome: boolean;dangerouslySkipPermissions: boolean;claudeEngine?: "auto" | "cli" | "acp";diff --git a/packages/adapters/claude-local/src/index.ts b/packages/adapters/claude-local/src/index.tsindex 4d54d86ff4..35de6e36ac 100644--- a/packages/adapters/claude-local/src/index.ts+++ b/packages/adapters/claude-local/src/index.ts@@ -1,5 +1,3 @@-import type { AdapterModelProfileDefinition } from "@paperclipai/adapter-utils";-export const type = "claude_local";export const label = "Claude Code";@@ -18,19 +16,6 @@ export const models = [{ id: "claude-haiku-4-5", label: "Claude Haiku 4.5" },];-export const modelProfiles: AdapterModelProfileDefinition[] = [- {- key: "cheap",- label: "Cheap",- description: "Use Claude Sonnet as the lower-cost Claude Code lane while preserving the agent's primary model.",- adapterConfig: {- model: "claude-sonnet-4-6",- effort: "low",- },- source: "adapter_default",- },-];-export const agentConfigurationDoc = `# claude_local agent configurationAdapter: claude_localdiff --git a/packages/adapters/codex-local/src/index.ts b/packages/adapters/codex-local/src/index.tsindex 9870a34657..8a21e8df49 100644--- a/packages/adapters/codex-local/src/index.ts+++ b/packages/adapters/codex-local/src/index.ts@@ -1,5 +1,3 @@-import type { AdapterModelProfileDefinition } from "@paperclipai/adapter-utils";-export const type = "codex_local";export const label = "Codex";@@ -74,16 +72,6 @@ export const models = [{ id: "codex-mini-latest", label: "Codex Mini" },];-export const modelProfiles: AdapterModelProfileDefinition[] = [- {- key: "cheap",- label: "Cheap",- description: "Use an explicitly configured lower-cost Codex model without changing the primary model.",- adapterConfig: {},- source: "adapter_default",- },-];-export const agentConfigurationDoc = `# codex_local agent configurationAdapter: codex_localdiff --git a/packages/adapters/cursor-local/src/index.ts b/packages/adapters/cursor-local/src/index.tsindex a576f503ca..0a78423c4f 100644--- a/packages/adapters/cursor-local/src/index.ts+++ b/packages/adapters/cursor-local/src/index.ts@@ -1,5 +1,3 @@-import type { AdapterModelProfileDefinition } from "@paperclipai/adapter-utils";-export const type = "cursor";export const label = "Cursor";@@ -58,18 +56,6 @@ const CURSOR_FALLBACK_MODEL_IDS = [export const models = CURSOR_FALLBACK_MODEL_IDS.map((id) => ({ id, label: id }));-export const modelProfiles: AdapterModelProfileDefinition[] = [- {- key: "cheap",- label: "Cheap",- description: "Use Cursor's known Codex mini model as the budget lane instead of assuming auto is cheap.",- adapterConfig: {- model: "gpt-5.1-codex-mini",- },- source: "adapter_default",- },-];-export const agentConfigurationDoc = `# cursor agent configurationAdapter: cursordiff --git a/packages/adapters/gemini-local/src/index.ts b/packages/adapters/gemini-local/src/index.tsindex e895c66102..8204022596 100644--- a/packages/adapters/gemini-local/src/index.ts+++ b/packages/adapters/gemini-local/src/index.ts@@ -1,6 +1,5 @@import {buildSandboxNpmInstallCommand,- type AdapterModelProfileDefinition,} from "@paperclipai/adapter-utils";export const type = "gemini_local";@@ -21,18 +20,6 @@ export const models = [{ id: "gemini-2.0-flash-lite", label: "Gemini 2.0 Flash Lite" },];-export const modelProfiles: AdapterModelProfileDefinition[] = [- {- key: "cheap",- label: "Cheap",- description: "Use Gemini Flash Lite as the budget Gemini CLI lane while preserving the primary model.",- adapterConfig: {- model: "gemini-2.5-flash-lite",- },- source: "adapter_default",- },-];-export const agentConfigurationDoc = `# gemini_local agent configurationAdapter: gemini_localdiff --git a/packages/adapters/opencode-local/src/index.test.ts b/packages/adapters/opencode-local/src/index.test.tsdeleted file mode 100644index 3a23d109bb..0000000000--- a/packages/adapters/opencode-local/src/index.test.ts+++ /dev/null@@ -1,28 +0,0 @@-import { describe, expect, it } from "vitest";-import { buildOpenCodeModelProfiles, DEFAULT_OPENCODE_CHEAP_MODEL } from "./index.js";--describe("buildOpenCodeModelProfiles cheap lane", () => {- it("defaults to the upstream Codex mini model with variant low", () => {- const [cheap] = buildOpenCodeModelProfiles({});- expect(cheap.key).toBe("cheap");- expect(cheap.adapterConfig).toEqual({ model: DEFAULT_OPENCODE_CHEAP_MODEL, variant: "low" });- });-- it("uses PAPERCLIP_OPENCODE_CHEAP_MODEL when set (no variant, gateway models may not support it)", () => {- const [cheap] = buildOpenCodeModelProfiles({ PAPERCLIP_OPENCODE_CHEAP_MODEL: "anthropic/gw/m" });- expect(cheap.adapterConfig).toEqual({ model: "anthropic/gw/m" });- });-- it("falls back to PAPERCLIP_OPENCODE_SMALL_MODEL so one setting covers both budget lanes", () => {- const [cheap] = buildOpenCodeModelProfiles({ PAPERCLIP_OPENCODE_SMALL_MODEL: "anthropic/gw/small" });- expect(cheap.adapterConfig).toEqual({ model: "anthropic/gw/small" });- });-- it("prefers CHEAP_MODEL over SMALL_MODEL when both are set", () => {- const [cheap] = buildOpenCodeModelProfiles({- PAPERCLIP_OPENCODE_CHEAP_MODEL: "anthropic/gw/cheap",- PAPERCLIP_OPENCODE_SMALL_MODEL: "anthropic/gw/small",- });- expect(cheap.adapterConfig).toEqual({ model: "anthropic/gw/cheap" });- });-});diff --git a/packages/adapters/opencode-local/src/index.ts b/packages/adapters/opencode-local/src/index.tsindex bb0e60171c..615f425ead 100644--- a/packages/adapters/opencode-local/src/index.ts+++ b/packages/adapters/opencode-local/src/index.ts@@ -1,5 +1,3 @@-import type { AdapterModelProfileDefinition } from "@paperclipai/adapter-utils";-export const type = "opencode_local";export const label = "OpenCode";@@ -63,41 +61,6 @@ export const models: Array<{ id: string; label: string }> = [{ id: "openai/gpt-5.1-codex-mini", label: "openai/gpt-5.1-codex-mini" },];-export const DEFAULT_OPENCODE_CHEAP_MODEL = "openai/gpt-5.1-codex-mini";--// The "cheap" budget profile (used for recovery retries and other low-cost lanes).-// Defaults to OpenCode's known Codex mini model, but is overridable so a deployment-// routing through a gateway that does not serve that model (e.g. an EU LLM gateway)-// can point the budget lane at a gateway-served model instead -- otherwise recovery-// retries fail with "model not found". PAPERCLIP_OPENCODE_CHEAP_MODEL takes priority;-// PAPERCLIP_OPENCODE_SMALL_MODEL (the auxiliary/title model) is reused as a sensible-// fallback so a single setting covers both budget lanes. The default keeps the-// upstream behaviour (with the Codex `variant: "low"`).-//-// This module is shared client/server code (the UI imports it for-// DEFAULT_OPENCODE_LOCAL_MODEL etc.), so it must not touch the global `process`-// unguarded: in the browser (Vite dev middleware serves it untransformed)-// a bare `process.env` throws ReferenceError at module load and takes the whole-// app down. Guard with `typeof process` and fall back to an empty env.-export function buildOpenCodeModelProfiles(- env: NodeJS.ProcessEnv = typeof process === "undefined" ? {} : process.env,-): AdapterModelProfileDefinition[] {- const override = (env.PAPERCLIP_OPENCODE_CHEAP_MODEL ?? env.PAPERCLIP_OPENCODE_SMALL_MODEL)?.trim();- return [- {- key: "cheap",- label: "Cheap",- description: "Budget lane model for recovery retries and other low-cost tasks.",- adapterConfig: override- ? { model: override }- : { model: DEFAULT_OPENCODE_CHEAP_MODEL, variant: "low" },- source: "adapter_default",- },- ];-}--export const modelProfiles: AdapterModelProfileDefinition[] = buildOpenCodeModelProfiles();-export const agentConfigurationDoc = `# opencode_local agent configurationAdapter: opencode_localdiff --git a/packages/adapters/pi-local/src/index.ts b/packages/adapters/pi-local/src/index.tsindex 57fb7daea6..7face86512 100644--- a/packages/adapters/pi-local/src/index.ts+++ b/packages/adapters/pi-local/src/index.ts@@ -1,5 +1,3 @@-import type { AdapterModelProfileDefinition } from "@paperclipai/adapter-utils";-export const type = "pi_local";export const label = "Pi";@@ -7,8 +5,6 @@ export const SANDBOX_INSTALL_COMMAND = "npm install -g @earendil-works/pi-codingexport const models: Array<{ id: string; label: string }> = [];-export const modelProfiles: AdapterModelProfileDefinition[] = [];-export const agentConfigurationDoc = `# pi_local agent configurationAdapter: pi_localdiff --git a/packages/db/src/client.test.ts b/packages/db/src/client.test.tsindex a12ea6b3a6..d5e166890f 100644--- a/packages/db/src/client.test.ts+++ b/packages/db/src/client.test.ts@@ -1904,4 +1904,100 @@ describeEmbeddedPostgres("applyPendingMigrations", () => {},30_000,);++ it(+ "removes retired model profiles from live records and configuration revisions",+ async () => {+ const connectionString = await createTempDatabase();+ await applyPendingMigrations(connectionString);+ const hash = await migrationHash("0236_remove_cheap_model_profiles.sql");+ const companyId = "10000000-0000-4000-8000-000000000236";+ const agentId = "20000000-0000-4000-8000-000000000236";+ const issueId = "30000000-0000-4000-8000-000000000236";+ const sql = postgres(connectionString, { max: 1, onnotice: () => {} });++ try {+ await sql`+ INSERT INTO companies (id, name, issue_prefix)+ VALUES (${companyId}, 'Model profile migration fixture', 'MPF')+ `;+ await sql`+ INSERT INTO agents (id, company_id, name, runtime_config)+ VALUES (+ ${agentId},+ ${companyId},+ 'Legacy model profile agent',+ '{"heartbeat":{"enabled":true},"modelProfiles":{"cheap":{"model":"legacy"}}}'::jsonb+ )+ `;+ await sql`+ INSERT INTO issues (id, company_id, title, assignee_adapter_overrides)+ VALUES (+ ${issueId},+ ${companyId},+ 'Legacy model profile issue',+ '{"modelProfile":"cheap","workingDirectory":"/workspace"}'::jsonb+ )+ `;+ await sql`+ INSERT INTO agent_config_revisions (+ company_id,+ agent_id,+ changed_keys,+ before_config,+ after_config+ )+ VALUES (+ ${companyId},+ ${agentId},+ '["runtimeConfig"]'::jsonb,+ '{"name":"Legacy model profile agent","runtimeConfig":{"modelProfiles":{"cheap":{"model":"legacy-before"}},"heartbeat":{"enabled":true}}}'::jsonb,+ '{"name":"Legacy model profile agent","runtimeConfig":{"modelProfiles":{"cheap":{"model":"legacy-after"}},"heartbeat":{"enabled":false}}}'::jsonb+ )+ `;+ await sql`+ DELETE FROM "drizzle"."__drizzle_migrations"+ WHERE "hash" = ${hash}+ `;+ } finally {+ await sql.end();+ }++ await applyPendingMigrations(connectionString);++ const verifySql = postgres(connectionString, { max: 1, onnotice: () => {} });+ try {+ const [result] = await verifySql.unsafe<{+ runtime_config: Record<string, unknown>;+ assignee_adapter_overrides: Record<string, unknown> | null;+ before_config: Record<string, unknown>;+ after_config: Record<string, unknown>;+ }[]>(`+ SELECT+ agent.runtime_config,+ issue.assignee_adapter_overrides,+ revision.before_config,+ revision.after_config+ FROM agents agent+ JOIN issues issue ON issue.company_id = agent.company_id+ JOIN agent_config_revisions revision ON revision.agent_id = agent.id+ WHERE agent.id = '${agentId}' AND issue.id = '${issueId}'+ `);++ expect(result.runtime_config).toEqual({ heartbeat: { enabled: true } });+ expect(result.assignee_adapter_overrides).toEqual({ workingDirectory: "/workspace" });+ expect(result.before_config).toEqual({+ name: "Legacy model profile agent",+ runtimeConfig: { heartbeat: { enabled: true } },+ });+ expect(result.after_config).toEqual({+ name: "Legacy model profile agent",+ runtimeConfig: { heartbeat: { enabled: false } },+ });+ } finally {+ await verifySql.end();+ }+ },+ 30_000,+ );});diff --git a/packages/db/src/migrations/0236_remove_cheap_model_profiles.sql b/packages/db/src/migrations/0236_remove_cheap_model_profiles.sqlnew file mode 100644index 0000000000..7d60675b48--- /dev/null+++ b/packages/db/src/migrations/0236_remove_cheap_model_profiles.sql@@ -0,0 +1,108 @@+CREATE INDEX IF NOT EXISTS "agents_remove_model_profiles_idx"+ ON "agents" USING btree ("id")+ WHERE "runtime_config" ? 'modelProfiles';--> statement-breakpoint++DO $$+DECLARE+ updated_count integer;+BEGIN+ LOOP+ WITH batch AS MATERIALIZED (+ SELECT "id"+ FROM "agents"+ WHERE "runtime_config" ? 'modelProfiles'+ ORDER BY "id"+ LIMIT 1000+ )+ UPDATE "agents" AS agent+ SET "runtime_config" = agent."runtime_config" - 'modelProfiles',+ "updated_at" = now()+ FROM batch+ WHERE agent."id" = batch."id";++ GET DIAGNOSTICS updated_count = ROW_COUNT;+ EXIT WHEN updated_count = 0;+ END LOOP;+END $$;--> statement-breakpoint++DROP INDEX IF EXISTS "agents_remove_model_profiles_idx";--> statement-breakpoint++-- paperclip:migration-safety-ignore large-create-index-not-concurrently: This temporary partial index covers only revision snapshots with the retired JSON key and is dropped after the bounded cleanup.+CREATE INDEX IF NOT EXISTS "agent_config_revisions_remove_model_profiles_idx"+ ON "agent_config_revisions" USING btree ("id")+ WHERE ("before_config" #> '{runtimeConfig}') ? 'modelProfiles'+ OR ("after_config" #> '{runtimeConfig}') ? 'modelProfiles';--> statement-breakpoint++DO $$+DECLARE+ updated_count integer;+BEGIN+ LOOP+ WITH batch AS MATERIALIZED (+ SELECT "id"+ FROM "agent_config_revisions"+ WHERE ("before_config" #> '{runtimeConfig}') ? 'modelProfiles'+ OR ("after_config" #> '{runtimeConfig}') ? 'modelProfiles'+ ORDER BY "id"+ LIMIT 1000+ )+ UPDATE "agent_config_revisions" AS revision+ SET "before_config" = CASE+ WHEN (revision."before_config" #> '{runtimeConfig}') ? 'modelProfiles'+ THEN jsonb_set(+ revision."before_config",+ '{runtimeConfig}',+ (revision."before_config" #> '{runtimeConfig}') - 'modelProfiles'+ )+ ELSE revision."before_config"+ END,+ "after_config" = CASE+ WHEN (revision."after_config" #> '{runtimeConfig}') ? 'modelProfiles'+ THEN jsonb_set(+ revision."after_config",+ '{runtimeConfig}',+ (revision."after_config" #> '{runtimeConfig}') - 'modelProfiles'+ )+ ELSE revision."after_config"+ END+ FROM batch+ WHERE revision."id" = batch."id";++ GET DIAGNOSTICS updated_count = ROW_COUNT;+ EXIT WHEN updated_count = 0;+ END LOOP;+END $$;--> statement-breakpoint++DROP INDEX IF EXISTS "agent_config_revisions_remove_model_profiles_idx";--> statement-breakpoint++-- paperclip:migration-safety-ignore large-create-index-not-concurrently: This temporary partial index covers only rows with the retired JSON key and is dropped after the bounded cleanup.+CREATE INDEX IF NOT EXISTS "issues_remove_model_profile_idx"+ ON "issues" USING btree ("id")+ WHERE "assignee_adapter_overrides" ? 'modelProfile';--> statement-breakpoint++DO $$+DECLARE+ updated_count integer;+BEGIN+ LOOP+ WITH batch AS MATERIALIZED (+ SELECT "id"+ FROM "issues"+ WHERE "assignee_adapter_overrides" ? 'modelProfile'+ ORDER BY "id"+ LIMIT 1000+ )+ UPDATE "issues" AS issue+ SET "assignee_adapter_overrides" = NULLIF(+ issue."assignee_adapter_overrides" - 'modelProfile',+ '{}'::jsonb+ )+ FROM batch+ WHERE issue."id" = batch."id";++ GET DIAGNOSTICS updated_count = ROW_COUNT;+ EXIT WHEN updated_count = 0;+ END LOOP;+END $$;--> statement-breakpoint++DROP INDEX IF EXISTS "issues_remove_model_profile_idx";diff --git a/packages/db/src/migrations/meta/0236_snapshot.json b/packages/db/src/migrations/meta/0236_snapshot.jsonnew file mode 100644index 0000000000..22d574bc8f--- /dev/null+++ b/packages/db/src/migrations/meta/0236_snapshot.json@@ -0,0 +1,42129 @@+{+ "id": "5129d326-4e5f-40bf-81ee-b2cc6f1506cf",+ "prevId": "6f6cff23-c283-4984-91e4-da2c3541ff4a",+ "version": "7",+ "dialect": "postgresql",+ "tables": {+ "public.activity_log": {+ "name": "activity_log",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "entity_type": {+ "name": "entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "entity_id": {+ "name": "entity_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "details": {+ "name": "details",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "activity_log_company_created_idx": {+ "name": "activity_log_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "activity_log_company_agent_created_idx": {+ "name": "activity_log_company_agent_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "activity_log_company_responsible_user_created_idx": {+ "name": "activity_log_company_responsible_user_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "responsible_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "activity_log_run_id_idx": {+ "name": "activity_log_run_id_idx",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "activity_log_entity_type_id_idx": {+ "name": "activity_log_entity_type_id_idx",+ "columns": [+ {+ "expression": "entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "activity_log_company_id_companies_id_fk": {+ "name": "activity_log_company_id_companies_id_fk",+ "tableFrom": "activity_log",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "activity_log_agent_id_agents_id_fk": {+ "name": "activity_log_agent_id_agents_id_fk",+ "tableFrom": "activity_log",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "activity_log_run_id_heartbeat_runs_id_fk": {+ "name": "activity_log_run_id_heartbeat_runs_id_fk",+ "tableFrom": "activity_log",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.adapter_auth_sessions": {+ "name": "adapter_auth_sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "environment_id": {+ "name": "environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "adapter_type": {+ "name": "adapter_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "started_by_user_id": {+ "name": "started_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "public_session_id": {+ "name": "public_session_id",+ "type": "varchar(128)",+ "primaryKey": false,+ "notNull": true+ },+ "provider_lease_id": {+ "name": "provider_lease_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'starting'"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "promotion_expires_at": {+ "name": "promotion_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "bound_at": {+ "name": "bound_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "adapter_auth_sessions_company_status_idx": {+ "name": "adapter_auth_sessions_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "adapter_auth_sessions_company_owner_adapter_active_uq": {+ "name": "adapter_auth_sessions_company_owner_adapter_active_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "adapter_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"adapter_auth_sessions\".\"status\" IN ('starting', 'waiting_for_user', 'promoting', 'awaiting_code', 'submitting')",+ "concurrently": false+ },+ "adapter_auth_sessions_public_session_id_uq": {+ "name": "adapter_auth_sessions_public_session_id_uq",+ "columns": [+ {+ "expression": "public_session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "adapter_auth_sessions_environment_idx": {+ "name": "adapter_auth_sessions_environment_idx",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "adapter_auth_sessions_expires_idx": {+ "name": "adapter_auth_sessions_expires_idx",+ "columns": [+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "adapter_auth_sessions_provider_lease_idx": {+ "name": "adapter_auth_sessions_provider_lease_idx",+ "columns": [+ {+ "expression": "provider_lease_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "adapter_auth_sessions_company_id_companies_id_fk": {+ "name": "adapter_auth_sessions_company_id_companies_id_fk",+ "tableFrom": "adapter_auth_sessions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "adapter_auth_sessions_environment_id_environments_id_fk": {+ "name": "adapter_auth_sessions_environment_id_environments_id_fk",+ "tableFrom": "adapter_auth_sessions",+ "columnsFrom": [+ "environment_id"+ ],+ "tableTo": "environments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_api_keys": {+ "name": "agent_api_keys",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key_hash": {+ "name": "key_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scope_config": {+ "name": "scope_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_api_keys_key_hash_idx": {+ "name": "agent_api_keys_key_hash_idx",+ "columns": [+ {+ "expression": "key_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_api_keys_company_agent_idx": {+ "name": "agent_api_keys_company_agent_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_api_keys_agent_id_agents_id_fk": {+ "name": "agent_api_keys_agent_id_agents_id_fk",+ "tableFrom": "agent_api_keys",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agent_api_keys_company_id_companies_id_fk": {+ "name": "agent_api_keys_company_id_companies_id_fk",+ "tableFrom": "agent_api_keys",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_config_revisions": {+ "name": "agent_config_revisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'patch'"+ },+ "rolled_back_from_revision_id": {+ "name": "rolled_back_from_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "changed_keys": {+ "name": "changed_keys",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "before_config": {+ "name": "before_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "after_config": {+ "name": "after_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_config_revisions_company_agent_created_idx": {+ "name": "agent_config_revisions_company_agent_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_config_revisions_agent_created_idx": {+ "name": "agent_config_revisions_agent_created_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_config_revisions_company_id_companies_id_fk": {+ "name": "agent_config_revisions_company_id_companies_id_fk",+ "tableFrom": "agent_config_revisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agent_config_revisions_agent_id_agents_id_fk": {+ "name": "agent_config_revisions_agent_id_agents_id_fk",+ "tableFrom": "agent_config_revisions",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_config_revisions_created_by_agent_id_agents_id_fk": {+ "name": "agent_config_revisions_created_by_agent_id_agents_id_fk",+ "tableFrom": "agent_config_revisions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_memberships": {+ "name": "agent_memberships",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'joined'"+ },+ "starred_at": {+ "name": "starred_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_memberships_company_user_idx": {+ "name": "agent_memberships_company_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_memberships_company_user_starred_idx": {+ "name": "agent_memberships_company_user_starred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "starred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_memberships_agent_idx": {+ "name": "agent_memberships_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_memberships_company_user_agent_uq": {+ "name": "agent_memberships_company_user_agent_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_memberships_company_id_companies_id_fk": {+ "name": "agent_memberships_company_id_companies_id_fk",+ "tableFrom": "agent_memberships",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_memberships_agent_id_agents_id_fk": {+ "name": "agent_memberships_agent_id_agents_id_fk",+ "tableFrom": "agent_memberships",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_runtime_state": {+ "name": "agent_runtime_state",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "adapter_type": {+ "name": "adapter_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state_json": {+ "name": "state_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "last_run_id": {+ "name": "last_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_run_status": {+ "name": "last_run_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "total_input_tokens": {+ "name": "total_input_tokens",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "total_output_tokens": {+ "name": "total_output_tokens",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "total_cached_input_tokens": {+ "name": "total_cached_input_tokens",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "total_cost_cents": {+ "name": "total_cost_cents",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_runtime_state_company_agent_idx": {+ "name": "agent_runtime_state_company_agent_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_runtime_state_company_updated_idx": {+ "name": "agent_runtime_state_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_runtime_state_agent_id_agents_id_fk": {+ "name": "agent_runtime_state_agent_id_agents_id_fk",+ "tableFrom": "agent_runtime_state",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agent_runtime_state_company_id_companies_id_fk": {+ "name": "agent_runtime_state_company_id_companies_id_fk",+ "tableFrom": "agent_runtime_state",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_task_sessions": {+ "name": "agent_task_sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "adapter_type": {+ "name": "adapter_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "task_key": {+ "name": "task_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_params_json": {+ "name": "session_params_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "session_display_id": {+ "name": "session_display_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_run_id": {+ "name": "last_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_task_sessions_company_agent_adapter_task_uniq": {+ "name": "agent_task_sessions_company_agent_adapter_task_uniq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "adapter_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "task_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_task_sessions_company_agent_updated_idx": {+ "name": "agent_task_sessions_company_agent_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_task_sessions_company_task_updated_idx": {+ "name": "agent_task_sessions_company_task_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "task_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_task_sessions_company_id_companies_id_fk": {+ "name": "agent_task_sessions_company_id_companies_id_fk",+ "tableFrom": "agent_task_sessions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agent_task_sessions_agent_id_agents_id_fk": {+ "name": "agent_task_sessions_agent_id_agents_id_fk",+ "tableFrom": "agent_task_sessions",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agent_task_sessions_last_run_id_heartbeat_runs_id_fk": {+ "name": "agent_task_sessions_last_run_id_heartbeat_runs_id_fk",+ "tableFrom": "agent_task_sessions",+ "columnsFrom": [+ "last_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_wakeup_requests": {+ "name": "agent_wakeup_requests",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "trigger_detail": {+ "name": "trigger_detail",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'queued'"+ },+ "coalesced_count": {+ "name": "coalesced_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "requested_by_actor_type": {+ "name": "requested_by_actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_by_actor_id": {+ "name": "requested_by_actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "requested_at": {+ "name": "requested_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "claimed_at": {+ "name": "claimed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_wakeup_requests_company_agent_status_idx": {+ "name": "agent_wakeup_requests_company_agent_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_wakeup_requests_company_requested_idx": {+ "name": "agent_wakeup_requests_company_requested_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "requested_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_wakeup_requests_agent_requested_idx": {+ "name": "agent_wakeup_requests_agent_requested_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "requested_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_wakeup_requests_review_path_recovery_idempotency_uq": {+ "name": "agent_wakeup_requests_review_path_recovery_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'issue_review_path_lost:%' AND \"agent_wakeup_requests\".\"status\" <> 'skipped'",+ "concurrently": false+ },+ "agent_wakeup_requests_disposition_repair_idempotency_uq": {+ "name": "agent_wakeup_requests_disposition_repair_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'issue_disposition_repair:%' AND \"agent_wakeup_requests\".\"status\" <> 'skipped'",+ "concurrently": false+ },+ "agent_wakeup_requests_question_response_delivery_idempotency_uq": {+ "name": "agent_wakeup_requests_question_response_delivery_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'question-response:%' AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",+ "concurrently": false+ },+ "agent_wakeup_requests_company_payload_issue_idx": {+ "name": "agent_wakeup_requests_company_payload_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "(\"payload\" ->> 'issueId')",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_wakeup_requests_company_id_companies_id_fk": {+ "name": "agent_wakeup_requests_company_id_companies_id_fk",+ "tableFrom": "agent_wakeup_requests",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agent_wakeup_requests_agent_id_agents_id_fk": {+ "name": "agent_wakeup_requests_agent_id_agents_id_fk",+ "tableFrom": "agent_wakeup_requests",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agents": {+ "name": "agents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'general'"+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'idle'"+ },+ "reports_to": {+ "name": "reports_to",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "capabilities": {+ "name": "capabilities",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "adapter_type": {+ "name": "adapter_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'process'"+ },+ "adapter_config": {+ "name": "adapter_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "runtime_config": {+ "name": "runtime_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "default_environment_id": {+ "name": "default_environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "budget_monthly_cents": {+ "name": "budget_monthly_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "spent_monthly_cents": {+ "name": "spent_monthly_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "pause_reason": {+ "name": "pause_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "paused_at": {+ "name": "paused_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "error_reason": {+ "name": "error_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "permissions": {+ "name": "permissions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "last_heartbeat_at": {+ "name": "last_heartbeat_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agents_company_status_idx": {+ "name": "agents_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agents_company_reports_to_idx": {+ "name": "agents_company_reports_to_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "reports_to",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agents_company_default_environment_idx": {+ "name": "agents_company_default_environment_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "default_environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agents_company_id_companies_id_fk": {+ "name": "agents_company_id_companies_id_fk",+ "tableFrom": "agents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agents_reports_to_agents_id_fk": {+ "name": "agents_reports_to_agents_id_fk",+ "tableFrom": "agents",+ "columnsFrom": [+ "reports_to"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "agents_default_environment_id_environments_id_fk": {+ "name": "agents_default_environment_id_environments_id_fk",+ "tableFrom": "agents",+ "columnsFrom": [+ "default_environment_id"+ ],+ "tableTo": "environments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.approval_comments": {+ "name": "approval_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "approval_id": {+ "name": "approval_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "author_agent_id": {+ "name": "author_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "approval_comments_company_idx": {+ "name": "approval_comments_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "approval_comments_approval_idx": {+ "name": "approval_comments_approval_idx",+ "columns": [+ {+ "expression": "approval_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "approval_comments_approval_created_idx": {+ "name": "approval_comments_approval_created_idx",+ "columns": [+ {+ "expression": "approval_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "approval_comments_company_id_companies_id_fk": {+ "name": "approval_comments_company_id_companies_id_fk",+ "tableFrom": "approval_comments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "approval_comments_approval_id_approvals_id_fk": {+ "name": "approval_comments_approval_id_approvals_id_fk",+ "tableFrom": "approval_comments",+ "columnsFrom": [+ "approval_id"+ ],+ "tableTo": "approvals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "approval_comments_author_agent_id_agents_id_fk": {+ "name": "approval_comments_author_agent_id_agents_id_fk",+ "tableFrom": "approval_comments",+ "columnsFrom": [+ "author_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.approvals": {+ "name": "approvals",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "requested_by_agent_id": {+ "name": "requested_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "requested_by_user_id": {+ "name": "requested_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "decision_note": {+ "name": "decision_note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decided_by_user_id": {+ "name": "decided_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decided_at": {+ "name": "decided_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "approvals_company_status_type_idx": {+ "name": "approvals_company_status_type_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "approvals_company_id_companies_id_fk": {+ "name": "approvals_company_id_companies_id_fk",+ "tableFrom": "approvals",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "approvals_requested_by_agent_id_agents_id_fk": {+ "name": "approvals_requested_by_agent_id_agents_id_fk",+ "tableFrom": "approvals",+ "columnsFrom": [+ "requested_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.assets": {+ "name": "assets",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "object_key": {+ "name": "object_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "byte_size": {+ "name": "byte_size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sha256": {+ "name": "sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "original_filename": {+ "name": "original_filename",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "assets_company_created_idx": {+ "name": "assets_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "assets_company_provider_idx": {+ "name": "assets_company_provider_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "assets_company_object_key_uq": {+ "name": "assets_company_object_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "object_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "assets_company_id_companies_id_fk": {+ "name": "assets_company_id_companies_id_fk",+ "tableFrom": "assets",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "assets_created_by_agent_id_agents_id_fk": {+ "name": "assets_created_by_agent_id_agents_id_fk",+ "tableFrom": "assets",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.account": {+ "name": "account",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "issuer": {+ "name": "issuer",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "account_issuer_account_id_uq": {+ "name": "account_issuer_account_id_uq",+ "columns": [+ {+ "expression": "issuer",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.session": {+ "name": "session",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "session_user_id_user_id_fk": {+ "name": "session_user_id_user_id_fk",+ "tableFrom": "session",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user": {+ "name": "user",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "email_verified": {+ "name": "email_verified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verification": {+ "name": "verification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.board_api_keys": {+ "name": "board_api_keys",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key_hash": {+ "name": "key_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "board_api_keys_key_hash_idx": {+ "name": "board_api_keys_key_hash_idx",+ "columns": [+ {+ "expression": "key_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "board_api_keys_user_idx": {+ "name": "board_api_keys_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "board_api_keys_user_id_user_id_fk": {+ "name": "board_api_keys_user_id_user_id_fk",+ "tableFrom": "board_api_keys",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.budget_incidents": {+ "name": "budget_incidents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "policy_id": {+ "name": "policy_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "scope_type": {+ "name": "scope_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "metric": {+ "name": "metric",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "window_kind": {+ "name": "window_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "window_start": {+ "name": "window_start",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "window_end": {+ "name": "window_end",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "threshold_type": {+ "name": "threshold_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "amount_limit": {+ "name": "amount_limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "amount_observed": {+ "name": "amount_observed",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'open'"+ },+ "approval_id": {+ "name": "approval_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "budget_incidents_company_status_idx": {+ "name": "budget_incidents_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "budget_incidents_company_scope_idx": {+ "name": "budget_incidents_company_scope_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "budget_incidents_policy_window_threshold_idx": {+ "name": "budget_incidents_policy_window_threshold_idx",+ "columns": [+ {+ "expression": "policy_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "window_start",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "threshold_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"budget_incidents\".\"status\" <> 'dismissed'",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "budget_incidents_company_id_companies_id_fk": {+ "name": "budget_incidents_company_id_companies_id_fk",+ "tableFrom": "budget_incidents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "budget_incidents_policy_id_budget_policies_id_fk": {+ "name": "budget_incidents_policy_id_budget_policies_id_fk",+ "tableFrom": "budget_incidents",+ "columnsFrom": [+ "policy_id"+ ],+ "tableTo": "budget_policies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "budget_incidents_approval_id_approvals_id_fk": {+ "name": "budget_incidents_approval_id_approvals_id_fk",+ "tableFrom": "budget_incidents",+ "columnsFrom": [+ "approval_id"+ ],+ "tableTo": "approvals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.budget_policies": {+ "name": "budget_policies",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "scope_type": {+ "name": "scope_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "metric": {+ "name": "metric",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'billed_cents'"+ },+ "window_kind": {+ "name": "window_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "amount": {+ "name": "amount",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "warn_percent": {+ "name": "warn_percent",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 80+ },+ "hard_stop_enabled": {+ "name": "hard_stop_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "notify_enabled": {+ "name": "notify_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "budget_policies_company_scope_active_idx": {+ "name": "budget_policies_company_scope_active_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "is_active",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "budget_policies_company_window_idx": {+ "name": "budget_policies_company_window_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "window_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "metric",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "budget_policies_company_scope_metric_unique_idx": {+ "name": "budget_policies_company_scope_metric_unique_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "metric",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "window_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "budget_policies_company_id_companies_id_fk": {+ "name": "budget_policies_company_id_companies_id_fk",+ "tableFrom": "budget_policies",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.built_in_managed_resources": {+ "name": "built_in_managed_resources",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "bundle_key": {+ "name": "bundle_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_kind": {+ "name": "resource_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_key": {+ "name": "resource_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_id": {+ "name": "resource_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "stock_version": {+ "name": "stock_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "stock_hash": {+ "name": "stock_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "defaults_json": {+ "name": "defaults_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "built_in_managed_resources_company_idx": {+ "name": "built_in_managed_resources_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "built_in_managed_resources_resource_idx": {+ "name": "built_in_managed_resources_resource_idx",+ "columns": [+ {+ "expression": "resource_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "built_in_managed_resources_company_bundle_resource_uq": {+ "name": "built_in_managed_resources_company_bundle_resource_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "bundle_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "built_in_managed_resources_company_id_companies_id_fk": {+ "name": "built_in_managed_resources_company_id_companies_id_fk",+ "tableFrom": "built_in_managed_resources",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.case_attachments": {+ "name": "case_attachments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "asset_id": {+ "name": "asset_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "case_attachments_company_case_idx": {+ "name": "case_attachments_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_attachments_asset_uq": {+ "name": "case_attachments_asset_uq",+ "columns": [+ {+ "expression": "asset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "case_attachments_company_id_companies_id_fk": {+ "name": "case_attachments_company_id_companies_id_fk",+ "tableFrom": "case_attachments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_attachments_case_id_cases_id_fk": {+ "name": "case_attachments_case_id_cases_id_fk",+ "tableFrom": "case_attachments",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_attachments_asset_id_assets_id_fk": {+ "name": "case_attachments_asset_id_assets_id_fk",+ "tableFrom": "case_attachments",+ "columnsFrom": [+ "asset_id"+ ],+ "tableTo": "assets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.case_documents": {+ "name": "case_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "case_documents_company_case_key_uq": {+ "name": "case_documents_company_case_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_documents_document_uq": {+ "name": "case_documents_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_documents_company_case_updated_idx": {+ "name": "case_documents_company_case_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "case_documents_company_id_companies_id_fk": {+ "name": "case_documents_company_id_companies_id_fk",+ "tableFrom": "case_documents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_documents_case_id_cases_id_fk": {+ "name": "case_documents_case_id_cases_id_fk",+ "tableFrom": "case_documents",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_documents_document_id_documents_id_fk": {+ "name": "case_documents_document_id_documents_id_fk",+ "tableFrom": "case_documents",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.case_events": {+ "name": "case_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_agent_id": {+ "name": "actor_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "case_events_case_created_idx": {+ "name": "case_events_case_created_idx",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_events_company_case_idx": {+ "name": "case_events_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "case_events_company_id_companies_id_fk": {+ "name": "case_events_company_id_companies_id_fk",+ "tableFrom": "case_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_events_case_id_cases_id_fk": {+ "name": "case_events_case_id_cases_id_fk",+ "tableFrom": "case_events",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_events_actor_agent_id_agents_id_fk": {+ "name": "case_events_actor_agent_id_agents_id_fk",+ "tableFrom": "case_events",+ "columnsFrom": [+ "actor_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "case_events_kind_check": {+ "name": "case_events_kind_check",+ "value": "\"case_events\".\"kind\" in (\n 'created',\n 'updated',\n 'fields_changed',\n 'status_changed',\n 'issue_linked',\n 'issue_unlinked',\n 'document_revised',\n 'child_linked',\n 'attachment_added',\n 'label_added',\n 'label_removed'\n )"+ },+ "case_events_actor_type_check": {+ "name": "case_events_actor_type_check",+ "value": "\"case_events\".\"actor_type\" in ('user', 'agent', 'system')"+ }+ },+ "isRLSEnabled": false+ },+ "public.case_issue_links": {+ "name": "case_issue_links",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "case_issue_links_case_issue_uq": {+ "name": "case_issue_links_case_issue_uq",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_issue_links_company_case_idx": {+ "name": "case_issue_links_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_issue_links_issue_idx": {+ "name": "case_issue_links_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "case_issue_links_company_id_companies_id_fk": {+ "name": "case_issue_links_company_id_companies_id_fk",+ "tableFrom": "case_issue_links",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_issue_links_case_id_cases_id_fk": {+ "name": "case_issue_links_case_id_cases_id_fk",+ "tableFrom": "case_issue_links",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_issue_links_issue_id_issues_id_fk": {+ "name": "case_issue_links_issue_id_issues_id_fk",+ "tableFrom": "case_issue_links",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "case_issue_links_role_check": {+ "name": "case_issue_links_role_check",+ "value": "\"case_issue_links\".\"role\" in ('origin', 'work', 'reference')"+ }+ },+ "isRLSEnabled": false+ },+ "public.case_labels": {+ "name": "case_labels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "case_labels_case_label_uq": {+ "name": "case_labels_case_label_uq",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_labels_company_case_idx": {+ "name": "case_labels_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "case_labels_label_idx": {+ "name": "case_labels_label_idx",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "case_labels_company_id_companies_id_fk": {+ "name": "case_labels_company_id_companies_id_fk",+ "tableFrom": "case_labels",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_labels_case_id_cases_id_fk": {+ "name": "case_labels_case_id_cases_id_fk",+ "tableFrom": "case_labels",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "case_labels_label_id_labels_id_fk": {+ "name": "case_labels_label_id_labels_id_fk",+ "tableFrom": "case_labels",+ "columnsFrom": [+ "label_id"+ ],+ "tableTo": "labels",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cases": {+ "name": "cases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "case_number": {+ "name": "case_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "case_type": {+ "name": "case_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'draft'"+ },+ "fields": {+ "name": "fields",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "parent_case_id": {+ "name": "parent_case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "cases_company_case_number_uq": {+ "name": "cases_company_case_number_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_identifier_uq": {+ "name": "cases_identifier_uq",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_company_type_key_uq": {+ "name": "cases_company_type_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_company_status_idx": {+ "name": "cases_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_company_type_idx": {+ "name": "cases_company_type_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_company_project_idx": {+ "name": "cases_company_project_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_parent_idx": {+ "name": "cases_parent_idx",+ "columns": [+ {+ "expression": "parent_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cases_title_search_idx": {+ "name": "cases_title_search_idx",+ "columns": [+ {+ "expression": "title",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "cases_identifier_search_idx": {+ "name": "cases_identifier_search_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "cases_summary_search_idx": {+ "name": "cases_summary_search_idx",+ "columns": [+ {+ "expression": "summary",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "cases_company_id_companies_id_fk": {+ "name": "cases_company_id_companies_id_fk",+ "tableFrom": "cases",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "cases_project_id_projects_id_fk": {+ "name": "cases_project_id_projects_id_fk",+ "tableFrom": "cases",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "cases_parent_case_id_cases_id_fk": {+ "name": "cases_parent_case_id_cases_id_fk",+ "tableFrom": "cases",+ "columnsFrom": [+ "parent_case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "cases_created_by_agent_id_agents_id_fk": {+ "name": "cases_created_by_agent_id_agents_id_fk",+ "tableFrom": "cases",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "cases_status_check": {+ "name": "cases_status_check",+ "value": "\"cases\".\"status\" in ('draft', 'in_progress', 'in_review', 'approved', 'done', 'cancelled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.cli_auth_challenges": {+ "name": "cli_auth_challenges",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "secret_hash": {+ "name": "secret_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "command": {+ "name": "command",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_name": {+ "name": "client_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_access": {+ "name": "requested_access",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'board'"+ },+ "requested_company_id": {+ "name": "requested_company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "pending_key_hash": {+ "name": "pending_key_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "pending_key_name": {+ "name": "pending_key_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "approved_by_user_id": {+ "name": "approved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "board_api_key_id": {+ "name": "board_api_key_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "approved_at": {+ "name": "approved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "cancelled_at": {+ "name": "cancelled_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "cli_auth_challenges_secret_hash_idx": {+ "name": "cli_auth_challenges_secret_hash_idx",+ "columns": [+ {+ "expression": "secret_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cli_auth_challenges_approved_by_idx": {+ "name": "cli_auth_challenges_approved_by_idx",+ "columns": [+ {+ "expression": "approved_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cli_auth_challenges_requested_company_idx": {+ "name": "cli_auth_challenges_requested_company_idx",+ "columns": [+ {+ "expression": "requested_company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "cli_auth_challenges_requested_company_id_companies_id_fk": {+ "name": "cli_auth_challenges_requested_company_id_companies_id_fk",+ "tableFrom": "cli_auth_challenges",+ "columnsFrom": [+ "requested_company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "cli_auth_challenges_approved_by_user_id_user_id_fk": {+ "name": "cli_auth_challenges_approved_by_user_id_user_id_fk",+ "tableFrom": "cli_auth_challenges",+ "columnsFrom": [+ "approved_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk": {+ "name": "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk",+ "tableFrom": "cli_auth_challenges",+ "columnsFrom": [+ "board_api_key_id"+ ],+ "tableTo": "board_api_keys",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.companies": {+ "name": "companies",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "pause_reason": {+ "name": "pause_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "paused_at": {+ "name": "paused_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "issue_prefix": {+ "name": "issue_prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'PAP'"+ },+ "issue_counter": {+ "name": "issue_counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "budget_monthly_cents": {+ "name": "budget_monthly_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "spent_monthly_cents": {+ "name": "spent_monthly_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "default_responsible_user_id": {+ "name": "default_responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "require_board_approval_for_new_agents": {+ "name": "require_board_approval_for_new_agents",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "interaction_resolver_governance": {+ "name": "interaction_resolver_governance",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "feedback_data_sharing_enabled": {+ "name": "feedback_data_sharing_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "feedback_data_sharing_consent_at": {+ "name": "feedback_data_sharing_consent_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_data_sharing_consent_by_user_id": {+ "name": "feedback_data_sharing_consent_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_data_sharing_terms_version": {+ "name": "feedback_data_sharing_terms_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "companies_issue_prefix_idx": {+ "name": "companies_issue_prefix_idx",+ "columns": [+ {+ "expression": "issue_prefix",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_logos": {+ "name": "company_logos",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "asset_id": {+ "name": "asset_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_logos_company_uq": {+ "name": "company_logos_company_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_logos_asset_uq": {+ "name": "company_logos_asset_uq",+ "columns": [+ {+ "expression": "asset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_logos_company_id_companies_id_fk": {+ "name": "company_logos_company_id_companies_id_fk",+ "tableFrom": "company_logos",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_logos_asset_id_assets_id_fk": {+ "name": "company_logos_asset_id_assets_id_fk",+ "tableFrom": "company_logos",+ "columnsFrom": [+ "asset_id"+ ],+ "tableTo": "assets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_memberships": {+ "name": "company_memberships",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "principal_type": {+ "name": "principal_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "principal_id": {+ "name": "principal_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "membership_role": {+ "name": "membership_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_memberships_company_principal_unique_idx": {+ "name": "company_memberships_company_principal_unique_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "principal_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "principal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_memberships_principal_status_idx": {+ "name": "company_memberships_principal_status_idx",+ "columns": [+ {+ "expression": "principal_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "principal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_memberships_company_status_idx": {+ "name": "company_memberships_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_memberships_company_id_companies_id_fk": {+ "name": "company_memberships_company_id_companies_id_fk",+ "tableFrom": "company_memberships",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_onboarding_seeds": {+ "name": "company_onboarding_seeds",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "revision": {+ "name": "revision",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "mission": {+ "name": "mission",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_name": {+ "name": "agent_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_role": {+ "name": "agent_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_task_title": {+ "name": "first_task_title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_task_details": {+ "name": "first_task_details",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "applied_at": {+ "name": "applied_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_onboarding_seeds_company_uq": {+ "name": "company_onboarding_seeds_company_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_onboarding_seeds_company_id_companies_id_fk": {+ "name": "company_onboarding_seeds_company_id_companies_id_fk",+ "tableFrom": "company_onboarding_seeds",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_onboarding_seeds_goal_id_goals_id_fk": {+ "name": "company_onboarding_seeds_goal_id_goals_id_fk",+ "tableFrom": "company_onboarding_seeds",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_onboarding_seeds_agent_id_agents_id_fk": {+ "name": "company_onboarding_seeds_agent_id_agents_id_fk",+ "tableFrom": "company_onboarding_seeds",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_onboarding_seeds_issue_id_issues_id_fk": {+ "name": "company_onboarding_seeds_issue_id_issues_id_fk",+ "tableFrom": "company_onboarding_seeds",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_secret_bindings": {+ "name": "company_secret_bindings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "secret_id": {+ "name": "secret_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "config_path": {+ "name": "config_path",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "version_selector": {+ "name": "version_selector",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'latest'"+ },+ "required": {+ "name": "required",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "projection_class": {+ "name": "projection_class",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unclassified'"+ },+ "projection_allowlist_key": {+ "name": "projection_allowlist_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_secret_bindings_company_idx": {+ "name": "company_secret_bindings_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_bindings_secret_idx": {+ "name": "company_secret_bindings_secret_idx",+ "columns": [+ {+ "expression": "secret_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_bindings_target_idx": {+ "name": "company_secret_bindings_target_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_bindings_target_path_uq": {+ "name": "company_secret_bindings_target_path_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "config_path",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_secret_bindings_company_id_companies_id_fk": {+ "name": "company_secret_bindings_company_id_companies_id_fk",+ "tableFrom": "company_secret_bindings",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "company_secret_bindings_secret_id_company_secrets_id_fk": {+ "name": "company_secret_bindings_secret_id_company_secrets_id_fk",+ "tableFrom": "company_secret_bindings",+ "columnsFrom": [+ "secret_id"+ ],+ "tableTo": "company_secrets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_secret_proposals": {+ "name": "company_secret_proposals",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "proposed_name": {+ "name": "proposed_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "proposed_key": {+ "name": "proposed_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "proposed_description": {+ "name": "proposed_description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "justification": {+ "name": "justification",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value_ciphertext": {+ "name": "value_ciphertext",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "value_fingerprint_sha256": {+ "name": "value_fingerprint_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "value_length": {+ "name": "value_length",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "secret_id": {+ "name": "secret_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "secret_proposal_id": {+ "name": "secret_proposal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_id": {+ "name": "target_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "config_path": {+ "name": "config_path",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "projection_class": {+ "name": "projection_class",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unclassified'"+ },+ "binding_target_policy_snapshot": {+ "name": "binding_target_policy_snapshot",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "proposer_ancestor_ids_snapshot": {+ "name": "proposer_ancestor_ids_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "target_ancestor_ids_snapshot": {+ "name": "target_ancestor_ids_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "proposed_by_agent_id": {+ "name": "proposed_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "origin_issue_id": {+ "name": "origin_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "interaction_id": {+ "name": "interaction_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolution_reason": {+ "name": "resolution_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_secret_id": {+ "name": "created_secret_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "applied_binding_config_path": {+ "name": "applied_binding_config_path",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ciphertext_scrubbed_at": {+ "name": "ciphertext_scrubbed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_secret_proposals_company_status_idx": {+ "name": "company_secret_proposals_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_proposals_proposer_status_idx": {+ "name": "company_secret_proposals_proposer_status_idx",+ "columns": [+ {+ "expression": "proposed_by_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_proposals_expiry_idx": {+ "name": "company_secret_proposals_expiry_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_proposals_secret_proposal_idx": {+ "name": "company_secret_proposals_secret_proposal_idx",+ "columns": [+ {+ "expression": "secret_proposal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_proposals_interaction_idx": {+ "name": "company_secret_proposals_interaction_idx",+ "columns": [+ {+ "expression": "interaction_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_secret_proposals_company_id_companies_id_fk": {+ "name": "company_secret_proposals_company_id_companies_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "company_secret_proposals_secret_id_company_secrets_id_fk": {+ "name": "company_secret_proposals_secret_id_company_secrets_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "secret_id"+ ],+ "tableTo": "company_secrets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_secret_proposals_secret_proposal_id_company_secret_proposals_id_fk": {+ "name": "company_secret_proposals_secret_proposal_id_company_secret_proposals_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "secret_proposal_id"+ ],+ "tableTo": "company_secret_proposals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_secret_proposals_target_id_agents_id_fk": {+ "name": "company_secret_proposals_target_id_agents_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "target_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_secret_proposals_proposed_by_agent_id_agents_id_fk": {+ "name": "company_secret_proposals_proposed_by_agent_id_agents_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "proposed_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_secret_proposals_origin_issue_id_issues_id_fk": {+ "name": "company_secret_proposals_origin_issue_id_issues_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "origin_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_secret_proposals_origin_run_id_heartbeat_runs_id_fk": {+ "name": "company_secret_proposals_origin_run_id_heartbeat_runs_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "origin_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_secret_proposals_interaction_id_issue_thread_interactions_id_fk": {+ "name": "company_secret_proposals_interaction_id_issue_thread_interactions_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "interaction_id"+ ],+ "tableTo": "issue_thread_interactions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_secret_proposals_created_secret_id_company_secrets_id_fk": {+ "name": "company_secret_proposals_created_secret_id_company_secrets_id_fk",+ "tableFrom": "company_secret_proposals",+ "columnsFrom": [+ "created_secret_id"+ ],+ "tableTo": "company_secrets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "company_secret_proposals_kind_check": {+ "name": "company_secret_proposals_kind_check",+ "value": "\"company_secret_proposals\".\"kind\" in ('secret', 'binding')"+ },+ "company_secret_proposals_status_check": {+ "name": "company_secret_proposals_status_check",+ "value": "\"company_secret_proposals\".\"status\" in ('pending', 'approved', 'rejected', 'withdrawn', 'expired')"+ },+ "company_secret_proposals_projection_check": {+ "name": "company_secret_proposals_projection_check",+ "value": "\"company_secret_proposals\".\"projection_class\" = 'unclassified'"+ },+ "company_secret_proposals_shape_check": {+ "name": "company_secret_proposals_shape_check",+ "value": "(\n \"company_secret_proposals\".\"kind\" = 'secret'\n and \"company_secret_proposals\".\"proposed_name\" is not null\n and \"company_secret_proposals\".\"proposed_key\" is not null\n and \"company_secret_proposals\".\"secret_id\" is null\n and \"company_secret_proposals\".\"secret_proposal_id\" is null\n and \"company_secret_proposals\".\"target_type\" is null\n and \"company_secret_proposals\".\"target_id\" is null\n and \"company_secret_proposals\".\"config_path\" is null\n ) or (\n \"company_secret_proposals\".\"kind\" = 'binding'\n and ((\"company_secret_proposals\".\"secret_id\" is not null)::int + (\"company_secret_proposals\".\"secret_proposal_id\" is not null)::int) = 1\n and \"company_secret_proposals\".\"target_type\" = 'agent'\n and \"company_secret_proposals\".\"target_id\" is not null\n and \"company_secret_proposals\".\"config_path\" is not null\n )"+ }+ },+ "isRLSEnabled": false+ },+ "public.company_secret_provider_configs": {+ "name": "company_secret_provider_configs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'ready'"+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "health_status": {+ "name": "health_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "health_checked_at": {+ "name": "health_checked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "health_message": {+ "name": "health_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "health_details": {+ "name": "health_details",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "disabled_at": {+ "name": "disabled_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_secret_provider_configs_company_idx": {+ "name": "company_secret_provider_configs_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_provider_configs_company_provider_idx": {+ "name": "company_secret_provider_configs_company_provider_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_provider_configs_default_uq": {+ "name": "company_secret_provider_configs_default_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"company_secret_provider_configs\".\"is_default\" = true",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_secret_provider_configs_company_id_companies_id_fk": {+ "name": "company_secret_provider_configs_company_id_companies_id_fk",+ "tableFrom": "company_secret_provider_configs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_secret_provider_configs_created_by_agent_id_agents_id_fk": {+ "name": "company_secret_provider_configs_created_by_agent_id_agents_id_fk",+ "tableFrom": "company_secret_provider_configs",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_secret_versions": {+ "name": "company_secret_versions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "secret_id": {+ "name": "secret_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "material": {+ "name": "material",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "value_sha256": {+ "name": "value_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_version_ref": {+ "name": "provider_version_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'current'"+ },+ "fingerprint_sha256": {+ "name": "fingerprint_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "rotation_job_id": {+ "name": "rotation_job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "company_secret_versions_secret_idx": {+ "name": "company_secret_versions_secret_idx",+ "columns": [+ {+ "expression": "secret_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_versions_value_sha256_idx": {+ "name": "company_secret_versions_value_sha256_idx",+ "columns": [+ {+ "expression": "value_sha256",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_versions_fingerprint_idx": {+ "name": "company_secret_versions_fingerprint_idx",+ "columns": [+ {+ "expression": "fingerprint_sha256",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secret_versions_secret_version_uq": {+ "name": "company_secret_versions_secret_version_uq",+ "columns": [+ {+ "expression": "secret_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_secret_versions_secret_id_company_secrets_id_fk": {+ "name": "company_secret_versions_secret_id_company_secrets_id_fk",+ "tableFrom": "company_secret_versions",+ "columnsFrom": [+ "secret_id"+ ],+ "tableTo": "company_secrets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_secret_versions_created_by_agent_id_agents_id_fk": {+ "name": "company_secret_versions_created_by_agent_id_agents_id_fk",+ "tableFrom": "company_secret_versions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_secrets": {+ "name": "company_secrets",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'company'"+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_secret_definition_id": {+ "name": "user_secret_definition_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_encrypted'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "managed_mode": {+ "name": "managed_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'paperclip_managed'"+ },+ "external_ref": {+ "name": "external_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_config_id": {+ "name": "provider_config_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider_metadata": {+ "name": "provider_metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "latest_version": {+ "name": "latest_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_resolved_at": {+ "name": "last_resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_rotated_at": {+ "name": "last_rotated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_secrets_company_idx": {+ "name": "company_secrets_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secrets_company_scope_idx": {+ "name": "company_secrets_company_scope_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secrets_company_owner_idx": {+ "name": "company_secrets_company_owner_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secrets_user_definition_owner_idx": {+ "name": "company_secrets_user_definition_owner_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_secret_definition_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secrets_company_provider_idx": {+ "name": "company_secrets_company_provider_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secrets_provider_config_idx": {+ "name": "company_secrets_provider_config_idx",+ "columns": [+ {+ "expression": "provider_config_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_secrets_company_name_uq": {+ "name": "company_secrets_company_name_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"company_secrets\".\"scope\" = 'company' and \"company_secrets\".\"deleted_at\" is null",+ "concurrently": false+ },+ "company_secrets_company_key_uq": {+ "name": "company_secrets_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"company_secrets\".\"scope\" = 'company' and \"company_secrets\".\"deleted_at\" is null",+ "concurrently": false+ },+ "company_secrets_user_definition_owner_uq": {+ "name": "company_secrets_user_definition_owner_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_secret_definition_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"company_secrets\".\"scope\" = 'user' and \"company_secrets\".\"deleted_at\" is null",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_secrets_company_id_companies_id_fk": {+ "name": "company_secrets_company_id_companies_id_fk",+ "tableFrom": "company_secrets",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "company_secrets_user_secret_definition_id_user_secret_definitions_id_fk": {+ "name": "company_secrets_user_secret_definition_id_user_secret_definitions_id_fk",+ "tableFrom": "company_secrets",+ "columnsFrom": [+ "user_secret_definition_id"+ ],+ "tableTo": "user_secret_definitions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_secrets_provider_config_id_company_secret_provider_configs_id_fk": {+ "name": "company_secrets_provider_config_id_company_secret_provider_configs_id_fk",+ "tableFrom": "company_secrets",+ "columnsFrom": [+ "provider_config_id"+ ],+ "tableTo": "company_secret_provider_configs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_secrets_created_by_agent_id_agents_id_fk": {+ "name": "company_secrets_created_by_agent_id_agents_id_fk",+ "tableFrom": "company_secrets",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "company_secrets_scope_shape_check": {+ "name": "company_secrets_scope_shape_check",+ "value": "(\n \"company_secrets\".\"scope\" = 'company'\n and \"company_secrets\".\"owner_user_id\" is null\n and \"company_secrets\".\"user_secret_definition_id\" is null\n ) or (\n \"company_secrets\".\"scope\" = 'user'\n and \"company_secrets\".\"owner_user_id\" is not null\n and \"company_secrets\".\"user_secret_definition_id\" is not null\n )"+ }+ },+ "isRLSEnabled": false+ },+ "public.company_skill_policies": {+ "name": "company_skill_policies",+ "schema": "",+ "columns": {+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true+ },+ "schema_version": {+ "name": "schema_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "revision": {+ "name": "revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "default_effect": {+ "name": "default_effect",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "rules": {+ "name": "rules",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "company_skill_policies_company_id_companies_id_fk": {+ "name": "company_skill_policies_company_id_companies_id_fk",+ "tableFrom": "company_skill_policies",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skill_comments": {+ "name": "company_skill_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_skill_id": {+ "name": "company_skill_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_agent_id": {+ "name": "author_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skill_comments_company_skill_created_idx": {+ "name": "company_skill_comments_company_skill_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_comments_parent_idx": {+ "name": "company_skill_comments_parent_idx",+ "columns": [+ {+ "expression": "parent_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skill_comments_company_id_companies_id_fk": {+ "name": "company_skill_comments_company_id_companies_id_fk",+ "tableFrom": "company_skill_comments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_comments_company_skill_id_company_skills_id_fk": {+ "name": "company_skill_comments_company_skill_id_company_skills_id_fk",+ "tableFrom": "company_skill_comments",+ "columnsFrom": [+ "company_skill_id"+ ],+ "tableTo": "company_skills",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_comments_parent_comment_id_company_skill_comments_id_fk": {+ "name": "company_skill_comments_parent_comment_id_company_skill_comments_id_fk",+ "tableFrom": "company_skill_comments",+ "columnsFrom": [+ "parent_comment_id"+ ],+ "tableTo": "company_skill_comments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_skill_comments_author_agent_id_agents_id_fk": {+ "name": "company_skill_comments_author_agent_id_agents_id_fk",+ "tableFrom": "company_skill_comments",+ "columnsFrom": [+ "author_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skill_stars": {+ "name": "company_skill_stars",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_skill_id": {+ "name": "company_skill_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skill_stars_skill_agent_idx": {+ "name": "company_skill_stars_skill_agent_idx",+ "columns": [+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_stars_skill_user_idx": {+ "name": "company_skill_stars_skill_user_idx",+ "columns": [+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_stars_company_skill_created_idx": {+ "name": "company_skill_stars_company_skill_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skill_stars_company_id_companies_id_fk": {+ "name": "company_skill_stars_company_id_companies_id_fk",+ "tableFrom": "company_skill_stars",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_stars_company_skill_id_company_skills_id_fk": {+ "name": "company_skill_stars_company_skill_id_company_skills_id_fk",+ "tableFrom": "company_skill_stars",+ "columnsFrom": [+ "company_skill_id"+ ],+ "tableTo": "company_skills",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_stars_agent_id_agents_id_fk": {+ "name": "company_skill_stars_agent_id_agents_id_fk",+ "tableFrom": "company_skill_stars",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skill_test_inputs": {+ "name": "company_skill_test_inputs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "skill_id": {+ "name": "skill_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skill_test_inputs_company_skill_name_idx": {+ "name": "company_skill_test_inputs_company_skill_name_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_test_inputs_company_skill_active_idx": {+ "name": "company_skill_test_inputs_company_skill_active_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deleted_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skill_test_inputs_company_id_companies_id_fk": {+ "name": "company_skill_test_inputs_company_id_companies_id_fk",+ "tableFrom": "company_skill_test_inputs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_test_inputs_skill_id_company_skills_id_fk": {+ "name": "company_skill_test_inputs_skill_id_company_skills_id_fk",+ "tableFrom": "company_skill_test_inputs",+ "columnsFrom": [+ "skill_id"+ ],+ "tableTo": "company_skills",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skill_test_run_templates": {+ "name": "company_skill_test_run_templates",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_agent_id": {+ "name": "updated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skill_test_run_templates_company_active_idx": {+ "name": "company_skill_test_run_templates_company_active_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deleted_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skill_test_run_templates_company_id_companies_id_fk": {+ "name": "company_skill_test_run_templates_company_id_companies_id_fk",+ "tableFrom": "company_skill_test_run_templates",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_test_run_templates_created_by_agent_id_agents_id_fk": {+ "name": "company_skill_test_run_templates_created_by_agent_id_agents_id_fk",+ "tableFrom": "company_skill_test_run_templates",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_skill_test_run_templates_updated_by_agent_id_agents_id_fk": {+ "name": "company_skill_test_run_templates_updated_by_agent_id_agents_id_fk",+ "tableFrom": "company_skill_test_run_templates",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skill_test_runs": {+ "name": "company_skill_test_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "skill_id": {+ "name": "skill_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "input_id": {+ "name": "input_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "input_snapshot": {+ "name": "input_snapshot",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "skill_version_id": {+ "name": "skill_version_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_config_snapshot": {+ "name": "agent_config_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "template_id": {+ "name": "template_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "template_name": {+ "name": "template_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "template_body": {+ "name": "template_body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rendered_template_body": {+ "name": "rendered_template_body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "harness_issue_description": {+ "name": "harness_issue_description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'queued'"+ },+ "output_document_key": {+ "name": "output_document_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'output'"+ },+ "output_snapshot": {+ "name": "output_snapshot",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "superseded_at": {+ "name": "superseded_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "harness_issue_expires_at": {+ "name": "harness_issue_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "harness_issue_deleted_at": {+ "name": "harness_issue_deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skill_test_runs_company_skill_created_idx": {+ "name": "company_skill_test_runs_company_skill_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_test_runs_company_issue_idx": {+ "name": "company_skill_test_runs_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_test_runs_company_input_created_idx": {+ "name": "company_skill_test_runs_company_input_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "input_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_test_runs_company_status_idx": {+ "name": "company_skill_test_runs_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_test_runs_company_harness_expires_idx": {+ "name": "company_skill_test_runs_company_harness_expires_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "harness_issue_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skill_test_runs_company_id_companies_id_fk": {+ "name": "company_skill_test_runs_company_id_companies_id_fk",+ "tableFrom": "company_skill_test_runs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_test_runs_skill_id_company_skills_id_fk": {+ "name": "company_skill_test_runs_skill_id_company_skills_id_fk",+ "tableFrom": "company_skill_test_runs",+ "columnsFrom": [+ "skill_id"+ ],+ "tableTo": "company_skills",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_test_runs_input_id_company_skill_test_inputs_id_fk": {+ "name": "company_skill_test_runs_input_id_company_skill_test_inputs_id_fk",+ "tableFrom": "company_skill_test_runs",+ "columnsFrom": [+ "input_id"+ ],+ "tableTo": "company_skill_test_inputs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_skill_test_runs_skill_version_id_company_skill_versions_id_fk": {+ "name": "company_skill_test_runs_skill_version_id_company_skill_versions_id_fk",+ "tableFrom": "company_skill_test_runs",+ "columnsFrom": [+ "skill_version_id"+ ],+ "tableTo": "company_skill_versions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "restrict"+ },+ "company_skill_test_runs_agent_id_agents_id_fk": {+ "name": "company_skill_test_runs_agent_id_agents_id_fk",+ "tableFrom": "company_skill_test_runs",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "restrict"+ },+ "company_skill_test_runs_issue_id_issues_id_fk": {+ "name": "company_skill_test_runs_issue_id_issues_id_fk",+ "tableFrom": "company_skill_test_runs",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "restrict"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skill_versions": {+ "name": "company_skill_versions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_skill_id": {+ "name": "company_skill_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "revision_number": {+ "name": "revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "release_id": {+ "name": "release_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "release_name": {+ "name": "release_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "released_at": {+ "name": "released_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "file_inventory": {+ "name": "file_inventory",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "author_agent_id": {+ "name": "author_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skill_versions_skill_revision_idx": {+ "name": "company_skill_versions_skill_revision_idx",+ "columns": [+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "revision_number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skill_versions_skill_release_idx": {+ "name": "company_skill_versions_skill_release_idx",+ "columns": [+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "release_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"company_skill_versions\".\"release_id\" is not null",+ "concurrently": false+ },+ "company_skill_versions_company_skill_created_idx": {+ "name": "company_skill_versions_company_skill_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "company_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skill_versions_company_id_companies_id_fk": {+ "name": "company_skill_versions_company_id_companies_id_fk",+ "tableFrom": "company_skill_versions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_versions_company_skill_id_company_skills_id_fk": {+ "name": "company_skill_versions_company_skill_id_company_skills_id_fk",+ "tableFrom": "company_skill_versions",+ "columnsFrom": [+ "company_skill_id"+ ],+ "tableTo": "company_skills",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "company_skill_versions_author_agent_id_agents_id_fk": {+ "name": "company_skill_versions_author_agent_id_agents_id_fk",+ "tableFrom": "company_skill_versions",+ "columnsFrom": [+ "author_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_skills": {+ "name": "company_skills",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "folder_id": {+ "name": "folder_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "markdown": {+ "name": "markdown",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_type": {+ "name": "source_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_path'"+ },+ "source_locator": {+ "name": "source_locator",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_ref": {+ "name": "source_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "trust_level": {+ "name": "trust_level",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'markdown_only'"+ },+ "compatibility": {+ "name": "compatibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compatible'"+ },+ "file_inventory": {+ "name": "file_inventory",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "icon_url": {+ "name": "icon_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tagline": {+ "name": "tagline",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "author_name": {+ "name": "author_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "homepage_url": {+ "name": "homepage_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "categories": {+ "name": "categories",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "sharing_scope": {+ "name": "sharing_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'company'"+ },+ "public_share_token": {+ "name": "public_share_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "forked_from_skill_id": {+ "name": "forked_from_skill_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "forked_from_company_id": {+ "name": "forked_from_company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "star_count": {+ "name": "star_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "install_count": {+ "name": "install_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "fork_count": {+ "name": "fork_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "current_version_id": {+ "name": "current_version_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_skills_company_key_idx": {+ "name": "company_skills_company_key_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skills_company_name_idx": {+ "name": "company_skills_company_name_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skills_company_folder_idx": {+ "name": "company_skills_company_folder_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "folder_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skills_company_categories_idx": {+ "name": "company_skills_company_categories_idx",+ "columns": [+ {+ "expression": "categories",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "company_skills_company_sharing_scope_idx": {+ "name": "company_skills_company_sharing_scope_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sharing_scope",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skills_company_current_version_idx": {+ "name": "company_skills_company_current_version_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "current_version_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_skills_company_forked_from_idx": {+ "name": "company_skills_company_forked_from_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "forked_from_skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_skills_company_id_companies_id_fk": {+ "name": "company_skills_company_id_companies_id_fk",+ "tableFrom": "company_skills",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "company_skills_folder_id_folders_id_fk": {+ "name": "company_skills_folder_id_folders_id_fk",+ "tableFrom": "company_skills",+ "columnsFrom": [+ "folder_id"+ ],+ "tableTo": "folders",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_skills_forked_from_skill_id_company_skills_id_fk": {+ "name": "company_skills_forked_from_skill_id_company_skills_id_fk",+ "tableFrom": "company_skills",+ "columnsFrom": [+ "forked_from_skill_id"+ ],+ "tableTo": "company_skills",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_skills_forked_from_company_id_companies_id_fk": {+ "name": "company_skills_forked_from_company_id_companies_id_fk",+ "tableFrom": "company_skills",+ "columnsFrom": [+ "forked_from_company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "company_skills_current_version_id_company_skill_versions_id_fk": {+ "name": "company_skills_current_version_id_company_skill_versions_id_fk",+ "tableFrom": "company_skills",+ "columnsFrom": [+ "current_version_id"+ ],+ "tableTo": "company_skill_versions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_transfer_runs": {+ "name": "company_transfer_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "direction": {+ "name": "direction",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "actor_key": {+ "name": "actor_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "container_ref": {+ "name": "container_ref",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "manifest_sha256": {+ "name": "manifest_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "manifest": {+ "name": "manifest",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "chunk_count": {+ "name": "chunk_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "blob_count": {+ "name": "blob_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "completed_parts": {+ "name": "completed_parts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_transfer_runs_company_idx": {+ "name": "company_transfer_runs_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_transfer_runs_idempotency_direction_idx": {+ "name": "company_transfer_runs_idempotency_direction_idx",+ "columns": [+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "direction",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_transfer_runs_actor_status_idx": {+ "name": "company_transfer_runs_actor_status_idx",+ "columns": [+ {+ "expression": "actor_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_transfer_runs_company_id_companies_id_fk": {+ "name": "company_transfer_runs_company_id_companies_id_fk",+ "tableFrom": "company_transfer_runs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.company_user_sidebar_preferences": {+ "name": "company_user_sidebar_preferences",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_order": {+ "name": "project_order",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "company_user_sidebar_preferences_company_idx": {+ "name": "company_user_sidebar_preferences_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_user_sidebar_preferences_user_idx": {+ "name": "company_user_sidebar_preferences_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "company_user_sidebar_preferences_company_user_uq": {+ "name": "company_user_sidebar_preferences_company_user_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "company_user_sidebar_preferences_company_id_companies_id_fk": {+ "name": "company_user_sidebar_preferences_company_id_companies_id_fk",+ "tableFrom": "company_user_sidebar_preferences",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.completion_contracts": {+ "name": "completion_contracts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "revision": {+ "name": "revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "schema_version": {+ "name": "schema_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "policy_version": {+ "name": "policy_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "risk": {+ "name": "risk",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "completion_authority": {+ "name": "completion_authority",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "incomplete_criteria_policy": {+ "name": "incomplete_criteria_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "contract_json": {+ "name": "contract_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "canonical_sha256": {+ "name": "canonical_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_actor_type": {+ "name": "created_by_actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_actor_id": {+ "name": "created_by_actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "supersedes_contract_id": {+ "name": "supersedes_contract_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "completion_contracts_issue_revision_uq": {+ "name": "completion_contracts_issue_revision_uq",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "revision",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "completion_contracts_issue_hash_uq": {+ "name": "completion_contracts_issue_hash_uq",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "canonical_sha256",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "completion_contracts_company_id_companies_id_fk": {+ "name": "completion_contracts_company_id_companies_id_fk",+ "tableFrom": "completion_contracts",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "completion_contracts_issue_company_fk": {+ "name": "completion_contracts_issue_company_fk",+ "tableFrom": "completion_contracts",+ "columnsFrom": [+ "company_id",+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "completion_contracts_supersedes_owner_fk": {+ "name": "completion_contracts_supersedes_owner_fk",+ "tableFrom": "completion_contracts",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "supersedes_contract_id"+ ],+ "tableTo": "completion_contracts",+ "columnsTo": [+ "company_id",+ "issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "completion_contracts_company_issue_id_uq": {+ "name": "completion_contracts_company_issue_id_uq",+ "columns": [+ "company_id",+ "issue_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cost_events": {+ "name": "cost_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_run_id": {+ "name": "heartbeat_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "billing_code": {+ "name": "billing_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "biller": {+ "name": "biller",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "billing_type": {+ "name": "billing_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "cost_status": {+ "name": "cost_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'reported'"+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "cached_input_tokens": {+ "name": "cached_input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "cost_cents": {+ "name": "cost_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "occurred_at": {+ "name": "occurred_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "cost_events_company_occurred_idx": {+ "name": "cost_events_company_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cost_events_company_agent_occurred_idx": {+ "name": "cost_events_company_agent_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cost_events_company_provider_occurred_idx": {+ "name": "cost_events_company_provider_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cost_events_company_biller_occurred_idx": {+ "name": "cost_events_company_biller_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "biller",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "cost_events_company_heartbeat_run_idx": {+ "name": "cost_events_company_heartbeat_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "heartbeat_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "cost_events_company_id_companies_id_fk": {+ "name": "cost_events_company_id_companies_id_fk",+ "tableFrom": "cost_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "cost_events_agent_id_agents_id_fk": {+ "name": "cost_events_agent_id_agents_id_fk",+ "tableFrom": "cost_events",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "cost_events_issue_id_issues_id_fk": {+ "name": "cost_events_issue_id_issues_id_fk",+ "tableFrom": "cost_events",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "cost_events_project_id_projects_id_fk": {+ "name": "cost_events_project_id_projects_id_fk",+ "tableFrom": "cost_events",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "cost_events_goal_id_goals_id_fk": {+ "name": "cost_events_goal_id_goals_id_fk",+ "tableFrom": "cost_events",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "cost_events_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "cost_events_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "cost_events",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.decision_archive_notification_outbox": {+ "name": "decision_archive_notification_outbox",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "archive_version": {+ "name": "archive_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "origin_agent_id": {+ "name": "origin_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "origin_issue_id": {+ "name": "origin_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempt_count": {+ "name": "attempt_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_attempt_at": {+ "name": "last_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "delivered_at": {+ "name": "delivered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_archive_notification_outbox_uq": {+ "name": "decision_archive_notification_outbox_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "archive_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_archive_notification_outbox_pending_idx": {+ "name": "decision_archive_notification_outbox_pending_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_archive_notification_outbox_company_id_companies_id_fk": {+ "name": "decision_archive_notification_outbox_company_id_companies_id_fk",+ "tableFrom": "decision_archive_notification_outbox",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_archive_notification_outbox_origin_agent_id_agents_id_fk": {+ "name": "decision_archive_notification_outbox_origin_agent_id_agents_id_fk",+ "tableFrom": "decision_archive_notification_outbox",+ "columnsFrom": [+ "origin_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "decision_archive_notification_outbox_status_check": {+ "name": "decision_archive_notification_outbox_status_check",+ "value": "\"decision_archive_notification_outbox\".\"status\" IN ('pending', 'delivering', 'delivered')"+ }+ },+ "isRLSEnabled": false+ },+ "public.decision_queue_items": {+ "name": "decision_queue_items",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "queue_id": {+ "name": "queue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "added_by_type": {+ "name": "added_by_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "added_by_agent_id": {+ "name": "added_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "added_by_run_id": {+ "name": "added_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "added_by_agent_api_key_id": {+ "name": "added_by_agent_api_key_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_queue_items_queue_source_uq": {+ "name": "decision_queue_items_queue_source_uq",+ "columns": [+ {+ "expression": "queue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_queue_items_company_source_idx": {+ "name": "decision_queue_items_company_source_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_queue_items_company_id_companies_id_fk": {+ "name": "decision_queue_items_company_id_companies_id_fk",+ "tableFrom": "decision_queue_items",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_queue_items_added_by_agent_id_agents_id_fk": {+ "name": "decision_queue_items_added_by_agent_id_agents_id_fk",+ "tableFrom": "decision_queue_items",+ "columnsFrom": [+ "added_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_queue_items_added_by_run_id_heartbeat_runs_id_fk": {+ "name": "decision_queue_items_added_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decision_queue_items",+ "columnsFrom": [+ "added_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_queue_items_added_by_agent_api_key_id_agent_api_keys_id_fk": {+ "name": "decision_queue_items_added_by_agent_api_key_id_agent_api_keys_id_fk",+ "tableFrom": "decision_queue_items",+ "columnsFrom": [+ "added_by_agent_api_key_id"+ ],+ "tableTo": "agent_api_keys",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_queue_items_queue_company_fk": {+ "name": "decision_queue_items_queue_company_fk",+ "tableFrom": "decision_queue_items",+ "columnsFrom": [+ "queue_id",+ "company_id"+ ],+ "tableTo": "decision_queues",+ "columnsTo": [+ "id",+ "company_id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "decision_queue_items_actor_check": {+ "name": "decision_queue_items_actor_check",+ "value": "(\n (\"decision_queue_items\".\"added_by_type\" = 'agent' AND \"decision_queue_items\".\"added_by_agent_id\" IS NOT NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NULL)\n OR (\"decision_queue_items\".\"added_by_type\" = 'user' AND \"decision_queue_items\".\"added_by_agent_id\" IS NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NOT NULL)\n OR (\"decision_queue_items\".\"added_by_type\" = 'system' AND \"decision_queue_items\".\"added_by_agent_id\" IS NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NULL)\n )"+ }+ },+ "isRLSEnabled": false+ },+ "public.decision_queues": {+ "name": "decision_queues",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_type": {+ "name": "created_by_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_api_key_id": {+ "name": "created_by_agent_api_key_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "retention_days": {+ "name": "retention_days",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "seed_rules": {+ "name": "seed_rules",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "seed_rules_enabled": {+ "name": "seed_rules_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_queues_company_key_uq": {+ "name": "decision_queues_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_queues_company_updated_idx": {+ "name": "decision_queues_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_queues_company_id_companies_id_fk": {+ "name": "decision_queues_company_id_companies_id_fk",+ "tableFrom": "decision_queues",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_queues_created_by_agent_id_agents_id_fk": {+ "name": "decision_queues_created_by_agent_id_agents_id_fk",+ "tableFrom": "decision_queues",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_queues_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "decision_queues_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decision_queues",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_queues_created_by_agent_api_key_id_agent_api_keys_id_fk": {+ "name": "decision_queues_created_by_agent_api_key_id_agent_api_keys_id_fk",+ "tableFrom": "decision_queues",+ "columnsFrom": [+ "created_by_agent_api_key_id"+ ],+ "tableTo": "agent_api_keys",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "decision_queues_id_company_uq": {+ "name": "decision_queues_id_company_uq",+ "columns": [+ "id",+ "company_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "decision_queues_creator_check": {+ "name": "decision_queues_creator_check",+ "value": "(\n (\"decision_queues\".\"created_by_type\" = 'agent' AND \"decision_queues\".\"created_by_agent_id\" IS NOT NULL AND \"decision_queues\".\"created_by_user_id\" IS NULL)\n OR (\"decision_queues\".\"created_by_type\" = 'user' AND \"decision_queues\".\"created_by_agent_id\" IS NULL AND \"decision_queues\".\"created_by_user_id\" IS NOT NULL)\n OR (\"decision_queues\".\"created_by_type\" = 'system' AND \"decision_queues\".\"created_by_agent_id\" IS NULL AND \"decision_queues\".\"created_by_user_id\" IS NULL)\n )"+ },+ "decision_queues_retention_days_check": {+ "name": "decision_queues_retention_days_check",+ "value": "\"decision_queues\".\"retention_days\" IS NULL OR (\"decision_queues\".\"retention_days\" >= 1 AND \"decision_queues\".\"retention_days\" <= 3650)"+ }+ },+ "isRLSEnabled": false+ },+ "public.decision_retention": {+ "name": "decision_retention",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_activity_at": {+ "name": "source_activity_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "keep": {+ "name": "keep",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_reason": {+ "name": "archived_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_type": {+ "name": "archived_by_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_agent_id": {+ "name": "archived_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_user_id": {+ "name": "archived_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_run_id": {+ "name": "archived_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "archive_version": {+ "name": "archive_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_retention_company_source_uq": {+ "name": "decision_retention_company_source_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_retention_company_archived_idx": {+ "name": "decision_retention_company_archived_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "archived_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_retention_company_id_companies_id_fk": {+ "name": "decision_retention_company_id_companies_id_fk",+ "tableFrom": "decision_retention",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_retention_archived_by_agent_id_agents_id_fk": {+ "name": "decision_retention_archived_by_agent_id_agents_id_fk",+ "tableFrom": "decision_retention",+ "columnsFrom": [+ "archived_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_retention_archived_by_run_id_heartbeat_runs_id_fk": {+ "name": "decision_retention_archived_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decision_retention",+ "columnsFrom": [+ "archived_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "decision_retention_archive_actor_check": {+ "name": "decision_retention_archive_actor_check",+ "value": "(\n (\"decision_retention\".\"archived_at\" IS NULL AND \"decision_retention\".\"archived_by_type\" IS NULL AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'system' AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'agent' AND \"decision_retention\".\"archived_by_agent_id\" IS NOT NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'user' AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NOT NULL)\n )"+ }+ },+ "isRLSEnabled": false+ },+ "public.decision_triage": {+ "name": "decision_triage",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "decide_by": {+ "name": "decide_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decide_by_date": {+ "name": "decide_by_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "set_by_type": {+ "name": "set_by_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "set_by_agent_id": {+ "name": "set_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "set_by_user_id": {+ "name": "set_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "set_by_run_id": {+ "name": "set_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "set_by_agent_api_key_id": {+ "name": "set_by_agent_api_key_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_triage_company_source_uq": {+ "name": "decision_triage_company_source_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_triage_company_decide_by_idx": {+ "name": "decision_triage_company_decide_by_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "decide_by",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_triage_company_id_companies_id_fk": {+ "name": "decision_triage_company_id_companies_id_fk",+ "tableFrom": "decision_triage",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_triage_set_by_agent_id_agents_id_fk": {+ "name": "decision_triage_set_by_agent_id_agents_id_fk",+ "tableFrom": "decision_triage",+ "columnsFrom": [+ "set_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_triage_set_by_run_id_heartbeat_runs_id_fk": {+ "name": "decision_triage_set_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decision_triage",+ "columnsFrom": [+ "set_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_triage_set_by_agent_api_key_id_agent_api_keys_id_fk": {+ "name": "decision_triage_set_by_agent_api_key_id_agent_api_keys_id_fk",+ "tableFrom": "decision_triage",+ "columnsFrom": [+ "set_by_agent_api_key_id"+ ],+ "tableTo": "agent_api_keys",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "decision_triage_actor_check": {+ "name": "decision_triage_actor_check",+ "value": "(\n (\"decision_triage\".\"set_by_type\" = 'agent' AND \"decision_triage\".\"set_by_agent_id\" IS NOT NULL AND \"decision_triage\".\"set_by_user_id\" IS NULL)\n OR (\"decision_triage\".\"set_by_type\" = 'user' AND \"decision_triage\".\"set_by_agent_id\" IS NULL AND \"decision_triage\".\"set_by_user_id\" IS NOT NULL)\n )"+ },+ "decision_triage_decide_by_check": {+ "name": "decision_triage_decide_by_check",+ "value": "(\n (\"decision_triage\".\"decide_by\" IS NULL AND \"decision_triage\".\"decide_by_date\" IS NULL)\n OR (\"decision_triage\".\"decide_by\" IN ('today', 'this_week', 'whenever') AND \"decision_triage\".\"decide_by_date\" IS NULL)\n OR (\"decision_triage\".\"decide_by\" = 'date' AND \"decision_triage\".\"decide_by_date\" IS NOT NULL)\n )"+ }+ },+ "isRLSEnabled": false+ },+ "public.decision_triage_events": {+ "name": "decision_triage_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "queue_id": {+ "name": "queue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_agent_id": {+ "name": "actor_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_run_id": {+ "name": "actor_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "agent_api_key_id": {+ "name": "agent_api_key_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "details": {+ "name": "details",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_triage_events_company_source_created_idx": {+ "name": "decision_triage_events_company_source_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_triage_events_queue_created_idx": {+ "name": "decision_triage_events_queue_created_idx",+ "columns": [+ {+ "expression": "queue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_triage_events_company_id_companies_id_fk": {+ "name": "decision_triage_events_company_id_companies_id_fk",+ "tableFrom": "decision_triage_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_triage_events_queue_id_decision_queues_id_fk": {+ "name": "decision_triage_events_queue_id_decision_queues_id_fk",+ "tableFrom": "decision_triage_events",+ "columnsFrom": [+ "queue_id"+ ],+ "tableTo": "decision_queues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_triage_events_actor_agent_id_agents_id_fk": {+ "name": "decision_triage_events_actor_agent_id_agents_id_fk",+ "tableFrom": "decision_triage_events",+ "columnsFrom": [+ "actor_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_triage_events_actor_run_id_heartbeat_runs_id_fk": {+ "name": "decision_triage_events_actor_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decision_triage_events",+ "columnsFrom": [+ "actor_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_triage_events_agent_api_key_id_agent_api_keys_id_fk": {+ "name": "decision_triage_events_agent_api_key_id_agent_api_keys_id_fk",+ "tableFrom": "decision_triage_events",+ "columnsFrom": [+ "agent_api_key_id"+ ],+ "tableTo": "agent_api_keys",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "decision_triage_events_actor_check": {+ "name": "decision_triage_events_actor_check",+ "value": "(\n (\"decision_triage_events\".\"actor_type\" = 'agent' AND \"decision_triage_events\".\"actor_agent_id\" IS NOT NULL AND \"decision_triage_events\".\"actor_user_id\" IS NULL)\n OR (\"decision_triage_events\".\"actor_type\" = 'user' AND \"decision_triage_events\".\"actor_agent_id\" IS NULL AND \"decision_triage_events\".\"actor_user_id\" IS NOT NULL)\n OR (\"decision_triage_events\".\"actor_type\" = 'system' AND \"decision_triage_events\".\"actor_agent_id\" IS NULL AND \"decision_triage_events\".\"actor_user_id\" IS NULL)\n )"+ }+ },+ "isRLSEnabled": false+ },+ "public.decision_training_examples": {+ "name": "decision_training_examples",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "cutoff_at": {+ "name": "cutoff_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "notes": {+ "name": "notes",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "notes_history": {+ "name": "notes_history",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "decision_outcome": {+ "name": "decision_outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retention_policy": {+ "name": "retention_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'scrub_deleted_comments_v1'"+ },+ "snapshot": {+ "name": "snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_training_examples_company_created_at_idx": {+ "name": "decision_training_examples_company_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_training_examples_issue_idx": {+ "name": "decision_training_examples_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_training_examples_source_author_uq": {+ "name": "decision_training_examples_source_author_uq",+ "columns": [+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_by_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_training_examples_company_id_companies_id_fk": {+ "name": "decision_training_examples_company_id_companies_id_fk",+ "tableFrom": "decision_training_examples",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_training_examples_issue_id_issues_id_fk": {+ "name": "decision_training_examples_issue_id_issues_id_fk",+ "tableFrom": "decision_training_examples",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.decision_bundles": {+ "name": "decision_bundles",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "origin_agent_id": {+ "name": "origin_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "origin_issue_id": {+ "name": "origin_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decision_bundles_company_created_at_idx": {+ "name": "decision_bundles_company_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_bundles_company_id_companies_id_fk": {+ "name": "decision_bundles_company_id_companies_id_fk",+ "tableFrom": "decision_bundles",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_bundles_origin_agent_id_agents_id_fk": {+ "name": "decision_bundles_origin_agent_id_agents_id_fk",+ "tableFrom": "decision_bundles",+ "columnsFrom": [+ "origin_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_bundles_origin_issue_id_issues_id_fk": {+ "name": "decision_bundles_origin_issue_id_issues_id_fk",+ "tableFrom": "decision_bundles",+ "columnsFrom": [+ "origin_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_bundles_origin_run_id_heartbeat_runs_id_fk": {+ "name": "decision_bundles_origin_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decision_bundles",+ "columnsFrom": [+ "origin_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.decision_effect_executions": {+ "name": "decision_effect_executions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "decision_id": {+ "name": "decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "effect_index": {+ "name": "effect_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "effect_type": {+ "name": "effect_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_issue_id": {+ "name": "target_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'claimed'"+ },+ "result": {+ "name": "result",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "activity_log_id": {+ "name": "activity_log_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "executed_at": {+ "name": "executed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "decision_effect_executions_decision_effect_uq": {+ "name": "decision_effect_executions_decision_effect_uq",+ "columns": [+ {+ "expression": "decision_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "effect_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_effect_executions_target_issue_idx": {+ "name": "decision_effect_executions_target_issue_idx",+ "columns": [+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_effect_executions_decision_id_decisions_id_fk": {+ "name": "decision_effect_executions_decision_id_decisions_id_fk",+ "tableFrom": "decision_effect_executions",+ "columnsFrom": [+ "decision_id"+ ],+ "tableTo": "decisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_effect_executions_target_issue_id_issues_id_fk": {+ "name": "decision_effect_executions_target_issue_id_issues_id_fk",+ "tableFrom": "decision_effect_executions",+ "columnsFrom": [+ "target_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decision_effect_executions_activity_log_id_activity_log_id_fk": {+ "name": "decision_effect_executions_activity_log_id_activity_log_id_fk",+ "tableFrom": "decision_effect_executions",+ "columnsFrom": [+ "activity_log_id"+ ],+ "tableTo": "activity_log",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.decision_target_issues": {+ "name": "decision_target_issues",+ "schema": "",+ "columns": {+ "decision_id": {+ "name": "decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "decision_target_issues_decision_idx": {+ "name": "decision_target_issues_decision_idx",+ "columns": [+ {+ "expression": "decision_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decision_target_issues_issue_idx": {+ "name": "decision_target_issues_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decision_target_issues_decision_id_decisions_id_fk": {+ "name": "decision_target_issues_decision_id_decisions_id_fk",+ "tableFrom": "decision_target_issues",+ "columnsFrom": [+ "decision_id"+ ],+ "tableTo": "decisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_target_issues_issue_id_issues_id_fk": {+ "name": "decision_target_issues_issue_id_issues_id_fk",+ "tableFrom": "decision_target_issues",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "decision_target_issues_company_id_companies_id_fk": {+ "name": "decision_target_issues_company_id_companies_id_fk",+ "tableFrom": "decision_target_issues",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {+ "decision_target_issues_decision_id_issue_id_pk": {+ "name": "decision_target_issues_decision_id_issue_id_pk",+ "columns": [+ "decision_id",+ "issue_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.decisions": {+ "name": "decisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "bundle_id": {+ "name": "bundle_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "origin_agent_id": {+ "name": "origin_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "origin_issue_id": {+ "name": "origin_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "rule_key": {+ "name": "rule_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "options": {+ "name": "options",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "inputs": {+ "name": "inputs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'open'"+ },+ "execution_status": {+ "name": "execution_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "chosen_option_id": {+ "name": "chosen_option_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_values": {+ "name": "input_values",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "decided_by_user_id": {+ "name": "decided_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decided_at": {+ "name": "decided_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "signed_spec": {+ "name": "signed_spec",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_snapshots": {+ "name": "target_snapshots",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "continuation_policy": {+ "name": "continuation_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'none'"+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "decisions_company_status_expires_at_idx": {+ "name": "decisions_company_status_expires_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decisions_bundle_idx": {+ "name": "decisions_bundle_idx",+ "columns": [+ {+ "expression": "bundle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decisions_origin_issue_idx": {+ "name": "decisions_origin_issue_idx",+ "columns": [+ {+ "expression": "origin_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "decisions_company_idempotency_uq": {+ "name": "decisions_company_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"decisions\".\"idempotency_key\" IS NOT NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "decisions_company_id_companies_id_fk": {+ "name": "decisions_company_id_companies_id_fk",+ "tableFrom": "decisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decisions_bundle_id_decision_bundles_id_fk": {+ "name": "decisions_bundle_id_decision_bundles_id_fk",+ "tableFrom": "decisions",+ "columnsFrom": [+ "bundle_id"+ ],+ "tableTo": "decision_bundles",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "decisions_origin_agent_id_agents_id_fk": {+ "name": "decisions_origin_agent_id_agents_id_fk",+ "tableFrom": "decisions",+ "columnsFrom": [+ "origin_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decisions_origin_issue_id_issues_id_fk": {+ "name": "decisions_origin_issue_id_issues_id_fk",+ "tableFrom": "decisions",+ "columnsFrom": [+ "origin_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "decisions_origin_run_id_heartbeat_runs_id_fk": {+ "name": "decisions_origin_run_id_heartbeat_runs_id_fk",+ "tableFrom": "decisions",+ "columnsFrom": [+ "origin_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_annotation_anchor_snapshots": {+ "name": "document_annotation_anchor_snapshots",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "from_revision_id": {+ "name": "from_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "from_revision_number": {+ "name": "from_revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "to_revision_id": {+ "name": "to_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "to_revision_number": {+ "name": "to_revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "previous_anchor": {+ "name": "previous_anchor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "next_anchor": {+ "name": "next_anchor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_state": {+ "name": "anchor_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "anchor_confidence": {+ "name": "anchor_confidence",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_annotation_anchor_snapshots_company_thread_created_at_idx": {+ "name": "document_annotation_anchor_snapshots_company_thread_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_anchor_snapshots_company_document_revision_idx": {+ "name": "document_annotation_anchor_snapshots_company_document_revision_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "to_revision_number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_annotation_anchor_snapshots_company_id_companies_id_fk": {+ "name": "document_annotation_anchor_snapshots_company_id_companies_id_fk",+ "tableFrom": "document_annotation_anchor_snapshots",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk": {+ "name": "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk",+ "tableFrom": "document_annotation_anchor_snapshots",+ "columnsFrom": [+ "thread_id"+ ],+ "tableTo": "document_annotation_threads",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_anchor_snapshots_document_id_documents_id_fk": {+ "name": "document_annotation_anchor_snapshots_document_id_documents_id_fk",+ "tableFrom": "document_annotation_anchor_snapshots",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk": {+ "name": "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk",+ "tableFrom": "document_annotation_anchor_snapshots",+ "columnsFrom": [+ "from_revision_id"+ ],+ "tableTo": "document_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk": {+ "name": "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk",+ "tableFrom": "document_annotation_anchor_snapshots",+ "columnsFrom": [+ "to_revision_id"+ ],+ "tableTo": "document_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_annotation_comments": {+ "name": "document_annotation_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "author_type": {+ "name": "author_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "author_agent_id": {+ "name": "author_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_comment_id": {+ "name": "issue_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source_trust": {+ "name": "source_trust",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_annotation_comments_company_thread_created_at_idx": {+ "name": "document_annotation_comments_company_thread_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_comments_company_issue_created_at_idx": {+ "name": "document_annotation_comments_company_issue_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_comments_company_routine_created_at_idx": {+ "name": "document_annotation_comments_company_routine_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_comments_company_case_created_at_idx": {+ "name": "document_annotation_comments_company_case_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_comments_company_document_created_at_idx": {+ "name": "document_annotation_comments_company_document_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_comments_issue_comment_idx": {+ "name": "document_annotation_comments_issue_comment_idx",+ "columns": [+ {+ "expression": "issue_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_comments_body_search_idx": {+ "name": "document_annotation_comments_body_search_idx",+ "columns": [+ {+ "expression": "body",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_annotation_comments_company_id_companies_id_fk": {+ "name": "document_annotation_comments_company_id_companies_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "document_annotation_comments_thread_id_document_annotation_threads_id_fk": {+ "name": "document_annotation_comments_thread_id_document_annotation_threads_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "thread_id"+ ],+ "tableTo": "document_annotation_threads",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_comments_issue_id_issues_id_fk": {+ "name": "document_annotation_comments_issue_id_issues_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_comments_routine_id_routines_id_fk": {+ "name": "document_annotation_comments_routine_id_routines_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_comments_case_id_cases_id_fk": {+ "name": "document_annotation_comments_case_id_cases_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_comments_document_id_documents_id_fk": {+ "name": "document_annotation_comments_document_id_documents_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_comments_author_agent_id_agents_id_fk": {+ "name": "document_annotation_comments_author_agent_id_agents_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "author_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_annotation_comments_issue_comment_id_issue_comments_id_fk": {+ "name": "document_annotation_comments_issue_comment_id_issue_comments_id_fk",+ "tableFrom": "document_annotation_comments",+ "columnsFrom": [+ "issue_comment_id"+ ],+ "tableTo": "issue_comments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "document_annotation_comments_exactly_one_owner_chk": {+ "name": "document_annotation_comments_exactly_one_owner_chk",+ "value": "num_nonnulls(\"document_annotation_comments\".\"issue_id\", \"document_annotation_comments\".\"routine_id\", \"document_annotation_comments\".\"case_id\") = 1"+ }+ },+ "isRLSEnabled": false+ },+ "public.document_annotation_threads": {+ "name": "document_annotation_threads",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_key": {+ "name": "document_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'open'"+ },+ "anchor_state": {+ "name": "anchor_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "original_revision_id": {+ "name": "original_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "original_revision_number": {+ "name": "original_revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "current_revision_id": {+ "name": "current_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "current_revision_number": {+ "name": "current_revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "selected_text": {+ "name": "selected_text",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prefix_text": {+ "name": "prefix_text",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "suffix_text": {+ "name": "suffix_text",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "normalized_start": {+ "name": "normalized_start",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "normalized_end": {+ "name": "normalized_end",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "markdown_start": {+ "name": "markdown_start",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "markdown_end": {+ "name": "markdown_end",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "anchor_confidence": {+ "name": "anchor_confidence",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'exact'"+ },+ "anchor_selector": {+ "name": "anchor_selector",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_agent_id": {+ "name": "resolved_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_annotation_threads_company_document_status_idx": {+ "name": "document_annotation_threads_company_document_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_threads_company_issue_status_idx": {+ "name": "document_annotation_threads_company_issue_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_threads_company_routine_status_idx": {+ "name": "document_annotation_threads_company_routine_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_threads_company_case_status_idx": {+ "name": "document_annotation_threads_company_case_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_threads_company_current_revision_open_idx": {+ "name": "document_annotation_threads_company_current_revision_open_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "current_revision_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_annotation_threads_company_anchor_state_idx": {+ "name": "document_annotation_threads_company_anchor_state_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "anchor_state",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_annotation_threads_company_id_companies_id_fk": {+ "name": "document_annotation_threads_company_id_companies_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "document_annotation_threads_issue_id_issues_id_fk": {+ "name": "document_annotation_threads_issue_id_issues_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_threads_routine_id_routines_id_fk": {+ "name": "document_annotation_threads_routine_id_routines_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_threads_case_id_cases_id_fk": {+ "name": "document_annotation_threads_case_id_cases_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_threads_document_id_documents_id_fk": {+ "name": "document_annotation_threads_document_id_documents_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_annotation_threads_original_revision_id_document_revisions_id_fk": {+ "name": "document_annotation_threads_original_revision_id_document_revisions_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "original_revision_id"+ ],+ "tableTo": "document_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_annotation_threads_current_revision_id_document_revisions_id_fk": {+ "name": "document_annotation_threads_current_revision_id_document_revisions_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "current_revision_id"+ ],+ "tableTo": "document_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_annotation_threads_created_by_agent_id_agents_id_fk": {+ "name": "document_annotation_threads_created_by_agent_id_agents_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_annotation_threads_resolved_by_agent_id_agents_id_fk": {+ "name": "document_annotation_threads_resolved_by_agent_id_agents_id_fk",+ "tableFrom": "document_annotation_threads",+ "columnsFrom": [+ "resolved_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "document_annotation_threads_exactly_one_owner_chk": {+ "name": "document_annotation_threads_exactly_one_owner_chk",+ "value": "num_nonnulls(\"document_annotation_threads\".\"issue_id\", \"document_annotation_threads\".\"routine_id\", \"document_annotation_threads\".\"case_id\") = 1"+ }+ },+ "isRLSEnabled": false+ },+ "public.document_memberships": {+ "name": "document_memberships",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "starred_at": {+ "name": "starred_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_memberships_company_user_starred_idx": {+ "name": "document_memberships_company_user_starred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "starred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_memberships_company_user_document_uq": {+ "name": "document_memberships_company_user_document_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_memberships_company_id_companies_id_fk": {+ "name": "document_memberships_company_id_companies_id_fk",+ "tableFrom": "document_memberships",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_memberships_document_id_documents_id_fk": {+ "name": "document_memberships_document_id_documents_id_fk",+ "tableFrom": "document_memberships",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_revisions": {+ "name": "document_revisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "revision_number": {+ "name": "revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "format": {+ "name": "format",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'markdown'"+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "change_summary": {+ "name": "change_summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_revisions_document_revision_uq": {+ "name": "document_revisions_document_revision_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "revision_number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "document_revisions_company_document_created_idx": {+ "name": "document_revisions_company_document_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_revisions_company_id_companies_id_fk": {+ "name": "document_revisions_company_id_companies_id_fk",+ "tableFrom": "document_revisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_revisions_document_id_documents_id_fk": {+ "name": "document_revisions_document_id_documents_id_fk",+ "tableFrom": "document_revisions",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_revisions_created_by_agent_id_agents_id_fk": {+ "name": "document_revisions_created_by_agent_id_agents_id_fk",+ "tableFrom": "document_revisions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "document_revisions_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "document_revisions_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "document_revisions",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.documents": {+ "name": "documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "format": {+ "name": "format",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'markdown'"+ },+ "latest_body": {+ "name": "latest_body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "latest_revision_id": {+ "name": "latest_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "latest_revision_number": {+ "name": "latest_revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_agent_id": {+ "name": "updated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "locked_at": {+ "name": "locked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "locked_by_agent_id": {+ "name": "locked_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "locked_by_user_id": {+ "name": "locked_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_trust": {+ "name": "source_trust",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "documents_company_updated_idx": {+ "name": "documents_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "documents_company_created_idx": {+ "name": "documents_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "documents_title_search_idx": {+ "name": "documents_title_search_idx",+ "columns": [+ {+ "expression": "title",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "documents_latest_body_search_idx": {+ "name": "documents_latest_body_search_idx",+ "columns": [+ {+ "expression": "latest_body",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "documents_company_id_companies_id_fk": {+ "name": "documents_company_id_companies_id_fk",+ "tableFrom": "documents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "documents_created_by_agent_id_agents_id_fk": {+ "name": "documents_created_by_agent_id_agents_id_fk",+ "tableFrom": "documents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "documents_updated_by_agent_id_agents_id_fk": {+ "name": "documents_updated_by_agent_id_agents_id_fk",+ "tableFrom": "documents",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "documents_locked_by_agent_id_agents_id_fk": {+ "name": "documents_locked_by_agent_id_agents_id_fk",+ "tableFrom": "documents",+ "columnsFrom": [+ "locked_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.environment_custom_image_setup_sessions": {+ "name": "environment_custom_image_setup_sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "environment_id": {+ "name": "environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "template_id": {+ "name": "template_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "promoted_template_id": {+ "name": "promoted_template_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_lease_id": {+ "name": "provider_lease_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "environment_lease_id": {+ "name": "environment_lease_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'starting'"+ },+ "started_by_user_id": {+ "name": "started_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_by_agent_id": {+ "name": "started_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "base_template_ref": {+ "name": "base_template_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "connection_summary": {+ "name": "connection_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "connection_secret_ref": {+ "name": "connection_secret_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "environment_custom_image_setup_sessions_environment_status_idx": {+ "name": "environment_custom_image_setup_sessions_environment_status_idx",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_setup_sessions_environment_active_uq": {+ "name": "environment_custom_image_setup_sessions_environment_active_uq",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"environment_custom_image_setup_sessions\".\"status\" IN ('starting', 'waiting_for_user', 'capturing')",+ "concurrently": false+ },+ "environment_custom_image_setup_sessions_template_idx": {+ "name": "environment_custom_image_setup_sessions_template_idx",+ "columns": [+ {+ "expression": "template_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_setup_sessions_promoted_template_idx": {+ "name": "environment_custom_image_setup_sessions_promoted_template_idx",+ "columns": [+ {+ "expression": "promoted_template_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_setup_sessions_expires_idx": {+ "name": "environment_custom_image_setup_sessions_expires_idx",+ "columns": [+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_setup_sessions_provider_lease_idx": {+ "name": "environment_custom_image_setup_sessions_provider_lease_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_lease_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "environment_custom_image_setup_sessions_environment_id_environments_id_fk": {+ "name": "environment_custom_image_setup_sessions_environment_id_environments_id_fk",+ "tableFrom": "environment_custom_image_setup_sessions",+ "columnsFrom": [+ "environment_id"+ ],+ "tableTo": "environments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "environment_custom_image_setup_sessions_template_id_environment_custom_image_templates_id_fk": {+ "name": "environment_custom_image_setup_sessions_template_id_environment_custom_image_templates_id_fk",+ "tableFrom": "environment_custom_image_setup_sessions",+ "columnsFrom": [+ "template_id"+ ],+ "tableTo": "environment_custom_image_templates",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_custom_image_setup_sessions_promoted_template_id_environment_custom_image_templates_id_fk": {+ "name": "environment_custom_image_setup_sessions_promoted_template_id_environment_custom_image_templates_id_fk",+ "tableFrom": "environment_custom_image_setup_sessions",+ "columnsFrom": [+ "promoted_template_id"+ ],+ "tableTo": "environment_custom_image_templates",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_custom_image_setup_sessions_environment_lease_id_environment_leases_id_fk": {+ "name": "environment_custom_image_setup_sessions_environment_lease_id_environment_leases_id_fk",+ "tableFrom": "environment_custom_image_setup_sessions",+ "columnsFrom": [+ "environment_lease_id"+ ],+ "tableTo": "environment_leases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_custom_image_setup_sessions_started_by_agent_id_agents_id_fk": {+ "name": "environment_custom_image_setup_sessions_started_by_agent_id_agents_id_fk",+ "tableFrom": "environment_custom_image_setup_sessions",+ "columnsFrom": [+ "started_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.environment_custom_image_templates": {+ "name": "environment_custom_image_templates",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "environment_id": {+ "name": "environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "template_kind": {+ "name": "template_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "template_ref": {+ "name": "template_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_template_ref": {+ "name": "source_template_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_environment_config_fingerprint": {+ "name": "source_environment_config_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "superseded_by_template_id": {+ "name": "superseded_by_template_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "environment_custom_image_templates_environment_status_idx": {+ "name": "environment_custom_image_templates_environment_status_idx",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_templates_environment_provider_status_idx": {+ "name": "environment_custom_image_templates_environment_provider_status_idx",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_templates_environment_active_uq": {+ "name": "environment_custom_image_templates_environment_active_uq",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"environment_custom_image_templates\".\"status\" = 'active'",+ "concurrently": false+ },+ "environment_custom_image_templates_superseded_by_idx": {+ "name": "environment_custom_image_templates_superseded_by_idx",+ "columns": [+ {+ "expression": "superseded_by_template_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_custom_image_templates_last_used_idx": {+ "name": "environment_custom_image_templates_last_used_idx",+ "columns": [+ {+ "expression": "last_used_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "environment_custom_image_templates_environment_id_environments_id_fk": {+ "name": "environment_custom_image_templates_environment_id_environments_id_fk",+ "tableFrom": "environment_custom_image_templates",+ "columnsFrom": [+ "environment_id"+ ],+ "tableTo": "environments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "environment_custom_image_templates_created_by_agent_id_agents_id_fk": {+ "name": "environment_custom_image_templates_created_by_agent_id_agents_id_fk",+ "tableFrom": "environment_custom_image_templates",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_custom_image_templates_superseded_by_template_id_environment_custom_image_templates_id_fk": {+ "name": "environment_custom_image_templates_superseded_by_template_id_environment_custom_image_templates_id_fk",+ "tableFrom": "environment_custom_image_templates",+ "columnsFrom": [+ "superseded_by_template_id"+ ],+ "tableTo": "environment_custom_image_templates",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.environment_leases": {+ "name": "environment_leases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "environment_id": {+ "name": "environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_run_id": {+ "name": "heartbeat_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "lease_policy": {+ "name": "lease_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'ephemeral'"+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_lease_id": {+ "name": "provider_lease_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "acquired_at": {+ "name": "acquired_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "released_at": {+ "name": "released_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cleanup_status": {+ "name": "cleanup_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "environment_leases_company_environment_status_idx": {+ "name": "environment_leases_company_environment_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_leases_company_execution_workspace_idx": {+ "name": "environment_leases_company_execution_workspace_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_leases_company_issue_idx": {+ "name": "environment_leases_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_leases_heartbeat_run_idx": {+ "name": "environment_leases_heartbeat_run_idx",+ "columns": [+ {+ "expression": "heartbeat_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_leases_company_last_used_idx": {+ "name": "environment_leases_company_last_used_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "last_used_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environment_leases_provider_lease_idx": {+ "name": "environment_leases_provider_lease_idx",+ "columns": [+ {+ "expression": "provider_lease_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "environment_leases_company_id_companies_id_fk": {+ "name": "environment_leases_company_id_companies_id_fk",+ "tableFrom": "environment_leases",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "environment_leases_environment_id_environments_id_fk": {+ "name": "environment_leases_environment_id_environments_id_fk",+ "tableFrom": "environment_leases",+ "columnsFrom": [+ "environment_id"+ ],+ "tableTo": "environments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_leases_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "environment_leases_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "environment_leases",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_leases_issue_id_issues_id_fk": {+ "name": "environment_leases_issue_id_issues_id_fk",+ "tableFrom": "environment_leases",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "environment_leases",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.environments": {+ "name": "environments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "driver": {+ "name": "driver",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "env_vars": {+ "name": "env_vars",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "environments_status_idx": {+ "name": "environments_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "environments_local_driver_idx": {+ "name": "environments_local_driver_idx",+ "columns": [+ {+ "expression": "driver",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"environments\".\"driver\" = 'local'",+ "concurrently": false+ },+ "environments_managed_sandbox_idx": {+ "name": "environments_managed_sandbox_idx",+ "columns": [+ {+ "expression": "driver",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"environments\".\"driver\" = 'sandbox' AND (\"environments\".\"metadata\" ->> 'managedByPaperclip')::boolean = true",+ "concurrently": false+ },+ "environments_name_idx": {+ "name": "environments_name_idx",+ "columns": [+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.execution_workspace_runtime_leases": {+ "name": "execution_workspace_runtime_leases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "owner_key": {+ "name": "owner_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "owner_issue_id": {+ "name": "owner_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_run_id": {+ "name": "owner_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_agent_id": {+ "name": "owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_action": {+ "name": "last_action",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "claimed_at": {+ "name": "claimed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "renewed_at": {+ "name": "renewed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "execution_workspace_runtime_leases_company_workspace_idx": {+ "name": "execution_workspace_runtime_leases_company_workspace_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "execution_workspace_runtime_leases_company_owner_idx": {+ "name": "execution_workspace_runtime_leases_company_owner_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "owner_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "execution_workspace_runtime_leases_expires_at_idx": {+ "name": "execution_workspace_runtime_leases_expires_at_idx",+ "columns": [+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "execution_workspace_runtime_leases_company_id_companies_id_fk": {+ "name": "execution_workspace_runtime_leases_company_id_companies_id_fk",+ "tableFrom": "execution_workspace_runtime_leases",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "execution_workspace_runtime_leases_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "execution_workspace_runtime_leases_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "execution_workspace_runtime_leases",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "execution_workspace_runtime_leases_owner_issue_id_issues_id_fk": {+ "name": "execution_workspace_runtime_leases_owner_issue_id_issues_id_fk",+ "tableFrom": "execution_workspace_runtime_leases",+ "columnsFrom": [+ "owner_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "execution_workspace_runtime_leases_owner_run_id_heartbeat_runs_id_fk": {+ "name": "execution_workspace_runtime_leases_owner_run_id_heartbeat_runs_id_fk",+ "tableFrom": "execution_workspace_runtime_leases",+ "columnsFrom": [+ "owner_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "execution_workspace_runtime_leases_owner_agent_id_agents_id_fk": {+ "name": "execution_workspace_runtime_leases_owner_agent_id_agents_id_fk",+ "tableFrom": "execution_workspace_runtime_leases",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "execution_workspace_runtime_leases_execution_workspace_id_unique": {+ "name": "execution_workspace_runtime_leases_execution_workspace_id_unique",+ "columns": [+ "execution_workspace_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.execution_workspaces": {+ "name": "execution_workspaces",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_workspace_id": {+ "name": "project_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "mode": {+ "name": "mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "strategy_type": {+ "name": "strategy_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "cwd": {+ "name": "cwd",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "repo_url": {+ "name": "repo_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "base_ref": {+ "name": "base_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "branch_name": {+ "name": "branch_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_type": {+ "name": "provider_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_fs'"+ },+ "provider_ref": {+ "name": "provider_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "derived_from_execution_workspace_id": {+ "name": "derived_from_execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "opened_at": {+ "name": "opened_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "closed_at": {+ "name": "closed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "cleanup_eligible_at": {+ "name": "cleanup_eligible_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "cleanup_reason": {+ "name": "cleanup_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "execution_workspaces_company_project_status_idx": {+ "name": "execution_workspaces_company_project_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "execution_workspaces_company_project_workspace_status_idx": {+ "name": "execution_workspaces_company_project_workspace_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "execution_workspaces_company_source_issue_idx": {+ "name": "execution_workspaces_company_source_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "execution_workspaces_company_last_used_idx": {+ "name": "execution_workspaces_company_last_used_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "last_used_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "execution_workspaces_company_branch_idx": {+ "name": "execution_workspaces_company_branch_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "branch_name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "execution_workspaces_company_id_companies_id_fk": {+ "name": "execution_workspaces_company_id_companies_id_fk",+ "tableFrom": "execution_workspaces",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "execution_workspaces_project_id_projects_id_fk": {+ "name": "execution_workspaces_project_id_projects_id_fk",+ "tableFrom": "execution_workspaces",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "execution_workspaces_project_workspace_id_project_workspaces_id_fk": {+ "name": "execution_workspaces_project_workspace_id_project_workspaces_id_fk",+ "tableFrom": "execution_workspaces",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "tableTo": "project_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "execution_workspaces_source_issue_id_issues_id_fk": {+ "name": "execution_workspaces_source_issue_id_issues_id_fk",+ "tableFrom": "execution_workspaces",+ "columnsFrom": [+ "source_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "execution_workspaces",+ "columnsFrom": [+ "derived_from_execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.external_object_mentions": {+ "name": "external_object_mentions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_record_id": {+ "name": "source_record_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "document_key": {+ "name": "document_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "property_key": {+ "name": "property_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "matched_text_redacted": {+ "name": "matched_text_redacted",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sanitized_display_url": {+ "name": "sanitized_display_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "canonical_identity_hash": {+ "name": "canonical_identity_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "canonical_identity": {+ "name": "canonical_identity",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "object_id": {+ "name": "object_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider_key": {+ "name": "provider_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "detector_key": {+ "name": "detector_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "object_type": {+ "name": "object_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "confidence": {+ "name": "confidence",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'exact'"+ },+ "created_by_plugin_id": {+ "name": "created_by_plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "external_object_mentions_company_source_issue_idx": {+ "name": "external_object_mentions_company_source_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_object_mentions_company_object_idx": {+ "name": "external_object_mentions_company_object_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "object_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_object_mentions_company_provider_idx": {+ "name": "external_object_mentions_company_provider_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "object_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_object_mentions_company_source_record_uq": {+ "name": "external_object_mentions_company_source_record_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_record_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "property_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "canonical_identity_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"external_object_mentions\".\"source_record_id\" is not null and \"external_object_mentions\".\"canonical_identity_hash\" is not null",+ "concurrently": false+ },+ "external_object_mentions_company_source_null_record_uq": {+ "name": "external_object_mentions_company_source_null_record_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "property_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "canonical_identity_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"external_object_mentions\".\"source_record_id\" is null and \"external_object_mentions\".\"canonical_identity_hash\" is not null",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "external_object_mentions_company_id_companies_id_fk": {+ "name": "external_object_mentions_company_id_companies_id_fk",+ "tableFrom": "external_object_mentions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "external_object_mentions_source_issue_id_issues_id_fk": {+ "name": "external_object_mentions_source_issue_id_issues_id_fk",+ "tableFrom": "external_object_mentions",+ "columnsFrom": [+ "source_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "external_object_mentions_object_id_external_objects_id_fk": {+ "name": "external_object_mentions_object_id_external_objects_id_fk",+ "tableFrom": "external_object_mentions",+ "columnsFrom": [+ "object_id"+ ],+ "tableTo": "external_objects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "external_object_mentions_created_by_plugin_id_plugins_id_fk": {+ "name": "external_object_mentions_created_by_plugin_id_plugins_id_fk",+ "tableFrom": "external_object_mentions",+ "columnsFrom": [+ "created_by_plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.external_objects": {+ "name": "external_objects",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "provider_key": {+ "name": "provider_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "object_type": {+ "name": "object_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sanitized_canonical_url": {+ "name": "sanitized_canonical_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "canonical_identity_hash": {+ "name": "canonical_identity_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_key": {+ "name": "display_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "icon_key": {+ "name": "icon_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_title": {+ "name": "display_title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status_key": {+ "name": "status_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status_label": {+ "name": "status_label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status_icon_key": {+ "name": "status_icon_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status_category": {+ "name": "status_category",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "status_tone": {+ "name": "status_tone",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'neutral'"+ },+ "liveness": {+ "name": "liveness",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "is_terminal": {+ "name": "is_terminal",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "remote_version": {+ "name": "remote_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "etag": {+ "name": "etag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_resolved_at": {+ "name": "last_resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_changed_at": {+ "name": "last_changed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error_at": {+ "name": "last_error_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "next_refresh_at": {+ "name": "next_refresh_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_started_at": {+ "name": "refresh_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_error_code": {+ "name": "last_error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_error_message": {+ "name": "last_error_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "external_objects_company_provider_object_idx": {+ "name": "external_objects_company_provider_object_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "object_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_objects_company_provider_status_idx": {+ "name": "external_objects_company_provider_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status_category",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_objects_company_refresh_idx": {+ "name": "external_objects_company_refresh_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_refresh_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_objects_company_external_id_uq": {+ "name": "external_objects_company_external_id_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "object_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "external_objects_company_identity_uq": {+ "name": "external_objects_company_identity_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "object_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "canonical_identity_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "external_objects_company_id_companies_id_fk": {+ "name": "external_objects_company_id_companies_id_fk",+ "tableFrom": "external_objects",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "external_objects_plugin_id_plugins_id_fk": {+ "name": "external_objects_plugin_id_plugins_id_fk",+ "tableFrom": "external_objects",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.feedback_exports": {+ "name": "feedback_exports",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "feedback_vote_id": {+ "name": "feedback_vote_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "vote": {+ "name": "vote",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_only'"+ },+ "destination": {+ "name": "destination",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "export_id": {+ "name": "export_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "consent_version": {+ "name": "consent_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "schema_version": {+ "name": "schema_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'paperclip-feedback-envelope-v2'"+ },+ "bundle_version": {+ "name": "bundle_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'paperclip-feedback-bundle-v2'"+ },+ "payload_version": {+ "name": "payload_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'paperclip-feedback-v1'"+ },+ "payload_digest": {+ "name": "payload_digest",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload_snapshot": {+ "name": "payload_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "target_summary": {+ "name": "target_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "redaction_summary": {+ "name": "redaction_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "attempt_count": {+ "name": "attempt_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_attempted_at": {+ "name": "last_attempted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "exported_at": {+ "name": "exported_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "feedback_exports_feedback_vote_idx": {+ "name": "feedback_exports_feedback_vote_idx",+ "columns": [+ {+ "expression": "feedback_vote_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_exports_company_created_idx": {+ "name": "feedback_exports_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_exports_company_status_idx": {+ "name": "feedback_exports_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_exports_company_issue_idx": {+ "name": "feedback_exports_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_exports_company_project_idx": {+ "name": "feedback_exports_company_project_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_exports_company_author_idx": {+ "name": "feedback_exports_company_author_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "feedback_exports_company_id_companies_id_fk": {+ "name": "feedback_exports_company_id_companies_id_fk",+ "tableFrom": "feedback_exports",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "feedback_exports_feedback_vote_id_feedback_votes_id_fk": {+ "name": "feedback_exports_feedback_vote_id_feedback_votes_id_fk",+ "tableFrom": "feedback_exports",+ "columnsFrom": [+ "feedback_vote_id"+ ],+ "tableTo": "feedback_votes",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "feedback_exports_issue_id_issues_id_fk": {+ "name": "feedback_exports_issue_id_issues_id_fk",+ "tableFrom": "feedback_exports",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "feedback_exports_project_id_projects_id_fk": {+ "name": "feedback_exports_project_id_projects_id_fk",+ "tableFrom": "feedback_exports",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.feedback_votes": {+ "name": "feedback_votes",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "vote": {+ "name": "vote",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "shared_with_labs": {+ "name": "shared_with_labs",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "shared_at": {+ "name": "shared_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "consent_version": {+ "name": "consent_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "redaction_summary": {+ "name": "redaction_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "feedback_votes_company_issue_idx": {+ "name": "feedback_votes_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_votes_issue_target_idx": {+ "name": "feedback_votes_issue_target_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_votes_author_idx": {+ "name": "feedback_votes_author_idx",+ "columns": [+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "feedback_votes_company_target_author_idx": {+ "name": "feedback_votes_company_target_author_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "feedback_votes_company_id_companies_id_fk": {+ "name": "feedback_votes_company_id_companies_id_fk",+ "tableFrom": "feedback_votes",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "feedback_votes_issue_id_issues_id_fk": {+ "name": "feedback_votes_issue_id_issues_id_fk",+ "tableFrom": "feedback_votes",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.finance_events": {+ "name": "finance_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_run_id": {+ "name": "heartbeat_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "cost_event_id": {+ "name": "cost_event_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "billing_code": {+ "name": "billing_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "event_kind": {+ "name": "event_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "direction": {+ "name": "direction",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'debit'"+ },+ "biller": {+ "name": "biller",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "execution_adapter_type": {+ "name": "execution_adapter_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pricing_tier": {+ "name": "pricing_tier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "quantity": {+ "name": "quantity",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "unit": {+ "name": "unit",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "amount_cents": {+ "name": "amount_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "currency": {+ "name": "currency",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'USD'"+ },+ "estimated": {+ "name": "estimated",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "external_invoice_id": {+ "name": "external_invoice_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata_json": {+ "name": "metadata_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "occurred_at": {+ "name": "occurred_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "finance_events_company_occurred_idx": {+ "name": "finance_events_company_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "finance_events_company_biller_occurred_idx": {+ "name": "finance_events_company_biller_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "biller",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "finance_events_company_kind_occurred_idx": {+ "name": "finance_events_company_kind_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "event_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "finance_events_company_direction_occurred_idx": {+ "name": "finance_events_company_direction_occurred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "direction",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "occurred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "finance_events_company_heartbeat_run_idx": {+ "name": "finance_events_company_heartbeat_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "heartbeat_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "finance_events_company_cost_event_idx": {+ "name": "finance_events_company_cost_event_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "cost_event_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "finance_events_company_id_companies_id_fk": {+ "name": "finance_events_company_id_companies_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "finance_events_agent_id_agents_id_fk": {+ "name": "finance_events_agent_id_agents_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "finance_events_issue_id_issues_id_fk": {+ "name": "finance_events_issue_id_issues_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "finance_events_project_id_projects_id_fk": {+ "name": "finance_events_project_id_projects_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "finance_events_goal_id_goals_id_fk": {+ "name": "finance_events_goal_id_goals_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "finance_events_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "finance_events_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "finance_events_cost_event_id_cost_events_id_fk": {+ "name": "finance_events_cost_event_id_cost_events_id_fk",+ "tableFrom": "finance_events",+ "columnsFrom": [+ "cost_event_id"+ ],+ "tableTo": "cost_events",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.folders": {+ "name": "folders",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "system_key": {+ "name": "system_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "folders_company_kind_position_idx": {+ "name": "folders_company_kind_position_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "folders_company_kind_root_slug_uq": {+ "name": "folders_company_kind_root_slug_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"folders\".\"parent_id\" is null",+ "concurrently": false+ },+ "folders_company_kind_parent_slug_uq": {+ "name": "folders_company_kind_parent_slug_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"folders\".\"parent_id\" is not null",+ "concurrently": false+ },+ "folders_company_kind_system_key_uq": {+ "name": "folders_company_kind_system_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "system_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"folders\".\"system_key\" is not null",+ "concurrently": false+ },+ "folders_company_kind_parent_position_idx": {+ "name": "folders_company_kind_parent_position_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "folders_company_id_companies_id_fk": {+ "name": "folders_company_id_companies_id_fk",+ "tableFrom": "folders",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "folders_parent_id_folders_id_fk": {+ "name": "folders_parent_id_folders_id_fk",+ "tableFrom": "folders",+ "columnsFrom": [+ "parent_id"+ ],+ "tableTo": "folders",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "restrict"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goals": {+ "name": "goals",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "level": {+ "name": "level",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'task'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planned'"+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_agent_id": {+ "name": "owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goals_company_idx": {+ "name": "goals_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "goals_company_id_companies_id_fk": {+ "name": "goals_company_id_companies_id_fk",+ "tableFrom": "goals",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "goals_parent_id_goals_id_fk": {+ "name": "goals_parent_id_goals_id_fk",+ "tableFrom": "goals",+ "columnsFrom": [+ "parent_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "goals_owner_agent_id_agents_id_fk": {+ "name": "goals_owner_agent_id_agents_id_fk",+ "tableFrom": "goals",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.heartbeat_run_events": {+ "name": "heartbeat_run_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "bigserial",+ "primaryKey": true,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "seq": {+ "name": "seq",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "stream": {+ "name": "stream",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "level": {+ "name": "level",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "message": {+ "name": "message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source_instance_id": {+ "name": "source_instance_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_event_id": {+ "name": "source_event_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_seq": {+ "name": "source_seq",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "source_payload_sha256": {+ "name": "source_payload_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "protocol_schema_version": {+ "name": "protocol_schema_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "heartbeat_run_events_run_seq_uq": {+ "name": "heartbeat_run_events_run_seq_uq",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "seq",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_run_events_run_source_event_uq": {+ "name": "heartbeat_run_events_run_source_event_uq",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_event_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"heartbeat_run_events\".\"source_event_id\" is not null",+ "concurrently": false+ },+ "heartbeat_run_events_run_source_seq_uq": {+ "name": "heartbeat_run_events_run_source_seq_uq",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_instance_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_seq",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"heartbeat_run_events\".\"source_instance_id\" is not null and \"heartbeat_run_events\".\"source_seq\" is not null",+ "concurrently": false+ },+ "heartbeat_run_events_company_run_idx": {+ "name": "heartbeat_run_events_company_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_run_events_company_created_idx": {+ "name": "heartbeat_run_events_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "heartbeat_run_events_company_id_companies_id_fk": {+ "name": "heartbeat_run_events_company_id_companies_id_fk",+ "tableFrom": "heartbeat_run_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "heartbeat_run_events_run_id_heartbeat_runs_id_fk": {+ "name": "heartbeat_run_events_run_id_heartbeat_runs_id_fk",+ "tableFrom": "heartbeat_run_events",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "heartbeat_run_events_agent_id_agents_id_fk": {+ "name": "heartbeat_run_events_agent_id_agents_id_fk",+ "tableFrom": "heartbeat_run_events",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.heartbeat_run_watchdog_decisions": {+ "name": "heartbeat_run_watchdog_decisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "evaluation_issue_id": {+ "name": "evaluation_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "decision": {+ "name": "decision",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "heartbeat_run_watchdog_decisions_company_run_created_idx": {+ "name": "heartbeat_run_watchdog_decisions_company_run_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_run_watchdog_decisions_company_run_snooze_idx": {+ "name": "heartbeat_run_watchdog_decisions_company_run_snooze_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "snoozed_until",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "heartbeat_run_watchdog_decisions_company_id_companies_id_fk": {+ "name": "heartbeat_run_watchdog_decisions_company_id_companies_id_fk",+ "tableFrom": "heartbeat_run_watchdog_decisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk": {+ "name": "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk",+ "tableFrom": "heartbeat_run_watchdog_decisions",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk": {+ "name": "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk",+ "tableFrom": "heartbeat_run_watchdog_decisions",+ "columnsFrom": [+ "evaluation_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk": {+ "name": "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk",+ "tableFrom": "heartbeat_run_watchdog_decisions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "heartbeat_run_watchdog_decisions",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.heartbeat_runs": {+ "name": "heartbeat_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "invocation_source": {+ "name": "invocation_source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'on_demand'"+ },+ "trigger_detail": {+ "name": "trigger_detail",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'queued'"+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "wakeup_request_id": {+ "name": "wakeup_request_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "exit_code": {+ "name": "exit_code",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "signal": {+ "name": "signal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "usage_json": {+ "name": "usage_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "result_json": {+ "name": "result_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "runtime_mode": {+ "name": "runtime_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'legacy'"+ },+ "runtime_mode_resolver_version": {+ "name": "runtime_mode_resolver_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runtime_mode_reason": {+ "name": "runtime_mode_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runtime_mode_resolved_at": {+ "name": "runtime_mode_resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "runner_profile_json": {+ "name": "runner_profile_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "runner_instance_id": {+ "name": "runner_instance_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "native_session_id": {+ "name": "native_session_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "native_issue_id": {+ "name": "native_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "driver_kind": {+ "name": "driver_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "driver_version": {+ "name": "driver_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "completion_contract_id": {+ "name": "completion_contract_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "completion_contract_sha256": {+ "name": "completion_contract_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "next_event_seq": {+ "name": "next_event_seq",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "native_phase": {+ "name": "native_phase",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "native_phase_updated_at": {+ "name": "native_phase_updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "session_id_before": {+ "name": "session_id_before",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "session_id_after": {+ "name": "session_id_after",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_store": {+ "name": "log_store",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_ref": {+ "name": "log_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_bytes": {+ "name": "log_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "log_sha256": {+ "name": "log_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_compressed": {+ "name": "log_compressed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "stdout_excerpt": {+ "name": "stdout_excerpt",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "stderr_excerpt": {+ "name": "stderr_excerpt",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "external_run_id": {+ "name": "external_run_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "process_pid": {+ "name": "process_pid",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "process_group_id": {+ "name": "process_group_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "process_started_at": {+ "name": "process_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_output_at": {+ "name": "last_output_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_output_seq": {+ "name": "last_output_seq",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_output_stream": {+ "name": "last_output_stream",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_output_bytes": {+ "name": "last_output_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "retry_of_run_id": {+ "name": "retry_of_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "process_loss_retry_count": {+ "name": "process_loss_retry_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "scheduled_retry_at": {+ "name": "scheduled_retry_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "scheduled_retry_attempt": {+ "name": "scheduled_retry_attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "scheduled_retry_reason": {+ "name": "scheduled_retry_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "issue_comment_status": {+ "name": "issue_comment_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'not_applicable'"+ },+ "issue_comment_satisfied_by_comment_id": {+ "name": "issue_comment_satisfied_by_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_comment_retry_queued_at": {+ "name": "issue_comment_retry_queued_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "liveness_state": {+ "name": "liveness_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "liveness_reason": {+ "name": "liveness_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "continuation_attempt": {+ "name": "continuation_attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_useful_action_at": {+ "name": "last_useful_action_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "next_action": {+ "name": "next_action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "context_snapshot": {+ "name": "context_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "heartbeat_runs_company_agent_started_idx": {+ "name": "heartbeat_runs_company_agent_started_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_responsible_user_idx": {+ "name": "heartbeat_runs_company_responsible_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "responsible_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_liveness_idx": {+ "name": "heartbeat_runs_company_liveness_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "liveness_state",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_status_last_output_idx": {+ "name": "heartbeat_runs_company_status_last_output_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "last_output_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_status_process_started_idx": {+ "name": "heartbeat_runs_company_status_process_started_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "process_started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_created_at_desc_idx": {+ "name": "heartbeat_runs_company_created_at_desc_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_ctx_issue_created_idx": {+ "name": "heartbeat_runs_company_ctx_issue_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "(\"context_snapshot\" ->> 'issueId')",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_ctx_task_created_idx": {+ "name": "heartbeat_runs_company_ctx_task_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "(\"context_snapshot\" ->> 'taskId')",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "heartbeat_runs_company_ctx_taskkey_created_idx": {+ "name": "heartbeat_runs_company_ctx_taskkey_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "(\"context_snapshot\" ->> 'taskKey')",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "heartbeat_runs_company_id_companies_id_fk": {+ "name": "heartbeat_runs_company_id_companies_id_fk",+ "tableFrom": "heartbeat_runs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "heartbeat_runs_agent_id_agents_id_fk": {+ "name": "heartbeat_runs_agent_id_agents_id_fk",+ "tableFrom": "heartbeat_runs",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": {+ "name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk",+ "tableFrom": "heartbeat_runs",+ "columnsFrom": [+ "wakeup_request_id"+ ],+ "tableTo": "agent_wakeup_requests",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk": {+ "name": "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk",+ "tableFrom": "heartbeat_runs",+ "columnsFrom": [+ "retry_of_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "heartbeat_runs_company_native_issue_id_uq": {+ "name": "heartbeat_runs_company_native_issue_id_uq",+ "columns": [+ "company_id",+ "native_issue_id",+ "id"+ ],+ "nullsNotDistinct": false+ },+ "heartbeat_runs_company_native_issue_contract_id_uq": {+ "name": "heartbeat_runs_company_native_issue_contract_id_uq",+ "columns": [+ "company_id",+ "native_issue_id",+ "id",+ "completion_contract_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.inbox_dismissals": {+ "name": "inbox_dismissals",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "item_key": {+ "name": "item_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'dismiss'"+ },+ "dismissed_at": {+ "name": "dismissed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "inbox_dismissals_company_user_idx": {+ "name": "inbox_dismissals_company_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "inbox_dismissals_company_item_idx": {+ "name": "inbox_dismissals_company_item_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "inbox_dismissals_company_user_item_idx": {+ "name": "inbox_dismissals_company_user_item_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "inbox_dismissals_company_id_companies_id_fk": {+ "name": "inbox_dismissals_company_id_companies_id_fk",+ "tableFrom": "inbox_dismissals",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.connection_grant_delegations": {+ "name": "connection_grant_delegations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "grant_id": {+ "name": "grant_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "connection_grant_delegations_company_agent_idx": {+ "name": "connection_grant_delegations_company_agent_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_grant_delegations_grant_agent_uq": {+ "name": "connection_grant_delegations_grant_agent_uq",+ "columns": [+ {+ "expression": "grant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "connection_grant_delegations_company_id_companies_id_fk": {+ "name": "connection_grant_delegations_company_id_companies_id_fk",+ "tableFrom": "connection_grant_delegations",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_grant_delegations_agent_id_agents_id_fk": {+ "name": "connection_grant_delegations_agent_id_agents_id_fk",+ "tableFrom": "connection_grant_delegations",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_grant_delegations_company_grant_fk": {+ "name": "connection_grant_delegations_company_grant_fk",+ "tableFrom": "connection_grant_delegations",+ "columnsFrom": [+ "company_id",+ "grant_id"+ ],+ "tableTo": "connection_grants",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.connection_grant_members": {+ "name": "connection_grant_members",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "grant_id": {+ "name": "grant_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subject_id": {+ "name": "subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "connection_grant_members_company_subject_idx": {+ "name": "connection_grant_members_company_subject_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_grant_members_grant_subject_uq": {+ "name": "connection_grant_members_grant_subject_uq",+ "columns": [+ {+ "expression": "grant_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "connection_grant_members_company_id_companies_id_fk": {+ "name": "connection_grant_members_company_id_companies_id_fk",+ "tableFrom": "connection_grant_members",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_grant_members_company_grant_fk": {+ "name": "connection_grant_members_company_grant_fk",+ "tableFrom": "connection_grant_members",+ "columnsFrom": [+ "company_id",+ "grant_id"+ ],+ "tableTo": "connection_grants",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "connection_grant_members_subject_type_check": {+ "name": "connection_grant_members_subject_type_check",+ "value": "\"connection_grant_members\".\"subject_type\" in ('user')"+ }+ },+ "isRLSEnabled": false+ },+ "public.connection_grants": {+ "name": "connection_grants",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subject_user_id": {+ "name": "subject_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_tenant": {+ "name": "provider_tenant",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "credential_secret_refs": {+ "name": "credential_secret_refs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "external_credential": {+ "name": "external_credential",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_by_agent_id": {+ "name": "revoked_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_by_user_id": {+ "name": "revoked_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "connection_grants_company_connection_idx": {+ "name": "connection_grants_company_connection_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_grants_subject_user_idx": {+ "name": "connection_grants_subject_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_grants_user_uq": {+ "name": "connection_grants_user_uq",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_grants_default_uq": {+ "name": "connection_grants_default_uq",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"connection_grants\".\"is_default\" = true and \"connection_grants\".\"kind\" = 'organization'",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "connection_grants_company_id_companies_id_fk": {+ "name": "connection_grants_company_id_companies_id_fk",+ "tableFrom": "connection_grants",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_grants_created_by_agent_id_agents_id_fk": {+ "name": "connection_grants_created_by_agent_id_agents_id_fk",+ "tableFrom": "connection_grants",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "connection_grants_revoked_by_agent_id_agents_id_fk": {+ "name": "connection_grants_revoked_by_agent_id_agents_id_fk",+ "tableFrom": "connection_grants",+ "columnsFrom": [+ "revoked_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "connection_grants_company_connection_fk": {+ "name": "connection_grants_company_connection_fk",+ "tableFrom": "connection_grants",+ "columnsFrom": [+ "company_id",+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "connection_grants_company_id_uq": {+ "name": "connection_grants_company_id_uq",+ "columns": [+ "company_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "connection_grants_kind_check": {+ "name": "connection_grants_kind_check",+ "value": "\"connection_grants\".\"kind\" in ('organization', 'user')"+ },+ "connection_grants_status_check": {+ "name": "connection_grants_status_check",+ "value": "\"connection_grants\".\"status\" in ('active', 'revoked', 'expired', 'needs_reauthorization')"+ },+ "connection_grants_credential_source_one_of_check": {+ "name": "connection_grants_credential_source_one_of_check",+ "value": "\"connection_grants\".\"external_credential\" is null or jsonb_array_length(\"connection_grants\".\"credential_secret_refs\") = 0"+ },+ "connection_grants_subject_check": {+ "name": "connection_grants_subject_check",+ "value": "(\"connection_grants\".\"kind\" = 'user' and \"connection_grants\".\"subject_user_id\" is not null) or (\"connection_grants\".\"kind\" = 'organization' and \"connection_grants\".\"subject_user_id\" is null)"+ },+ "connection_grants_default_check": {+ "name": "connection_grants_default_check",+ "value": "\"connection_grants\".\"is_default\" = false or \"connection_grants\".\"kind\" = 'organization'"+ }+ },+ "isRLSEnabled": false+ },+ "public.connection_token_issuances": {+ "name": "connection_token_issuances",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "path": {+ "name": "path",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "requested_scope": {+ "name": "requested_scope",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "issued_scope": {+ "name": "issued_scope",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "ttl_seconds": {+ "name": "ttl_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "token_hash": {+ "name": "token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "connection_token_issuances_company_created_idx": {+ "name": "connection_token_issuances_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_token_issuances_connection_created_idx": {+ "name": "connection_token_issuances_connection_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_token_issuances_agent_connection_idx": {+ "name": "connection_token_issuances_agent_connection_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "connection_token_issuances_run_idx": {+ "name": "connection_token_issuances_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "connection_token_issuances_company_id_companies_id_fk": {+ "name": "connection_token_issuances_company_id_companies_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_token_issuances_application_id_tool_applications_id_fk": {+ "name": "connection_token_issuances_application_id_tool_applications_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "connection_token_issuances_connection_id_tool_connections_id_fk": {+ "name": "connection_token_issuances_connection_id_tool_connections_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_token_issuances_agent_id_agents_id_fk": {+ "name": "connection_token_issuances_agent_id_agents_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "connection_token_issuances_run_id_heartbeat_runs_id_fk": {+ "name": "connection_token_issuances_run_id_heartbeat_runs_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "connection_token_issuances_issue_id_issues_id_fk": {+ "name": "connection_token_issuances_issue_id_issues_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "connection_token_issuances_project_id_projects_id_fk": {+ "name": "connection_token_issuances_project_id_projects_id_fk",+ "tableFrom": "connection_token_issuances",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.instance_settings": {+ "name": "instance_settings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "singleton_key": {+ "name": "singleton_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "default_environment_id": {+ "name": "default_environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "general": {+ "name": "general",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "experimental": {+ "name": "experimental",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "instance_settings_singleton_key_idx": {+ "name": "instance_settings_singleton_key_idx",+ "columns": [+ {+ "expression": "singleton_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "instance_settings_default_environment_id_environments_id_fk": {+ "name": "instance_settings_default_environment_id_environments_id_fk",+ "tableFrom": "instance_settings",+ "columnsFrom": [+ "default_environment_id"+ ],+ "tableTo": "environments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.instance_user_roles": {+ "name": "instance_user_roles",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'instance_admin'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "instance_user_roles_user_role_unique_idx": {+ "name": "instance_user_roles_user_role_unique_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "role",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "instance_user_roles_role_idx": {+ "name": "instance_user_roles_role_idx",+ "columns": [+ {+ "expression": "role",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.invites": {+ "name": "invites",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "invite_type": {+ "name": "invite_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'company_join'"+ },+ "token_hash": {+ "name": "token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "allowed_join_types": {+ "name": "allowed_join_types",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'both'"+ },+ "defaults_payload": {+ "name": "defaults_payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "invited_by_user_id": {+ "name": "invited_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accepted_at": {+ "name": "accepted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "invites_token_hash_unique_idx": {+ "name": "invites_token_hash_unique_idx",+ "columns": [+ {+ "expression": "token_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "invites_company_invite_state_idx": {+ "name": "invites_company_invite_state_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "invite_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "revoked_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "invites_company_id_companies_id_fk": {+ "name": "invites_company_id_companies_id_fk",+ "tableFrom": "invites",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_approvals": {+ "name": "issue_approvals",+ "schema": "",+ "columns": {+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "approval_id": {+ "name": "approval_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "linked_by_agent_id": {+ "name": "linked_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "linked_by_user_id": {+ "name": "linked_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_approvals_issue_idx": {+ "name": "issue_approvals_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_approvals_approval_idx": {+ "name": "issue_approvals_approval_idx",+ "columns": [+ {+ "expression": "approval_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_approvals_company_idx": {+ "name": "issue_approvals_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_approvals_company_id_companies_id_fk": {+ "name": "issue_approvals_company_id_companies_id_fk",+ "tableFrom": "issue_approvals",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_approvals_issue_id_issues_id_fk": {+ "name": "issue_approvals_issue_id_issues_id_fk",+ "tableFrom": "issue_approvals",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_approvals_approval_id_approvals_id_fk": {+ "name": "issue_approvals_approval_id_approvals_id_fk",+ "tableFrom": "issue_approvals",+ "columnsFrom": [+ "approval_id"+ ],+ "tableTo": "approvals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_approvals_linked_by_agent_id_agents_id_fk": {+ "name": "issue_approvals_linked_by_agent_id_agents_id_fk",+ "tableFrom": "issue_approvals",+ "columnsFrom": [+ "linked_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {+ "issue_approvals_pk": {+ "name": "issue_approvals_pk",+ "columns": [+ "issue_id",+ "approval_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_attachments": {+ "name": "issue_attachments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "asset_id": {+ "name": "asset_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_comment_id": {+ "name": "issue_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_attachments_company_issue_idx": {+ "name": "issue_attachments_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_attachments_issue_comment_idx": {+ "name": "issue_attachments_issue_comment_idx",+ "columns": [+ {+ "expression": "issue_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_attachments_asset_uq": {+ "name": "issue_attachments_asset_uq",+ "columns": [+ {+ "expression": "asset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_attachments_company_id_companies_id_fk": {+ "name": "issue_attachments_company_id_companies_id_fk",+ "tableFrom": "issue_attachments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_attachments_issue_id_issues_id_fk": {+ "name": "issue_attachments_issue_id_issues_id_fk",+ "tableFrom": "issue_attachments",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_attachments_asset_id_assets_id_fk": {+ "name": "issue_attachments_asset_id_assets_id_fk",+ "tableFrom": "issue_attachments",+ "columnsFrom": [+ "asset_id"+ ],+ "tableTo": "assets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_attachments_issue_comment_id_issue_comments_id_fk": {+ "name": "issue_attachments_issue_comment_id_issue_comments_id_fk",+ "tableFrom": "issue_attachments",+ "columnsFrom": [+ "issue_comment_id"+ ],+ "tableTo": "issue_comments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_comments": {+ "name": "issue_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "author_agent_id": {+ "name": "author_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "on_behalf_of_user_id": {+ "name": "on_behalf_of_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "author_type": {+ "name": "author_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "derived_author_agent_id": {+ "name": "derived_author_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "derived_created_by_run_id": {+ "name": "derived_created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "derived_author_source": {+ "name": "derived_author_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "presentation": {+ "name": "presentation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_by_type": {+ "name": "deleted_by_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_by_agent_id": {+ "name": "deleted_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_by_user_id": {+ "name": "deleted_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_by_run_id": {+ "name": "deleted_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source_trust": {+ "name": "source_trust",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_comments_issue_idx": {+ "name": "issue_comments_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_comments_company_idx": {+ "name": "issue_comments_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_comments_company_issue_created_at_idx": {+ "name": "issue_comments_company_issue_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_comments_company_author_issue_created_at_idx": {+ "name": "issue_comments_company_author_issue_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_comments_body_search_idx": {+ "name": "issue_comments_body_search_idx",+ "columns": [+ {+ "expression": "body",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_comments_company_id_companies_id_fk": {+ "name": "issue_comments_company_id_companies_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_comments_issue_id_issues_id_fk": {+ "name": "issue_comments_issue_id_issues_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_comments_author_agent_id_agents_id_fk": {+ "name": "issue_comments_author_agent_id_agents_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "author_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_comments_on_behalf_of_user_id_user_id_fk": {+ "name": "issue_comments_on_behalf_of_user_id_user_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "on_behalf_of_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_comments_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_comments_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_comments_derived_author_agent_id_agents_id_fk": {+ "name": "issue_comments_derived_author_agent_id_agents_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "derived_author_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "derived_created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_comments_deleted_by_agent_id_agents_id_fk": {+ "name": "issue_comments_deleted_by_agent_id_agents_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "deleted_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_comments_deleted_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_comments_deleted_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_comments",+ "columnsFrom": [+ "deleted_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_create_idempotency_keys": {+ "name": "issue_create_idempotency_keys",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_create_idempotency_keys_company_key_uq": {+ "name": "issue_create_idempotency_keys_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_create_idempotency_keys_issue_idx": {+ "name": "issue_create_idempotency_keys_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_create_idempotency_keys_company_created_at_idx": {+ "name": "issue_create_idempotency_keys_company_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_create_idempotency_keys_company_id_companies_id_fk": {+ "name": "issue_create_idempotency_keys_company_id_companies_id_fk",+ "tableFrom": "issue_create_idempotency_keys",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_create_idempotency_keys_issue_id_issues_id_fk": {+ "name": "issue_create_idempotency_keys_issue_id_issues_id_fk",+ "tableFrom": "issue_create_idempotency_keys",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_documents": {+ "name": "issue_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_documents_company_issue_key_uq": {+ "name": "issue_documents_company_issue_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_documents_document_uq": {+ "name": "issue_documents_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_documents_company_issue_updated_idx": {+ "name": "issue_documents_company_issue_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_documents_company_id_companies_id_fk": {+ "name": "issue_documents_company_id_companies_id_fk",+ "tableFrom": "issue_documents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_documents_issue_id_issues_id_fk": {+ "name": "issue_documents_issue_id_issues_id_fk",+ "tableFrom": "issue_documents",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_documents_document_id_documents_id_fk": {+ "name": "issue_documents_document_id_documents_id_fk",+ "tableFrom": "issue_documents",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_execution_decisions": {+ "name": "issue_execution_decisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "stage_id": {+ "name": "stage_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "stage_type": {+ "name": "stage_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_agent_id": {+ "name": "actor_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_execution_decisions_company_issue_idx": {+ "name": "issue_execution_decisions_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_execution_decisions_stage_idx": {+ "name": "issue_execution_decisions_stage_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "stage_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_execution_decisions_company_id_companies_id_fk": {+ "name": "issue_execution_decisions_company_id_companies_id_fk",+ "tableFrom": "issue_execution_decisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_execution_decisions_issue_id_issues_id_fk": {+ "name": "issue_execution_decisions_issue_id_issues_id_fk",+ "tableFrom": "issue_execution_decisions",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_execution_decisions_actor_agent_id_agents_id_fk": {+ "name": "issue_execution_decisions_actor_agent_id_agents_id_fk",+ "tableFrom": "issue_execution_decisions",+ "columnsFrom": [+ "actor_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_execution_decisions",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_inbox_archives": {+ "name": "issue_inbox_archives",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "archived_by_actor_type": {+ "name": "archived_by_actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'user'"+ },+ "archived_by_agent_id": {+ "name": "archived_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_run_id": {+ "name": "archived_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_inbox_archives_company_issue_idx": {+ "name": "issue_inbox_archives_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_inbox_archives_company_user_idx": {+ "name": "issue_inbox_archives_company_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_inbox_archives_company_issue_user_idx": {+ "name": "issue_inbox_archives_company_issue_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_inbox_archives_company_id_companies_id_fk": {+ "name": "issue_inbox_archives_company_id_companies_id_fk",+ "tableFrom": "issue_inbox_archives",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_inbox_archives_issue_id_issues_id_fk": {+ "name": "issue_inbox_archives_issue_id_issues_id_fk",+ "tableFrom": "issue_inbox_archives",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_inbox_archives_archived_by_agent_id_agents_id_fk": {+ "name": "issue_inbox_archives_archived_by_agent_id_agents_id_fk",+ "tableFrom": "issue_inbox_archives",+ "columnsFrom": [+ "archived_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_inbox_archives_archived_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_inbox_archives_archived_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_inbox_archives",+ "columnsFrom": [+ "archived_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_inbox_archives_archived_by_actor_type_check": {+ "name": "issue_inbox_archives_archived_by_actor_type_check",+ "value": "\"issue_inbox_archives\".\"archived_by_actor_type\" in ('user', 'agent')"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_labels": {+ "name": "issue_labels",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_labels_issue_idx": {+ "name": "issue_labels_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_labels_label_idx": {+ "name": "issue_labels_label_idx",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_labels_company_idx": {+ "name": "issue_labels_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_labels_issue_id_issues_id_fk": {+ "name": "issue_labels_issue_id_issues_id_fk",+ "tableFrom": "issue_labels",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_labels_label_id_labels_id_fk": {+ "name": "issue_labels_label_id_labels_id_fk",+ "tableFrom": "issue_labels",+ "columnsFrom": [+ "label_id"+ ],+ "tableTo": "labels",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_labels_company_id_companies_id_fk": {+ "name": "issue_labels_company_id_companies_id_fk",+ "tableFrom": "issue_labels",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "issue_labels_pk": {+ "name": "issue_labels_pk",+ "columns": [+ "issue_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_plan_decompositions": {+ "name": "issue_plan_decompositions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "accepted_plan_revision_id": {+ "name": "accepted_plan_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "accepted_interaction_id": {+ "name": "accepted_interaction_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'in_flight'"+ },+ "request_fingerprint": {+ "name": "request_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "requested_child_count": {+ "name": "requested_child_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "requested_children": {+ "name": "requested_children",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "child_issue_ids": {+ "name": "child_issue_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "owner_agent_id": {+ "name": "owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "owner_run_id": {+ "name": "owner_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_plan_decompositions_company_source_status_idx": {+ "name": "issue_plan_decompositions_company_source_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_plan_decompositions_active_owner_idx": {+ "name": "issue_plan_decompositions_active_owner_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "owner_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issue_plan_decompositions\".\"status\" = 'in_flight'",+ "concurrently": false+ },+ "issue_plan_decompositions_source_revision_uq": {+ "name": "issue_plan_decompositions_source_revision_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "accepted_plan_revision_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_plan_decompositions_company_id_companies_id_fk": {+ "name": "issue_plan_decompositions_company_id_companies_id_fk",+ "tableFrom": "issue_plan_decompositions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_plan_decompositions_source_issue_id_issues_id_fk": {+ "name": "issue_plan_decompositions_source_issue_id_issues_id_fk",+ "tableFrom": "issue_plan_decompositions",+ "columnsFrom": [+ "source_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk": {+ "name": "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk",+ "tableFrom": "issue_plan_decompositions",+ "columnsFrom": [+ "accepted_plan_revision_id"+ ],+ "tableTo": "document_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk": {+ "name": "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk",+ "tableFrom": "issue_plan_decompositions",+ "columnsFrom": [+ "accepted_interaction_id"+ ],+ "tableTo": "issue_thread_interactions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_plan_decompositions_owner_agent_id_agents_id_fk": {+ "name": "issue_plan_decompositions_owner_agent_id_agents_id_fk",+ "tableFrom": "issue_plan_decompositions",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk": {+ "name": "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_plan_decompositions",+ "columnsFrom": [+ "owner_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_question_response_deliveries": {+ "name": "issue_question_response_deliveries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "interaction_id": {+ "name": "interaction_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_run_id": {+ "name": "source_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "target_run_id": {+ "name": "target_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "target_turn_id": {+ "name": "target_turn_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "correlation_id": {+ "name": "correlation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "payload_sha256": {+ "name": "payload_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "delivery_mode": {+ "name": "delivery_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "attempt_count": {+ "name": "attempt_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "error_count": {+ "name": "error_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_attempt_at": {+ "name": "last_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "acknowledged_at": {+ "name": "acknowledged_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error_code": {+ "name": "last_error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_question_response_deliveries_interaction_uq": {+ "name": "issue_question_response_deliveries_interaction_uq",+ "columns": [+ {+ "expression": "interaction_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_question_response_deliveries_correlation_uq": {+ "name": "issue_question_response_deliveries_correlation_uq",+ "columns": [+ {+ "expression": "correlation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_question_response_deliveries_pending_idx": {+ "name": "issue_question_response_deliveries_pending_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_question_response_deliveries_company_issue_idx": {+ "name": "issue_question_response_deliveries_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_question_response_deliveries_company_id_companies_id_fk": {+ "name": "issue_question_response_deliveries_company_id_companies_id_fk",+ "tableFrom": "issue_question_response_deliveries",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_question_response_deliveries_issue_id_issues_id_fk": {+ "name": "issue_question_response_deliveries_issue_id_issues_id_fk",+ "tableFrom": "issue_question_response_deliveries",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_question_response_deliveries_interaction_id_issue_thread_interactions_id_fk": {+ "name": "issue_question_response_deliveries_interaction_id_issue_thread_interactions_id_fk",+ "tableFrom": "issue_question_response_deliveries",+ "columnsFrom": [+ "interaction_id"+ ],+ "tableTo": "issue_thread_interactions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_question_response_deliveries_source_run_id_heartbeat_runs_id_fk": {+ "name": "issue_question_response_deliveries_source_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_question_response_deliveries",+ "columnsFrom": [+ "source_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_question_response_deliveries_target_run_id_heartbeat_runs_id_fk": {+ "name": "issue_question_response_deliveries_target_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_question_response_deliveries",+ "columnsFrom": [+ "target_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_question_response_deliveries_status_check": {+ "name": "issue_question_response_deliveries_status_check",+ "value": "\"issue_question_response_deliveries\".\"status\" IN ('pending', 'delivering', 'delivered', 'fallback_queued', 'failed')"+ },+ "issue_question_response_deliveries_mode_check": {+ "name": "issue_question_response_deliveries_mode_check",+ "value": "\"issue_question_response_deliveries\".\"delivery_mode\" IS NULL OR \"issue_question_response_deliveries\".\"delivery_mode\" IN ('steered', 'coalesced', 'wake_fallback')"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_read_states": {+ "name": "issue_read_states",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "last_read_at": {+ "name": "last_read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_read_states_company_issue_idx": {+ "name": "issue_read_states_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_read_states_company_user_idx": {+ "name": "issue_read_states_company_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_read_states_company_issue_user_idx": {+ "name": "issue_read_states_company_issue_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_read_states_company_id_companies_id_fk": {+ "name": "issue_read_states_company_id_companies_id_fk",+ "tableFrom": "issue_read_states",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_read_states_issue_id_issues_id_fk": {+ "name": "issue_read_states_issue_id_issues_id_fk",+ "tableFrom": "issue_read_states",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_recovery_actions": {+ "name": "issue_recovery_actions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "recovery_issue_id": {+ "name": "recovery_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "owner_type": {+ "name": "owner_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'agent'"+ },+ "owner_agent_id": {+ "name": "owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "previous_owner_agent_id": {+ "name": "previous_owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "return_owner_agent_id": {+ "name": "return_owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "cause": {+ "name": "cause",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "fingerprint": {+ "name": "fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "evidence": {+ "name": "evidence",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "next_action": {+ "name": "next_action",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "wake_policy": {+ "name": "wake_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_policy": {+ "name": "monitor_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "attempt_count": {+ "name": "attempt_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "max_attempts": {+ "name": "max_attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "timeout_at": {+ "name": "timeout_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_attempt_at": {+ "name": "last_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolution_note": {+ "name": "resolution_note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_recovery_actions_company_source_status_idx": {+ "name": "issue_recovery_actions_company_source_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_recovery_actions_company_owner_status_idx": {+ "name": "issue_recovery_actions_company_owner_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "owner_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_recovery_actions_company_recovery_issue_idx": {+ "name": "issue_recovery_actions_company_recovery_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "recovery_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_recovery_actions_active_source_uq": {+ "name": "issue_recovery_actions_active_source_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')",+ "concurrently": false+ },+ "issue_recovery_actions_active_fingerprint_uq": {+ "name": "issue_recovery_actions_active_fingerprint_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "cause",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "fingerprint",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_recovery_actions_company_id_companies_id_fk": {+ "name": "issue_recovery_actions_company_id_companies_id_fk",+ "tableFrom": "issue_recovery_actions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_recovery_actions_source_issue_id_issues_id_fk": {+ "name": "issue_recovery_actions_source_issue_id_issues_id_fk",+ "tableFrom": "issue_recovery_actions",+ "columnsFrom": [+ "source_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_recovery_actions_recovery_issue_id_issues_id_fk": {+ "name": "issue_recovery_actions_recovery_issue_id_issues_id_fk",+ "tableFrom": "issue_recovery_actions",+ "columnsFrom": [+ "recovery_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_recovery_actions_owner_agent_id_agents_id_fk": {+ "name": "issue_recovery_actions_owner_agent_id_agents_id_fk",+ "tableFrom": "issue_recovery_actions",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_recovery_actions_previous_owner_agent_id_agents_id_fk": {+ "name": "issue_recovery_actions_previous_owner_agent_id_agents_id_fk",+ "tableFrom": "issue_recovery_actions",+ "columnsFrom": [+ "previous_owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_recovery_actions_return_owner_agent_id_agents_id_fk": {+ "name": "issue_recovery_actions_return_owner_agent_id_agents_id_fk",+ "tableFrom": "issue_recovery_actions",+ "columnsFrom": [+ "return_owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_reference_mentions": {+ "name": "issue_reference_mentions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_issue_id": {+ "name": "target_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "source_kind": {+ "name": "source_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_record_id": {+ "name": "source_record_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "document_key": {+ "name": "document_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "matched_text": {+ "name": "matched_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_reference_mentions_company_source_issue_idx": {+ "name": "issue_reference_mentions_company_source_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_reference_mentions_company_target_issue_idx": {+ "name": "issue_reference_mentions_company_target_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_reference_mentions_company_issue_pair_idx": {+ "name": "issue_reference_mentions_company_issue_pair_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_reference_mentions_company_source_mention_record_uq": {+ "name": "issue_reference_mentions_company_source_mention_record_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_record_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_reference_mentions\".\"source_record_id\" is not null",+ "concurrently": false+ },+ "issue_reference_mentions_company_source_mention_null_record_uq": {+ "name": "issue_reference_mentions_company_source_mention_null_record_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_reference_mentions\".\"source_record_id\" is null",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_reference_mentions_company_id_companies_id_fk": {+ "name": "issue_reference_mentions_company_id_companies_id_fk",+ "tableFrom": "issue_reference_mentions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_reference_mentions_source_issue_id_issues_id_fk": {+ "name": "issue_reference_mentions_source_issue_id_issues_id_fk",+ "tableFrom": "issue_reference_mentions",+ "columnsFrom": [+ "source_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_reference_mentions_target_issue_id_issues_id_fk": {+ "name": "issue_reference_mentions_target_issue_id_issues_id_fk",+ "tableFrom": "issue_reference_mentions",+ "columnsFrom": [+ "target_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_relations": {+ "name": "issue_relations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "related_issue_id": {+ "name": "related_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_relations_company_issue_idx": {+ "name": "issue_relations_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_relations_company_related_issue_idx": {+ "name": "issue_relations_company_related_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "related_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_relations_company_type_idx": {+ "name": "issue_relations_company_type_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_relations_company_edge_uq": {+ "name": "issue_relations_company_edge_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "related_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_relations_company_id_companies_id_fk": {+ "name": "issue_relations_company_id_companies_id_fk",+ "tableFrom": "issue_relations",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_relations_issue_id_issues_id_fk": {+ "name": "issue_relations_issue_id_issues_id_fk",+ "tableFrom": "issue_relations",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_relations_related_issue_id_issues_id_fk": {+ "name": "issue_relations_related_issue_id_issues_id_fk",+ "tableFrom": "issue_relations",+ "columnsFrom": [+ "related_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_relations_created_by_agent_id_agents_id_fk": {+ "name": "issue_relations_created_by_agent_id_agents_id_fk",+ "tableFrom": "issue_relations",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_thread_interactions": {+ "name": "issue_thread_interactions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "continuation_policy": {+ "name": "continuation_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'wake_assignee'"+ },+ "requested_resolver_policy": {+ "name": "requested_resolver_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'anyone'"+ },+ "effective_resolver_policy": {+ "name": "effective_resolver_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'anyone'"+ },+ "resolver_policy_provenance": {+ "name": "resolver_policy_provenance",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'inherited'"+ },+ "effective_resolver_policy_source": {+ "name": "effective_resolver_policy_source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'requested'"+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_comment_id": {+ "name": "source_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source_run_id": {+ "name": "source_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "addressee_agent_id": {+ "name": "addressee_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "addressee_user_id": {+ "name": "addressee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_agent_id": {+ "name": "resolved_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_run_id": {+ "name": "resolved_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "result": {+ "name": "result",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_thread_interactions_issue_idx": {+ "name": "issue_thread_interactions_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_thread_interactions_company_issue_created_at_idx": {+ "name": "issue_thread_interactions_company_issue_created_at_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_thread_interactions_company_issue_status_idx": {+ "name": "issue_thread_interactions_company_issue_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_thread_interactions_company_issue_idempotency_uq": {+ "name": "issue_thread_interactions_company_issue_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_thread_interactions\".\"idempotency_key\" IS NOT NULL",+ "concurrently": false+ },+ "issue_thread_interactions_source_comment_idx": {+ "name": "issue_thread_interactions_source_comment_idx",+ "columns": [+ {+ "expression": "source_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_thread_interactions_addressee_agent_idx": {+ "name": "issue_thread_interactions_addressee_agent_idx",+ "columns": [+ {+ "expression": "addressee_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_thread_interactions_addressee_user_idx": {+ "name": "issue_thread_interactions_addressee_user_idx",+ "columns": [+ {+ "expression": "addressee_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_thread_interactions_company_id_companies_id_fk": {+ "name": "issue_thread_interactions_company_id_companies_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_thread_interactions_issue_id_issues_id_fk": {+ "name": "issue_thread_interactions_issue_id_issues_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_thread_interactions_source_comment_id_issue_comments_id_fk": {+ "name": "issue_thread_interactions_source_comment_id_issue_comments_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "source_comment_id"+ ],+ "tableTo": "issue_comments",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk": {+ "name": "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "source_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_thread_interactions_created_by_agent_id_agents_id_fk": {+ "name": "issue_thread_interactions_created_by_agent_id_agents_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_thread_interactions_addressee_agent_id_agents_id_fk": {+ "name": "issue_thread_interactions_addressee_agent_id_agents_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "addressee_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_thread_interactions_resolved_by_agent_id_agents_id_fk": {+ "name": "issue_thread_interactions_resolved_by_agent_id_agents_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "resolved_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_thread_interactions_resolved_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_thread_interactions_resolved_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_thread_interactions",+ "columnsFrom": [+ "resolved_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_tree_hold_members": {+ "name": "issue_tree_hold_members",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "hold_id": {+ "name": "hold_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "parent_issue_id": {+ "name": "parent_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "depth": {+ "name": "depth",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "issue_identifier": {+ "name": "issue_identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "issue_title": {+ "name": "issue_title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "issue_status": {+ "name": "issue_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "assignee_agent_id": {+ "name": "assignee_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "active_run_id": {+ "name": "active_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "active_run_status": {+ "name": "active_run_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "skipped": {+ "name": "skipped",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "skip_reason": {+ "name": "skip_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_tree_hold_members_hold_issue_uq": {+ "name": "issue_tree_hold_members_hold_issue_uq",+ "columns": [+ {+ "expression": "hold_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_tree_hold_members_company_issue_idx": {+ "name": "issue_tree_hold_members_company_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_tree_hold_members_hold_depth_idx": {+ "name": "issue_tree_hold_members_hold_depth_idx",+ "columns": [+ {+ "expression": "hold_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "depth",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_tree_hold_members_company_id_companies_id_fk": {+ "name": "issue_tree_hold_members_company_id_companies_id_fk",+ "tableFrom": "issue_tree_hold_members",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk": {+ "name": "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk",+ "tableFrom": "issue_tree_hold_members",+ "columnsFrom": [+ "hold_id"+ ],+ "tableTo": "issue_tree_holds",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_tree_hold_members_issue_id_issues_id_fk": {+ "name": "issue_tree_hold_members_issue_id_issues_id_fk",+ "tableFrom": "issue_tree_hold_members",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_tree_hold_members_parent_issue_id_issues_id_fk": {+ "name": "issue_tree_hold_members_parent_issue_id_issues_id_fk",+ "tableFrom": "issue_tree_hold_members",+ "columnsFrom": [+ "parent_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_tree_hold_members_assignee_agent_id_agents_id_fk": {+ "name": "issue_tree_hold_members_assignee_agent_id_agents_id_fk",+ "tableFrom": "issue_tree_hold_members",+ "columnsFrom": [+ "assignee_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk": {+ "name": "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_tree_hold_members",+ "columnsFrom": [+ "active_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_tree_holds": {+ "name": "issue_tree_holds",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "root_issue_id": {+ "name": "root_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "mode": {+ "name": "mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "release_policy": {+ "name": "release_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_actor_type": {+ "name": "created_by_actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "released_at": {+ "name": "released_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "released_by_actor_type": {+ "name": "released_by_actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "released_by_agent_id": {+ "name": "released_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "released_by_user_id": {+ "name": "released_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "released_by_run_id": {+ "name": "released_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "release_reason": {+ "name": "release_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "release_metadata": {+ "name": "release_metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_tree_holds_company_root_status_idx": {+ "name": "issue_tree_holds_company_root_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "root_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_tree_holds_company_status_mode_idx": {+ "name": "issue_tree_holds_company_status_mode_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "mode",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_tree_holds_company_id_companies_id_fk": {+ "name": "issue_tree_holds_company_id_companies_id_fk",+ "tableFrom": "issue_tree_holds",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_tree_holds_root_issue_id_issues_id_fk": {+ "name": "issue_tree_holds_root_issue_id_issues_id_fk",+ "tableFrom": "issue_tree_holds",+ "columnsFrom": [+ "root_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_tree_holds_created_by_agent_id_agents_id_fk": {+ "name": "issue_tree_holds_created_by_agent_id_agents_id_fk",+ "tableFrom": "issue_tree_holds",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_tree_holds",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_tree_holds_released_by_agent_id_agents_id_fk": {+ "name": "issue_tree_holds_released_by_agent_id_agents_id_fk",+ "tableFrom": "issue_tree_holds",+ "columnsFrom": [+ "released_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_tree_holds",+ "columnsFrom": [+ "released_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_watchdogs": {+ "name": "issue_watchdogs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "watchdog_agent_id": {+ "name": "watchdog_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "watchdog_issue_id": {+ "name": "watchdog_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_observed_fingerprint": {+ "name": "last_observed_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_reviewed_fingerprint": {+ "name": "last_reviewed_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_observed_stop_snapshot": {+ "name": "last_observed_stop_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_reviewed_stop_snapshot": {+ "name": "last_reviewed_stop_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_triggered_at": {+ "name": "last_triggered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_completed_at": {+ "name": "last_completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_count": {+ "name": "trigger_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_agent_id": {+ "name": "updated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_run_id": {+ "name": "updated_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_watchdogs_company_issue_uq": {+ "name": "issue_watchdogs_company_issue_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_watchdogs_company_status_idx": {+ "name": "issue_watchdogs_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_watchdogs_company_agent_idx": {+ "name": "issue_watchdogs_company_agent_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "watchdog_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_watchdogs_company_watchdog_issue_uq": {+ "name": "issue_watchdogs_company_watchdog_issue_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "watchdog_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_watchdogs\".\"watchdog_issue_id\" is not null",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_watchdogs_company_id_companies_id_fk": {+ "name": "issue_watchdogs_company_id_companies_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_watchdogs_issue_id_issues_id_fk": {+ "name": "issue_watchdogs_issue_id_issues_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_watchdogs_watchdog_agent_id_agents_id_fk": {+ "name": "issue_watchdogs_watchdog_agent_id_agents_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "watchdog_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_watchdogs_watchdog_issue_id_issues_id_fk": {+ "name": "issue_watchdogs_watchdog_issue_id_issues_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "watchdog_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_watchdogs_created_by_agent_id_agents_id_fk": {+ "name": "issue_watchdogs_created_by_agent_id_agents_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_watchdogs_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_watchdogs_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_watchdogs_updated_by_agent_id_agents_id_fk": {+ "name": "issue_watchdogs_updated_by_agent_id_agents_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_watchdogs_updated_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_watchdogs_updated_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_watchdogs",+ "columnsFrom": [+ "updated_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_work_products": {+ "name": "issue_work_products",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "runtime_service_id": {+ "name": "runtime_service_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "review_state": {+ "name": "review_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'none'"+ },+ "is_primary": {+ "name": "is_primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "health_status": {+ "name": "health_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source_trust": {+ "name": "source_trust",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_work_products_company_issue_type_idx": {+ "name": "issue_work_products_company_issue_type_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_work_products_company_execution_workspace_type_idx": {+ "name": "issue_work_products_company_execution_workspace_type_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_work_products_company_provider_external_id_idx": {+ "name": "issue_work_products_company_provider_external_id_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_work_products_company_updated_idx": {+ "name": "issue_work_products_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_work_products_company_id_companies_id_fk": {+ "name": "issue_work_products_company_id_companies_id_fk",+ "tableFrom": "issue_work_products",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_work_products_project_id_projects_id_fk": {+ "name": "issue_work_products_project_id_projects_id_fk",+ "tableFrom": "issue_work_products",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_work_products_issue_id_issues_id_fk": {+ "name": "issue_work_products_issue_id_issues_id_fk",+ "tableFrom": "issue_work_products",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_work_products_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "issue_work_products_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "issue_work_products",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk": {+ "name": "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk",+ "tableFrom": "issue_work_products",+ "columnsFrom": [+ "runtime_service_id"+ ],+ "tableTo": "workspace_runtime_services",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_work_products_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "issue_work_products_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issue_work_products",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issues": {+ "name": "issues",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_workspace_id": {+ "name": "project_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'backlog'"+ },+ "status_version": {+ "name": "status_version",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_status_decision_id": {+ "name": "last_status_decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "work_mode": {+ "name": "work_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'standard'"+ },+ "harness_kind": {+ "name": "harness_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'medium'"+ },+ "review_policy": {+ "name": "review_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_agent_id": {+ "name": "assignee_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "checkout_run_id": {+ "name": "checkout_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "execution_run_id": {+ "name": "execution_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "execution_agent_name_key": {+ "name": "execution_agent_name_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "execution_locked_at": {+ "name": "execution_locked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "issue_number": {+ "name": "issue_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "origin_kind": {+ "name": "origin_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'manual'"+ },+ "origin_id": {+ "name": "origin_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "origin_fingerprint": {+ "name": "origin_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "request_depth": {+ "name": "request_depth",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "billing_code": {+ "name": "billing_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_adapter_overrides": {+ "name": "assignee_adapter_overrides",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "execution_policy": {+ "name": "execution_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "execution_state": {+ "name": "execution_state",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_next_check_at": {+ "name": "monitor_next_check_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_wake_requested_at": {+ "name": "monitor_wake_requested_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_last_triggered_at": {+ "name": "monitor_last_triggered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_attempt_count": {+ "name": "monitor_attempt_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "monitor_notes": {+ "name": "monitor_notes",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_scheduled_by": {+ "name": "monitor_scheduled_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_preference": {+ "name": "execution_workspace_preference",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_settings": {+ "name": "execution_workspace_settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source_trust": {+ "name": "source_trust",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "unblock_descriptor": {+ "name": "unblock_descriptor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "blocked_transition_at": {+ "name": "blocked_transition_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "blocked_owner_notified_at": {+ "name": "blocked_owner_notified_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "cancelled_at": {+ "name": "cancelled_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "hidden_at": {+ "name": "hidden_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issues_company_status_idx": {+ "name": "issues_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_harness_kind_idx": {+ "name": "issues_company_harness_kind_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "harness_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_assignee_status_idx": {+ "name": "issues_company_assignee_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "assignee_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_assignee_user_status_idx": {+ "name": "issues_company_assignee_user_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "assignee_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_responsible_user_idx": {+ "name": "issues_company_responsible_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "responsible_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_parent_idx": {+ "name": "issues_company_parent_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_project_idx": {+ "name": "issues_company_project_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_origin_idx": {+ "name": "issues_company_origin_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_project_workspace_idx": {+ "name": "issues_company_project_workspace_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_execution_workspace_idx": {+ "name": "issues_company_execution_workspace_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_monitor_due_idx": {+ "name": "issues_company_monitor_due_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "monitor_next_check_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_updated_idx": {+ "name": "issues_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_company_created_idx": {+ "name": "issues_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_open_normalized_title_created_idx": {+ "name": "issues_open_normalized_title_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(regexp_replace(btrim(\"title\"), '\\s+', ' ', 'g'))",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"hidden_at\" is null and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_company_priority_idx": {+ "name": "issues_company_priority_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "priority",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_identifier_idx": {+ "name": "issues_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issues_title_search_idx": {+ "name": "issues_title_search_idx",+ "columns": [+ {+ "expression": "title",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "issues_identifier_search_idx": {+ "name": "issues_identifier_search_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "issues_description_search_idx": {+ "name": "issues_description_search_idx",+ "columns": [+ {+ "expression": "description",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "gin_trgm_ops"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ },+ "issues_open_routine_execution_uq": {+ "name": "issues_open_routine_execution_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_fingerprint",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'routine_execution'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"execution_run_id\" is not null\n and \"issues\".\"status\" in ('backlog', 'todo', 'in_progress', 'in_review', 'blocked')",+ "concurrently": false+ },+ "issues_active_liveness_recovery_incident_uq": {+ "name": "issues_active_liveness_recovery_incident_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_active_liveness_recovery_leaf_uq": {+ "name": "issues_active_liveness_recovery_leaf_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_fingerprint",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_fingerprint\" <> 'default'\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_active_stale_run_evaluation_uq": {+ "name": "issues_active_stale_run_evaluation_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'stale_active_run_evaluation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_active_task_watchdog_uq": {+ "name": "issues_active_task_watchdog_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'task_watchdog'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_active_productivity_review_uq": {+ "name": "issues_active_productivity_review_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'issue_productivity_review'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_active_stranded_issue_recovery_uq": {+ "name": "issues_active_stranded_issue_recovery_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'stranded_issue_recovery'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",+ "concurrently": false+ },+ "issues_onboarding_first_task_uq": {+ "name": "issues_onboarding_first_task_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issues\".\"origin_kind\" = 'onboarding_first_task'",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issues_company_id_companies_id_fk": {+ "name": "issues_company_id_companies_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issues_project_id_projects_id_fk": {+ "name": "issues_project_id_projects_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issues_project_workspace_id_project_workspaces_id_fk": {+ "name": "issues_project_workspace_id_project_workspaces_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "tableTo": "project_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issues_goal_id_goals_id_fk": {+ "name": "issues_goal_id_goals_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issues_parent_id_issues_id_fk": {+ "name": "issues_parent_id_issues_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "parent_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issues_assignee_agent_id_agents_id_fk": {+ "name": "issues_assignee_agent_id_agents_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "assignee_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issues_checkout_run_id_heartbeat_runs_id_fk": {+ "name": "issues_checkout_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "checkout_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issues_execution_run_id_heartbeat_runs_id_fk": {+ "name": "issues_execution_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "execution_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issues_created_by_agent_id_agents_id_fk": {+ "name": "issues_created_by_agent_id_agents_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issues_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "issues_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "issues",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issues_company_id_uq": {+ "name": "issues_company_id_uq",+ "columns": [+ "company_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.join_requests": {+ "name": "join_requests",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "invite_id": {+ "name": "invite_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "request_type": {+ "name": "request_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending_approval'"+ },+ "request_ip": {+ "name": "request_ip",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "requesting_user_id": {+ "name": "requesting_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "request_email_snapshot": {+ "name": "request_email_snapshot",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_name": {+ "name": "agent_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "adapter_type": {+ "name": "adapter_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "capabilities": {+ "name": "capabilities",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_defaults_payload": {+ "name": "agent_defaults_payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "claim_secret_hash": {+ "name": "claim_secret_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "claim_secret_expires_at": {+ "name": "claim_secret_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "claim_secret_consumed_at": {+ "name": "claim_secret_consumed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_agent_id": {+ "name": "created_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "approved_by_user_id": {+ "name": "approved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "approved_at": {+ "name": "approved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "rejected_by_user_id": {+ "name": "rejected_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rejected_at": {+ "name": "rejected_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "join_requests_invite_unique_idx": {+ "name": "join_requests_invite_unique_idx",+ "columns": [+ {+ "expression": "invite_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "join_requests_company_status_type_created_idx": {+ "name": "join_requests_company_status_type_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "request_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "join_requests_pending_human_user_uq": {+ "name": "join_requests_pending_human_user_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "requesting_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"requesting_user_id\" IS NOT NULL",+ "concurrently": false+ },+ "join_requests_pending_human_email_uq": {+ "name": "join_requests_pending_human_email_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"request_email_snapshot\")",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"request_email_snapshot\" IS NOT NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "join_requests_invite_id_invites_id_fk": {+ "name": "join_requests_invite_id_invites_id_fk",+ "tableFrom": "join_requests",+ "columnsFrom": [+ "invite_id"+ ],+ "tableTo": "invites",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "join_requests_company_id_companies_id_fk": {+ "name": "join_requests_company_id_companies_id_fk",+ "tableFrom": "join_requests",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "join_requests_created_agent_id_agents_id_fk": {+ "name": "join_requests_created_agent_id_agents_id_fk",+ "tableFrom": "join_requests",+ "columnsFrom": [+ "created_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.labels": {+ "name": "labels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "labels_company_idx": {+ "name": "labels_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "labels_company_name_idx": {+ "name": "labels_company_name_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "labels_company_id_companies_id_fk": {+ "name": "labels_company_id_companies_id_fk",+ "tableFrom": "labels",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.native_run_finalizations": {+ "name": "native_run_finalizations",+ "schema": "",+ "columns": {+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "phase": {+ "name": "phase",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "attempt": {+ "name": "attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "lease_owner": {+ "name": "lease_owner",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "lease_expires_at": {+ "name": "lease_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "result_id": {+ "name": "result_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "assessment_id": {+ "name": "assessment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "decision_id": {+ "name": "decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "failure_code": {+ "name": "failure_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "failure_detail": {+ "name": "failure_detail",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "native_run_finalizations_company_id_companies_id_fk": {+ "name": "native_run_finalizations_company_id_companies_id_fk",+ "tableFrom": "native_run_finalizations",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_finalizations_issue_company_fk": {+ "name": "native_run_finalizations_issue_company_fk",+ "tableFrom": "native_run_finalizations",+ "columnsFrom": [+ "company_id",+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_finalizations_run_owner_fk": {+ "name": "native_run_finalizations_run_owner_fk",+ "tableFrom": "native_run_finalizations",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "company_id",+ "native_issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_finalizations_result_owner_fk": {+ "name": "native_run_finalizations_result_owner_fk",+ "tableFrom": "native_run_finalizations",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "result_id"+ ],+ "tableTo": "native_run_results",+ "columnsTo": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_finalizations_assessment_owner_fk": {+ "name": "native_run_finalizations_assessment_owner_fk",+ "tableFrom": "native_run_finalizations",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "assessment_id"+ ],+ "tableTo": "work_assessments",+ "columnsTo": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_finalizations_decision_owner_fk": {+ "name": "native_run_finalizations_decision_owner_fk",+ "tableFrom": "native_run_finalizations",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "assessment_id",+ "decision_id"+ ],+ "tableTo": "status_decisions",+ "columnsTo": [+ "company_id",+ "issue_id",+ "run_id",+ "assessment_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "native_run_finalizations_assessment_requires_result_check": {+ "name": "native_run_finalizations_assessment_requires_result_check",+ "value": "\"native_run_finalizations\".\"assessment_id\" is null or \"native_run_finalizations\".\"result_id\" is not null"+ },+ "native_run_finalizations_decision_requires_assessment_check": {+ "name": "native_run_finalizations_decision_requires_assessment_check",+ "value": "\"native_run_finalizations\".\"decision_id\" is null or \"native_run_finalizations\".\"assessment_id\" is not null"+ }+ },+ "isRLSEnabled": false+ },+ "public.native_run_results": {+ "name": "native_run_results",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "turn_id": {+ "name": "turn_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "completion_contract_id": {+ "name": "completion_contract_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "caller_result_id": {+ "name": "caller_result_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "caller_dedupe_key": {+ "name": "caller_dedupe_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "server_fingerprint": {+ "name": "server_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "schema_status": {+ "name": "schema_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "rejection_code": {+ "name": "rejection_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "result_json": {+ "name": "result_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "canonical_sha256": {+ "name": "canonical_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "native_run_results_run_fingerprint_uq": {+ "name": "native_run_results_run_fingerprint_uq",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "server_fingerprint",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "native_run_results_run_caller_result_uq": {+ "name": "native_run_results_run_caller_result_uq",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "caller_result_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "native_run_results_run_caller_dedupe_uq": {+ "name": "native_run_results_run_caller_dedupe_uq",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "caller_dedupe_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "native_run_results_company_id_companies_id_fk": {+ "name": "native_run_results_company_id_companies_id_fk",+ "tableFrom": "native_run_results",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_results_issue_company_fk": {+ "name": "native_run_results_issue_company_fk",+ "tableFrom": "native_run_results",+ "columnsFrom": [+ "company_id",+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_results_run_contract_owner_fk": {+ "name": "native_run_results_run_contract_owner_fk",+ "tableFrom": "native_run_results",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "completion_contract_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "company_id",+ "native_issue_id",+ "id",+ "completion_contract_id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "native_run_results_completion_contract_owner_fk": {+ "name": "native_run_results_completion_contract_owner_fk",+ "tableFrom": "native_run_results",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "completion_contract_id"+ ],+ "tableTo": "completion_contracts",+ "columnsTo": [+ "company_id",+ "issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "native_run_results_company_issue_run_id_uq": {+ "name": "native_run_results_company_issue_run_id_uq",+ "columns": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.pipeline_automation_executions": {+ "name": "pipeline_automation_executions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "automation_id": {+ "name": "automation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "triggering_event_id": {+ "name": "triggering_event_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "execution_issue_id": {+ "name": "execution_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "retry_of_execution_id": {+ "name": "retry_of_execution_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "generation": {+ "name": "generation",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_automation_executions_idempotency_uq": {+ "name": "pipeline_automation_executions_idempotency_uq",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "automation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "triggering_event_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_automation_executions_company_case_idx": {+ "name": "pipeline_automation_executions_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_automation_executions_routine_idx": {+ "name": "pipeline_automation_executions_routine_idx",+ "columns": [+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_automation_executions_execution_issue_idx": {+ "name": "pipeline_automation_executions_execution_issue_idx",+ "columns": [+ {+ "expression": "execution_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_automation_executions_retry_of_execution_idx": {+ "name": "pipeline_automation_executions_retry_of_execution_idx",+ "columns": [+ {+ "expression": "retry_of_execution_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_automation_executions_company_id_companies_id_fk": {+ "name": "pipeline_automation_executions_company_id_companies_id_fk",+ "tableFrom": "pipeline_automation_executions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_automation_executions_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_automation_executions_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_automation_executions",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_automation_executions_routine_id_routines_id_fk": {+ "name": "pipeline_automation_executions_routine_id_routines_id_fk",+ "tableFrom": "pipeline_automation_executions",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_automation_executions_execution_issue_id_issues_id_fk": {+ "name": "pipeline_automation_executions_execution_issue_id_issues_id_fk",+ "tableFrom": "pipeline_automation_executions",+ "columnsFrom": [+ "execution_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "pipeline_automation_executions_status_check": {+ "name": "pipeline_automation_executions_status_check",+ "value": "\"pipeline_automation_executions\".\"status\" in ('succeeded', 'failed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.pipeline_case_blockers": {+ "name": "pipeline_case_blockers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "blocked_by_case_id": {+ "name": "blocked_by_case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_case_blockers_case_blocked_by_uq": {+ "name": "pipeline_case_blockers_case_blocked_by_uq",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "blocked_by_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_blockers_blocked_by_idx": {+ "name": "pipeline_case_blockers_blocked_by_idx",+ "columns": [+ {+ "expression": "blocked_by_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_blockers_company_case_idx": {+ "name": "pipeline_case_blockers_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_case_blockers_company_id_companies_id_fk": {+ "name": "pipeline_case_blockers_company_id_companies_id_fk",+ "tableFrom": "pipeline_case_blockers",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_blockers_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_case_blockers_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_case_blockers",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_blockers_blocked_by_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_case_blockers_blocked_by_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_case_blockers",+ "columnsFrom": [+ "blocked_by_case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "pipeline_case_blockers_no_self_block_check": {+ "name": "pipeline_case_blockers_no_self_block_check",+ "value": "\"pipeline_case_blockers\".\"case_id\" <> \"pipeline_case_blockers\".\"blocked_by_case_id\""+ }+ },+ "isRLSEnabled": false+ },+ "public.pipeline_case_documents": {+ "name": "pipeline_case_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_case_documents_company_case_key_uq": {+ "name": "pipeline_case_documents_company_case_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_documents_document_uq": {+ "name": "pipeline_case_documents_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_documents_company_case_updated_idx": {+ "name": "pipeline_case_documents_company_case_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_case_documents_company_id_companies_id_fk": {+ "name": "pipeline_case_documents_company_id_companies_id_fk",+ "tableFrom": "pipeline_case_documents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_documents_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_case_documents_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_case_documents",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_documents_document_id_documents_id_fk": {+ "name": "pipeline_case_documents_document_id_documents_id_fk",+ "tableFrom": "pipeline_case_documents",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.pipeline_case_events": {+ "name": "pipeline_case_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_agent_id": {+ "name": "actor_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "from_stage_id": {+ "name": "from_stage_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "to_stage_id": {+ "name": "to_stage_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_case_events_case_created_idx": {+ "name": "pipeline_case_events_case_created_idx",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_events_company_case_idx": {+ "name": "pipeline_case_events_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_case_events_company_id_companies_id_fk": {+ "name": "pipeline_case_events_company_id_companies_id_fk",+ "tableFrom": "pipeline_case_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_events_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_case_events_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_case_events",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_events_actor_agent_id_agents_id_fk": {+ "name": "pipeline_case_events_actor_agent_id_agents_id_fk",+ "tableFrom": "pipeline_case_events",+ "columnsFrom": [+ "actor_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "pipeline_case_events_from_stage_id_pipeline_stages_id_fk": {+ "name": "pipeline_case_events_from_stage_id_pipeline_stages_id_fk",+ "tableFrom": "pipeline_case_events",+ "columnsFrom": [+ "from_stage_id"+ ],+ "tableTo": "pipeline_stages",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "pipeline_case_events_to_stage_id_pipeline_stages_id_fk": {+ "name": "pipeline_case_events_to_stage_id_pipeline_stages_id_fk",+ "tableFrom": "pipeline_case_events",+ "columnsFrom": [+ "to_stage_id"+ ],+ "tableTo": "pipeline_stages",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "pipeline_case_events_type_check": {+ "name": "pipeline_case_events_type_check",+ "value": "\"pipeline_case_events\".\"type\" in (\n 'ingested',\n 'updated',\n 'claimed',\n 'lease_released',\n 'lease_expired',\n 'transitioned',\n 'transition_forced',\n 'transition_suggested',\n 'suggestion_resolved',\n 'review_decided',\n 'conversation_opened',\n 'issue_linked',\n 'issue_unlinked',\n 'automation_executed',\n 'automation_failed',\n 'automation_retry_requested',\n 'automation_effects_retired',\n 'automation_retry_dispatched',\n 'blockers_set',\n 'blockers_resolved',\n 'children_terminal',\n 'upstream_drift',\n 'drift_acknowledged'\n )"+ },+ "pipeline_case_events_actor_type_check": {+ "name": "pipeline_case_events_actor_type_check",+ "value": "\"pipeline_case_events\".\"actor_type\" in ('user', 'agent', 'system')"+ },+ "pipeline_case_events_agent_run_check": {+ "name": "pipeline_case_events_agent_run_check",+ "value": "\"pipeline_case_events\".\"actor_type\" <> 'agent' or \"pipeline_case_events\".\"run_id\" is not null"+ }+ },+ "isRLSEnabled": false+ },+ "public.pipeline_case_issue_links": {+ "name": "pipeline_case_issue_links",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_id": {+ "name": "case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "automation_attempt_id": {+ "name": "automation_attempt_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "retired_at": {+ "name": "retired_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "retired_by_attempt_id": {+ "name": "retired_by_attempt_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "retired_reason": {+ "name": "retired_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_case_issue_links_case_issue_uq": {+ "name": "pipeline_case_issue_links_case_issue_uq",+ "columns": [+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_issue_links_issue_idx": {+ "name": "pipeline_case_issue_links_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_issue_links_company_case_idx": {+ "name": "pipeline_case_issue_links_company_case_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_case_issue_links_automation_attempt_idx": {+ "name": "pipeline_case_issue_links_automation_attempt_idx",+ "columns": [+ {+ "expression": "automation_attempt_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_case_issue_links_company_id_companies_id_fk": {+ "name": "pipeline_case_issue_links_company_id_companies_id_fk",+ "tableFrom": "pipeline_case_issue_links",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_issue_links_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_case_issue_links_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_case_issue_links",+ "columnsFrom": [+ "case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_case_issue_links_issue_id_issues_id_fk": {+ "name": "pipeline_case_issue_links_issue_id_issues_id_fk",+ "tableFrom": "pipeline_case_issue_links",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "pipeline_case_issue_links_role_check": {+ "name": "pipeline_case_issue_links_role_check",+ "value": "\"pipeline_case_issue_links\".\"role\" in ('origin', 'conversation', 'work', 'automation')"+ }+ },+ "isRLSEnabled": false+ },+ "public.pipeline_cases": {+ "name": "pipeline_cases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "pipeline_id": {+ "name": "pipeline_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "stage_id": {+ "name": "stage_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "case_key": {+ "name": "case_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "fields": {+ "name": "fields",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "workspace_ref": {+ "name": "workspace_ref",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "parent_case_id": {+ "name": "parent_case_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "parent_case_version": {+ "name": "parent_case_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "request_key": {+ "name": "request_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "automation_attempt_id": {+ "name": "automation_attempt_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "pending_suggestion": {+ "name": "pending_suggestion",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "lease_owner_type": {+ "name": "lease_owner_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "lease_agent_id": {+ "name": "lease_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "lease_user_id": {+ "name": "lease_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "lease_token": {+ "name": "lease_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "lease_expires_at": {+ "name": "lease_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "terminal_kind": {+ "name": "terminal_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "terminal_at": {+ "name": "terminal_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "retired_at": {+ "name": "retired_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "retired_by_attempt_id": {+ "name": "retired_by_attempt_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "retired_reason": {+ "name": "retired_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "hidden_from_board_at": {+ "name": "hidden_from_board_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "child_count": {+ "name": "child_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "terminal_child_count": {+ "name": "terminal_child_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_cases_pipeline_case_key_uq": {+ "name": "pipeline_cases_pipeline_case_key_uq",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "case_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_cases_parent_request_key_uq": {+ "name": "pipeline_cases_parent_request_key_uq",+ "columns": [+ {+ "expression": "parent_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "request_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"pipeline_cases\".\"request_key\" is not null and \"pipeline_cases\".\"retired_at\" is null",+ "concurrently": false+ },+ "pipeline_cases_company_idx": {+ "name": "pipeline_cases_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_cases_pipeline_stage_idx": {+ "name": "pipeline_cases_pipeline_stage_idx",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "stage_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_cases_parent_idx": {+ "name": "pipeline_cases_parent_idx",+ "columns": [+ {+ "expression": "parent_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_cases_automation_attempt_idx": {+ "name": "pipeline_cases_automation_attempt_idx",+ "columns": [+ {+ "expression": "automation_attempt_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_cases_retired_idx": {+ "name": "pipeline_cases_retired_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "retired_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_cases_lease_expires_idx": {+ "name": "pipeline_cases_lease_expires_idx",+ "columns": [+ {+ "expression": "lease_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"pipeline_cases\".\"lease_expires_at\" is not null",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_cases_company_id_companies_id_fk": {+ "name": "pipeline_cases_company_id_companies_id_fk",+ "tableFrom": "pipeline_cases",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_cases_pipeline_id_pipelines_id_fk": {+ "name": "pipeline_cases_pipeline_id_pipelines_id_fk",+ "tableFrom": "pipeline_cases",+ "columnsFrom": [+ "pipeline_id"+ ],+ "tableTo": "pipelines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_cases_stage_id_pipeline_stages_id_fk": {+ "name": "pipeline_cases_stage_id_pipeline_stages_id_fk",+ "tableFrom": "pipeline_cases",+ "columnsFrom": [+ "stage_id"+ ],+ "tableTo": "pipeline_stages",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "pipeline_cases_parent_case_id_pipeline_cases_id_fk": {+ "name": "pipeline_cases_parent_case_id_pipeline_cases_id_fk",+ "tableFrom": "pipeline_cases",+ "columnsFrom": [+ "parent_case_id"+ ],+ "tableTo": "pipeline_cases",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "pipeline_cases_lease_agent_id_agents_id_fk": {+ "name": "pipeline_cases_lease_agent_id_agents_id_fk",+ "tableFrom": "pipeline_cases",+ "columnsFrom": [+ "lease_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "pipeline_cases_created_by_agent_id_agents_id_fk": {+ "name": "pipeline_cases_created_by_agent_id_agents_id_fk",+ "tableFrom": "pipeline_cases",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "pipeline_cases_terminal_kind_check": {+ "name": "pipeline_cases_terminal_kind_check",+ "value": "\"pipeline_cases\".\"terminal_kind\" is null or \"pipeline_cases\".\"terminal_kind\" in ('done', 'cancelled')"+ },+ "pipeline_cases_lease_owner_type_check": {+ "name": "pipeline_cases_lease_owner_type_check",+ "value": "\"pipeline_cases\".\"lease_owner_type\" is null or \"pipeline_cases\".\"lease_owner_type\" in ('user', 'agent')"+ }+ },+ "isRLSEnabled": false+ },+ "public.pipeline_documents": {+ "name": "pipeline_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "pipeline_id": {+ "name": "pipeline_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_documents_company_pipeline_key_uq": {+ "name": "pipeline_documents_company_pipeline_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_documents_document_uq": {+ "name": "pipeline_documents_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_documents_company_pipeline_updated_idx": {+ "name": "pipeline_documents_company_pipeline_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_documents_company_id_companies_id_fk": {+ "name": "pipeline_documents_company_id_companies_id_fk",+ "tableFrom": "pipeline_documents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_documents_pipeline_id_pipelines_id_fk": {+ "name": "pipeline_documents_pipeline_id_pipelines_id_fk",+ "tableFrom": "pipeline_documents",+ "columnsFrom": [+ "pipeline_id"+ ],+ "tableTo": "pipelines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_documents_document_id_documents_id_fk": {+ "name": "pipeline_documents_document_id_documents_id_fk",+ "tableFrom": "pipeline_documents",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.pipeline_stages": {+ "name": "pipeline_stages",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "pipeline_id": {+ "name": "pipeline_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_stages_pipeline_key_uq": {+ "name": "pipeline_stages_pipeline_key_uq",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_stages_pipeline_position_idx": {+ "name": "pipeline_stages_pipeline_position_idx",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_stages_pipeline_id_pipelines_id_fk": {+ "name": "pipeline_stages_pipeline_id_pipelines_id_fk",+ "tableFrom": "pipeline_stages",+ "columnsFrom": [+ "pipeline_id"+ ],+ "tableTo": "pipelines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "pipeline_stages_kind_check": {+ "name": "pipeline_stages_kind_check",+ "value": "\"pipeline_stages\".\"kind\" in ('working', 'review', 'done', 'cancelled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.pipeline_transitions": {+ "name": "pipeline_transitions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "pipeline_id": {+ "name": "pipeline_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "from_stage_id": {+ "name": "from_stage_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "to_stage_id": {+ "name": "to_stage_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipeline_transitions_pipeline_edge_uq": {+ "name": "pipeline_transitions_pipeline_edge_uq",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "from_stage_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "to_stage_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_transitions_pipeline_from_idx": {+ "name": "pipeline_transitions_pipeline_from_idx",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "from_stage_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipeline_transitions_pipeline_to_idx": {+ "name": "pipeline_transitions_pipeline_to_idx",+ "columns": [+ {+ "expression": "pipeline_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "to_stage_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipeline_transitions_pipeline_id_pipelines_id_fk": {+ "name": "pipeline_transitions_pipeline_id_pipelines_id_fk",+ "tableFrom": "pipeline_transitions",+ "columnsFrom": [+ "pipeline_id"+ ],+ "tableTo": "pipelines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_transitions_from_stage_id_pipeline_stages_id_fk": {+ "name": "pipeline_transitions_from_stage_id_pipeline_stages_id_fk",+ "tableFrom": "pipeline_transitions",+ "columnsFrom": [+ "from_stage_id"+ ],+ "tableTo": "pipeline_stages",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipeline_transitions_to_stage_id_pipeline_stages_id_fk": {+ "name": "pipeline_transitions_to_stage_id_pipeline_stages_id_fk",+ "tableFrom": "pipeline_transitions",+ "columnsFrom": [+ "to_stage_id"+ ],+ "tableTo": "pipeline_stages",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.pipelines": {+ "name": "pipelines",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enforce_transitions": {+ "name": "enforce_transitions",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "pipelines_company_key_uq": {+ "name": "pipelines_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipelines_company_idx": {+ "name": "pipelines_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "pipelines_company_project_idx": {+ "name": "pipelines_company_project_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "pipelines_company_id_companies_id_fk": {+ "name": "pipelines_company_id_companies_id_fk",+ "tableFrom": "pipelines",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "pipelines_project_id_projects_id_fk": {+ "name": "pipelines_project_id_projects_id_fk",+ "tableFrom": "pipelines",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "pipelines_created_by_agent_id_agents_id_fk": {+ "name": "pipelines_created_by_agent_id_agents_id_fk",+ "tableFrom": "pipelines",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_company_settings": {+ "name": "plugin_company_settings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "settings_json": {+ "name": "settings_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_company_settings_company_idx": {+ "name": "plugin_company_settings_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_company_settings_plugin_idx": {+ "name": "plugin_company_settings_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_company_settings_company_plugin_uq": {+ "name": "plugin_company_settings_company_plugin_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_company_settings_company_id_companies_id_fk": {+ "name": "plugin_company_settings_company_id_companies_id_fk",+ "tableFrom": "plugin_company_settings",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_company_settings_plugin_id_plugins_id_fk": {+ "name": "plugin_company_settings_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_company_settings",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_config": {+ "name": "plugin_config",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "config_json": {+ "name": "config_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_config_plugin_company_idx": {+ "name": "plugin_config_plugin_company_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_config_plugin_id_plugins_id_fk": {+ "name": "plugin_config_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_config",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_config_company_id_companies_id_fk": {+ "name": "plugin_config_company_id_companies_id_fk",+ "tableFrom": "plugin_config",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_database_namespaces": {+ "name": "plugin_database_namespaces",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_key": {+ "name": "plugin_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "namespace_name": {+ "name": "namespace_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "namespace_mode": {+ "name": "namespace_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'schema'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_database_namespaces_plugin_idx": {+ "name": "plugin_database_namespaces_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_database_namespaces_namespace_idx": {+ "name": "plugin_database_namespaces_namespace_idx",+ "columns": [+ {+ "expression": "namespace_name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_database_namespaces_status_idx": {+ "name": "plugin_database_namespaces_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_database_namespaces_plugin_id_plugins_id_fk": {+ "name": "plugin_database_namespaces_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_database_namespaces",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_entities": {+ "name": "plugin_entities",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "entity_type": {+ "name": "entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_kind": {+ "name": "scope_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_entities_plugin_idx": {+ "name": "plugin_entities_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_entities_company_idx": {+ "name": "plugin_entities_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_entities_type_idx": {+ "name": "plugin_entities_type_idx",+ "columns": [+ {+ "expression": "entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_entities_scope_idx": {+ "name": "plugin_entities_scope_idx",+ "columns": [+ {+ "expression": "scope_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_entities_plugin_id_plugins_id_fk": {+ "name": "plugin_entities_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_entities",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_entities_company_id_companies_id_fk": {+ "name": "plugin_entities_company_id_companies_id_fk",+ "tableFrom": "plugin_entities",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "plugin_entities_external_idx": {+ "name": "plugin_entities_external_idx",+ "columns": [+ "company_id",+ "plugin_id",+ "entity_type",+ "external_id"+ ],+ "nullsNotDistinct": true+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_job_runs": {+ "name": "plugin_job_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "job_id": {+ "name": "job_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "duration_ms": {+ "name": "duration_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "logs": {+ "name": "logs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_job_runs_job_idx": {+ "name": "plugin_job_runs_job_idx",+ "columns": [+ {+ "expression": "job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_job_runs_plugin_idx": {+ "name": "plugin_job_runs_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_job_runs_company_idx": {+ "name": "plugin_job_runs_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_job_runs_status_idx": {+ "name": "plugin_job_runs_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_job_runs_job_id_plugin_jobs_id_fk": {+ "name": "plugin_job_runs_job_id_plugin_jobs_id_fk",+ "tableFrom": "plugin_job_runs",+ "columnsFrom": [+ "job_id"+ ],+ "tableTo": "plugin_jobs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_job_runs_plugin_id_plugins_id_fk": {+ "name": "plugin_job_runs_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_job_runs",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_job_runs_company_id_companies_id_fk": {+ "name": "plugin_job_runs_company_id_companies_id_fk",+ "tableFrom": "plugin_job_runs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_jobs": {+ "name": "plugin_jobs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "job_key": {+ "name": "job_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "schedule": {+ "name": "schedule",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "next_run_at": {+ "name": "next_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_jobs_plugin_idx": {+ "name": "plugin_jobs_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_jobs_next_run_idx": {+ "name": "plugin_jobs_next_run_idx",+ "columns": [+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_jobs_unique_idx": {+ "name": "plugin_jobs_unique_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "job_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_jobs_plugin_id_plugins_id_fk": {+ "name": "plugin_jobs_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_jobs",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_logs": {+ "name": "plugin_logs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "level": {+ "name": "level",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'info'"+ },+ "message": {+ "name": "message",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "meta": {+ "name": "meta",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_logs_plugin_time_idx": {+ "name": "plugin_logs_plugin_time_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_logs_company_idx": {+ "name": "plugin_logs_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_logs_level_idx": {+ "name": "plugin_logs_level_idx",+ "columns": [+ {+ "expression": "level",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_logs_plugin_id_plugins_id_fk": {+ "name": "plugin_logs_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_logs",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_logs_company_id_companies_id_fk": {+ "name": "plugin_logs_company_id_companies_id_fk",+ "tableFrom": "plugin_logs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_managed_resources": {+ "name": "plugin_managed_resources",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_key": {+ "name": "plugin_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_kind": {+ "name": "resource_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_key": {+ "name": "resource_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_id": {+ "name": "resource_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "defaults_json": {+ "name": "defaults_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_managed_resources_company_idx": {+ "name": "plugin_managed_resources_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_managed_resources_plugin_idx": {+ "name": "plugin_managed_resources_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_managed_resources_resource_idx": {+ "name": "plugin_managed_resources_resource_idx",+ "columns": [+ {+ "expression": "resource_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_managed_resources_company_plugin_resource_uq": {+ "name": "plugin_managed_resources_company_plugin_resource_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_managed_resources_company_id_companies_id_fk": {+ "name": "plugin_managed_resources_company_id_companies_id_fk",+ "tableFrom": "plugin_managed_resources",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_managed_resources_plugin_id_plugins_id_fk": {+ "name": "plugin_managed_resources_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_managed_resources",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_migrations": {+ "name": "plugin_migrations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_key": {+ "name": "plugin_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "namespace_name": {+ "name": "namespace_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "migration_key": {+ "name": "migration_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "checksum": {+ "name": "checksum",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "plugin_version": {+ "name": "plugin_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "applied_at": {+ "name": "applied_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "error_message": {+ "name": "error_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "plugin_migrations_plugin_key_idx": {+ "name": "plugin_migrations_plugin_key_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "migration_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_migrations_plugin_idx": {+ "name": "plugin_migrations_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_migrations_status_idx": {+ "name": "plugin_migrations_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_migrations_plugin_id_plugins_id_fk": {+ "name": "plugin_migrations_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_migrations",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_state": {+ "name": "plugin_state",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "scope_kind": {+ "name": "scope_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "namespace": {+ "name": "namespace",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "state_key": {+ "name": "state_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value_json": {+ "name": "value_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_state_plugin_scope_idx": {+ "name": "plugin_state_plugin_scope_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_state_plugin_id_plugins_id_fk": {+ "name": "plugin_state_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_state",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "plugin_state_unique_entry_idx": {+ "name": "plugin_state_unique_entry_idx",+ "columns": [+ "plugin_id",+ "scope_kind",+ "scope_id",+ "namespace",+ "state_key"+ ],+ "nullsNotDistinct": true+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_webhook_deliveries": {+ "name": "plugin_webhook_deliveries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "webhook_key": {+ "name": "webhook_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "duration_ms": {+ "name": "duration_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "headers": {+ "name": "headers",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_webhook_deliveries_plugin_idx": {+ "name": "plugin_webhook_deliveries_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_webhook_deliveries_company_idx": {+ "name": "plugin_webhook_deliveries_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_webhook_deliveries_status_idx": {+ "name": "plugin_webhook_deliveries_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugin_webhook_deliveries_key_idx": {+ "name": "plugin_webhook_deliveries_key_idx",+ "columns": [+ {+ "expression": "webhook_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "plugin_webhook_deliveries_plugin_id_plugins_id_fk": {+ "name": "plugin_webhook_deliveries_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_webhook_deliveries",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "plugin_webhook_deliveries_company_id_companies_id_fk": {+ "name": "plugin_webhook_deliveries_company_id_companies_id_fk",+ "tableFrom": "plugin_webhook_deliveries",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugins": {+ "name": "plugins",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "plugin_key": {+ "name": "plugin_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "package_name": {+ "name": "package_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "api_version": {+ "name": "api_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "categories": {+ "name": "categories",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "manifest_json": {+ "name": "manifest_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'installed'"+ },+ "install_order": {+ "name": "install_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "package_path": {+ "name": "package_path",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "installed_at": {+ "name": "installed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugins_plugin_key_idx": {+ "name": "plugins_plugin_key_idx",+ "columns": [+ {+ "expression": "plugin_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "plugins_status_idx": {+ "name": "plugins_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.principal_permission_grants": {+ "name": "principal_permission_grants",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "principal_type": {+ "name": "principal_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "principal_id": {+ "name": "principal_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "permission_key": {+ "name": "permission_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope": {+ "name": "scope",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "granted_by_user_id": {+ "name": "granted_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "principal_permission_grants_unique_idx": {+ "name": "principal_permission_grants_unique_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "principal_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "principal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "permission_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "principal_permission_grants_company_permission_idx": {+ "name": "principal_permission_grants_company_permission_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "permission_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "principal_permission_grants_company_id_companies_id_fk": {+ "name": "principal_permission_grants_company_id_companies_id_fk",+ "tableFrom": "principal_permission_grants",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_goals": {+ "name": "project_goals",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_goals_project_idx": {+ "name": "project_goals_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_goals_goal_idx": {+ "name": "project_goals_goal_idx",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_goals_company_idx": {+ "name": "project_goals_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_goals_project_id_projects_id_fk": {+ "name": "project_goals_project_id_projects_id_fk",+ "tableFrom": "project_goals",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_goals_goal_id_goals_id_fk": {+ "name": "project_goals_goal_id_goals_id_fk",+ "tableFrom": "project_goals",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_goals_company_id_companies_id_fk": {+ "name": "project_goals_company_id_companies_id_fk",+ "tableFrom": "project_goals",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_goals_project_id_goal_id_pk": {+ "name": "project_goals_project_id_goal_id_pk",+ "columns": [+ "project_id",+ "goal_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_memberships": {+ "name": "project_memberships",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'joined'"+ },+ "starred_at": {+ "name": "starred_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_memberships_company_user_idx": {+ "name": "project_memberships_company_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_memberships_company_user_starred_idx": {+ "name": "project_memberships_company_user_starred_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "starred_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_memberships_project_idx": {+ "name": "project_memberships_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_memberships_company_user_project_uq": {+ "name": "project_memberships_company_user_project_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_memberships_company_id_companies_id_fk": {+ "name": "project_memberships_company_id_companies_id_fk",+ "tableFrom": "project_memberships",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_memberships_project_id_projects_id_fk": {+ "name": "project_memberships_project_id_projects_id_fk",+ "tableFrom": "project_memberships",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_workspaces": {+ "name": "project_workspaces",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_type": {+ "name": "source_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_path'"+ },+ "cwd": {+ "name": "cwd",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "repo_url": {+ "name": "repo_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "repo_ref": {+ "name": "repo_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "default_ref": {+ "name": "default_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "setup_command": {+ "name": "setup_command",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cleanup_command": {+ "name": "cleanup_command",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "remote_provider": {+ "name": "remote_provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "remote_workspace_ref": {+ "name": "remote_workspace_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "shared_workspace_key": {+ "name": "shared_workspace_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "is_primary": {+ "name": "is_primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_workspaces_company_project_idx": {+ "name": "project_workspaces_company_project_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_workspaces_project_primary_idx": {+ "name": "project_workspaces_project_primary_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "is_primary",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_workspaces_project_source_type_idx": {+ "name": "project_workspaces_project_source_type_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_workspaces_company_shared_key_idx": {+ "name": "project_workspaces_company_shared_key_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "shared_workspace_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_workspaces_project_remote_ref_idx": {+ "name": "project_workspaces_project_remote_ref_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "remote_provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "remote_workspace_ref",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_workspaces_company_id_companies_id_fk": {+ "name": "project_workspaces_company_id_companies_id_fk",+ "tableFrom": "project_workspaces",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "project_workspaces_project_id_projects_id_fk": {+ "name": "project_workspaces_project_id_projects_id_fk",+ "tableFrom": "project_workspaces",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.projects": {+ "name": "projects",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'backlog'"+ },+ "lead_agent_id": {+ "name": "lead_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "target_date": {+ "name": "target_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "env": {+ "name": "env",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "pause_reason": {+ "name": "pause_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "paused_at": {+ "name": "paused_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_policy": {+ "name": "execution_workspace_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "projects_company_idx": {+ "name": "projects_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "projects_company_id_companies_id_fk": {+ "name": "projects_company_id_companies_id_fk",+ "tableFrom": "projects",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "projects_goal_id_goals_id_fk": {+ "name": "projects_goal_id_goals_id_fk",+ "tableFrom": "projects",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "projects_lead_agent_id_agents_id_fk": {+ "name": "projects_lead_agent_id_agents_id_fk",+ "tableFrom": "projects",+ "columnsFrom": [+ "lead_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.provider_trace_records": {+ "name": "provider_trace_records",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'capturing'"+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "trace_ref": {+ "name": "trace_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "frame_count": {+ "name": "frame_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "byte_count": {+ "name": "byte_count",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "digest": {+ "name": "digest",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_by": {+ "name": "requested_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "provider_trace_records_run_unique": {+ "name": "provider_trace_records_run_unique",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "provider_trace_records_expiry_idx": {+ "name": "provider_trace_records_expiry_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "provider_trace_records_company_created_idx": {+ "name": "provider_trace_records_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "provider_trace_records_company_id_companies_id_fk": {+ "name": "provider_trace_records_company_id_companies_id_fk",+ "tableFrom": "provider_trace_records",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "provider_trace_records_run_id_heartbeat_runs_id_fk": {+ "name": "provider_trace_records_run_id_heartbeat_runs_id_fk",+ "tableFrom": "provider_trace_records",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routine_documents": {+ "name": "routine_documents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "routine_documents_company_routine_key_uq": {+ "name": "routine_documents_company_routine_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_documents_document_uq": {+ "name": "routine_documents_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_documents_company_routine_updated_idx": {+ "name": "routine_documents_company_routine_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "routine_documents_company_id_companies_id_fk": {+ "name": "routine_documents_company_id_companies_id_fk",+ "tableFrom": "routine_documents",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "routine_documents_routine_id_routines_id_fk": {+ "name": "routine_documents_routine_id_routines_id_fk",+ "tableFrom": "routine_documents",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_documents_document_id_documents_id_fk": {+ "name": "routine_documents_document_id_documents_id_fk",+ "tableFrom": "routine_documents",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routine_revisions": {+ "name": "routine_revisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "revision_number": {+ "name": "revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "snapshot": {+ "name": "snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "change_summary": {+ "name": "change_summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "restored_from_revision_id": {+ "name": "restored_from_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_run_id": {+ "name": "created_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "routine_revisions_routine_revision_uq": {+ "name": "routine_revisions_routine_revision_uq",+ "columns": [+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "revision_number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_revisions_company_routine_created_idx": {+ "name": "routine_revisions_company_routine_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_revisions_company_responsible_user_idx": {+ "name": "routine_revisions_company_responsible_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "responsible_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "routine_revisions_company_id_companies_id_fk": {+ "name": "routine_revisions_company_id_companies_id_fk",+ "tableFrom": "routine_revisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_revisions_routine_id_routines_id_fk": {+ "name": "routine_revisions_routine_id_routines_id_fk",+ "tableFrom": "routine_revisions",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_revisions_restored_from_revision_id_routine_revisions_id_fk": {+ "name": "routine_revisions_restored_from_revision_id_routine_revisions_id_fk",+ "tableFrom": "routine_revisions",+ "columnsFrom": [+ "restored_from_revision_id"+ ],+ "tableTo": "routine_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routine_revisions_created_by_agent_id_agents_id_fk": {+ "name": "routine_revisions_created_by_agent_id_agents_id_fk",+ "tableFrom": "routine_revisions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routine_revisions_created_by_run_id_heartbeat_runs_id_fk": {+ "name": "routine_revisions_created_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "routine_revisions",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routine_runs": {+ "name": "routine_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "trigger_id": {+ "name": "trigger_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'received'"+ },+ "triggered_at": {+ "name": "triggered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "routine_revision_id": {+ "name": "routine_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_payload": {+ "name": "trigger_payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "dispatch_fingerprint": {+ "name": "dispatch_fingerprint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "linked_issue_id": {+ "name": "linked_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "coalesced_into_run_id": {+ "name": "coalesced_into_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "routine_runs_company_routine_idx": {+ "name": "routine_runs_company_routine_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_runs_revision_idx": {+ "name": "routine_runs_revision_idx",+ "columns": [+ {+ "expression": "routine_revision_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_runs_company_responsible_user_idx": {+ "name": "routine_runs_company_responsible_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "responsible_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_runs_trigger_idx": {+ "name": "routine_runs_trigger_idx",+ "columns": [+ {+ "expression": "trigger_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_runs_dispatch_fingerprint_idx": {+ "name": "routine_runs_dispatch_fingerprint_idx",+ "columns": [+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "dispatch_fingerprint",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_runs_linked_issue_idx": {+ "name": "routine_runs_linked_issue_idx",+ "columns": [+ {+ "expression": "linked_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_runs_trigger_idempotency_idx": {+ "name": "routine_runs_trigger_idempotency_idx",+ "columns": [+ {+ "expression": "trigger_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "routine_runs_company_id_companies_id_fk": {+ "name": "routine_runs_company_id_companies_id_fk",+ "tableFrom": "routine_runs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_runs_routine_id_routines_id_fk": {+ "name": "routine_runs_routine_id_routines_id_fk",+ "tableFrom": "routine_runs",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_runs_trigger_id_routine_triggers_id_fk": {+ "name": "routine_runs_trigger_id_routine_triggers_id_fk",+ "tableFrom": "routine_runs",+ "columnsFrom": [+ "trigger_id"+ ],+ "tableTo": "routine_triggers",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routine_runs_routine_revision_id_routine_revisions_id_fk": {+ "name": "routine_runs_routine_revision_id_routine_revisions_id_fk",+ "tableFrom": "routine_runs",+ "columnsFrom": [+ "routine_revision_id"+ ],+ "tableTo": "routine_revisions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routine_runs_linked_issue_id_issues_id_fk": {+ "name": "routine_runs_linked_issue_id_issues_id_fk",+ "tableFrom": "routine_runs",+ "columnsFrom": [+ "linked_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routine_triggers": {+ "name": "routine_triggers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "routine_id": {+ "name": "routine_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "cron_expression": {+ "name": "cron_expression",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "next_run_at": {+ "name": "next_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_fired_at": {+ "name": "last_fired_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "public_id": {+ "name": "public_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "secret_id": {+ "name": "secret_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "signing_mode": {+ "name": "signing_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "replay_window_sec": {+ "name": "replay_window_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_rotated_at": {+ "name": "last_rotated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_result": {+ "name": "last_result",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_agent_id": {+ "name": "updated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "routine_triggers_company_routine_idx": {+ "name": "routine_triggers_company_routine_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_triggers_company_kind_idx": {+ "name": "routine_triggers_company_kind_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_triggers_next_run_idx": {+ "name": "routine_triggers_next_run_idx",+ "columns": [+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_triggers_public_id_idx": {+ "name": "routine_triggers_public_id_idx",+ "columns": [+ {+ "expression": "public_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routine_triggers_public_id_uq": {+ "name": "routine_triggers_public_id_uq",+ "columns": [+ {+ "expression": "public_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "routine_triggers_company_id_companies_id_fk": {+ "name": "routine_triggers_company_id_companies_id_fk",+ "tableFrom": "routine_triggers",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_triggers_routine_id_routines_id_fk": {+ "name": "routine_triggers_routine_id_routines_id_fk",+ "tableFrom": "routine_triggers",+ "columnsFrom": [+ "routine_id"+ ],+ "tableTo": "routines",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routine_triggers_secret_id_company_secrets_id_fk": {+ "name": "routine_triggers_secret_id_company_secrets_id_fk",+ "tableFrom": "routine_triggers",+ "columnsFrom": [+ "secret_id"+ ],+ "tableTo": "company_secrets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routine_triggers_created_by_agent_id_agents_id_fk": {+ "name": "routine_triggers_created_by_agent_id_agents_id_fk",+ "tableFrom": "routine_triggers",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routine_triggers_updated_by_agent_id_agents_id_fk": {+ "name": "routine_triggers_updated_by_agent_id_agents_id_fk",+ "tableFrom": "routine_triggers",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routines": {+ "name": "routines",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "folder_id": {+ "name": "folder_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "goal_id": {+ "name": "goal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "parent_issue_id": {+ "name": "parent_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_agent_id": {+ "name": "assignee_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'medium'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "concurrency_policy": {+ "name": "concurrency_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'coalesce_if_active'"+ },+ "catch_up_policy": {+ "name": "catch_up_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'skip_missed'"+ },+ "activity_gate_policy": {+ "name": "activity_gate_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'always'"+ },+ "activity_gate_scope": {+ "name": "activity_gate_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'company'"+ },+ "origin_kind": {+ "name": "origin_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'manual'"+ },+ "origin_id": {+ "name": "origin_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "variables": {+ "name": "variables",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "env": {+ "name": "env",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "latest_revision_id": {+ "name": "latest_revision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "latest_revision_number": {+ "name": "latest_revision_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_agent_id": {+ "name": "updated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_triggered_at": {+ "name": "last_triggered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_enqueued_at": {+ "name": "last_enqueued_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "routines_company_status_idx": {+ "name": "routines_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routines_company_assignee_idx": {+ "name": "routines_company_assignee_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "assignee_agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routines_company_project_idx": {+ "name": "routines_company_project_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routines_company_folder_idx": {+ "name": "routines_company_folder_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "folder_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routines_company_responsible_user_idx": {+ "name": "routines_company_responsible_user_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "responsible_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "routines_company_origin_idx": {+ "name": "routines_company_origin_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "origin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "routines_company_id_companies_id_fk": {+ "name": "routines_company_id_companies_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routines_project_id_projects_id_fk": {+ "name": "routines_project_id_projects_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "routines_folder_id_folders_id_fk": {+ "name": "routines_folder_id_folders_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "folder_id"+ ],+ "tableTo": "folders",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routines_goal_id_goals_id_fk": {+ "name": "routines_goal_id_goals_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "goal_id"+ ],+ "tableTo": "goals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routines_parent_issue_id_issues_id_fk": {+ "name": "routines_parent_issue_id_issues_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "parent_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routines_assignee_agent_id_agents_id_fk": {+ "name": "routines_assignee_agent_id_agents_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "assignee_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "routines_created_by_agent_id_agents_id_fk": {+ "name": "routines_created_by_agent_id_agents_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "routines_updated_by_agent_id_agents_id_fk": {+ "name": "routines_updated_by_agent_id_agents_id_fk",+ "tableFrom": "routines",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.secret_access_events": {+ "name": "secret_access_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "secret_id": {+ "name": "secret_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "user_secret_definition_id": {+ "name": "user_secret_definition_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "secret_scope": {+ "name": "secret_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'company'"+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "responsible_user_id": {+ "name": "responsible_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_owner_user_id": {+ "name": "credential_owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_subject_type": {+ "name": "credential_subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_subject_id": {+ "name": "credential_subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "consumer_type": {+ "name": "consumer_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "consumer_id": {+ "name": "consumer_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "config_path": {+ "name": "config_path",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_run_id": {+ "name": "heartbeat_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "secret_access_events_company_created_idx": {+ "name": "secret_access_events_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "secret_access_events_secret_created_idx": {+ "name": "secret_access_events_secret_created_idx",+ "columns": [+ {+ "expression": "secret_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "secret_access_events_user_definition_created_idx": {+ "name": "secret_access_events_user_definition_created_idx",+ "columns": [+ {+ "expression": "user_secret_definition_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "secret_access_events_company_credential_owner_idx": {+ "name": "secret_access_events_company_credential_owner_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "credential_owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "secret_access_events_consumer_idx": {+ "name": "secret_access_events_consumer_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "consumer_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "consumer_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "secret_access_events_run_idx": {+ "name": "secret_access_events_run_idx",+ "columns": [+ {+ "expression": "heartbeat_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "secret_access_events_company_id_companies_id_fk": {+ "name": "secret_access_events_company_id_companies_id_fk",+ "tableFrom": "secret_access_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "secret_access_events_secret_id_company_secrets_id_fk": {+ "name": "secret_access_events_secret_id_company_secrets_id_fk",+ "tableFrom": "secret_access_events",+ "columnsFrom": [+ "secret_id"+ ],+ "tableTo": "company_secrets",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "secret_access_events_user_secret_definition_id_user_secret_definitions_id_fk": {+ "name": "secret_access_events_user_secret_definition_id_user_secret_definitions_id_fk",+ "tableFrom": "secret_access_events",+ "columnsFrom": [+ "user_secret_definition_id"+ ],+ "tableTo": "user_secret_definitions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "secret_access_events_issue_id_issues_id_fk": {+ "name": "secret_access_events_issue_id_issues_id_fk",+ "tableFrom": "secret_access_events",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "secret_access_events",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "secret_access_events_plugin_id_plugins_id_fk": {+ "name": "secret_access_events_plugin_id_plugins_id_fk",+ "tableFrom": "secret_access_events",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.smoke_run_steps": {+ "name": "smoke_run_steps",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "path": {+ "name": "path",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scenario_step": {+ "name": "scenario_step",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "detail": {+ "name": "detail",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "screenshot_artifact_ref": {+ "name": "screenshot_artifact_ref",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "duration_ms": {+ "name": "duration_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "smoke_run_steps_company_run_idx": {+ "name": "smoke_run_steps_company_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "smoke_run_steps_company_path_idx": {+ "name": "smoke_run_steps_company_path_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "path",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "smoke_run_steps_company_id_companies_id_fk": {+ "name": "smoke_run_steps_company_id_companies_id_fk",+ "tableFrom": "smoke_run_steps",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "smoke_run_steps_run_id_smoke_runs_id_fk": {+ "name": "smoke_run_steps_run_id_smoke_runs_id_fk",+ "tableFrom": "smoke_run_steps",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "smoke_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.smoke_runs": {+ "name": "smoke_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'running'"+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "smoke_runs_company_started_idx": {+ "name": "smoke_runs_company_started_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "smoke_runs_company_status_idx": {+ "name": "smoke_runs_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "smoke_runs_company_id_companies_id_fk": {+ "name": "smoke_runs_company_id_companies_id_fk",+ "tableFrom": "smoke_runs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.status_card_updates": {+ "name": "status_card_updates",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "card_id": {+ "name": "card_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "generation_issue_id": {+ "name": "generation_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "changes": {+ "name": "changes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "cost_cents": {+ "name": "cost_cents",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "query_version": {+ "name": "query_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "change_summary": {+ "name": "change_summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "status_card_updates_card_started_idx": {+ "name": "status_card_updates_card_started_idx",+ "columns": [+ {+ "expression": "card_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "status_card_updates_generation_issue_idx": {+ "name": "status_card_updates_generation_issue_idx",+ "columns": [+ {+ "expression": "generation_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "status_card_updates_card_id_status_cards_id_fk": {+ "name": "status_card_updates_card_id_status_cards_id_fk",+ "tableFrom": "status_card_updates",+ "columnsFrom": [+ "card_id"+ ],+ "tableTo": "status_cards",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "status_card_updates_generation_issue_id_issues_id_fk": {+ "name": "status_card_updates_generation_issue_id_issues_id_fk",+ "tableFrom": "status_card_updates",+ "columnsFrom": [+ "generation_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "status_card_updates_run_id_heartbeat_runs_id_fk": {+ "name": "status_card_updates_run_id_heartbeat_runs_id_fk",+ "tableFrom": "status_card_updates",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.status_cards": {+ "name": "status_cards",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title_pinned": {+ "name": "title_pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "interest_prompt": {+ "name": "interest_prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "queries": {+ "name": "queries",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "query_version": {+ "name": "query_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "query_compiled_at": {+ "name": "query_compiled_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "query_compiled_by_agent_id": {+ "name": "query_compiled_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_policy": {+ "name": "refresh_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compiling'"+ },+ "pending_change_count": {+ "name": "pending_change_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "pending_change_hash": {+ "name": "pending_change_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_change_at": {+ "name": "last_change_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "fingerprint": {+ "name": "fingerprint",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "fingerprint_at": {+ "name": "fingerprint_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "mentioned_issue_ids": {+ "name": "mentioned_issue_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_update_run_kind": {+ "name": "last_update_run_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_generated_at": {+ "name": "last_generated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_model": {+ "name": "last_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "generating_issue_id": {+ "name": "generating_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "next_eval_at": {+ "name": "next_eval_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_user_id": {+ "name": "archived_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_agent_id": {+ "name": "archived_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "status_cards_company_archived_idx": {+ "name": "status_cards_company_archived_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "archived_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "status_cards_company_next_eval_idx": {+ "name": "status_cards_company_next_eval_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_eval_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "status_cards_company_id_companies_id_fk": {+ "name": "status_cards_company_id_companies_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "status_cards_created_by_agent_id_agents_id_fk": {+ "name": "status_cards_created_by_agent_id_agents_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "status_cards_query_compiled_by_agent_id_agents_id_fk": {+ "name": "status_cards_query_compiled_by_agent_id_agents_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "query_compiled_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "status_cards_agent_id_agents_id_fk": {+ "name": "status_cards_agent_id_agents_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "status_cards_document_id_documents_id_fk": {+ "name": "status_cards_document_id_documents_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "status_cards_generating_issue_id_issues_id_fk": {+ "name": "status_cards_generating_issue_id_issues_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "generating_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "status_cards_archived_by_agent_id_agents_id_fk": {+ "name": "status_cards_archived_by_agent_id_agents_id_fk",+ "tableFrom": "status_cards",+ "columnsFrom": [+ "archived_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.status_decision_effects": {+ "name": "status_decision_effects",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "decision_id": {+ "name": "decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "ordinal": {+ "name": "ordinal",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "effect_kind": {+ "name": "effect_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "delivery_state": {+ "name": "delivery_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempt_count": {+ "name": "attempt_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "delivered_at": {+ "name": "delivered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "status_decision_effects_decision_ordinal_uq": {+ "name": "status_decision_effects_decision_ordinal_uq",+ "columns": [+ {+ "expression": "decision_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "ordinal",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "status_decision_effects_company_idempotency_uq": {+ "name": "status_decision_effects_company_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "status_decision_effects_company_id_companies_id_fk": {+ "name": "status_decision_effects_company_id_companies_id_fk",+ "tableFrom": "status_decision_effects",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "status_decision_effects_issue_company_fk": {+ "name": "status_decision_effects_issue_company_fk",+ "tableFrom": "status_decision_effects",+ "columnsFrom": [+ "company_id",+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "status_decision_effects_decision_owner_fk": {+ "name": "status_decision_effects_decision_owner_fk",+ "tableFrom": "status_decision_effects",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "decision_id"+ ],+ "tableTo": "status_decisions",+ "columnsTo": [+ "company_id",+ "issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.status_decisions": {+ "name": "status_decisions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "assessment_id": {+ "name": "assessment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "decision_version": {+ "name": "decision_version",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "policy_version": {+ "name": "policy_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "from_status": {+ "name": "from_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "to_status": {+ "name": "to_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason_code": {+ "name": "reason_code",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "decision_json": {+ "name": "decision_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "decision_digest": {+ "name": "decision_digest",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "application_state": {+ "name": "application_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'proposed'"+ },+ "supersedes_decision_id": {+ "name": "supersedes_decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "applied_at": {+ "name": "applied_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "status_decisions_company_issue_version_uq": {+ "name": "status_decisions_company_issue_version_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "decision_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "status_decisions_company_assessment_uq": {+ "name": "status_decisions_company_assessment_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "assessment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "status_decisions_company_issue_digest_uq": {+ "name": "status_decisions_company_issue_digest_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "decision_digest",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "status_decisions_company_id_companies_id_fk": {+ "name": "status_decisions_company_id_companies_id_fk",+ "tableFrom": "status_decisions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "status_decisions_issue_company_fk": {+ "name": "status_decisions_issue_company_fk",+ "tableFrom": "status_decisions",+ "columnsFrom": [+ "company_id",+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "status_decisions_assessment_owner_fk": {+ "name": "status_decisions_assessment_owner_fk",+ "tableFrom": "status_decisions",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "assessment_id"+ ],+ "tableTo": "work_assessments",+ "columnsTo": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "status_decisions_supersedes_owner_fk": {+ "name": "status_decisions_supersedes_owner_fk",+ "tableFrom": "status_decisions",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "supersedes_decision_id"+ ],+ "tableTo": "status_decisions",+ "columnsTo": [+ "company_id",+ "issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "status_decisions_company_issue_id_uq": {+ "name": "status_decisions_company_issue_id_uq",+ "columns": [+ "company_id",+ "issue_id",+ "id"+ ],+ "nullsNotDistinct": false+ },+ "status_decisions_company_issue_run_assessment_id_uq": {+ "name": "status_decisions_company_issue_run_assessment_id_uq",+ "columns": [+ "company_id",+ "issue_id",+ "run_id",+ "assessment_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.summary_slots": {+ "name": "summary_slots",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "scope_kind": {+ "name": "scope_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "slot_key": {+ "name": "slot_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'idle'"+ },+ "failure_reason": {+ "name": "failure_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "generating_issue_id": {+ "name": "generating_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_generated_at": {+ "name": "last_generated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_generated_by_agent_id": {+ "name": "last_generated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_model": {+ "name": "last_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "summary_slots_document_uq": {+ "name": "summary_slots_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "summary_slots_company_scope_idx": {+ "name": "summary_slots_company_scope_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "summary_slots_company_generating_issue_idx": {+ "name": "summary_slots_company_generating_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "generating_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "summary_slots_company_updated_idx": {+ "name": "summary_slots_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "summary_slots_company_id_companies_id_fk": {+ "name": "summary_slots_company_id_companies_id_fk",+ "tableFrom": "summary_slots",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "summary_slots_document_id_documents_id_fk": {+ "name": "summary_slots_document_id_documents_id_fk",+ "tableFrom": "summary_slots",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "documents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "summary_slots_generating_issue_id_issues_id_fk": {+ "name": "summary_slots_generating_issue_id_issues_id_fk",+ "tableFrom": "summary_slots",+ "columnsFrom": [+ "generating_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "summary_slots_last_generated_by_agent_id_agents_id_fk": {+ "name": "summary_slots_last_generated_by_agent_id_agents_id_fk",+ "tableFrom": "summary_slots",+ "columnsFrom": [+ "last_generated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "summary_slots_company_scope_slot_uq": {+ "name": "summary_slots_company_scope_slot_uq",+ "columns": [+ "company_id",+ "scope_kind",+ "scope_id",+ "slot_key"+ ],+ "nullsNotDistinct": true+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_access_audit_events": {+ "name": "tool_access_audit_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "gateway_id": {+ "name": "gateway_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_token_id": {+ "name": "gateway_token_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_public_id": {+ "name": "gateway_public_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_name": {+ "name": "client_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "correlation_id": {+ "name": "correlation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "catalog_entry_id": {+ "name": "catalog_entry_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason_code": {+ "name": "reason_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "details": {+ "name": "details",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_access_audit_company_created_idx": {+ "name": "tool_access_audit_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_access_audit_connection_idx": {+ "name": "tool_access_audit_connection_idx",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_access_audit_gateway_idx": {+ "name": "tool_access_audit_gateway_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "gateway_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_access_audit_events_company_id_companies_id_fk": {+ "name": "tool_access_audit_events_company_id_companies_id_fk",+ "tableFrom": "tool_access_audit_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_access_audit_events_gateway_id_tool_mcp_gateways_id_fk": {+ "name": "tool_access_audit_events_gateway_id_tool_mcp_gateways_id_fk",+ "tableFrom": "tool_access_audit_events",+ "columnsFrom": [+ "gateway_id"+ ],+ "tableTo": "tool_mcp_gateways",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_access_audit_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {+ "name": "tool_access_audit_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk",+ "tableFrom": "tool_access_audit_events",+ "columnsFrom": [+ "gateway_token_id"+ ],+ "tableTo": "tool_mcp_gateway_tokens",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_access_audit_events_connection_id_tool_connections_id_fk": {+ "name": "tool_access_audit_events_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_access_audit_events",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_access_audit_events_catalog_entry_id_tool_catalog_entries_id_fk": {+ "name": "tool_access_audit_events_catalog_entry_id_tool_catalog_entries_id_fk",+ "tableFrom": "tool_access_audit_events",+ "columnsFrom": [+ "catalog_entry_id"+ ],+ "tableTo": "tool_catalog_entries",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_action_requests": {+ "name": "tool_action_requests",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "invocation_id": {+ "name": "invocation_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "interaction_id": {+ "name": "interaction_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "approval_id": {+ "name": "approval_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "canonical_arguments_hash": {+ "name": "canonical_arguments_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "canonical_arguments_summary": {+ "name": "canonical_arguments_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "signed_arguments": {+ "name": "signed_arguments",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "preview_markdown": {+ "name": "preview_markdown",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_by_agent_id": {+ "name": "requested_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "requested_by_user_id": {+ "name": "requested_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_agent_id": {+ "name": "resolved_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decided_by_agent_id": {+ "name": "decided_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "decided_by_user_id": {+ "name": "decided_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decided_at": {+ "name": "decided_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_action_requests_company_status_idx": {+ "name": "tool_action_requests_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_action_requests_invocation_idx": {+ "name": "tool_action_requests_invocation_idx",+ "columns": [+ {+ "expression": "invocation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_action_requests_issue_idx": {+ "name": "tool_action_requests_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_action_requests_company_id_companies_id_fk": {+ "name": "tool_action_requests_company_id_companies_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_action_requests_invocation_id_tool_invocations_id_fk": {+ "name": "tool_action_requests_invocation_id_tool_invocations_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "invocation_id"+ ],+ "tableTo": "tool_invocations",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_action_requests_issue_id_issues_id_fk": {+ "name": "tool_action_requests_issue_id_issues_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_action_requests_interaction_id_issue_thread_interactions_id_fk": {+ "name": "tool_action_requests_interaction_id_issue_thread_interactions_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "interaction_id"+ ],+ "tableTo": "issue_thread_interactions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_action_requests_approval_id_approvals_id_fk": {+ "name": "tool_action_requests_approval_id_approvals_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "approval_id"+ ],+ "tableTo": "approvals",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_action_requests_requested_by_agent_id_agents_id_fk": {+ "name": "tool_action_requests_requested_by_agent_id_agents_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "requested_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_action_requests_resolved_by_agent_id_agents_id_fk": {+ "name": "tool_action_requests_resolved_by_agent_id_agents_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "resolved_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_action_requests_decided_by_agent_id_agents_id_fk": {+ "name": "tool_action_requests_decided_by_agent_id_agents_id_fk",+ "tableFrom": "tool_action_requests",+ "columnsFrom": [+ "decided_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_applications": {+ "name": "tool_applications",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "application_key": {+ "name": "application_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "plugin_id": {+ "name": "plugin_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_agent_id": {+ "name": "owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_applications_company_idx": {+ "name": "tool_applications_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_applications_company_status_idx": {+ "name": "tool_applications_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_applications_company_name_uq": {+ "name": "tool_applications_company_name_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_applications_company_key_uq": {+ "name": "tool_applications_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "application_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_applications_company_id_companies_id_fk": {+ "name": "tool_applications_company_id_companies_id_fk",+ "tableFrom": "tool_applications",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_applications_plugin_id_plugins_id_fk": {+ "name": "tool_applications_plugin_id_plugins_id_fk",+ "tableFrom": "tool_applications",+ "columnsFrom": [+ "plugin_id"+ ],+ "tableTo": "plugins",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_applications_owner_agent_id_agents_id_fk": {+ "name": "tool_applications_owner_agent_id_agents_id_fk",+ "tableFrom": "tool_applications",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_call_events": {+ "name": "tool_call_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_id": {+ "name": "gateway_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_token_id": {+ "name": "gateway_token_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_public_id": {+ "name": "gateway_public_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_subject_type": {+ "name": "client_subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_subject_id": {+ "name": "client_subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_name": {+ "name": "client_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_session_id": {+ "name": "mcp_session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "correlation_id": {+ "name": "correlation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "catalog_entry_id": {+ "name": "catalog_entry_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "invocation_id": {+ "name": "invocation_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "action_request_id": {+ "name": "action_request_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "runtime_slot_id": {+ "name": "runtime_slot_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "tool_name": {+ "name": "tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decision": {+ "name": "decision",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "matched_policy_ids": {+ "name": "matched_policy_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "reason_code": {+ "name": "reason_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "policy_explanation": {+ "name": "policy_explanation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "credential_scope_summary": {+ "name": "credential_scope_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "header_policy_summary": {+ "name": "header_policy_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "latency_ms": {+ "name": "latency_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "arguments_summary": {+ "name": "arguments_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "request_hash": {+ "name": "request_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "request_summary": {+ "name": "request_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "result_hash": {+ "name": "result_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "result_summary": {+ "name": "result_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "result_size_bytes": {+ "name": "result_size_bytes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "redaction_plan": {+ "name": "redaction_plan",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "rate_limit_state": {+ "name": "rate_limit_state",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error_message": {+ "name": "error_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_call_events_company_created_idx": {+ "name": "tool_call_events_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_call_events_run_idx": {+ "name": "tool_call_events_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_call_events_issue_idx": {+ "name": "tool_call_events_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_call_events_invocation_idx": {+ "name": "tool_call_events_invocation_idx",+ "columns": [+ {+ "expression": "invocation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_call_events_gateway_idx": {+ "name": "tool_call_events_gateway_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "gateway_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_call_events_company_id_companies_id_fk": {+ "name": "tool_call_events_company_id_companies_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_call_events_agent_id_agents_id_fk": {+ "name": "tool_call_events_agent_id_agents_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_run_id_heartbeat_runs_id_fk": {+ "name": "tool_call_events_run_id_heartbeat_runs_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_issue_id_issues_id_fk": {+ "name": "tool_call_events_issue_id_issues_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_gateway_id_tool_mcp_gateways_id_fk": {+ "name": "tool_call_events_gateway_id_tool_mcp_gateways_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "gateway_id"+ ],+ "tableTo": "tool_mcp_gateways",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {+ "name": "tool_call_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "gateway_token_id"+ ],+ "tableTo": "tool_mcp_gateway_tokens",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_application_id_tool_applications_id_fk": {+ "name": "tool_call_events_application_id_tool_applications_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_connection_id_tool_connections_id_fk": {+ "name": "tool_call_events_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_catalog_entry_id_tool_catalog_entries_id_fk": {+ "name": "tool_call_events_catalog_entry_id_tool_catalog_entries_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "catalog_entry_id"+ ],+ "tableTo": "tool_catalog_entries",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_invocation_id_tool_invocations_id_fk": {+ "name": "tool_call_events_invocation_id_tool_invocations_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "invocation_id"+ ],+ "tableTo": "tool_invocations",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_action_request_id_tool_action_requests_id_fk": {+ "name": "tool_call_events_action_request_id_tool_action_requests_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "action_request_id"+ ],+ "tableTo": "tool_action_requests",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_call_events_runtime_slot_id_tool_runtime_slots_id_fk": {+ "name": "tool_call_events_runtime_slot_id_tool_runtime_slots_id_fk",+ "tableFrom": "tool_call_events",+ "columnsFrom": [+ "runtime_slot_id"+ ],+ "tableTo": "tool_runtime_slots",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_catalog_entries": {+ "name": "tool_catalog_entries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "entry_kind": {+ "name": "entry_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'tool'"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_name": {+ "name": "tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_schema": {+ "name": "input_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "output_schema": {+ "name": "output_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "annotations": {+ "name": "annotations",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "risk_level": {+ "name": "risk_level",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'read'"+ },+ "is_read_only": {+ "name": "is_read_only",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "is_write": {+ "name": "is_write",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_destructive": {+ "name": "is_destructive",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "version": {+ "name": "version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "version_hash": {+ "name": "version_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "schema_hash": {+ "name": "schema_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "reviewed_at": {+ "name": "reviewed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "reviewed_by_agent_id": {+ "name": "reviewed_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "reviewed_by_user_id": {+ "name": "reviewed_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "quarantined_at": {+ "name": "quarantined_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "quarantine_reason": {+ "name": "quarantine_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_catalog_entries_company_idx": {+ "name": "tool_catalog_entries_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_catalog_entries_application_idx": {+ "name": "tool_catalog_entries_application_idx",+ "columns": [+ {+ "expression": "application_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_catalog_entries_connection_idx": {+ "name": "tool_catalog_entries_connection_idx",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_catalog_entries_company_status_idx": {+ "name": "tool_catalog_entries_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_catalog_entries_connection_name_uq": {+ "name": "tool_catalog_entries_connection_name_uq",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_catalog_entries_company_id_companies_id_fk": {+ "name": "tool_catalog_entries_company_id_companies_id_fk",+ "tableFrom": "tool_catalog_entries",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_catalog_entries_application_id_tool_applications_id_fk": {+ "name": "tool_catalog_entries_application_id_tool_applications_id_fk",+ "tableFrom": "tool_catalog_entries",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_catalog_entries_connection_id_tool_connections_id_fk": {+ "name": "tool_catalog_entries_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_catalog_entries",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_catalog_entries_reviewed_by_agent_id_agents_id_fk": {+ "name": "tool_catalog_entries_reviewed_by_agent_id_agents_id_fk",+ "tableFrom": "tool_catalog_entries",+ "columnsFrom": [+ "reviewed_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_connection_installs": {+ "name": "tool_connection_installs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_connection_installs_company_target_idx": {+ "name": "tool_connection_installs_company_target_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_connection_installs_connection_idx": {+ "name": "tool_connection_installs_connection_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_connection_installs_target_uq": {+ "name": "tool_connection_installs_target_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_connection_installs_company_id_companies_id_fk": {+ "name": "tool_connection_installs_company_id_companies_id_fk",+ "tableFrom": "tool_connection_installs",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_connection_installs_connection_id_tool_connections_id_fk": {+ "name": "tool_connection_installs_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_connection_installs",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_connection_installs_created_by_agent_id_agents_id_fk": {+ "name": "tool_connection_installs_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_connection_installs",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "tool_connection_installs_target_type_check": {+ "name": "tool_connection_installs_target_type_check",+ "value": "\"tool_connection_installs\".\"target_type\" in ('company', 'agent')"+ }+ },+ "isRLSEnabled": false+ },+ "public.tool_connections": {+ "name": "tool_connections",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "uid": {+ "name": "uid",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "connection_kind": {+ "name": "connection_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'managed'"+ },+ "ownership": {+ "name": "ownership",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'customer'"+ },+ "transport": {+ "name": "transport",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_kind": {+ "name": "auth_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'none'"+ },+ "credential_source": {+ "name": "credential_source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'paperclip_vault'"+ },+ "external_credential": {+ "name": "external_credential",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "credential_policy": {+ "name": "credential_policy",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'shared'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'draft'"+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "transport_config": {+ "name": "transport_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "credential_refs": {+ "name": "credential_refs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "credential_secret_refs": {+ "name": "credential_secret_refs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "health_status": {+ "name": "health_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unchecked'"+ },+ "health_message": {+ "name": "health_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "health_checked_at": {+ "name": "health_checked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_health_at": {+ "name": "last_health_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_catalog_refresh_at": {+ "name": "last_catalog_refresh_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_connections_company_idx": {+ "name": "tool_connections_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_connections_application_idx": {+ "name": "tool_connections_application_idx",+ "columns": [+ {+ "expression": "application_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_connections_company_enabled_idx": {+ "name": "tool_connections_company_enabled_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "enabled",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_connections_company_uid_uq": {+ "name": "tool_connections_company_uid_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "uid",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_connections_company_id_companies_id_fk": {+ "name": "tool_connections_company_id_companies_id_fk",+ "tableFrom": "tool_connections",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_connections_application_id_tool_applications_id_fk": {+ "name": "tool_connections_application_id_tool_applications_id_fk",+ "tableFrom": "tool_connections",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "tool_connections_created_by_agent_id_agents_id_fk": {+ "name": "tool_connections_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_connections",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "tool_connections_company_id_uq": {+ "name": "tool_connections_company_id_uq",+ "columns": [+ "company_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "tool_connections_ownership_check": {+ "name": "tool_connections_ownership_check",+ "value": "\"tool_connections\".\"ownership\" in ('platform_shared', 'platform_provisioned', 'customer', 'dcr')"+ },+ "tool_connections_transport_check": {+ "name": "tool_connections_transport_check",+ "value": "\"tool_connections\".\"transport\" in ('mcp_remote', 'rest_api', 'local_stdio')"+ },+ "tool_connections_auth_kind_check": {+ "name": "tool_connections_auth_kind_check",+ "value": "\"tool_connections\".\"auth_kind\" in ('oauth', 'api_key', 'none')"+ },+ "tool_connections_credential_source_check": {+ "name": "tool_connections_credential_source_check",+ "value": "\"tool_connections\".\"credential_source\" in ('paperclip_vault', 'vercel_connect')"+ },+ "tool_connections_credential_source_one_of_check": {+ "name": "tool_connections_credential_source_one_of_check",+ "value": "(\n (\"tool_connections\".\"credential_source\" = 'paperclip_vault' and \"tool_connections\".\"external_credential\" is null)\n or\n (\"tool_connections\".\"credential_source\" = 'vercel_connect' and \"tool_connections\".\"external_credential\" is not null and jsonb_array_length(\"tool_connections\".\"credential_refs\") = 0 and jsonb_array_length(\"tool_connections\".\"credential_secret_refs\") = 0)\n )"+ },+ "tool_connections_credential_policy_check": {+ "name": "tool_connections_credential_policy_check",+ "value": "\"tool_connections\".\"credential_policy\" in ('shared', 'per_user', 'per_user_with_fallback')"+ }+ },+ "isRLSEnabled": false+ },+ "public.tool_gateway_rate_limit_counters": {+ "name": "tool_gateway_rate_limit_counters",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "counter_key": {+ "name": "counter_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "window_start_at": {+ "name": "window_start_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "window_ms": {+ "name": "window_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "limit": {+ "name": "limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "count": {+ "name": "count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "reset_at": {+ "name": "reset_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_gateway_rate_limit_counters_company_idx": {+ "name": "tool_gateway_rate_limit_counters_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_gateway_rate_limit_counters_window_uq": {+ "name": "tool_gateway_rate_limit_counters_window_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "counter_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "window_start_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_gateway_rate_limit_counters_company_id_companies_id_fk": {+ "name": "tool_gateway_rate_limit_counters_company_id_companies_id_fk",+ "tableFrom": "tool_gateway_rate_limit_counters",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_gateway_sessions": {+ "name": "tool_gateway_sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_id": {+ "name": "gateway_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_token_id": {+ "name": "gateway_token_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_public_id": {+ "name": "gateway_public_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_subject_type": {+ "name": "client_subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_subject_id": {+ "name": "client_subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_name": {+ "name": "client_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_session_id": {+ "name": "mcp_session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "correlation_id": {+ "name": "correlation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "token_hash": {+ "name": "token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_gateway_sessions_token_hash_uq": {+ "name": "tool_gateway_sessions_token_hash_uq",+ "columns": [+ {+ "expression": "token_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_gateway_sessions_company_agent_idx": {+ "name": "tool_gateway_sessions_company_agent_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_gateway_sessions_company_expires_idx": {+ "name": "tool_gateway_sessions_company_expires_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_gateway_sessions_run_idx": {+ "name": "tool_gateway_sessions_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_gateway_sessions_issue_idx": {+ "name": "tool_gateway_sessions_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_gateway_sessions_gateway_idx": {+ "name": "tool_gateway_sessions_gateway_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "gateway_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_gateway_sessions_company_id_companies_id_fk": {+ "name": "tool_gateway_sessions_company_id_companies_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_gateway_sessions_agent_id_agents_id_fk": {+ "name": "tool_gateway_sessions_agent_id_agents_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_gateway_sessions_run_id_heartbeat_runs_id_fk": {+ "name": "tool_gateway_sessions_run_id_heartbeat_runs_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_gateway_sessions_issue_id_issues_id_fk": {+ "name": "tool_gateway_sessions_issue_id_issues_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_gateway_sessions_project_id_projects_id_fk": {+ "name": "tool_gateway_sessions_project_id_projects_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_gateway_sessions_gateway_id_tool_mcp_gateways_id_fk": {+ "name": "tool_gateway_sessions_gateway_id_tool_mcp_gateways_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "gateway_id"+ ],+ "tableTo": "tool_mcp_gateways",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_gateway_sessions_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {+ "name": "tool_gateway_sessions_gateway_token_id_tool_mcp_gateway_tokens_id_fk",+ "tableFrom": "tool_gateway_sessions",+ "columnsFrom": [+ "gateway_token_id"+ ],+ "tableTo": "tool_mcp_gateway_tokens",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_invocations": {+ "name": "tool_invocations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "idempotency_key": {+ "name": "idempotency_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_id": {+ "name": "gateway_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_token_id": {+ "name": "gateway_token_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "gateway_public_id": {+ "name": "gateway_public_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_subject_type": {+ "name": "client_subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_subject_id": {+ "name": "client_subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_name": {+ "name": "client_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_session_id": {+ "name": "mcp_session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "correlation_id": {+ "name": "correlation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "catalog_entry_id": {+ "name": "catalog_entry_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "catalog_version_hash": {+ "name": "catalog_version_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "catalog_schema_hash": {+ "name": "catalog_schema_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_type": {+ "name": "provider_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "application_key": {+ "name": "application_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "upstream_tool_name": {+ "name": "upstream_tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "risk_level": {+ "name": "risk_level",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tool_name": {+ "name": "tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "arguments_hash": {+ "name": "arguments_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "arguments_summary": {+ "name": "arguments_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "policy_decision": {+ "name": "policy_decision",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "matched_policy_ids": {+ "name": "matched_policy_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "policy_explanation": {+ "name": "policy_explanation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "credential_scope_summary": {+ "name": "credential_scope_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "header_policy_summary": {+ "name": "header_policy_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "approval_state": {+ "name": "approval_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'not_required'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "upstream_request_id": {+ "name": "upstream_request_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "result_hash": {+ "name": "result_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "result_summary": {+ "name": "result_summary",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "result_size_bytes": {+ "name": "result_size_bytes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "result_artifact_id": {+ "name": "result_artifact_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error_message": {+ "name": "error_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_invocations_company_created_idx": {+ "name": "tool_invocations_company_created_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_invocations_run_idx": {+ "name": "tool_invocations_run_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_invocations_issue_idx": {+ "name": "tool_invocations_issue_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_invocations_gateway_idx": {+ "name": "tool_invocations_gateway_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "gateway_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_invocations_company_idempotency_uq": {+ "name": "tool_invocations_company_idempotency_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "idempotency_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_invocations_company_id_companies_id_fk": {+ "name": "tool_invocations_company_id_companies_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_invocations_agent_id_agents_id_fk": {+ "name": "tool_invocations_agent_id_agents_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_issue_id_issues_id_fk": {+ "name": "tool_invocations_issue_id_issues_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_run_id_heartbeat_runs_id_fk": {+ "name": "tool_invocations_run_id_heartbeat_runs_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_gateway_id_tool_mcp_gateways_id_fk": {+ "name": "tool_invocations_gateway_id_tool_mcp_gateways_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "gateway_id"+ ],+ "tableTo": "tool_mcp_gateways",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {+ "name": "tool_invocations_gateway_token_id_tool_mcp_gateway_tokens_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "gateway_token_id"+ ],+ "tableTo": "tool_mcp_gateway_tokens",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_application_id_tool_applications_id_fk": {+ "name": "tool_invocations_application_id_tool_applications_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_connection_id_tool_connections_id_fk": {+ "name": "tool_invocations_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_invocations_catalog_entry_id_tool_catalog_entries_id_fk": {+ "name": "tool_invocations_catalog_entry_id_tool_catalog_entries_id_fk",+ "tableFrom": "tool_invocations",+ "columnsFrom": [+ "catalog_entry_id"+ ],+ "tableTo": "tool_catalog_entries",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_mcp_gateway_tokens": {+ "name": "tool_mcp_gateway_tokens",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "gateway_id": {+ "name": "gateway_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "token_hash": {+ "name": "token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "token_prefix": {+ "name": "token_prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'gateway_client'"+ },+ "subject_id": {+ "name": "subject_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_label": {+ "name": "client_label",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "owner_note": {+ "name": "owner_note",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "allowed_actions": {+ "name": "allowed_actions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[\"tools/list\",\"tools/call\"]'::jsonb"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "expiry_override_reason": {+ "name": "expiry_override_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "expiry_override_by_user_id": {+ "name": "expiry_override_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "expiry_override_by_agent_id": {+ "name": "expiry_override_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "expiry_override_at": {+ "name": "expiry_override_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_mcp_gateway_tokens_token_hash_uq": {+ "name": "tool_mcp_gateway_tokens_token_hash_uq",+ "columns": [+ {+ "expression": "token_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateway_tokens_gateway_idx": {+ "name": "tool_mcp_gateway_tokens_gateway_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "gateway_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateway_tokens_subject_idx": {+ "name": "tool_mcp_gateway_tokens_subject_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "subject_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateway_tokens_company_expires_idx": {+ "name": "tool_mcp_gateway_tokens_company_expires_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_mcp_gateway_tokens_company_id_companies_id_fk": {+ "name": "tool_mcp_gateway_tokens_company_id_companies_id_fk",+ "tableFrom": "tool_mcp_gateway_tokens",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_mcp_gateway_tokens_gateway_id_tool_mcp_gateways_id_fk": {+ "name": "tool_mcp_gateway_tokens_gateway_id_tool_mcp_gateways_id_fk",+ "tableFrom": "tool_mcp_gateway_tokens",+ "columnsFrom": [+ "gateway_id"+ ],+ "tableTo": "tool_mcp_gateways",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_mcp_gateway_tokens_expiry_override_by_agent_id_agents_id_fk": {+ "name": "tool_mcp_gateway_tokens_expiry_override_by_agent_id_agents_id_fk",+ "tableFrom": "tool_mcp_gateway_tokens",+ "columnsFrom": [+ "expiry_override_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_mcp_gateway_tokens_created_by_agent_id_agents_id_fk": {+ "name": "tool_mcp_gateway_tokens_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_mcp_gateway_tokens",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_mcp_gateways": {+ "name": "tool_mcp_gateways",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "gateway_public_id": {+ "name": "gateway_public_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'gw_' || replace(gen_random_uuid()::text, '-', '')"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "display_slug": {+ "name": "display_slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "profile_id": {+ "name": "profile_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "default_profile_mode": {+ "name": "default_profile_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'gateway_only'"+ },+ "context_scope_type": {+ "name": "context_scope_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'none'"+ },+ "context_scope_id": {+ "name": "context_scope_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "approval_issue_id": {+ "name": "approval_issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "auth_config": {+ "name": "auth_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{\"version\":1,\"bearer\":{\"enabled\":true,\"tokenPrefix\":\"pcgw\",\"defaultTtlSeconds\":7776000,\"requireFiniteExpiry\":true,\"longLivedTokenRequiresOverride\":true},\"oauth\":{\"enabled\":false,\"reservedFor\":\"v1_5\",\"dynamicClientRegistration\":false,\"authorizationCodePkce\":false}}'::jsonb"+ },+ "header_policy": {+ "name": "header_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{\"version\":1,\"callerPassthrough\":{\"enabled\":false,\"allowedHeaders\":[]},\"staticHeaders\":[],\"generatedMetadata\":{\"enabled\":false,\"allowedHeaders\":[]},\"responseHeaders\":{\"forwardMcpRequiredHeaders\":true,\"forwardSafeCacheHeaders\":true}}'::jsonb"+ },+ "metadata_policy": {+ "name": "metadata_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{\"version\":1,\"forwardCompanyId\":false,\"forwardGatewayId\":false,\"forwardProjectId\":false,\"forwardIssueId\":false,\"forwardAgentId\":false,\"forwardRunId\":false,\"forwardCorrelationId\":true}'::jsonb"+ },+ "on_demand_tools_config": {+ "name": "on_demand_tools_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{\"enabled\":false,\"searchToolName\":\"search_tools\",\"runToolName\":\"run_tool\"}'::jsonb"+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_mcp_gateways_company_idx": {+ "name": "tool_mcp_gateways_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateways_company_status_idx": {+ "name": "tool_mcp_gateways_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateways_profile_idx": {+ "name": "tool_mcp_gateways_profile_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "profile_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateways_public_id_uq": {+ "name": "tool_mcp_gateways_public_id_uq",+ "columns": [+ {+ "expression": "gateway_public_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateways_company_slug_uq": {+ "name": "tool_mcp_gateways_company_slug_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_mcp_gateways_company_name_uq": {+ "name": "tool_mcp_gateways_company_name_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_mcp_gateways_company_id_companies_id_fk": {+ "name": "tool_mcp_gateways_company_id_companies_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_mcp_gateways_profile_id_tool_profiles_id_fk": {+ "name": "tool_mcp_gateways_profile_id_tool_profiles_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "profile_id"+ ],+ "tableTo": "tool_profiles",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "restrict"+ },+ "tool_mcp_gateways_agent_id_agents_id_fk": {+ "name": "tool_mcp_gateways_agent_id_agents_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_mcp_gateways_project_id_projects_id_fk": {+ "name": "tool_mcp_gateways_project_id_projects_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_mcp_gateways_issue_id_issues_id_fk": {+ "name": "tool_mcp_gateways_issue_id_issues_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_mcp_gateways_approval_issue_id_issues_id_fk": {+ "name": "tool_mcp_gateways_approval_issue_id_issues_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "approval_issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_mcp_gateways_created_by_agent_id_agents_id_fk": {+ "name": "tool_mcp_gateways_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_mcp_gateways",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_oauth_states": {+ "name": "tool_oauth_states",+ "schema": "",+ "columns": {+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "code_verifier": {+ "name": "code_verifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_actor_type": {+ "name": "created_by_actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_actor_id": {+ "name": "created_by_actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_session_id": {+ "name": "created_by_session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "subject_user_id": {+ "name": "subject_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requested_scopes": {+ "name": "requested_scopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "return_to": {+ "name": "return_to",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "interaction_id": {+ "name": "interaction_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_oauth_states_company_idx": {+ "name": "tool_oauth_states_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_oauth_states_connection_idx": {+ "name": "tool_oauth_states_connection_idx",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_oauth_states_actor_idx": {+ "name": "tool_oauth_states_actor_idx",+ "columns": [+ {+ "expression": "created_by_actor_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_by_actor_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_oauth_states_expires_at_idx": {+ "name": "tool_oauth_states_expires_at_idx",+ "columns": [+ {+ "expression": "expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_oauth_states_company_id_companies_id_fk": {+ "name": "tool_oauth_states_company_id_companies_id_fk",+ "tableFrom": "tool_oauth_states",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_oauth_states_connection_id_tool_connections_id_fk": {+ "name": "tool_oauth_states_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_oauth_states",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_policies": {+ "name": "tool_policies",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "policy_type": {+ "name": "policy_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 100+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "selectors": {+ "name": "selectors",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "conditions": {+ "name": "conditions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_policies_company_enabled_idx": {+ "name": "tool_policies_company_enabled_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "enabled",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_policies_company_type_idx": {+ "name": "tool_policies_company_type_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "policy_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_policies_company_name_uq": {+ "name": "tool_policies_company_name_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_policies_company_id_companies_id_fk": {+ "name": "tool_policies_company_id_companies_id_fk",+ "tableFrom": "tool_policies",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_policies_created_by_agent_id_agents_id_fk": {+ "name": "tool_policies_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_policies",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_profile_bindings": {+ "name": "tool_profile_bindings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "profile_id": {+ "name": "profile_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 100+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_profile_bindings_company_target_idx": {+ "name": "tool_profile_bindings_company_target_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_profile_bindings_target_profile_uq": {+ "name": "tool_profile_bindings_target_profile_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "profile_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_profile_bindings_company_id_companies_id_fk": {+ "name": "tool_profile_bindings_company_id_companies_id_fk",+ "tableFrom": "tool_profile_bindings",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_profile_bindings_profile_id_tool_profiles_id_fk": {+ "name": "tool_profile_bindings_profile_id_tool_profiles_id_fk",+ "tableFrom": "tool_profile_bindings",+ "columnsFrom": [+ "profile_id"+ ],+ "tableTo": "tool_profiles",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_profile_bindings_created_by_agent_id_agents_id_fk": {+ "name": "tool_profile_bindings_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_profile_bindings",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_profile_entries": {+ "name": "tool_profile_entries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "profile_id": {+ "name": "profile_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "selector_type": {+ "name": "selector_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "effect": {+ "name": "effect",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'include'"+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "catalog_entry_id": {+ "name": "catalog_entry_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "tool_name": {+ "name": "tool_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "risk_level": {+ "name": "risk_level",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "conditions": {+ "name": "conditions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_profile_entries_company_profile_idx": {+ "name": "tool_profile_entries_company_profile_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "profile_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_profile_entries_application_idx": {+ "name": "tool_profile_entries_application_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "application_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_profile_entries_connection_idx": {+ "name": "tool_profile_entries_connection_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_profile_entries_catalog_entry_idx": {+ "name": "tool_profile_entries_catalog_entry_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "catalog_entry_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_profile_entries_company_id_companies_id_fk": {+ "name": "tool_profile_entries_company_id_companies_id_fk",+ "tableFrom": "tool_profile_entries",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_profile_entries_profile_id_tool_profiles_id_fk": {+ "name": "tool_profile_entries_profile_id_tool_profiles_id_fk",+ "tableFrom": "tool_profile_entries",+ "columnsFrom": [+ "profile_id"+ ],+ "tableTo": "tool_profiles",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_profile_entries_application_id_tool_applications_id_fk": {+ "name": "tool_profile_entries_application_id_tool_applications_id_fk",+ "tableFrom": "tool_profile_entries",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_profile_entries_connection_id_tool_connections_id_fk": {+ "name": "tool_profile_entries_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_profile_entries",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_profile_entries_catalog_entry_id_tool_catalog_entries_id_fk": {+ "name": "tool_profile_entries_catalog_entry_id_tool_catalog_entries_id_fk",+ "tableFrom": "tool_profile_entries",+ "columnsFrom": [+ "catalog_entry_id"+ ],+ "tableTo": "tool_catalog_entries",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_profiles": {+ "name": "tool_profiles",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "profile_key": {+ "name": "profile_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "default_action": {+ "name": "default_action",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'deny'"+ },+ "new_tools_reviewed_at": {+ "name": "new_tools_reviewed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_profiles_company_status_idx": {+ "name": "tool_profiles_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_profiles_company_key_uq": {+ "name": "tool_profiles_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "profile_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_profiles_company_name_uq": {+ "name": "tool_profiles_company_name_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_profiles_company_id_companies_id_fk": {+ "name": "tool_profiles_company_id_companies_id_fk",+ "tableFrom": "tool_profiles",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_rate_limit_counters": {+ "name": "tool_rate_limit_counters",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "policy_id": {+ "name": "policy_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "counter_key": {+ "name": "counter_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_type": {+ "name": "scope_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "window_kind": {+ "name": "window_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "window_start_at": {+ "name": "window_start_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "limit": {+ "name": "limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "remaining": {+ "name": "remaining",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "reset_at": {+ "name": "reset_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_rate_limit_counters_company_idx": {+ "name": "tool_rate_limit_counters_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_rate_limit_counters_window_uq": {+ "name": "tool_rate_limit_counters_window_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "policy_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "counter_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "window_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "window_start_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_rate_limit_counters_company_id_companies_id_fk": {+ "name": "tool_rate_limit_counters_company_id_companies_id_fk",+ "tableFrom": "tool_rate_limit_counters",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_rate_limit_counters_policy_id_tool_policies_id_fk": {+ "name": "tool_rate_limit_counters_policy_id_tool_policies_id_fk",+ "tableFrom": "tool_rate_limit_counters",+ "columnsFrom": [+ "policy_id"+ ],+ "tableTo": "tool_policies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_runtime_metric_counters": {+ "name": "tool_runtime_metric_counters",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "metric": {+ "name": "metric",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "bucket_start_at": {+ "name": "bucket_start_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "count": {+ "name": "count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_runtime_metric_counters_company_metric_idx": {+ "name": "tool_runtime_metric_counters_company_metric_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "metric",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "bucket_start_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_runtime_metric_counters_bucket_uq": {+ "name": "tool_runtime_metric_counters_bucket_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "metric",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "bucket_start_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_runtime_metric_counters_company_id_companies_id_fk": {+ "name": "tool_runtime_metric_counters_company_id_companies_id_fk",+ "tableFrom": "tool_runtime_metric_counters",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_runtime_slots": {+ "name": "tool_runtime_slots",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "application_id": {+ "name": "application_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_workspace_id": {+ "name": "project_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "owner_scope_type": {+ "name": "owner_scope_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'connection'"+ },+ "owner_scope_id": {+ "name": "owner_scope_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runtime_kind": {+ "name": "runtime_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_stdio'"+ },+ "slot_key": {+ "name": "slot_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'stopped'"+ },+ "reuse_key": {+ "name": "reuse_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_scope": {+ "name": "workspace_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_scope_hash": {+ "name": "credential_scope_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_ref": {+ "name": "provider_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "process_id": {+ "name": "process_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "command_template_key": {+ "name": "command_template_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "health_status": {+ "name": "health_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unchecked'"+ },+ "health_message": {+ "name": "health_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_health_check_at": {+ "name": "last_health_check_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_started_at": {+ "name": "last_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "stopped_at": {+ "name": "stopped_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "idle_expires_at": {+ "name": "idle_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "idle_deadline_at": {+ "name": "idle_deadline_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_runtime_slots_company_idx": {+ "name": "tool_runtime_slots_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_runtime_slots_connection_idx": {+ "name": "tool_runtime_slots_connection_idx",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_runtime_slots_execution_workspace_idx": {+ "name": "tool_runtime_slots_execution_workspace_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_runtime_slots_slot_key_uq": {+ "name": "tool_runtime_slots_slot_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slot_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_runtime_slots_company_id_companies_id_fk": {+ "name": "tool_runtime_slots_company_id_companies_id_fk",+ "tableFrom": "tool_runtime_slots",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_runtime_slots_application_id_tool_applications_id_fk": {+ "name": "tool_runtime_slots_application_id_tool_applications_id_fk",+ "tableFrom": "tool_runtime_slots",+ "columnsFrom": [+ "application_id"+ ],+ "tableTo": "tool_applications",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_runtime_slots_connection_id_tool_connections_id_fk": {+ "name": "tool_runtime_slots_connection_id_tool_connections_id_fk",+ "tableFrom": "tool_runtime_slots",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "tool_connections",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_runtime_slots_project_workspace_id_project_workspaces_id_fk": {+ "name": "tool_runtime_slots_project_workspace_id_project_workspaces_id_fk",+ "tableFrom": "tool_runtime_slots",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "tableTo": "project_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_runtime_slots_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "tool_runtime_slots_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "tool_runtime_slots",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "tool_runtime_slots_issue_id_issues_id_fk": {+ "name": "tool_runtime_slots_issue_id_issues_id_fk",+ "tableFrom": "tool_runtime_slots",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.tool_stdio_command_templates": {+ "name": "tool_stdio_command_templates",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "template_key": {+ "name": "template_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "command": {+ "name": "command",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "args": {+ "name": "args",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "env_keys": {+ "name": "env_keys",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "tools": {+ "name": "tools",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "disabled_at": {+ "name": "disabled_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "tool_stdio_command_templates_company_idx": {+ "name": "tool_stdio_command_templates_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_stdio_command_templates_company_status_idx": {+ "name": "tool_stdio_command_templates_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "tool_stdio_command_templates_company_key_uq": {+ "name": "tool_stdio_command_templates_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "template_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "tool_stdio_command_templates_company_id_companies_id_fk": {+ "name": "tool_stdio_command_templates_company_id_companies_id_fk",+ "tableFrom": "tool_stdio_command_templates",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "tool_stdio_command_templates_created_by_agent_id_agents_id_fk": {+ "name": "tool_stdio_command_templates_created_by_agent_id_agents_id_fk",+ "tableFrom": "tool_stdio_command_templates",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_inbox_agent_policies": {+ "name": "user_inbox_agent_policies",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "mode": {+ "name": "mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'open'"+ },+ "allowed_agent_ids": {+ "name": "allowed_agent_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_inbox_agent_policies_company_user_uq": {+ "name": "user_inbox_agent_policies_company_user_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_inbox_agent_policies_allowed_agent_ids_idx": {+ "name": "user_inbox_agent_policies_allowed_agent_ids_idx",+ "columns": [+ {+ "expression": "allowed_agent_ids",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "gin",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "user_inbox_agent_policies_company_id_companies_id_fk": {+ "name": "user_inbox_agent_policies_company_id_companies_id_fk",+ "tableFrom": "user_inbox_agent_policies",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "user_inbox_agent_policies_mode_check": {+ "name": "user_inbox_agent_policies_mode_check",+ "value": "\"user_inbox_agent_policies\".\"mode\" in ('open', 'allowlist', 'disabled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.user_secret_declarations": {+ "name": "user_secret_declarations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_secret_definition_id": {+ "name": "user_secret_definition_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "config_path": {+ "name": "config_path",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "env_key": {+ "name": "env_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "version_selector": {+ "name": "version_selector",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'latest'"+ },+ "required": {+ "name": "required",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "allow_missing_override": {+ "name": "allow_missing_override",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_secret_declarations_company_idx": {+ "name": "user_secret_declarations_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_declarations_definition_idx": {+ "name": "user_secret_declarations_definition_idx",+ "columns": [+ {+ "expression": "user_secret_definition_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_declarations_target_idx": {+ "name": "user_secret_declarations_target_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_declarations_company_required_idx": {+ "name": "user_secret_declarations_company_required_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "required",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_declarations_target_path_uq": {+ "name": "user_secret_declarations_target_path_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "config_path",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_declarations_required_override_idx": {+ "name": "user_secret_declarations_required_override_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "allow_missing_override",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"user_secret_declarations\".\"allow_missing_override\" = true",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "user_secret_declarations_company_id_companies_id_fk": {+ "name": "user_secret_declarations_company_id_companies_id_fk",+ "tableFrom": "user_secret_declarations",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "user_secret_declarations_user_secret_definition_id_user_secret_definitions_id_fk": {+ "name": "user_secret_declarations_user_secret_definition_id_user_secret_definitions_id_fk",+ "tableFrom": "user_secret_declarations",+ "columnsFrom": [+ "user_secret_definition_id"+ ],+ "tableTo": "user_secret_definitions",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_secret_definitions": {+ "name": "user_secret_definitions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_encrypted'"+ },+ "managed_mode": {+ "name": "managed_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'paperclip_managed'"+ },+ "provider_config_id": {+ "name": "provider_config_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider_metadata": {+ "name": "provider_metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "usage_guidance": {+ "name": "usage_guidance",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_agent_id": {+ "name": "updated_by_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_secret_definitions_company_status_idx": {+ "name": "user_secret_definitions_company_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_definitions_company_provider_idx": {+ "name": "user_secret_definitions_company_provider_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_definitions_provider_config_idx": {+ "name": "user_secret_definitions_provider_config_idx",+ "columns": [+ {+ "expression": "provider_config_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "user_secret_definitions_company_key_uq": {+ "name": "user_secret_definitions_company_key_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"user_secret_definitions\".\"deleted_at\" is null",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "user_secret_definitions_company_id_companies_id_fk": {+ "name": "user_secret_definitions_company_id_companies_id_fk",+ "tableFrom": "user_secret_definitions",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "user_secret_definitions_provider_config_id_company_secret_provider_configs_id_fk": {+ "name": "user_secret_definitions_provider_config_id_company_secret_provider_configs_id_fk",+ "tableFrom": "user_secret_definitions",+ "columnsFrom": [+ "provider_config_id"+ ],+ "tableTo": "company_secret_provider_configs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "user_secret_definitions_created_by_agent_id_agents_id_fk": {+ "name": "user_secret_definitions_created_by_agent_id_agents_id_fk",+ "tableFrom": "user_secret_definitions",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "user_secret_definitions_updated_by_agent_id_agents_id_fk": {+ "name": "user_secret_definitions_updated_by_agent_id_agents_id_fk",+ "tableFrom": "user_secret_definitions",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_sidebar_preferences": {+ "name": "user_sidebar_preferences",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "company_order": {+ "name": "company_order",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_sidebar_preferences_user_uq": {+ "name": "user_sidebar_preferences_user_uq",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.work_assessments": {+ "name": "work_assessments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "turn_id": {+ "name": "turn_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "contract_id": {+ "name": "contract_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "result_id": {+ "name": "result_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "trigger_kind": {+ "name": "trigger_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "trigger_ref": {+ "name": "trigger_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_capability": {+ "name": "trigger_capability",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_actor_company_id": {+ "name": "trigger_actor_company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "prior_issue_status": {+ "name": "prior_issue_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prior_status_version": {+ "name": "prior_status_version",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "prior_decision_id": {+ "name": "prior_decision_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "policy_version": {+ "name": "policy_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "assessment_json": {+ "name": "assessment_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "input_digest": {+ "name": "input_digest",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "supersedes_assessment_id": {+ "name": "supersedes_assessment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "work_assessments_company_issue_input_uq": {+ "name": "work_assessments_company_issue_input_uq",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "input_digest",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "work_assessments_company_id_companies_id_fk": {+ "name": "work_assessments_company_id_companies_id_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "work_assessments_trigger_actor_company_id_companies_id_fk": {+ "name": "work_assessments_trigger_actor_company_id_companies_id_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "trigger_actor_company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "work_assessments_issue_company_fk": {+ "name": "work_assessments_issue_company_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "company_id",+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "company_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "work_assessments_run_owner_fk": {+ "name": "work_assessments_run_owner_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "company_id",+ "native_issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "work_assessments_contract_owner_fk": {+ "name": "work_assessments_contract_owner_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "contract_id"+ ],+ "tableTo": "completion_contracts",+ "columnsTo": [+ "company_id",+ "issue_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "work_assessments_result_owner_fk": {+ "name": "work_assessments_result_owner_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "result_id"+ ],+ "tableTo": "native_run_results",+ "columnsTo": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "work_assessments_supersedes_owner_fk": {+ "name": "work_assessments_supersedes_owner_fk",+ "tableFrom": "work_assessments",+ "columnsFrom": [+ "company_id",+ "issue_id",+ "run_id",+ "supersedes_assessment_id"+ ],+ "tableTo": "work_assessments",+ "columnsTo": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "work_assessments_company_issue_run_id_uq": {+ "name": "work_assessments_company_issue_run_id_uq",+ "columns": [+ "company_id",+ "issue_id",+ "run_id",+ "id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "work_assessments_trigger_actor_company_check": {+ "name": "work_assessments_trigger_actor_company_check",+ "value": "\"work_assessments\".\"trigger_actor_company_id\" = \"work_assessments\".\"company_id\""+ }+ },+ "isRLSEnabled": false+ },+ "public.workspace_operations": {+ "name": "workspace_operations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "heartbeat_run_id": {+ "name": "heartbeat_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "phase": {+ "name": "phase",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "command": {+ "name": "command",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cwd": {+ "name": "cwd",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'running'"+ },+ "exit_code": {+ "name": "exit_code",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "log_store": {+ "name": "log_store",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_ref": {+ "name": "log_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_bytes": {+ "name": "log_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "log_sha256": {+ "name": "log_sha256",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "log_compressed": {+ "name": "log_compressed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "stdout_excerpt": {+ "name": "stdout_excerpt",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "stderr_excerpt": {+ "name": "stderr_excerpt",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_operations_company_run_started_idx": {+ "name": "workspace_operations_company_run_started_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "heartbeat_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "workspace_operations_company_workspace_started_idx": {+ "name": "workspace_operations_company_workspace_started_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "workspace_operations_company_workspace_issue_started_idx": {+ "name": "workspace_operations_company_workspace_issue_started_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "workspace_operations_company_id_companies_id_fk": {+ "name": "workspace_operations_company_id_companies_id_fk",+ "tableFrom": "workspace_operations",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "workspace_operations_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "workspace_operations_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "workspace_operations",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "workspace_operations",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_operations_issue_id_issues_id_fk": {+ "name": "workspace_operations_issue_id_issues_id_fk",+ "tableFrom": "workspace_operations",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace_runtime_services": {+ "name": "workspace_runtime_services",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true+ },+ "company_id": {+ "name": "company_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "project_workspace_id": {+ "name": "project_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "execution_workspace_id": {+ "name": "execution_workspace_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "issue_id": {+ "name": "issue_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "scope_type": {+ "name": "scope_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_id": {+ "name": "scope_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "service_name": {+ "name": "service_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "lifecycle": {+ "name": "lifecycle",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reuse_key": {+ "name": "reuse_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "command": {+ "name": "command",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cwd": {+ "name": "cwd",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "port": {+ "name": "port",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_ref": {+ "name": "provider_ref",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "owner_agent_id": {+ "name": "owner_agent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "started_by_run_id": {+ "name": "started_by_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "stopped_at": {+ "name": "stopped_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "stop_policy": {+ "name": "stop_policy",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "exposure": {+ "name": "exposure",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "exposure_handle": {+ "name": "exposure_handle",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "backend_url": {+ "name": "backend_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "health_status": {+ "name": "health_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unknown'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_runtime_services_company_workspace_status_idx": {+ "name": "workspace_runtime_services_company_workspace_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "workspace_runtime_services_company_execution_workspace_status_idx": {+ "name": "workspace_runtime_services_company_execution_workspace_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "execution_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "workspace_runtime_services_company_project_status_idx": {+ "name": "workspace_runtime_services_company_project_status_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "workspace_runtime_services_run_idx": {+ "name": "workspace_runtime_services_run_idx",+ "columns": [+ {+ "expression": "started_by_run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "workspace_runtime_services_company_updated_idx": {+ "name": "workspace_runtime_services_company_updated_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "workspace_runtime_services_company_id_companies_id_fk": {+ "name": "workspace_runtime_services_company_id_companies_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "company_id"+ ],+ "tableTo": "companies",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "workspace_runtime_services_project_id_projects_id_fk": {+ "name": "workspace_runtime_services_project_id_projects_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "projects",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk": {+ "name": "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "tableTo": "project_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "tableTo": "execution_workspaces",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_runtime_services_issue_id_issues_id_fk": {+ "name": "workspace_runtime_services_issue_id_issues_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issues",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_runtime_services_owner_agent_id_agents_id_fk": {+ "name": "workspace_runtime_services_owner_agent_id_agents_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "tableTo": "agents",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk": {+ "name": "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk",+ "tableFrom": "workspace_runtime_services",+ "columnsFrom": [+ "started_by_run_id"+ ],+ "tableTo": "heartbeat_runs",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {},+ "schemas": {},+ "views": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/src/migrations/meta/_journal.json b/packages/db/src/migrations/meta/_journal.jsonindex 4c73fdf57b..73c8e90ec6 100644--- a/packages/db/src/migrations/meta/_journal.json+++ b/packages/db/src/migrations/meta/_journal.json@@ -1639,6 +1639,13 @@"when": 1788198788171,"tag": "0235_heartbeat_run_event_sequence_uniqueness","breakpoints": true+ },+ {+ "idx": 236,+ "version": "7",+ "when": 1788283761224,+ "tag": "0236_remove_cheap_model_profiles",+ "breakpoints": true}]}diff --git a/packages/plugins/plugin-llm-wiki/src/manifest.ts b/packages/plugins/plugin-llm-wiki/src/manifest.tsindex de611ae6ad..ec235d38fe 100644--- a/packages/plugins/plugin-llm-wiki/src/manifest.ts+++ b/packages/plugins/plugin-llm-wiki/src/manifest.ts@@ -167,13 +167,6 @@ const manifest: PaperclipPluginManifestV1 = {desiredSkills: WIKI_MANAGED_SKILL_CANONICAL_KEYS}},- runtimeConfig: {- modelProfiles: {- cheap: {- purpose: "classification, lint planning, index maintenance"- }- }- },permissions: {pluginTools: [PLUGIN_ID]},diff --git a/packages/plugins/plugin-llm-wiki/src/ui/app.tsx b/packages/plugins/plugin-llm-wiki/src/ui/app.tsxindex 07ba8af680..bc596eee2e 100644--- a/packages/plugins/plugin-llm-wiki/src/ui/app.tsx+++ b/packages/plugins/plugin-llm-wiki/src/ui/app.tsx@@ -5443,7 +5443,6 @@ function DistillationSettingsPanel({ context, settings }: { context: { companyIdconst counts = data?.counts ?? { cursors: 0, runningRuns: 0, failedRuns24h: 0, reviewRequired: 0 };const isConfigured = cursors.length > 0;const autoApplyRestriction = settings.distillationPolicy?.autoApplyRestriction ?? null;- const [useCheapPath, setUseCheapPath] = useState(true);const projectsCovered = useMemo(() => {const set = new Set<string>();@@ -5463,7 +5462,6 @@ function DistillationSettingsPanel({ context, settings }: { context: { companyIdtry {await distillNow({companyId: context.companyId,- useCheapModelProfile: useCheapPath,idempotencyKey: `manual:company:${Date.now()}`,});toast({@@ -5515,7 +5513,6 @@ function DistillationSettingsPanel({ context, settings }: { context: { companyIdcompanyId: context.companyId,projectId: target.projectId ?? undefined,rootIssueId: target.rootIssueId ?? undefined,- useCheapModelProfile: useCheapPath,});toast({ tone: "success", title: "Backfill queued", body: target.projectName ?? target.rootIssueIdentifier ?? "Selected scope" });overview.refresh();@@ -5607,8 +5604,7 @@ function DistillationSettingsPanel({ context, settings }: { context: { companyId</div></div><Tiny style={{ marginTop: 6 }}>- Distillation runs on the assigned Wiki Maintainer agent and writes only into the default- space. Use the cheap path option when the agent exposes a cheap model profile.+ Distillation runs on the assigned Wiki Maintainer agent and writes only into the default space.</Tiny></Callout>@@ -5670,13 +5666,6 @@ function DistillationSettingsPanel({ context, settings }: { context: { companyId: "No maintainer agent resolved"}</div></SettingField>- <SettingField label="Cheap path" hint="When enabled, manual distill and backfill operation issues request assigneeAdapterOverrides.modelProfile = cheap.">- <CheckboxRow- label="Request the assigned agent's cheap model profile for distillation tasks"- checked={useCheapPath}- onChange={setUseCheapPath}- />- </SettingField></div></CardBody></Card>diff --git a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts b/packages/plugins/plugin-llm-wiki/src/wiki/core.tsindex a0033f8c29..b907f3bc48 100644--- a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts+++ b/packages/plugins/plugin-llm-wiki/src/wiki/core.ts@@ -260,7 +260,6 @@ type OperationInput = {operationType: "ingest" | "query" | "lint" | "file-as-page" | "index" | "distill" | "backfill";title?: string | null;prompt?: string | null;- useCheapModelProfile?: boolean;};type OperationSpaceContext = {@@ -2354,7 +2353,6 @@ export async function createOperationIssue(ctx: PluginContext, input: OperationIstatus: "todo",priority: input.operationType === "query" ? "medium" : "low",assigneeAgentId: assignableAgentId,- assigneeAdapterOverrides: input.useCheapModelProfile ? { modelProfile: "cheap" } : null,billingCode: operationBillingCode(wikiId, space),surfaceVisibility: "plugin_operation",originKind: `${OPERATION_ORIGIN_KIND}:${input.operationType}` as PluginIssueOriginKind,diff --git a/packages/plugins/plugin-llm-wiki/src/worker.ts b/packages/plugins/plugin-llm-wiki/src/worker.tsindex 0335b31b6e..1484427eac 100644--- a/packages/plugins/plugin-llm-wiki/src/worker.ts+++ b/packages/plugins/plugin-llm-wiki/src/worker.ts@@ -296,7 +296,6 @@ const plugin = definePlugin({operationType,title: stringField(params.title),prompt: stringField(params.prompt),- useCheapModelProfile: params.useCheapModelProfile === true,});});@@ -447,7 +446,6 @@ const plugin = definePlugin({spaceSlug,operationType: "backfill",title: scope.rootIssueId ? "Backfill Paperclip root issue wiki history" : "Backfill Paperclip project wiki history",- useCheapModelProfile: params.useCheapModelProfile === true,prompt: ["Backfill LLM Wiki distillation was queued from a per-space Paperclip ingestion profile.",scope.projectId ? `Project ID: ${scope.projectId}` : null,@@ -618,7 +616,6 @@ const plugin = definePlugin({: projectId? "Distill Paperclip project into wiki": "Distill Paperclip changes into wiki",- useCheapModelProfile: params.useCheapModelProfile === true,prompt: buildManualDistillPrompt({ companyId, projectId, rootIssueId }),});return { status: "queued", workItem, operation };@@ -660,7 +657,6 @@ const plugin = definePlugin({spaceSlug,operationType: "backfill",title: rootIssueId ? "Backfill Paperclip root issue wiki history" : "Backfill Paperclip project wiki history",- useCheapModelProfile: params.useCheapModelProfile === true,prompt: ["Backfill LLM Wiki distillation requested for a bounded Paperclip source window.",projectId ? `Project ID: ${projectId}` : null,diff --git a/packages/plugins/plugin-llm-wiki/tests/plugin.spec.ts b/packages/plugins/plugin-llm-wiki/tests/plugin.spec.tsindex 88d33100bc..df52153a0a 100644--- a/packages/plugins/plugin-llm-wiki/tests/plugin.spec.ts+++ b/packages/plugins/plugin-llm-wiki/tests/plugin.spec.ts@@ -1213,7 +1213,7 @@ Duplicate headings receive stable suffixes.expect(markup).not.toContain("Permissions are stored but not enforced");});- it("renders distillation settings with assigned-agent model selection and cheap path without budget controls", () => {+ it("renders distillation settings with assigned-agent execution without budget controls", () => {mockPathname = "/PAP/wiki/settings/distillation";mockDistillationOverviewData = {counts: { cursors: 1, runningRuns: 0, failedRuns24h: 0, reviewRequired: 0 },@@ -1236,8 +1236,6 @@ Duplicate headings receive stable suffixes.expect(markup).toContain("Agent execution");expect(markup).toContain("Assigned maintainer");expect(markup).toContain("Wiki Maintainer · claude local");- expect(markup).toContain("Cheap path");- expect(markup).toContain("assigneeAdapterOverrides.modelProfile = cheap");expect(markup).toContain("All sections — apply when source hash matches and confidence");expect(markup).not.toContain("Per-task budget");expect(markup).not.toContain("Project total budget");@@ -2279,12 +2277,11 @@ Duplicate headings receive stable suffixes.await plugin.definition.setup(harness.ctx);const result = await harness.performAction<{status: string;- operation: { issue: { originKind: string; billingCode: string | null; assigneeAgentId: string | null; assigneeAdapterOverrides: { modelProfile?: string } | null; description: string | null } };+ operation: { issue: { originKind: string; billingCode: string | null; assigneeAgentId: string | null; assigneeAdapterOverrides: Record<string, unknown> | null; description: string | null } };workItem: { kind: string; workItemId: string };}>("distill-paperclip-now", {companyId: COMPANY_ID,autoApply: false,- useCheapModelProfile: true,includeSupportingPages: false,});@@ -2293,7 +2290,7 @@ Duplicate headings receive stable suffixes.expect(result.operation.issue.originKind).toBe(`${OPERATION_ORIGIN_KIND}:distill`);expect(result.operation.issue.billingCode).toBe("plugin-llm-wiki:default");expect(result.operation.issue.assigneeAgentId).toBe(wikiMaintainerAgent().id);- expect(result.operation.issue.assigneeAdapterOverrides).toEqual({ modelProfile: "cheap" });+ expect(result.operation.issue.assigneeAdapterOverrides).toBeNull();expect(result.operation.issue.description).toContain("Prompt source: LLM Wiki plugin action `distill-paperclip-now`");expect(result.operation.issue.description).toContain(`Required skill: use the installed \`${PAPERCLIP_DISTILL_SKILL_KEY}\` skill`);expect(result.operation.issue.description).toContain("Do not hardcode a single project");diff --git a/packages/shared/src/constants.ts b/packages/shared/src/constants.tsindex 1ce92fbcda..429809c8d3 100644--- a/packages/shared/src/constants.ts+++ b/packages/shared/src/constants.ts@@ -91,9 +91,6 @@ export const ADAPTER_AGNOSTIC_KEYS = [] as const;export type AdapterAgnosticKey = (typeof ADAPTER_AGNOSTIC_KEYS)[number];-export const MODEL_PROFILE_KEYS = ["cheap"] as const;-export type ModelProfileKey = (typeof MODEL_PROFILE_KEYS)[number];-export const AGENT_ICON_NAMES = ["bot","cpu",diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.tsindex 0234d42ac9..e39c5dbcf4 100644--- a/packages/shared/src/index.ts+++ b/packages/shared/src/index.ts@@ -364,7 +364,6 @@ export {AGENT_DEFAULT_MAX_CONCURRENT_RUNS,WORKSPACE_BRANCH_ROUTINE_VARIABLE,ADAPTER_AGNOSTIC_KEYS,- MODEL_PROFILE_KEYS,AGENT_ICON_NAMES,PROJECT_ICON_NAMES,ISSUE_STATUSES,@@ -562,7 +561,6 @@ export {type AgentAdapterType,type AgentRole,type AdapterAgnosticKey,- type ModelProfileKey,type AgentIconName,type ProjectIconName,type IssueStatus,@@ -1837,6 +1835,7 @@ export {agentSkillSyncSchema,type AgentSkillSync,createAgentSchema,+ agentRuntimeConfigSchema,builtInAgentEmptyMutationSchema,builtInAgentProvisionSchema,builtInAgentResetSchema,diff --git a/packages/shared/src/types/agent.ts b/packages/shared/src/types/agent.tsindex d1cadf7cb5..d9b4f8601d 100644--- a/packages/shared/src/types/agent.ts+++ b/packages/shared/src/types/agent.ts@@ -1,6 +1,5 @@import type {AgentAdapterType,- ModelProfileKey,PauseReason,AgentRole,AgentStatus,@@ -23,15 +22,7 @@ export interface AgentPermissions extends Record<string, unknown> {authorizationPolicy?: TrustAuthorizationPolicy;}-export interface AgentModelProfileConfig {- enabled?: boolean;- label?: string;- adapterConfig: Record<string, unknown>;-}--export interface AgentRuntimeConfig extends Record<string, unknown> {- modelProfiles?: Partial<Record<ModelProfileKey, AgentModelProfileConfig>>;-}+export type AgentRuntimeConfig = Record<string, unknown>;export type AgentInstructionsBundleMode = "managed" | "external";diff --git a/packages/shared/src/types/index.ts b/packages/shared/src/types/index.tsindex 36b9fcd9e0..3fa7eb50d2 100644--- a/packages/shared/src/types/index.ts+++ b/packages/shared/src/types/index.ts@@ -278,7 +278,6 @@ export type {AgentChainOfCommandEntry,AgentDetail,ClearAgentErrorResponse,- AgentModelProfileConfig,AgentPermissions,AgentRuntimeConfig,AgentInstructionsBundleMode,diff --git a/packages/shared/src/types/issue.ts b/packages/shared/src/types/issue.tsindex a52874c03c..a25f8d6187 100644--- a/packages/shared/src/types/issue.ts+++ b/packages/shared/src/types/issue.ts@@ -23,7 +23,6 @@ import type {IssueRecoveryActionOwnerType,IssueRecoveryActionStatus,IssueWorkMode,- ModelProfileKey,IssueThreadInteractionContinuationPolicy,IssueThreadInteractionCanonicalResolverPolicy,IssueThreadInteractionEffectiveResolverPolicySource,@@ -89,7 +88,6 @@ export interface IssueLabel {}export interface IssueAssigneeAdapterOverrides {- modelProfile?: ModelProfileKey;adapterConfig?: Record<string, unknown>;useProjectWorkspace?: boolean;}diff --git a/packages/shared/src/validators/agent.ts b/packages/shared/src/validators/agent.tsindex 30ea65310d..2be813ca6f 100644--- a/packages/shared/src/validators/agent.ts+++ b/packages/shared/src/validators/agent.ts@@ -57,23 +57,19 @@ export const createAgentInstructionsBundleSchema = z.object({}),});-const agentModelProfileConfigSchema = z.object({- enabled: z.boolean().optional(),- label: z.string().trim().min(1).optional(),- // Disabled profiles created before model-profile editing may not have an- // adapter payload yet. Keep them valid so unrelated runtime settings (such- // as debug capture) can be updated without fabricating model configuration.- adapterConfig: adapterConfigSchema.optional().default({}),-}).strict();-export const agentRuntimeConfigSchema = z.object({- modelProfiles: z.object({- cheap: agentModelProfileConfigSchema.optional(),- }).strict().optional(),debug: z.object({providerTrace: z.literal("raw").optional(),}).strict().optional(),-}).catchall(z.unknown());+}).catchall(z.unknown()).superRefine((value, ctx) => {+ if (Object.prototype.hasOwnProperty.call(value, "modelProfiles")) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["modelProfiles"],+ message: "runtimeConfig.modelProfiles is no longer supported",+ });+ }+});export const createAgentSchema = z.object({name: z.string().min(1),diff --git a/packages/shared/src/validators/issue.test.ts b/packages/shared/src/validators/issue.test.tsindex 20161a2094..64f3fd0864 100644--- a/packages/shared/src/validators/issue.test.ts+++ b/packages/shared/src/validators/issue.test.ts@@ -458,29 +458,19 @@ describe("issue validators", () => {expect(parsed.requestDepth).toBe(MAX_ISSUE_REQUEST_DEPTH);});- it("accepts the cheap model profile in issue assignee adapter overrides", () => {- const parsed = createIssueSchema.parse({- title: "Run a cheap heartbeat",+ it("rejects retired model profiles in issue assignee adapter overrides", () => {+ const parsed = createIssueSchema.safeParse({+ title: "Run a heartbeat",assigneeAdapterOverrides: {modelProfile: "cheap",},});- expect(parsed.assigneeAdapterOverrides?.modelProfile).toBe("cheap");- });-- it("rejects unknown issue model profile keys", () => {- const parsed = updateIssueSchema.safeParse({- assigneeAdapterOverrides: {- modelProfile: "fast",- },- });-expect(parsed.success).toBe(false);});- it("validates agent runtime cheap model profile config without rejecting other runtime fields", () => {- const parsed = createAgentSchema.parse({+ it("rejects retired model profiles in agent runtime config", () => {+ const parsed = createAgentSchema.safeParse({name: "Coder",adapterType: "codex_local",runtimeConfig: {@@ -497,47 +487,6 @@ describe("issue validators", () => {},});- expect(parsed.runtimeConfig.modelProfiles?.cheap?.adapterConfig).toEqual({- model: "gpt-5.3-codex-spark",- });- expect(parsed.runtimeConfig.heartbeat).toEqual({ enabled: true });- });-- it("validates cheap model profile env bindings like top-level adapter config", () => {- const parsed = createAgentSchema.safeParse({- name: "Coder",- adapterType: "codex_local",- runtimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- env: {- API_TOKEN: 123,- },- },- },- },- },- });-- expect(parsed.success).toBe(false);- });-- it("rejects unknown agent runtime model profile keys", () => {- const parsed = createAgentSchema.safeParse({- name: "Coder",- adapterType: "codex_local",- runtimeConfig: {- modelProfiles: {- fast: {- adapterConfig: {- model: "gpt-5-mini",- },- },- },- },- });-expect(parsed.success).toBe(false);});});diff --git a/packages/shared/src/validators/issue.ts b/packages/shared/src/validators/issue.tsindex 512ccdbbb3..3412a4d6be 100644--- a/packages/shared/src/validators/issue.ts+++ b/packages/shared/src/validators/issue.ts@@ -32,7 +32,6 @@ import {ISSUE_THREAD_INTERACTION_RESOLVER_POLICY_PROVENANCES,ISSUE_THREAD_INTERACTION_STATUSES,ISSUE_WATCHDOG_DISCOVERY_KINDS,- MODEL_PROFILE_KEYS,REQUEST_CHECKBOX_CONFIRMATION_OPTION_LIMIT,REQUEST_ITEM_VERDICTS_ITEM_LIMIT,} from "../constants.js";@@ -222,7 +221,6 @@ export const issueExecutionWorkspaceSettingsSchema = zexport const issueAssigneeAdapterOverridesSchema = z.object({- modelProfile: z.enum(MODEL_PROFILE_KEYS).optional(),adapterConfig: z.record(z.string(), z.unknown()).optional(),useProjectWorkspace: z.boolean().optional(),})diff --git a/server/src/__tests__/adapter-registry.test.ts b/server/src/__tests__/adapter-registry.test.tsindex 383c76adc8..b7cfa075d3 100644--- a/server/src/__tests__/adapter-registry.test.ts+++ b/server/src/__tests__/adapter-registry.test.ts@@ -7,7 +7,6 @@ import {findActiveServerAdapter,findServerAdapter,listAdapterModels,- listAdapterModelProfiles,registerServerAdapter,requireServerAdapter,unregisterServerAdapter,@@ -62,31 +61,6 @@ describe("server adapter registry", () => {]);});- it("exposes adapter model profiles when adapters declare them", async () => {- const adapterWithProfiles: ServerAdapterModule = {- ...externalAdapter,- modelProfiles: [- {- key: "cheap",- label: "Cheap",- adapterConfig: { model: "external-mini" },- source: "adapter_default",- },- ],- };-- registerServerAdapter(adapterWithProfiles);-- expect(await listAdapterModelProfiles("external_test")).toEqual([- {- key: "cheap",- label: "Cheap",- adapterConfig: { model: "external-mini" },- source: "adapter_default",- },- ]);- });-it("removes external adapters when unregistered", () => {registerServerAdapter(externalAdapter);@@ -275,45 +249,6 @@ describe("server adapter registry", () => {});});- it("built-in local adapters declare cheap model profile defaults where supported", async () => {- await expect(listAdapterModelProfiles("claude_local")).resolves.toEqual([- expect.objectContaining({- key: "cheap",- adapterConfig: expect.objectContaining({ model: "claude-sonnet-4-6" }),- source: "adapter_default",- }),- ]);- await expect(listAdapterModelProfiles("codex_local")).resolves.toEqual([- expect.objectContaining({- key: "cheap",- adapterConfig: {},- source: "adapter_default",- }),- ]);- await expect(listAdapterModelProfiles("gemini_local")).resolves.toEqual([- expect.objectContaining({- key: "cheap",- adapterConfig: expect.objectContaining({ model: "gemini-2.5-flash-lite" }),- source: "adapter_default",- }),- ]);- await expect(listAdapterModelProfiles("opencode_local")).resolves.toEqual([- expect.objectContaining({- key: "cheap",- adapterConfig: expect.objectContaining({ model: "openai/gpt-5.1-codex-mini" }),- source: "adapter_default",- }),- ]);- await expect(listAdapterModelProfiles("cursor")).resolves.toEqual([- expect.objectContaining({- key: "cheap",- adapterConfig: expect.objectContaining({ model: "gpt-5.1-codex-mini" }),- source: "adapter_default",- }),- ]);- await expect(listAdapterModelProfiles("pi_local")).resolves.toEqual([]);- });-it("wraps built-in npm runtime installs with the sandbox-aware install helper", () => {const expectedClaudeInstall = `if ! command -v 'claude' >/dev/null 2>&1; then ${buildSandboxNpmInstallCommand("@anthropic-ai/claude-code")}; fi`;const expectedCodexInstall = `if ! command -v 'codex' >/dev/null 2>&1; then ${buildSandboxNpmInstallCommand("@openai/codex")}; fi`;diff --git a/server/src/__tests__/adapter-routes.test.ts b/server/src/__tests__/adapter-routes.test.tsindex a6ac7455c9..649f030e89 100644--- a/server/src/__tests__/adapter-routes.test.ts+++ b/server/src/__tests__/adapter-routes.test.ts@@ -164,7 +164,6 @@ describe("adapter routes", () => {disabled: false,capabilities: {supportsInstructionsBundle: false,- supportsModelProfiles: true,},});});diff --git a/server/src/__tests__/agent-permissions-routes.test.ts b/server/src/__tests__/agent-permissions-routes.test.tsindex 982cca00a5..4eadf5318a 100644--- a/server/src/__tests__/agent-permissions-routes.test.ts+++ b/server/src/__tests__/agent-permissions-routes.test.ts@@ -434,9 +434,7 @@ describe.sequential("agent permission routes", () => {env: { PAPERCLIP_API_KEY: "secret-test-key" },},runtimeConfig: {- modelProfiles: {- default: { enabled: true, adapterConfig: { model: "openai/gpt-5.4-mini" } },- },+ heartbeat: { enabled: false },},});@@ -456,9 +454,7 @@ describe.sequential("agent permission routes", () => {env: { PAPERCLIP_API_KEY: "secret-test-key" },});expect(res.body.runtimeConfig).toMatchObject({- modelProfiles: {- default: { enabled: true, adapterConfig: { model: "openai/gpt-5.4-mini" } },- },+ heartbeat: { enabled: false },});expect(res.body.permissions).toMatchObject({ trustPreset: LOW_TRUST_REVIEW_PRESET });}, 20_000);@@ -693,165 +689,6 @@ describe.sequential("agent permission routes", () => {expect(mockLogActivity).not.toHaveBeenCalled();});- it("blocks agent-authenticated self-updates that set cheap-profile host-executed workspace commands", async () => {- mockAgentService.getById.mockResolvedValue({- ...baseAgent,- adapterType: "codex_local",- });-- const app = await createApp({- type: "agent",- agentId,- companyId,- source: "agent_key",- runId: "run-1",- });-- const res = await requestApp(app, (baseUrl) => request(baseUrl)- .patch(`/api/agents/${agentId}`)- .send({- runtimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- workspaceStrategy: {- type: "git_worktree",- provisionCommand: "touch /tmp/paperclip-rce",- },- },- },- },- },- }));-- expect(res.status).toBe(403);- expect(res.body.error).toContain("host-executed workspace commands");- expect(res.body.error).toContain(- "runtimeConfig.modelProfiles.cheap.adapterConfig.workspaceStrategy.provisionCommand",- );- expect(mockLogActivity).not.toHaveBeenCalled();- });-- it("allows board updates that set cheap-profile workspace commands", async () => {- mockAgentService.getById.mockResolvedValue({- ...baseAgent,- adapterType: "codex_local",- });-- const app = await createApp({- type: "board",- userId: "board-user",- source: "local_implicit",- isInstanceAdmin: true,- companyIds: [companyId],- });-- const runtimeConfig = {- modelProfiles: {- cheap: {- adapterConfig: {- workspaceStrategy: {- type: "git_worktree",- provisionCommand: "bash ./scripts/provision-worktree.sh",- },- },- },- },- };-- const res = await requestApp(app, (baseUrl) => request(baseUrl)- .patch(`/api/agents/${agentId}`)- .send({ runtimeConfig }));-- expect(res.status, JSON.stringify(res.body)).toBe(200);- expect(mockAgentService.update).toHaveBeenCalledWith(- agentId,- expect.objectContaining({ runtimeConfig }),- expect.anything(),- );- expect(mockLogActivity).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({- action: "agent.updated",- }));- });-- it("normalizes cheap-profile env bindings through the adapter config secret pipeline", async () => {- mockAgentService.getById.mockResolvedValue({- ...baseAgent,- adapterType: "codex_local",- });- mockSecretService.normalizeAdapterConfigForPersistence.mockImplementation(async (_companyId, config) => ({- ...config,- env: {- API_TOKEN: {- type: "secret_ref",- secretId: "33333333-3333-4333-8333-333333333333",- version: "latest",- },- },- }));-- const app = await createApp({- type: "board",- userId: "board-user",- source: "local_implicit",- isInstanceAdmin: true,- companyIds: [companyId],- });-- const res = await requestApp(app, (baseUrl) => request(baseUrl)- .patch(`/api/agents/${agentId}`)- .send({- runtimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- model: "gpt-5.3-codex-spark",- env: {- API_TOKEN: {- type: "secret_ref",- secretId: "33333333-3333-4333-8333-333333333333",- version: "latest",- },- },- },- },- },- },- }));-- expect(res.status, JSON.stringify(res.body)).toBe(200);- expect(mockSecretService.normalizeAdapterConfigForPersistence).toHaveBeenCalledWith(- companyId,- expect.objectContaining({- model: "gpt-5.3-codex-spark",- env: expect.any(Object),- }),- { strictMode: false, adapterType: "codex_local" },- );- expect(mockAgentService.update).toHaveBeenCalledWith(- agentId,- expect.objectContaining({- runtimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- model: "gpt-5.3-codex-spark",- env: {- API_TOKEN: {- type: "secret_ref",- secretId: "33333333-3333-4333-8333-333333333333",- version: "latest",- },- },- },- },- },- },- }),- expect.anything(),- );- });-it("blocks agent-authenticated self-updates that set instructions bundle roots", async () => {const app = await createApp({type: "agent",@@ -1102,81 +939,12 @@ describe.sequential("agent permission routes", () => {intervalSec: 3600,maxConcurrentRuns: 20,},- modelProfiles: {- cheap: { enabled: false },- },},}),{ claudeLogin: { storedSessionId: null, ownerUserId: "board-user", applyExistingWithoutClaim: false } },);});- it("creates agents when optional adapter model profile discovery fails", async () => {- const { registerServerAdapter, unregisterServerAdapter } = await import("../adapters/index.js");- registerServerAdapter({- type: "failing_profile_discovery",- execute: async () => ({ exitCode: 0, signal: null, timedOut: false }),- testEnvironment: async () => ({- adapterType: "failing_profile_discovery",- status: "pass",- checks: [],- testedAt: new Date(0).toISOString(),- }),- listModelProfiles: async () => {- throw new Error("profile discovery unavailable");- },- });-- try {- const app = await createApp({- type: "board",- userId: "board-user",- source: "local_implicit",- isInstanceAdmin: true,- companyIds: [companyId],- });-- const res = await requestApp(app, (baseUrl) => request(baseUrl)- .post(`/api/companies/${companyId}/agents`)- .send({- name: "Builder",- role: "engineer",- adapterType: "failing_profile_discovery",- adapterConfig: {},- runtimeConfig: {- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: {},- },- },- },- }));-- expect(res.status, JSON.stringify(res.body)).toBe(201);- expect(mockAgentService.create).toHaveBeenCalledWith(- companyId,- expect.objectContaining({- runtimeConfig: {- heartbeat: {- enabled: false,- maxConcurrentRuns: 20,- },- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: {},- },- },- },- }),- { claudeLogin: { storedSessionId: null, ownerUserId: "board-user", applyExistingWithoutClaim: false } },- );- } finally {- unregisterServerAdapter("failing_profile_discovery");- }- });-it("seeds opencode agent creation with the static default model without live discovery", async () => {mockEnsureOpenCodeModelConfiguredAndAvailable.mockRejectedValue(new Error("`opencode models` should not be called during creation"),@@ -1284,9 +1052,6 @@ describe.sequential("agent permission routes", () => {intervalSec: 3600,maxConcurrentRuns: 20,},- modelProfiles: {- cheap: { enabled: false },- },},}),{ claudeLogin: { storedSessionId: null, ownerUserId: "board-user", applyExistingWithoutClaim: false } },diff --git a/server/src/__tests__/approval-routes-idempotency.test.ts b/server/src/__tests__/approval-routes-idempotency.test.tsindex afce78bf3e..676ae4ebbd 100644--- a/server/src/__tests__/approval-routes-idempotency.test.ts+++ b/server/src/__tests__/approval-routes-idempotency.test.ts@@ -374,7 +374,6 @@ describe("approval routes idempotent retries", () => {it("blocks status-only recovery runs from creating approvals", async () => {const res = await request(await createAgentApp({contextSnapshot: {- modelProfile: "cheap",recoveryIntent: "status_only",allowDeliverableWork: false,allowDocumentUpdates: false,@@ -388,7 +387,7 @@ describe("approval routes idempotent retries", () => {});expect(res.status, JSON.stringify(res.body)).toBe(403);- expect(res.body.error).toContain("Cheap status-only recovery runs cannot create or modify approvals");+ expect(res.body.error).toContain("Status-only recovery runs cannot create or modify approvals");expect(mockApprovalService.create).not.toHaveBeenCalled();expect(mockIssueApprovalService.linkManyForApproval).not.toHaveBeenCalled();});@@ -405,7 +404,6 @@ describe("approval routes idempotent retries", () => {const res = await request(await createAgentApp({contextSnapshot: {- modelProfile: "cheap",recoveryIntent: "status_only",allowDeliverableWork: false,allowDocumentUpdates: false,@@ -416,7 +414,7 @@ describe("approval routes idempotent retries", () => {.send({ payload: { title: "Retry" } });expect(res.status, JSON.stringify(res.body)).toBe(403);- expect(res.body.error).toContain("Cheap status-only recovery runs cannot create or modify approvals");+ expect(res.body.error).toContain("Status-only recovery runs cannot create or modify approvals");expect(mockApprovalService.resubmit).not.toHaveBeenCalled();});@@ -432,7 +430,6 @@ describe("approval routes idempotent retries", () => {const res = await request(await createAgentApp({contextSnapshot: {- modelProfile: "cheap",recoveryIntent: "status_only",allowDeliverableWork: false,allowDocumentUpdates: false,@@ -443,7 +440,7 @@ describe("approval routes idempotent retries", () => {.send({ body: "please approve" });expect(res.status, JSON.stringify(res.body)).toBe(403);- expect(res.body.error).toContain("Cheap status-only recovery runs cannot create or modify approvals");+ expect(res.body.error).toContain("Status-only recovery runs cannot create or modify approvals");expect(mockApprovalService.addComment).not.toHaveBeenCalled();});});diff --git a/server/src/__tests__/built-in-agents.test.ts b/server/src/__tests__/built-in-agents.test.tsindex 880c53b30d..8f3abf3972 100644--- a/server/src/__tests__/built-in-agents.test.ts+++ b/server/src/__tests__/built-in-agents.test.ts@@ -1209,8 +1209,6 @@ describeEmbeddedPostgres("built-in agents", () => {featureKeys: ["summarizer"],});- expect(state.agent?.runtimeConfig).not.toHaveProperty("modelProfiles.cheap");-expect(state.resources.map((resource) => [resource.resourceKind, resource.stockStatus])).toEqual([["instructions", "stock_current"],["skill", "stock_current"],@@ -1266,24 +1264,6 @@ describeEmbeddedPostgres("built-in agents", () => {});});- it("preserves an operator-overridden cheap summariser model across reconcile", async () => {- const companyId = await seedCompany();- const builtIns = builtInAgentService(db);- const created = await builtIns.ensure(companyId, "summarizer");-- // Operator overrides the cheap lane with a provider-specific low-cost model.- await agentService(db).update(created.agentId!, {- runtimeConfig: {- modelProfiles: { cheap: { enabled: true, label: "Cheap", adapterConfig: { model: "haiku-cheap" } } },- },- }, { allowBuiltInAgentMetadata: true });-- const reconciled = await builtIns.ensure(companyId, "summarizer");- expect(reconciled.agent?.runtimeConfig).toMatchObject({- modelProfiles: { cheap: { adapterConfig: { model: "haiku-cheap" } } },- });- });-it("restores Summarizer instruction drift on reset", async () => {const companyId = await seedCompany();const builtIns = builtInAgentService(db);diff --git a/server/src/__tests__/heartbeat-accepted-plan-workspace-refresh.test.ts b/server/src/__tests__/heartbeat-accepted-plan-workspace-refresh.test.tsindex e7d6c933ba..490c070204 100644--- a/server/src/__tests__/heartbeat-accepted-plan-workspace-refresh.test.ts+++ b/server/src/__tests__/heartbeat-accepted-plan-workspace-refresh.test.ts@@ -62,7 +62,6 @@ vi.mock("../adapters/index.js", () => ({execute: adapterExecute,supportsLocalAgentJwt: false,}),- listAdapterModelProfiles: async () => [],runningProcesses: new Map(),}));diff --git a/server/src/__tests__/heartbeat-comment-wake-batching.test.ts b/server/src/__tests__/heartbeat-comment-wake-batching.test.tsindex 0987f7d077..f7399db1b4 100644--- a/server/src/__tests__/heartbeat-comment-wake-batching.test.ts+++ b/server/src/__tests__/heartbeat-comment-wake-batching.test.ts@@ -2014,8 +2014,8 @@ describeEmbeddedPostgres("heartbeat comment wake batching", () => {expect(payloads).toHaveLength(2);expect(runs[1]?.contextSnapshot).toMatchObject({retryReason: "missing_issue_comment",- modelProfile: "cheap",});+ expect(runs[1]?.contextSnapshot).not.toHaveProperty("modelProfile");} finally {gateway.releaseFirstWait();await gateway.close();@@ -2218,7 +2218,7 @@ describeEmbeddedPostgres("heartbeat comment wake batching", () => {),);expect(missingCommentRetries).toHaveLength(1);- expect(missingCommentRetries[0]?.payload).toMatchObject({ modelProfile: "cheap" });+ expect(missingCommentRetries[0]?.payload).not.toHaveProperty("modelProfile");} finally {gateway.releaseFirstWait();await gateway.close();diff --git a/server/src/__tests__/heartbeat-model-profile.test.ts b/server/src/__tests__/heartbeat-model-profile.test.tsdeleted file mode 100644index 2ed42a4bfa..0000000000--- a/server/src/__tests__/heartbeat-model-profile.test.ts+++ /dev/null@@ -1,157 +0,0 @@-import { describe, expect, it } from "vitest";-import {- listAdapterModelProfiles,- type AdapterModelProfileDefinition,-} from "../adapters/index.js";-import {- mergeModelProfileAdapterConfig,- normalizeModelProfileWakeContext,- resolveModelProfileApplication,- isConfigurationIncompleteFailedRun,-} from "../services/heartbeat.ts";--const cheapProfile: AdapterModelProfileDefinition = {- key: "cheap",- label: "Cheap",- adapterConfig: {- model: "adapter-cheap",- modelReasoningEffort: "low",- },- source: "adapter_default",-};--describe("heartbeat model profile application", () => {- it("keeps Codex on its primary model when cheap has no explicit model override", async () => {- const modelProfile = resolveModelProfileApplication({- adapterModelProfiles: await listAdapterModelProfiles("codex_local"),- agentRuntimeConfig: {},- issueModelProfile: "cheap",- contextSnapshot: {},- });-- const merged = mergeModelProfileAdapterConfig({- baseConfig: { model: "primary" },- modelProfile,- issueAdapterConfig: null,- });-- expect(modelProfile).toMatchObject({- requested: "cheap",- requestedBy: "issue_override",- applied: "cheap",- configSource: "adapter_default",- fallbackReason: null,- adapterConfig: {},- });- expect(merged).toEqual({ model: "primary" });- });-- it("applies cheap profile patches before explicit issue adapter config overrides", () => {- const modelProfile = resolveModelProfileApplication({- adapterModelProfiles: [cheapProfile],- agentRuntimeConfig: {},- issueModelProfile: "cheap",- contextSnapshot: {},- });-- const merged = mergeModelProfileAdapterConfig({- baseConfig: {- model: "primary",- modelReasoningEffort: "high",- approvalPolicy: "strict",- },- modelProfile,- issueAdapterConfig: {- model: "issue-explicit",- },- });-- expect(modelProfile).toMatchObject({- requested: "cheap",- requestedBy: "issue_override",- applied: "cheap",- configSource: "adapter_default",- fallbackReason: null,- });- expect(merged).toEqual({- model: "issue-explicit",- modelReasoningEffort: "low",- approvalPolicy: "strict",- });- });-- it("lets agent runtime profile config customize adapter defaults", () => {- const modelProfile = resolveModelProfileApplication({- adapterModelProfiles: [cheapProfile],- agentRuntimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- model: "agent-cheap",- },- },- },- },- issueModelProfile: null,- contextSnapshot: { modelProfile: "cheap" },- });-- expect(modelProfile).toMatchObject({- requested: "cheap",- requestedBy: "wake_context",- applied: "cheap",- configSource: "agent_runtime",- adapterConfig: {- model: "agent-cheap",- modelReasoningEffort: "low",- },- });- });-- it("falls back to the primary config when the adapter does not support the requested profile", () => {- const modelProfile = resolveModelProfileApplication({- adapterModelProfiles: [],- agentRuntimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- model: "agent-cheap",- },- },- },- },- issueModelProfile: null,- contextSnapshot: { modelProfile: "cheap" },- });-- const merged = mergeModelProfileAdapterConfig({- baseConfig: {- model: "primary",- },- modelProfile,- issueAdapterConfig: null,- });-- expect(modelProfile).toMatchObject({- requested: "cheap",- applied: null,- fallbackReason: "adapter_profile_not_supported",- adapterConfig: null,- });- expect(merged).toEqual({ model: "primary" });- });-- it("normalizes a wake payload model profile into run context", () => {- const contextSnapshot = normalizeModelProfileWakeContext({- contextSnapshot: {},- payload: { modelProfile: "cheap" },- });-- expect(contextSnapshot).toMatchObject({ modelProfile: "cheap" });- });-- it("treats model resolution failures as non-retryable configuration failures", () => {- expect(isConfigurationIncompleteFailedRun({ errorCode: "model_not_found" })).toBe(true);- expect(isConfigurationIncompleteFailedRun({ errorCode: "provider_quota" })).toBe(false);- });-});diff --git a/server/src/__tests__/heartbeat-plugin-environment.test.ts b/server/src/__tests__/heartbeat-plugin-environment.test.tsindex 4750b686fb..2cd19d301d 100644--- a/server/src/__tests__/heartbeat-plugin-environment.test.ts+++ b/server/src/__tests__/heartbeat-plugin-environment.test.ts@@ -43,7 +43,6 @@ vi.mock("../adapters/index.js", () => ({execute: adapterExecute,supportsLocalAgentJwt: false,}),- listAdapterModelProfiles: async () => [],runningProcesses: new Map(),}));diff --git a/server/src/__tests__/heartbeat-runtime-state.test.ts b/server/src/__tests__/heartbeat-runtime-state.test.tsindex 50990f6b38..d66d54a094 100644--- a/server/src/__tests__/heartbeat-runtime-state.test.ts+++ b/server/src/__tests__/heartbeat-runtime-state.test.ts@@ -26,7 +26,6 @@ vi.doMock("../adapters/index.js", () => ({execute: vi.fn(),testEnvironment: vi.fn(),})),- listAdapterModelProfiles: vi.fn(() => []),runningProcesses: new Map(),}));diff --git a/server/src/__tests__/heartbeat-workspace-branch-containment.test.ts b/server/src/__tests__/heartbeat-workspace-branch-containment.test.tsindex 10514830ae..ef2ac9670f 100644--- a/server/src/__tests__/heartbeat-workspace-branch-containment.test.ts+++ b/server/src/__tests__/heartbeat-workspace-branch-containment.test.ts@@ -105,7 +105,6 @@ vi.mock("../adapters/index.js", () => ({execute: adapterExecute,supportsLocalAgentJwt: false,}),- listAdapterModelProfiles: async () => [],runningProcesses: new Map(),}));diff --git a/server/src/__tests__/heartbeat-workspace-finalize-branch.test.ts b/server/src/__tests__/heartbeat-workspace-finalize-branch.test.tsindex 2cb8a2404a..ff6d564024 100644--- a/server/src/__tests__/heartbeat-workspace-finalize-branch.test.ts+++ b/server/src/__tests__/heartbeat-workspace-finalize-branch.test.ts@@ -62,7 +62,6 @@ vi.mock("../adapters/index.js", () => ({execute: adapterExecute,supportsLocalAgentJwt: false,}),- listAdapterModelProfiles: async () => [],runningProcesses: new Map(),}));diff --git a/server/src/__tests__/heartbeat-workspace-session.test.ts b/server/src/__tests__/heartbeat-workspace-session.test.tsindex 3dfc5a10a9..37f7e38df0 100644--- a/server/src/__tests__/heartbeat-workspace-session.test.ts+++ b/server/src/__tests__/heartbeat-workspace-session.test.ts@@ -2117,7 +2117,6 @@ async function buildSessionConfigMetadata(maxConcurrentRuns: 1,},},- modelProfile: null,issueOverrides: null,workspaceConfig: {requestedMode: "agent_default",@@ -2330,24 +2329,13 @@ describe("effective run session config freshness", () => {expect(decision.reasons).toEqual([]);});- it("names safe categories for model profile, issue override, env, secret, and runtime skill drift", async () => {+ it("names safe categories for issue override, env, secret, and runtime skill drift", async () => {const base = await buildSessionConfigMetadata();const cases: Array<{name: string;category: string;metadata: SessionConfigMetadata;}> = [- {- name: "model profile",- category: "modelProfile",- metadata: await buildSessionConfigMetadata({- modelProfile: {- requested: "cheap",- applied: true,- configSource: "agent_runtime",- },- }),- },{name: "issue overrides",category: "issueOverrides",diff --git a/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts b/server/src/__tests__/issue-agent-mutation-ownership-routes.test.tsindex 2a19a6fc65..05ee67b55b 100644--- a/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts+++ b/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts@@ -1140,17 +1140,17 @@ describe("agent issue mutation checkout ownership", () => {provider: "test",title: "Artifact",}),- "Cheap status-only recovery runs cannot update issue documents",+ "Status-only recovery runs cannot update issue documents",],["work product update",(app: express.Express) => request(app).patch("/api/work-products/product-1").send({ title: "Blocked" }),- "Cheap status-only recovery runs cannot update issue documents",+ "Status-only recovery runs cannot update issue documents",],["work product delete",(app: express.Express) => request(app).delete("/api/work-products/product-1"),- "Cheap status-only recovery runs cannot update issue documents",+ "Status-only recovery runs cannot update issue documents",],["low-trust promotion",@@ -1161,7 +1161,7 @@ describe("agent issue mutation checkout ownership", () => {title: "Promoted artifact",summary: "Sanitized output",}),- "Cheap status-only recovery runs cannot update issue documents",+ "Status-only recovery runs cannot update issue documents",],["attachment upload",@@ -1169,12 +1169,12 @@ describe("agent issue mutation checkout ownership", () => {request(app).post(`/api/companies/${companyId}/issues/${issueId}/attachments`).attach("file", Buffer.from("report"), { filename: "report.txt", contentType: "text/plain" }),- "Cheap status-only recovery runs cannot update issue documents",+ "Status-only recovery runs cannot update issue documents",],["attachment delete",(app: express.Express) => request(app).delete("/api/attachments/attachment-1"),- "Cheap status-only recovery runs cannot update issue documents",+ "Status-only recovery runs cannot update issue documents",],["issue approval link",@@ -1182,19 +1182,18 @@ describe("agent issue mutation checkout ownership", () => {request(app).post(`/api/issues/${issueId}/approvals`).send({approvalId: "88888888-8888-4888-8888-888888888888",}),- "Cheap status-only recovery runs cannot create or modify approvals",+ "Status-only recovery runs cannot create or modify approvals",],["issue approval unlink",(app: express.Express) =>request(app).delete(`/api/issues/${issueId}/approvals/88888888-8888-4888-8888-888888888888`),- "Cheap status-only recovery runs cannot create or modify approvals",+ "Status-only recovery runs cannot create or modify approvals",],- ])("blocks cheap status-only recovery runs from %s", async (_name, sendRequest, expectedError) => {+ ])("blocks status-only recovery runs from %s", async (_name, sendRequest, expectedError) => {const app = await createApp(ownerActor(),createRunContextDb({- modelProfile: "cheap",recoveryIntent: "status_only",allowDeliverableWork: false,allowDocumentUpdates: false,@@ -1217,51 +1216,6 @@ describe("agent issue mutation checkout ownership", () => {expect(mockIssueApprovalService.unlink).not.toHaveBeenCalled();});- it.each([- [- "issue create",- (app: express.Express) =>- request(app).post(`/api/companies/${companyId}/issues`).send({- title: "Downstream source work",- assigneeAdapterOverrides: { modelProfile: "cheap" },- }),- ],- [- "child issue create",- (app: express.Express) =>- request(app).post(`/api/issues/${issueId}/children`).send({- title: "Downstream child source work",- assigneeAdapterOverrides: { modelProfile: "cheap" },- }),- ],- [- "issue update",- (app: express.Express) =>- request(app).patch(`/api/issues/${issueId}`).send({- assigneeAdapterOverrides: { modelProfile: "cheap" },- }),- ],- ])("blocks cheap status-only recovery runs from propagating cheap profile through %s", async (_name, sendRequest) => {- const app = await createApp(- ownerActor(),- createRunContextDb({- modelProfile: "cheap",- recoveryIntent: "status_only",- allowDeliverableWork: false,- allowDocumentUpdates: false,- resumeRequiresNormalModel: true,- }),- );-- const res = await sendRequest(app);-- expect(res.status, JSON.stringify(res.body)).toBe(403);- expect(res.body.error).toContain("cannot assign downstream issue work to the cheap model profile");- expect(mockIssueService.create).not.toHaveBeenCalled();- expect(mockIssueService.createChild).not.toHaveBeenCalled();- expect(mockIssueService.update).not.toHaveBeenCalled();- });-it("defaults agent-created root follow-up issues to inherit the current run workspace", async () => {const app = await createApp(ownerActor(),@@ -1494,20 +1448,15 @@ describe("agent issue mutation checkout ownership", () => {);});- it("allows board users to set explicit cheap issue assignee profile overrides", async () => {+ it("rejects retired issue assignee profile overrides", async () => {const app = await createApp(boardActor());await request(app).patch(`/api/issues/${issueId}`).send({ assigneeAdapterOverrides: { modelProfile: "cheap" } })- .expect(200);+ .expect(400);- expect(mockIssueService.update).toHaveBeenCalledWith(- issueId,- expect.objectContaining({- assigneeAdapterOverrides: { modelProfile: "cheap" },- }),- );+ expect(mockIssueService.update).not.toHaveBeenCalled();});it("preserves committed issue updates, comments, documents, and work product writes when recovery revalidation fails", async () => {diff --git a/server/src/__tests__/issue-document-restore-routes.test.ts b/server/src/__tests__/issue-document-restore-routes.test.tsindex 0a4906d1b2..55c26d1550 100644--- a/server/src/__tests__/issue-document-restore-routes.test.ts+++ b/server/src/__tests__/issue-document-restore-routes.test.ts@@ -349,7 +349,7 @@ describe("issue document revision routes", () => {}));});- it("blocks cheap status-only recovery runs from restoring issue documents", async () => {+ it("blocks status-only recovery runs from restoring issue documents", async () => {mockIssueService.getById.mockResolvedValueOnce({id: issueId,companyId,@@ -368,7 +368,6 @@ describe("issue document revision routes", () => {source: "agent_jwt",},createRunContextDb({- modelProfile: "cheap",recoveryIntent: "status_only",allowDeliverableWork: false,allowDocumentUpdates: false,@@ -379,7 +378,7 @@ describe("issue document revision routes", () => {.send({});expect(res.status).toBe(403);- expect(res.body.error).toContain("Cheap status-only recovery runs cannot update issue documents");+ expect(res.body.error).toContain("Status-only recovery runs cannot update issue documents");expect(mockDocumentsService.restoreIssueDocumentRevision).not.toHaveBeenCalled();});diff --git a/server/src/__tests__/issue-monitor-scheduler.test.ts b/server/src/__tests__/issue-monitor-scheduler.test.tsindex 87e44201da..dd2baf74ff 100644--- a/server/src/__tests__/issue-monitor-scheduler.test.ts+++ b/server/src/__tests__/issue-monitor-scheduler.test.ts@@ -441,7 +441,6 @@ describeEmbeddedPostgres("issue monitor scheduler", () => {issueId,clearReason: "max_attempts_exhausted",maxAttempts: 1,- modelProfile: "cheap",});const activity = await db@@ -484,7 +483,7 @@ describeEmbeddedPostgres("issue monitor scheduler", () => {expect(recoveryIssue).toMatchObject({parentId: issueId,priority: "high",- assigneeAdapterOverrides: { modelProfile: "cheap" },+ assigneeAdapterOverrides: null,});expect(["todo", "in_progress"]).toContain(recoveryIssue?.status);});diff --git a/server/src/__tests__/legacy-finalization-regression.test.ts b/server/src/__tests__/legacy-finalization-regression.test.tsindex fc15ec9b30..c400d364cc 100644--- a/server/src/__tests__/legacy-finalization-regression.test.ts+++ b/server/src/__tests__/legacy-finalization-regression.test.ts@@ -40,7 +40,6 @@ vi.mock("../adapters/index.js", () => ({execute: adapterExecute,supportsLocalAgentJwt: false,}),- listAdapterModelProfiles: async () => [],runningProcesses: new Map(),}));diff --git a/server/src/__tests__/plugin-managed-agents.test.ts b/server/src/__tests__/plugin-managed-agents.test.tsindex a0deff4915..34ba238c55 100644--- a/server/src/__tests__/plugin-managed-agents.test.ts+++ b/server/src/__tests__/plugin-managed-agents.test.ts@@ -62,7 +62,7 @@ function manifest(): PaperclipPluginManifestV1 {capabilities: "Maintains a plugin-owned wiki.",adapterType: "process",adapterConfig: { command: "pnpm wiki:maintain" },- runtimeConfig: { modelProfiles: { cheap: { enabled: true, adapterConfig: { model: "small" } } } },+ runtimeConfig: { heartbeat: { enabled: false } },permissions: { canCreateAgents: false },budgetMonthlyCents: 1234,},diff --git a/server/src/__tests__/productivity-review-service.test.ts b/server/src/__tests__/productivity-review-service.test.tsindex a45e4502ed..7531b0b6a2 100644--- a/server/src/__tests__/productivity-review-service.test.ts+++ b/server/src/__tests__/productivity-review-service.test.ts@@ -201,7 +201,7 @@ describeEmbeddedPostgres("productivity review service", () => {expect(reviews).toHaveLength(1);expect(reviews[0]?.parentId).toBe(seeded.issueId);expect(reviews[0]?.assigneeAgentId).toBe(seeded.managerId);- expect(reviews[0]?.assigneeAdapterOverrides).toEqual({ modelProfile: "cheap" });+ expect(reviews[0]?.assigneeAdapterOverrides).toBeNull();expect(reviews[0]?.originId).toBe(seeded.issueId);expect(reviews[0]?.originFingerprint).toBe(`productivity-review:${seeded.issueId}`);expect(reviews[0]?.description).toContain("Primary trigger: `no_comment_streak`");diff --git a/server/src/__tests__/routines-service.test.ts b/server/src/__tests__/routines-service.test.tsindex cbdf42ee70..817a5a0f10 100644--- a/server/src/__tests__/routines-service.test.ts+++ b/server/src/__tests__/routines-service.test.ts@@ -754,15 +754,7 @@ describeEmbeddedPostgres("routine service live-execution coalescing", () => {},},runtimeConfig: {- modelProfiles: {- cheap: {- adapterConfig: {- env: {- ROUTINE_ASSIGNEE_RUNTIME_SECRET: { type: "plain", value: sentinelSecret },- },- },- },- },+ privateRuntimeSetting: { token: sentinelSecret },},}).where(eq(agents.id, agentId));diff --git a/server/src/adapters/index.ts b/server/src/adapters/index.tsindex 21fa069a05..3334eeabf7 100644--- a/server/src/adapters/index.ts+++ b/server/src/adapters/index.ts@@ -6,7 +6,6 @@ export {findServerAdapter,findActiveServerAdapter,detectAdapterModel,- listAdapterModelProfiles,registerServerAdapter,unregisterServerAdapter,requireServerAdapter,@@ -22,7 +21,6 @@ export type {AdapterRuntimeMcpAccess,AdapterRuntimeToolAccess,AdapterRuntimeToolDelivery,- AdapterModelProfileDefinition,AdapterEnvironmentCheckLevel,AdapterEnvironmentCheck,AdapterEnvironmentTestStatus,diff --git a/server/src/adapters/registry.ts b/server/src/adapters/registry.tsindex 5bdba04386..46fce45e96 100644--- a/server/src/adapters/registry.ts+++ b/server/src/adapters/registry.ts@@ -1,8 +1,4 @@-import type {- AdapterModelProfileDefinition,- AdapterRuntimeCommandSpec,- ServerAdapterModule,-} from "./types.js";+import type { AdapterRuntimeCommandSpec, ServerAdapterModule } from "./types.js";import { parseAdapterModelsEnv } from "../services/adapter-models-env.js";import { stampClaudeAgentIdHeader } from "./claude-agent-id-header.js";import {@@ -29,7 +25,6 @@ import {import {agentConfigurationDoc as claudeAgentConfigurationDoc,models as claudeModels,- modelProfiles as claudeModelProfiles,} from "@paperclipai/adapter-claude-local";import {execute as codexExecute,@@ -45,7 +40,6 @@ import {import {agentConfigurationDoc as codexAgentConfigurationDoc,models as codexModels,- modelProfiles as codexModelProfiles,} from "@paperclipai/adapter-codex-local";import {execute as cursorExecute,@@ -57,7 +51,6 @@ import {import {agentConfigurationDoc as cursorAgentConfigurationDoc,models as cursorModels,- modelProfiles as cursorModelProfiles,} from "@paperclipai/adapter-cursor-local";import {execute as cursorCloudExecute,@@ -77,7 +70,6 @@ import {import {agentConfigurationDoc as geminiAgentConfigurationDoc,models as geminiModels,- modelProfiles as geminiModelProfiles,} from "@paperclipai/adapter-gemini-local";import {execute as grokExecute,@@ -118,7 +110,6 @@ import {import {agentConfigurationDoc as openCodeAgentConfigurationDoc,models as openCodeModels,- modelProfiles as openCodeModelProfiles,} from "@paperclipai/adapter-opencode-local";import {execute as openclawGatewayExecute,@@ -138,10 +129,7 @@ import {sessionCodec as piSessionCodec,listPiModels,} from "@paperclipai/adapter-pi-local/server";-import {- agentConfigurationDoc as piAgentConfigurationDoc,- modelProfiles as piModelProfiles,-} from "@paperclipai/adapter-pi-local";+import { agentConfigurationDoc as piAgentConfigurationDoc } from "@paperclipai/adapter-pi-local";import { BUILTIN_ADAPTER_TYPES } from "./builtin-adapter-types.js";import { buildExternalAdapters } from "./plugin-loader.js";import { getDisabledAdapterTypes } from "../services/adapter-plugin-store.js";@@ -274,7 +262,6 @@ const claudeLocalAdapter: ServerAdapterModule = {sessionCodec: claudeSessionCodec,sessionManagement: getAdapterSessionManagement("claude_local") ?? undefined,models: claudeModels,- modelProfiles: claudeModelProfiles,listModels: listClaudeModels,refreshModels: refreshClaudeModels,supportsLocalAgentJwt: true,@@ -350,7 +337,6 @@ const codexLocalAdapter: ServerAdapterModule = {sessionCodec: codexSessionCodec,sessionManagement: getAdapterSessionManagement("codex_local") ?? undefined,models: codexModels,- modelProfiles: codexModelProfiles,listModels: listCodexModels,refreshModels: refreshCodexModels,supportsLocalAgentJwt: true,@@ -430,7 +416,6 @@ const paperclipRunnerAdapter: ServerAdapterModule = {syncSkills: syncCodexSkills,sessionCodec: codexSessionCodec,models: codexModels,- modelProfiles: codexModelProfiles,listModels: listCodexModels,refreshModels: refreshCodexModels,supportsLocalAgentJwt: false,@@ -484,7 +469,6 @@ const cursorLocalAdapter: ServerAdapterModule = {sessionCodec: cursorSessionCodec,sessionManagement: getAdapterSessionManagement("cursor") ?? undefined,models: cursorModels,- modelProfiles: cursorModelProfiles,listModels: listCursorModels,supportsLocalAgentJwt: true,supportsInstructionsBundle: true,@@ -528,7 +512,6 @@ const geminiLocalAdapter: ServerAdapterModule = {sessionCodec: geminiSessionCodec,sessionManagement: getAdapterSessionManagement("gemini_local") ?? undefined,models: geminiModels,- modelProfiles: geminiModelProfiles,supportsLocalAgentJwt: true,supportsInstructionsBundle: true,instructionsPathKey: "instructionsFilePath",@@ -620,7 +603,6 @@ const openCodeLocalAdapter: ServerAdapterModule = {syncSkills: syncOpenCodeSkills,sessionCodec: openCodeSessionCodec,models: openCodeModels,- modelProfiles: openCodeModelProfiles,sessionManagement: getAdapterSessionManagement("opencode_local") ?? undefined,listModels: listOpenCodeModels,supportsLocalAgentJwt: true,@@ -641,7 +623,6 @@ const piLocalAdapter: ServerAdapterModule = {sessionCodec: piSessionCodec,sessionManagement: getAdapterSessionManagement("pi_local") ?? undefined,models: [],- modelProfiles: piModelProfiles,listModels: listPiModels,supportsLocalAgentJwt: true,supportsInstructionsBundle: true,@@ -869,16 +850,6 @@ export async function refreshAdapterModels(type: string): Promise<{ id: string;return adapter.models ?? [];}-export async function listAdapterModelProfiles(type: string): Promise<AdapterModelProfileDefinition[]> {- const adapter = findActiveServerAdapter(type);- if (!adapter) return [];- if (adapter.listModelProfiles) {- const discovered = await adapter.listModelProfiles();- if (discovered.length > 0) return discovered;- }- return adapter.modelProfiles ?? [];-}-export function listServerAdapters(): ServerAdapterModule[] {return Array.from(adaptersByType.values());}diff --git a/server/src/adapters/types.ts b/server/src/adapters/types.tsindex d1a33193b3..b1c6f03d2b 100644--- a/server/src/adapters/types.ts+++ b/server/src/adapters/types.ts@@ -24,8 +24,6 @@ export type {AdapterSkillContext,AdapterSessionCodec,AdapterModel,- AdapterModelProfileKey,- AdapterModelProfileDefinition,NativeContextManagement,ResolvedSessionCompactionPolicy,SessionCompactionPolicy,diff --git a/server/src/built-ins/agents/summarizer/AGENTS.md b/server/src/built-ins/agents/summarizer/AGENTS.mdindex 60c9a3ea7f..33d5488ccd 100644--- a/server/src/built-ins/agents/summarizer/AGENTS.md+++ b/server/src/built-ins/agents/summarizer/AGENTS.md@@ -24,12 +24,9 @@ Your job is to turn the current state of a Paperclip scope — a project, the wo- Keep every read company-scoped. Do not cross company boundaries.- Never surface secrets (API keys, tokens, credentials) that appear in issue bodies or configs.-## Model lane--You run on the low-cost model profile lane (`cheap`) by default and spend no tokens in the background. Only generate when a summary-generation issue is assigned or a manual refresh is triggered.+Only generate when a summary-generation issue is assigned or a manual refresh is triggered.- Keep summaries short — a header summary that scrolls or reads like a task list has failed its job.-- An operator may override the cheap default with a specific model in this agent's `cheap` model profile configuration. Respect whatever model the run actually provides.## Execution contractdiff --git a/server/src/built-ins/agents/summarizer/routines/refresh-stale-summaries.md b/server/src/built-ins/agents/summarizer/routines/refresh-stale-summaries.mdindex 8920f0ae03..ec07ccb4fb 100644--- a/server/src/built-ins/agents/summarizer/routines/refresh-stale-summaries.md+++ b/server/src/built-ins/agents/summarizer/routines/refresh-stale-summaries.md@@ -59,7 +59,7 @@ This routine is **paused by default** and spends no tokens until an operator ena- Read-and-report only. This routine must never change issues, workspaces, code, or agent configuration — its only write is the summary revision.- Keep every read company-scoped. Do not cross company boundaries.-- Run on the low-cost model profile lane (`cheap`). Keep each summary short.+- Keep each summary short.- Never fabricate status and never surface secrets from issue bodies or configs.## Outputdiff --git a/server/src/routes/adapters.ts b/server/src/routes/adapters.tsindex 231c55e6ad..6afcff0bcd 100644--- a/server/src/routes/adapters.ts+++ b/server/src/routes/adapters.ts@@ -115,7 +115,6 @@ interface AdapterCapabilities {supportsSkills: boolean;supportsLocalAgentJwt: boolean;requiresMaterializedRuntimeSkills: boolean;- supportsModelProfiles: boolean;supportsAcp: boolean;/*** The projected login capability. It is present only when the adapter@@ -182,7 +181,6 @@ export function buildAdapterCapabilities(adapter: ServerAdapterModule): AdapterCsupportsSkills: Boolean(adapter.listSkills || adapter.syncSkills),supportsLocalAgentJwt: adapter.supportsLocalAgentJwt ?? false,requiresMaterializedRuntimeSkills: adapter.requiresMaterializedRuntimeSkills ?? false,- supportsModelProfiles: Boolean(adapter.modelProfiles?.length || adapter.listModelProfiles),supportsAcp: Boolean(adapter.acp),...(login? {diff --git a/server/src/routes/agents.ts b/server/src/routes/agents.tsindex 7d292f47e0..c118630bf9 100644--- a/server/src/routes/agents.ts+++ b/server/src/routes/agents.ts@@ -80,7 +80,6 @@ import type { AdapterExecutionTarget } from "@paperclipai/adapter-utils/executioimport type {AdapterEnvironmentCheck,AdapterEnvironmentTestResult,- AdapterModelProfileDefinition,} from "@paperclipai/adapter-utils";import { evaluateCodexCredentialReadiness } from "@paperclipai/adapter-codex-local/server";import type { AdapterAuthSignal, AdapterAuthSignalResponse } from "@paperclipai/shared";@@ -100,7 +99,6 @@ import {findServerAdapter,listServerAdapters,listAdapterModels,- listAdapterModelProfiles,refreshAdapterModels,requireServerAdapter,} from "../adapters/index.js";@@ -1863,24 +1861,7 @@ export function agentRoutes(};}- async function listNewAgentAdapterModelProfiles(- adapterType: string,- ): Promise<AdapterModelProfileDefinition[]> {- try {- return await listAdapterModelProfiles(adapterType);- } catch (error) {- logger.warn(- { err: error, adapterType },- "Failed to discover adapter model profiles while normalizing a new agent; continuing without profile defaults",- );- return [];- }- }-- async function normalizeNewAgentRuntimeConfig(- adapterType: string,- runtimeConfig: unknown,- ): Promise<Record<string, unknown>> {+ function normalizeNewAgentRuntimeConfig(runtimeConfig: unknown): Record<string, unknown> {const parsedRuntimeConfig = asRecord(runtimeConfig);const normalizedRuntimeConfig = parsedRuntimeConfig ? { ...parsedRuntimeConfig } : {};const parsedHeartbeat = asRecord(normalizedRuntimeConfig.heartbeat);@@ -1895,57 +1876,9 @@ export function agentRoutes(normalizedRuntimeConfig.heartbeat = heartbeat;- const parsedModelProfiles = asRecord(normalizedRuntimeConfig.modelProfiles);- const modelProfiles = parsedModelProfiles ? { ...parsedModelProfiles } : {};- if (!Object.prototype.hasOwnProperty.call(modelProfiles, "cheap")) {- const adapterModelProfiles = await listNewAgentAdapterModelProfiles(adapterType);- if (adapterModelProfiles.some((profile) => profile.key === "cheap")) {- modelProfiles.cheap = { enabled: false };- }- }- if (Object.keys(modelProfiles).length > 0) {- normalizedRuntimeConfig.modelProfiles = modelProfiles;- }-return normalizedRuntimeConfig;}- function listRuntimeModelProfileAdapterConfigs(runtimeConfig: unknown): Array<{- profileKey: string;- profile: Record<string, unknown>;- adapterConfig: Record<string, unknown>;- path: string;- }> {- const runtimeRecord = asRecord(runtimeConfig);- const modelProfiles = asRecord(runtimeRecord?.modelProfiles);- if (!modelProfiles) return [];-- const entries: Array<{- profileKey: string;- profile: Record<string, unknown>;- adapterConfig: Record<string, unknown>;- path: string;- }> = [];- for (const [profileKey, rawProfile] of Object.entries(modelProfiles)) {- const profile = asRecord(rawProfile);- const adapterConfig = asRecord(profile?.adapterConfig);- if (!profile || !adapterConfig) continue;- entries.push({- profileKey,- profile,- adapterConfig,- path: `runtimeConfig.modelProfiles.${profileKey}.adapterConfig`,- });- }- return entries;- }-- function assertNoAgentRuntimeConfigAdapterConfigMutation(req: Request, runtimeConfig: unknown) {- for (const entry of listRuntimeModelProfileAdapterConfigs(runtimeConfig)) {- assertNoAgentAdapterConfigMutation(req, entry.adapterConfig, entry.path);- }- }-async function normalizeMediatedAdapterConfigForPersistence(input: {companyId: string;adapterType: string | null | undefined;@@ -1969,42 +1902,6 @@ export function agentRoutes(return normalizedAdapterConfig;}- async function normalizeRuntimeConfigAdapterConfigsForPersistence(- companyId: string,- adapterType: string,- runtimeConfig: Record<string, unknown>,- baseAdapterConfig: Record<string, unknown>,- ): Promise<Record<string, unknown>> {- const entries = listRuntimeModelProfileAdapterConfigs(runtimeConfig);- if (entries.length === 0) return runtimeConfig;- const adapterModelProfiles = await listNewAgentAdapterModelProfiles(adapterType);-- const normalizedRuntimeConfig = { ...runtimeConfig };- const modelProfiles = asRecord(runtimeConfig.modelProfiles) ?? {};- const normalizedModelProfiles = { ...modelProfiles };- normalizedRuntimeConfig.modelProfiles = normalizedModelProfiles;-- for (const entry of entries) {- const adapterProfile = adapterModelProfiles.find((profile) => profile.key === entry.profileKey);- const adapterDefaultConfig = asRecord(adapterProfile?.adapterConfig) ?? {};- const normalizedAdapterConfig = await normalizeMediatedAdapterConfigForPersistence({- companyId,- adapterType,- adapterConfig: entry.adapterConfig,- constraintAdapterConfig: {- ...baseAdapterConfig,- ...adapterDefaultConfig,- },- });- normalizedModelProfiles[entry.profileKey] = {- ...entry.profile,- adapterConfig: normalizedAdapterConfig,- };- }-- return normalizedRuntimeConfig;- }-function generateEd25519PrivateKeyPem(): string {const { privateKey } = generateKeyPairSync("ed25519");return privateKey.export({ type: "pkcs8", format: "pem" }).toString();@@ -2609,14 +2506,6 @@ export function agentRoutes(res.json(models);});- router.get("/companies/:companyId/adapters/:type/model-profiles", async (req, res) => {- const companyId = req.params.companyId as string;- assertCompanyAccess(req, companyId);- const type = assertKnownAdapterType(req.params.type as string);- const profiles = await listAdapterModelProfiles(type);- res.json(profiles);- });-router.get("/companies/:companyId/adapters/:type/detect-model", async (req, res) => {const companyId = req.params.companyId as string;assertCompanyAccess(req, companyId);@@ -3641,7 +3530,6 @@ export function agentRoutes(rawHireAdapterConfig,);assertNoAgentAdapterConfigMutation(req, rawHireAdapterConfig);- assertNoAgentRuntimeConfigAdapterConfigMutation(req, hireInput.runtimeConfig);const hiredAgentId = randomUUID();const requestedAdapterConfig = applyCodexLocalKeyIsolation(companyId,@@ -3667,12 +3555,7 @@ export function agentRoutes(adapterType: hireInput.adapterType,adapterConfig: desiredSkillAssignment.adapterConfig,});- const normalizedRuntimeConfig = await normalizeRuntimeConfigAdapterConfigsForPersistence(- companyId,- hireInput.adapterType,- await normalizeNewAgentRuntimeConfig(hireInput.adapterType, hireInput.runtimeConfig),- normalizedAdapterConfig,- );+ const normalizedRuntimeConfig = normalizeNewAgentRuntimeConfig(hireInput.runtimeConfig);const normalizedHireInput = {...hireInput,adapterConfig: normalizedAdapterConfig,@@ -3865,7 +3748,6 @@ export function agentRoutes(rawCreateAdapterConfig,);assertNoAgentAdapterConfigMutation(req, rawCreateAdapterConfig);- assertNoAgentRuntimeConfigAdapterConfigMutation(req, createInput.runtimeConfig);const agentId = randomUUID();const requestedAdapterConfig = applyCodexLocalKeyIsolation(companyId,@@ -3891,12 +3773,7 @@ export function agentRoutes(adapterType: createInput.adapterType,adapterConfig: desiredSkillAssignment.adapterConfig,});- const normalizedRuntimeConfig = await normalizeRuntimeConfigAdapterConfigsForPersistence(- companyId,- createInput.adapterType,- await normalizeNewAgentRuntimeConfig(createInput.adapterType, createInput.runtimeConfig),- normalizedAdapterConfig,- );+ const normalizedRuntimeConfig = normalizeNewAgentRuntimeConfig(createInput.runtimeConfig);await assertAgentEnvironmentSelection(companyId, createInput.adapterType, createInput.defaultEnvironmentId);await assertAgentDefaultEnvironmentSelection(companyId, createInput.defaultEnvironmentId, {allowedDrivers: allowedEnvironmentDriversForAgent(createInput.adapterType),@@ -4308,7 +4185,6 @@ export function agentRoutes(res.status(422).json({ error: "runtimeConfig must be an object" });return;}- assertNoAgentRuntimeConfigAdapterConfigMutation(req, runtimeConfig);assertProviderTraceSettingTransition(req,runtimeConfig,@@ -4384,15 +4260,7 @@ export function agentRoutes(});patchData.adapterConfig = syncInstructionsBundleConfigFromFilePath(existing, normalizedEffectiveAdapterConfig);}- if (requestedRuntimeConfig) {- const baseAdapterConfig = asRecord(patchData.adapterConfig) ?? asRecord(existing.adapterConfig) ?? {};- patchData.runtimeConfig = await normalizeRuntimeConfigAdapterConfigsForPersistence(- existing.companyId,- requestedAdapterType,- requestedRuntimeConfig,- baseAdapterConfig,- );- }+ if (requestedRuntimeConfig) patchData.runtimeConfig = requestedRuntimeConfig;if (touchesAdapterConfiguration || Object.prototype.hasOwnProperty.call(patchData, "defaultEnvironmentId")) {await assertAgentDefaultEnvironmentSelection(existing.companyId,diff --git a/server/src/routes/approvals.ts b/server/src/routes/approvals.tsindex ef2578ea0a..feb3bbdfda 100644--- a/server/src/routes/approvals.ts+++ b/server/src/routes/approvals.ts@@ -31,11 +31,10 @@ function redactApprovalPayload<T extends { payload: Record<string, unknown> }>(a};}-function isStatusOnlyCheapRecoveryContext(contextSnapshot: unknown) {+function isStatusOnlyRecoveryContext(contextSnapshot: unknown) {if (!contextSnapshot || typeof contextSnapshot !== "object" || Array.isArray(contextSnapshot)) return false;const context = contextSnapshot as Record<string, unknown>;- return context.modelProfile === "cheap" &&- context.recoveryIntent === "status_only" &&+ return context.recoveryIntent === "status_only" &&context.allowDeliverableWork === false &&context.allowDocumentUpdates === false &&context.resumeRequiresNormalModel === true;@@ -189,14 +188,13 @@ export function approvalRoutes(.where(eq(heartbeatRuns.id, runId)).then((rows) => rows[0] ?? null);if (!run || run.companyId !== companyId || run.agentId !== req.actor.agentId) return true;- if (!isStatusOnlyCheapRecoveryContext(run.contextSnapshot)) return true;+ if (!isStatusOnlyRecoveryContext(run.contextSnapshot)) return true;res.status(403).json({- error: "Cheap status-only recovery runs cannot create or modify approvals",+ error: "Status-only recovery runs cannot create or modify approvals",details: {companyId,runId: run.id,- modelProfile: "cheap",recoveryIntent: "status_only",resumeRequiresNormalModel: true,},diff --git a/server/src/routes/issues.ts b/server/src/routes/issues.tsindex 70e998121e..0640ea1877 100644--- a/server/src/routes/issues.ts+++ b/server/src/routes/issues.ts@@ -4932,24 +4932,15 @@ export function issueRoutes(return { scope, discovery, sourceIssue, watchdogIssue };}- function isStatusOnlyCheapRecoveryContext(contextSnapshot: unknown) {+ function isStatusOnlyRecoveryContext(contextSnapshot: unknown) {if (!contextSnapshot || typeof contextSnapshot !== "object" || Array.isArray(contextSnapshot)) return false;const context = contextSnapshot as Record<string, unknown>;- return context.modelProfile === "cheap" &&- context.recoveryIntent === "status_only" &&+ return context.recoveryIntent === "status_only" &&context.allowDeliverableWork === false &&context.allowDocumentUpdates === false &&context.resumeRequiresNormalModel === true;}- function requestsCheapIssueAssigneeModelProfile(input: { assigneeAdapterOverrides?: unknown }) {- const overrides = input.assigneeAdapterOverrides;- return !!overrides &&- typeof overrides === "object" &&- !Array.isArray(overrides) &&- (overrides as Record<string, unknown>).modelProfile === "cheap";- }-async function loadActorRunContext(req: Request, companyId: string) {if (req.actor.type !== "agent") return null;const runId = req.actor.runId?.trim();@@ -5015,29 +5006,6 @@ export function issueRoutes(};}- async function assertCheapRecoveryIssueAssigneeProfileAllowed(- req: Request,- res: Response,- issue: { id?: string; companyId: string },- input: { assigneeAdapterOverrides?: unknown },- ) {- if (!requestsCheapIssueAssigneeModelProfile(input)) return true;- const run = await loadActorRunContext(req, issue.companyId);- if (!run || !isStatusOnlyCheapRecoveryContext(run.contextSnapshot)) return true;-- res.status(403).json({- error: "Cheap status-only recovery runs cannot assign downstream issue work to the cheap model profile",- details: {- issueId: issue.id ?? null,- runId: run.id,- modelProfile: "cheap",- recoveryIntent: "status_only",- resumeRequiresNormalModel: true,- },- });- return false;- }-async function assertDeliverableMutationAllowedByRunContext(req: Request,res: Response,@@ -5045,14 +5013,13 @@ export function issueRoutes() {const run = await loadActorRunContext(req, issue.companyId);if (!run) return true;- if (!isStatusOnlyCheapRecoveryContext(run.contextSnapshot)) return true;+ if (!isStatusOnlyRecoveryContext(run.contextSnapshot)) return true;res.status(403).json({- error: "Cheap status-only recovery runs cannot update issue documents, plans, or deliverable artifacts",+ error: "Status-only recovery runs cannot update issue documents, plans, or deliverable artifacts",details: {issueId: issue.id,runId: run.id,- modelProfile: "cheap",recoveryIntent: "status_only",resumeRequiresNormalModel: true,},@@ -5067,14 +5034,13 @@ export function issueRoutes() {const run = await loadActorRunContext(req, issue.companyId);if (!run) return true;- if (!isStatusOnlyCheapRecoveryContext(run.contextSnapshot)) return true;+ if (!isStatusOnlyRecoveryContext(run.contextSnapshot)) return true;res.status(403).json({- error: "Cheap status-only recovery runs cannot create or modify approvals",+ error: "Status-only recovery runs cannot create or modify approvals",details: {issueId: issue.id,runId: run.id,- modelProfile: "cheap",recoveryIntent: "status_only",resumeRequiresNormalModel: true,},@@ -9127,7 +9093,6 @@ export function issueRoutes(}: {}),};- if (!(await assertCheapRecoveryIssueAssigneeProfileAllowed(req, res, { companyId }, createBody))) return;const createAssignmentScope = {projectId: await resolveAssignmentProjectId({companyId,@@ -9363,7 +9328,6 @@ export function issueRoutes(...sanitizedBody,...(normalizedAssigneeAgentId !== undefined ? { assigneeAgentId: normalizedAssigneeAgentId } : {}),};- if (!(await assertCheapRecoveryIssueAssigneeProfileAllowed(req, res, parent, createBody))) return;const childAssignmentScope = {projectId: createBody.projectId ?? parent.projectId ?? null,parentIssueId: parent.id,@@ -9542,7 +9506,6 @@ export function issueRoutes(};requestedChildren.push(childBody);assertNoAgentHostWorkspaceCommandMutation(req, collectIssueWorkspaceCommandPaths(childBody));- if (!(await assertCheapRecoveryIssueAssigneeProfileAllowed(req, res, sourceIssue, childBody))) return;if (childBody.assigneeAgentId || childBody.assigneeUserId) {await assertCanAssignTasks(req, sourceIssue.companyId, {projectId: childBody.projectId ?? sourceIssue.projectId ?? null,@@ -9913,7 +9876,6 @@ export function issueRoutes(const issueMutationAuthorizationReason = req.actor.type === "agent"? issueWriteAuthorizationReason(req, await decideIssueAccess(req, existing, "issue:mutate")): issueWriteAuthorizationReason(req, true);- if (!(await assertCheapRecoveryIssueAssigneeProfileAllowed(req, res, existing, req.body))) return;const actor = getActorInfo(req);const isClosed = isClosedIssueStatus(existing.status);diff --git a/server/src/routes/openapi.ts b/server/src/routes/openapi.tsindex 547f0d225d..563f064275 100644--- a/server/src/routes/openapi.ts+++ b/server/src/routes/openapi.ts@@ -6815,13 +6815,6 @@ registerCurrentRoute({summary: "Get adapter registration details",});-registerCurrentRoute({- method: "get",- path: "/api/companies/{companyId}/adapters/{type}/model-profiles",- tags: ["adapters"],- summary: "List adapter model profiles for a company",-});-registerCurrentRoute({method: "post",path: "/api/health/dev-server/restart",diff --git a/server/src/services/agents.ts b/server/src/services/agents.tsindex c1937641ea..9019a26b50 100644--- a/server/src/services/agents.ts+++ b/server/src/services/agents.ts@@ -18,6 +18,7 @@ import {} from "@paperclipai/db";import {AGENT_DEFAULT_MAX_CONCURRENT_RUNS,+ agentRuntimeConfigSchema,getAgentWorkEligibility,isUuidLike,normalizeAgentApiKeyScope,@@ -288,6 +289,12 @@ function configPatchFromSnapshot(snapshot: unknown): Partial<typeof agents.$infeif (typeof snapshot.budgetMonthlyCents !== "number" || !Number.isFinite(snapshot.budgetMonthlyCents)) {throw unprocessable("Invalid revision snapshot: budgetMonthlyCents");}+ const runtimeConfig = agentRuntimeConfigSchema.safeParse(+ isPlainRecord(snapshot.runtimeConfig) ? snapshot.runtimeConfig : {},+ );+ if (!runtimeConfig.success) {+ throw unprocessable("Invalid revision snapshot: runtimeConfig");+ }return {name: snapshot.name,@@ -301,7 +308,7 @@ function configPatchFromSnapshot(snapshot: unknown): Partial<typeof agents.$infe: null,adapterType: snapshot.adapterType,adapterConfig: isPlainRecord(snapshot.adapterConfig) ? snapshot.adapterConfig : {},- runtimeConfig: isPlainRecord(snapshot.runtimeConfig) ? snapshot.runtimeConfig : {},+ runtimeConfig: runtimeConfig.data,defaultEnvironmentId:typeof snapshot.defaultEnvironmentId === "string" || snapshot.defaultEnvironmentId === null? snapshot.defaultEnvironmentIddiff --git a/server/src/services/company-portability.ts b/server/src/services/company-portability.tsindex ca8d06fcf5..0199667e31 100644--- a/server/src/services/company-portability.ts+++ b/server/src/services/company-portability.ts@@ -1306,6 +1306,7 @@ function parseFiniteNumberLike(value: unknown): number | null {function sanitizeImportedAgentRuntimeConfig(runtimeConfig: unknown) {const next = clonePortableRecord(runtimeConfig) ?? {};+ delete next.modelProfiles;const heartbeat = isPlainRecord(next.heartbeat) ? { ...next.heartbeat } : {};heartbeat.enabled = false;if (parseFiniteNumberLike(heartbeat.maxConcurrentRuns) == null) {@@ -1325,6 +1326,13 @@ function sanitizeImportedAgentRuntimeConfig(runtimeConfig: unknown) {return next;}+function sanitizeImportedIssueAssigneeAdapterOverrides(value: unknown) {+ const next = clonePortableRecord(value);+ if (!next) return null;+ delete next.modelProfile;+ return Object.keys(next).length > 0 ? next : null;+}+function normalizePortableProjectWorkspaceExtension(workspaceKey: string,value: unknown,@@ -6249,7 +6257,9 @@ export function companyPortabilityService(db: Db, storage?: StorageService) {? manifestIssue.priority as typeof ISSUE_PRIORITIES[number]: "medium",billingCode: manifestIssue.billingCode ?? null,- assigneeAdapterOverrides: manifestIssue.assigneeAdapterOverrides ?? null,+ assigneeAdapterOverrides: sanitizeImportedIssueAssigneeAdapterOverrides(+ manifestIssue.assigneeAdapterOverrides,+ ),executionWorkspaceSettings: manifestIssue.executionWorkspaceSettings ?? null,labelIds: resolvedLabelIds,monitorNotes,diff --git a/server/src/services/heartbeat.ts b/server/src/services/heartbeat.tsindex 3a02b0d3db..87e8fe2bb3 100644--- a/server/src/services/heartbeat.ts+++ b/server/src/services/heartbeat.ts@@ -27,7 +27,6 @@ import {CONNECTION_RUNTIME_TOOL_NAMES,ISSUE_CONTINUATION_SUMMARY_DOCUMENT_KEY,ISSUE_DISPOSITION_REPAIR_RETRY_REASON,- MODEL_PROFILE_KEYS,PROVIDER_QUOTA_MONITOR_SERVICE_NAME,envBindingSchema,isEnvironmentDriverSupportedForAdapter,@@ -41,7 +40,6 @@ import {type IssueExecutionMonitorClearReason,type IssueExecutionMonitorPolicy,type IssueExecutionMonitorRecoveryPolicy,- type ModelProfileKey,type RequestConfirmationResult,type RoutineRevisionSnapshotV1,type RunLivenessState,@@ -151,13 +149,11 @@ import {} from "./provider-trace-store.js";import {getServerAdapter,- listAdapterModelProfiles,runningProcesses,} from "../adapters/index.js";import type {AdapterExecutionResult,AdapterInvocationMeta,- AdapterModelProfileDefinition,AdapterRuntimeEvent,AdapterRuntimeMcpAccess,AdapterRuntimeMcpServer,@@ -337,10 +333,7 @@ import {buildImmediateExecutionPathRecoveryNoticeSeed,buildWorkspaceValidationRecoveryNoticeSeed,} from "./recovery/stranded-notice.js";-import {- recoveryAssigneeAdapterOverrides,- withRecoveryModelProfileHint,-} from "./recovery/model-profile-hint.js";+import { withRecoveryContext } from "./recovery/status-only-context.js";import {ACTIVE_RUN_OUTPUT_SUSPICION_THRESHOLD_MS as RECOVERY_ACTIVE_RUN_OUTPUT_SUSPICION_THRESHOLD_MS,recoveryService,@@ -3191,23 +3184,10 @@ type SessionCompactionDecision = {};interface ParsedIssueAssigneeAdapterOverrides {- modelProfile: ModelProfileKey | null;adapterConfig: Record<string, unknown> | null;useProjectWorkspace: boolean | null;}-type ModelProfileRequestSource = "issue_override" | "wake_context";-type AppliedModelProfileConfigSource = "agent_runtime" | "adapter_default";--export interface ModelProfileApplication {- requested: ModelProfileKey | null;- requestedBy: ModelProfileRequestSource | null;- applied: ModelProfileKey | null;- configSource: AppliedModelProfileConfigSource | null;- fallbackReason: string | null;- adapterConfig: Record<string, unknown> | null;-}-/*** A single read-only referenced (mentioned) project workspace resolved for a run.* The run materializes one entry per authorized additional project, each in its own@@ -4482,165 +4462,6 @@ export async function createManagedMcpRunConfig(input: {};}-function readModelProfileKey(value: unknown): ModelProfileKey | null {- return MODEL_PROFILE_KEYS.includes(value as ModelProfileKey)- ? (value as ModelProfileKey)- : null;-}--function readContextModelProfile(- contextSnapshot: Record<string, unknown> | null | undefined,-): ModelProfileKey | null {- return readModelProfileKey(contextSnapshot?.modelProfile);-}--export function normalizeModelProfileWakeContext(input: {- contextSnapshot: Record<string, unknown>;- payload: Record<string, unknown> | null | undefined;-}): Record<string, unknown> {- const modelProfileFromPayload = readModelProfileKey(- input.payload?.modelProfile,- );- if (- !readContextModelProfile(input.contextSnapshot) &&- modelProfileFromPayload- ) {- input.contextSnapshot.modelProfile = modelProfileFromPayload;- }- return input.contextSnapshot;-}--function readAgentRuntimeModelProfile(- runtimeConfig: unknown,- key: ModelProfileKey,-): {- enabled: boolean;- adapterConfig: Record<string, unknown>;- configured: boolean;-} {- const modelProfiles = parseObject(parseObject(runtimeConfig).modelProfiles);- const profile = parseObject(modelProfiles[key]);- if (Object.keys(profile).length === 0) {- return { enabled: true, adapterConfig: {}, configured: false };- }-- return {- enabled: profile.enabled !== false,- adapterConfig: parseObject(profile.adapterConfig),- configured: true,- };-}--export function resolveModelProfileApplication(input: {- adapterModelProfiles: AdapterModelProfileDefinition[];- agentRuntimeConfig: unknown;- issueModelProfile: ModelProfileKey | null | undefined;- contextSnapshot: Record<string, unknown> | null | undefined;- profileResolutionFallbackReason?: string | null;-}): ModelProfileApplication {- const issueModelProfile = input.issueModelProfile ?? null;- const contextModelProfile = readContextModelProfile(input.contextSnapshot);- const requested = issueModelProfile ?? contextModelProfile;- const requestedBy: ModelProfileRequestSource | null = issueModelProfile- ? "issue_override"- : contextModelProfile- ? "wake_context"- : null;-- if (!requested) {- return {- requested: null,- requestedBy: null,- applied: null,- configSource: null,- fallbackReason: null,- adapterConfig: null,- };- }-- const adapterProfile =- input.adapterModelProfiles.find((profile) => profile.key === requested) ??- null;- if (!adapterProfile) {- return {- requested,- requestedBy,- applied: null,- configSource: null,- fallbackReason:- input.profileResolutionFallbackReason ??- "adapter_profile_not_supported",- adapterConfig: null,- };- }-- const runtimeProfile = readAgentRuntimeModelProfile(- input.agentRuntimeConfig,- requested,- );- if (!runtimeProfile.enabled) {- return {- requested,- requestedBy,- applied: null,- configSource: null,- fallbackReason: "agent_runtime_profile_disabled",- adapterConfig: null,- };- }-- return {- requested,- requestedBy,- applied: requested,- configSource: runtimeProfile.configured- ? "agent_runtime"- : "adapter_default",- fallbackReason: null,- adapterConfig: {- ...parseObject(adapterProfile.adapterConfig),- ...runtimeProfile.adapterConfig,- },- };-}--export function mergeModelProfileAdapterConfig(input: {- baseConfig: Record<string, unknown>;- modelProfile: ModelProfileApplication;- issueAdapterConfig: Record<string, unknown> | null | undefined;-}): Record<string, unknown> {- return {- ...input.baseConfig,- ...(input.modelProfile.adapterConfig ?? {}),- ...(input.issueAdapterConfig ?? {}),- };-}--function modelProfileRunMetadata(- modelProfile: ModelProfileApplication,-): Record<string, unknown> | null {- if (!modelProfile.requested) return null;- return {- requested: modelProfile.requested,- requestedBy: modelProfile.requestedBy,- applied: modelProfile.applied,- configSource: modelProfile.configSource,- fallbackReason: modelProfile.fallbackReason,- };-}--function mergeModelProfileRunMetadata(- resultJson: Record<string, unknown> | null,- modelProfile: ModelProfileApplication,-): Record<string, unknown> | null {- const metadata = modelProfileRunMetadata(modelProfile);- if (!metadata) return resultJson;- return {- ...(resultJson ?? {}),- modelProfile: metadata,- };-}-export function summarizeHeartbeatRunContextSnapshot(contextSnapshot: Record<string, unknown> | null | undefined,): Record<string, unknown> | null {@@ -4654,7 +4475,6 @@ export function summarizeHeartbeatRunContextSnapshot("wakeReason","wakeSource","wakeTriggerDetail",- "modelProfile",] as const;for (const key of allowedKeys) {@@ -5109,11 +4929,6 @@ function parseIssueAssigneeAdapterOverrides(raw: unknown,): ParsedIssueAssigneeAdapterOverrides | null {const parsed = parseObject(raw);- const modelProfile = MODEL_PROFILE_KEYS.includes(- parsed.modelProfile as ModelProfileKey,- )- ? (parsed.modelProfile as ModelProfileKey)- : null;const parsedAdapterConfig = parseObject(parsed.adapterConfig);const adapterConfig =Object.keys(parsedAdapterConfig).length > 0 ? parsedAdapterConfig : null;@@ -5121,10 +4936,9 @@ function parseIssueAssigneeAdapterOverrides(typeof parsed.useProjectWorkspace === "boolean"? parsed.useProjectWorkspace: null;- if (!modelProfile && !adapterConfig && useProjectWorkspace === null)+ if (!adapterConfig && useProjectWorkspace === null)return null;return {- modelProfile,adapterConfig,useProjectWorkspace,};@@ -5372,7 +5186,6 @@ const EFFECTIVE_RUN_SESSION_CONFIG_CATEGORIES = ["adapter","adapterConfig","agentRuntimeConfig",- "modelProfile","instructions","issueOverrides","workspaceConfig",@@ -5645,7 +5458,6 @@ const EFFECTIVE_RUN_SESSION_CONFIG_CATEGORY_LABELS: Record<adapter: "adapter",adapterConfig: "adapter config",agentRuntimeConfig: "agent runtime config",- modelProfile: "model profile",instructions: "instructions",issueOverrides: "issue overrides",workspaceConfig: "workspace config",@@ -6020,7 +5832,6 @@ function buildSessionConfigCategoryValues(input: {adapterType: string;effectiveAdapterConfig: Record<string, unknown>;agentRuntimeConfig: unknown;- modelProfile: unknown;instructions: unknown;issueOverrides: unknown;workspaceConfig: unknown;@@ -6048,7 +5859,6 @@ function buildSessionConfigCategoryValues(input: {},adapterConfig: input.effectiveAdapterConfig,agentRuntimeConfig: input.agentRuntimeConfig,- modelProfile: input.modelProfile,instructions: input.instructions,issueOverrides: input.issueOverrides,workspaceConfig,@@ -6067,7 +5877,6 @@ export async function buildEffectiveRunSessionConfigMetadata(input: {adapterType: string;effectiveAdapterConfig: Record<string, unknown>;agentRuntimeConfig: unknown;- modelProfile: unknown;issueOverrides: unknown;workspaceConfig: unknown;environment: unknown;@@ -6086,7 +5895,6 @@ export async function buildEffectiveRunSessionConfigMetadata(input: {adapterType: input.adapterType,effectiveAdapterConfig: input.effectiveAdapterConfig,agentRuntimeConfig: input.agentRuntimeConfig,- modelProfile: input.modelProfile,instructions,issueOverrides: input.issueOverrides,workspaceConfig: input.workspaceConfig,@@ -6662,7 +6470,6 @@ function enrichWakeContextSnapshot(input: {) {contextSnapshot.wakeTriggerDetail = triggerDetail;}- normalizeModelProfileWakeContext({ contextSnapshot, payload });normalizeInteractionContinuationWakeContext(contextSnapshot, payload);return {@@ -9479,8 +9286,6 @@ export function heartbeatService(projectId: input.claimed.projectId,goalId: input.claimed.goalId,assigneeAgentId: input.claimed.assigneeAgentId,- assigneeAdapterOverrides:- recoveryAssigneeAdapterOverrides("status_only"),originKind: RECOVERY_ORIGIN_KINDS.strandedIssueRecovery,originId: input.claimed.id,originFingerprint: `issue_monitor:${input.clearReason}`,@@ -9494,13 +9299,13 @@ export function heartbeatService(triggerDetail: "system",reason: "issue_monitor_recovery_issue",idempotencyKey: `issue-monitor-recovery-issue:${input.claimed.id}:${input.clearReason}:${input.scheduledAtIso}`,- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({ issueId: recoveryIssue.id, sourceIssueId: input.claimed.id },"status_only",),requestedByActorType: input.actorType,requestedByActorId: input.actorId,- contextSnapshot: withRecoveryModelProfileHint(+ contextSnapshot: withRecoveryContext({issueId: recoveryIssue.id,sourceIssueId: input.claimed.id,@@ -9561,7 +9366,7 @@ export function heartbeatService(triggerDetail: "system",reason: "issue_monitor_recovery",idempotencyKey: `issue-monitor-recovery:${input.claimed.id}:${input.clearReason}:${input.scheduledAtIso}`,- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({issueId: input.claimed.id,monitorAttemptCount: input.nextAttemptCount,@@ -9576,7 +9381,7 @@ export function heartbeatService(),requestedByActorType: input.actorType,requestedByActorId: input.actorId,- contextSnapshot: withRecoveryModelProfileHint(+ contextSnapshot: withRecoveryContext({issueId: input.claimed.id,source: "issue.monitor.recovery",@@ -11923,7 +11728,7 @@ export function heartbeatService(const contextSnapshot = parseObject(run.contextSnapshot);const taskKey = deriveTaskKeyWithHeartbeatFallback(contextSnapshot, null);const sessionBefore = await resolveSessionBeforeForWakeup(agent, taskKey);- const retryContextSnapshot = withRecoveryModelProfileHint(+ const retryContextSnapshot = withRecoveryContext({...contextSnapshot,retryOfRunId: run.id,@@ -11964,7 +11769,7 @@ export function heartbeatService(source: "automation",triggerDetail: "system",reason: "missing_issue_comment",- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({issueId,retryOfRunId: run.id,@@ -12302,7 +12107,7 @@ export function heartbeatService(: "process_lost";const taskKey = deriveTaskKeyWithHeartbeatFallback(contextSnapshot, null);const sessionBefore = await resolveSessionBeforeForWakeup(agent, taskKey);- const retryContextSnapshot = withRecoveryModelProfileHint(+ const retryContextSnapshot = withRecoveryContext({...contextSnapshot,retryOfRunId: run.id,@@ -12325,7 +12130,7 @@ export function heartbeatService(source: "automation",triggerDetail: "system",reason: "process_lost_retry",- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({...(issueId ? { issueId } : {}),retryOfRunId: run.id,@@ -13686,7 +13491,7 @@ export function heartbeatService(workspaceValidationRetryPayload !== null &&Object.keys(workspaceValidationRetryPayload).length > 0;const retryContextSnapshot: Record<string, unknown> =- withRecoveryModelProfileHint(+ withRecoveryContext({...contextSnapshot,retryOfRunId: run.id,@@ -13993,7 +13798,7 @@ export function heartbeatService(source: "automation",triggerDetail: "system",reason: wakeReason,- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({...(issueId ? { issueId } : {}),retryOfRunId: run.id,@@ -18254,47 +18059,10 @@ export function heartbeatService(legacyUseProjectWorkspace:issueAssigneeOverrides?.useProjectWorkspace ?? null,});- let adapterModelProfiles: AdapterModelProfileDefinition[] = [];- let profileResolutionFallbackReason: string | null = null;- try {- adapterModelProfiles = await listAdapterModelProfiles(- agent.adapterType,- );- } catch (error) {- profileResolutionFallbackReason = "adapter_profile_resolution_failed";- logger.warn(- {- err: error,- companyId: agent.companyId,- agentId: agent.id,- adapterType: agent.adapterType,- runId: run.id,- },- "Failed to resolve adapter model profiles; falling back to primary adapter config",- );- }- const modelProfileApplication = resolveModelProfileApplication({- adapterModelProfiles,- agentRuntimeConfig: agent.runtimeConfig,- issueModelProfile: issueAssigneeOverrides?.modelProfile ?? null,- contextSnapshot: context,- profileResolutionFallbackReason,- });- const modelProfileMetadata = modelProfileRunMetadata(- modelProfileApplication,- );- if (modelProfileMetadata) {- context.paperclipModelProfile = modelProfileMetadata;- if (modelProfileApplication.requested)- context.modelProfile = modelProfileApplication.requested;- } else {- delete context.paperclipModelProfile;- }- const mergedConfig = mergeModelProfileAdapterConfig({- baseConfig: workspaceManagedConfig,- modelProfile: modelProfileApplication,- issueAdapterConfig: issueAssigneeOverrides?.adapterConfig ?? null,- });+ const mergedConfig = {+ ...workspaceManagedConfig,+ ...(issueAssigneeOverrides?.adapterConfig ?? {}),+ };const configSnapshot = buildExecutionWorkspaceConfigSnapshot(mergedConfig,selectedEnvironmentId,@@ -18386,7 +18154,6 @@ export function heartbeatService(adapterType: agent.adapterType,effectiveAdapterConfig: runtimeConfig,agentRuntimeConfig: agent.runtimeConfig,- modelProfile: modelProfileMetadata,issueOverrides: issueAssigneeOverrides,workspaceConfig: {requestedMode: requestedExecutionWorkspaceMode,@@ -19827,20 +19594,12 @@ export function heartbeatService(if (key in meta.env) meta.env[key] = "***REDACTED***";}}- const modelProfileMetadata = modelProfileRunMetadata(- modelProfileApplication,- );await appendRunEvent(currentRun, {eventType: "adapter.invoke",stream: "system",level: "info",message: "adapter invocation",- payload: {- ...(meta as unknown as Record<string, unknown>),- ...(modelProfileMetadata- ? { modelProfile: modelProfileMetadata }- : {}),- },+ payload: meta as unknown as Record<string, unknown>,});};@@ -21152,20 +20911,17 @@ export function heartbeatService(const persistedResultJson = mergeHeartbeatRunResultJson(mergeRunStopMetadataForAgent(agent, outcome, {- resultJson: mergeModelProfileRunMetadata(- mergeAdapterRecoveryMetadata({- resultJson: {- ...(adapterResult.nativeFinalization- ? parseObject(latestRun?.resultJson)- : {}),- ...parseObject(adapterResult.resultJson),- configFreshness: configFreshnessResultMetadata,- },- errorFamily: adapterResult.errorFamily ?? null,- retryNotBefore: adapterResult.retryNotBefore ?? null,- }),- modelProfileApplication,- ),+ resultJson: mergeAdapterRecoveryMetadata({+ resultJson: {+ ...(adapterResult.nativeFinalization+ ? parseObject(latestRun?.resultJson)+ : {}),+ ...parseObject(adapterResult.resultJson),+ configFreshness: configFreshnessResultMetadata,+ },+ errorFamily: adapterResult.errorFamily ?? null,+ retryNotBefore: adapterResult.retryNotBefore ?? null,+ }),errorCode: runErrorCode,errorMessage: runErrorMessage,}),@@ -22685,7 +22441,7 @@ export function heartbeatService(source: "automation",triggerDetail: "system",reason: EXECUTION_REVIEW_PARTICIPANT_RECOVERY_WAKE_REASON,- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({issueId: issue.id,retryOfRunId: run.id,@@ -22712,7 +22468,7 @@ export function heartbeatService(triggerDetail: "system",status: "queued",wakeupRequestId: wakeupRequest.id,- contextSnapshot: withRecoveryModelProfileHint(+ contextSnapshot: withRecoveryContext({issueId: issue.id,taskId: issue.id,@@ -22856,7 +22612,7 @@ export function heartbeatService(? "issue.assignment_recovery": "issue.continuation_recovery";const now = new Date();- const recoveryContextSnapshot = withRecoveryModelProfileHint(+ const recoveryContextSnapshot = withRecoveryContext({issueId: issue.id,taskId: issue.id,@@ -22903,7 +22659,7 @@ export function heartbeatService(source: "automation",triggerDetail: "system",reason: recoveryReason,- payload: withRecoveryModelProfileHint(+ payload: withRecoveryContext({issueId: issue.id,retryOfRunId: run.id,diff --git a/server/src/services/productivity-review.ts b/server/src/services/productivity-review.tsindex 909682d675..cda9722fa8 100644--- a/server/src/services/productivity-review.ts+++ b/server/src/services/productivity-review.ts@@ -16,10 +16,7 @@ import { logActivity } from "./activity-log.js";import { budgetService } from "./budgets.js";import { issueService } from "./issues.js";import { visibleIssueCondition } from "./issue-visibility.js";-import {- recoveryAssigneeAdapterOverrides,- withRecoveryModelProfileHint,-} from "./recovery/model-profile-hint.js";+import { withRecoveryContext } from "./recovery/status-only-context.js";import { RECOVERY_ORIGIN_KINDS } from "./recovery/origins.js";export const PRODUCTIVITY_REVIEW_ORIGIN_KIND = RECOVERY_ORIGIN_KINDS.issueProductivityReview;@@ -771,7 +768,6 @@ export function productivityReviewService(db: Db, deps?: { enqueueWakeup?: EnquegoalId: evidence.sourceIssue.goalId,billingCode: evidence.sourceIssue.billingCode,assigneeAgentId: ownerAgentId,- assigneeAdapterOverrides: recoveryAssigneeAdapterOverrides("status_only"),originKind: PRODUCTIVITY_REVIEW_ORIGIN_KIND,originId: evidence.sourceIssue.id,originFingerprint: productivityReviewFingerprint(evidence.sourceIssue.id),@@ -817,14 +813,14 @@ export function productivityReviewService(db: Db, deps?: { enqueueWakeup?: Enquesource: "assignment",triggerDetail: "system",reason: "issue_assigned",- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: review.id,sourceIssueId: evidence.sourceIssue.id,trigger: evidence.trigger,}, "status_only"),requestedByActorType: "system",requestedByActorId: "productivity_review",- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({issueId: review.id,taskId: review.id,wakeReason: "issue_assigned",diff --git a/server/src/services/recovery/model-profile-hint.test.ts b/server/src/services/recovery/model-profile-hint.test.tsdeleted file mode 100644index 77639ee4d6..0000000000--- a/server/src/services/recovery/model-profile-hint.test.ts+++ /dev/null@@ -1,44 +0,0 @@-import { describe, expect, it } from "vitest";-import {- recoveryAssigneeAdapterOverrides,- scrubRecoveryModelProfileHints,- withRecoveryModelProfileHint,-} from "./model-profile-hint.js";--describe("recovery model profile policy", () => {- it("allows cheap only for status-only recovery and adds guard context", () => {- expect(withRecoveryModelProfileHint({ issueId: "issue-1" }, "status_only")).toEqual({- issueId: "issue-1",- recoveryIntent: "status_only",- allowDeliverableWork: false,- allowDocumentUpdates: false,- resumeRequiresNormalModel: true,- modelProfile: "cheap",- });- expect(recoveryAssigneeAdapterOverrides("status_only")).toEqual({ modelProfile: "cheap" });- });-- it("scrubs inherited cheap hints from normal model source-work retries", () => {- expect(withRecoveryModelProfileHint({- issueId: "issue-1",- retryOfRunId: "run-1",- modelProfile: "cheap",- recoveryIntent: "status_only",- allowDeliverableWork: false,- allowDocumentUpdates: false,- resumeRequiresNormalModel: true,- }, "normal_model")).toEqual({- issueId: "issue-1",- retryOfRunId: "run-1",- });- });-- it("can scrub copied downstream source-work contexts without applying a profile", () => {- expect(scrubRecoveryModelProfileHints({- taskId: "source-task",- modelProfile: "cheap",- paperclipModelProfile: { requested: "cheap" },- allowDocumentUpdates: false,- })).toEqual({ taskId: "source-task" });- });-});diff --git a/server/src/services/recovery/model-profile-hint.ts b/server/src/services/recovery/model-profile-hint.tsdeleted file mode 100644index bdbdccb93b..0000000000--- a/server/src/services/recovery/model-profile-hint.ts+++ /dev/null@@ -1,65 +0,0 @@-export const RECOVERY_MODEL_PROFILE_KEY = "cheap" as const;--export type RecoveryModelProfileWorkClass = "status_only" | "normal_model";--export const STATUS_ONLY_RECOVERY_GUARD_CONTEXT = {- recoveryIntent: "status_only",- allowDeliverableWork: false,- allowDocumentUpdates: false,- resumeRequiresNormalModel: true,-} as const;--const RECOVERY_MODEL_PROFILE_HINT_KEYS = [- "modelProfile",- "paperclipModelProfile",- "recoveryIntent",- "allowDeliverableWork",- "allowDocumentUpdates",- "resumeRequiresNormalModel",-] as const;--type RecoveryModelProfileHintKey = (typeof RECOVERY_MODEL_PROFILE_HINT_KEYS)[number];-type WithoutRecoveryModelProfileHints<T> = Omit<T, RecoveryModelProfileHintKey>;--export function scrubRecoveryModelProfileHints<T extends Record<string, unknown>>(- input: T,-): WithoutRecoveryModelProfileHints<T> {- const output: Record<string, unknown> = { ...input };- for (const key of RECOVERY_MODEL_PROFILE_HINT_KEYS) {- delete output[key];- }- return output as WithoutRecoveryModelProfileHints<T>;-}--export function withRecoveryModelProfileHint<T extends Record<string, unknown>>(- input: T,- workClass: "normal_model",-): WithoutRecoveryModelProfileHints<T>;-export function withRecoveryModelProfileHint<T extends Record<string, unknown>>(- input: T,- workClass: "status_only",-): WithoutRecoveryModelProfileHints<T> & typeof STATUS_ONLY_RECOVERY_GUARD_CONTEXT & {- modelProfile: typeof RECOVERY_MODEL_PROFILE_KEY;-};-export function withRecoveryModelProfileHint<T extends Record<string, unknown>>(- input: T,- workClass: RecoveryModelProfileWorkClass,-):- | WithoutRecoveryModelProfileHints<T>- | (WithoutRecoveryModelProfileHints<T> & typeof STATUS_ONLY_RECOVERY_GUARD_CONTEXT & {- modelProfile: typeof RECOVERY_MODEL_PROFILE_KEY;- }) {- if (workClass === "normal_model") {- return scrubRecoveryModelProfileHints(input);- }-- return {- ...scrubRecoveryModelProfileHints(input),- ...STATUS_ONLY_RECOVERY_GUARD_CONTEXT,- modelProfile: RECOVERY_MODEL_PROFILE_KEY,- };-}--export function recoveryAssigneeAdapterOverrides(_workClass: Extract<RecoveryModelProfileWorkClass, "status_only">) {- return { modelProfile: RECOVERY_MODEL_PROFILE_KEY };-}diff --git a/server/src/services/recovery/review-path-recovery.ts b/server/src/services/recovery/review-path-recovery.tsindex cd147900ce..27ef24234f 100644--- a/server/src/services/recovery/review-path-recovery.ts+++ b/server/src/services/recovery/review-path-recovery.ts@@ -1,6 +1,6 @@import { createHash } from "node:crypto";import type { IssueReviewAttention } from "@paperclipai/shared";-import { withRecoveryModelProfileHint } from "./model-profile-hint.js";+import { withRecoveryContext } from "./status-only-context.js";export const ISSUE_REVIEW_PATH_LOST_WAKE_REASON = "issue_review_path_lost";export const REVIEW_PATH_RECOVERY_INSTRUCTION =@@ -100,7 +100,7 @@ export function decideIssueReviewPathRecovery(input: {});if (input.existingWake) return { kind: "skip", reason: "review-path recovery wake already exists" };- const payload = withRecoveryModelProfileHint({+ const payload = withRecoveryContext({issueId: input.issueId,taskId: input.issueId,sourceIssueId: input.issueId,@@ -116,7 +116,7 @@ export function decideIssueReviewPathRecovery(input: {kind: "enqueue",idempotencyKey,payload,- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({...payload,wakeReason: ISSUE_REVIEW_PATH_LOST_WAKE_REASON,source: readNonEmptyString(context.source) ?? "heartbeat.review_path_disposition",diff --git a/server/src/services/recovery/run-liveness-continuations.ts b/server/src/services/recovery/run-liveness-continuations.tsindex dd199b310c..ca14d68734 100644--- a/server/src/services/recovery/run-liveness-continuations.ts+++ b/server/src/services/recovery/run-liveness-continuations.ts@@ -2,7 +2,7 @@ import { and, eq, inArray } from "drizzle-orm";import type { Db } from "@paperclipai/db";import { agentWakeupRequests, agents, heartbeatRuns, issues } from "@paperclipai/db";import type { RunLivenessState } from "@paperclipai/shared";-import { withRecoveryModelProfileHint } from "./model-profile-hint.js";+import { withRecoveryContext } from "./status-only-context.js";import { RECOVERY_REASON_KINDS } from "./origins.js";export const RUN_LIVENESS_CONTINUATION_REASON = RECOVERY_REASON_KINDS.runLivenessContinuation;@@ -156,7 +156,7 @@ export function decideRunLivenessContinuation(input: {return { kind: "skip", reason: "continuation wake already exists for this source run and attempt" };}- const payload = withRecoveryModelProfileHint({+ const payload = withRecoveryContext({issueId: issue.id,sourceRunId: run.id,livenessState,@@ -173,7 +173,7 @@ export function decideRunLivenessContinuation(input: {nextAttempt,idempotencyKey,payload,- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({issueId: issue.id,taskId: issue.id,taskKey: issue.id,diff --git a/server/src/services/recovery/service.ts b/server/src/services/recovery/service.tsindex 92cafb4ca5..2d8cbb5d86 100644--- a/server/src/services/recovery/service.ts+++ b/server/src/services/recovery/service.ts@@ -68,10 +68,7 @@ import {RECOVERY_ORIGIN_KINDS,isStrandedIssueRecoveryOriginKind,} from "./origins.js";-import {- recoveryAssigneeAdapterOverrides,- withRecoveryModelProfileHint,-} from "./model-profile-hint.js";+import { withRecoveryContext } from "./status-only-context.js";import { isAutomaticRecoverySuppressedByPauseHold } from "./pause-hold-guard.js";import {collectDispositionRepairSourceState,@@ -1034,14 +1031,14 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })source: "automation",triggerDetail: "system",reason: input.reason,- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: input.issueId,...(input.retryOfRunId ? { retryOfRunId: input.retryOfRunId } : {}),...(input.extraContext ?? {}),}, "normal_model"),requestedByActorType: "system",requestedByActorId: null,- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({issueId: input.issueId,taskId: input.issueId,wakeReason: input.reason,@@ -1072,13 +1069,13 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })source: "assignment",triggerDetail: "system",reason: "issue_assigned",- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: issue.id,mutation: "assigned_todo_liveness_dispatch",}, "normal_model"),requestedByActorType: "system",requestedByActorId: null,- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({issueId: issue.id,taskId: issue.id,wakeReason: "issue_assigned",@@ -1187,13 +1184,13 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })source: "automation",triggerDetail: "system",reason: "issue_assigned",- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: candidate.id,mutation: "unassigned_blocker_recovery",}, "normal_model"),requestedByActorType: "system",requestedByActorId: null,- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({issueId: candidate.id,taskId: candidate.id,wakeReason: "issue_assigned",@@ -2150,7 +2147,7 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })source: "automation",triggerDetail: "system",reason: "provider_quota_recovery",- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: input.issue.id,retryOfRunId: input.latestRun?.id ?? null,retryReason: "provider_quota_recovery",@@ -2177,7 +2174,7 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })scheduledRetryAt: retryAt,scheduledRetryAttempt: 1,scheduledRetryReason: "provider_quota_recovery",- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({issueId: input.issue.id,taskId: input.issue.id,wakeReason: "provider_quota_recovery",@@ -2565,7 +2562,7 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })const now = new Date();const retryAt = new Date(now.getTime() + timing.delayMs);const idempotencyKey = `issue_disposition_repair:${input.issue.id}:${input.fingerprint}:${input.attempt}`;- const context = withRecoveryModelProfileHint({+ const context = withRecoveryContext({issueId: input.issue.id,taskId: input.issue.id,wakeReason: ISSUE_DISPOSITION_REPAIR_RETRY_REASON,@@ -2603,7 +2600,7 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })triggerDetail: "system",reason: ISSUE_DISPOSITION_REPAIR_RETRY_REASON,idempotencyKey,- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: input.issue.id,retryOfRunId: input.latestRun?.id ?? null,recoveryActionId: input.action.id,@@ -2627,7 +2624,7 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })source: "automation",triggerDetail: "system",reason: ISSUE_DISPOSITION_REPAIR_RETRY_REASON,- payload: withRecoveryModelProfileHint({+ payload: withRecoveryContext({issueId: input.issue.id,retryOfRunId: input.latestRun?.id ?? null,recoveryActionId: input.action.id,diff --git a/server/src/services/recovery/status-only-context.test.ts b/server/src/services/recovery/status-only-context.test.tsnew file mode 100644index 0000000000..4ae151238e--- /dev/null+++ b/server/src/services/recovery/status-only-context.test.ts@@ -0,0 +1,24 @@+import { describe, expect, it } from "vitest";+import { withRecoveryContext } from "./status-only-context.js";++describe("withRecoveryContext", () => {+ it("applies status-only mutation guards without selecting a model", () => {+ expect(withRecoveryContext({ issueId: "issue-1" }, "status_only")).toEqual({+ issueId: "issue-1",+ recoveryIntent: "status_only",+ allowDeliverableWork: false,+ allowDocumentUpdates: false,+ resumeRequiresNormalModel: true,+ });+ });++ it("removes legacy model hints from all recovery work", () => {+ expect(withRecoveryContext({+ issueId: "issue-1",+ modelProfile: "cheap",+ paperclipModelProfile: { requested: "cheap" },+ }, "normal_model")).toEqual({+ issueId: "issue-1",+ });+ });+});diff --git a/server/src/services/recovery/status-only-context.ts b/server/src/services/recovery/status-only-context.tsnew file mode 100644index 0000000000..17846a1317--- /dev/null+++ b/server/src/services/recovery/status-only-context.ts@@ -0,0 +1,48 @@+export type RecoveryWorkClass = "status_only" | "normal_model";++export const STATUS_ONLY_RECOVERY_GUARD_CONTEXT = {+ recoveryIntent: "status_only",+ allowDeliverableWork: false,+ allowDocumentUpdates: false,+ resumeRequiresNormalModel: true,+} as const;++const RECOVERY_CONTEXT_KEYS = [+ // Retired model-profile fields are scrubbed from old queued contexts so an+ // upgrade cannot restore the removed execution path.+ "modelProfile",+ "paperclipModelProfile",+ "recoveryIntent",+ "allowDeliverableWork",+ "allowDocumentUpdates",+ "resumeRequiresNormalModel",+] as const;++type RecoveryContextKey = (typeof RECOVERY_CONTEXT_KEYS)[number];+type WithoutRecoveryContext<T> = Omit<T, RecoveryContextKey>;++export function scrubRecoveryContext<T extends Record<string, unknown>>(+ input: T,+): WithoutRecoveryContext<T> {+ const output: Record<string, unknown> = { ...input };+ for (const key of RECOVERY_CONTEXT_KEYS) delete output[key];+ return output as WithoutRecoveryContext<T>;+}++export function withRecoveryContext<T extends Record<string, unknown>>(+ input: T,+ workClass: "normal_model",+): WithoutRecoveryContext<T>;+export function withRecoveryContext<T extends Record<string, unknown>>(+ input: T,+ workClass: "status_only",+): WithoutRecoveryContext<T> & typeof STATUS_ONLY_RECOVERY_GUARD_CONTEXT;+export function withRecoveryContext<T extends Record<string, unknown>>(+ input: T,+ workClass: RecoveryWorkClass,+): WithoutRecoveryContext<T> | (WithoutRecoveryContext<T> & typeof STATUS_ONLY_RECOVERY_GUARD_CONTEXT) {+ const scrubbed = scrubRecoveryContext(input);+ return workClass === "status_only"+ ? { ...scrubbed, ...STATUS_ONLY_RECOVERY_GUARD_CONTEXT }+ : scrubbed;+}diff --git a/server/src/services/recovery/successful-run-handoff.ts b/server/src/services/recovery/successful-run-handoff.tsindex e842859458..ae59eaa06e 100644--- a/server/src/services/recovery/successful-run-handoff.ts+++ b/server/src/services/recovery/successful-run-handoff.ts@@ -2,7 +2,7 @@ import { and, eq, inArray } from "drizzle-orm";import type { Db } from "@paperclipai/db";import { agentWakeupRequests, agents, heartbeatRuns, issues } from "@paperclipai/db";import type { IssueCommentMetadata, IssueCommentPresentation, RunLivenessState } from "@paperclipai/shared";-import { withRecoveryModelProfileHint } from "./model-profile-hint.js";+import { withRecoveryContext } from "./status-only-context.js";import {agentLinkRow,issueLinkRow,@@ -512,7 +512,7 @@ export function decideSuccessfulRunHandoff(input: {nextAction: input.nextAction,detectedProgressSummary: input.detectedProgressSummary,});- const payload = withRecoveryModelProfileHint({+ const payload = withRecoveryContext({issueId: issue.id,taskId: issue.id,sourceIssueId: issue.id,@@ -540,7 +540,7 @@ export function decideSuccessfulRunHandoff(input: {}),payload,instruction,- contextSnapshot: withRecoveryModelProfileHint({+ contextSnapshot: withRecoveryContext({...payload,wakeReason: FINISH_SUCCESSFUL_RUN_HANDOFF_REASON,livenessState: input.livenessState,diff --git a/ui/src/adapters/use-adapter-capabilities.ts b/ui/src/adapters/use-adapter-capabilities.tsindex 332c29e0c2..58e6a1f1a4 100644--- a/ui/src/adapters/use-adapter-capabilities.ts+++ b/ui/src/adapters/use-adapter-capabilities.ts@@ -8,7 +8,6 @@ const ALL_FALSE: AdapterCapabilities = {supportsSkills: false,supportsLocalAgentJwt: false,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,supportsAcp: false,};@@ -21,15 +20,15 @@ const ALL_FALSE: AdapterCapabilities = {* Reconcile the two together if any adapter's login flow changes.*/const KNOWN_DEFAULTS: Record<string, AdapterCapabilities> = {- claude_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: false, supportsModelProfiles: true, supportsAcp: true, login: { panelMode: "submitted_browser_code", timeoutPolicy: "fixed" } },- codex_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: false, supportsModelProfiles: true, supportsAcp: true, login: { panelMode: "displayed_code", timeoutPolicy: "caller_bounded" } },- paperclip_runner: { supportsInstructionsBundle: false, supportsSkills: true, supportsLocalAgentJwt: false, requiresMaterializedRuntimeSkills: false, supportsModelProfiles: false, supportsAcp: false },- cursor: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsModelProfiles: true, supportsAcp: false },- gemini_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsModelProfiles: true, supportsAcp: true },- grok_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsModelProfiles: false, supportsAcp: false, login: { panelMode: "displayed_code", timeoutPolicy: "caller_bounded" } },- kimi_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsModelProfiles: false, supportsAcp: true },- opencode_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsModelProfiles: true, supportsAcp: false },- pi_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsModelProfiles: false, supportsAcp: false },+ claude_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: false, supportsAcp: true, login: { panelMode: "submitted_browser_code", timeoutPolicy: "fixed" } },+ codex_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: false, supportsAcp: true, login: { panelMode: "displayed_code", timeoutPolicy: "caller_bounded" } },+ paperclip_runner: { supportsInstructionsBundle: false, supportsSkills: true, supportsLocalAgentJwt: false, requiresMaterializedRuntimeSkills: false, supportsAcp: false },+ cursor: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsAcp: false },+ gemini_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsAcp: true },+ grok_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsAcp: false, login: { panelMode: "displayed_code", timeoutPolicy: "caller_bounded" } },+ kimi_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsAcp: true },+ opencode_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsAcp: false },+ pi_local: { supportsInstructionsBundle: true, supportsSkills: true, supportsLocalAgentJwt: true, requiresMaterializedRuntimeSkills: true, supportsAcp: false },openclaw_gateway: ALL_FALSE,};diff --git a/ui/src/api/adapters.ts b/ui/src/api/adapters.tsindex a6368d29b4..0641b1ed7d 100644--- a/ui/src/api/adapters.ts+++ b/ui/src/api/adapters.ts@@ -19,7 +19,6 @@ export interface AdapterCapabilities {supportsSkills: boolean;supportsLocalAgentJwt: boolean;requiresMaterializedRuntimeSkills: boolean;- supportsModelProfiles: boolean;supportsAcp: boolean;/** Present only when the adapter declares an interactive login capability. */login?: AdapterLoginProjection;diff --git a/ui/src/api/agents.ts b/ui/src/api/agents.tsindex 6a89834b8c..530f3006d2 100644--- a/ui/src/api/agents.ts+++ b/ui/src/api/agents.ts@@ -28,10 +28,6 @@ import type {ClearAgentErrorResponse,AgentApiKeyScope,} from "@paperclipai/shared";-import type {- AdapterModelProfileDefinition,- AdapterModelProfileKey,-} from "@paperclipai/adapter-utils";import { isUuidLike, normalizeAgentUrlKey } from "@paperclipai/shared";import { ApiError, api } from "./client";@@ -48,9 +44,6 @@ export interface AdapterModel {label: string;}-export type { AdapterModelProfileKey };-export type AdapterModelProfile = AdapterModelProfileDefinition;-export interface DetectedAdapterModel {model: string;provider: string;@@ -223,10 +216,6 @@ export const agentsApi = {api.get<DetectedAdapterModel | null>(`/companies/${encodeURIComponent(companyId)}/adapters/${encodeURIComponent(type)}/detect-model`,),- adapterModelProfiles: (companyId: string, type: string) =>- api.get<AdapterModelProfile[]>(- `/companies/${encodeURIComponent(companyId)}/adapters/${encodeURIComponent(type)}/model-profiles`,- ),testEnvironment: (companyId: string,type: string,diff --git a/ui/src/components/AgentConfigForm.render.test.tsx b/ui/src/components/AgentConfigForm.render.test.tsxindex e6191c4cb5..80e4c87c6c 100644--- a/ui/src/components/AgentConfigForm.render.test.tsx+++ b/ui/src/components/AgentConfigForm.render.test.tsx@@ -15,7 +15,6 @@ import { buildNewAgentHirePayload } from "../lib/new-agent-hire-payload";import { ApiError } from "../api/client";const mockAgentsApi = vi.hoisted(() => ({- adapterModelProfiles: vi.fn(),adapterModels: vi.fn(),detectModel: vi.fn(),list: vi.fn(),@@ -143,7 +142,6 @@ vi.mock("../adapters/use-adapter-capabilities", () => ({supportsSkills: false,supportsLocalAgentJwt: false,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,supportsAcp: false,}: {@@ -151,7 +149,6 @@ vi.mock("../adapters/use-adapter-capabilities", () => ({supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: true,supportsAcp: true,...(login ? { login } : {}),};@@ -632,7 +629,6 @@ describe("AgentConfigForm environment selector", () => {let roots: Root[] = [];beforeEach(() => {- mockAgentsApi.adapterModelProfiles.mockResolvedValue([]);mockAgentsApi.adapterModels.mockResolvedValue([]);mockAgentsApi.detectModel.mockResolvedValue(null);mockAgentsApi.list.mockResolvedValue([]);@@ -879,51 +875,6 @@ describe("AgentConfigForm environment selector", () => {expect(result.container.textContent).toContain("Hermes Gateway fields");});- it("tests both the primary and cheap models when a cheap profile is configured", async () => {- const result = await renderForm([- makeEnvironment({ id: "local-1", name: "Local", driver: "local" }),- ], {- adapterConfig: { model: "gpt-5.4" },- runtimeConfig: {- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: {- model: "gpt-5.4-mini",- baseUrl: "https://cheap-models.example.test",- provider: "budget-provider",- },- },- },- },- }, {- showAdapterTestEnvironmentButton: true,- });- roots.push(result.root);-- const testButton = Array.from(result.container.querySelectorAll("button")).find(- (button) => button.textContent?.trim() === "Test",- );- expect(testButton).toBeTruthy();-- await act(async () => {- testButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));- });- await flushReact();-- expect(mockAgentsApi.testEnvironment).toHaveBeenCalledTimes(2);- expect(mockAgentsApi.testEnvironment.mock.calls[0]?.[2]).toMatchObject({- adapterConfig: expect.objectContaining({ model: "gpt-5.4" }),- });- expect(mockAgentsApi.testEnvironment.mock.calls[1]?.[2]).toMatchObject({- adapterConfig: expect.objectContaining({- model: "gpt-5.4-mini",- baseUrl: "https://cheap-models.example.test",- provider: "budget-provider",- }),- });- });-it("tests a Codex agent after clearing the primary model to the adapter default", async () => {const result = await renderForm([makeEnvironment({ id: "local-1", name: "Local", driver: "local" }),@@ -1057,14 +1008,6 @@ describe("AgentConfigForm environment selector", () => {makeEnvironment({ id: "local-1", name: "Local", driver: "local" }),], {adapterConfig: { model: "gpt-5.4" },- runtimeConfig: {- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: { model: "gpt-5.4-mini" },- },- },- },}, {showAdapterTestEnvironmentButton: true,});@@ -2465,7 +2408,6 @@ describe("AgentConfigForm create-mode Claude OAuth binding", () => {let roots: Root[] = [];beforeEach(() => {- mockAgentsApi.adapterModelProfiles.mockResolvedValue([]);mockAgentsApi.adapterModels.mockResolvedValue([]);mockAgentsApi.detectModel.mockResolvedValue(null);mockAgentsApi.list.mockResolvedValue([]);@@ -2664,7 +2606,6 @@ describe("AgentConfigForm edit-mode Claude OAuth binding", () => {let roots: Root[] = [];beforeEach(() => {- mockAgentsApi.adapterModelProfiles.mockResolvedValue([]);mockAgentsApi.adapterModels.mockResolvedValue([]);mockAgentsApi.detectModel.mockResolvedValue(null);mockAgentsApi.list.mockResolvedValue([]);@@ -2789,7 +2730,6 @@ describe("AgentConfigForm managed-sandbox-only host surfaces", () => {}beforeEach(() => {- mockAgentsApi.adapterModelProfiles.mockResolvedValue([]);mockAgentsApi.adapterModels.mockResolvedValue([]);mockAgentsApi.detectModel.mockResolvedValue(null);mockAgentsApi.list.mockResolvedValue([]);diff --git a/ui/src/components/AgentConfigForm.tsx b/ui/src/components/AgentConfigForm.tsxindex b244f06839..4867f276e8 100644--- a/ui/src/components/AgentConfigForm.tsx+++ b/ui/src/components/AgentConfigForm.tsx@@ -51,7 +51,6 @@ import {help,adapterLabels,} from "./agent-config-primitives";-import { ToggleSwitch } from "@/components/ui/toggle-switch";import { defaultCreateValues } from "./agent-config-defaults";import { getUIAdapter } from "../adapters";import { ClaudeLocalAdvancedFields } from "../adapters/claude-local/config-fields";@@ -153,8 +152,7 @@ function isOverlayDirty(o: AgentConfigOverlay): boolean {Object.keys(o.adapterConfig).length > 0 ||Object.keys(o.heartbeat).length > 0 ||Object.keys(o.debug).length > 0 ||- Object.keys(o.runtime).length > 0 ||- o.modelProfiles?.cheap !== undefined+ Object.keys(o.runtime).length > 0);}@@ -778,30 +776,8 @@ export function AgentConfigForm(props: AgentConfigFormProps) {const [runPolicyAdvancedOpen, setRunPolicyAdvancedOpen] = useState(false);// Popover statesconst [modelOpen, setModelOpen] = useState(false);- const [cheapModelOpen, setCheapModelOpen] = useState(false);const [thinkingEffortOpen, setThinkingEffortOpen] = useState(false);- // Cheap model profile state — only relevant when the adapter advertises- // `supportsModelProfiles`. Defaults are sourced from the adapter's- // /model-profiles endpoint so the UI does not encode adapter-specific- // cheap defaults.- const supportsModelProfiles = adapterCaps.supportsModelProfiles;- const { data: adapterCheapProfileDefinitions } = useQuery({- queryKey: selectedCompanyId- ? queryKeys.agents.adapterModelProfiles(selectedCompanyId, adapterType)- : ["agents", "none", "adapter-model-profiles", adapterType],- queryFn: () => agentsApi.adapterModelProfiles(selectedCompanyId!, adapterType),- enabled: Boolean(selectedCompanyId) && supportsModelProfiles,- });- const adapterCheapDefault = useMemo(() => {- return (adapterCheapProfileDefinitions ?? []).find((profile) => profile.key === "cheap") ?? null;- }, [adapterCheapProfileDefinitions]);- const adapterCheapDefaultModel = useMemo(() => {- const adapterConfig = adapterCheapDefault?.adapterConfig ?? {};- const value = (adapterConfig as Record<string, unknown>).model;- return typeof value === "string" ? value : "";- }, [adapterCheapDefault]);-function buildAdapterConfigForTest(adapterConfigPatch?: Record<string, unknown>): Record<string, unknown> {if (isCreate) {const next = uiAdapter.buildAdapterConfig(val!);@@ -818,86 +794,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {return omitUndefinedEntries(next);}- function buildCheapAdapterConfigForTest(adapterConfigPatch?: Record<string, unknown>): Record<string, unknown> {- const adapterDefaultConfig = asObject(adapterCheapDefault?.adapterConfig);- const createCheapModel = isCreate ? (val!.cheapModel ?? "").trim() : "";- const cheapAdapterConfig = isCreate- ? {- ...adapterDefaultConfig,- ...(createCheapModel ? { model: createCheapModel } : {}),- }- : {- ...adapterDefaultConfig,- ...cheapProfileFromAgent.adapterConfig,- ...asObject(cheapOverlay?.adapterConfig),- };- return buildAdapterConfigForTest({ ...cheapAdapterConfig, ...adapterConfigPatch });- }-- function getCheapModelTestCase(adapterConfigPatch?: Record<string, unknown>): { model: string; adapterConfig: Record<string, unknown> } | null {- if (!currentCheapEnabled) return null;- const adapterConfig = buildCheapAdapterConfigForTest(adapterConfigPatch);- const configModel = typeof adapterConfig.model === "string" ? adapterConfig.model.trim() : "";- const model = configModel || currentCheapModel.trim();- if (!model) return null;- adapterConfig.model = model;- return { model, adapterConfig };- }-- function prefixEnvironmentTestChecks(- result: AdapterEnvironmentTestResult,- label: string,- model: string | null,- ): AdapterEnvironmentTestResult {- const modelLabel = model ? ` (${model})` : "";- return {- ...result,- checks: [- {- code: `${label.toLowerCase().replace(/[^a-z0-9]+/g, "_")}_test_started`,- level: "info",- message: `${label} test${modelLabel}`,- },- ...result.checks.map((check) => ({- ...check,- message: `${label} test${modelLabel}: ${check.message}`,- })),- ],- };- }-- async function runEnvironmentTestCase(- label: string,- model: string | null,- adapterConfig: Record<string, unknown>,- environmentId: string | null,- ): Promise<AdapterEnvironmentTestResult> {- const result = await agentsApi.testEnvironment(selectedCompanyId!, adapterType, {- adapterConfig,- environmentId,- });- return prefixEnvironmentTestChecks(result, label, model);- }-- function mergeEnvironmentTestResults(- results: AdapterEnvironmentTestResult[],- ): AdapterEnvironmentTestResult {- const checks = results.flatMap((result) => result.checks);- const status = results.some((result) => result.status === "fail")- ? "fail"- : results.some((result) => result.status === "warn")- ? "warn"- : "pass";- const testedAt = results[results.length - 1]?.testedAt ?? new Date().toISOString();-- return {- adapterType,- status,- checks,- testedAt,- };- }-const testEnvironment = useMutation({mutationFn: async () => {if (!selectedCompanyId) {@@ -905,8 +801,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {}const flushedEnv = flushEnvironmentDraft();const adapterConfigPatch = flushedEnv ? { env: flushedEnv } : undefined;- const primaryModel = currentModelId.trim() || null;- const cheapTestCase = getCheapModelTestCase(adapterConfigPatch);// Probe where a real run would actually execute: the agent's own// environment, else the instance default. Testing the host for an// agent that runs in the instance-default sandbox reports failures@@ -974,35 +868,10 @@ export function AgentConfigForm(props: AgentConfigFormProps) {// managed sandbox instead of sending the hidden local id to the server.visibleEnvironmentIds: environmentList.map((environment) => environment.id),});- const testResults: Array<{ label: string; model: string | null; result: AdapterEnvironmentTestResult }> = [- {- label: "Primary model",- model: primaryModel,- result: await runEnvironmentTestCase(- "Primary model",- primaryModel,- buildAdapterConfigForTest(adapterConfigPatch),- environmentId,- ),- },- ];-- if (cheapTestCase) {- testResults.push({- label: "Cheap model",- model: cheapTestCase.model,- result: await runEnvironmentTestCase(- "Cheap model",- cheapTestCase.model,- cheapTestCase.adapterConfig,- environmentId,- ),- });- }-- return testResults.length > 1- ? mergeEnvironmentTestResults(testResults.map(({ result }) => result))- : testResults[0]!.result;+ return agentsApi.testEnvironment(selectedCompanyId, adapterType, {+ adapterConfig: buildAdapterConfigForTest(adapterConfigPatch),+ environmentId,+ });},});const [testActionPending, setTestActionPending] = useState(false);@@ -1228,70 +1097,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {const codexSearchEnabled = adapterType === "codex_local"? (isCreate ? Boolean(val!.search) : eff("adapterConfig", "search", Boolean(config.search))): false;- // Cheap profile read/write helpers. Edit-mode values come from- // runtimeConfig.modelProfiles.cheap with overlay overrides on top; create-mode- // values come straight from CreateConfigValues (cheapModel + cheapModelEnabled).- const cheapProfileFromAgent = useMemo(() => {- const profiles = (runtimeConfig.modelProfiles ?? {}) as Record<string, unknown>;- const cheap = (profiles.cheap ?? {}) as Record<string, unknown>;- const cheapAdapterConfig = asObject(cheap.adapterConfig);- return {- enabled: cheap.enabled !== false,- adapterConfig: cheapAdapterConfig,- model: typeof cheapAdapterConfig.model === "string" ? cheapAdapterConfig.model : "",- };- }, [runtimeConfig]);- const cheapOverlay = !isCreate ? overlay.modelProfiles?.cheap : undefined;- const currentCheapEnabled = isCreate- ? val!.cheapModelEnabled ?? false- : cheapOverlay?.enabled ?? cheapProfileFromAgent.enabled;- const currentCheapModel = isCreate- ? val!.cheapModel ?? ""- : (() => {- const overlayModel = (cheapOverlay?.adapterConfig as Record<string, unknown> | undefined)?.model;- if (typeof overlayModel === "string") return overlayModel;- return cheapProfileFromAgent.model;- })();-- function setCheapEnabled(next: boolean) {- if (isCreate) {- set!({ cheapModelEnabled: next });- return;- }- setOverlay((prev) => ({- ...prev,- modelProfiles: {- cheap: {- ...(prev.modelProfiles?.cheap ?? {}),- enabled: next,- },- },- }));- }-- function setCheapModel(next: string) {- if (isCreate) {- set!({ cheapModel: next });- return;- }- setOverlay((prev) => {- const existing = prev.modelProfiles?.cheap ?? {};- const nextAdapterConfig = {- ...((existing.adapterConfig ?? {}) as Record<string, unknown>),- model: next || undefined,- };- return {- ...prev,- modelProfiles: {- cheap: {- ...existing,- adapterConfig: nextAdapterConfig,- },- },- };- });- }-const effectiveRuntimeConfig = useMemo(() => {if (isCreate) {return {@@ -1579,7 +1384,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {setOverlay((prev) => ({...prev,adapterType: t,- modelProfiles: { cheap: { cleared: true } },adapterConfig: {model:t === "gemini_local"@@ -1722,9 +1526,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {</Field>)}- {supportsModelProfiles && (- <div className="text-(length:--text-micro) uppercase tracking-wide text-muted-foreground">Primary model</div>- )}<ModelDropdownmodels={models}value={currentModelId}@@ -1772,20 +1573,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {</p>)}- {supportsModelProfiles && (- <CheapModelSection- enabled={currentCheapEnabled}- model={currentCheapModel}- models={models}- adapterType={adapterType}- adapterDefaultModel={adapterCheapDefaultModel}- onEnabledChange={setCheapEnabled}- onModelChange={setCheapModel}- open={cheapModelOpen}- onOpenChange={setCheapModelOpen}- />- )}-{showThinkingEffort && (<><ThinkingEffortDropdown@@ -3360,72 +3147,6 @@ export function ModelDropdown({);}-function CheapModelSection({- enabled,- model,- models,- adapterType,- adapterDefaultModel,- onEnabledChange,- onModelChange,- open,- onOpenChange,-}: {- enabled: boolean;- model: string;- models: AdapterModel[];- adapterType: string;- adapterDefaultModel: string;- onEnabledChange: (next: boolean) => void;- onModelChange: (next: string) => void;- open: boolean;- onOpenChange: (open: boolean) => void;-}) {- const placeholderHint = adapterDefaultModel- ? `Adapter default · ${adapterDefaultModel}`- : "No adapter default — choose a cheaper model";- return (- <div className="rounded-md border border-border/70 bg-muted/20 p-3 space-y-3">- <div className="flex items-center justify-between gap-3">- <div className="min-w-0">- <div className="text-(length:--text-micro) uppercase tracking-wide text-muted-foreground">Cheap model</div>- <p className="text-xs text-muted-foreground">- Used when a run requests the cheap profile (e.g. routine summaries). The primary model stays unchanged.- </p>- </div>- <ToggleSwitch checked={enabled} onCheckedChange={onEnabledChange} />- </div>- {enabled ? (- <ModelDropdown- models={models}- value={model}- onChange={onModelChange}- open={open}- onOpenChange={onOpenChange}- allowDefault- required={false}- groupByProvider={adapterType === "opencode_local"}- creatable- detectedModel={null}- detectedModelCandidates={[]}- emptyDetectHint={placeholderHint}- defaultLabel={placeholderHint}- />- ) : null}- {enabled && !model && adapterDefaultModel ? (- <p className="text-(length:--text-micro) text-muted-foreground">- No explicit cheap model selected — runtime falls back to <code>{adapterDefaultModel}</code>.- </p>- ) : null}- {enabled && !model && !adapterDefaultModel ? (- <p className="text-(length:--text-micro) text-amber-500">- No cheap model selected and the adapter has no default. Cheap-lane runs will continue on the primary model with a fallback note.- </p>- ) : null}- </div>- );-}-function ThinkingEffortDropdown({value,options,diff --git a/ui/src/components/IssueProperties.test.tsx b/ui/src/components/IssueProperties.test.tsxindex f63581e9ff..eeda4c95c0 100644--- a/ui/src/components/IssueProperties.test.tsx+++ b/ui/src/components/IssueProperties.test.tsx@@ -20,7 +20,6 @@ import { queryKeys } from "../lib/queryKeys";const mockAgentsApi = vi.hoisted(() => ({list: vi.fn(),adapterModels: vi.fn(),- adapterModelProfiles: vi.fn(),}));const mockProjectsApi = vi.hoisted(() => ({@@ -462,7 +461,6 @@ describe("IssueProperties", () => {document.body.appendChild(container);mockAgentsApi.list.mockResolvedValue([]);mockAgentsApi.adapterModels.mockResolvedValue([]);- mockAgentsApi.adapterModelProfiles.mockResolvedValue([]);mockProjectsApi.list.mockResolvedValue([]);mockExecutionWorkspacesApi.controlRuntimeCommands.mockReset();mockIssuesApi.list.mockResolvedValue([]);diff --git a/ui/src/components/IssueRunLedger.test.tsx b/ui/src/components/IssueRunLedger.test.tsxindex 574e380778..117f27ff3b 100644--- a/ui/src/components/IssueRunLedger.test.tsx+++ b/ui/src/components/IssueRunLedger.test.tsx@@ -530,41 +530,6 @@ describe("IssueRunLedger", () => {});});- it("renders requested/applied model profile and surfaces fallback reasons", () => {- renderLedger({- runs: [- createRun({- runId: "run-cheap-applied",- resultJson: {- modelProfile: {- requested: "cheap",- applied: "cheap",- configSource: "agent_runtime",- fallbackReason: null,- },- },- }),- createRun({- runId: "run-cheap-fallback",- createdAt: "2026-04-18T19:50:00.000Z",- resultJson: {- modelProfile: {- requested: "cheap",- applied: null,- configSource: null,- fallbackReason: "agent_runtime_profile_disabled",- },- },- }),- ],- });-- expect(container.textContent).toContain("Profile: cheap");- expect(container.textContent).toContain("Profile: cheap (unavailable)");- expect(container.textContent).toContain("Cheap profile fell back to primary");- expect(container.textContent).toContain("agent_runtime_profile_disabled");- });-it("hides watchdog decision actions for known non-owner viewers", () => {const onWatchdogDecision = vi.fn();renderLedger({diff --git a/ui/src/components/IssueRunLedger.tsx b/ui/src/components/IssueRunLedger.tsxindex 45de011e42..6cd7cdee99 100644--- a/ui/src/components/IssueRunLedger.tsx+++ b/ui/src/components/IssueRunLedger.tsx@@ -188,45 +188,6 @@ function readString(value: unknown) {: null;}-interface ModelProfileSummary {- requested: string;- applied: string | null;- configSource: string | null;- fallbackReason: string | null;-}--function modelProfileForRun(run: RunForIssue): ModelProfileSummary | null {- const result = asRecord(run.resultJson);- const profile = asRecord(result?.modelProfile);- if (!profile) return null;- const requested = readString(profile.requested);- if (!requested) return null;- return {- requested,- applied: readString(profile.applied),- configSource: readString(profile.configSource),- fallbackReason: readString(profile.fallbackReason),- };-}--function modelProfileBadgeTone(summary: ModelProfileSummary) {- if (summary.applied === summary.requested) {- return "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300";- }- if (summary.fallbackReason) {- return "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300";- }- return "border-border bg-background text-muted-foreground";-}--function modelProfileTitle(summary: ModelProfileSummary) {- const lines = [`Requested: ${summary.requested}`];- if (summary.applied) lines.push(`Applied: ${summary.applied}`);- if (summary.configSource) lines.push(`Source: ${summary.configSource}`);- if (summary.fallbackReason) lines.push(`Fallback: ${summary.fallbackReason}`);- return lines.join("\n");-}-function readNumber(value: unknown) {return typeof value === "number" && Number.isFinite(value) ? value : null;}@@ -975,27 +936,6 @@ export function IssueRunLedgerContent({{RUN_OUTPUT_SILENCE_COPY[run.outputSilence.level]?.label}</span>) : null}- {(() => {- const profile = modelProfileForRun(run);- if (!profile) return null;- const label =- profile.applied === profile.requested- ? `Profile: ${profile.requested}`- : profile.applied- ? `Profile: ${profile.requested} → ${profile.applied}`- : `Profile: ${profile.requested} (unavailable)`;- return (- <span- className={cn(- "rounded-md border px-1.5 py-0.5 text-(length:--text-micro) font-medium",- modelProfileBadgeTone(profile),- )}- title={modelProfileTitle(profile)}- >- {label}- </span>- );- })()}{sourceResolvedFold ? <SourceResolvedFoldBadge /> : null}<span className="ml-auto shrink-0">{relativeTime(item.timestamp)}@@ -1044,26 +984,6 @@ export function IssueRunLedgerContent({</div>) : null}- {(() => {- const profile = modelProfileForRun(run);- if (- !profile?.fallbackReason ||- profile.applied === profile.requested- )- return null;- return (- <p className="min-w-0 break-words text-(length:--text-micro) leading-5 text-amber-700 dark:text-amber-300">- {profile.requested === "cheap"- ? "Cheap profile fell back to primary"- : `${profile.requested} profile unavailable`}- {": "}- <span className="font-mono">- {profile.fallbackReason}- </span>- </p>- );- })()}-{run.livenessReason ? (<p className="min-w-0 break-words text-xs leading-5 text-muted-foreground">{run.livenessReason}diff --git a/ui/src/components/NewIssueDialog.tsx b/ui/src/components/NewIssueDialog.tsxindex 21f23d5193..913b52aaf2 100644--- a/ui/src/components/NewIssueDialog.tsx+++ b/ui/src/components/NewIssueDialog.tsx@@ -3,7 +3,6 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";import type { AgentEnvConfig, EnvBinding, IssueWorkMode } from "@paperclipai/shared";import { useDialog } from "../context/DialogContext";import { useCompany } from "../context/CompanyContext";-import { useAdapterCapabilities } from "../adapters/use-adapter-capabilities";import { executionWorkspacesApi } from "../api/execution-workspaces";import { issuesApi } from "../api/issues";import { MissingUserSecretsBanner } from "../pages/secrets/MissingUserSecretsBanner";@@ -595,25 +594,6 @@ export function NewIssueDialog() {const supportsAssigneeOverrides = Boolean(assigneeAdapterType && ISSUE_OVERRIDE_ADAPTER_TYPES.has(assigneeAdapterType),);- const getAdapterCapabilities = useAdapterCapabilities();- const assigneeAdapterCapabilities = assigneeAdapterType- ? getAdapterCapabilities(assigneeAdapterType)- : null;- const assigneeSupportsCheapLane = Boolean(- supportsAssigneeOverrides && assigneeAdapterCapabilities?.supportsModelProfiles,- );-- const { data: assigneeCheapProfiles } = useQuery({- queryKey: effectiveCompanyId && assigneeAdapterType- ? queryKeys.agents.adapterModelProfiles(effectiveCompanyId, assigneeAdapterType)- : ["agents", "none", "adapter-model-profiles", assigneeAdapterType ?? "none"],- queryFn: () => agentsApi.adapterModelProfiles(effectiveCompanyId!, assigneeAdapterType!),- enabled: Boolean(effectiveCompanyId) && newIssueOpen && assigneeSupportsCheapLane,- });- const assigneeCheapProfile = useMemo(- () => (assigneeCheapProfiles ?? []).find((profile) => profile.key === "cheap") ?? null,- [assigneeCheapProfiles],- );const mentionOptions = useMemo<MentionOption[]>(() => {return buildMarkdownMentionOptions({agents,@@ -952,10 +932,6 @@ export function NewIssueDialog() {setAssigneeChrome(false);return;}- if (!assigneeSupportsCheapLane && assigneeModelLane === "cheap") {- setAssigneeModelLane("primary");- }-const validThinkingValues =assigneeAdapterType === "codex_local"? ISSUE_THINKING_EFFORT_OPTIONS.codex_local@@ -969,8 +945,6 @@ export function NewIssueDialog() {supportsAssigneeOverrides,assigneeAdapterType,assigneeThinkingEffort,- assigneeSupportsCheapLane,- assigneeModelLane,]);// Cleanup timer on unmount@@ -1044,14 +1018,9 @@ export function NewIssueDialog() {const currentTitle = titleRef.current.trim();const currentDescription = descriptionRef.current.trim();if (!effectiveCompanyId || !currentTitle || createIssue.isPending) return;- const effectiveLane = assigneeSupportsCheapLane- ? assigneeModelLane- : assigneeModelLane === "cheap"- ? "primary"- : assigneeModelLane;const assigneeAdapterOverrides = buildAssigneeAdapterOverrides({adapterType: assigneeAdapterType,- lane: effectiveLane,+ lane: assigneeModelLane,modelOverride: assigneeModelOverride,thinkingEffortOverride: assigneeThinkingEffort,chrome: assigneeChrome,@@ -1933,7 +1902,7 @@ export function NewIssueDialog() {role="radiogroup"aria-label="Model lane">- {(["primary", ...(assigneeSupportsCheapLane ? (["cheap"] as const) : ([] as const)), "custom"] as const).map((lane) => (+ {(["primary", "custom"] as const).map((lane) => (<buttonkey={lane}type="button"@@ -1945,24 +1914,10 @@ export function NewIssueDialog() {)}onClick={() => setAssigneeModelLane(lane)}>- {lane === "primary"- ? "Primary"- : lane === "cheap"- ? "Cheap"- : "Custom"}+ {lane === "primary" ? "Primary" : "Custom"}</button>))}</div>- {assigneeModelLane === "cheap" && (- <p className="text-(length:--text-micro) text-muted-foreground">- Sends <code>modelProfile: "cheap"</code>{" "}- {assigneeCheapProfile?.adapterConfig && typeof (assigneeCheapProfile.adapterConfig as Record<string, unknown>).model === "string"- ? <>· adapter default <code>{String((assigneeCheapProfile.adapterConfig as Record<string, unknown>).model)}</code></>- : assigneeCheapProfile- ? <>· uses the agent's configured cheap profile</>- : <>· falls back to the primary model if no cheap profile is configured</>}- </p>- )}{assigneeModelLane === "primary" && (<p className="text-(length:--text-micro) text-muted-foreground">Runs on the agent's primary model.</p>)}diff --git a/ui/src/components/OnboardingWizard.adapters.test.tsx b/ui/src/components/OnboardingWizard.adapters.test.tsxindex 8adee65844..3d60d1ffff 100644--- a/ui/src/components/OnboardingWizard.adapters.test.tsx+++ b/ui/src/components/OnboardingWizard.adapters.test.tsx@@ -92,7 +92,6 @@ vi.mock("../adapters/use-adapter-capabilities", () => ({supportsSkills: false,supportsLocalAgentJwt: false,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,}),}));// Animation / canvas-ish children that add nothing to the logic under test.diff --git a/ui/src/components/OnboardingWizard.test.tsx b/ui/src/components/OnboardingWizard.test.tsxindex f6067ac83a..b7d225be5a 100644--- a/ui/src/components/OnboardingWizard.test.tsx+++ b/ui/src/components/OnboardingWizard.test.tsx@@ -173,7 +173,6 @@ vi.mock("../adapters/use-adapter-capabilities", () => ({supportsSkills: false,supportsLocalAgentJwt: false,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,login: ADAPTERS_WITH_LOGIN.has(type)? { panelMode: "displayed_code" as const, timeoutPolicy: "fixed" as const }: undefined,diff --git a/ui/src/components/issue-properties/IssueProperties.tsx b/ui/src/components/issue-properties/IssueProperties.tsxindex 1e34756d09..050e611269 100644--- a/ui/src/components/issue-properties/IssueProperties.tsx+++ b/ui/src/components/issue-properties/IssueProperties.tsx@@ -564,12 +564,6 @@ export function IssueProperties({const supportsAssigneeOverrides = Boolean(assigneeAdapterType && ISSUE_OVERRIDE_ADAPTER_TYPES.has(assigneeAdapterType),);- const assigneeSupportsCheapLane = Boolean(- supportsAssigneeOverrides- && (assigneeAdapterType === "claude_local"- || assigneeAdapterType === "codex_local"- || assigneeAdapterType === "opencode_local"),- );const assigneeOverrideLane = overrideLane(assigneeAdapterOverrides);const assigneeOverrideAdapterConfig = asRecord(assigneeAdapterOverrides?.adapterConfig);const assigneeOverrideModel =@@ -588,17 +582,6 @@ export function IssueProperties({queryFn: () => agentsApi.adapterModels(companyId!, assigneeAdapterType!),enabled: Boolean(companyId) && showAssigneeAdapterOptions && supportsAssigneeOverrides,});- const { data: assigneeCheapProfiles } = useQuery({- queryKey: companyId && assigneeAdapterType- ? queryKeys.agents.adapterModelProfiles(companyId, assigneeAdapterType)- : ["agents", "none", "adapter-model-profiles", assigneeAdapterType ?? "none"],- queryFn: () => agentsApi.adapterModelProfiles(companyId!, assigneeAdapterType!),- enabled: Boolean(companyId) && showAssigneeAdapterOptions && assigneeSupportsCheapLane,- });- const assigneeCheapProfile = useMemo(- () => (assigneeCheapProfiles ?? []).find((profile) => profile.key === "cheap") ?? null,- [assigneeCheapProfiles],- );const modelOverrideOptions = useMemo<InlineEntityOption[]>(() => {const models = sortAdapterModels(assigneeAdapterModels ?? []);const options = models.map((model) => ({@@ -650,21 +633,9 @@ export function IssueProperties({updateAssigneeAdapterOverrides(null);return;}- if (lane === "cheap") {- updateAssigneeAdapterOverrides(- compactRecord({- useProjectWorkspace: assigneeAdapterOverrides?.useProjectWorkspace,- modelProfile: "cheap",- }),- );- return;- }updateAssigneeAdapterOverrides(buildAssigneeOverrideWithConfig(assigneeOverrideAdapterConfig) ?? { adapterConfig: {} });};const assigneeOptionsTrigger = (() => {- if (assigneeOverrideLane === "cheap") {- return <span className="text-sm">Cheap model</span>;- }if (assigneeOverrideLane === "custom") {const details = [assigneeOverrideModel,@@ -688,7 +659,7 @@ export function IssueProperties({<div className="space-y-1.5"><div className="text-xs text-muted-foreground">Model lane</div><div className="flex w-full overflow-hidden rounded-md border border-border" role="radiogroup" aria-label="Model lane">- {(["primary", ...(assigneeSupportsCheapLane ? (["cheap"] as const) : ([] as const)), "custom"] as const).map((lane) => (+ {(["primary", "custom"] as const).map((lane) => (<buttonkey={lane}type="button"@@ -700,20 +671,10 @@ export function IssueProperties({)}onClick={() => setAssigneeOverrideLane(lane)}>- {lane === "primary" ? "Primary" : lane === "cheap" ? "Cheap" : "Override"}+ {lane === "primary" ? "Primary" : "Override"}</button>))}</div>- {assigneeOverrideLane === "cheap" ? (- <p className="text-xs text-muted-foreground">- Sends <code>modelProfile: "cheap"</code>{" "}- {assigneeCheapProfile?.adapterConfig && typeof (assigneeCheapProfile.adapterConfig as Record<string, unknown>).model === "string"- ? <>· adapter default <code>{String((assigneeCheapProfile.adapterConfig as Record<string, unknown>).model)}</code></>- : assigneeCheapProfile- ? <>· uses the agent's configured cheap profile</>- : <>· falls back to the primary model if no cheap profile is configured</>}- </p>- ) : null}{assigneeOverrideLane === "custom" ? (<p className="text-xs text-muted-foreground">Task-level model override — replaces the agent's primary model for this issue.diff --git a/ui/src/components/issue-properties/helpers.ts b/ui/src/components/issue-properties/helpers.tsindex d39cce23de..24788453ef 100644--- a/ui/src/components/issue-properties/helpers.ts+++ b/ui/src/components/issue-properties/helpers.ts@@ -113,7 +113,6 @@ export function thinkingEffortValueFor(adapterType: string | null | undefined, a}export function overrideLane(overrides: Issue["assigneeAdapterOverrides"]): IssueModelLane {- if (overrides?.modelProfile === "cheap") return "cheap";if (overrides?.adapterConfig) return "custom";return "primary";}diff --git a/ui/src/components/skill-studio/AgentsUsingSkillDialog.test.tsx b/ui/src/components/skill-studio/AgentsUsingSkillDialog.test.tsxindex 061f8370a9..84529ad32d 100644--- a/ui/src/components/skill-studio/AgentsUsingSkillDialog.test.tsx+++ b/ui/src/components/skill-studio/AgentsUsingSkillDialog.test.tsx@@ -37,7 +37,6 @@ vi.mock("@/adapters/use-adapter-capabilities", () => ({supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,}),}));vi.mock("@/context/ToastContext", () => ({diff --git a/ui/src/lib/agent-config-patch.test.ts b/ui/src/lib/agent-config-patch.test.tsindex 9fac4e16d5..2ead6cdb96 100644--- a/ui/src/lib/agent-config-patch.test.ts+++ b/ui/src/lib/agent-config-patch.test.ts@@ -92,37 +92,6 @@ describe("buildAgentUpdatePatch", () => {});});- it("writes the cheap profile under runtimeConfig.modelProfiles, never on primary adapterConfig", () => {- const patch = buildAgentUpdatePatch(- makeAgent(),- makeOverlay({- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: { model: "claude-haiku-4-5" },- },- },- }),- );-- expect(patch).toEqual({- runtimeConfig: {- heartbeat: {- enabled: true,- intervalSec: 300,- },- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: { model: "claude-haiku-4-5" },- },- },- },- });- // The primary adapterConfig is untouched.- expect(patch.adapterConfig).toBeUndefined();- });-it("writes max-turn continuation policy under runtimeConfig.heartbeat", () => {const patch = buildAgentUpdatePatch(makeAgent(),@@ -152,61 +121,6 @@ describe("buildAgentUpdatePatch", () => {});});- it("merges cheap profile changes onto existing runtimeConfig.modelProfiles state", () => {- const agent = makeAgent();- agent.runtimeConfig = {- heartbeat: { enabled: true, intervalSec: 300 },- modelProfiles: {- cheap: {- enabled: false,- adapterConfig: { model: "old-cheap" },- },- },- };-- const patch = buildAgentUpdatePatch(- agent,- makeOverlay({- modelProfiles: {- cheap: {- enabled: true,- },- },- }),- );-- expect((patch.runtimeConfig as Record<string, unknown>).modelProfiles).toEqual({- cheap: {- enabled: true,- adapterConfig: { model: "old-cheap" },- },- });- });-- it("clears the cheap profile when the overlay marks it cleared", () => {- const agent = makeAgent();- agent.runtimeConfig = {- heartbeat: { enabled: true, intervalSec: 300 },- modelProfiles: {- cheap: {- enabled: true,- adapterConfig: { model: "claude-haiku-4-5" },- },- },- };-- const patch = buildAgentUpdatePatch(- agent,- makeOverlay({- modelProfiles: { cheap: { cleared: true } },- }),- );-- expect(patch.runtimeConfig).toEqual({- heartbeat: { enabled: true, intervalSec: 300 },- });- });-it("preserves adapter-agnostic keys when changing adapter types", () => {const patch = buildAgentUpdatePatch(makeAgent(),diff --git a/ui/src/lib/agent-config-patch.ts b/ui/src/lib/agent-config-patch.tsindex f5f90de8d9..f95d4008ba 100644--- a/ui/src/lib/agent-config-patch.ts+++ b/ui/src/lib/agent-config-patch.ts@@ -1,15 +1,5 @@import { ADAPTER_AGNOSTIC_KEYS, type Agent } from "@paperclipai/shared";-export interface AgentModelProfileOverlay {- enabled?: boolean;- adapterConfig?: Record<string, unknown>;- /**- * Mark the cheap profile for clearing. When true, the patch removes- * `runtimeConfig.modelProfiles.cheap` instead of merging into it.- */- cleared?: boolean;-}-export interface AgentConfigOverlay {identity: Record<string, unknown>;adapterType?: string;@@ -17,7 +7,6 @@ export interface AgentConfigOverlay {heartbeat: Record<string, unknown>;debug: Record<string, unknown>;runtime: Record<string, unknown>;- modelProfiles?: { cheap?: AgentModelProfileOverlay };}export function omitUndefinedEntries(value: Record<string, unknown>) {@@ -58,13 +47,9 @@ export function buildAgentUpdatePatch(agent: Agent, overlay: AgentConfigOverlay)patch.replaceAdapterConfig = true;}- const cheapOverlay = overlay.modelProfiles?.cheap;- const hasModelProfileChange = cheapOverlay !== undefined;-if (Object.keys(overlay.heartbeat).length > 0|| Object.keys(overlay.debug).length > 0- || hasModelProfileChange) {const existingRc = (agent.runtimeConfig ?? {}) as Record<string, unknown>;const nextRuntimeConfig: Record<string, unknown> = (patch.runtimeConfig as Record<string, unknown> | undefined)@@ -85,33 +70,6 @@ export function buildAgentUpdatePatch(agent: Agent, overlay: AgentConfigOverlay)}}- if (hasModelProfileChange) {- const existingProfiles = ((existingRc.modelProfiles ?? {}) as Record<string, unknown>);- const existingCheap = ((existingProfiles.cheap ?? {}) as Record<string, unknown>);- const nextProfiles = { ...existingProfiles };-- if (cheapOverlay?.cleared) {- delete nextProfiles.cheap;- } else if (cheapOverlay) {- const mergedAdapterConfig = {- ...((existingCheap.adapterConfig ?? {}) as Record<string, unknown>),- ...(cheapOverlay.adapterConfig ?? {}),- };- const enabled = cheapOverlay.enabled ?? (existingCheap.enabled !== false);- nextProfiles.cheap = {- ...existingCheap,- enabled,- adapterConfig: mergedAdapterConfig,- };- }-- if (Object.keys(nextProfiles).length === 0) {- delete nextRuntimeConfig.modelProfiles;- } else {- nextRuntimeConfig.modelProfiles = nextProfiles;- }- }-patch.runtimeConfig = nextRuntimeConfig;}diff --git a/ui/src/lib/issue-assignee-overrides.test.ts b/ui/src/lib/issue-assignee-overrides.test.tsindex bcc3f0baa0..f3aa73f5f7 100644--- a/ui/src/lib/issue-assignee-overrides.test.ts+++ b/ui/src/lib/issue-assignee-overrides.test.ts@@ -28,18 +28,6 @@ describe("buildAssigneeAdapterOverrides", () => {).toBeNull();});- it("cheap lane sends modelProfile=cheap and no adapterConfig", () => {- expect(- buildAssigneeAdapterOverrides({- adapterType: "codex_local",- lane: "cheap",- modelOverride: "ignored",- thinkingEffortOverride: "high",- chrome: false,- }),- ).toEqual({ modelProfile: "cheap" });- });-it("custom lane preserves explicit model + thinking effort + chrome overrides", () => {expect(buildAssigneeAdapterOverrides({diff --git a/ui/src/lib/issue-assignee-overrides.ts b/ui/src/lib/issue-assignee-overrides.tsindex bdbcfc0377..02d517de1a 100644--- a/ui/src/lib/issue-assignee-overrides.ts+++ b/ui/src/lib/issue-assignee-overrides.ts@@ -4,7 +4,7 @@ export const ISSUE_OVERRIDE_ADAPTER_TYPES = new Set(["opencode_local",]);-export type IssueModelLane = "primary" | "cheap" | "custom";+export type IssueModelLane = "primary" | "custom";export interface BuildAssigneeAdapterOverridesInput {adapterType: string | null | undefined;@@ -19,8 +19,6 @@ export interface BuildAssigneeAdapterOverridesInput {** Lane semantics:* - "primary" → no overrides, runs on the agent's primary model.- * - "cheap" → `modelProfile: "cheap"` only; the runtime resolves the actual- * adapter config from the agent's runtimeConfig + adapter default.* - "custom" → preserves the legacy explicit override path* (`adapterConfig.model`, thinking effort, chrome).*/@@ -36,10 +34,6 @@ export function buildAssigneeAdapterOverrides(return null;}- if (input.lane === "cheap") {- return { modelProfile: "cheap" };- }-const adapterConfig: Record<string, unknown> = {};if (input.modelOverride) adapterConfig.model = input.modelOverride;if (input.thinkingEffortOverride) {diff --git a/ui/src/lib/new-agent-hire-payload.ts b/ui/src/lib/new-agent-hire-payload.tsindex e89e4d070e..c2fb251f4d 100644--- a/ui/src/lib/new-agent-hire-payload.ts+++ b/ui/src/lib/new-agent-hire-payload.ts@@ -35,8 +35,6 @@ export function buildNewAgentHirePayload(input: {runtimeConfig: buildNewAgentRuntimeConfig({heartbeatEnabled: configValues.heartbeatEnabled,intervalSec: configValues.intervalSec,- cheapModel: configValues.cheapModel,- cheapModelEnabled: configValues.cheapModelEnabled,}),budgetMonthlyCents: 0,...(permissions ? { permissions } : {}),diff --git a/ui/src/lib/new-agent-runtime-config.test.ts b/ui/src/lib/new-agent-runtime-config.test.tsindex af33566268..5d60a4ca7d 100644--- a/ui/src/lib/new-agent-runtime-config.test.ts+++ b/ui/src/lib/new-agent-runtime-config.test.ts@@ -34,47 +34,4 @@ describe("buildNewAgentRuntimeConfig", () => {},});});-- it("stores cheap model under modelProfiles.cheap, not primary adapterConfig", () => {- const config = buildNewAgentRuntimeConfig({- heartbeatEnabled: true,- intervalSec: 600,- cheapModel: "claude-sonnet-4-6",- cheapModelEnabled: true,- });-- expect(config.modelProfiles).toEqual({- cheap: {- enabled: true,- adapterConfig: { model: "claude-sonnet-4-6" },- },- });- // primary heartbeat config still present- expect(config.heartbeat).toMatchObject({ enabled: true, intervalSec: 600 });- });-- it("omits modelProfiles when no cheap model is configured", () => {- const config = buildNewAgentRuntimeConfig({ heartbeatEnabled: false });- expect(config.modelProfiles).toBeUndefined();- });-- it("persists explicit cheap-profile opt-in when using the adapter default", () => {- const config = buildNewAgentRuntimeConfig({- cheapModelEnabled: true,- });- expect(config.modelProfiles).toEqual({- cheap: {- enabled: true,- adapterConfig: {},- },- });- });-- it("omits modelProfiles when cheap model is set but explicitly disabled", () => {- const config = buildNewAgentRuntimeConfig({- cheapModel: "claude-sonnet-4-6",- cheapModelEnabled: false,- });- expect(config.modelProfiles).toBeUndefined();- });});diff --git a/ui/src/lib/new-agent-runtime-config.ts b/ui/src/lib/new-agent-runtime-config.tsindex c1376d81ad..478321ce9e 100644--- a/ui/src/lib/new-agent-runtime-config.ts+++ b/ui/src/lib/new-agent-runtime-config.ts@@ -4,8 +4,6 @@ import { defaultCreateValues } from "../components/agent-config-defaults";export function buildNewAgentRuntimeConfig(input?: {heartbeatEnabled?: boolean;intervalSec?: number;- cheapModel?: string;- cheapModelEnabled?: boolean;}): Record<string, unknown> {const config: Record<string, unknown> = {heartbeat: {@@ -18,16 +16,5 @@ export function buildNewAgentRuntimeConfig(input?: {},};- const cheapModel = input?.cheapModel?.trim() ?? "";- const cheapEnabled = input?.cheapModelEnabled ?? false;- if (cheapEnabled) {- config.modelProfiles = {- cheap: {- enabled: true,- adapterConfig: cheapModel ? { model: cheapModel } : {},- },- };- }-return config;}diff --git a/ui/src/lib/queryKeys.ts b/ui/src/lib/queryKeys.tsindex b47d23c22e..00d3db2be6 100644--- a/ui/src/lib/queryKeys.ts+++ b/ui/src/lib/queryKeys.ts@@ -216,8 +216,6 @@ export const queryKeys = {adapterType,environmentId ?? null,] as const,- adapterModelProfiles: (companyId: string, adapterType: string) =>- ["agents", companyId, "adapter-model-profiles", adapterType] as const,detectModel: (companyId: string, adapterType: string) =>["agents", companyId, "detect-model", adapterType] as const,authSignal: (companyId: string, adapterType: string, environmentId?: string | null) =>diff --git a/ui/src/pages/AdapterManager.tsx b/ui/src/pages/AdapterManager.tsxindex d9f643ef80..dd4fb67544 100644--- a/ui/src/pages/AdapterManager.tsx+++ b/ui/src/pages/AdapterManager.tsx@@ -621,7 +621,6 @@ export function AdapterManager() {supportsSkills: false,supportsLocalAgentJwt: false,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,supportsAcp: false,},}}diff --git a/ui/src/pages/AgentDetail.instructions.test.tsx b/ui/src/pages/AgentDetail.instructions.test.tsxindex 3f0dbfbf13..1d3ab7b8ee 100644--- a/ui/src/pages/AgentDetail.instructions.test.tsx+++ b/ui/src/pages/AgentDetail.instructions.test.tsx@@ -42,7 +42,6 @@ vi.mock("@/adapters/use-adapter-capabilities", () => ({supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: true,}),}));diff --git a/ui/src/pages/NewAgent.test.tsx b/ui/src/pages/NewAgent.test.tsxindex 42e500f38c..3fce160619 100644--- a/ui/src/pages/NewAgent.test.tsx+++ b/ui/src/pages/NewAgent.test.tsx@@ -14,7 +14,6 @@ import { NewAgent } from "./NewAgent";// `env` map, which is the contract this page test verifies.const mockAgentsApi = vi.hoisted(() => ({- adapterModelProfiles: vi.fn(),adapterModels: vi.fn(),detectModel: vi.fn(),list: vi.fn(),@@ -102,7 +101,6 @@ vi.mock("../adapters/use-adapter-capabilities", () => ({supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: true,supportsAcp: true,...(login ? { login } : {}),};@@ -244,7 +242,6 @@ describe("NewAgent Claude subscription login", () => {mockAdapterAvailability.disabled = new Set<string>();mockAdapterAvailability.loaded = true;mockSearchParams.value = new URLSearchParams();- mockAgentsApi.adapterModelProfiles.mockResolvedValue([]);mockAgentsApi.adapterModels.mockResolvedValue([]);mockAgentsApi.detectModel.mockResolvedValue(null);// No existing agents: the page treats the new agent as the first (CEO) anddiff --git a/ui/storybook/stories/agent-management.stories.tsx b/ui/storybook/stories/agent-management.stories.tsxindex c32646d94e..d40382e9cb 100644--- a/ui/storybook/stories/agent-management.stories.tsx+++ b/ui/storybook/stories/agent-management.stories.tsx@@ -338,7 +338,6 @@ const adapterFixtures: AdapterInfo[] = [supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: true,- supportsModelProfiles: true,supportsAcp: true,},},@@ -354,7 +353,6 @@ const adapterFixtures: AdapterInfo[] = [supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: true,- supportsModelProfiles: true,supportsAcp: true,},},@@ -370,7 +368,6 @@ const adapterFixtures: AdapterInfo[] = [supportsSkills: false,supportsLocalAgentJwt: false,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: false,supportsAcp: false,},},diff --git a/ui/storybook/stories/dialogs-modals.stories.tsx b/ui/storybook/stories/dialogs-modals.stories.tsxindex e5757c83d4..ba3e5bb040 100644--- a/ui/storybook/stories/dialogs-modals.stories.tsx+++ b/ui/storybook/stories/dialogs-modals.stories.tsx@@ -384,7 +384,6 @@ function hydrateDialogQueries(queryClient: ReturnType<typeof useQueryClient>) {supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: true,supportsAcp: true,},},@@ -400,7 +399,6 @@ function hydrateDialogQueries(queryClient: ReturnType<typeof useQueryClient>) {supportsSkills: true,supportsLocalAgentJwt: true,requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: true,supportsAcp: true,},},@@ -409,41 +407,8 @@ function hydrateDialogQueries(queryClient: ReturnType<typeof useQueryClient>) {{ id: "gpt-5.4", label: "GPT-5.4" },{ id: "gpt-5.4-mini", label: "GPT-5.4 Mini" },]);- queryClient.setQueryData(queryKeys.agents.adapterModelProfiles(COMPANY_ID, "codex_local"), [- {- key: "cheap",- label: "Cheap",- adapterConfig: { model: "gpt-5.4-mini" },- source: "adapter_default",- },- ]);}-const HERMES_AGENT: Agent = {- id: "agent-hermes",- companyId: COMPANY_ID,- name: "HermesRouter",- urlKey: "hermesrouter",- role: "engineer",- title: "Lightweight Routing",- icon: "code",- status: "idle",- reportsTo: "agent-cto",- capabilities: "Hermes-backed assistant on an adapter without the cheap-profile contract.",- adapterType: "opencode_local",- adapterConfig: {},- runtimeConfig: {},- budgetMonthlyCents: 60_000,- spentMonthlyCents: 9_000,- pauseReason: null,- pausedAt: null,- permissions: { canCreateAgents: false },- lastHeartbeatAt: new Date("2026-04-29T08:30:00.000Z"),- metadata: null,- createdAt: new Date("2026-04-12T08:00:00.000Z"),- updatedAt: new Date("2026-04-29T08:30:00.000Z"),-};-function StorybookDialogFixtures({ children }: { children: ReactNode }) {const queryClient = useQueryClient();const [ready] = useState(() => {@@ -694,130 +659,6 @@ function ImageGalleryModalStory() {);}-type CheapLaneVariant = "primary" | "cheap" | "custom" | "unsupported";--function clickModelLaneButton(label: "Primary" | "Cheap" | "Custom") {- const radiogroup = document.querySelector<HTMLElement>("[aria-label='Model lane']");- if (!radiogroup) return false;- const buttons = Array.from(radiogroup.querySelectorAll<HTMLButtonElement>("button[role='radio']"));- const button = buttons.find((candidate) => candidate.textContent?.trim() === label);- if (!button) return false;- button.click();- return true;-}--function findAssigneeOptionsButton() {- const buttons = Array.from(document.querySelectorAll<HTMLButtonElement>("button"));- return (- buttons.find((candidate) => /(Codex|Claude|OpenCode|Agent) options$/.test(candidate.textContent?.trim() ?? "")) ?? null- );-}--function useCheapLaneAdapterOverrides(variant: CheapLaneVariant) {- const queryClient = useQueryClient();- useLayoutEffect(() => {- if (variant !== "unsupported") return;- queryClient.setQueryData(- queryKeys.agents.list(COMPANY_ID),- [...storybookAgents, HERMES_AGENT],- );- queryClient.setQueryData(queryKeys.adapters.all, [- {- type: "codex_local",- label: "Codex",- source: "builtin",- modelsCount: 5,- loaded: true,- disabled: false,- capabilities: {- supportsInstructionsBundle: true,- supportsSkills: true,- supportsLocalAgentJwt: true,- requiresMaterializedRuntimeSkills: false,- supportsModelProfiles: true,- supportsAcp: true,- },- },- {- type: "opencode_local",- label: "OpenCode",- source: "builtin",- modelsCount: 2,- loaded: true,- disabled: false,- capabilities: {- supportsInstructionsBundle: true,- supportsSkills: true,- supportsLocalAgentJwt: true,- requiresMaterializedRuntimeSkills: true,- supportsModelProfiles: false,- supportsAcp: false,- },- },- ]);- queryClient.setQueryData(queryKeys.agents.adapterModels(COMPANY_ID, "opencode_local"), [- { id: "anthropic/claude-haiku-4-5", label: "Claude Haiku 4.5" },- { id: "openai/gpt-5.4-mini", label: "GPT-5.4 Mini" },- ]);- }, [queryClient, variant]);-}--function CheapLaneIssueDialogOpener({ variant }: { variant: CheapLaneVariant }) {- const { openNewIssue } = useDialog();- useCheapLaneAdapterOverrides(variant);-- const assigneeAgentId = variant === "unsupported" ? "agent-hermes" : "agent-codex";- const title =- variant === "unsupported"- ? "Route research summary to HermesRouter"- : "Generate weekly Storybook coverage report";- const description =- variant === "unsupported"- ? "HermesRouter runs on an adapter that does not advertise a cheap profile, so the Cheap lane should disappear instead of being greyed."- : "Lower-cost runs should still pick up the agent's cheap profile so the model badge can show the requested lane.";-- useOpenWhenCompanyReady(() => {- openNewIssue({- title,- description,- status: "todo",- priority: "medium",- projectId: "project-board-ui",- projectWorkspaceId: "workspace-board-ui",- assigneeAgentId,- });- });-- useEffect(() => {- let cancelled = false;- const timers: number[] = [];-- timers.push(- window.setTimeout(() => {- if (cancelled) return;- const optionsButton = findAssigneeOptionsButton();- optionsButton?.click();- }, 300),- );-- if (variant === "cheap" || variant === "custom") {- timers.push(- window.setTimeout(() => {- if (cancelled) return;- clickModelLaneButton(variant === "cheap" ? "Cheap" : "Custom");- }, 600),- );- }-- return () => {- cancelled = true;- for (const timer of timers) window.clearTimeout(timer);- };- }, [variant]);-- return <NewIssueDialog />;-}-function PathInstructionsModalStory() {return (<DialogStory@@ -889,62 +730,6 @@ export const NewIssueValidationError: Story = {),};-export const NewIssueCheapLanePrimary: Story = {- name: "New Issue - Cheap lane (Primary)",- render: () => (- <DialogStory- eyebrow="NewIssueDialog"- title="Model lane segmented control - Primary selected"- description="Codex assignee with the assignee-options drawer expanded so the Primary | Cheap | Custom segmented control is visible. Default helper copy is shown."- badges={["model lane", "primary", "default"]}- >- <CheapLaneIssueDialogOpener variant="primary" />- </DialogStory>- ),-};--export const NewIssueCheapLaneCheap: Story = {- name: "New Issue - Cheap lane (Cheap)",- render: () => (- <DialogStory- eyebrow="NewIssueDialog"- title="Model lane segmented control - Cheap selected"- description='Codex assignee with the Cheap lane selected so the helper line "Sends modelProfile: \"cheap\" · adapter default …" is visible.'- badges={["model lane", "cheap", "modelProfile"]}- >- <CheapLaneIssueDialogOpener variant="cheap" />- </DialogStory>- ),-};--export const NewIssueCheapLaneCustom: Story = {- name: "New Issue - Cheap lane (Custom)",- render: () => (- <DialogStory- eyebrow="NewIssueDialog"- title="Model lane segmented control - Custom selected"- description="Custom selected so the explicit model picker and thinking-effort sub-fields render the way they did before the cheap lane was added."- badges={["model lane", "custom", "regression"]}- >- <CheapLaneIssueDialogOpener variant="custom" />- </DialogStory>- ),-};--export const NewIssueCheapLaneUnsupported: Story = {- name: "New Issue - Cheap lane (Unsupported adapter)",- render: () => (- <DialogStory- eyebrow="NewIssueDialog"- title="Model lane on an adapter without supportsModelProfiles"- description="HermesRouter runs on opencode_local with supportsModelProfiles disabled, so the Cheap option should be hidden — the segmented control collapses to Primary | Custom rather than showing a greyed Cheap entry."- badges={["model lane", "unsupported", "cheap hidden"]}- >- <CheapLaneIssueDialogOpener variant="unsupported" />- </DialogStory>- ),-};-export const NewAgentRecommendation: Story = {name: "New Agent - Recommendation",render: () => (diff --git a/ui/storybook/stories/issue-management.stories.tsx b/ui/storybook/stories/issue-management.stories.tsxindex 189e88885b..c5f5071207 100644--- a/ui/storybook/stories/issue-management.stories.tsx+++ b/ui/storybook/stories/issue-management.stories.tsx@@ -553,116 +553,6 @@ function OpenFiltersPopover() {);}-const modelProfileLedgerRuns: RunForIssue[] = [- {- runId: "run-cheap-applied",- status: "succeeded",- agentId: "agent-codex",- adapterType: "codex_local",- startedAt: "2026-04-29T09:30:00.000Z",- finishedAt: "2026-04-29T09:32:14.000Z",- createdAt: "2026-04-29T09:29:55.000Z",- invocationSource: "manual",- usageJson: { costCents: 17, inputTokens: 6400, outputTokens: 480 },- resultJson: {- stopReason: "completed",- modelProfile: {- requested: "cheap",- applied: "cheap",- configSource: "agent_runtime_config",- },- },- livenessState: "advanced",- livenessReason: "Cheap-lane summary completed inside the planned scope.",- continuationAttempt: 0,- lastUsefulActionAt: "2026-04-29T09:32:10.000Z",- nextAction: "Hand the routine output back to the operator inbox.",- },- {- runId: "run-cheap-fallback",- status: "succeeded",- agentId: "agent-codex",- adapterType: "codex_local",- startedAt: "2026-04-29T08:10:00.000Z",- finishedAt: "2026-04-29T08:14:42.000Z",- createdAt: "2026-04-29T08:09:50.000Z",- invocationSource: "manual",- usageJson: { costCents: 91, inputTokens: 21800, outputTokens: 3200 },- resultJson: {- stopReason: "completed",- modelProfile: {- requested: "cheap",- applied: "primary",- configSource: "adapter_default",- fallbackReason: "Cheap profile not configured for this agent",- },- },- livenessState: "advanced",- livenessReason: "Routine fell back to the primary model after the cheap lookup missed.",- continuationAttempt: 0,- lastUsefulActionAt: "2026-04-29T08:14:36.000Z",- nextAction: "Configure agent-codex with a cheap profile to avoid the fallback.",- },- {- runId: "run-baseline",- status: "succeeded",- agentId: "agent-codex",- adapterType: "codex_local",- startedAt: "2026-04-28T18:05:00.000Z",- finishedAt: "2026-04-28T18:14:11.000Z",- createdAt: "2026-04-28T18:04:50.000Z",- invocationSource: "scheduler",- usageJson: { costCents: 142, inputTokens: 38400, outputTokens: 7200 },- resultJson: { stopReason: "completed" },- livenessState: "advanced",- livenessReason: "Standard primary-lane run with no profile metadata recorded.",- continuationAttempt: 0,- lastUsefulActionAt: "2026-04-28T18:13:58.000Z",- nextAction: "Continue with the next planned subtask.",- },-];--function ModelProfileBadgeLedger() {- return (- <div className="grid gap-5 xl:grid-cols-[minmax(0,1fr)_360px]">- <IssueRunLedgerContent- runs={modelProfileLedgerRuns}- activeRun={null}- liveRuns={[]}- issueStatus="in_progress"- childIssues={[]}- agentMap={storybookAgentMap}- />- <Card className="shadow-none">- <CardHeader>- <CardTitle className="flex items-center gap-2">- <GitBranch className="h-4 w-4" />- Model profile metadata- </CardTitle>- <CardDescription>- Profile badges read <code>resultJson.modelProfile</code> on each run. Applied matching the request renders- emerald; an applied fallback renders amber and surfaces the inline reason.- </CardDescription>- </CardHeader>- <CardContent className="space-y-3 text-xs text-muted-foreground">- <div className="rounded-md border border-border bg-background/70 p-3">- <div className="font-mono text-emerald-600 dark:text-emerald-400">Profile: cheap</div>- <p className="mt-1">requested + applied both equal cheap → emerald badge.</p>- </div>- <div className="rounded-md border border-border bg-background/70 p-3">- <div className="font-mono text-amber-600 dark:text-amber-400">Profile: cheap → primary</div>- <p className="mt-1">cheap requested but primary applied → amber badge plus inline fallback reason.</p>- </div>- <div className="rounded-md border border-border bg-background/70 p-3">- <div className="font-mono text-muted-foreground">No profile badge</div>- <p className="mt-1">Run with no <code>modelProfile</code> metadata renders without a badge for visual contrast.</p>- </div>- </CardContent>- </Card>- </div>- );-}-function RunLedgerWithCostColumns() {return (<div className="grid gap-5 xl:grid-cols-[minmax(0,1fr)_380px]">@@ -891,10 +781,6 @@ function IssueManagementStories() {<RunLedgerWithCostColumns /></Section>- <Section eyebrow="IssueRunLedger" title="Model profile badges for cheap, fallback, and baseline runs">- <ModelProfileBadgeLedger />- </Section>-<Section eyebrow="IssueWorkspaceCard" title="Workspace info card with branch, path, and runtime status"><WorkspaceCardWithRuntime /></Section>@@ -966,40 +852,3 @@ export const IssuePropertiesMobileBlockerActions: Story = {render: () => <IssuePropertiesMobileBlockerActionsPane />,parameters: { viewport: { defaultViewport: "mobile1" } },};--function ModelProfileLedgerStandalone() {- return (- <StorybookData>- <div className="paperclip-story">- <main className="paperclip-story__inner space-y-6">- <section className="paperclip-story__frame p-6">- <div className="flex flex-wrap items-start justify-between gap-5">- <div>- <div className="paperclip-story__label">IssueRunLedger</div>- <h1 className="mt-2 text-3xl font-semibold tracking-tight">Model profile badges</h1>- <p className="mt-3 max-w-3xl text-sm leading-6 text-muted-foreground">- Run ledger isolated to the cheap-lane visual states: an emerald applied=cheap badge, an amber- cheap-fell-back-to-primary badge with the inline fallback reason, and a baseline run without a- modelProfile so the visual diff stays obvious.- </p>- </div>- <div className="flex flex-wrap gap-2">- <Badge variant="outline">cheap applied</Badge>- <Badge variant="outline">cheap → primary</Badge>- <Badge variant="outline">no profile</Badge>- </div>- </div>- </section>- <Section eyebrow="IssueRunLedger" title="Cheap, fallback, and baseline runs">- <ModelProfileBadgeLedger />- </Section>- </main>- </div>- </StorybookData>- );-}--export const RunLedgerModelProfileBadges: Story = {- name: "Run ledger - Model profile badges",- render: () => <ModelProfileLedgerStandalone />,-};