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.

♻️ refactor(builtin-tool): move sub-agent dispatch from `lobe-gtd` to `lobe-agent` (#14715)

Arvin Xuccddbaa25dbc
diff --git a/.agents/skills/builtin-tool/references/architecture.md b/.agents/skills/builtin-tool/references/architecture.md
index 7f7375d1291..c1c837466cb 100644
--- a/.agents/skills/builtin-tool/references/architecture.md
+++ b/.agents/skills/builtin-tool/references/architecture.md
@@ -213,7 +213,7 @@ The runtime hands every executor method an optional `BuiltinToolContext` as the
| `operationId` | Operation lineage (use for cancellation, tracing) |
| `scope` | `'task' \| 'agent' \| …` — toggles default behaviors |
| `signal: AbortSignal` | Honor for long-running ops |
-| `stepContext` | Cross-message runtime state (GTD todos, etc.) |
+| `stepContext` | Cross-message runtime state (lobe-agent todos, etc.) |
| `registerAfterCompletion(cb)` | Defer side-effects past message-update race |
| `groupOrchestration` | Group orchestration callbacks |
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index ef06cc08091..e2ea475bda7 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -314,7 +314,7 @@
"openInNewWindow": "Open in New Window",
"operation.contextCompression": "Context too long, compressing history...",
"operation.execAgentRuntime": "Preparing response",
- "operation.execClientTask": "Executing task",
+ "operation.execClientSubAgent": "Running sub-agent",
"operation.execHeterogeneousAgent": "{{name}} is running",
"operation.execServerAgentRuntime": "Task is running in the server. You are safe to leave this page",
"operation.heterogeneousAgentFallback": "External agent",
@@ -772,6 +772,8 @@
"workflow.toolDisplayName.addPreferenceMemory": "Saved memory",
"workflow.toolDisplayName.calculate": "Calculated",
"workflow.toolDisplayName.callAgent": "Called an agent",
+ "workflow.toolDisplayName.callSubAgent": "Dispatched a sub-agent",
+ "workflow.toolDisplayName.callSubAgents": "Dispatched sub-agents",
"workflow.toolDisplayName.clearTodos": "Cleared todos",
"workflow.toolDisplayName.copyDocument": "Copied a document",
"workflow.toolDisplayName.crawlMultiPages": "Crawled pages",
@@ -786,8 +788,6 @@
"workflow.toolDisplayName.editTitle": "Edited title",
"workflow.toolDisplayName.evaluate": "Evaluated expression",
"workflow.toolDisplayName.execScript": "Executed a script",
- "workflow.toolDisplayName.execTask": "Executed a task",
- "workflow.toolDisplayName.execTasks": "Executed tasks",
"workflow.toolDisplayName.execute": "Executed calculation",
"workflow.toolDisplayName.executeCode": "Executed code",
"workflow.toolDisplayName.finishOnboarding": "Finished onboarding",
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index 190690e53c4..c5f5358e7c5 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -72,6 +72,22 @@
"builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "Assemble agent team",
"builtins.lobe-agent-marketplace.apiName.submitAgentPick": "Submit agent picks",
"builtins.lobe-agent-marketplace.title": "Agent Marketplace",
+ "builtins.lobe-agent.apiName.callSubAgent": "Call sub-agent",
+ "builtins.lobe-agent.apiName.callSubAgent.completed": "Sub-agent dispatched: ",
+ "builtins.lobe-agent.apiName.callSubAgent.loading": "Dispatching sub-agent: ",
+ "builtins.lobe-agent.apiName.callSubAgents": "Call sub-agents",
+ "builtins.lobe-agent.apiName.clearTodos": "Clear todos",
+ "builtins.lobe-agent.apiName.clearTodos.modeAll": "all",
+ "builtins.lobe-agent.apiName.clearTodos.modeCompleted": "completed",
+ "builtins.lobe-agent.apiName.clearTodos.result": "Clear <mode>{{mode}}</mode> todos",
+ "builtins.lobe-agent.apiName.createPlan": "Create plan",
+ "builtins.lobe-agent.apiName.createPlan.result": "Create plan: <goal>{{goal}}</goal>",
+ "builtins.lobe-agent.apiName.createTodos": "Create todos",
+ "builtins.lobe-agent.apiName.updatePlan": "Update plan",
+ "builtins.lobe-agent.apiName.updatePlan.completed": "Completed",
+ "builtins.lobe-agent.apiName.updatePlan.modified": "Modified",
+ "builtins.lobe-agent.apiName.updateTodos": "Update todos",
+ "builtins.lobe-agent.title": "Lobe Agent",
"builtins.lobe-claude-code.agent.instruction": "Instruction",
"builtins.lobe-claude-code.agent.result": "Result",
"builtins.lobe-claude-code.todoWrite.allDone": "All tasks completed",
@@ -139,24 +155,6 @@
"builtins.lobe-group-management.inspector.executeAgentTasks.title": "Assigning tasks to:",
"builtins.lobe-group-management.inspector.speak.title": "Designated Agent speaks:",
"builtins.lobe-group-management.title": "Group Coordinator",
- "builtins.lobe-gtd.apiName.clearTodos": "Clear todos",
- "builtins.lobe-gtd.apiName.clearTodos.modeAll": "all",
- "builtins.lobe-gtd.apiName.clearTodos.modeCompleted": "completed",
- "builtins.lobe-gtd.apiName.clearTodos.result": "Clear <mode>{{mode}}</mode> todos",
- "builtins.lobe-gtd.apiName.completeTodos": "Complete todos",
- "builtins.lobe-gtd.apiName.createPlan": "Create plan",
- "builtins.lobe-gtd.apiName.createPlan.result": "Create plan: <goal>{{goal}}</goal>",
- "builtins.lobe-gtd.apiName.createTodos": "Create todos",
- "builtins.lobe-gtd.apiName.execTask": "Execute task",
- "builtins.lobe-gtd.apiName.execTask.completed": "Task created: ",
- "builtins.lobe-gtd.apiName.execTask.loading": "Creating task: ",
- "builtins.lobe-gtd.apiName.execTasks": "Execute tasks",
- "builtins.lobe-gtd.apiName.removeTodos": "Delete todos",
- "builtins.lobe-gtd.apiName.updatePlan": "Update plan",
- "builtins.lobe-gtd.apiName.updatePlan.completed": "Completed",
- "builtins.lobe-gtd.apiName.updatePlan.modified": "Modified",
- "builtins.lobe-gtd.apiName.updateTodos": "Update todos",
- "builtins.lobe-gtd.title": "Task Tools",
"builtins.lobe-knowledge-base.apiName.readKnowledge": "Read Library content",
"builtins.lobe-knowledge-base.apiName.searchKnowledgeBase": "Search Library",
"builtins.lobe-knowledge-base.inspector.andMoreFiles": "and {{count}} more",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 63668f41041..5bf961a92e1 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -934,9 +934,6 @@
"tools.builtins.lobe-group-agent-builder.title": "Group Agent Builder",
"tools.builtins.lobe-group-management.description": "Orchestrate and manage multi-agent group conversations",
"tools.builtins.lobe-group-management.title": "Group Management",
- "tools.builtins.lobe-gtd.description": "Plan goals and track progress with GTD methodology",
- "tools.builtins.lobe-gtd.readme": "Plan goals and track progress using GTD methodology. Create strategic plans, manage todo lists with status tracking, and execute long-running async tasks.",
- "tools.builtins.lobe-gtd.title": "GTD Tools",
"tools.builtins.lobe-knowledge-base.description": "Search uploaded documents and domain knowledge via semantic vector search — for persistent, reusable reference",
"tools.builtins.lobe-knowledge-base.title": "Knowledge Base",
"tools.builtins.lobe-local-system.description": "Access and manage local files, run shell commands on your desktop",
diff --git a/locales/en-US/tool.json b/locales/en-US/tool.json
index a155098d735..964bf0e16d0 100644
--- a/locales/en-US/tool.json
+++ b/locales/en-US/tool.json
@@ -56,51 +56,51 @@
"dalle.generating": "Generating...",
"dalle.images": "Images:",
"dalle.prompt": "Prompt",
- "lobe-gtd.actions.add": "Add",
- "lobe-gtd.actions.clearCompleted": "Clear Completed",
- "lobe-gtd.actions.placeholder": "Enter a to-do item...",
- "lobe-gtd.addTodo.placeholder": "Add a todo item...",
- "lobe-gtd.clearTodos.cleared": "{{count}} item(s) cleared",
- "lobe-gtd.clearTodos.clearedCompleted": "{{count}} completed item(s) cleared",
- "lobe-gtd.clearTodos.clearedCompleted_one": "{{count}} completed item cleared",
- "lobe-gtd.clearTodos.clearedCompleted_other": "{{count}} completed items cleared",
- "lobe-gtd.clearTodos.cleared_one": "{{count}} item cleared",
- "lobe-gtd.clearTodos.cleared_other": "{{count}} items cleared",
- "lobe-gtd.clearTodos.header": "Clear Todo Items",
- "lobe-gtd.clearTodos.label": "Choose what to clear:",
- "lobe-gtd.clearTodos.noItems": "No items to clear",
- "lobe-gtd.clearTodos.option.all": "Clear all items (including pending)",
- "lobe-gtd.clearTodos.option.completed": "Clear completed items only",
- "lobe-gtd.clearTodos.remaining": "{{count}} item(s) remaining",
- "lobe-gtd.clearTodos.remaining_one": "{{count}} item remaining",
- "lobe-gtd.clearTodos.remaining_other": "{{count}} items remaining",
- "lobe-gtd.completeTodos.completed": "{{count}} item(s) completed",
- "lobe-gtd.completeTodos.completed_one": "{{count}} item completed",
- "lobe-gtd.completeTodos.completed_other": "{{count}} items completed",
- "lobe-gtd.createPlan.context.label": "Context (optional)",
- "lobe-gtd.createPlan.context.placeholder": "Background, constraints, considerations...",
- "lobe-gtd.createPlan.description.label": "Description",
- "lobe-gtd.createPlan.description.placeholder": "Brief summary of the plan",
- "lobe-gtd.createPlan.goal.label": "Goal",
- "lobe-gtd.createPlan.goal.placeholder": "What do you want to achieve?",
- "lobe-gtd.createTodos.created": "{{count}} to-do item(s) created",
- "lobe-gtd.createTodos.created_one": "{{count}} to-do item created",
- "lobe-gtd.createTodos.created_other": "{{count}} to-do items created",
- "lobe-gtd.createTodos.total": "Total: {{count}} item(s)",
- "lobe-gtd.createTodos.total_one": "Total: {{count}} item",
- "lobe-gtd.createTodos.total_other": "Total: {{count}} items",
- "lobe-gtd.removeTodos.removed": "{{count}} item(s) removed",
- "lobe-gtd.removeTodos.removed_one": "{{count}} item removed",
- "lobe-gtd.removeTodos.removed_other": "{{count}} items removed",
- "lobe-gtd.status.done": "{{count}} completed",
- "lobe-gtd.status.pending": "{{count}} pending",
- "lobe-gtd.todoItem.placeholder": "Enter todo item...",
- "lobe-gtd.todoList.empty": "To-do list is empty",
- "lobe-gtd.todoList.items": "{{count}} item(s)",
- "lobe-gtd.todoList.items_one": "{{count}} item",
- "lobe-gtd.todoList.items_other": "{{count}} items",
- "lobe-gtd.todoList.title": "To-Do List",
- "lobe-gtd.updateTodos.updated": "To-do list updated",
+ "lobe-agent.actions.add": "Add",
+ "lobe-agent.actions.clearCompleted": "Clear Completed",
+ "lobe-agent.actions.placeholder": "Enter a to-do item...",
+ "lobe-agent.addTodo.placeholder": "Add a todo item...",
+ "lobe-agent.clearTodos.cleared": "{{count}} item(s) cleared",
+ "lobe-agent.clearTodos.clearedCompleted": "{{count}} completed item(s) cleared",
+ "lobe-agent.clearTodos.clearedCompleted_one": "{{count}} completed item cleared",
+ "lobe-agent.clearTodos.clearedCompleted_other": "{{count}} completed items cleared",
+ "lobe-agent.clearTodos.cleared_one": "{{count}} item cleared",
+ "lobe-agent.clearTodos.cleared_other": "{{count}} items cleared",
+ "lobe-agent.clearTodos.header": "Clear Todo Items",
+ "lobe-agent.clearTodos.label": "Choose what to clear:",
+ "lobe-agent.clearTodos.noItems": "No items to clear",
+ "lobe-agent.clearTodos.option.all": "Clear all items (including pending)",
+ "lobe-agent.clearTodos.option.completed": "Clear completed items only",
+ "lobe-agent.clearTodos.remaining": "{{count}} item(s) remaining",
+ "lobe-agent.clearTodos.remaining_one": "{{count}} item remaining",
+ "lobe-agent.clearTodos.remaining_other": "{{count}} items remaining",
+ "lobe-agent.completeTodos.completed": "{{count}} item(s) completed",
+ "lobe-agent.completeTodos.completed_one": "{{count}} item completed",
+ "lobe-agent.completeTodos.completed_other": "{{count}} items completed",
+ "lobe-agent.createPlan.context.label": "Context (optional)",
+ "lobe-agent.createPlan.context.placeholder": "Background, constraints, considerations...",
+ "lobe-agent.createPlan.description.label": "Description",
+ "lobe-agent.createPlan.description.placeholder": "Brief summary of the plan",
+ "lobe-agent.createPlan.goal.label": "Goal",
+ "lobe-agent.createPlan.goal.placeholder": "What do you want to achieve?",
+ "lobe-agent.createTodos.created": "{{count}} to-do item(s) created",
+ "lobe-agent.createTodos.created_one": "{{count}} to-do item created",
+ "lobe-agent.createTodos.created_other": "{{count}} to-do items created",
+ "lobe-agent.createTodos.total": "Total: {{count}} item(s)",
+ "lobe-agent.createTodos.total_one": "Total: {{count}} item",
+ "lobe-agent.createTodos.total_other": "Total: {{count}} items",
+ "lobe-agent.removeTodos.removed": "{{count}} item(s) removed",
+ "lobe-agent.removeTodos.removed_one": "{{count}} item removed",
+ "lobe-agent.removeTodos.removed_other": "{{count}} items removed",
+ "lobe-agent.status.done": "{{count}} completed",
+ "lobe-agent.status.pending": "{{count}} pending",
+ "lobe-agent.todoItem.placeholder": "Enter todo item...",
+ "lobe-agent.todoList.empty": "To-do list is empty",
+ "lobe-agent.todoList.items": "{{count}} item(s)",
+ "lobe-agent.todoList.items_one": "{{count}} item",
+ "lobe-agent.todoList.items_other": "{{count}} items",
+ "lobe-agent.todoList.title": "To-Do List",
+ "lobe-agent.updateTodos.updated": "To-do list updated",
"lobe-knowledge-base.readKnowledge.meta.chars": "Character Count",
"lobe-knowledge-base.readKnowledge.meta.lines": "Line Count",
"localFiles.editFile.newString": "Replace with",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 0d3ad9c11b3..aac6d6342cc 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -314,7 +314,7 @@
"openInNewWindow": "在新窗口打开",
"operation.contextCompression": "上下文过长,正在压缩历史记录……",
"operation.execAgentRuntime": "准备响应中",
- "operation.execClientTask": "执行任务中",
+ "operation.execClientSubAgent": "运行子代理中",
"operation.execHeterogeneousAgent": "{{name}} 正在运行",
"operation.execServerAgentRuntime": "任务正在服务器运行,您可以放心离开此页面",
"operation.heterogeneousAgentFallback": "外部智能体",
@@ -772,6 +772,8 @@
"workflow.toolDisplayName.addPreferenceMemory": "保存了记忆",
"workflow.toolDisplayName.calculate": "完成了计算",
"workflow.toolDisplayName.callAgent": "调用了助理",
+ "workflow.toolDisplayName.callSubAgent": "派发了子代理",
+ "workflow.toolDisplayName.callSubAgents": "派发了多个子代理",
"workflow.toolDisplayName.clearTodos": "清空了待办",
"workflow.toolDisplayName.copyDocument": "复制了文档",
"workflow.toolDisplayName.crawlMultiPages": "抓取了多个页面",
@@ -786,8 +788,6 @@
"workflow.toolDisplayName.editTitle": "编辑了标题",
"workflow.toolDisplayName.evaluate": "求值了表达式",
"workflow.toolDisplayName.execScript": "执行了脚本",
- "workflow.toolDisplayName.execTask": "执行了任务",
- "workflow.toolDisplayName.execTasks": "执行了任务",
"workflow.toolDisplayName.execute": "执行了计算",
"workflow.toolDisplayName.executeCode": "执行了代码",
"workflow.toolDisplayName.finishOnboarding": "完成了引导",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index b152b49d400..b090bbcf501 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -72,6 +72,22 @@
"builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "组建 Agent 团队",
"builtins.lobe-agent-marketplace.apiName.submitAgentPick": "提交助手选择",
"builtins.lobe-agent-marketplace.title": "助手市场",
+ "builtins.lobe-agent.apiName.callSubAgent": "调用子代理",
+ "builtins.lobe-agent.apiName.callSubAgent.completed": "已派发子代理:",
+ "builtins.lobe-agent.apiName.callSubAgent.loading": "正在派发子代理:",
+ "builtins.lobe-agent.apiName.callSubAgents": "调用多个子代理",
+ "builtins.lobe-agent.apiName.clearTodos": "清除待办",
+ "builtins.lobe-agent.apiName.clearTodos.modeAll": "全部",
+ "builtins.lobe-agent.apiName.clearTodos.modeCompleted": "已完成",
+ "builtins.lobe-agent.apiName.clearTodos.result": "清除<mode>{{mode}}</mode>待办",
+ "builtins.lobe-agent.apiName.createPlan": "创建计划",
+ "builtins.lobe-agent.apiName.createPlan.result": "创建计划:<goal>{{goal}}</goal>",
+ "builtins.lobe-agent.apiName.createTodos": "创建待办",
+ "builtins.lobe-agent.apiName.updatePlan": "更新计划",
+ "builtins.lobe-agent.apiName.updatePlan.completed": "已完成",
+ "builtins.lobe-agent.apiName.updatePlan.modified": "已修改",
+ "builtins.lobe-agent.apiName.updateTodos": "更新待办",
+ "builtins.lobe-agent.title": "Lobe Agent",
"builtins.lobe-claude-code.agent.instruction": "指令",
"builtins.lobe-claude-code.agent.result": "结果",
"builtins.lobe-claude-code.todoWrite.allDone": "全部任务已完成",
@@ -139,24 +155,6 @@
"builtins.lobe-group-management.inspector.executeAgentTasks.title": "分配任务给:",
"builtins.lobe-group-management.inspector.speak.title": "指定 Agent 发言:",
"builtins.lobe-group-management.title": "群组协调",
- "builtins.lobe-gtd.apiName.clearTodos": "清除待办",
- "builtins.lobe-gtd.apiName.clearTodos.modeAll": "全部",
- "builtins.lobe-gtd.apiName.clearTodos.modeCompleted": "已完成",
- "builtins.lobe-gtd.apiName.clearTodos.result": "清除<mode>{{mode}}</mode>待办",
- "builtins.lobe-gtd.apiName.completeTodos": "完成待办",
- "builtins.lobe-gtd.apiName.createPlan": "创建计划",
- "builtins.lobe-gtd.apiName.createPlan.result": "创建计划:<goal>{{goal}}</goal>",
- "builtins.lobe-gtd.apiName.createTodos": "创建待办",
- "builtins.lobe-gtd.apiName.execTask": "执行任务",
- "builtins.lobe-gtd.apiName.execTask.completed": "已创建任务:",
- "builtins.lobe-gtd.apiName.execTask.loading": "创建任务中:",
- "builtins.lobe-gtd.apiName.execTasks": "执行多个任务",
- "builtins.lobe-gtd.apiName.removeTodos": "删除待办",
- "builtins.lobe-gtd.apiName.updatePlan": "更新计划",
- "builtins.lobe-gtd.apiName.updatePlan.completed": "已完成",
- "builtins.lobe-gtd.apiName.updatePlan.modified": "已修改",
- "builtins.lobe-gtd.apiName.updateTodos": "更新待办",
- "builtins.lobe-gtd.title": "任务工具",
"builtins.lobe-knowledge-base.apiName.readKnowledge": "读取资源库内容",
"builtins.lobe-knowledge-base.apiName.searchKnowledgeBase": "搜索资源库",
"builtins.lobe-knowledge-base.inspector.andMoreFiles": "还有 {{count}} 个",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 957ffef738c..22ebdbc83b5 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -934,9 +934,6 @@
"tools.builtins.lobe-group-agent-builder.title": "群组助手构建器",
"tools.builtins.lobe-group-management.description": "编排并管理多助手群组对话",
"tools.builtins.lobe-group-management.title": "群组管理",
- "tools.builtins.lobe-gtd.description": "使用 GTD 方法规划目标并追踪进度",
- "tools.builtins.lobe-gtd.readme": "使用 GTD 方法规划目标并追踪进度。创建战略计划、管理带状态跟踪的待办列表,并执行长时间运行的异步任务。",
- "tools.builtins.lobe-gtd.title": "GTD 工具",
"tools.builtins.lobe-knowledge-base.description": "通过语义向量检索搜索已上传的文档与领域知识 — 适用于持久、可复用的参考资料",
"tools.builtins.lobe-knowledge-base.title": "知识库",
"tools.builtins.lobe-local-system.description": "访问和管理本地文件,在桌面端运行 Shell 命令",
diff --git a/locales/zh-CN/tool.json b/locales/zh-CN/tool.json
index 3de23cee308..46729ddd478 100644
--- a/locales/zh-CN/tool.json
+++ b/locales/zh-CN/tool.json
@@ -56,51 +56,51 @@
"dalle.generating": "生成中...",
"dalle.images": "图片:",
"dalle.prompt": "提示词",
- "lobe-gtd.actions.add": "添加",
- "lobe-gtd.actions.clearCompleted": "清除已完成",
- "lobe-gtd.actions.placeholder": "输入待办事项...",
- "lobe-gtd.addTodo.placeholder": "添加待办事项...",
- "lobe-gtd.clearTodos.cleared": "已清除 {{count}} 项",
- "lobe-gtd.clearTodos.clearedCompleted": "已清除 {{count}} 项已完成事项",
- "lobe-gtd.clearTodos.clearedCompleted_one": "已清除 {{count}} 项已完成事项",
- "lobe-gtd.clearTodos.clearedCompleted_other": "已清除 {{count}} 项已完成事项",
- "lobe-gtd.clearTodos.cleared_one": "已清除 {{count}} 项",
- "lobe-gtd.clearTodos.cleared_other": "已清除 {{count}} 项",
- "lobe-gtd.clearTodos.header": "清除待办事项",
- "lobe-gtd.clearTodos.label": "请选择要清除的内容:",
- "lobe-gtd.clearTodos.noItems": "无可清除事项",
- "lobe-gtd.clearTodos.option.all": "清除所有事项(包括未完成)",
- "lobe-gtd.clearTodos.option.completed": "仅清除已完成事项",
- "lobe-gtd.clearTodos.remaining": "剩余 {{count}} 项",
- "lobe-gtd.clearTodos.remaining_one": "剩余 {{count}} 项",
- "lobe-gtd.clearTodos.remaining_other": "剩余 {{count}} 项",
- "lobe-gtd.completeTodos.completed": "已完成 {{count}} 项",
- "lobe-gtd.completeTodos.completed_one": "已完成 {{count}} 项",
- "lobe-gtd.completeTodos.completed_other": "已完成 {{count}} 项",
- "lobe-gtd.createPlan.context.label": "上下文(可选)",
- "lobe-gtd.createPlan.context.placeholder": "背景、限制、注意事项等...",
- "lobe-gtd.createPlan.description.label": "描述",
- "lobe-gtd.createPlan.description.placeholder": "简要说明计划内容",
- "lobe-gtd.createPlan.goal.label": "目标",
- "lobe-gtd.createPlan.goal.placeholder": "你希望达成什么目标?",
- "lobe-gtd.createTodos.created": "已创建 {{count}} 项待办事项",
- "lobe-gtd.createTodos.created_one": "已创建 {{count}} 项待办事项",
- "lobe-gtd.createTodos.created_other": "已创建 {{count}} 项待办事项",
- "lobe-gtd.createTodos.total": "总计:{{count}} 项",
- "lobe-gtd.createTodos.total_one": "总计:{{count}} 项",
- "lobe-gtd.createTodos.total_other": "总计:{{count}} 项",
- "lobe-gtd.removeTodos.removed": "已移除 {{count}} 项",
- "lobe-gtd.removeTodos.removed_one": "已移除 {{count}} 项",
- "lobe-gtd.removeTodos.removed_other": "已移除 {{count}} 项",
- "lobe-gtd.status.done": "已完成 {{count}} 项",
- "lobe-gtd.status.pending": "待完成 {{count}} 项",
- "lobe-gtd.todoItem.placeholder": "输入待办事项...",
- "lobe-gtd.todoList.empty": "待办事项列表为空",
- "lobe-gtd.todoList.items": "{{count}} 项",
- "lobe-gtd.todoList.items_one": "{{count}} 项",
- "lobe-gtd.todoList.items_other": "{{count}} 项",
- "lobe-gtd.todoList.title": "待办事项列表",
- "lobe-gtd.updateTodos.updated": "待办事项已更新",
+ "lobe-agent.actions.add": "添加",
+ "lobe-agent.actions.clearCompleted": "清除已完成",
+ "lobe-agent.actions.placeholder": "输入待办事项...",
+ "lobe-agent.addTodo.placeholder": "添加待办事项...",
+ "lobe-agent.clearTodos.cleared": "已清除 {{count}} 项",
+ "lobe-agent.clearTodos.clearedCompleted": "已清除 {{count}} 项已完成事项",
+ "lobe-agent.clearTodos.clearedCompleted_one": "已清除 {{count}} 项已完成事项",
+ "lobe-agent.clearTodos.clearedCompleted_other": "已清除 {{count}} 项已完成事项",
+ "lobe-agent.clearTodos.cleared_one": "已清除 {{count}} 项",
+ "lobe-agent.clearTodos.cleared_other": "已清除 {{count}} 项",
+ "lobe-agent.clearTodos.header": "清除待办事项",
+ "lobe-agent.clearTodos.label": "请选择要清除的内容:",
+ "lobe-agent.clearTodos.noItems": "无可清除事项",
+ "lobe-agent.clearTodos.option.all": "清除所有事项(包括未完成)",
+ "lobe-agent.clearTodos.option.completed": "仅清除已完成事项",
+ "lobe-agent.clearTodos.remaining": "剩余 {{count}} 项",
+ "lobe-agent.clearTodos.remaining_one": "剩余 {{count}} 项",
+ "lobe-agent.clearTodos.remaining_other": "剩余 {{count}} 项",
+ "lobe-agent.completeTodos.completed": "已完成 {{count}} 项",
+ "lobe-agent.completeTodos.completed_one": "已完成 {{count}} 项",
+ "lobe-agent.completeTodos.completed_other": "已完成 {{count}} 项",
+ "lobe-agent.createPlan.context.label": "上下文(可选)",
+ "lobe-agent.createPlan.context.placeholder": "背景、限制、注意事项等...",
+ "lobe-agent.createPlan.description.label": "描述",
+ "lobe-agent.createPlan.description.placeholder": "简要说明计划内容",
+ "lobe-agent.createPlan.goal.label": "目标",
+ "lobe-agent.createPlan.goal.placeholder": "你希望达成什么目标?",
+ "lobe-agent.createTodos.created": "已创建 {{count}} 项待办事项",
+ "lobe-agent.createTodos.created_one": "已创建 {{count}} 项待办事项",
+ "lobe-agent.createTodos.created_other": "已创建 {{count}} 项待办事项",
+ "lobe-agent.createTodos.total": "总计:{{count}} 项",
+ "lobe-agent.createTodos.total_one": "总计:{{count}} 项",
+ "lobe-agent.createTodos.total_other": "总计:{{count}} 项",
+ "lobe-agent.removeTodos.removed": "已移除 {{count}} 项",
+ "lobe-agent.removeTodos.removed_one": "已移除 {{count}} 项",
+ "lobe-agent.removeTodos.removed_other": "已移除 {{count}} 项",
+ "lobe-agent.status.done": "已完成 {{count}} 项",
+ "lobe-agent.status.pending": "待完成 {{count}} 项",
+ "lobe-agent.todoItem.placeholder": "输入待办事项...",
+ "lobe-agent.todoList.empty": "待办事项列表为空",
+ "lobe-agent.todoList.items": "{{count}} 项",
+ "lobe-agent.todoList.items_one": "{{count}} 项",
+ "lobe-agent.todoList.items_other": "{{count}} 项",
+ "lobe-agent.todoList.title": "待办事项列表",
+ "lobe-agent.updateTodos.updated": "待办事项已更新",
"lobe-knowledge-base.readKnowledge.meta.chars": "字符数",
"lobe-knowledge-base.readKnowledge.meta.lines": "行数",
"localFiles.editFile.newString": "替换为",
diff --git a/package.json b/package.json
index 77a52b2fbda..88680bec830 100644
--- a/package.json
+++ b/package.json
@@ -220,7 +220,6 @@
"@lobechat/builtin-tool-creds": "workspace:*",
"@lobechat/builtin-tool-group-agent-builder": "workspace:*",
"@lobechat/builtin-tool-group-management": "workspace:*",
- "@lobechat/builtin-tool-gtd": "workspace:*",
"@lobechat/builtin-tool-knowledge-base": "workspace:*",
"@lobechat/builtin-tool-lobe-agent": "workspace:*",
"@lobechat/builtin-tool-local-system": "workspace:*",
diff --git a/packages/agent-mock/src/cases/builtins/todo-write-stress.ts b/packages/agent-mock/src/cases/builtins/todo-write-stress.ts
index d5cb1e7d3f1..7a8e7bd9239 100644
--- a/packages/agent-mock/src/cases/builtins/todo-write-stress.ts
+++ b/packages/agent-mock/src/cases/builtins/todo-write-stress.ts
@@ -1,13 +1,13 @@
import { defineCase, errorStep, llmStep, toolStep } from '../../builders/defineCase';
// ---------------------------------------------------------------------------
-// Helpers — all mapped to lobe-gtd
+// Helpers — all mapped to lobe-agent
// ---------------------------------------------------------------------------
-/** lobe-gtd / createTodos */
+/** lobe-agent / createTodos */
const createTodos = (items: string[], durationMs = 60) =>
toolStep({
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'createTodos',
arguments: JSON.stringify({ adds: items }),
result: {
@@ -20,14 +20,14 @@ const createTodos = (items: string[], durationMs = 60) =>
durationMs,
});
-/** lobe-gtd / updateTodos — batch operations */
+/** lobe-agent / updateTodos — batch operations */
const updateTodos = (
operations: Array<{ type: string; index?: number; newText?: string; status?: string }>,
currentItems: Array<{ text: string; status: string }>,
durationMs = 60,
) =>
toolStep({
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'updateTodos',
arguments: JSON.stringify({ operations }),
result: {
@@ -40,7 +40,7 @@ const updateTodos = (
durationMs,
});
-/** lobe-gtd / createPlan */
+/** lobe-agent / createPlan */
const createPlan = (
goal: string,
description: string,
@@ -49,7 +49,7 @@ const createPlan = (
durationMs = 80,
) =>
toolStep({
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'createPlan',
arguments: JSON.stringify({ goal, description, context }),
result: {
@@ -66,14 +66,14 @@ const createPlan = (
durationMs,
});
-/** lobe-gtd / updatePlan */
+/** lobe-agent / updatePlan */
const updatePlan = (
planId: string,
set: { goal?: string; description?: string; context?: string; completed?: boolean },
durationMs = 60,
) =>
toolStep({
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'updatePlan',
arguments: JSON.stringify({ planId, ...set }),
result: {
@@ -90,16 +90,16 @@ const updatePlan = (
durationMs,
});
-/** lobe-gtd / execTask */
-const execTask = (description: string, instruction: string, durationMs = 200) =>
+/** lobe-agent / callSubAgent */
+const callSubAgent = (description: string, instruction: string, durationMs = 200) =>
toolStep({
- identifier: 'lobe-gtd',
- apiName: 'execTask',
+ identifier: 'lobe-agent',
+ apiName: 'callSubAgent',
arguments: JSON.stringify({ description, instruction }),
result: {
parentMessageId: `mock-msg-task-${Date.now()}`,
task: { description, instruction },
- type: 'execTask' as const,
+ type: 'execSubAgent' as const,
},
durationMs,
});
@@ -108,14 +108,14 @@ const execTask = (description: string, instruction: string, durationMs = 200) =>
const breathe = (text: string, durationMs = 250) => llmStep({ text, durationMs });
// ---------------------------------------------------------------------------
-// The main case — ~200 lobe-gtd tool calls across 8 phases
+// The main case — ~200 lobe-agent tool calls across 8 phases
// ---------------------------------------------------------------------------
export const todoWriteStress = defineCase({
id: 'todo-write-stress',
name: 'TodoWrite × 200 (complex)',
description:
- '~200 GTD tool calls across 8 realistic phases: discovery, schema audit, store migration, ' +
+ '~200 lobe-agent tool calls across 8 realistic phases: discovery, schema audit, store migration, ' +
'TRPC refactor, i18n extraction, component rewrites, testing, and final verification.',
tags: ['stress', 'todo', 'builtin'],
@@ -137,8 +137,8 @@ export const todoWriteStress = defineCase({
text: '第一阶段:全面盘点现有代码结构。创建总体计划,再拆解为 15 个待办事项。',
reasoning: '先创建一个顶层计划文档,再将盘点工作拆解为具体的 todo 项。',
toolsCalling: [
- { id: 'tc-plan-1', identifier: 'lobe-gtd', apiName: 'createPlan', arguments: '{}' },
- { id: 'tc-todos-1', identifier: 'lobe-gtd', apiName: 'createTodos', arguments: '{}' },
+ { id: 'tc-plan-1', identifier: 'lobe-agent', apiName: 'createPlan', arguments: '{}' },
+ { id: 'tc-todos-1', identifier: 'lobe-agent', apiName: 'createTodos', arguments: '{}' },
],
durationMs: 600,
}),
@@ -242,7 +242,7 @@ export const todoWriteStress = defineCase({
status: k === i ? 'processing' : k < i ? 'completed' : 'todo',
})),
),
- execTask(
+ callSubAgent(
`为 ${table} 表添加索引`,
`检查 src/database/schemas/${table}.ts 的表结构,添加 createdAt 性能索引,生成迁移 SQL`,
),
@@ -275,7 +275,7 @@ export const todoWriteStress = defineCase({
status: k === i ? 'processing' : k < i ? 'completed' : 'todo',
})),
),
- execTask(
+ callSubAgent(
`为 ${table} 表添加索引`,
`检查 src/database/schemas/${table}.ts 的表结构,添加 createdAt 性能索引,生成迁移 SQL`,
),
@@ -343,7 +343,7 @@ export const todoWriteStress = defineCase({
[{ type: 'processing', index: 0 }],
[{ text: `迁移 ${slice} store slice 到 SWR 模式`, status: 'processing' }],
),
- execTask(
+ callSubAgent(
`迁移 ${slice} store slice`,
`重构 src/store/chat/slices/${slice}/index.ts,将数据获取逻辑迁移到 SWR + Zustand 模式`,
),
@@ -482,7 +482,7 @@ export const todoWriteStress = defineCase({
{ text: '修复 type-check 发现的类型问题', status: 'processing' },
],
),
- execTask('修复 TRPC 类型问题', '运行 bun run type-check,逐一修复类型错误直到通过'),
+ callSubAgent('修复 TRPC 类型问题', '运行 bun run type-check,逐一修复类型错误直到通过'),
updateTodos(
[{ type: 'complete', index: 1 }],
[
@@ -523,7 +523,7 @@ export const todoWriteStress = defineCase({
[{ type: 'processing', index: 0 }],
[{ text: `提取 ${ns} 命名空间的硬编码字符串`, status: 'processing' }],
),
- execTask(
+ callSubAgent(
`提取 ${ns} i18n keys`,
`扫描 src/locales/default/${ns}.ts,将硬编码字符串替换为 i18n key`,
),
@@ -540,7 +540,7 @@ export const todoWriteStress = defineCase({
[{ type: 'processing', index: 0 }],
[{ text: `提取 ${ns} 命名空间的硬编码字符串`, status: 'processing' }],
),
- execTask(
+ callSubAgent(
`提取 ${ns} i18n keys`,
`扫描 src/locales/default/${ns}.ts,将硬编码字符串替换为 i18n key`,
),
@@ -560,7 +560,7 @@ export const todoWriteStress = defineCase({
[{ type: 'processing', index: 0 }],
[{ text: '修复 i18n sync 重复 key 问题', status: 'processing' }],
),
- execTask(
+ callSubAgent(
'修复 i18n 重复 key',
'检查 src/locales/zh-CN/agent.ts,合并重复的 confirmDelete key,重新运行 pnpm i18n',
),
@@ -627,7 +627,7 @@ export const todoWriteStress = defineCase({
status: k === localIdx ? 'processing' : k < localIdx ? 'completed' : 'todo',
})),
),
- execTask(
+ callSubAgent(
`迁移 ${comp} 样式`,
`将 src/features/${comp}/index.tsx 中的 createStyles 替换为 createStaticStyles,使用 cssVar`,
),
@@ -660,7 +660,7 @@ export const todoWriteStress = defineCase({
[{ type: 'processing', index: 0 }],
[{ text: '验证迁移后的组件编译通过', status: 'processing' }],
),
- execTask('编译验证', '运行 bun run type-check 确认迁移后的组件没有类型错误'),
+ callSubAgent('编译验证', '运行 bun run type-check 确认迁移后的组件没有类型错误'),
updateTodos(
[{ type: 'complete', index: 0 }],
[{ text: '验证迁移后的组件编译通过', status: 'completed' }],
@@ -693,7 +693,7 @@ export const todoWriteStress = defineCase({
status: k === i ? 'processing' : k < i ? 'completed' : 'todo',
})),
),
- execTask(`编写 ${target} 测试`, `为 ${target} 编写 vitest 测试用例,覆盖核心功能路径`),
+ callSubAgent(`编写 ${target} 测试`, `为 ${target} 编写 vitest 测试用例,覆盖核心功能路径`),
updateTodos(
[{ type: 'complete', index: i }],
Array.from({ length: 4 }, (_, k) => ({
@@ -728,7 +728,7 @@ export const todoWriteStress = defineCase({
status: k === i ? 'processing' : k < i ? 'completed' : 'todo',
})),
),
- execTask(`${target}`, `执行 ${target} 相关的测试修复与验证工作`),
+ callSubAgent(`${target}`, `执行 ${target} 相关的测试修复与验证工作`),
updateTodos(
[{ type: 'complete', index: i }],
Array.from({ length: 4 }, (_, k) => ({
@@ -768,7 +768,7 @@ export const todoWriteStress = defineCase({
status: k === i ? 'processing' : k < i ? 'completed' : 'todo',
})),
),
- execTask(`执行 ${task}`, `运行 ${task} 确认迁移无回归`),
+ callSubAgent(`执行 ${task}`, `运行 ${task} 确认迁移无回归`),
updateTodos(
[{ type: 'complete', index: i }],
Array.from({ length: 5 }, (_, k) => ({
@@ -791,8 +791,8 @@ export const todoWriteStress = defineCase({
{ text: '写迁移指南文档', status: 'processing' },
],
),
- execTask('更新 CI 配置', '修改 .github/workflows/ci.yml 添加并行 vitest shards'),
- execTask('写迁移指南', '创建 docs/MIGRATION.md 记录所有迁移变更和操作步骤'),
+ callSubAgent('更新 CI 配置', '修改 .github/workflows/ci.yml 添加并行 vitest shards'),
+ callSubAgent('写迁移指南', '创建 docs/MIGRATION.md 记录所有迁移变更和操作步骤'),
updateTodos(
[
{ type: 'complete', index: 0 },
@@ -810,7 +810,7 @@ export const todoWriteStress = defineCase({
// Done
// =====================================================================
llmStep({
- text: '全部 8 个阶段完成。共执行约 200 个 GTD 工具调用,涵盖计划创建、待办管理、任务执行和错误恢复。迁移已通过 type-check、单测、E2E 和安全审计。',
+ text: '全部 8 个阶段完成。共执行约 200 个 lobe-agent 工具调用,涵盖计划创建、待办管理、任务执行和错误恢复。迁移已通过 type-check、单测、E2E 和安全审计。',
reasoning: '确认所有 todo 已标记完成,所有 plan 已标记 completed,汇总执行统计。',
durationMs: 600,
}),
diff --git a/packages/agent-runtime/src/agents/GeneralChatAgent.ts b/packages/agent-runtime/src/agents/GeneralChatAgent.ts
index 144e399119d..1d0eb01ae36 100644
--- a/packages/agent-runtime/src/agents/GeneralChatAgent.ts
+++ b/packages/agent-runtime/src/agents/GeneralChatAgent.ts
@@ -21,8 +21,8 @@ import {
type GeneralAgentCompressionResultPayload,
type GeneralAgentConfig,
type HumanAbortPayload,
- type TaskResultPayload,
- type TasksBatchResultPayload,
+ type SubAgentResultPayload,
+ type SubAgentsBatchResultPayload,
} from '../types';
import { shouldCompress } from '../utils/tokenCounter';
@@ -544,55 +544,57 @@ export class GeneralChatAgent implements Agent {
const { data, parentMessageId, stop } =
context.payload as GeneralAgentCallToolResultPayload;
- // Check if this is a GTD async task request (only execTask/execTasks are passed here with stop=true)
+ // Check if this is a sub-agent dispatch request (lobe-agent.callSubAgent /
+ // callSubAgents and similarly-shaped tools emit state.type=execSubAgent*
+ // with stop=true so the runtime forks a sub-agent here).
if (stop && data?.state) {
const stateType = data.state.type;
- // GTD async task (single)
- if (stateType === 'execTask') {
+ // Server-side sub-agent (single)
+ if (stateType === 'execSubAgent') {
const { parentMessageId: execParentId, task } = data.state as {
parentMessageId: string;
task: any;
};
return {
payload: { parentMessageId: execParentId, task },
- type: 'exec_task',
+ type: 'exec_sub_agent',
};
}
- // GTD async tasks (multiple)
- if (stateType === 'execTasks') {
+ // Server-side sub-agents (multiple)
+ if (stateType === 'execSubAgents') {
const { parentMessageId: execParentId, tasks } = data.state as {
parentMessageId: string;
tasks: any[];
};
return {
payload: { parentMessageId: execParentId, tasks },
- type: 'exec_tasks',
+ type: 'exec_sub_agents',
};
}
- // GTD client-side async task (single, desktop only)
- if (stateType === 'execClientTask') {
+ // Client-side sub-agent (single, desktop only)
+ if (stateType === 'execClientSubAgent') {
const { parentMessageId: execParentId, task } = data.state as {
parentMessageId: string;
task: any;
};
return {
payload: { parentMessageId: execParentId, task },
- type: 'exec_client_task',
+ type: 'exec_client_sub_agent',
};
}
- // GTD client-side async tasks (multiple, desktop only)
- if (stateType === 'execClientTasks') {
+ // Client-side sub-agents (multiple, desktop only)
+ if (stateType === 'execClientSubAgents') {
const { parentMessageId: execParentId, tasks } = data.state as {
parentMessageId: string;
tasks: any[];
};
return {
payload: { parentMessageId: execParentId, tasks },
- type: 'exec_client_tasks',
+ type: 'exec_client_sub_agents',
};
}
}
@@ -662,9 +664,9 @@ export class GeneralChatAgent implements Agent {
} as GeneralAgentCallLLMInstructionPayload);
}
- case 'task_result': {
- // Single async task completed, continue to call LLM with result
- const { parentMessageId } = context.payload as TaskResultPayload;
+ case 'sub_agent_result': {
+ // Single sub-agent completed, continue to call LLM with result
+ const { parentMessageId } = context.payload as SubAgentResultPayload;
// Continue to call LLM with updated messages (task message is already in state)
return this.toLLMCall({
@@ -676,9 +678,9 @@ export class GeneralChatAgent implements Agent {
} as GeneralAgentCallLLMInstructionPayload);
}
- case 'tasks_batch_result': {
- // Async tasks batch completed, continue to call LLM with results
- const { parentMessageId } = context.payload as TasksBatchResultPayload;
+ case 'sub_agents_batch_result': {
+ // Sub-agents batch completed, continue to call LLM with results
+ const { parentMessageId } = context.payload as SubAgentsBatchResultPayload;
if (context.stepContext?.hasQueuedMessages) {
return { reason: 'queued_message_interrupt', type: 'finish' };
diff --git a/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts b/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts
index 08a2fdb5921..dd9232586d5 100644
--- a/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts
+++ b/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts
@@ -451,8 +451,8 @@ describe('GeneralChatAgent', () => {
});
describe('tool_result phase', () => {
- describe('GTD async tasks', () => {
- it('should return exec_task for single async task (execTask)', async () => {
+ describe('Lobe Agent sub-agents (execSubAgent state)', () => {
+ it('should return exec_sub_agent for single sub-agent (execSubAgent)', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
operationId: 'test-session',
@@ -465,7 +465,7 @@ describe('GeneralChatAgent', () => {
stop: true,
data: {
state: {
- type: 'execTask',
+ type: 'execSubAgent',
parentMessageId: 'exec-parent-msg',
task: { instruction: 'Do something async', timeout: 30000 },
},
@@ -475,7 +475,7 @@ describe('GeneralChatAgent', () => {
const result = await agent.runner(context, state);
expect(result).toEqual({
- type: 'exec_task',
+ type: 'exec_sub_agent',
payload: {
parentMessageId: 'exec-parent-msg',
task: { instruction: 'Do something async', timeout: 30000 },
@@ -483,7 +483,7 @@ describe('GeneralChatAgent', () => {
});
});
- it('should return exec_tasks for multiple async tasks (execTasks)', async () => {
+ it('should return exec_sub_agents for multiple sub-agents (execSubAgents)', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
operationId: 'test-session',
@@ -500,7 +500,7 @@ describe('GeneralChatAgent', () => {
stop: true,
data: {
state: {
- type: 'execTasks',
+ type: 'execSubAgents',
parentMessageId: 'exec-parent-msg',
tasks,
},
@@ -510,7 +510,7 @@ describe('GeneralChatAgent', () => {
const result = await agent.runner(context, state);
expect(result).toEqual({
- type: 'exec_tasks',
+ type: 'exec_sub_agents',
payload: {
parentMessageId: 'exec-parent-msg',
tasks,
@@ -518,7 +518,7 @@ describe('GeneralChatAgent', () => {
});
});
- it('should return exec_client_task for single client-side async task (execClientTask)', async () => {
+ it('should return exec_client_sub_agent for single client-side sub-agent (execClientSubAgent)', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
operationId: 'test-session',
@@ -531,7 +531,7 @@ describe('GeneralChatAgent', () => {
stop: true,
data: {
state: {
- type: 'execClientTask',
+ type: 'execClientSubAgent',
parentMessageId: 'exec-parent-msg',
task: { type: 'localFile', path: '/path/to/file' },
},
@@ -541,7 +541,7 @@ describe('GeneralChatAgent', () => {
const result = await agent.runner(context, state);
expect(result).toEqual({
- type: 'exec_client_task',
+ type: 'exec_client_sub_agent',
payload: {
parentMessageId: 'exec-parent-msg',
task: { type: 'localFile', path: '/path/to/file' },
@@ -549,7 +549,7 @@ describe('GeneralChatAgent', () => {
});
});
- it('should return exec_client_tasks for multiple client-side async tasks (execClientTasks)', async () => {
+ it('should return exec_client_sub_agents for multiple client-side sub-agents (execClientSubAgents)', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
operationId: 'test-session',
@@ -566,7 +566,7 @@ describe('GeneralChatAgent', () => {
stop: true,
data: {
state: {
- type: 'execClientTasks',
+ type: 'execClientSubAgents',
parentMessageId: 'exec-parent-msg',
tasks,
},
@@ -576,7 +576,7 @@ describe('GeneralChatAgent', () => {
const result = await agent.runner(context, state);
expect(result).toEqual({
- type: 'exec_client_tasks',
+ type: 'exec_client_sub_agents',
payload: {
parentMessageId: 'exec-parent-msg',
tasks,
@@ -584,7 +584,7 @@ describe('GeneralChatAgent', () => {
});
});
- it('should not trigger exec_task when stop is false', async () => {
+ it('should not trigger exec_sub_agent when stop is false', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
operationId: 'test-session',
@@ -600,10 +600,10 @@ describe('GeneralChatAgent', () => {
});
const context = createMockContext('tool_result', {
parentMessageId: 'tool-msg-1',
- stop: false, // stop is false, should not trigger exec_task
+ stop: false, // stop is false, should not trigger exec_sub_agent
data: {
state: {
- type: 'execTask',
+ type: 'execSubAgent',
parentMessageId: 'exec-parent-msg',
task: { instruction: 'Do something async' },
},
@@ -612,7 +612,7 @@ describe('GeneralChatAgent', () => {
const result = await agent.runner(context, state);
- // Should return call_llm instead of exec_task
+ // Should return call_llm instead of exec_sub_agent
expect(result).toEqual({
type: 'call_llm',
payload: {
@@ -625,7 +625,7 @@ describe('GeneralChatAgent', () => {
});
});
- it('should not trigger exec_task when data.state is undefined', async () => {
+ it('should not trigger exec_sub_agent when data.state is undefined', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
operationId: 'test-session',
@@ -647,7 +647,7 @@ describe('GeneralChatAgent', () => {
const result = await agent.runner(context, state);
- // Should return call_llm instead of exec_task
+ // Should return call_llm instead of exec_sub_agent
expect(result).toEqual({
type: 'call_llm',
payload: {
@@ -1502,7 +1502,7 @@ describe('GeneralChatAgent', () => {
});
});
- describe('task_result phase (single task)', () => {
+ describe('sub_agent_result phase (single sub-agent)', () => {
it('should return call_llm when task completed', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
@@ -1518,7 +1518,7 @@ describe('GeneralChatAgent', () => {
] as any,
});
- const context = createMockContext('task_result', {
+ const context = createMockContext('sub_agent_result', {
parentMessageId: 'task-parent-msg',
result: {
success: true,
@@ -1557,7 +1557,7 @@ describe('GeneralChatAgent', () => {
] as any,
});
- const context = createMockContext('task_result', {
+ const context = createMockContext('sub_agent_result', {
parentMessageId: 'task-parent-msg',
result: {
success: false,
@@ -1592,7 +1592,7 @@ describe('GeneralChatAgent', () => {
] as any,
});
- const context = createMockContext('task_result', {
+ const context = createMockContext('sub_agent_result', {
parentMessageId: 'task-parent-msg',
});
@@ -1602,7 +1602,7 @@ describe('GeneralChatAgent', () => {
});
});
- describe('tasks_batch_result phase (multiple tasks)', () => {
+ describe('sub_agents_batch_result phase (multiple sub-agents)', () => {
it('should return call_llm when tasks completed', async () => {
const agent = new GeneralChatAgent({
agentConfig: { maxSteps: 100 },
@@ -1619,7 +1619,7 @@ describe('GeneralChatAgent', () => {
] as any,
});
- const context = createMockContext('tasks_batch_result', {
+ const context = createMockContext('sub_agents_batch_result', {
parentMessageId: 'task-parent-msg',
results: [
{ success: true, taskMessageId: 'task-1', threadId: 'thread-1', result: 'Task 1 result' },
@@ -1664,7 +1664,7 @@ describe('GeneralChatAgent', () => {
] as any,
});
- const context = createMockContext('tasks_batch_result', {
+ const context = createMockContext('sub_agents_batch_result', {
parentMessageId: 'task-parent-msg',
results: [
{ success: true, taskMessageId: 'task-1', threadId: 'thread-1', result: 'Task 1 result' },
@@ -1710,7 +1710,7 @@ describe('GeneralChatAgent', () => {
] as any,
});
- const context = createMockContext('tasks_batch_result', {
+ const context = createMockContext('sub_agents_batch_result', {
parentMessageId: 'task-parent-msg',
});
diff --git a/packages/agent-runtime/src/types/generalAgent.ts b/packages/agent-runtime/src/types/generalAgent.ts
index 75f11dff319..4be58010f3d 100644
--- a/packages/agent-runtime/src/types/generalAgent.ts
+++ b/packages/agent-runtime/src/types/generalAgent.ts
@@ -34,7 +34,7 @@ export interface GeneralAgentCallToolResultPayload {
executionTime: number;
isSuccess: boolean;
parentMessageId: string;
- /** Whether tool requested to stop execution (e.g., group management speak/delegate, GTD async tasks) */
+ /** Whether tool requested to stop execution (e.g., group management speak/delegate, lobe-agent async sub-agents) */
stop?: boolean;
toolCall: ChatToolPayload;
toolCallId: string;
diff --git a/packages/agent-runtime/src/types/instruction.ts b/packages/agent-runtime/src/types/instruction.ts
index cdfc5a468fe..8f99183b3e7 100644
--- a/packages/agent-runtime/src/types/instruction.ts
+++ b/packages/agent-runtime/src/types/instruction.ts
@@ -35,8 +35,8 @@ export interface AgentRuntimeContext {
| 'llm_result'
| 'tool_result'
| 'tools_batch_result'
- | 'task_result'
- | 'tasks_batch_result'
+ | 'sub_agent_result'
+ | 'sub_agents_batch_result'
| 'human_response'
| 'human_approved_tool'
| 'human_abort'
@@ -53,7 +53,7 @@ export interface AgentRuntimeContext {
/**
* Step context computed at the beginning of each step
- * Contains dynamic state like GTD todos that changes between steps
+ * Contains dynamic state like lobe-agent todos that changes between steps
* Computed by AgentRuntime and passed to Context Engine and Tool Executors
*/
stepContext?: RuntimeStepContext;
@@ -148,27 +148,28 @@ export interface HumanAbortPayload {
}
/**
- * Task definition for exec_tasks instruction
+ * Sub-agent definition for exec_sub_agents instruction
*/
-export interface ExecTaskItem {
- /** Brief description of what this task does (shown in UI) */
+export interface SubAgentTask {
+ /** Brief description of what this sub-agent does (shown in UI) */
description: string;
/** Whether to inherit context messages from parent conversation */
inheritMessages?: boolean;
- /** Detailed instruction/prompt for the task execution */
+ /** Detailed instruction/prompt for the sub-agent execution */
instruction: string;
/**
- * Whether to execute the task on the client side (desktop only).
- * When true and running on desktop, the task will be executed locally
- * with access to local tools (file system, shell commands, etc.).
+ * Whether to execute the sub-agent on the client side (desktop only).
+ * When true and running on desktop, the sub-agent runs locally with
+ * access to local tools (file system, shell commands, etc.).
*
- * IMPORTANT: This MUST be set to true when the task requires:
+ * IMPORTANT: This MUST be set to true when the sub-agent requires:
* - Reading/writing local files via `local-system` tool
* - Executing shell commands
* - Any other desktop-only local tool operations
*
- * If not specified or false, the task runs on the server (default behavior).
- * On non-desktop platforms (web), this flag is ignored and tasks always run on server.
+ * If not specified or false, the sub-agent runs on the server (default behavior).
+ * On non-desktop platforms (web), this flag is ignored and sub-agents always
+ * run on the server.
*/
runInClient?: boolean;
/** Timeout in milliseconds (optional, default 30 minutes) */
@@ -176,43 +177,43 @@ export interface ExecTaskItem {
}
/**
- * Payload for task_result phase (single task)
+ * Payload for sub_agent_result phase (single sub-agent)
*/
-export interface TaskResultPayload {
+export interface SubAgentResultPayload {
/** Parent message ID */
parentMessageId: string;
- /** Result from executed task */
+ /** Result from executed sub-agent */
result: {
- /** Error message if task failed */
+ /** Error message if sub-agent failed */
error?: string;
- /** Task result content */
+ /** Sub-agent result content */
result?: string;
- /** Whether the task completed successfully */
+ /** Whether the sub-agent completed successfully */
success: boolean;
- /** Task message ID */
+ /** Sub-agent message ID */
taskMessageId: string;
- /** Thread ID where the task was executed */
+ /** Thread ID where the sub-agent was executed */
threadId: string;
};
}
/**
- * Payload for tasks_batch_result phase (multiple tasks)
+ * Payload for sub_agents_batch_result phase (multiple sub-agents)
*/
-export interface TasksBatchResultPayload {
+export interface SubAgentsBatchResultPayload {
/** Parent message ID */
parentMessageId: string;
- /** Results from executed tasks */
+ /** Results from executed sub-agents */
results: Array<{
- /** Error message if task failed */
+ /** Error message if sub-agent failed */
error?: string;
- /** Task result content */
+ /** Sub-agent result content */
result?: string;
- /** Whether the task completed successfully */
+ /** Whether the sub-agent completed successfully */
success: boolean;
- /** Task message ID */
+ /** Sub-agent message ID */
taskMessageId: string;
- /** Thread ID where the task was executed */
+ /** Thread ID where the sub-agent was executed */
threadId: string;
}>;
}
@@ -272,46 +273,46 @@ export interface AgentInstructionResolveAbortedTools extends AgentInstructionBas
type: 'resolve_aborted_tools';
}
-// ─ Task ──────────────────────────────────────────────────
+// ─ Sub-Agent ─────────────────────────────────────────────
-export interface AgentInstructionExecTask extends AgentInstructionBase {
+export interface AgentInstructionExecSubAgent extends AgentInstructionBase {
payload: {
- /** Parent message ID (tool message that triggered the task) */
+ /** Parent message ID (tool message that dispatched the sub-agent) */
parentMessageId: string;
- /** Task to execute */
- task: ExecTaskItem;
+ /** Sub-agent to execute */
+ task: SubAgentTask;
};
- type: 'exec_task';
+ type: 'exec_sub_agent';
}
-export interface AgentInstructionExecTasks extends AgentInstructionBase {
+export interface AgentInstructionExecSubAgents extends AgentInstructionBase {
payload: {
- /** Parent message ID (tool message that triggered the tasks) */
+ /** Parent message ID (tool message that dispatched the sub-agents) */
parentMessageId: string;
- /** Array of tasks to execute */
- tasks: ExecTaskItem[];
+ /** Array of sub-agents to execute */
+ tasks: SubAgentTask[];
};
- type: 'exec_tasks';
+ type: 'exec_sub_agents';
}
-export interface AgentInstructionExecClientTask extends AgentInstructionBase {
+export interface AgentInstructionExecClientSubAgent extends AgentInstructionBase {
payload: {
- /** Parent message ID (tool message that triggered the task) */
+ /** Parent message ID (tool message that dispatched the sub-agent) */
parentMessageId: string;
- /** Task to execute */
- task: ExecTaskItem;
+ /** Sub-agent to execute */
+ task: SubAgentTask;
};
- type: 'exec_client_task';
+ type: 'exec_client_sub_agent';
}
-export interface AgentInstructionExecClientTasks extends AgentInstructionBase {
+export interface AgentInstructionExecClientSubAgents extends AgentInstructionBase {
payload: {
- /** Parent message ID (tool message that triggered the tasks) */
+ /** Parent message ID (tool message that dispatched the sub-agents) */
parentMessageId: string;
- /** Array of tasks to execute */
- tasks: ExecTaskItem[];
+ /** Array of sub-agents to execute */
+ tasks: SubAgentTask[];
};
- type: 'exec_client_tasks';
+ type: 'exec_client_sub_agents';
}
// ─ Human Interaction ─────────────────────────────────────
@@ -372,11 +373,11 @@ export type AgentInstruction =
| AgentInstructionCallTool
| AgentInstructionCallToolsBatch
| AgentInstructionResolveAbortedTools
- // Task
- | AgentInstructionExecTask
- | AgentInstructionExecTasks
- | AgentInstructionExecClientTask
- | AgentInstructionExecClientTasks
+ // Sub-Agent
+ | AgentInstructionExecSubAgent
+ | AgentInstructionExecSubAgents
+ | AgentInstructionExecClientSubAgent
+ | AgentInstructionExecClientSubAgents
// Human Interaction
| AgentInstructionRequestHumanPrompt
| AgentInstructionRequestHumanSelect
diff --git a/packages/agent-runtime/src/types/runtime.ts b/packages/agent-runtime/src/types/runtime.ts
index 1f1381b42e6..675d848bf00 100644
--- a/packages/agent-runtime/src/types/runtime.ts
+++ b/packages/agent-runtime/src/types/runtime.ts
@@ -7,7 +7,7 @@ export type InstructionExecutor = (
state: AgentState,
/**
* Runtime context for this step
- * Contains stepContext with dynamic state like GTD todos
+ * Contains stepContext with dynamic state like lobe-agent todos
*/
context?: AgentRuntimeContext,
) => Promise<{
diff --git a/packages/agent-runtime/src/utils/messageSelectors.ts b/packages/agent-runtime/src/utils/messageSelectors.ts
index f4e2cf002c2..194d9225473 100644
--- a/packages/agent-runtime/src/utils/messageSelectors.ts
+++ b/packages/agent-runtime/src/utils/messageSelectors.ts
@@ -25,9 +25,9 @@ export interface MessageVisitorOptions {
* if (id) return { activeDeviceId: id };
* }, { role: 'tool' });
*
- * // Find latest GTD todos
+ * // Find latest lobe-agent todos
* const todos = findInMessages(messages, (msg) => {
- * if (msg.plugin?.identifier === GTDIdentifier) return msg.pluginState?.todos;
+ * if (msg.plugin?.identifier === LobeAgentIdentifier) return msg.pluginState?.todos;
* }, { role: 'tool' });
* ```
*/
diff --git a/packages/builtin-agents/package.json b/packages/builtin-agents/package.json
index 428ae6f3e8e..e899b6d2607 100644
--- a/packages/builtin-agents/package.json
+++ b/packages/builtin-agents/package.json
@@ -9,7 +9,6 @@
"@lobechat/builtin-tool-agent-management": "workspace:*",
"@lobechat/builtin-tool-group-agent-builder": "workspace:*",
"@lobechat/builtin-tool-group-management": "workspace:*",
- "@lobechat/builtin-tool-gtd": "workspace:*",
"@lobechat/builtin-tool-notebook": "workspace:*",
"@lobechat/builtin-tool-task": "workspace:*",
"@lobechat/builtin-tool-user-interaction": "workspace:*",
diff --git a/packages/builtin-agents/src/agents/group-supervisor/index.ts b/packages/builtin-agents/src/agents/group-supervisor/index.ts
index 319eaac5342..531ad66a7c4 100644
--- a/packages/builtin-agents/src/agents/group-supervisor/index.ts
+++ b/packages/builtin-agents/src/agents/group-supervisor/index.ts
@@ -26,7 +26,7 @@ const resolveSystemRole = (ctx: GroupSupervisorContext): string => {
* Tools:
* - GroupManagement: orchestration (speak, broadcast, executeAgentTask, etc.)
* - GroupAgentBuilder: member management (searchAgent, inviteAgent, createAgent, etc.)
- * - GTD: task tracking
+ * - LobeAgent: task tracking (plan + todos)
*/
export const GROUP_SUPERVISOR: BuiltinAgentDefinition = {
runtime: (ctx) => {
diff --git a/packages/builtin-tool-agent-management/src/executor.ts b/packages/builtin-tool-agent-management/src/executor.ts
index 6c9e7e4bd6c..bbfbf8a136c 100644
--- a/packages/builtin-tool-agent-management/src/executor.ts
+++ b/packages/builtin-tool-agent-management/src/executor.ts
@@ -119,7 +119,7 @@ class AgentManagementExecutor extends BaseExecutor<typeof AgentManagementApiName
} = params;
if (runAsTask) {
- // Execute as async task using GTD exec_task pattern
+ // Dispatch as a sub-agent using the lobe-agent exec_sub_agent pattern
// Pre-load target agent config to ensure it exists
const targetAgentExists = useAgentStore.getState().agentMap[agentId];
if (!targetAgentExists) {
@@ -141,8 +141,8 @@ class AgentManagementExecutor extends BaseExecutor<typeof AgentManagementApiName
}
}
- // Return special state that will be recognized by AgentRuntime's exec_task executor
- // Following GTD execTask pattern: stop: true + state.type = 'execTask'
+ // Return special state that will be recognized by AgentRuntime's exec_sub_agent executor
+ // Follows the lobe-agent callSubAgent pattern: stop: true + state.type = 'execSubAgent'
return {
content: `🚀 Triggered async task to call agent "${agentId}"${taskTitle ? `: ${taskTitle}` : ''}`,
state: {
@@ -153,7 +153,7 @@ class AgentManagementExecutor extends BaseExecutor<typeof AgentManagementApiName
targetAgentId: agentId, // Special field for callAgent - indicates target agent
timeout: timeout || 1_800_000,
},
- type: 'execTask', // Use same type as GTD to reuse existing executor
+ type: 'execSubAgent', // Same wire-level type as lobe-agent so the runtime reuses its executor
},
stop: true,
success: true,
diff --git a/packages/builtin-tool-claude-code/src/types.ts b/packages/builtin-tool-claude-code/src/types.ts
index 4c346606900..16d0a6452fe 100644
--- a/packages/builtin-tool-claude-code/src/types.ts
+++ b/packages/builtin-tool-claude-code/src/types.ts
@@ -46,7 +46,7 @@ export enum ClaudeCodeApiName {
/**
* Status of a single todo item in a `TodoWrite` tool_use.
- * Matches Claude Code's native schema — do not reuse GTD's `TodoStatus`,
+ * Matches Claude Code's native schema — do not reuse lobe-agent's `TodoStatus`,
* which has a different vocabulary (`todo` / `processing`).
*/
export type ClaudeCodeTodoStatus = 'pending' | 'in_progress' | 'completed';
diff --git a/packages/builtin-tool-gtd/package.json b/packages/builtin-tool-gtd/package.json
deleted file mode 100644
index 6df061ff42c..00000000000
--- a/packages/builtin-tool-gtd/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "@lobechat/builtin-tool-gtd",
- "version": "1.0.0",
- "private": true,
- "exports": {
- ".": "./src/index.ts",
- "./executor": "./src/executor/index.ts",
- "./executionRuntime": "./src/ExecutionRuntime/index.ts",
- "./client": "./src/client/index.ts"
- },
- "main": "./src/index.ts",
- "dependencies": {
- "@lobechat/const": "workspace:*",
- "@lobechat/prompts": "workspace:*"
- },
- "devDependencies": {
- "@lobechat/types": "workspace:*"
- },
- "peerDependencies": {
- "@lobehub/editor": "^4",
- "@lobehub/ui": "^5",
- "antd": "^6",
- "antd-style": "*",
- "lucide-react": "*",
- "react": "*"
- }
-}
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx
deleted file mode 100644
index f33f1a00ba2..00000000000
--- a/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-'use client';
-
-import type { BuiltinInspectorProps } from '@lobechat/types';
-import { cx } from 'antd-style';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
-
-import type { ExecTaskParams, ExecTaskState } from '../../../types';
-
-export const ExecTaskInspector = memo<BuiltinInspectorProps<ExecTaskParams, ExecTaskState>>(
- ({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
- const { t } = useTranslation('plugin');
-
- const description = args?.description || partialArgs?.description;
-
- // Arguments are still streaming and no description yet
- if (isArgumentsStreaming) {
- if (!description)
- return (
- <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.execTask')}</span>
- </div>
- );
-
- return (
- <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.execTask.loading')}</span>
- <span className={highlightTextStyles.primary}>{description}</span>
- </div>
- );
- }
-
- // When description is available, show different text based on loading state
- if (description) {
- return (
- <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
- <span>
- {isLoading
- ? t('builtins.lobe-gtd.apiName.execTask.loading')
- : t('builtins.lobe-gtd.apiName.execTask.completed')}
- </span>
- <span className={highlightTextStyles.primary}>{description}</span>
- </div>
- );
- }
-
- // fallback
- return (
- <div className={inspectorTextStyles.root}>
- <span>{t('builtins.lobe-gtd.apiName.execTask')}</span>
- </div>
- );
- },
-);
-
-ExecTaskInspector.displayName = 'ExecTaskInspector';
-
-export default ExecTaskInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/ExecTasks/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/ExecTasks/index.tsx
deleted file mode 100644
index 64e1bae5863..00000000000
--- a/packages/builtin-tool-gtd/src/client/Inspector/ExecTasks/index.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-'use client';
-
-import type { BuiltinInspectorProps } from '@lobechat/types';
-import { Icon } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { ListTodo } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { highlightTextStyles, shinyTextStyles } from '@/styles';
-
-import type { ExecTasksParams, ExecTasksState } from '../../../types';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- count: css`
- flex-shrink: 0;
- margin-inline-start: 4px;
- color: ${cssVar.colorTextSecondary};
- `,
- description: css`
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- root: css`
- overflow: hidden;
- display: flex;
- gap: 4px;
- align-items: center;
- `,
- title: css`
- flex-shrink: 0;
- color: ${cssVar.colorText};
- `,
-}));
-
-export const ExecTasksInspector = memo<BuiltinInspectorProps<ExecTasksParams, ExecTasksState>>(
- ({ args, partialArgs, isArgumentsStreaming }) => {
- const { t } = useTranslation('plugin');
-
- const tasks = args?.tasks || partialArgs?.tasks || [];
- const count = tasks.length;
- const firstTask = tasks[0];
-
- if (isArgumentsStreaming && count === 0) {
- return (
- <div className={cx(styles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.execTasks')}</span>
- </div>
- );
- }
-
- return (
- <div className={styles.root}>
- <span className={cx(styles.title, isArgumentsStreaming && shinyTextStyles.shinyText)}>
- {t('builtins.lobe-gtd.apiName.execTasks')}:
- </span>
- {firstTask?.description && (
- <span className={cx(styles.description, highlightTextStyles.primary)}>
- {firstTask.description}
- </span>
- )}
- {count > 1 && (
- <span className={styles.count}>
- <Icon icon={ListTodo} size={14} /> {count}
- </span>
- )}
- </div>
- );
- },
-);
-
-ExecTasksInspector.displayName = 'ExecTasksInspector';
-
-export default ExecTasksInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/index.ts b/packages/builtin-tool-gtd/src/client/Inspector/index.ts
deleted file mode 100644
index b147d614c47..00000000000
--- a/packages/builtin-tool-gtd/src/client/Inspector/index.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import type { BuiltinInspector } from '@lobechat/types';
-
-import { GTDApiName } from '../../types';
-import { ClearTodosInspector } from './ClearTodos';
-import { CreatePlanInspector } from './CreatePlan';
-import { CreateTodosInspector } from './CreateTodos';
-import { ExecTaskInspector } from './ExecTask';
-import { ExecTasksInspector } from './ExecTasks';
-import { UpdatePlanInspector } from './UpdatePlan';
-import { UpdateTodosInspector } from './UpdateTodos';
-
-/**
- * GTD Inspector Components Registry
- *
- * Inspector components customize the title/header area
- * of tool calls in the conversation UI.
- */
-export const GTDInspectors: Record<string, BuiltinInspector> = {
- [GTDApiName.clearTodos]: ClearTodosInspector as BuiltinInspector,
- [GTDApiName.createPlan]: CreatePlanInspector as BuiltinInspector,
- [GTDApiName.createTodos]: CreateTodosInspector as BuiltinInspector,
- [GTDApiName.execTask]: ExecTaskInspector as BuiltinInspector,
- [GTDApiName.execTasks]: ExecTasksInspector as BuiltinInspector,
- [GTDApiName.updatePlan]: UpdatePlanInspector as BuiltinInspector,
- [GTDApiName.updateTodos]: UpdateTodosInspector as BuiltinInspector,
-};
diff --git a/packages/builtin-tool-gtd/src/client/Render/ExecTasks/index.tsx b/packages/builtin-tool-gtd/src/client/Render/ExecTasks/index.tsx
deleted file mode 100644
index 46088ebb2db..00000000000
--- a/packages/builtin-tool-gtd/src/client/Render/ExecTasks/index.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-'use client';
-
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Text } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-import type { ExecTasksParams, ExecTasksState } from '../../../types';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- index: css`
- flex-shrink: 0;
- font-size: 12px;
- color: ${cssVar.colorTextQuaternary};
- `,
-
- taskItem: css`
- display: flex;
- gap: 8px;
- align-items: flex-start;
-
- padding-block: 12px;
- padding-inline: 12px;
- border-block-end: 1px dashed ${cssVar.colorBorderSecondary};
-
- &:last-child {
- border-block-end: none;
- }
- `,
-}));
-
-export const ExecTasksRender = memo<BuiltinRenderProps<ExecTasksParams, ExecTasksState>>(
- ({ pluginState }) => {
- const { tasks } = pluginState || {};
-
- if (!tasks || tasks.length === 0) return null;
-
- return (
- <Block variant={'outlined'} width="100%">
- {tasks.map((task, index) => (
- <div className={styles.taskItem} key={index}>
- <div className={styles.index}>{index + 1}.</div>
- <div>
- {task.description && (
- <Text as={'h4'} fontSize={14} weight={500}>
- {task.description}
- </Text>
- )}
- {task.instruction && (
- <Text as={'p'} ellipsis={{ rows: 2 }} fontSize={12} type={'secondary'}>
- {task.instruction}
- </Text>
- )}
- </div>
- </div>
- ))}
- </Block>
- );
- },
-);
-
-ExecTasksRender.displayName = 'ExecTasksRender';
-
-export default ExecTasksRender;
diff --git a/packages/builtin-tool-gtd/src/client/Render/index.ts b/packages/builtin-tool-gtd/src/client/Render/index.ts
deleted file mode 100644
index ba32cf7dc09..00000000000
--- a/packages/builtin-tool-gtd/src/client/Render/index.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { GTDApiName } from '../../types';
-import CreatePlan from './CreatePlan';
-import ExecTaskRender from './ExecTask';
-import ExecTasksRender from './ExecTasks';
-import TodoListRender from './TodoList';
-
-/**
- * GTD Tool Render Components Registry
- *
- * All todo operations use the same TodoList render component
- * which displays the current state of the todo list.
- * Plan operations use the CreatePlan render component.
- */
-export const GTDRenders = {
- // All todo operations render the same TodoList UI
- [GTDApiName.clearTodos]: TodoListRender,
- [GTDApiName.createTodos]: TodoListRender,
- [GTDApiName.updateTodos]: TodoListRender,
-
- // Plan operations render the PlanCard UI
- [GTDApiName.createPlan]: CreatePlan,
- [GTDApiName.updatePlan]: CreatePlan,
-
- // Async task operations
- [GTDApiName.execTask]: ExecTaskRender,
- [GTDApiName.execTasks]: ExecTasksRender,
-};
-
-export { default as CreatePlan, PlanCard } from './CreatePlan';
-export { default as ExecTaskRender } from './ExecTask';
-export { default as ExecTasksRender } from './ExecTasks';
-export type { TodoListRenderState } from './TodoList';
-export { default as TodoListRender, TodoListUI } from './TodoList';
diff --git a/packages/builtin-tool-gtd/src/client/Streaming/ExecTasks/index.tsx b/packages/builtin-tool-gtd/src/client/Streaming/ExecTasks/index.tsx
deleted file mode 100644
index 7ef25e53274..00000000000
--- a/packages/builtin-tool-gtd/src/client/Streaming/ExecTasks/index.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-'use client';
-
-import type { BuiltinStreamingProps } from '@lobechat/types';
-import { Block, Markdown } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-import type { ExecTasksParams } from '../../../types';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- index: css`
- flex-shrink: 0;
- font-size: 12px;
- color: ${cssVar.colorTextQuaternary};
- `,
- instruction: css`
- font-size: 12px;
- line-height: 1.5;
- color: ${cssVar.colorTextTertiary};
- `,
- taskContent: css`
- display: flex;
- flex: 1;
- flex-direction: column;
- gap: 2px;
-
- min-width: 0;
- `,
- taskItem: css`
- display: flex;
- gap: 8px;
- align-items: flex-start;
-
- padding-block: 10px;
- padding-inline: 12px;
- border-block-end: 1px dashed ${cssVar.colorBorderSecondary};
-
- &:last-child {
- border-block-end: none;
- }
- `,
- title: css`
- font-size: 13px;
- line-height: 1.4;
- color: ${cssVar.colorText};
- `,
-}));
-
-export const ExecTasksStreaming = memo<BuiltinStreamingProps<ExecTasksParams>>(({ args }) => {
- const { tasks } = args || {};
-
- if (!tasks || tasks.length === 0) return null;
-
- return (
- <Block variant={'outlined'} width="100%">
- {tasks.map((task, index) => (
- <div className={styles.taskItem} key={index}>
- <div className={styles.index}>{index + 1}.</div>
- <div className={styles.taskContent}>
- {task.description && <div className={styles.title}>{task.description}</div>}
- {task.instruction && (
- <div className={styles.instruction}>
- <Markdown animated variant={'chat'}>
- {task.instruction}
- </Markdown>
- </div>
- )}
- </div>
- </div>
- ))}
- </Block>
- );
-});
-
-ExecTasksStreaming.displayName = 'ExecTasksStreaming';
-
-export default ExecTasksStreaming;
diff --git a/packages/builtin-tool-gtd/src/client/Streaming/index.ts b/packages/builtin-tool-gtd/src/client/Streaming/index.ts
deleted file mode 100644
index 8b549bef18b..00000000000
--- a/packages/builtin-tool-gtd/src/client/Streaming/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import type { BuiltinStreaming } from '@lobechat/types';
-
-import { GTDApiName } from '../../types';
-import { CreatePlanStreaming } from './CreatePlan';
-import { ExecTaskStreaming } from './ExecTask';
-import { ExecTasksStreaming } from './ExecTasks';
-
-/**
- * GTD Streaming Components Registry
- *
- * Streaming components render tool calls while they are
- * still executing, allowing real-time feedback to users.
- */
-export const GTDStreamings: Record<string, BuiltinStreaming> = {
- [GTDApiName.createPlan]: CreatePlanStreaming as BuiltinStreaming,
- [GTDApiName.execTask]: ExecTaskStreaming as BuiltinStreaming,
- [GTDApiName.execTasks]: ExecTasksStreaming as BuiltinStreaming,
-};
-
-
-
-export {CreatePlanStreaming} from './CreatePlan';
-export {ExecTaskStreaming} from './ExecTask';
-export {ExecTasksStreaming} from './ExecTasks';
\ No newline at end of file
diff --git a/packages/builtin-tool-gtd/src/client/index.ts b/packages/builtin-tool-gtd/src/client/index.ts
deleted file mode 100644
index 18b5fecfa8d..00000000000
--- a/packages/builtin-tool-gtd/src/client/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-// Inspector components (customized tool call headers)
-export { GTDInspectors } from './Inspector';
-
-// Render components (read-only snapshots)
-export type { TodoListRenderState } from './Render';
-export { GTDRenders, TodoListRender, TodoListUI } from './Render';
-
-// Streaming components (real-time tool execution feedback)
-export {
- CreatePlanStreaming,
- ExecTasksStreaming,
- ExecTaskStreaming,
- GTDStreamings,
-} from './Streaming';
-
-// Intervention components (interactive editing)
-export { AddTodoIntervention, ClearTodosIntervention, GTDInterventions } from './Intervention';
-
-// Reusable components
-export type { SortableTodoListProps, TodoListItem } from './components';
-export { SortableTodoList } from './components';
-
-// Re-export types and manifest for convenience
-export { GTDManifest } from '../manifest';
-export * from '../types';
diff --git a/packages/builtin-tool-gtd/src/executor/index.test.ts b/packages/builtin-tool-gtd/src/executor/index.test.ts
deleted file mode 100644
index b5c24242b32..00000000000
--- a/packages/builtin-tool-gtd/src/executor/index.test.ts
+++ /dev/null
@@ -1,421 +0,0 @@
-import type { BuiltinToolContext } from '@lobechat/types';
-import { describe, expect, it } from 'vitest';
-
-import { gtdExecutor } from './index';
-
-describe('GTDExecutor', () => {
- const createMockContext = (pluginState?: Record<string, unknown>): BuiltinToolContext => ({
- messageId: 'test-message-id',
- operationId: 'test-operation-id',
- pluginState,
- });
-
- describe('createTodos', () => {
- it('should add items to empty todo list using adds (AI input)', async () => {
- const ctx = createMockContext();
-
- const result = await gtdExecutor.createTodos({ adds: ['Buy milk', 'Call mom'] }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('Added 2 items');
- expect(result.content).toContain('Buy milk');
- expect(result.content).toContain('Call mom');
- expect(result.state?.todos.items).toHaveLength(2);
- expect(result.state?.todos.items[0].text).toBe('Buy milk');
- expect(result.state?.todos.items[0].status).toBe('todo');
- expect(result.state?.todos.items[1].text).toBe('Call mom');
- });
-
- it('should add items using items (user-edited format)', async () => {
- const ctx = createMockContext();
-
- const result = await gtdExecutor.createTodos(
- {
- items: [
- { text: 'Buy milk', status: 'todo' },
- { text: 'Call mom', status: 'completed' },
- ],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('Added 2 items');
- expect(result.state?.todos.items).toHaveLength(2);
- expect(result.state?.todos.items[0].text).toBe('Buy milk');
- expect(result.state?.todos.items[0].status).toBe('todo');
- expect(result.state?.todos.items[1].text).toBe('Call mom');
- expect(result.state?.todos.items[1].status).toBe('completed');
- });
-
- it('should append items to existing todo list', async () => {
- const ctx = createMockContext({
- todos: {
- items: [{ text: 'Existing task', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.createTodos({ adds: ['New task'] }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(2);
- expect(result.state?.todos.items[0].text).toBe('Existing task');
- expect(result.state?.todos.items[1].text).toBe('New task');
- });
-
- it('should return error when no items provided', async () => {
- const ctx = createMockContext();
-
- const result = await gtdExecutor.createTodos({ adds: [] }, ctx);
-
- expect(result.success).toBe(false);
- expect(result.content).toContain('No items provided');
- });
-
- it('should add single item with correct singular grammar', async () => {
- const ctx = createMockContext();
-
- const result = await gtdExecutor.createTodos({ adds: ['Single task'] }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('Added 1 item');
- expect(result.content).not.toContain('items');
- });
-
- it('should prioritize items over adds when both provided', async () => {
- const ctx = createMockContext();
-
- const result = await gtdExecutor.createTodos(
- {
- adds: ['AI task'],
- items: [{ text: 'User edited task', status: 'completed' }],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(1);
- expect(result.state?.todos.items[0].text).toBe('User edited task');
- expect(result.state?.todos.items[0].status).toBe('completed');
- });
- });
-
- describe('updateTodos', () => {
- it('should add new items via operations', async () => {
- const ctx = createMockContext({
- todos: {
- items: [{ text: 'Existing task', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.updateTodos(
- {
- operations: [{ type: 'add', text: 'New task' }],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(2);
- expect(result.state?.todos.items[1].text).toBe('New task');
- });
-
- it('should update item text via operations', async () => {
- const ctx = createMockContext({
- todos: {
- items: [{ text: 'Old task', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.updateTodos(
- {
- operations: [{ type: 'update', index: 0, newText: 'Updated task' }],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items[0].text).toBe('Updated task');
- });
-
- it('should complete items via operations', async () => {
- const ctx = createMockContext({
- todos: {
- items: [{ text: 'Task', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.updateTodos(
- {
- operations: [{ type: 'complete', index: 0 }],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items[0].status).toBe('completed');
- });
-
- it('should remove items via operations', async () => {
- const ctx = createMockContext({
- todos: {
- items: [
- { text: 'Task 1', status: 'todo' },
- { text: 'Task 2', status: 'todo' },
- ],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.updateTodos(
- {
- operations: [{ type: 'remove', index: 0 }],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(1);
- expect(result.state?.todos.items[0].text).toBe('Task 2');
- });
-
- it('should return error when no operations provided', async () => {
- const ctx = createMockContext();
-
- const result = await gtdExecutor.updateTodos({ operations: [] }, ctx);
-
- expect(result.success).toBe(false);
- expect(result.content).toContain('No operations provided');
- });
-
- it('should handle complete operations with out-of-range indices gracefully', async () => {
- // Test case: 5 items (indices 0-4), operations reference index 5 (out of range) and index 2 (valid)
- const ctx = createMockContext({
- createdItems: ['Task A', 'Task B', 'Task C', 'Task D', 'Task E'],
- todos: {
- items: [
- { status: 'todo', text: 'Task A' },
- { status: 'todo', text: 'Task B' },
- { status: 'todo', text: 'Task C' },
- { status: 'todo', text: 'Task D' },
- { status: 'todo', text: 'Task E' },
- ],
- updatedAt: '2025-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.updateTodos(
- {
- operations: [
- { index: 5, type: 'complete' }, // out of range
- { index: 2, type: 'complete' }, // valid
- ],
- },
- ctx,
- );
-
- expect(result.success).toBe(true);
- // Should have all 5 items preserved
- expect(result.state?.todos.items).toHaveLength(5);
- // Index 5 is out of range (0-4), so should be skipped
- // Index 2 should be completed
- expect(result.state?.todos.items[2].status).toBe('completed');
- // Other items should remain uncompleted
- expect(result.state?.todos.items[0].status).toBe('todo');
- expect(result.state?.todos.items[1].status).toBe('todo');
- expect(result.state?.todos.items[3].status).toBe('todo');
- expect(result.state?.todos.items[4].status).toBe('todo');
- });
- });
-
- describe('clearTodos', () => {
- it('should clear all items when mode is "all"', async () => {
- const ctx = createMockContext({
- todos: {
- items: [
- { text: 'Task 1', status: 'todo' },
- { text: 'Task 2', status: 'completed' },
- ],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.clearTodos({ mode: 'all' }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('Cleared all 2 items');
- expect(result.state?.todos.items).toHaveLength(0);
- });
-
- it('should clear only completed items when mode is "completed"', async () => {
- const ctx = createMockContext({
- todos: {
- items: [
- { text: 'Task 1', status: 'todo' },
- { text: 'Task 2', status: 'completed' },
- { text: 'Task 3', status: 'completed' },
- ],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.clearTodos({ mode: 'completed' }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('Cleared 2 completed items');
- // New format shows "1 pending" instead of "1 item remaining"
- expect(result.content).toContain('1 pending');
- expect(result.state?.todos.items).toHaveLength(1);
- expect(result.state?.todos.items[0].text).toBe('Task 1');
- });
-
- it('should handle empty todo list', async () => {
- const ctx = createMockContext({
- todos: { items: [], updatedAt: '2024-01-01T00:00:00.000Z' },
- });
-
- const result = await gtdExecutor.clearTodos({ mode: 'all' }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('already empty');
- });
-
- it('should handle no completed items to clear', async () => {
- const ctx = createMockContext({
- todos: {
- items: [{ text: 'Task 1', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- });
-
- const result = await gtdExecutor.clearTodos({ mode: 'completed' }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.content).toContain('No completed items to clear');
- expect(result.state?.todos.items).toHaveLength(1);
- });
- });
-
- describe('stepContext priority', () => {
- it('should prioritize stepContext.todos over pluginState.todos', async () => {
- // Create context with both stepContext and pluginState
- const ctx: BuiltinToolContext = {
- messageId: 'test-message-id',
- operationId: 'test-operation-id',
- pluginState: {
- todos: {
- items: [{ text: 'Old task from pluginState', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- },
- stepContext: {
- todos: {
- items: [{ text: 'New task from stepContext', status: 'completed' }],
- updatedAt: '2024-06-01T00:00:00.000Z',
- },
- },
- };
-
- // createTodos should use stepContext.todos as base
- const result = await gtdExecutor.createTodos({ adds: ['Another task'] }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(2);
- // First item should be from stepContext, not pluginState
- expect(result.state?.todos.items[0].text).toBe('New task from stepContext');
- expect(result.state?.todos.items[0].status).toBe('completed');
- expect(result.state?.todos.items[1].text).toBe('Another task');
- });
-
- it('should fallback to pluginState.todos when stepContext.todos is undefined', async () => {
- const ctx: BuiltinToolContext = {
- messageId: 'test-message-id',
- operationId: 'test-operation-id',
- pluginState: {
- todos: {
- items: [{ text: 'Task from pluginState', status: 'todo' }],
- updatedAt: '2024-01-01T00:00:00.000Z',
- },
- },
- stepContext: {
- // No todos in stepContext
- },
- };
-
- const result = await gtdExecutor.createTodos({ adds: ['New task'] }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(2);
- expect(result.state?.todos.items[0].text).toBe('Task from pluginState');
- expect(result.state?.todos.items[1].text).toBe('New task');
- });
-
- it('should start with empty todos when both stepContext and pluginState are empty', async () => {
- const ctx: BuiltinToolContext = {
- messageId: 'test-message-id',
- operationId: 'test-operation-id',
- stepContext: {},
- };
-
- const result = await gtdExecutor.createTodos({ adds: ['First task'] }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(1);
- expect(result.state?.todos.items[0].text).toBe('First task');
- });
-
- it('should work with stepContext.todos for clearTodos', async () => {
- const ctx: BuiltinToolContext = {
- messageId: 'test-message-id',
- operationId: 'test-operation-id',
- stepContext: {
- todos: {
- items: [
- { text: 'Task 1', status: 'completed' },
- { text: 'Task 2', status: 'todo' },
- ],
- updatedAt: '2024-06-01T00:00:00.000Z',
- },
- },
- };
-
- const result = await gtdExecutor.clearTodos({ mode: 'completed' }, ctx);
-
- expect(result.success).toBe(true);
- expect(result.state?.todos.items).toHaveLength(1);
- expect(result.state?.todos.items[0].text).toBe('Task 2');
- });
- });
-
- describe('executor metadata', () => {
- it('should have correct identifier', () => {
- expect(gtdExecutor.identifier).toBe('lobe-gtd');
- });
-
- it('should support all APIs', () => {
- expect(gtdExecutor.hasApi('createTodos')).toBe(true);
- expect(gtdExecutor.hasApi('updateTodos')).toBe(true);
- expect(gtdExecutor.hasApi('clearTodos')).toBe(true);
- expect(gtdExecutor.hasApi('createPlan')).toBe(true);
- expect(gtdExecutor.hasApi('updatePlan')).toBe(true);
- expect(gtdExecutor.hasApi('execTask')).toBe(true);
- expect(gtdExecutor.hasApi('execTasks')).toBe(true);
- });
-
- it('should return correct API names', () => {
- const apiNames = gtdExecutor.getApiNames();
- expect(apiNames).toContain('createTodos');
- expect(apiNames).toContain('updateTodos');
- expect(apiNames).toContain('clearTodos');
- expect(apiNames).toContain('createPlan');
- expect(apiNames).toContain('updatePlan');
- expect(apiNames).toContain('execTask');
- expect(apiNames).toContain('execTasks');
- expect(apiNames).toHaveLength(7);
- });
- });
-});
diff --git a/packages/builtin-tool-gtd/src/executor/index.ts b/packages/builtin-tool-gtd/src/executor/index.ts
deleted file mode 100644
index 858511f78a8..00000000000
--- a/packages/builtin-tool-gtd/src/executor/index.ts
+++ /dev/null
@@ -1,136 +0,0 @@
-import type { BuiltinToolContext, BuiltinToolResult } from '@lobechat/types';
-import { BaseExecutor } from '@lobechat/types';
-
-import { notebookService } from '@/services/notebook';
-import { useNotebookStore } from '@/store/notebook';
-
-import {
- GTDExecutionRuntime,
- type GTDRuntimeContext,
- type GTDRuntimeService,
- type PlanDocument,
-} from '../ExecutionRuntime';
-import { GTDIdentifier } from '../manifest';
-import type {
- ClearTodosParams,
- CreatePlanParams,
- CreateTodosParams,
- ExecTaskParams,
- ExecTasksParams,
- UpdatePlanParams,
- UpdateTodosParams,
-} from '../types';
-import { GTDApiName } from '../types';
-import { getTodosFromContext } from './helper';
-
-const PLAN_DOC_TYPE = 'agent/plan';
-
-/**
- * Normalize a document payload returned by notebookService / useNotebookStore
- * into the `PlanDocument` shape expected by GTDExecutionRuntime.
- */
-const normalizePlanDoc = (doc: {
- content?: string | null;
- createdAt: Date | string;
- description?: string | null;
- id: string;
- metadata?: Record<string, any> | null;
- title?: string | null;
- updatedAt: Date | string;
-}): PlanDocument => ({
- content: doc.content ?? null,
- createdAt: typeof doc.createdAt === 'string' ? new Date(doc.createdAt) : doc.createdAt,
- description: doc.description ?? null,
- id: doc.id,
- metadata: doc.metadata ?? null,
- title: doc.title ?? null,
- updatedAt: typeof doc.updatedAt === 'string' ? new Date(doc.updatedAt) : doc.updatedAt,
-});
-
-/**
- * Client-side implementation of the GTD runtime service.
- * Routes user-facing plan CRUD through useNotebookStore (so SWR caches refresh),
- * and keeps silent metadata writes (todos sync) on the raw notebookService.
- */
-const clientGTDService: GTDRuntimeService = {
- createPlan: async ({ topicId, goal, description, content }) => {
- const doc = await useNotebookStore.getState().createDocument({
- content,
- description,
- title: goal,
- topicId,
- type: PLAN_DOC_TYPE,
- });
- return normalizePlanDoc(doc);
- },
-
- findPlanById: async (id) => {
- const doc = await notebookService.getDocument(id);
- return doc ? normalizePlanDoc(doc) : null;
- },
-
- findPlanByTopic: async (topicId) => {
- const result = await notebookService.listDocuments({ topicId, type: PLAN_DOC_TYPE });
- const first = result.data[0];
- return first ? normalizePlanDoc(first) : null;
- },
-
- updatePlan: async (id, { goal, description, content }, topicId) => {
- const doc = await useNotebookStore
- .getState()
- .updateDocument({ content, description, id, title: goal }, topicId ?? '');
- if (!doc) throw new Error(`Plan not found after update: ${id}`);
- return normalizePlanDoc(doc);
- },
-
- updatePlanMetadata: async (id, metadata) => {
- await notebookService.updateDocument({ id, metadata });
- },
-};
-
-const GTDApiNameEnum = {
- clearTodos: GTDApiName.clearTodos,
- createPlan: GTDApiName.createPlan,
- createTodos: GTDApiName.createTodos,
- execTask: GTDApiName.execTask,
- execTasks: GTDApiName.execTasks,
- updatePlan: GTDApiName.updatePlan,
- updateTodos: GTDApiName.updateTodos,
-} as const;
-
-const toRuntimeContext = (ctx: BuiltinToolContext): GTDRuntimeContext => ({
- currentTodos: getTodosFromContext(ctx),
- messageId: ctx.messageId,
- signal: ctx.signal,
- topicId: ctx.topicId ?? undefined,
-});
-
-class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
- readonly identifier = GTDIdentifier;
- protected readonly apiEnum = GTDApiNameEnum;
-
- private runtime = new GTDExecutionRuntime(clientGTDService);
-
- createTodos = (params: CreateTodosParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.createTodos(params, toRuntimeContext(ctx));
-
- updateTodos = (params: UpdateTodosParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.updateTodos(params, toRuntimeContext(ctx));
-
- clearTodos = (params: ClearTodosParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.clearTodos(params, toRuntimeContext(ctx));
-
- createPlan = (params: CreatePlanParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.createPlan(params, toRuntimeContext(ctx));
-
- updatePlan = (params: UpdatePlanParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.updatePlan(params, toRuntimeContext(ctx));
-
- execTask = (params: ExecTaskParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.execTask(params, toRuntimeContext(ctx));
-
- execTasks = (params: ExecTasksParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
- this.runtime.execTasks(params, toRuntimeContext(ctx));
-}
-
-export const gtdExecutor = new GTDExecutor();
diff --git a/packages/builtin-tool-gtd/src/index.ts b/packages/builtin-tool-gtd/src/index.ts
deleted file mode 100644
index 95ce02e077d..00000000000
--- a/packages/builtin-tool-gtd/src/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './manifest';
-export * from './systemRole';
-export * from './types';
diff --git a/packages/builtin-tool-gtd/src/manifest.ts b/packages/builtin-tool-gtd/src/manifest.ts
deleted file mode 100644
index 3ace391ee51..00000000000
--- a/packages/builtin-tool-gtd/src/manifest.ts
+++ /dev/null
@@ -1,247 +0,0 @@
-import type { BuiltinToolManifest } from '@lobechat/types';
-
-import { isDesktop } from './const';
-import { systemPrompt } from './systemRole';
-import { GTDApiName } from './types';
-
-export const GTDIdentifier = 'lobe-gtd';
-
-export const GTDManifest: BuiltinToolManifest = {
- api: [
- // ==================== Planning ====================
- {
- description:
- 'Create a high-level plan document. Plans define the strategic direction (the "what" and "why"), while todos handle the actionable steps.',
- name: GTDApiName.createPlan,
- humanIntervention: 'required',
- renderDisplayControl: 'expand',
- parameters: {
- properties: {
- goal: {
- description: 'The main goal or objective to achieve (used as document title).',
- type: 'string',
- },
- description: {
- description: 'A brief summary of the plan (1-2 sentences).',
- type: 'string',
- },
- context: {
- description:
- 'Detailed context, constraints, background information, or strategic considerations relevant to the goal.',
- type: 'string',
- },
- },
- required: ['goal', 'description', 'context'],
- type: 'object',
- },
- },
- {
- description:
- 'Update an existing plan document. Only use this when the goal fundamentally changes. Plans should remain stable once created - do not update plans just because details change.',
- name: GTDApiName.updatePlan,
- parameters: {
- properties: {
- planId: {
- description:
- 'The document ID of the plan to update (e.g., "docs_xxx"). This ID is returned in the createPlan response. Do NOT use the goal text as planId.',
- type: 'string',
- },
- goal: {
- description: 'Updated goal (document title).',
- type: 'string',
- },
- description: {
- description: 'Updated brief summary.',
- type: 'string',
- },
- context: {
- description: 'Updated detailed context.',
- type: 'string',
- },
- },
- required: ['planId'],
- type: 'object',
- },
- },
-
- // ==================== Quick Todo ====================
- {
- description: 'Create new todo items. Pass an array of text strings.',
- name: GTDApiName.createTodos,
- humanIntervention: 'required',
- parameters: {
- properties: {
- adds: {
- description: 'Array of todo item texts to create.',
- items: { type: 'string' },
- type: 'array',
- },
- },
- required: ['adds'],
- type: 'object',
- },
- },
- {
- description: `Update todo items with batch operations. Each operation type requires specific fields:
-- "add": requires "text" (the todo text to add)
-- "update": requires "index", optional "newText" and/or "status"
-- "remove": requires "index" only
-- "complete": requires "index" only (marks item as completed)
-- "processing": requires "index" only (marks item as in progress)`,
- name: GTDApiName.updateTodos,
- renderDisplayControl: 'expand',
- parameters: {
- properties: {
- operations: {
- description:
- 'Array of update operations. IMPORTANT: For "complete", "processing" and "remove" operations, only pass "type" and "index" - no other fields needed.',
- items: {
- properties: {
- type: {
- description:
- 'Operation type. "add" needs text, "update" needs index + optional newText/status, "remove", "complete" and "processing" need index only.',
- enum: ['add', 'update', 'remove', 'complete', 'processing'],
- type: 'string',
- },
- text: {
- description: 'Required for "add" only: the text to add.',
- type: 'string',
- },
- index: {
- description:
- 'Required for "update", "remove", "complete", "processing": the item index (0-based).',
- type: 'number',
- },
- newText: {
- description: 'Optional for "update" only: the new text.',
- type: 'string',
- },
- status: {
- description:
- 'Optional for "update" only: set status (todo, processing, completed).',
- enum: ['todo', 'processing', 'completed'],
- type: 'string',
- },
- },
- required: ['type'],
- type: 'object',
- },
- type: 'array',
- },
- },
- required: ['operations'],
- type: 'object',
- },
- },
- {
- description: 'Clear todo items. Can clear only completed items or all items.',
- name: GTDApiName.clearTodos,
- humanIntervention: 'always',
- renderDisplayControl: 'expand',
- parameters: {
- properties: {
- mode: {
- description: '"completed" clears only done items, "all" clears the entire list.',
- enum: ['completed', 'all'],
- type: 'string',
- },
- },
- required: ['mode'],
- type: 'object',
- },
- },
-
- // ==================== Async Tasks ====================
- {
- description:
- 'Execute a single long-running async task. The task runs in an isolated context and can take significant time to complete. Use this for a single complex operation that requires extended processing.',
- name: GTDApiName.execTask,
- parameters: {
- properties: {
- description: {
- description: 'Brief description of what this task does (shown in UI).',
- type: 'string',
- },
- instruction: {
- description: 'Detailed instruction/prompt for the task execution.',
- type: 'string',
- },
- inheritMessages: {
- description:
- 'Whether to inherit context messages from the parent conversation. Default is false.',
- type: 'boolean',
- },
- ...(isDesktop && {
- runInClient: {
- description:
- 'Whether to run on the desktop client (for local file/shell access). MUST be true when task requires local-system tools. Default is false (server execution).',
- type: 'boolean',
- },
- }),
- timeout: {
- description: 'Optional timeout in milliseconds. Default is 30 minutes.',
- type: 'number',
- },
- },
- required: ['description', 'instruction'],
- type: 'object',
- },
- },
- {
- description:
- 'Execute one or more long-running async tasks. Each task runs in an isolated context and can take significant time to complete. Use this for complex operations that require extended processing.',
- name: GTDApiName.execTasks,
- parameters: {
- properties: {
- tasks: {
- description: 'Array of tasks to execute asynchronously.',
- items: {
- properties: {
- description: {
- description: 'Brief description of what this task does (shown in UI).',
- type: 'string',
- },
- instruction: {
- description: 'Detailed instruction/prompt for the task execution.',
- type: 'string',
- },
- inheritMessages: {
- description:
- 'Whether to inherit context messages from the parent conversation. Default is false.',
- type: 'boolean',
- },
- ...(isDesktop && {
- runInClient: {
- description:
- 'Whether to run on the desktop client (for local file/shell access). MUST be true when task requires local-system tools. Default is false (server execution).',
- type: 'boolean',
- },
- }),
- timeout: {
- description: 'Optional timeout in milliseconds. Default is 30 minutes.',
- type: 'number',
- },
- },
- required: ['description', 'instruction'],
- type: 'object',
- },
- type: 'array',
- },
- },
- required: ['tasks'],
- type: 'object',
- },
- },
- ],
- identifier: GTDIdentifier,
- meta: {
- avatar: '✅',
- description:
- 'Plan and track one-time goals, manage todo checklists, and run background tasks. For tasks that need to be done once or tracked manually — NOT for tasks that should repeat automatically on a schedule (use lobe-cron for daily/weekly/recurring automation).',
- title: 'GTD Tools',
- },
- systemRole: systemPrompt,
- type: 'builtin',
-};
-
-export { GTDApiName } from './types';
diff --git a/packages/builtin-tool-gtd/src/systemRole.ts b/packages/builtin-tool-gtd/src/systemRole.ts
deleted file mode 100644
index 209991af11f..00000000000
--- a/packages/builtin-tool-gtd/src/systemRole.ts
+++ /dev/null
@@ -1,216 +0,0 @@
-import { isDesktop } from './const';
-
-const runInClientSection = `
-<run_in_client>
-**IMPORTANT: When to use \`runInClient: true\` for async tasks**
-
-The \`runInClient\` parameter controls WHERE the async task executes:
-- \`runInClient: false\` (default): Task runs on the **server** - suitable for web searches, API calls, general research
-- \`runInClient: true\`: Task runs on the **desktop client** - required for local system access
-
-**MUST set \`runInClient: true\` when the task involves:**
-- Reading or writing local files (via \`local-system\` tool)
-- Executing shell commands on the user's machine
-- Accessing local directories or file system
-- Any operation that requires desktop-only local tools
-
-**Keep \`runInClient: false\` (or omit) when:**
-- Task only needs web searches or API calls
-- Task processes data that doesn't require local file access
-- Task can be fully completed with server-side capabilities
-
-**Note:** \`runInClient\` only has effect on the **desktop app**. On web platform, tasks always run on the server regardless of this setting.
-
-**Examples:**
-- "Research Python best practices" → \`runInClient: false\` (web search only)
-- "Organize files in my Downloads folder" → \`runInClient: true\` (local file access required)
-- "Read the project README and summarize it" → \`runInClient: true\` (local file read required)
-- "Find trending tech news" → \`runInClient: false\` (web search only)
-- "Create a new directory structure for my project" → \`runInClient: true\` (local shell/file required)
-</run_in_client>
-`;
-
-export const systemPrompt = `You have GTD (Getting Things Done) tools to help manage plans, todos and tasks effectively. These tools support three levels of task management:
-
-- **Plan**: A high-level strategic document describing goals, context, and overall direction. Plans do NOT contain actionable steps - they define the "what" and "why". **Plans should be stable once created** - they represent the overarching objective that rarely changes.
-- **Todo**: The concrete execution list with actionable items. Todos define the "how" - specific tasks to accomplish the plan. **Todos are dynamic** - they can be added, updated, completed, and removed as work progresses.
-- **Task**: Long-running async operations that execute in isolated contexts. Tasks are for complex, multi-step operations that require extended processing time. **Tasks run independently** - they can inherit context but execute separately from the main conversation.
-
-<tool_overview>
-**Planning Tools** - For high-level goal documentation:
-- \`createPlan\`: Create a strategic plan document. **Required params: goal, description (brief summary), context** - all three must be provided
-- \`updatePlan\`: Update plan details (only planId is required)
-
-**Todo Tools** - For actionable execution items:
-- \`createTodos\`: Create new todo items from text array
-- \`updateTodos\`: Batch update todos (add, update, remove, complete, processing operations)
-- \`clearTodos\`: Clear completed or all items
-
-**Todo Status Workflow:** todo → processing → completed (use "processing" when actively working on an item)
-
-**Async Task Tools** - For long-running background tasks:
-- \`execTask\`: Execute a single async task. **Required params: description (brief UI label), instruction (detailed prompt)** - both must be provided
-- \`execTasks\`: Execute multiple async tasks in parallel. Each task requires **description** and **instruction**
-</tool_overview>
-
-<default_workflow>
-**CRITICAL: Most tasks do NOT need GTD tools. Only use them for complex, multi-step projects.**
-
-**DO NOT use GTD tools for:**
-- Simple one-step tasks (rename a file, send a message, search something)
-- Quick questions or lookups
-- Tasks that can be completed immediately with a single action
-- Any request that doesn't require tracking progress over time
-
-**ONLY use GTD tools when ALL of these are true:**
-1. The task has multiple distinct steps that need tracking
-2. The user explicitly wants to plan or organize something
-3. Progress needs to be tracked over time (not completed in one response)
-
-**When GTD tools ARE appropriate:**
-1. **First**, use \`createPlan\` to document the goal and relevant context
-2. **Then**, use \`createTodos\` to break down the plan into actionable steps
-
-**Examples:**
-- ❌ "Rename this file" → Just do it, no GTD needed
-- ❌ "What's the weather?" → Just answer, no GTD needed
-- ❌ "Help me write an email" → Just write it, no GTD needed
-- ✅ "Help me plan a trip to Japan" → Use createPlan + createTodos
-- ✅ "I want to learn Python, create a study plan" → Use createPlan + createTodos
-- ✅ "Help me organize my project tasks" → Use createTodos (user explicitly wants organization)
-</default_workflow>
-
-<when_to_use>
-**Use Plans when:**
-- User explicitly asks to "plan", "organize", or "break down" a complex goal
-- The project spans multiple sessions or days
-- There's significant context, constraints, or background worth documenting
-- The task has 5+ distinct steps that benefit from strategic organization
-
-**Use Todos when:**
-- Breaking down a plan into actionable steps (after creating a plan)
-- User explicitly requests a checklist or task list
-- Tracking progress on a multi-step project
-
-**DO NOT use Plans/Todos when:**
-- The task can be done in one action (rename, delete, send, search, etc.)
-- The user just wants something done, not organized
-- The task will be completed in this single conversation
-- The user wants a task to repeat automatically on a schedule (daily/weekly/hourly) — use **lobe-cron** instead. Keywords like "daily task", "routine", "recurring", "every day/morning/week", "set as daily", "make it regular" all indicate scheduled automation, not GTD todo management.
-
-**Use Async Tasks when:**
-- **The request requires gathering external information**: User wants you to research, investigate, or find information that you don't already know. This requires web searches, reading multiple sources, and synthesizing information.
-- **The task involves multiple steps**: The request cannot be answered in one simple response - it requires searching, reading, analyzing, and summarizing.
-- **Quality depends on thorough investigation**: A superficial answer would be insufficient; the user expects comprehensive, well-researched results.
-- **Independent execution is beneficial**: The task can run separately while freeing up the main conversation.
-
-**How to identify async task scenarios:**
-Ask yourself: "Can I answer this well from my existing knowledge, or does this require actively gathering new information?"
-- If you need to search the web, read articles, or investigate → Use async task
-- If you can answer directly from knowledge → Just respond
-
-Use \`execTask\` for a single task, \`execTasks\` for multiple parallel tasks.
-
-**Example scenarios:**
-- User asks about best restaurants in a city → execTask (needs current info from reviews, searches)
-- User wants research on a topic → execTask (multi-step: search, read, analyze, summarize)
-- User asks to compare products/services → execTask (needs to gather data from multiple sources)
-- User asks a factual question you know → Just answer directly
-- User wants multiple independent analyses → execTasks (parallel execution)
-</when_to_use>
-${isDesktop ? runInClientSection : ''}
-<best_practices>
-- **Plan first, then todos**: Always start with a plan unless explicitly told otherwise
-- **Separate concerns**: Plans describe goals; Todos list actions
-- **Actionable todos**: Each todo should be a concrete, completable task
-- **Context in plans**: Use plan's context field to capture constraints and background
-- **Regular cleanup**: Clear completed todos to keep the list focused
-- **Track progress**: Use todo completion to measure plan progress
-</best_practices>
-
-<updateTodos_usage>
-When using \`updateTodos\`, each operation type requires specific fields:
-
-**Todo Status:**
-- \`todo\`: Not started yet
-- \`processing\`: Currently in progress
-- \`completed\`: Done
-
-**Minimal required fields per operation type:**
-- \`{ "type": "add", "text": "todo text" }\` - only type + text
-- \`{ "type": "complete", "index": 0 }\` - only type + index (marks as completed)
-- \`{ "type": "processing", "index": 0 }\` - only type + index (marks as in progress)
-- \`{ "type": "remove", "index": 0 }\` - only type + index
-- \`{ "type": "update", "index": 0, "newText": "..." }\` - type + index + optional newText/status
-
-**Example - mark item 0 as processing, item 1 as complete:**
-\`\`\`json
-{
- "operations": [
- { "type": "processing", "index": 0 },
- { "type": "complete", "index": 1 }
- ]
-}
-\`\`\`
-
-**DO NOT** add extra fields like \`"status": "completed"\` for complete/processing operations - they are ignored.
-</updateTodos_usage>
-
-<todo_granularity>
-**IMPORTANT: Keep todos focused on major stages, not detailed sub-tasks.**
-
-- **Limit to 5-10 items**: A todo list should contain around 5-10 major milestones or stages, not 20+ detailed tasks.
-- **Think in phases**: Group related tasks into higher-level stages (e.g., "Plan itinerary" instead of listing every city separately).
-- **Use hierarchical numbering** when more detail is needed: Use "1.", "2.", "2.1", "2.2", "3." format to show parent-child relationships.
-
-**Good example** (Japan trip - 7 items, stage-focused):
-- 1. Determine travel dates and duration
-- 2. Handle visa and documentation
-- 3. Book flights and accommodation
-- 4. Plan city itineraries
-- 5. Arrange local transportation
-- 6. Prepare for departure
-- 7. Final confirmation before trip
-
-**Bad example** (20+ detailed items):
-- Book Tokyo hotel
-- Book Kyoto hotel
-- Book Osaka hotel
-- Buy Suica card
-- Download Google Maps
-- Download translation app
-- ... (too granular!)
-
-**When user needs more detail**, use hierarchical numbering:
-- 1. Determine travel dates
-- 2. Plan itinerary
-- 2.1 Tokyo attractions (3 days)
-- 2.2 Kyoto attractions (2 days)
-- 2.3 Osaka attractions (2 days)
-- 3. Handle bookings
-- 3.1 Flights
-- 3.2 Hotels
-- 3.3 JR Pass
-- 4. Departure preparation
-</todo_granularity>
-
-<plan_stability>
-**IMPORTANT: Plans should remain stable once created. Each conversation has only ONE plan.**
-
-- **Do NOT update plans** when details change (dates, locations, preferences). Instead, update the todos to reflect new information.
-- **Only use updatePlan** when the user's goal fundamentally changes (e.g., destination changes from Japan to Korea).
-- When user provides more specific information (like exact dates or preferences), **update or add todos** - not the plan.
-
-Example:
-- User: "Plan a trip to Japan" → Create plan with goal "Japan Trip"
-- User: "I want to go in February" → Update todos to include February-specific tasks, NOT update the plan
-- User: "Actually I want to go to Korea instead" → Use updatePlan to change the goal to "Korea Trip" (fundamental goal change)
-</plan_stability>
-
-<response_format>
-When working with GTD tools:
-- Confirm actions: "Created plan: [goal]" or "Added [n] todo items"
-- Show progress: "Completed [n] items, [m] remaining"
-- Be concise: Brief confirmations, not verbose explanations
-- **NEVER repeat the todo list in your response** - Users can already see the todos in the UI component. Do not list or enumerate the todo items in your text output.
-</response_format>`;
diff --git a/packages/builtin-tool-gtd/src/types.ts b/packages/builtin-tool-gtd/src/types.ts
deleted file mode 100644
index 34a14c06dd7..00000000000
--- a/packages/builtin-tool-gtd/src/types.ts
+++ /dev/null
@@ -1,333 +0,0 @@
-/**
- * API names for GTD (Getting Things Done) tool
- *
- * GTD Tools help users and agents manage tasks effectively.
- * These tools can be used by:
- * - LobeAI default assistant for user task management
- * - Group Supervisor for multi-agent task orchestration
- *
- * MVP version focuses on Plan and Todo functionality.
- * Task management will be added in future iterations.
- */
-export const GTDApiName = {
- // ==================== Quick Todo ====================
- /** Clear completed or all todos */
- clearTodos: 'clearTodos',
-
- // ==================== Planning ====================
- /** Create a structured plan by breaking down a goal into actionable steps */
- createPlan: 'createPlan',
-
- /** Create new todo items */
- createTodos: 'createTodos',
-
- // ==================== Async Tasks ====================
- /** Execute a single async task */
- execTask: 'execTask',
-
- /** Execute one or more async tasks */
- execTasks: 'execTasks',
-
- /** Update an existing plan */
- updatePlan: 'updatePlan',
-
- /** Update todo items with batch operations (add, update, remove, complete, processing) */
- updateTodos: 'updateTodos',
-} as const;
-
-export type GTDApiNameType = (typeof GTDApiName)[keyof typeof GTDApiName];
-
-// ==================== Todo Item ====================
-
-/** Status of a todo item */
-export type TodoStatus = 'todo' | 'processing' | 'completed';
-
-export interface TodoItem {
- /** Status of the todo item */
- status: TodoStatus;
- /** The todo item text */
- text: string;
-}
-
-/** Get the next status in the cycle: todo → processing → completed → todo */
-export const getNextTodoStatus = (current: TodoStatus): TodoStatus => {
- const cycle: TodoStatus[] = ['todo', 'processing', 'completed'];
- const index = cycle.indexOf(current);
- return cycle[(index + 1) % cycle.length];
-};
-
-export interface TodoList {
- items: TodoItem[];
- updatedAt: string;
-}
-
-/** Alias for TodoList, used for state storage in Plan metadata */
-export type TodoState = TodoList;
-
-// ==================== Todo Params ====================
-
-/**
- * Create new todo items
- * - AI input: { adds: string[] } - array of text strings from AI
- * - After user edit: { items: TodoItem[] } - saved format with TodoItem objects
- */
-export interface CreateTodosParams {
- /** Array of text strings from AI */
- adds?: string[];
- /** Array of TodoItem objects (saved format after user edit) */
- items?: TodoItem[];
-}
-
-/**
- * Update operation types for batch updates
- */
-export type TodoUpdateOperationType = 'add' | 'update' | 'remove' | 'complete' | 'processing';
-
-/**
- * Single update operation
- */
-export interface TodoUpdateOperation {
- /** For 'update', 'remove', 'complete', 'processing': the index of the item (0-based) */
- index?: number;
- /** For 'update': the new text */
- newText?: string;
- /** For 'update': the new status */
- status?: TodoStatus;
- /** For 'add': the text to add */
- text?: string;
- /** Operation type */
- type: TodoUpdateOperationType;
-}
-
-/**
- * Update todo list with batch operations
- * Supports: add, update, remove, complete, processing
- */
-export interface UpdateTodosParams {
- /** Array of update operations to apply */
- operations: TodoUpdateOperation[];
-}
-
-/**
- * Clear todo items
- */
-export interface ClearTodosParams {
- /** Clear mode: 'completed' only clears done items, 'all' clears everything */
- mode: 'completed' | 'all';
-}
-
-// ==================== Todo State Types for Render ====================
-
-export interface CreateTodosState {
- /** Items that were created */
- createdItems: string[];
- /** Current todo list after creation */
- todos: TodoList;
-}
-
-export interface UpdateTodosState {
- /** Operations that were applied */
- appliedOperations: TodoUpdateOperation[];
- /** Current todo list after update */
- todos: TodoList;
-}
-
-export interface CompleteTodosState {
- /** Indices that were completed */
- completedIndices: number[];
- /** Current todo list after completion */
- todos: TodoList;
-}
-
-export interface RemoveTodosState {
- /** Indices that were removed */
- removedIndices: number[];
- /** Current todo list after removal */
- todos: TodoList;
-}
-
-export interface ClearTodosState {
- /** Number of items cleared */
- clearedCount: number;
- /** Mode used for clearing */
- mode: 'completed' | 'all';
- /** Current todo list after clearing */
- todos: TodoList;
-}
-
-// ==================== Planning Params ====================
-
-/**
- * Create a high-level plan document
- * Plans define the strategic direction (what and why), not actionable steps
- *
- * Field mapping to Document:
- * - goal -> document.title
- * - description -> document.description
- * - context -> document.content
- */
-export interface CreatePlanParams {
- /** Detailed context, background, constraints (maps to document.content) */
- context?: string;
- /** Brief summary of the plan (maps to document.description) */
- description: string;
- /** The main goal or objective to achieve (maps to document.title) */
- goal: string;
-}
-
-export interface UpdatePlanParams {
- /** Mark plan as completed */
- completed?: boolean;
- /** Updated context (maps to document.content) */
- context?: string;
- /** Updated description (maps to document.description) */
- description?: string;
- /** Updated goal (maps to document.title) */
- goal?: string;
- /** Plan ID to update */
- planId: string;
-}
-
-// ==================== Plan Result Types ====================
-
-/**
- * A high-level plan document
- * Contains goal and context, but no steps (steps are managed via Todos)
- *
- * Field mapping to Document:
- * - goal -> document.title
- * - description -> document.description
- * - context -> document.content
- */
-export interface Plan {
- /** Whether the plan is completed */
- completed: boolean;
- /** Detailed context, background, constraints (maps to document.content) */
- context?: string;
- /** Creation timestamp */
- createdAt: string;
- /** Brief summary of the plan (maps to document.description) */
- description: string;
- /** The main goal or objective (maps to document.title) */
- goal: string;
- /** Unique plan identifier */
- id: string;
- /** Last update timestamp */
- updatedAt: string;
-}
-
-// ==================== Plan State Types for Render ====================
-
-export interface CreatePlanState {
- /** The created plan document */
- plan: Plan;
-}
-
-export interface UpdatePlanState {
- /** The updated plan document */
- plan: Plan;
-}
-
-// ==================== Async Tasks Types ====================
-
-/**
- * Single task item for execution
- */
-export interface ExecTaskItem {
- /** Brief description of what this task does (shown in UI) */
- description: string;
- /** Whether to inherit context messages from parent conversation */
- inheritMessages?: boolean;
- /** Detailed instruction/prompt for the task execution */
- instruction: string;
- /**
- * Whether to execute the task on the client side (desktop only).
- * When true and running on desktop, the task will be executed locally
- * with access to local tools (file system, shell commands, etc.).
- *
- * MUST be true when task requires local-system tools.
- */
- runInClient?: boolean;
- /** Timeout in milliseconds (optional, default 30 minutes) */
- timeout?: number;
-}
-
-/**
- * Parameters for execTask API
- * Execute a single async task
- */
-export interface ExecTaskParams {
- /** Brief description of what this task does (shown in UI) */
- description: string;
- /** Whether to inherit context messages from parent conversation */
- inheritMessages?: boolean;
- /** Detailed instruction/prompt for the task execution */
- instruction: string;
- /**
- * Whether to execute the task on the client side (desktop only).
- * When true and running on desktop, the task will be executed locally
- * with access to local tools (file system, shell commands, etc.).
- *
- * MUST be true when task requires local-system tools.
- */
- runInClient?: boolean;
- /** Timeout in milliseconds (optional, default 30 minutes) */
- timeout?: number;
-}
-
-/**
- * Parameters for execTasks API
- * Execute one or more async tasks
- */
-export interface ExecTasksParams {
- /** Array of tasks to execute */
- tasks: ExecTaskItem[];
-}
-
-/**
- * State returned after triggering exec_task (server-side)
- */
-export interface ExecTaskState {
- /** Parent message ID (tool message) */
- parentMessageId: string;
- /** The task definition that was triggered */
- task: ExecTaskItem;
- /** Type identifier for render component */
- type: 'execTask';
-}
-
-/**
- * State returned after triggering exec_tasks (server-side)
- */
-export interface ExecTasksState {
- /** Parent message ID (tool message) */
- parentMessageId: string;
- /** Array of task definitions that were triggered */
- tasks: ExecTaskItem[];
- /** Type identifier for render component */
- type: 'execTasks';
-}
-
-/**
- * State returned after triggering exec_client_task (client-side, desktop only)
- */
-export interface ExecClientTaskState {
- /** Parent message ID (tool message) */
- parentMessageId: string;
- /** The task definition that was triggered */
- task: ExecTaskItem;
- /** Type identifier for render component */
- type: 'execClientTask';
-}
-
-/**
- * State returned after triggering exec_client_tasks (client-side, desktop only)
- */
-export interface ExecClientTasksState {
- /** Parent message ID (tool message) */
- parentMessageId: string;
- /** Array of task definitions that were triggered */
- tasks: ExecTaskItem[];
- /** Type identifier for render component */
- type: 'execClientTasks';
-}
diff --git a/packages/builtin-tool-lobe-agent/package.json b/packages/builtin-tool-lobe-agent/package.json
index 52839bab11f..5b8aa146f21 100644
--- a/packages/builtin-tool-lobe-agent/package.json
+++ b/packages/builtin-tool-lobe-agent/package.json
@@ -4,7 +4,7 @@
"private": true,
"exports": {
".": "./src/index.ts",
- "./executor": "./src/executor/index.ts"
+ "./client": "./src/client/index.ts"
},
"main": "./src/index.ts",
"scripts": {
@@ -12,7 +12,19 @@
"test:coverage": "vitest --coverage --silent='passed-only'",
"test:update": "vitest -u"
},
+ "dependencies": {
+ "@lobechat/const": "workspace:*",
+ "@lobechat/prompts": "workspace:*"
+ },
"devDependencies": {
"@lobechat/types": "workspace:*"
+ },
+ "peerDependencies": {
+ "@lobehub/editor": "^4",
+ "@lobehub/ui": "^5",
+ "antd": "^6",
+ "antd-style": "*",
+ "lucide-react": "*",
+ "react": "*"
}
}
diff --git a/packages/builtin-tool-lobe-agent/src/client/Inspector/CallSubAgent/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/CallSubAgent/index.tsx
new file mode 100644
index 00000000000..65592bf8d3f
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/CallSubAgent/index.tsx
@@ -0,0 +1,57 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { cx } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
+
+import type { CallSubAgentParams, CallSubAgentState } from '../../../types';
+
+export const CallSubAgentInspector = memo<
+ BuiltinInspectorProps<CallSubAgentParams, CallSubAgentState>
+>(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
+ const { t } = useTranslation('plugin');
+
+ const description = args?.description || partialArgs?.description;
+
+ if (isArgumentsStreaming) {
+ if (!description)
+ return (
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-agent.apiName.callSubAgent')}</span>
+ </div>
+ );
+
+ return (
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-agent.apiName.callSubAgent.loading')}</span>
+ <span className={highlightTextStyles.primary}>{description}</span>
+ </div>
+ );
+ }
+
+ if (description) {
+ return (
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
+ <span>
+ {isLoading
+ ? t('builtins.lobe-agent.apiName.callSubAgent.loading')
+ : t('builtins.lobe-agent.apiName.callSubAgent.completed')}
+ </span>
+ <span className={highlightTextStyles.primary}>{description}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={inspectorTextStyles.root}>
+ <span>{t('builtins.lobe-agent.apiName.callSubAgent')}</span>
+ </div>
+ );
+});
+
+CallSubAgentInspector.displayName = 'CallSubAgentInspector';
+
+export default CallSubAgentInspector;
diff --git a/packages/builtin-tool-lobe-agent/src/client/Inspector/CallSubAgents/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/CallSubAgents/index.tsx
new file mode 100644
index 00000000000..6b0592d49d0
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/CallSubAgents/index.tsx
@@ -0,0 +1,75 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { ListTodo } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { highlightTextStyles, shinyTextStyles } from '@/styles';
+
+import type { CallSubAgentsParams, CallSubAgentsState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ count: css`
+ flex-shrink: 0;
+ margin-inline-start: 4px;
+ color: ${cssVar.colorTextSecondary};
+ `,
+ description: css`
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ root: css`
+ overflow: hidden;
+ display: flex;
+ gap: 4px;
+ align-items: center;
+ `,
+ title: css`
+ flex-shrink: 0;
+ color: ${cssVar.colorText};
+ `,
+}));
+
+export const CallSubAgentsInspector = memo<
+ BuiltinInspectorProps<CallSubAgentsParams, CallSubAgentsState>
+>(({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const tasks = args?.tasks || partialArgs?.tasks || [];
+ const count = tasks.length;
+ const firstTask = tasks[0];
+
+ if (isArgumentsStreaming && count === 0) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-agent.apiName.callSubAgents')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={styles.root}>
+ <span className={cx(styles.title, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ {t('builtins.lobe-agent.apiName.callSubAgents')}:
+ </span>
+ {firstTask?.description && (
+ <span className={cx(styles.description, highlightTextStyles.primary)}>
+ {firstTask.description}
+ </span>
+ )}
+ {count > 1 && (
+ <span className={styles.count}>
+ <Icon icon={ListTodo} size={14} /> {count}
+ </span>
+ )}
+ </div>
+ );
+});
+
+CallSubAgentsInspector.displayName = 'CallSubAgentsInspector';
+
+export default CallSubAgentsInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/ClearTodos/index.tsx
similarity index 84%
rename from packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Inspector/ClearTodos/index.tsx
index 25b1cfde01d..312ccdc66b3 100644
--- a/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/ClearTodos/index.tsx
@@ -26,15 +26,15 @@ export const ClearTodosInspector = memo<BuiltinInspectorProps<ClearTodosParams,
if (isArgumentsStreaming && !mode) {
return (
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.clearTodos')}</span>
+ <span>{t('builtins.lobe-agent.apiName.clearTodos')}</span>
</div>
);
}
const modeLabel =
mode === 'all'
- ? t('builtins.lobe-gtd.apiName.clearTodos.modeAll')
- : t('builtins.lobe-gtd.apiName.clearTodos.modeCompleted');
+ ? t('builtins.lobe-agent.apiName.clearTodos.modeAll')
+ : t('builtins.lobe-agent.apiName.clearTodos.modeCompleted');
return (
<div
@@ -42,7 +42,7 @@ export const ClearTodosInspector = memo<BuiltinInspectorProps<ClearTodosParams,
>
<Trans
components={{ mode: <span className={styles.mode} /> }}
- i18nKey="builtins.lobe-gtd.apiName.clearTodos.result"
+ i18nKey="builtins.lobe-agent.apiName.clearTodos.result"
ns="plugin"
values={{ mode: modeLabel }}
/>
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/CreatePlan/index.tsx
similarity index 85%
rename from packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Inspector/CreatePlan/index.tsx
index 3c95767bdf5..6904ce18d5a 100644
--- a/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/CreatePlan/index.tsx
@@ -18,7 +18,7 @@ export const CreatePlanInspector = memo<BuiltinInspectorProps<CreatePlanParams,
if (isArgumentsStreaming && !goal) {
return (
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.createPlan')}</span>
+ <span>{t('builtins.lobe-agent.apiName.createPlan')}</span>
</div>
);
}
@@ -30,12 +30,12 @@ export const CreatePlanInspector = memo<BuiltinInspectorProps<CreatePlanParams,
{goal ? (
<Trans
components={{ goal: <span className={highlightTextStyles.primary} /> }}
- i18nKey="builtins.lobe-gtd.apiName.createPlan.result"
+ i18nKey="builtins.lobe-agent.apiName.createPlan.result"
ns="plugin"
values={{ goal }}
/>
) : (
- <span>{t('builtins.lobe-gtd.apiName.createPlan')}</span>
+ <span>{t('builtins.lobe-agent.apiName.createPlan')}</span>
)}
</div>
);
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsx
similarity index 90%
rename from packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsx
index c44a4d4b650..8dbcfea93cc 100644
--- a/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/CreateTodos/index.tsx
@@ -30,14 +30,14 @@ export const CreateTodosInspector = memo<
if (isArgumentsStreaming && count === 0) {
return (
<div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.createTodos')}</span>
+ <span>{t('builtins.lobe-agent.apiName.createTodos')}</span>
</div>
);
}
return (
<div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>
- <span className={styles.title}>{t('builtins.lobe-gtd.apiName.createTodos')}</span>
+ <span className={styles.title}>{t('builtins.lobe-agent.apiName.createTodos')}</span>
{count > 0 && (
<Text code as={'span'} color={cssVar.colorSuccess} fontSize={12}>
<Icon icon={Plus} size={12} />
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdatePlan/index.tsx
similarity index 85%
rename from packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Inspector/UpdatePlan/index.tsx
index a8ffe2528ee..9b2233a06b2 100644
--- a/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdatePlan/index.tsx
@@ -29,24 +29,24 @@ export const UpdatePlanInspector = memo<BuiltinInspectorProps<UpdatePlanParams,
if (isArgumentsStreaming && !planId) {
return (
<div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.updatePlan')}</span>
+ <span>{t('builtins.lobe-agent.apiName.updatePlan')}</span>
</div>
);
}
return (
<div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>
- <span className={styles.title}>{t('builtins.lobe-gtd.apiName.updatePlan')}</span>
+ <span className={styles.title}>{t('builtins.lobe-agent.apiName.updatePlan')}</span>
{completed && (
<Text code as={'span'} color={cssVar.colorSuccess} fontSize={12}>
<Icon icon={CheckCircle} size={12} />
- {t('builtins.lobe-gtd.apiName.updatePlan.completed')}
+ {t('builtins.lobe-agent.apiName.updatePlan.completed')}
</Text>
)}
{hasUpdates && !completed && (
<Text code as={'span'} color={cssVar.colorWarning} fontSize={12}>
<Icon icon={DiffIcon} size={12} />
- {t('builtins.lobe-gtd.apiName.updatePlan.modified')}
+ {t('builtins.lobe-agent.apiName.updatePlan.modified')}
</Text>
)}
</div>
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsx
similarity index 95%
rename from packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsx
index e5b3cb1115c..b1914662167 100644
--- a/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/UpdateTodos/index.tsx
@@ -62,7 +62,7 @@ export const UpdateTodosInspector = memo<
if (isArgumentsStreaming && !hasOperations) {
return (
<div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-gtd.apiName.updateTodos')}</span>
+ <span>{t('builtins.lobe-agent.apiName.updateTodos')}</span>
</div>
);
}
@@ -103,7 +103,7 @@ export const UpdateTodosInspector = memo<
return (
<div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>
- <span className={styles.title}>{t('builtins.lobe-gtd.apiName.updateTodos')}</span>
+ <span className={styles.title}>{t('builtins.lobe-agent.apiName.updateTodos')}</span>
{statsParts.length > 0 && (
<>
{statsParts.map((part, index) => (
diff --git a/packages/builtin-tool-lobe-agent/src/client/Inspector/index.ts b/packages/builtin-tool-lobe-agent/src/client/Inspector/index.ts
new file mode 100644
index 00000000000..adf7f1a6976
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Inspector/index.ts
@@ -0,0 +1,26 @@
+import type { BuiltinInspector } from '@lobechat/types';
+
+import { LobeAgentApiName } from '../../types';
+import { CallSubAgentInspector } from './CallSubAgent';
+import { CallSubAgentsInspector } from './CallSubAgents';
+import { ClearTodosInspector } from './ClearTodos';
+import { CreatePlanInspector } from './CreatePlan';
+import { CreateTodosInspector } from './CreateTodos';
+import { UpdatePlanInspector } from './UpdatePlan';
+import { UpdateTodosInspector } from './UpdateTodos';
+
+/**
+ * Lobe Agent Inspector Components Registry
+ *
+ * Inspector components customize the title/header area
+ * of tool calls in the conversation UI.
+ */
+export const LobeAgentInspectors: Record<string, BuiltinInspector> = {
+ [LobeAgentApiName.callSubAgent]: CallSubAgentInspector as BuiltinInspector,
+ [LobeAgentApiName.callSubAgents]: CallSubAgentsInspector as BuiltinInspector,
+ [LobeAgentApiName.clearTodos]: ClearTodosInspector as BuiltinInspector,
+ [LobeAgentApiName.createPlan]: CreatePlanInspector as BuiltinInspector,
+ [LobeAgentApiName.createTodos]: CreateTodosInspector as BuiltinInspector,
+ [LobeAgentApiName.updatePlan]: UpdatePlanInspector as BuiltinInspector,
+ [LobeAgentApiName.updateTodos]: UpdateTodosInspector as BuiltinInspector,
+};
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx b/packages/builtin-tool-lobe-agent/src/client/Intervention/AddTodo.tsx
similarity index 85%
rename from packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Intervention/AddTodo.tsx
index d1ae2c8832d..ea4e065f6f2 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Intervention/AddTodo.tsx
@@ -21,9 +21,9 @@ const AddTodoIntervention = memo<BuiltinInterventionProps<CreateTodosParams>>(
const handleSave = useCallback(
async (items: TodoItem[]) => {
- console.log('[AddTodoIntervention] handleSave called with', items.length, 'items');
+ console.info('[AddTodoIntervention] handleSave called with', items.length, 'items');
await onArgsChange?.({ items });
- console.log('[AddTodoIntervention] onArgsChange completed');
+ console.info('[AddTodoIntervention] onArgsChange completed');
},
[onArgsChange],
);
@@ -32,7 +32,7 @@ const AddTodoIntervention = memo<BuiltinInterventionProps<CreateTodosParams>>(
<Block variant={'outlined'}>
<SortableTodoList
defaultItems={defaultItems}
- placeholder={t('lobe-gtd.addTodo.placeholder')}
+ placeholder={t('lobe-agent.addTodo.placeholder')}
registerBeforeApprove={registerBeforeApprove}
onSave={handleSave}
/>
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx b/packages/builtin-tool-lobe-agent/src/client/Intervention/ClearTodos.tsx
similarity index 89%
rename from packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Intervention/ClearTodos.tsx
index 6bd717b7dc1..78da56c9b9a 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/ClearTodos.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Intervention/ClearTodos.tsx
@@ -55,20 +55,20 @@ const ClearTodosIntervention = memo<BuiltinInterventionProps<ClearTodosParams>>(
<Flexbox gap={12}>
<Flexbox horizontal align="center" className={styles.header} gap={8}>
<Trash2 size={16} />
- <span style={{ fontSize: 14, fontWeight: 500 }}>{t('lobe-gtd.clearTodos.header')}</span>
+ <span style={{ fontSize: 14, fontWeight: 500 }}>{t('lobe-agent.clearTodos.header')}</span>
</Flexbox>
<Flexbox className={styles.container} gap={8}>
- <span className={styles.label}>{t('lobe-gtd.clearTodos.label')}</span>
+ <span className={styles.label}>{t('lobe-agent.clearTodos.label')}</span>
<Radio.Group value={mode} onChange={handleModeChange}>
<Flexbox gap={8}>
<Radio value="completed">
<span className={styles.normalText}>
- {t('lobe-gtd.clearTodos.option.completed')}
+ {t('lobe-agent.clearTodos.option.completed')}
</span>
</Radio>
<Radio value="all">
- <span className={styles.dangerText}>{t('lobe-gtd.clearTodos.option.all')}</span>
+ <span className={styles.dangerText}>{t('lobe-agent.clearTodos.option.all')}</span>
</Radio>
</Flexbox>
</Radio.Group>
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx b/packages/builtin-tool-lobe-agent/src/client/Intervention/CreatePlan.tsx
similarity index 95%
rename from packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Intervention/CreatePlan.tsx
index cc189ca613e..aadf83fbf7d 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/CreatePlan.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Intervention/CreatePlan.tsx
@@ -143,7 +143,7 @@ const CreatePlanIntervention = memo<BuiltinInterventionProps<CreatePlanParams>>(
<TextArea
autoSize={{ minRows: 1 }}
className={styles.title}
- placeholder={t('lobe-gtd.createPlan.goal.placeholder')}
+ placeholder={t('lobe-agent.createPlan.goal.placeholder')}
style={{ padding: 0, resize: 'none' }}
value={goal}
variant={'borderless'}
@@ -156,7 +156,7 @@ const CreatePlanIntervention = memo<BuiltinInterventionProps<CreatePlanParams>>(
autoSize={{ minRows: 1 }}
className={styles.description}
data-testid="plan-description"
- placeholder={t('lobe-gtd.createPlan.description.placeholder')}
+ placeholder={t('lobe-agent.createPlan.description.placeholder')}
style={{ padding: 0, resize: 'none' }}
value={description}
variant={'borderless'}
@@ -169,8 +169,8 @@ const CreatePlanIntervention = memo<BuiltinInterventionProps<CreatePlanParams>>(
<Editor
content={args.context}
editor={editor}
- lineEmptyPlaceholder={t('lobe-gtd.createPlan.context.placeholder')}
- placeholder={t('lobe-gtd.createPlan.context.placeholder')}
+ lineEmptyPlaceholder={t('lobe-agent.createPlan.context.placeholder')}
+ placeholder={t('lobe-agent.createPlan.context.placeholder')}
type={'text'}
plugins={[
ReactListPlugin,
diff --git a/packages/builtin-tool-gtd/src/client/Intervention/index.ts b/packages/builtin-tool-lobe-agent/src/client/Intervention/index.ts
similarity index 56%
rename from packages/builtin-tool-gtd/src/client/Intervention/index.ts
rename to packages/builtin-tool-lobe-agent/src/client/Intervention/index.ts
index d23e68e3089..4e23f93a60b 100644
--- a/packages/builtin-tool-gtd/src/client/Intervention/index.ts
+++ b/packages/builtin-tool-lobe-agent/src/client/Intervention/index.ts
@@ -1,20 +1,20 @@
import type { BuiltinIntervention } from '@lobechat/types';
-import { GTDApiName } from '../../types';
+import { LobeAgentApiName } from '../../types';
import AddTodoIntervention from './AddTodo';
import ClearTodosIntervention from './ClearTodos';
import CreatePlanIntervention from './CreatePlan';
/**
- * GTD Tool Intervention Components Registry
+ * Lobe Agent Intervention Components Registry
*
* Intervention components allow users to review and modify tool parameters
* before the tool is executed.
*/
-export const GTDInterventions: Record<string, BuiltinIntervention> = {
- [GTDApiName.clearTodos]: ClearTodosIntervention as BuiltinIntervention,
- [GTDApiName.createPlan]: CreatePlanIntervention as BuiltinIntervention,
- [GTDApiName.createTodos]: AddTodoIntervention as BuiltinIntervention,
+export const LobeAgentInterventions: Record<string, BuiltinIntervention> = {
+ [LobeAgentApiName.clearTodos]: ClearTodosIntervention as BuiltinIntervention,
+ [LobeAgentApiName.createPlan]: CreatePlanIntervention as BuiltinIntervention,
+ [LobeAgentApiName.createTodos]: AddTodoIntervention as BuiltinIntervention,
};
export { default as AddTodoIntervention } from './AddTodo';
diff --git a/packages/builtin-tool-gtd/src/client/Render/ExecTask/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Render/CallSubAgent/index.tsx
similarity index 83%
rename from packages/builtin-tool-gtd/src/client/Render/ExecTask/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Render/CallSubAgent/index.tsx
index 83e8e49300e..46c2230fd1e 100644
--- a/packages/builtin-tool-gtd/src/client/Render/ExecTask/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Render/CallSubAgent/index.tsx
@@ -5,7 +5,7 @@ import { Block } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
-import type { ExecTaskParams, ExecTaskState } from '../../../types';
+import type { CallSubAgentParams, CallSubAgentState } from '../../../types';
const styles = createStaticStyles(({ css, cssVar }) => ({
instruction: css`
@@ -41,7 +41,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
`,
}));
-export const ExecTaskRender = memo<BuiltinRenderProps<ExecTaskParams, ExecTaskState>>(
+export const CallSubAgentRender = memo<BuiltinRenderProps<CallSubAgentParams, CallSubAgentState>>(
({ pluginState }) => {
const { task } = pluginState || {};
@@ -60,6 +60,6 @@ export const ExecTaskRender = memo<BuiltinRenderProps<ExecTaskParams, ExecTaskSt
},
);
-ExecTaskRender.displayName = 'ExecTaskRender';
+CallSubAgentRender.displayName = 'CallSubAgentRender';
-export default ExecTaskRender;
+export default CallSubAgentRender;
diff --git a/packages/builtin-tool-lobe-agent/src/client/Render/CallSubAgents/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Render/CallSubAgents/index.tsx
new file mode 100644
index 00000000000..77773c6d8eb
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Render/CallSubAgents/index.tsx
@@ -0,0 +1,64 @@
+'use client';
+
+import type { BuiltinRenderProps } from '@lobechat/types';
+import { Block, Text } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import { memo } from 'react';
+
+import type { CallSubAgentsParams, CallSubAgentsState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ index: css`
+ flex-shrink: 0;
+ font-size: 12px;
+ color: ${cssVar.colorTextQuaternary};
+ `,
+
+ taskItem: css`
+ display: flex;
+ gap: 8px;
+ align-items: flex-start;
+
+ padding-block: 12px;
+ padding-inline: 12px;
+ border-block-end: 1px dashed ${cssVar.colorBorderSecondary};
+
+ &:last-child {
+ border-block-end: none;
+ }
+ `,
+}));
+
+export const CallSubAgentsRender = memo<
+ BuiltinRenderProps<CallSubAgentsParams, CallSubAgentsState>
+>(({ pluginState }) => {
+ const { tasks } = pluginState || {};
+
+ if (!tasks || tasks.length === 0) return null;
+
+ return (
+ <Block variant={'outlined'} width="100%">
+ {tasks.map((task, index) => (
+ <div className={styles.taskItem} key={index}>
+ <div className={styles.index}>{index + 1}.</div>
+ <div>
+ {task.description && (
+ <Text as={'h4'} fontSize={14} weight={500}>
+ {task.description}
+ </Text>
+ )}
+ {task.instruction && (
+ <Text as={'p'} ellipsis={{ rows: 2 }} fontSize={12} type={'secondary'}>
+ {task.instruction}
+ </Text>
+ )}
+ </div>
+ </div>
+ ))}
+ </Block>
+ );
+});
+
+CallSubAgentsRender.displayName = 'CallSubAgentsRender';
+
+export default CallSubAgentsRender;
diff --git a/packages/builtin-tool-gtd/src/client/Render/CreatePlan/PlanCard.tsx b/packages/builtin-tool-lobe-agent/src/client/Render/CreatePlan/PlanCard.tsx
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/Render/CreatePlan/PlanCard.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Render/CreatePlan/PlanCard.tsx
diff --git a/packages/builtin-tool-gtd/src/client/Render/CreatePlan/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Render/CreatePlan/index.tsx
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/Render/CreatePlan/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Render/CreatePlan/index.tsx
diff --git a/packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsx
similarity index 98%
rename from packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsx
index 1be41bede76..e01fa742293 100644
--- a/packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Render/TodoList/index.tsx
@@ -111,7 +111,7 @@ const TodoListUI = memo<TodoListUIProps>(({ items }) => {
TodoListUI.displayName = 'TodoListUI';
/**
- * TodoList Render component for GTD tool
+ * TodoList Render component for the lobe-agent tool
* Read-only display of todo items matching the style of AddTodoIntervention
*/
const TodoListRender = memo<BuiltinRenderProps<unknown, TodoListRenderState>>(({ pluginState }) => {
diff --git a/packages/builtin-tool-lobe-agent/src/client/Render/index.ts b/packages/builtin-tool-lobe-agent/src/client/Render/index.ts
new file mode 100644
index 00000000000..8728e41f15a
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Render/index.ts
@@ -0,0 +1,32 @@
+import { LobeAgentApiName } from '../../types';
+import CallSubAgentRender from './CallSubAgent';
+import CallSubAgentsRender from './CallSubAgents';
+import CreatePlan from './CreatePlan';
+import TodoListRender from './TodoList';
+
+/**
+ * Lobe Agent Tool Render Components Registry
+ *
+ * Sub-agent dispatch operations render a card showing the dispatched
+ * task(s). Plan operations render the PlanCard UI. Todo operations
+ * share a single TodoList render.
+ */
+export const LobeAgentRenders = {
+ [LobeAgentApiName.callSubAgent]: CallSubAgentRender,
+ [LobeAgentApiName.callSubAgents]: CallSubAgentsRender,
+
+ // Plan operations render the PlanCard UI
+ [LobeAgentApiName.createPlan]: CreatePlan,
+ [LobeAgentApiName.updatePlan]: CreatePlan,
+
+ // All todo operations render the same TodoList UI
+ [LobeAgentApiName.clearTodos]: TodoListRender,
+ [LobeAgentApiName.createTodos]: TodoListRender,
+ [LobeAgentApiName.updateTodos]: TodoListRender,
+};
+
+export { default as CallSubAgentRender } from './CallSubAgent';
+export { default as CallSubAgentsRender } from './CallSubAgents';
+export { default as CreatePlan, PlanCard } from './CreatePlan';
+export type { TodoListRenderState } from './TodoList';
+export { default as TodoListRender, TodoListUI } from './TodoList';
diff --git a/packages/builtin-tool-gtd/src/client/Streaming/ExecTask/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Streaming/CallSubAgent/index.tsx
similarity index 77%
rename from packages/builtin-tool-gtd/src/client/Streaming/ExecTask/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Streaming/CallSubAgent/index.tsx
index 91db48866a7..a4d0af69c10 100644
--- a/packages/builtin-tool-gtd/src/client/Streaming/ExecTask/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/Streaming/CallSubAgent/index.tsx
@@ -5,7 +5,7 @@ import { Markdown } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
-import type { ExecTaskParams } from '../../../types';
+import type { CallSubAgentParams } from '../../../types';
const styles = createStaticStyles(({ css, cssVar }) => ({
container: css`
@@ -24,7 +24,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
`,
}));
-export const ExecTaskStreaming = memo<BuiltinStreamingProps<ExecTaskParams>>(({ args }) => {
+export const CallSubAgentStreaming = memo<BuiltinStreamingProps<CallSubAgentParams>>(({ args }) => {
const { instruction } = args || {};
if (!instruction) return null;
@@ -42,6 +42,6 @@ export const ExecTaskStreaming = memo<BuiltinStreamingProps<ExecTaskParams>>(({
);
});
-ExecTaskStreaming.displayName = 'ExecTaskStreaming';
+CallSubAgentStreaming.displayName = 'CallSubAgentStreaming';
-export default ExecTaskStreaming;
+export default CallSubAgentStreaming;
diff --git a/packages/builtin-tool-lobe-agent/src/client/Streaming/CallSubAgents/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Streaming/CallSubAgents/index.tsx
new file mode 100644
index 00000000000..e9b0e077f4a
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Streaming/CallSubAgents/index.tsx
@@ -0,0 +1,79 @@
+'use client';
+
+import type { BuiltinStreamingProps } from '@lobechat/types';
+import { Block, Markdown } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import { memo } from 'react';
+
+import type { CallSubAgentsParams } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ index: css`
+ flex-shrink: 0;
+ font-size: 12px;
+ color: ${cssVar.colorTextQuaternary};
+ `,
+ instruction: css`
+ font-size: 12px;
+ line-height: 1.5;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ taskContent: css`
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ gap: 2px;
+
+ min-width: 0;
+ `,
+ taskItem: css`
+ display: flex;
+ gap: 8px;
+ align-items: flex-start;
+
+ padding-block: 10px;
+ padding-inline: 12px;
+ border-block-end: 1px dashed ${cssVar.colorBorderSecondary};
+
+ &:last-child {
+ border-block-end: none;
+ }
+ `,
+ title: css`
+ font-size: 13px;
+ line-height: 1.4;
+ color: ${cssVar.colorText};
+ `,
+}));
+
+export const CallSubAgentsStreaming = memo<BuiltinStreamingProps<CallSubAgentsParams>>(
+ ({ args }) => {
+ const { tasks } = args || {};
+
+ if (!tasks || tasks.length === 0) return null;
+
+ return (
+ <Block variant={'outlined'} width="100%">
+ {tasks.map((task, index) => (
+ <div className={styles.taskItem} key={index}>
+ <div className={styles.index}>{index + 1}.</div>
+ <div className={styles.taskContent}>
+ {task.description && <div className={styles.title}>{task.description}</div>}
+ {task.instruction && (
+ <div className={styles.instruction}>
+ <Markdown animated variant={'chat'}>
+ {task.instruction}
+ </Markdown>
+ </div>
+ )}
+ </div>
+ </div>
+ ))}
+ </Block>
+ );
+ },
+);
+
+CallSubAgentsStreaming.displayName = 'CallSubAgentsStreaming';
+
+export default CallSubAgentsStreaming;
diff --git a/packages/builtin-tool-gtd/src/client/Streaming/CreatePlan/index.tsx b/packages/builtin-tool-lobe-agent/src/client/Streaming/CreatePlan/index.tsx
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/Streaming/CreatePlan/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/Streaming/CreatePlan/index.tsx
diff --git a/packages/builtin-tool-lobe-agent/src/client/Streaming/index.ts b/packages/builtin-tool-lobe-agent/src/client/Streaming/index.ts
new file mode 100644
index 00000000000..8d97eb40217
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/Streaming/index.ts
@@ -0,0 +1,22 @@
+import type { BuiltinStreaming } from '@lobechat/types';
+
+import { LobeAgentApiName } from '../../types';
+import { CallSubAgentStreaming } from './CallSubAgent';
+import { CallSubAgentsStreaming } from './CallSubAgents';
+import { CreatePlanStreaming } from './CreatePlan';
+
+/**
+ * Lobe Agent Streaming Components Registry
+ *
+ * Streaming components render tool calls while they are still
+ * executing, allowing real-time feedback to users.
+ */
+export const LobeAgentStreamings: Record<string, BuiltinStreaming> = {
+ [LobeAgentApiName.callSubAgent]: CallSubAgentStreaming as BuiltinStreaming,
+ [LobeAgentApiName.callSubAgents]: CallSubAgentsStreaming as BuiltinStreaming,
+ [LobeAgentApiName.createPlan]: CreatePlanStreaming as BuiltinStreaming,
+};
+
+export { CallSubAgentStreaming } from './CallSubAgent';
+export { CallSubAgentsStreaming } from './CallSubAgents';
+export { CreatePlanStreaming } from './CreatePlan';
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/AddItemRow.tsx
similarity index 97%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/AddItemRow.tsx
index e0baddaec1d..dad16df579b 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/AddItemRow.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/AddItemRow.tsx
@@ -29,7 +29,7 @@ interface AddItemRowProps {
const AddItemRow = memo<AddItemRowProps>(({ placeholder, showDragHandle = true, className }) => {
const { t } = useTranslation('tool');
const inputRef = useRef<InputRef>(null);
- const defaultPlaceholder = placeholder || t('lobe-gtd.addTodo.placeholder');
+ const defaultPlaceholder = placeholder || t('lobe-agent.addTodo.placeholder');
const newItemText = useTodoListStore((s) => s.newItemText);
const focusedId = useTodoListStore((s) => s.focusedId);
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/SortableItem.tsx b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/SortableItem.tsx
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/SortableItem.tsx
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/SortableItem.tsx
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/TodoItemRow.tsx
similarity index 98%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/TodoItemRow.tsx
index c0fa1002c9e..a7c522e3fef 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/TodoItemRow.tsx
@@ -53,7 +53,7 @@ interface TodoItemRowProps {
const TodoItemRow = memo<TodoItemRowProps>(({ id, placeholder }) => {
const { t } = useTranslation('tool');
const inputRef = useRef<InputRef>(null);
- const defaultPlaceholder = placeholder || t('lobe-gtd.todoItem.placeholder');
+ const defaultPlaceholder = placeholder || t('lobe-agent.todoItem.placeholder');
// Find item by stable id
const item = useTodoListStore((s) => s.items.find((item) => item.id === id));
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoList.tsx b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/TodoList.tsx
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoList.tsx
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/TodoList.tsx
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/index.tsx
similarity index 95%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/index.tsx
index a3e91c3ee54..2670240b7c1 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/index.tsx
+++ b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/index.tsx
@@ -42,9 +42,9 @@ const SortableTodoList = memo<SortableTodoListProps>(
useEffect(() => {
if (registerBeforeApprove) {
const unregister = registerBeforeApprove('sortable-todo-list', async () => {
- console.log('trigger save');
+ console.info('trigger save');
await store.getState().saveNow();
- console.log('trigger save successful');
+ console.info('trigger save successful');
});
// Cleanup: unregister on unmount
return unregister;
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/actions.ts
similarity index 87%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/actions.ts
index 1900e129a51..c1decdffe6b 100644
--- a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts
+++ b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/actions.ts
@@ -27,11 +27,11 @@ export const createActions = (
): TodoListStore => {
// Save implementation (used by both debounced and immediate save)
const performSave = async () => {
- console.log('[performSave] called, onSave:', !!internals.onSave);
+ console.info('[performSave] called, onSave:', !!internals.onSave);
if (!internals.onSave) return;
const { items, isDirty } = get();
- console.log('[performSave] isDirty:', isDirty, 'items:', items.length);
+ console.info('[performSave] isDirty:', isDirty, 'items:', items.length);
if (!isDirty) return;
set({ saveStatus: 'saving' });
@@ -39,10 +39,16 @@ export const createActions = (
try {
// Convert TodoListItem[] to TodoItem[] (remove id)
const todoItems: TodoItem[] = items.map(({ status, text }) => ({ status, text }));
- console.log('[performSave] calling onSave with', todoItems.length, 'items');
+ console.info('[performSave] calling onSave with', todoItems.length, 'items');
await internals.onSave(todoItems);
- console.log('[performSave] onSave completed');
+ console.info('[performSave] onSave completed');
set({ isDirty: false, saveStatus: 'saved' });
+
+ // Match saveNow: ease the indicator back to `idle` so the UI doesn't
+ // get stuck showing "saved" after the auto-save settles.
+ setTimeout(() => {
+ set((state) => (state.saveStatus === 'saved' ? { saveStatus: 'idle' } : {}));
+ }, 1500);
} catch {
set({ saveStatus: 'error' });
}
@@ -98,9 +104,9 @@ export const createActions = (
try {
const todoItems: TodoItem[] = items.map(({ status, text }) => ({ status, text }));
- console.log('[saveNow] force saving', todoItems.length, 'items');
+ console.info('[saveNow] force saving', todoItems.length, 'items');
await internals.onSave(todoItems);
- console.log('[saveNow] save completed');
+ console.info('[saveNow] save completed');
set({ isDirty: false, saveStatus: 'saved' });
setTimeout(() => {
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/index.ts b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/index.ts
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/index.ts
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/index.ts
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/initialState.ts b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/initialState.ts
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/initialState.ts
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/initialState.ts
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/store.test.ts b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/store.test.ts
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/store.test.ts
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/store.test.ts
diff --git a/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/types.ts b/packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/types.ts
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/types.ts
rename to packages/builtin-tool-lobe-agent/src/client/components/SortableTodoList/store/types.ts
diff --git a/packages/builtin-tool-gtd/src/client/components/index.ts b/packages/builtin-tool-lobe-agent/src/client/components/index.ts
similarity index 100%
rename from packages/builtin-tool-gtd/src/client/components/index.ts
rename to packages/builtin-tool-lobe-agent/src/client/components/index.ts
diff --git a/packages/builtin-tool-gtd/src/ExecutionRuntime/index.ts b/packages/builtin-tool-lobe-agent/src/client/executor/PlanRuntime/index.ts
similarity index 82%
rename from packages/builtin-tool-gtd/src/ExecutionRuntime/index.ts
rename to packages/builtin-tool-lobe-agent/src/client/executor/PlanRuntime/index.ts
index a14b2551540..f822593cc87 100644
--- a/packages/builtin-tool-gtd/src/ExecutionRuntime/index.ts
+++ b/packages/builtin-tool-lobe-agent/src/client/executor/PlanRuntime/index.ts
@@ -5,14 +5,12 @@ import type {
ClearTodosParams,
CreatePlanParams,
CreateTodosParams,
- ExecTaskParams,
- ExecTasksParams,
Plan,
TodoItem,
TodoState,
UpdatePlanParams,
UpdateTodosParams,
-} from '../types';
+} from '../../../types';
export interface PlanDocument {
content: string | null;
@@ -24,7 +22,7 @@ export interface PlanDocument {
updatedAt: Date;
}
-export interface GTDRuntimeService {
+export interface PlanRuntimeService {
createPlan: (args: {
content: string;
description: string;
@@ -50,13 +48,13 @@ export interface GTDRuntimeService {
updatePlanMetadata: (id: string, metadata: Record<string, any>) => Promise<void>;
}
-export interface GTDRuntimeContext {
+export interface PlanRuntimeContext {
/**
* Existing todos supplied by the caller (client: from stepContext / pluginState).
* When undefined, the runtime resolves todos from the plan document's metadata.
*/
currentTodos?: TodoItem[];
- /** Tool call message ID — used as `parentMessageId` for execTask/execTasks. */
+ /** Tool call message ID. */
messageId?: string;
signal?: AbortSignal;
taskId?: string;
@@ -83,14 +81,14 @@ const readTodosFromPlan = (doc: PlanDocument | null): TodoItem[] => {
return [];
};
-export class GTDExecutionRuntime {
- private service: GTDRuntimeService;
+export class PlanExecutionRuntime {
+ private service: PlanRuntimeService;
- constructor(service: GTDRuntimeService) {
+ constructor(service: PlanRuntimeService) {
this.service = service;
}
- private async resolveExistingTodos(context: GTDRuntimeContext): Promise<TodoItem[]> {
+ private async resolveExistingTodos(context: PlanRuntimeContext): Promise<TodoItem[]> {
if (context.currentTodos) return context.currentTodos;
if (!context.topicId) return [];
const plan = await this.service.findPlanByTopic(context.topicId);
@@ -111,7 +109,7 @@ export class GTDExecutionRuntime {
createTodos = async (
params: CreateTodosParams,
- context: GTDRuntimeContext,
+ context: PlanRuntimeContext,
): Promise<BuiltinToolResult> => {
const itemsToAdd: TodoItem[] = params.items
? params.items
@@ -146,7 +144,7 @@ export class GTDExecutionRuntime {
updateTodos = async (
params: UpdateTodosParams,
- context: GTDRuntimeContext,
+ context: PlanRuntimeContext,
): Promise<BuiltinToolResult> => {
const { operations } = params;
@@ -220,7 +218,7 @@ export class GTDExecutionRuntime {
clearTodos = async (
params: ClearTodosParams,
- context: GTDRuntimeContext,
+ context: PlanRuntimeContext,
): Promise<BuiltinToolResult> => {
const { mode } = params;
@@ -272,7 +270,7 @@ export class GTDExecutionRuntime {
createPlan = async (
params: CreatePlanParams,
- context: GTDRuntimeContext,
+ context: PlanRuntimeContext,
): Promise<BuiltinToolResult> => {
try {
if (context.signal?.aborted) return { stop: true, success: false };
@@ -309,7 +307,7 @@ export class GTDExecutionRuntime {
updatePlan = async (
params: UpdatePlanParams,
- context: GTDRuntimeContext,
+ context: PlanRuntimeContext,
): Promise<BuiltinToolResult> => {
try {
if (context.signal?.aborted) return { stop: true, success: false };
@@ -347,51 +345,4 @@ export class GTDExecutionRuntime {
};
}
};
-
- // ==================== Async Tasks API ====================
-
- execTask = async (
- params: ExecTaskParams,
- context: GTDRuntimeContext,
- ): Promise<BuiltinToolResult> => {
- const { description, instruction, inheritMessages, timeout, runInClient } = params;
-
- if (!description || !instruction) {
- return { content: 'Task description and instruction are required.', success: false };
- }
-
- const task = { description, inheritMessages, instruction, runInClient, timeout };
- const stateType = runInClient ? 'execClientTask' : 'execTask';
-
- return {
- content: `🚀 Triggered async task for ${runInClient ? 'client-side' : ''} execution:\n- ${description}`,
- state: { parentMessageId: context.messageId ?? '', task, type: stateType },
- stop: true,
- success: true,
- };
- };
-
- execTasks = async (
- params: ExecTasksParams,
- context: GTDRuntimeContext,
- ): Promise<BuiltinToolResult> => {
- const { tasks } = params;
-
- if (!tasks || tasks.length === 0) {
- return { content: 'No tasks provided to execute.', success: false };
- }
-
- const taskCount = tasks.length;
- const taskList = tasks.map((t, i) => `${i + 1}. ${t.description}`).join('\n');
- const hasClientTasks = tasks.some((t) => t.runInClient);
- const stateType = hasClientTasks ? 'execClientTasks' : 'execTasks';
- const executionMode = hasClientTasks ? 'client-side' : '';
-
- return {
- content: `🚀 Triggered ${taskCount} async task${taskCount > 1 ? 's' : ''} for ${executionMode} execution:\n${taskList}`,
- state: { parentMessageId: context.messageId ?? '', tasks, type: stateType },
- stop: true,
- success: true,
- };
- };
}
diff --git a/packages/builtin-tool-lobe-agent/src/executor/index.ts b/packages/builtin-tool-lobe-agent/src/client/executor/index.ts
similarity index 55%
rename from packages/builtin-tool-lobe-agent/src/executor/index.ts
rename to packages/builtin-tool-lobe-agent/src/client/executor/index.ts
index b9b8b89f495..3616ba88fcb 100644
--- a/packages/builtin-tool-lobe-agent/src/executor/index.ts
+++ b/packages/builtin-tool-lobe-agent/src/client/executor/index.ts
@@ -1,10 +1,22 @@
import type { BuiltinToolContext, BuiltinToolResult, ChatStreamPayload } from '@lobechat/types';
import { BaseExecutor, RequestTrigger } from '@lobechat/types';
-import { LobeAgentManifest } from '../manifest';
-import type { AnalyzeVisualMediaParams } from '../types';
-import { LobeAgentApiName } from '../types';
-import type { VisualFileItem } from '../visualMedia';
+import { notebookService } from '@/services/notebook';
+import { useNotebookStore } from '@/store/notebook';
+
+import { LobeAgentManifest } from '../../manifest';
+import type {
+ AnalyzeVisualMediaParams,
+ CallSubAgentParams,
+ CallSubAgentsParams,
+ ClearTodosParams,
+ CreatePlanParams,
+ CreateTodosParams,
+ UpdatePlanParams,
+ UpdateTodosParams,
+} from '../../types';
+import { LobeAgentApiName } from '../../types';
+import type { VisualFileItem } from '../../visualMedia';
import {
buildAnalyzeVisualMediaContent,
createUrlVisualFileItems,
@@ -15,7 +27,86 @@ import {
normalizeAnalyzeVisualMediaInput,
selectVisualFileItems,
validateVisualMediaUrls,
-} from '../visualMedia';
+} from '../../visualMedia';
+import {
+ type PlanDocument,
+ PlanExecutionRuntime,
+ type PlanRuntimeContext,
+ type PlanRuntimeService,
+} from './PlanRuntime';
+import { getTodosFromContext } from './planTodoHelper';
+
+const PLAN_DOC_TYPE = 'agent/plan';
+
+/**
+ * Normalize a document payload returned by notebookService / useNotebookStore
+ * into the `PlanDocument` shape expected by PlanExecutionRuntime.
+ */
+const normalizePlanDoc = (doc: {
+ content?: string | null;
+ createdAt: Date | string;
+ description?: string | null;
+ id: string;
+ metadata?: Record<string, any> | null;
+ title?: string | null;
+ updatedAt: Date | string;
+}): PlanDocument => ({
+ content: doc.content ?? null,
+ createdAt: typeof doc.createdAt === 'string' ? new Date(doc.createdAt) : doc.createdAt,
+ description: doc.description ?? null,
+ id: doc.id,
+ metadata: doc.metadata ?? null,
+ title: doc.title ?? null,
+ updatedAt: typeof doc.updatedAt === 'string' ? new Date(doc.updatedAt) : doc.updatedAt,
+});
+
+/**
+ * Client-side implementation of the Plan runtime service.
+ * Routes user-facing plan CRUD through useNotebookStore (so SWR caches refresh),
+ * and keeps silent metadata writes (todos sync) on the raw notebookService.
+ */
+const clientPlanService: PlanRuntimeService = {
+ createPlan: async ({ topicId, goal, description, content }) => {
+ const doc = await useNotebookStore.getState().createDocument({
+ content,
+ description,
+ title: goal,
+ topicId,
+ type: PLAN_DOC_TYPE,
+ });
+ return normalizePlanDoc(doc);
+ },
+
+ findPlanById: async (id) => {
+ const doc = await notebookService.getDocument(id);
+ return doc ? normalizePlanDoc(doc) : null;
+ },
+
+ findPlanByTopic: async (topicId) => {
+ const result = await notebookService.listDocuments({ topicId, type: PLAN_DOC_TYPE });
+ const first = result.data[0];
+ return first ? normalizePlanDoc(first) : null;
+ },
+
+ updatePlan: async (id, { goal, description, content }, topicId) => {
+ const doc = await useNotebookStore
+ .getState()
+ .updateDocument({ content, description, id, title: goal }, topicId ?? '');
+ if (!doc) throw new Error(`Plan not found after update: ${id}`);
+ return normalizePlanDoc(doc);
+ },
+
+ updatePlanMetadata: async (id, metadata) => {
+ await notebookService.updateDocument({ id, metadata });
+ },
+};
+
+const toPlanRuntimeContext = (ctx: BuiltinToolContext): PlanRuntimeContext => ({
+ currentTodos: getTodosFromContext(ctx),
+ messageId: ctx.messageId,
+ signal: ctx.signal,
+ topicId: ctx.topicId ?? undefined,
+});
interface VisualSourceMessage {
parentId?: string;
@@ -50,6 +141,27 @@ class LobeAgentExecutor extends BaseExecutor<typeof LobeAgentApiName> {
readonly identifier = LobeAgentManifest.identifier;
protected readonly apiEnum = LobeAgentApiName;
+ private planRuntime = new PlanExecutionRuntime(clientPlanService);
+
+ // ==================== Plan / Todo ====================
+
+ createPlan = (params: CreatePlanParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
+ this.planRuntime.createPlan(params, toPlanRuntimeContext(ctx));
+
+ updatePlan = (params: UpdatePlanParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
+ this.planRuntime.updatePlan(params, toPlanRuntimeContext(ctx));
+
+ createTodos = (params: CreateTodosParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
+ this.planRuntime.createTodos(params, toPlanRuntimeContext(ctx));
+
+ updateTodos = (params: UpdateTodosParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
+ this.planRuntime.updateTodos(params, toPlanRuntimeContext(ctx));
+
+ clearTodos = (params: ClearTodosParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> =>
+ this.planRuntime.clearTodos(params, toPlanRuntimeContext(ctx));
+
+ // ==================== Visual ====================
+
analyzeVisualMedia = async (
params: AnalyzeVisualMediaParams,
ctx: BuiltinToolContext,
@@ -241,6 +353,58 @@ class LobeAgentExecutor extends BaseExecutor<typeof LobeAgentApiName> {
success: true,
};
};
+
+ // ==================== Sub-Agent ====================
+ //
+ // The executor only constructs the state payload that bridges the tool call
+ // to the agent-runtime instruction layer. The actual sub-agent dispatch is
+ // handled by `createAgentExecutors.ts` which reads `state.type` to emit the
+ // matching `exec_sub_agent` / `exec_client_sub_agent(s)` instruction.
+
+ callSubAgent = async (
+ params: CallSubAgentParams,
+ ctx: BuiltinToolContext,
+ ): Promise<BuiltinToolResult> => {
+ const { description, instruction, inheritMessages, timeout, runInClient } = params;
+
+ if (!description || !instruction) {
+ return { content: 'Sub-agent description and instruction are required.', success: false };
+ }
+
+ const task = { description, inheritMessages, instruction, runInClient, timeout };
+ const stateType = runInClient ? 'execClientSubAgent' : 'execSubAgent';
+
+ return {
+ content: `🚀 Dispatched sub-agent for ${runInClient ? 'client-side' : ''} execution:\n- ${description}`,
+ state: { parentMessageId: ctx.messageId ?? '', task, type: stateType },
+ stop: true,
+ success: true,
+ };
+ };
+
+ callSubAgents = async (
+ params: CallSubAgentsParams,
+ ctx: BuiltinToolContext,
+ ): Promise<BuiltinToolResult> => {
+ const { tasks } = params;
+
+ if (!tasks || tasks.length === 0) {
+ return { content: 'No sub-agents provided to dispatch.', success: false };
+ }
+
+ const taskCount = tasks.length;
+ const taskList = tasks.map((t, i) => `${i + 1}. ${t.description}`).join('\n');
+ const hasClientTasks = tasks.some((t) => t.runInClient);
+ const stateType = hasClientTasks ? 'execClientSubAgents' : 'execSubAgents';
+ const executionMode = hasClientTasks ? 'client-side' : '';
+
+ return {
+ content: `🚀 Dispatched ${taskCount} sub-agent${taskCount > 1 ? 's' : ''} for ${executionMode} execution:\n${taskList}`,
+ state: { parentMessageId: ctx.messageId ?? '', tasks, type: stateType },
+ stop: true,
+ success: true,
+ };
+ };
}
export const lobeAgentExecutor = new LobeAgentExecutor();
diff --git a/packages/builtin-tool-gtd/src/executor/helper.ts b/packages/builtin-tool-lobe-agent/src/client/executor/planTodoHelper.ts
similarity index 96%
rename from packages/builtin-tool-gtd/src/executor/helper.ts
rename to packages/builtin-tool-lobe-agent/src/client/executor/planTodoHelper.ts
index 75130ae74e5..eea7d4d7948 100644
--- a/packages/builtin-tool-gtd/src/executor/helper.ts
+++ b/packages/builtin-tool-lobe-agent/src/client/executor/planTodoHelper.ts
@@ -1,6 +1,6 @@
import type { BuiltinToolContext } from '@lobechat/types';
-import type { TodoItem } from '../types';
+import type { TodoItem } from '../../types';
/**
* Helper to get todos from step context or fallback to plugin state
diff --git a/packages/builtin-tool-lobe-agent/src/client/index.ts b/packages/builtin-tool-lobe-agent/src/client/index.ts
new file mode 100644
index 00000000000..494be0b72a1
--- /dev/null
+++ b/packages/builtin-tool-lobe-agent/src/client/index.ts
@@ -0,0 +1,41 @@
+// Executor (client-side — depends on app stores/services)
+export { lobeAgentExecutor } from './executor';
+
+// Inspector components (customized tool call headers)
+export { LobeAgentInspectors } from './Inspector';
+
+// Render components (read-only snapshots)
+export type { TodoListRenderState } from './Render';
+export {
+ CallSubAgentRender,
+ CallSubAgentsRender,
+ CreatePlan,
+ LobeAgentRenders,
+ PlanCard,
+ TodoListRender,
+ TodoListUI,
+} from './Render';
+
+// Streaming components (real-time tool execution feedback)
+export {
+ CallSubAgentsStreaming,
+ CallSubAgentStreaming,
+ CreatePlanStreaming,
+ LobeAgentStreamings,
+} from './Streaming';
+
+// Intervention components (interactive editing)
+export {
+ AddTodoIntervention,
+ ClearTodosIntervention,
+ CreatePlanIntervention,
+ LobeAgentInterventions,
+} from './Intervention';
+
+// Reusable components
+export type { SortableTodoListProps, TodoListItem } from './components';
+export { SortableTodoList } from './components';
+
+// Re-export types and manifest for convenience
+export { LobeAgentManifest } from '../manifest';
+export * from '../types';
diff --git a/packages/builtin-tool-gtd/src/const.ts b/packages/builtin-tool-lobe-agent/src/const.ts
similarity index 100%
rename from packages/builtin-tool-gtd/src/const.ts
rename to packages/builtin-tool-lobe-agent/src/const.ts
diff --git a/packages/builtin-tool-lobe-agent/src/index.ts b/packages/builtin-tool-lobe-agent/src/index.ts
index 9919d9c8377..4321213778e 100644
--- a/packages/builtin-tool-lobe-agent/src/index.ts
+++ b/packages/builtin-tool-lobe-agent/src/index.ts
@@ -1,3 +1,10 @@
+// Plan execution runtime — pure logic, safe to consume server-side
+export {
+ type PlanDocument,
+ PlanExecutionRuntime,
+ type PlanRuntimeContext,
+ type PlanRuntimeService,
+} from './client/executor/PlanRuntime';
export * from './manifest';
export * from './systemRole';
export * from './types';
diff --git a/packages/builtin-tool-lobe-agent/src/manifest.test.ts b/packages/builtin-tool-lobe-agent/src/manifest.test.ts
index 54cdce2c2ff..bc0dbd6e63a 100644
--- a/packages/builtin-tool-lobe-agent/src/manifest.test.ts
+++ b/packages/builtin-tool-lobe-agent/src/manifest.test.ts
@@ -5,7 +5,9 @@ import { LobeAgentManifest } from './manifest';
describe('LobeAgentManifest', () => {
it('should keep the package metadata generic for future Lobe Agent capabilities', () => {
expect(LobeAgentManifest.meta.avatar).toBe('🤖');
- expect(LobeAgentManifest.meta.description).toBe('Run built-in Lobe Agent capabilities.');
+ expect(LobeAgentManifest.meta.description).toBe(
+ 'Run built-in Lobe Agent capabilities: plan + todo management, sub-agent dispatch, and visual media analysis.',
+ );
expect(LobeAgentManifest.meta.readme).toContain(
'built-in assistant capabilities that can be expanded over time',
);
diff --git a/packages/builtin-tool-lobe-agent/src/manifest.ts b/packages/builtin-tool-lobe-agent/src/manifest.ts
index 95a13b24551..96f635e9407 100644
--- a/packages/builtin-tool-lobe-agent/src/manifest.ts
+++ b/packages/builtin-tool-lobe-agent/src/manifest.ts
@@ -1,5 +1,6 @@
import type { BuiltinToolManifest } from '@lobechat/types';
+import { isDesktop } from './const';
import { systemPrompt } from './systemRole';
import { LobeAgentApiName, LobeAgentIdentifier } from './types';
@@ -38,11 +39,237 @@ export const LobeAgentManifest: BuiltinToolManifest = {
type: 'object',
},
},
+
+ // ==================== Planning ====================
+ {
+ description:
+ 'Create a high-level plan document. Plans define the strategic direction (the "what" and "why"), while todos handle the actionable steps.',
+ name: LobeAgentApiName.createPlan,
+ humanIntervention: 'required',
+ renderDisplayControl: 'expand',
+ parameters: {
+ properties: {
+ goal: {
+ description: 'The main goal or objective to achieve (used as document title).',
+ type: 'string',
+ },
+ description: {
+ description: 'A brief summary of the plan (1-2 sentences).',
+ type: 'string',
+ },
+ context: {
+ description:
+ 'Detailed context, constraints, background information, or strategic considerations relevant to the goal.',
+ type: 'string',
+ },
+ },
+ required: ['goal', 'description', 'context'],
+ type: 'object',
+ },
+ },
+ {
+ description:
+ 'Update an existing plan document. Only use this when the goal fundamentally changes. Plans should remain stable once created - do not update plans just because details change.',
+ name: LobeAgentApiName.updatePlan,
+ parameters: {
+ properties: {
+ planId: {
+ description:
+ 'The document ID of the plan to update (e.g., "docs_xxx"). This ID is returned in the createPlan response. Do NOT use the goal text as planId.',
+ type: 'string',
+ },
+ goal: {
+ description: 'Updated goal (document title).',
+ type: 'string',
+ },
+ description: {
+ description: 'Updated brief summary.',
+ type: 'string',
+ },
+ context: {
+ description: 'Updated detailed context.',
+ type: 'string',
+ },
+ },
+ required: ['planId'],
+ type: 'object',
+ },
+ },
+
+ // ==================== Quick Todo ====================
+ {
+ description: 'Create new todo items. Pass an array of text strings.',
+ name: LobeAgentApiName.createTodos,
+ humanIntervention: 'required',
+ parameters: {
+ properties: {
+ adds: {
+ description: 'Array of todo item texts to create.',
+ items: { type: 'string' },
+ type: 'array',
+ },
+ },
+ required: ['adds'],
+ type: 'object',
+ },
+ },
+ {
+ description: `Update todo items with batch operations. Each operation type requires specific fields:
+- "add": requires "text" (the todo text to add)
+- "update": requires "index", optional "newText" and/or "status"
+- "remove": requires "index" only
+- "complete": requires "index" only (marks item as completed)
+- "processing": requires "index" only (marks item as in progress)`,
+ name: LobeAgentApiName.updateTodos,
+ renderDisplayControl: 'expand',
+ parameters: {
+ properties: {
+ operations: {
+ description:
+ 'Array of update operations. IMPORTANT: For "complete", "processing" and "remove" operations, only pass "type" and "index" - no other fields needed.',
+ items: {
+ properties: {
+ type: {
+ description:
+ 'Operation type. "add" needs text, "update" needs index + optional newText/status, "remove", "complete" and "processing" need index only.',
+ enum: ['add', 'update', 'remove', 'complete', 'processing'],
+ type: 'string',
+ },
+ text: {
+ description: 'Required for "add" only: the text to add.',
+ type: 'string',
+ },
+ index: {
+ description:
+ 'Required for "update", "remove", "complete", "processing": the item index (0-based).',
+ type: 'number',
+ },
+ newText: {
+ description: 'Optional for "update" only: the new text.',
+ type: 'string',
+ },
+ status: {
+ description:
+ 'Optional for "update" only: set status (todo, processing, completed).',
+ enum: ['todo', 'processing', 'completed'],
+ type: 'string',
+ },
+ },
+ required: ['type'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ },
+ required: ['operations'],
+ type: 'object',
+ },
+ },
+ {
+ description: 'Clear todo items. Can clear only completed items or all items.',
+ name: LobeAgentApiName.clearTodos,
+ humanIntervention: 'always',
+ renderDisplayControl: 'expand',
+ parameters: {
+ properties: {
+ mode: {
+ description: '"completed" clears only done items, "all" clears the entire list.',
+ enum: ['completed', 'all'],
+ type: 'string',
+ },
+ },
+ required: ['mode'],
+ type: 'object',
+ },
+ },
+
+ // ==================== Sub-Agent ====================
+ {
+ description:
+ 'Dispatch a single sub-agent that runs in an isolated context to handle a long-running, multi-step request. Use this when the request requires extended processing (web research, multi-source synthesis, deep investigation) that benefits from running independently of the main conversation.',
+ name: LobeAgentApiName.callSubAgent,
+ parameters: {
+ properties: {
+ description: {
+ description: 'Brief description of what this sub-agent does (shown in UI).',
+ type: 'string',
+ },
+ instruction: {
+ description: 'Detailed instruction/prompt for the sub-agent execution.',
+ type: 'string',
+ },
+ inheritMessages: {
+ description:
+ 'Whether to inherit context messages from the parent conversation. Default is false.',
+ type: 'boolean',
+ },
+ ...(isDesktop && {
+ runInClient: {
+ description:
+ 'Whether to run on the desktop client (for local file/shell access). MUST be true when the sub-agent requires local-system tools. Default is false (server execution).',
+ type: 'boolean',
+ },
+ }),
+ timeout: {
+ description: 'Optional timeout in milliseconds. Default is 30 minutes.',
+ type: 'number',
+ },
+ },
+ required: ['description', 'instruction'],
+ type: 'object',
+ },
+ },
+ {
+ description:
+ 'Dispatch one or more sub-agents in parallel. Each sub-agent runs in an isolated context. Use this when several independent investigations / multi-step tasks should proceed concurrently.',
+ name: LobeAgentApiName.callSubAgents,
+ parameters: {
+ properties: {
+ tasks: {
+ description: 'Array of sub-agents to dispatch.',
+ items: {
+ properties: {
+ description: {
+ description: 'Brief description of what this sub-agent does (shown in UI).',
+ type: 'string',
+ },
+ instruction: {
+ description: 'Detailed instruction/prompt for the sub-agent execution.',
+ type: 'string',
+ },
+ inheritMessages: {
+ description:
+ 'Whether to inherit context messages from the parent conversation. Default is false.',
+ type: 'boolean',
+ },
+ ...(isDesktop && {
+ runInClient: {
+ description:
+ 'Whether to run on the desktop client (for local file/shell access). MUST be true when the sub-agent requires local-system tools. Default is false (server execution).',
+ type: 'boolean',
+ },
+ }),
+ timeout: {
+ description: 'Optional timeout in milliseconds. Default is 30 minutes.',
+ type: 'number',
+ },
+ },
+ required: ['description', 'instruction'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ },
+ required: ['tasks'],
+ type: 'object',
+ },
+ },
],
identifier: LobeAgentIdentifier,
meta: {
avatar: '🤖',
- description: 'Run built-in Lobe Agent capabilities.',
+ description:
+ 'Run built-in Lobe Agent capabilities: plan + todo management, sub-agent dispatch, and visual media analysis.',
readme: 'Lobe Agent provides built-in assistant capabilities that can be expanded over time.',
title: 'Lobe Agent',
},
diff --git a/packages/builtin-tool-lobe-agent/src/systemRole.ts b/packages/builtin-tool-lobe-agent/src/systemRole.ts
index eccdfee451b..2c1a712aabe 100644
--- a/packages/builtin-tool-lobe-agent/src/systemRole.ts
+++ b/packages/builtin-tool-lobe-agent/src/systemRole.ts
@@ -1 +1,210 @@
-export const systemPrompt = `Use Lobe Agent capabilities only when the active model needs built-in assistance. Prefer the active model's native capabilities whenever they are sufficient. Follow each tool's description and schema, and use tool results to answer the user directly.`;
+import { isDesktop } from './const';
+
+const runInClientSection = `
+<run_in_client>
+**IMPORTANT: When to use \`runInClient: true\` for sub-agents**
+
+The \`runInClient\` parameter controls WHERE the sub-agent executes:
+- \`runInClient: false\` (default): Sub-agent runs on the **server** - suitable for web searches, API calls, general research
+- \`runInClient: true\`: Sub-agent runs on the **desktop client** - required for local system access
+
+**MUST set \`runInClient: true\` when the sub-agent involves:**
+- Reading or writing local files (via \`local-system\` tool)
+- Executing shell commands on the user's machine
+- Accessing local directories or file system
+- Any operation that requires desktop-only local tools
+
+**Keep \`runInClient: false\` (or omit) when:**
+- Sub-agent only needs web searches or API calls
+- Sub-agent processes data that doesn't require local file access
+- Sub-agent can be fully completed with server-side capabilities
+
+**Note:** \`runInClient\` only has effect on the **desktop app**. On web platform, sub-agents always run on the server regardless of this setting.
+
+**Examples:**
+- "Research Python best practices" → \`runInClient: false\` (web search only)
+- "Organize files in my Downloads folder" → \`runInClient: true\` (local file access required)
+- "Read the project README and summarize it" → \`runInClient: true\` (local file read required)
+- "Find trending tech news" → \`runInClient: false\` (web search only)
+- "Create a new directory structure for my project" → \`runInClient: true\` (local shell/file required)
+</run_in_client>
+`;
+
+const subAgentSection = `
+<sub_agents>
+You can dispatch **sub-agents** to handle long-running, multi-step work in isolated contexts.
+
+**Sub-Agent Tools:**
+- \`callSubAgent\`: Dispatch a single sub-agent. **Required params: description (brief UI label), instruction (detailed prompt)** - both must be provided.
+- \`callSubAgents\`: Dispatch multiple sub-agents in parallel. Each task requires **description** and **instruction**.
+
+**Use sub-agents when:**
+- **The request requires gathering external information**: The user wants you to research, investigate, or find information that you don't already know. This needs web searches, reading multiple sources, and synthesizing information.
+- **The task involves multiple steps**: The request cannot be answered in one simple response - it requires searching, reading, analyzing, and summarizing.
+- **Quality depends on thorough investigation**: A superficial answer would be insufficient; the user expects comprehensive, well-researched results.
+- **Independent execution is beneficial**: The task can run separately while freeing up the main conversation.
+
+**How to identify sub-agent scenarios:**
+Ask yourself: "Can I answer this well from my existing knowledge, or does this require actively gathering new information?"
+- If you need to search the web, read articles, or investigate → Dispatch a sub-agent
+- If you can answer directly from knowledge → Just respond
+
+Use \`callSubAgent\` for a single sub-agent, \`callSubAgents\` for multiple parallel sub-agents.
+
+**Example scenarios:**
+- User asks about best restaurants in a city → \`callSubAgent\` (needs current info from reviews, searches)
+- User wants research on a topic → \`callSubAgent\` (multi-step: search, read, analyze, summarize)
+- User asks to compare products/services → \`callSubAgent\` (needs data from multiple sources)
+- User asks a factual question you know → Just answer directly
+- User wants multiple independent analyses → \`callSubAgents\` (parallel execution)
+</sub_agents>
+${isDesktop ? runInClientSection : ''}`;
+
+const planTodoSection = `
+<plan_and_todos>
+You have **plan and todo management** tools to organize multi-step work over time.
+
+- **Plan**: A high-level strategic document describing goals, context, and overall direction. Plans do NOT contain actionable steps - they define the "what" and "why". **Plans should be stable once created** - they represent the overarching objective that rarely changes.
+- **Todo**: The concrete execution list with actionable items. Todos define the "how" - specific tasks to accomplish the plan. **Todos are dynamic** - they can be added, updated, completed, and removed as work progresses.
+
+**Planning Tools** - For high-level goal documentation:
+- \`createPlan\`: Create a strategic plan document. **Required params: goal, description (brief summary), context** - all three must be provided
+- \`updatePlan\`: Update plan details (only planId is required)
+
+**Todo Tools** - For actionable execution items:
+- \`createTodos\`: Create new todo items from text array
+- \`updateTodos\`: Batch update todos (add, update, remove, complete, processing operations)
+- \`clearTodos\`: Clear completed or all items
+
+**Todo Status Workflow:** todo → processing → completed (use "processing" when actively working on an item)
+
+<default_workflow>
+**CRITICAL: Most tasks do NOT need plan/todo tools. Only use them for complex, multi-step projects.**
+
+**DO NOT use plan/todo tools for:**
+- Simple one-step tasks (rename a file, send a message, search something)
+- Quick questions or lookups
+- Tasks that can be completed immediately with a single action
+- Any request that doesn't require tracking progress over time
+
+**ONLY use plan/todo tools when ALL of these are true:**
+1. The task has multiple distinct steps that need tracking
+2. The user explicitly wants to plan or organize something
+3. Progress needs to be tracked over time (not completed in one response)
+
+**When plan/todo tools ARE appropriate:**
+1. **First**, use \`createPlan\` to document the goal and relevant context
+2. **Then**, use \`createTodos\` to break down the plan into actionable steps
+
+**Examples:**
+- ❌ "Rename this file" → Just do it, no plan/todo needed
+- ❌ "What's the weather?" → Just answer, no plan/todo needed
+- ❌ "Help me write an email" → Just write it, no plan/todo needed
+- ✅ "Help me plan a trip to Japan" → Use createPlan + createTodos
+- ✅ "I want to learn Python, create a study plan" → Use createPlan + createTodos
+- ✅ "Help me organize my project tasks" → Use createTodos (user explicitly wants organization)
+</default_workflow>
+
+<when_to_use>
+**Use Plans when:**
+- User explicitly asks to "plan", "organize", or "break down" a complex goal
+- The project spans multiple sessions or days
+- There's significant context, constraints, or background worth documenting
+- The task has 5+ distinct steps that benefit from strategic organization
+
+**Use Todos when:**
+- Breaking down a plan into actionable steps (after creating a plan)
+- User explicitly requests a checklist or task list
+- Tracking progress on a multi-step project
+
+**DO NOT use Plans/Todos when:**
+- The task can be done in one action (rename, delete, send, search, etc.)
+- The user just wants something done, not organized
+- The task will be completed in this single conversation
+- The user wants a task to repeat automatically on a schedule (daily/weekly/hourly) — use **lobe-cron** instead. Keywords like "daily task", "routine", "recurring", "every day/morning/week", "set as daily", "make it regular" all indicate scheduled automation, not plan/todo management.
+</when_to_use>
+
+<best_practices>
+- **Plan first, then todos**: Always start with a plan unless explicitly told otherwise
+- **Separate concerns**: Plans describe goals; Todos list actions
+- **Actionable todos**: Each todo should be a concrete, completable task
+- **Context in plans**: Use plan's context field to capture constraints and background
+- **Regular cleanup**: Clear completed todos to keep the list focused
+- **Track progress**: Use todo completion to measure plan progress
+</best_practices>
+
+<updateTodos_usage>
+When using \`updateTodos\`, each operation type requires specific fields:
+
+**Todo Status:**
+- \`todo\`: Not started yet
+- \`processing\`: Currently in progress
+- \`completed\`: Done
+
+**Minimal required fields per operation type:**
+- \`{ "type": "add", "text": "todo text" }\` - only type + text
+- \`{ "type": "complete", "index": 0 }\` - only type + index (marks as completed)
+- \`{ "type": "processing", "index": 0 }\` - only type + index (marks as in progress)
+- \`{ "type": "remove", "index": 0 }\` - only type + index
+- \`{ "type": "update", "index": 0, "newText": "..." }\` - type + index + optional newText/status
+
+**Example - mark item 0 as processing, item 1 as complete:**
+\`\`\`json
+{
+ "operations": [
+ { "type": "processing", "index": 0 },
+ { "type": "complete", "index": 1 }
+ ]
+}
+\`\`\`
+
+**DO NOT** add extra fields like \`"status": "completed"\` for complete/processing operations - they are ignored.
+</updateTodos_usage>
+
+<todo_granularity>
+**IMPORTANT: Keep todos focused on major stages, not detailed sub-tasks.**
+
+- **Limit to 5-10 items**: A todo list should contain around 5-10 major milestones or stages, not 20+ detailed tasks.
+- **Think in phases**: Group related tasks into higher-level stages (e.g., "Plan itinerary" instead of listing every city separately).
+- **Use hierarchical numbering** when more detail is needed: Use "1.", "2.", "2.1", "2.2", "3." format to show parent-child relationships.
+
+**Good example** (Japan trip - 7 items, stage-focused):
+- 1. Determine travel dates and duration
+- 2. Handle visa and documentation
+- 3. Book flights and accommodation
+- 4. Plan city itineraries
+- 5. Arrange local transportation
+- 6. Prepare for departure
+- 7. Final confirmation before trip
+
+**Bad example** (20+ detailed items):
+- Book Tokyo hotel
+- Book Kyoto hotel
+- Book Osaka hotel
+- Buy Suica card
+- Download Google Maps
+- Download translation app
+- ... (too granular!)
+</todo_granularity>
+
+<plan_stability>
+**IMPORTANT: Plans should remain stable once created. Each conversation has only ONE plan.**
+
+- **Do NOT update plans** when details change (dates, locations, preferences). Instead, update the todos to reflect new information.
+- **Only use updatePlan** when the user's goal fundamentally changes (e.g., destination changes from Japan to Korea).
+- When user provides more specific information (like exact dates or preferences), **update or add todos** - not the plan.
+</plan_stability>
+
+<response_format>
+When working with plan/todo tools:
+- Confirm actions: "Created plan: [goal]" or "Added [n] todo items"
+- Show progress: "Completed [n] items, [m] remaining"
+- Be concise: Brief confirmations, not verbose explanations
+- **NEVER repeat the todo list in your response** - Users can already see the todos in the UI component. Do not list or enumerate the todo items in your text output.
+</response_format>
+</plan_and_todos>
+`;
+
+export const systemPrompt = `Use Lobe Agent capabilities only when the active model needs built-in assistance. Prefer the active model's native capabilities whenever they are sufficient. Follow each tool's description and schema, and use tool results to answer the user directly.
+${planTodoSection}
+${subAgentSection}`;
diff --git a/packages/builtin-tool-lobe-agent/src/types.ts b/packages/builtin-tool-lobe-agent/src/types.ts
index e817334182c..f542af40ff0 100644
--- a/packages/builtin-tool-lobe-agent/src/types.ts
+++ b/packages/builtin-tool-lobe-agent/src/types.ts
@@ -2,6 +2,13 @@ export const LobeAgentIdentifier = 'lobe-agent';
export const LobeAgentApiName = {
analyzeVisualMedia: 'analyzeVisualMedia',
+ callSubAgent: 'callSubAgent',
+ callSubAgents: 'callSubAgents',
+ clearTodos: 'clearTodos',
+ createPlan: 'createPlan',
+ createTodos: 'createTodos',
+ updatePlan: 'updatePlan',
+ updateTodos: 'updateTodos',
} as const;
export type LobeAgentApiNameType = (typeof LobeAgentApiName)[keyof typeof LobeAgentApiName];
@@ -11,3 +18,276 @@ export interface AnalyzeVisualMediaParams {
refs?: string[];
urls?: string[];
}
+
+// ==================== Sub-Agent Tasks ====================
+
+/**
+ * Single sub-agent task definition.
+ *
+ * A sub-agent is a long-running, isolated execution that runs in its own
+ * context (server or desktop client) and reports back to the parent
+ * conversation when it finishes.
+ */
+export interface SubAgentTask {
+ /** Brief description of what this sub-agent does (shown in UI) */
+ description: string;
+ /** Whether to inherit context messages from parent conversation */
+ inheritMessages?: boolean;
+ /** Detailed instruction/prompt for the sub-agent execution */
+ instruction: string;
+ /**
+ * Whether to execute the sub-agent on the client side (desktop only).
+ * When true and running on desktop, the sub-agent runs locally with
+ * access to local tools (file system, shell commands, etc.).
+ *
+ * MUST be true when the sub-agent requires local-system tools.
+ */
+ runInClient?: boolean;
+ /** Timeout in milliseconds (optional, default 30 minutes) */
+ timeout?: number;
+}
+
+/**
+ * Parameters for callSubAgent API
+ * Dispatch a single sub-agent.
+ */
+export interface CallSubAgentParams {
+ description: string;
+ inheritMessages?: boolean;
+ instruction: string;
+ runInClient?: boolean;
+ timeout?: number;
+}
+
+/**
+ * Parameters for callSubAgents API
+ * Dispatch one or more sub-agents in parallel.
+ */
+export interface CallSubAgentsParams {
+ tasks: SubAgentTask[];
+}
+
+/**
+ * State returned after dispatching a server-side sub-agent.
+ *
+ * The `type` value is the wire-level discriminator the `agent-runtime`
+ * layer (`GeneralChatAgent.tool_result`) inspects to emit the matching
+ * `exec_sub_agent` / `exec_client_sub_agent` instruction.
+ */
+export interface CallSubAgentState {
+ parentMessageId: string;
+ task: SubAgentTask;
+ type: 'execSubAgent';
+}
+
+/** State returned after dispatching multiple server-side sub-agents. */
+export interface CallSubAgentsState {
+ parentMessageId: string;
+ tasks: SubAgentTask[];
+ type: 'execSubAgents';
+}
+
+/** State returned after dispatching a desktop-only client-side sub-agent. */
+export interface CallClientSubAgentState {
+ parentMessageId: string;
+ task: SubAgentTask;
+ type: 'execClientSubAgent';
+}
+
+/** State returned after dispatching multiple desktop-only client-side sub-agents. */
+export interface CallClientSubAgentsState {
+ parentMessageId: string;
+ tasks: SubAgentTask[];
+ type: 'execClientSubAgents';
+}
+
+// ==================== Todo Item ====================
+
+/** Status of a todo item */
+export type TodoStatus = 'todo' | 'processing' | 'completed';
+
+export interface TodoItem {
+ /** Status of the todo item */
+ status: TodoStatus;
+ /** The todo item text */
+ text: string;
+}
+
+/** Get the next status in the cycle: todo → processing → completed → todo */
+export const getNextTodoStatus = (current: TodoStatus): TodoStatus => {
+ const cycle: TodoStatus[] = ['todo', 'processing', 'completed'];
+ const index = cycle.indexOf(current);
+ return cycle[(index + 1) % cycle.length];
+};
+
+export interface TodoList {
+ items: TodoItem[];
+ updatedAt: string;
+}
+
+/** Alias for TodoList, used for state storage in Plan metadata */
+export type TodoState = TodoList;
+
+// ==================== Todo Params ====================
+
+/**
+ * Create new todo items
+ * - AI input: { adds: string[] } - array of text strings from AI
+ * - After user edit: { items: TodoItem[] } - saved format with TodoItem objects
+ */
+export interface CreateTodosParams {
+ /** Array of text strings from AI */
+ adds?: string[];
+ /** Array of TodoItem objects (saved format after user edit) */
+ items?: TodoItem[];
+}
+
+/**
+ * Update operation types for batch updates
+ */
+export type TodoUpdateOperationType = 'add' | 'update' | 'remove' | 'complete' | 'processing';
+
+/**
+ * Single update operation
+ */
+export interface TodoUpdateOperation {
+ /** For 'update', 'remove', 'complete', 'processing': the index of the item (0-based) */
+ index?: number;
+ /** For 'update': the new text */
+ newText?: string;
+ /** For 'update': the new status */
+ status?: TodoStatus;
+ /** For 'add': the text to add */
+ text?: string;
+ /** Operation type */
+ type: TodoUpdateOperationType;
+}
+
+/**
+ * Update todo list with batch operations
+ * Supports: add, update, remove, complete, processing
+ */
+export interface UpdateTodosParams {
+ /** Array of update operations to apply */
+ operations: TodoUpdateOperation[];
+}
+
+/**
+ * Clear todo items
+ */
+export interface ClearTodosParams {
+ /** Clear mode: 'completed' only clears done items, 'all' clears everything */
+ mode: 'completed' | 'all';
+}
+
+// ==================== Todo State Types for Render ====================
+
+export interface CreateTodosState {
+ /** Items that were created */
+ createdItems: string[];
+ /** Current todo list after creation */
+ todos: TodoList;
+}
+
+export interface UpdateTodosState {
+ /** Operations that were applied */
+ appliedOperations: TodoUpdateOperation[];
+ /** Current todo list after update */
+ todos: TodoList;
+}
+
+export interface CompleteTodosState {
+ /** Indices that were completed */
+ completedIndices: number[];
+ /** Current todo list after completion */
+ todos: TodoList;
+}
+
+export interface RemoveTodosState {
+ /** Indices that were removed */
+ removedIndices: number[];
+ /** Current todo list after removal */
+ todos: TodoList;
+}
+
+export interface ClearTodosState {
+ /** Number of items cleared */
+ clearedCount: number;
+ /** Mode used for clearing */
+ mode: 'completed' | 'all';
+ /** Current todo list after clearing */
+ todos: TodoList;
+}
+
+// ==================== Planning Params ====================
+
+/**
+ * Create a high-level plan document
+ * Plans define the strategic direction (what and why), not actionable steps
+ *
+ * Field mapping to Document:
+ * - goal -> document.title
+ * - description -> document.description
+ * - context -> document.content
+ */
+export interface CreatePlanParams {
+ /** Detailed context, background, constraints (maps to document.content) */
+ context?: string;
+ /** Brief summary of the plan (maps to document.description) */
+ description: string;
+ /** The main goal or objective to achieve (maps to document.title) */
+ goal: string;
+}
+
+export interface UpdatePlanParams {
+ /** Mark plan as completed */
+ completed?: boolean;
+ /** Updated context (maps to document.content) */
+ context?: string;
+ /** Updated description (maps to document.description) */
+ description?: string;
+ /** Updated goal (maps to document.title) */
+ goal?: string;
+ /** Plan ID to update */
+ planId: string;
+}
+
+// ==================== Plan Result Types ====================
+
+/**
+ * A high-level plan document
+ * Contains goal and context, but no steps (steps are managed via Todos)
+ *
+ * Field mapping to Document:
+ * - goal -> document.title
+ * - description -> document.description
+ * - context -> document.content
+ */
+export interface Plan {
+ /** Whether the plan is completed */
+ completed: boolean;
+ /** Detailed context, background, constraints (maps to document.content) */
+ context?: string;
+ /** Creation timestamp */
+ createdAt: string;
+ /** Brief summary of the plan (maps to document.description) */
+ description: string;
+ /** The main goal or objective (maps to document.title) */
+ goal: string;
+ /** Unique plan identifier */
+ id: string;
+ /** Last update timestamp */
+ updatedAt: string;
+}
+
+// ==================== Plan State Types for Render ====================
+
+export interface CreatePlanState {
+ /** The created plan document */
+ plan: Plan;
+}
+
+export interface UpdatePlanState {
+ /** The updated plan document */
+ plan: Plan;
+}
diff --git a/packages/builtin-tools/package.json b/packages/builtin-tools/package.json
index 8180a601e08..d82e6eb99a8 100644
--- a/packages/builtin-tools/package.json
+++ b/packages/builtin-tools/package.json
@@ -27,7 +27,6 @@
"@lobechat/builtin-tool-creds": "workspace:*",
"@lobechat/builtin-tool-group-agent-builder": "workspace:*",
"@lobechat/builtin-tool-group-management": "workspace:*",
- "@lobechat/builtin-tool-gtd": "workspace:*",
"@lobechat/builtin-tool-knowledge-base": "workspace:*",
"@lobechat/builtin-tool-lobe-agent": "workspace:*",
"@lobechat/builtin-tool-local-system": "workspace:*",
diff --git a/packages/builtin-tools/src/identifiers.ts b/packages/builtin-tools/src/identifiers.ts
index c01e0f6c253..f6a6d3c8621 100644
--- a/packages/builtin-tools/src/identifiers.ts
+++ b/packages/builtin-tools/src/identifiers.ts
@@ -7,7 +7,6 @@ import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
import { CredsManifest } from '@lobechat/builtin-tool-creds';
import { GroupAgentBuilderManifest } from '@lobechat/builtin-tool-group-agent-builder';
import { GroupManagementManifest } from '@lobechat/builtin-tool-group-management';
-import { GTDManifest } from '@lobechat/builtin-tool-gtd';
import { KnowledgeBaseManifest } from '@lobechat/builtin-tool-knowledge-base';
import { LobeAgentManifest } from '@lobechat/builtin-tool-lobe-agent';
import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
@@ -31,7 +30,6 @@ export const builtinToolIdentifiers: string[] = [
CredsManifest.identifier,
GroupAgentBuilderManifest.identifier,
GroupManagementManifest.identifier,
- GTDManifest.identifier,
KnowledgeBaseManifest.identifier,
LocalSystemManifest.identifier,
MemoryManifest.identifier,
diff --git a/packages/builtin-tools/src/index.ts b/packages/builtin-tools/src/index.ts
index 2312b694ddb..16675f89820 100644
--- a/packages/builtin-tools/src/index.ts
+++ b/packages/builtin-tools/src/index.ts
@@ -8,7 +8,6 @@ import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
import { CredsManifest } from '@lobechat/builtin-tool-creds';
import { GroupAgentBuilderManifest } from '@lobechat/builtin-tool-group-agent-builder';
import { GroupManagementManifest } from '@lobechat/builtin-tool-group-management';
-import { GTDManifest } from '@lobechat/builtin-tool-gtd';
import { KnowledgeBaseManifest } from '@lobechat/builtin-tool-knowledge-base';
import { LobeAgentManifest } from '@lobechat/builtin-tool-lobe-agent';
import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
@@ -43,7 +42,6 @@ export const defaultToolIds = [
CloudSandboxManifest.identifier,
TopicReferenceManifest.identifier,
AgentDocumentsManifest.identifier,
- GTDManifest.identifier,
TaskManifest.identifier,
LobeAgentManifest.identifier,
];
@@ -202,11 +200,6 @@ export const builtinTools: LobeBuiltinTool[] = [
manifest: AgentManagementManifest,
type: 'builtin',
},
- {
- identifier: GTDManifest.identifier,
- manifest: GTDManifest,
- type: 'builtin',
- },
{
identifier: CalculatorManifest.identifier,
manifest: CalculatorManifest,
diff --git a/packages/builtin-tools/src/inspectors.ts b/packages/builtin-tools/src/inspectors.ts
index d5b836330db..65a3a3c3326 100644
--- a/packages/builtin-tools/src/inspectors.ts
+++ b/packages/builtin-tools/src/inspectors.ts
@@ -30,11 +30,11 @@ import {
GroupManagementInspectors,
GroupManagementManifest,
} from '@lobechat/builtin-tool-group-management/client';
-import { GTDInspectors, GTDManifest } from '@lobechat/builtin-tool-gtd/client';
import {
KnowledgeBaseInspectors,
KnowledgeBaseManifest,
} from '@lobechat/builtin-tool-knowledge-base/client';
+import { LobeAgentInspectors, LobeAgentManifest } from '@lobechat/builtin-tool-lobe-agent/client';
import {
LocalSystemInspectors,
LocalSystemManifest,
@@ -86,8 +86,8 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =
string,
BuiltinInspector
>,
- [GTDManifest.identifier]: GTDInspectors as Record<string, BuiltinInspector>,
[KnowledgeBaseManifest.identifier]: KnowledgeBaseInspectors as Record<string, BuiltinInspector>,
+ [LobeAgentManifest.identifier]: LobeAgentInspectors as Record<string, BuiltinInspector>,
[LocalSystemManifest.identifier]: LocalSystemInspectors as Record<string, BuiltinInspector>,
[MemoryManifest.identifier]: MemoryInspectors as Record<string, BuiltinInspector>,
[MessageManifest.identifier]: MessageInspectors as Record<string, BuiltinInspector>,
diff --git a/packages/builtin-tools/src/interventions.ts b/packages/builtin-tools/src/interventions.ts
index 02849876aa0..1cc15d5c6ce 100644
--- a/packages/builtin-tools/src/interventions.ts
+++ b/packages/builtin-tools/src/interventions.ts
@@ -12,7 +12,10 @@ import {
GroupManagementInterventions,
GroupManagementManifest,
} from '@lobechat/builtin-tool-group-management/client';
-import { GTDInterventions, GTDManifest } from '@lobechat/builtin-tool-gtd/client';
+import {
+ LobeAgentInterventions,
+ LobeAgentManifest,
+} from '@lobechat/builtin-tool-lobe-agent/client';
import {
LocalSystemIdentifier,
LocalSystemInterventions,
@@ -39,7 +42,7 @@ export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
[ClaudeCodeIdentifier]: ClaudeCodeInterventions,
[CloudSandboxManifest.identifier]: CloudSandboxInterventions,
[GroupManagementManifest.identifier]: GroupManagementInterventions,
- [GTDManifest.identifier]: GTDInterventions,
+ [LobeAgentManifest.identifier]: LobeAgentInterventions,
[LocalSystemIdentifier]: LocalSystemInterventions,
[MemoryManifest.identifier]: MemoryInterventions,
[MessageManifest.identifier]: MessageInterventions,
diff --git a/packages/builtin-tools/src/renders.ts b/packages/builtin-tools/src/renders.ts
index 1cafb669e05..4d7844a777c 100644
--- a/packages/builtin-tools/src/renders.ts
+++ b/packages/builtin-tools/src/renders.ts
@@ -15,11 +15,11 @@ import { GroupAgentBuilderManifest } from '@lobechat/builtin-tool-group-agent-bu
import { GroupAgentBuilderRenders } from '@lobechat/builtin-tool-group-agent-builder/client';
import { GroupManagementManifest } from '@lobechat/builtin-tool-group-management';
import { GroupManagementRenders } from '@lobechat/builtin-tool-group-management/client';
-import { GTDManifest, GTDRenders } from '@lobechat/builtin-tool-gtd/client';
import {
KnowledgeBaseManifest,
KnowledgeBaseRenders,
} from '@lobechat/builtin-tool-knowledge-base/client';
+import { LobeAgentManifest, LobeAgentRenders } from '@lobechat/builtin-tool-lobe-agent/client';
import {
LocalSystemManifest,
LocalSystemRenders,
@@ -63,8 +63,8 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
[CloudSandboxManifest.identifier]: CloudSandboxRenders as Record<string, BuiltinRender>,
[GroupAgentBuilderManifest.identifier]: GroupAgentBuilderRenders as Record<string, BuiltinRender>,
[GroupManagementManifest.identifier]: GroupManagementRenders as Record<string, BuiltinRender>,
- [GTDManifest.identifier]: GTDRenders as Record<string, BuiltinRender>,
[KnowledgeBaseManifest.identifier]: KnowledgeBaseRenders as Record<string, BuiltinRender>,
+ [LobeAgentManifest.identifier]: LobeAgentRenders as Record<string, BuiltinRender>,
[LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,
[MemoryManifest.identifier]: MemoryRenders as Record<string, BuiltinRender>,
[MessageManifest.identifier]: MessageRenders as Record<string, BuiltinRender>,
diff --git a/packages/builtin-tools/src/streamings.ts b/packages/builtin-tools/src/streamings.ts
index a83909f3063..a4df8d6368f 100644
--- a/packages/builtin-tools/src/streamings.ts
+++ b/packages/builtin-tools/src/streamings.ts
@@ -26,7 +26,7 @@ import {
GroupManagementManifest,
GroupManagementStreamings,
} from '@lobechat/builtin-tool-group-management/client';
-import { GTDManifest, GTDStreamings } from '@lobechat/builtin-tool-gtd/client';
+import { LobeAgentManifest, LobeAgentStreamings } from '@lobechat/builtin-tool-lobe-agent/client';
import {
LocalSystemManifest,
LocalSystemStreamings,
@@ -60,7 +60,7 @@ const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> =
string,
BuiltinStreaming
>,
- [GTDManifest.identifier]: GTDStreamings as Record<string, BuiltinStreaming>,
+ [LobeAgentManifest.identifier]: LobeAgentStreamings as Record<string, BuiltinStreaming>,
[LocalSystemManifest.identifier]: LocalSystemStreamings as Record<string, BuiltinStreaming>,
[MemoryManifest.identifier]: MemoryStreamings as Record<string, BuiltinStreaming>,
[MessageManifest.identifier]: MessageStreamings as Record<string, BuiltinStreaming>,
diff --git a/packages/const/src/recommendedSkill.ts b/packages/const/src/recommendedSkill.ts
index 2fddea5ca9b..a80d9638bb3 100644
--- a/packages/const/src/recommendedSkill.ts
+++ b/packages/const/src/recommendedSkill.ts
@@ -14,7 +14,6 @@ export const RECOMMENDED_SKILLS: RecommendedSkillItem[] = [
{ id: 'lobe-artifacts', type: RecommendedSkillType.Builtin },
{ id: 'lobe-user-memory', type: RecommendedSkillType.Builtin },
{ id: 'lobe-cloud-sandbox', type: RecommendedSkillType.Builtin },
- { id: 'lobe-gtd', type: RecommendedSkillType.Builtin },
{ id: 'lobe-task', type: RecommendedSkillType.Builtin },
{ id: 'lobe-agent-documents', type: RecommendedSkillType.Builtin },
{ id: 'lobe-message', type: RecommendedSkillType.Builtin },
diff --git a/packages/context-engine/src/engine/messages/MessagesEngine.ts b/packages/context-engine/src/engine/messages/MessagesEngine.ts
index 44b41bf7094..f63e1835e0c 100644
--- a/packages/context-engine/src/engine/messages/MessagesEngine.ts
+++ b/packages/context-engine/src/engine/messages/MessagesEngine.ts
@@ -37,8 +37,6 @@ import {
ForceFinishSummaryInjector,
GroupAgentBuilderContextInjector,
GroupContextInjector,
- GTDPlanInjector,
- GTDTodoInjector,
HistorySummaryProvider,
KnowledgeInjector,
LocalSystemToolSnapshotInjector,
@@ -47,11 +45,13 @@ import {
OnboardingSyntheticStateInjector,
PageEditorContextInjector,
PageSelectionsInjector,
+ PlanInjector,
SelectedSkillInjector,
SkillContextProvider,
SystemDateProvider,
SystemRoleInjector,
TaskManagerContextInjector,
+ TodoInjector,
ToolDiscoveryProvider,
ToolSystemRoleProvider,
TopicReferenceContextInjector,
@@ -162,7 +162,7 @@ export class MessagesEngine {
groupAgentBuilderContext,
agentGroup,
agentDocuments,
- gtd,
+ planTodo,
userMemory,
initialContext,
stepContext,
@@ -187,9 +187,9 @@ export class MessagesEngine {
// Page editor is enabled if either direct pageContentContext or initialContext.pageEditor is provided
const isPageEditorEnabled = !!pageContentContext || !!initialContext?.pageEditor;
const hasActiveTopicDocument = !!initialContext?.activeTopicDocument;
- // GTD is enabled if gtd.enabled is true and either plan or todos is provided
- const isGTDPlanEnabled = gtd?.enabled && gtd?.plan;
- const isGTDTodoEnabled = gtd?.enabled && gtd?.todos;
+ // Plan/Todo is enabled if planTodo.enabled is true and either plan or todos is provided
+ const isPlanEnabled = planTodo?.enabled && planTodo?.plan;
+ const isTodoEnabled = planTodo?.enabled && planTodo?.todos;
// System date is redundant when web-browsing or memory tools are enabled,
// as they already include current date in their system prompts
@@ -276,8 +276,8 @@ export class MessagesEngine {
}),
// Discord context (channel/guild info)
new DiscordContextProvider({ context: discordContext, enabled: !!discordContext }),
- // GTD Plan
- new GTDPlanInjector({ enabled: !!isGTDPlanEnabled, plan: gtd?.plan }),
+ // Plan (high-level plan document)
+ new PlanInjector({ enabled: !!isPlanEnabled, plan: planTodo?.plan }),
// Knowledge (agent files + knowledge bases)
new KnowledgeInjector({
fileContents: knowledge?.fileContents,
@@ -354,8 +354,8 @@ export class MessagesEngine {
contextPrompt: initialContext?.taskManager?.contextPrompt,
enabled: !!initialContext?.taskManager?.contextPrompt,
}),
- // GTD Todo (at end of last user message)
- new GTDTodoInjector({ enabled: !!isGTDTodoEnabled, todos: gtd?.todos }),
+ // Todo list (at end of last user message)
+ new TodoInjector({ enabled: !!isTodoEnabled, todos: planTodo?.todos }),
// Topic Reference context (referenced topic summaries to last user message)
new TopicReferenceContextInjector({
enabled: !!(topicReferences && topicReferences.length > 0),
diff --git a/packages/context-engine/src/engine/messages/index.ts b/packages/context-engine/src/engine/messages/index.ts
index f2af6187b88..8d801169142 100644
--- a/packages/context-engine/src/engine/messages/index.ts
+++ b/packages/context-engine/src/engine/messages/index.ts
@@ -5,16 +5,16 @@ export type {
AgentInfo,
FileContent,
FileContextConfig,
- GTDConfig,
- GTDPlan,
- GTDTodoItem,
- GTDTodoList,
KnowledgeBaseInfo,
KnowledgeConfig,
MessagesEngineParams,
MessagesEngineResult,
ModelCapabilityChecker,
OpenAIChatMessage,
+ Plan,
+ PlanTodoConfig,
+ TodoItem,
+ TodoList,
ToolDiscoveryConfig,
ToolDiscoveryMeta,
ToolsConfig,
diff --git a/packages/context-engine/src/engine/messages/types.ts b/packages/context-engine/src/engine/messages/types.ts
index b225644d62c..6f1636486fa 100644
--- a/packages/context-engine/src/engine/messages/types.ts
+++ b/packages/context-engine/src/engine/messages/types.ts
@@ -18,10 +18,10 @@ import type { DiscordContext } from '../../providers/DiscordContextProvider';
import type { EvalContext } from '../../providers/EvalContextSystemInjector';
import type { GroupAgentBuilderContext } from '../../providers/GroupAgentBuilderContextInjector';
import type { GroupMemberInfo } from '../../providers/GroupContextInjector';
-import type { GTDPlan } from '../../providers/GTDPlanInjector';
-import type { GTDTodoList } from '../../providers/GTDTodoInjector';
import type { OnboardingContext } from '../../providers/OnboardingContextInjector';
+import type { Plan } from '../../providers/PlanInjector';
import type { SkillMeta } from '../../providers/SkillContextProvider';
+import type { TodoList } from '../../providers/TodoInjector';
import type { ToolDiscoveryMeta } from '../../providers/ToolDiscoveryProvider';
import type { TopicReferenceItem } from '../../providers/TopicReferenceContextInjector';
import type { PipelineContextMetadata } from '../../types';
@@ -192,16 +192,16 @@ export interface AgentGroupConfig {
}
/**
- * GTD (Getting Things Done) configuration
+ * Plan + Todo configuration
* Used to inject plan and todo context for task management
*/
-export interface GTDConfig {
- /** Whether GTD context injection is enabled */
+export interface PlanTodoConfig {
+ /** Whether plan/todo context injection is enabled */
enabled?: boolean;
/** The current plan to inject (injected before first user message) */
- plan?: GTDPlan;
+ plan?: Plan;
/** The current todo list to inject (injected at end of last user message) */
- todos?: GTDTodoList;
+ todos?: TodoList;
}
/**
@@ -287,8 +287,8 @@ export interface MessagesEngineParams {
agentGroup?: AgentGroupConfig;
/** Group Agent Builder context */
groupAgentBuilderContext?: GroupAgentBuilderContext;
- /** GTD (Getting Things Done) configuration */
- gtd?: GTDConfig;
+ /** Plan + Todo configuration */
+ planTodo?: PlanTodoConfig;
/** Reaction feedback configuration */
reactionFeedback?: {
enabled?: boolean;
@@ -346,9 +346,9 @@ export { type BotPlatformContext } from '../../providers/BotPlatformContextInjec
export { type DiscordContext } from '../../providers/DiscordContextProvider';
export { type EvalContext } from '../../providers/EvalContextSystemInjector';
export { type GroupAgentBuilderContext } from '../../providers/GroupAgentBuilderContextInjector';
-export { type GTDPlan } from '../../providers/GTDPlanInjector';
-export { type GTDTodoItem, type GTDTodoList } from '../../providers/GTDTodoInjector';
+export { type Plan } from '../../providers/PlanInjector';
export { type SkillMeta } from '../../providers/SkillContextProvider';
+export { type TodoItem, type TodoList } from '../../providers/TodoInjector';
export { type ToolDiscoveryMeta } from '../../providers/ToolDiscoveryProvider';
export { type TopicReferenceItem } from '../../providers/TopicReferenceContextInjector';
export { type OpenAIChatMessage, type UIChatMessage } from '@/types/index';
diff --git a/packages/context-engine/src/engine/tools/ToolArgumentsRepairer.ts b/packages/context-engine/src/engine/tools/ToolArgumentsRepairer.ts
index 8c3a6160ab3..81c1ee5fce3 100644
--- a/packages/context-engine/src/engine/tools/ToolArgumentsRepairer.ts
+++ b/packages/context-engine/src/engine/tools/ToolArgumentsRepairer.ts
@@ -50,7 +50,7 @@ const safeParseJSON = <T = Record<string, unknown>>(text?: string): T | undefine
* @example Usage:
* ```typescript
* const repairer = new ToolArgumentsRepairer(manifest);
- * const args = repairer.parse('execTask', argumentsString);
+ * const args = repairer.parse('callSubAgent', argumentsString);
* ```
*/
export class ToolArgumentsRepairer {
diff --git a/packages/context-engine/src/engine/tools/__tests__/ToolArgumentsRepairer.test.ts b/packages/context-engine/src/engine/tools/__tests__/ToolArgumentsRepairer.test.ts
index 3d9c149b9c7..8913205042f 100644
--- a/packages/context-engine/src/engine/tools/__tests__/ToolArgumentsRepairer.test.ts
+++ b/packages/context-engine/src/engine/tools/__tests__/ToolArgumentsRepairer.test.ts
@@ -103,11 +103,11 @@ describe('ToolArgumentsRepairer', () => {
describe('parse - integrated parsing and repair', () => {
it('should parse and repair arguments using manifest schema', () => {
const manifest: LobeToolManifest = {
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
api: [
{
- name: 'execTask',
- description: 'Execute async task',
+ name: 'callSubAgent',
+ description: 'Dispatch a sub-agent',
parameters: {
type: 'object',
required: ['description', 'instruction'],
@@ -131,7 +131,7 @@ describe('ToolArgumentsRepairer', () => {
'Test task", "instruction": "Do something important", "runInClient": true, "timeout": 60000}',
});
- const result = repairer.parse('execTask', malformedArguments);
+ const result = repairer.parse('callSubAgent', malformedArguments);
expect(result).toHaveProperty('description', 'Test task');
expect(result).toHaveProperty('instruction', 'Do something important');
diff --git a/packages/context-engine/src/providers/GTDPlanInjector.ts b/packages/context-engine/src/providers/PlanInjector.ts
similarity index 66%
rename from packages/context-engine/src/providers/GTDPlanInjector.ts
rename to packages/context-engine/src/providers/PlanInjector.ts
index 7c5d0ea2bc2..a375906d6e2 100644
--- a/packages/context-engine/src/providers/GTDPlanInjector.ts
+++ b/packages/context-engine/src/providers/PlanInjector.ts
@@ -5,18 +5,18 @@ import type { PipelineContext, ProcessorOptions } from '../types';
declare module '../types' {
interface PipelineContextMetadataOverrides {
- gtdPlanId?: string;
- gtdPlanInjected?: boolean;
+ planId?: string;
+ planInjected?: boolean;
}
}
-const log = debug('context-engine:provider:GTDPlanInjector');
+const log = debug('context-engine:provider:PlanInjector');
/**
- * GTD Plan data structure
+ * Plan data structure
* Represents a high-level plan document
*/
-export interface GTDPlan {
+export interface Plan {
/** Whether the plan is completed */
completed: boolean;
/** Detailed context, background, constraints */
@@ -33,18 +33,18 @@ export interface GTDPlan {
updatedAt: string;
}
-export interface GTDPlanInjectorConfig {
- /** Whether GTD Plan injection is enabled */
+export interface PlanInjectorConfig {
+ /** Whether Plan injection is enabled */
enabled?: boolean;
/** The current plan to inject */
- plan?: GTDPlan;
+ plan?: Plan;
}
/**
- * Format GTD Plan content for injection
+ * Format Plan content for injection
*/
-function formatGTDPlan(plan: GTDPlan): string {
- const lines: string[] = ['<gtd_plan>', `<goal>${plan.goal}</goal>`];
+function formatPlan(plan: Plan): string {
+ const lines: string[] = ['<plan>', `<goal>${plan.goal}</goal>`];
if (plan.description) {
lines.push(`<description>${plan.description}</description>`);
@@ -55,21 +55,21 @@ function formatGTDPlan(plan: GTDPlan): string {
}
lines.push(`<status>${plan.completed ? 'completed' : 'in_progress'}</status>`);
- lines.push('</gtd_plan>');
+ lines.push('</plan>');
return lines.join('\n');
}
/**
- * GTD Plan Injector
+ * Plan Injector
* Responsible for injecting the current plan into context before the first user message
* This provides the AI with awareness of the user's current goal and plan context
*/
-export class GTDPlanInjector extends BaseFirstUserContentProvider {
- readonly name = 'GTDPlanInjector';
+export class PlanInjector extends BaseFirstUserContentProvider {
+ readonly name = 'PlanInjector';
constructor(
- private config: GTDPlanInjectorConfig,
+ private config: PlanInjectorConfig,
options: ProcessorOptions = {},
) {
super(options);
@@ -79,19 +79,18 @@ export class GTDPlanInjector extends BaseFirstUserContentProvider {
const { enabled, plan } = this.config;
if (!enabled || !plan) {
- log('GTD Plan not enabled or no plan provided');
+ log('Plan not enabled or no plan provided');
return null;
}
- // Skip if plan is completed
if (plan.completed) {
log('Plan is completed, skipping injection');
return null;
}
- const formattedContent = formatGTDPlan(plan);
+ const formattedContent = formatPlan(plan);
- log(`GTD Plan prepared: goal="${plan.goal}"`);
+ log(`Plan prepared: goal="${plan.goal}"`);
return formattedContent;
}
@@ -99,10 +98,9 @@ export class GTDPlanInjector extends BaseFirstUserContentProvider {
protected async doProcess(context: PipelineContext): Promise<PipelineContext> {
const result = await super.doProcess(context);
- // Update metadata
if (this.config.enabled && this.config.plan && !this.config.plan.completed) {
- result.metadata.gtdPlanInjected = true;
- result.metadata.gtdPlanId = this.config.plan.id;
+ result.metadata.planInjected = true;
+ result.metadata.planId = this.config.plan.id;
}
return result;
diff --git a/packages/context-engine/src/providers/GTDTodoInjector.ts b/packages/context-engine/src/providers/TodoInjector.ts
similarity index 57%
rename from packages/context-engine/src/providers/GTDTodoInjector.ts
rename to packages/context-engine/src/providers/TodoInjector.ts
index b4959081ac7..44345f42ecd 100644
--- a/packages/context-engine/src/providers/GTDTodoInjector.ts
+++ b/packages/context-engine/src/providers/TodoInjector.ts
@@ -5,54 +5,54 @@ import type { PipelineContext, ProcessorOptions } from '../types';
declare module '../types' {
interface PipelineContextMetadataOverrides {
- gtdTodoCompletedCount?: number;
- gtdTodoCount?: number;
- gtdTodoInjected?: boolean;
- gtdTodoProcessingCount?: number;
+ todoCompletedCount?: number;
+ todoCount?: number;
+ todoInjected?: boolean;
+ todoProcessingCount?: number;
}
}
-const log = debug('context-engine:provider:GTDTodoInjector');
+const log = debug('context-engine:provider:TodoInjector');
/** Status of a todo item */
-export type GTDTodoStatus = 'todo' | 'processing' | 'completed';
+export type TodoStatus = 'todo' | 'processing' | 'completed';
/**
- * GTD Todo item structure
+ * Todo item structure
*/
-export interface GTDTodoItem {
+export interface TodoItem {
/** Status of the todo item */
- status: GTDTodoStatus;
+ status: TodoStatus;
/** The todo item text */
text: string;
}
/**
- * GTD Todo list structure
+ * Todo list structure
*/
-export interface GTDTodoList {
- items: GTDTodoItem[];
+export interface TodoList {
+ items: TodoItem[];
updatedAt: string;
}
-export interface GTDTodoInjectorConfig {
- /** Whether GTD Todo injection is enabled */
+export interface TodoInjectorConfig {
+ /** Whether Todo injection is enabled */
enabled?: boolean;
/** The current todo list to inject */
- todos?: GTDTodoList;
+ todos?: TodoList;
}
/**
- * Format GTD Todo list content for injection
+ * Format Todo list content for injection
*/
-function formatGTDTodos(todos: GTDTodoList): string | null {
+function formatTodos(todos: TodoList): string | null {
const { items } = todos;
if (!items || items.length === 0) {
return null;
}
- const lines: string[] = ['<gtd_todos>'];
+ const lines: string[] = ['<todos>'];
items.forEach((item, index) => {
lines.push(`<todo index="${index}" status="${item.status}">${item.text}</todo>`);
@@ -65,21 +65,21 @@ function formatGTDTodos(todos: GTDTodoList): string | null {
`<progress completed="${completedCount}" processing="${processingCount}" total="${totalCount}" />`,
);
- lines.push('</gtd_todos>');
+ lines.push('</todos>');
return lines.join('\n');
}
/**
- * GTD Todo Injector
+ * Todo Injector
* Responsible for injecting the current todo list at the end of the last user message
* This provides the AI with real-time awareness of task progress
*/
-export class GTDTodoInjector extends BaseLastUserContentProvider {
- readonly name = 'GTDTodoInjector';
+export class TodoInjector extends BaseLastUserContentProvider {
+ readonly name = 'TodoInjector';
constructor(
- private config: GTDTodoInjectorConfig,
+ private config: TodoInjectorConfig,
options: ProcessorOptions = {},
) {
super(options);
@@ -91,16 +91,13 @@ export class GTDTodoInjector extends BaseLastUserContentProvider {
const clonedContext = this.cloneContext(context);
- // Skip if GTD Todo is not enabled or no todos
if (!this.config.enabled || !this.config.todos) {
- log('GTD Todo not enabled or no todos, skipping injection');
+ log('Todo not enabled or no todos, skipping injection');
return this.markAsExecuted(clonedContext);
}
- // Format todo list content
- const formattedContent = formatGTDTodos(this.config.todos);
+ const formattedContent = formatTodos(this.config.todos);
- // Skip if no content to inject (empty todo list)
if (!formattedContent) {
log('No todos to inject (empty list)');
return this.markAsExecuted(clonedContext);
@@ -108,7 +105,6 @@ export class GTDTodoInjector extends BaseLastUserContentProvider {
log('Formatted content length:', formattedContent.length);
- // Find the last user message index
const lastUserIndex = this.findLastUserMessageIndex(clonedContext.messages);
log('Last user message index:', lastUserIndex);
@@ -118,26 +114,23 @@ export class GTDTodoInjector extends BaseLastUserContentProvider {
return this.markAsExecuted(clonedContext);
}
- // Check if system context wrapper already exists
- // If yes, only insert context block; if no, use full wrapper
const hasExistingWrapper = this.hasExistingSystemContext(clonedContext);
const contentToAppend = hasExistingWrapper
- ? this.createContextBlock(formattedContent, 'gtd_todo_context')
- : this.wrapWithSystemContext(formattedContent, 'gtd_todo_context');
+ ? this.createContextBlock(formattedContent, 'todo_context')
+ : this.wrapWithSystemContext(formattedContent, 'todo_context');
this.appendToLastUserMessage(clonedContext, contentToAppend);
- // Update metadata
- clonedContext.metadata.gtdTodoInjected = true;
- clonedContext.metadata.gtdTodoCount = this.config.todos.items.length;
- clonedContext.metadata.gtdTodoCompletedCount = this.config.todos.items.filter(
+ clonedContext.metadata.todoInjected = true;
+ clonedContext.metadata.todoCount = this.config.todos.items.length;
+ clonedContext.metadata.todoCompletedCount = this.config.todos.items.filter(
(item) => item.status === 'completed',
).length;
- clonedContext.metadata.gtdTodoProcessingCount = this.config.todos.items.filter(
+ clonedContext.metadata.todoProcessingCount = this.config.todos.items.filter(
(item) => item.status === 'processing',
).length;
- log('GTD Todo context appended to last user message');
+ log('Todo context appended to last user message');
return this.markAsExecuted(clonedContext);
}
diff --git a/packages/context-engine/src/providers/index.ts b/packages/context-engine/src/providers/index.ts
index 75cec92cbd3..28f1afb393b 100644
--- a/packages/context-engine/src/providers/index.ts
+++ b/packages/context-engine/src/providers/index.ts
@@ -16,8 +16,6 @@ export { EvalContextSystemInjector } from './EvalContextSystemInjector';
export { ForceFinishSummaryInjector } from './ForceFinishSummaryInjector';
export { GroupAgentBuilderContextInjector } from './GroupAgentBuilderContextInjector';
export { GroupContextInjector } from './GroupContextInjector';
-export { GTDPlanInjector } from './GTDPlanInjector';
-export { GTDTodoInjector } from './GTDTodoInjector';
export { HistorySummaryProvider } from './HistorySummary';
export { KnowledgeInjector } from './KnowledgeInjector';
export { LocalSystemToolSnapshotInjector } from './LocalSystemToolSnapshotInjector';
@@ -26,6 +24,7 @@ export { OnboardingContextInjector } from './OnboardingContextInjector';
export { OnboardingSyntheticStateInjector } from './OnboardingSyntheticStateInjector';
export { PageEditorContextInjector } from './PageEditorContextInjector';
export { PageSelectionsInjector } from './PageSelectionsInjector';
+export { PlanInjector } from './PlanInjector';
export {
formatSelectedSkills,
formatSelectedSkillsContext,
@@ -40,6 +39,7 @@ export { SkillContextProvider } from './SkillContextProvider';
export { SystemDateProvider } from './SystemDateProvider';
export { SystemRoleInjector } from './SystemRoleInjector';
export { TaskManagerContextInjector } from './TaskManagerContextInjector';
+export { TodoInjector } from './TodoInjector';
export { ToolDiscoveryProvider } from './ToolDiscoveryProvider';
export { ToolSystemRoleProvider } from './ToolSystemRole';
export { TopicReferenceContextInjector } from './TopicReferenceContextInjector';
@@ -87,8 +87,6 @@ export type {
GroupContextInjectorConfig,
GroupMemberInfo as GroupContextMemberInfo,
} from './GroupContextInjector';
-export type { GTDPlan, GTDPlanInjectorConfig } from './GTDPlanInjector';
-export type { GTDTodoInjectorConfig, GTDTodoItem, GTDTodoList } from './GTDTodoInjector';
export type { HistorySummaryConfig } from './HistorySummary';
export type { KnowledgeInjectorConfig } from './KnowledgeInjector';
export type { LocalSystemToolSnapshotInjectorConfig } from './LocalSystemToolSnapshotInjector';
@@ -99,12 +97,14 @@ export type {
} from './OnboardingContextInjector';
export type { PageEditorContextInjectorConfig } from './PageEditorContextInjector';
export type { PageSelectionsInjectorConfig } from './PageSelectionsInjector';
+export type { Plan, PlanInjectorConfig } from './PlanInjector';
export type { SelectedSkillInjectorConfig } from './SelectedSkillInjector';
export type { SelectedToolInjectorConfig } from './SelectedToolInjector';
export type { SkillContextProviderConfig, SkillMeta } from './SkillContextProvider';
export type { SystemDateProviderConfig } from './SystemDateProvider';
export type { SystemRoleInjectorConfig } from './SystemRoleInjector';
export type { TaskManagerContextInjectorConfig } from './TaskManagerContextInjector';
+export type { TodoInjectorConfig, TodoItem, TodoList } from './TodoInjector';
export type { ToolDiscoveryMeta, ToolDiscoveryProviderConfig } from './ToolDiscoveryProvider';
export type { ToolSystemRoleConfig } from './ToolSystemRole';
export type {
diff --git a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json
index 492dc19362c..73b6abf0c71 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/multi-tasks-with-summary.json
@@ -20,9 +20,9 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Task 1\"}, {\"description\": \"Task 2\"}, {\"description\": \"Task 3\"}, {\"description\": \"Task 4\"}, {\"description\": \"Task 5\"}, {\"description\": \"Task 6\"}, {\"description\": \"Task 7\"}, {\"description\": \"Task 8\"}, {\"description\": \"Task 9\"}, {\"description\": \"Task 10\"}]}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
]
},
@@ -35,7 +35,7 @@
"createdAt": 1735526588116,
"updatedAt": 1735526591337,
"pluginState": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{ "description": "Task 1" },
{ "description": "Task 2" },
diff --git a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/simple.json b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/simple.json
index b08d9c0ed30..0c99d89591e 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/simple.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/simple.json
@@ -20,9 +20,9 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research Hangzhou weather\", \"instruction\": \"Search for Hangzhou weather tomorrow.\"}, {\"description\": \"Research Beijing weather\", \"instruction\": \"Search for Beijing weather tomorrow.\"}]}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
],
"metadata": {
@@ -45,13 +45,13 @@
"createdAt": 1735526588116,
"updatedAt": 1735526591337,
"plugin": {
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research Hangzhou weather\", \"instruction\": \"Search for Hangzhou weather tomorrow.\"}, {\"description\": \"Research Beijing weather\", \"instruction\": \"Search for Beijing weather tomorrow.\"}]}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"type": "builtin"
},
"pluginState": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{
"description": "Research Hangzhou weather",
diff --git a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/single-task-with-tool-chain.json b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/single-task-with-tool-chain.json
index 7689c8713b0..97952163777 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/single-task-with-tool-chain.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/single-task-with-tool-chain.json
@@ -20,9 +20,9 @@
{
"id": "call_exec_task_1",
"type": "builtin",
- "apiName": "execTask",
+ "apiName": "callSubAgent",
"arguments": "{\"description\":\"Write 400-word story and save to Notebook\",\"inheritMessages\":true,\"instruction\":\"Write a ~400 word short story, then save it to Notebook.\",\"timeout\":1800000}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
],
"metadata": {
@@ -45,9 +45,9 @@
"createdAt": 1739032808194,
"updatedAt": 1739032811207,
"plugin": {
- "apiName": "execTask",
+ "apiName": "callSubAgent",
"arguments": "{\"description\":\"Write 400-word story and save to Notebook\",\"inheritMessages\":true,\"instruction\":\"Write a ~400 word short story, then save it to Notebook.\",\"timeout\":1800000}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"type": "builtin"
},
"pluginState": {
@@ -57,7 +57,7 @@
"instruction": "Write a ~400 word short story, then save it to Notebook.",
"inheritMessages": true
},
- "type": "execTask",
+ "type": "execSubAgent",
"parentMessageId": "msg-tool-1"
}
},
diff --git a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-assistant-group.json b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-assistant-group.json
index b27ca32f425..0b5b1b9acb6 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-assistant-group.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-assistant-group.json
@@ -20,9 +20,9 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research LLM architectures\"}, {\"description\": \"Research AI agents\"}, {\"description\": \"Research RAG systems\"}]}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
]
},
@@ -35,7 +35,7 @@
"createdAt": 1735526588116,
"updatedAt": 1735526591337,
"pluginState": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{ "description": "Research LLM architectures" },
{ "description": "Research AI agents" },
diff --git a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-summary.json b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-summary.json
index 6b462f6ee92..c65b612cf77 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-summary.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-summary.json
@@ -20,9 +20,9 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research LLM architectures\"}, {\"description\": \"Research AI agents\"}, {\"description\": \"Research RAG systems\"}]}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
]
},
@@ -35,7 +35,7 @@
"createdAt": 1735526588116,
"updatedAt": 1735526591337,
"pluginState": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{
"description": "Research LLM architectures"
diff --git a/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/simple.json b/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/simple.json
index f666abe741b..117cc6cdd1a 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/simple.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/simple.json
@@ -67,14 +67,14 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research Hangzhou weather\", \"instruction\": \"Search for Hangzhou weather tomorrow.\"}, {\"description\": \"Research Beijing weather\", \"instruction\": \"Search for Beijing weather tomorrow.\"}]}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"result": {
"content": "Triggered 2 async tasks for execution:\n1. Research Hangzhou weather\n2. Research Beijing weather",
"id": "msg-tool-1",
"state": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{
"description": "Research Hangzhou weather",
@@ -209,9 +209,9 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research Hangzhou weather\", \"instruction\": \"Search for Hangzhou weather tomorrow.\"}, {\"description\": \"Research Beijing weather\", \"instruction\": \"Search for Beijing weather tomorrow.\"}]}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
],
"metadata": {
@@ -234,13 +234,13 @@
"createdAt": 1735526588116,
"updatedAt": 1735526591337,
"plugin": {
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research Hangzhou weather\", \"instruction\": \"Search for Hangzhou weather tomorrow.\"}, {\"description\": \"Research Beijing weather\", \"instruction\": \"Search for Beijing weather tomorrow.\"}]}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"type": "builtin"
},
"pluginState": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{
"description": "Research Hangzhou weather",
diff --git a/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/single-task-with-tool-chain.json b/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/single-task-with-tool-chain.json
index 2aca470f43f..27ebacf636f 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/single-task-with-tool-chain.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/single-task-with-tool-chain.json
@@ -83,9 +83,9 @@
{
"id": "call_exec_task_1",
"type": "builtin",
- "apiName": "execTask",
+ "apiName": "callSubAgent",
"arguments": "{\"description\":\"Write 400-word story and save to Notebook\",\"inheritMessages\":true,\"instruction\":\"Write a ~400 word short story, then save it to Notebook.\",\"timeout\":1800000}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"result": {
"content": "🚀 Triggered async task for execution:\n- Write 400-word story and save to Notebook",
"id": "msg-tool-1",
@@ -96,7 +96,7 @@
"instruction": "Write a ~400 word short story, then save it to Notebook.",
"inheritMessages": true
},
- "type": "execTask",
+ "type": "execSubAgent",
"parentMessageId": "msg-tool-1"
}
},
@@ -247,9 +247,9 @@
{
"id": "call_exec_task_1",
"type": "builtin",
- "apiName": "execTask",
+ "apiName": "callSubAgent",
"arguments": "{\"description\":\"Write 400-word story and save to Notebook\",\"inheritMessages\":true,\"instruction\":\"Write a ~400 word short story, then save it to Notebook.\",\"timeout\":1800000}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
],
"metadata": {
@@ -272,9 +272,9 @@
"createdAt": 1739032808194,
"updatedAt": 1739032811207,
"plugin": {
- "apiName": "execTask",
+ "apiName": "callSubAgent",
"arguments": "{\"description\":\"Write 400-word story and save to Notebook\",\"inheritMessages\":true,\"instruction\":\"Write a ~400 word short story, then save it to Notebook.\",\"timeout\":1800000}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"type": "builtin"
},
"pluginState": {
@@ -284,7 +284,7 @@
"instruction": "Write a ~400 word short story, then save it to Notebook.",
"inheritMessages": true
},
- "type": "execTask",
+ "type": "execSubAgent",
"parentMessageId": "msg-tool-1"
}
},
diff --git a/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/with-summary.json b/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/with-summary.json
index 80b74dc6058..dae26c2e38e 100644
--- a/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/with-summary.json
+++ b/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/with-summary.json
@@ -65,14 +65,14 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research LLM architectures\"}, {\"description\": \"Research AI agents\"}, {\"description\": \"Research RAG systems\"}]}",
- "identifier": "lobe-gtd",
+ "identifier": "lobe-agent",
"result": {
"id": "msg-tool-1",
"content": "Triggered 3 async tasks",
"state": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{
"description": "Research LLM architectures"
@@ -189,9 +189,9 @@
{
"id": "call_exec_tasks_1",
"type": "builtin",
- "apiName": "execTasks",
+ "apiName": "callSubAgents",
"arguments": "{\"tasks\": [{\"description\": \"Research LLM architectures\"}, {\"description\": \"Research AI agents\"}, {\"description\": \"Research RAG systems\"}]}",
- "identifier": "lobe-gtd"
+ "identifier": "lobe-agent"
}
]
},
@@ -204,7 +204,7 @@
"createdAt": 1735526588116,
"updatedAt": 1735526591337,
"pluginState": {
- "type": "execTasks",
+ "type": "execSubAgents",
"tasks": [
{
"description": "Research LLM architectures"
diff --git a/packages/conversation-flow/src/__tests__/parse.test.ts b/packages/conversation-flow/src/__tests__/parse.test.ts
index ef268a076f7..fedd7cd506a 100644
--- a/packages/conversation-flow/src/__tests__/parse.test.ts
+++ b/packages/conversation-flow/src/__tests__/parse.test.ts
@@ -257,7 +257,7 @@ describe('parse', () => {
expect(result.flatList[3].content).toContain('All 10 tasks completed');
});
- it('should handle single task (execTask) with tool chain after completion', () => {
+ it('should handle single sub-agent (callSubAgent) with tool chain after completion', () => {
const result = parse(inputs.tasks.singleTaskWithToolChain);
expect(serializeParseResult(result)).toEqual(outputs.tasks.singleTaskWithToolChain);
diff --git a/packages/model-runtime/src/core/streams/google/google-ai.test.ts b/packages/model-runtime/src/core/streams/google/google-ai.test.ts
index 8111e9a5214..d7bb2aa89d2 100644
--- a/packages/model-runtime/src/core/streams/google/google-ai.test.ts
+++ b/packages/model-runtime/src/core/streams/google/google-ai.test.ts
@@ -1391,7 +1391,7 @@ describe('GoogleGenerativeAIStream', () => {
parts: [
{
functionCall: {
- name: 'lobe-gtd____createPlan',
+ name: 'lobe-agent____createPlan',
args: {
goal: 'Fix Linear API Argument Validation Error',
description: 'Investigate the Linear API error.',
@@ -1424,7 +1424,7 @@ describe('GoogleGenerativeAIStream', () => {
parts: [
{
functionCall: {
- name: 'lobe-gtd____createTodos',
+ name: 'lobe-agent____createTodos',
args: {
adds: [
'Verify Linear GraphQL API requirements',
@@ -1498,12 +1498,12 @@ describe('GoogleGenerativeAIStream', () => {
// First tool call (createPlan)
'id: chat_test',
'event: tool_calls',
- 'data: [{"function":{"arguments":"{\\"goal\\":\\"Fix Linear API Argument Validation Error\\",\\"description\\":\\"Investigate the Linear API error.\\",\\"context\\":\\"The user is encountering a validation error.\\"}","name":"lobe-gtd____createPlan"},"id":"lobe-gtd____createPlan_0_tool_id_1","index":0,"thoughtSignature":"EoIYCv8XAXLI2nx+C18votz5l0A...","type":"function"}]\n',
+ 'data: [{"function":{"arguments":"{\\"goal\\":\\"Fix Linear API Argument Validation Error\\",\\"description\\":\\"Investigate the Linear API error.\\",\\"context\\":\\"The user is encountering a validation error.\\"}","name":"lobe-agent____createPlan"},"id":"lobe-agent____createPlan_0_tool_id_1","index":0,"thoughtSignature":"EoIYCv8XAXLI2nx+C18votz5l0A...","type":"function"}]\n',
// Second tool call (createTodos) - should be a SEPARATE event with index:0
'id: chat_test',
'event: tool_calls',
- 'data: [{"function":{"arguments":"{\\"adds\\":[\\"Verify Linear GraphQL API requirements\\",\\"Determine if code needs to look up Team UUID\\",\\"Provide corrected code\\"]}","name":"lobe-gtd____createTodos"},"id":"lobe-gtd____createTodos_0_tool_id_2","index":0,"type":"function"}]\n',
+ 'data: [{"function":{"arguments":"{\\"adds\\":[\\"Verify Linear GraphQL API requirements\\",\\"Determine if code needs to look up Team UUID\\",\\"Provide corrected code\\"]}","name":"lobe-agent____createTodos"},"id":"lobe-agent____createTodos_0_tool_id_2","index":0,"type":"function"}]\n',
// Stop and usage
'id: chat_test',
diff --git a/packages/prompts/src/prompts/index.ts b/packages/prompts/src/prompts/index.ts
index da1243c928b..f7bc8b5ecf5 100644
--- a/packages/prompts/src/prompts/index.ts
+++ b/packages/prompts/src/prompts/index.ts
@@ -9,9 +9,9 @@ export * from './discordContext';
export * from './files';
export * from './fileSystem';
export * from './groupChat';
-export * from './gtd';
export * from './knowledgeBaseQA';
export * from './messagesToText';
+export * from './planTodo';
export * from './plugin';
export * from './remoteDevice';
export * from './search';
diff --git a/packages/prompts/src/prompts/gtd/index.test.ts b/packages/prompts/src/prompts/planTodo/index.test.ts
similarity index 100%
rename from packages/prompts/src/prompts/gtd/index.test.ts
rename to packages/prompts/src/prompts/planTodo/index.test.ts
diff --git a/packages/prompts/src/prompts/gtd/index.ts b/packages/prompts/src/prompts/planTodo/index.ts
similarity index 100%
rename from packages/prompts/src/prompts/gtd/index.ts
rename to packages/prompts/src/prompts/planTodo/index.ts
diff --git a/packages/types/src/stepContext.ts b/packages/types/src/stepContext.ts
index 2f93bb4c627..e436fab3b1b 100644
--- a/packages/types/src/stepContext.ts
+++ b/packages/types/src/stepContext.ts
@@ -15,7 +15,7 @@ export type StepContextTodoStatus = 'todo' | 'processing' | 'completed';
/**
* Todo item structure
- * Duplicated here to avoid circular dependency with builtin-tool-gtd
+ * Duplicated here to avoid circular dependency with builtin-tool-lobe-agent
*/
export interface StepContextTodoItem {
status: StepContextTodoStatus;
@@ -175,7 +175,7 @@ export interface RuntimeStepContext {
stepPageEditor?: StepPageEditorContext;
/**
* Current todo list state
- * Computed from the latest GTD tool message in the conversation
+ * Computed from the latest lobe-agent tool message in the conversation
*/
todos?: StepContextTodos;
}
diff --git a/packages/types/src/tool/builtin.ts b/packages/types/src/tool/builtin.ts
index 9e2fa5ebb8d..10ccd9441d9 100644
--- a/packages/types/src/tool/builtin.ts
+++ b/packages/types/src/tool/builtin.ts
@@ -469,7 +469,7 @@ export interface BuiltinToolContext {
/**
* Step context computed at the beginning of each step
- * Contains dynamic state like GTD todos that changes between steps
+ * Contains dynamic state like lobe-agent todos that changes between steps
* Computed by AgentRuntime and passed to Tool Executors
*/
stepContext?: RuntimeStepContext;
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/Fallback.test.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/Fallback.test.tsx
index 85782fcee41..416f1149cac 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/Fallback.test.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/Fallback.test.tsx
@@ -102,7 +102,7 @@ describe('FallbackIntervention', () => {
});
it('shows the activation reason for activateTools interventions', () => {
- const reason = 'I need GTD tools to create and manage the requested task list.';
+ const reason = 'I need lobe-agent tools to create and manage the requested task list.';
render(
<FallbackIntervention
diff --git a/src/features/Conversation/Messages/AssistantGroup/constants.ts b/src/features/Conversation/Messages/AssistantGroup/constants.ts
index 7b612864030..23a6105185e 100644
--- a/src/features/Conversation/Messages/AssistantGroup/constants.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/constants.ts
@@ -163,14 +163,16 @@ export const TOOL_API_DISPLAY_NAMES: Record<string, string> = {
// Cloud sandbox
executeCode: 'workflow.toolDisplayName.executeCode',
- // GTD
+ // Lobe Agent — Plan & Todos
createPlan: 'workflow.toolDisplayName.createPlan',
createTodos: 'workflow.toolDisplayName.createTodos',
updatePlan: 'workflow.toolDisplayName.updatePlan',
updateTodos: 'workflow.toolDisplayName.updateTodos',
clearTodos: 'workflow.toolDisplayName.clearTodos',
- execTask: 'workflow.toolDisplayName.execTask',
- execTasks: 'workflow.toolDisplayName.execTasks',
+
+ // Lobe Agent — Sub-Agents
+ callSubAgent: 'workflow.toolDisplayName.callSubAgent',
+ callSubAgents: 'workflow.toolDisplayName.callSubAgents',
// Memory
addActivityMemory: 'workflow.toolDisplayName.addActivityMemory',
diff --git a/src/features/DevPanel/RenderGallery/fixtures/index.ts b/src/features/DevPanel/RenderGallery/fixtures/index.ts
index e75ced3af1e..2627968cd75 100644
--- a/src/features/DevPanel/RenderGallery/fixtures/index.ts
+++ b/src/features/DevPanel/RenderGallery/fixtures/index.ts
@@ -9,13 +9,13 @@ import claudeCode from './claude-code';
import codex from './codex';
import github from './github';
import lobeActivator from './lobe-activator';
+import lobeAgent from './lobe-agent';
import lobeAgentBuilder from './lobe-agent-builder';
import lobeAgentDocuments from './lobe-agent-documents';
import lobeAgentManagement from './lobe-agent-management';
import lobeCloudSandbox from './lobe-cloud-sandbox';
import lobeGroupAgentBuilder from './lobe-group-agent-builder';
import lobeGroupManagement from './lobe-group-management';
-import lobeGtd from './lobe-gtd';
import lobeKnowledgeBase from './lobe-knowledge-base';
import lobeLocalSystem from './lobe-local-system';
import lobeNotebook from './lobe-notebook';
@@ -67,13 +67,13 @@ const toolsetModules: ToolsetFixtureModule[] = [
codex,
github,
lobeActivator,
+ lobeAgent,
lobeAgentBuilder,
lobeAgentDocuments,
lobeAgentManagement,
lobeCloudSandbox,
lobeGroupAgentBuilder,
lobeGroupManagement,
- lobeGtd,
lobeKnowledgeBase,
lobeLocalSystem,
lobeNotebook,
diff --git a/src/features/DevPanel/RenderGallery/fixtures/lobe-gtd.ts b/src/features/DevPanel/RenderGallery/fixtures/lobe-agent.ts
similarity index 97%
rename from src/features/DevPanel/RenderGallery/fixtures/lobe-gtd.ts
rename to src/features/DevPanel/RenderGallery/fixtures/lobe-agent.ts
index b3402ae58be..156e88bffb8 100644
--- a/src/features/DevPanel/RenderGallery/fixtures/lobe-gtd.ts
+++ b/src/features/DevPanel/RenderGallery/fixtures/lobe-agent.ts
@@ -3,8 +3,31 @@
import { defineFixtures, single, variants } from './_helpers';
export default defineFixtures({
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
fixtures: {
+ callSubAgent: single({
+ pluginState: {
+ task: {
+ description: 'Smoke test the desktop router config',
+ instruction:
+ 'Run the desktop router sync test and confirm /devtools only appears in development.',
+ },
+ },
+ }),
+ callSubAgents: single({
+ pluginState: {
+ tasks: [
+ {
+ description: 'Audit builtin render coverage',
+ instruction: 'Find any registered render without a usable sample fixture.',
+ },
+ {
+ description: 'Check route gating',
+ instruction: 'Make sure production builds do not expose /devtools.',
+ },
+ ],
+ },
+ }),
clearTodos: single({
pluginState: {
todos: {
@@ -63,29 +86,6 @@ export default defineFixtures({
},
},
]),
- execTask: single({
- pluginState: {
- task: {
- description: 'Smoke test the desktop router config',
- instruction:
- 'Run the desktop router sync test and confirm /devtools only appears in development.',
- },
- },
- }),
- execTasks: single({
- pluginState: {
- tasks: [
- {
- description: 'Audit builtin render coverage',
- instruction: 'Find any registered render without a usable sample fixture.',
- },
- {
- description: 'Check route gating',
- instruction: 'Make sure production builds do not expose /devtools.',
- },
- ],
- },
- }),
updatePlan: single({
pluginState: {
plan: {
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index b3f3d33afcb..8310d5d0214 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -337,7 +337,7 @@ export default {
'openInNewWindow': 'Open in New Window',
'operation.contextCompression': 'Context too long, compressing history...',
'operation.execAgentRuntime': 'Preparing response',
- 'operation.execClientTask': 'Executing task',
+ 'operation.execClientSubAgent': 'Running sub-agent',
'operation.execHeterogeneousAgent': '{{name}} is running',
'operation.heterogeneousAgentFallback': 'External agent',
'operation.execServerAgentRuntime':
@@ -834,6 +834,8 @@ export default {
'workflow.toolDisplayName.addPreferenceMemory': 'Saved memory',
'workflow.toolDisplayName.calculate': 'Calculated',
'workflow.toolDisplayName.callAgent': 'Called an agent',
+ 'workflow.toolDisplayName.callSubAgent': 'Dispatched a sub-agent',
+ 'workflow.toolDisplayName.callSubAgents': 'Dispatched sub-agents',
'workflow.toolDisplayName.clearTodos': 'Cleared todos',
'workflow.toolDisplayName.copyDocument': 'Copied a document',
'workflow.toolDisplayName.crawlMultiPages': 'Crawled pages',
@@ -849,8 +851,6 @@ export default {
'workflow.toolDisplayName.editTitle': 'Edited title',
'workflow.toolDisplayName.evaluate': 'Evaluated expression',
'workflow.toolDisplayName.execScript': 'Executed a script',
- 'workflow.toolDisplayName.execTask': 'Executed a task',
- 'workflow.toolDisplayName.execTasks': 'Executed tasks',
'workflow.toolDisplayName.execute': 'Executed calculation',
'workflow.toolDisplayName.executeCode': 'Executed code',
'workflow.toolDisplayName.finishOnboarding': 'Finished onboarding',
diff --git a/src/locales/default/plugin.ts b/src/locales/default/plugin.ts
index e103c15879f..688467ea079 100644
--- a/src/locales/default/plugin.ts
+++ b/src/locales/default/plugin.ts
@@ -51,6 +51,11 @@ export default {
'builtins.lobe-agent-management.render.installPlugin.plugin': 'Plugin',
'builtins.lobe-agent-management.render.installPlugin.success': 'Installed successfully',
'builtins.lobe-agent-management.title': 'Agent Manager',
+ 'builtins.lobe-agent.apiName.callSubAgent': 'Call sub-agent',
+ 'builtins.lobe-agent.apiName.callSubAgent.completed': 'Sub-agent dispatched: ',
+ 'builtins.lobe-agent.apiName.callSubAgent.loading': 'Dispatching sub-agent: ',
+ 'builtins.lobe-agent.apiName.callSubAgents': 'Call sub-agents',
+ 'builtins.lobe-agent.title': 'Lobe Agent',
'builtins.lobe-claude-code.agent.instruction': 'Instruction',
'builtins.lobe-claude-code.agent.result': 'Result',
'builtins.lobe-claude-code.todoWrite.allDone': 'All tasks completed',
@@ -119,24 +124,17 @@ export default {
'builtins.lobe-group-management.inspector.executeAgentTasks.title': 'Assigning tasks to:',
'builtins.lobe-group-management.inspector.speak.title': 'Designated Agent speaks:',
'builtins.lobe-group-management.title': 'Group Coordinator',
- 'builtins.lobe-gtd.apiName.clearTodos': 'Clear todos',
- 'builtins.lobe-gtd.apiName.clearTodos.modeAll': 'all',
- 'builtins.lobe-gtd.apiName.clearTodos.modeCompleted': 'completed',
- 'builtins.lobe-gtd.apiName.clearTodos.result': 'Clear <mode>{{mode}}</mode> todos',
- 'builtins.lobe-gtd.apiName.completeTodos': 'Complete todos',
- 'builtins.lobe-gtd.apiName.createPlan': 'Create plan',
- 'builtins.lobe-gtd.apiName.createPlan.result': 'Create plan: <goal>{{goal}}</goal>',
- 'builtins.lobe-gtd.apiName.createTodos': 'Create todos',
- 'builtins.lobe-gtd.apiName.execTask': 'Execute task',
- 'builtins.lobe-gtd.apiName.execTask.completed': 'Task created: ',
- 'builtins.lobe-gtd.apiName.execTask.loading': 'Creating task: ',
- 'builtins.lobe-gtd.apiName.execTasks': 'Execute tasks',
- 'builtins.lobe-gtd.apiName.removeTodos': 'Delete todos',
- 'builtins.lobe-gtd.apiName.updatePlan': 'Update plan',
- 'builtins.lobe-gtd.apiName.updatePlan.completed': 'Completed',
- 'builtins.lobe-gtd.apiName.updatePlan.modified': 'Modified',
- 'builtins.lobe-gtd.apiName.updateTodos': 'Update todos',
- 'builtins.lobe-gtd.title': 'Task Tools',
+ 'builtins.lobe-agent.apiName.clearTodos': 'Clear todos',
+ 'builtins.lobe-agent.apiName.clearTodos.modeAll': 'all',
+ 'builtins.lobe-agent.apiName.clearTodos.modeCompleted': 'completed',
+ 'builtins.lobe-agent.apiName.clearTodos.result': 'Clear <mode>{{mode}}</mode> todos',
+ 'builtins.lobe-agent.apiName.createPlan': 'Create plan',
+ 'builtins.lobe-agent.apiName.createPlan.result': 'Create plan: <goal>{{goal}}</goal>',
+ 'builtins.lobe-agent.apiName.createTodos': 'Create todos',
+ 'builtins.lobe-agent.apiName.updatePlan': 'Update plan',
+ 'builtins.lobe-agent.apiName.updatePlan.completed': 'Completed',
+ 'builtins.lobe-agent.apiName.updatePlan.modified': 'Modified',
+ 'builtins.lobe-agent.apiName.updateTodos': 'Update todos',
'builtins.lobe-knowledge-base.apiName.readKnowledge': 'Read Library content',
'builtins.lobe-knowledge-base.apiName.searchKnowledgeBase': 'Search Library',
'builtins.lobe-knowledge-base.inspector.andMoreFiles': 'and {{count}} more',
diff --git a/src/locales/default/setting.ts b/src/locales/default/setting.ts
index a90baab60f8..ae1e879f757 100644
--- a/src/locales/default/setting.ts
+++ b/src/locales/default/setting.ts
@@ -1049,10 +1049,6 @@ When I am ___, I need ___
'tools.builtins.lobe-cloud-sandbox.readme':
'Execute Python, JavaScript, and TypeScript code in an isolated cloud environment. Run shell commands, manage files, search content with regex, and export results securely.',
'tools.builtins.lobe-cloud-sandbox.title': 'Cloud Sandbox',
- 'tools.builtins.lobe-gtd.description': 'Plan goals and track progress with GTD methodology',
- 'tools.builtins.lobe-gtd.readme':
- 'Plan goals and track progress using GTD methodology. Create strategic plans, manage todo lists with status tracking, and execute long-running async tasks.',
- 'tools.builtins.lobe-gtd.title': 'GTD Tools',
'tools.builtins.lobe-local-system.description':
'Access and manage local files, run shell commands on your desktop',
'tools.builtins.lobe-local-system.readme':
diff --git a/src/locales/default/tool.ts b/src/locales/default/tool.ts
index 688ee314730..5efb02d1b98 100644
--- a/src/locales/default/tool.ts
+++ b/src/locales/default/tool.ts
@@ -59,51 +59,51 @@ export default {
'dalle.generating': 'Generating...',
'dalle.images': 'Images:',
'dalle.prompt': 'Prompt',
- 'lobe-gtd.actions.add': 'Add',
- 'lobe-gtd.actions.clearCompleted': 'Clear Completed',
- 'lobe-gtd.actions.placeholder': 'Enter a to-do item...',
- 'lobe-gtd.addTodo.placeholder': 'Add a todo item...',
- 'lobe-gtd.clearTodos.cleared': '{{count}} item(s) cleared',
- 'lobe-gtd.clearTodos.clearedCompleted': '{{count}} completed item(s) cleared',
- 'lobe-gtd.clearTodos.clearedCompleted_one': '{{count}} completed item cleared',
- 'lobe-gtd.clearTodos.clearedCompleted_other': '{{count}} completed items cleared',
- 'lobe-gtd.clearTodos.cleared_one': '{{count}} item cleared',
- 'lobe-gtd.clearTodos.cleared_other': '{{count}} items cleared',
- 'lobe-gtd.clearTodos.header': 'Clear Todo Items',
- 'lobe-gtd.clearTodos.label': 'Choose what to clear:',
- 'lobe-gtd.clearTodos.noItems': 'No items to clear',
- 'lobe-gtd.clearTodos.option.all': 'Clear all items (including pending)',
- 'lobe-gtd.clearTodos.option.completed': 'Clear completed items only',
- 'lobe-gtd.clearTodos.remaining': '{{count}} item(s) remaining',
- 'lobe-gtd.clearTodos.remaining_one': '{{count}} item remaining',
- 'lobe-gtd.clearTodos.remaining_other': '{{count}} items remaining',
- 'lobe-gtd.completeTodos.completed': '{{count}} item(s) completed',
- 'lobe-gtd.completeTodos.completed_one': '{{count}} item completed',
- 'lobe-gtd.completeTodos.completed_other': '{{count}} items completed',
- 'lobe-gtd.createPlan.context.label': 'Context (optional)',
- 'lobe-gtd.createPlan.context.placeholder': 'Background, constraints, considerations...',
- 'lobe-gtd.createPlan.description.label': 'Description',
- 'lobe-gtd.createPlan.description.placeholder': 'Brief summary of the plan',
- 'lobe-gtd.createPlan.goal.label': 'Goal',
- 'lobe-gtd.createPlan.goal.placeholder': 'What do you want to achieve?',
- 'lobe-gtd.createTodos.created': '{{count}} to-do item(s) created',
- 'lobe-gtd.createTodos.created_one': '{{count}} to-do item created',
- 'lobe-gtd.createTodos.created_other': '{{count}} to-do items created',
- 'lobe-gtd.createTodos.total': 'Total: {{count}} item(s)',
- 'lobe-gtd.createTodos.total_one': 'Total: {{count}} item',
- 'lobe-gtd.createTodos.total_other': 'Total: {{count}} items',
- 'lobe-gtd.removeTodos.removed': '{{count}} item(s) removed',
- 'lobe-gtd.removeTodos.removed_one': '{{count}} item removed',
- 'lobe-gtd.removeTodos.removed_other': '{{count}} items removed',
- 'lobe-gtd.status.done': '{{count}} completed',
- 'lobe-gtd.status.pending': '{{count}} pending',
- 'lobe-gtd.todoItem.placeholder': 'Enter todo item...',
- 'lobe-gtd.todoList.empty': 'To-do list is empty',
- 'lobe-gtd.todoList.items': '{{count}} item(s)',
- 'lobe-gtd.todoList.items_one': '{{count}} item',
- 'lobe-gtd.todoList.items_other': '{{count}} items',
- 'lobe-gtd.todoList.title': 'To-Do List',
- 'lobe-gtd.updateTodos.updated': 'To-do list updated',
+ 'lobe-agent.actions.add': 'Add',
+ 'lobe-agent.actions.clearCompleted': 'Clear Completed',
+ 'lobe-agent.actions.placeholder': 'Enter a to-do item...',
+ 'lobe-agent.addTodo.placeholder': 'Add a todo item...',
+ 'lobe-agent.clearTodos.cleared': '{{count}} item(s) cleared',
+ 'lobe-agent.clearTodos.clearedCompleted': '{{count}} completed item(s) cleared',
+ 'lobe-agent.clearTodos.clearedCompleted_one': '{{count}} completed item cleared',
+ 'lobe-agent.clearTodos.clearedCompleted_other': '{{count}} completed items cleared',
+ 'lobe-agent.clearTodos.cleared_one': '{{count}} item cleared',
+ 'lobe-agent.clearTodos.cleared_other': '{{count}} items cleared',
+ 'lobe-agent.clearTodos.header': 'Clear Todo Items',
+ 'lobe-agent.clearTodos.label': 'Choose what to clear:',
+ 'lobe-agent.clearTodos.noItems': 'No items to clear',
+ 'lobe-agent.clearTodos.option.all': 'Clear all items (including pending)',
+ 'lobe-agent.clearTodos.option.completed': 'Clear completed items only',
+ 'lobe-agent.clearTodos.remaining': '{{count}} item(s) remaining',
+ 'lobe-agent.clearTodos.remaining_one': '{{count}} item remaining',
+ 'lobe-agent.clearTodos.remaining_other': '{{count}} items remaining',
+ 'lobe-agent.completeTodos.completed': '{{count}} item(s) completed',
+ 'lobe-agent.completeTodos.completed_one': '{{count}} item completed',
+ 'lobe-agent.completeTodos.completed_other': '{{count}} items completed',
+ 'lobe-agent.createPlan.context.label': 'Context (optional)',
+ 'lobe-agent.createPlan.context.placeholder': 'Background, constraints, considerations...',
+ 'lobe-agent.createPlan.description.label': 'Description',
+ 'lobe-agent.createPlan.description.placeholder': 'Brief summary of the plan',
+ 'lobe-agent.createPlan.goal.label': 'Goal',
+ 'lobe-agent.createPlan.goal.placeholder': 'What do you want to achieve?',
+ 'lobe-agent.createTodos.created': '{{count}} to-do item(s) created',
+ 'lobe-agent.createTodos.created_one': '{{count}} to-do item created',
+ 'lobe-agent.createTodos.created_other': '{{count}} to-do items created',
+ 'lobe-agent.createTodos.total': 'Total: {{count}} item(s)',
+ 'lobe-agent.createTodos.total_one': 'Total: {{count}} item',
+ 'lobe-agent.createTodos.total_other': 'Total: {{count}} items',
+ 'lobe-agent.removeTodos.removed': '{{count}} item(s) removed',
+ 'lobe-agent.removeTodos.removed_one': '{{count}} item removed',
+ 'lobe-agent.removeTodos.removed_other': '{{count}} items removed',
+ 'lobe-agent.status.done': '{{count}} completed',
+ 'lobe-agent.status.pending': '{{count}} pending',
+ 'lobe-agent.todoItem.placeholder': 'Enter todo item...',
+ 'lobe-agent.todoList.empty': 'To-do list is empty',
+ 'lobe-agent.todoList.items': '{{count}} item(s)',
+ 'lobe-agent.todoList.items_one': '{{count}} item',
+ 'lobe-agent.todoList.items_other': '{{count}} items',
+ 'lobe-agent.todoList.title': 'To-Do List',
+ 'lobe-agent.updateTodos.updated': 'To-do list updated',
'lobe-knowledge-base.readKnowledge.meta.chars': 'Character Count',
'lobe-knowledge-base.readKnowledge.meta.lines': 'Line Count',
'localFiles.editFile.newString': 'Replace with',
diff --git a/src/server/services/toolExecution/serverRuntimes/agentManagement.ts b/src/server/services/toolExecution/serverRuntimes/agentManagement.ts
index 79151b5c239..6101282ded3 100644
--- a/src/server/services/toolExecution/serverRuntimes/agentManagement.ts
+++ b/src/server/services/toolExecution/serverRuntimes/agentManagement.ts
@@ -53,7 +53,7 @@ export const agentManagementRuntime: ServerRuntimeRegistration = {
targetAgentId: agentId,
timeout: timeout || 1_800_000,
},
- type: 'execTask',
+ type: 'execSubAgent',
},
success: true,
};
diff --git a/src/server/services/toolExecution/serverRuntimes/index.ts b/src/server/services/toolExecution/serverRuntimes/index.ts
index 532ff520966..f63af9434a3 100644
--- a/src/server/services/toolExecution/serverRuntimes/index.ts
+++ b/src/server/services/toolExecution/serverRuntimes/index.ts
@@ -14,7 +14,6 @@ import { briefRuntime } from './brief';
import { calculatorRuntime } from './calculator';
import { cloudSandboxRuntime } from './cloudSandbox';
import { credsRuntime } from './creds';
-import { gtdRuntime } from './gtd';
import { knowledgeBaseRuntime } from './knowledgeBase';
import { lobeAgentRuntime } from './lobeAgent';
import { localSystemRuntime } from './localSystem';
@@ -68,7 +67,6 @@ registerRuntimes([
topicReferenceRuntime,
userInteractionRuntime,
credsRuntime,
- gtdRuntime,
knowledgeBaseRuntime,
webOnboardingRuntime,
lobeAgentRuntime,
diff --git a/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts b/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts
index 6a4220d8bd0..5e8f366aba4 100644
--- a/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts
+++ b/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts
@@ -7,6 +7,7 @@ import {
hasUserVisualFiles,
LobeAgentIdentifier,
normalizeAnalyzeVisualMediaInput,
+ PlanExecutionRuntime,
selectVisualFileItems,
validateVisualMediaUrls,
} from '@lobechat/builtin-tool-lobe-agent';
@@ -22,6 +23,7 @@ import { toolsEnv } from '@/envs/tools';
import { initModelRuntimeFromDB } from '@/server/modules/ModelRuntime';
import { FileService } from '@/server/services/file';
+import { createServerPlanRuntimeService } from './lobeAgentPlan';
import type { ServerRuntimeRegistration } from './types';
interface AnalyzeVisualMediaParams {
@@ -69,6 +71,7 @@ class LobeAgentExecutionRuntime {
private messageId: string;
private threadId?: string | null;
private topicId?: string;
+ private planRuntime: PlanExecutionRuntime;
constructor(context: LobeAgentRuntimeContext) {
this.agentId = context.agentId;
@@ -78,8 +81,28 @@ class LobeAgentExecutionRuntime {
this.threadId = context.threadId;
this.topicId = context.topicId;
this.userId = context.userId;
+ this.planRuntime = new PlanExecutionRuntime(
+ createServerPlanRuntimeService(context.serverDB, context.userId),
+ );
}
+ // ==================== Plan / Todo (delegated to PlanExecutionRuntime) ====================
+
+ createPlan = (params: any) =>
+ this.planRuntime.createPlan(params, { messageId: this.messageId, topicId: this.topicId });
+
+ updatePlan = (params: any) =>
+ this.planRuntime.updatePlan(params, { messageId: this.messageId, topicId: this.topicId });
+
+ createTodos = (params: any) =>
+ this.planRuntime.createTodos(params, { messageId: this.messageId, topicId: this.topicId });
+
+ updateTodos = (params: any) =>
+ this.planRuntime.updateTodos(params, { messageId: this.messageId, topicId: this.topicId });
+
+ clearTodos = (params: any) =>
+ this.planRuntime.clearTodos(params, { messageId: this.messageId, topicId: this.topicId });
+
private queryScopeMessages = (
messageModel: MessageModel,
sourceMessage: ServerVisualSourceMessage,
diff --git a/src/server/services/toolExecution/serverRuntimes/gtd.ts b/src/server/services/toolExecution/serverRuntimes/lobeAgentPlan.ts
similarity index 77%
rename from src/server/services/toolExecution/serverRuntimes/gtd.ts
rename to src/server/services/toolExecution/serverRuntimes/lobeAgentPlan.ts
index 811c9e3fa1a..36e293f83fa 100644
--- a/src/server/services/toolExecution/serverRuntimes/gtd.ts
+++ b/src/server/services/toolExecution/serverRuntimes/lobeAgentPlan.ts
@@ -1,19 +1,22 @@
-import { GTDIdentifier } from '@lobechat/builtin-tool-gtd';
-import {
- GTDExecutionRuntime,
- type GTDRuntimeService,
- type PlanDocument,
-} from '@lobechat/builtin-tool-gtd/executionRuntime';
+import { type PlanDocument, type PlanRuntimeService } from '@lobechat/builtin-tool-lobe-agent';
import { type LobeChatDatabase } from '@lobechat/database';
import { DocumentModel } from '@/database/models/document';
import { TopicDocumentModel } from '@/database/models/topicDocument';
-import { type ServerRuntimeRegistration } from './types';
-
const PLAN_FILE_TYPE = 'agent/plan';
-const createGTDRuntimeService = (serverDB: LobeChatDatabase, userId: string): GTDRuntimeService => {
+/**
+ * Build a server-side `PlanRuntimeService` backed by the application database.
+ *
+ * The factory is consumed by `lobeAgent.ts`'s `LobeAgentExecutionRuntime`,
+ * which folds plan/todo execution into the lobe-agent server runtime so the
+ * registry has a single runtime per identifier.
+ */
+export const createServerPlanRuntimeService = (
+ serverDB: LobeChatDatabase,
+ userId: string,
+): PlanRuntimeService => {
const documentModel = new DocumentModel(serverDB, userId);
const topicDocumentModel = new TopicDocumentModel(serverDB, userId);
@@ -47,7 +50,7 @@ const createGTDRuntimeService = (serverDB: LobeChatDatabase, userId: string): GT
content,
description,
fileType: PLAN_FILE_TYPE,
- source: `gtd:${topicId}`,
+ source: `lobe-agent:${topicId}`,
sourceType: 'api',
title: goal,
totalCharCount: content.length,
@@ -93,15 +96,3 @@ const createGTDRuntimeService = (serverDB: LobeChatDatabase, userId: string): GT
},
};
};
-
-export const gtdRuntime: ServerRuntimeRegistration = {
- factory: (context) => {
- if (!context.userId || !context.serverDB) {
- throw new Error('userId and serverDB are required for GTD tool execution');
- }
-
- const service = createGTDRuntimeService(context.serverDB, context.userId);
- return new GTDExecutionRuntime(service);
- },
- identifier: GTDIdentifier,
-};
diff --git a/src/services/chat/index.ts b/src/services/chat/index.ts
index 2538b33a32c..ebe0afd970a 100644
--- a/src/services/chat/index.ts
+++ b/src/services/chat/index.ts
@@ -71,7 +71,7 @@ interface GetChatCompletionPayload extends Partial<Omit<ChatStreamPayload, 'mess
messages: UIChatMessage[];
/**
* Pre-resolved agent config from AgentRuntime layer.
- * Required to ensure config consistency and proper isSubTask filtering.
+ * Required to ensure config consistency and proper isSubAgent filtering.
*/
resolvedAgentConfig: ResolvedAgentConfig;
topicId?: string;
@@ -141,7 +141,7 @@ class ChatService {
// =================== 1. use pre-resolved agent config =================== //
// Config is resolved in AgentRuntime layer (internal_createAgentState)
- // which handles isSubTask filtering, disableTools, and tools generation
+ // which handles isSubAgent filtering, disableTools, and tools generation
const targetAgentId = getTargetAgentId(agentId);
diff --git a/src/services/chat/mecha/agentConfigResolver.test.ts b/src/services/chat/mecha/agentConfigResolver.test.ts
index 9b6ca119a8d..641ba0a16b3 100644
--- a/src/services/chat/mecha/agentConfigResolver.test.ts
+++ b/src/services/chat/mecha/agentConfigResolver.test.ts
@@ -1,6 +1,6 @@
import * as builtinAgents from '@lobechat/builtin-agents';
import { GroupManagementIdentifier } from '@lobechat/builtin-tool-group-management';
-import { GTDIdentifier } from '@lobechat/builtin-tool-gtd';
+import { LobeAgentIdentifier } from '@lobechat/builtin-tool-lobe-agent';
import { NotebookIdentifier } from '@lobechat/builtin-tool-notebook';
import { PageAgentIdentifier } from '@lobechat/builtin-tool-page-agent';
import { TaskIdentifier } from '@lobechat/builtin-tool-task';
@@ -462,23 +462,23 @@ describe('resolveAgentConfig', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentSlugById').mockReturnValue(() => 'inbox');
});
- it('should include GTD and Notebook tools in plugins', () => {
+ it('should include lobe-agent and Notebook tools in plugins', () => {
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
- plugins: [GTDIdentifier, NotebookIdentifier],
+ plugins: [LobeAgentIdentifier, NotebookIdentifier],
systemRole: 'Inbox system role',
});
const result = resolveAgentConfig({ agentId: 'inbox-agent' });
- expect(result.plugins).toContain(GTDIdentifier);
+ expect(result.plugins).toContain(LobeAgentIdentifier);
expect(result.plugins).toContain(NotebookIdentifier);
expect(result.isBuiltinAgent).toBe(true);
expect(result.slug).toBe('inbox');
});
- it('should preserve user plugins while including GTD and Notebook', () => {
+ it('should preserve user plugins while including lobe-agent and Notebook', () => {
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
- plugins: [GTDIdentifier, NotebookIdentifier, 'user-plugin'],
+ plugins: [LobeAgentIdentifier, NotebookIdentifier, 'user-plugin'],
systemRole: 'Inbox system role',
});
@@ -487,7 +487,7 @@ describe('resolveAgentConfig', () => {
plugins: ['user-plugin'],
});
- expect(result.plugins).toContain(GTDIdentifier);
+ expect(result.plugins).toContain(LobeAgentIdentifier);
expect(result.plugins).toContain(NotebookIdentifier);
expect(result.plugins).toContain('user-plugin');
});
@@ -510,8 +510,8 @@ describe('resolveAgentConfig', () => {
const getAgentRuntimeConfigSpy = vi
.spyOn(builtinAgents, 'getAgentRuntimeConfig')
.mockImplementation((slug, ctx) => ({
- // This simulates the actual INBOX runtime: [GTDIdentifier, NotebookIdentifier, ...(ctx.plugins || [])]
- plugins: [GTDIdentifier, NotebookIdentifier, ...(ctx.plugins || [])],
+ // This simulates the actual INBOX runtime: [LobeAgentIdentifier, NotebookIdentifier, ...(ctx.plugins || [])]
+ plugins: [LobeAgentIdentifier, NotebookIdentifier, ...(ctx.plugins || [])],
systemRole: 'Inbox system role',
}));
@@ -527,7 +527,7 @@ describe('resolveAgentConfig', () => {
);
// Verify final plugins include both builtin tools AND user-configured plugins
- expect(result.plugins).toContain(GTDIdentifier);
+ expect(result.plugins).toContain(LobeAgentIdentifier);
expect(result.plugins).toContain(NotebookIdentifier);
expect(result.plugins).toContain('web-search');
expect(result.plugins).toContain('memory');
@@ -853,7 +853,7 @@ describe('resolveAgentConfig', () => {
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
chatConfig: { enableHistoryCount: false },
- plugins: [GroupManagementIdentifier, GTDIdentifier],
+ plugins: [GroupManagementIdentifier, LobeAgentIdentifier],
systemRole: 'You are a group supervisor...',
});
@@ -888,7 +888,7 @@ describe('resolveAgentConfig', () => {
// Mock: getAgentRuntimeConfig for supervisor agent
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
chatConfig: { enableHistoryCount: false },
- plugins: [GroupManagementIdentifier, GTDIdentifier],
+ plugins: [GroupManagementIdentifier, LobeAgentIdentifier],
systemRole: 'You are a group supervisor...',
});
@@ -901,7 +901,7 @@ describe('resolveAgentConfig', () => {
expect(result.isBuiltinAgent).toBe(true);
expect(result.slug).toBe('group-supervisor');
expect(result.plugins).toContain(GroupManagementIdentifier);
- expect(result.plugins).toContain(GTDIdentifier);
+ expect(result.plugins).toContain(LobeAgentIdentifier);
});
it('should pass groupSupervisorContext to getAgentRuntimeConfig', () => {
@@ -1022,7 +1022,7 @@ describe('resolveAgentConfig', () => {
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
chatConfig: { enableHistoryCount: false },
- plugins: [GroupManagementIdentifier, GTDIdentifier],
+ plugins: [GroupManagementIdentifier, LobeAgentIdentifier],
systemRole: 'Supervisor system role',
});
@@ -1042,67 +1042,67 @@ describe('resolveAgentConfig', () => {
});
});
- describe('sub-task filtering (isSubTask)', () => {
+ describe('sub-agent filtering (isSubAgent)', () => {
beforeEach(() => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentSlugById').mockReturnValue(() => undefined);
});
- it('should filter out lobe-gtd when isSubTask is true for regular agent', () => {
+ it('should filter out lobe-agent when isSubAgent is true for regular agent', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentConfigById').mockReturnValue(
() =>
({
...mockAgentConfig,
- plugins: ['lobe-gtd', 'plugin-a', 'plugin-b'],
+ plugins: ['lobe-agent', 'plugin-a', 'plugin-b'],
}) as any,
);
const result = resolveAgentConfig({
agentId: 'test-agent',
- isSubTask: true,
+ isSubAgent: true,
});
- expect(result.plugins).not.toContain('lobe-gtd');
+ expect(result.plugins).not.toContain('lobe-agent');
expect(result.plugins).toEqual(['plugin-a', 'plugin-b']);
});
- it('should keep lobe-gtd when isSubTask is false', () => {
+ it('should keep lobe-agent when isSubAgent is false', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentConfigById').mockReturnValue(
() =>
({
...mockAgentConfig,
- plugins: ['lobe-gtd', 'plugin-a', 'plugin-b'],
+ plugins: ['lobe-agent', 'plugin-a', 'plugin-b'],
}) as any,
);
const result = resolveAgentConfig({
agentId: 'test-agent',
- isSubTask: false,
+ isSubAgent: false,
});
- expect(result.plugins).toContain('lobe-gtd');
- expect(result.plugins).toEqual(['lobe-gtd', 'plugin-a', 'plugin-b']);
+ expect(result.plugins).toContain('lobe-agent');
+ expect(result.plugins).toEqual(['lobe-agent', 'plugin-a', 'plugin-b']);
});
- it('should keep lobe-gtd when isSubTask is undefined', () => {
+ it('should keep lobe-agent when isSubAgent is undefined', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentConfigById').mockReturnValue(
() =>
({
...mockAgentConfig,
- plugins: ['lobe-gtd', 'plugin-a'],
+ plugins: ['lobe-agent', 'plugin-a'],
}) as any,
);
const result = resolveAgentConfig({ agentId: 'test-agent' });
- expect(result.plugins).toContain('lobe-gtd');
+ expect(result.plugins).toContain('lobe-agent');
});
- it('should filter lobe-gtd in page scope when isSubTask is true', () => {
+ it('should filter lobe-agent in page scope when isSubAgent is true', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentConfigById').mockReturnValue(
() =>
({
...mockAgentConfig,
- plugins: ['lobe-gtd', 'plugin-a'],
+ plugins: ['lobe-agent', 'plugin-a'],
}) as any,
);
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
@@ -1112,46 +1112,46 @@ describe('resolveAgentConfig', () => {
const result = resolveAgentConfig({
agentId: 'test-agent',
scope: 'page',
- isSubTask: true,
+ isSubAgent: true,
});
- expect(result.plugins).not.toContain('lobe-gtd');
+ expect(result.plugins).not.toContain('lobe-agent');
expect(result.plugins).toContain(PageAgentIdentifier);
});
- it('should filter lobe-gtd for builtin agent when isSubTask is true', () => {
+ it('should filter lobe-agent for builtin agent when isSubAgent is true', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentSlugById').mockReturnValue(
() => 'agent-builder',
);
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
- plugins: ['lobe-gtd', 'runtime-plugin'],
+ plugins: ['lobe-agent', 'runtime-plugin'],
systemRole: 'Runtime system role',
});
const result = resolveAgentConfig({
agentId: 'builtin-agent',
- isSubTask: true,
+ isSubAgent: true,
});
- expect(result.plugins).not.toContain('lobe-gtd');
+ expect(result.plugins).not.toContain('lobe-agent');
expect(result.plugins).toContain('runtime-plugin');
});
- it('should keep lobe-gtd for builtin agent when isSubTask is false', () => {
+ it('should keep lobe-agent for builtin agent when isSubAgent is false', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentSlugById').mockReturnValue(
() => 'agent-builder',
);
vi.spyOn(builtinAgents, 'getAgentRuntimeConfig').mockReturnValue({
- plugins: ['lobe-gtd', 'runtime-plugin'],
+ plugins: ['lobe-agent', 'runtime-plugin'],
systemRole: 'Runtime system role',
});
const result = resolveAgentConfig({
agentId: 'builtin-agent',
- isSubTask: false,
+ isSubAgent: false,
});
- expect(result.plugins).toContain('lobe-gtd');
+ expect(result.plugins).toContain('lobe-agent');
});
});
@@ -1165,7 +1165,7 @@ describe('resolveAgentConfig', () => {
() =>
({
...mockAgentConfig,
- plugins: ['plugin-a', 'plugin-b', 'lobe-gtd'],
+ plugins: ['plugin-a', 'plugin-b', 'lobe-agent'],
}) as any,
);
@@ -1226,22 +1226,22 @@ describe('resolveAgentConfig', () => {
expect(result.plugins).toEqual([]);
});
- it('should take precedence over isSubTask filtering', () => {
+ it('should take precedence over isSubAgent filtering', () => {
vi.spyOn(agentSelectors.agentSelectors, 'getAgentConfigById').mockReturnValue(
() =>
({
...mockAgentConfig,
- plugins: ['lobe-gtd', 'plugin-a'],
+ plugins: ['lobe-agent', 'plugin-a'],
}) as any,
);
const result = resolveAgentConfig({
agentId: 'test-agent',
disableTools: true,
- isSubTask: true,
+ isSubAgent: true,
});
- // disableTools should result in empty plugins regardless of isSubTask
+ // disableTools should result in empty plugins regardless of isSubAgent
expect(result.plugins).toEqual([]);
});
diff --git a/src/services/chat/mecha/agentConfigResolver.ts b/src/services/chat/mecha/agentConfigResolver.ts
index 43ab4315003..2a95209c609 100644
--- a/src/services/chat/mecha/agentConfigResolver.ts
+++ b/src/services/chat/mecha/agentConfigResolver.ts
@@ -87,10 +87,11 @@ export interface AgentConfigResolverContext {
groupId?: string;
/**
- * Whether this is a sub-task execution.
- * When true, filters out lobe-gtd tools to prevent nested sub-task creation.
+ * Whether this is a sub-agent execution.
+ * When true, filters out the lobe-agent tool (which owns the sub-agent
+ * dispatch APIs) to prevent nested sub-agent creation.
*/
- isSubTask?: boolean;
+ isSubAgent?: boolean;
/** Current model being used (for template variables) */
model?: string;
@@ -143,20 +144,21 @@ export interface ResolvedAgentConfig {
* For regular agents, this simply returns the config from the store.
*/
export const resolveAgentConfig = (ctx: AgentConfigResolverContext): ResolvedAgentConfig => {
- const { agentId, model, documentContent, plugins, targetAgentConfig, isSubTask, disableTools } =
+ const { agentId, model, documentContent, plugins, targetAgentConfig, isSubAgent, disableTools } =
ctx;
log(
- 'resolveAgentConfig called with agentId: %s, scope: %s, isSubTask: %s, disableTools: %s',
+ 'resolveAgentConfig called with agentId: %s, scope: %s, isSubAgent: %s, disableTools: %s',
agentId,
ctx.scope,
- isSubTask,
+ isSubAgent,
disableTools,
);
// Helper to apply plugin filters:
// 1. If disableTools is true, return empty array (for broadcast scenarios)
- // 2. If isSubTask is true, filter out lobe-gtd to prevent nested sub-task creation
+ // 2. If isSubAgent is true, filter out lobe-agent (which owns the sub-agent
+ // dispatch APIs) to prevent nested sub-agent creation.
const applyPluginFilters = (pluginIds: string[]) => {
if (disableTools) {
log('disableTools is true, returning empty plugins');
@@ -169,7 +171,7 @@ export const resolveAgentConfig = (ctx: AgentConfigResolverContext): ResolvedAge
nextPluginIds = nextPluginIds.filter((id) => id !== PageAgentIdentifier);
}
- return isSubTask ? nextPluginIds.filter((id) => id !== 'lobe-gtd') : nextPluginIds;
+ return isSubAgent ? nextPluginIds.filter((id) => id !== 'lobe-agent') : nextPluginIds;
};
const agentStoreState = getAgentStoreState();
diff --git a/src/services/chat/mecha/contextEngineering.ts b/src/services/chat/mecha/contextEngineering.ts
index 469260c3815..c22e87b5616 100644
--- a/src/services/chat/mecha/contextEngineering.ts
+++ b/src/services/chat/mecha/contextEngineering.ts
@@ -9,7 +9,7 @@ import {
type KlavisServiceSummary,
} from '@lobechat/builtin-tool-creds';
import { GroupAgentBuilderIdentifier } from '@lobechat/builtin-tool-group-agent-builder';
-import { GTDIdentifier } from '@lobechat/builtin-tool-gtd';
+import { LobeAgentIdentifier } from '@lobechat/builtin-tool-lobe-agent';
import { PageAgentIdentifier } from '@lobechat/builtin-tool-page-agent';
import { WebOnboardingIdentifier } from '@lobechat/builtin-tool-web-onboarding';
import { KLAVIS_SERVER_TYPES, LOBEHUB_SKILL_PROVIDERS } from '@lobechat/const';
@@ -20,10 +20,10 @@ import type {
AgentManagementContext,
GroupAgentBuilderContext,
GroupOfficialToolItem,
- GTDConfig,
LobeToolManifest,
MemoryContext,
OnboardingContext,
+ PlanTodoConfig,
ToolDiscoveryConfig,
UserMemoryData,
} from '@lobechat/context-engine';
@@ -98,7 +98,7 @@ interface ContextEngineeringContext {
stepContext?: RuntimeStepContext;
systemRole?: string;
tools?: string[];
- /** Topic ID for GTD context injection */
+ /** Topic ID for plan/todo context injection */
topicId?: string;
}
@@ -317,12 +317,12 @@ export const contextEngineering = async ({
userMemoryData = combineUserMemoryData(topicMemories, persona);
}
- // Resolve GTD context: plan and todos
- // GTD tool must be enabled and topicId must be provided
- const isGTDEnabled = tools?.includes(GTDIdentifier) ?? false;
- let gtdConfig: GTDConfig | undefined;
+ // Resolve plan + todos context (now part of the lobe-agent tool).
+ // Lobe-agent must be enabled and topicId must be provided.
+ const isPlanTodoEnabled = tools?.includes(LobeAgentIdentifier) ?? false;
+ let planTodoConfig: PlanTodoConfig | undefined;
- if (isGTDEnabled && topicId) {
+ if (isPlanTodoEnabled && topicId) {
try {
// Fetch plan document for the current topic
const planResult = await notebookService.listDocuments({
@@ -347,17 +347,17 @@ export const contextEngineering = async ({
// Get todos from plan's metadata
const todos = planDoc.metadata?.todos;
- gtdConfig = {
+ planTodoConfig = {
enabled: true,
plan,
todos,
};
- log('GTD context resolved: plan=%s, todos=%o', plan.goal, todos?.items?.length ?? 0);
+ log('Plan/Todo context resolved: plan=%s, todos=%o', plan.goal, todos?.items?.length ?? 0);
}
} catch (error) {
- // Silently fail - GTD context is optional
- log('Failed to resolve GTD context:', error);
+ // Silently fail - plan/todo context is optional
+ log('Failed to resolve plan/todo context:', error);
}
}
@@ -742,7 +742,7 @@ export const contextEngineering = async ({
...(isGroupAgentBuilderEnabled && { groupAgentBuilderContext }),
...(agentManagementContext && { agentManagementContext }),
...(agentGroup && { agentGroup }),
- ...(gtdConfig && { gtd: gtdConfig }),
+ ...(planTodoConfig && { planTodo: planTodoConfig }),
...(topicReferences && topicReferences.length > 0 && { topicReferences }),
...(onboardingContext && { onboardingContext }),
});
diff --git a/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts b/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts
index 972b75de5db..def3635c32d 100644
--- a/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts
+++ b/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts
@@ -701,7 +701,7 @@ export const createGroupOrchestrationExecutors = (
// 4. Create a child operation for task execution (now with threadId)
const { operationId: taskOperationId } = get().startOperation({
- type: 'execClientTask',
+ type: 'execClientSubAgent',
context: subContext,
parentOperationId: orchestrationOperationId,
metadata: {
@@ -743,7 +743,7 @@ export const createGroupOrchestrationExecutors = (
parentMessageType: 'user',
operationId: taskOperationId,
parentOperationId: orchestrationOperationId,
- isSubTask: true, // Disable lobe-gtd tools to prevent nested sub-tasks
+ isSubAgent: true, // Disable lobe-agent tool to prevent nested sub-agents
});
log(`[${sessionLogId}] Client-side AgentRuntime execution completed`);
diff --git a/src/store/chat/agents/__tests__/createAgentExecutors/exec-task.test.ts b/src/store/chat/agents/__tests__/createAgentExecutors/exec-task.test.ts
index e8aca8d5e9d..cbee950e666 100644
--- a/src/store/chat/agents/__tests__/createAgentExecutors/exec-task.test.ts
+++ b/src/store/chat/agents/__tests__/createAgentExecutors/exec-task.test.ts
@@ -1,10 +1,10 @@
-import { type AgentRuntimeContext, type TaskResultPayload } from '@lobechat/agent-runtime';
+import { type AgentRuntimeContext, type SubAgentResultPayload } from '@lobechat/agent-runtime';
import { type Mock } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import { aiAgentService } from '@/services/aiAgent';
-import { createExecTaskInstruction } from './fixtures';
+import { createExecSubAgentInstruction } from './fixtures';
import { createMockStore } from './fixtures/mockStore';
import { createInitialState, createTestContext, executeWithMockContext } from './helpers';
@@ -20,7 +20,7 @@ vi.mock('@/services/aiAgent', () => ({
const mockExecSubAgentTask = aiAgentService.execSubAgentTask as Mock;
const mockGetSubAgentTaskStatus = aiAgentService.getSubAgentTaskStatus as Mock;
-describe('exec_task executor', () => {
+describe('exec_sub_agent executor', () => {
beforeEach(() => {
vi.clearAllMocks();
});
@@ -30,7 +30,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction(
+ const instruction = createExecSubAgentInstruction(
{ description: 'Test task', instruction: 'Do something' },
'msg_parent',
);
@@ -56,7 +56,7 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
@@ -64,9 +64,9 @@ describe('exec_task executor', () => {
// Then
expect(result.nextContext).toBeDefined();
- expect((result.nextContext as AgentRuntimeContext).phase).toBe('task_result');
+ expect((result.nextContext as AgentRuntimeContext).phase).toBe('sub_agent_result');
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result).toBeDefined();
expect(payload.result.success).toBe(true);
expect(payload.result.threadId).toBe('thread_1');
@@ -79,7 +79,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext({ agentId: undefined, topicId: null });
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId: 'test-op' });
// Override operation context to have no agentId/topicId
@@ -99,7 +99,7 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
@@ -107,7 +107,7 @@ describe('exec_task executor', () => {
// Then
expect(result.nextContext).toBeDefined();
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(false);
expect(payload.result.error).toBe('No valid context available');
});
@@ -116,7 +116,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId: 'test-op' });
// Mock task message creation failure
@@ -125,14 +125,14 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
});
// Then
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(false);
expect(payload.result.error).toBe('Failed to create task message');
});
@@ -141,7 +141,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -157,14 +157,14 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
});
// Then
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(false);
expect(payload.result.error).toBe('API error');
expect(mockStore.optimisticUpdateMessageContent).toHaveBeenCalledWith(
@@ -179,7 +179,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -199,14 +199,14 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
});
// Then
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(false);
expect(payload.result.error).toBe('Execution error');
});
@@ -217,7 +217,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -239,7 +239,7 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
@@ -254,7 +254,7 @@ describe('exec_task executor', () => {
},
{ operationId: 'test-op' },
);
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(true);
});
@@ -262,7 +262,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -282,14 +282,14 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
});
// Then
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(false);
expect(payload.result.error).toBe('Task was cancelled');
expect(mockStore.optimisticUpdateMessageContent).toHaveBeenCalledWith(
@@ -308,7 +308,7 @@ describe('exec_task executor', () => {
// Use same operationId for both context and state
const operationId = 'test-op';
const context = createTestContext({ operationId });
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ operationId });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -330,14 +330,14 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
});
// Then
- const payload = (result.nextContext as AgentRuntimeContext).payload as TaskResultPayload;
+ const payload = (result.nextContext as AgentRuntimeContext).payload as SubAgentResultPayload;
expect(payload.result.success).toBe(false);
expect(payload.result.error).toBe('Operation cancelled');
// getSubAgentTaskStatus should not be called since operation was cancelled before poll
@@ -346,11 +346,11 @@ describe('exec_task executor', () => {
});
describe('Result Phase', () => {
- it('should return task_result phase with correct session info', async () => {
+ it('should return sub_agent_result phase with correct session info', async () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction(
+ const instruction = createExecSubAgentInstruction(
{ description: 'Test', instruction: 'Test instruction' },
'msg_parent',
);
@@ -373,7 +373,7 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
@@ -382,11 +382,11 @@ describe('exec_task executor', () => {
// Then
expect(result.nextContext).toBeDefined();
const nextContext = result.nextContext as AgentRuntimeContext;
- expect(nextContext.phase).toBe('task_result');
+ expect(nextContext.phase).toBe('sub_agent_result');
expect(nextContext.session?.stepCount).toBe(6);
expect(nextContext.session?.status).toBe('running');
- const payload = nextContext.payload as TaskResultPayload;
+ const payload = nextContext.payload as SubAgentResultPayload;
expect(payload.parentMessageId).toBe('msg_parent');
});
@@ -394,7 +394,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTaskInstruction();
+ const instruction = createExecSubAgentInstruction();
const state = createInitialState({ messages: [], operationId: 'test-op' });
const updatedMessages = [{ content: 'test', id: 'msg_1', role: 'user' }];
@@ -417,7 +417,7 @@ describe('exec_task executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
@@ -433,7 +433,7 @@ describe('exec_task executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext({ agentId: 'agent_1', topicId: 'topic_1' });
- const instruction = createExecTaskInstruction(
+ const instruction = createExecSubAgentInstruction(
{ description: 'Test task', instruction: 'Do something important' },
'msg_parent',
);
@@ -456,7 +456,7 @@ describe('exec_task executor', () => {
// When
await executeWithMockContext({
context,
- executor: 'exec_task',
+ executor: 'exec_sub_agent',
instruction,
mockStore,
state,
diff --git a/src/store/chat/agents/__tests__/createAgentExecutors/exec-tasks.test.ts b/src/store/chat/agents/__tests__/createAgentExecutors/exec-tasks.test.ts
index b03032828b7..c2400e4c5a2 100644
--- a/src/store/chat/agents/__tests__/createAgentExecutors/exec-tasks.test.ts
+++ b/src/store/chat/agents/__tests__/createAgentExecutors/exec-tasks.test.ts
@@ -1,10 +1,13 @@
-import { type AgentRuntimeContext, type TasksBatchResultPayload } from '@lobechat/agent-runtime';
+import {
+ type AgentRuntimeContext,
+ type SubAgentsBatchResultPayload,
+} from '@lobechat/agent-runtime';
import { type Mock } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import { aiAgentService } from '@/services/aiAgent';
-import { createExecTasksInstruction } from './fixtures';
+import { createExecSubAgentsInstruction } from './fixtures';
import { createMockStore } from './fixtures/mockStore';
import { createInitialState, createTestContext, executeWithMockContext } from './helpers';
@@ -20,7 +23,7 @@ vi.mock('@/services/aiAgent', () => ({
const mockExecSubAgentTask = aiAgentService.execSubAgentTask as Mock;
const mockGetSubAgentTaskStatus = aiAgentService.getSubAgentTaskStatus as Mock;
-describe('exec_tasks executor', () => {
+describe('exec_sub_agents executor', () => {
beforeEach(() => {
vi.clearAllMocks();
});
@@ -30,7 +33,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction(
+ const instruction = createExecSubAgentsInstruction(
[{ description: 'Test task 1', instruction: 'Do something' }],
'msg_parent',
);
@@ -56,7 +59,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -64,10 +67,10 @@ describe('exec_tasks executor', () => {
// Then
expect(result.nextContext).toBeDefined();
- expect((result.nextContext as AgentRuntimeContext).phase).toBe('tasks_batch_result');
+ expect((result.nextContext as AgentRuntimeContext).phase).toBe('sub_agents_batch_result');
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results).toHaveLength(1);
expect(payload.results[0].success).toBe(true);
expect(payload.results[0].threadId).toBe('thread_1');
@@ -78,7 +81,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction(
+ const instruction = createExecSubAgentsInstruction(
[
{ description: 'Task 1', instruction: 'Do task 1' },
{ description: 'Task 2', instruction: 'Do task 2' },
@@ -124,7 +127,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -133,7 +136,7 @@ describe('exec_tasks executor', () => {
// Then
expect(result.nextContext).toBeDefined();
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results).toHaveLength(3);
expect(payload.results.every((r) => r.success)).toBe(true);
});
@@ -144,7 +147,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext({ agentId: undefined, topicId: null });
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId: 'test-op' });
// Override operation context to have no agentId/topicId
@@ -164,7 +167,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -173,7 +176,7 @@ describe('exec_tasks executor', () => {
// Then
expect(result.nextContext).toBeDefined();
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results).toHaveLength(1);
expect(payload.results[0].success).toBe(false);
expect(payload.results[0].error).toBe('No valid context available');
@@ -183,7 +186,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId: 'test-op' });
// Mock task message creation failure
@@ -192,7 +195,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -200,7 +203,7 @@ describe('exec_tasks executor', () => {
// Then
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results[0].success).toBe(false);
expect(payload.results[0].error).toBe('Failed to create task message');
});
@@ -209,7 +212,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -225,7 +228,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -233,7 +236,7 @@ describe('exec_tasks executor', () => {
// Then
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results[0].success).toBe(false);
expect(payload.results[0].error).toBe('API error');
expect(mockStore.optimisticUpdateMessageContent).toHaveBeenCalledWith(
@@ -248,7 +251,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -268,7 +271,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -276,7 +279,7 @@ describe('exec_tasks executor', () => {
// Then
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results[0].success).toBe(false);
expect(payload.results[0].error).toBe('Execution error');
});
@@ -287,7 +290,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -309,7 +312,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -325,7 +328,7 @@ describe('exec_tasks executor', () => {
{ operationId: 'test-op' },
);
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results[0].success).toBe(true);
});
@@ -333,7 +336,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId: 'test-op' });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -353,7 +356,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -361,7 +364,7 @@ describe('exec_tasks executor', () => {
// Then
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results[0].success).toBe(false);
expect(payload.results[0].error).toBe('Task was cancelled');
expect(mockStore.optimisticUpdateMessageContent).toHaveBeenCalledWith(
@@ -380,7 +383,7 @@ describe('exec_tasks executor', () => {
// Use same operationId for both context and state
const operationId = 'test-op';
const context = createTestContext({ operationId });
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ operationId });
(mockStore.optimisticCreateMessage as Mock).mockResolvedValueOnce({ id: 'task_msg_1' });
@@ -403,7 +406,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -411,7 +414,7 @@ describe('exec_tasks executor', () => {
// Then
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results[0].success).toBe(false);
expect(payload.results[0].error).toBe('Operation cancelled');
// getSubAgentTaskStatus should not be called since operation was cancelled before poll
@@ -424,7 +427,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction(
+ const instruction = createExecSubAgentsInstruction(
[{ description: 'Test', instruction: 'Test instruction' }],
'msg_parent',
);
@@ -447,7 +450,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -456,11 +459,11 @@ describe('exec_tasks executor', () => {
// Then
expect(result.nextContext).toBeDefined();
const nextContext = result.nextContext as AgentRuntimeContext;
- expect(nextContext.phase).toBe('tasks_batch_result');
+ expect(nextContext.phase).toBe('sub_agents_batch_result');
expect(nextContext.session?.stepCount).toBe(6);
expect(nextContext.session?.status).toBe('running');
- const payload = nextContext.payload as TasksBatchResultPayload;
+ const payload = nextContext.payload as SubAgentsBatchResultPayload;
expect(payload.parentMessageId).toBe('msg_parent');
});
@@ -468,7 +471,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction();
+ const instruction = createExecSubAgentsInstruction();
const state = createInitialState({ messages: [], operationId: 'test-op' });
const updatedMessages = [{ content: 'test', id: 'msg_1', role: 'user' }];
@@ -491,7 +494,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -507,7 +510,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext({ agentId: 'agent_1', topicId: 'topic_1' });
- const instruction = createExecTasksInstruction(
+ const instruction = createExecSubAgentsInstruction(
[{ description: 'Test task', instruction: 'Do something important' }],
'msg_parent',
);
@@ -530,7 +533,7 @@ describe('exec_tasks executor', () => {
// When
await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -557,7 +560,7 @@ describe('exec_tasks executor', () => {
// Given
const mockStore = createMockStore();
const context = createTestContext();
- const instruction = createExecTasksInstruction(
+ const instruction = createExecSubAgentsInstruction(
[
{ description: 'Task 1', instruction: 'Success task' },
{ description: 'Task 2', instruction: 'Fail task' },
@@ -591,7 +594,7 @@ describe('exec_tasks executor', () => {
// When
const result = await executeWithMockContext({
context,
- executor: 'exec_tasks',
+ executor: 'exec_sub_agents',
instruction,
mockStore,
state,
@@ -599,7 +602,7 @@ describe('exec_tasks executor', () => {
// Then
const payload = (result.nextContext as AgentRuntimeContext)
- .payload as TasksBatchResultPayload;
+ .payload as SubAgentsBatchResultPayload;
expect(payload.results).toHaveLength(2);
expect(payload.results[0].success).toBe(true);
expect(payload.results[1].success).toBe(false);
diff --git a/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockInstructions.ts b/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockInstructions.ts
index 68e7fadf207..a83adc15d4f 100644
--- a/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockInstructions.ts
+++ b/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockInstructions.ts
@@ -2,11 +2,11 @@ import {
type AgentInstruction,
type AgentInstructionCallLlm,
type AgentInstructionCallTool,
- type AgentInstructionExecTask,
- type AgentInstructionExecTasks,
- type ExecTaskItem,
+ type AgentInstructionExecSubAgent,
+ type AgentInstructionExecSubAgents,
type GeneralAgentCallingToolInstructionPayload,
type GeneralAgentCallLLMInstructionPayload,
+ type SubAgentTask,
} from '@lobechat/agent-runtime';
import { type ChatToolPayload } from '@lobechat/types';
import { nanoid } from '@lobechat/utils';
@@ -129,13 +129,13 @@ export const createFinishInstruction = (
};
/**
- * Create a mock exec_task instruction (single task)
+ * Create a mock exec_sub_agent instruction (single sub-agent)
*/
-export const createExecTaskInstruction = (
- task?: Partial<ExecTaskItem>,
+export const createExecSubAgentInstruction = (
+ task?: Partial<SubAgentTask>,
parentMessageId?: string,
-): AgentInstructionExecTask => {
- const defaultTask: ExecTaskItem = {
+): AgentInstructionExecSubAgent => {
+ const defaultTask: SubAgentTask = {
description: 'Test task',
instruction: 'Execute test task',
...task,
@@ -146,18 +146,18 @@ export const createExecTaskInstruction = (
parentMessageId: parentMessageId || `msg_${nanoid()}`,
task: defaultTask,
},
- type: 'exec_task',
+ type: 'exec_sub_agent',
};
};
/**
- * Create a mock exec_tasks instruction (multiple tasks)
+ * Create a mock exec_sub_agents instruction (multiple sub-agents)
*/
-export const createExecTasksInstruction = (
- tasks: ExecTaskItem[] = [],
+export const createExecSubAgentsInstruction = (
+ tasks: SubAgentTask[] = [],
parentMessageId?: string,
-): AgentInstructionExecTasks => {
- const defaultTasks: ExecTaskItem[] = tasks.length
+): AgentInstructionExecSubAgents => {
+ const defaultTasks: SubAgentTask[] = tasks.length
? tasks
: [
{
@@ -171,6 +171,6 @@ export const createExecTasksInstruction = (
parentMessageId: parentMessageId || `msg_${nanoid()}`,
tasks: defaultTasks,
},
- type: 'exec_tasks',
+ type: 'exec_sub_agents',
};
};
diff --git a/src/store/chat/agents/createAgentExecutors.ts b/src/store/chat/agents/createAgentExecutors.ts
index 156e46a5dce..0fa68e78361 100644
--- a/src/store/chat/agents/createAgentExecutors.ts
+++ b/src/store/chat/agents/createAgentExecutors.ts
@@ -4,10 +4,10 @@ import type {
AgentInstructionCallLlm,
AgentInstructionCallTool,
AgentInstructionCompressContext,
- AgentInstructionExecClientTask,
- AgentInstructionExecClientTasks,
- AgentInstructionExecTask,
- AgentInstructionExecTasks,
+ AgentInstructionExecClientSubAgent,
+ AgentInstructionExecClientSubAgents,
+ AgentInstructionExecSubAgent,
+ AgentInstructionExecSubAgents,
AgentRuntimeContext,
GeneralAgentCallingToolInstructionPayload,
GeneralAgentCallLLMInstructionPayload,
@@ -15,8 +15,8 @@ import type {
GeneralAgentCallToolResultPayload,
GeneralAgentCompressionResultPayload,
InstructionExecutor,
- TaskResultPayload,
- TasksBatchResultPayload,
+ SubAgentResultPayload,
+ SubAgentsBatchResultPayload,
} from '@lobechat/agent-runtime';
import { calculateMessageTokens, UsageCounter } from '@lobechat/agent-runtime';
import { isDesktop } from '@lobechat/const';
@@ -144,7 +144,7 @@ const localizeError = (error: ChatMessageError): ChatMessageError => {
* @param context.skipCreateFirstMessage - Skip first message creation
*/
export const createAgentExecutors = (context: {
- /** Pre-resolved agent config with isSubTask filtering applied */
+ /** Pre-resolved agent config with isSubAgent filtering applied */
agentConfig: ResolvedAgentConfig;
get: () => ChatStore;
messageKey: string;
@@ -1004,10 +1004,17 @@ export const createAgentExecutors = (context: {
const stateType = result.state?.type;
- // GTD async tasks need to be passed to Agent for exec_task/exec_tasks instruction
- // Includes both server-side (execTask/execTasks) and client-side (execClientTask/execClientTasks)
- const execTaskStateTypes = ['execTask', 'execTasks', 'execClientTask', 'execClientTasks'];
- if (execTaskStateTypes.includes(stateType)) {
+ // Sub-agent dispatches need to be forwarded to the Agent runtime as an
+ // exec_sub_agent / exec_sub_agents instruction. Covers both server-side
+ // (execSubAgent / execSubAgents) and client-side (execClientSubAgent /
+ // execClientSubAgents) wire-level state types.
+ const subAgentStateTypes = [
+ 'execSubAgent',
+ 'execSubAgents',
+ 'execClientSubAgent',
+ 'execClientSubAgents',
+ ];
+ if (subAgentStateTypes.includes(stateType)) {
log(
'[%s][call_tool] Detected %s state, passing to Agent for decision',
sessionLogId,
@@ -1298,23 +1305,23 @@ export const createAgentExecutors = (context: {
},
/**
- * exec_task executor
- * Executes a single async task
+ * exec_sub_agent executor
+ * Dispatches a single sub-agent
*
* Flow:
* 1. Create a task message (role: 'task') as placeholder
* 2. Call execSubAgentTask API (backend creates thread)
- * 3. Poll for task completion
+ * 3. Poll for sub-agent completion
* 4. Update task message content with result on completion
- * 5. Return task_result phase with result
+ * 5. Return sub_agent_result phase with result
*/
- exec_task: async (instruction, state) => {
- const { parentMessageId, task } = (instruction as AgentInstructionExecTask).payload;
+ exec_sub_agent: async (instruction, state) => {
+ const { parentMessageId, task } = (instruction as AgentInstructionExecSubAgent).payload;
const events: AgentEvent[] = [];
const sessionLogId = `${state.operationId}:${state.stepCount}`;
- log('[%s][exec_task] Starting execution of task: %s', sessionLogId, task.description);
+ log('[%s][exec_sub_agent] Starting execution of task: %s', sessionLogId, task.description);
// Get context from operation
const opContext = getOperationContext();
@@ -1325,7 +1332,7 @@ export const createAgentExecutors = (context: {
const executionAgentId = targetAgentId || agentId;
if (!agentId || !topicId || !executionAgentId) {
- log('[%s][exec_task] No valid context, cannot execute task', sessionLogId);
+ log('[%s][exec_sub_agent] No valid context, cannot execute task', sessionLogId);
return {
events,
newState: state,
@@ -1338,8 +1345,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -1352,7 +1359,7 @@ export const createAgentExecutors = (context: {
if (targetAgentId) {
log(
- '[%s][exec_task] callAgent mode - current agent: %s, target agent: %s',
+ '[%s][exec_sub_agent] callAgent mode - current agent: %s, target agent: %s',
sessionLogId,
agentId,
targetAgentId,
@@ -1396,8 +1403,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -1416,7 +1423,7 @@ export const createAgentExecutors = (context: {
// This ensures the task executes with the correct agent's config
log('[%s] Using server-side execution with agentId: %s', taskLogId, executionAgentId);
const createResult = await aiAgentService.execSubAgentTask({
- agentId: executionAgentId, // Use targetAgentId for callAgent, or current agentId for GTD
+ agentId: executionAgentId, // Use targetAgentId for callAgent, or current agentId for sub-agent dispatch
instruction: task.instruction,
parentMessageId: taskMessageId,
title: task.description,
@@ -1445,8 +1452,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -1501,8 +1508,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: createResult.threadId,
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: updatedMessages.length,
sessionId: state.operationId,
@@ -1552,8 +1559,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: createResult.threadId,
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: updatedMessages.length,
sessionId: state.operationId,
@@ -1589,8 +1596,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: createResult.threadId,
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: updatedMessages.length,
sessionId: state.operationId,
@@ -1623,8 +1630,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: createResult.threadId,
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: updatedMessages.length,
sessionId: state.operationId,
@@ -1672,8 +1679,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: createResult.threadId,
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: updatedMessages.length,
sessionId: state.operationId,
@@ -1696,8 +1703,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -1710,30 +1717,30 @@ export const createAgentExecutors = (context: {
},
/**
- * exec_tasks executor
- * Executes one or more async tasks in parallel
+ * exec_sub_agents executor
+ * Dispatches one or more sub-agents in parallel
*
* Flow:
- * 1. For each task, create a task message (role: 'task') as placeholder
+ * 1. For each sub-agent, create a task message (role: 'task') as placeholder
* 2. Call execSubAgentTask API (backend creates thread)
- * 3. Poll for task completion
+ * 3. Poll for sub-agent completion
* 4. Update task message content with result on completion
- * 5. Return tasks_batch_result phase with all results
+ * 5. Return sub_agents_batch_result phase with all results
*/
- exec_tasks: async (instruction, state) => {
- const { parentMessageId, tasks } = (instruction as AgentInstructionExecTasks).payload;
+ exec_sub_agents: async (instruction, state) => {
+ const { parentMessageId, tasks } = (instruction as AgentInstructionExecSubAgents).payload;
const events: AgentEvent[] = [];
const sessionLogId = `${state.operationId}:${state.stepCount}`;
- log('[%s][exec_tasks] Starting execution of %d tasks', sessionLogId, tasks.length);
+ log('[%s][exec_sub_agents] Starting execution of %d tasks', sessionLogId, tasks.length);
// Get context from operation
const opContext = getOperationContext();
const { agentId, topicId } = opContext;
if (!agentId || !topicId) {
- log('[%s][exec_tasks] No valid context, cannot execute tasks', sessionLogId);
+ log('[%s][exec_sub_agents] No valid context, cannot execute tasks', sessionLogId);
return {
events,
newState: state,
@@ -1746,8 +1753,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
})),
- } as TasksBatchResultPayload,
- phase: 'tasks_batch_result',
+ } as SubAgentsBatchResultPayload,
+ phase: 'sub_agents_batch_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -1977,13 +1984,13 @@ export const createAgentExecutors = (context: {
{ concurrency: 15 }, // Limit concurrent tasks
);
- log('[%s][exec_tasks] All tasks completed, results: %O', sessionLogId, results);
+ log('[%s][exec_sub_agents] All tasks completed, results: %O', sessionLogId, results);
// Get latest messages from store
const updatedMessages = context.get().dbMessagesMap[context.messageKey] || [];
const newState = { ...state, messages: updatedMessages };
- // Return tasks_batch_result phase
+ // Return sub_agents_batch_result phase
return {
events,
newState,
@@ -1991,8 +1998,8 @@ export const createAgentExecutors = (context: {
payload: {
parentMessageId,
results,
- } as TasksBatchResultPayload,
- phase: 'tasks_batch_result',
+ } as SubAgentsBatchResultPayload,
+ phase: 'sub_agents_batch_result',
session: {
messageCount: newState.messages.length,
sessionId: state.operationId,
@@ -2004,9 +2011,9 @@ export const createAgentExecutors = (context: {
},
/**
- * exec_client_task executor
- * Executes a single async task on the client side (desktop only)
- * Used when task requires local tools like file system or shell commands
+ * exec_client_sub_agent executor
+ * Dispatches a single sub-agent on the client side (desktop only)
+ * Used when the sub-agent requires local tools like file system or shell commands
*
* Flow:
* 1. Create a task message (role: 'task') as placeholder
@@ -2014,16 +2021,16 @@ export const createAgentExecutors = (context: {
* 3. Execute using executeClientAgent (client-side)
* 4. Update Thread status via API on completion
* 5. Update task message content with result
- * 6. Return task_result phase with result
+ * 6. Return sub_agent_result phase with result
*/
- exec_client_task: async (instruction, state) => {
- const { parentMessageId, task } = (instruction as AgentInstructionExecClientTask).payload;
+ exec_client_sub_agent: async (instruction, state) => {
+ const { parentMessageId, task } = (instruction as AgentInstructionExecClientSubAgent).payload;
const events: AgentEvent[] = [];
const sessionLogId = `${state.operationId}:${state.stepCount}`;
log(
- '[%s][exec_client_task] Starting client-side execution of task: %s',
+ '[%s][exec_client_sub_agent] Starting client-side execution of task: %s',
sessionLogId,
task.description,
);
@@ -2031,7 +2038,7 @@ export const createAgentExecutors = (context: {
// Check if we're on desktop - if not, this executor shouldn't have been called
if (!isDesktop) {
log(
- '[%s][exec_client_task] ERROR: Not on desktop, cannot execute client-side task',
+ '[%s][exec_client_sub_agent] ERROR: Not on desktop, cannot execute client-side task',
sessionLogId,
);
return {
@@ -2046,8 +2053,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2063,7 +2070,7 @@ export const createAgentExecutors = (context: {
const { agentId, topicId } = opContext;
if (!agentId || !topicId) {
- log('[%s][exec_client_task] No valid context, cannot execute task', sessionLogId);
+ log('[%s][exec_client_sub_agent] No valid context, cannot execute task', sessionLogId);
return {
events,
newState: state,
@@ -2076,8 +2083,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2125,8 +2132,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2138,7 +2145,7 @@ export const createAgentExecutors = (context: {
}
const taskMessageId = taskMessageResult.id;
- log('[%s][exec_client_task] Created task message: %s', taskLogId, taskMessageId);
+ log('[%s][exec_client_sub_agent] Created task message: %s', taskLogId, taskMessageId);
// 2. Create Thread via API first (to get threadId for operation context)
const threadResult = await aiAgentService.createClientTaskThread({
@@ -2150,7 +2157,7 @@ export const createAgentExecutors = (context: {
});
if (!threadResult.success) {
- log('[%s][exec_client_task] Failed to create client task thread', taskLogId);
+ log('[%s][exec_client_sub_agent] Failed to create client task thread', taskLogId);
await context
.get()
.optimisticUpdateMessageContent(
@@ -2171,8 +2178,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2195,7 +2202,7 @@ export const createAgentExecutors = (context: {
// 4. Create a child operation for task execution (now with threadId)
const { operationId: taskOperationId } = context.get().startOperation({
- type: 'execClientTask',
+ type: 'execClientSubAgent',
context: subContext,
parentOperationId: state.operationId,
metadata: {
@@ -2206,7 +2213,7 @@ export const createAgentExecutors = (context: {
},
});
log(
- '[%s][exec_client_task] Created thread: %s, userMessageId: %s, threadMessages: %d',
+ '[%s][exec_client_sub_agent] Created thread: %s, userMessageId: %s, threadMessages: %d',
taskLogId,
threadId,
userMessageId,
@@ -2231,7 +2238,7 @@ export const createAgentExecutors = (context: {
}
// 7. Execute using executeClientAgent (client-side with local tools access)
- log('[%s][exec_client_task] Starting client-side AgentRuntime execution', taskLogId);
+ log('[%s][exec_client_sub_agent] Starting client-side AgentRuntime execution', taskLogId);
const runtimeResult = await context.get().executeClientAgent({
context: subContext,
@@ -2240,10 +2247,10 @@ export const createAgentExecutors = (context: {
parentMessageType: 'user',
operationId: taskOperationId,
parentOperationId: state.operationId,
- isSubTask: true, // Disable lobe-gtd tools to prevent nested sub-tasks
+ isSubAgent: true, // Disable lobe-agent tool to prevent nested sub-agents
});
- log('[%s][exec_client_task] Client-side AgentRuntime execution completed', taskLogId);
+ log('[%s][exec_client_sub_agent] Client-side AgentRuntime execution completed', taskLogId);
// 8. Get execution result from sub-task messages
const subMessageKey = messageMapKey(subContext);
@@ -2252,7 +2259,7 @@ export const createAgentExecutors = (context: {
const resultContent = lastAssistant?.content || 'Task completed';
log(
- '[%s][exec_client_task] Got result from sub-task: %d chars',
+ '[%s][exec_client_sub_agent] Got result from sub-task: %d chars',
taskLogId,
resultContent.length,
);
@@ -2264,7 +2271,7 @@ export const createAgentExecutors = (context: {
const { usage, cost } = runtimeResult || {};
log(
- '[%s][exec_client_task] Runtime usage: tokens=%d, cost=%s, model=%s',
+ '[%s][exec_client_sub_agent] Runtime usage: tokens=%d, cost=%s, model=%s',
taskLogId,
usage?.llm?.tokens?.total,
cost?.total,
@@ -2318,8 +2325,8 @@ export const createAgentExecutors = (context: {
taskMessageId,
threadId,
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: updatedMessages.length,
sessionId: state.operationId,
@@ -2329,7 +2336,7 @@ export const createAgentExecutors = (context: {
} as AgentRuntimeContext,
};
} catch (error) {
- log('[%s][exec_client_task] Error executing client task: %O', taskLogId, error);
+ log('[%s][exec_client_sub_agent] Error executing client task: %O', taskLogId, error);
// Update task message with error
// Note: taskMessageId may not exist if error occurred before message creation
@@ -2347,8 +2354,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
},
- } as TaskResultPayload,
- phase: 'task_result',
+ } as SubAgentResultPayload,
+ phase: 'sub_agent_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2361,26 +2368,27 @@ export const createAgentExecutors = (context: {
},
/**
- * exec_client_tasks executor
- * Executes multiple async tasks on the client side in parallel (desktop only)
- * Used when tasks require local tools like file system or shell commands
+ * exec_client_sub_agents executor
+ * Dispatches multiple sub-agents on the client side in parallel (desktop only)
+ * Used when sub-agents require local tools like file system or shell commands
*
* Flow:
- * 1. For each task, create a task message (role: 'task') as placeholder
+ * 1. For each sub-agent, create a task message (role: 'task') as placeholder
* 2. Create Thread via API (for isolation)
* 3. Execute using executeClientAgent (client-side)
* 4. Update Thread status via API on completion
* 5. Update task message content with result
- * 6. Return tasks_batch_result phase with all results
+ * 6. Return sub_agents_batch_result phase with all results
*/
- exec_client_tasks: async (instruction, state) => {
- const { parentMessageId, tasks } = (instruction as AgentInstructionExecClientTasks).payload;
+ exec_client_sub_agents: async (instruction, state) => {
+ const { parentMessageId, tasks } = (instruction as AgentInstructionExecClientSubAgents)
+ .payload;
const events: AgentEvent[] = [];
const sessionLogId = `${state.operationId}:${state.stepCount}`;
log(
- '[%s][exec_client_tasks] Starting client-side execution of %d tasks',
+ '[%s][exec_client_sub_agents] Starting client-side execution of %d tasks',
sessionLogId,
tasks.length,
);
@@ -2388,7 +2396,7 @@ export const createAgentExecutors = (context: {
// Check if we're on desktop - if not, this executor shouldn't have been called
if (!isDesktop) {
log(
- '[%s][exec_client_tasks] ERROR: Not on desktop, cannot execute client-side tasks',
+ '[%s][exec_client_sub_agents] ERROR: Not on desktop, cannot execute client-side tasks',
sessionLogId,
);
return {
@@ -2403,8 +2411,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
})),
- } as TasksBatchResultPayload,
- phase: 'tasks_batch_result',
+ } as SubAgentsBatchResultPayload,
+ phase: 'sub_agents_batch_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2420,7 +2428,7 @@ export const createAgentExecutors = (context: {
const { agentId, topicId } = opContext;
if (!agentId || !topicId) {
- log('[%s][exec_client_tasks] No valid context, cannot execute tasks', sessionLogId);
+ log('[%s][exec_client_sub_agents] No valid context, cannot execute tasks', sessionLogId);
return {
events,
newState: state,
@@ -2433,8 +2441,8 @@ export const createAgentExecutors = (context: {
taskMessageId: '',
threadId: '',
})),
- } as TasksBatchResultPayload,
- phase: 'tasks_batch_result',
+ } as SubAgentsBatchResultPayload,
+ phase: 'sub_agents_batch_result',
session: {
messageCount: state.messages.length,
sessionId: state.operationId,
@@ -2526,7 +2534,7 @@ export const createAgentExecutors = (context: {
// 4. Create a child operation for task execution (now with threadId)
const { operationId: taskOperationId } = context.get().startOperation({
- type: 'execClientTask',
+ type: 'execClientSubAgent',
context: subContext,
parentOperationId: state.operationId,
metadata: {
@@ -2565,7 +2573,7 @@ export const createAgentExecutors = (context: {
parentMessageType: 'user',
operationId: taskOperationId,
parentOperationId: state.operationId,
- isSubTask: true, // Disable lobe-gtd tools to prevent nested sub-tasks
+ isSubAgent: true, // Disable lobe-agent tool to prevent nested sub-agents
});
log('[%s] Client-side AgentRuntime execution completed', taskLogId);
@@ -2614,7 +2622,7 @@ export const createAgentExecutors = (context: {
{ concurrency: 15 },
);
- log('[%s][exec_client_tasks] All tasks completed, results: %O', sessionLogId, results);
+ log('[%s][exec_client_sub_agents] All tasks completed, results: %O', sessionLogId, results);
// Get latest messages from store
const updatedMessages = context.get().dbMessagesMap[context.messageKey] || [];
@@ -2631,8 +2639,8 @@ export const createAgentExecutors = (context: {
// Use last task message as parent so subsequent messages are created after the tasks
parentMessageId: lastSuccessfulTaskId || parentMessageId,
results,
- } as TasksBatchResultPayload,
- phase: 'tasks_batch_result',
+ } as SubAgentsBatchResultPayload,
+ phase: 'sub_agents_batch_result',
session: {
messageCount: newState.messages.length,
sessionId: state.operationId,
diff --git a/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts b/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts
index 7bd2606c4f9..d94d9a60200 100644
--- a/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts
+++ b/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts
@@ -2281,26 +2281,26 @@ describe('StreamingExecutor actions', () => {
});
});
- describe('isSubTask filtering', () => {
- it('should filter out lobe-gtd tools when isSubTask is true', async () => {
+ describe('isSubAgent filtering', () => {
+ it('should filter out lobe-agent tool when isSubAgent is true', async () => {
const { result } = renderHook(() => useChatStore());
const messages = [createMockMessage({ role: 'user' })];
- // Mock resolveAgentConfig to return plugins including lobe-gtd
+ // Mock resolveAgentConfig to return plugins including lobe-agent
const resolveAgentConfigSpy = vi
.spyOn(agentConfigResolver, 'resolveAgentConfig')
.mockReturnValue({
agentConfig: createMockAgentConfig(),
chatConfig: createMockChatConfig(),
isBuiltinAgent: false,
- plugins: ['lobe-gtd', 'lobe-local-system', 'other-plugin'],
+ plugins: ['lobe-agent', 'lobe-local-system', 'other-plugin'],
});
// Create operation
let operationId: string;
act(() => {
const res = result.current.startOperation({
- type: 'execClientTask',
+ type: 'execClientSubAgent',
context: {
agentId: TEST_IDS.SESSION_ID,
topicId: TEST_IDS.TOPIC_ID,
@@ -2309,13 +2309,13 @@ describe('StreamingExecutor actions', () => {
operationId = res.operationId;
});
- // Call internal_createAgentState with isSubTask: true
+ // Call internal_createAgentState with isSubAgent: true
act(() => {
result.current.internal_createAgentState({
messages,
parentMessageId: TEST_IDS.USER_MESSAGE_ID,
operationId,
- isSubTask: true,
+ isSubAgent: true,
});
});
@@ -2325,21 +2325,21 @@ describe('StreamingExecutor actions', () => {
resolveAgentConfigSpy.mockRestore();
});
- it('should NOT filter out lobe-gtd tools when isSubTask is false or undefined', async () => {
+ it('should NOT filter out lobe-agent tool when isSubAgent is false or undefined', async () => {
const { result } = renderHook(() => useChatStore());
const messages = [createMockMessage({ role: 'user' })];
- // Mock resolveAgentConfig to return plugins including lobe-gtd
+ // Mock resolveAgentConfig to return plugins including lobe-agent
const resolveAgentConfigSpy = vi
.spyOn(agentConfigResolver, 'resolveAgentConfig')
.mockReturnValue({
agentConfig: createMockAgentConfig(),
chatConfig: createMockChatConfig(),
isBuiltinAgent: false,
- plugins: ['lobe-gtd', 'lobe-local-system', 'other-plugin'],
+ plugins: ['lobe-agent', 'lobe-local-system', 'other-plugin'],
});
- // Create operation without isSubTask (normal conversation)
+ // Create operation without isSubAgent (normal conversation)
let operationId: string;
act(() => {
const res = result.current.startOperation({
@@ -2352,7 +2352,7 @@ describe('StreamingExecutor actions', () => {
operationId = res.operationId;
});
- // Call internal_createAgentState without isSubTask
+ // Call internal_createAgentState without isSubAgent
act(() => {
result.current.internal_createAgentState({
messages,
diff --git a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
index 889cb6297fa..2673341a53d 100644
--- a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
+++ b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
@@ -169,7 +169,7 @@ export class StreamingExecutorActionImpl {
initialContext,
operationId,
subAgentId: paramSubAgentId,
- isSubTask,
+ isSubAgent,
}: {
messages: UIChatMessage[];
parentMessageId: string;
@@ -186,7 +186,7 @@ export class StreamingExecutorActionImpl {
* - scope: 'sub_agent': Used for agent config but doesn't change message ownership
*/
subAgentId?: string;
- isSubTask?: boolean;
+ isSubAgent?: boolean;
}): {
state: AgentState;
context: AgentRuntimeContext;
@@ -211,13 +211,13 @@ export class StreamingExecutorActionImpl {
// Resolve agent config with builtin agent runtime config merged
// This ensures runtime plugins (e.g., 'lobe-agent-builder' for Agent Builder) are included
- // - isSubTask: filters out lobe-gtd tools to prevent nested sub-task creation
+ // - isSubAgent: filters out lobe-agent tool to prevent nested sub-agent creation
// - disableTools: clears all plugins for broadcast scenarios
const agentConfig = resolveAgentConfig({
agentId: effectiveAgentId || '',
disableTools, // Clear plugins for broadcast scenarios
groupId, // Pass groupId for supervisor detection
- isSubTask, // Filter out lobe-gtd in sub-task context
+ isSubAgent, // Filter out lobe-agent in sub-agent context
scope, // Pass scope from operation context
});
@@ -258,9 +258,9 @@ export class StreamingExecutorActionImpl {
: effectivePluginIds;
log(
- '[internal_createAgentState] resolved plugins=%o, isSubTask=%s, disableTools=%s, hasTopicReference=%s',
+ '[internal_createAgentState] resolved plugins=%o, isSubAgent=%s, disableTools=%s, hasTopicReference=%s',
effectivePluginIds,
- isSubTask,
+ isSubAgent,
disableTools,
hasTopicReference,
);
@@ -479,7 +479,7 @@ export class StreamingExecutorActionImpl {
parentMessageType: 'user' | 'assistant' | 'tool';
parentOperationId?: string;
skipCreateFirstMessage?: boolean;
- isSubTask?: boolean;
+ isSubAgent?: boolean;
}): Promise<{ cost?: Cost; usage?: Usage } | void> => {
const {
disableTools,
@@ -487,7 +487,7 @@ export class StreamingExecutorActionImpl {
parentMessageId,
parentMessageType,
context,
- isSubTask,
+ isSubAgent,
} = params;
// Extract values from context
@@ -554,7 +554,7 @@ export class StreamingExecutorActionImpl {
// ===========================================
// Step 1: Create Agent State (resolves config once)
// ===========================================
- // agentConfig contains isSubTask filtering and is passed to callLLM executor
+ // agentConfig already has isSubAgent filtering applied and is passed to callLLM executor
const {
state: initialAgentState,
context: initialAgentContext,
@@ -571,7 +571,7 @@ export class StreamingExecutorActionImpl {
initialContext: params.initialContext,
operationId,
subAgentId, // Pass subAgentId for agent config retrieval (behavior depends on scope)
- isSubTask, // Pass isSubTask to filter out lobe-gtd tools in sub-task context
+ isSubAgent, // Pass isSubAgent to filter out lobe-agent tool in sub-agent context
});
// Use model/provider from resolved agentConfig
@@ -742,7 +742,7 @@ export class StreamingExecutorActionImpl {
// REMEMBER: There is no test for it (too hard to add), if you want to change it , ask @arvinxx first
if (
result.nextContext?.phase &&
- ['tasks_batch_result', 'tools_batch_result'].includes(result.nextContext?.phase)
+ ['sub_agents_batch_result', 'tools_batch_result'].includes(result.nextContext?.phase)
) {
log(
`[executeClientAgent] ${result.nextContext?.phase} completed, refreshing messages to sync state`,
diff --git a/src/store/chat/slices/message/selectors/dbMessage.test.ts b/src/store/chat/slices/message/selectors/dbMessage.test.ts
index 1049cd35504..47cb8fbac67 100644
--- a/src/store/chat/slices/message/selectors/dbMessage.test.ts
+++ b/src/store/chat/slices/message/selectors/dbMessage.test.ts
@@ -4,7 +4,7 @@ import { describe, expect, it } from 'vitest';
import { selectCurrentTurnTodosFromMessages, selectTodosFromMessages } from './dbMessage';
describe('selectTodosFromMessages', () => {
- const createGTDToolMessage = (todos: {
+ const createLobeAgentToolMessage = (todos: {
items: Array<{ text: string; status: 'todo' | 'processing' | 'completed' }>;
updatedAt: string;
}): UIChatMessage =>
@@ -13,7 +13,7 @@ describe('selectTodosFromMessages', () => {
role: 'tool',
content: 'Todos updated',
plugin: {
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'createTodos',
arguments: '{}',
},
@@ -22,14 +22,14 @@ describe('selectTodosFromMessages', () => {
},
}) as unknown as UIChatMessage;
- it('should extract todos from the latest GTD tool message', () => {
+ it('should extract todos from the latest lobe-agent tool message', () => {
const messages: UIChatMessage[] = [
{
id: 'msg-1',
role: 'user',
content: 'Create a todo list',
} as UIChatMessage,
- createGTDToolMessage({
+ createLobeAgentToolMessage({
items: [{ text: 'Buy milk', status: 'todo' }],
updatedAt: '2024-06-01T00:00:00.000Z',
}),
@@ -43,9 +43,9 @@ describe('selectTodosFromMessages', () => {
expect(result?.items[0].status).toBe('todo');
});
- it('should return the most recent todos when multiple GTD messages exist', () => {
+ it('should return the most recent todos when multiple lobe-agent messages exist', () => {
const messages: UIChatMessage[] = [
- createGTDToolMessage({
+ createLobeAgentToolMessage({
items: [{ text: 'Old task', status: 'todo' }],
updatedAt: '2024-01-01T00:00:00.000Z',
}),
@@ -54,7 +54,7 @@ describe('selectTodosFromMessages', () => {
role: 'assistant',
content: 'Task added',
} as UIChatMessage,
- createGTDToolMessage({
+ createLobeAgentToolMessage({
items: [
{ text: 'Old task', status: 'completed' },
{ text: 'New task', status: 'todo' },
@@ -73,7 +73,7 @@ describe('selectTodosFromMessages', () => {
expect(result?.items[1].text).toBe('New task');
});
- it('should return undefined when no GTD messages exist', () => {
+ it('should return undefined when no lobe-agent messages exist', () => {
const messages: UIChatMessage[] = [
{
id: 'msg-1',
@@ -98,7 +98,7 @@ describe('selectTodosFromMessages', () => {
expect(result).toBeUndefined();
});
- it('should ignore non-GTD tool messages', () => {
+ it('should ignore non-lobe-agent tool messages', () => {
const messages: UIChatMessage[] = [
{
id: 'msg-1',
@@ -120,14 +120,14 @@ describe('selectTodosFromMessages', () => {
expect(result).toBeUndefined();
});
- it('should handle GTD message without pluginState.todos', () => {
+ it('should handle lobe-agent message without pluginState.todos', () => {
const messages: UIChatMessage[] = [
{
id: 'msg-1',
role: 'tool',
content: 'Something',
plugin: {
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'someOtherApi',
arguments: '{}',
},
@@ -149,7 +149,7 @@ describe('selectTodosFromMessages', () => {
role: 'tool',
content: 'Todos',
plugin: {
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'createTodos',
arguments: '{}',
},
@@ -170,7 +170,7 @@ describe('selectTodosFromMessages', () => {
expect(new Date(result!.updatedAt).toISOString()).toBe(result!.updatedAt);
});
- it('should pick up pluginState.todos from a non-GTD tool message (CC TodoWrite)', () => {
+ it('should pick up pluginState.todos from a non-lobe-agent tool message (CC TodoWrite)', () => {
// Heterogeneous-agent tools (Claude Code TodoWrite, future ACP/Codex
// equivalents) synthesize `pluginState.todos` with identifier
// 'claude-code'. The selector is a shared contract on `pluginState.todos`
@@ -206,11 +206,11 @@ describe('selectTodosFromMessages', () => {
});
it('should prefer the most recent pluginState.todos across producers', () => {
- // GTD wrote first, then CC TodoWrite wrote later — the latest producer
+ // lobe-agent wrote first, then CC TodoWrite wrote later — the latest producer
// wins regardless of identifier.
const messages: UIChatMessage[] = [
- createGTDToolMessage({
- items: [{ text: 'old gtd task', status: 'todo' }],
+ createLobeAgentToolMessage({
+ items: [{ text: 'old lobe-agent task', status: 'todo' }],
updatedAt: '2026-04-01T00:00:00.000Z',
}),
{
@@ -242,7 +242,7 @@ describe('selectTodosFromMessages', () => {
role: 'tool',
content: 'Todos',
plugin: {
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
apiName: 'createTodos',
arguments: '{}',
},
@@ -266,12 +266,15 @@ describe('selectTodosFromMessages', () => {
});
describe('selectCurrentTurnTodosFromMessages', () => {
- const gtdMessage = (text: string, status: 'todo' | 'processing' | 'completed'): UIChatMessage =>
+ const lobeAgentMessage = (
+ text: string,
+ status: 'todo' | 'processing' | 'completed',
+ ): UIChatMessage =>
({
id: `tool-${text}`,
role: 'tool',
content: 'Todos updated',
- plugin: { identifier: 'lobe-gtd', apiName: 'createTodos', arguments: '{}' },
+ plugin: { identifier: 'lobe-agent', apiName: 'createTodos', arguments: '{}' },
pluginState: {
todos: { items: [{ text, status }], updatedAt: '2026-04-20T00:00:00.000Z' },
},
@@ -283,9 +286,9 @@ describe('selectCurrentTurnTodosFromMessages', () => {
it('returns todos from the current turn only', () => {
const messages: UIChatMessage[] = [
userMessage('u1'),
- gtdMessage('turn 1 task', 'completed'),
+ lobeAgentMessage('turn 1 task', 'completed'),
userMessage('u2'),
- gtdMessage('turn 2 task', 'processing'),
+ lobeAgentMessage('turn 2 task', 'processing'),
];
const result = selectCurrentTurnTodosFromMessages(messages);
@@ -297,7 +300,7 @@ describe('selectCurrentTurnTodosFromMessages', () => {
it('returns undefined once a new user turn starts without its own todos', () => {
const messages: UIChatMessage[] = [
userMessage('u1'),
- gtdMessage('previous turn task', 'completed'),
+ lobeAgentMessage('previous turn task', 'completed'),
userMessage('u2'),
];
@@ -307,7 +310,7 @@ describe('selectCurrentTurnTodosFromMessages', () => {
});
it('falls back to full history when no user message exists', () => {
- const messages: UIChatMessage[] = [gtdMessage('greeting task', 'todo')];
+ const messages: UIChatMessage[] = [lobeAgentMessage('greeting task', 'todo')];
const result = selectCurrentTurnTodosFromMessages(messages);
diff --git a/src/store/chat/slices/message/selectors/dbMessage.ts b/src/store/chat/slices/message/selectors/dbMessage.ts
index 8ebfc6e73dd..d66488582a9 100644
--- a/src/store/chat/slices/message/selectors/dbMessage.ts
+++ b/src/store/chat/slices/message/selectors/dbMessage.ts
@@ -249,14 +249,14 @@ export const selectActivatedSkillsFromMessages = (
return skillsMap.size > 0 ? [...skillsMap.values()] : undefined;
};
-// ============= GTD Todos Selectors ========== //
+// ============= Todos Selectors ========== //
/**
* Select the latest todos state from messages array
*
* Searches messages in reverse order to find the most recent tool message
* that carries a `pluginState.todos` payload — regardless of which tool
- * produced it. `pluginState.todos` is treated as a shared contract: GTD
+ * produced it. `pluginState.todos` is treated as a shared contract: lobe-agent
* writes it via its client state mutation, and heterogeneous agent adapters
* (Claude Code TodoWrite, future ACP/Codex equivalents) synthesize it onto
* the tool_result event. Any new producer that honors the shape gets picked
diff --git a/src/store/chat/slices/operation/types.ts b/src/store/chat/slices/operation/types.ts
index bcf0632b1bb..a9d3f5a6080 100644
--- a/src/store/chat/slices/operation/types.ts
+++ b/src/store/chat/slices/operation/types.ts
@@ -57,9 +57,9 @@ export type OperationType =
| 'groupAgentGenerate' // Group agent generate (deprecated, use groupAgentStream)
| 'groupAgentStream' // Group agent SSE stream (sub-operation of execServerAgentRuntime)
- // === Async Task (Desktop only) ===
- | 'execClientTask' // Execute single async sub-agent task on desktop client
- | 'execClientTasks' // Execute multiple async sub-agent tasks on desktop client
+ // === Sub-Agent (Desktop only) ===
+ | 'execClientSubAgent' // Dispatch single sub-agent on the desktop client
+ | 'execClientSubAgents' // Dispatch multiple sub-agents on the desktop client
// === Context Compression ===
// Context compression (compress old messages into summary)
diff --git a/src/store/chat/slices/plugin/action.test.ts b/src/store/chat/slices/plugin/action.test.ts
index 2fb5e555472..8e82e5c8380 100644
--- a/src/store/chat/slices/plugin/action.test.ts
+++ b/src/store/chat/slices/plugin/action.test.ts
@@ -852,7 +852,7 @@ describe('ChatPluginAction', () => {
{
id: 'tool1',
function: {
- name: ['lobe-gtd', 'execTask', 'default'].join(PLUGIN_SCHEMA_SEPARATOR),
+ name: ['lobe-agent', 'callSubAgent', 'default'].join(PLUGIN_SCHEMA_SEPARATOR),
arguments: malformedArguments,
},
type: 'function',
@@ -865,13 +865,13 @@ describe('ChatPluginAction', () => {
builtinTools: [
{
type: 'builtin',
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
manifest: {
- identifier: 'lobe-gtd',
+ identifier: 'lobe-agent',
api: [
{
- name: 'execTask',
- description: 'Execute async task',
+ name: 'callSubAgent',
+ description: 'Dispatch a sub-agent',
parameters: {
type: 'object',
required: ['description', 'instruction'],
diff --git a/src/store/chat/utils/messageMapKey.test.ts b/src/store/chat/utils/messageMapKey.test.ts
index ae36dad6abd..cb9ec1ef7fe 100644
--- a/src/store/chat/utils/messageMapKey.test.ts
+++ b/src/store/chat/utils/messageMapKey.test.ts
@@ -440,7 +440,7 @@ describe('messageMapKey', () => {
});
it('Scenario: Agent has independent message stream in group (group_agent scope)', () => {
- // When an agent needs its own message stream (future execTask scenario)
+ // When an agent needs its own message stream (future sub-agent scenario)
const result = messageMapKey({
agentId: 'agt_supervisor',
groupId: 'grp_group001',
diff --git a/src/store/tool/slices/builtin/executors/index.ts b/src/store/tool/slices/builtin/executors/index.ts
index 3dac666b85f..c5fc8504e10 100644
--- a/src/store/tool/slices/builtin/executors/index.ts
+++ b/src/store/tool/slices/builtin/executors/index.ts
@@ -11,9 +11,8 @@ import { cloudSandboxExecutor } from '@lobechat/builtin-tool-cloud-sandbox/execu
import { credsExecutor } from '@lobechat/builtin-tool-creds/executor';
import { groupAgentBuilderExecutor } from '@lobechat/builtin-tool-group-agent-builder/executor';
import { groupManagementExecutor } from '@lobechat/builtin-tool-group-management/executor';
-import { gtdExecutor } from '@lobechat/builtin-tool-gtd/executor';
import { knowledgeBaseExecutor } from '@lobechat/builtin-tool-knowledge-base/client';
-import { lobeAgentExecutor } from '@lobechat/builtin-tool-lobe-agent/executor';
+import { lobeAgentExecutor } from '@lobechat/builtin-tool-lobe-agent/client';
import { localSystemExecutor } from '@lobechat/builtin-tool-local-system/executor';
import { memoryExecutor } from '@lobechat/builtin-tool-memory/executor';
import { taskExecutor } from '@lobechat/builtin-tool-task/executor';
@@ -141,7 +140,6 @@ registerExecutors([
credsExecutor,
groupAgentBuilderExecutor,
groupManagementExecutor,
- gtdExecutor,
knowledgeBaseExecutor,
localSystemExecutor,
memoryExecutor,