mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## What changed - Pair `PreModelRequest` and `PostModelRequest` hooks per sampling or compaction attempt, with distinct lifecycle IDs and cancellation reporting. - Add `thread_id` and `kind` to hook inputs, distinguishing `sampling`, `foreground_compaction`, and `background_compaction`. Include the provider's `response_id` in post-hook inputs when available. - Wait for synchronous post-hooks before releasing terminal response events, accounting for usage, or installing compaction results. Allow streaming output and tool execution to proceed before the hook finishes, and cancel synchronous post-hooks when their owning request is interrupted. - Preserve incomplete-response, budget-exceeded, and hook-denied outcomes across sampling retries and compaction model fallback. ## Testing Add coverage for streaming and tool ordering, interrupted post-hooks, per-attempt metadata, and foreground and background compaction accounting and installation ordering. GitOrigin-RevId: 3e808c5b3bf2d5a6a326d9f5be5bbd0359b2d16e
167 lines
3.7 KiB
JSON
Generated
167 lines
3.7 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"
|
|
]
|
|
},
|
|
"SamplingKind": {
|
|
"enum": [
|
|
"sampling",
|
|
"foreground_compaction",
|
|
"background_compaction"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"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"
|
|
},
|
|
"response_id": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/NullableString"
|
|
}
|
|
],
|
|
"description": "The provider's identifier for the completed or incomplete response, if available."
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/ModelRequestStatus"
|
|
},
|
|
"token_usage": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/TokenUsage"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"error",
|
|
"hook_event_name",
|
|
"response_id",
|
|
"status",
|
|
"token_usage"
|
|
],
|
|
"type": "object"
|
|
}
|
|
],
|
|
"properties": {
|
|
"agent_id": {
|
|
"type": "string"
|
|
},
|
|
"agent_type": {
|
|
"type": "string"
|
|
},
|
|
"cwd": {
|
|
"$ref": "#/definitions/AbsolutePathBuf"
|
|
},
|
|
"kind": {
|
|
"$ref": "#/definitions/SamplingKind"
|
|
},
|
|
"model": {
|
|
"type": "string"
|
|
},
|
|
"session_id": {
|
|
"type": "string"
|
|
},
|
|
"thread_id": {
|
|
"description": "Identifies the issuing thread within its shared session.",
|
|
"type": "string"
|
|
},
|
|
"transcript_path": {
|
|
"$ref": "#/definitions/NullableString"
|
|
},
|
|
"turn_id": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"cwd",
|
|
"kind",
|
|
"model",
|
|
"session_id",
|
|
"thread_id",
|
|
"transcript_path",
|
|
"turn_id"
|
|
],
|
|
"title": "model-request.command.input",
|
|
"type": "object"
|
|
} |