__init__.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. """
  2. 内置基础工具 - 参考 opencode 实现
  3. 这些工具参考 vendor/opencode/packages/opencode/src/tool/ 的设计,
  4. 在 Python 中重新实现核心功能。
  5. 参考版本:opencode main branch (2025-01)
  6. """
  7. # 文件操作工具
  8. from agent.tools.builtin.file.read import read_file
  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.file.glob import glob_files
  12. from agent.tools.builtin.file.grep import grep_content
  13. # 系统工具
  14. from agent.tools.builtin.bash import bash_command
  15. from agent.tools.builtin.skill import skill, list_skills
  16. from agent.tools.builtin.search import search_posts, get_search_suggestions
  17. from agent.tools.builtin.sandbox import (sandbox_create_environment, sandbox_run_shell,
  18. sandbox_rebuild_with_ports,sandbox_destroy_environment)
  19. # 导入浏览器工具以触发注册
  20. import agent.tools.builtin.browser # noqa: F401
  21. __all__ = [
  22. # 文件操作
  23. "read_file",
  24. "edit_file",
  25. "write_file",
  26. "glob_files",
  27. "grep_content",
  28. # 系统工具
  29. "bash_command",
  30. "skill",
  31. "list_skills",
  32. "search_posts",
  33. "get_search_suggestions",
  34. "sandbox_create_environment",
  35. "sandbox_run_shell",
  36. "sandbox_rebuild_with_ports",
  37. "sandbox_destroy_environment",
  38. ]