"""
内置基础工具 - 参考 opencode 实现

这些工具参考 vendor/opencode/packages/opencode/src/tool/ 的设计，
在 Python 中重新实现核心功能。

参考版本：opencode main branch (2025-01)
"""

from agent.tools.builtin.file.read import read_file
from agent.tools.builtin.file.edit import edit_file
from agent.tools.builtin.file.write import write_file
from agent.tools.builtin.glob_tool import glob_files
from agent.tools.builtin.file.grep import grep_content
from agent.tools.builtin.bash import bash_command
from agent.tools.builtin.skill import skill, list_skills
from agent.tools.builtin.subagent import agent, evaluate
from agent.tools.builtin.search import search_posts, get_search_suggestions
from agent.tools.builtin.sandbox import (sandbox_create_environment, sandbox_run_shell,
                                         sandbox_rebuild_with_ports,sandbox_destroy_environment)
from agent.tools.builtin.knowledge import(knowledge_search,knowledge_save,knowledge_list,knowledge_update,knowledge_batch_update,knowledge_slim)
from agent.tools.builtin.knowledge_manager import ask_knowledge, upload_knowledge
from agent.tools.builtin.context import get_current_context
from agent.tools.builtin.toolhub import toolhub_health, toolhub_search, toolhub_call, toolhub_create
from agent.tools.builtin.resource import resource_list_tools, resource_get_tool
from agent.tools.builtin.crawler import youtube_search, youtube_detail, x_search, import_content, extract_video_clip
from agent.trace.goal_tool import goal
# 导入浏览器工具以触发注册
import agent.tools.builtin.browser  # noqa: F401

import agent.tools.builtin.feishu
import agent.tools.builtin.im

__all__ = [
    # 文件操作
    "read_file",
    "edit_file",
    "write_file",
    "glob_files",
    "grep_content",
    # 系统工具
    "bash_command",
    "skill",
    # 知识管理（新架构 - 通过 IM 与 Knowledge Manager 交互）
    "ask_knowledge",
    "upload_knowledge",
    # 知识管理（旧架构 - 直接 HTTP API，仅供 Knowledge Manager 内部使用）
    # "knowledge_search",
    # "knowledge_save",
    # "knowledge_list",
    # "knowledge_update",
    # "knowledge_batch_update",
    # "knowledge_slim",
    "list_skills",
    "agent",
    "evaluate",
    "search_posts",
    "select_post",
    "get_search_suggestions",
    "sandbox_create_environment",
    "sandbox_run_shell",
    "sandbox_rebuild_with_ports",
    "sandbox_destroy_environment",
    # 上下文工具
    "get_current_context",
    # ToolHub 远程工具库
    "toolhub_health",
    "toolhub_search",
    "toolhub_call",
    "toolhub_create",
    # 资源查询
    "resource_list_tools",
    "resource_get_tool",
    # 爬虫工具
    "youtube_search",
    "youtube_detail",
    "x_search",
    "import_content",
    "extract_video_clip",
    # Goal 管理
    "goal",
]
