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
Add instance experimental setting for isolated workspaces
Dottae39ae5a40017
diff --git a/packages/db/src/migrations/0036_cheerful_nitro.sql b/packages/db/src/migrations/0036_cheerful_nitro.sqlnew file mode 100644index 0000000000..211f5adfef--- /dev/null+++ b/packages/db/src/migrations/0036_cheerful_nitro.sql@@ -0,0 +1,9 @@+CREATE TABLE "instance_settings" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "singleton_key" text DEFAULT 'default' NOT NULL,+ "experimental" jsonb DEFAULT '{}'::jsonb NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+CREATE UNIQUE INDEX "instance_settings_singleton_key_idx" ON "instance_settings" USING btree ("singleton_key");\ No newline at end of filediff --git a/packages/db/src/migrations/meta/0036_snapshot.json b/packages/db/src/migrations/meta/0036_snapshot.jsonnew file mode 100644index 0000000000..42a4bc0a3d--- /dev/null+++ b/packages/db/src/migrations/meta/0036_snapshot.json@@ -0,0 +1,10023 @@+{+ "id": "91f3df03-8aa5-4fc6-8862-d5c4bf9cf913",+ "prevId": "84eaecc3-cd1c-4068-8c1d-3c1ca2f65108",+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "activity_log_run_id_idx": {+ "name": "activity_log_run_id_idx",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "activity_log_company_id_companies_id_fk": {+ "name": "activity_log_company_id_companies_id_fk",+ "tableFrom": "activity_log",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "activity_log_agent_id_agents_id_fk": {+ "name": "activity_log_agent_id_agents_id_fk",+ "tableFrom": "activity_log",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "activity_log_run_id_heartbeat_runs_id_fk": {+ "name": "activity_log_run_id_heartbeat_runs_id_fk",+ "tableFrom": "activity_log",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_api_keys_agent_id_agents_id_fk": {+ "name": "agent_api_keys_agent_id_agents_id_fk",+ "tableFrom": "agent_api_keys",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agent_api_keys_company_id_companies_id_fk": {+ "name": "agent_api_keys_company_id_companies_id_fk",+ "tableFrom": "agent_api_keys",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_config_revisions_company_id_companies_id_fk": {+ "name": "agent_config_revisions_company_id_companies_id_fk",+ "tableFrom": "agent_config_revisions",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agent_config_revisions_agent_id_agents_id_fk": {+ "name": "agent_config_revisions_agent_id_agents_id_fk",+ "tableFrom": "agent_config_revisions",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_runtime_state_agent_id_agents_id_fk": {+ "name": "agent_runtime_state_agent_id_agents_id_fk",+ "tableFrom": "agent_runtime_state",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agent_runtime_state_company_id_companies_id_fk": {+ "name": "agent_runtime_state_company_id_companies_id_fk",+ "tableFrom": "agent_runtime_state",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_task_sessions_company_id_companies_id_fk": {+ "name": "agent_task_sessions_company_id_companies_id_fk",+ "tableFrom": "agent_task_sessions",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agent_task_sessions_agent_id_agents_id_fk": {+ "name": "agent_task_sessions_agent_id_agents_id_fk",+ "tableFrom": "agent_task_sessions",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "last_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_wakeup_requests_company_id_companies_id_fk": {+ "name": "agent_wakeup_requests_company_id_companies_id_fk",+ "tableFrom": "agent_wakeup_requests",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agent_wakeup_requests_agent_id_agents_id_fk": {+ "name": "agent_wakeup_requests_agent_id_agents_id_fk",+ "tableFrom": "agent_wakeup_requests",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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"+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agents_company_id_companies_id_fk": {+ "name": "agents_company_id_companies_id_fk",+ "tableFrom": "agents",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "agents_reports_to_agents_id_fk": {+ "name": "agents_reports_to_agents_id_fk",+ "tableFrom": "agents",+ "tableTo": "agents",+ "columnsFrom": [+ "reports_to"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "approval_comments_approval_idx": {+ "name": "approval_comments_approval_idx",+ "columns": [+ {+ "expression": "approval_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "approval_comments_company_id_companies_id_fk": {+ "name": "approval_comments_company_id_companies_id_fk",+ "tableFrom": "approval_comments",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "approval_comments_approval_id_approvals_id_fk": {+ "name": "approval_comments_approval_id_approvals_id_fk",+ "tableFrom": "approval_comments",+ "tableTo": "approvals",+ "columnsFrom": [+ "approval_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "approval_comments_author_agent_id_agents_id_fk": {+ "name": "approval_comments_author_agent_id_agents_id_fk",+ "tableFrom": "approval_comments",+ "tableTo": "agents",+ "columnsFrom": [+ "author_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "approvals_company_id_companies_id_fk": {+ "name": "approvals_company_id_companies_id_fk",+ "tableFrom": "approvals",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "approvals_requested_by_agent_id_agents_id_fk": {+ "name": "approvals_requested_by_agent_id_agents_id_fk",+ "tableFrom": "approvals",+ "tableTo": "agents",+ "columnsFrom": [+ "requested_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "assets_company_id_companies_id_fk": {+ "name": "assets_company_id_companies_id_fk",+ "tableFrom": "assets",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "assets_created_by_agent_id_agents_id_fk": {+ "name": "assets_created_by_agent_id_agents_id_fk",+ "tableFrom": "assets",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.account": {+ "name": "account",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "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": {},+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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.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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"budget_incidents\".\"status\" <> 'dismissed'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "budget_incidents_company_id_companies_id_fk": {+ "name": "budget_incidents_company_id_companies_id_fk",+ "tableFrom": "budget_incidents",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "budget_incidents_policy_id_budget_policies_id_fk": {+ "name": "budget_incidents_policy_id_budget_policies_id_fk",+ "tableFrom": "budget_incidents",+ "tableTo": "budget_policies",+ "columnsFrom": [+ "policy_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "budget_incidents_approval_id_approvals_id_fk": {+ "name": "budget_incidents_approval_id_approvals_id_fk",+ "tableFrom": "budget_incidents",+ "tableTo": "approvals",+ "columnsFrom": [+ "approval_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "budget_policies_company_id_companies_id_fk": {+ "name": "budget_policies_company_id_companies_id_fk",+ "tableFrom": "budget_policies",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "require_board_approval_for_new_agents": {+ "name": "require_board_approval_for_new_agents",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "brand_color": {+ "name": "brand_color",+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "company_logos_asset_uq": {+ "name": "company_logos_asset_uq",+ "columns": [+ {+ "expression": "asset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "company_logos_company_id_companies_id_fk": {+ "name": "company_logos_company_id_companies_id_fk",+ "tableFrom": "company_logos",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "company_logos_asset_id_assets_id_fk": {+ "name": "company_logos_asset_id_assets_id_fk",+ "tableFrom": "company_logos",+ "tableTo": "assets",+ "columnsFrom": [+ "asset_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "company_memberships_company_id_companies_id_fk": {+ "name": "company_memberships_company_id_companies_id_fk",+ "tableFrom": "company_memberships",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "company_secret_versions_secret_id_company_secrets_id_fk": {+ "name": "company_secret_versions_secret_id_company_secrets_id_fk",+ "tableFrom": "company_secret_versions",+ "tableTo": "company_secrets",+ "columnsFrom": [+ "secret_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'local_encrypted'"+ },+ "external_ref": {+ "name": "external_ref",+ "type": "text",+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "company_secrets_company_id_companies_id_fk": {+ "name": "company_secrets_company_id_companies_id_fk",+ "tableFrom": "company_secrets",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "company_secrets_created_by_agent_id_agents_id_fk": {+ "name": "company_secrets_created_by_agent_id_agents_id_fk",+ "tableFrom": "company_secrets",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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'"+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "cost_events_company_id_companies_id_fk": {+ "name": "cost_events_company_id_companies_id_fk",+ "tableFrom": "cost_events",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "cost_events_agent_id_agents_id_fk": {+ "name": "cost_events_agent_id_agents_id_fk",+ "tableFrom": "cost_events",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "cost_events_issue_id_issues_id_fk": {+ "name": "cost_events_issue_id_issues_id_fk",+ "tableFrom": "cost_events",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "cost_events_project_id_projects_id_fk": {+ "name": "cost_events_project_id_projects_id_fk",+ "tableFrom": "cost_events",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "cost_events_goal_id_goals_id_fk": {+ "name": "cost_events_goal_id_goals_id_fk",+ "tableFrom": "cost_events",+ "tableTo": "goals",+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "cost_events_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "cost_events_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "cost_events",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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_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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_revisions_company_id_companies_id_fk": {+ "name": "document_revisions_company_id_companies_id_fk",+ "tableFrom": "document_revisions",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "document_revisions_document_id_documents_id_fk": {+ "name": "document_revisions_document_id_documents_id_fk",+ "tableFrom": "document_revisions",+ "tableTo": "documents",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_revisions_created_by_agent_id_agents_id_fk": {+ "name": "document_revisions_created_by_agent_id_agents_id_fk",+ "tableFrom": "document_revisions",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "documents_company_id_companies_id_fk": {+ "name": "documents_company_id_companies_id_fk",+ "tableFrom": "documents",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "documents_created_by_agent_id_agents_id_fk": {+ "name": "documents_created_by_agent_id_agents_id_fk",+ "tableFrom": "documents",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "documents_updated_by_agent_id_agents_id_fk": {+ "name": "documents_updated_by_agent_id_agents_id_fk",+ "tableFrom": "documents",+ "tableTo": "agents",+ "columnsFrom": [+ "updated_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "execution_workspaces_company_id_companies_id_fk": {+ "name": "execution_workspaces_company_id_companies_id_fk",+ "tableFrom": "execution_workspaces",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "execution_workspaces_project_id_projects_id_fk": {+ "name": "execution_workspaces_project_id_projects_id_fk",+ "tableFrom": "execution_workspaces",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "execution_workspaces_project_workspace_id_project_workspaces_id_fk": {+ "name": "execution_workspaces_project_workspace_id_project_workspaces_id_fk",+ "tableFrom": "execution_workspaces",+ "tableTo": "project_workspaces",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "execution_workspaces_source_issue_id_issues_id_fk": {+ "name": "execution_workspaces_source_issue_id_issues_id_fk",+ "tableFrom": "execution_workspaces",+ "tableTo": "issues",+ "columnsFrom": [+ "source_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "execution_workspaces",+ "columnsFrom": [+ "derived_from_execution_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "finance_events_company_id_companies_id_fk": {+ "name": "finance_events_company_id_companies_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "finance_events_agent_id_agents_id_fk": {+ "name": "finance_events_agent_id_agents_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "finance_events_issue_id_issues_id_fk": {+ "name": "finance_events_issue_id_issues_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "finance_events_project_id_projects_id_fk": {+ "name": "finance_events_project_id_projects_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "finance_events_goal_id_goals_id_fk": {+ "name": "finance_events_goal_id_goals_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "goals",+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "finance_events_heartbeat_run_id_heartbeat_runs_id_fk": {+ "name": "finance_events_heartbeat_run_id_heartbeat_runs_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "heartbeat_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "finance_events_cost_event_id_cost_events_id_fk": {+ "name": "finance_events_cost_event_id_cost_events_id_fk",+ "tableFrom": "finance_events",+ "tableTo": "cost_events",+ "columnsFrom": [+ "cost_event_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goals_company_id_companies_id_fk": {+ "name": "goals_company_id_companies_id_fk",+ "tableFrom": "goals",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "goals_parent_id_goals_id_fk": {+ "name": "goals_parent_id_goals_id_fk",+ "tableFrom": "goals",+ "tableTo": "goals",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "goals_owner_agent_id_agents_id_fk": {+ "name": "goals_owner_agent_id_agents_id_fk",+ "tableFrom": "goals",+ "tableTo": "agents",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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": "integer",+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "heartbeat_run_events_run_seq_idx": {+ "name": "heartbeat_run_events_run_seq_idx",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "seq",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "heartbeat_run_events_company_id_companies_id_fk": {+ "name": "heartbeat_run_events_company_id_companies_id_fk",+ "tableFrom": "heartbeat_run_events",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "heartbeat_run_events_agent_id_agents_id_fk": {+ "name": "heartbeat_run_events_agent_id_agents_id_fk",+ "tableFrom": "heartbeat_run_events",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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'"+ },+ "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+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "heartbeat_runs_company_id_companies_id_fk": {+ "name": "heartbeat_runs_company_id_companies_id_fk",+ "tableFrom": "heartbeat_runs",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "heartbeat_runs_agent_id_agents_id_fk": {+ "name": "heartbeat_runs_agent_id_agents_id_fk",+ "tableFrom": "heartbeat_runs",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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",+ "tableTo": "agent_wakeup_requests",+ "columnsFrom": [+ "wakeup_request_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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'"+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "instance_user_roles_role_idx": {+ "name": "instance_user_roles_role_idx",+ "columns": [+ {+ "expression": "role",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "invites_company_id_companies_id_fk": {+ "name": "invites_company_id_companies_id_fk",+ "tableFrom": "invites",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_approvals_approval_idx": {+ "name": "issue_approvals_approval_idx",+ "columns": [+ {+ "expression": "approval_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_approvals_company_idx": {+ "name": "issue_approvals_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_approvals_company_id_companies_id_fk": {+ "name": "issue_approvals_company_id_companies_id_fk",+ "tableFrom": "issue_approvals",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_approvals_issue_id_issues_id_fk": {+ "name": "issue_approvals_issue_id_issues_id_fk",+ "tableFrom": "issue_approvals",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_approvals_approval_id_approvals_id_fk": {+ "name": "issue_approvals_approval_id_approvals_id_fk",+ "tableFrom": "issue_approvals",+ "tableTo": "approvals",+ "columnsFrom": [+ "approval_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_approvals_linked_by_agent_id_agents_id_fk": {+ "name": "issue_approvals_linked_by_agent_id_agents_id_fk",+ "tableFrom": "issue_approvals",+ "tableTo": "agents",+ "columnsFrom": [+ "linked_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_attachments_issue_comment_idx": {+ "name": "issue_attachments_issue_comment_idx",+ "columns": [+ {+ "expression": "issue_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_attachments_asset_uq": {+ "name": "issue_attachments_asset_uq",+ "columns": [+ {+ "expression": "asset_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_attachments_company_id_companies_id_fk": {+ "name": "issue_attachments_company_id_companies_id_fk",+ "tableFrom": "issue_attachments",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_attachments_issue_id_issues_id_fk": {+ "name": "issue_attachments_issue_id_issues_id_fk",+ "tableFrom": "issue_attachments",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_attachments_asset_id_assets_id_fk": {+ "name": "issue_attachments_asset_id_assets_id_fk",+ "tableFrom": "issue_attachments",+ "tableTo": "assets",+ "columnsFrom": [+ "asset_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_attachments_issue_comment_id_issue_comments_id_fk": {+ "name": "issue_attachments_issue_comment_id_issue_comments_id_fk",+ "tableFrom": "issue_attachments",+ "tableTo": "issue_comments",+ "columnsFrom": [+ "issue_comment_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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": {+ "issue_comments_issue_idx": {+ "name": "issue_comments_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_comments_company_idx": {+ "name": "issue_comments_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_comments_company_id_companies_id_fk": {+ "name": "issue_comments_company_id_companies_id_fk",+ "tableFrom": "issue_comments",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_comments_issue_id_issues_id_fk": {+ "name": "issue_comments_issue_id_issues_id_fk",+ "tableFrom": "issue_comments",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_comments_author_agent_id_agents_id_fk": {+ "name": "issue_comments_author_agent_id_agents_id_fk",+ "tableFrom": "issue_comments",+ "tableTo": "agents",+ "columnsFrom": [+ "author_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_documents_document_uq": {+ "name": "issue_documents_document_uq",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_documents_company_id_companies_id_fk": {+ "name": "issue_documents_company_id_companies_id_fk",+ "tableFrom": "issue_documents",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_documents_issue_id_issues_id_fk": {+ "name": "issue_documents_issue_id_issues_id_fk",+ "tableFrom": "issue_documents",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_documents_document_id_documents_id_fk": {+ "name": "issue_documents_document_id_documents_id_fk",+ "tableFrom": "issue_documents",+ "tableTo": "documents",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_labels_label_idx": {+ "name": "issue_labels_label_idx",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_labels_company_idx": {+ "name": "issue_labels_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_labels_issue_id_issues_id_fk": {+ "name": "issue_labels_issue_id_issues_id_fk",+ "tableFrom": "issue_labels",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_labels_label_id_labels_id_fk": {+ "name": "issue_labels_label_id_labels_id_fk",+ "tableFrom": "issue_labels",+ "tableTo": "labels",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_labels_company_id_companies_id_fk": {+ "name": "issue_labels_company_id_companies_id_fk",+ "tableFrom": "issue_labels",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_labels_pk": {+ "name": "issue_labels_pk",+ "columns": [+ "issue_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_read_states_company_id_companies_id_fk": {+ "name": "issue_read_states_company_id_companies_id_fk",+ "tableFrom": "issue_read_states",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_read_states_issue_id_issues_id_fk": {+ "name": "issue_read_states_issue_id_issues_id_fk",+ "tableFrom": "issue_read_states",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_work_products_company_id_companies_id_fk": {+ "name": "issue_work_products_company_id_companies_id_fk",+ "tableFrom": "issue_work_products",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_work_products_project_id_projects_id_fk": {+ "name": "issue_work_products_project_id_projects_id_fk",+ "tableFrom": "issue_work_products",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_work_products_issue_id_issues_id_fk": {+ "name": "issue_work_products_issue_id_issues_id_fk",+ "tableFrom": "issue_work_products",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "execution_workspaces",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "workspace_runtime_services",+ "columnsFrom": [+ "runtime_service_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "created_by_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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'"+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'medium'"+ },+ "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+ },+ "issue_number": {+ "name": "issue_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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_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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issues_identifier_idx": {+ "name": "issues_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issues_company_id_companies_id_fk": {+ "name": "issues_company_id_companies_id_fk",+ "tableFrom": "issues",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issues_project_id_projects_id_fk": {+ "name": "issues_project_id_projects_id_fk",+ "tableFrom": "issues",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issues_project_workspace_id_project_workspaces_id_fk": {+ "name": "issues_project_workspace_id_project_workspaces_id_fk",+ "tableFrom": "issues",+ "tableTo": "project_workspaces",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issues_goal_id_goals_id_fk": {+ "name": "issues_goal_id_goals_id_fk",+ "tableFrom": "issues",+ "tableTo": "goals",+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issues_parent_id_issues_id_fk": {+ "name": "issues_parent_id_issues_id_fk",+ "tableFrom": "issues",+ "tableTo": "issues",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issues_assignee_agent_id_agents_id_fk": {+ "name": "issues_assignee_agent_id_agents_id_fk",+ "tableFrom": "issues",+ "tableTo": "agents",+ "columnsFrom": [+ "assignee_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issues_checkout_run_id_heartbeat_runs_id_fk": {+ "name": "issues_checkout_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issues",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "checkout_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issues_execution_run_id_heartbeat_runs_id_fk": {+ "name": "issues_execution_run_id_heartbeat_runs_id_fk",+ "tableFrom": "issues",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "execution_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issues_created_by_agent_id_agents_id_fk": {+ "name": "issues_created_by_agent_id_agents_id_fk",+ "tableFrom": "issues",+ "tableTo": "agents",+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issues_execution_workspace_id_execution_workspaces_id_fk": {+ "name": "issues_execution_workspace_id_execution_workspaces_id_fk",+ "tableFrom": "issues",+ "tableTo": "execution_workspaces",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "join_requests_invite_id_invites_id_fk": {+ "name": "join_requests_invite_id_invites_id_fk",+ "tableFrom": "join_requests",+ "tableTo": "invites",+ "columnsFrom": [+ "invite_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "join_requests_company_id_companies_id_fk": {+ "name": "join_requests_company_id_companies_id_fk",+ "tableFrom": "join_requests",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "join_requests_created_agent_id_agents_id_fk": {+ "name": "join_requests_created_agent_id_agents_id_fk",+ "tableFrom": "join_requests",+ "tableTo": "agents",+ "columnsFrom": [+ "created_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "labels_company_id_companies_id_fk": {+ "name": "labels_company_id_companies_id_fk",+ "tableFrom": "labels",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_company_settings_plugin_idx": {+ "name": "plugin_company_settings_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_company_settings_company_id_companies_id_fk": {+ "name": "plugin_company_settings_company_id_companies_id_fk",+ "tableFrom": "plugin_company_settings",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "plugin_company_settings_plugin_id_plugins_id_fk": {+ "name": "plugin_company_settings_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_company_settings",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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_id_idx": {+ "name": "plugin_config_plugin_id_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_config_plugin_id_plugins_id_fk": {+ "name": "plugin_config_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_config",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_entities_type_idx": {+ "name": "plugin_entities_type_idx",+ "columns": [+ {+ "expression": "entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_entities_external_idx": {+ "name": "plugin_entities_external_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_entities_plugin_id_plugins_id_fk": {+ "name": "plugin_entities_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_entities",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_job_runs_plugin_idx": {+ "name": "plugin_job_runs_plugin_idx",+ "columns": [+ {+ "expression": "plugin_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_job_runs_status_idx": {+ "name": "plugin_job_runs_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_job_runs_job_id_plugin_jobs_id_fk": {+ "name": "plugin_job_runs_job_id_plugin_jobs_id_fk",+ "tableFrom": "plugin_job_runs",+ "tableTo": "plugin_jobs",+ "columnsFrom": [+ "job_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "plugin_job_runs_plugin_id_plugins_id_fk": {+ "name": "plugin_job_runs_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_job_runs",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_jobs_next_run_idx": {+ "name": "plugin_jobs_next_run_idx",+ "columns": [+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_jobs_plugin_id_plugins_id_fk": {+ "name": "plugin_jobs_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_jobs",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_logs_level_idx": {+ "name": "plugin_logs_level_idx",+ "columns": [+ {+ "expression": "level",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_logs_plugin_id_plugins_id_fk": {+ "name": "plugin_logs_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_logs",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_state_plugin_id_plugins_id_fk": {+ "name": "plugin_state_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_state",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "plugin_state_unique_entry_idx": {+ "name": "plugin_state_unique_entry_idx",+ "nullsNotDistinct": true,+ "columns": [+ "plugin_id",+ "scope_kind",+ "scope_id",+ "namespace",+ "state_key"+ ]+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_webhook_deliveries_status_idx": {+ "name": "plugin_webhook_deliveries_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugin_webhook_deliveries_key_idx": {+ "name": "plugin_webhook_deliveries_key_idx",+ "columns": [+ {+ "expression": "webhook_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_webhook_deliveries_plugin_id_plugins_id_fk": {+ "name": "plugin_webhook_deliveries_plugin_id_plugins_id_fk",+ "tableFrom": "plugin_webhook_deliveries",+ "tableTo": "plugins",+ "columnsFrom": [+ "plugin_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "plugins_status_idx": {+ "name": "plugins_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "principal_permission_grants_company_id_companies_id_fk": {+ "name": "principal_permission_grants_company_id_companies_id_fk",+ "tableFrom": "principal_permission_grants",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_goals_goal_idx": {+ "name": "project_goals_goal_idx",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_goals_company_idx": {+ "name": "project_goals_company_idx",+ "columns": [+ {+ "expression": "company_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_goals_project_id_projects_id_fk": {+ "name": "project_goals_project_id_projects_id_fk",+ "tableFrom": "project_goals",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_goals_goal_id_goals_id_fk": {+ "name": "project_goals_goal_id_goals_id_fk",+ "tableFrom": "project_goals",+ "tableTo": "goals",+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_goals_company_id_companies_id_fk": {+ "name": "project_goals_company_id_companies_id_fk",+ "tableFrom": "project_goals",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "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_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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_workspaces_company_id_companies_id_fk": {+ "name": "project_workspaces_company_id_companies_id_fk",+ "tableFrom": "project_workspaces",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "project_workspaces_project_id_projects_id_fk": {+ "name": "project_workspaces_project_id_projects_id_fk",+ "tableFrom": "project_workspaces",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "projects_company_id_companies_id_fk": {+ "name": "projects_company_id_companies_id_fk",+ "tableFrom": "projects",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "projects_goal_id_goals_id_fk": {+ "name": "projects_goal_id_goals_id_fk",+ "tableFrom": "projects",+ "tableTo": "goals",+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "projects_lead_agent_id_agents_id_fk": {+ "name": "projects_lead_agent_id_agents_id_fk",+ "tableFrom": "projects",+ "tableTo": "agents",+ "columnsFrom": [+ "lead_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_runtime_services_company_id_companies_id_fk": {+ "name": "workspace_runtime_services_company_id_companies_id_fk",+ "tableFrom": "workspace_runtime_services",+ "tableTo": "companies",+ "columnsFrom": [+ "company_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "workspace_runtime_services_project_id_projects_id_fk": {+ "name": "workspace_runtime_services_project_id_projects_id_fk",+ "tableFrom": "workspace_runtime_services",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "project_workspaces",+ "columnsFrom": [+ "project_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "execution_workspaces",+ "columnsFrom": [+ "execution_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "workspace_runtime_services_issue_id_issues_id_fk": {+ "name": "workspace_runtime_services_issue_id_issues_id_fk",+ "tableFrom": "workspace_runtime_services",+ "tableTo": "issues",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "workspace_runtime_services_owner_agent_id_agents_id_fk": {+ "name": "workspace_runtime_services_owner_agent_id_agents_id_fk",+ "tableFrom": "workspace_runtime_services",+ "tableTo": "agents",+ "columnsFrom": [+ "owner_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "heartbeat_runs",+ "columnsFrom": [+ "started_by_run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_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 15bbb912b4..57beea4587 100644--- a/packages/db/src/migrations/meta/_journal.json+++ b/packages/db/src/migrations/meta/_journal.json@@ -253,6 +253,13 @@"when": 1773698696169,"tag": "0035_marvelous_satana","breakpoints": true+ },+ {+ "idx": 36,+ "version": "7",+ "when": 1773756213455,+ "tag": "0036_cheerful_nitro",+ "breakpoints": true}]-}\ No newline at end of file+}diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.tsindex b0664ab9e4..e355da7807 100644--- a/packages/db/src/schema/index.ts+++ b/packages/db/src/schema/index.ts@@ -1,6 +1,7 @@export { companies } from "./companies.js";export { companyLogos } from "./company_logos.js";export { authUsers, authSessions, authAccounts, authVerifications } from "./auth.js";+export { instanceSettings } from "./instance_settings.js";export { instanceUserRoles } from "./instance_user_roles.js";export { agents } from "./agents.js";export { companyMemberships } from "./company_memberships.js";diff --git a/packages/db/src/schema/instance_settings.ts b/packages/db/src/schema/instance_settings.tsnew file mode 100644index 0000000000..a9085ea45c--- /dev/null+++ b/packages/db/src/schema/instance_settings.ts@@ -0,0 +1,15 @@+import { pgTable, uuid, text, timestamp, jsonb, uniqueIndex } from "drizzle-orm/pg-core";++export const instanceSettings = pgTable(+ "instance_settings",+ {+ id: uuid("id").primaryKey().defaultRandom(),+ singletonKey: text("singleton_key").notNull().default("default"),+ experimental: jsonb("experimental").$type<Record<string, unknown>>().notNull().default({}),+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),+ },+ (table) => ({+ singletonKeyIdx: uniqueIndex("instance_settings_singleton_key_idx").on(table.singletonKey),+ }),+);diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.tsindex 578edd64a3..8de6a8e515 100644--- a/packages/shared/src/index.ts+++ b/packages/shared/src/index.ts@@ -120,6 +120,8 @@ export {export type {Company,+ InstanceExperimentalSettings,+ InstanceSettings,Agent,AgentPermissions,AgentKeyCreated,@@ -239,6 +241,12 @@ export type {ProviderQuotaResult,} from "./types/index.js";+export {+ instanceExperimentalSettingsSchema,+ patchInstanceExperimentalSettingsSchema,+ type PatchInstanceExperimentalSettings,+} from "./validators/index.js";+export {createCompanySchema,updateCompanySchema,diff --git a/packages/shared/src/types/index.ts b/packages/shared/src/types/index.tsindex 2ce7abd6a6..bdd3919eef 100644--- a/packages/shared/src/types/index.ts+++ b/packages/shared/src/types/index.ts@@ -1,4 +1,5 @@export type { Company } from "./company.js";+export type { InstanceExperimentalSettings, InstanceSettings } from "./instance.js";export type {Agent,AgentPermissions,diff --git a/packages/shared/src/types/instance.ts b/packages/shared/src/types/instance.tsnew file mode 100644index 0000000000..f243ef6130--- /dev/null+++ b/packages/shared/src/types/instance.ts@@ -0,0 +1,10 @@+export interface InstanceExperimentalSettings {+ enableIsolatedWorkspaces: boolean;+}++export interface InstanceSettings {+ id: string;+ experimental: InstanceExperimentalSettings;+ createdAt: Date;+ updatedAt: Date;+}diff --git a/packages/shared/src/validators/index.ts b/packages/shared/src/validators/index.tsindex a37056b3d2..ed9dcdd065 100644--- a/packages/shared/src/validators/index.ts+++ b/packages/shared/src/validators/index.ts@@ -1,3 +1,10 @@+export {+ instanceExperimentalSettingsSchema,+ patchInstanceExperimentalSettingsSchema,+ type InstanceExperimentalSettings,+ type PatchInstanceExperimentalSettings,+} from "./instance.js";+export {upsertBudgetPolicySchema,resolveBudgetIncidentSchema,diff --git a/packages/shared/src/validators/instance.ts b/packages/shared/src/validators/instance.tsnew file mode 100644index 0000000000..955db00208--- /dev/null+++ b/packages/shared/src/validators/instance.ts@@ -0,0 +1,10 @@+import { z } from "zod";++export const instanceExperimentalSettingsSchema = z.object({+ enableIsolatedWorkspaces: z.boolean().default(false),+}).strict();++export const patchInstanceExperimentalSettingsSchema = instanceExperimentalSettingsSchema.partial();++export type InstanceExperimentalSettings = z.infer<typeof instanceExperimentalSettingsSchema>;+export type PatchInstanceExperimentalSettings = z.infer<typeof patchInstanceExperimentalSettingsSchema>;diff --git a/server/src/__tests__/execution-workspace-policy.test.ts b/server/src/__tests__/execution-workspace-policy.test.tsindex 72f2837e2a..a52fba4e81 100644--- a/server/src/__tests__/execution-workspace-policy.test.ts+++ b/server/src/__tests__/execution-workspace-policy.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";import {buildExecutionWorkspaceAdapterConfig,defaultIssueExecutionWorkspaceSettingsForProject,+ gateProjectExecutionWorkspacePolicy,parseIssueExecutionWorkspaceSettings,parseProjectExecutionWorkspacePolicy,resolveExecutionWorkspaceMode,@@ -140,4 +141,19 @@ describe("execution workspace policy helpers", () => {mode: "shared_workspace",});});++ it("disables project execution workspace policy when the instance flag is off", () => {+ expect(+ gateProjectExecutionWorkspacePolicy(+ { enabled: true, defaultMode: "isolated_workspace" },+ false,+ ),+ ).toBeNull();+ expect(+ gateProjectExecutionWorkspacePolicy(+ { enabled: true, defaultMode: "isolated_workspace" },+ true,+ ),+ ).toEqual({ enabled: true, defaultMode: "isolated_workspace" });+ });});diff --git a/server/src/__tests__/instance-settings-routes.test.ts b/server/src/__tests__/instance-settings-routes.test.tsnew file mode 100644index 0000000000..3014e6686e--- /dev/null+++ b/server/src/__tests__/instance-settings-routes.test.ts@@ -0,0 +1,99 @@+import express from "express";+import request from "supertest";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { errorHandler } from "../middleware/index.js";+import { instanceSettingsRoutes } from "../routes/instance-settings.js";++const mockInstanceSettingsService = vi.hoisted(() => ({+ getExperimental: vi.fn(),+ updateExperimental: vi.fn(),+ listCompanyIds: vi.fn(),+}));+const mockLogActivity = vi.hoisted(() => vi.fn());++vi.mock("../services/index.js", () => ({+ instanceSettingsService: () => mockInstanceSettingsService,+ logActivity: mockLogActivity,+}));++function createApp(actor: any) {+ const app = express();+ app.use(express.json());+ app.use((req, _res, next) => {+ req.actor = actor;+ next();+ });+ app.use("/api", instanceSettingsRoutes({} as any));+ app.use(errorHandler);+ return app;+}++describe("instance settings routes", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ mockInstanceSettingsService.getExperimental.mockResolvedValue({+ enableIsolatedWorkspaces: false,+ });+ mockInstanceSettingsService.updateExperimental.mockResolvedValue({+ id: "instance-settings-1",+ experimental: {+ enableIsolatedWorkspaces: true,+ },+ });+ mockInstanceSettingsService.listCompanyIds.mockResolvedValue(["company-1", "company-2"]);+ });++ it("allows local board users to read and update experimental settings", async () => {+ const app = createApp({+ type: "board",+ userId: "local-board",+ source: "local_implicit",+ isInstanceAdmin: true,+ });++ const getRes = await request(app).get("/api/instance/settings/experimental");+ expect(getRes.status).toBe(200);+ expect(getRes.body).toEqual({ enableIsolatedWorkspaces: false });++ const patchRes = await request(app)+ .patch("/api/instance/settings/experimental")+ .send({ enableIsolatedWorkspaces: true });++ expect(patchRes.status).toBe(200);+ expect(mockInstanceSettingsService.updateExperimental).toHaveBeenCalledWith({+ enableIsolatedWorkspaces: true,+ });+ expect(mockLogActivity).toHaveBeenCalledTimes(2);+ });++ it("rejects non-admin board users", async () => {+ const app = createApp({+ type: "board",+ userId: "user-1",+ source: "session",+ isInstanceAdmin: false,+ companyIds: ["company-1"],+ });++ const res = await request(app).get("/api/instance/settings/experimental");++ expect(res.status).toBe(403);+ expect(mockInstanceSettingsService.getExperimental).not.toHaveBeenCalled();+ });++ it("rejects agent callers", async () => {+ const app = createApp({+ type: "agent",+ agentId: "agent-1",+ companyId: "company-1",+ source: "agent_key",+ });++ const res = await request(app)+ .patch("/api/instance/settings/experimental")+ .send({ enableIsolatedWorkspaces: true });++ expect(res.status).toBe(403);+ expect(mockInstanceSettingsService.updateExperimental).not.toHaveBeenCalled();+ });+});diff --git a/server/src/app.ts b/server/src/app.tsindex 89911c47cc..8200ef832b 100644--- a/server/src/app.ts+++ b/server/src/app.ts@@ -22,6 +22,7 @@ import { costRoutes } from "./routes/costs.js";import { activityRoutes } from "./routes/activity.js";import { dashboardRoutes } from "./routes/dashboard.js";import { sidebarBadgeRoutes } from "./routes/sidebar-badges.js";+import { instanceSettingsRoutes } from "./routes/instance-settings.js";import { llmRoutes } from "./routes/llms.js";import { assetRoutes } from "./routes/assets.js";import { accessRoutes } from "./routes/access.js";@@ -147,6 +148,7 @@ export async function createApp(api.use(activityRoutes(db));api.use(dashboardRoutes(db));api.use(sidebarBadgeRoutes(db));+ api.use(instanceSettingsRoutes(db));const hostServicesDisposers = new Map<string, () => void>();const workerManager = createPluginWorkerManager();const pluginRegistry = pluginRegistryService(db);diff --git a/server/src/routes/index.ts b/server/src/routes/index.tsindex c509d54462..f79e54a561 100644--- a/server/src/routes/index.ts+++ b/server/src/routes/index.ts@@ -12,3 +12,4 @@ export { dashboardRoutes } from "./dashboard.js";export { sidebarBadgeRoutes } from "./sidebar-badges.js";export { llmRoutes } from "./llms.js";export { accessRoutes } from "./access.js";+export { instanceSettingsRoutes } from "./instance-settings.js";diff --git a/server/src/routes/instance-settings.ts b/server/src/routes/instance-settings.tsnew file mode 100644index 0000000000..93ae9f6a61--- /dev/null+++ b/server/src/routes/instance-settings.ts@@ -0,0 +1,59 @@+import { Router, type Request } from "express";+import type { Db } from "@paperclipai/db";+import { patchInstanceExperimentalSettingsSchema } from "@paperclipai/shared";+import { forbidden } from "../errors.js";+import { validate } from "../middleware/validate.js";+import { instanceSettingsService, logActivity } from "../services/index.js";+import { getActorInfo } from "./authz.js";++function assertCanManageInstanceSettings(req: Request) {+ if (req.actor.type !== "board") {+ throw forbidden("Board access required");+ }+ if (req.actor.source === "local_implicit" || req.actor.isInstanceAdmin) {+ return;+ }+ throw forbidden("Instance admin access required");+}++export function instanceSettingsRoutes(db: Db) {+ const router = Router();+ const svc = instanceSettingsService(db);++ router.get("/instance/settings/experimental", async (req, res) => {+ assertCanManageInstanceSettings(req);+ res.json(await svc.getExperimental());+ });++ router.patch(+ "/instance/settings/experimental",+ validate(patchInstanceExperimentalSettingsSchema),+ async (req, res) => {+ assertCanManageInstanceSettings(req);+ const updated = await svc.updateExperimental(req.body);+ const actor = getActorInfo(req);+ const companyIds = await svc.listCompanyIds();+ await Promise.all(+ companyIds.map((companyId) =>+ logActivity(db, {+ companyId,+ actorType: actor.actorType,+ actorId: actor.actorId,+ agentId: actor.agentId,+ runId: actor.runId,+ action: "instance.settings.experimental_updated",+ entityType: "instance_settings",+ entityId: updated.id,+ details: {+ experimental: updated.experimental,+ changedKeys: Object.keys(req.body).sort(),+ },+ }),+ ),+ );+ res.json(updated.experimental);+ },+ );++ return router;+}diff --git a/server/src/services/execution-workspace-policy.ts b/server/src/services/execution-workspace-policy.tsindex 6f61e6d3c0..53487324e5 100644--- a/server/src/services/execution-workspace-policy.ts+++ b/server/src/services/execution-workspace-policy.ts@@ -77,6 +77,14 @@ export function parseProjectExecutionWorkspacePolicy(raw: unknown): ProjectExecu};}+export function gateProjectExecutionWorkspacePolicy(+ projectPolicy: ProjectExecutionWorkspacePolicy | null,+ isolatedWorkspacesEnabled: boolean,+): ProjectExecutionWorkspacePolicy | null {+ if (!isolatedWorkspacesEnabled) return null;+ return projectPolicy;+}+export function parseIssueExecutionWorkspaceSettings(raw: unknown): IssueExecutionWorkspaceSettings | null {const parsed = parseObject(raw);if (Object.keys(parsed).length === 0) return null;diff --git a/server/src/services/heartbeat.ts b/server/src/services/heartbeat.tsindex 7759dba931..680bc03b93 100644--- a/server/src/services/heartbeat.ts+++ b/server/src/services/heartbeat.ts@@ -40,10 +40,12 @@ import { issueService } from "./issues.js";import { executionWorkspaceService } from "./execution-workspaces.js";import {buildExecutionWorkspaceAdapterConfig,+ gateProjectExecutionWorkspacePolicy,parseIssueExecutionWorkspaceSettings,parseProjectExecutionWorkspacePolicy,resolveExecutionWorkspaceMode,} from "./execution-workspace-policy.js";+import { instanceSettingsService } from "./instance-settings.js";import { redactCurrentUserText, redactCurrentUserValue } from "../log-redaction.js";const MAX_LIVE_LOG_CHUNK_BYTES = 8 * 1024;@@ -697,6 +699,8 @@ function resolveNextSessionState(input: {}export function heartbeatService(db: Db) {+ const instanceSettings = instanceSettingsService(db);+const runLogStore = getRunLogStore();const secretsSvc = secretService(db);const issuesSvc = issueService(db);@@ -1661,9 +1665,10 @@ export function heartbeatService(db: Db) {issueAssigneeConfig.assigneeAdapterOverrides,): null;- const issueExecutionWorkspaceSettings = parseIssueExecutionWorkspaceSettings(- issueAssigneeConfig?.executionWorkspaceSettings,- );+ const isolatedWorkspacesEnabled = (await instanceSettings.getExperimental()).enableIsolatedWorkspaces;+ const issueExecutionWorkspaceSettings = isolatedWorkspacesEnabled+ ? parseIssueExecutionWorkspaceSettings(issueAssigneeConfig?.executionWorkspaceSettings)+ : null;const contextProjectId = readNonEmptyString(context.projectId);const executionProjectId = issueAssigneeConfig?.projectId ?? contextProjectId;const projectExecutionWorkspacePolicy = executionProjectId@@ -1671,7 +1676,11 @@ export function heartbeatService(db: Db) {.select({ executionWorkspacePolicy: projects.executionWorkspacePolicy }).from(projects).where(and(eq(projects.id, executionProjectId), eq(projects.companyId, agent.companyId)))- .then((rows) => parseProjectExecutionWorkspacePolicy(rows[0]?.executionWorkspacePolicy))+ .then((rows) =>+ gateProjectExecutionWorkspacePolicy(+ parseProjectExecutionWorkspacePolicy(rows[0]?.executionWorkspacePolicy),+ isolatedWorkspacesEnabled,+ )): null;const taskSession = taskKey? await getTaskSession(agent.companyId, agent.id, agent.adapterType, taskKey)diff --git a/server/src/services/index.ts b/server/src/services/index.tsindex 98e52d9086..e2950c9ca3 100644--- a/server/src/services/index.ts+++ b/server/src/services/index.ts@@ -16,6 +16,7 @@ export { heartbeatService } from "./heartbeat.js";export { dashboardService } from "./dashboard.js";export { sidebarBadgeService } from "./sidebar-badges.js";export { accessService } from "./access.js";+export { instanceSettingsService } from "./instance-settings.js";export { companyPortabilityService } from "./company-portability.js";export { executionWorkspaceService } from "./execution-workspaces.js";export { workProductService } from "./work-products.js";diff --git a/server/src/services/instance-settings.ts b/server/src/services/instance-settings.tsnew file mode 100644index 0000000000..e60154a43b--- /dev/null+++ b/server/src/services/instance-settings.ts@@ -0,0 +1,95 @@+import type { Db } from "@paperclipai/db";+import { companies, instanceSettings } from "@paperclipai/db";+import {+ instanceExperimentalSettingsSchema,+ type InstanceExperimentalSettings,+ type InstanceSettings,+ type PatchInstanceExperimentalSettings,+} from "@paperclipai/shared";+import { eq } from "drizzle-orm";++const DEFAULT_SINGLETON_KEY = "default";++function normalizeExperimentalSettings(raw: unknown): InstanceExperimentalSettings {+ const parsed = instanceExperimentalSettingsSchema.safeParse(raw ?? {});+ if (parsed.success) {+ return {+ enableIsolatedWorkspaces: parsed.data.enableIsolatedWorkspaces ?? false,+ };+ }+ return {+ enableIsolatedWorkspaces: false,+ };+}++function toInstanceSettings(row: typeof instanceSettings.$inferSelect): InstanceSettings {+ return {+ id: row.id,+ experimental: normalizeExperimentalSettings(row.experimental),+ createdAt: row.createdAt,+ updatedAt: row.updatedAt,+ };+}++export function instanceSettingsService(db: Db) {+ async function getOrCreateRow() {+ const existing = await db+ .select()+ .from(instanceSettings)+ .where(eq(instanceSettings.singletonKey, DEFAULT_SINGLETON_KEY))+ .then((rows) => rows[0] ?? null);+ if (existing) return existing;++ const now = new Date();+ const [created] = await db+ .insert(instanceSettings)+ .values({+ singletonKey: DEFAULT_SINGLETON_KEY,+ experimental: {},+ createdAt: now,+ updatedAt: now,+ })+ .onConflictDoUpdate({+ target: [instanceSettings.singletonKey],+ set: {+ updatedAt: now,+ },+ })+ .returning();++ return created;+ }++ return {+ get: async (): Promise<InstanceSettings> => toInstanceSettings(await getOrCreateRow()),++ getExperimental: async (): Promise<InstanceExperimentalSettings> => {+ const row = await getOrCreateRow();+ return normalizeExperimentalSettings(row.experimental);+ },++ updateExperimental: async (patch: PatchInstanceExperimentalSettings): Promise<InstanceSettings> => {+ const current = await getOrCreateRow();+ const nextExperimental = normalizeExperimentalSettings({+ ...normalizeExperimentalSettings(current.experimental),+ ...patch,+ });+ const now = new Date();+ const [updated] = await db+ .update(instanceSettings)+ .set({+ experimental: { ...nextExperimental },+ updatedAt: now,+ })+ .where(eq(instanceSettings.id, current.id))+ .returning();+ return toInstanceSettings(updated ?? current);+ },++ listCompanyIds: async (): Promise<string[]> =>+ db+ .select({ id: companies.id })+ .from(companies)+ .then((rows) => rows.map((row) => row.id)),+ };+}diff --git a/server/src/services/issues.ts b/server/src/services/issues.tsindex dcace41b68..1f1a49619f 100644--- a/server/src/services/issues.ts+++ b/server/src/services/issues.ts@@ -23,8 +23,10 @@ import { extractProjectMentionIds } from "@paperclipai/shared";import { conflict, notFound, unprocessable } from "../errors.js";import {defaultIssueExecutionWorkspaceSettingsForProject,+ gateProjectExecutionWorkspacePolicy,parseProjectExecutionWorkspacePolicy,} from "./execution-workspace-policy.js";+import { instanceSettingsService } from "./instance-settings.js";import { redactCurrentUserText } from "../log-redaction.js";import { resolveIssueGoalId, resolveNextIssueGoalId } from "./issue-goal-fallback.js";import { getDefaultCompanyGoal } from "./goals.js";@@ -316,6 +318,8 @@ function withActiveRuns(}export function issueService(db: Db) {+ const instanceSettings = instanceSettingsService(db);+async function assertAssignableAgent(companyId: string, agentId: string) {const assignee = await db.select({@@ -676,6 +680,12 @@ export function issueService(db: Db) {data: Omit<typeof issues.$inferInsert, "companyId"> & { labelIds?: string[] },) => {const { labelIds: inputLabelIds, ...issueData } = data;+ const isolatedWorkspacesEnabled = (await instanceSettings.getExperimental()).enableIsolatedWorkspaces;+ if (!isolatedWorkspacesEnabled) {+ delete issueData.executionWorkspaceId;+ delete issueData.executionWorkspacePreference;+ delete issueData.executionWorkspaceSettings;+ }if (data.assigneeAgentId && data.assigneeUserId) {throw unprocessable("Issue can only have one assignee");}@@ -706,7 +716,10 @@ export function issueService(db: Db) {.then((rows) => rows[0] ?? null);executionWorkspaceSettings =defaultIssueExecutionWorkspaceSettingsForProject(- parseProjectExecutionWorkspacePolicy(project?.executionWorkspacePolicy),+ gateProjectExecutionWorkspacePolicy(+ parseProjectExecutionWorkspacePolicy(project?.executionWorkspacePolicy),+ isolatedWorkspacesEnabled,+ ),) as Record<string, unknown> | null;}let projectWorkspaceId = issueData.projectWorkspaceId ?? null;@@ -779,6 +792,12 @@ export function issueService(db: Db) {if (!existing) return null;const { labelIds: nextLabelIds, ...issueData } = data;+ const isolatedWorkspacesEnabled = (await instanceSettings.getExperimental()).enableIsolatedWorkspaces;+ if (!isolatedWorkspacesEnabled) {+ delete issueData.executionWorkspaceId;+ delete issueData.executionWorkspacePreference;+ delete issueData.executionWorkspaceSettings;+ }if (issueData.status) {assertTransition(existing.status, issueData.status);diff --git a/ui/src/App.tsx b/ui/src/App.tsxindex 291781f985..ff1daecffd 100644--- a/ui/src/App.tsx+++ b/ui/src/App.tsx@@ -25,6 +25,7 @@ import { Inbox } from "./pages/Inbox";import { CompanySettings } from "./pages/CompanySettings";import { DesignGuide } from "./pages/DesignGuide";import { InstanceSettings } from "./pages/InstanceSettings";+import { InstanceExperimentalSettings } from "./pages/InstanceExperimentalSettings";import { PluginManager } from "./pages/PluginManager";import { PluginSettings } from "./pages/PluginSettings";import { PluginPage } from "./pages/PluginPage";@@ -307,6 +308,7 @@ export function App() {<Route path="instance/settings" element={<Layout />}><Route index element={<Navigate to="heartbeats" replace />} /><Route path="heartbeats" element={<InstanceSettings />} />+ <Route path="experimental" element={<InstanceExperimentalSettings />} /><Route path="plugins" element={<PluginManager />} /><Route path="plugins/:pluginId" element={<PluginSettings />} /></Route>diff --git a/ui/src/api/index.ts b/ui/src/api/index.tsindex 8c95c24671..0757ff8d49 100644--- a/ui/src/api/index.ts+++ b/ui/src/api/index.ts@@ -12,4 +12,5 @@ export { costsApi } from "./costs";export { activityApi } from "./activity";export { dashboardApi } from "./dashboard";export { heartbeatsApi } from "./heartbeats";+export { instanceSettingsApi } from "./instanceSettings";export { sidebarBadgesApi } from "./sidebarBadges";diff --git a/ui/src/api/instanceSettings.ts b/ui/src/api/instanceSettings.tsnew file mode 100644index 0000000000..0b7a8f2486--- /dev/null+++ b/ui/src/api/instanceSettings.ts@@ -0,0 +1,12 @@+import type {+ InstanceExperimentalSettings,+ PatchInstanceExperimentalSettings,+} from "@paperclipai/shared";+import { api } from "./client";++export const instanceSettingsApi = {+ getExperimental: () =>+ api.get<InstanceExperimentalSettings>("/instance/settings/experimental"),+ updateExperimental: (patch: PatchInstanceExperimentalSettings) =>+ api.patch<InstanceExperimentalSettings>("/instance/settings/experimental", patch),+};diff --git a/ui/src/components/InstanceSidebar.tsx b/ui/src/components/InstanceSidebar.tsxindex 5c9dcd54d9..451678d154 100644--- a/ui/src/components/InstanceSidebar.tsx+++ b/ui/src/components/InstanceSidebar.tsx@@ -1,5 +1,5 @@import { useQuery } from "@tanstack/react-query";-import { Clock3, Puzzle, Settings } from "lucide-react";+import { Clock3, FlaskConical, Puzzle, Settings } from "lucide-react";import { NavLink } from "@/lib/router";import { pluginsApi } from "@/api/plugins";import { queryKeys } from "@/lib/queryKeys";@@ -23,6 +23,7 @@ export function InstanceSidebar() {<nav className="flex-1 min-h-0 overflow-y-auto scrollbar-auto-hide flex flex-col gap-4 px-3 py-2"><div className="flex flex-col gap-0.5"><SidebarNavItem to="/instance/settings/heartbeats" label="Heartbeats" icon={Clock3} end />+ <SidebarNavItem to="/instance/settings/experimental" label="Experimental" icon={FlaskConical} /><SidebarNavItem to="/instance/settings/plugins" label="Plugins" icon={Puzzle} />{(plugins ?? []).length > 0 ? (<div className="ml-4 mt-1 flex flex-col gap-0.5 border-l border-border/70 pl-3">diff --git a/ui/src/components/IssueProperties.tsx b/ui/src/components/IssueProperties.tsxindex d4ec226666..053e8e424b 100644--- a/ui/src/components/IssueProperties.tsx+++ b/ui/src/components/IssueProperties.tsx@@ -5,6 +5,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import { agentsApi } from "../api/agents";import { authApi } from "../api/auth";import { executionWorkspacesApi } from "../api/execution-workspaces";+import { instanceSettingsApi } from "../api/instanceSettings";import { issuesApi } from "../api/issues";import { projectsApi } from "../api/projects";import { useCompany } from "../context/CompanyContext";@@ -189,6 +190,10 @@ export function IssueProperties({ issue, onUpdate, inline }: IssuePropertiesPropqueryKey: queryKeys.auth.session,queryFn: () => authApi.getSession(),});+ const { data: experimentalSettings } = useQuery({+ queryKey: queryKeys.instance.experimentalSettings,+ queryFn: () => instanceSettingsApi.getExperimental(),+ });const currentUserId = session?.user?.id ?? session?.session?.userId;const { data: agents } = useQuery({@@ -258,7 +263,10 @@ export function IssueProperties({ issue, onUpdate, inline }: IssuePropertiesPropconst currentProject = issue.projectId? orderedProjects.find((project) => project.id === issue.projectId) ?? null: null;- const currentProjectExecutionWorkspacePolicy = currentProject?.executionWorkspacePolicy ?? null;+ const currentProjectExecutionWorkspacePolicy =+ experimentalSettings?.enableIsolatedWorkspaces === true+ ? currentProject?.executionWorkspacePolicy ?? null+ : null;const currentProjectSupportsExecutionWorkspace = Boolean(currentProjectExecutionWorkspacePolicy?.enabled);const currentExecutionWorkspaceSelection =issue.executionWorkspacePreferencediff --git a/ui/src/components/Layout.tsx b/ui/src/components/Layout.tsxindex e6aaf22aed..723ac6ff9c 100644--- a/ui/src/components/Layout.tsx+++ b/ui/src/components/Layout.tsx@@ -24,32 +24,16 @@ import { useKeyboardShortcuts } from "../hooks/useKeyboardShortcuts";import { useCompanyPageMemory } from "../hooks/useCompanyPageMemory";import { healthApi } from "../api/health";import { shouldSyncCompanySelectionFromRoute } from "../lib/company-selection";+import {+ DEFAULT_INSTANCE_SETTINGS_PATH,+ normalizeRememberedInstanceSettingsPath,+} from "../lib/instance-settings";import { queryKeys } from "../lib/queryKeys";import { cn } from "../lib/utils";import { NotFoundPage } from "../pages/NotFound";import { Button } from "@/components/ui/button";const INSTANCE_SETTINGS_MEMORY_KEY = "paperclip.lastInstanceSettingsPath";-const DEFAULT_INSTANCE_SETTINGS_PATH = "/instance/settings/heartbeats";--function normalizeRememberedInstanceSettingsPath(rawPath: string | null): string {- if (!rawPath) return DEFAULT_INSTANCE_SETTINGS_PATH;-- const match = rawPath.match(/^([^?#]*)(\?[^#]*)?(#.*)?$/);- const pathname = match?.[1] ?? rawPath;- const search = match?.[2] ?? "";- const hash = match?.[3] ?? "";-- if (pathname === "/instance/settings/heartbeats" || pathname === "/instance/settings/plugins") {- return `${pathname}${search}${hash}`;- }-- if (/^\/instance\/settings\/plugins\/[^/?#]+$/.test(pathname)) {- return `${pathname}${search}${hash}`;- }-- return DEFAULT_INSTANCE_SETTINGS_PATH;-}function readRememberedInstanceSettingsPath(): string {if (typeof window === "undefined") return DEFAULT_INSTANCE_SETTINGS_PATH;diff --git a/ui/src/components/NewIssueDialog.tsx b/ui/src/components/NewIssueDialog.tsxindex 74e5bcf1d0..a734fbd56c 100644--- a/ui/src/components/NewIssueDialog.tsx+++ b/ui/src/components/NewIssueDialog.tsx@@ -4,6 +4,7 @@ import { useDialog } from "../context/DialogContext";import { useCompany } from "../context/CompanyContext";import { executionWorkspacesApi } from "../api/execution-workspaces";import { issuesApi } from "../api/issues";+import { instanceSettingsApi } from "../api/instanceSettings";import { projectsApi } from "../api/projects";import { agentsApi } from "../api/agents";import { authApi } from "../api/auth";@@ -341,6 +342,11 @@ export function NewIssueDialog() {queryKey: queryKeys.auth.session,queryFn: () => authApi.getSession(),});+ const { data: experimentalSettings } = useQuery({+ queryKey: queryKeys.instance.experimentalSettings,+ queryFn: () => instanceSettingsApi.getExperimental(),+ enabled: newIssueOpen,+ });const currentUserId = session?.user?.id ?? session?.session?.userId ?? null;const activeProjects = useMemo(() => (projects ?? []).filter((p) => !p.archivedAt),@@ -635,7 +641,10 @@ export function NewIssueDialog() {chrome: assigneeChrome,});const selectedProject = orderedProjects.find((project) => project.id === projectId);- const executionWorkspacePolicy = selectedProject?.executionWorkspacePolicy ?? null;+ const executionWorkspacePolicy =+ experimentalSettings?.enableIsolatedWorkspaces === true+ ? selectedProject?.executionWorkspacePolicy ?? null+ : null;const selectedReusableExecutionWorkspace = deduplicatedReusableWorkspaces.find((workspace) => workspace.id === selectedExecutionWorkspaceId,);@@ -743,7 +752,10 @@ export function NewIssueDialog() {? (agents ?? []).find((a) => a.id === selectedAssigneeAgentId): null;const currentProject = orderedProjects.find((project) => project.id === projectId);- const currentProjectExecutionWorkspacePolicy = currentProject?.executionWorkspacePolicy ?? null;+ const currentProjectExecutionWorkspacePolicy =+ experimentalSettings?.enableIsolatedWorkspaces === true+ ? currentProject?.executionWorkspacePolicy ?? null+ : null;const currentProjectSupportsExecutionWorkspace = Boolean(currentProjectExecutionWorkspacePolicy?.enabled);const deduplicatedReusableWorkspaces = useMemo(() => {const workspaces = reusableExecutionWorkspaces ?? [];@@ -1106,9 +1118,9 @@ export function NewIssueDialog() {</div>{currentProject && (- <div className="px-4 pb-2 shrink-0 space-y-2">+ <div className="px-4 py-3 shrink-0 space-y-2">{currentProjectSupportsExecutionWorkspace && (- <div className="rounded-md border border-border px-3 py-2 space-y-1.5">+ <div className="space-y-1.5"><div className="text-xs font-medium">Execution workspace</div><div className="text-[11px] text-muted-foreground">Control whether this issue runs in the shared workspace, a new isolated workspace, or an existing one.diff --git a/ui/src/components/ProjectProperties.tsx b/ui/src/components/ProjectProperties.tsxindex b5170a0e4a..edff15238e 100644--- a/ui/src/components/ProjectProperties.tsx+++ b/ui/src/components/ProjectProperties.tsx@@ -5,6 +5,7 @@ import type { Project } from "@paperclipai/shared";import { StatusBadge } from "./StatusBadge";import { cn, formatDate } from "../lib/utils";import { goalsApi } from "../api/goals";+import { instanceSettingsApi } from "../api/instanceSettings";import { projectsApi } from "../api/projects";import { useCompany } from "../context/CompanyContext";import { queryKeys } from "../lib/queryKeys";@@ -173,6 +174,10 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSaqueryFn: () => goalsApi.list(selectedCompanyId!),enabled: !!selectedCompanyId,});+ const { data: experimentalSettings } = useQuery({+ queryKey: queryKeys.instance.experimentalSettings,+ queryFn: () => instanceSettingsApi.getExperimental(),+ });const linkedGoalIds = project.goalIds.length > 0? project.goalIds@@ -194,6 +199,7 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSaconst hasAdditionalLegacyWorkspaces = workspaces.some((workspace) => workspace.id !== primaryCodebaseWorkspace?.id);const executionWorkspacePolicy = project.executionWorkspacePolicy ?? null;const executionWorkspacesEnabled = executionWorkspacePolicy?.enabled === true;+ const isolatedWorkspacesEnabled = experimentalSettings?.enableIsolatedWorkspaces === true;const executionWorkspaceDefaultMode =executionWorkspacePolicy?.defaultMode === "isolated_workspace" ? "isolated_workspace" : "shared_workspace";const executionWorkspaceStrategy = executionWorkspacePolicy?.workspaceStrategy ?? {@@ -781,244 +787,255 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa)}</div>- <Separator className="my-4" />+ {isolatedWorkspacesEnabled ? (+ <>+ <Separator className="my-4" />- <div className="py-1.5 space-y-2">- <div className="flex items-center gap-1.5 text-xs text-muted-foreground">- <span>Execution Workspaces</span>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- className="inline-flex h-4 w-4 items-center justify-center rounded-full border border-border text-[10px] text-muted-foreground hover:text-foreground"- aria-label="Execution workspaces help"- >- ?- </button>- </TooltipTrigger>- <TooltipContent side="top">- Project-owned defaults for isolated issue checkouts and execution workspace behavior.- </TooltipContent>- </Tooltip>- </div>- <div className="space-y-3">- <div className="flex items-center justify-between gap-3">- <div className="space-y-0.5">- <div className="flex items-center gap-2 text-sm font-medium">- <span>Enable isolated issue checkouts</span>- <SaveIndicator state={fieldState("execution_workspace_enabled")} />- </div>- <div className="text-xs text-muted-foreground">- Let issues choose between the project’s primary checkout and an isolated execution workspace.- </div>+ <div className="py-1.5 space-y-2">+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground">+ <span>Execution Workspaces</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ className="inline-flex h-4 w-4 items-center justify-center rounded-full border border-border text-[10px] text-muted-foreground hover:text-foreground"+ aria-label="Execution workspaces help"+ >+ ?+ </button>+ </TooltipTrigger>+ <TooltipContent side="top">+ Project-owned defaults for isolated issue checkouts and execution workspace behavior.+ </TooltipContent>+ </Tooltip></div>- {onUpdate || onFieldUpdate ? (- <button- className={cn(- "relative inline-flex h-5 w-9 items-center rounded-full transition-colors",- executionWorkspacesEnabled ? "bg-green-600" : "bg-muted",- )}- type="button"- onClick={() =>- commitField(- "execution_workspace_enabled",- updateExecutionWorkspacePolicy({ enabled: !executionWorkspacesEnabled })!,- )}- >- <span- className={cn(- "inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",- executionWorkspacesEnabled ? "translate-x-4.5" : "translate-x-0.5",- )}- />- </button>- ) : (- <span className="text-xs text-muted-foreground">- {executionWorkspacesEnabled ? "Enabled" : "Disabled"}- </span>- )}- </div>-- {executionWorkspacesEnabled && (- <>+ <div className="space-y-3"><div className="flex items-center justify-between gap-3"><div className="space-y-0.5">- <div className="flex items-center gap-2 text-sm">- <span>New issues default to isolated checkout</span>- <SaveIndicator state={fieldState("execution_workspace_default_mode")} />+ <div className="flex items-center gap-2 text-sm font-medium">+ <span>Enable isolated issue checkouts</span>+ <SaveIndicator state={fieldState("execution_workspace_enabled")} /></div>- <div className="text-[11px] text-muted-foreground">- If disabled, new issues stay on the project’s primary checkout unless someone opts in.+ <div className="text-xs text-muted-foreground">+ Let issues choose between the project's primary checkout and an isolated execution workspace.</div></div>- <button- className={cn(- "relative inline-flex h-5 w-9 items-center rounded-full transition-colors",- executionWorkspaceDefaultMode === "isolated_workspace" ? "bg-green-600" : "bg-muted",- )}- type="button"- onClick={() =>- commitField(- "execution_workspace_default_mode",- updateExecutionWorkspacePolicy({- defaultMode: executionWorkspaceDefaultMode === "isolated_workspace" ? "shared_workspace" : "isolated_workspace",- })!,- )}- >- <span+ {onUpdate || onFieldUpdate ? (+ <buttonclassName={cn(- "inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",- executionWorkspaceDefaultMode === "isolated_workspace" ? "translate-x-4.5" : "translate-x-0.5",+ "relative inline-flex h-5 w-9 items-center rounded-full transition-colors",+ executionWorkspacesEnabled ? "bg-green-600" : "bg-muted",)}- />- </button>- </div>-- <div className="border-t border-border/60 pt-2">- <button- type="button"- className="flex items-center gap-2 w-full py-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors"- onClick={() => setExecutionWorkspaceAdvancedOpen((open) => !open)}- >- {executionWorkspaceAdvancedOpen ? "Hide advanced checkout settings" : "Show advanced checkout settings"}- </button>+ type="button"+ onClick={() =>+ commitField(+ "execution_workspace_enabled",+ updateExecutionWorkspacePolicy({ enabled: !executionWorkspacesEnabled })!,+ )}+ >+ <span+ className={cn(+ "inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",+ executionWorkspacesEnabled ? "translate-x-4.5" : "translate-x-0.5",+ )}+ />+ </button>+ ) : (+ <span className="text-xs text-muted-foreground">+ {executionWorkspacesEnabled ? "Enabled" : "Disabled"}+ </span>+ )}</div>- {executionWorkspaceAdvancedOpen && (+ {executionWorkspacesEnabled ? (<div className="space-y-3">- <div className="text-xs text-muted-foreground">- Host-managed implementation: <span className="text-foreground">Git worktree</span>- </div>- <div>- <div className="mb-1 flex items-center gap-1.5">- <label className="flex items-center gap-2 text-xs text-muted-foreground">- <span>Base ref</span>- <SaveIndicator state={fieldState("execution_workspace_base_ref")} />- </label>+ <div className="flex items-center justify-between gap-3">+ <div className="space-y-0.5">+ <div className="flex items-center gap-2 text-sm">+ <span>New issues default to isolated checkout</span>+ <SaveIndicator state={fieldState("execution_workspace_default_mode")} />+ </div>+ <div className="text-[11px] text-muted-foreground">+ If disabled, new issues stay on the project's primary checkout unless someone opts in.+ </div></div>- <DraftInput- value={executionWorkspaceStrategy.baseRef ?? ""}- onCommit={(value) =>- commitField("execution_workspace_base_ref", {- ...updateExecutionWorkspacePolicy({- workspaceStrategy: {- ...executionWorkspaceStrategy,- type: "git_worktree",- baseRef: value || null,- },- })!,- })}- immediate- className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"- placeholder="origin/main"- />- </div>- <div>- <div className="mb-1 flex items-center gap-1.5">- <label className="flex items-center gap-2 text-xs text-muted-foreground">- <span>Branch template</span>- <SaveIndicator state={fieldState("execution_workspace_branch_template")} />- </label>- </div>- <DraftInput- value={executionWorkspaceStrategy.branchTemplate ?? ""}- onCommit={(value) =>- commitField("execution_workspace_branch_template", {- ...updateExecutionWorkspacePolicy({- workspaceStrategy: {- ...executionWorkspaceStrategy,- type: "git_worktree",- branchTemplate: value || null,- },- })!,- })}- immediate- className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"- placeholder="{{issue.identifier}}-{{slug}}"- />- </div>- <div>- <div className="mb-1 flex items-center gap-1.5">- <label className="flex items-center gap-2 text-xs text-muted-foreground">- <span>Worktree parent dir</span>- <SaveIndicator state={fieldState("execution_workspace_worktree_parent_dir")} />- </label>- </div>- <DraftInput- value={executionWorkspaceStrategy.worktreeParentDir ?? ""}- onCommit={(value) =>- commitField("execution_workspace_worktree_parent_dir", {- ...updateExecutionWorkspacePolicy({- workspaceStrategy: {- ...executionWorkspaceStrategy,- type: "git_worktree",- worktreeParentDir: value || null,- },+ <button+ className={cn(+ "relative inline-flex h-5 w-9 items-center rounded-full transition-colors",+ executionWorkspaceDefaultMode === "isolated_workspace" ? "bg-green-600" : "bg-muted",+ )}+ type="button"+ onClick={() =>+ commitField(+ "execution_workspace_default_mode",+ updateExecutionWorkspacePolicy({+ defaultMode:+ executionWorkspaceDefaultMode === "isolated_workspace"+ ? "shared_workspace"+ : "isolated_workspace",})!,- })}- immediate- className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"- placeholder=".paperclip/worktrees"- />+ )}+ >+ <span+ className={cn(+ "inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",+ executionWorkspaceDefaultMode === "isolated_workspace"+ ? "translate-x-4.5"+ : "translate-x-0.5",+ )}+ />+ </button></div>- <div>- <div className="mb-1 flex items-center gap-1.5">- <label className="flex items-center gap-2 text-xs text-muted-foreground">- <span>Provision command</span>- <SaveIndicator state={fieldState("execution_workspace_provision_command")} />- </label>- </div>- <DraftInput- value={executionWorkspaceStrategy.provisionCommand ?? ""}- onCommit={(value) =>- commitField("execution_workspace_provision_command", {- ...updateExecutionWorkspacePolicy({- workspaceStrategy: {- ...executionWorkspaceStrategy,- type: "git_worktree",- provisionCommand: value || null,- },- })!,- })}- immediate- className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"- placeholder="bash ./scripts/provision-worktree.sh"- />++ <div className="border-t border-border/60 pt-2">+ <button+ type="button"+ className="flex w-full items-center gap-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground"+ onClick={() => setExecutionWorkspaceAdvancedOpen((open) => !open)}+ >+ {executionWorkspaceAdvancedOpen+ ? "Hide advanced checkout settings"+ : "Show advanced checkout settings"}+ </button></div>- <div>- <div className="mb-1 flex items-center gap-1.5">- <label className="flex items-center gap-2 text-xs text-muted-foreground">- <span>Teardown command</span>- <SaveIndicator state={fieldState("execution_workspace_teardown_command")} />- </label>++ {executionWorkspaceAdvancedOpen ? (+ <div className="space-y-3">+ <div className="text-xs text-muted-foreground">+ Host-managed implementation: <span className="text-foreground">Git worktree</span>+ </div>+ <div>+ <div className="mb-1 flex items-center gap-1.5">+ <label className="flex items-center gap-2 text-xs text-muted-foreground">+ <span>Base ref</span>+ <SaveIndicator state={fieldState("execution_workspace_base_ref")} />+ </label>+ </div>+ <DraftInput+ value={executionWorkspaceStrategy.baseRef ?? ""}+ onCommit={(value) =>+ commitField("execution_workspace_base_ref", {+ ...updateExecutionWorkspacePolicy({+ workspaceStrategy: {+ ...executionWorkspaceStrategy,+ type: "git_worktree",+ baseRef: value || null,+ },+ })!,+ })}+ immediate+ className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"+ placeholder="origin/main"+ />+ </div>+ <div>+ <div className="mb-1 flex items-center gap-1.5">+ <label className="flex items-center gap-2 text-xs text-muted-foreground">+ <span>Branch template</span>+ <SaveIndicator state={fieldState("execution_workspace_branch_template")} />+ </label>+ </div>+ <DraftInput+ value={executionWorkspaceStrategy.branchTemplate ?? ""}+ onCommit={(value) =>+ commitField("execution_workspace_branch_template", {+ ...updateExecutionWorkspacePolicy({+ workspaceStrategy: {+ ...executionWorkspaceStrategy,+ type: "git_worktree",+ branchTemplate: value || null,+ },+ })!,+ })}+ immediate+ className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"+ placeholder="{{issue.identifier}}-{{slug}}"+ />+ </div>+ <div>+ <div className="mb-1 flex items-center gap-1.5">+ <label className="flex items-center gap-2 text-xs text-muted-foreground">+ <span>Worktree parent dir</span>+ <SaveIndicator state={fieldState("execution_workspace_worktree_parent_dir")} />+ </label>+ </div>+ <DraftInput+ value={executionWorkspaceStrategy.worktreeParentDir ?? ""}+ onCommit={(value) =>+ commitField("execution_workspace_worktree_parent_dir", {+ ...updateExecutionWorkspacePolicy({+ workspaceStrategy: {+ ...executionWorkspaceStrategy,+ type: "git_worktree",+ worktreeParentDir: value || null,+ },+ })!,+ })}+ immediate+ className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"+ placeholder=".paperclip/worktrees"+ />+ </div>+ <div>+ <div className="mb-1 flex items-center gap-1.5">+ <label className="flex items-center gap-2 text-xs text-muted-foreground">+ <span>Provision command</span>+ <SaveIndicator state={fieldState("execution_workspace_provision_command")} />+ </label>+ </div>+ <DraftInput+ value={executionWorkspaceStrategy.provisionCommand ?? ""}+ onCommit={(value) =>+ commitField("execution_workspace_provision_command", {+ ...updateExecutionWorkspacePolicy({+ workspaceStrategy: {+ ...executionWorkspaceStrategy,+ type: "git_worktree",+ provisionCommand: value || null,+ },+ })!,+ })}+ immediate+ className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"+ placeholder="bash ./scripts/provision-worktree.sh"+ />+ </div>+ <div>+ <div className="mb-1 flex items-center gap-1.5">+ <label className="flex items-center gap-2 text-xs text-muted-foreground">+ <span>Teardown command</span>+ <SaveIndicator state={fieldState("execution_workspace_teardown_command")} />+ </label>+ </div>+ <DraftInput+ value={executionWorkspaceStrategy.teardownCommand ?? ""}+ onCommit={(value) =>+ commitField("execution_workspace_teardown_command", {+ ...updateExecutionWorkspacePolicy({+ workspaceStrategy: {+ ...executionWorkspaceStrategy,+ type: "git_worktree",+ teardownCommand: value || null,+ },+ })!,+ })}+ immediate+ className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"+ placeholder="bash ./scripts/teardown-worktree.sh"+ />+ </div>+ <p className="text-[11px] text-muted-foreground">+ Provision runs inside the derived worktree before agent execution. Teardown is stored here for+ future cleanup flows.+ </p></div>- <DraftInput- value={executionWorkspaceStrategy.teardownCommand ?? ""}- onCommit={(value) =>- commitField("execution_workspace_teardown_command", {- ...updateExecutionWorkspacePolicy({- workspaceStrategy: {- ...executionWorkspaceStrategy,- type: "git_worktree",- teardownCommand: value || null,- },- })!,- })}- immediate- className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs font-mono outline-none"- placeholder="bash ./scripts/teardown-worktree.sh"- />- </div>- <p className="text-[11px] text-muted-foreground">- Provision runs inside the derived worktree before agent execution. Teardown is stored here for- future cleanup flows.- </p>+ ) : null}</div>- )}- </>- )}- </div>- </div>+ ) : null}+ </div>+ </div>+ </>+ ) : null}</div>diff --git a/ui/src/lib/instance-settings.test.ts b/ui/src/lib/instance-settings.test.tsnew file mode 100644index 0000000000..74ef01a093--- /dev/null+++ b/ui/src/lib/instance-settings.test.ts@@ -0,0 +1,23 @@+import { describe, expect, it } from "vitest";+import {+ DEFAULT_INSTANCE_SETTINGS_PATH,+ normalizeRememberedInstanceSettingsPath,+} from "./instance-settings";++describe("normalizeRememberedInstanceSettingsPath", () => {+ it("keeps known instance settings pages", () => {+ expect(normalizeRememberedInstanceSettingsPath("/instance/settings/experimental")).toBe(+ "/instance/settings/experimental",+ );+ expect(normalizeRememberedInstanceSettingsPath("/instance/settings/plugins/example?tab=config#logs")).toBe(+ "/instance/settings/plugins/example?tab=config#logs",+ );+ });++ it("falls back to the default page for unknown paths", () => {+ expect(normalizeRememberedInstanceSettingsPath("/instance/settings/nope")).toBe(+ DEFAULT_INSTANCE_SETTINGS_PATH,+ );+ expect(normalizeRememberedInstanceSettingsPath(null)).toBe(DEFAULT_INSTANCE_SETTINGS_PATH);+ });+});diff --git a/ui/src/lib/instance-settings.ts b/ui/src/lib/instance-settings.tsnew file mode 100644index 0000000000..c4bc3b9f20--- /dev/null+++ b/ui/src/lib/instance-settings.ts@@ -0,0 +1,24 @@+export const DEFAULT_INSTANCE_SETTINGS_PATH = "/instance/settings/heartbeats";++export function normalizeRememberedInstanceSettingsPath(rawPath: string | null): string {+ if (!rawPath) return DEFAULT_INSTANCE_SETTINGS_PATH;++ const match = rawPath.match(/^([^?#]*)(\?[^#]*)?(#.*)?$/);+ const pathname = match?.[1] ?? rawPath;+ const search = match?.[2] ?? "";+ const hash = match?.[3] ?? "";++ if (+ pathname === "/instance/settings/heartbeats" ||+ pathname === "/instance/settings/plugins" ||+ pathname === "/instance/settings/experimental"+ ) {+ return `${pathname}${search}${hash}`;+ }++ if (/^\/instance\/settings\/plugins\/[^/?#]+$/.test(pathname)) {+ return `${pathname}${search}${hash}`;+ }++ return DEFAULT_INSTANCE_SETTINGS_PATH;+}diff --git a/ui/src/lib/queryKeys.ts b/ui/src/lib/queryKeys.tsindex dbef667366..45fe2eb36e 100644--- a/ui/src/lib/queryKeys.ts+++ b/ui/src/lib/queryKeys.ts@@ -69,6 +69,7 @@ export const queryKeys = {},instance: {schedulerHeartbeats: ["instance", "scheduler-heartbeats"] as const,+ experimentalSettings: ["instance", "experimental-settings"] as const,},health: ["health"] as const,secrets: {diff --git a/ui/src/pages/InstanceExperimentalSettings.tsx b/ui/src/pages/InstanceExperimentalSettings.tsxnew file mode 100644index 0000000000..0a19ffd2ef--- /dev/null+++ b/ui/src/pages/InstanceExperimentalSettings.tsx@@ -0,0 +1,102 @@+import { useEffect, useState } from "react";+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import { FlaskConical } from "lucide-react";+import { instanceSettingsApi } from "@/api/instanceSettings";+import { useBreadcrumbs } from "../context/BreadcrumbContext";+import { queryKeys } from "../lib/queryKeys";+import { cn } from "../lib/utils";++export function InstanceExperimentalSettings() {+ const { setBreadcrumbs } = useBreadcrumbs();+ const queryClient = useQueryClient();+ const [actionError, setActionError] = useState<string | null>(null);++ useEffect(() => {+ setBreadcrumbs([+ { label: "Instance Settings" },+ { label: "Experimental" },+ ]);+ }, [setBreadcrumbs]);++ const experimentalQuery = useQuery({+ queryKey: queryKeys.instance.experimentalSettings,+ queryFn: () => instanceSettingsApi.getExperimental(),+ });++ const toggleMutation = useMutation({+ mutationFn: async (enabled: boolean) =>+ instanceSettingsApi.updateExperimental({ enableIsolatedWorkspaces: enabled }),+ onSuccess: async () => {+ setActionError(null);+ await queryClient.invalidateQueries({ queryKey: queryKeys.instance.experimentalSettings });+ },+ onError: (error) => {+ setActionError(error instanceof Error ? error.message : "Failed to update experimental settings.");+ },+ });++ if (experimentalQuery.isLoading) {+ return <div className="text-sm text-muted-foreground">Loading experimental settings...</div>;+ }++ if (experimentalQuery.error) {+ return (+ <div className="text-sm text-destructive">+ {experimentalQuery.error instanceof Error+ ? experimentalQuery.error.message+ : "Failed to load experimental settings."}+ </div>+ );+ }++ const enableIsolatedWorkspaces = experimentalQuery.data?.enableIsolatedWorkspaces === true;++ return (+ <div className="max-w-4xl space-y-6">+ <div className="space-y-2">+ <div className="flex items-center gap-2">+ <FlaskConical className="h-5 w-5 text-muted-foreground" />+ <h1 className="text-lg font-semibold">Experimental</h1>+ </div>+ <p className="text-sm text-muted-foreground">+ Opt into features that are still being evaluated before they become default behavior.+ </p>+ </div>++ {actionError && (+ <div className="rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive">+ {actionError}+ </div>+ )}++ <section className="rounded-xl border border-border bg-card p-5">+ <div className="flex items-start justify-between gap-4">+ <div className="space-y-1.5">+ <h2 className="text-sm font-semibold">Enabled Isolated Workspaces</h2>+ <p className="max-w-2xl text-sm text-muted-foreground">+ Show execution workspace controls in project configuration and allow isolated workspace behavior for new+ and existing issue runs.+ </p>+ </div>+ <button+ type="button"+ aria-label="Toggle isolated workspaces experimental setting"+ disabled={toggleMutation.isPending}+ className={cn(+ "relative inline-flex h-6 w-11 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60",+ enableIsolatedWorkspaces ? "bg-green-600" : "bg-muted",+ )}+ onClick={() => toggleMutation.mutate(!enableIsolatedWorkspaces)}+ >+ <span+ className={cn(+ "inline-block h-4.5 w-4.5 rounded-full bg-white transition-transform",+ enableIsolatedWorkspaces ? "translate-x-6" : "translate-x-0.5",+ )}+ />+ </button>+ </div>+ </section>+ </div>+ );+}