feat(core): implement additionalContext for BeforeModel hooks and aggregate context from multiple hooks

This commit is contained in:
Michael Bleigh
2026-03-26 16:05:21 -07:00
parent 73dd7328df
commit 8faf2e31ea
7 changed files with 180 additions and 22 deletions
+4
View File
@@ -197,6 +197,10 @@ request format.
outgoing request (e.g., changing models or temperature).
- `hookSpecificOutput.llm_response`: A **Synthetic Response** object. If
provided, the CLI skips the LLM call entirely and uses this as the response.
- `hookSpecificOutput.additionalContext`: (`string`) Text that is **appended**
to the end of the user message (wrapped in `<hook_context>` tags). If
`llm_request` also modifies contents, it will be appended to the modified
contents.
- `decision`: Set to `"deny"` to block the request and abort the turn.
- **Exit Code 2 (Block Turn)**: Aborts the turn and skips the LLM call. Uses
`stderr` as the error message.