Skip to content

The open-source app everyone uses to manage agents at work

Merge remote-tracking branch 'public-gh/master' into paperclip-subissues

Dotta8cf85a5a5036
diff --cc packages/db/src/migrations/0029_modern_paper_doll.sql
index e19de7857a,0000000000..e19de7857a
mode 100644,000000..100644
--- a/packages/db/src/migrations/0029_modern_paper_doll.sql
+++ b/packages/db/src/migrations/0029_modern_paper_doll.sql
diff --cc packages/db/src/migrations/meta/0029_snapshot.json
index 0000000000,0000000000..ffdefa9e86
new file mode 100644
--- /dev/null
+++ b/packages/db/src/migrations/meta/0029_snapshot.json
@@@ -1,0 -1,0 +1,7630 @@@
++{
++ "id": "8a988f9e-ddc3-414b-8f11-6ecd5cbb800c",
++ "prevId": "6fe59d88-aadc-4acb-acf4-ea60b7dbc7dc",
++ "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
++ },
++ "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.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'"
++ },
++ "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_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
++ },
++ "billing_code": {
++ "name": "billing_code",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false
++ },
++ "provider": {
++ "name": "provider",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true
++ },
++ "model": {
++ "name": "model",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true
++ },
++ "input_tokens": {
++ "name": "input_tokens",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "default": 0
++ },
++ "output_tokens": {
++ "name": "output_tokens",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "default": 0
++ },
++ "cost_cents": {
++ "name": "cost_cents",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true
++ },
++ "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": {}
++ }
++ },
++ "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"
++ }
++ },
++ "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.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_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.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
++ },
++ "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": {}
++ }
++}
diff --cc packages/db/src/migrations/meta/_journal.json
index 56e8c493fb,59741caede..a54279d113
--- a/packages/db/src/migrations/meta/_journal.json
+++ b/packages/db/src/migrations/meta/_journal.json
@@@ -201,9 -201,9 +201,16 @@@
{
"idx": 28,
"version": "7",
- "when": 1773439626334,
- "tag": "0028_unusual_the_hunter",
+ "when": 1773432085646,
+ "tag": "0028_harsh_goliath",
+ "breakpoints": true
++ },
++ {
++ "idx": 29,
++ "version": "7",
++ "when": 1773508957274,
++ "tag": "0029_modern_paper_doll",
+ "breakpoints": true
}
]
}
diff --cc packages/shared/src/index.ts
index 7ba01e4080,33a92c2b8c..f3badc2bf4
--- a/packages/shared/src/index.ts
+++ b/packages/shared/src/index.ts
@@@ -181,13 -177,9 +186,16 @@@ export
addIssueCommentSchema,
linkIssueApprovalSchema,
createIssueAttachmentMetadataSchema,
+ createIssueWorkProductSchema,
+ updateIssueWorkProductSchema,
+ issueWorkProductTypeSchema,
+ issueWorkProductStatusSchema,
+ issueWorkProductReviewStateSchema,
+ updateExecutionWorkspaceSchema,
+ executionWorkspaceStatusSchema,
+ issueDocumentFormatSchema,
+ issueDocumentKeySchema,
+ upsertIssueDocumentSchema,
type CreateIssue,
type CreateIssueLabel,
type UpdateIssue,
@@@ -195,9 -187,8 +203,11 @@@
type AddIssueComment,
type LinkIssueApproval,
type CreateIssueAttachmentMetadata,
+ type CreateIssueWorkProduct,
+ type UpdateIssueWorkProduct,
+ type UpdateExecutionWorkspace,
+ type IssueDocumentFormat,
+ type UpsertIssueDocument,
createGoalSchema,
updateGoalSchema,
type CreateGoal,
diff --cc packages/shared/src/types/issue.ts
index a8bc63d53c,94e482c325..662d44e1a1
--- a/packages/shared/src/types/issue.ts
+++ b/packages/shared/src/types/issue.ts
@@@ -85,10 -124,11 +128,13 @@@ export interface Issue
hiddenAt: Date | null;
labelIds?: string[];
labels?: IssueLabel[];
+ planDocument?: IssueDocument | null;
+ documentSummaries?: IssueDocumentSummary[];
+ legacyPlanDocument?: LegacyPlanDocument | null;
project?: Project | null;
goal?: Goal | null;
+ currentExecutionWorkspace?: ExecutionWorkspace | null;
+ workProducts?: IssueWorkProduct[];
mentionedProjects?: Project[];
myLastTouchAt?: Date | null;
lastExternalCommentAt?: Date | null;
diff --cc packages/shared/src/validators/index.ts
index 44779c99ec,6f19a33336..03af0c6918
--- a/packages/shared/src/validators/index.ts
+++ b/packages/shared/src/validators/index.ts
@@@ -74,24 -77,10 +77,26 @@@ export
type AddIssueComment,
type LinkIssueApproval,
type CreateIssueAttachmentMetadata,
+ type IssueDocumentFormat,
+ type UpsertIssueDocument,
} from "./issue.js";
+export {
+ createIssueWorkProductSchema,
+ updateIssueWorkProductSchema,
+ issueWorkProductTypeSchema,
+ issueWorkProductStatusSchema,
+ issueWorkProductReviewStateSchema,
+ type CreateIssueWorkProduct,
+ type UpdateIssueWorkProduct,
+} from "./work-product.js";
+
+export {
+ updateExecutionWorkspaceSchema,
+ executionWorkspaceStatusSchema,
+ type UpdateExecutionWorkspace,
+} from "./execution-workspace.js";
+
export {
createGoalSchema,
updateGoalSchema,
diff --cc server/src/routes/issues.ts
index 3aaa03fa72,c745277b2e..c4046c7102
--- a/server/src/routes/issues.ts
+++ b/server/src/routes/issues.ts
@@@ -9,7 -8,8 +9,9 @@@ import
checkoutIssueSchema,
createIssueSchema,
linkIssueApprovalSchema,
+ issueDocumentKeySchema,
+ updateIssueWorkProductSchema,
+ upsertIssueDocumentSchema,
updateIssueSchema,
} from "@paperclipai/shared";
import type { StorageService } from "../storage/types.js";
@@@ -22,9 -21,9 +24,10 @@@ import
heartbeatService,
issueApprovalService,
issueService,
+ documentService,
logActivity,
projectService,
+ workProductService,
} from "../services/index.js";
import { logger } from "../middleware/logger.js";
import { forbidden, HttpError, unauthorized } from "../errors.js";
@@@ -41,8 -42,7 +46,9 @@@ export function issueRoutes(db: Db, sto
const projectsSvc = projectService(db);
const goalsSvc = goalService(db);
const issueApprovalsSvc = issueApprovalService(db);
+ const executionWorkspacesSvc = executionWorkspaceService(db);
+ const workProductsSvc = workProductService(db);
+ const documentsSvc = documentService(db);
const upload = multer({
storage: multer.memoryStorage(),
limits: { fileSize: MAX_ATTACHMENT_BYTES, files: 1 },
@@@ -326,105 -322,219 +334,318 @@@
});
});
+ router.get("/issues/:id/heartbeat-context", async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+
+ const wakeCommentId =
+ typeof req.query.wakeCommentId === "string" && req.query.wakeCommentId.trim().length > 0
+ ? req.query.wakeCommentId.trim()
+ : null;
+
+ const [ancestors, project, goal, commentCursor, wakeComment] = await Promise.all([
+ svc.getAncestors(issue.id),
+ issue.projectId ? projectsSvc.getById(issue.projectId) : null,
+ issue.goalId
+ ? goalsSvc.getById(issue.goalId)
+ : !issue.projectId
+ ? goalsSvc.getDefaultCompanyGoal(issue.companyId)
+ : null,
+ svc.getCommentCursor(issue.id),
+ wakeCommentId ? svc.getComment(wakeCommentId) : null,
+ ]);
+
+ res.json({
+ issue: {
+ id: issue.id,
+ identifier: issue.identifier,
+ title: issue.title,
+ description: issue.description,
+ status: issue.status,
+ priority: issue.priority,
+ projectId: issue.projectId,
+ goalId: goal?.id ?? issue.goalId,
+ parentId: issue.parentId,
+ assigneeAgentId: issue.assigneeAgentId,
+ assigneeUserId: issue.assigneeUserId,
+ updatedAt: issue.updatedAt,
+ },
+ ancestors: ancestors.map((ancestor) => ({
+ id: ancestor.id,
+ identifier: ancestor.identifier,
+ title: ancestor.title,
+ status: ancestor.status,
+ priority: ancestor.priority,
+ })),
+ project: project
+ ? {
+ id: project.id,
+ name: project.name,
+ status: project.status,
+ targetDate: project.targetDate,
+ }
+ : null,
+ goal: goal
+ ? {
+ id: goal.id,
+ title: goal.title,
+ status: goal.status,
+ level: goal.level,
+ parentId: goal.parentId,
+ }
+ : null,
+ commentCursor,
+ wakeComment:
+ wakeComment && wakeComment.issueId === issue.id
+ ? wakeComment
+ : null,
+ });
+ });
+
+ router.get("/issues/:id/work-products", async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ const workProducts = await workProductsSvc.listForIssue(issue.id);
+ res.json(workProducts);
+ });
+
+ router.get("/issues/:id/documents", async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ const docs = await documentsSvc.listIssueDocuments(issue.id);
+ res.json(docs);
+ });
+
+ router.get("/issues/:id/documents/:key", async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ const keyParsed = issueDocumentKeySchema.safeParse(String(req.params.key ?? "").trim().toLowerCase());
+ if (!keyParsed.success) {
+ res.status(400).json({ error: "Invalid document key", details: keyParsed.error.issues });
+ return;
+ }
+ const doc = await documentsSvc.getIssueDocumentByKey(issue.id, keyParsed.data);
+ if (!doc) {
+ res.status(404).json({ error: "Document not found" });
+ return;
+ }
+ res.json(doc);
+ });
+
+ router.put("/issues/:id/documents/:key", validate(upsertIssueDocumentSchema), async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ const keyParsed = issueDocumentKeySchema.safeParse(String(req.params.key ?? "").trim().toLowerCase());
+ if (!keyParsed.success) {
+ res.status(400).json({ error: "Invalid document key", details: keyParsed.error.issues });
+ return;
+ }
+
+ const actor = getActorInfo(req);
+ const result = await documentsSvc.upsertIssueDocument({
+ issueId: issue.id,
+ key: keyParsed.data,
+ title: req.body.title ?? null,
+ format: req.body.format,
+ body: req.body.body,
+ changeSummary: req.body.changeSummary ?? null,
+ baseRevisionId: req.body.baseRevisionId ?? null,
+ createdByAgentId: actor.agentId ?? null,
+ createdByUserId: actor.actorType === "user" ? actor.actorId : null,
+ });
+ const doc = result.document;
+
+ await logActivity(db, {
+ companyId: issue.companyId,
+ actorType: actor.actorType,
+ actorId: actor.actorId,
+ agentId: actor.agentId,
+ runId: actor.runId,
+ action: result.created ? "issue.document_created" : "issue.document_updated",
+ entityType: "issue",
+ entityId: issue.id,
+ details: {
+ key: doc.key,
+ documentId: doc.id,
+ title: doc.title,
+ format: doc.format,
+ revisionNumber: doc.latestRevisionNumber,
+ },
+ });
+
+ res.status(result.created ? 201 : 200).json(doc);
+ });
+
+ router.get("/issues/:id/documents/:key/revisions", async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ const keyParsed = issueDocumentKeySchema.safeParse(String(req.params.key ?? "").trim().toLowerCase());
+ if (!keyParsed.success) {
+ res.status(400).json({ error: "Invalid document key", details: keyParsed.error.issues });
+ return;
+ }
+ const revisions = await documentsSvc.listIssueDocumentRevisions(issue.id, keyParsed.data);
+ res.json(revisions);
+ });
+
+ router.delete("/issues/:id/documents/:key", async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ if (req.actor.type !== "board") {
+ res.status(403).json({ error: "Board authentication required" });
+ return;
+ }
+ const keyParsed = issueDocumentKeySchema.safeParse(String(req.params.key ?? "").trim().toLowerCase());
+ if (!keyParsed.success) {
+ res.status(400).json({ error: "Invalid document key", details: keyParsed.error.issues });
+ return;
+ }
+ const removed = await documentsSvc.deleteIssueDocument(issue.id, keyParsed.data);
+ if (!removed) {
+ res.status(404).json({ error: "Document not found" });
+ return;
+ }
+ const actor = getActorInfo(req);
+ await logActivity(db, {
+ companyId: issue.companyId,
+ actorType: actor.actorType,
+ actorId: actor.actorId,
+ agentId: actor.agentId,
+ runId: actor.runId,
+ action: "issue.document_deleted",
+ entityType: "issue",
+ entityId: issue.id,
+ details: {
+ key: removed.key,
+ documentId: removed.id,
+ title: removed.title,
+ },
+ });
+ res.json({ ok: true });
+ });
+
+ router.post("/issues/:id/work-products", validate(createIssueWorkProductSchema), async (req, res) => {
+ const id = req.params.id as string;
+ const issue = await svc.getById(id);
+ if (!issue) {
+ res.status(404).json({ error: "Issue not found" });
+ return;
+ }
+ assertCompanyAccess(req, issue.companyId);
+ const product = await workProductsSvc.createForIssue(issue.id, issue.companyId, {
+ ...req.body,
+ projectId: req.body.projectId ?? issue.projectId ?? null,
+ });
+ if (!product) {
+ res.status(422).json({ error: "Invalid work product payload" });
+ return;
+ }
+ const actor = getActorInfo(req);
+ await logActivity(db, {
+ companyId: issue.companyId,
+ actorType: actor.actorType,
+ actorId: actor.actorId,
+ agentId: actor.agentId,
+ runId: actor.runId,
+ action: "issue.work_product_created",
+ entityType: "issue",
+ entityId: issue.id,
+ details: { workProductId: product.id, type: product.type, provider: product.provider },
+ });
+ res.status(201).json(product);
+ });
+
+ router.patch("/work-products/:id", validate(updateIssueWorkProductSchema), async (req, res) => {
+ const id = req.params.id as string;
+ const existing = await workProductsSvc.getById(id);
+ if (!existing) {
+ res.status(404).json({ error: "Work product not found" });
+ return;
+ }
+ assertCompanyAccess(req, existing.companyId);
+ const product = await workProductsSvc.update(id, req.body);
+ if (!product) {
+ res.status(404).json({ error: "Work product not found" });
+ return;
+ }
+ const actor = getActorInfo(req);
+ await logActivity(db, {
+ companyId: existing.companyId,
+ actorType: actor.actorType,
+ actorId: actor.actorId,
+ agentId: actor.agentId,
+ runId: actor.runId,
+ action: "issue.work_product_updated",
+ entityType: "issue",
+ entityId: existing.issueId,
+ details: { workProductId: product.id, changedKeys: Object.keys(req.body).sort() },
+ });
+ res.json(product);
+ });
+
+ router.delete("/work-products/:id", async (req, res) => {
+ const id = req.params.id as string;
+ const existing = await workProductsSvc.getById(id);
+ if (!existing) {
+ res.status(404).json({ error: "Work product not found" });
+ return;
+ }
+ assertCompanyAccess(req, existing.companyId);
+ const removed = await workProductsSvc.remove(id);
+ if (!removed) {
+ res.status(404).json({ error: "Work product not found" });
+ return;
+ }
+ const actor = getActorInfo(req);
+ await logActivity(db, {
+ companyId: existing.companyId,
+ actorType: actor.actorType,
+ actorId: actor.actorId,
+ agentId: actor.agentId,
+ runId: actor.runId,
+ action: "issue.work_product_deleted",
+ entityType: "issue",
+ entityId: existing.issueId,
+ details: { workProductId: removed.id, type: removed.type },
+ });
+ res.json(removed);
+ });
+
router.post("/issues/:id/read", async (req, res) => {
const id = req.params.id as string;
const issue = await svc.getById(id);
diff --cc server/src/services/issues.ts
index a76258c753,51d4dcb424..dcace41b68
--- a/server/src/services/issues.ts
+++ b/server/src/services/issues.ts
@@@ -5,9 -5,9 +5,10 @@@ import
assets,
companies,
companyMemberships,
+ documents,
goals,
heartbeatRuns,
+ executionWorkspaces,
issueAttachments,
issueLabels,
issueComments,
diff --cc ui/src/api/issues.ts
index 1d99d9fc72,f6fe8b9dc4..3153f9284b
--- a/ui/src/api/issues.ts
+++ b/ui/src/api/issues.ts
@@@ -1,4 -1,13 +1,14 @@@
- import type { Approval, Issue, IssueAttachment, IssueComment, IssueLabel, IssueWorkProduct } from "@paperclipai/shared";
+ import type {
+ Approval,
+ DocumentRevision,
+ Issue,
+ IssueAttachment,
+ IssueComment,
+ IssueDocument,
+ IssueLabel,
++ IssueWorkProduct,
+ UpsertIssueDocument,
+ } from "@paperclipai/shared";
import { api } from "./client";
export const issuesApi = {
diff --cc ui/src/components/NewIssueDialog.tsx
index 1b084c81d4,dc2d73c736..32195ab55c
--- a/ui/src/components/NewIssueDialog.tsx
+++ b/ui/src/components/NewIssueDialog.tsx
@@@ -63,18 -71,25 +71,28 @@@ interface IssueDraft
description: string;
status: string;
priority: string;
- assigneeId: string;
+ assigneeValue: string;
+ assigneeId?: string;
projectId: string;
+ projectWorkspaceId?: string;
assigneeModelOverride: string;
assigneeThinkingEffort: string;
assigneeChrome: boolean;
- useIsolatedExecutionWorkspace: boolean;
+ executionWorkspaceMode?: string;
+ selectedExecutionWorkspaceId?: string;
+ useIsolatedExecutionWorkspace?: boolean;
}
+ type StagedIssueFile = {
+ id: string;
+ file: File;
+ kind: "document" | "attachment";
+ documentKey?: string;
+ title?: string | null;
+ };
+
const ISSUE_OVERRIDE_ADAPTER_TYPES = new Set(["claude_local", "codex_local", "opencode_local"]);
+ const STAGED_FILE_ACCEPT = "image/*,application/pdf,text/plain,text/markdown,application/json,text/csv,text/html,.md,.markdown";
const ISSUE_THINKING_EFFORT_OPTIONS = {
claude_local: [
@@@ -209,23 -239,23 +280,26 @@@ function issueExecutionWorkspaceModeFor
export function NewIssueDialog() {
const { newIssueOpen, newIssueDefaults, closeNewIssue } = useDialog();
const { companies, selectedCompanyId, selectedCompany } = useCompany();
+ const { enabled: showExperimentalWorkspaceUi } = useExperimentalWorkspacesEnabled();
const queryClient = useQueryClient();
+ const { pushToast } = useToast();
const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
const [status, setStatus] = useState("todo");
const [priority, setPriority] = useState("");
- const [assigneeId, setAssigneeId] = useState("");
+ const [assigneeValue, setAssigneeValue] = useState("");
const [projectId, setProjectId] = useState("");
+ const [projectWorkspaceId, setProjectWorkspaceId] = useState("");
const [assigneeOptionsOpen, setAssigneeOptionsOpen] = useState(false);
const [assigneeModelOverride, setAssigneeModelOverride] = useState("");
const [assigneeThinkingEffort, setAssigneeThinkingEffort] = useState("");
const [assigneeChrome, setAssigneeChrome] = useState(false);
- const [useIsolatedExecutionWorkspace, setUseIsolatedExecutionWorkspace] = useState(false);
+ const [executionWorkspaceMode, setExecutionWorkspaceMode] = useState<string>("shared_workspace");
+ const [selectedExecutionWorkspaceId, setSelectedExecutionWorkspaceId] = useState("");
const [expanded, setExpanded] = useState(false);
const [dialogCompanyId, setDialogCompanyId] = useState<string | null>(null);
+ const [stagedFiles, setStagedFiles] = useState<StagedIssueFile[]>([]);
+ const [isFileDragOver, setIsFileDragOver] = useState(false);
const draftTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const executionWorkspaceDefaultProjectId = useRef<string | null>(null);
@@@ -353,9 -411,8 +469,9 @@@
description,
status,
priority,
- assigneeId,
+ assigneeValue,
projectId,
+ projectWorkspaceId,
assigneeModelOverride,
assigneeThinkingEffort,
assigneeChrome,
@@@ -367,9 -423,8 +483,9 @@@
description,
status,
priority,
- assigneeId,
+ assigneeValue,
projectId,
+ projectWorkspaceId,
assigneeModelOverride,
assigneeThinkingEffort,
assigneeChrome,
@@@ -391,11 -445,8 +507,11 @@@
setDescription(newIssueDefaults.description ?? "");
setStatus(newIssueDefaults.status ?? "todo");
setPriority(newIssueDefaults.priority ?? "");
- setProjectId(newIssueDefaults.projectId ?? "");
+ const defaultProjectId = newIssueDefaults.projectId ?? "";
+ const defaultProject = orderedProjects.find((project) => project.id === defaultProjectId);
+ setProjectId(defaultProjectId);
+ setProjectWorkspaceId(defaultProjectWorkspaceIdForProject(defaultProject));
- setAssigneeId(newIssueDefaults.assigneeAgentId ?? "");
+ setAssigneeValue(assigneeValueFromSelection(newIssueDefaults));
setAssigneeModelOverride("");
setAssigneeThinkingEffort("");
setAssigneeChrome(false);
@@@ -409,26 -456,21 +525,30 @@@
setDescription(draft.description);
setStatus(draft.status || "todo");
setPriority(draft.priority);
- setAssigneeId(newIssueDefaults.assigneeAgentId ?? draft.assigneeId);
+ setAssigneeValue(
+ newIssueDefaults.assigneeAgentId || newIssueDefaults.assigneeUserId
+ ? assigneeValueFromSelection(newIssueDefaults)
+ : (draft.assigneeValue ?? draft.assigneeId ?? ""),
+ );
- setProjectId(newIssueDefaults.projectId ?? draft.projectId);
+ setProjectId(restoredProjectId);
+ setProjectWorkspaceId(draft.projectWorkspaceId ?? defaultProjectWorkspaceIdForProject(restoredProject));
setAssigneeModelOverride(draft.assigneeModelOverride ?? "");
setAssigneeThinkingEffort(draft.assigneeThinkingEffort ?? "");
setAssigneeChrome(draft.assigneeChrome ?? false);
- setUseIsolatedExecutionWorkspace(draft.useIsolatedExecutionWorkspace ?? false);
+ setExecutionWorkspaceMode(
+ draft.executionWorkspaceMode
+ ?? (draft.useIsolatedExecutionWorkspace ? "isolated_workspace" : defaultExecutionWorkspaceModeForProject(restoredProject)),
+ );
+ setSelectedExecutionWorkspaceId(draft.selectedExecutionWorkspaceId ?? "");
+ executionWorkspaceDefaultProjectId.current = restoredProjectId || null;
} else {
+ const defaultProjectId = newIssueDefaults.projectId ?? "";
+ const defaultProject = orderedProjects.find((project) => project.id === defaultProjectId);
setStatus(newIssueDefaults.status ?? "todo");
setPriority(newIssueDefaults.priority ?? "");
- setProjectId(newIssueDefaults.projectId ?? "");
+ setProjectId(defaultProjectId);
+ setProjectWorkspaceId(defaultProjectWorkspaceIdForProject(defaultProject));
- setAssigneeId(newIssueDefaults.assigneeAgentId ?? "");
+ setAssigneeValue(assigneeValueFromSelection(newIssueDefaults));
setAssigneeModelOverride("");
setAssigneeThinkingEffort("");
setAssigneeChrome(false);
@@@ -470,17 -510,17 +590,19 @@@
setDescription("");
setStatus("todo");
setPriority("");
- setAssigneeId("");
+ setAssigneeValue("");
setProjectId("");
+ setProjectWorkspaceId("");
setAssigneeOptionsOpen(false);
setAssigneeModelOverride("");
setAssigneeThinkingEffort("");
setAssigneeChrome(false);
- setUseIsolatedExecutionWorkspace(false);
+ setExecutionWorkspaceMode("shared_workspace");
+ setSelectedExecutionWorkspaceId("");
setExpanded(false);
setDialogCompanyId(null);
+ setStagedFiles([]);
+ setIsFileDragOver(false);
setCompanyOpen(false);
executionWorkspaceDefaultProjectId.current = null;
}
@@@ -488,9 -528,8 +610,9 @@@
function handleCompanyChange(companyId: string) {
if (companyId === effectiveCompanyId) return;
setDialogCompanyId(companyId);
- setAssigneeId("");
+ setAssigneeValue("");
setProjectId("");
+ setProjectWorkspaceId("");
setAssigneeModelOverride("");
setAssigneeThinkingEffort("");
setAssigneeChrome(false);
@@@ -532,14 -566,10 +655,15 @@@
description: description.trim() || undefined,
status,
priority: priority || "medium",
- ...(assigneeId ? { assigneeAgentId: assigneeId } : {}),
+ ...(selectedAssigneeAgentId ? { assigneeAgentId: selectedAssigneeAgentId } : {}),
+ ...(selectedAssigneeUserId ? { assigneeUserId: selectedAssigneeUserId } : {}),
...(projectId ? { projectId } : {}),
+ ...(projectWorkspaceId ? { projectWorkspaceId } : {}),
...(assigneeAdapterOverrides ? { assigneeAdapterOverrides } : {}),
+ ...(executionWorkspacePolicy?.enabled ? { executionWorkspacePreference: executionWorkspaceMode } : {}),
+ ...(executionWorkspaceMode === "reuse_existing" && selectedExecutionWorkspaceId
+ ? { executionWorkspaceId: selectedExecutionWorkspaceId }
+ : {}),
...(executionWorkspaceSettings ? { executionWorkspaceSettings } : {}),
});
}
@@@ -566,13 -615,43 +709,44 @@@
}
}
- const hasDraft = title.trim().length > 0 || description.trim().length > 0;
+ function handleFileDragEnter(evt: DragEvent<HTMLDivElement>) {
+ if (!evt.dataTransfer.types.includes("Files")) return;
+ evt.preventDefault();
+ setIsFileDragOver(true);
+ }
+
+ function handleFileDragOver(evt: DragEvent<HTMLDivElement>) {
+ if (!evt.dataTransfer.types.includes("Files")) return;
+ evt.preventDefault();
+ evt.dataTransfer.dropEffect = "copy";
+ setIsFileDragOver(true);
+ }
+
+ function handleFileDragLeave(evt: DragEvent<HTMLDivElement>) {
+ if (evt.currentTarget.contains(evt.relatedTarget as Node | null)) return;
+ setIsFileDragOver(false);
+ }
+
+ function handleFileDrop(evt: DragEvent<HTMLDivElement>) {
+ if (!evt.dataTransfer.files.length) return;
+ evt.preventDefault();
+ setIsFileDragOver(false);
+ stageFiles(Array.from(evt.dataTransfer.files));
+ }
+
+ function removeStagedFile(id: string) {
+ setStagedFiles((current) => current.filter((file) => file.id !== id));
+ }
+
+ const hasDraft = title.trim().length > 0 || description.trim().length > 0 || stagedFiles.length > 0;
const currentStatus = statuses.find((s) => s.value === status) ?? statuses[1]!;
const currentPriority = priorities.find((p) => p.value === priority);
- const currentAssignee = (agents ?? []).find((a) => a.id === assigneeId);
+ const currentAssignee = selectedAssigneeAgentId
+ ? (agents ?? []).find((a) => a.id === selectedAssigneeAgentId)
+ : null;
const currentProject = orderedProjects.find((project) => project.id === projectId);
- const currentProjectExecutionWorkspacePolicy = SHOW_EXPERIMENTAL_ISSUE_WORKTREE_UI
+ const currentProjectWorkspaces = currentProject?.workspaces ?? [];
+ const currentProjectExecutionWorkspacePolicy = showExperimentalWorkspaceUi
? currentProject?.executionWorkspacePolicy ?? null
: null;
const currentProjectSupportsExecutionWorkspace = Boolean(currentProjectExecutionWorkspacePolicy?.enabled);
diff --cc ui/src/pages/IssueDetail.tsx
index fb4d50fbfc,b96ca7dbf1..711d25d878
--- a/ui/src/pages/IssueDetail.tsx
+++ b/ui/src/pages/IssueDetail.tsx
@@@ -186,13 -202,7 +228,14 @@@ export function IssueDetail()
cost: false,
});
const [attachmentError, setAttachmentError] = useState<string | null>(null);
+ const [newWorkProductType, setNewWorkProductType] = useState<IssueWorkProduct["type"]>("preview_url");
+ const [newWorkProductProvider, setNewWorkProductProvider] = useState("paperclip");
+ const [newWorkProductTitle, setNewWorkProductTitle] = useState("");
+ const [newWorkProductUrl, setNewWorkProductUrl] = useState("");
+ const [newWorkProductStatus, setNewWorkProductStatus] = useState<IssueWorkProduct["status"]>("active");
+ const [newWorkProductReviewState, setNewWorkProductReviewState] = useState<IssueWorkProduct["reviewState"]>("none");
+ const [newWorkProductSummary, setNewWorkProductSummary] = useState("");
+ const [attachmentDragActive, setAttachmentDragActive] = useState(false);
const fileInputRef = useRef<HTMLInputElement | null>(null);
const lastMarkedReadIssueIdRef = useRef<string | null>(null);
@@@ -418,9 -427,9 +460,10 @@@
queryClient.invalidateQueries({ queryKey: queryKeys.issues.runs(issueId!) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.approvals(issueId!) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.attachments(issueId!) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.issues.documents(issueId!) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.liveRuns(issueId!) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.activeRun(issueId!) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.issues.workProducts(issueId!) });
if (selectedCompanyId) {
queryClient.invalidateQueries({ queryKey: queryKeys.issues.list(selectedCompanyId) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.listTouchedByMe(selectedCompanyId) });
@@@ -578,16 -575,17 +645,22 @@@
// Ancestors are returned oldest-first from the server (root at end, immediate parent at start)
const ancestors = issue.ancestors ?? [];
+ const workProducts = issue.workProducts ?? [];
+ const showOutputsTab =
+ experimentalWorkspacesEnabled ||
+ Boolean(issue.currentExecutionWorkspace) ||
+ workProducts.length > 0;
const handleFilePicked = async (evt: ChangeEvent<HTMLInputElement>) => {
- const file = evt.target.files?.[0];
- if (!file) return;
- await uploadAttachment.mutateAsync(file);
+ const files = evt.target.files;
+ if (!files || files.length === 0) return;
+ for (const file of Array.from(files)) {
+ if (isMarkdownFile(file)) {
+ await importMarkdownDocument.mutateAsync(file);
+ } else {
+ await uploadAttachment.mutateAsync(file);
+ }
+ }
if (fileInputRef.current) {
fileInputRef.current.value = "";
}