diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.json index 6af19f89e2..fa7ec0a2a6 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -1932,6 +1932,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "ItemCompletedNotification": { "properties": { "completedAtMs": { @@ -3823,6 +3919,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 215842d929..104c322e8e 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -9892,6 +9892,102 @@ ], "type": "string" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "InputModality": { "description": "Canonical user-input modality tags advertised by a model.", "oneOf": [ @@ -16150,6 +16246,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/v2/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 085744e819..0445715fa7 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -6392,6 +6392,102 @@ ], "type": "string" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "InitializeCapabilities": { "description": "Client-declared capabilities negotiated during initialize.", "properties": { @@ -13974,6 +14070,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json index 6909415c2a..2f8b036323 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json @@ -285,6 +285,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1035,6 +1131,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json index 758ceba32d..183595ccf2 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json @@ -285,6 +285,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1035,6 +1131,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json index 9afd1ae514..74f48b2cbd 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json @@ -422,6 +422,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1179,6 +1275,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json index 6e74ab4ac8..5d36df7cef 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json @@ -756,6 +756,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -2014,6 +2110,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json index f78fbaf27e..75f616675f 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json @@ -448,6 +448,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1471,6 +1567,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json index 4268ad203a..e8c0d5509e 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json @@ -448,6 +448,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1471,6 +1567,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json index fb0d80a047..a08ce4f591 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json @@ -448,6 +448,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1471,6 +1567,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json index 727b7a3fb2..aa22690f07 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json @@ -756,6 +756,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -2014,6 +2110,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json index 204828c732..ccf1a49bf0 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json @@ -448,6 +448,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1471,6 +1567,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json index bf03f0fb55..59c76c222b 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json @@ -756,6 +756,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -2014,6 +2110,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json index 759b5990be..f799cc872a 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json @@ -448,6 +448,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1471,6 +1567,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json index f64400129a..34a133ab42 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json @@ -448,6 +448,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1471,6 +1567,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json index e5e2558e9c..e77e398509 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json @@ -422,6 +422,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1179,6 +1275,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json index a2eff7fdd8..af49f5005a 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json @@ -422,6 +422,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1179,6 +1275,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json index 0952db2aca..8db6aff772 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json @@ -422,6 +422,102 @@ ], "type": "object" }, + "ImageGenerationContent": { + "oneOf": [ + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "dataBase64": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "inline" + ], + "title": "InlineImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "dataBase64", + "mimeType", + "type" + ], + "title": "InlineImageGenerationContent", + "type": "object" + }, + { + "properties": { + "byteLength": { + "format": "uint64", + "minimum": 0.0, + "type": "integer" + }, + "contentId": { + "type": "string" + }, + "height": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + }, + "mimeType": { + "type": "string" + }, + "type": { + "enum": [ + "deferred" + ], + "title": "DeferredImageGenerationContentType", + "type": "string" + }, + "width": { + "format": "uint32", + "minimum": 0.0, + "type": [ + "integer", + "null" + ] + } + }, + "required": [ + "byteLength", + "contentId", + "mimeType", + "type" + ], + "title": "DeferredImageGenerationContent", + "type": "object" + } + ] + }, "McpToolCallError": { "properties": { "message": { @@ -1179,6 +1275,17 @@ }, { "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/ImageGenerationContent" + }, + { + "type": "null" + } + ], + "default": null + }, "id": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ImageGenerationContent.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ImageGenerationContent.ts new file mode 100644 index 0000000000..435e711837 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ImageGenerationContent.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ImageGenerationContent = { "type": "inline", mimeType: string, dataBase64: string, byteLength: bigint, width: number | null, height: number | null, } | { "type": "deferred", contentId: string, mimeType: string, byteLength: bigint, width: number | null, height: number | null, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts index f7880c9d32..6f73f29442 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts @@ -15,6 +15,7 @@ import type { DynamicToolCallOutputContentItem } from "./DynamicToolCallOutputCo import type { DynamicToolCallStatus } from "./DynamicToolCallStatus"; import type { FileUpdateChange } from "./FileUpdateChange"; import type { HookPromptFragment } from "./HookPromptFragment"; +import type { ImageGenerationContent } from "./ImageGenerationContent"; import type { McpToolCallError } from "./McpToolCallError"; import type { McpToolCallResult } from "./McpToolCallResult"; import type { McpToolCallStatus } from "./McpToolCallStatus"; @@ -98,4 +99,4 @@ reasoningEffort: ReasoningEffort | null, /** * Last known status of the target agents, when available. */ -agentsStates: { [key in string]?: CollabAgentState }, } | { "type": "webSearch", id: string, query: string, action: WebSearchAction | null, } | { "type": "imageView", id: string, path: AbsolutePathBuf, } | { "type": "imageGeneration", id: string, status: string, revisedPrompt: string | null, result: string, savedPath?: AbsolutePathBuf, } | { "type": "enteredReviewMode", id: string, review: string, } | { "type": "exitedReviewMode", id: string, review: string, } | { "type": "contextCompaction", id: string, }; +agentsStates: { [key in string]?: CollabAgentState }, } | { "type": "webSearch", id: string, query: string, action: WebSearchAction | null, } | { "type": "imageView", id: string, path: AbsolutePathBuf, } | { "type": "imageGeneration", id: string, status: string, revisedPrompt: string | null, content: ImageGenerationContent | null, result: string, savedPath?: AbsolutePathBuf, } | { "type": "enteredReviewMode", id: string, review: string, } | { "type": "exitedReviewMode", id: string, review: string, } | { "type": "contextCompaction", id: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index a6b961366e..a993f391c2 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -164,6 +164,7 @@ export type { HookTrustStatus } from "./HookTrustStatus"; export type { HooksListEntry } from "./HooksListEntry"; export type { HooksListParams } from "./HooksListParams"; export type { HooksListResponse } from "./HooksListResponse"; +export type { ImageGenerationContent } from "./ImageGenerationContent"; export type { ItemCompletedNotification } from "./ItemCompletedNotification"; export type { ItemGuardianApprovalReviewCompletedNotification } from "./ItemGuardianApprovalReviewCompletedNotification"; export type { ItemGuardianApprovalReviewStartedNotification } from "./ItemGuardianApprovalReviewStartedNotification"; diff --git a/codex-rs/app-server-protocol/src/protocol/thread_history.rs b/codex-rs/app-server-protocol/src/protocol/thread_history.rs index 1121d3a35b..1af3eb82fa 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_history.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_history.rs @@ -586,6 +586,7 @@ impl ThreadHistoryBuilder { id: payload.call_id.clone(), status: String::new(), revised_prompt: None, + content: None, result: String::new(), saved_path: None, }; @@ -597,6 +598,7 @@ impl ThreadHistoryBuilder { id: payload.call_id.clone(), status: payload.status.clone(), revised_prompt: payload.revised_prompt.clone(), + content: None, result: payload.result.clone(), saved_path: payload.saved_path.clone(), }; @@ -1469,6 +1471,7 @@ mod tests { id: "ig_123".into(), status: "completed".into(), revised_prompt: Some("final prompt".into()), + content: None, result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()), }, diff --git a/codex-rs/app-server-protocol/src/protocol/v2/item.rs b/codex-rs/app-server-protocol/src/protocol/v2/item.rs index 0e22c48590..a528f5ed1c 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/item.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/item.rs @@ -345,6 +345,8 @@ pub enum ThreadItem { id: String, status: String, revised_prompt: Option, + #[serde(default)] + content: Option, result: String, #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] @@ -361,6 +363,30 @@ pub enum ThreadItem { ContextCompaction { id: String }, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(tag = "type", rename_all = "camelCase")] +#[ts(tag = "type", export_to = "v2/")] +pub enum ImageGenerationContent { + #[serde(rename_all = "camelCase")] + #[ts(rename_all = "camelCase")] + Inline { + mime_type: String, + data_base64: String, + byte_length: u64, + width: Option, + height: Option, + }, + #[serde(rename_all = "camelCase")] + #[ts(rename_all = "camelCase")] + Deferred { + content_id: String, + mime_type: String, + byte_length: u64, + width: Option, + height: Option, + }, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase", export_to = "v2/")] @@ -822,6 +848,7 @@ impl From for ThreadItem { id: image.id, status: image.status, revised_prompt: image.revised_prompt, + content: None, result: image.result, saved_path: image.saved_path, }, diff --git a/codex-rs/app-server-protocol/src/protocol/v2/tests.rs b/codex-rs/app-server-protocol/src/protocol/v2/tests.rs index 30599776ae..eba2cd2244 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/tests.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/tests.rs @@ -148,6 +148,147 @@ fn thread_turns_items_list_round_trips() { ); } +#[test] +fn image_generation_accepts_missing_content_for_legacy_payloads() { + let item: ThreadItem = serde_json::from_value(json!({ + "type": "imageGeneration", + "id": "ig_123", + "status": "completed", + "revisedPrompt": null, + "result": "Zm9v", + "savedPath": null + })) + .expect("legacy image generation item should deserialize"); + + assert_eq!( + item, + ThreadItem::ImageGeneration { + id: "ig_123".to_string(), + status: "completed".to_string(), + revised_prompt: None, + content: None, + result: "Zm9v".to_string(), + saved_path: None, + } + ); +} + +#[test] +fn image_generation_serializes_missing_content_as_null() { + let item = ThreadItem::ImageGeneration { + id: "ig_123".to_string(), + status: "completed".to_string(), + revised_prompt: None, + content: None, + result: "Zm9v".to_string(), + saved_path: None, + }; + + assert_eq!( + serde_json::to_value(item).expect("image generation item should serialize"), + json!({ + "type": "imageGeneration", + "id": "ig_123", + "status": "completed", + "revisedPrompt": null, + "content": null, + "result": "Zm9v", + }) + ); +} + +#[test] +fn image_generation_inline_content_round_trips() { + let item = ThreadItem::ImageGeneration { + id: "ig_inline".to_string(), + status: "completed".to_string(), + revised_prompt: Some("final prompt".to_string()), + content: Some(ImageGenerationContent::Inline { + mime_type: "image/png".to_string(), + data_base64: "Zm9v".to_string(), + byte_length: 3, + width: Some(512), + height: Some(512), + }), + result: "Zm9v".to_string(), + saved_path: None, + }; + + let serialized = + serde_json::to_value(&item).expect("inline image generation item should serialize"); + + assert_eq!( + serialized, + json!({ + "type": "imageGeneration", + "id": "ig_inline", + "status": "completed", + "revisedPrompt": "final prompt", + "content": { + "type": "inline", + "mimeType": "image/png", + "dataBase64": "Zm9v", + "byteLength": 3, + "width": 512, + "height": 512, + }, + "result": "Zm9v", + }) + ); + + assert_eq!( + serde_json::from_value::(serialized) + .expect("inline image generation item should deserialize"), + item + ); +} + +#[test] +fn image_generation_deferred_content_round_trips() { + let item = ThreadItem::ImageGeneration { + id: "ig_deferred".to_string(), + status: "completed".to_string(), + revised_prompt: None, + content: Some(ImageGenerationContent::Deferred { + content_id: "content_123".to_string(), + mime_type: "image/png".to_string(), + byte_length: 3, + width: None, + height: None, + }), + result: String::new(), + saved_path: None, + }; + + let serialized = + serde_json::to_value(&item).expect("deferred image generation item should serialize"); + + assert_eq!( + serialized, + json!({ + "type": "imageGeneration", + "id": "ig_deferred", + "status": "completed", + "revisedPrompt": null, + "content": { + "type": "deferred", + "contentId": "content_123", + "mimeType": "image/png", + "byteLength": 3, + "width": null, + "height": null, + }, + "result": "", + }) + ); + + assert_eq!( + serde_json::from_value::(serialized) + .expect("deferred image generation item should deserialize"), + item + ); +} + #[test] fn thread_list_params_accepts_single_cwd() { let params = serde_json::from_value::(json!({ diff --git a/codex-rs/tui/src/chatwidget/tests/helpers.rs b/codex-rs/tui/src/chatwidget/tests/helpers.rs index f11cd64843..ad37b8f2de 100644 --- a/codex-rs/tui/src/chatwidget/tests/helpers.rs +++ b/codex-rs/tui/src/chatwidget/tests/helpers.rs @@ -706,6 +706,13 @@ pub(super) fn handle_image_generation_end( id: call_id.into(), status: "completed".to_string(), revised_prompt, + content: Some(codex_app_server_protocol::ImageGenerationContent::Inline { + mime_type: "image/png".to_string(), + data_base64: String::new(), + byte_length: 0, + width: None, + height: None, + }), result: String::new(), saved_path, },