__init__.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.edit import edit_file
  9. from agent.tools.builtin.file.write import write_file
  10. from agent.tools.builtin.glob_tool import glob_files
  11. from agent.tools.builtin.file.grep import grep_content
  12. from agent.tools.builtin.bash import bash_command
  13. from agent.tools.builtin.skill import skill, list_skills
  14. from agent.tools.builtin.subagent import agent, evaluate
  15. from agent.tools.builtin.search import search_posts, get_search_suggestions
  16. from agent.tools.builtin.sandbox import (sandbox_create_environment, sandbox_run_shell,
  17. sandbox_rebuild_with_ports,sandbox_destroy_environment)
  18. from agent.tools.builtin.knowledge import(knowledge_search,knowledge_save,knowledge_list,knowledge_update,knowledge_batch_update,knowledge_slim)
  19. from agent.tools.builtin.context import get_current_context
  20. from agent.tools.builtin.toolhub import toolhub_health, toolhub_search, toolhub_call, toolhub_create
  21. from agent.trace.goal_tool import goal
  22. # 导入浏览器工具以触发注册
  23. import agent.tools.builtin.browser # noqa: F401
  24. import agent.tools.builtin.feishu
  25. __all__ = [
  26. # 文件操作
  27. "read_file",
  28. "edit_file",
  29. "write_file",
  30. "glob_files",
  31. "grep_content",
  32. # 系统工具
  33. "bash_command",
  34. "skill",
  35. "knowledge_search",
  36. "knowledge_save",
  37. "knowledge_list",
  38. "knowledge_update",
  39. "knowledge_batch_update",
  40. "knowledge_slim",
  41. "list_skills",
  42. "agent",
  43. "evaluate",
  44. "search_posts",
  45. "select_post",
  46. "get_search_suggestions",
  47. "sandbox_create_environment",
  48. "sandbox_run_shell",
  49. "sandbox_rebuild_with_ports",
  50. "sandbox_destroy_environment",
  51. # 上下文工具
  52. "get_current_context",
  53. # ToolHub 远程工具库
  54. "toolhub_health",
  55. "toolhub_search",
  56. "toolhub_call",
  57. "toolhub_create",
  58. # Goal 管理
  59. "goal",
  60. ]