Skip to content

🤯 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.

🗃️ feat(database): add agent account settings and an inbox topic index (#22557)

Arvin Xu11af25573164
diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbml
index a46832fd4ad..2e22e6dfa8e 100644
--- a/docs/development/database-schema.dbml
+++ b/docs/development/database-schema.dbml
@@ -185,6 +185,7 @@ table agent_accounts {
credentials text
credential_hint jsonb
metadata jsonb [default: `{}`]
+ settings jsonb [not null, default: `{}`]
revoked_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
@@ -606,6 +607,7 @@ table agent_inbox_messages {
(account_id, created_at) [name: 'agent_inbox_messages_account_created_at_idx']
(account_id, sender, created_at) [name: 'agent_inbox_messages_account_sender_created_at_idx']
(account_id, thread_key) [name: 'agent_inbox_messages_account_thread_idx']
+ topic_id [name: 'agent_inbox_messages_topic_id_idx']
user_id [name: 'agent_inbox_messages_user_id_idx']
}
}
diff --git a/packages/database/migrations/0207_agent_account_settings.sql b/packages/database/migrations/0207_agent_account_settings.sql
new file mode 100644
index 00000000000..d8bea9462e3
--- /dev/null
+++ b/packages/database/migrations/0207_agent_account_settings.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "agent_accounts" ADD COLUMN IF NOT EXISTS "settings" jsonb DEFAULT '{}'::jsonb NOT NULL;--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "agent_inbox_messages_topic_id_idx" ON "agent_inbox_messages" USING btree ("topic_id");
diff --git a/packages/database/migrations/meta/0197_snapshot.json b/packages/database/migrations/meta/0207_snapshot.json
similarity index 97%
rename from packages/database/migrations/meta/0197_snapshot.json
rename to packages/database/migrations/meta/0207_snapshot.json
index d1d2477136a..2ea12603038 100644
--- a/packages/database/migrations/meta/0197_snapshot.json
+++ b/packages/database/migrations/meta/0207_snapshot.json
@@ -6,9 +6,9 @@
},
"dialect": "postgresql",
"enums": {},
- "id": "c74b5a61-73c0-412c-b4eb-7631ef66db26",
+ "id": "67cd6047-5e05-4943-b7ab-6e9b44f6bff3",
"policies": {},
- "prevId": "e2f20123-d060-4835-9d0e-a10c82966916",
+ "prevId": "63465691-3d9e-4f5e-b5fe-543adf2bd840",
"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,569 @@
"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
+ },
+ "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_memories_attempt_id_idx": {
+ "name": "agent_eval_memories_attempt_id_idx",
+ "columns": [
+ {
+ "expression": "attempt_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_memories_run_id_idx": {
+ "name": "agent_eval_memories_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_memories_topic_id_idx": {
+ "name": "agent_eval_memories_topic_id_idx",
+ "columns": [
+ {
+ "expression": "topic_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_memories_thread_id_idx": {
+ "name": "agent_eval_memories_thread_id_idx",
+ "columns": [
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_memories_user_id_idx": {
+ "name": "agent_eval_memories_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_memories_workspace_id_idx": {
+ "name": "agent_eval_memories_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_eval_memories_user_id_users_id_fk": {
+ "name": "agent_eval_memories_user_id_users_id_fk",
+ "tableFrom": "agent_eval_memories",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_memories_workspace_id_workspaces_id_fk": {
+ "name": "agent_eval_memories_workspace_id_workspaces_id_fk",
+ "tableFrom": "agent_eval_memories",
+ "tableTo": "workspaces",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_memories_run_id_agent_eval_runs_id_fk": {
+ "name": "agent_eval_memories_run_id_agent_eval_runs_id_fk",
+ "tableFrom": "agent_eval_memories",
+ "tableTo": "agent_eval_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_memories_topic_id_topics_id_fk": {
+ "name": "agent_eval_memories_topic_id_topics_id_fk",
+ "tableFrom": "agent_eval_memories",
+ "tableTo": "topics",
+ "columnsFrom": ["topic_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "agent_eval_memories_thread_id_threads_id_fk": {
+ "name": "agent_eval_memories_thread_id_threads_id_fk",
+ "tableFrom": "agent_eval_memories",
+ "tableTo": "threads",
+ "columnsFrom": ["thread_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_eval_benchmarks": {
+ "name": "agent_eval_benchmarks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rubrics": {
+ "name": "rubrics",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_url": {
+ "name": "reference_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_system": {
+ "name": "is_system",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "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_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"
+ },
+ "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",
+ "type": "text",
+ "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": false
+ },
+ "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
+ },
+ "eval_mode": {
+ "name": "eval_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "eval_config": {
+ "name": "eval_config",
+ "type": "jsonb",
"primaryKey": false,
"notNull": false
},
@@ -3201,6 +3506,183 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "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": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "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_environments_user_id_idx": {
+ "name": "agent_eval_environments_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_environments_workspace_id_idx": {
+ "name": "agent_eval_environments_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_environments_identifier_user_id_unique": {
+ "name": "agent_eval_environments_identifier_user_id_unique",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_eval_environments\".\"identifier\" IS NOT NULL AND \"agent_eval_environments\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_environments_identifier_workspace_id_unique": {
+ "name": "agent_eval_environments_identifier_workspace_id_unique",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_eval_environments\".\"identifier\" IS NOT NULL AND \"agent_eval_environments\".\"workspace_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_eval_environments_user_id_users_id_fk": {
+ "name": "agent_eval_environments_user_id_users_id_fk",
+ "tableFrom": "agent_eval_environments",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_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"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.agent_eval_experiment_benchmarks": {
"name": "agent_eval_experiment_benchmarks",
"schema": "",
@@ -3739,53 +4221,263 @@
}
},
"indexes": {
- "agent_eval_runs_dataset_id_idx": {
- "name": "agent_eval_runs_dataset_id_idx",
- "columns": [
- {
- "expression": "dataset_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_eval_runs_experiment_id_idx": {
- "name": "agent_eval_runs_experiment_id_idx",
- "columns": [
- {
- "expression": "experiment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_eval_runs_parent_run_id_idx": {
- "name": "agent_eval_runs_parent_run_id_idx",
- "columns": [
- {
- "expression": "parent_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_eval_runs_user_id_idx": {
- "name": "agent_eval_runs_user_id_idx",
+ "agent_eval_runs_dataset_id_idx": {
+ "name": "agent_eval_runs_dataset_id_idx",
+ "columns": [
+ {
+ "expression": "dataset_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_runs_experiment_id_idx": {
+ "name": "agent_eval_runs_experiment_id_idx",
+ "columns": [
+ {
+ "expression": "experiment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_runs_parent_run_id_idx": {
+ "name": "agent_eval_runs_parent_run_id_idx",
+ "columns": [
+ {
+ "expression": "parent_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_runs_user_id_idx": {
+ "name": "agent_eval_runs_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_runs_status_idx": {
+ "name": "agent_eval_runs_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_runs_target_agent_id_idx": {
+ "name": "agent_eval_runs_target_agent_id_idx",
+ "columns": [
+ {
+ "expression": "target_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_eval_runs_workspace_id_idx": {
+ "name": "agent_eval_runs_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk": {
+ "name": "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk",
+ "tableFrom": "agent_eval_runs",
+ "tableTo": "agent_eval_datasets",
+ "columnsFrom": ["dataset_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk": {
+ "name": "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk",
+ "tableFrom": "agent_eval_runs",
+ "tableTo": "agent_eval_experiments",
+ "columnsFrom": ["experiment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "agent_eval_runs_target_agent_id_agents_id_fk": {
+ "name": "agent_eval_runs_target_agent_id_agents_id_fk",
+ "tableFrom": "agent_eval_runs",
+ "tableTo": "agents",
+ "columnsFrom": ["target_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_runs_user_id_users_id_fk": {
+ "name": "agent_eval_runs_user_id_users_id_fk",
+ "tableFrom": "agent_eval_runs",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_runs_workspace_id_workspaces_id_fk": {
+ "name": "agent_eval_runs_workspace_id_workspaces_id_fk",
+ "tableFrom": "agent_eval_runs",
+ "tableTo": "workspaces",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk": {
+ "name": "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk",
+ "tableFrom": "agent_eval_runs",
+ "tableTo": "agent_eval_runs",
+ "columnsFrom": ["parent_run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_eval_test_cases": {
+ "name": "agent_eval_test_cases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dataset_id": {
+ "name": "dataset_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "eval_mode": {
+ "name": "eval_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "eval_config": {
+ "name": "eval_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accessed_at": {
+ "name": "accessed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_eval_test_cases_user_id_idx": {
+ "name": "agent_eval_test_cases_user_id_idx",
"columns": [
{
"expression": "user_id",
@@ -3799,200 +4491,11 @@
"method": "btree",
"with": {}
},
- "agent_eval_runs_status_idx": {
- "name": "agent_eval_runs_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_eval_runs_target_agent_id_idx": {
- "name": "agent_eval_runs_target_agent_id_idx",
- "columns": [
- {
- "expression": "target_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_eval_runs_workspace_id_idx": {
- "name": "agent_eval_runs_workspace_id_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk": {
- "name": "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk",
- "tableFrom": "agent_eval_runs",
- "tableTo": "agent_eval_datasets",
- "columnsFrom": ["dataset_id"],
- "columnsTo": ["id"],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk": {
- "name": "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk",
- "tableFrom": "agent_eval_runs",
- "tableTo": "agent_eval_experiments",
- "columnsFrom": ["experiment_id"],
- "columnsTo": ["id"],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_eval_runs_target_agent_id_agents_id_fk": {
- "name": "agent_eval_runs_target_agent_id_agents_id_fk",
- "tableFrom": "agent_eval_runs",
- "tableTo": "agents",
- "columnsFrom": ["target_agent_id"],
- "columnsTo": ["id"],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_eval_runs_user_id_users_id_fk": {
- "name": "agent_eval_runs_user_id_users_id_fk",
- "tableFrom": "agent_eval_runs",
- "tableTo": "users",
- "columnsFrom": ["user_id"],
- "columnsTo": ["id"],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_eval_runs_workspace_id_workspaces_id_fk": {
- "name": "agent_eval_runs_workspace_id_workspaces_id_fk",
- "tableFrom": "agent_eval_runs",
- "tableTo": "workspaces",
- "columnsFrom": ["workspace_id"],
- "columnsTo": ["id"],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk": {
- "name": "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk",
- "tableFrom": "agent_eval_runs",
- "tableTo": "agent_eval_runs",
- "columnsFrom": ["parent_run_id"],
- "columnsTo": ["id"],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_eval_test_cases": {
- "name": "agent_eval_test_cases",
- "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
- },
- "dataset_id": {
- "name": "dataset_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "content": {
- "name": "content",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "eval_mode": {
- "name": "eval_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "eval_config": {
- "name": "eval_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "sort_order": {
- "name": "sort_order",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "accessed_at": {
- "name": "accessed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_eval_test_cases_user_id_idx": {
- "name": "agent_eval_test_cases_user_id_idx",
+ "agent_eval_test_cases_dataset_id_idx": {
+ "name": "agent_eval_test_cases_dataset_id_idx",
"columns": [
{
- "expression": "user_id",
+ "expression": "dataset_id",
"isExpression": false,
"asc": true,
"nulls": "last"
@@ -4003,11 +4506,11 @@
"method": "btree",
"with": {}
},
- "agent_eval_test_cases_dataset_id_idx": {
- "name": "agent_eval_test_cases_dataset_id_idx",
+ "agent_eval_test_cases_environment_id_idx": {
+ "name": "agent_eval_test_cases_environment_id_idx",
"columns": [
{
- "expression": "dataset_id",
+ "expression": "environment_id",
"isExpression": false,
"asc": true,
"nulls": "last"
@@ -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,19 @@
"primaryKey": false,
"notNull": false
},
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'public'"
+ },
"deleted_at": {
"name": "deleted_at",
"type": "timestamp with time zone",
@@ -20293,6 +20845,33 @@
"method": "btree",
"with": {}
},
+ "goals_workspace_visibility_idx": {
+ "name": "goals_workspace_visibility_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "visibility",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"goals_agent_id_idx": {
"name": "goals_agent_id_idx",
"columns": [
@@ -28963,6 +29542,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",
@@ -36769,6 +37354,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": "",
@@ -37948,6 +38897,305 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.topic_analyses": {
+ "name": "topic_analyses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "topic_id": {
+ "name": "topic_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
+ },
+ "taxonomy_version": {
+ "name": "taxonomy_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secondary_category": {
+ "name": "secondary_category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "intent": {
+ "name": "intent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "labels": {
+ "name": "labels",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "topic_model": {
+ "name": "topic_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "topic_provider": {
+ "name": "topic_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_input_tokens": {
+ "name": "total_input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_output_tokens": {
+ "name": "total_output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost": {
+ "name": "total_cost",
+ "type": "numeric(20, 6)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "llm_calls": {
+ "name": "llm_calls",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_calls": {
+ "name": "tool_calls",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_messages": {
+ "name": "user_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assistant_messages": {
+ "name": "assistant_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_message_id": {
+ "name": "last_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_message_updated_at": {
+ "name": "last_message_updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accessed_at": {
+ "name": "accessed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "topic_analyses_topic_version_unique": {
+ "name": "topic_analyses_topic_version_unique",
+ "columns": [
+ {
+ "expression": "topic_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "taxonomy_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "topic_analyses_user_id_created_at_idx": {
+ "name": "topic_analyses_user_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "topic_analyses_workspace_id_created_at_idx": {
+ "name": "topic_analyses_workspace_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"topic_analyses\".\"workspace_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "topic_analyses_version_category_idx": {
+ "name": "topic_analyses_version_category_idx",
+ "columns": [
+ {
+ "expression": "taxonomy_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "topic_analyses_topic_id_topics_id_fk": {
+ "name": "topic_analyses_topic_id_topics_id_fk",
+ "tableFrom": "topic_analyses",
+ "tableTo": "topics",
+ "columnsFrom": ["topic_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "topic_analyses_user_id_users_id_fk": {
+ "name": "topic_analyses_user_id_users_id_fk",
+ "tableFrom": "topic_analyses",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "topic_analyses_workspace_id_workspaces_id_fk": {
+ "name": "topic_analyses_workspace_id_workspaces_id_fk",
+ "tableFrom": "topic_analyses",
+ "tableTo": "workspaces",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.topic_comment_mentions": {
"name": "topic_comment_mentions",
"schema": "",
@@ -46502,11 +47750,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",
@@ -46614,7 +47869,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.json
index 93ebe53e20e..8fdd914333e 100644
--- a/packages/database/migrations/meta/_journal.json
+++ b/packages/database/migrations/meta/_journal.json
@@ -1449,6 +1449,13 @@
"when": 1793984982722,
"tag": "0206_channel_job_wake",
"breakpoints": true
+ },
+ {
+ "idx": 207,
+ "version": "7",
+ "when": 1794065054788,
+ "tag": "0207_agent_account_settings",
+ "breakpoints": true
}
],
"version": "6"
diff --git a/packages/database/src/models/__tests__/agentAccount.test.ts b/packages/database/src/models/__tests__/agentAccount.test.ts
index 1854c61b150..2f4f1cbb827 100644
--- a/packages/database/src/models/__tests__/agentAccount.test.ts
+++ b/packages/database/src/models/__tests__/agentAccount.test.ts
@@ -225,6 +225,21 @@ describe('AgentAccountModel workspace isolation by agent visibility', () => {
});
describe('AgentAccountModel scope and writes', () => {
+ it("starts with empty settings and returns the owner's settings once written", async () => {
+ const model = new AgentAccountModel(serverDB, userId);
+ const created = await model.create(mailAccount());
+
+ expect(created.settings).toEqual({});
+ expect((await model.findById(created.id))?.settings).toEqual({});
+
+ const settings = {
+ wake: { digestMinutes: 30, mode: 'on' as const, wakeSenders: ['@lobehub.com'] },
+ };
+ await expect(model.update(created.id, { settings })).resolves.toBe(created.id);
+ expect((await model.findById(created.id))?.settings).toEqual(settings);
+ expect((await model.query({ agentId }))[0]?.settings).toEqual(settings);
+ });
+
it('does not expose another user account', async () => {
const model1 = new AgentAccountModel(serverDB, userId);
const model2 = new AgentAccountModel(serverDB, userId2);
diff --git a/packages/database/src/models/agentAccount.ts b/packages/database/src/models/agentAccount.ts
index 34d6f4bc86a..e93a1d081d2 100644
--- a/packages/database/src/models/agentAccount.ts
+++ b/packages/database/src/models/agentAccount.ts
@@ -3,6 +3,7 @@ import type {
AgentAccountCredentialHint,
AgentAccountKind,
AgentAccountPersistedKind,
+ AgentAccountSettings,
AgentAccountStatus,
} from '@lobechat/types';
import { AGENT_ACCOUNT_KINDS } from '@lobechat/types';
@@ -55,6 +56,7 @@ export interface AgentAccountPatch {
capabilities?: AgentAccountCapabilities;
displayName?: string | null;
metadata?: Record<string, unknown>;
+ settings?: AgentAccountSettings;
}
/** Strip the ciphertext from a freshly written row. */
@@ -84,6 +86,7 @@ const viewColumns = {
metadata: agentAccounts.metadata,
provider: agentAccounts.provider,
revokedAt: agentAccounts.revokedAt,
+ settings: agentAccounts.settings,
status: agentAccounts.status,
updatedAt: agentAccounts.updatedAt,
userId: agentAccounts.userId,
diff --git a/packages/database/src/schemas/agentAccount.ts b/packages/database/src/schemas/agentAccount.ts
index 924d1c58d82..123ef6a53b5 100644
--- a/packages/database/src/schemas/agentAccount.ts
+++ b/packages/database/src/schemas/agentAccount.ts
@@ -2,6 +2,7 @@ import type {
AgentAccountCapabilities,
AgentAccountCredentialHint,
AgentAccountKind,
+ AgentAccountSettings,
AgentAccountStatus,
} from '@lobechat/types';
import { sql } from 'drizzle-orm';
@@ -90,6 +91,13 @@ export const agentAccounts = pgTable(
/** Provider-side non-secret handles (inboxId, chatId, walletId, …). */
metadata: jsonb('metadata').$type<Record<string, unknown>>().default({}),
+ /**
+ * The owner's own settings for the account, such as its wake rules. Kept
+ * apart from `metadata`, which a managed provider owns and the owner may
+ * not rewrite.
+ */
+ settings: jsonb('settings').$type<AgentAccountSettings>().notNull().default({}),
+
/** When the account was released. Kept for audit; the row is not deleted. */
revokedAt: timestamptz('revoked_at'),
diff --git a/packages/database/src/schemas/agentInboxMessage.ts b/packages/database/src/schemas/agentInboxMessage.ts
index b6cfde553cd..5bd9cbe8bfd 100644
--- a/packages/database/src/schemas/agentInboxMessage.ts
+++ b/packages/database/src/schemas/agentInboxMessage.ts
@@ -88,6 +88,8 @@ export const agentInboxMessages = pgTable(
),
// Continuing a thread in the topic its first item woke.
index('agent_inbox_messages_account_thread_idx').on(t.accountId, t.threadKey),
+ // Whether a topic holds mail from outside: the outbound gate holds every send there.
+ index('agent_inbox_messages_topic_id_idx').on(t.topicId),
index('agent_inbox_messages_user_id_idx').on(t.userId),
],
);
diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml
index b2bf3563ace..a04ec321cdc 100644
--- a/packages/openapi/openapi.yml
+++ b/packages/openapi/openapi.yml
@@ -81,6 +81,27 @@ components:
type:
- string
- "null"
+ settings:
+ additionalProperties: true
+ properties:
+ wake:
+ additionalProperties: true
+ properties:
+ digestMinutes:
+ maximum: 1440
+ minimum: 5
+ type: integer
+ mode:
+ enum:
+ - on
+ - off
+ type: string
+ wakeSenders:
+ items:
+ type: string
+ type: array
+ type: object
+ type: object
status:
enum:
- provisioning
diff --git a/packages/openapi/src/spec.ts b/packages/openapi/src/spec.ts
index 6a51ca31f2c..e99bc250f80 100644
--- a/packages/openapi/src/spec.ts
+++ b/packages/openapi/src/spec.ts
@@ -1,4 +1,9 @@
-import { AGENT_ACCOUNT_PERSISTED_KINDS, AGENT_ACCOUNT_STATUSES } from '@lobechat/types';
+import {
+ AGENT_ACCOUNT_DIGEST_MINUTES_RANGE,
+ AGENT_ACCOUNT_PERSISTED_KINDS,
+ AGENT_ACCOUNT_STATUSES,
+ AGENT_ACCOUNT_WAKE_MODES,
+} from '@lobechat/types';
import { API_KEY_PREFIX } from '@lobechat/utils/apiKey';
import { generateSpecs } from 'hono-openapi';
@@ -60,6 +65,26 @@ const agentAccountProperties = {
metadata: nullableObject,
provider: { type: 'string' },
revokedAt: { ...dateTime, type: ['string', 'null'] },
+ // The owner's own settings. Stored JSON, so a field a later build adds may appear.
+ settings: {
+ additionalProperties: true,
+ properties: {
+ wake: {
+ additionalProperties: true,
+ properties: {
+ digestMinutes: {
+ maximum: AGENT_ACCOUNT_DIGEST_MINUTES_RANGE.max,
+ minimum: AGENT_ACCOUNT_DIGEST_MINUTES_RANGE.min,
+ type: 'integer',
+ },
+ mode: { enum: AGENT_ACCOUNT_WAKE_MODES, type: 'string' },
+ wakeSenders: { items: { type: 'string' }, type: 'array' },
+ },
+ type: 'object',
+ },
+ },
+ type: 'object',
+ },
status: { enum: AGENT_ACCOUNT_STATUSES, type: 'string' },
updatedAt: dateTime,
userId: { type: 'string' },
diff --git a/packages/types/src/agentAccount.ts b/packages/types/src/agentAccount.ts
index 596aef15e0f..8f8ac9811e2 100644
--- a/packages/types/src/agentAccount.ts
+++ b/packages/types/src/agentAccount.ts
@@ -68,6 +68,41 @@ export interface AgentAccountCapabilities {
sign?: boolean;
}
+/**
+ * How inbound messages wake the agent.
+ *
+ * - `on` (the default): the wake rules decide. A message they let through — a
+ * listed sender, a reply in a thread the agent wrote to — wakes the agent at
+ * once; everything else waits for the digest, one run that goes through all
+ * of it together.
+ * - `off`: messages are stored in the inbox and never wake the agent.
+ */
+export const AGENT_ACCOUNT_WAKE_MODES = ['on', 'off'] as const;
+export type AgentAccountWakeMode = (typeof AGENT_ACCOUNT_WAKE_MODES)[number];
+
+/** Shortest and longest digest window, in minutes. */
+export const AGENT_ACCOUNT_DIGEST_MINUTES_RANGE = { max: 24 * 60, min: 5 } as const;
+
+/** The owner's wake rules for one account. Every field is optional; defaults apply when read. */
+export interface AgentAccountWakeSettings {
+ /** Minutes the digest collects held messages before one run goes through them. Default 60. */
+ digestMinutes?: number;
+ mode?: AgentAccountWakeMode;
+ /**
+ * Senders whose messages wake the agent at once: full addresses
+ * (`[email protected]`) or whole domains (`@example.com`).
+ */
+ wakeSenders?: string[];
+}
+
+/**
+ * The owner's settings for one account. Unlike `metadata`, which a managed
+ * provider owns, these belong to the person and are always patchable.
+ */
+export interface AgentAccountSettings {
+ wake?: AgentAccountWakeSettings;
+}
+
/**
* Non-secret facts about the stored credential, safe to return from any read
* API: enough for a person to recognise *which* secret is installed and when it