Commit Graph

64 Commits

Author SHA1 Message Date
Arvin Xu
b005a9c73b 👷 build: add agent task system database schema (#13280)
* 🗃️ chore: add agent task system database schema

Add 6 new tables for the Agent Task System:
- tasks: core task with tree structure, heartbeat, scheduling
- task_dependencies: inter-task dependency graph (blocks/relates)
- task_documents: MVP workspace document pinning
- task_topics: topic tracking with handoff (jsonb) and review results
- task_comments: user/agent comments with author tracking (text id: cmt_)
- briefs: unresolved notification system (text id: brf_)

All sub-tables include userId FK for row-level user isolation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: add self-referential FK on tasks.parentTaskId (ON DELETE SET NULL)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: use foreignKey() for self-referential parentTaskId to avoid TS circular inference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: add FK on task_topics.topic_id → topics.id (ON DELETE SET NULL)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: resolve pre-existing TS type-check errors

- Fix i18next defaultValue type (string | null → string)
- Fix i18next options type mismatches
- Fix fieldTags.webhook possibly undefined

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: add FK on tasks.currentTopicId → topics.id (ON DELETE SET NULL)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: add FK constraints for assignee, author, topic, and parent fields

- tasks.assigneeUserId → users.id (ON DELETE SET NULL)
- tasks.assigneeAgentId → agents.id (ON DELETE SET NULL)
- tasks.parentTaskId → tasks.id (ON DELETE SET NULL)
- tasks.currentTopicId → topics.id (ON DELETE SET NULL)
- task_comments.authorUserId → users.id (ON DELETE SET NULL)
- task_comments.authorAgentId → agents.id (ON DELETE SET NULL)
- task_topics.topicId → topics.id (ON DELETE SET NULL)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: change task_topics.topicId FK to ON DELETE CASCADE

Topic deleted → task_topic mapping row removed (not just nulled).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: use inline .references() for currentTopicId FK

No circular inference issue — only parentTaskId (self-ref) needs foreignKey().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: add FK on task_comments.briefId and topicId (ON DELETE SET NULL)

- task_comments.briefId → briefs.id (SET NULL)
- task_comments.topicId → topics.id (SET NULL)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: merge briefs table into task.ts to fix circular dependency

brief.ts imported task.ts (briefs.taskId FK) and task.ts imported
brief.ts (taskComments.briefId FK), causing circular dependency error.
Merged briefs into task.ts since briefs are part of the task system.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🗃️ chore: add FK on tasks.createdByAgentId → agents.id (ON DELETE SET NULL)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:56:01 +08:00
Arvin Xu
ae77fee1b8 👷 build: add settings column to agent_bot_providers (#13081) 2026-03-18 12:28:58 +08:00
YuTengjing
3091489695 👷 build: add description column to topics table (#12939) 2026-03-12 19:39:47 +08:00
Arvin Xu
49a8f6b497 🐛 fix: fix benchmarks table schema not correctly (#12532)
* fix benchmark table issue

* add new db migration

* fix types
2026-02-28 21:05:32 +08:00
Arvin Xu
e7598fe90b feat: support agent benchmark (#12355)
* improve total

fix page size issue

fix error message handler

fix eval home page

try to fix batch run agent step issue

fix run list

fix dataset loading

fix abort issue

improve jump and table column

fix error streaming

try to fix error output in vercel

refactor qstash workflow client

improve passK

add evals to proxy

refactor metrics

try to fix build

refactor tests

improve detail page

fix passK issue

improve eval-rubric

fix types

support passK

fix type

update

fix db insert issue

improve dataset ui

improve run config

finish step limit now

add step limited

100% coverage to models

add failed tests todo

support interruptOperation

fix lint

improve report detail

improve pass rate

improve sort order issue

fix timeout issue

Update db schema

完整 case 跑通

update database

improve error handling

refactor to improve database

优化 test case 的处理流程

优化部分细节体验和实现

基本完成 Benchmark 全流程功能

优化 run case 展示

优化 run case 序号问题

优化 eval test case 页面

新增 eval test 模式

新增 dataset 页面

update schema

support

finish create test run

fix

update

improve import exp

refactor data flow

improve import workflow

rubric Benchmark detail 页面

improve import ux

update schema

finish eval home page

add eval workflow endpoint

implement benchmark run model

refactor RAG eval

implement backend

update db schema

update db migration

init benchmark

* support rerun error test case

* fix tests

* fix tests
2026-02-21 20:36:40 +08:00
YuTengjing
e112cd6f7f 🗃️ db: add video generation schema changes
- async_tasks: add inference_id column with index
- generation_topics: add type column (default 'image')
2026-02-13 12:09:18 +08:00
Neko
b0def6d711 👷 build(database): migrate id using seq and identity to text with nanoid (#12223)
* 🔨 chore(database): added id_nanoid to replace id using seq and identity

* 🔨 chore(database): assgin database id column value to id_nanoid

* 🔨 chore(database): update dbml

* 🔨 chore(database): add not null & unique index

* 🔨 chore(database): drop foreign key dependency, switch to depend on id_nanoid

* 🔨 chore(database): switch to use id_nanoid as primary key

* 🔨 chore(database): drop old id column

* 🔨 chore(database): rename id_nanoid to id

* 🔨 chore(database): remove unique constraint

* 🔨 chore(database): updated dbml

* 🔨 chore(database): incorrect --> statement-breakpoint
2026-02-09 22:27:46 +08:00
Arvin Xu
3f1fd102c5 👷 build: fix db index (#12090)
* build index

* update
2026-02-04 13:16:56 +08:00
Neko
14adf995f7 feat(database): added user memory persona schema (#11833) 2026-01-26 01:50:56 +08:00
YuTengjing
5ed1cca355 🔨 chore: add account deletion feature with 72h cooling-off period (#11818) 2026-01-25 20:21:52 +08:00
Arvin Xu
09a00df38e feat: support history context auto compress (#11790)
* add compress implement

* push

* update

* update

* update

* fix auto scroll

* db schema update

* fix compress

* fix types

* fix lint

* update get compressedMessages

* update content

* update

* fix tests

* fix tests

* fix tests
2026-01-25 13:59:44 +08:00
Shinji-Li
a7dad9f3af 🔨 chore: add the market identifier in chat group (#11779)
* chore: add the market identifier in chatgroup

* fix: add IF NOT EXISTS in sql

* fix: add the ts onSucess
2026-01-24 21:07:56 +08:00
Neko
31d2f26b6e feat(database): extended async task with metadata and parent id, added index (#11712) 2026-01-23 21:49:56 +08:00
Neko
0160fbde83 feat(database): added user memory activity (#11680) 2026-01-22 10:24:50 +08:00
YuTengjing
ddca1652bb feat(share): add topic sharing functionality (#11448) 2026-01-13 22:10:48 +08:00
Arvin Xu
a8c6b2cb92 ♻️ refactor(agentGroup): simplify LobeChatGroupChatConfig schema (#11431)
* ♻️ refactor(agentGroup): simplify LobeChatGroupChatConfig schema

- Remove unused config properties: enableSupervisor, orchestratorModel, orchestratorProvider, scene, maxResponseInRow, responseOrder, responseSpeed
- Keep only essential properties: allowDM, revealDM, openingMessage, openingQuestions, systemPrompt
- Delete GroupChatSettings feature component (no longer needed)
- Delete AgentTeamSettings mobile component
- Update InsertChatGroupSchema to use manual Zod schema instead of createInsertSchema
- Remove hostConfig and enableSupervisor parameters from GroupWizard and MemberSelectionModal interfaces
- Simplify callback signatures across the codebase
- Update all related tests to use new config structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* update default provider

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-12 15:46:11 +08:00
Shinji-Li
eefb6cb185 feat: generate agent_cron_jobs in agents (#11349)
* feat: generate agent_cron_job in agents

* feat: update the db fields

* feat: add trigger/mode in topics table & add group id in cronjob

* feat: update sql

* fix: fixed db migration

* feat: update the test
2026-01-09 14:22:35 +08:00
Arvin Xu
e05375f796 feat: support notebook tool (#10902)
* add notebook builtin tool

* document init workflow

* gtd support plan mode

* add notebook tools
2025-12-24 12:55:09 +08:00
Arvin Xu
9be0893dba 👷 build: improve document db schema (#10892)
* add document db schema update

* update migration sql

* update migration sql
2025-12-23 18:54:48 +08:00
Rdmclin2
8c42a934b3 feat: mobile native better auth support (#10871)
* feat: mobile native better auth support

* chore: add android assetlinks

* chore: add android assetlinks

* chore: add expo fingerpoint

* chore: add relation

* chore: add android origin hash

* chore: update passkey table

* chore: optimize version

* chore: remove as any

* fix: sql not exits problem

* fix: passkey statement

* fix:  passkey origin null

* chore: remove strict peer dependencies

* fix: test case

* chore: remove local passkey origin
2025-12-23 15:19:42 +08:00
Arvin Xu
5c489bc971 ♻️ refactor: refactor database schema (#10860)
* update data schema

* update data schema
2025-12-20 20:20:07 +08:00
Arvin Xu
81e56d462a ️ perf: add more sql to improve performance (#10777)
* Update sql

* fix user tests
2025-12-15 01:06:34 +08:00
René Wang
ec3aa6ba3b ️ perf(database): optimize document queries with indexes and field exclusion (#10740)
* ️ perf(database): optimize document queries with indexes and field exclusion

- Add database indexes for source_type and compound query optimization
- Exclude large JSONB fields (content, pages, editorData) in list queries
- Improve queryDocuments performance for better list view rendering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: Add migration

* ️ perf(database): missing user_id and user_memory_id index

* refac: Use select

* fix: migration

* fix: Test error

* Update sql

* feat(userMemories): added captured_at column

* fix: not null default now

* fix: not null default now

* Update sql

* Update sql

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Neko Ayaka <neko@ayaka.moe>
Co-authored-by: arvinxx <arvinx@foxmail.com>
2025-12-12 20:09:08 +08:00
YuTengjing
458cbf4d5c 🔨 chore: track user last active time (#10733) 2025-12-11 17:14:25 +08:00
YuTengjing
f72a5e6cc1 feat: betterauth username signin (#10607) 2025-12-05 01:35:20 +08:00
Shinji-Li
c09f2474db 🔨 chore: add source type into user_install_plugins (#10603)
* chore: add source type into user_install_plugins

* fix: change the source type into varchar
2025-12-04 18:14:21 +08:00
Neko
d15c845213 feat(database): topic metadata for user memory extractor (#10569) 2025-12-03 19:14:29 +08:00
Arvin Xu
0d609d199a ♻️ refactor: refactor agent slug schema (#10561)
* fix agent schema

* fix snapshot
2025-12-02 23:23:42 +08:00
YuTengjing
2ab88c5dcf 🐛 fix: drop user.phoneNumber and reuse user.phone (#10531) 2025-12-01 19:00:29 +08:00
YuTengjing
3be78f04e8 feat: integrate better-auth admin plugin (#10512) 2025-12-01 17:16:06 +08:00
Arvin Xu
dff82f4093 🔨 chore: update topic and message db (#10511)
* update topic and message db

* fix tests
2025-11-30 19:37:57 +08:00
Shinji-Li
1674cc94f2 🔨 chore: add market into userSettings & save the oidc token into db (#10481)
* feat: add market into userSettings & save the oidc token into db

* fix: update migrations
2025-11-28 23:19:42 +08:00
Arvin Xu
69898185f3 ♻️ refactor: refactor thread table and nextauth userId (#10475)
push update
2025-11-28 13:50:43 +08:00
YuTengjing
dc62cc969d feat: support better-auth (#10215) 2025-11-27 20:10:40 +08:00
Shinji-Li
3f95d1c34a 🔨 chore: add editor_data in agents db (#10448)
* feat: add editor_data in agents db

* fix: add if exists sql

* fix: change the schema
2025-11-27 13:09:05 +08:00
Arvin Xu
760105adb2 🐛 fix: fix db migration snapshot not align with db schema (#10399)
* fix db sql

* clean
2025-11-24 21:15:25 +08:00
René Wang
eea41dcb82 👷 build: Add slug to documents table (#10299)
* feat: Add SLUG

* fix: CI

* feat: Update constairnt

* fix: Remove slug from files

* fix: Test error
2025-11-21 17:56:08 +08:00
René Wang
10e44dfb6b 👷 build: Update schema for incoming folder (#10217)
* feat: Update schema

* fix: Circular deps

* feat: Add more validate

* fix: Vercel build error

* fix: Duplicated import

* fix: Circular deps

* feat: Set varchar from 30 to 255

* feat: Regenerate migration file

* feat: Regenerate migration

* feat: Regenerate migration
2025-11-18 16:42:13 +08:00
Arvin Xu
656a33359b 👷 build: add intervention tool column (#10163)
* add intervention tool

* update sql
2025-11-12 10:25:03 +08:00
Shinji-Li
a15eda7fbf 🔨 chore: add market_identifier into agents table schema (#10164)
chore: add market_identifier into agents table schema
2025-11-11 22:37:47 +08:00
sxjeru
7e1dd02d7c ♻️ refactor: add settings (jsonb) column to ai_models table (#10042)
* Refactor code structure for improved readability and maintainability

* edit dbml

* feat: 更新 AiInfraRepos 以支持用户设置覆盖内置设置

* Revert "Refactor code structure for improved readability and maintainability"

This reverts commit 81453d8dc3.

* Refactor code structure for improved readability and maintainability

* 添加 IF NOT EXISTS 选项以避免重复列添加

* format
2025-11-04 21:02:40 +08:00
Arvin Xu
0d8188c60b ️ perf: improve db query performance (#10036)
* improve db query performance

* Remove query timing log from hasMoreThanN

Removed timing log from hasMoreThanN method.
2025-11-04 14:29:11 +08:00
Arvin Xu
8abfdecd54 ️ perf: improve db query performance (#9946)
* fix db performance issue

* fix tests
2025-10-31 12:39:59 +08:00
Neko
6c5caf9184 👷 build(database): improve user memory schema (#9822)
chore(database): improve user memory schema
2025-10-28 15:50:15 +08:00
René Wang
bf53c116dd 👷 build: Add editorData column on document table (#9899)
feat: Add rawData column
2025-10-27 17:12:55 +08:00
YuTengjing
de7368bc25 feat: add new setting for default image num (#9618) 2025-10-12 23:56:17 +08:00
Neko
23d61aebc9 🔨 chore(database): add user memory db schemas (#9371)
*  feat(database): user memory db schemas

* feat: migrations

* fix: id

* fix: syntax id

* update

* revert

---------

Co-authored-by: arvinxx <arvinx@foxmail.com>
2025-10-10 17:41:14 +08:00
Arvin Xu
af274190a8 🔨 chore: add group-messages database schema (#9543)
* add group messages

* update

* add migrations

* ♻️ refactor: refactor message group

* fix

* fix

* update schema
2025-10-05 23:49:27 +08:00
René Wang
b0cb96e5c2 👷 build: Add virtual column to agent table (#9464) 2025-09-29 10:07:19 +02:00
Arvin Xu
273e0277d1 🔨 chore: pre-merge group chat relative implement (#9432)
* pre-merge code

* fix tests

* fix circular

* remove redirectUri

* fix types

* improve sql

* fix docs

* fix lint

* update model runtime
2025-09-26 03:47:25 +08:00