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 会自动转小写。",
};
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 工作区的一条本地记忆。支持两种写法：1) 精确替换时必须同时提供 old_string 和 new_string；2) 追加时只提供 append。若记忆不存在请使用 create_memory。",
    inputSchema: {
        type: "object",
        properties: {
            uri: MEMORY_URI_SCHEMA,
            memory_type: MEMORY_TYPE_SCHEMA,
            old_string: {
                type: "string",
                minLength: 1,
                description: "要被替换的旧内容。替换时必须与 new_string 同时传入；追加时不要传此字段。",
            },
            new_string: {
                type: "string",
                description: "替换后的新内容。替换时必须与 old_string 同时传入；追加时不要传此字段。允许为空字符串表示删除旧内容。",
            },
            append: {
                type: "string",
                minLength: 1,
                description: "追加到记忆末尾的内容。追加时只传 append，不要传 old_string/new_string。",
            },
        },
        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"],
    },
};
//# sourceMappingURL=memory-tools.js.map