docs(hooks): document PreToolUse permissionDecision 'ask' behavior (#6411)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Dragon 2026-07-07 06:18:49 +08:00 committed by GitHub
parent be7e874fd1
commit bcdb44c5d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -396,6 +396,12 @@ Hook output supports three categories of fields:
- `hookSpecificOutput.updatedInput`: modified tool input parameters to use instead of original
- `hookSpecificOutput.additionalContext`: additional context information
The `permissionDecision` value controls whether the tool runs:
- `"allow"` — run the tool without the usual approval prompt.
- `"deny"` — block the tool; it does not execute and an error is returned to the model.
- `"ask"` — pause and ask the user to confirm the tool call in the TUI before it runs. Confirming runs the tool once; declining cancels it. In contexts that cannot prompt for confirmation — headless (`--prompt`) runs and background subagents — `"ask"` falls back to `"deny"`.
**Note**: While standard hook output fields like `decision` and `reason` are technically supported by the underlying class, the official interface expects the `hookSpecificOutput` with `permissionDecision` and `permissionDecisionReason`.
**Example Output**: