| 🔨 chore: add the agent runtime tools call hooks (#13874)
* feat: add the agent runtime tools call hooks
* feat: add more agent runtime hooks
* fix: add the lost hooks
* fix: add the agent runtimes hooks test
* fix: slove some error
* fix: change the as any to hooksEvent
* fix: slove the lint error
* fix: slove the lint error
* fix: slove the lint error
* fix: clean the code
* fix: change the toolCallCounts into all mode & add all hooks into qstash runtime way
* 🐛 fix: harden beforeToolCall mock validation and remove userId fallbacks
- dispatchBeforeToolCall returns { content, isMocked } instead of { content } | null
for explicit mock detection (avoids falsy content edge cases)
- mock() rejects invalid content: empty string, undefined, object, array, number, null
- Remove all `userId: ctx.userId || ''` fallbacks — userId absence should surface, not silently degrade
- beforeToolCall adds separate dispatch() observation path for QStash webhook delivery
- Add BeforeToolCallObservationEvent type for production webhook payload
- Add 3 unit tests for mock content validation edge cases
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> | 29 天前 |