__init__.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. """
  2. 内置基础工具 - 参考 opencode 实现
  3. 这些工具参考 vendor/opencode/packages/opencode/src/tool/ 的设计,
  4. 在 Python 中重新实现核心功能。
  5. 参考版本:opencode main branch (2025-01)
  6. """
  7. from agent.tools.builtin.file.read import read_file
  8. from agent.tools.builtin.file.read_images import read_images
  9. from agent.tools.builtin.file.edit import edit_file
  10. from agent.tools.builtin.file.write import write_file
  11. from agent.tools.builtin.glob_tool import glob_files
  12. from agent.tools.builtin.file.grep import grep_content
  13. from agent.tools.builtin.bash import bash_command
  14. from agent.tools.builtin.skill import skill, list_skills
  15. from agent.tools.builtin.subagent import agent, evaluate
  16. # sandbox 工具已废弃(2026-04);search.py / crawler.py 已重构为 content/ 工具族(2026-04)
  17. from agent.tools.builtin.knowledge import(knowledge_search,knowledge_save,knowledge_list,knowledge_update,knowledge_batch_update,knowledge_slim)
  18. # 知识上传/查询已统一到 agent 工具:
  19. # agent(agent_type="remote_librarian", task=...) # 查询
  20. # agent(agent_type="remote_librarian_ingest", task=...) # 上传(异步)
  21. # agent(agent_type="remote_research", task=...) # 深度调研
  22. from agent.tools.builtin.context import get_current_context
  23. from agent.tools.builtin.toolhub import toolhub_health, toolhub_search, toolhub_call
  24. from agent.tools.builtin.resource import resource_list_tools, resource_get_tool
  25. from agent.tools.builtin.content import (
  26. content_platforms, content_search, content_detail, content_suggest,
  27. extract_video_clip, import_content,
  28. )
  29. from agent.trace.goal_tool import goal
  30. # 导入浏览器工具以触发注册
  31. import agent.tools.builtin.browser # noqa: F401
  32. import agent.tools.builtin.feishu
  33. import agent.tools.builtin.im
  34. __all__ = [
  35. # 文件操作
  36. "read_file",
  37. "read_images",
  38. "edit_file",
  39. "write_file",
  40. "glob_files",
  41. "grep_content",
  42. # 系统工具
  43. "bash_command",
  44. "skill",
  45. # 知识管理:统一通过 agent(agent_type="remote_librarian" / "remote_librarian_ingest" / "remote_research")
  46. # 知识管理(旧架构 - 直接 HTTP API,仅供 Knowledge Manager 内部使用)
  47. # "knowledge_search",
  48. # "knowledge_save",
  49. # "knowledge_list",
  50. # "knowledge_update",
  51. # "knowledge_batch_update",
  52. # "knowledge_slim",
  53. "list_skills",
  54. "agent",
  55. "evaluate",
  56. # 内容工具族(重构自 search.py + crawler.py)
  57. "content_platforms",
  58. "content_search",
  59. "content_detail",
  60. "content_suggest",
  61. # 上下文工具
  62. "get_current_context",
  63. # ToolHub 远程工具库
  64. "toolhub_health",
  65. "toolhub_search",
  66. "toolhub_call",
  67. # image_uploader / image_downloader 已内化到 toolhub_call 的图片管线中,不再单独暴露
  68. # 资源查询
  69. "resource_list_tools",
  70. "resource_get_tool",
  71. # 媒体 / 导入
  72. "extract_video_clip",
  73. "import_content",
  74. # Goal 管理
  75. "goal",
  76. ]