hermes-agent/website/docs
Teknium 0f82c757e0
feat(hooks): add duration_ms to post_tool_call + transform_tool_result
Plugin hooks fired after a tool dispatch now receive an integer
duration_ms kwarg measuring how long the tool's registry.dispatch()
call took (time.monotonic() before/after). Inspired by Claude Code
2.1.119 which added the same field to PostToolUse hook inputs.

Wire points:
- model_tools.py: measure dispatch latency, pass duration_ms to
  invoke_hook("post_tool_call", ...) and invoke_hook("transform_tool_result", ...)
- hermes_cli/hooks.py: include duration_ms in the synthetic payload
  used by 'hermes hooks test' and 'hermes hooks doctor' so shell-hook
  authors see the same shape at development time as runtime
- shell hooks (agent/shell_hooks.py): no code change needed;
  _serialize_payload already surfaces non-top-level kwargs under
  payload['extra'], so duration_ms lands at extra.duration_ms for
  shell-hook scripts

Plugin authors can now build latency dashboards, per-tool SLO alerts,
and regression canaries without having to wrap every tool manually.

Test: tests/test_model_tools.py::test_post_tool_call_receives_non_negative_integer_duration_ms
E2E: real PluginManager + dispatch monkey-patched with a 50ms sleep,
hook callback observes duration_ms=50 (int).

Refs: https://code.claude.com/docs/en/changelog (2.1.119, Apr 23 2026)
2026-04-24 17:08:06 -07:00
..
developer-guide chore: fix lint 2026-04-24 12:32:10 -04:00
getting-started docs: add PR review guides, rework quickstart, slim down installation 2026-04-19 05:30:50 -07:00
guides feat(hooks): add duration_ms to post_tool_call + transform_tool_result 2026-04-24 17:08:06 -07:00
integrations feat(copilot): add 401 auth recovery with automatic token refresh and client rebuild 2026-04-24 05:09:08 -07:00
reference docs(faq): Update docs on backups 2026-04-24 15:14:08 -07:00
user-guide feat(hooks): add duration_ms to post_tool_call + transform_tool_result 2026-04-24 17:08:06 -07:00
index.md fix(docs): show sidebar on docs homepage 2026-04-16 04:24:45 -07:00