🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(database): add agent_deliveries, an Agent's track record of deliveries (#23462)
Arvin Xu43dfc70aa73f
diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbmlindex 643c5400013..c70ced91baa 100644--- a/docs/development/database-schema.dbml+++ b/docs/development/database-schema.dbml@@ -312,6 +312,70 @@ table agent_cron_jobs {}}+table agent_deliveries {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ agent_id text [not null]+ user_id text [not null]+ workspace_id text+ subject_type text [not null]+ subject_id text [not null]+ parent_delivery_id uuid+ requester_user_id text+ project_id text+ channel_id text+ task_id text+ title text+ summary text+ category text+ outcome text [not null, default: 'unknown']+ outcome_source text+ outcome_confidence real+ shots integer+ frictions jsonb+ total_cost "numeric(20, 6)"+ total_tokens integer+ tool_calls integer+ user_messages integer+ agent_messages integer+ duration_ms integer+ started_at "timestamp with time zone"+ delivered_at "timestamp with time zone"+ settled_at "timestamp with time zone"+ distilled_at "timestamp with time zone"+ metadata jsonb+ accessed_at "timestamp with time zone" [not null, default: `now()`]+ created_at "timestamp with time zone" [not null, default: `now()`]+ updated_at "timestamp with time zone" [not null, default: `now()`]++ indexes {+ (subject_type, subject_id, agent_id) [name: 'agent_deliveries_subject_agent_unique', unique]+ (agent_id, settled_at) [name: 'agent_deliveries_agent_id_settled_at_idx']+ (user_id, settled_at) [name: 'agent_deliveries_user_id_settled_at_idx']+ (workspace_id, settled_at) [name: 'agent_deliveries_workspace_id_settled_at_idx']+ parent_delivery_id [name: 'agent_deliveries_parent_delivery_id_idx']+ project_id [name: 'agent_deliveries_project_id_idx']+ task_id [name: 'agent_deliveries_task_id_idx']+ }+}++table agent_delivery_works {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ delivery_id uuid [not null]+ work_id text [not null]+ workspace_id text+ role text [not null]+ work_version_id uuid+ accessed_at "timestamp with time zone" [not null, default: `now()`]+ created_at "timestamp with time zone" [not null, default: `now()`]+ updated_at "timestamp with time zone" [not null, default: `now()`]++ indexes {+ (delivery_id, work_id) [name: 'agent_delivery_works_delivery_id_work_id_unique', unique]+ work_id [name: 'agent_delivery_works_work_id_idx']+ workspace_id [name: 'agent_delivery_works_workspace_id_idx']+ }+}+table agent_documents {id uuid [pk, not null, default: `gen_random_uuid()`]user_id text [not null]@@ -1920,6 +1984,7 @@ table user_contact_requests {addressee_id text [not null]workspace_id textmessage text+ source jsonbstatus text [not null, default: 'pending']responded_at "timestamp with time zone"accessed_at "timestamp with time zone" [not null, default: `now()`]diff --git a/packages/database/migrations/0224_agent_deliveries_and_contact_request_source.sql b/packages/database/migrations/0224_agent_deliveries_and_contact_request_source.sqlnew file mode 100644index 00000000000..06502692b45--- /dev/null+++ b/packages/database/migrations/0224_agent_deliveries_and_contact_request_source.sql@@ -0,0 +1,83 @@+CREATE TABLE IF NOT EXISTS "agent_deliveries" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "agent_id" text NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "subject_type" text NOT NULL,+ "subject_id" text NOT NULL,+ "parent_delivery_id" uuid,+ "requester_user_id" text,+ "project_id" text,+ "channel_id" text,+ "task_id" text,+ "title" text,+ "summary" text,+ "category" text,+ "outcome" text DEFAULT 'unknown' NOT NULL,+ "outcome_source" text,+ "outcome_confidence" real,+ "shots" integer,+ "frictions" jsonb,+ "total_cost" numeric(20, 6),+ "total_tokens" integer,+ "tool_calls" integer,+ "user_messages" integer,+ "agent_messages" integer,+ "duration_ms" integer,+ "started_at" timestamp with time zone,+ "delivered_at" timestamp with time zone,+ "settled_at" timestamp with time zone,+ "distilled_at" timestamp with time zone,+ "metadata" jsonb,+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "agent_delivery_works" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "delivery_id" uuid NOT NULL,+ "work_id" text NOT NULL,+ "workspace_id" text,+ "role" text NOT NULL,+ "work_version_id" uuid,+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+ALTER TABLE "user_contact_requests" ADD COLUMN IF NOT EXISTS "source" jsonb;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_agent_id_agents_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_parent_delivery_id_agent_deliveries_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_parent_delivery_id_agent_deliveries_id_fk" FOREIGN KEY ("parent_delivery_id") REFERENCES "public"."agent_deliveries"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_requester_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_requester_user_id_users_id_fk" FOREIGN KEY ("requester_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_project_id_projects_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_channel_id_channels_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_channel_id_channels_id_fk" FOREIGN KEY ("channel_id") REFERENCES "public"."channels"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_deliveries" DROP CONSTRAINT IF EXISTS "agent_deliveries_task_id_tasks_id_fk";--> statement-breakpoint+ALTER TABLE "agent_deliveries" ADD CONSTRAINT "agent_deliveries_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_delivery_works" DROP CONSTRAINT IF EXISTS "agent_delivery_works_delivery_id_agent_deliveries_id_fk";--> statement-breakpoint+ALTER TABLE "agent_delivery_works" ADD CONSTRAINT "agent_delivery_works_delivery_id_agent_deliveries_id_fk" FOREIGN KEY ("delivery_id") REFERENCES "public"."agent_deliveries"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_delivery_works" DROP CONSTRAINT IF EXISTS "agent_delivery_works_work_id_works_id_fk";--> statement-breakpoint+ALTER TABLE "agent_delivery_works" ADD CONSTRAINT "agent_delivery_works_work_id_works_id_fk" FOREIGN KEY ("work_id") REFERENCES "public"."works"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_delivery_works" DROP CONSTRAINT IF EXISTS "agent_delivery_works_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "agent_delivery_works" ADD CONSTRAINT "agent_delivery_works_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_delivery_works" DROP CONSTRAINT IF EXISTS "agent_delivery_works_work_version_id_work_versions_id_fk";--> statement-breakpoint+ALTER TABLE "agent_delivery_works" ADD CONSTRAINT "agent_delivery_works_work_version_id_work_versions_id_fk" FOREIGN KEY ("work_version_id") REFERENCES "public"."work_versions"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "agent_deliveries_subject_agent_unique" ON "agent_deliveries" USING btree ("subject_type","subject_id","agent_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_deliveries_agent_id_settled_at_idx" ON "agent_deliveries" USING btree ("agent_id","settled_at");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_deliveries_user_id_settled_at_idx" ON "agent_deliveries" USING btree ("user_id","settled_at");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_deliveries_workspace_id_settled_at_idx" ON "agent_deliveries" USING btree ("workspace_id","settled_at") WHERE "agent_deliveries"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_deliveries_parent_delivery_id_idx" ON "agent_deliveries" USING btree ("parent_delivery_id") WHERE "agent_deliveries"."parent_delivery_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_deliveries_project_id_idx" ON "agent_deliveries" USING btree ("project_id") WHERE "agent_deliveries"."project_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_deliveries_task_id_idx" ON "agent_deliveries" USING btree ("task_id") WHERE "agent_deliveries"."task_id" IS NOT NULL;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "agent_delivery_works_delivery_id_work_id_unique" ON "agent_delivery_works" USING btree ("delivery_id","work_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_delivery_works_work_id_idx" ON "agent_delivery_works" USING btree ("work_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "agent_delivery_works_workspace_id_idx" ON "agent_delivery_works" USING btree ("workspace_id") WHERE "agent_delivery_works"."workspace_id" IS NOT NULL;\ No newline at end of filediff --git a/packages/database/migrations/meta/0214_snapshot.json b/packages/database/migrations/meta/0224_snapshot.jsonsimilarity index 93%rename from packages/database/migrations/meta/0214_snapshot.jsonrename to packages/database/migrations/meta/0224_snapshot.jsonindex 3d8f559095e..a69e9a579dd 100644--- a/packages/database/migrations/meta/0214_snapshot.json+++ b/packages/database/migrations/meta/0224_snapshot.json@@ -6,9 +6,9 @@},"dialect": "postgresql","enums": {},- "id": "3ad7c485-f325-43ae-80bf-417a3e451b33",+ "id": "b5b0e975-6a35-467a-b05a-d4504b1af168","policies": {},- "prevId": "46e3c4ea-97e4-4a8e-87d2-d89b786c7131",+ "prevId": "e4b7cfb6-736f-455b-a78e-7a6383945adc","roles": {},"schemas": {},"sequences": {@@ -2752,8 +2752,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_documents": {- "name": "agent_documents",+ "public.agent_deliveries": {+ "name": "agent_deliveries","schema": "","columns": {"id": {@@ -2763,6 +2763,12 @@"notNull": true,"default": "gen_random_uuid()"},+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },"user_id": {"name": "user_id","type": "text",@@ -2775,103 +2781,170 @@"primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "subject_type": {+ "name": "subject_type","type": "text","primaryKey": false,"notNull": true},- "document_id": {- "name": "document_id",- "type": "varchar(255)",+ "subject_id": {+ "name": "subject_id",+ "type": "text","primaryKey": false,"notNull": true},- "template_id": {- "name": "template_id",- "type": "varchar(100)",+ "parent_delivery_id": {+ "name": "parent_delivery_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "access_self": {- "name": "access_self",- "type": "integer",+ "requester_user_id": {+ "name": "requester_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "category": {+ "name": "category",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text","primaryKey": false,"notNull": true,- "default": 31+ "default": "'unknown'"},- "access_shared": {- "name": "access_shared",+ "outcome_source": {+ "name": "outcome_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "outcome_confidence": {+ "name": "outcome_confidence",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "shots": {+ "name": "shots","type": "integer","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "access_public": {- "name": "access_public",+ "frictions": {+ "name": "frictions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "total_tokens": {+ "name": "total_tokens","type": "integer","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "policy_load": {- "name": "policy_load",- "type": "varchar(30)",+ "tool_calls": {+ "name": "tool_calls",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "'always'"+ "notNull": false},- "policy": {- "name": "policy",- "type": "jsonb",+ "user_messages": {+ "name": "user_messages",+ "type": "integer","primaryKey": false,"notNull": false},- "policy_load_position": {- "name": "policy_load_position",- "type": "varchar(50)",+ "agent_messages": {+ "name": "agent_messages",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "'before-first-user'"+ "notNull": false},- "policy_load_format": {- "name": "policy_load_format",- "type": "varchar(20)",+ "duration_ms": {+ "name": "duration_ms",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "'raw'"+ "notNull": false},- "policy_load_rule": {- "name": "policy_load_rule",- "type": "varchar(50)",+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "'always'"+ "notNull": false},- "deleted_at": {- "name": "deleted_at",+ "delivered_at": {+ "name": "delivered_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "deleted_by_user_id": {- "name": "deleted_by_user_id",- "type": "text",+ "settled_at": {+ "name": "settled_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "deleted_by_agent_id": {- "name": "deleted_by_agent_id",- "type": "text",+ "distilled_at": {+ "name": "distilled_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "delete_reason": {- "name": "delete_reason",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },"created_at": {"name": "created_at","type": "timestamp with time zone",@@ -2888,71 +2961,44 @@}},"indexes": {- "agent_documents_workspace_id_idx": {- "name": "agent_documents_workspace_id_idx",+ "agent_deliveries_subject_agent_unique": {+ "name": "agent_deliveries_subject_agent_unique","columns": [{- "expression": "workspace_id",+ "expression": "subject_type","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_documents_user_id_idx": {- "name": "agent_documents_user_id_idx",- "columns": [+ },{- "expression": "user_id",+ "expression": "subject_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_documents_deleted_by_user_id_idx": {- "name": "agent_documents_deleted_by_user_id_idx",- "columns": [+ },{- "expression": "deleted_by_user_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "agent_documents_agent_id_idx": {- "name": "agent_documents_agent_id_idx",+ "agent_deliveries_agent_id_settled_at_idx": {+ "name": "agent_deliveries_agent_id_settled_at_idx","columns": [{"expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_documents_access_self_idx": {- "name": "agent_documents_access_self_idx",- "columns": [+ },{- "expression": "access_self",+ "expression": "settled_at","isExpression": false,"asc": true,"nulls": "last"@@ -2963,26 +3009,17 @@"method": "btree","with": {}},- "agent_documents_access_shared_idx": {- "name": "agent_documents_access_shared_idx",+ "agent_deliveries_user_id_settled_at_idx": {+ "name": "agent_deliveries_user_id_settled_at_idx","columns": [{- "expression": "access_shared",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_documents_access_public_idx": {- "name": "agent_documents_access_public_idx",- "columns": [+ },{- "expression": "access_public",+ "expression": "settled_at","isExpression": false,"asc": true,"nulls": "last"@@ -2993,149 +3030,247 @@"method": "btree","with": {}},- "agent_documents_policy_load_idx": {- "name": "agent_documents_policy_load_idx",+ "agent_deliveries_workspace_id_settled_at_idx": {+ "name": "agent_deliveries_workspace_id_settled_at_idx","columns": [{- "expression": "policy_load",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_documents_template_id_idx": {- "name": "agent_documents_template_id_idx",- "columns": [+ },{- "expression": "template_id",+ "expression": "settled_at","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"agent_deliveries\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_documents_policy_load_position_idx": {- "name": "agent_documents_policy_load_position_idx",+ "agent_deliveries_parent_delivery_id_idx": {+ "name": "agent_deliveries_parent_delivery_id_idx","columns": [{- "expression": "policy_load_position",+ "expression": "parent_delivery_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"agent_deliveries\".\"parent_delivery_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_documents_policy_load_format_idx": {- "name": "agent_documents_policy_load_format_idx",+ "agent_deliveries_project_id_idx": {+ "name": "agent_deliveries_project_id_idx","columns": [{- "expression": "policy_load_format",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"agent_deliveries\".\"project_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_documents_policy_load_rule_idx": {- "name": "agent_documents_policy_load_rule_idx",+ "agent_deliveries_task_id_idx": {+ "name": "agent_deliveries_task_id_idx","columns": [{- "expression": "policy_load_rule",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_documents_agent_load_position_idx": {- "name": "agent_documents_agent_load_position_idx",- "columns": [- {- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "policy_load_position",+ "expression": "task_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"agent_deliveries\".\"task_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}+ }+ },+ "foreignKeys": {+ "agent_deliveries_agent_id_agents_id_fk": {+ "name": "agent_deliveries_agent_id_agents_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "agent_documents_deleted_at_idx": {- "name": "agent_documents_deleted_at_idx",- "columns": [- {- "expression": "deleted_at",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}+ "agent_deliveries_user_id_users_id_fk": {+ "name": "agent_deliveries_user_id_users_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "agent_documents_agent_autoload_deleted_idx": {- "name": "agent_documents_agent_autoload_deleted_idx",+ "agent_deliveries_workspace_id_workspaces_id_fk": {+ "name": "agent_deliveries_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_deliveries_parent_delivery_id_agent_deliveries_id_fk": {+ "name": "agent_deliveries_parent_delivery_id_agent_deliveries_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "agent_deliveries",+ "columnsFrom": ["parent_delivery_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_deliveries_requester_user_id_users_id_fk": {+ "name": "agent_deliveries_requester_user_id_users_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "users",+ "columnsFrom": ["requester_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_deliveries_project_id_projects_id_fk": {+ "name": "agent_deliveries_project_id_projects_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_deliveries_channel_id_channels_id_fk": {+ "name": "agent_deliveries_channel_id_channels_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_deliveries_task_id_tasks_id_fk": {+ "name": "agent_deliveries_task_id_tasks_id_fk",+ "tableFrom": "agent_deliveries",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_delivery_works": {+ "name": "agent_delivery_works",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "delivery_id": {+ "name": "delivery_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "work_id": {+ "name": "work_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "work_version_id": {+ "name": "work_version_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_delivery_works_delivery_id_work_id_unique": {+ "name": "agent_delivery_works_delivery_id_work_id_unique","columns": [{- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "deleted_at",+ "expression": "delivery_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "policy_load",+ "expression": "work_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "agent_documents_document_id_idx": {- "name": "agent_documents_document_id_idx",+ "agent_delivery_works_work_id_idx": {+ "name": "agent_delivery_works_work_id_idx","columns": [{- "expression": "document_id",+ "expression": "work_id","isExpression": false,"asc": true,"nulls": "last"@@ -3146,85 +3281,56 @@"method": "btree","with": {}},- "agent_documents_agent_document_user_unique": {- "name": "agent_documents_agent_document_user_unique",+ "agent_delivery_works_workspace_id_idx": {+ "name": "agent_delivery_works_workspace_id_idx","columns": [{- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "document_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,+ "where": "\"agent_delivery_works\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_documents_user_id_users_id_fk": {- "name": "agent_documents_user_id_users_id_fk",- "tableFrom": "agent_documents",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_documents_workspace_id_workspaces_id_fk": {- "name": "agent_documents_workspace_id_workspaces_id_fk",- "tableFrom": "agent_documents",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "agent_delivery_works_delivery_id_agent_deliveries_id_fk": {+ "name": "agent_delivery_works_delivery_id_agent_deliveries_id_fk",+ "tableFrom": "agent_delivery_works",+ "tableTo": "agent_deliveries",+ "columnsFrom": ["delivery_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_documents_agent_id_agents_id_fk": {- "name": "agent_documents_agent_id_agents_id_fk",- "tableFrom": "agent_documents",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "agent_delivery_works_work_id_works_id_fk": {+ "name": "agent_delivery_works_work_id_works_id_fk",+ "tableFrom": "agent_delivery_works",+ "tableTo": "works",+ "columnsFrom": ["work_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_documents_document_id_documents_id_fk": {- "name": "agent_documents_document_id_documents_id_fk",- "tableFrom": "agent_documents",- "tableTo": "documents",- "columnsFrom": ["document_id"],+ "agent_delivery_works_workspace_id_workspaces_id_fk": {+ "name": "agent_delivery_works_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_delivery_works",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_documents_deleted_by_user_id_users_id_fk": {- "name": "agent_documents_deleted_by_user_id_users_id_fk",- "tableFrom": "agent_documents",- "tableTo": "users",- "columnsFrom": ["deleted_by_user_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "agent_documents_deleted_by_agent_id_agents_id_fk": {- "name": "agent_documents_deleted_by_agent_id_agents_id_fk",- "tableFrom": "agent_documents",- "tableTo": "agents",- "columnsFrom": ["deleted_by_agent_id"],+ "agent_delivery_works_work_version_id_work_versions_id_fk": {+ "name": "agent_delivery_works_work_version_id_work_versions_id_fk",+ "tableFrom": "agent_delivery_works",+ "tableTo": "work_versions",+ "columnsFrom": ["work_version_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"@@ -3236,8 +3342,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_memories": {- "name": "agent_eval_memories",+ "public.agent_documents": {+ "name": "agent_documents","schema": "","columns": {"id": {@@ -3259,121 +3365,103 @@"primaryKey": false,"notNull": false},- "run_id": {- "name": "run_id",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": true},- "topic_id": {- "name": "topic_id",- "type": "text",+ "document_id": {+ "name": "document_id",+ "type": "varchar(255)","primaryKey": false,- "notNull": false+ "notNull": true},- "thread_id": {- "name": "thread_id",- "type": "text",+ "template_id": {+ "name": "template_id",+ "type": "varchar(100)","primaryKey": false,"notNull": false},- "attempt_id": {- "name": "attempt_id",- "type": "text",+ "access_self": {+ "name": "access_self",+ "type": "integer","primaryKey": false,- "notNull": true- },- "layer": {- "name": "layer",- "type": "text",- "primaryKey": false,- "notNull": true+ "notNull": true,+ "default": 31},- "source": {- "name": "source",- "type": "text",+ "access_shared": {+ "name": "access_shared",+ "type": "integer","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": 0},- "fixture_hash": {- "name": "fixture_hash",- "type": "text",+ "access_public": {+ "name": "access_public",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},- "title": {- "name": "title",- "type": "text",+ "policy_load": {+ "name": "policy_load",+ "type": "varchar(30)","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'always'"},- "summary": {- "name": "summary",- "type": "text",+ "policy": {+ "name": "policy",+ "type": "jsonb","primaryKey": false,"notNull": false},- "details": {- "name": "details",- "type": "text",+ "policy_load_position": {+ "name": "policy_load_position",+ "type": "varchar(50)","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'before-first-user'"},- "memory_category": {- "name": "memory_category",- "type": "text",+ "policy_load_format": {+ "name": "policy_load_format",+ "type": "varchar(20)","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'raw'"},- "memory_type": {- "name": "memory_type",- "type": "text",+ "policy_load_rule": {+ "name": "policy_load_rule",+ "type": "varchar(50)","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'always'"},- "tags": {- "name": "tags",- "type": "jsonb",+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "payload": {- "name": "payload",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "embedding": {- "name": "embedding",- "type": "vector(1024)",+ "deleted_by_user_id": {+ "name": "deleted_by_user_id",+ "type": "text","primaryKey": false,"notNull": false},- "captured_at": {- "name": "captured_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true- },- "removed_reason": {- "name": "removed_reason",+ "deleted_by_agent_id": {+ "name": "deleted_by_agent_id","type": "text","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "delete_reason": {+ "name": "delete_reason",+ "type": "text","primaryKey": false,"notNull": false},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- },"created_at": {"name": "created_at","type": "timestamp with time zone",@@ -3390,11 +3478,11 @@}},"indexes": {- "agent_eval_memories_attempt_id_idx": {- "name": "agent_eval_memories_attempt_id_idx",+ "agent_documents_workspace_id_idx": {+ "name": "agent_documents_workspace_id_idx","columns": [{- "expression": "attempt_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -3405,11 +3493,11 @@"method": "btree","with": {}},- "agent_eval_memories_run_id_idx": {- "name": "agent_eval_memories_run_id_idx",+ "agent_documents_user_id_idx": {+ "name": "agent_documents_user_id_idx","columns": [{- "expression": "run_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -3420,11 +3508,11 @@"method": "btree","with": {}},- "agent_eval_memories_topic_id_idx": {- "name": "agent_eval_memories_topic_id_idx",+ "agent_documents_deleted_by_user_id_idx": {+ "name": "agent_documents_deleted_by_user_id_idx","columns": [{- "expression": "topic_id",+ "expression": "deleted_by_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -3435,11 +3523,11 @@"method": "btree","with": {}},- "agent_eval_memories_thread_id_idx": {- "name": "agent_eval_memories_thread_id_idx",+ "agent_documents_agent_id_idx": {+ "name": "agent_documents_agent_id_idx","columns": [{- "expression": "thread_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"@@ -3450,11 +3538,11 @@"method": "btree","with": {}},- "agent_eval_memories_user_id_idx": {- "name": "agent_eval_memories_user_id_idx",+ "agent_documents_access_self_idx": {+ "name": "agent_documents_access_self_idx","columns": [{- "expression": "user_id",+ "expression": "access_self","isExpression": false,"asc": true,"nulls": "last"@@ -3465,11 +3553,11 @@"method": "btree","with": {}},- "agent_eval_memories_workspace_id_idx": {- "name": "agent_eval_memories_workspace_id_idx",+ "agent_documents_access_shared_idx": {+ "name": "agent_documents_access_shared_idx","columns": [{- "expression": "workspace_id",+ "expression": "access_shared","isExpression": false,"asc": true,"nulls": "last"@@ -3479,176 +3567,123 @@"concurrently": false,"method": "btree","with": {}- }- },- "foreignKeys": {- "agent_eval_memories_user_id_users_id_fk": {- "name": "agent_eval_memories_user_id_users_id_fk",- "tableFrom": "agent_eval_memories",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_eval_memories_workspace_id_workspaces_id_fk": {- "name": "agent_eval_memories_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_memories",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_eval_memories_run_id_agent_eval_runs_id_fk": {- "name": "agent_eval_memories_run_id_agent_eval_runs_id_fk",- "tableFrom": "agent_eval_memories",- "tableTo": "agent_eval_runs",- "columnsFrom": ["run_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"},- "agent_eval_memories_topic_id_topics_id_fk": {- "name": "agent_eval_memories_topic_id_topics_id_fk",- "tableFrom": "agent_eval_memories",- "tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"+ "agent_documents_access_public_idx": {+ "name": "agent_documents_access_public_idx",+ "columns": [+ {+ "expression": "access_public",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "agent_eval_memories_thread_id_threads_id_fk": {- "name": "agent_eval_memories_thread_id_threads_id_fk",- "tableFrom": "agent_eval_memories",- "tableTo": "threads",- "columnsFrom": ["thread_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.agent_eval_benchmarks": {- "name": "agent_eval_benchmarks",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "text",- "primaryKey": true,- "notNull": true+ "agent_documents_policy_load_idx": {+ "name": "agent_documents_policy_load_idx",+ "columns": [+ {+ "expression": "policy_load",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "identifier": {- "name": "identifier",- "type": "text",- "primaryKey": false,- "notNull": true+ "agent_documents_template_id_idx": {+ "name": "agent_documents_template_id_idx",+ "columns": [+ {+ "expression": "template_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "name": {- "name": "name",- "type": "text",- "primaryKey": false,- "notNull": true- },- "description": {- "name": "description",- "type": "text",- "primaryKey": false,- "notNull": false- },- "rubrics": {- "name": "rubrics",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "reference_url": {- "name": "reference_url",- "type": "text",- "primaryKey": false,- "notNull": false- },- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "is_system": {- "name": "is_system",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": true+ "agent_documents_policy_load_position_idx": {+ "name": "agent_documents_policy_load_position_idx",+ "columns": [+ {+ "expression": "policy_load_position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "agent_documents_policy_load_format_idx": {+ "name": "agent_documents_policy_load_format_idx",+ "columns": [+ {+ "expression": "policy_load_format",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "agent_documents_policy_load_rule_idx": {+ "name": "agent_documents_policy_load_rule_idx",+ "columns": [+ {+ "expression": "policy_load_rule",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "agent_eval_benchmarks_identifier_user_id_unique": {- "name": "agent_eval_benchmarks_identifier_user_id_unique",+ "agent_documents_agent_load_position_idx": {+ "name": "agent_documents_agent_load_position_idx","columns": [{- "expression": "identifier",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "policy_load_position","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"agent_eval_benchmarks\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_eval_benchmarks_is_system_idx": {- "name": "agent_eval_benchmarks_is_system_idx",+ "agent_documents_deleted_at_idx": {+ "name": "agent_documents_deleted_at_idx","columns": [{- "expression": "is_system",+ "expression": "deleted_at","isExpression": false,"asc": true,"nulls": "last"@@ -3659,11 +3694,23 @@"method": "btree","with": {}},- "agent_eval_benchmarks_user_id_idx": {- "name": "agent_eval_benchmarks_user_id_idx",+ "agent_documents_agent_autoload_deleted_idx": {+ "name": "agent_documents_agent_autoload_deleted_idx","columns": [{- "expression": "user_id",+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deleted_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "policy_load","isExpression": false,"asc": true,"nulls": "last"@@ -3674,11 +3721,11 @@"method": "btree","with": {}},- "agent_eval_benchmarks_workspace_id_idx": {- "name": "agent_eval_benchmarks_workspace_id_idx",+ "agent_documents_document_id_idx": {+ "name": "agent_documents_document_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"@@ -3689,47 +3736,88 @@"method": "btree","with": {}},- "agent_eval_benchmarks_identifier_workspace_id_unique": {- "name": "agent_eval_benchmarks_identifier_workspace_id_unique",+ "agent_documents_agent_document_user_unique": {+ "name": "agent_documents_agent_document_user_unique","columns": [{- "expression": "workspace_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "identifier",+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,- "where": "\"agent_eval_benchmarks\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_eval_benchmarks_user_id_users_id_fk": {- "name": "agent_eval_benchmarks_user_id_users_id_fk",- "tableFrom": "agent_eval_benchmarks",+ "agent_documents_user_id_users_id_fk": {+ "name": "agent_documents_user_id_users_id_fk",+ "tableFrom": "agent_documents","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_benchmarks_workspace_id_workspaces_id_fk": {- "name": "agent_eval_benchmarks_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_benchmarks",+ "agent_documents_workspace_id_workspaces_id_fk": {+ "name": "agent_documents_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_documents","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "agent_documents_agent_id_agents_id_fk": {+ "name": "agent_documents_agent_id_agents_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_documents_document_id_documents_id_fk": {+ "name": "agent_documents_document_id_documents_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_documents_deleted_by_user_id_users_id_fk": {+ "name": "agent_documents_deleted_by_user_id_users_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "users",+ "columnsFrom": ["deleted_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_documents_deleted_by_agent_id_agents_id_fk": {+ "name": "agent_documents_deleted_by_agent_id_agents_id_fk",+ "tableFrom": "agent_documents",+ "tableTo": "agents",+ "columnsFrom": ["deleted_by_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -3738,68 +3826,129 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_datasets": {- "name": "agent_eval_datasets",+ "public.agent_eval_memories": {+ "name": "agent_eval_memories","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "benchmark_id": {- "name": "benchmark_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "source_experiment_id": {- "name": "source_experiment_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "identifier": {- "name": "identifier",+ "run_id": {+ "name": "run_id","type": "text","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "topic_id": {+ "name": "topic_id","type": "text","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",+ "thread_id": {+ "name": "thread_id","type": "text","primaryKey": false,"notNull": false},- "name": {- "name": "name",+ "attempt_id": {+ "name": "attempt_id","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "layer": {+ "name": "layer","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "eval_mode": {- "name": "eval_mode",+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "fixture_hash": {+ "name": "fixture_hash","type": "text","primaryKey": false,"notNull": false},- "eval_config": {- "name": "eval_config",+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "details": {+ "name": "details",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_category": {+ "name": "memory_category",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_type": {+ "name": "memory_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload","type": "jsonb","primaryKey": false,+ "notNull": true+ },+ "embedding": {+ "name": "embedding",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "removed_reason": {+ "name": "removed_reason",+ "type": "text",+ "primaryKey": false,"notNull": false},"metadata": {@@ -3831,33 +3980,26 @@}},"indexes": {- "agent_eval_datasets_identifier_user_id_unique": {- "name": "agent_eval_datasets_identifier_user_id_unique",+ "agent_eval_memories_attempt_id_idx": {+ "name": "agent_eval_memories_attempt_id_idx","columns": [{- "expression": "identifier",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",+ "expression": "attempt_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"agent_eval_datasets\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_eval_datasets_benchmark_id_idx": {- "name": "agent_eval_datasets_benchmark_id_idx",+ "agent_eval_memories_run_id_idx": {+ "name": "agent_eval_memories_run_id_idx","columns": [{- "expression": "benchmark_id",+ "expression": "run_id","isExpression": false,"asc": true,"nulls": "last"@@ -3868,11 +4010,11 @@"method": "btree","with": {}},- "agent_eval_datasets_source_experiment_id_idx": {- "name": "agent_eval_datasets_source_experiment_id_idx",+ "agent_eval_memories_topic_id_idx": {+ "name": "agent_eval_memories_topic_id_idx","columns": [{- "expression": "source_experiment_id",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"@@ -3883,11 +4025,11 @@"method": "btree","with": {}},- "agent_eval_datasets_user_id_idx": {- "name": "agent_eval_datasets_user_id_idx",+ "agent_eval_memories_thread_id_idx": {+ "name": "agent_eval_memories_thread_id_idx","columns": [{- "expression": "user_id",+ "expression": "thread_id","isExpression": false,"asc": true,"nulls": "last"@@ -3898,11 +4040,11 @@"method": "btree","with": {}},- "agent_eval_datasets_workspace_id_idx": {- "name": "agent_eval_datasets_workspace_id_idx",+ "agent_eval_memories_user_id_idx": {+ "name": "agent_eval_memories_user_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -3913,64 +4055,66 @@"method": "btree","with": {}},- "agent_eval_datasets_identifier_workspace_id_unique": {- "name": "agent_eval_datasets_identifier_workspace_id_unique",+ "agent_eval_memories_workspace_id_idx": {+ "name": "agent_eval_memories_workspace_id_idx","columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "identifier",- "isExpression": false,- "asc": true,- "nulls": "last"}],- "isUnique": true,- "where": "\"agent_eval_datasets\".\"workspace_id\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk": {- "name": "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk",- "tableFrom": "agent_eval_datasets",- "tableTo": "agent_eval_benchmarks",- "columnsFrom": ["benchmark_id"],+ "agent_eval_memories_user_id_users_id_fk": {+ "name": "agent_eval_memories_user_id_users_id_fk",+ "tableFrom": "agent_eval_memories",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk": {- "name": "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk",- "tableFrom": "agent_eval_datasets",- "tableTo": "agent_eval_experiments",- "columnsFrom": ["source_experiment_id"],+ "agent_eval_memories_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_memories_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_memories",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "agent_eval_datasets_user_id_users_id_fk": {- "name": "agent_eval_datasets_user_id_users_id_fk",- "tableFrom": "agent_eval_datasets",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "agent_eval_memories_run_id_agent_eval_runs_id_fk": {+ "name": "agent_eval_memories_run_id_agent_eval_runs_id_fk",+ "tableFrom": "agent_eval_memories",+ "tableTo": "agent_eval_runs",+ "columnsFrom": ["run_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_datasets_workspace_id_workspaces_id_fk": {- "name": "agent_eval_datasets_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_datasets",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "agent_eval_memories_topic_id_topics_id_fk": {+ "name": "agent_eval_memories_topic_id_topics_id_fk",+ "tableFrom": "agent_eval_memories",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_eval_memories_thread_id_threads_id_fk": {+ "name": "agent_eval_memories_thread_id_threads_id_fk",+ "tableFrom": "agent_eval_memories",+ "tableTo": "threads",+ "columnsFrom": ["thread_id"],+ "columnsTo": ["id"],+ "onDelete": "set null","onUpdate": "no action"}},@@ -3980,34 +4124,21 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_environments": {- "name": "agent_eval_environments",+ "public.agent_eval_benchmarks": {+ "name": "agent_eval_benchmarks","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": false- },- "workspace_id": {- "name": "workspace_id","type": "text",- "primaryKey": false,- "notNull": false+ "primaryKey": true,+ "notNull": true},"identifier": {"name": "identifier","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},"name": {"name": "name",@@ -4021,18 +4152,43 @@"primaryKey": false,"notNull": false},- "config": {- "name": "config",+ "rubrics": {+ "name": "rubrics","type": "jsonb","primaryKey": false,"notNull": true},+ "reference_url": {+ "name": "reference_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"metadata": {"name": "metadata","type": "jsonb","primaryKey": false,"notNull": false},+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_system": {+ "name": "is_system",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },"accessed_at": {"name": "accessed_at","type": "timestamp with time zone",@@ -4056,9 +4212,15 @@}},"indexes": {- "agent_eval_environments_user_id_idx": {- "name": "agent_eval_environments_user_id_idx",+ "agent_eval_benchmarks_identifier_user_id_unique": {+ "name": "agent_eval_benchmarks_identifier_user_id_unique","columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },{"expression": "user_id","isExpression": false,@@ -4066,16 +4228,17 @@"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"agent_eval_benchmarks\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "agent_eval_environments_workspace_id_idx": {- "name": "agent_eval_environments_workspace_id_idx",+ "agent_eval_benchmarks_is_system_idx": {+ "name": "agent_eval_benchmarks_is_system_idx","columns": [{- "expression": "workspace_id",+ "expression": "is_system","isExpression": false,"asc": true,"nulls": "last"@@ -4086,15 +4249,9 @@"method": "btree","with": {}},- "agent_eval_environments_identifier_user_id_unique": {- "name": "agent_eval_environments_identifier_user_id_unique",+ "agent_eval_benchmarks_user_id_idx": {+ "name": "agent_eval_benchmarks_user_id_idx","columns": [- {- "expression": "identifier",- "isExpression": false,- "asc": true,- "nulls": "last"- },{"expression": "user_id","isExpression": false,@@ -4102,48 +4259,62 @@"nulls": "last"}],- "isUnique": true,- "where": "\"agent_eval_environments\".\"identifier\" IS NOT NULL AND \"agent_eval_environments\".\"workspace_id\" IS NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_eval_environments_identifier_workspace_id_unique": {- "name": "agent_eval_environments_identifier_workspace_id_unique",+ "agent_eval_benchmarks_workspace_id_idx": {+ "name": "agent_eval_benchmarks_workspace_id_idx","columns": [{- "expression": "identifier",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_benchmarks_identifier_workspace_id_unique": {+ "name": "agent_eval_benchmarks_identifier_workspace_id_unique",+ "columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"}],"isUnique": true,- "where": "\"agent_eval_environments\".\"identifier\" IS NOT NULL AND \"agent_eval_environments\".\"workspace_id\" IS NOT NULL",+ "where": "\"agent_eval_benchmarks\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_eval_environments_user_id_users_id_fk": {- "name": "agent_eval_environments_user_id_users_id_fk",- "tableFrom": "agent_eval_environments",+ "agent_eval_benchmarks_user_id_users_id_fk": {+ "name": "agent_eval_benchmarks_user_id_users_id_fk",+ "tableFrom": "agent_eval_benchmarks","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_environments_workspace_id_workspaces_id_fk": {- "name": "agent_eval_environments_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_environments",+ "agent_eval_benchmarks_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_benchmarks_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_benchmarks","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -4157,27 +4328,39 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_experiment_benchmarks": {- "name": "agent_eval_experiment_benchmarks",+ "public.agent_eval_datasets": {+ "name": "agent_eval_datasets","schema": "","columns": {- "experiment_id": {- "name": "experiment_id",+ "id": {+ "name": "id","type": "text",- "primaryKey": false,+ "primaryKey": true,"notNull": true},"benchmark_id": {"name": "benchmark_id","type": "text","primaryKey": false,+ "notNull": false+ },+ "source_experiment_id": {+ "name": "source_experiment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,"notNull": true},"user_id": {"name": "user_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},"workspace_id": {"name": "workspace_id",@@ -4185,17 +4368,83 @@"primaryKey": false,"notNull": false},+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "eval_mode": {+ "name": "eval_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "eval_config": {+ "name": "eval_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_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": {- "agent_eval_experiment_benchmarks_benchmark_id_idx": {- "name": "agent_eval_experiment_benchmarks_benchmark_id_idx",+ "agent_eval_datasets_identifier_user_id_unique": {+ "name": "agent_eval_datasets_identifier_user_id_unique",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_datasets\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_benchmark_id_idx": {+ "name": "agent_eval_datasets_benchmark_id_idx","columns": [{"expression": "benchmark_id",@@ -4209,8 +4458,23 @@"method": "btree","with": {}},- "agent_eval_experiment_benchmarks_user_id_idx": {- "name": "agent_eval_experiment_benchmarks_user_id_idx",+ "agent_eval_datasets_source_experiment_id_idx": {+ "name": "agent_eval_datasets_source_experiment_id_idx",+ "columns": [+ {+ "expression": "source_experiment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_user_id_idx": {+ "name": "agent_eval_datasets_user_id_idx","columns": [{"expression": "user_id",@@ -4224,8 +4488,8 @@"method": "btree","with": {}},- "agent_eval_experiment_benchmarks_workspace_id_idx": {- "name": "agent_eval_experiment_benchmarks_workspace_id_idx",+ "agent_eval_datasets_workspace_id_idx": {+ "name": "agent_eval_datasets_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -4238,39 +4502,61 @@"concurrently": false,"method": "btree","with": {}+ },+ "agent_eval_datasets_identifier_workspace_id_unique": {+ "name": "agent_eval_datasets_identifier_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_datasets\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {- "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk": {- "name": "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk",- "tableFrom": "agent_eval_experiment_benchmarks",- "tableTo": "agent_eval_experiments",- "columnsFrom": ["experiment_id"],+ "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk": {+ "name": "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk",+ "tableFrom": "agent_eval_datasets",+ "tableTo": "agent_eval_benchmarks",+ "columnsFrom": ["benchmark_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk": {- "name": "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk",- "tableFrom": "agent_eval_experiment_benchmarks",- "tableTo": "agent_eval_benchmarks",- "columnsFrom": ["benchmark_id"],+ "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk": {+ "name": "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk",+ "tableFrom": "agent_eval_datasets",+ "tableTo": "agent_eval_experiments",+ "columnsFrom": ["source_experiment_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"},- "agent_eval_experiment_benchmarks_user_id_users_id_fk": {- "name": "agent_eval_experiment_benchmarks_user_id_users_id_fk",- "tableFrom": "agent_eval_experiment_benchmarks",+ "agent_eval_datasets_user_id_users_id_fk": {+ "name": "agent_eval_datasets_user_id_users_id_fk",+ "tableFrom": "agent_eval_datasets","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk": {- "name": "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_experiment_benchmarks",+ "agent_eval_datasets_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_datasets_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_datasets","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -4278,32 +4564,28 @@"onUpdate": "no action"}},- "compositePrimaryKeys": {- "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk": {- "name": "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk",- "columns": ["experiment_id", "benchmark_id"]- }- },+ "compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_experiments": {- "name": "agent_eval_experiments",+ "public.agent_eval_environments": {+ "name": "agent_eval_environments","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},"user_id": {"name": "user_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},"workspace_id": {"name": "workspace_id",@@ -4311,6 +4593,12 @@"primaryKey": false,"notNull": false},+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"name": {"name": "name","type": "text",@@ -4323,6 +4611,12 @@"primaryKey": false,"notNull": false},+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },"metadata": {"name": "metadata","type": "jsonb",@@ -4352,8 +4646,8 @@}},"indexes": {- "agent_eval_experiments_user_id_idx": {- "name": "agent_eval_experiments_user_id_idx",+ "agent_eval_environments_user_id_idx": {+ "name": "agent_eval_environments_user_id_idx","columns": [{"expression": "user_id",@@ -4367,8 +4661,8 @@"method": "btree","with": {}},- "agent_eval_experiments_workspace_id_idx": {- "name": "agent_eval_experiments_workspace_id_idx",+ "agent_eval_environments_workspace_id_idx": {+ "name": "agent_eval_environments_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -4381,21 +4675,65 @@"concurrently": false,"method": "btree","with": {}- }- },- "foreignKeys": {- "agent_eval_experiments_user_id_users_id_fk": {- "name": "agent_eval_experiments_user_id_users_id_fk",- "tableFrom": "agent_eval_experiments",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ },+ "agent_eval_environments_identifier_user_id_unique": {+ "name": "agent_eval_environments_identifier_user_id_unique",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_environments\".\"identifier\" IS NOT NULL AND \"agent_eval_environments\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_environments_identifier_workspace_id_unique": {+ "name": "agent_eval_environments_identifier_workspace_id_unique",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_environments\".\"identifier\" IS NOT NULL AND \"agent_eval_environments\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_eval_environments_user_id_users_id_fk": {+ "name": "agent_eval_environments_user_id_users_id_fk",+ "tableFrom": "agent_eval_environments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_experiments_workspace_id_workspaces_id_fk": {- "name": "agent_eval_experiments_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_experiments",+ "agent_eval_environments_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_environments_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_environments","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -4409,64 +4747,34 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_run_topics": {- "name": "agent_eval_run_topics",+ "public.agent_eval_experiment_benchmarks": {+ "name": "agent_eval_experiment_benchmarks","schema": "","columns": {- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "run_id": {- "name": "run_id",+ "experiment_id": {+ "name": "experiment_id","type": "text","primaryKey": false,"notNull": true},- "topic_id": {- "name": "topic_id",+ "benchmark_id": {+ "name": "benchmark_id","type": "text","primaryKey": false,"notNull": true},- "test_case_id": {- "name": "test_case_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "status": {- "name": "status",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "score": {- "name": "score",- "type": "real",- "primaryKey": false,- "notNull": false- },- "passed": {- "name": "passed",- "type": "boolean",- "primaryKey": false,- "notNull": false- },- "eval_result": {- "name": "eval_result",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },"created_at": {"name": "created_at","type": "timestamp with time zone",@@ -4476,26 +4784,11 @@}},"indexes": {- "agent_eval_run_topics_user_id_idx": {- "name": "agent_eval_run_topics_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_run_topics_run_id_idx": {- "name": "agent_eval_run_topics_run_id_idx",+ "agent_eval_experiment_benchmarks_benchmark_id_idx": {+ "name": "agent_eval_experiment_benchmarks_benchmark_id_idx","columns": [{- "expression": "run_id",+ "expression": "benchmark_id","isExpression": false,"asc": true,"nulls": "last"@@ -4506,11 +4799,11 @@"method": "btree","with": {}},- "agent_eval_run_topics_test_case_id_idx": {- "name": "agent_eval_run_topics_test_case_id_idx",+ "agent_eval_experiment_benchmarks_user_id_idx": {+ "name": "agent_eval_experiment_benchmarks_user_id_idx","columns": [{- "expression": "test_case_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -4521,8 +4814,8 @@"method": "btree","with": {}},- "agent_eval_run_topics_workspace_id_idx": {- "name": "agent_eval_run_topics_workspace_id_idx",+ "agent_eval_experiment_benchmarks_workspace_id_idx": {+ "name": "agent_eval_experiment_benchmarks_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -4538,56 +4831,47 @@}},"foreignKeys": {- "agent_eval_run_topics_user_id_users_id_fk": {- "name": "agent_eval_run_topics_user_id_users_id_fk",- "tableFrom": "agent_eval_run_topics",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_eval_run_topics_workspace_id_workspaces_id_fk": {- "name": "agent_eval_run_topics_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_run_topics",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk": {+ "name": "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "agent_eval_experiments",+ "columnsFrom": ["experiment_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_run_topics_run_id_agent_eval_runs_id_fk": {- "name": "agent_eval_run_topics_run_id_agent_eval_runs_id_fk",- "tableFrom": "agent_eval_run_topics",- "tableTo": "agent_eval_runs",- "columnsFrom": ["run_id"],+ "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk": {+ "name": "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "agent_eval_benchmarks",+ "columnsFrom": ["benchmark_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_run_topics_topic_id_topics_id_fk": {- "name": "agent_eval_run_topics_topic_id_topics_id_fk",- "tableFrom": "agent_eval_run_topics",- "tableTo": "topics",- "columnsFrom": ["topic_id"],+ "agent_eval_experiment_benchmarks_user_id_users_id_fk": {+ "name": "agent_eval_experiment_benchmarks_user_id_users_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk": {- "name": "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk",- "tableFrom": "agent_eval_run_topics",- "tableTo": "agent_eval_test_cases",- "columnsFrom": ["test_case_id"],+ "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_experiment_benchmarks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"}},"compositePrimaryKeys": {- "agent_eval_run_topics_run_id_topic_id_pk": {- "name": "agent_eval_run_topics_run_id_topic_id_pk",- "columns": ["run_id", "topic_id"]+ "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk": {+ "name": "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk",+ "columns": ["experiment_id", "benchmark_id"]}},"uniqueConstraints": {},@@ -4595,8 +4879,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_runs": {- "name": "agent_eval_runs",+ "public.agent_eval_experiments": {+ "name": "agent_eval_experiments","schema": "","columns": {"id": {@@ -4605,30 +4889,6 @@"primaryKey": true,"notNull": true},- "dataset_id": {- "name": "dataset_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "experiment_id": {- "name": "experiment_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "parent_run_id": {- "name": "parent_run_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "target_agent_id": {- "name": "target_agent_id",- "type": "text",- "primaryKey": false,- "notNull": false- },"user_id": {"name": "user_id","type": "text",@@ -4645,33 +4905,20 @@"name": "name","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "status": {- "name": "status",+ "description": {+ "name": "description","type": "text","primaryKey": false,- "notNull": true,- "default": "'idle'"- },- "config": {- "name": "config",- "type": "jsonb",- "primaryKey": false,"notNull": false},- "metrics": {- "name": "metrics",+ "metadata": {+ "name": "metadata","type": "jsonb","primaryKey": false,"notNull": false},- "started_at": {- "name": "started_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },"accessed_at": {"name": "accessed_at","type": "timestamp with time zone",@@ -4695,11 +4942,11 @@}},"indexes": {- "agent_eval_runs_dataset_id_idx": {- "name": "agent_eval_runs_dataset_id_idx",+ "agent_eval_experiments_user_id_idx": {+ "name": "agent_eval_experiments_user_id_idx","columns": [{- "expression": "dataset_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -4710,83 +4957,8 @@"method": "btree","with": {}},- "agent_eval_runs_experiment_id_idx": {- "name": "agent_eval_runs_experiment_id_idx",- "columns": [- {- "expression": "experiment_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_runs_parent_run_id_idx": {- "name": "agent_eval_runs_parent_run_id_idx",- "columns": [- {- "expression": "parent_run_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_runs_user_id_idx": {- "name": "agent_eval_runs_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_runs_status_idx": {- "name": "agent_eval_runs_status_idx",- "columns": [- {- "expression": "status",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_runs_target_agent_id_idx": {- "name": "agent_eval_runs_target_agent_id_idx",- "columns": [- {- "expression": "target_agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_runs_workspace_id_idx": {- "name": "agent_eval_runs_workspace_id_idx",+ "agent_eval_experiments_workspace_id_idx": {+ "name": "agent_eval_experiments_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -4802,59 +4974,23 @@}},"foreignKeys": {- "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk": {- "name": "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk",- "tableFrom": "agent_eval_runs",- "tableTo": "agent_eval_datasets",- "columnsFrom": ["dataset_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk": {- "name": "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk",- "tableFrom": "agent_eval_runs",- "tableTo": "agent_eval_experiments",- "columnsFrom": ["experiment_id"],- "columnsTo": ["id"],- "onDelete": "no action",- "onUpdate": "no action"- },- "agent_eval_runs_target_agent_id_agents_id_fk": {- "name": "agent_eval_runs_target_agent_id_agents_id_fk",- "tableFrom": "agent_eval_runs",- "tableTo": "agents",- "columnsFrom": ["target_agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_eval_runs_user_id_users_id_fk": {- "name": "agent_eval_runs_user_id_users_id_fk",- "tableFrom": "agent_eval_runs",+ "agent_eval_experiments_user_id_users_id_fk": {+ "name": "agent_eval_experiments_user_id_users_id_fk",+ "tableFrom": "agent_eval_experiments","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_runs_workspace_id_workspaces_id_fk": {- "name": "agent_eval_runs_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_runs",+ "agent_eval_experiments_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_experiments_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_experiments","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk": {- "name": "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk",- "tableFrom": "agent_eval_runs",- "tableTo": "agent_eval_runs",- "columnsFrom": ["parent_run_id"],- "columnsTo": ["id"],- "onDelete": "no action",- "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -4863,21 +4999,15 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_test_cases": {- "name": "agent_eval_test_cases",+ "public.agent_eval_run_topics": {+ "name": "agent_eval_run_topics","schema": "","columns": {- "id": {- "name": "id",- "type": "text",- "primaryKey": true,- "notNull": true- },"user_id": {"name": "user_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},"workspace_id": {"name": "workspace_id",@@ -4885,73 +5015,59 @@"primaryKey": false,"notNull": false},- "dataset_id": {- "name": "dataset_id",+ "run_id": {+ "name": "run_id","type": "text","primaryKey": false,"notNull": true},- "environment_id": {- "name": "environment_id",- "type": "uuid",+ "topic_id": {+ "name": "topic_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "content": {- "name": "content",- "type": "jsonb",+ "test_case_id": {+ "name": "test_case_id",+ "type": "text","primaryKey": false,"notNull": true},- "eval_mode": {- "name": "eval_mode",+ "status": {+ "name": "status","type": "text","primaryKey": false,"notNull": false},- "eval_config": {- "name": "eval_config",- "type": "jsonb",+ "score": {+ "name": "score",+ "type": "real","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "passed": {+ "name": "passed",+ "type": "boolean","primaryKey": false,"notNull": false},- "sort_order": {- "name": "sort_order",- "type": "integer",+ "eval_result": {+ "name": "eval_result",+ "type": "jsonb","primaryKey": false,"notNull": false},- "accessed_at": {- "name": "accessed_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": {- "agent_eval_test_cases_user_id_idx": {- "name": "agent_eval_test_cases_user_id_idx",+ "agent_eval_run_topics_user_id_idx": {+ "name": "agent_eval_run_topics_user_id_idx","columns": [{"expression": "user_id",@@ -4965,26 +5081,11 @@"method": "btree","with": {}},- "agent_eval_test_cases_dataset_id_idx": {- "name": "agent_eval_test_cases_dataset_id_idx",- "columns": [- {- "expression": "dataset_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_test_cases_environment_id_idx": {- "name": "agent_eval_test_cases_environment_id_idx",+ "agent_eval_run_topics_run_id_idx": {+ "name": "agent_eval_run_topics_run_id_idx","columns": [{- "expression": "environment_id",+ "expression": "run_id","isExpression": false,"asc": true,"nulls": "last"@@ -4995,11 +5096,11 @@"method": "btree","with": {}},- "agent_eval_test_cases_sort_order_idx": {- "name": "agent_eval_test_cases_sort_order_idx",+ "agent_eval_run_topics_test_case_id_idx": {+ "name": "agent_eval_run_topics_test_case_id_idx","columns": [{- "expression": "sort_order",+ "expression": "test_case_id","isExpression": false,"asc": true,"nulls": "last"@@ -5010,8 +5111,8 @@"method": "btree","with": {}},- "agent_eval_test_cases_workspace_id_idx": {- "name": "agent_eval_test_cases_workspace_id_idx",+ "agent_eval_run_topics_workspace_id_idx": {+ "name": "agent_eval_run_topics_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -5027,100 +5128,198 @@}},"foreignKeys": {- "agent_eval_test_cases_user_id_users_id_fk": {- "name": "agent_eval_test_cases_user_id_users_id_fk",- "tableFrom": "agent_eval_test_cases",+ "agent_eval_run_topics_user_id_users_id_fk": {+ "name": "agent_eval_run_topics_user_id_users_id_fk",+ "tableFrom": "agent_eval_run_topics","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_test_cases_workspace_id_workspaces_id_fk": {- "name": "agent_eval_test_cases_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_test_cases",+ "agent_eval_run_topics_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_run_topics_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_run_topics","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk": {- "name": "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk",- "tableFrom": "agent_eval_test_cases",- "tableTo": "agent_eval_datasets",- "columnsFrom": ["dataset_id"],+ "agent_eval_run_topics_run_id_agent_eval_runs_id_fk": {+ "name": "agent_eval_run_topics_run_id_agent_eval_runs_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "agent_eval_runs",+ "columnsFrom": ["run_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_eval_test_cases_environment_id_agent_eval_environments_id_fk": {- "name": "agent_eval_test_cases_environment_id_agent_eval_environments_id_fk",- "tableFrom": "agent_eval_test_cases",- "tableTo": "agent_eval_environments",- "columnsFrom": ["environment_id"],+ "agent_eval_run_topics_topic_id_topics_id_fk": {+ "name": "agent_eval_run_topics_topic_id_topics_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk": {+ "name": "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk",+ "tableFrom": "agent_eval_run_topics",+ "tableTo": "agent_eval_test_cases",+ "columnsFrom": ["test_case_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade","onUpdate": "no action"}},- "compositePrimaryKeys": {},+ "compositePrimaryKeys": {+ "agent_eval_run_topics_run_id_topic_id_pk": {+ "name": "agent_eval_run_topics_run_id_topic_id_pk",+ "columns": ["run_id", "topic_id"]+ }+ },"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.agent_history_job_agents": {- "name": "agent_history_job_agents",+ "public.agent_eval_runs": {+ "name": "agent_eval_runs","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "job_id": {- "name": "job_id",+ "dataset_id": {+ "name": "dataset_id","type": "text","primaryKey": false,"notNull": true},- "agent_id": {- "name": "agent_id",+ "experiment_id": {+ "name": "experiment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_run_id": {+ "name": "parent_run_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_agent_id": {+ "name": "target_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'idle'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metrics": {+ "name": "metrics",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_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": {- "agent_history_job_agents_job_id_agent_id_unique": {- "name": "agent_history_job_agents_job_id_agent_id_unique",+ "agent_eval_runs_dataset_id_idx": {+ "name": "agent_eval_runs_dataset_id_idx","columns": [{- "expression": "job_id",+ "expression": "dataset_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_experiment_id_idx": {+ "name": "agent_eval_runs_experiment_id_idx",+ "columns": [{- "expression": "agent_id",+ "expression": "experiment_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_history_job_agents_agent_id_idx": {- "name": "agent_history_job_agents_agent_id_idx",+ "agent_eval_runs_parent_run_id_idx": {+ "name": "agent_eval_runs_parent_run_id_idx","columns": [{- "expression": "agent_id",+ "expression": "parent_run_id","isExpression": false,"asc": true,"nulls": "last"@@ -5130,85 +5329,57 @@"concurrently": false,"method": "btree","with": {}- }- },- "foreignKeys": {- "agent_history_job_agents_job_id_agent_history_jobs_id_fk": {- "name": "agent_history_job_agents_job_id_agent_history_jobs_id_fk",- "tableFrom": "agent_history_job_agents",- "tableTo": "agent_history_jobs",- "columnsFrom": ["job_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_history_job_agents_agent_id_agents_id_fk": {- "name": "agent_history_job_agents_agent_id_agents_id_fk",- "tableFrom": "agent_history_job_agents",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.agent_history_job_groups": {- "name": "agent_history_job_groups",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"},- "job_id": {- "name": "job_id",- "type": "text",- "primaryKey": false,- "notNull": true+ "agent_eval_runs_user_id_idx": {+ "name": "agent_eval_runs_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "group_id": {- "name": "group_id",- "type": "text",- "primaryKey": false,- "notNull": true- }- },- "indexes": {- "agent_history_job_groups_job_id_group_id_unique": {- "name": "agent_history_job_groups_job_id_group_id_unique",+ "agent_eval_runs_status_idx": {+ "name": "agent_eval_runs_status_idx","columns": [{- "expression": "job_id",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_runs_target_agent_id_idx": {+ "name": "agent_eval_runs_target_agent_id_idx",+ "columns": [{- "expression": "group_id",+ "expression": "target_agent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_history_job_groups_group_id_idx": {- "name": "agent_history_job_groups_group_id_idx",+ "agent_eval_runs_workspace_id_idx": {+ "name": "agent_eval_runs_workspace_id_idx","columns": [{- "expression": "group_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -5221,157 +5392,59 @@}},"foreignKeys": {- "agent_history_job_groups_job_id_agent_history_jobs_id_fk": {- "name": "agent_history_job_groups_job_id_agent_history_jobs_id_fk",- "tableFrom": "agent_history_job_groups",- "tableTo": "agent_history_jobs",- "columnsFrom": ["job_id"],+ "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk": {+ "name": "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agent_eval_datasets",+ "columnsFrom": ["dataset_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_history_job_groups_group_id_chat_groups_id_fk": {- "name": "agent_history_job_groups_group_id_chat_groups_id_fk",- "tableFrom": "agent_history_job_groups",- "tableTo": "chat_groups",- "columnsFrom": ["group_id"],+ "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk": {+ "name": "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agent_eval_experiments",+ "columnsFrom": ["experiment_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "no action","onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.agent_history_job_topics": {- "name": "agent_history_job_topics",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "job_id": {- "name": "job_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "topic_id": {- "name": "topic_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "priority": {- "name": "priority",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": false- },- "activity_at": {- "name": "activity_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true- },- "payload": {- "name": "payload",- "type": "jsonb",- "primaryKey": false,- "notNull": false- }- },- "indexes": {- "agent_history_job_topics_job_id_topic_id_unique": {- "name": "agent_history_job_topics_job_id_topic_id_unique",- "columns": [- {- "expression": "job_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "topic_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "concurrently": false,- "method": "btree",- "with": {}},- "agent_history_job_topics_topic_id_idx": {- "name": "agent_history_job_topics_topic_id_idx",- "columns": [- {- "expression": "topic_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}+ "agent_eval_runs_target_agent_id_agents_id_fk": {+ "name": "agent_eval_runs_target_agent_id_agents_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agents",+ "columnsFrom": ["target_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "agent_history_job_topics_pick_idx": {- "name": "agent_history_job_topics_pick_idx",- "columns": [- {- "expression": "job_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "priority",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "activity_at",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- }- },- "foreignKeys": {- "agent_history_job_topics_job_id_agent_history_jobs_id_fk": {- "name": "agent_history_job_topics_job_id_agent_history_jobs_id_fk",- "tableFrom": "agent_history_job_topics",- "tableTo": "agent_history_jobs",- "columnsFrom": ["job_id"],+ "agent_eval_runs_user_id_users_id_fk": {+ "name": "agent_eval_runs_user_id_users_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_history_job_topics_topic_id_topics_id_fk": {- "name": "agent_history_job_topics_topic_id_topics_id_fk",- "tableFrom": "agent_history_job_topics",- "tableTo": "topics",- "columnsFrom": ["topic_id"],+ "agent_eval_runs_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_runs_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk": {+ "name": "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk",+ "tableFrom": "agent_eval_runs",+ "tableTo": "agent_eval_runs",+ "columnsFrom": ["parent_run_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -5380,8 +5453,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_history_jobs": {- "name": "agent_history_jobs",+ "public.agent_eval_test_cases": {+ "name": "agent_eval_test_cases","schema": "","columns": {"id": {@@ -5390,86 +5463,58 @@"primaryKey": true,"notNull": true},- "status": {- "name": "status",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'pending'"+ "notNull": false},- "type": {- "name": "type",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'transfer'"- },- "payload": {- "name": "payload",- "type": "jsonb",- "primaryKey": false,"notNull": false},- "agent_ids": {- "name": "agent_ids",- "type": "jsonb",+ "dataset_id": {+ "name": "dataset_id",+ "type": "text","primaryKey": false,"notNull": true},- "session_ids": {- "name": "session_ids",- "type": "jsonb",+ "environment_id": {+ "name": "environment_id",+ "type": "uuid","primaryKey": false,- "notNull": true+ "notNull": false},- "group_ids": {- "name": "group_ids",+ "content": {+ "name": "content","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"- },- "source_user_id": {- "name": "source_user_id",- "type": "text",- "primaryKey": false,"notNull": true},- "source_workspace_id": {- "name": "source_workspace_id",+ "eval_mode": {+ "name": "eval_mode","type": "text","primaryKey": false,"notNull": false},- "target_user_id": {- "name": "target_user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "target_workspace_id": {- "name": "target_workspace_id",- "type": "text",+ "eval_config": {+ "name": "eval_config",+ "type": "jsonb","primaryKey": false,"notNull": false},- "total_topics": {- "name": "total_topics",- "type": "integer",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "completed_topics": {- "name": "completed_topics",+ "sort_order": {+ "name": "sort_order","type": "integer","primaryKey": false,- "notNull": true,- "default": 0- },- "completed_at": {- "name": "completed_at",- "type": "timestamp with time zone",- "primaryKey": false,"notNull": false},"accessed_at": {@@ -5495,11 +5540,11 @@}},"indexes": {- "agent_history_jobs_status_idx": {- "name": "agent_history_jobs_status_idx",+ "agent_eval_test_cases_user_id_idx": {+ "name": "agent_eval_test_cases_user_id_idx","columns": [{- "expression": "status",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -5510,11 +5555,11 @@"method": "btree","with": {}},- "agent_history_jobs_source_user_id_idx": {- "name": "agent_history_jobs_source_user_id_idx",+ "agent_eval_test_cases_dataset_id_idx": {+ "name": "agent_eval_test_cases_dataset_id_idx","columns": [{- "expression": "source_user_id",+ "expression": "dataset_id","isExpression": false,"asc": true,"nulls": "last"@@ -5525,11 +5570,11 @@"method": "btree","with": {}},- "agent_history_jobs_target_user_id_idx": {- "name": "agent_history_jobs_target_user_id_idx",+ "agent_eval_test_cases_environment_id_idx": {+ "name": "agent_eval_test_cases_environment_id_idx","columns": [{- "expression": "target_user_id",+ "expression": "environment_id","isExpression": false,"asc": true,"nulls": "last"@@ -5540,11 +5585,11 @@"method": "btree","with": {}},- "agent_history_jobs_source_workspace_id_idx": {- "name": "agent_history_jobs_source_workspace_id_idx",+ "agent_eval_test_cases_sort_order_idx": {+ "name": "agent_eval_test_cases_sort_order_idx","columns": [{- "expression": "source_workspace_id",+ "expression": "sort_order","isExpression": false,"asc": true,"nulls": "last"@@ -5555,11 +5600,11 @@"method": "btree","with": {}},- "agent_history_jobs_target_workspace_id_idx": {- "name": "agent_history_jobs_target_workspace_id_idx",+ "agent_eval_test_cases_workspace_id_idx": {+ "name": "agent_eval_test_cases_workspace_id_idx","columns": [{- "expression": "target_workspace_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -5571,15 +5616,52 @@"with": {}}},- "foreignKeys": {},+ "foreignKeys": {+ "agent_eval_test_cases_user_id_users_id_fk": {+ "name": "agent_eval_test_cases_user_id_users_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_test_cases_workspace_id_workspaces_id_fk": {+ "name": "agent_eval_test_cases_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk": {+ "name": "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "agent_eval_datasets",+ "columnsFrom": ["dataset_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_eval_test_cases_environment_id_agent_eval_environments_id_fk": {+ "name": "agent_eval_test_cases_environment_id_agent_eval_environments_id_fk",+ "tableFrom": "agent_eval_test_cases",+ "tableTo": "agent_eval_environments",+ "columnsFrom": ["environment_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.agent_inbox_messages": {- "name": "agent_inbox_messages",+ "public.agent_history_job_agents": {+ "name": "agent_history_job_agents","schema": "","columns": {"id": {@@ -5589,131 +5671,31 @@"notNull": true,"default": "gen_random_uuid()"},- "agent_id": {- "name": "agent_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "account_id": {- "name": "account_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "source_type": {- "name": "source_type",- "type": "text",- "primaryKey": false,- "notNull": true- },- "source_id": {- "name": "source_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "sender": {- "name": "sender",+ "job_id": {+ "name": "job_id","type": "text","primaryKey": false,"notNull": true},- "title": {- "name": "title",- "type": "text",- "primaryKey": false,- "notNull": false- },- "preview": {- "name": "preview",- "type": "text",- "primaryKey": false,- "notNull": false- },- "thread_key": {- "name": "thread_key",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,- "notNull": false- },- "received_at": {- "name": "received_at",- "type": "timestamp with time zone",- "primaryKey": false,"notNull": true- },- "read_at": {- "name": "read_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "topic_id": {- "name": "topic_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "wake_claimed_at": {- "name": "wake_claimed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "wait_consumed_by": {- "name": "wait_consumed_by",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"- },- "accessed_at": {- "name": "accessed_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": {- "agent_inbox_messages_source_unique": {- "name": "agent_inbox_messages_source_unique",+ "agent_history_job_agents_job_id_agent_id_unique": {+ "name": "agent_history_job_agents_job_id_agent_id_unique","columns": [{- "expression": "source_type",+ "expression": "job_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "source_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"@@ -5724,59 +5706,99 @@"method": "btree","with": {}},- "agent_inbox_messages_agent_received_at_idx": {- "name": "agent_inbox_messages_agent_received_at_idx",+ "agent_history_job_agents_agent_id_idx": {+ "name": "agent_history_job_agents_agent_id_idx","columns": [{"expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "received_at",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": false,"concurrently": false,"method": "btree","with": {}+ }+ },+ "foreignKeys": {+ "agent_history_job_agents_job_id_agent_history_jobs_id_fk": {+ "name": "agent_history_job_agents_job_id_agent_history_jobs_id_fk",+ "tableFrom": "agent_history_job_agents",+ "tableTo": "agent_history_jobs",+ "columnsFrom": ["job_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "agent_inbox_messages_agent_created_at_idx": {- "name": "agent_inbox_messages_agent_created_at_idx",+ "agent_history_job_agents_agent_id_agents_id_fk": {+ "name": "agent_history_job_agents_agent_id_agents_id_fk",+ "tableFrom": "agent_history_job_agents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_history_job_groups": {+ "name": "agent_history_job_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "job_id": {+ "name": "job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_history_job_groups_job_id_group_id_unique": {+ "name": "agent_history_job_groups_job_id_group_id_unique","columns": [{- "expression": "agent_id",+ "expression": "job_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "created_at",+ "expression": "group_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "agent_inbox_messages_account_created_at_idx": {- "name": "agent_inbox_messages_account_created_at_idx",+ "agent_history_job_groups_group_id_idx": {+ "name": "agent_history_job_groups_group_id_idx","columns": [{- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "created_at",+ "expression": "group_id","isExpression": false,"asc": true,"nulls": "last"@@ -5786,45 +5808,104 @@"concurrently": false,"method": "btree","with": {}- },- "agent_inbox_messages_account_sender_created_at_idx": {- "name": "agent_inbox_messages_account_sender_created_at_idx",- "columns": [- {- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },+ }+ },+ "foreignKeys": {+ "agent_history_job_groups_job_id_agent_history_jobs_id_fk": {+ "name": "agent_history_job_groups_job_id_agent_history_jobs_id_fk",+ "tableFrom": "agent_history_job_groups",+ "tableTo": "agent_history_jobs",+ "columnsFrom": ["job_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_history_job_groups_group_id_chat_groups_id_fk": {+ "name": "agent_history_job_groups_group_id_chat_groups_id_fk",+ "tableFrom": "agent_history_job_groups",+ "tableTo": "chat_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_history_job_topics": {+ "name": "agent_history_job_topics",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "job_id": {+ "name": "job_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "priority": {+ "name": "priority",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "activity_at": {+ "name": "activity_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "agent_history_job_topics_job_id_topic_id_unique": {+ "name": "agent_history_job_topics_job_id_topic_id_unique",+ "columns": [{- "expression": "sender",+ "expression": "job_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "created_at",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "agent_inbox_messages_account_thread_idx": {- "name": "agent_inbox_messages_account_thread_idx",+ "agent_history_job_topics_topic_id_idx": {+ "name": "agent_history_job_topics_topic_id_idx","columns": [{- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "thread_key",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"@@ -5835,26 +5916,23 @@"method": "btree","with": {}},- "agent_inbox_messages_topic_id_idx": {- "name": "agent_inbox_messages_topic_id_idx",+ "agent_history_job_topics_pick_idx": {+ "name": "agent_history_job_topics_pick_idx","columns": [{- "expression": "topic_id",+ "expression": "job_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_inbox_messages_user_id_idx": {- "name": "agent_inbox_messages_user_id_idx",- "columns": [+ },{- "expression": "user_id",+ "expression": "priority",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_at","isExpression": false,"asc": true,"nulls": "last"@@ -5867,49 +5945,22 @@}},"foreignKeys": {- "agent_inbox_messages_agent_id_agents_id_fk": {- "name": "agent_inbox_messages_agent_id_agents_id_fk",- "tableFrom": "agent_inbox_messages",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_inbox_messages_user_id_users_id_fk": {- "name": "agent_inbox_messages_user_id_users_id_fk",- "tableFrom": "agent_inbox_messages",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_inbox_messages_workspace_id_workspaces_id_fk": {- "name": "agent_inbox_messages_workspace_id_workspaces_id_fk",- "tableFrom": "agent_inbox_messages",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_inbox_messages_account_id_agent_accounts_id_fk": {- "name": "agent_inbox_messages_account_id_agent_accounts_id_fk",- "tableFrom": "agent_inbox_messages",- "tableTo": "agent_accounts",- "columnsFrom": ["account_id"],+ "agent_history_job_topics_job_id_agent_history_jobs_id_fk": {+ "name": "agent_history_job_topics_job_id_agent_history_jobs_id_fk",+ "tableFrom": "agent_history_job_topics",+ "tableTo": "agent_history_jobs",+ "columnsFrom": ["job_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_inbox_messages_topic_id_topics_id_fk": {- "name": "agent_inbox_messages_topic_id_topics_id_fk",- "tableFrom": "agent_inbox_messages",+ "agent_history_job_topics_topic_id_topics_id_fk": {+ "name": "agent_history_job_topics_topic_id_topics_id_fk",+ "tableFrom": "agent_history_job_topics","tableTo": "topics","columnsFrom": ["topic_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"}},@@ -5919,224 +5970,105 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_intervention_resolutions": {- "name": "agent_intervention_resolutions",+ "public.agent_history_jobs": {+ "name": "agent_history_jobs","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "resolution_request_id": {- "name": "resolution_request_id",- "type": "uuid",- "primaryKey": false,"notNull": true},- "operation_id": {- "name": "operation_id",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "'pending'"},- "batch_id": {- "name": "batch_id",+ "type": {+ "name": "type","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "'transfer'"},- "source": {- "name": "source",- "type": "text",+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "agent_ids": {+ "name": "agent_ids",+ "type": "jsonb","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",- "type": "text",+ "session_ids": {+ "name": "session_ids",+ "type": "jsonb","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "group_ids": {+ "name": "group_ids",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "actor_id": {- "name": "actor_id",+ "source_user_id": {+ "name": "source_user_id","type": "text","primaryKey": false,"notNull": true},- "scope": {- "name": "scope",+ "source_workspace_id": {+ "name": "source_workspace_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "selected_intervention_ids": {- "name": "selected_intervention_ids",- "type": "jsonb",+ "target_user_id": {+ "name": "target_user_id",+ "type": "text","primaryKey": false,"notNull": true},- "expected_versions": {- "name": "expected_versions",- "type": "jsonb",+ "target_workspace_id": {+ "name": "target_workspace_id",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "expected_request_revision_hashes": {- "name": "expected_request_revision_hashes",- "type": "jsonb",+ "total_topics": {+ "name": "total_topics",+ "type": "integer","primaryKey": false,"notNull": true},- "expected_item_count": {- "name": "expected_item_count",+ "completed_topics": {+ "name": "completed_topics","type": "integer","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": 0},- "action": {- "name": "action",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "custom_execution_input_hash": {- "name": "custom_execution_input_hash",- "type": "varchar(64)",- "primaryKey": false,- "notNull": false- },- "custom_execution_state": {- "name": "custom_execution_state",- "type": "text",- "primaryKey": false,- "notNull": false- },- "custom_execution_attempt": {- "name": "custom_execution_attempt",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "custom_execution_lease_token": {- "name": "custom_execution_lease_token",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "custom_execution_lease_expires_at": {- "name": "custom_execution_lease_expires_at",+ "completed_at": {+ "name": "completed_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "custom_execution_result": {- "name": "custom_execution_result",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "remember_tool_key": {- "name": "remember_tool_key",- "type": "text",- "primaryKey": false,- "notNull": false- },- "remember_effect_status": {- "name": "remember_effect_status",- "type": "text",- "primaryKey": false,- "notNull": false- },- "original_arguments": {- "name": "original_arguments",- "type": "text",- "primaryKey": false,- "notNull": false- },- "edited_arguments": {- "name": "edited_arguments",- "type": "text",- "primaryKey": false,- "notNull": false- },- "original_request_revision_hash": {- "name": "original_request_revision_hash",- "type": "text",- "primaryKey": false,- "notNull": false- },- "edited_request_revision_hash": {- "name": "edited_request_revision_hash",- "type": "text",- "primaryKey": false,- "notNull": false- },- "argument_effect_status": {- "name": "argument_effect_status",- "type": "text",- "primaryKey": false,- "notNull": false- },- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'resolving'"- },- "resolving_at": {- "name": "resolving_at",+ "accessed_at": {+ "name": "accessed_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,"default": "now()"},- "published_at": {- "name": "published_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "continuation_started_at": {- "name": "continuation_started_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "producer_ack_at": {- "name": "producer_ack_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "terminal_at": {- "name": "terminal_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "rolled_back_at": {- "name": "rolled_back_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "version": {- "name": "version",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 1- },"created_at": {"name": "created_at","type": "timestamp with time zone",@@ -6153,38 +6085,41 @@}},"indexes": {- "agent_intervention_resolutions_request_unique": {- "name": "agent_intervention_resolutions_request_unique",+ "agent_history_jobs_status_idx": {+ "name": "agent_history_jobs_status_idx","columns": [{- "expression": "resolution_request_id",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_intervention_resolutions_owner_batch_idx": {- "name": "agent_intervention_resolutions_owner_batch_idx",+ "agent_history_jobs_source_user_id_idx": {+ "name": "agent_history_jobs_source_user_id_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "workspace_id",+ "expression": "source_user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_jobs_target_user_id_idx": {+ "name": "agent_history_jobs_target_user_id_idx",+ "columns": [{- "expression": "batch_id",+ "expression": "target_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -6195,17 +6130,26 @@"method": "btree","with": {}},- "agent_intervention_resolutions_status_created_idx": {- "name": "agent_intervention_resolutions_status_created_idx",+ "agent_history_jobs_source_workspace_id_idx": {+ "name": "agent_history_jobs_source_workspace_id_idx","columns": [{- "expression": "status",+ "expression": "source_workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_history_jobs_target_workspace_id_idx": {+ "name": "agent_history_jobs_target_workspace_id_idx",+ "columns": [{- "expression": "created_at",+ "expression": "target_workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -6217,64 +6161,15 @@"with": {}}},- "foreignKeys": {- "agent_intervention_resolutions_operation_id_agent_operations_id_fk": {- "name": "agent_intervention_resolutions_operation_id_agent_operations_id_fk",- "tableFrom": "agent_intervention_resolutions",- "tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_intervention_resolutions_user_id_users_id_fk": {- "name": "agent_intervention_resolutions_user_id_users_id_fk",- "tableFrom": "agent_intervention_resolutions",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_intervention_resolutions_workspace_id_workspaces_id_fk": {- "name": "agent_intervention_resolutions_workspace_id_workspaces_id_fk",- "tableFrom": "agent_intervention_resolutions",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },+ "foreignKeys": {},"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {- "agent_intervention_resolutions_expected_item_count_check": {- "name": "agent_intervention_resolutions_expected_item_count_check",- "value": "\"agent_intervention_resolutions\".\"expected_item_count\" > 0"- },- "agent_intervention_resolutions_custom_execution_input_hash_check": {- "name": "agent_intervention_resolutions_custom_execution_input_hash_check",- "value": "\"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NULL OR \"agent_intervention_resolutions\".\"custom_execution_input_hash\" ~ '^[a-f0-9]{64}$'"- },- "agent_intervention_resolutions_custom_execution_state_check": {- "name": "agent_intervention_resolutions_custom_execution_state_check",- "value": "(\n (\"agent_intervention_resolutions\".\"custom_execution_state\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'pending'\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" = 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'executing'\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" > 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'completed'\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" > 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NOT NULL)\n )"- },- "agent_intervention_resolutions_custom_execution_parent_status_check": {- "name": "agent_intervention_resolutions_custom_execution_parent_status_check",- "value": "\"agent_intervention_resolutions\".\"custom_execution_state\" NOT IN ('executing', 'completed') OR \"agent_intervention_resolutions\".\"status\" IN ('resolving', 'published', 'acknowledged', 'completed')"- },- "agent_intervention_resolutions_version_check": {- "name": "agent_intervention_resolutions_version_check",- "value": "\"agent_intervention_resolutions\".\"version\" > 0"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.agent_interventions": {- "name": "agent_interventions",+ "public.agent_inbox_messages": {+ "name": "agent_inbox_messages","schema": "","columns": {"id": {@@ -6284,24 +6179,12 @@"notNull": true,"default": "gen_random_uuid()"},- "operation_id": {- "name": "operation_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "tool_call_id": {- "name": "tool_call_id",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": true},- "tool_message_id": {- "name": "tool_message_id",- "type": "text",- "primaryKey": false,- "notNull": false- },"user_id": {"name": "user_id","type": "text",@@ -6314,170 +6197,85 @@"primaryKey": false,"notNull": false},- "source": {- "name": "source",- "type": "text",- "primaryKey": false,- "notNull": true- },- "provider": {- "name": "provider",- "type": "text",+ "account_id": {+ "name": "account_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "interaction_kind": {- "name": "interaction_kind",+ "source_type": {+ "name": "source_type","type": "text","primaryKey": false,"notNull": true},- "surface": {- "name": "surface",- "type": "text",+ "source_id": {+ "name": "source_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "system_action_eligibility": {- "name": "system_action_eligibility",+ "sender": {+ "name": "sender","type": "text","primaryKey": false,"notNull": true},- "approval_mode": {- "name": "approval_mode",+ "title": {+ "name": "title","type": "text","primaryKey": false,"notNull": false},- "batch_id": {- "name": "batch_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "activity_key": {- "name": "activity_key",- "type": "text",- "primaryKey": false,- "notNull": true- },- "step_index": {- "name": "step_index",- "type": "integer",- "primaryKey": false,- "notNull": true- },- "item_index": {- "name": "item_index",- "type": "integer",- "primaryKey": false,- "notNull": true- },- "item_count": {- "name": "item_count",- "type": "integer",- "primaryKey": false,- "notNull": true- },- "sealed": {- "name": "sealed",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": false- },- "canonical_tool_key": {- "name": "canonical_tool_key",+ "preview": {+ "name": "preview","type": "text","primaryKey": false,"notNull": false},- "request_revision_hash": {- "name": "request_revision_hash",+ "thread_key": {+ "name": "thread_key","type": "text","primaryKey": false,- "notNull": true- },- "allowed_actions": {- "name": "allowed_actions",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "risk": {- "name": "risk",- "type": "jsonb",- "primaryKey": false,"notNull": false},- "review_token_hash": {- "name": "review_token_hash",- "type": "text",- "primaryKey": false,- "notNull": true- },- "review_context": {- "name": "review_context",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "sanitized_request": {- "name": "sanitized_request",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "deadline": {- "name": "deadline",+ "received_at": {+ "name": "received_at","type": "timestamp with time zone","primaryKey": false,"notNull": true},- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'pending'"- },- "resolution_id": {- "name": "resolution_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "resolving_at": {- "name": "resolving_at",+ "read_at": {+ "name": "read_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "published_at": {- "name": "published_at",- "type": "timestamp with time zone",+ "topic_id": {+ "name": "topic_id",+ "type": "text","primaryKey": false,"notNull": false},- "resolved_at": {- "name": "resolved_at",+ "wake_claimed_at": {+ "name": "wake_claimed_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "producer_ack_at": {- "name": "producer_ack_at",- "type": "timestamp with time zone",+ "wait_consumed_by": {+ "name": "wait_consumed_by",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "version": {- "name": "version",- "type": "integer",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": true,- "default": 1+ "default": "now()"},"created_at": {"name": "created_at",@@ -6495,38 +6293,17 @@}},"indexes": {- "agent_interventions_operation_batch_tool_call_unique": {- "name": "agent_interventions_operation_batch_tool_call_unique",+ "agent_inbox_messages_source_unique": {+ "name": "agent_inbox_messages_source_unique","columns": [{- "expression": "operation_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "batch_id",+ "expression": "source_type","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "tool_call_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_interventions_review_token_hash_unique": {- "name": "agent_interventions_review_token_hash_unique",- "columns": [- {- "expression": "review_token_hash",+ "expression": "source_id","isExpression": false,"asc": true,"nulls": "last"@@ -6537,83 +6314,59 @@"method": "btree","with": {}},- "agent_interventions_operation_batch_item_unique": {- "name": "agent_interventions_operation_batch_item_unique",+ "agent_inbox_messages_agent_received_at_idx": {+ "name": "agent_inbox_messages_agent_received_at_idx","columns": [{- "expression": "operation_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "batch_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "item_index",+ "expression": "received_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_interventions_owner_activity_item_unique": {- "name": "agent_interventions_owner_activity_item_unique",+ "agent_inbox_messages_agent_created_at_idx": {+ "name": "agent_inbox_messages_agent_created_at_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "activity_key",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "item_index",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_interventions_owner_status_deadline_idx": {- "name": "agent_interventions_owner_status_deadline_idx",+ "agent_inbox_messages_account_created_at_idx": {+ "name": "agent_inbox_messages_account_created_at_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "status",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "deadline",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -6624,29 +6377,23 @@"method": "btree","with": {}},- "agent_interventions_owner_batch_idx": {- "name": "agent_interventions_owner_batch_idx",+ "agent_inbox_messages_account_sender_created_at_idx": {+ "name": "agent_inbox_messages_account_sender_created_at_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "workspace_id",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "batch_id",+ "expression": "sender","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "item_index",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -6657,17 +6404,17 @@"method": "btree","with": {}},- "agent_interventions_activity_key_idx": {- "name": "agent_interventions_activity_key_idx",+ "agent_inbox_messages_account_thread_idx": {+ "name": "agent_inbox_messages_account_thread_idx","columns": [{- "expression": "user_id",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "activity_key",+ "expression": "thread_key","isExpression": false,"asc": true,"nulls": "last"@@ -6678,17 +6425,26 @@"method": "btree","with": {}},- "agent_interventions_status_deadline_idx": {- "name": "agent_interventions_status_deadline_idx",+ "agent_inbox_messages_topic_id_idx": {+ "name": "agent_inbox_messages_topic_id_idx","columns": [{- "expression": "status",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_inbox_messages_user_id_idx": {+ "name": "agent_inbox_messages_user_id_idx",+ "columns": [{- "expression": "deadline",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -6701,38 +6457,47 @@}},"foreignKeys": {- "agent_interventions_operation_id_agent_operations_id_fk": {- "name": "agent_interventions_operation_id_agent_operations_id_fk",- "tableFrom": "agent_interventions",- "tableTo": "agent_operations",- "columnsFrom": ["operation_id"],+ "agent_inbox_messages_agent_id_agents_id_fk": {+ "name": "agent_inbox_messages_agent_id_agents_id_fk",+ "tableFrom": "agent_inbox_messages",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_interventions_user_id_users_id_fk": {- "name": "agent_interventions_user_id_users_id_fk",- "tableFrom": "agent_interventions",+ "agent_inbox_messages_user_id_users_id_fk": {+ "name": "agent_inbox_messages_user_id_users_id_fk",+ "tableFrom": "agent_inbox_messages","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_interventions_workspace_id_workspaces_id_fk": {- "name": "agent_interventions_workspace_id_workspaces_id_fk",- "tableFrom": "agent_interventions",+ "agent_inbox_messages_workspace_id_workspaces_id_fk": {+ "name": "agent_inbox_messages_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_inbox_messages","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk": {- "name": "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk",- "tableFrom": "agent_interventions",- "tableTo": "agent_intervention_resolutions",- "columnsFrom": ["resolution_id"],+ "agent_inbox_messages_account_id_agent_accounts_id_fk": {+ "name": "agent_inbox_messages_account_id_agent_accounts_id_fk",+ "tableFrom": "agent_inbox_messages",+ "tableTo": "agent_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_inbox_messages_topic_id_topics_id_fk": {+ "name": "agent_inbox_messages_topic_id_topics_id_fk",+ "tableFrom": "agent_inbox_messages",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"@@ -6741,63 +6506,2799 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {- "agent_interventions_review_token_hash_check": {- "name": "agent_interventions_review_token_hash_check",- "value": "\"agent_interventions\".\"review_token_hash\" ~ '^[a-f0-9]{64}$'"+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_intervention_resolutions": {+ "name": "agent_intervention_resolutions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "resolution_request_id": {+ "name": "resolution_request_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "batch_id": {+ "name": "batch_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_id": {+ "name": "actor_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "selected_intervention_ids": {+ "name": "selected_intervention_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expected_versions": {+ "name": "expected_versions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expected_request_revision_hashes": {+ "name": "expected_request_revision_hashes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "expected_item_count": {+ "name": "expected_item_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "action": {+ "name": "action",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "custom_execution_input_hash": {+ "name": "custom_execution_input_hash",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_state": {+ "name": "custom_execution_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_attempt": {+ "name": "custom_execution_attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_lease_token": {+ "name": "custom_execution_lease_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_lease_expires_at": {+ "name": "custom_execution_lease_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "custom_execution_result": {+ "name": "custom_execution_result",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "remember_tool_key": {+ "name": "remember_tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "remember_effect_status": {+ "name": "remember_effect_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "original_arguments": {+ "name": "original_arguments",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "edited_arguments": {+ "name": "edited_arguments",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "original_request_revision_hash": {+ "name": "original_request_revision_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "edited_request_revision_hash": {+ "name": "edited_request_revision_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "argument_effect_status": {+ "name": "argument_effect_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'resolving'"+ },+ "resolving_at": {+ "name": "resolving_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "published_at": {+ "name": "published_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "continuation_started_at": {+ "name": "continuation_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "producer_ack_at": {+ "name": "producer_ack_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "terminal_at": {+ "name": "terminal_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "rolled_back_at": {+ "name": "rolled_back_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_intervention_resolutions_request_unique": {+ "name": "agent_intervention_resolutions_request_unique",+ "columns": [+ {+ "expression": "resolution_request_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_intervention_resolutions_owner_batch_idx": {+ "name": "agent_intervention_resolutions_owner_batch_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_intervention_resolutions_status_created_idx": {+ "name": "agent_intervention_resolutions_status_created_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_intervention_resolutions_operation_id_agent_operations_id_fk": {+ "name": "agent_intervention_resolutions_operation_id_agent_operations_id_fk",+ "tableFrom": "agent_intervention_resolutions",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_intervention_resolutions_user_id_users_id_fk": {+ "name": "agent_intervention_resolutions_user_id_users_id_fk",+ "tableFrom": "agent_intervention_resolutions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_intervention_resolutions_workspace_id_workspaces_id_fk": {+ "name": "agent_intervention_resolutions_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_intervention_resolutions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_intervention_resolutions_expected_item_count_check": {+ "name": "agent_intervention_resolutions_expected_item_count_check",+ "value": "\"agent_intervention_resolutions\".\"expected_item_count\" > 0"+ },+ "agent_intervention_resolutions_custom_execution_input_hash_check": {+ "name": "agent_intervention_resolutions_custom_execution_input_hash_check",+ "value": "\"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NULL OR \"agent_intervention_resolutions\".\"custom_execution_input_hash\" ~ '^[a-f0-9]{64}$'"+ },+ "agent_intervention_resolutions_custom_execution_state_check": {+ "name": "agent_intervention_resolutions_custom_execution_state_check",+ "value": "(\n (\"agent_intervention_resolutions\".\"custom_execution_state\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'pending'\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" = 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'executing'\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" > 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NULL)\n OR\n (\"agent_intervention_resolutions\".\"custom_execution_state\" = 'completed'\n AND \"agent_intervention_resolutions\".\"custom_execution_input_hash\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_attempt\" > 0\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_token\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_lease_expires_at\" IS NOT NULL\n AND \"agent_intervention_resolutions\".\"custom_execution_result\" IS NOT NULL)\n )"+ },+ "agent_intervention_resolutions_custom_execution_parent_status_check": {+ "name": "agent_intervention_resolutions_custom_execution_parent_status_check",+ "value": "\"agent_intervention_resolutions\".\"custom_execution_state\" NOT IN ('executing', 'completed') OR \"agent_intervention_resolutions\".\"status\" IN ('resolving', 'published', 'acknowledged', 'completed')"+ },+ "agent_intervention_resolutions_version_check": {+ "name": "agent_intervention_resolutions_version_check",+ "value": "\"agent_intervention_resolutions\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_interventions": {+ "name": "agent_interventions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_call_id": {+ "name": "tool_call_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_message_id": {+ "name": "tool_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "interaction_kind": {+ "name": "interaction_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "surface": {+ "name": "surface",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "system_action_eligibility": {+ "name": "system_action_eligibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "approval_mode": {+ "name": "approval_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "batch_id": {+ "name": "batch_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "activity_key": {+ "name": "activity_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "step_index": {+ "name": "step_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "item_index": {+ "name": "item_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "item_count": {+ "name": "item_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sealed": {+ "name": "sealed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "canonical_tool_key": {+ "name": "canonical_tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "request_revision_hash": {+ "name": "request_revision_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "allowed_actions": {+ "name": "allowed_actions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "risk": {+ "name": "risk",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "review_token_hash": {+ "name": "review_token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "review_context": {+ "name": "review_context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "sanitized_request": {+ "name": "sanitized_request",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "deadline": {+ "name": "deadline",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "resolution_id": {+ "name": "resolution_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "resolving_at": {+ "name": "resolving_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "published_at": {+ "name": "published_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "producer_ack_at": {+ "name": "producer_ack_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_interventions_operation_batch_tool_call_unique": {+ "name": "agent_interventions_operation_batch_tool_call_unique",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_call_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_review_token_hash_unique": {+ "name": "agent_interventions_review_token_hash_unique",+ "columns": [+ {+ "expression": "review_token_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_operation_batch_item_unique": {+ "name": "agent_interventions_operation_batch_item_unique",+ "columns": [+ {+ "expression": "operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_owner_activity_item_unique": {+ "name": "agent_interventions_owner_activity_item_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_owner_status_deadline_idx": {+ "name": "agent_interventions_owner_status_deadline_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deadline",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_owner_batch_idx": {+ "name": "agent_interventions_owner_batch_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "batch_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "item_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_activity_key_idx": {+ "name": "agent_interventions_activity_key_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "activity_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_interventions_status_deadline_idx": {+ "name": "agent_interventions_status_deadline_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deadline",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_interventions_operation_id_agent_operations_id_fk": {+ "name": "agent_interventions_operation_id_agent_operations_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_interventions_user_id_users_id_fk": {+ "name": "agent_interventions_user_id_users_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_interventions_workspace_id_workspaces_id_fk": {+ "name": "agent_interventions_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk": {+ "name": "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk",+ "tableFrom": "agent_interventions",+ "tableTo": "agent_intervention_resolutions",+ "columnsFrom": ["resolution_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_interventions_review_token_hash_check": {+ "name": "agent_interventions_review_token_hash_check",+ "value": "\"agent_interventions\".\"review_token_hash\" ~ '^[a-f0-9]{64}$'"+ },+ "agent_interventions_request_revision_hash_check": {+ "name": "agent_interventions_request_revision_hash_check",+ "value": "\"agent_interventions\".\"request_revision_hash\" ~ '^[a-f0-9]{64}$'"+ },+ "agent_interventions_step_index_check": {+ "name": "agent_interventions_step_index_check",+ "value": "\"agent_interventions\".\"step_index\" >= 0"+ },+ "agent_interventions_item_bounds_check": {+ "name": "agent_interventions_item_bounds_check",+ "value": "\"agent_interventions\".\"item_count\" > 0 AND \"agent_interventions\".\"item_index\" >= 0 AND \"agent_interventions\".\"item_index\" < \"agent_interventions\".\"item_count\""+ },+ "agent_interventions_version_check": {+ "name": "agent_interventions_version_check",+ "value": "\"agent_interventions\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_label_assignments": {+ "name": "agent_label_assignments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "label_id": {+ "name": "label_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_label_assignments_label_id_agent_id_unique": {+ "name": "agent_label_assignments_label_id_agent_id_unique",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_label_assignments_agent_id_idx": {+ "name": "agent_label_assignments_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_label_assignments_user_id_idx": {+ "name": "agent_label_assignments_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_label_assignments_workspace_id_idx": {+ "name": "agent_label_assignments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_label_assignments_label_id_agent_labels_id_fk": {+ "name": "agent_label_assignments_label_id_agent_labels_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "agent_labels",+ "columnsFrom": ["label_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_label_assignments_agent_id_agents_id_fk": {+ "name": "agent_label_assignments_agent_id_agents_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_label_assignments_user_id_users_id_fk": {+ "name": "agent_label_assignments_user_id_users_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_label_assignments_workspace_id_workspaces_id_fk": {+ "name": "agent_label_assignments_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_label_assignments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_labels": {+ "name": "agent_labels",+ "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+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "archived": {+ "name": "archived",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_labels_user_id_idx": {+ "name": "agent_labels_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_labels_workspace_id_idx": {+ "name": "agent_labels_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_labels_user_id_name_unique": {+ "name": "agent_labels_user_id_name_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_labels\".\"workspace_id\" IS NULL AND \"agent_labels\".\"archived\" = false",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_labels_workspace_id_name_unique": {+ "name": "agent_labels_workspace_id_name_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_labels\".\"workspace_id\" IS NOT NULL AND \"agent_labels\".\"archived\" = false",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_labels_user_id_users_id_fk": {+ "name": "agent_labels_user_id_users_id_fk",+ "tableFrom": "agent_labels",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_labels_workspace_id_workspaces_id_fk": {+ "name": "agent_labels_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_labels",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_mails": {+ "name": "agent_mails",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "signal_id": {+ "name": "signal_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "direction": {+ "name": "direction",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_message_id": {+ "name": "provider_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "in_reply_to": {+ "name": "in_reply_to",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "references": {+ "name": "references",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "thread_key": {+ "name": "thread_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "from_address": {+ "name": "from_address",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "from_name": {+ "name": "from_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "to": {+ "name": "to",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "cc": {+ "name": "cc",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "reply_to": {+ "name": "reply_to",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "subject": {+ "name": "subject",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "text": {+ "name": "text",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "attachments": {+ "name": "attachments",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "codes": {+ "name": "codes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "delivered_at": {+ "name": "delivered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_mails_account_provider_message_unique": {+ "name": "agent_mails_account_provider_message_unique",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_mails_account_thread_idx": {+ "name": "agent_mails_account_thread_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_mails_agent_delivered_at_idx": {+ "name": "agent_mails_agent_delivered_at_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "delivered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_mails_signal_id_idx": {+ "name": "agent_mails_signal_id_idx",+ "columns": [+ {+ "expression": "signal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_mails_user_id_idx": {+ "name": "agent_mails_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_mails_agent_id_agents_id_fk": {+ "name": "agent_mails_agent_id_agents_id_fk",+ "tableFrom": "agent_mails",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_mails_user_id_users_id_fk": {+ "name": "agent_mails_user_id_users_id_fk",+ "tableFrom": "agent_mails",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_mails_workspace_id_workspaces_id_fk": {+ "name": "agent_mails_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_mails",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_mails_account_id_agent_accounts_id_fk": {+ "name": "agent_mails_account_id_agent_accounts_id_fk",+ "tableFrom": "agent_mails",+ "tableTo": "agent_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_mails_signal_id_signals_id_fk": {+ "name": "agent_mails_signal_id_signals_id_fk",+ "tableFrom": "agent_mails",+ "tableTo": "signals",+ "columnsFrom": ["signal_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_operations": {+ "name": "agent_operations",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "chat_group_id": {+ "name": "chat_group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_operation_id": {+ "name": "parent_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "completion_reason": {+ "name": "completion_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verify_status": {+ "name": "verify_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "verify_plan": {+ "name": "verify_plan",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "verify_plan_confirmed_at": {+ "name": "verify_plan_confirmed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "step_count": {+ "name": "step_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "max_steps": {+ "name": "max_steps",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "force_finish": {+ "name": "force_finish",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "interruption": {+ "name": "interruption",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "currency": {+ "name": "currency",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'USD'"+ },+ "total_input_tokens": {+ "name": "total_input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_output_tokens": {+ "name": "total_output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_tokens": {+ "name": "total_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "llm_calls": {+ "name": "llm_calls",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "tool_calls": {+ "name": "tool_calls",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "human_interventions": {+ "name": "human_interventions",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "processing_time_ms": {+ "name": "processing_time_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "human_waiting_time_ms": {+ "name": "human_waiting_time_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cost": {+ "name": "cost",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "usage": {+ "name": "usage",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "cost_limit": {+ "name": "cost_limit",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model_runtime_config": {+ "name": "model_runtime_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "app_context": {+ "name": "app_context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trace_s3_key": {+ "name": "trace_s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_operations_user_id_idx": {+ "name": "agent_operations_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_workspace_id_idx": {+ "name": "agent_operations_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_agent_id_idx": {+ "name": "agent_operations_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_topic_id_idx": {+ "name": "agent_operations_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_thread_id_idx": {+ "name": "agent_operations_thread_id_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_task_id_idx": {+ "name": "agent_operations_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_chat_group_id_idx": {+ "name": "agent_operations_chat_group_id_idx",+ "columns": [+ {+ "expression": "chat_group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_parent_operation_id_idx": {+ "name": "agent_operations_parent_operation_id_idx",+ "columns": [+ {+ "expression": "parent_operation_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_status_idx": {+ "name": "agent_operations_status_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_running_created_at_idx": {+ "name": "agent_operations_running_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"agent_operations\".\"status\" = 'running'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_user_id_created_at_idx": {+ "name": "agent_operations_user_id_created_at_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_workspace_id_created_at_idx": {+ "name": "agent_operations_workspace_id_created_at_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_operations_metadata_idx": {+ "name": "agent_operations_metadata_idx",+ "columns": [+ {+ "expression": "metadata",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "gin",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_operations_workspace_id_workspaces_id_fk": {+ "name": "agent_operations_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_operations_agent_id_agents_id_fk": {+ "name": "agent_operations_agent_id_agents_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_topic_id_topics_id_fk": {+ "name": "agent_operations_topic_id_topics_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_thread_id_threads_id_fk": {+ "name": "agent_operations_thread_id_threads_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "threads",+ "columnsFrom": ["thread_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_task_id_tasks_id_fk": {+ "name": "agent_operations_task_id_tasks_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_operations_chat_group_id_chat_groups_id_fk": {+ "name": "agent_operations_chat_group_id_chat_groups_id_fk",+ "tableFrom": "agent_operations",+ "tableTo": "chat_groups",+ "columnsFrom": ["chat_group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_account_bindings": {+ "name": "agent_account_bindings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pool'"+ },+ "priority": {+ "name": "priority",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "weight": {+ "name": "weight",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_account_bindings_agent_account_unique": {+ "name": "agent_account_bindings_agent_account_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_agent_pinned_unique": {+ "name": "agent_account_bindings_agent_pinned_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_account_bindings\".\"role\" = 'pinned'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_agent_id_idx": {+ "name": "agent_account_bindings_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_account_id_idx": {+ "name": "agent_account_bindings_account_id_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_user_id_idx": {+ "name": "agent_account_bindings_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_account_bindings_workspace_id_idx": {+ "name": "agent_account_bindings_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_account_bindings_agent_id_agents_id_fk": {+ "name": "agent_account_bindings_agent_id_agents_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_account_bindings_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_account_bindings_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_account_bindings_user_id_users_id_fk": {+ "name": "agent_account_bindings_user_id_users_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_account_bindings_workspace_id_workspaces_id_fk": {+ "name": "agent_account_bindings_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_account_bindings",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_device_account_bindings": {+ "name": "agent_device_account_bindings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "device_id": {+ "name": "device_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_device_account_bindings_agent_device_unique": {+ "name": "agent_device_account_bindings_agent_device_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_device_id_idx": {+ "name": "agent_device_account_bindings_device_id_idx",+ "columns": [+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_account_device_idx": {+ "name": "agent_device_account_bindings_account_device_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_user_id_idx": {+ "name": "agent_device_account_bindings_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_workspace_id_idx": {+ "name": "agent_device_account_bindings_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_device_account_bindings_agent_id_agents_id_fk": {+ "name": "agent_device_account_bindings_agent_id_agents_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_user_id_users_id_fk": {+ "name": "agent_device_account_bindings_user_id_users_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_workspace_id_workspaces_id_fk": {+ "name": "agent_device_account_bindings_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_device_id_devices_id_fk": {+ "name": "agent_device_account_bindings_device_id_devices_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "devices",+ "columnsFrom": ["device_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_device_account_bindings_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_login_fk": {+ "name": "agent_device_account_bindings_login_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "agent_provider_account_logins",+ "columnsFrom": ["account_id", "device_id"],+ "columnsTo": ["account_id", "device_id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_provider_account_logins": {+ "name": "agent_provider_account_logins",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "device_id": {+ "name": "device_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_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": {+ "agent_provider_account_logins_device_id_idx": {+ "name": "agent_provider_account_logins_device_id_idx",+ "columns": [+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_account_logins_user_id_idx": {+ "name": "agent_provider_account_logins_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_account_logins_workspace_id_idx": {+ "name": "agent_provider_account_logins_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_provider_account_logins_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_provider_account_logins_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_account_logins_device_id_devices_id_fk": {+ "name": "agent_provider_account_logins_device_id_devices_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "devices",+ "columnsFrom": ["device_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_account_logins_user_id_users_id_fk": {+ "name": "agent_provider_account_logins_user_id_users_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_account_logins_workspace_id_workspaces_id_fk": {+ "name": "agent_provider_account_logins_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_provider_account_logins_account_device_unique": {+ "name": "agent_provider_account_logins_account_device_unique",+ "nullsNotDistinct": false,+ "columns": ["account_id", "device_id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_provider_accounts": {+ "name": "agent_provider_accounts",+ "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+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_account_id": {+ "name": "external_account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "agent_interventions_request_revision_hash_check": {- "name": "agent_interventions_request_revision_hash_check",- "value": "\"agent_interventions\".\"request_revision_hash\" ~ '^[a-f0-9]{64}$'"+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "agent_interventions_step_index_check": {- "name": "agent_interventions_step_index_check",- "value": "\"agent_interventions\".\"step_index\" >= 0"+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "agent_interventions_item_bounds_check": {- "name": "agent_interventions_item_bounds_check",- "value": "\"agent_interventions\".\"item_count\" > 0 AND \"agent_interventions\".\"item_index\" >= 0 AND \"agent_interventions\".\"item_index\" < \"agent_interventions\".\"item_count\""+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "agent_interventions_version_check": {- "name": "agent_interventions_version_check",- "value": "\"agent_interventions\".\"version\" > 0"- }- },- "isRLSEnabled": false- },- "public.agent_label_assignments": {- "name": "agent_label_assignments",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "plan_tier": {+ "name": "plan_tier",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "label_id": {- "name": "label_id",- "type": "uuid",+ "rate_limit_tier": {+ "name": "rate_limit_tier",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "agent_id": {- "name": "agent_id",+ "label": {+ "name": "label",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "credential_mode": {+ "name": "credential_mode","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "'referenced'"},- "user_id": {- "name": "user_id",+ "credentials": {+ "name": "credentials","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "workspace_id": {- "name": "workspace_id",+ "credential_ref": {+ "name": "credential_ref",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status","type": "text","primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "last_validated_at": {+ "name": "last_validated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,"notNull": false},"accessed_at": {@@ -6823,32 +9324,68 @@}},"indexes": {- "agent_label_assignments_label_id_agent_id_unique": {- "name": "agent_label_assignments_label_id_agent_id_unique",+ "agent_provider_accounts_user_id_idx": {+ "name": "agent_provider_accounts_user_id_idx","columns": [{- "expression": "label_id",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_accounts_workspace_id_idx": {+ "name": "agent_provider_accounts_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_accounts_workspace_visibility_idx": {+ "name": "agent_provider_accounts_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "agent_id",+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_label_assignments_agent_id_idx": {- "name": "agent_label_assignments_agent_id_idx",+ "agent_provider_accounts_token_expires_at_idx": {+ "name": "agent_provider_accounts_token_expires_at_idx","columns": [{- "expression": "agent_id",+ "expression": "token_expires_at","isExpression": false,"asc": true,"nulls": "last"@@ -6859,24 +9396,49 @@"method": "btree","with": {}},- "agent_label_assignments_user_id_idx": {- "name": "agent_label_assignments_user_id_idx",+ "agent_provider_accounts_identity_unique": {+ "name": "agent_provider_accounts_identity_unique","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"agent_provider_accounts\".\"external_account_id\" IS NOT NULL and \"agent_provider_accounts\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "agent_label_assignments_workspace_id_idx": {- "name": "agent_label_assignments_workspace_id_idx",+ "agent_provider_accounts_identity_workspace_unique": {+ "name": "agent_provider_accounts_identity_workspace_unique","columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "external_account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },{"expression": "workspace_id","isExpression": false,@@ -6884,43 +9446,26 @@"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"agent_provider_accounts\".\"external_account_id\" IS NOT NULL and \"agent_provider_accounts\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_label_assignments_label_id_agent_labels_id_fk": {- "name": "agent_label_assignments_label_id_agent_labels_id_fk",- "tableFrom": "agent_label_assignments",- "tableTo": "agent_labels",- "columnsFrom": ["label_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_label_assignments_agent_id_agents_id_fk": {- "name": "agent_label_assignments_agent_id_agents_id_fk",- "tableFrom": "agent_label_assignments",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_label_assignments_user_id_users_id_fk": {- "name": "agent_label_assignments_user_id_users_id_fk",- "tableFrom": "agent_label_assignments",+ "agent_provider_accounts_user_id_users_id_fk": {+ "name": "agent_provider_accounts_user_id_users_id_fk",+ "tableFrom": "agent_provider_accounts","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_label_assignments_workspace_id_workspaces_id_fk": {- "name": "agent_label_assignments_workspace_id_workspaces_id_fk",- "tableFrom": "agent_label_assignments",+ "agent_provider_accounts_workspace_id_workspaces_id_fk": {+ "name": "agent_provider_accounts_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_provider_accounts","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -6934,8 +9479,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_labels": {- "name": "agent_labels",+ "public.agent_quota_calibrations": {+ "name": "agent_quota_calibrations","schema": "","columns": {"id": {@@ -6945,59 +9490,94 @@"notNull": true,"default": "gen_random_uuid()"},- "name": {- "name": "name",+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "limit_type": {+ "name": "limit_type","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "scope_key": {+ "name": "scope_key","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "''"},- "color": {- "name": "color",- "type": "text",+ "capacity_usd": {+ "name": "capacity_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": true+ },+ "capacity_tokens_equivalent": {+ "name": "capacity_tokens_equivalent",+ "type": "bigint","primaryKey": false,"notNull": false},- "archived": {- "name": "archived",- "type": "boolean",+ "model_mix": {+ "name": "model_mix",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": false+ "notNull": false},- "user_id": {- "name": "user_id",- "type": "text",+ "sample_count": {+ "name": "sample_count",+ "type": "integer","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "confidence": {+ "name": "confidence",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "method": {+ "name": "method","type": "text","primaryKey": false,"notNull": false},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",+ "window_seconds": {+ "name": "window_seconds",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "created_at": {- "name": "created_at",+ "calibrated_at": {+ "name": "calibrated_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,"default": "now()"},- "updated_at": {- "name": "updated_at",+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,@@ -7005,94 +9585,92 @@}},"indexes": {- "agent_labels_user_id_idx": {- "name": "agent_labels_user_id_idx",+ "agent_quota_calibrations_account_type_scope_idx": {+ "name": "agent_quota_calibrations_account_type_scope_idx","columns": [{- "expression": "user_id",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_labels_workspace_id_idx": {- "name": "agent_labels_workspace_id_idx",- "columns": [+ },{- "expression": "workspace_id",+ "expression": "limit_type","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_labels_user_id_name_unique": {- "name": "agent_labels_user_id_name_unique",- "columns": [+ },{- "expression": "user_id",+ "expression": "scope_key","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "name",+ "expression": "calibrated_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"agent_labels\".\"workspace_id\" IS NULL AND \"agent_labels\".\"archived\" = false",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_labels_workspace_id_name_unique": {- "name": "agent_labels_workspace_id_name_unique",+ "agent_quota_calibrations_workspace_id_idx": {+ "name": "agent_quota_calibrations_workspace_id_idx","columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_quota_calibrations_user_id_idx": {+ "name": "agent_quota_calibrations_user_id_idx",+ "columns": [{- "expression": "name",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"agent_labels\".\"workspace_id\" IS NOT NULL AND \"agent_labels\".\"archived\" = false",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_labels_user_id_users_id_fk": {- "name": "agent_labels_user_id_users_id_fk",- "tableFrom": "agent_labels",+ "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_calibrations",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_quota_calibrations_user_id_users_id_fk": {+ "name": "agent_quota_calibrations_user_id_users_id_fk",+ "tableFrom": "agent_quota_calibrations","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_labels_workspace_id_workspaces_id_fk": {- "name": "agent_labels_workspace_id_workspaces_id_fk",- "tableFrom": "agent_labels",+ "agent_quota_calibrations_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_calibrations_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_calibrations","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -7106,8 +9684,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_mails": {- "name": "agent_mails",+ "public.agent_quota_snapshots": {+ "name": "agent_quota_snapshots","schema": "","columns": {"id": {@@ -7117,9 +9695,9 @@"notNull": true,"default": "gen_random_uuid()"},- "agent_id": {- "name": "agent_id",- "type": "text",+ "account_id": {+ "name": "account_id",+ "type": "uuid","primaryKey": false,"notNull": true},@@ -7135,143 +9713,64 @@"primaryKey": false,"notNull": false},- "account_id": {- "name": "account_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "signal_id": {- "name": "signal_id",+ "device_id": {+ "name": "device_id","type": "uuid","primaryKey": false,"notNull": false},- "direction": {- "name": "direction",- "type": "text",- "primaryKey": false,- "notNull": true- },- "provider": {- "name": "provider",- "type": "text",- "primaryKey": false,- "notNull": true- },- "provider_message_id": {- "name": "provider_message_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "message_id": {- "name": "message_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "in_reply_to": {- "name": "in_reply_to",- "type": "text",- "primaryKey": false,- "notNull": false- },- "references": {- "name": "references",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"- },- "thread_key": {- "name": "thread_key",- "type": "text",- "primaryKey": false,- "notNull": false- },- "from_address": {- "name": "from_address",+ "limit_type": {+ "name": "limit_type","type": "text","primaryKey": false,"notNull": true},- "from_name": {- "name": "from_name",+ "scope_key": {+ "name": "scope_key","type": "text","primaryKey": false,- "notNull": false- },- "to": {- "name": "to",- "type": "jsonb",- "primaryKey": false,"notNull": true,- "default": "'[]'::jsonb"- },- "cc": {- "name": "cc",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"- },- "reply_to": {- "name": "reply_to",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "default": "''"},- "subject": {- "name": "subject",- "type": "text",+ "resets_at": {+ "name": "resets_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "text": {- "name": "text",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "''"- },- "attachments": {- "name": "attachments",- "type": "jsonb",+ "utilization": {+ "name": "utilization",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": true},- "codes": {- "name": "codes",- "type": "jsonb",+ "severity": {+ "name": "severity",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false},- "delivered_at": {- "name": "delivered_at",- "type": "timestamp with time zone",+ "is_active": {+ "name": "is_active",+ "type": "boolean","primaryKey": false,- "notNull": true+ "notNull": false},- "accessed_at": {- "name": "accessed_at",+ "captured_at": {+ "name": "captured_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,"default": "now()"},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",+ "raw": {+ "name": "raw",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "updated_at": {- "name": "updated_at",+ "created_at": {+ "name": "created_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,@@ -7279,8 +9778,8 @@}},"indexes": {- "agent_mails_account_provider_message_unique": {- "name": "agent_mails_account_provider_message_unique",+ "agent_quota_snapshots_account_type_scope_idx": {+ "name": "agent_quota_snapshots_account_type_scope_idx","columns": [{"expression": "account_id",@@ -7289,19 +9788,31 @@"nulls": "last"},{- "expression": "provider_message_id",+ "expression": "limit_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scope_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "captured_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_mails_account_thread_idx": {- "name": "agent_mails_account_thread_idx",+ "agent_quota_snapshots_account_captured_idx": {+ "name": "agent_quota_snapshots_account_captured_idx","columns": [{"expression": "account_id",@@ -7310,7 +9821,7 @@"nulls": "last"},{- "expression": "thread_key",+ "expression": "captured_at","isExpression": false,"asc": true,"nulls": "last"@@ -7321,17 +9832,11 @@"method": "btree","with": {}},- "agent_mails_agent_delivered_at_idx": {- "name": "agent_mails_agent_delivered_at_idx",+ "agent_quota_snapshots_resets_at_idx": {+ "name": "agent_quota_snapshots_resets_at_idx","columns": [{- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "delivered_at",+ "expression": "resets_at","isExpression": false,"asc": true,"nulls": "last"@@ -7342,11 +9847,11 @@"method": "btree","with": {}},- "agent_mails_signal_id_idx": {- "name": "agent_mails_signal_id_idx",+ "agent_quota_snapshots_workspace_id_idx": {+ "name": "agent_quota_snapshots_workspace_id_idx","columns": [{- "expression": "signal_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -7357,8 +9862,8 @@"method": "btree","with": {}},- "agent_mails_user_id_idx": {- "name": "agent_mails_user_id_idx",+ "agent_quota_snapshots_user_id_idx": {+ "name": "agent_quota_snapshots_user_id_idx","columns": [{"expression": "user_id",@@ -7374,47 +9879,38 @@}},"foreignKeys": {- "agent_mails_agent_id_agents_id_fk": {- "name": "agent_mails_agent_id_agents_id_fk",- "tableFrom": "agent_mails",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_snapshots",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_mails_user_id_users_id_fk": {- "name": "agent_mails_user_id_users_id_fk",- "tableFrom": "agent_mails",+ "agent_quota_snapshots_user_id_users_id_fk": {+ "name": "agent_quota_snapshots_user_id_users_id_fk",+ "tableFrom": "agent_quota_snapshots","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_mails_workspace_id_workspaces_id_fk": {- "name": "agent_mails_workspace_id_workspaces_id_fk",- "tableFrom": "agent_mails",+ "agent_quota_snapshots_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_snapshots_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_snapshots","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_mails_account_id_agent_accounts_id_fk": {- "name": "agent_mails_account_id_agent_accounts_id_fk",- "tableFrom": "agent_mails",- "tableTo": "agent_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_mails_signal_id_signals_id_fk": {- "name": "agent_mails_signal_id_signals_id_fk",- "tableFrom": "agent_mails",- "tableTo": "signals",- "columnsFrom": ["signal_id"],+ "agent_quota_snapshots_device_id_devices_id_fk": {+ "name": "agent_quota_snapshots_device_id_devices_id_fk",+ "tableFrom": "agent_quota_snapshots",+ "tableTo": "devices",+ "columnsFrom": ["device_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"@@ -7426,247 +9922,121 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_operations": {- "name": "agent_operations",+ "public.agent_quota_usage_ledger": {+ "name": "agent_quota_usage_ledger","schema": "","columns": {"id": {"name": "id",- "type": "text",- "primaryKey": true,- "notNull": true- },- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "agent_id": {- "name": "agent_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "topic_id": {- "name": "topic_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "thread_id": {- "name": "thread_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "task_id": {- "name": "task_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "chat_group_id": {- "name": "chat_group_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "parent_operation_id": {- "name": "parent_operation_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true- },- "completion_reason": {- "name": "completion_reason",- "type": "text",- "primaryKey": false,- "notNull": false- },- "verify_status": {- "name": "verify_status",- "type": "text",- "primaryKey": false,- "notNull": false- },- "verify_plan": {- "name": "verify_plan",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "verify_plan_confirmed_at": {- "name": "verify_plan_confirmed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "started_at": {- "name": "started_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "completed_at": {- "name": "completed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "step_count": {- "name": "step_count",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "max_steps": {- "name": "max_steps",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "force_finish": {- "name": "force_finish",- "type": "boolean",- "primaryKey": false,- "notNull": false- },- "interruption": {- "name": "interruption",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "error": {- "name": "error",- "type": "jsonb",- "primaryKey": false,- "notNull": false+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"},- "total_cost": {- "name": "total_cost",- "type": "numeric(20, 6)",+ "account_id": {+ "name": "account_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "currency": {- "name": "currency",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'USD'"+ "notNull": true},- "total_input_tokens": {- "name": "total_input_tokens",- "type": "integer",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,"notNull": false},- "total_output_tokens": {- "name": "total_output_tokens",- "type": "integer",+ "provider": {+ "name": "provider",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "total_tokens": {- "name": "total_tokens",- "type": "integer",+ "model": {+ "name": "model",+ "type": "text","primaryKey": false,"notNull": false},- "llm_calls": {- "name": "llm_calls",- "type": "integer",+ "occurred_at": {+ "name": "occurred_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true},- "tool_calls": {- "name": "tool_calls",+ "input_tokens": {+ "name": "input_tokens","type": "integer","primaryKey": false,"notNull": false},- "human_interventions": {- "name": "human_interventions",+ "output_tokens": {+ "name": "output_tokens","type": "integer","primaryKey": false,"notNull": false},- "processing_time_ms": {- "name": "processing_time_ms",+ "cache_read_tokens": {+ "name": "cache_read_tokens","type": "integer","primaryKey": false,"notNull": false},- "human_waiting_time_ms": {- "name": "human_waiting_time_ms",+ "cache_write_tokens": {+ "name": "cache_write_tokens","type": "integer","primaryKey": false,"notNull": false},- "cost": {- "name": "cost",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "usage": {- "name": "usage",- "type": "jsonb",+ "reasoning_tokens": {+ "name": "reasoning_tokens",+ "type": "integer","primaryKey": false,"notNull": false},- "cost_limit": {- "name": "cost_limit",- "type": "jsonb",+ "cost_usd": {+ "name": "cost_usd",+ "type": "numeric(20, 6)","primaryKey": false,"notNull": false},- "model": {- "name": "model",+ "cost_source": {+ "name": "cost_source","type": "text","primaryKey": false,"notNull": false},- "provider": {- "name": "provider",+ "message_id": {+ "name": "message_id","type": "text","primaryKey": false,"notNull": false},- "model_runtime_config": {- "name": "model_runtime_config",- "type": "jsonb",+ "operation_id": {+ "name": "operation_id",+ "type": "text","primaryKey": false,"notNull": false},- "trigger": {- "name": "trigger",+ "topic_id": {+ "name": "topic_id","type": "text","primaryKey": false,"notNull": false},- "app_context": {- "name": "app_context",- "type": "jsonb",+ "agent_id": {+ "name": "agent_id",+ "type": "text","primaryKey": false,"notNull": false},- "trace_s3_key": {- "name": "trace_s3_key",+ "external_event_id": {+ "name": "external_event_id","type": "text","primaryKey": false,"notNull": false@@ -7675,15 +10045,7 @@"name": "metadata","type": "jsonb","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"- },- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},"created_at": {"name": "created_at",@@ -7691,51 +10053,20 @@"primaryKey": false,"notNull": true,"default": "now()"- },- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"}},"indexes": {- "agent_operations_user_id_idx": {- "name": "agent_operations_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_operations_workspace_id_idx": {- "name": "agent_operations_workspace_id_idx",+ "agent_quota_usage_ledger_account_occurred_idx": {+ "name": "agent_quota_usage_ledger_account_occurred_idx","columns": [{- "expression": "workspace_id",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_operations_agent_id_idx": {- "name": "agent_operations_agent_id_idx",- "columns": [+ },{- "expression": "agent_id",+ "expression": "occurred_at","isExpression": false,"asc": true,"nulls": "last"@@ -7746,41 +10077,23 @@"method": "btree","with": {}},- "agent_operations_topic_id_idx": {- "name": "agent_operations_topic_id_idx",+ "agent_quota_usage_ledger_account_model_occurred_idx": {+ "name": "agent_quota_usage_ledger_account_model_occurred_idx","columns": [{- "expression": "topic_id",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_operations_thread_id_idx": {- "name": "agent_operations_thread_id_idx",- "columns": [+ },{- "expression": "thread_id",+ "expression": "model","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_operations_task_id_idx": {- "name": "agent_operations_task_id_idx",- "columns": [+ },{- "expression": "task_id",+ "expression": "occurred_at","isExpression": false,"asc": true,"nulls": "last"@@ -7791,11 +10104,11 @@"method": "btree","with": {}},- "agent_operations_chat_group_id_idx": {- "name": "agent_operations_chat_group_id_idx",+ "agent_quota_usage_ledger_message_id_idx": {+ "name": "agent_quota_usage_ledger_message_id_idx","columns": [{- "expression": "chat_group_id",+ "expression": "message_id","isExpression": false,"asc": true,"nulls": "last"@@ -7806,11 +10119,11 @@"method": "btree","with": {}},- "agent_operations_parent_operation_id_idx": {- "name": "agent_operations_parent_operation_id_idx",+ "agent_quota_usage_ledger_operation_id_idx": {+ "name": "agent_quota_usage_ledger_operation_id_idx","columns": [{- "expression": "parent_operation_id",+ "expression": "operation_id","isExpression": false,"asc": true,"nulls": "last"@@ -7821,11 +10134,11 @@"method": "btree","with": {}},- "agent_operations_status_idx": {- "name": "agent_operations_status_idx",+ "agent_quota_usage_ledger_workspace_id_idx": {+ "name": "agent_quota_usage_ledger_workspace_id_idx","columns": [{- "expression": "status",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -7836,20 +10149,14 @@"method": "btree","with": {}},- "agent_operations_user_id_created_at_idx": {- "name": "agent_operations_user_id_created_at_idx",+ "agent_quota_usage_ledger_user_id_idx": {+ "name": "agent_quota_usage_ledger_user_id_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "created_at",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": false,@@ -7857,94 +10164,83 @@"method": "btree","with": {}},- "agent_operations_workspace_id_created_at_idx": {- "name": "agent_operations_workspace_id_created_at_idx",+ "agent_quota_usage_ledger_external_event_unique": {+ "name": "agent_quota_usage_ledger_external_event_unique","columns": [{- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "created_at",+ "expression": "external_event_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"agent_quota_usage_ledger\".\"external_event_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}- },- "agent_operations_metadata_idx": {- "name": "agent_operations_metadata_idx",- "columns": [- {- "expression": "metadata",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "gin",- "with": {}- }- },- "foreignKeys": {- "agent_operations_workspace_id_workspaces_id_fk": {- "name": "agent_operations_workspace_id_workspaces_id_fk",- "tableFrom": "agent_operations",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ }+ },+ "foreignKeys": {+ "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": ["account_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_quota_usage_ledger_user_id_users_id_fk": {+ "name": "agent_quota_usage_ledger_user_id_users_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_operations_agent_id_agents_id_fk": {- "name": "agent_operations_agent_id_agents_id_fk",- "tableFrom": "agent_operations",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "agent_quota_usage_ledger_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_usage_ledger_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "agent_operations_topic_id_topics_id_fk": {- "name": "agent_operations_topic_id_topics_id_fk",- "tableFrom": "agent_operations",- "tableTo": "topics",- "columnsFrom": ["topic_id"],+ "agent_quota_usage_ledger_message_id_messages_id_fk": {+ "name": "agent_quota_usage_ledger_message_id_messages_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "messages",+ "columnsFrom": ["message_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "agent_operations_thread_id_threads_id_fk": {- "name": "agent_operations_thread_id_threads_id_fk",- "tableFrom": "agent_operations",- "tableTo": "threads",- "columnsFrom": ["thread_id"],+ "agent_quota_usage_ledger_operation_id_agent_operations_id_fk": {+ "name": "agent_quota_usage_ledger_operation_id_agent_operations_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "agent_operations_task_id_tasks_id_fk": {- "name": "agent_operations_task_id_tasks_id_fk",- "tableFrom": "agent_operations",- "tableTo": "tasks",- "columnsFrom": ["task_id"],+ "agent_quota_usage_ledger_topic_id_topics_id_fk": {+ "name": "agent_quota_usage_ledger_topic_id_topics_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "agent_operations_chat_group_id_chat_groups_id_fk": {- "name": "agent_operations_chat_group_id_chat_groups_id_fk",- "tableFrom": "agent_operations",- "tableTo": "chat_groups",- "columnsFrom": ["chat_group_id"],+ "agent_quota_usage_ledger_agent_id_agents_id_fk": {+ "name": "agent_quota_usage_ledger_agent_id_agents_id_fk",+ "tableFrom": "agent_quota_usage_ledger",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"@@ -7956,8 +10252,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_account_bindings": {- "name": "agent_account_bindings",+ "public.agent_quota_windows": {+ "name": "agent_quota_windows","schema": "","columns": {"id": {@@ -7967,12 +10263,6 @@"notNull": true,"default": "gen_random_uuid()"},- "agent_id": {- "name": "agent_id",- "type": "text",- "primaryKey": false,- "notNull": true- },"account_id": {"name": "account_id","type": "uuid",@@ -7991,33 +10281,92 @@"primaryKey": false,"notNull": false},- "role": {- "name": "role",+ "limit_type": {+ "name": "limit_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scope_key": {+ "name": "scope_key","type": "text","primaryKey": false,"notNull": true,- "default": "'pool'"+ "default": "''"},- "priority": {- "name": "priority",+ "resets_at": {+ "name": "resets_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "window_start_at": {+ "name": "window_start_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "window_seconds": {+ "name": "window_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "peak_utilization": {+ "name": "peak_utilization","type": "integer","primaryKey": false,"notNull": true,"default": 0},- "weight": {- "name": "weight",+ "last_utilization": {+ "name": "last_utilization","type": "integer","primaryKey": false,- "notNull": true,- "default": 1+ "notNull": false},- "enabled": {- "name": "enabled",+ "rate_limited_at": {+ "name": "rate_limited_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "observed_cost_usd": {+ "name": "observed_cost_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "observed_tokens": {+ "name": "observed_tokens",+ "type": "bigint",+ "primaryKey": false,+ "notNull": false+ },+ "estimated_capacity_usd": {+ "name": "estimated_capacity_usd",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "contaminated": {+ "name": "contaminated","type": "boolean","primaryKey": false,"notNull": true,- "default": true+ "default": false+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -8042,66 +10391,53 @@}},"indexes": {- "agent_account_bindings_agent_account_unique": {- "name": "agent_account_bindings_agent_account_unique",+ "agent_quota_windows_natural_key_unique": {+ "name": "agent_quota_windows_natural_key_unique","columns": [{- "expression": "agent_id",+ "expression": "account_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "account_id",+ "expression": "limit_type","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": true,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_account_bindings_agent_pinned_unique": {- "name": "agent_account_bindings_agent_pinned_unique",- "columns": [+ },{- "expression": "agent_id",+ "expression": "scope_key","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": true,- "where": "\"agent_account_bindings\".\"role\" = 'pinned'",- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_account_bindings_agent_id_idx": {- "name": "agent_account_bindings_agent_id_idx",- "columns": [+ },{- "expression": "agent_id",+ "expression": "resets_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "agent_account_bindings_account_id_idx": {- "name": "agent_account_bindings_account_id_idx",+ "agent_quota_windows_account_resets_idx": {+ "name": "agent_quota_windows_account_resets_idx","columns": [{"expression": "account_id","isExpression": false,"asc": true,"nulls": "last"+ },+ {+ "expression": "resets_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"}],"isUnique": false,@@ -8109,8 +10445,8 @@"method": "btree","with": {}},- "agent_account_bindings_user_id_idx": {- "name": "agent_account_bindings_user_id_idx",+ "agent_quota_windows_user_id_idx": {+ "name": "agent_quota_windows_user_id_idx","columns": [{"expression": "user_id",@@ -8124,8 +10460,8 @@"method": "btree","with": {}},- "agent_account_bindings_workspace_id_idx": {- "name": "agent_account_bindings_workspace_id_idx",+ "agent_quota_windows_workspace_id_idx": {+ "name": "agent_quota_windows_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -8141,36 +10477,27 @@}},"foreignKeys": {- "agent_account_bindings_agent_id_agents_id_fk": {- "name": "agent_account_bindings_agent_id_agents_id_fk",- "tableFrom": "agent_account_bindings",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_account_bindings_account_id_agent_provider_accounts_id_fk": {- "name": "agent_account_bindings_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_account_bindings",+ "agent_quota_windows_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_quota_windows_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_quota_windows","tableTo": "agent_provider_accounts","columnsFrom": ["account_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_account_bindings_user_id_users_id_fk": {- "name": "agent_account_bindings_user_id_users_id_fk",- "tableFrom": "agent_account_bindings",+ "agent_quota_windows_user_id_users_id_fk": {+ "name": "agent_quota_windows_user_id_users_id_fk",+ "tableFrom": "agent_quota_windows","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_account_bindings_workspace_id_workspaces_id_fk": {- "name": "agent_account_bindings_workspace_id_workspaces_id_fk",- "tableFrom": "agent_account_bindings",+ "agent_quota_windows_workspace_id_workspaces_id_fk": {+ "name": "agent_quota_windows_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_quota_windows","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -8184,8 +10511,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_device_account_bindings": {- "name": "agent_device_account_bindings",+ "public.agent_shares": {+ "name": "agent_shares","schema": "","columns": {"id": {@@ -8201,29 +10528,25 @@"primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "workspace_id": {- "name": "workspace_id",+ "visibility": {+ "name": "visibility","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'private'"},- "device_id": {- "name": "device_id",- "type": "uuid",+ "share_config": {+ "name": "share_config",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "account_id": {- "name": "account_id",- "type": "uuid",+ "user_view_count": {+ "name": "user_view_count",+ "type": "integer","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": 0},"accessed_at": {"name": "accessed_at",@@ -8248,20 +10571,14 @@}},"indexes": {- "agent_device_account_bindings_agent_device_unique": {- "name": "agent_device_account_bindings_agent_device_unique",+ "agent_shares_agent_id_unique": {+ "name": "agent_shares_agent_id_unique","columns": [{"expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "device_id",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": true,@@ -8269,62 +10586,11 @@"method": "btree","with": {}},- "agent_device_account_bindings_device_id_idx": {- "name": "agent_device_account_bindings_device_id_idx",- "columns": [- {- "expression": "device_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_device_account_bindings_account_device_idx": {- "name": "agent_device_account_bindings_account_device_idx",- "columns": [- {- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "device_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_device_account_bindings_user_id_idx": {- "name": "agent_device_account_bindings_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_device_account_bindings_workspace_id_idx": {- "name": "agent_device_account_bindings_workspace_id_idx",+ "agent_shares_visibility_idx": {+ "name": "agent_shares_visibility_idx","columns": [{- "expression": "workspace_id",+ "expression": "visibility","isExpression": false,"asc": true,"nulls": "last"@@ -8337,59 +10603,14 @@}},"foreignKeys": {- "agent_device_account_bindings_agent_id_agents_id_fk": {- "name": "agent_device_account_bindings_agent_id_agents_id_fk",- "tableFrom": "agent_device_account_bindings",+ "agent_shares_agent_id_agents_id_fk": {+ "name": "agent_shares_agent_id_agents_id_fk",+ "tableFrom": "agent_shares","tableTo": "agents","columnsFrom": ["agent_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "agent_device_account_bindings_user_id_users_id_fk": {- "name": "agent_device_account_bindings_user_id_users_id_fk",- "tableFrom": "agent_device_account_bindings",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_device_account_bindings_workspace_id_workspaces_id_fk": {- "name": "agent_device_account_bindings_workspace_id_workspaces_id_fk",- "tableFrom": "agent_device_account_bindings",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_device_account_bindings_device_id_devices_id_fk": {- "name": "agent_device_account_bindings_device_id_devices_id_fk",- "tableFrom": "agent_device_account_bindings",- "tableTo": "devices",- "columnsFrom": ["device_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_device_account_bindings_account_id_agent_provider_accounts_id_fk": {- "name": "agent_device_account_bindings_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_device_account_bindings",- "tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_device_account_bindings_login_fk": {- "name": "agent_device_account_bindings_login_fk",- "tableFrom": "agent_device_account_bindings",- "tableTo": "agent_provider_account_logins",- "columnsFrom": ["account_id", "device_id"],- "columnsTo": ["account_id", "device_id"],- "onDelete": "cascade",- "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -8398,29 +10619,78 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_provider_account_logins": {- "name": "agent_provider_account_logins",+ "public.agent_skills": {+ "name": "agent_skills","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "account_id": {- "name": "account_id",- "type": "uuid",+ "name": {+ "name": "name",+ "type": "text","primaryKey": false,"notNull": true},- "device_id": {- "name": "device_id",- "type": "uuid",+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text","primaryKey": false,"notNull": true},+ "upstream": {+ "name": "upstream",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "manifest": {+ "name": "manifest",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "zip_file_hash": {+ "name": "zip_file_hash",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },"user_id": {"name": "user_id","type": "text",@@ -8433,19 +10703,17 @@"primaryKey": false,"notNull": false},- "first_seen_at": {- "name": "first_seen_at",+ "deleted_at": {+ "name": "deleted_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "last_seen_at": {- "name": "last_seen_at",- "type": "timestamp with time zone",+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -8461,20 +10729,42 @@"notNull": true,"default": "now()"},- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "agent_provider_account_logins_device_id_idx": {- "name": "agent_provider_account_logins_device_id_idx",+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_skills_user_name_idx": {+ "name": "agent_skills_user_name_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_skills\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_identifier_idx": {+ "name": "agent_skills_identifier_idx","columns": [{- "expression": "device_id",+ "expression": "identifier","isExpression": false,"asc": true,"nulls": "last"@@ -8485,8 +10775,8 @@"method": "btree","with": {}},- "agent_provider_account_logins_user_id_idx": {- "name": "agent_provider_account_logins_user_id_idx",+ "agent_skills_user_id_idx": {+ "name": "agent_skills_user_id_idx","columns": [{"expression": "user_id",@@ -8500,8 +10790,38 @@"method": "btree","with": {}},- "agent_provider_account_logins_workspace_id_idx": {- "name": "agent_provider_account_logins_workspace_id_idx",+ "agent_skills_source_idx": {+ "name": "agent_skills_source_idx",+ "columns": [+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_zip_hash_idx": {+ "name": "agent_skills_zip_hash_idx",+ "columns": [+ {+ "expression": "zip_file_hash",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_skills_workspace_id_idx": {+ "name": "agent_skills_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -8514,39 +10834,52 @@"concurrently": false,"method": "btree","with": {}+ },+ "agent_skills_name_workspace_id_unique": {+ "name": "agent_skills_name_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_skills\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {- "agent_provider_account_logins_account_id_agent_provider_accounts_id_fk": {- "name": "agent_provider_account_logins_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_provider_account_logins",- "tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_provider_account_logins_device_id_devices_id_fk": {- "name": "agent_provider_account_logins_device_id_devices_id_fk",- "tableFrom": "agent_provider_account_logins",- "tableTo": "devices",- "columnsFrom": ["device_id"],- "columnsTo": ["id"],- "onDelete": "cascade",+ "agent_skills_zip_file_hash_global_files_hash_id_fk": {+ "name": "agent_skills_zip_file_hash_global_files_hash_id_fk",+ "tableFrom": "agent_skills",+ "tableTo": "global_files",+ "columnsFrom": ["zip_file_hash"],+ "columnsTo": ["hash_id"],+ "onDelete": "set null","onUpdate": "no action"},- "agent_provider_account_logins_user_id_users_id_fk": {- "name": "agent_provider_account_logins_user_id_users_id_fk",- "tableFrom": "agent_provider_account_logins",+ "agent_skills_user_id_users_id_fk": {+ "name": "agent_skills_user_id_users_id_fk",+ "tableFrom": "agent_skills","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_provider_account_logins_workspace_id_workspaces_id_fk": {- "name": "agent_provider_account_logins_workspace_id_workspaces_id_fk",- "tableFrom": "agent_provider_account_logins",+ "agent_skills_workspace_id_workspaces_id_fk": {+ "name": "agent_skills_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_skills","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -8555,143 +10888,131 @@}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "agent_provider_account_logins_account_device_unique": {- "name": "agent_provider_account_logins_account_device_unique",- "nullsNotDistinct": false,- "columns": ["account_id", "device_id"]- }- },+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.agent_provider_accounts": {- "name": "agent_provider_accounts",+ "public.ai_models": {+ "name": "ai_models","schema": "","columns": {"id": {"name": "id",+ "type": "varchar(150)",+ "primaryKey": false,+ "notNull": true+ },+ "_id": {+ "name": "_id","type": "uuid","primaryKey": true,"notNull": true,"default": "gen_random_uuid()"},- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "display_name": {+ "name": "display_name",+ "type": "varchar(200)","primaryKey": false,"notNull": false},- "visibility": {- "name": "visibility",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'public'"- },- "provider": {- "name": "provider",+ "description": {+ "name": "description","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "external_account_id": {- "name": "external_account_id",- "type": "text",+ "organization": {+ "name": "organization",+ "type": "varchar(100)","primaryKey": false,"notNull": false},- "email": {- "name": "email",- "type": "text",+ "enabled": {+ "name": "enabled",+ "type": "boolean","primaryKey": false,"notNull": false},- "display_name": {- "name": "display_name",- "type": "text",+ "provider_id": {+ "name": "provider_id",+ "type": "varchar(64)","primaryKey": false,- "notNull": false+ "notNull": true},- "organization_id": {- "name": "organization_id",- "type": "text",+ "type": {+ "name": "type",+ "type": "varchar(20)","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'chat'"},- "plan_tier": {- "name": "plan_tier",- "type": "text",+ "sort": {+ "name": "sort",+ "type": "integer","primaryKey": false,"notNull": false},- "rate_limit_tier": {- "name": "rate_limit_tier",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "label": {- "name": "label",- "type": "varchar(255)",+ "pricing": {+ "name": "pricing",+ "type": "jsonb","primaryKey": false,"notNull": false},- "credential_mode": {- "name": "credential_mode",- "type": "text",+ "parameters": {+ "name": "parameters",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'referenced'"+ "notNull": false,+ "default": "'{}'::jsonb"},- "credentials": {- "name": "credentials",- "type": "text",+ "config": {+ "name": "config",+ "type": "jsonb","primaryKey": false,"notNull": false},- "credential_ref": {- "name": "credential_ref",+ "abilities": {+ "name": "abilities","type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": false,+ "default": "'{}'::jsonb"},- "token_expires_at": {- "name": "token_expires_at",- "type": "timestamp with time zone",+ "context_window_tokens": {+ "name": "context_window_tokens",+ "type": "integer","primaryKey": false,"notNull": false},- "status": {- "name": "status",- "type": "text",+ "source": {+ "name": "source",+ "type": "varchar(20)","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "released_at": {+ "name": "released_at",+ "type": "varchar(10)","primaryKey": false,- "notNull": true,- "default": true+ "notNull": false},- "last_validated_at": {- "name": "last_validated_at",- "type": "timestamp with time zone",+ "settings": {+ "name": "settings",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": false,+ "default": "'{}'::jsonb"},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,"notNull": false},@@ -8718,47 +11039,45 @@}},"indexes": {- "agent_provider_accounts_user_id_idx": {- "name": "agent_provider_accounts_user_id_idx",+ "ai_models_id_provider_id_user_id_unique": {+ "name": "ai_models_id_provider_id_user_id_unique","columns": [{- "expression": "user_id",+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_provider_accounts_workspace_id_idx": {- "name": "agent_provider_accounts_workspace_id_idx",- "columns": [+ },{- "expression": "workspace_id",+ "expression": "provider_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"ai_models\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "agent_provider_accounts_workspace_visibility_idx": {- "name": "agent_provider_accounts_workspace_visibility_idx",+ "ai_models_id_provider_id_user_id_workspace_id_unique": {+ "name": "ai_models_id_provider_id_user_id_workspace_id_unique","columns": [{- "expression": "workspace_id",+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "visibility",+ "expression": "provider_id","isExpression": false,"asc": true,"nulls": "last"@@ -8768,71 +11087,38 @@"isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_provider_accounts_token_expires_at_idx": {- "name": "agent_provider_accounts_token_expires_at_idx",- "columns": [+ },{- "expression": "token_expires_at",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"ai_models\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}},- "agent_provider_accounts_identity_unique": {- "name": "agent_provider_accounts_identity_unique",+ "ai_models_user_id_idx": {+ "name": "ai_models_user_id_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "provider",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "external_account_id",- "isExpression": false,- "asc": true,- "nulls": "last"}],- "isUnique": true,- "where": "\"agent_provider_accounts\".\"external_account_id\" IS NOT NULL and \"agent_provider_accounts\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_provider_accounts_identity_workspace_unique": {- "name": "agent_provider_accounts_identity_workspace_unique",+ "ai_models_workspace_id_idx": {+ "name": "ai_models_workspace_id_idx","columns": [- {- "expression": "provider",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "external_account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },{"expression": "workspace_id","isExpression": false,@@ -8840,26 +11126,25 @@"nulls": "last"}],- "isUnique": true,- "where": "\"agent_provider_accounts\".\"external_account_id\" IS NOT NULL and \"agent_provider_accounts\".\"workspace_id\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_provider_accounts_user_id_users_id_fk": {- "name": "agent_provider_accounts_user_id_users_id_fk",- "tableFrom": "agent_provider_accounts",+ "ai_models_user_id_users_id_fk": {+ "name": "ai_models_user_id_users_id_fk",+ "tableFrom": "ai_models","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_provider_accounts_workspace_id_workspaces_id_fk": {- "name": "agent_provider_accounts_workspace_id_workspaces_id_fk",- "tableFrom": "agent_provider_accounts",+ "ai_models_workspace_id_workspaces_id_fk": {+ "name": "ai_models_workspace_id_workspaces_id_fk",+ "tableFrom": "ai_models","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -8873,150 +11158,179 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_quota_calibrations": {- "name": "agent_quota_calibrations",+ "public.ai_providers": {+ "name": "ai_providers","schema": "","columns": {"id": {"name": "id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "_id": {+ "name": "_id","type": "uuid","primaryKey": true,"notNull": true,"default": "gen_random_uuid()"},- "account_id": {- "name": "account_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },"user_id": {"name": "user_id","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "sort": {+ "name": "sort",+ "type": "integer","primaryKey": false,"notNull": false},- "limit_type": {- "name": "limit_type",- "type": "text",+ "enabled": {+ "name": "enabled",+ "type": "boolean","primaryKey": false,- "notNull": true+ "notNull": false},- "scope_key": {- "name": "scope_key",+ "fetch_on_client": {+ "name": "fetch_on_client",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "check_model": {+ "name": "check_model","type": "text","primaryKey": false,- "notNull": true,- "default": "''"+ "notNull": false},- "capacity_usd": {- "name": "capacity_usd",- "type": "numeric(20, 6)",+ "logo": {+ "name": "logo",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "capacity_tokens_equivalent": {- "name": "capacity_tokens_equivalent",- "type": "bigint",+ "description": {+ "name": "description",+ "type": "text","primaryKey": false,"notNull": false},- "model_mix": {- "name": "model_mix",- "type": "jsonb",+ "key_vaults": {+ "name": "key_vaults",+ "type": "text","primaryKey": false,"notNull": false},- "sample_count": {- "name": "sample_count",- "type": "integer",+ "source": {+ "name": "source",+ "type": "varchar(20)","primaryKey": false,- "notNull": true+ "notNull": false},- "confidence": {- "name": "confidence",- "type": "numeric(20, 6)",+ "settings": {+ "name": "settings",+ "type": "jsonb","primaryKey": false,"notNull": false},- "method": {- "name": "method",- "type": "text",+ "config": {+ "name": "config",+ "type": "jsonb","primaryKey": false,"notNull": false},- "window_seconds": {- "name": "window_seconds",- "type": "integer",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,"notNull": false},- "calibrated_at": {- "name": "calibrated_at",+ "accessed_at": {+ "name": "accessed_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,"default": "now()"},- "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": {- "agent_quota_calibrations_account_type_scope_idx": {- "name": "agent_quota_calibrations_account_type_scope_idx",+ "ai_providers_id_user_id_unique": {+ "name": "ai_providers_id_user_id_unique","columns": [{- "expression": "account_id",+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "limit_type",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"ai_providers\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_providers_id_user_id_workspace_id_unique": {+ "name": "ai_providers_id_user_id_workspace_id_unique",+ "columns": [+ {+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "scope_key",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "calibrated_at",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"ai_providers\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}},- "agent_quota_calibrations_workspace_id_idx": {- "name": "agent_quota_calibrations_workspace_id_idx",+ "ai_providers_user_id_idx": {+ "name": "ai_providers_user_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -9027,11 +11341,11 @@"method": "btree","with": {}},- "agent_quota_calibrations_user_id_idx": {- "name": "agent_quota_calibrations_user_id_idx",+ "ai_providers_workspace_id_idx": {+ "name": "ai_providers_workspace_id_idx","columns": [{- "expression": "user_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -9044,27 +11358,18 @@}},"foreignKeys": {- "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk": {- "name": "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_quota_calibrations",- "tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_quota_calibrations_user_id_users_id_fk": {- "name": "agent_quota_calibrations_user_id_users_id_fk",- "tableFrom": "agent_quota_calibrations",+ "ai_providers_user_id_users_id_fk": {+ "name": "ai_providers_user_id_users_id_fk",+ "tableFrom": "ai_providers","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_quota_calibrations_workspace_id_workspaces_id_fk": {- "name": "agent_quota_calibrations_workspace_id_workspaces_id_fk",- "tableFrom": "agent_quota_calibrations",+ "ai_providers_workspace_id_workspaces_id_fk": {+ "name": "ai_providers_workspace_id_workspaces_id_fk",+ "tableFrom": "ai_providers","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -9078,159 +11383,99 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_quota_snapshots": {- "name": "agent_quota_snapshots",+ "public.api_keys": {+ "name": "api_keys","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "account_id": {- "name": "account_id",- "type": "uuid",+ "name": {+ "name": "name",+ "type": "varchar(256)","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",- "type": "text",+ "key": {+ "name": "key",+ "type": "varchar(256)","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "key_hash": {+ "name": "key_hash",+ "type": "varchar(128)","primaryKey": false,"notNull": false},- "device_id": {- "name": "device_id",- "type": "uuid",+ "enabled": {+ "name": "enabled",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": false,+ "default": true},- "limit_type": {- "name": "limit_type",- "type": "text",+ "scopes": {+ "name": "scopes",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "scope_key": {- "name": "scope_key",- "type": "text",+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "''"+ "notNull": false},- "resets_at": {- "name": "resets_at",+ "last_used_at": {+ "name": "last_used_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "utilization": {- "name": "utilization",- "type": "integer",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "severity": {- "name": "severity",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "is_active": {- "name": "is_active",- "type": "boolean",- "primaryKey": false,- "notNull": false- },- "captured_at": {- "name": "captured_at",+ "accessed_at": {+ "name": "accessed_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,"default": "now()"},- "raw": {- "name": "raw",- "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": {- "agent_quota_snapshots_account_type_scope_idx": {- "name": "agent_quota_snapshots_account_type_scope_idx",- "columns": [- {- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "limit_type",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "scope_key",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "captured_at",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_quota_snapshots_account_captured_idx": {- "name": "agent_quota_snapshots_account_captured_idx",- "columns": [- {- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "captured_at",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_quota_snapshots_resets_at_idx": {- "name": "agent_quota_snapshots_resets_at_idx",+ "api_keys_user_id_idx": {+ "name": "api_keys_user_id_idx","columns": [{- "expression": "resets_at",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -9241,8 +11486,8 @@"method": "btree","with": {}},- "agent_quota_snapshots_workspace_id_idx": {- "name": "agent_quota_snapshots_workspace_id_idx",+ "api_keys_workspace_id_idx": {+ "name": "api_keys_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -9255,182 +11500,148 @@"concurrently": false,"method": "btree","with": {}- },- "agent_quota_snapshots_user_id_idx": {- "name": "agent_quota_snapshots_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}}},"foreignKeys": {- "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk": {- "name": "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_quota_snapshots",- "tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_quota_snapshots_user_id_users_id_fk": {- "name": "agent_quota_snapshots_user_id_users_id_fk",- "tableFrom": "agent_quota_snapshots",+ "api_keys_user_id_users_id_fk": {+ "name": "api_keys_user_id_users_id_fk",+ "tableFrom": "api_keys","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_quota_snapshots_workspace_id_workspaces_id_fk": {- "name": "agent_quota_snapshots_workspace_id_workspaces_id_fk",- "tableFrom": "agent_quota_snapshots",+ "api_keys_workspace_id_workspaces_id_fk": {+ "name": "api_keys_workspace_id_workspaces_id_fk",+ "tableFrom": "api_keys","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "agent_quota_snapshots_device_id_devices_id_fk": {- "name": "agent_quota_snapshots_device_id_devices_id_fk",- "tableFrom": "agent_quota_snapshots",- "tableTo": "devices",- "columnsFrom": ["device_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {},+ "uniqueConstraints": {+ "api_keys_key_unique": {+ "name": "api_keys_key_unique",+ "nullsNotDistinct": false,+ "columns": ["key"]+ },+ "api_keys_key_hash_unique": {+ "name": "api_keys_key_hash_unique",+ "nullsNotDistinct": false,+ "columns": ["key_hash"]+ }+ },"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.agent_quota_usage_ledger": {- "name": "agent_quota_usage_ledger",+ "public.artboard_boards": {+ "name": "artboard_boards","schema": "","columns": {"id": {"name": "id","type": "uuid","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "account_id": {- "name": "account_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "workspace_id": {- "name": "workspace_id",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "provider": {- "name": "provider",+ "page_id": {+ "name": "page_id","type": "text","primaryKey": false,"notNull": true},- "model": {- "name": "model",+ "group_id": {+ "name": "group_id","type": "text","primaryKey": false,"notNull": false},- "occurred_at": {- "name": "occurred_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true- },- "input_tokens": {- "name": "input_tokens",- "type": "integer",+ "round_id": {+ "name": "round_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "output_tokens": {- "name": "output_tokens",- "type": "integer",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "cache_read_tokens": {- "name": "cache_read_tokens",- "type": "integer",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,"notNull": false},- "cache_write_tokens": {- "name": "cache_write_tokens",- "type": "integer",+ "project_id": {+ "name": "project_id",+ "type": "text","primaryKey": false,"notNull": false},- "reasoning_tokens": {- "name": "reasoning_tokens",- "type": "integer",+ "acceptance_flow_node_id": {+ "name": "acceptance_flow_node_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "cost_usd": {- "name": "cost_usd",- "type": "numeric(20, 6)",+ "type": {+ "name": "type",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "cost_source": {- "name": "cost_source",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "message_id": {- "name": "message_id",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "operation_id": {- "name": "operation_id",+ "expected": {+ "name": "expected","type": "text","primaryKey": false,"notNull": false},- "topic_id": {- "name": "topic_id",- "type": "text",+ "rect": {+ "name": "rect",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "source_work_version_id": {+ "name": "source_work_version_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "source_path": {+ "name": "source_path","type": "text","primaryKey": false,"notNull": false},- "external_event_id": {- "name": "external_event_id",+ "source_file_id": {+ "name": "source_file_id","type": "text","primaryKey": false,"notNull": false@@ -9441,26 +11652,34 @@"primaryKey": false,"notNull": false},+ "accessed_at": {+ "name": "accessed_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": {- "agent_quota_usage_ledger_account_occurred_idx": {- "name": "agent_quota_usage_ledger_account_occurred_idx",+ "artboard_boards_artboard_id_idx": {+ "name": "artboard_boards_artboard_id_idx","columns": [{- "expression": "account_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "occurred_at",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"@@ -9471,80 +11690,103 @@"method": "btree","with": {}},- "agent_quota_usage_ledger_account_model_occurred_idx": {- "name": "agent_quota_usage_ledger_account_model_occurred_idx",+ "artboard_boards_page_id_idx": {+ "name": "artboard_boards_page_id_idx","columns": [{- "expression": "account_id",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_group_id_idx": {+ "name": "artboard_boards_group_id_idx",+ "columns": [{- "expression": "model",+ "expression": "group_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "where": "\"artboard_boards\".\"group_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_round_id_idx": {+ "name": "artboard_boards_round_id_idx",+ "columns": [{- "expression": "occurred_at",+ "expression": "round_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_boards\".\"round_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_quota_usage_ledger_message_id_idx": {- "name": "agent_quota_usage_ledger_message_id_idx",+ "artboard_boards_project_id_idx": {+ "name": "artboard_boards_project_id_idx","columns": [{- "expression": "message_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_boards\".\"project_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_quota_usage_ledger_operation_id_idx": {- "name": "agent_quota_usage_ledger_operation_id_idx",+ "artboard_boards_acceptance_flow_node_id_unique": {+ "name": "artboard_boards_acceptance_flow_node_id_unique","columns": [{- "expression": "operation_id",+ "expression": "acceptance_flow_node_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"artboard_boards\".\"acceptance_flow_node_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_quota_usage_ledger_workspace_id_idx": {- "name": "agent_quota_usage_ledger_workspace_id_idx",+ "artboard_boards_source_work_version_id_idx": {+ "name": "artboard_boards_source_work_version_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "source_work_version_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_boards\".\"source_work_version_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_quota_usage_ledger_user_id_idx": {- "name": "agent_quota_usage_ledger_user_id_idx",+ "artboard_boards_user_id_idx": {+ "name": "artboard_boards_user_id_idx","columns": [{"expression": "user_id",@@ -9558,83 +11800,101 @@"method": "btree","with": {}},- "agent_quota_usage_ledger_external_event_unique": {- "name": "agent_quota_usage_ledger_external_event_unique",+ "artboard_boards_workspace_id_idx": {+ "name": "artboard_boards_workspace_id_idx","columns": [{- "expression": "external_event_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"agent_quota_usage_ledger\".\"external_event_id\" IS NOT NULL",+ "isUnique": false,+ "where": "\"artboard_boards\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk": {- "name": "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_quota_usage_ledger",- "tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],+ "artboard_boards_artboard_id_artboards_id_fk": {+ "name": "artboard_boards_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_boards_page_id_artboard_pages_id_fk": {+ "name": "artboard_boards_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_boards_group_id_artboard_groups_id_fk": {+ "name": "artboard_boards_group_id_artboard_groups_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboard_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_boards_round_id_artboard_rounds_id_fk": {+ "name": "artboard_boards_round_id_artboard_rounds_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboard_rounds",+ "columnsFrom": ["round_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "agent_quota_usage_ledger_user_id_users_id_fk": {- "name": "agent_quota_usage_ledger_user_id_users_id_fk",- "tableFrom": "agent_quota_usage_ledger",+ "artboard_boards_user_id_users_id_fk": {+ "name": "artboard_boards_user_id_users_id_fk",+ "tableFrom": "artboard_boards","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_quota_usage_ledger_workspace_id_workspaces_id_fk": {- "name": "agent_quota_usage_ledger_workspace_id_workspaces_id_fk",- "tableFrom": "agent_quota_usage_ledger",+ "artboard_boards_workspace_id_workspaces_id_fk": {+ "name": "artboard_boards_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_boards","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_quota_usage_ledger_message_id_messages_id_fk": {- "name": "agent_quota_usage_ledger_message_id_messages_id_fk",- "tableFrom": "agent_quota_usage_ledger",- "tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "agent_quota_usage_ledger_operation_id_agent_operations_id_fk": {- "name": "agent_quota_usage_ledger_operation_id_agent_operations_id_fk",- "tableFrom": "agent_quota_usage_ledger",- "tableTo": "agent_operations",- "columnsFrom": ["operation_id"],+ "artboard_boards_project_id_projects_id_fk": {+ "name": "artboard_boards_project_id_projects_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "agent_quota_usage_ledger_topic_id_topics_id_fk": {- "name": "agent_quota_usage_ledger_topic_id_topics_id_fk",- "tableFrom": "agent_quota_usage_ledger",- "tableTo": "topics",- "columnsFrom": ["topic_id"],+ "artboard_boards_source_work_version_id_work_versions_id_fk": {+ "name": "artboard_boards_source_work_version_id_work_versions_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "work_versions",+ "columnsFrom": ["source_work_version_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "agent_quota_usage_ledger_agent_id_agents_id_fk": {- "name": "agent_quota_usage_ledger_agent_id_agents_id_fk",- "tableFrom": "agent_quota_usage_ledger",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "artboard_boards_source_file_id_files_id_fk": {+ "name": "artboard_boards_source_file_id_files_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "files",+ "columnsFrom": ["source_file_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"@@ -9643,11 +11903,20 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "artboard_boards_single_source_check": {+ "name": "artboard_boards_single_source_check",+ "value": "num_nonnulls(\"artboard_boards\".\"source_work_version_id\", \"artboard_boards\".\"source_file_id\") <= 1"+ },+ "artboard_boards_decision_no_source_check": {+ "name": "artboard_boards_decision_no_source_check",+ "value": "\"artboard_boards\".\"type\" <> 'decision' OR num_nonnulls(\"artboard_boards\".\"source_work_version_id\", \"artboard_boards\".\"source_file_id\", \"artboard_boards\".\"source_path\") = 0"+ }+ },"isRLSEnabled": false},- "public.agent_quota_windows": {- "name": "agent_quota_windows",+ "public.artboard_comments": {+ "name": "artboard_comments","schema": "","columns": {"id": {@@ -9657,111 +11926,102 @@"notNull": true,"default": "gen_random_uuid()"},- "account_id": {- "name": "account_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "user_id": {- "name": "user_id",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "limit_type": {- "name": "limit_type",+ "author_user_id": {+ "name": "author_user_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "scope_key": {- "name": "scope_key",+ "author_agent_id": {+ "name": "author_agent_id","type": "text","primaryKey": false,- "notNull": true,- "default": "''"- },- "resets_at": {- "name": "resets_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true- },- "window_start_at": {- "name": "window_start_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true+ "notNull": false},- "window_seconds": {- "name": "window_seconds",- "type": "integer",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "peak_utilization": {- "name": "peak_utilization",- "type": "integer",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "last_utilization": {- "name": "last_utilization",- "type": "integer",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,"notNull": false},- "rate_limited_at": {- "name": "rate_limited_at",- "type": "timestamp with time zone",+ "group_id": {+ "name": "group_id",+ "type": "text","primaryKey": false,"notNull": false},- "observed_cost_usd": {- "name": "observed_cost_usd",- "type": "numeric(20, 6)",+ "board_id": {+ "name": "board_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "observed_tokens": {- "name": "observed_tokens",- "type": "bigint",+ "content": {+ "name": "content",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "estimated_capacity_usd": {- "name": "estimated_capacity_usd",- "type": "numeric(20, 6)",+ "client_id": {+ "name": "client_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "contaminated": {- "name": "contaminated",- "type": "boolean",+ "anchor": {+ "name": "anchor",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": false+ "notNull": false},- "first_seen_at": {- "name": "first_seen_at",+ "delivered_at": {+ "name": "delivered_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "last_seen_at": {- "name": "last_seen_at",+ "resolved_at": {+ "name": "resolved_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },"accessed_at": {"name": "accessed_at","type": "timestamp with time zone",@@ -9785,50 +12045,74 @@}},"indexes": {- "agent_quota_windows_natural_key_unique": {- "name": "agent_quota_windows_natural_key_unique",+ "artboard_comments_artboard_id_author_user_id_client_id_unique": {+ "name": "artboard_comments_artboard_id_author_user_id_client_id_unique","columns": [{- "expression": "account_id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "limit_type",+ "expression": "author_user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "scope_key",+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_artboard_id_created_at_idx": {+ "name": "artboard_comments_artboard_id_created_at_idx",+ "columns": [+ {+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "resets_at",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_quota_windows_account_resets_idx": {- "name": "agent_quota_windows_account_resets_idx",+ "artboard_comments_parent_comment_id_idx": {+ "name": "artboard_comments_parent_comment_id_idx","columns": [{- "expression": "account_id",+ "expression": "parent_comment_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_board_id_idx": {+ "name": "artboard_comments_board_id_idx",+ "columns": [{- "expression": "resets_at",+ "expression": "board_id","isExpression": false,"asc": true,"nulls": "last"@@ -9839,8 +12123,8 @@"method": "btree","with": {}},- "agent_quota_windows_user_id_idx": {- "name": "agent_quota_windows_user_id_idx",+ "artboard_comments_user_id_idx": {+ "name": "artboard_comments_user_id_idx","columns": [{"expression": "user_id",@@ -9854,8 +12138,8 @@"method": "btree","with": {}},- "agent_quota_windows_workspace_id_idx": {- "name": "agent_quota_windows_workspace_id_idx",+ "artboard_comments_workspace_id_idx": {+ "name": "artboard_comments_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -9865,145 +12149,132 @@}],"isUnique": false,+ "where": "\"artboard_comments\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}- }- },- "foreignKeys": {- "agent_quota_windows_account_id_agent_provider_accounts_id_fk": {- "name": "agent_quota_windows_account_id_agent_provider_accounts_id_fk",- "tableFrom": "agent_quota_windows",- "tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_quota_windows_user_id_users_id_fk": {- "name": "agent_quota_windows_user_id_users_id_fk",- "tableFrom": "agent_quota_windows",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "agent_quota_windows_workspace_id_workspaces_id_fk": {- "name": "agent_quota_windows_workspace_id_workspaces_id_fk",- "tableFrom": "agent_quota_windows",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.agent_shares": {- "name": "agent_shares",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "agent_id": {- "name": "agent_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "visibility": {- "name": "visibility",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'private'"- },- "share_config": {- "name": "share_config",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "user_view_count": {- "name": "user_view_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "accessed_at": {- "name": "accessed_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": {- "agent_shares_agent_id_unique": {- "name": "agent_shares_agent_id_unique",+ "artboard_comments_page_id_idx": {+ "name": "artboard_comments_page_id_idx","columns": [{- "expression": "agent_id",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_shares_visibility_idx": {- "name": "agent_shares_visibility_idx",+ "artboard_comments_group_id_idx": {+ "name": "artboard_comments_group_id_idx","columns": [{- "expression": "visibility",+ "expression": "group_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_comments\".\"group_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_shares_agent_id_agents_id_fk": {- "name": "agent_shares_agent_id_agents_id_fk",- "tableFrom": "agent_shares",+ "artboard_comments_artboard_id_artboards_id_fk": {+ "name": "artboard_comments_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_comments_parent_comment_id_artboard_comments_id_fk": {+ "name": "artboard_comments_parent_comment_id_artboard_comments_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_comments",+ "columnsFrom": ["parent_comment_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_comments_author_user_id_users_id_fk": {+ "name": "artboard_comments_author_user_id_users_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "users",+ "columnsFrom": ["author_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_author_agent_id_agents_id_fk": {+ "name": "artboard_comments_author_agent_id_agents_id_fk",+ "tableFrom": "artboard_comments","tableTo": "agents",- "columnsFrom": ["agent_id"],+ "columnsFrom": ["author_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_user_id_users_id_fk": {+ "name": "artboard_comments_user_id_users_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_comments_workspace_id_workspaces_id_fk": {+ "name": "artboard_comments_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_comments_page_id_artboard_pages_id_fk": {+ "name": "artboard_comments_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_comments_group_id_artboard_groups_id_fk": {+ "name": "artboard_comments_group_id_artboard_groups_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_board_id_artboard_boards_id_fk": {+ "name": "artboard_comments_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_boards",+ "columnsFrom": ["board_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_resolved_by_user_id_users_id_fk": {+ "name": "artboard_comments_resolved_by_user_id_users_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "users",+ "columnsFrom": ["resolved_by_user_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"}},@@ -10013,93 +12284,83 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_skills": {- "name": "agent_skills",+ "public.artboard_edges": {+ "name": "artboard_edges","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "name": {- "name": "name",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",- "type": "text",+ "source_board_id": {+ "name": "source_board_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "identifier": {- "name": "identifier",- "type": "text",+ "target_board_id": {+ "name": "target_board_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "source": {- "name": "source",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "manifest": {- "name": "manifest",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'{}'::jsonb"- },- "content": {- "name": "content",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "editor_data": {- "name": "editor_data",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "resources": {- "name": "resources",- "type": "jsonb",- "primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"- },- "zip_file_hash": {- "name": "zip_file_hash",- "type": "varchar(64)",+ "acceptance_flow_edge_id": {+ "name": "acceptance_flow_edge_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "user_id": {- "name": "user_id",+ "label": {+ "name": "label","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "''"},- "workspace_id": {- "name": "workspace_id",+ "condition": {+ "name": "condition","type": "text","primaryKey": false,"notNull": false},- "deleted_at": {- "name": "deleted_at",- "type": "timestamp with time zone",+ "is_default": {+ "name": "is_default",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},@@ -10126,33 +12387,26 @@}},"indexes": {- "agent_skills_user_name_idx": {- "name": "agent_skills_user_name_idx",+ "artboard_edges_artboard_id_idx": {+ "name": "artboard_edges_artboard_id_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "name",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"agent_skills\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_skills_identifier_idx": {- "name": "agent_skills_identifier_idx",+ "artboard_edges_source_board_id_idx": {+ "name": "artboard_edges_source_board_id_idx","columns": [{- "expression": "identifier",+ "expression": "source_board_id","isExpression": false,"asc": true,"nulls": "last"@@ -10163,26 +12417,27 @@"method": "btree","with": {}},- "agent_skills_user_id_idx": {- "name": "agent_skills_user_id_idx",+ "artboard_edges_source_board_id_default_unique": {+ "name": "artboard_edges_source_board_id_default_unique","columns": [{- "expression": "user_id",+ "expression": "source_board_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"artboard_edges\".\"is_default\" = true","concurrently": false,"method": "btree","with": {}},- "agent_skills_source_idx": {- "name": "agent_skills_source_idx",+ "artboard_edges_target_board_id_idx": {+ "name": "artboard_edges_target_board_id_idx","columns": [{- "expression": "source",+ "expression": "target_board_id","isExpression": false,"asc": true,"nulls": "last"@@ -10193,26 +12448,27 @@"method": "btree","with": {}},- "agent_skills_zip_hash_idx": {- "name": "agent_skills_zip_hash_idx",+ "artboard_edges_acceptance_flow_edge_id_unique": {+ "name": "artboard_edges_acceptance_flow_edge_id_unique","columns": [{- "expression": "zip_file_hash",+ "expression": "acceptance_flow_edge_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"artboard_edges\".\"acceptance_flow_edge_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "agent_skills_workspace_id_idx": {- "name": "agent_skills_workspace_id_idx",+ "artboard_edges_user_id_idx": {+ "name": "artboard_edges_user_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -10223,51 +12479,63 @@"method": "btree","with": {}},- "agent_skills_name_workspace_id_unique": {- "name": "agent_skills_name_workspace_id_unique",+ "artboard_edges_workspace_id_idx": {+ "name": "artboard_edges_workspace_id_idx","columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "name",- "isExpression": false,- "asc": true,- "nulls": "last"}],- "isUnique": true,- "where": "\"agent_skills\".\"workspace_id\" is not null",+ "isUnique": false,+ "where": "\"artboard_edges\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "agent_skills_zip_file_hash_global_files_hash_id_fk": {- "name": "agent_skills_zip_file_hash_global_files_hash_id_fk",- "tableFrom": "agent_skills",- "tableTo": "global_files",- "columnsFrom": ["zip_file_hash"],- "columnsTo": ["hash_id"],- "onDelete": "set null",+ "artboard_edges_artboard_id_artboards_id_fk": {+ "name": "artboard_edges_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade","onUpdate": "no action"},- "agent_skills_user_id_users_id_fk": {- "name": "agent_skills_user_id_users_id_fk",- "tableFrom": "agent_skills",+ "artboard_edges_source_board_id_artboard_boards_id_fk": {+ "name": "artboard_edges_source_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "artboard_boards",+ "columnsFrom": ["source_board_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_edges_target_board_id_artboard_boards_id_fk": {+ "name": "artboard_edges_target_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "artboard_boards",+ "columnsFrom": ["target_board_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_edges_user_id_users_id_fk": {+ "name": "artboard_edges_user_id_users_id_fk",+ "tableFrom": "artboard_edges","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "agent_skills_workspace_id_workspaces_id_fk": {- "name": "agent_skills_workspace_id_workspaces_id_fk",- "tableFrom": "agent_skills",+ "artboard_edges_workspace_id_workspaces_id_fk": {+ "name": "artboard_edges_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_edges","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -10281,65 +12549,27 @@"checkConstraints": {},"isRLSEnabled": false},- "public.ai_models": {- "name": "ai_models",+ "public.artboard_groups": {+ "name": "artboard_groups","schema": "","columns": {"id": {"name": "id",- "type": "varchar(150)",- "primaryKey": false,- "notNull": true- },- "_id": {- "name": "_id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "display_name": {- "name": "display_name",- "type": "varchar(200)",- "primaryKey": false,- "notNull": false+ "notNull": true},- "description": {- "name": "description",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,- "notNull": false- },- "organization": {- "name": "organization",- "type": "varchar(100)",- "primaryKey": false,- "notNull": false- },- "enabled": {- "name": "enabled",- "type": "boolean",- "primaryKey": false,- "notNull": false- },- "provider_id": {- "name": "provider_id",- "type": "varchar(64)",- "primaryKey": false,"notNull": true},- "type": {- "name": "type",- "type": "varchar(20)",- "primaryKey": false,- "notNull": true,- "default": "'chat'"- },- "sort": {- "name": "sort",- "type": "integer",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},"user_id": {"name": "user_id",@@ -10347,60 +12577,39 @@"primaryKey": false,"notNull": true},- "pricing": {- "name": "pricing",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "parameters": {- "name": "parameters",- "type": "jsonb",- "primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"- },- "config": {- "name": "config",- "type": "jsonb",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,"notNull": false},- "abilities": {- "name": "abilities",- "type": "jsonb",- "primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"- },- "context_window_tokens": {- "name": "context_window_tokens",- "type": "integer",+ "kind": {+ "name": "kind",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "source": {- "name": "source",- "type": "varchar(20)",+ "title": {+ "name": "title",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "released_at": {- "name": "released_at",- "type": "varchar(10)",+ "description": {+ "name": "description",+ "type": "text","primaryKey": false,"notNull": false},- "settings": {- "name": "settings",+ "rect": {+ "name": "rect","type": "jsonb","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},@@ -10427,21 +12636,39 @@}},"indexes": {- "ai_models_id_provider_id_user_id_unique": {- "name": "ai_models_id_provider_id_user_id_unique",+ "artboard_groups_artboard_id_idx": {+ "name": "artboard_groups_artboard_id_idx","columns": [{- "expression": "id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_groups_page_id_idx": {+ "name": "artboard_groups_page_id_idx",+ "columns": [{- "expression": "provider_id",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_groups_user_id_idx": {+ "name": "artboard_groups_user_id_idx",+ "columns": [{"expression": "user_id","isExpression": false,@@ -10449,48 +12676,159 @@"nulls": "last"}],- "isUnique": true,- "where": "\"ai_models\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "ai_models_id_provider_id_user_id_workspace_id_unique": {- "name": "ai_models_id_provider_id_user_id_workspace_id_unique",+ "artboard_groups_workspace_id_idx": {+ "name": "artboard_groups_workspace_id_idx","columns": [{- "expression": "id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "provider_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "where": "\"artboard_groups\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "artboard_groups_artboard_id_artboards_id_fk": {+ "name": "artboard_groups_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_groups_page_id_artboard_pages_id_fk": {+ "name": "artboard_groups_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_groups_user_id_users_id_fk": {+ "name": "artboard_groups_user_id_users_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_groups_workspace_id_workspaces_id_fk": {+ "name": "artboard_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.artboard_pages": {+ "name": "artboard_pages",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "artboard_id": {+ "name": "artboard_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_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": {+ "artboard_pages_artboard_id_idx": {+ "name": "artboard_pages_artboard_id_idx",+ "columns": [{- "expression": "workspace_id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"ai_models\".\"workspace_id\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "ai_models_user_id_idx": {- "name": "ai_models_user_id_idx",+ "artboard_pages_user_id_idx": {+ "name": "artboard_pages_user_id_idx","columns": [{"expression": "user_id",@@ -10504,8 +12842,8 @@"method": "btree","with": {}},- "ai_models_workspace_id_idx": {- "name": "ai_models_workspace_id_idx",+ "artboard_pages_workspace_id_idx": {+ "name": "artboard_pages_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -10515,24 +12853,34 @@}],"isUnique": false,+ "where": "\"artboard_pages\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "ai_models_user_id_users_id_fk": {- "name": "ai_models_user_id_users_id_fk",- "tableFrom": "ai_models",+ "artboard_pages_artboard_id_artboards_id_fk": {+ "name": "artboard_pages_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_pages",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_pages_user_id_users_id_fk": {+ "name": "artboard_pages_user_id_users_id_fk",+ "tableFrom": "artboard_pages","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "ai_models_workspace_id_workspaces_id_fk": {- "name": "ai_models_workspace_id_workspaces_id_fk",- "tableFrom": "ai_models",+ "artboard_pages_workspace_id_workspaces_id_fk": {+ "name": "artboard_pages_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_pages","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -10546,98 +12894,81 @@"checkConstraints": {},"isRLSEnabled": false},- "public.ai_providers": {- "name": "ai_providers",+ "public.artboard_rounds": {+ "name": "artboard_rounds","schema": "","columns": {"id": {"name": "id",- "type": "varchar(64)",- "primaryKey": false,- "notNull": true- },- "name": {- "name": "name",- "type": "text",- "primaryKey": false,- "notNull": false- },- "_id": {- "name": "_id","type": "uuid","primaryKey": true,"notNull": true,"default": "gen_random_uuid()"},- "user_id": {- "name": "user_id",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,"notNull": true},- "sort": {- "name": "sort",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "enabled": {- "name": "enabled",- "type": "boolean",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "fetch_on_client": {- "name": "fetch_on_client",- "type": "boolean",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "check_model": {- "name": "check_model",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "logo": {- "name": "logo",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "description": {- "name": "description",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'open'"},- "key_vaults": {- "name": "key_vaults",- "type": "text",+ "recommended_board_id": {+ "name": "recommended_board_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "source": {- "name": "source",- "type": "varchar(20)",+ "chosen_board_id": {+ "name": "chosen_board_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "settings": {- "name": "settings",- "type": "jsonb",+ "selected_by": {+ "name": "selected_by",+ "type": "text","primaryKey": false,"notNull": false},- "config": {- "name": "config",- "type": "jsonb",+ "selected_at": {+ "name": "selected_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},@@ -10664,43 +12995,54 @@}},"indexes": {- "ai_providers_id_user_id_unique": {- "name": "ai_providers_id_user_id_unique",+ "artboard_rounds_artboard_id_idx": {+ "name": "artboard_rounds_artboard_id_idx","columns": [{- "expression": "id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_page_id_idx": {+ "name": "artboard_rounds_page_id_idx",+ "columns": [{- "expression": "user_id",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"ai_providers\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "ai_providers_id_user_id_workspace_id_unique": {- "name": "ai_providers_id_user_id_workspace_id_unique",+ "artboard_rounds_user_id_idx": {+ "name": "artboard_rounds_user_id_idx","columns": [- {- "expression": "id",- "isExpression": false,- "asc": true,- "nulls": "last"- },{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_workspace_id_idx": {+ "name": "artboard_rounds_workspace_id_idx",+ "columns": [{"expression": "workspace_id","isExpression": false,@@ -10708,61 +13050,108 @@"nulls": "last"}],- "isUnique": true,- "where": "\"ai_providers\".\"workspace_id\" is not null",+ "isUnique": false,+ "where": "\"artboard_rounds\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "ai_providers_user_id_idx": {- "name": "ai_providers_user_id_idx",+ "artboard_rounds_recommended_board_id_idx": {+ "name": "artboard_rounds_recommended_board_id_idx","columns": [{- "expression": "user_id",+ "expression": "recommended_board_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_rounds\".\"recommended_board_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "ai_providers_workspace_id_idx": {- "name": "ai_providers_workspace_id_idx",+ "artboard_rounds_chosen_board_id_idx": {+ "name": "artboard_rounds_chosen_board_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "chosen_board_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_rounds\".\"chosen_board_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "ai_providers_user_id_users_id_fk": {- "name": "ai_providers_user_id_users_id_fk",- "tableFrom": "ai_providers",+ "artboard_rounds_artboard_id_artboards_id_fk": {+ "name": "artboard_rounds_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_rounds_page_id_artboard_pages_id_fk": {+ "name": "artboard_rounds_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_rounds_user_id_users_id_fk": {+ "name": "artboard_rounds_user_id_users_id_fk",+ "tableFrom": "artboard_rounds","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "ai_providers_workspace_id_workspaces_id_fk": {- "name": "ai_providers_workspace_id_workspaces_id_fk",- "tableFrom": "ai_providers",+ "artboard_rounds_workspace_id_workspaces_id_fk": {+ "name": "artboard_rounds_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_rounds","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "artboard_rounds_recommended_board_id_artboard_boards_id_fk": {+ "name": "artboard_rounds_recommended_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboard_boards",+ "columnsFrom": ["recommended_board_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_rounds_chosen_board_id_artboard_boards_id_fk": {+ "name": "artboard_rounds_chosen_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboard_boards",+ "columnsFrom": ["chosen_board_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_rounds_selected_by_users_id_fk": {+ "name": "artboard_rounds_selected_by_users_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "users",+ "columnsFrom": ["selected_by"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -10771,8 +13160,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.api_keys": {- "name": "api_keys",+ "public.artboards": {+ "name": "artboards","schema": "","columns": {"id": {@@ -10781,59 +13170,78 @@"primaryKey": true,"notNull": true},- "name": {- "name": "name",- "type": "varchar(256)",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "key": {- "name": "key",- "type": "varchar(256)",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "key_hash": {- "name": "key_hash",- "type": "varchar(128)",+ "topic_id": {+ "name": "topic_id",+ "type": "text","primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "task_id": {+ "name": "task_id",+ "type": "text","primaryKey": false,- "notNull": false,- "default": true+ "notNull": false},- "scopes": {- "name": "scopes",- "type": "jsonb",+ "project_id": {+ "name": "project_id",+ "type": "text","primaryKey": false,"notNull": false},- "expires_at": {- "name": "expires_at",- "type": "timestamp with time zone",+ "acceptance_id": {+ "name": "acceptance_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "last_used_at": {- "name": "last_used_at",- "type": "timestamp with time zone",+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text","primaryKey": false,"notNull": false},- "user_id": {- "name": "user_id",+ "content": {+ "name": "content","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "workspace_id": {- "name": "workspace_id",+ "phase": {+ "name": "phase","type": "text","primaryKey": false,+ "notNull": true,+ "default": "'discuss'"+ },+ "revision": {+ "name": "revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,"notNull": false},"accessed_at": {@@ -10859,8 +13267,8 @@}},"indexes": {- "api_keys_user_id_idx": {- "name": "api_keys_user_id_idx",+ "artboards_user_id_idx": {+ "name": "artboards_user_id_idx","columns": [{"expression": "user_id",@@ -10874,8 +13282,8 @@"method": "btree","with": {}},- "api_keys_workspace_id_idx": {- "name": "api_keys_workspace_id_idx",+ "artboards_workspace_id_idx": {+ "name": "artboards_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -10885,44 +13293,162 @@}],"isUnique": false,+ "where": "\"artboards\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_topic_id_idx": {+ "name": "artboards_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboards\".\"topic_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_task_id_idx": {+ "name": "artboards_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboards\".\"task_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_project_id_idx": {+ "name": "artboards_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_phase_idx": {+ "name": "artboards_phase_idx",+ "columns": [+ {+ "expression": "phase",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_created_at_idx": {+ "name": "artboards_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_updated_at_idx": {+ "name": "artboards_updated_at_idx",+ "columns": [+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "api_keys_user_id_users_id_fk": {- "name": "api_keys_user_id_users_id_fk",- "tableFrom": "api_keys",+ "artboards_user_id_users_id_fk": {+ "name": "artboards_user_id_users_id_fk",+ "tableFrom": "artboards","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "api_keys_workspace_id_workspaces_id_fk": {- "name": "api_keys_workspace_id_workspaces_id_fk",- "tableFrom": "api_keys",+ "artboards_workspace_id_workspaces_id_fk": {+ "name": "artboards_workspace_id_workspaces_id_fk",+ "tableFrom": "artboards","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {- "api_keys_key_unique": {- "name": "api_keys_key_unique",- "nullsNotDistinct": false,- "columns": ["key"]},- "api_keys_key_hash_unique": {- "name": "api_keys_key_hash_unique",- "nullsNotDistinct": false,- "columns": ["key_hash"]+ "artboards_topic_id_topics_id_fk": {+ "name": "artboards_topic_id_topics_id_fk",+ "tableFrom": "artboards",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboards_task_id_tasks_id_fk": {+ "name": "artboards_task_id_tasks_id_fk",+ "tableFrom": "artboards",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboards_project_id_projects_id_fk": {+ "name": "artboards_project_id_projects_id_fk",+ "tableFrom": "artboards",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboards_acceptance_id_acceptances_id_fk": {+ "name": "artboards_acceptance_id_acceptances_id_fk",+ "tableFrom": "artboards",+ "tableTo": "acceptances",+ "columnsFrom": ["acceptance_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false@@ -12053,24 +14579,8 @@"method": "btree","with": {}},- "channel_jobs_active_member_unique": {- "name": "channel_jobs_active_member_unique",- "columns": [- {- "expression": "member_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"channel_jobs\".\"writer_held\" AND \"channel_jobs\".\"isolated_at\" IS NULL",- "concurrently": false,- "method": "btree",- "with": {}- },- "channel_jobs_active_directory_unique": {- "name": "channel_jobs_active_directory_unique",+ "channel_jobs_active_directory_idx": {+ "name": "channel_jobs_active_directory_idx","columns": [{"expression": "device_id",@@ -12085,8 +14595,8 @@"nulls": "last"}],- "isUnique": true,- "where": "\"channel_jobs\".\"device_id\" IS NOT NULL AND \"channel_jobs\".\"working_directory\" IS NOT NULL AND \"channel_jobs\".\"writer_held\"",+ "isUnique": false,+ "where": "\"channel_jobs\".\"writer_held\"","concurrently": false,"method": "btree","with": {}@@ -12391,6 +14901,32 @@"primaryKey": false,"notNull": false},+ "section_id": {+ "name": "section_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "pinned": {+ "name": "pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "hidden": {+ "name": "hidden",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "pinned_at": {+ "name": "pinned_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },"agent_id": {"name": "agent_id","type": "text",@@ -12483,6 +15019,22 @@"method": "btree","with": {}},+ "channel_members_section_id_idx": {+ "name": "channel_members_section_id_idx",+ "columns": [+ {+ "expression": "section_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channel_members\".\"section_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"channel_members_agent_id_idx": {"name": "channel_members_agent_id_idx","columns": [@@ -12518,6 +15070,15 @@"onDelete": "set null","onUpdate": "no action"},+ "channel_members_section_id_channel_sections_id_fk": {+ "name": "channel_members_section_id_channel_sections_id_fk",+ "tableFrom": "channel_members",+ "tableTo": "channel_sections",+ "columnsFrom": ["section_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },"channel_members_agent_id_agents_id_fk": {"name": "channel_members_agent_id_agents_id_fk","tableFrom": "channel_members",@@ -12562,6 +15123,10 @@"name": "channel_members_agent_id_owner_check","value": "\"channel_members\".\"agent_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'agent'"},+ "channel_members_section_id_owner_check": {+ "name": "channel_members_section_id_owner_check",+ "value": "\"channel_members\".\"section_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'user'"+ },"channel_members_config_owner_check": {"name": "channel_members_config_owner_check","value": "\"channel_members\".\"config\" IS NULL OR \"channel_members\".\"actor_type\" <> 'user'"@@ -12937,12 +15502,114 @@"channel_messages_user_sender_check": {"name": "channel_messages_user_sender_check","value": "\"channel_messages\".\"routing_status\" <> 'reply' OR \"channel_messages\".\"user_id\" IS NULL"+ }+ },+ "isRLSEnabled": false+ },+ "public.channel_sections": {+ "name": "channel_sections",+ "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+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sort": {+ "name": "sort",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "collapsed": {+ "name": "collapsed",+ "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": {+ "channel_sections_user_id_workspace_id_idx": {+ "name": "channel_sections_user_id_workspace_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_sections_user_id_users_id_fk": {+ "name": "channel_sections_user_id_users_id_fk",+ "tableFrom": "channel_sections",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "channel_messages_agent_sender_check": {- "name": "channel_messages_agent_sender_check",- "value": "\"channel_messages\".\"routing_status\" = 'reply' OR \"channel_messages\".\"agent_id\" IS NULL"+ "channel_sections_workspace_id_workspaces_id_fk": {+ "name": "channel_sections_workspace_id_workspaces_id_fk",+ "tableFrom": "channel_sections",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},"isRLSEnabled": false},"public.channel_threads": {@@ -13110,6 +15777,12 @@"primaryKey": false,"notNull": false},+ "agent_pair_key": {+ "name": "agent_pair_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"title": {"name": "title","type": "text",@@ -13221,6 +15894,34 @@"method": "btree","with": {}},+ "channels_agent_pair_unique": {+ "name": "channels_agent_pair_unique",+ "columns": [+ {+ "expression": "agent_pair_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "coalesce(\"workspace_id\", '')",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"channels\".\"agent_pair_key\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"channels_project_id_idx": {"name": "channels_project_id_idx","columns": [@@ -14058,6 +16759,13 @@"primaryKey": false,"notNull": false},+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },"accessed_at": {"name": "accessed_at","type": "timestamp with time zone",@@ -14394,12 +17102,24 @@"primaryKey": false,"notNull": true},+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"message": {"name": "message","type": "text","primaryKey": false,"notNull": false},+ "source": {+ "name": "source",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },"status": {"name": "status","type": "text",@@ -14453,7 +17173,35 @@}],"isUnique": true,- "where": "\"user_contact_requests\".\"status\" = 'pending'",+ "where": "\"user_contact_requests\".\"status\" = 'pending' AND \"user_contact_requests\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contact_requests_workspace_pending_unique": {+ "name": "user_contact_requests_workspace_pending_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "requester_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "addressee_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_contact_requests\".\"status\" = 'pending' AND \"user_contact_requests\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}@@ -14499,6 +17247,21 @@"concurrently": false,"method": "btree","with": {}+ },+ "user_contact_requests_workspace_id_idx": {+ "name": "user_contact_requests_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {@@ -14519,6 +17282,15 @@"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "user_contact_requests_workspace_id_workspaces_id_fk": {+ "name": "user_contact_requests_workspace_id_workspaces_id_fk",+ "tableFrom": "user_contact_requests",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -14786,6 +17558,12 @@"primaryKey": false,"notNull": true},+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"type": {"name": "type","type": "text",@@ -14868,7 +17646,35 @@}],"isUnique": true,- "where": "\"user_contacts\".\"contact_user_id\" IS NOT NULL",+ "where": "\"user_contacts\".\"contact_user_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contacts_workspace_user_unique": {+ "name": "user_contacts_workspace_user_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "contact_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_contacts\".\"contact_user_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}@@ -14890,7 +17696,29 @@}],"isUnique": true,- "where": "\"user_contacts\".\"agent_id\" IS NOT NULL",+ "where": "\"user_contacts\".\"agent_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contacts_workspace_agent_unique": {+ "name": "user_contacts_workspace_agent_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_contacts\".\"agent_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}@@ -14924,6 +17752,21 @@"concurrently": false,"method": "btree","with": {}+ },+ "user_contacts_workspace_id_idx": {+ "name": "user_contacts_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {@@ -14936,6 +17779,15 @@"onDelete": "cascade","onUpdate": "no action"},+ "user_contacts_workspace_id_workspaces_id_fk": {+ "name": "user_contacts_workspace_id_workspaces_id_fk",+ "tableFrom": "user_contacts",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },"user_contacts_contact_user_id_users_id_fk": {"name": "user_contacts_contact_user_id_users_id_fk","tableFrom": "user_contacts",@@ -16586,6 +19438,12 @@"primaryKey": false,"notNull": false},+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"name": {"name": "name","type": "varchar(255)",@@ -16671,6 +19529,22 @@"method": "btree","with": {}},+ "environments_project_id_unique": {+ "name": "environments_project_id_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"environments\".\"project_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"environments_workspace_visibility_idx": {"name": "environments_workspace_visibility_idx","columns": [@@ -16715,7 +19589,7 @@}],"isUnique": true,- "where": "\"environments\".\"workspace_id\" is null",+ "where": "\"environments\".\"workspace_id\" IS NULL AND \"environments\".\"project_id\" IS NULL","concurrently": false,"method": "btree","with": {}@@ -16743,7 +19617,7 @@}],"isUnique": true,- "where": "\"environments\".\"workspace_id\" is not null",+ "where": "\"environments\".\"workspace_id\" IS NOT NULL AND \"environments\".\"project_id\" IS NULL","concurrently": false,"method": "btree","with": {}@@ -16767,6 +19641,15 @@"columnsTo": ["id"],"onDelete": "restrict","onUpdate": "no action"+ },+ "environments_project_id_projects_id_fk": {+ "name": "environments_project_id_projects_id_fk",+ "tableFrom": "environments",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "restrict",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -23490,113 +26373,320 @@"primaryKey": true,"notNull": true},- "trace_s3_key": {- "name": "trace_s3_key",+ "trace_s3_key": {+ "name": "trace_s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "final_status": {+ "name": "final_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "advances_total": {+ "name": "advances_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "ticks_total": {+ "name": "ticks_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "advances_by_trigger": {+ "name": "advances_by_trigger",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "advances_by_outcome": {+ "name": "advances_by_outcome",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "ticks_by_branch": {+ "name": "ticks_by_branch",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "work_operations": {+ "name": "work_operations",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "nodes_total": {+ "name": "nodes_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "work_resolved": {+ "name": "work_resolved",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "work_retired": {+ "name": "work_retired",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "findings_total": {+ "name": "findings_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "gates_opened": {+ "name": "gates_opened",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "gates_resolved": {+ "name": "gates_resolved",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "human_waiting_ms": {+ "name": "human_waiting_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_traces_started_at_idx": {+ "name": "goal_traces_started_at_idx",+ "columns": [+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_traces_final_status_idx": {+ "name": "goal_traces_final_status_idx",+ "columns": [+ {+ "expression": "final_status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_traces_goal_id_goals_id_fk": {+ "name": "goal_traces_goal_id_goals_id_fk",+ "tableFrom": "goal_traces",+ "tableTo": "goals",+ "columnsFrom": ["goal_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.inbound_webhooks": {+ "name": "inbound_webhooks",+ "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+ },+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "started_at": {- "name": "started_at",- "type": "timestamp with time zone",+ "kind": {+ "name": "kind",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "completed_at": {- "name": "completed_at",- "type": "timestamp with time zone",+ "name": {+ "name": "name",+ "type": "text","primaryKey": false,"notNull": false},- "final_status": {- "name": "final_status",+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id","type": "text","primaryKey": false,"notNull": false},- "advances_total": {- "name": "advances_total",- "type": "integer",+ "instructions": {+ "name": "instructions",+ "type": "text","primaryKey": false,"notNull": false},- "ticks_total": {- "name": "ticks_total",- "type": "integer",+ "secret": {+ "name": "secret",+ "type": "text","primaryKey": false,"notNull": false},- "advances_by_trigger": {- "name": "advances_by_trigger",+ "verification": {+ "name": "verification","type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true},- "advances_by_outcome": {- "name": "advances_by_outcome",+ "config": {+ "name": "config","type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true},- "ticks_by_branch": {- "name": "ticks_by_branch",+ "state": {+ "name": "state","type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'{}'::jsonb"},- "total_cost": {- "name": "total_cost",- "type": "numeric(20, 6)",+ "connector_id": {+ "name": "connector_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "work_operations": {- "name": "work_operations",- "type": "integer",+ "dedupe_key": {+ "name": "dedupe_key",+ "type": "text","primaryKey": false,"notNull": false},- "nodes_total": {- "name": "nodes_total",- "type": "integer",+ "next_maintenance_at": {+ "name": "next_maintenance_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "work_resolved": {- "name": "work_resolved",+ "maintenance_failures": {+ "name": "maintenance_failures","type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},- "work_retired": {- "name": "work_retired",- "type": "integer",+ "last_delivery_at": {+ "name": "last_delivery_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "findings_total": {- "name": "findings_total",- "type": "integer",+ "last_error": {+ "name": "last_error",+ "type": "text","primaryKey": false,"notNull": false},- "gates_opened": {- "name": "gates_opened",+ "wake_count": {+ "name": "wake_count","type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},- "gates_resolved": {- "name": "gates_resolved",- "type": "integer",+ "wake_window_started_at": {+ "name": "wake_window_started_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},- "human_waiting_ms": {- "name": "human_waiting_ms",- "type": "integer",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -23614,26 +26704,115 @@}},"indexes": {- "goal_traces_started_at_idx": {- "name": "goal_traces_started_at_idx",+ "inbound_webhooks_user_kind_dedupe_unique": {+ "name": "inbound_webhooks_user_kind_dedupe_unique","columns": [{- "expression": "started_at",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "dedupe_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"inbound_webhooks\".\"dedupe_key\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_next_maintenance_idx": {+ "name": "inbound_webhooks_next_maintenance_idx",+ "columns": [+ {+ "expression": "next_maintenance_at","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"inbound_webhooks\".\"next_maintenance_at\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "goal_traces_final_status_idx": {- "name": "goal_traces_final_status_idx",+ "inbound_webhooks_user_idx": {+ "name": "inbound_webhooks_user_idx","columns": [{- "expression": "final_status",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_workspace_idx": {+ "name": "inbound_webhooks_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_topic_idx": {+ "name": "inbound_webhooks_topic_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_agent_idx": {+ "name": "inbound_webhooks_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_connector_idx": {+ "name": "inbound_webhooks_connector_idx",+ "columns": [+ {+ "expression": "connector_id","isExpression": false,"asc": true,"nulls": "last"@@ -23646,11 +26825,47 @@}},"foreignKeys": {- "goal_traces_goal_id_goals_id_fk": {- "name": "goal_traces_goal_id_goals_id_fk",- "tableFrom": "goal_traces",- "tableTo": "goals",- "columnsFrom": ["goal_id"],+ "inbound_webhooks_user_id_users_id_fk": {+ "name": "inbound_webhooks_user_id_users_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_workspace_id_workspaces_id_fk": {+ "name": "inbound_webhooks_workspace_id_workspaces_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_agent_id_agents_id_fk": {+ "name": "inbound_webhooks_agent_id_agents_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_topic_id_topics_id_fk": {+ "name": "inbound_webhooks_topic_id_topics_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_connector_id_user_connectors_id_fk": {+ "name": "inbound_webhooks_connector_id_user_connectors_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "user_connectors",+ "columnsFrom": ["connector_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -26651,6 +29866,27 @@"method": "btree","with": {}},+ "messages_user_id_topic_id_idx": {+ "name": "messages_user_id_topic_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"messages_session_id_idx": {"name": "messages_session_id_idx","columns": [diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex a0c6151f816..9bf1fd317de 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -1568,7 +1568,14 @@"when": 1795082781704,"tag": "0223_running_operations_and_message_author_indexes","breakpoints": true+ },+ {+ "idx": 224,+ "version": "7",+ "when": 1795115161849,+ "tag": "0224_agent_deliveries_and_contact_request_source",+ "breakpoints": true}],"version": "6"-}\ No newline at end of file+}diff --git a/packages/database/src/schemas/agentDelivery.ts b/packages/database/src/schemas/agentDelivery.tsnew file mode 100644index 00000000000..91831f1e163--- /dev/null+++ b/packages/database/src/schemas/agentDelivery.ts@@ -0,0 +1,157 @@+import type {+ AgentDeliveryFriction,+ AgentDeliveryOutcome,+ AgentDeliveryOutcomeSource,+ AgentDeliverySubjectType,+ AgentDeliveryWorkRole,+} from '@lobechat/types';+import { sql } from 'drizzle-orm';+import type { AnyPgColumn } from 'drizzle-orm/pg-core';+import { index, integer, jsonb, pgTable, real, text, uniqueIndex, uuid } from 'drizzle-orm/pg-core';++import { amountNumeric, timestamps, timestamptz } from './_helpers';+import { agents } from './agent';+import { channels } from './channel';+import { projects } from './project';+import { tasks } from './task';+import { users } from './user';+import { works, workVersions } from './work';+import { workspaces } from './workspace';++/**+ * An Agent's track record, one row per delivery — like an order on a ride-hailing+ * app: someone asked for something, the Agent took it on and handed back a result,+ * and the requester's verdict (stated or inferred) closes the loop.+ *+ * A row is settled when its carrier is archived (topic, channel thread, task) and+ * is overwritten — never duplicated — if the carrier is reopened and archived+ * again. Several Agents working in one thread each get their own row.+ *+ * Rows are the raw material the Agent's profile stats are read from and that+ * skills and Expertise lessons are later distilled out of.+ */+export const agentDeliveries = pgTable(+ 'agent_deliveries',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ agentId: text('agent_id')+ .references(() => agents.id, { onDelete: 'cascade' })+ .notNull(),++ userId: text('user_id')+ .references(() => users.id, { onDelete: 'cascade' })+ .notNull(),+ workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }),++ /** The carrier this delivery settled on. Polymorphic, so `subjectId` carries no FK. */+ subjectType: text('subject_type').$type<AgentDeliverySubjectType>().notNull(),+ subjectId: text('subject_id').notNull(),+ /** The container delivery (e.g. a task's) this atomic delivery rolls up into. */+ parentDeliveryId: uuid('parent_delivery_id').references((): AnyPgColumn => agentDeliveries.id, {+ onDelete: 'set null',+ }),++ /** Who asked for it; outcomes are read per requester since standards differ. */+ requesterUserId: text('requester_user_id').references(() => users.id, {+ onDelete: 'set null',+ }),+ projectId: text('project_id').references(() => projects.id, { onDelete: 'set null' }),+ channelId: text('channel_id').references(() => channels.id, { onDelete: 'set null' }),+ taskId: text('task_id').references(() => tasks.id, { onDelete: 'set null' }),++ title: text('title'),+ summary: text('summary'),+ /** Same taxonomy as `topic_analyses.category`, so both read on one axis. */+ category: text('category'),++ outcome: text('outcome').$type<AgentDeliveryOutcome>().default('unknown').notNull(),+ outcomeSource: text('outcome_source').$type<AgentDeliveryOutcomeSource>(),+ /** 0–1. */+ outcomeConfidence: real('outcome_confidence'),++ /**+ * Rounds of back-and-forth after the Agent's first hand-off. At most+ * `AGENT_DELIVERY_SMOOTH_MAX_SHOTS` counts as smooth: some rounds are only a+ * confirmation or a small touch-up.+ */+ shots: integer('shots'),+ frictions: jsonb('frictions').$type<AgentDeliveryFriction[]>(),++ /** Total spend in USD across the delivery's runs. */+ totalCost: amountNumeric('total_cost'),+ totalTokens: integer('total_tokens'),+ toolCalls: integer('tool_calls'),+ userMessages: integer('user_messages'),+ agentMessages: integer('agent_messages'),+ durationMs: integer('duration_ms'),++ startedAt: timestamptz('started_at'),+ deliveredAt: timestamptz('delivered_at'),+ /** When the carrier was archived and the delivery judged. */+ settledAt: timestamptz('settled_at'),+ /** Set once the delivery has been distilled into skills / Expertise. */+ distilledAt: timestamptz('distilled_at'),++ /** How the analysis was produced and what it cited (prompt version, evidence message ids). */+ metadata: jsonb('metadata').$type<Record<string, unknown>>(),++ ...timestamps,+ },+ (t) => [+ uniqueIndex('agent_deliveries_subject_agent_unique').on(t.subjectType, t.subjectId, t.agentId),+ index('agent_deliveries_agent_id_settled_at_idx').on(t.agentId, t.settledAt),+ index('agent_deliveries_user_id_settled_at_idx').on(t.userId, t.settledAt),+ index('agent_deliveries_workspace_id_settled_at_idx')+ .on(t.workspaceId, t.settledAt)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ index('agent_deliveries_parent_delivery_id_idx')+ .on(t.parentDeliveryId)+ .where(sql`${t.parentDeliveryId} IS NOT NULL`),+ index('agent_deliveries_project_id_idx')+ .on(t.projectId)+ .where(sql`${t.projectId} IS NOT NULL`),+ index('agent_deliveries_task_id_idx')+ .on(t.taskId)+ .where(sql`${t.taskId} IS NOT NULL`),+ ],+);++export type AgentDeliveryItem = typeof agentDeliveries.$inferSelect;+export type NewAgentDelivery = typeof agentDeliveries.$inferInsert;++/**+ * Works a delivery produced or touched. Many-to-many: one delivery can ship+ * several Works, and one Work can be revised across several deliveries.+ */+export const agentDeliveryWorks = pgTable(+ 'agent_delivery_works',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ deliveryId: uuid('delivery_id')+ .references(() => agentDeliveries.id, { onDelete: 'cascade' })+ .notNull(),+ workId: text('work_id')+ .references(() => works.id, { onDelete: 'cascade' })+ .notNull(),++ workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }),++ role: text('role').$type<AgentDeliveryWorkRole>().notNull(),+ /** The Work's version when the delivery settled. */+ workVersionId: uuid('work_version_id').references(() => workVersions.id, {+ onDelete: 'set null',+ }),++ ...timestamps,+ },+ (t) => [+ uniqueIndex('agent_delivery_works_delivery_id_work_id_unique').on(t.deliveryId, t.workId),+ index('agent_delivery_works_work_id_idx').on(t.workId),+ index('agent_delivery_works_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ ],+);++export type AgentDeliveryWorkItem = typeof agentDeliveryWorks.$inferSelect;+export type NewAgentDeliveryWork = typeof agentDeliveryWorks.$inferInsert;diff --git a/packages/database/src/schemas/contact.ts b/packages/database/src/schemas/contact.tsindex 0cc1a4dc520..2c8bcb2169d 100644--- a/packages/database/src/schemas/contact.ts+++ b/packages/database/src/schemas/contact.ts@@ -1,4 +1,9 @@-import type { ContactMetadata, ContactRequestStatus, ContactType } from '@lobechat/types';+import type {+ ContactMetadata,+ ContactRequestSource,+ ContactRequestStatus,+ ContactType,+} from '@lobechat/types';import { sql } from 'drizzle-orm';import {check,@@ -113,6 +118,8 @@ export const userContactRequests = pgTable(workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }),message: text('message'),+ /** How the requester found the addressee, e.g. a card someone shared; null otherwise. */+ source: jsonb('source').$type<ContactRequestSource>(),status: text('status').$type<ContactRequestStatus>().notNull().default('pending'),respondedAt: timestamptz('responded_at'),diff --git a/packages/database/src/schemas/index.ts b/packages/database/src/schemas/index.tsindex e90618e27c1..159ab1b0b9e 100644--- a/packages/database/src/schemas/index.ts+++ b/packages/database/src/schemas/index.ts@@ -5,6 +5,7 @@ export * from './agent';export * from './agentAccount';export * from './agentBotProvider';export * from './agentCronJob';+export * from './agentDelivery';export * from './agentDocuments';export * from './agentEvalMemory';export * from './agentEvals';diff --git a/packages/types/src/agentDelivery.ts b/packages/types/src/agentDelivery.tsnew file mode 100644index 00000000000..ba0341f63cf--- /dev/null+++ b/packages/types/src/agentDelivery.ts@@ -0,0 +1,39 @@+/**+ * The carrier a delivery settles on. `topic`, `channel_thread` and+ * `channel_message` are atomic events; a `task` is a container whose+ * delivery rolls up the atomic deliveries filed under it.+ */+export type AgentDeliverySubjectType = 'channel_message' | 'channel_thread' | 'task' | 'topic';++/** How the requester received the delivery. */+export type AgentDeliveryOutcome = 'abandoned' | 'accepted' | 'partial' | 'rejected' | 'unknown';++/**+ * Where the outcome came from. Kept apart from the outcome itself because an+ * acceptance the requester stated outright and one inferred from silence are+ * not worth the same in any rate built on top of them.+ * explicit the requester said so (approved, liked, "looks good")+ * behavioral read off what happened next (PR merged, task closed, never revisited)+ * inferred judged by the analysis model from the conversation+ */+export type AgentDeliveryOutcomeSource = 'behavioral' | 'explicit' | 'inferred';++/**+ * Who a round of friction is on. A requester who changed their mind mid-way+ * must not count against the Agent.+ */+export type AgentDeliveryFrictionAttribution = 'agent' | 'external' | 'requester';++/** One reason the delivery took more than a straight run. */+export interface AgentDeliveryFriction {+ attribution: AgentDeliveryFrictionAttribution;+ note?: string;+ /** e.g. 'misunderstood' | 'bug' | 'scope_change' | 'environment' | 'permission'. */+ type: string;+}++/** What the delivery did to a Work it touched. */+export type AgentDeliveryWorkRole = 'created' | 'referenced' | 'updated';++/** A delivery with at most this many rounds after the first hand-off counts as smooth. */+export const AGENT_DELIVERY_SMOOTH_MAX_SHOTS = 3;diff --git a/packages/types/src/contact.ts b/packages/types/src/contact.tsindex f313431e9b7..89244aa48d8 100644--- a/packages/types/src/contact.ts+++ b/packages/types/src/contact.ts@@ -90,3 +90,14 @@ export type ContactSearchResult =/** Owner-side extras of an address book entry; open for later management features. */export type ContactMetadata = Record<string, unknown>;++/**+ * Stored on a contact request sent from a person's card in a Channel: the card message and who+ * shared it. Server-verified at send time, so it never names a referrer who did not share.+ */+export interface ContactRequestSource {+ channelId: string;+ messageId: string;+ referrerId: string | null;+ type: 'card';+}diff --git a/packages/types/src/index.ts b/packages/types/src/index.tsindex 9b5741c0c77..f58dc1c987c 100644--- a/packages/types/src/index.ts+++ b/packages/types/src/index.ts@@ -1,6 +1,7 @@export * from './agent';export * from './agentAccount';export * from './agentAvailability';+export * from './agentDelivery';export * from './agentExecution';export * from './agentGroup';export * from './agentHook';