#4878

feat(hooks): add auto-discovery mechanism for agent hooks

OpenKANG99wants to merge intofrom

Introduce hook registration via pkgutil scanning + entry_points, mirroring the existing pattern used by channels and tools. Adding a custom hook now only requires dropping a .py file into nanobot/agent/hooks/ with a hook_factories or hooks list — no manual wiring needed.

Changes:

  • New: nanobot/agent/hooks/discovery.py — pkgutil scan + entry_points loader
  • New: nanobot/agent/hooks/sound_hook.py — completion chime hook
  • nanobot/agent/loop.py: from_config() auto-discovers and merges hooks
  • nanobot/cli/commands.py, nanobot/nanobot.py: remove manual hook wiring
  • pyproject.toml: add dotenv dep + nanobot.hooks entry-point docs