π€― 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 meeting refine and minutes lifecycle to the model (#22613)
Arvin Xu036450fc2fe9
diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbmlindex d0029a69208..b1ccaf94a79 100644--- a/docs/development/database-schema.dbml+++ b/docs/development/database-schema.dbml@@ -2809,6 +2809,7 @@ table meetings {duration_ms integeraudio_file_id textlocal_audio_path text+ error jsonbvisibility text [not null, default: 'private']accessed_at "timestamp with time zone" [not null, default: `now()`]created_at "timestamp with time zone" [not null, default: `now()`]diff --git a/packages/database/migrations/0209_add_meeting_error.sql b/packages/database/migrations/0209_add_meeting_error.sqlnew file mode 100644index 00000000000..7d482c0428f--- /dev/null+++ b/packages/database/migrations/0209_add_meeting_error.sql@@ -0,0 +1 @@+ALTER TABLE "meetings" ADD COLUMN IF NOT EXISTS "error" jsonb;\ No newline at end of filediff --git a/packages/database/migrations/meta/0199_snapshot.json b/packages/database/migrations/meta/0209_snapshot.jsonsimilarity index 96%rename from packages/database/migrations/meta/0199_snapshot.jsonrename to packages/database/migrations/meta/0209_snapshot.jsonindex 04bd9359f97..43a8ba7abb2 100644--- a/packages/database/migrations/meta/0199_snapshot.json+++ b/packages/database/migrations/meta/0209_snapshot.json@@ -6,9 +6,9 @@},"dialect": "postgresql","enums": {},- "id": "15428217-3557-46ba-8f4f-431a23829ead",+ "id": "c1058806-e910-4f65-99ad-9f434bc92441","policies": {},- "prevId": "2abb741e-cd71-49d5-baa4-0563f57e3a75",+ "prevId": "1e746038-7134-4368-b581-34f87c1b9b32","roles": {},"schemas": {},"sequences": {@@ -1610,6 +1610,13 @@"notNull": false,"default": "'{}'::jsonb"},+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },"revoked_at": {"name": "revoked_at","type": "timestamp with time zone",@@ -2755,271 +2762,128 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_benchmarks": {- "name": "agent_eval_benchmarks",+ "public.agent_eval_memories": {+ "name": "agent_eval_memories","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true- },- "identifier": {- "name": "identifier",- "type": "text",- "primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "name": {- "name": "name",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "rubrics": {- "name": "rubrics",- "type": "jsonb",+ "run_id": {+ "name": "run_id",+ "type": "text","primaryKey": false,"notNull": true},- "reference_url": {- "name": "reference_url",+ "topic_id": {+ "name": "topic_id","type": "text","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "user_id": {- "name": "user_id",+ "thread_id": {+ "name": "thread_id","type": "text","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",+ "attempt_id": {+ "name": "attempt_id","type": "text","primaryKey": false,- "notNull": false- },- "is_system": {- "name": "is_system",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": true+ "notNull": true},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",+ "layer": {+ "name": "layer",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",+ "source": {+ "name": "source",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",+ "fixture_hash": {+ "name": "fixture_hash",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "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,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"agent_eval_benchmarks\".\"workspace_id\" is null",- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_benchmarks_is_system_idx": {- "name": "agent_eval_benchmarks_is_system_idx",- "columns": [- {- "expression": "is_system",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_benchmarks_user_id_idx": {- "name": "agent_eval_benchmarks_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "agent_eval_benchmarks_workspace_id_idx": {- "name": "agent_eval_benchmarks_workspace_id_idx",- "columns": [- {- "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_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",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"+ "notNull": false},- "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"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.agent_eval_datasets": {- "name": "agent_eval_datasets",- "schema": "",- "columns": {- "id": {- "name": "id",+ "title": {+ "name": "title","type": "text",- "primaryKey": true,- "notNull": true+ "primaryKey": false,+ "notNull": false},- "benchmark_id": {- "name": "benchmark_id",+ "summary": {+ "name": "summary","type": "text","primaryKey": false,"notNull": false},- "source_experiment_id": {- "name": "source_experiment_id",+ "details": {+ "name": "details","type": "text","primaryKey": false,"notNull": false},- "identifier": {- "name": "identifier",+ "memory_category": {+ "name": "memory_category","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "user_id": {- "name": "user_id",+ "memory_type": {+ "name": "memory_type","type": "text","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "tags": {+ "name": "tags",+ "type": "jsonb","primaryKey": false,"notNull": false},- "name": {- "name": "name",- "type": "text",+ "payload": {+ "name": "payload",+ "type": "jsonb","primaryKey": false,"notNull": true},- "description": {- "name": "description",- "type": "text",+ "embedding": {+ "name": "embedding",+ "type": "vector(1024)","primaryKey": false,"notNull": false},- "eval_mode": {- "name": "eval_mode",- "type": "text",+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true},- "eval_config": {- "name": "eval_config",- "type": "jsonb",+ "removed_reason": {+ "name": "removed_reason",+ "type": "text","primaryKey": false,"notNull": false},@@ -3052,33 +2916,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"@@ -3089,11 +2946,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"@@ -3104,11 +2961,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"@@ -3119,11 +2976,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"@@ -3134,64 +2991,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"}},@@ -3201,27 +3060,57 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_experiment_benchmarks": {- "name": "agent_eval_experiment_benchmarks",+ "public.agent_eval_benchmarks": {+ "name": "agent_eval_benchmarks","schema": "","columns": {- "experiment_id": {- "name": "experiment_id",+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier","type": "text","primaryKey": false,"notNull": true},- "benchmark_id": {- "name": "benchmark_id",+ "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": true+ "notNull": false},"workspace_id": {"name": "workspace_id",@@ -3229,20 +3118,63 @@"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",+ "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_benchmarks_identifier_user_id_unique": {+ "name": "agent_eval_benchmarks_identifier_user_id_unique","columns": [{- "expression": "benchmark_id",+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"agent_eval_benchmarks\".\"workspace_id\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_benchmarks_is_system_idx": {+ "name": "agent_eval_benchmarks_is_system_idx",+ "columns": [+ {+ "expression": "is_system","isExpression": false,"asc": true,"nulls": "last"@@ -3253,8 +3185,8 @@"method": "btree","with": {}},- "agent_eval_experiment_benchmarks_user_id_idx": {- "name": "agent_eval_experiment_benchmarks_user_id_idx",+ "agent_eval_benchmarks_user_id_idx": {+ "name": "agent_eval_benchmarks_user_id_idx","columns": [{"expression": "user_id",@@ -3268,8 +3200,8 @@"method": "btree","with": {}},- "agent_eval_experiment_benchmarks_workspace_id_idx": {- "name": "agent_eval_experiment_benchmarks_workspace_id_idx",+ "agent_eval_benchmarks_workspace_id_idx": {+ "name": "agent_eval_benchmarks_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -3282,39 +3214,43 @@"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_benchmarks\".\"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"],- "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"],- "columnsTo": ["id"],- "onDelete": "cascade",- "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_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_experiment_benchmarks_workspace_id_workspaces_id_fk": {- "name": "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_experiment_benchmarks",+ "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"],@@ -3322,19 +3258,14 @@"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_datasets": {+ "name": "agent_eval_datasets","schema": "","columns": {"id": {@@ -3343,11 +3274,29 @@"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",@@ -3367,6 +3316,18 @@"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",@@ -3396,9 +3357,15 @@}},"indexes": {- "agent_eval_experiments_user_id_idx": {- "name": "agent_eval_experiments_user_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,@@ -3406,13 +3373,59 @@"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",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],"isUnique": false,"concurrently": false,"method": "btree","with": {}},- "agent_eval_experiments_workspace_id_idx": {- "name": "agent_eval_experiments_workspace_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",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_datasets_workspace_id_idx": {+ "name": "agent_eval_datasets_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -3425,21 +3438,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_experiments_user_id_users_id_fk": {- "name": "agent_eval_experiments_user_id_users_id_fk",- "tableFrom": "agent_eval_experiments",+ "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_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": "set null",+ "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"],"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_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"],@@ -3453,15 +3506,22 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_eval_run_topics": {- "name": "agent_eval_run_topics",+ "public.agent_eval_environments": {+ "name": "agent_eval_environments","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+ "notNull": false},"workspace_id": {"name": "workspace_id",@@ -3469,47 +3529,42 @@"primaryKey": false,"notNull": false},- "run_id": {- "name": "run_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "topic_id": {- "name": "topic_id",+ "identifier": {+ "name": "identifier","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "test_case_id": {- "name": "test_case_id",+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "status": {- "name": "status",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "score": {- "name": "score",- "type": "real",+ "config": {+ "name": "config",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true},- "passed": {- "name": "passed",- "type": "boolean",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "eval_result": {- "name": "eval_result",- "type": "jsonb",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -3517,11 +3572,18 @@"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_run_topics_user_id_idx": {- "name": "agent_eval_run_topics_user_id_idx",+ "agent_eval_environments_user_id_idx": {+ "name": "agent_eval_environments_user_id_idx","columns": [{"expression": "user_id",@@ -3535,11 +3597,11 @@"method": "btree","with": {}},- "agent_eval_run_topics_run_id_idx": {- "name": "agent_eval_run_topics_run_id_idx",+ "agent_eval_environments_workspace_id_idx": {+ "name": "agent_eval_environments_workspace_id_idx","columns": [{- "expression": "run_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -3550,24 +3612,37 @@"method": "btree","with": {}},- "agent_eval_run_topics_test_case_id_idx": {- "name": "agent_eval_run_topics_test_case_id_idx",+ "agent_eval_environments_identifier_user_id_unique": {+ "name": "agent_eval_environments_identifier_user_id_unique","columns": [{- "expression": "test_case_id",+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "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_run_topics_workspace_id_idx": {- "name": "agent_eval_run_topics_workspace_id_idx",+ "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,@@ -3575,64 +3650,471 @@"nulls": "last"}],- "isUnique": false,+ "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_run_topics_user_id_users_id_fk": {- "name": "agent_eval_run_topics_user_id_users_id_fk",- "tableFrom": "agent_eval_run_topics",+ "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_run_topics_workspace_id_workspaces_id_fk": {- "name": "agent_eval_run_topics_workspace_id_workspaces_id_fk",- "tableFrom": "agent_eval_run_topics",+ "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"],"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"],- "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"],- "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"],- "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"]- }+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_experiment_benchmarks": {+ "name": "agent_eval_experiment_benchmarks",+ "schema": "",+ "columns": {+ "experiment_id": {+ "name": "experiment_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "benchmark_id": {+ "name": "benchmark_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+ },+ "created_at": {+ "name": "created_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",+ "columns": [+ {+ "expression": "benchmark_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_experiment_benchmarks_user_id_idx": {+ "name": "agent_eval_experiment_benchmarks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_experiment_benchmarks_workspace_id_idx": {+ "name": "agent_eval_experiment_benchmarks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "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"],+ "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"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "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",+ "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",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "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"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_experiments": {+ "name": "agent_eval_experiments",+ "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+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "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",+ "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_experiments_user_id_idx": {+ "name": "agent_eval_experiments_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_experiments_workspace_id_idx": {+ "name": "agent_eval_experiments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "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"],+ "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",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_eval_run_topics": {+ "name": "agent_eval_run_topics",+ "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",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "test_case_id": {+ "name": "test_case_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "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",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "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",+ "columns": [+ {+ "expression": "run_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_run_topics_test_case_id_idx": {+ "name": "agent_eval_run_topics_test_case_id_idx",+ "columns": [+ {+ "expression": "test_case_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_eval_run_topics_workspace_id_idx": {+ "name": "agent_eval_run_topics_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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"],+ "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"],+ "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"],+ "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"],+ "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"]+ }},"uniqueConstraints": {},"policies": {},@@ -3921,7 +4403,7 @@"name": "user_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},"workspace_id": {"name": "workspace_id",@@ -3935,6 +4417,12 @@"primaryKey": false,"notNull": true},+ "environment_id": {+ "name": "environment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },"content": {"name": "content","type": "jsonb",@@ -4018,6 +4506,21 @@"method": "btree","with": {}},+ "agent_eval_test_cases_environment_id_idx": {+ "name": "agent_eval_test_cases_environment_id_idx",+ "columns": [+ {+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"agent_eval_test_cases_sort_order_idx": {"name": "agent_eval_test_cases_sort_order_idx","columns": [@@ -4076,6 +4579,15 @@"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": {},@@ -4849,6 +5361,21 @@"method": "btree","with": {}},+ "agent_inbox_messages_topic_id_idx": {+ "name": "agent_inbox_messages_topic_id_idx",+ "columns": [+ {+ "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": [@@ -10796,6 +11323,12 @@"primaryKey": false,"notNull": false},+ "wake": {+ "name": "wake",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },"manifest": {"name": "manifest","type": "jsonb",@@ -12103,6 +12636,12 @@"notNull": true,"default": "'private'"},+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },"metadata": {"name": "metadata","type": "jsonb",@@ -20235,6 +20774,12 @@"primaryKey": false,"notNull": false},+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },"visibility": {"name": "visibility","type": "text",@@ -22319,100 +22864,927 @@}},"indexes": {- "linear_sync_rules_project_id_idx": {- "name": "linear_sync_rules_project_id_idx",+ "linear_sync_rules_project_id_idx": {+ "name": "linear_sync_rules_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "linear_sync_rules_connection_id_idx": {+ "name": "linear_sync_rules_connection_id_idx",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "linear_sync_rules_user_id_idx": {+ "name": "linear_sync_rules_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "linear_sync_rules_workspace_id_idx": {+ "name": "linear_sync_rules_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "linear_sync_rules_project_id_projects_id_fk": {+ "name": "linear_sync_rules_project_id_projects_id_fk",+ "tableFrom": "linear_sync_rules",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "linear_sync_rules_connection_id_linear_connections_id_fk": {+ "name": "linear_sync_rules_connection_id_linear_connections_id_fk",+ "tableFrom": "linear_sync_rules",+ "tableTo": "linear_connections",+ "columnsFrom": ["connection_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "linear_sync_rules_user_id_users_id_fk": {+ "name": "linear_sync_rules_user_id_users_id_fk",+ "tableFrom": "linear_sync_rules",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "linear_sync_rules_workspace_id_workspaces_id_fk": {+ "name": "linear_sync_rules_workspace_id_workspaces_id_fk",+ "tableFrom": "linear_sync_rules",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.llm_generation_tracing": {+ "name": "llm_generation_tracing",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "scenario": {+ "name": "scenario",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt_version": {+ "name": "prompt_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt_hash": {+ "name": "prompt_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "schema_name": {+ "name": "schema_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_tracing_id": {+ "name": "parent_tracing_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "success": {+ "name": "success",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error_detail": {+ "name": "error_detail",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "validation_failed": {+ "name": "validation_failed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "input_hash": {+ "name": "input_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_hint": {+ "name": "input_hint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "latency_ms": {+ "name": "latency_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cost_usd": {+ "name": "cost_usd",+ "type": "numeric(12, 8)",+ "primaryKey": false,+ "notNull": false+ },+ "storage_key": {+ "name": "storage_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_signal": {+ "name": "feedback_signal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_score": {+ "name": "feedback_score",+ "type": "numeric(3, 2)",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_source": {+ "name": "feedback_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_data": {+ "name": "feedback_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_updated_at": {+ "name": "feedback_updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "trace_id": {+ "name": "trace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "span_id": {+ "name": "span_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "llm_generation_tracing_scenario_idx": {+ "name": "llm_generation_tracing_scenario_idx",+ "columns": [+ {+ "expression": "scenario",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_prompt_version_idx": {+ "name": "llm_generation_tracing_prompt_version_idx",+ "columns": [+ {+ "expression": "prompt_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_user_id_idx": {+ "name": "llm_generation_tracing_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_agent_id_idx": {+ "name": "llm_generation_tracing_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_topic_id_idx": {+ "name": "llm_generation_tracing_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_workspace_id_idx": {+ "name": "llm_generation_tracing_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_provider_idx": {+ "name": "llm_generation_tracing_provider_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_model_idx": {+ "name": "llm_generation_tracing_model_idx",+ "columns": [+ {+ "expression": "model",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_success_idx": {+ "name": "llm_generation_tracing_success_idx",+ "columns": [+ {+ "expression": "success",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_error_code_idx": {+ "name": "llm_generation_tracing_error_code_idx",+ "columns": [+ {+ "expression": "error_code",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_validation_failed_idx": {+ "name": "llm_generation_tracing_validation_failed_idx",+ "columns": [+ {+ "expression": "validation_failed",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_feedback_signal_idx": {+ "name": "llm_generation_tracing_feedback_signal_idx",+ "columns": [+ {+ "expression": "feedback_signal",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_created_at_idx": {+ "name": "llm_generation_tracing_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "llm_generation_tracing_workspace_id_workspaces_id_fk": {+ "name": "llm_generation_tracing_workspace_id_workspaces_id_fk",+ "tableFrom": "llm_generation_tracing",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.meeting_minutes": {+ "name": "meeting_minutes",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "meeting_id": {+ "name": "meeting_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "chapters": {+ "name": "chapters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "decisions": {+ "name": "decisions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "action_items": {+ "name": "action_items",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "keywords": {+ "name": "keywords",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "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": {+ "meeting_minutes_meeting_id_unique": {+ "name": "meeting_minutes_meeting_id_unique",+ "columns": [+ {+ "expression": "meeting_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "meeting_minutes_document_id_idx": {+ "name": "meeting_minutes_document_id_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "meeting_minutes_meeting_id_meetings_id_fk": {+ "name": "meeting_minutes_meeting_id_meetings_id_fk",+ "tableFrom": "meeting_minutes",+ "tableTo": "meetings",+ "columnsFrom": ["meeting_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "meeting_minutes_document_id_documents_id_fk": {+ "name": "meeting_minutes_document_id_documents_id_fk",+ "tableFrom": "meeting_minutes",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.meeting_segments": {+ "name": "meeting_segments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "meeting_id": {+ "name": "meeting_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "speaker_id": {+ "name": "speaker_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "seq": {+ "name": "seq",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "start_ms": {+ "name": "start_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "end_ms": {+ "name": "end_ms",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "text": {+ "name": "text",+ "type": "text",+ "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": {+ "meeting_segments_meeting_id_source_seq_unique": {+ "name": "meeting_segments_meeting_id_source_seq_unique",+ "columns": [+ {+ "expression": "meeting_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "seq",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "meeting_segments_meeting_id_source_start_ms_idx": {+ "name": "meeting_segments_meeting_id_source_start_ms_idx",+ "columns": [+ {+ "expression": "meeting_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "start_ms",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "meeting_segments_speaker_id_idx": {+ "name": "meeting_segments_speaker_id_idx",+ "columns": [+ {+ "expression": "speaker_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "meeting_segments_meeting_id_meetings_id_fk": {+ "name": "meeting_segments_meeting_id_meetings_id_fk",+ "tableFrom": "meeting_segments",+ "tableTo": "meetings",+ "columnsFrom": ["meeting_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "meeting_segments_speaker_id_meeting_speakers_id_fk": {+ "name": "meeting_segments_speaker_id_meeting_speakers_id_fk",+ "tableFrom": "meeting_segments",+ "tableTo": "meeting_speakers",+ "columnsFrom": ["speaker_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.meeting_speakers": {+ "name": "meeting_speakers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "meeting_id": {+ "name": "meeting_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "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": {+ "meeting_speakers_meeting_id_label_unique": {+ "name": "meeting_speakers_meeting_id_label_unique","columns": [{- "expression": "project_id",+ "expression": "meeting_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_sync_rules_connection_id_idx": {- "name": "linear_sync_rules_connection_id_idx",- "columns": [- {- "expression": "connection_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_sync_rules_user_id_idx": {- "name": "linear_sync_rules_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_sync_rules_workspace_id_idx": {- "name": "linear_sync_rules_workspace_id_idx",- "columns": [+ },{- "expression": "workspace_id",+ "expression": "label","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "linear_sync_rules_project_id_projects_id_fk": {- "name": "linear_sync_rules_project_id_projects_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "linear_sync_rules_connection_id_linear_connections_id_fk": {- "name": "linear_sync_rules_connection_id_linear_connections_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "linear_connections",- "columnsFrom": ["connection_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "linear_sync_rules_user_id_users_id_fk": {- "name": "linear_sync_rules_user_id_users_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "linear_sync_rules_workspace_id_workspaces_id_fk": {- "name": "linear_sync_rules_workspace_id_workspaces_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "meeting_speakers_meeting_id_meetings_id_fk": {+ "name": "meeting_speakers_meeting_id_meetings_id_fk",+ "tableFrom": "meeting_speakers",+ "tableTo": "meetings",+ "columnsFrom": ["meeting_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -22424,8 +23796,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.llm_generation_tracing": {- "name": "llm_generation_tracing",+ "public.meetings": {+ "name": "meetings","schema": "","columns": {"id": {@@ -22435,193 +23807,106 @@"notNull": true,"default": "gen_random_uuid()"},- "scenario": {- "name": "scenario",- "type": "text",- "primaryKey": false,- "notNull": true- },- "prompt_version": {- "name": "prompt_version",- "type": "text",- "primaryKey": false,- "notNull": true- },- "prompt_hash": {- "name": "prompt_hash",- "type": "text",- "primaryKey": false,- "notNull": true- },- "schema_name": {- "name": "schema_name",- "type": "text",- "primaryKey": false,- "notNull": false- },"user_id": {"name": "user_id","type": "text","primaryKey": false,"notNull": true},- "agent_id": {- "name": "agent_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "topic_id": {- "name": "topic_id",- "type": "text",- "primaryKey": false,- "notNull": false- },"workspace_id": {"name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "trigger": {- "name": "trigger",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": false- },- "parent_tracing_id": {- "name": "parent_tracing_id",- "type": "uuid",- "primaryKey": false,- "notNull": false+ "notNull": true},- "provider": {- "name": "provider",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'recording'"},- "model": {- "name": "model",+ "platform": {+ "name": "platform","type": "text","primaryKey": false,- "notNull": false- },- "success": {- "name": "success",- "type": "boolean",- "primaryKey": false,"notNull": true},- "error_code": {- "name": "error_code",+ "realtime_provider": {+ "name": "realtime_provider","type": "text","primaryKey": false,- "notNull": false- },- "error_detail": {- "name": "error_detail",- "type": "text",- "primaryKey": false,- "notNull": false- },- "validation_failed": {- "name": "validation_failed",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": false+ "notNull": true},- "input_hash": {- "name": "input_hash",+ "refine_provider": {+ "name": "refine_provider","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "input_hint": {- "name": "input_hint",+ "language": {+ "name": "language","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'auto'"},- "latency_ms": {- "name": "latency_ms",- "type": "integer",+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},- "input_tokens": {- "name": "input_tokens",- "type": "integer",+ "ended_at": {+ "name": "ended_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "output_tokens": {- "name": "output_tokens",+ "duration_ms": {+ "name": "duration_ms","type": "integer","primaryKey": false,"notNull": false},- "cost_usd": {- "name": "cost_usd",- "type": "numeric(12, 8)",- "primaryKey": false,- "notNull": false- },- "storage_key": {- "name": "storage_key",- "type": "text",- "primaryKey": false,- "notNull": false- },- "feedback_signal": {- "name": "feedback_signal",+ "audio_file_id": {+ "name": "audio_file_id","type": "text","primaryKey": false,"notNull": false},- "feedback_score": {- "name": "feedback_score",- "type": "numeric(3, 2)",- "primaryKey": false,- "notNull": false- },- "feedback_source": {- "name": "feedback_source",+ "local_audio_path": {+ "name": "local_audio_path","type": "text","primaryKey": false,"notNull": false},- "feedback_data": {- "name": "feedback_data",+ "error": {+ "name": "error","type": "jsonb","primaryKey": false,"notNull": false},- "feedback_updated_at": {- "name": "feedback_updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "trace_id": {- "name": "trace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "span_id": {- "name": "span_id",+ "visibility": {+ "name": "visibility","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'private'"},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -22629,149 +23914,33 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "llm_generation_tracing_scenario_idx": {- "name": "llm_generation_tracing_scenario_idx",- "columns": [- {- "expression": "scenario",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_prompt_version_idx": {- "name": "llm_generation_tracing_prompt_version_idx",- "columns": [- {- "expression": "prompt_version",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_user_id_idx": {- "name": "llm_generation_tracing_user_id_idx",+ "meetings_user_id_workspace_id_created_at_idx": {+ "name": "meetings_user_id_workspace_id_created_at_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_agent_id_idx": {- "name": "llm_generation_tracing_agent_id_idx",- "columns": [- {- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_topic_id_idx": {- "name": "llm_generation_tracing_topic_id_idx",- "columns": [- {- "expression": "topic_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_workspace_id_idx": {- "name": "llm_generation_tracing_workspace_id_idx",- "columns": [+ },{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_provider_idx": {- "name": "llm_generation_tracing_provider_idx",- "columns": [- {- "expression": "provider",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_model_idx": {- "name": "llm_generation_tracing_model_idx",- "columns": [- {- "expression": "model",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_success_idx": {- "name": "llm_generation_tracing_success_idx",- "columns": [- {- "expression": "success",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_error_code_idx": {- "name": "llm_generation_tracing_error_code_idx",- "columns": [+ },{- "expression": "error_code",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -22782,26 +23951,17 @@"method": "btree","with": {}},- "llm_generation_tracing_validation_failed_idx": {- "name": "llm_generation_tracing_validation_failed_idx",+ "meetings_workspace_id_created_at_idx": {+ "name": "meetings_workspace_id_created_at_idx","columns": [{- "expression": "validation_failed",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_feedback_signal_idx": {- "name": "llm_generation_tracing_feedback_signal_idx",- "columns": [+ },{- "expression": "feedback_signal",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -22812,11 +23972,11 @@"method": "btree","with": {}},- "llm_generation_tracing_created_at_idx": {- "name": "llm_generation_tracing_created_at_idx",+ "meetings_audio_file_id_idx": {+ "name": "meetings_audio_file_id_idx","columns": [{- "expression": "created_at",+ "expression": "audio_file_id","isExpression": false,"asc": true,"nulls": "last"@@ -22829,14 +23989,32 @@}},"foreignKeys": {- "llm_generation_tracing_workspace_id_workspaces_id_fk": {- "name": "llm_generation_tracing_workspace_id_workspaces_id_fk",- "tableFrom": "llm_generation_tracing",+ "meetings_user_id_users_id_fk": {+ "name": "meetings_user_id_users_id_fk",+ "tableFrom": "meetings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "meetings_workspace_id_workspaces_id_fk": {+ "name": "meetings_workspace_id_workspaces_id_fk",+ "tableFrom": "meetings","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "meetings_audio_file_id_files_id_fk": {+ "name": "meetings_audio_file_id_files_id_fk",+ "tableFrom": "meetings",+ "tableTo": "files",+ "columnsFrom": ["audio_file_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -28997,6 +30175,12 @@"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","type": "timestamp with time zone",@@ -36803,6 +37987,370 @@"checkConstraints": {},"isRLSEnabled": false},+ "public.task_label_links": {+ "name": "task_label_links",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_label_links_task_id_label_id_unique": {+ "name": "task_label_links_task_id_label_id_unique",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_label_links_label_id_idx": {+ "name": "task_label_links_label_id_idx",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_label_links_user_id_idx": {+ "name": "task_label_links_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_label_links_workspace_id_idx": {+ "name": "task_label_links_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_label_links_task_id_tasks_id_fk": {+ "name": "task_label_links_task_id_tasks_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_label_links_label_id_task_labels_id_fk": {+ "name": "task_label_links_label_id_task_labels_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "task_labels",+ "columnsFrom": ["label_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_label_links_user_id_users_id_fk": {+ "name": "task_label_links_user_id_users_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_label_links_workspace_id_workspaces_id_fk": {+ "name": "task_label_links_workspace_id_workspaces_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.task_labels": {+ "name": "task_labels",+ "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+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "is_group": {+ "name": "is_group",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "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+ },+ "sort_order": {+ "name": "sort_order",+ "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": {+ "task_labels_user_id_idx": {+ "name": "task_labels_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_workspace_id_idx": {+ "name": "task_labels_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_parent_id_idx": {+ "name": "task_labels_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_user_id_name_unique": {+ "name": "task_labels_user_id_name_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"name\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"task_labels\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_workspace_id_name_unique": {+ "name": "task_labels_workspace_id_name_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"name\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"task_labels\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_labels_user_id_users_id_fk": {+ "name": "task_labels_user_id_users_id_fk",+ "tableFrom": "task_labels",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "task_labels_workspace_id_workspaces_id_fk": {+ "name": "task_labels_workspace_id_workspaces_id_fk",+ "tableFrom": "task_labels",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_labels_parent_id_task_labels_id_fk": {+ "name": "task_labels_parent_id_task_labels_id_fk",+ "tableFrom": "task_labels",+ "tableTo": "task_labels",+ "columnsFrom": ["parent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },"public.threads": {"name": "threads","schema": "",@@ -46835,11 +48383,18 @@"notNull": true,"default": "'pending'"},+ "reusable": {+ "name": "reusable",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },"expires_at": {"name": "expires_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": false},"created_at": {"name": "created_at",@@ -46947,7 +48502,12 @@}},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "workspace_invitations_expiry_required": {+ "name": "workspace_invitations_expiry_required",+ "value": "\"workspace_invitations\".\"reusable\" OR \"workspace_invitations\".\"expires_at\" IS NOT NULL"+ }+ },"isRLSEnabled": false},"public.workspace_members": {diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex 54968c348a2..1e2ca1679b1 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -1463,6 +1463,13 @@"when": 1794068654788,"tag": "0208_add_meetings","breakpoints": true+ },+ {+ "idx": 209,+ "version": "7",+ "when": 1794149966527,+ "tag": "0209_add_meeting_error",+ "breakpoints": true}],"version": "6"diff --git a/packages/database/src/models/__tests__/meeting.minutes.test.ts b/packages/database/src/models/__tests__/meeting.minutes.test.tsnew file mode 100644index 00000000000..b35e806d20b--- /dev/null+++ b/packages/database/src/models/__tests__/meeting.minutes.test.ts@@ -0,0 +1,130 @@+// @vitest-environment node+import { afterEach, beforeEach, describe, expect, it } from 'vitest';++import { getTestDB } from '../../core/getTestDB';+import { users } from '../../schemas';+import type { LobeChatDatabase } from '../../type';+import { MeetingModel, MeetingStateError } from '../meeting';++const serverDB: LobeChatDatabase = await getTestDB();++const userId = 'meeting-minutes-user';+const otherUserId = 'meeting-minutes-other';+const model = new MeetingModel(serverDB, userId);++const item = (id: string, status: 'created' | 'suggested' = 'suggested') => ({+ id,+ segmentIds: [],+ status,+ text: `to-do ${id}`,+});++/** A meeting whose refine pass just landed and handed over to the minutes. */+const refinedMeeting = async () => {+ const meeting = await model.create({+ platform: 'web',+ realtimeProvider: 'cloud',+ refineProvider: 'cloud',+ title: 'Minutes',+ });+ await model.attachAudio(meeting.id, { localAudioPath: '/tmp/x.wav' });+ await model.finish(meeting.id, { durationMs: 60_000 });+ await model.startRefine(meeting.id);+ await model.completeRefine(+ meeting.id,+ [{ endMs: 4000, seq: 0, speakerLabel: 'S1', startMs: 0, text: 'hello' }],+ { next: 'summarizing' },+ );+ return meeting.id;+};++beforeEach(async () => {+ await serverDB.delete(users);+ await serverDB.insert(users).values([{ id: userId }, { id: otherUserId }]);+});++afterEach(async () => {+ await serverDB.delete(users);+});++describe('MeetingModel minutes', () => {+ it('hands a refined meeting to the minutes without passing through ready', async () => {+ const id = await refinedMeeting();+ expect((await model.findById(id))!.status).toBe('summarizing');++ await model.startMinutes(id);+ const result = await model.completeMinutes(id, {+ actionItems: [item('a')],+ summary: 'Done',+ });++ expect(result!.meeting).toMatchObject({ error: null, status: 'ready' });+ expect(result!.minutes).toMatchObject({ actionItems: [item('a')], summary: 'Done' });+ });++ it('refuses minutes while the transcript is not final', async () => {+ const meeting = await model.create({+ platform: 'web',+ realtimeProvider: 'cloud',+ refineProvider: 'cloud',+ title: 'Live',+ });++ await expect(model.startMinutes(meeting.id)).rejects.toBeInstanceOf(MeetingStateError);+ });++ it('never moves a live meeting to ready', async () => {+ const meeting = await model.create({+ platform: 'web',+ realtimeProvider: 'cloud',+ refineProvider: 'cloud',+ title: 'Live',+ });++ await expect(model.completeMinutes(meeting.id, { summary: 'x' })).rejects.toBeInstanceOf(+ MeetingStateError,+ );+ await expect(+ model.failMinutes(meeting.id, { code: 'quota_exceeded', stage: 'minutes' }),+ ).rejects.toBeInstanceOf(MeetingStateError);+ expect((await model.findById(meeting.id))!.status).toBe('recording');+ });++ it('keeps the meeting ready when only the minutes failed, and clears it on retry', async () => {+ const id = await refinedMeeting();+ await model.startMinutes(id);++ const failed = await model.failMinutes(id, { code: 'quota_exceeded', stage: 'minutes' });+ expect(failed).toMatchObject({+ error: { code: 'quota_exceeded', stage: 'minutes' },+ status: 'ready',+ });++ const restarted = await model.startMinutes(id);+ expect(restarted).toMatchObject({ error: null, status: 'summarizing' });+ });++ it('updates action items under a lock, and only for the creator', async () => {+ const id = await refinedMeeting();+ await model.completeMinutes(id, { actionItems: [item('a'), item('b')] });++ const updated = await model.updateActionItems(id, (items) =>+ items.map((current) =>+ current.id === 'a' ? { ...current, status: 'created' as const, taskId: 'task_1' } : current,+ ),+ );+ expect(updated!.actionItems).toEqual([+ { ...item('a'), status: 'created', taskId: 'task_1' },+ item('b'),+ ]);++ const stranger = new MeetingModel(serverDB, otherUserId);+ expect(await stranger.updateActionItems(id, () => [])).toBeUndefined();+ expect(await stranger.startMinutes(id)).toBeUndefined();+ });++ it('has nothing to update before minutes exist', async () => {+ const id = await refinedMeeting();+ expect(await model.updateActionItems(id, (items) => items)).toBeUndefined();+ });+});diff --git a/packages/database/src/models/__tests__/meeting.refine.test.ts b/packages/database/src/models/__tests__/meeting.refine.test.tsnew file mode 100644index 00000000000..b776edfb3fe--- /dev/null+++ b/packages/database/src/models/__tests__/meeting.refine.test.ts@@ -0,0 +1,151 @@+// @vitest-environment node+import { and, eq } from 'drizzle-orm';+import { afterEach, beforeEach, describe, expect, it } from 'vitest';++import { getTestDB } from '../../core/getTestDB';+import { meetings, meetingSegments, users } from '../../schemas';+import type { LobeChatDatabase } from '../../type';+import { MeetingModel, MeetingStateError } from '../meeting';++const serverDB: LobeChatDatabase = await getTestDB();++const userId = 'meeting-refine-user';+const otherUserId = 'meeting-refine-other';+const model = new MeetingModel(serverDB, userId);++const base = {+ platform: 'web' as const,+ realtimeProvider: 'cloud' as const,+ refineProvider: 'cloud' as const,+ title: 'Refine',+};++/** A meeting that stopped recording with its audio stored. */+const finishedMeeting = async () => {+ const meeting = await model.create(base);+ await model.attachAudio(meeting.id, { localAudioPath: '/tmp/x.wav' });+ await model.finish(meeting.id, { durationMs: 90_000 });+ return meeting.id;+};++const refineRows = (meetingId: string) =>+ serverDB+ .select()+ .from(meetingSegments)+ .where(and(eq(meetingSegments.meetingId, meetingId), eq(meetingSegments.source, 'refine')))+ .orderBy(meetingSegments.seq);++beforeEach(async () => {+ await serverDB.delete(users);+ await serverDB.insert(users).values([{ id: userId }, { id: otherUserId }]);+});++afterEach(async () => {+ await serverDB.delete(users);+});++describe('MeetingModel refine', () => {+ it('replaces the refined transcript as a whole and keeps the live draft', async () => {+ const id = await finishedMeeting();+ await model.appendSegments(id, [+ { endMs: 5000, seq: 0, source: 'realtime', startMs: 0, text: 'draft' },+ ]);++ await model.startRefine(id);+ await model.completeRefine(id, [+ { endMs: 4000, seq: 0, speakerLabel: 'S1', startMs: 0, text: 'one' },+ { endMs: 8000, seq: 1, speakerLabel: 'S2', startMs: 4000, text: 'two' },+ { endMs: 9000, seq: 2, speakerLabel: 'S1', startMs: 8000, text: 'three' },+ ]);++ // A second pass with fewer segments leaves nothing of the first one behind.+ await model.startRefine(id);+ const updated = await model.completeRefine(id, [+ { endMs: 9000, seq: 0, speakerLabel: 'S1', startMs: 0, text: 'all of it' },+ ]);++ expect(updated).toMatchObject({ error: null, status: 'ready' });+ expect((await refineRows(id)).map((row) => row.text)).toEqual(['all of it']);++ const detail = await model.getDetail(id);+ expect(detail?.segmentSource).toBe('refine');+ expect(detail?.speakers.map((speaker) => speaker.label).sort()).toEqual(['S1', 'S2']);+ const draft = await model.getDetail(id, { source: 'realtime' });+ expect(draft?.segments.map((segment) => segment.text)).toEqual(['draft']);+ });++ it('records the failure code and clears it on retry', async () => {+ const id = await finishedMeeting();+ await model.startRefine(id);++ const failed = await model.failRefine(id, {+ code: 'quota_exceeded',+ message: 'InsufficientQuota',+ stage: 'refine',+ });+ expect(failed).toMatchObject({+ error: { code: 'quota_exceeded', stage: 'refine' },+ status: 'failed',+ });++ const retried = await model.startRefine(id);+ expect(retried).toMatchObject({ error: null, status: 'transcribing' });+ });++ it('refuses to refine a meeting that is still recording', async () => {+ const meeting = await model.create(base);+ await expect(model.startRefine(meeting.id)).rejects.toBeInstanceOf(MeetingStateError);++ const [row] = await serverDB.select().from(meetings).where(eq(meetings.id, meeting.id));+ expect(row.status).toBe('recording');+ });++ it('only completes a refine that is in progress', async () => {+ const id = await finishedMeeting();+ await model.startRefine(id);+ await model.completeRefine(id, []);++ await expect(model.completeRefine(id, [])).rejects.toBeInstanceOf(MeetingStateError);+ });++ it('keeps serving the draft while a re-run replaces a refined transcript', async () => {+ const id = await finishedMeeting();+ await model.appendSegments(id, [+ { endMs: 5000, seq: 0, source: 'realtime', startMs: 0, text: 'draft' },+ ]);+ await model.startRefine(id);+ await model.completeRefine(id, [{ endMs: 4000, seq: 0, startMs: 0, text: 'first pass' }]);++ await model.startRefine(id);++ expect((await model.getDetail(id))?.segmentSource).toBe('realtime');+ });++ it('only records a failure for a refine in progress', async () => {+ const meeting = await model.create(base);+ const error = { code: 'transcription_failed' as const, stage: 'refine' as const };++ await expect(model.failRefine(meeting.id, error)).rejects.toBeInstanceOf(MeetingStateError);++ const [row] = await serverDB.select().from(meetings).where(eq(meetings.id, meeting.id));+ expect(row).toMatchObject({ error: null, status: 'recording' });+ });++ it('treats a malformed id as missing', async () => {+ expect(await model.startRefine('not-a-uuid')).toBeUndefined();+ expect(await model.completeRefine('not-a-uuid', [])).toBeUndefined();+ expect(await model.failRefine('not-a-uuid', { code: 'audio_missing', stage: 'refine' })).toBe(+ undefined,+ );+ });++ it("does not touch another user's meeting", async () => {+ const id = await finishedMeeting();+ const stranger = new MeetingModel(serverDB, otherUserId);++ expect(await stranger.startRefine(id)).toBeUndefined();+ expect(await stranger.failRefine(id, { code: 'transcription_failed', stage: 'refine' })).toBe(+ undefined,+ );+ });+});diff --git a/packages/database/src/models/meeting.ts b/packages/database/src/models/meeting.tsindex 63ee5b6b1c6..6217b1f735f 100644--- a/packages/database/src/models/meeting.ts+++ b/packages/database/src/models/meeting.ts@@ -2,6 +2,7 @@ import type {MeetingActionItem,MeetingChapter,MeetingDecision,+ MeetingError,MeetingLanguage,MeetingPlatform,MeetingRealtimeProvider,@@ -75,6 +76,12 @@ export class MeetingStateError extends Error {}}+/** Statuses minutes may be (re)generated from: the transcript is final. */+const SUMMARIZABLE_STATUSES = new Set<MeetingStatus>(['ready', 'summarizing']);++/** Statuses a refine pass may (re)start from: audio is stored and nothing is recording. */+const REFINABLE_STATUSES = new Set<MeetingStatus>(['failed', 'ready', 'transcribing']);+const isLive = (status: MeetingStatus) =>(MEETING_LIVE_STATUSES as readonly MeetingStatus[]).includes(status);@@ -338,39 +345,8 @@ export class MeetingModel {).values(),];- const speakerIds = await this.ensureSpeakers(- tx,- meetingId,- batch.map((segment) => segment.speakerLabel).filter((label): label is string => !!label),- );-- const now = new Date();- const rows = await tx- .insert(meetingSegments)- .values(- batch.map((segment) => ({- endMs: segment.endMs,- meetingId,- seq: segment.seq,- source: segment.source,- speakerId: segment.speakerLabel ? speakerIds.get(segment.speakerLabel) : null,- startMs: segment.startMs,- text: segment.text,- })),- )- .onConflictDoUpdate({- set: {- endMs: sql`excluded.end_ms`,- speakerId: sql`excluded.speaker_id`,- startMs: sql`excluded.start_ms`,- text: sql`excluded.text`,- updatedAt: now,- },- target: [meetingSegments.meetingId, meetingSegments.source, meetingSegments.seq],- })- .returning();-- await tx.update(meetings).set({ updatedAt: now }).where(eq(meetings.id, meetingId));+ const rows = await this.upsertSegments(tx, meetingId, batch);+ await tx.update(meetings).set({ updatedAt: new Date() }).where(eq(meetings.id, meetingId));const byKey = new Map(rows.map((row) => [`${row.source}:${row.seq}`, row]));return segments.map((segment) => byKey.get(`${segment.source}:${segment.seq}`)!);@@ -394,6 +370,195 @@ export class MeetingModel {// ββ Minutes ββ+ // ββ Refine ββ++ /**+ * Enter `transcribing` for a refine pass and clear the previous failure.+ * Allowed once audio is stored and recording has stopped, including a retry+ * after `failed` or a re-run over a `ready` meeting.+ */+ async startRefine(id: string) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(id, tx);+ if (!meeting) return undefined;+ if (!REFINABLE_STATUSES.has(meeting.status)) {+ throw new MeetingStateError(meeting.status, 'refine');+ }++ const [updated] = await tx+ .update(meetings)+ .set({ error: null, status: 'transcribing', updatedAt: new Date() })+ .where(eq(meetings.id, id))+ .returning();++ return updated;+ });+ }++ /**+ * Replace the whole refined transcript in one transaction and mark the+ * meeting `ready` β or `summarizing` when minutes are generated next, so a+ * reader polling the meeting never sees a `ready` without minutes. Re-running+ * a refine therefore never leaves segments of an earlier pass behind. The+ * realtime draft is kept for comparison.+ */+ async completeRefine(+ id: string,+ segments: Omit<AppendMeetingSegmentInput, 'source'>[],+ options: { next?: 'ready' | 'summarizing' } = {},+ ) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(id, tx);+ if (!meeting) return undefined;+ if (meeting.status !== 'transcribing') {+ throw new MeetingStateError(meeting.status, 'complete the refine of');+ }++ await tx+ .delete(meetingSegments)+ .where(and(eq(meetingSegments.meetingId, id), eq(meetingSegments.source, 'refine')));+ if (segments.length > 0) {+ await this.upsertSegments(+ tx,+ id,+ segments.map((segment) => ({ ...segment, source: 'refine' as const })),+ );+ }++ const [updated] = await tx+ .update(meetings)+ .set({ error: null, status: options.next ?? 'ready', updatedAt: new Date() })+ .where(eq(meetings.id, id))+ .returning();++ return updated;+ });+ }++ /** Record why the refine pass failed; the meeting moves to `failed` until retried. */+ async failRefine(id: string, error: MeetingError) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(id, tx);+ if (!meeting) return undefined;+ if (meeting.status !== 'transcribing') {+ throw new MeetingStateError(meeting.status, 'fail the refine of');+ }++ const [updated] = await tx+ .update(meetings)+ .set({ error, status: 'failed', updatedAt: new Date() })+ .where(eq(meetings.id, id))+ .returning();++ return updated;+ });+ }++ // ββ Minutes ββ++ /**+ * Enter `summarizing` for a minutes pass and clear the previous failure.+ * Allowed once the transcript is final (`ready`), and while `summarizing`+ * so a pass interrupted mid-way can be run again.+ */+ async startMinutes(id: string) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(id, tx);+ if (!meeting) return undefined;+ if (!SUMMARIZABLE_STATUSES.has(meeting.status)) {+ throw new MeetingStateError(meeting.status, 'summarize');+ }++ const [updated] = await tx+ .update(meetings)+ .set({ error: null, status: 'summarizing', updatedAt: new Date() })+ .where(eq(meetings.id, id))+ .returning();++ return updated;+ });+ }++ /** Store the generated minutes and mark the meeting `ready`, in one transaction. */+ async completeMinutes(id: string, input: SaveMeetingMinutesInput) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(id, tx);+ if (!meeting) return undefined;+ if (!SUMMARIZABLE_STATUSES.has(meeting.status)) {+ throw new MeetingStateError(meeting.status, 'complete the minutes of');+ }++ const now = new Date();+ const [minutes] = await tx+ .insert(meetingMinutes)+ .values({ ...input, meetingId: id })+ .onConflictDoUpdate({ set: { ...input, updatedAt: now }, target: meetingMinutes.meetingId })+ .returning();++ const [updated] = await tx+ .update(meetings)+ .set({ error: null, status: 'ready', updatedAt: now })+ .where(eq(meetings.id, id))+ .returning();++ return { meeting: updated, minutes };+ });+ }++ /**+ * Record why minutes generation failed. The meeting stays `ready` β its+ * transcript is complete and readable β with `error.stage = 'minutes'`+ * until a retry succeeds.+ */+ async failMinutes(id: string, error: MeetingError) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(id, tx);+ if (!meeting) return undefined;+ if (!SUMMARIZABLE_STATUSES.has(meeting.status)) {+ throw new MeetingStateError(meeting.status, 'fail the minutes of');+ }++ const [updated] = await tx+ .update(meetings)+ .set({ error, status: 'ready', updatedAt: new Date() })+ .where(eq(meetings.id, id))+ .returning();++ return updated;+ });+ }++ /**+ * Read-modify-write the action items under a row lock, so two confirmations+ * of the same minutes (two tabs, a retry) never overwrite each other's task+ * links. `update` receives the stored items and returns the new list.+ */+ async updateActionItems(+ meetingId: string,+ update: (items: MeetingActionItem[]) => MeetingActionItem[],+ ) {+ return this.db.transaction(async (tx) => {+ const meeting = await this.lockManageable(meetingId, tx);+ if (!meeting) return undefined;++ const [minutes] = await tx+ .select()+ .from(meetingMinutes)+ .where(eq(meetingMinutes.meetingId, meetingId))+ .limit(1)+ .for('update');+ if (!minutes) return undefined;++ const [updated] = await tx+ .update(meetingMinutes)+ .set({ actionItems: update(minutes.actionItems), updatedAt: new Date() })+ .where(eq(meetingMinutes.id, minutes.id))+ .returning();++ return updated;+ });+ }+/*** Create or replace the meeting's minutes; omitted fields keep their stored value.*@@ -467,6 +632,44 @@ export class MeetingModel {});}+ private async upsertSegments(+ tx: Transaction,+ meetingId: string,+ batch: AppendMeetingSegmentInput[],+ ) {+ const speakerIds = await this.ensureSpeakers(+ tx,+ meetingId,+ batch.map((segment) => segment.speakerLabel).filter((label): label is string => !!label),+ );++ const now = new Date();+ return tx+ .insert(meetingSegments)+ .values(+ batch.map((segment) => ({+ endMs: segment.endMs,+ meetingId,+ seq: segment.seq,+ source: segment.source,+ speakerId: segment.speakerLabel ? speakerIds.get(segment.speakerLabel) : null,+ startMs: segment.startMs,+ text: segment.text,+ })),+ )+ .onConflictDoUpdate({+ set: {+ endMs: sql`excluded.end_ms`,+ speakerId: sql`excluded.speaker_id`,+ startMs: sql`excluded.start_ms`,+ text: sql`excluded.text`,+ updatedAt: now,+ },+ target: [meetingSegments.meetingId, meetingSegments.source, meetingSegments.seq],+ })+ .returning();+ }+private async ensureSpeakers(tx: Transaction, meetingId: string, labels: string[]) {const unique = [...new Set(labels)];if (unique.length === 0) return new Map<string, string>();diff --git a/packages/database/src/schemas/meeting.ts b/packages/database/src/schemas/meeting.tsindex 720b3ad21fd..d6c884b1136 100644--- a/packages/database/src/schemas/meeting.ts+++ b/packages/database/src/schemas/meeting.ts@@ -2,6 +2,7 @@ import type {MeetingActionItem,MeetingChapter,MeetingDecision,+ MeetingError,MeetingLanguage,MeetingPlatform,MeetingRealtimeProvider,@@ -62,6 +63,8 @@ export const meetings = pgTable(* that captured it, e.g. `~/Library/Application Support/LobeHub/meetings/<meetingId>.wav`.*/localAudioPath: text('local_audio_path'),+ /** Why the meeting is `failed`, so the UI can name the fix; NULL otherwise. */+ error: jsonb('error').$type<MeetingError>(),visibility: text('visibility').$type<MeetingVisibility>().notNull().default('private'),...timestamps,diff --git a/packages/types/src/meeting/index.ts b/packages/types/src/meeting/index.tsindex 57cb5c8074b..ed7474b483c 100644--- a/packages/types/src/meeting/index.ts+++ b/packages/types/src/meeting/index.ts@@ -57,6 +57,37 @@ export type MeetingSegmentSource = (typeof MEETING_SEGMENT_SOURCES)[number];export const MEETING_VISIBILITIES = ['private', 'public'] as const;export type MeetingVisibility = (typeof MEETING_VISIBILITIES)[number];+/** Pipeline stage a meeting failed in: the refine transcript, or the minutes generated from it. */+export const MEETING_ERROR_STAGES = ['refine', 'minutes'] as const;+export type MeetingErrorStage = (typeof MEETING_ERROR_STAGES)[number];++/**+ * Why a post-recording stage failed, chosen so the UI can say what to fix:+ * `provider_not_configured` β set up the transcription model / key,+ * `quota_exceeded` β top up or wait, `provider_unavailable` β retry later,+ * `audio_missing` / `audio_unsupported` β the recording itself is unusable,+ * `transcript_empty` β nothing was said that minutes could cover.+ */+export const MEETING_ERROR_CODES = [+ 'audio_missing',+ 'audio_unsupported',+ 'provider_not_configured',+ 'provider_unavailable',+ 'quota_exceeded',+ 'summarization_failed',+ 'transcript_empty',+ 'transcription_failed',+] as const;+export type MeetingErrorCode = (typeof MEETING_ERROR_CODES)[number];++/** Last failure of a meeting's post-recording pipeline; cleared when the stage is retried. */+export interface MeetingError {+ code: MeetingErrorCode;+ /** Provider or server detail, for support; not shown as the primary message. */+ message?: string;+ stage: MeetingErrorStage;+}+/** A titled span of the meeting timeline. */export interface MeetingChapter {endMs: number;