/**
 * MCP 工具定义
 * 集中管理所有 MCP Tool 的元数据
 */
const MEMORY_TYPE_SCHEMA = {
    type: "string",
    enum: ["task_list", "recently_memory", "memory"],
    description: "记忆类型：task_list 表示临时任务清单，recently_memory 表示近期上下文，memory 表示长期记忆。",
};
const LISTABLE_MEMORY_TYPE_SCHEMA = {
    type: "string",
    enum: ["task_list", "recently_memory"],
    description: "可直接列出的记忆类型。长期 memory 请使用 search_memory 按 query 检索，避免一次性暴露过多上下文。",
};
const MEMORY_URI_SCHEMA = {
    type: "string",
    description: "记忆 URI，格式为 domain://path，例如 core://agent/profile 或 task://todo/current。domain 会自动转小写。",
};
/**
 * 获取当前 Agent 可见的同事列表（包含离线 Agent）
 */
export const GET_COLLEAGUE_TOOL = {
    name: "get_colleague",
    description: "获取当前 Agent 可见的同事 Agent 列表，包含在线和离线状态。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 获取当前 Agent 可发现的群组列表
 */
export const GET_GROUP_ROOMS_TOOL = {
    name: "get_group_rooms",
    description: "获取当前 Agent 在关系图中可发现的群组列表，包括项目公共群聊以及自己所在的小组群。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 获取当前 Agent 信息
 */
export const GET_PROFILE_TOOL = {
    name: "get_profile",
    description: "获取当前 Agent 的个人信息，包括 ID、显示名称、角色名称、Prompt、在线状态等。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 获取运行状态
 */
export const GET_STATUS_TOOL = {
    name: "get_status",
    description: "获取当前 Agent 的运行状态（连接状态、消息循环状态等）。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 招聘同事
 */
export const HIRE_COLLEAGUE_TOOL = {
    name: "hire_colleague",
    description: "向人事部发起招聘同事请求，直接按创建角色实例所需参数创建一个新的 Agent 同事。",
    inputSchema: {
        type: "object",
        properties: {
            projectName: {
                type: "string",
                description: "项目名，不传时由服务端按默认逻辑处理。",
            },
            roleName: {
                type: "string",
                description: "角色名。与 newRoleName 二选一，优先按服务端现有创建规则处理。",
            },
            newRoleName: {
                type: "string",
                description: "新角色名。用于需要显式创建新角色实例时传入。",
            },
            displayName: {
                type: "string",
                description: "新同事显示名。",
            },
            prompt: {
                type: "string",
                description: "新同事职责说明或系统提示词。",
            },
            workspacePath: {
                type: "string",
                description: "新同事工作目录。",
            },
            myYmlPath: {
                type: "string",
                description: "my.yml 路径，可选。",
            },
            myYmlContent: {
                type: "string",
                description: "my.yml 内容，可选。",
            },
            runtimeSkillEnabled: {
                type: "boolean",
                description: "是否启用 skill。",
            },
            runtimeMcpEnabled: {
                type: "boolean",
                description: "是否启用 MCP。",
            },
            runtimeCcSwitchEnabledTools: {
                type: "string",
                description: "初始化启用的工具列表 JSON 字符串。",
            },
        },
        required: ["workspacePath"],
    },
};
/**
 * 批量招聘同事
 */
export const HIRE_COLLEAGUES_BATCH_TOOL = {
    name: "hire_colleagues_batch",
    description: "向人事部发起批量招聘同事请求，一次提交多个待审批招聘项，由审批人逐项批准或拒绝后统一返回结果。",
    inputSchema: {
        type: "object",
        properties: {
            projectName: {
                type: "string",
                description: "项目名，不传时由服务端按默认逻辑处理。",
            },
            items: {
                type: "array",
                description: "待批量招聘的同事列表。每一项对应一个待审批的招聘请求。",
                items: {
                    type: "object",
                    properties: {
                        roleName: {
                            type: "string",
                            description: "角色名。与 newRoleName 二选一，优先按服务端现有创建规则处理。",
                        },
                        newRoleName: {
                            type: "string",
                            description: "新角色名。用于需要显式创建新角色实例时传入。",
                        },
                        displayName: {
                            type: "string",
                            description: "新同事显示名。",
                        },
                        prompt: {
                            type: "string",
                            description: "新同事职责说明或系统提示词。",
                        },
                        workspacePath: {
                            type: "string",
                            description: "新同事工作目录。",
                        },
                        myYmlPath: {
                            type: "string",
                            description: "my.yml 路径，可选。",
                        },
                        myYmlContent: {
                            type: "string",
                            description: "my.yml 内容，可选。",
                        },
                        runtimeSkillEnabled: {
                            type: "boolean",
                            description: "是否启用 skill。",
                        },
                        runtimeMcpEnabled: {
                            type: "boolean",
                            description: "是否启用 MCP。",
                        },
                        runtimeCcSwitchEnabledTools: {
                            type: "string",
                            description: "初始化启用的工具列表 JSON 字符串。",
                        },
                    },
                    required: ["workspacePath"],
                },
                minItems: 1,
            },
        },
        required: ["items"],
    },
};
/**
 * 发送群消息
 */
export const SEND_GROUP_TOOL = {
    name: "send_group",
    description: "向公共群聊发送消息，所有在线参与者都能收到。回复群消息时建议传入消息中的 projectName，确保回复到正确的项目群聊。",
    inputSchema: {
        type: "object",
        properties: {
            content: {
                type: "string",
                description: "消息内容",
            },
            projectName: {
                type: "string",
                description: "目标项目名（可选）。不传则使用 Agent 所属项目（由服务端决定）。回复群消息时应传入消息中的 projectName，确保回复到正确的项目群聊。",
            },
            roomId: {
                type: "string",
                description: "目标群聊房间 ID（可选）。当回复 get_group_rooms 或群消息中的小组群时，优先传入 roomId，避免误发到项目公共群。",
            },
        },
        required: ["content"],
    },
};
/**
 * 发送私信
 */
export const SEND_PRIVATE_TOOL = {
    name: "send_private",
    description: "发送私信给指定用户。支持两种模式：通知式（waitReply=false）和调用式（waitReply=true，阻塞等待回复）。",
    inputSchema: {
        type: "object",
        properties: {
            targetId: {
                type: "string",
                description: "目标用户ID",
            },
            content: {
                type: "string",
                description: "消息内容",
            },
            waitReply: {
                type: "boolean",
                description: "是否等待对方回复（调用式）。为true时会阻塞等待回复，超时后继续执行",
            },
            replyToCallId: {
                type: "string",
                description: "回复的调用ID（用于回复调用式消息）",
            },
            timeoutMs: {
                type: "number",
                description: "等待回复的超时时间（毫秒，可选，默认使用服务端统一配置）",
            },
        },
        required: ["targetId", "content"],
    },
};
/**
 * 轮询消息（阻塞式）
 */
export const POLL_MESSAGE_TOOL = {
    name: "poll_message",
    description: "获取未读消息（包括群消息和私信），持续阻塞等待直到有新消息，这是获取消息的主要接口。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 获取消息（非阻塞）
 */
export const GET_MESSAGE_TOOL = {
    name: "get_message",
    description: "获取未读消息（非阻塞），从消息缓冲区获取消息，立即返回，若当前没有任务应使用 poll_message。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 获取私信历史
 */
export const GET_DM_HISTORY_TOOL = {
    name: "get_dm_history",
    description: "获取私信历史消息。可以获取与特定用户的对话历史，或获取所有私信历史。",
    inputSchema: {
        type: "object",
        properties: {
            targetUserId: {
                type: "string",
                description: "目标用户ID（可选）。如果不指定，则返回所有私信历史。",
            },
            limit: {
                type: "number",
                description: "获取最近历史消息的数量（默认50）",
            },
            since: {
                type: "string",
                description: "起始时间（ISO 8601 格式，可选）。早于该时间的消息将不会被返回。",
            },
        },
        required: [],
    },
};
/**
 * 获取群聊历史
 */
export const GET_GROUP_HISTORY_TOOL = {
    name: "get_group_history",
    description: "获取公共群聊的历史消息。",
    inputSchema: {
        type: "object",
        properties: {
            limit: {
                type: "number",
                description: "获取最近历史消息的数量（默认50）",
            },
            since: {
                type: "string",
                description: "起始时间（ISO 8601 格式，可选）。早于该时间的消息将不会被返回。",
            },
        },
        required: [],
    },
};
/**
 * 获取我的流程线任务
 */
export const MY_TASK_TOOL = {
    name: "my_task",
    description: "获取当前 Agent 已通过 poll_message 后台静默抢占或正在处理的流程线任务列表。此工具只读取已分配给当前 Agent 的任务详情，不会主动抢占新的待处理节点。收到流程线任务分配通知后，调用此工具获取任务指令、前序节点输出、requiredOutput 输出契约等；完成后必须按 requiredOutput 使用 submit_task_result 提交结果。若 requiredOutput 的目标是 HUMAN 节点，提交给该分支的 output 必须包含 questions 数组且至少一个题目带 question 字段。",
    inputSchema: {
        type: "object",
        properties: {},
        required: [],
    },
};
/**
 * 创建流程线实例级留言
 */
export const CREATE_TASK_INSTANCE_COMMENT_TOOL = {
    name: "create_task_instance_comment",
    description: "为当前正在处理的流程线实例创建一条实例级留言。仅允许由后台静默抢占后正在处理该实例节点的 Agent 调用；留言会在实例列表“查看留言”和后续 my_task 返回中展示。",
    inputSchema: {
        type: "object",
        properties: {
            taskInstanceId: {
                type: "string",
                description: "流程线任务实例ID（从 my_task 返回中获取）",
            },
            content: {
                type: "string",
                description: "留言内容",
            },
        },
        required: ["taskInstanceId", "content"],
    },
};
/**
 * 提交任务结果
 */
export const SUBMIT_TASK_RESULT_TOOL = {
    name: "submit_task_result",
    description: "提交流程线任务的执行结果。完成任务后调用此工具，输出将传递给下一个节点。outputPayload 必须遵循 my_task 返回的 requiredOutput：有后继分支时必须是 JSON 数组，每项包含 targetNodeId 和 output。若目标分支是 HUMAN 节点，output 必须是 JSON 对象并包含非空 questions 数组，questions 至少一个题目必须包含字符串 question 字段。",
    inputSchema: {
        type: "object",
        properties: {
            nodeId: {
                type: "string",
                description: "任务节点ID（从 my_task 返回的任务信息中获取）",
            },
            outputPayload: {
                type: "string",
                description: "任务执行结果的 JSON 字符串。必须按 my_task.requiredOutput 选择目标分支，例如 [{\"targetNodeId\":\"<目标节点模板ID>\",\"output\":{...}}]；提交到 HUMAN 节点时 output 必须形如 {\"questions\":[{\"question\":\"请确认...\",\"options\":[{\"label\":\"通过\"}]}]}。",
            },
        },
        required: ["nodeId", "outputPayload"],
    },
};
/**
 * 记录流程线任务变更
 */
export const RECORD_TASK_CHANGE_TOOL = {
    name: "record_task_change",
    description: "记录当前流程线实例因本 Agent 执行而产生的文件/内容变更。仅允许在后台静默抢占后、submit_task_result 前由正在处理该节点的 Agent 调用；记录采用类似 git 的 CRUD 摘要。",
    inputSchema: {
        type: "object",
        properties: {
            taskInstanceId: {
                type: "string",
                description: "流程线任务实例ID（可选；如传入必须与 nodeId 所属实例一致）。",
            },
            nodeId: {
                type: "string",
                description: "当前正在处理的任务节点ID。",
            },
            operation: {
                type: "string",
                enum: ["CREATE", "UPDATE", "DELETE"],
                description: "对目标执行的操作类型。",
            },
            targetType: {
                type: "string",
                description: "目标类型，例如 file 或 content。",
            },
            path: {
                type: "string",
                description: "文件路径或内容定位路径。",
            },
            summary: {
                type: "string",
                description: "变更摘要，说明改了哪些信息。",
            },
            beforeHash: {
                type: "string",
                description: "变更前内容哈希（可选）。",
            },
            afterHash: {
                type: "string",
                description: "变更后内容哈希（可选）。",
            },
            metadata: {
                type: "string",
                description: "附加元数据 JSON 字符串（可选）。",
            },
        },
        required: ["nodeId", "operation", "targetType", "path"],
    },
};
/**
 * 开始 AI 回退任务
 */
export const START_TASK_ROLLBACK_TOOL = {
    name: "start_task_rollback",
    description: "将分配给当前 Agent 的流程线 AI 回退任务标记为回退中。收到回退委托后，开始实际回退前调用。",
    inputSchema: {
        type: "object",
        properties: {
            rollbackTaskId: {
                type: "string",
                description: "AI 回退任务ID（从回退委托消息中获取）。",
            },
        },
        required: ["rollbackTaskId"],
    },
};
/**
 * 完成 AI 回退任务
 */
export const FINISH_TASK_ROLLBACK_TOOL = {
    name: "finish_task_rollback",
    description: "将分配给当前 Agent 的流程线 AI 回退任务标记为已回退，并记录回退结果。完成回退后调用。",
    inputSchema: {
        type: "object",
        properties: {
            rollbackTaskId: {
                type: "string",
                description: "AI 回退任务ID（从回退委托消息中获取）。",
            },
            resultMessage: {
                type: "string",
                description: "回退结果说明（可选）。",
            },
        },
        required: ["rollbackTaskId"],
    },
};
/**
 * 拒绝任务
 */
export const REJECT_TASK_TOOL = {
    name: "reject_task",
    description: "拒绝对前序节点输出的任务，任务将回退到前一个节点重新执行。适用于前序输出不满足要求或无法继续执行的场景。",
    inputSchema: {
        type: "object",
        properties: {
            nodeId: {
                type: "string",
                description: "任务节点ID（从 my_task 返回的任务信息中获取）",
            },
            reason: {
                type: "string",
                description: "拒绝原因",
            },
        },
        required: ["nodeId", "reason"],
    },
};
/**
 * 终止任务
 */
export const TERMINATE_TASK_TOOL = {
    name: "terminate_task",
    description: "终止整个流程线任务。终止后任务状态变为 TERMINATED（已终止），所有未完成的节点也将被终止，任务不再进行后续流转。适用于任务无法继续执行或需要强制停止的场景。注意：终止操作不可逆，请谨慎使用。",
    inputSchema: {
        type: "object",
        properties: {
            taskInstanceId: {
                type: "string",
                description: "任务实例ID（从 my_task 返回的任务信息中获取 taskInstanceId）",
            },
            reason: {
                type: "string",
                description: "终止原因",
            },
        },
        required: ["taskInstanceId", "reason"],
    },
};
/**
 * 创建记忆
 */
export const CREATE_MEMORY_TOOL = {
    name: "create_memory",
    description: "在当前 Agent 工作区创建一条本地记忆。适合保存长期偏好、近期上下文或任务清单；同一 uri 已存在时会失败，避免意外覆盖。",
    inputSchema: {
        type: "object",
        properties: {
            memory_type: MEMORY_TYPE_SCHEMA,
            uri: MEMORY_URI_SCHEMA,
            content: {
                type: "string",
                description: "记忆内容。",
            },
        },
        required: ["memory_type", "uri", "content"],
    },
};
/**
 * 读取记忆
 */
export const READ_MEMORY_TOOL = {
    name: "read_memory",
    description: "按 uri 读取当前 Agent 工作区的一条本地记忆。可传 memory_type 做类型校验，避免读错分类。",
    inputSchema: {
        type: "object",
        properties: {
            uri: MEMORY_URI_SCHEMA,
            memory_type: MEMORY_TYPE_SCHEMA,
        },
        required: ["uri"],
    },
};
/**
 * 更新记忆
 */
export const UPDATE_MEMORY_TOOL = {
    name: "update_memory",
    description: "更新当前 Agent 工作区的一条本地记忆。支持精确替换 old_string -> new_string，也支持 append 追加；精确替换要求 old_string 只出现一次。",
    inputSchema: {
        type: "object",
        properties: {
            uri: MEMORY_URI_SCHEMA,
            memory_type: MEMORY_TYPE_SCHEMA,
            old_string: {
                type: "string",
                description: "要被替换的旧内容。与 new_string 同时传入时启用精确替换。",
            },
            new_string: {
                type: "string",
                description: "替换后的新内容。与 old_string 同时传入时启用精确替换。",
            },
            append: {
                type: "string",
                description: "追加到记忆末尾的内容。",
            },
        },
        required: ["uri"],
    },
};
/**
 * 删除记忆
 */
export const DELETE_MEMORY_TOOL = {
    name: "delete_memory",
    description: "按 uri 删除当前 Agent 工作区的一条本地记忆。可传 memory_type 做类型校验，删除成功返回 deleted=true。",
    inputSchema: {
        type: "object",
        properties: {
            uri: MEMORY_URI_SCHEMA,
            memory_type: MEMORY_TYPE_SCHEMA,
        },
        required: ["uri"],
    },
};
/**
 * 搜索记忆
 */
export const SEARCH_MEMORY_TOOL = {
    name: "search_memory",
    description: "按关键字搜索当前 Agent 工作区的本地记忆。会同时匹配 uri 与 content，并按相关性和更新时间排序。",
    inputSchema: {
        type: "object",
        properties: {
            query: {
                type: "string",
                description: "搜索关键字。",
            },
            limit: {
                type: "number",
                description: "最多返回条数，默认 10。",
            },
            memory_type: MEMORY_TYPE_SCHEMA,
        },
        required: ["query"],
    },
};
/**
 * 按类型列出短期记忆
 */
export const LIST_MEMORIES_TOOL = {
    name: "list_memories",
    description: "按类型列出当前 Agent 工作区的 task_list 或 recently_memory。长期 memory 请使用 search_memory 检索，避免一次性加载过多历史上下文。",
    inputSchema: {
        type: "object",
        properties: {
            memory_type: LISTABLE_MEMORY_TYPE_SCHEMA,
        },
        required: ["memory_type"],
    },
};
/**
 * 获取记忆容量统计
 */
export const GET_MEMORY_STATS_TOOL = {
    name: "get_memory_stats",
    description: "获取当前 Agent 工作区本地记忆的容量统计。默认返回短期/近期/长期总数、短期/近期下的 URI domain 类型占用、以及每个 domain 下 memory 条数占用；传 memory_type 时只返回该层级的类型占用详情。",
    inputSchema: {
        type: "object",
        properties: {
            memory_type: MEMORY_TYPE_SCHEMA,
        },
        required: [],
    },
};
/**
 * 移除任务清单记忆
 */
export const REMOVE_TASK_LIST_MEMORY_TOOL = {
    name: "remove_task_list_memory",
    description: "删除一条 task_list 类型的本地任务清单记忆。若 uri 指向其他类型会失败，避免误删长期记忆。",
    inputSchema: {
        type: "object",
        properties: {
            uri: MEMORY_URI_SCHEMA,
        },
        required: ["uri"],
    },
};
/**
 * 归档近期记忆
 */
export const ARCHIVE_RECENTLY_MEMORY_TOOL = {
    name: "archive_recently_memory",
    description: "将一条 recently_memory 类型的本地近期记忆归档为长期 memory。若 uri 指向其他类型会失败。",
    inputSchema: {
        type: "object",
        properties: {
            uri: MEMORY_URI_SCHEMA,
        },
        required: ["uri"],
    },
};
/**
 * 所有 MCP 工具列表
 */
export const MCP_TOOLS = [
    GET_COLLEAGUE_TOOL,
    GET_GROUP_ROOMS_TOOL,
    GET_PROFILE_TOOL,
    GET_STATUS_TOOL,
    HIRE_COLLEAGUE_TOOL,
    HIRE_COLLEAGUES_BATCH_TOOL,
    SEND_GROUP_TOOL,
    SEND_PRIVATE_TOOL,
    POLL_MESSAGE_TOOL,
    GET_MESSAGE_TOOL,
    GET_DM_HISTORY_TOOL,
    GET_GROUP_HISTORY_TOOL,
    MY_TASK_TOOL,
    CREATE_TASK_INSTANCE_COMMENT_TOOL,
    SUBMIT_TASK_RESULT_TOOL,
    RECORD_TASK_CHANGE_TOOL,
    START_TASK_ROLLBACK_TOOL,
    FINISH_TASK_ROLLBACK_TOOL,
    REJECT_TASK_TOOL,
    TERMINATE_TASK_TOOL,
    CREATE_MEMORY_TOOL,
    READ_MEMORY_TOOL,
    UPDATE_MEMORY_TOOL,
    DELETE_MEMORY_TOOL,
    SEARCH_MEMORY_TOOL,
    LIST_MEMORIES_TOOL,
    GET_MEMORY_STATS_TOOL,
    REMOVE_TASK_LIST_MEMORY_TOOL,
    ARCHIVE_RECENTLY_MEMORY_TOOL,
];
//# sourceMappingURL=mcp-tools.js.map