Files
codex/codex-rs/hooks/schema/generated/model-request.command.input.schema.json
T
Vivian Fang 70b3bb6d88 Add observation-only model request lifecycle hooks (#55144)
## What changed

- Add `PreModelRequest` and `PostModelRequest` hooks around model request attempts, including retries. Pass model, session, turn, and optional subagent context; report completion, failure, or cancellation with errors and token usage when available.
- Treat hook output as diagnostic data without allowing it to veto requests or alter model context. Wait for synchronous post-request hooks before dispatching tools, while asynchronous hooks allow streaming tool dispatch to continue.
- Apply memory-consolidation hook filtering and expose the new events through configuration, protocol schemas, generated clients, and the hooks browser.

## Testing

Add integration coverage for failures and retries, ignored control directives, cancellation, synchronous and asynchronous tool ordering, interrupted-turn resume and token accounting, and memory-consolidation filtering. Update hook schema fixtures and hooks browser snapshots.

GitOrigin-RevId: 6ed7b39fc8bb94cf467e350d07d97fcc729c21ce
2026-10-18 22:43:56 +00:00

141 lines
3.1 KiB
JSON
Generated

{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AbsolutePathBuf": {
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
"type": "string"
},
"ModelRequestStatus": {
"enum": [
"completed",
"failed",
"cancelled"
],
"type": "string"
},
"NullableString": {
"type": [
"string",
"null"
]
},
"TokenUsage": {
"properties": {
"cache_write_input_tokens": {
"default": 0,
"format": "int64",
"type": "integer"
},
"cached_input_tokens": {
"format": "int64",
"type": "integer"
},
"input_tokens": {
"format": "int64",
"type": "integer"
},
"output_tokens": {
"format": "int64",
"type": "integer"
},
"reasoning_output_tokens": {
"format": "int64",
"type": "integer"
},
"total_tokens": {
"format": "int64",
"type": "integer"
}
},
"required": [
"cached_input_tokens",
"input_tokens",
"output_tokens",
"reasoning_output_tokens",
"total_tokens"
],
"type": "object"
}
},
"oneOf": [
{
"properties": {
"hook_event_name": {
"enum": [
"PreModelRequest"
],
"type": "string"
}
},
"required": [
"hook_event_name"
],
"type": "object"
},
{
"properties": {
"error": {
"$ref": "#/definitions/NullableString"
},
"hook_event_name": {
"enum": [
"PostModelRequest"
],
"type": "string"
},
"status": {
"$ref": "#/definitions/ModelRequestStatus"
},
"token_usage": {
"anyOf": [
{
"$ref": "#/definitions/TokenUsage"
},
{
"type": "null"
}
]
}
},
"required": [
"error",
"hook_event_name",
"status",
"token_usage"
],
"type": "object"
}
],
"properties": {
"agent_id": {
"type": "string"
},
"agent_type": {
"type": "string"
},
"cwd": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"model": {
"type": "string"
},
"session_id": {
"type": "string"
},
"transcript_path": {
"$ref": "#/definitions/NullableString"
},
"turn_id": {
"type": "string"
}
},
"required": [
"cwd",
"model",
"session_id",
"transcript_path",
"turn_id"
],
"title": "model-request.command.input",
"type": "object"
}