refactor(core): 移除 todoread 工具
todowrite 工具返回值已包含完整列表,todoread 工具多余
This commit is contained in:
@@ -181,7 +181,6 @@ export const buildAgent: Omit<AgentInfo, 'name'> = {
|
|||||||
'agent_output',
|
'agent_output',
|
||||||
|
|
||||||
// ============ Todo 任务管理 ============
|
// ============ Todo 任务管理 ============
|
||||||
'todoread',
|
|
||||||
'todowrite',
|
'todowrite',
|
||||||
|
|
||||||
// ============ Web 工具 ============
|
// ============ Web 工具 ============
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ export const exploreAgent: Omit<AgentInfo, 'name'> = {
|
|||||||
'edit_file',
|
'edit_file',
|
||||||
'multi_edit',
|
'multi_edit',
|
||||||
// 禁用 Todo(由父 Agent 管理)
|
// 禁用 Todo(由父 Agent 管理)
|
||||||
'todo_read',
|
|
||||||
'todo_write',
|
'todo_write',
|
||||||
// 禁用 Git 写操作
|
// 禁用 Git 写操作
|
||||||
'git_add',
|
'git_add',
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export const generalAgent: Omit<AgentInfo, 'name'> = {
|
|||||||
3. 需要父 Agent 注意的事项(如有)`,
|
3. 需要父 Agent 注意的事项(如有)`,
|
||||||
tools: {
|
tools: {
|
||||||
disabled: [
|
disabled: [
|
||||||
'todo_read',
|
|
||||||
'todo_write',
|
'todo_write',
|
||||||
],
|
],
|
||||||
noTask: true, // 禁止嵌套调用 Task
|
noTask: true, // 禁止嵌套调用 Task
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ export const guideAgent: Omit<AgentInfo, 'name'> = {
|
|||||||
'edit_file',
|
'edit_file',
|
||||||
'multi_edit',
|
'multi_edit',
|
||||||
// 禁用 Todo(由父 Agent 管理)
|
// 禁用 Todo(由父 Agent 管理)
|
||||||
'todo_read',
|
|
||||||
'todo_write',
|
'todo_write',
|
||||||
// 禁用 Git 写操作
|
// 禁用 Git 写操作
|
||||||
'git_add',
|
'git_add',
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ export const planAgent: Omit<AgentInfo, 'name'> = {
|
|||||||
'web_search',
|
'web_search',
|
||||||
'web_extract',
|
'web_extract',
|
||||||
// Todo 管理
|
// Todo 管理
|
||||||
'todoread',
|
|
||||||
'todowrite',
|
'todowrite',
|
||||||
// Plan 模式工具
|
// Plan 模式工具
|
||||||
'ask_user_question',
|
'ask_user_question',
|
||||||
|
|||||||
@@ -333,7 +333,6 @@ export const DEFAULT_TOOL_NAMES: ToolNameMapping = {
|
|||||||
enterPlanMode: 'enter_plan_mode',
|
enterPlanMode: 'enter_plan_mode',
|
||||||
task: 'task',
|
task: 'task',
|
||||||
agentOutput: 'agent_output',
|
agentOutput: 'agent_output',
|
||||||
todoRead: 'todoread',
|
|
||||||
todoWrite: 'todowrite',
|
todoWrite: 'todowrite',
|
||||||
webSearch: 'web_search',
|
webSearch: 'web_search',
|
||||||
webExtract: 'web_extract',
|
webExtract: 'web_extract',
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ export interface ToolNameMapping {
|
|||||||
enterPlanMode: string;
|
enterPlanMode: string;
|
||||||
task: string;
|
task: string;
|
||||||
agentOutput: string;
|
agentOutput: string;
|
||||||
todoRead: string;
|
|
||||||
todoWrite: string;
|
todoWrite: string;
|
||||||
webSearch: string;
|
webSearch: string;
|
||||||
webExtract: string;
|
webExtract: string;
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
读取当前会话的待办事项列表。
|
|
||||||
|
|
||||||
返回所有待办事项及其状态:
|
|
||||||
- pending: 待处理
|
|
||||||
- in_progress: 进行中
|
|
||||||
- completed: 已完成
|
|
||||||
|
|
||||||
用于查看任务进度和剩余工作。
|
|
||||||
@@ -6,7 +6,7 @@ import { bashTool } from './shell/index.js';
|
|||||||
|
|
||||||
// 核心工具
|
// 核心工具
|
||||||
import { toolSearchTool } from './tool-search.js';
|
import { toolSearchTool } from './tool-search.js';
|
||||||
import { todoReadTool, todoWriteTool } from './todo/index.js';
|
import { todoWriteTool } from './todo/index.js';
|
||||||
|
|
||||||
// Task 工具(Agent 子任务)
|
// Task 工具(Agent 子任务)
|
||||||
import { taskTool, agentOutputTool } from './task/index.js';
|
import { taskTool, agentOutputTool } from './task/index.js';
|
||||||
@@ -65,7 +65,6 @@ const allToolsWithMetadata: ToolWithMetadata[] = [
|
|||||||
// 核心工具 (deferLoading: false)
|
// 核心工具 (deferLoading: false)
|
||||||
toolSearchTool,
|
toolSearchTool,
|
||||||
bashTool,
|
bashTool,
|
||||||
todoReadTool,
|
|
||||||
todoWriteTool,
|
todoWriteTool,
|
||||||
taskTool,
|
taskTool,
|
||||||
agentOutputTool,
|
agentOutputTool,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ const TOOL_CATEGORY_MAP: Record<string, string> = {
|
|||||||
git_checkout: 'git',
|
git_checkout: 'git',
|
||||||
git_stash: 'git',
|
git_stash: 'git',
|
||||||
// todo
|
// todo
|
||||||
todo_read: 'todo',
|
|
||||||
todo_write: 'todo',
|
todo_write: 'todo',
|
||||||
// plan
|
// plan
|
||||||
ask_user_question: 'plan',
|
ask_user_question: 'plan',
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
export { todoReadTool } from './todoread.js';
|
|
||||||
export { todoWriteTool } from './todowrite.js';
|
export { todoWriteTool } from './todowrite.js';
|
||||||
export { todoManager } from './todo-manager.js';
|
export { todoManager } from './todo-manager.js';
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
import type { ToolResult } from '../../types/index.js';
|
|
||||||
import type { ToolWithMetadata } from '../types.js';
|
|
||||||
import { todoManager } from './todo-manager.js';
|
|
||||||
|
|
||||||
export const todoReadTool: ToolWithMetadata = {
|
|
||||||
name: 'todoread',
|
|
||||||
description: `读取当前会话的待办事项列表。
|
|
||||||
|
|
||||||
使用场景:
|
|
||||||
- 在对话开始时查看待处理的任务
|
|
||||||
- 开始新任务前了解当前进度
|
|
||||||
- 用户询问之前的任务或计划时
|
|
||||||
- 不确定下一步做什么时
|
|
||||||
- 完成任务后更新对剩余工作的理解
|
|
||||||
- 每隔几条消息检查一次以确保进度正常
|
|
||||||
|
|
||||||
返回格式:
|
|
||||||
- 返回 JSON 格式的待办事项列表
|
|
||||||
- 每个事项包含 id、content(内容)、status(状态)
|
|
||||||
- 状态:pending(待处理)、in_progress(进行中)、completed(已完成)`,
|
|
||||||
metadata: {
|
|
||||||
name: 'todoread',
|
|
||||||
category: 'core',
|
|
||||||
description: '读取待办事项列表',
|
|
||||||
keywords: ['todo', 'task', 'list', 'read', '待办', '任务', '列表', '进度'],
|
|
||||||
deferLoading: false, // 核心工具,始终加载
|
|
||||||
},
|
|
||||||
parameters: {},
|
|
||||||
execute: async (): Promise<ToolResult> => {
|
|
||||||
if (!todoManager.isInitialized()) {
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
output: '',
|
|
||||||
error: '会话管理器未初始化,无法读取待办事项',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const todos = todoManager.getTodos();
|
|
||||||
const pendingCount = todos.filter((t) => t.status !== 'completed').length;
|
|
||||||
|
|
||||||
return {
|
|
||||||
success: true,
|
|
||||||
output: JSON.stringify(todos, null, 2),
|
|
||||||
metadata: {
|
|
||||||
todos,
|
|
||||||
pendingCount,
|
|
||||||
totalCount: todos.length,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user