diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 96602e3bb..fe145a2d4 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,8 +1,8 @@ schema_version: 1 -generation_id: d8a1420b-a1ed-40ae-8675-e79d0e6fe5ce +generation_id: 9ddc7bd7-7dde-4ca0-9796-b799d1856183 openapi_spec_hash: 92700e1a33a4f6174a01b46648c8186a openapi_transformed_spec_hash: e37bbe0f04caa6093f1cb5d65d23ad03 -config_hash: d13c582815d0db08c374985806be7352 -codegen_sha: 48b2b7ead2af6d92c34149aa44744f7e2ae4367a -codegen_hash: f7d9f64ad58ebcf8291c4168c4322d6cc0c5ef1fe934f58dd7f785338920a919 -public_codegen_sha: ad61fb7c99fae3ed2d764fc4eb31db395ea44b33 +config_hash: beab4f058e80bab30085bb6c8467b65f +codegen_sha: eb5e25357e53704e2f933c553955a272266a1c04 +codegen_hash: eba4178634b1f9b13d20cce4648c21f0009e610a7434e11e4b363c03f7058563 +public_codegen_sha: f2bbcb54a3442935e643fd86befd04a969fbcb60 diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponsesServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponsesServerEvent.kt index 4f445f520..5b41025bd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponsesServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponsesServerEvent.kt @@ -28,12 +28,6 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -private fun Map.streamId(): JsonField = - get("stream_id") ?: JsonMissing.of() - -private fun JsonField.asStreamId(): Optional = - if (isMissing() || isNull()) Optional.empty() else Optional.of(asStringOrThrow()) - /** Server events emitted by the Responses WebSocket server. */ @JsonDeserialize(using = BetaResponsesServerEvent.Deserializer::class) @JsonSerialize(using = BetaResponsesServerEvent.Serializer::class) @@ -382,120 +376,233 @@ private constructor( * The WebSocket lane that emitted this event. This field is present when the originating * `response.create` event supplied a `stream_id`. */ - fun streamId(): Optional = streamIdField().asStreamId() + fun streamId(): Optional { + val value = streamIdField() + return if (value.isMissing() || value.isNull()) Optional.empty() + else Optional.of(value.asStringOrThrow()) + } private fun streamIdField(): JsonField = _json?.asObject()?.getOrNull()?.get("stream_id") ?: when { - responseAudioDelta != null -> responseAudioDelta._additionalProperties().streamId() - responseAudioDone != null -> responseAudioDone._additionalProperties().streamId() + responseAudioDelta != null -> + responseAudioDelta._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseAudioDone != null -> + responseAudioDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseAudioTranscriptDelta != null -> - responseAudioTranscriptDelta._additionalProperties().streamId() + responseAudioTranscriptDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseAudioTranscriptDone != null -> - responseAudioTranscriptDone._additionalProperties().streamId() + responseAudioTranscriptDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallCodeDelta != null -> - responseCodeInterpreterCallCodeDelta._additionalProperties().streamId() + responseCodeInterpreterCallCodeDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallCodeDone != null -> - responseCodeInterpreterCallCodeDone._additionalProperties().streamId() + responseCodeInterpreterCallCodeDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallCompleted != null -> - responseCodeInterpreterCallCompleted._additionalProperties().streamId() + responseCodeInterpreterCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallInProgress != null -> - responseCodeInterpreterCallInProgress._additionalProperties().streamId() + responseCodeInterpreterCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallInterpreting != null -> - responseCodeInterpreterCallInterpreting._additionalProperties().streamId() - responseCompleted != null -> responseCompleted._additionalProperties().streamId() + responseCodeInterpreterCallInterpreting._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseCompleted != null -> + responseCompleted._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseContentPartAdded != null -> - responseContentPartAdded._additionalProperties().streamId() + responseContentPartAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseContentPartDone != null -> - responseContentPartDone._additionalProperties().streamId() - responseCreated != null -> responseCreated._additionalProperties().streamId() - error != null -> error._additionalProperties().streamId() + responseContentPartDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseCreated != null -> + responseCreated._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseFileSearchCallCompleted != null -> - responseFileSearchCallCompleted._additionalProperties().streamId() + responseFileSearchCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFileSearchCallInProgress != null -> - responseFileSearchCallInProgress._additionalProperties().streamId() + responseFileSearchCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFileSearchCallSearching != null -> - responseFileSearchCallSearching._additionalProperties().streamId() + responseFileSearchCallSearching._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFunctionCallArgumentsDelta != null -> - responseFunctionCallArgumentsDelta._additionalProperties().streamId() + responseFunctionCallArgumentsDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFunctionCallArgumentsDone != null -> - responseFunctionCallArgumentsDone._additionalProperties().streamId() - responseInProgress != null -> responseInProgress._additionalProperties().streamId() - responseFailed != null -> responseFailed._additionalProperties().streamId() - responseIncomplete != null -> responseIncomplete._additionalProperties().streamId() + responseFunctionCallArgumentsDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallCommandAdded != null -> + responseShellCallCommandAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallCommandDelta != null -> + responseShellCallCommandDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallCommandDone != null -> + responseShellCallCommandDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallOutputContentDelta != null -> + responseShellCallOutputContentDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallOutputContentDone != null -> + responseShellCallOutputContentDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseInProgress != null -> + responseInProgress._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseFailed != null -> + responseFailed._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseIncomplete != null -> + responseIncomplete._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputItemAdded != null -> - responseOutputItemAdded._additionalProperties().streamId() + responseOutputItemAdded._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputItemDone != null -> - responseOutputItemDone._additionalProperties().streamId() + responseOutputItemDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseReasoningSummaryPartAdded != null -> - responseReasoningSummaryPartAdded._additionalProperties().streamId() + responseReasoningSummaryPartAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningSummaryPartDone != null -> - responseReasoningSummaryPartDone._additionalProperties().streamId() + responseReasoningSummaryPartDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningSummaryTextDelta != null -> - responseReasoningSummaryTextDelta._additionalProperties().streamId() + responseReasoningSummaryTextDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningSummaryTextDone != null -> - responseReasoningSummaryTextDone._additionalProperties().streamId() + responseReasoningSummaryTextDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningTextDelta != null -> - responseReasoningTextDelta._additionalProperties().streamId() + responseReasoningTextDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningTextDone != null -> - responseReasoningTextDone._additionalProperties().streamId() + responseReasoningTextDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseRefusalDelta != null -> - responseRefusalDelta._additionalProperties().streamId() + responseRefusalDelta._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseRefusalDone != null -> - responseRefusalDone._additionalProperties().streamId() + responseRefusalDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputTextDelta != null -> - responseOutputTextDelta._additionalProperties().streamId() + responseOutputTextDelta._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputTextDone != null -> - responseOutputTextDone._additionalProperties().streamId() + responseOutputTextDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseWebSearchCallCompleted != null -> - responseWebSearchCallCompleted._additionalProperties().streamId() + responseWebSearchCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseWebSearchCallInProgress != null -> - responseWebSearchCallInProgress._additionalProperties().streamId() + responseWebSearchCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseWebSearchCallSearching != null -> - responseWebSearchCallSearching._additionalProperties().streamId() + responseWebSearchCallSearching._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallCompleted != null -> - responseImageGenerationCallCompleted._additionalProperties().streamId() + responseImageGenerationCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallGenerating != null -> - responseImageGenerationCallGenerating._additionalProperties().streamId() + responseImageGenerationCallGenerating._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallInProgress != null -> - responseImageGenerationCallInProgress._additionalProperties().streamId() + responseImageGenerationCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallPartialImage != null -> - responseImageGenerationCallPartialImage._additionalProperties().streamId() + responseImageGenerationCallPartialImage._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallArgumentsDelta != null -> - responseMcpCallArgumentsDelta._additionalProperties().streamId() + responseMcpCallArgumentsDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallArgumentsDone != null -> - responseMcpCallArgumentsDone._additionalProperties().streamId() + responseMcpCallArgumentsDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallCompleted != null -> - responseMcpCallCompleted._additionalProperties().streamId() + responseMcpCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallFailed != null -> - responseMcpCallFailed._additionalProperties().streamId() + responseMcpCallFailed._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseMcpCallInProgress != null -> - responseMcpCallInProgress._additionalProperties().streamId() + responseMcpCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpListToolsCompleted != null -> - responseMcpListToolsCompleted._additionalProperties().streamId() + responseMcpListToolsCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpListToolsFailed != null -> - responseMcpListToolsFailed._additionalProperties().streamId() + responseMcpListToolsFailed._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpListToolsInProgress != null -> - responseMcpListToolsInProgress._additionalProperties().streamId() + responseMcpListToolsInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseOutputTextAnnotationAdded != null -> - responseOutputTextAnnotationAdded._additionalProperties().streamId() - responseQueued != null -> responseQueued._additionalProperties().streamId() + responseOutputTextAnnotationAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseQueued != null -> + responseQueued._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseCustomToolCallInputDelta != null -> - responseCustomToolCallInputDelta._additionalProperties().streamId() + responseCustomToolCallInputDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCustomToolCallInputDone != null -> - responseCustomToolCallInputDone._additionalProperties().streamId() + responseCustomToolCallInputDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + error != null -> error._streamId() + responseInjectCreated != null -> responseInjectCreated._streamId() + responseInjectFailed != null -> responseInjectFailed._streamId() - responseShellCallCommandAdded != null -> - responseShellCallCommandAdded._additionalProperties().streamId() - responseShellCallCommandDelta != null -> - responseShellCallCommandDelta._additionalProperties().streamId() - responseShellCallCommandDone != null -> - responseShellCallCommandDone._additionalProperties().streamId() - responseShellCallOutputContentDelta != null -> - responseShellCallOutputContentDelta._additionalProperties().streamId() - responseShellCallOutputContentDone != null -> - responseShellCallOutputContentDone._additionalProperties().streamId() + else -> JsonMissing.of() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt index 1c6889135..77fddaf23 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponsesServerEvent.kt @@ -28,12 +28,6 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -private fun Map.streamId(): JsonField = - get("stream_id") ?: JsonMissing.of() - -private fun JsonField.asStreamId(): Optional = - if (isMissing() || isNull()) Optional.empty() else Optional.of(asStringOrThrow()) - /** Server events emitted by the Responses WebSocket server. */ @JsonDeserialize(using = ResponsesServerEvent.Deserializer::class) @JsonSerialize(using = ResponsesServerEvent.Serializer::class) @@ -349,118 +343,229 @@ private constructor( * The WebSocket lane that emitted this event. This field is present when the originating * `response.create` event supplied a `stream_id`. */ - fun streamId(): Optional = streamIdField().asStreamId() + fun streamId(): Optional { + val value = streamIdField() + return if (value.isMissing() || value.isNull()) Optional.empty() + else Optional.of(value.asStringOrThrow()) + } private fun streamIdField(): JsonField = _json?.asObject()?.getOrNull()?.get("stream_id") ?: when { - responseAudioDelta != null -> responseAudioDelta._additionalProperties().streamId() - responseAudioDone != null -> responseAudioDone._additionalProperties().streamId() + responseAudioDelta != null -> + responseAudioDelta._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseAudioDone != null -> + responseAudioDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseAudioTranscriptDelta != null -> - responseAudioTranscriptDelta._additionalProperties().streamId() + responseAudioTranscriptDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseAudioTranscriptDone != null -> - responseAudioTranscriptDone._additionalProperties().streamId() + responseAudioTranscriptDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallCodeDelta != null -> - responseCodeInterpreterCallCodeDelta._additionalProperties().streamId() + responseCodeInterpreterCallCodeDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallCodeDone != null -> - responseCodeInterpreterCallCodeDone._additionalProperties().streamId() + responseCodeInterpreterCallCodeDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallCompleted != null -> - responseCodeInterpreterCallCompleted._additionalProperties().streamId() + responseCodeInterpreterCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallInProgress != null -> - responseCodeInterpreterCallInProgress._additionalProperties().streamId() + responseCodeInterpreterCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCodeInterpreterCallInterpreting != null -> - responseCodeInterpreterCallInterpreting._additionalProperties().streamId() - responseCompleted != null -> responseCompleted._additionalProperties().streamId() + responseCodeInterpreterCallInterpreting._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseCompleted != null -> + responseCompleted._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseContentPartAdded != null -> - responseContentPartAdded._additionalProperties().streamId() + responseContentPartAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseContentPartDone != null -> - responseContentPartDone._additionalProperties().streamId() - responseCreated != null -> responseCreated._additionalProperties().streamId() - error != null -> error._additionalProperties().streamId() + responseContentPartDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseCreated != null -> + responseCreated._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseFileSearchCallCompleted != null -> - responseFileSearchCallCompleted._additionalProperties().streamId() + responseFileSearchCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFileSearchCallInProgress != null -> - responseFileSearchCallInProgress._additionalProperties().streamId() + responseFileSearchCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFileSearchCallSearching != null -> - responseFileSearchCallSearching._additionalProperties().streamId() + responseFileSearchCallSearching._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFunctionCallArgumentsDelta != null -> - responseFunctionCallArgumentsDelta._additionalProperties().streamId() + responseFunctionCallArgumentsDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseFunctionCallArgumentsDone != null -> - responseFunctionCallArgumentsDone._additionalProperties().streamId() - responseInProgress != null -> responseInProgress._additionalProperties().streamId() - responseFailed != null -> responseFailed._additionalProperties().streamId() - responseIncomplete != null -> responseIncomplete._additionalProperties().streamId() + responseFunctionCallArgumentsDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallCommandAdded != null -> + responseShellCallCommandAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallCommandDelta != null -> + responseShellCallCommandDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallCommandDone != null -> + responseShellCallCommandDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallOutputContentDelta != null -> + responseShellCallOutputContentDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseShellCallOutputContentDone != null -> + responseShellCallOutputContentDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseInProgress != null -> + responseInProgress._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseFailed != null -> + responseFailed._additionalProperties()["stream_id"] ?: JsonMissing.of() + + responseIncomplete != null -> + responseIncomplete._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputItemAdded != null -> - responseOutputItemAdded._additionalProperties().streamId() + responseOutputItemAdded._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputItemDone != null -> - responseOutputItemDone._additionalProperties().streamId() + responseOutputItemDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseReasoningSummaryPartAdded != null -> - responseReasoningSummaryPartAdded._additionalProperties().streamId() + responseReasoningSummaryPartAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningSummaryPartDone != null -> - responseReasoningSummaryPartDone._additionalProperties().streamId() + responseReasoningSummaryPartDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningSummaryTextDelta != null -> - responseReasoningSummaryTextDelta._additionalProperties().streamId() + responseReasoningSummaryTextDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningSummaryTextDone != null -> - responseReasoningSummaryTextDone._additionalProperties().streamId() + responseReasoningSummaryTextDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningTextDelta != null -> - responseReasoningTextDelta._additionalProperties().streamId() + responseReasoningTextDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseReasoningTextDone != null -> - responseReasoningTextDone._additionalProperties().streamId() + responseReasoningTextDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseRefusalDelta != null -> - responseRefusalDelta._additionalProperties().streamId() + responseRefusalDelta._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseRefusalDone != null -> - responseRefusalDone._additionalProperties().streamId() + responseRefusalDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputTextDelta != null -> - responseOutputTextDelta._additionalProperties().streamId() + responseOutputTextDelta._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseOutputTextDone != null -> - responseOutputTextDone._additionalProperties().streamId() + responseOutputTextDone._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseWebSearchCallCompleted != null -> - responseWebSearchCallCompleted._additionalProperties().streamId() + responseWebSearchCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseWebSearchCallInProgress != null -> - responseWebSearchCallInProgress._additionalProperties().streamId() + responseWebSearchCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseWebSearchCallSearching != null -> - responseWebSearchCallSearching._additionalProperties().streamId() + responseWebSearchCallSearching._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallCompleted != null -> - responseImageGenerationCallCompleted._additionalProperties().streamId() + responseImageGenerationCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallGenerating != null -> - responseImageGenerationCallGenerating._additionalProperties().streamId() + responseImageGenerationCallGenerating._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallInProgress != null -> - responseImageGenerationCallInProgress._additionalProperties().streamId() + responseImageGenerationCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseImageGenerationCallPartialImage != null -> - responseImageGenerationCallPartialImage._additionalProperties().streamId() + responseImageGenerationCallPartialImage._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallArgumentsDelta != null -> - responseMcpCallArgumentsDelta._additionalProperties().streamId() + responseMcpCallArgumentsDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallArgumentsDone != null -> - responseMcpCallArgumentsDone._additionalProperties().streamId() + responseMcpCallArgumentsDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallCompleted != null -> - responseMcpCallCompleted._additionalProperties().streamId() + responseMcpCallCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpCallFailed != null -> - responseMcpCallFailed._additionalProperties().streamId() + responseMcpCallFailed._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseMcpCallInProgress != null -> - responseMcpCallInProgress._additionalProperties().streamId() + responseMcpCallInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpListToolsCompleted != null -> - responseMcpListToolsCompleted._additionalProperties().streamId() + responseMcpListToolsCompleted._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpListToolsFailed != null -> - responseMcpListToolsFailed._additionalProperties().streamId() + responseMcpListToolsFailed._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseMcpListToolsInProgress != null -> - responseMcpListToolsInProgress._additionalProperties().streamId() + responseMcpListToolsInProgress._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseOutputTextAnnotationAdded != null -> - responseOutputTextAnnotationAdded._additionalProperties().streamId() - responseQueued != null -> responseQueued._additionalProperties().streamId() + responseOutputTextAnnotationAdded._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + responseQueued != null -> + responseQueued._additionalProperties()["stream_id"] ?: JsonMissing.of() + responseCustomToolCallInputDelta != null -> - responseCustomToolCallInputDelta._additionalProperties().streamId() + responseCustomToolCallInputDelta._additionalProperties()["stream_id"] + ?: JsonMissing.of() + responseCustomToolCallInputDone != null -> - responseCustomToolCallInputDone._additionalProperties().streamId() - responseShellCallCommandAdded != null -> - responseShellCallCommandAdded._additionalProperties().streamId() - responseShellCallCommandDelta != null -> - responseShellCallCommandDelta._additionalProperties().streamId() - responseShellCallCommandDone != null -> - responseShellCallCommandDone._additionalProperties().streamId() - responseShellCallOutputContentDelta != null -> - responseShellCallOutputContentDelta._additionalProperties().streamId() - responseShellCallOutputContentDone != null -> - responseShellCallOutputContentDone._additionalProperties().streamId() + responseCustomToolCallInputDone._additionalProperties()["stream_id"] + ?: JsonMissing.of() + + error != null -> error._streamId() + else -> JsonMissing.of() } diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt index 2a0f6d3d1..40a800b98 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt @@ -21,14 +21,12 @@ internal class BetaResponsesServerEventTest { .delta("delta") .sequenceNumber(0L) .agent(BetaResponseAudioDeltaEvent.Agent.builder().agentName("agent_name").build()) - .putAdditionalProperty("stream_id", JsonValue.from("stream_id")) .build() val betaResponsesServerEvent = BetaResponsesServerEvent.ofResponseAudioDelta(responseAudioDelta) assertThat(betaResponsesServerEvent.responseAudioDelta()).contains(responseAudioDelta) - assertThat(betaResponsesServerEvent.streamId()).contains("stream_id") assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty assertThat(betaResponsesServerEvent.responseAudioTranscriptDelta()).isEmpty assertThat(betaResponsesServerEvent.responseAudioTranscriptDone()).isEmpty @@ -46,6 +44,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -108,6 +111,61 @@ internal class BetaResponsesServerEventTest { assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) } + @Test + fun ofResponseAudioDeltaStreamIdMetadata() { + val mapper = jsonMapper() + val original = + BetaResponsesServerEvent.ofResponseAudioDelta( + BetaResponseAudioDeltaEvent.builder() + .delta("delta") + .sequenceNumber(0L) + .agent( + BetaResponseAudioDeltaEvent.Agent.builder().agentName("agent_name").build() + ) + .build() + ) + val originalIsValid = original.isValid() + val seed = mapper.readTree(mapper.writeValueAsString(original)) + for (value in listOf(null, "null", "\"route\"", "42", "[]", "{}")) { + val node = seed.deepCopy() + node.put("x_castiron_unknown", "preserved") + if (value == null) { + node.remove("stream_id") + } else { + node.set( + "stream_id", + mapper.readTree(value), + ) + } + val json = mapper.writeValueAsString(node) + val deserialized = mapper.readValue(json, jacksonTypeRef()) + val wrapped = + BetaResponsesServerEvent.ofResponseAudioDelta( + mapper.readValue(json, original.asResponseAudioDelta().javaClass) + ) + for (event in listOf(deserialized, wrapped)) { + assertThat(event.isResponseAudioDelta()).isTrue() + assertThat(mapper.readTree(mapper.writeValueAsString(event))).isEqualTo(node) + when (value) { + null, + "null" -> assertThat(event.streamId()).isEmpty + "\"route\"" -> assertThat(event.streamId()).contains("route") + else -> { + assertThrows { event.streamId() } + assertThrows { event.validate() } + assertThat(event.isValid()).isFalse() + continue + } + } + assertThat(event.isValid()).isEqualTo(originalIsValid) + if (originalIsValid) { + assertThat(event.validate()).isSameAs(event) + assertThat(event.validate()).isSameAs(event) + } + } + } + } + @Test fun ofResponseAudioDone() { val responseAudioDone = @@ -137,6 +195,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -233,6 +296,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -331,6 +399,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -433,6 +506,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -538,6 +616,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -642,6 +725,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -745,6 +833,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -848,6 +941,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -1156,6 +1254,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -1501,6 +1604,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -1654,6 +1762,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -1988,6 +2101,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -2254,8 +2372,554 @@ internal class BetaResponsesServerEventTest { .user("user-1234") .build() ) - .sequenceNumber(0L) - .agent(BetaResponseCreatedEvent.Agent.builder().agentName("agent_name").build()) + .sequenceNumber(0L) + .agent(BetaResponseCreatedEvent.Agent.builder().agentName("agent_name").build()) + .build() + ) + + val roundtrippedBetaResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaResponsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) + } + + @Test + fun ofResponseFileSearchCallCompleted() { + val responseFileSearchCallCompleted = + BetaResponseFileSearchCallCompletedEvent.builder() + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFileSearchCallCompletedEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFileSearchCallCompleted( + responseFileSearchCallCompleted + ) + + assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(betaResponsesServerEvent.responseCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()) + .contains(responseFileSearchCallCompleted) + assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDone()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseQueued()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(betaResponsesServerEvent.error()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectFailed()).isEmpty + } + + @Test + fun ofResponseFileSearchCallCompletedRoundtrip() { + val jsonMapper = jsonMapper() + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFileSearchCallCompleted( + BetaResponseFileSearchCallCompletedEvent.builder() + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFileSearchCallCompletedEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + ) + + val roundtrippedBetaResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaResponsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) + } + + @Test + fun ofResponseFileSearchCallInProgress() { + val responseFileSearchCallInProgress = + BetaResponseFileSearchCallInProgressEvent.builder() + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFileSearchCallInProgressEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFileSearchCallInProgress( + responseFileSearchCallInProgress + ) + + assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(betaResponsesServerEvent.responseCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()) + .contains(responseFileSearchCallInProgress) + assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDone()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseQueued()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(betaResponsesServerEvent.error()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectFailed()).isEmpty + } + + @Test + fun ofResponseFileSearchCallInProgressRoundtrip() { + val jsonMapper = jsonMapper() + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFileSearchCallInProgress( + BetaResponseFileSearchCallInProgressEvent.builder() + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFileSearchCallInProgressEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + ) + + val roundtrippedBetaResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaResponsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) + } + + @Test + fun ofResponseFileSearchCallSearching() { + val responseFileSearchCallSearching = + BetaResponseFileSearchCallSearchingEvent.builder() + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFileSearchCallSearchingEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFileSearchCallSearching( + responseFileSearchCallSearching + ) + + assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(betaResponsesServerEvent.responseCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()) + .contains(responseFileSearchCallSearching) + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDone()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseQueued()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(betaResponsesServerEvent.error()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectFailed()).isEmpty + } + + @Test + fun ofResponseFileSearchCallSearchingRoundtrip() { + val jsonMapper = jsonMapper() + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFileSearchCallSearching( + BetaResponseFileSearchCallSearchingEvent.builder() + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFileSearchCallSearchingEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + ) + + val roundtrippedBetaResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaResponsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) + } + + @Test + fun ofResponseFunctionCallArgumentsDelta() { + val responseFunctionCallArgumentsDelta = + BetaResponseFunctionCallArgumentsDeltaEvent.builder() + .delta("delta") + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFunctionCallArgumentsDeltaEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDelta( + responseFunctionCallArgumentsDelta + ) + + assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(betaResponsesServerEvent.responseCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()) + .contains(responseFunctionCallArgumentsDelta) + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDone()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseQueued()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(betaResponsesServerEvent.error()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectFailed()).isEmpty + } + + @Test + fun ofResponseFunctionCallArgumentsDeltaRoundtrip() { + val jsonMapper = jsonMapper() + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDelta( + BetaResponseFunctionCallArgumentsDeltaEvent.builder() + .delta("delta") + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFunctionCallArgumentsDeltaEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + ) + + val roundtrippedBetaResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaResponsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) + } + + @Test + fun ofResponseFunctionCallArgumentsDone() { + val responseFunctionCallArgumentsDone = + BetaResponseFunctionCallArgumentsDoneEvent.builder() + .arguments("arguments") + .itemId("item_id") + .name("name") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFunctionCallArgumentsDoneEvent.Agent.builder() + .agentName("agent_name") + .build() + ) + .build() + + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDone( + responseFunctionCallArgumentsDone + ) + + assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(betaResponsesServerEvent.responseCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()) + .contains(responseFunctionCallArgumentsDone) + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseRefusalDone()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(betaResponsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(betaResponsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseQueued()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(betaResponsesServerEvent.error()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectCreated()).isEmpty + assertThat(betaResponsesServerEvent.responseInjectFailed()).isEmpty + } + + @Test + fun ofResponseFunctionCallArgumentsDoneRoundtrip() { + val jsonMapper = jsonMapper() + val betaResponsesServerEvent = + BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDone( + BetaResponseFunctionCallArgumentsDoneEvent.builder() + .arguments("arguments") + .itemId("item_id") + .name("name") + .outputIndex(0L) + .sequenceNumber(0L) + .agent( + BetaResponseFunctionCallArgumentsDoneEvent.Agent.builder() + .agentName("agent_name") + .build() + ) .build() ) @@ -2269,23 +2933,22 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFileSearchCallCompleted() { - val responseFileSearchCallCompleted = - BetaResponseFileSearchCallCompletedEvent.builder() - .itemId("item_id") + fun ofResponseShellCallCommandAdded() { + val responseShellCallCommandAdded = + BetaResponseShellCallCommandAddedEvent.builder() + .command("command") + .commandIndex(0L) .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFileSearchCallCompletedEvent.Agent.builder() + BetaResponseShellCallCommandAddedEvent.Agent.builder() .agentName("agent_name") .build() ) .build() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFileSearchCallCompleted( - responseFileSearchCallCompleted - ) + BetaResponsesServerEvent.ofResponseShellCallCommandAdded(responseShellCallCommandAdded) assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty @@ -2300,12 +2963,17 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseContentPartAdded()).isEmpty assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty assertThat(betaResponsesServerEvent.responseCreated()).isEmpty - assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()) - .contains(responseFileSearchCallCompleted) + assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()) + .contains(responseShellCallCommandAdded) + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -2346,16 +3014,17 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFileSearchCallCompletedRoundtrip() { + fun ofResponseShellCallCommandAddedRoundtrip() { val jsonMapper = jsonMapper() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFileSearchCallCompleted( - BetaResponseFileSearchCallCompletedEvent.builder() - .itemId("item_id") + BetaResponsesServerEvent.ofResponseShellCallCommandAdded( + BetaResponseShellCallCommandAddedEvent.builder() + .command("command") + .commandIndex(0L) .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFileSearchCallCompletedEvent.Agent.builder() + BetaResponseShellCallCommandAddedEvent.Agent.builder() .agentName("agent_name") .build() ) @@ -2372,23 +3041,23 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFileSearchCallInProgress() { - val responseFileSearchCallInProgress = - BetaResponseFileSearchCallInProgressEvent.builder() - .itemId("item_id") + fun ofResponseShellCallCommandDelta() { + val responseShellCallCommandDelta = + BetaResponseShellCallCommandDeltaEvent.builder() + .commandIndex(0L) + .delta("delta") .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFileSearchCallInProgressEvent.Agent.builder() + BetaResponseShellCallCommandDeltaEvent.Agent.builder() .agentName("agent_name") .build() ) + .obfuscation("obfuscation") .build() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFileSearchCallInProgress( - responseFileSearchCallInProgress - ) + BetaResponsesServerEvent.ofResponseShellCallCommandDelta(responseShellCallCommandDelta) assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty @@ -2404,11 +3073,16 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseContentPartDone()).isEmpty assertThat(betaResponsesServerEvent.responseCreated()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty - assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()) - .contains(responseFileSearchCallInProgress) + assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()) + .contains(responseShellCallCommandDelta) + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -2449,19 +3123,21 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFileSearchCallInProgressRoundtrip() { + fun ofResponseShellCallCommandDeltaRoundtrip() { val jsonMapper = jsonMapper() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFileSearchCallInProgress( - BetaResponseFileSearchCallInProgressEvent.builder() - .itemId("item_id") + BetaResponsesServerEvent.ofResponseShellCallCommandDelta( + BetaResponseShellCallCommandDeltaEvent.builder() + .commandIndex(0L) + .delta("delta") .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFileSearchCallInProgressEvent.Agent.builder() + BetaResponseShellCallCommandDeltaEvent.Agent.builder() .agentName("agent_name") .build() ) + .obfuscation("obfuscation") .build() ) @@ -2475,23 +3151,22 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFileSearchCallSearching() { - val responseFileSearchCallSearching = - BetaResponseFileSearchCallSearchingEvent.builder() - .itemId("item_id") + fun ofResponseShellCallCommandDone() { + val responseShellCallCommandDone = + BetaResponseShellCallCommandDoneEvent.builder() + .command("command") + .commandIndex(0L) .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFileSearchCallSearchingEvent.Agent.builder() + BetaResponseShellCallCommandDoneEvent.Agent.builder() .agentName("agent_name") .build() ) .build() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFileSearchCallSearching( - responseFileSearchCallSearching - ) + BetaResponsesServerEvent.ofResponseShellCallCommandDone(responseShellCallCommandDone) assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty assertThat(betaResponsesServerEvent.responseAudioDone()).isEmpty @@ -2508,10 +3183,15 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseCreated()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty - assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()) - .contains(responseFileSearchCallSearching) + assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()) + .contains(responseShellCallCommandDone) + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -2552,16 +3232,17 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFileSearchCallSearchingRoundtrip() { + fun ofResponseShellCallCommandDoneRoundtrip() { val jsonMapper = jsonMapper() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFileSearchCallSearching( - BetaResponseFileSearchCallSearchingEvent.builder() - .itemId("item_id") + BetaResponsesServerEvent.ofResponseShellCallCommandDone( + BetaResponseShellCallCommandDoneEvent.builder() + .command("command") + .commandIndex(0L) .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFileSearchCallSearchingEvent.Agent.builder() + BetaResponseShellCallCommandDoneEvent.Agent.builder() .agentName("agent_name") .build() ) @@ -2578,23 +3259,29 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFunctionCallArgumentsDelta() { - val responseFunctionCallArgumentsDelta = - BetaResponseFunctionCallArgumentsDeltaEvent.builder() - .delta("delta") + fun ofResponseShellCallOutputContentDelta() { + val responseShellCallOutputContentDelta = + BetaResponseShellCallOutputContentDeltaEvent.builder() + .commandIndex(0L) + .delta( + BetaResponseShellCallOutputContentDeltaEvent.Delta.builder() + .stderr("stderr") + .stdout("stdout") + .build() + ) .itemId("item_id") .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFunctionCallArgumentsDeltaEvent.Agent.builder() + BetaResponseShellCallOutputContentDeltaEvent.Agent.builder() .agentName("agent_name") .build() ) .build() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDelta( - responseFunctionCallArgumentsDelta + BetaResponsesServerEvent.ofResponseShellCallOutputContentDelta( + responseShellCallOutputContentDelta ) assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty @@ -2613,9 +3300,14 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallCompleted()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty - assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()) - .contains(responseFunctionCallArgumentsDelta) + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()) + .contains(responseShellCallOutputContentDelta) + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -2656,17 +3348,23 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFunctionCallArgumentsDeltaRoundtrip() { + fun ofResponseShellCallOutputContentDeltaRoundtrip() { val jsonMapper = jsonMapper() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDelta( - BetaResponseFunctionCallArgumentsDeltaEvent.builder() - .delta("delta") + BetaResponsesServerEvent.ofResponseShellCallOutputContentDelta( + BetaResponseShellCallOutputContentDeltaEvent.builder() + .commandIndex(0L) + .delta( + BetaResponseShellCallOutputContentDeltaEvent.Delta.builder() + .stderr("stderr") + .stdout("stdout") + .build() + ) .itemId("item_id") .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFunctionCallArgumentsDeltaEvent.Agent.builder() + BetaResponseShellCallOutputContentDeltaEvent.Agent.builder() .agentName("agent_name") .build() ) @@ -2683,24 +3381,31 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFunctionCallArgumentsDone() { - val responseFunctionCallArgumentsDone = - BetaResponseFunctionCallArgumentsDoneEvent.builder() - .arguments("arguments") + fun ofResponseShellCallOutputContentDone() { + val responseShellCallOutputContentDone = + BetaResponseShellCallOutputContentDoneEvent.builder() + .commandIndex(0L) .itemId("item_id") - .name("name") + .addOutput( + BetaResponseShellCallOutputContentDoneEvent.Output.builder() + .outcomeTimeout() + .stderr("stderr") + .stdout("stdout") + .createdBy("created_by") + .build() + ) .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFunctionCallArgumentsDoneEvent.Agent.builder() + BetaResponseShellCallOutputContentDoneEvent.Agent.builder() .agentName("agent_name") .build() ) .build() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDone( - responseFunctionCallArgumentsDone + BetaResponsesServerEvent.ofResponseShellCallOutputContentDone( + responseShellCallOutputContentDone ) assertThat(betaResponsesServerEvent.responseAudioDelta()).isEmpty @@ -2720,8 +3425,13 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty - assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()) - .contains(responseFunctionCallArgumentsDone) + assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()) + .contains(responseShellCallOutputContentDone) assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -2762,18 +3472,25 @@ internal class BetaResponsesServerEventTest { } @Test - fun ofResponseFunctionCallArgumentsDoneRoundtrip() { + fun ofResponseShellCallOutputContentDoneRoundtrip() { val jsonMapper = jsonMapper() val betaResponsesServerEvent = - BetaResponsesServerEvent.ofResponseFunctionCallArgumentsDone( - BetaResponseFunctionCallArgumentsDoneEvent.builder() - .arguments("arguments") + BetaResponsesServerEvent.ofResponseShellCallOutputContentDone( + BetaResponseShellCallOutputContentDoneEvent.builder() + .commandIndex(0L) .itemId("item_id") - .name("name") + .addOutput( + BetaResponseShellCallOutputContentDoneEvent.Output.builder() + .outcomeTimeout() + .stderr("stderr") + .stdout("stdout") + .createdBy("created_by") + .build() + ) .outputIndex(0L) .sequenceNumber(0L) .agent( - BetaResponseFunctionCallArgumentsDoneEvent.Agent.builder() + BetaResponseShellCallOutputContentDoneEvent.Agent.builder() .agentName("agent_name") .build() ) @@ -3032,6 +3749,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).contains(responseInProgress) assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -3556,6 +4278,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).contains(responseFailed) assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -4079,6 +4806,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).contains(responseIncomplete) @@ -4431,6 +5163,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -4604,6 +5341,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -4748,6 +5490,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -4860,6 +5607,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -4972,6 +5724,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5079,6 +5836,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5184,6 +5946,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5289,6 +6056,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5392,6 +6164,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5492,6 +6269,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5602,6 +6384,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5725,6 +6512,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5840,6 +6632,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -5943,6 +6740,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6046,6 +6848,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6149,6 +6956,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6252,6 +7064,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6355,6 +7172,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6435,6 +7257,10 @@ internal class BetaResponsesServerEventTest { .agentName("agent_name") .build() ) + .background("background") + .outputFormat("output_format") + .quality("quality") + .size("size") .build() val betaResponsesServerEvent = @@ -6460,6 +7286,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6516,6 +7347,10 @@ internal class BetaResponsesServerEventTest { .agentName("agent_name") .build() ) + .background("background") + .outputFormat("output_format") + .quality("quality") + .size("size") .build() ) @@ -6564,6 +7399,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6667,6 +7507,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6769,6 +7614,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6868,6 +7718,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -6968,6 +7823,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -7069,6 +7929,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -7170,6 +8035,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -7273,6 +8143,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -7385,6 +8260,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -7702,6 +8582,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -8020,6 +8905,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -8125,6 +9015,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -8239,6 +9134,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -8317,6 +9217,77 @@ internal class BetaResponsesServerEventTest { assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) } + @Test + fun ofErrorStreamIdMetadata() { + val mapper = jsonMapper() + val original = + BetaResponsesServerEvent.ofError( + BetaResponsesServerEvent.BetaResponseWsError.builder() + .error( + BetaResponsesServerEvent.BetaResponseWsError.Error.builder() + .code("code") + .message("message") + .param("param") + .type("type") + .headers( + BetaResponsesServerEvent.BetaResponseWsError.Error.Headers.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .agent( + BetaResponsesServerEvent.BetaResponseWsError.Agent.builder() + .agentName("agent_name") + .build() + ) + .sequenceNumber(0L) + .status(0L) + .streamId("stream_id") + .build() + ) + val originalIsValid = original.isValid() + val seed = mapper.readTree(mapper.writeValueAsString(original)) + for (value in listOf(null, "null", "\"route\"", "42", "[]", "{}")) { + val node = seed.deepCopy() + node.put("x_castiron_unknown", "preserved") + if (value == null) { + node.remove("stream_id") + } else { + node.set( + "stream_id", + mapper.readTree(value), + ) + } + val json = mapper.writeValueAsString(node) + val deserialized = mapper.readValue(json, jacksonTypeRef()) + val wrapped = + BetaResponsesServerEvent.ofError( + mapper.readValue(json, original.asError().javaClass) + ) + for (event in listOf(deserialized, wrapped)) { + assertThat(event.isError()).isTrue() + assertThat(mapper.readTree(mapper.writeValueAsString(event))).isEqualTo(node) + when (value) { + null, + "null" -> assertThat(event.streamId()).isEmpty + "\"route\"" -> assertThat(event.streamId()).contains("route") + else -> { + assertThrows { event.streamId() } + assertThrows { event.validate() } + assertThat(event.isValid()).isFalse() + continue + } + } + assertThat(event.isValid()).isEqualTo(originalIsValid) + if (originalIsValid) { + assertThat(event.validate()).isSameAs(event) + assertThat(event.validate()).isSameAs(event) + } + } + } + } + @Test fun ofResponseInjectCreated() { val responseInjectCreated = @@ -8347,6 +9318,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -8383,7 +9359,6 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseCustomToolCallInputDone()).isEmpty assertThat(betaResponsesServerEvent.error()).isEmpty assertThat(betaResponsesServerEvent.responseInjectCreated()).contains(responseInjectCreated) - assertThat(betaResponsesServerEvent.streamId()).contains("stream_id") assertThat(betaResponsesServerEvent.responseInjectFailed()).isEmpty } @@ -8408,6 +9383,59 @@ internal class BetaResponsesServerEventTest { assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) } + @Test + fun ofResponseInjectCreatedStreamIdMetadata() { + val mapper = jsonMapper() + val original = + BetaResponsesServerEvent.ofResponseInjectCreated( + BetaResponseInjectCreatedEvent.builder() + .responseId("response_id") + .sequenceNumber(0L) + .streamId("stream_id") + .build() + ) + val originalIsValid = original.isValid() + val seed = mapper.readTree(mapper.writeValueAsString(original)) + for (value in listOf(null, "null", "\"route\"", "42", "[]", "{}")) { + val node = seed.deepCopy() + node.put("x_castiron_unknown", "preserved") + if (value == null) { + node.remove("stream_id") + } else { + node.set( + "stream_id", + mapper.readTree(value), + ) + } + val json = mapper.writeValueAsString(node) + val deserialized = mapper.readValue(json, jacksonTypeRef()) + val wrapped = + BetaResponsesServerEvent.ofResponseInjectCreated( + mapper.readValue(json, original.asResponseInjectCreated().javaClass) + ) + for (event in listOf(deserialized, wrapped)) { + assertThat(event.isResponseInjectCreated()).isTrue() + assertThat(mapper.readTree(mapper.writeValueAsString(event))).isEqualTo(node) + when (value) { + null, + "null" -> assertThat(event.streamId()).isEmpty + "\"route\"" -> assertThat(event.streamId()).contains("route") + else -> { + assertThrows { event.streamId() } + assertThrows { event.validate() } + assertThat(event.isValid()).isFalse() + continue + } + } + assertThat(event.isValid()).isEqualTo(originalIsValid) + if (originalIsValid) { + assertThat(event.validate()).isSameAs(event) + assertThat(event.validate()).isSameAs(event) + } + } + } + } + @Test fun ofResponseInjectFailed() { val responseInjectFailed = @@ -8452,6 +9480,11 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(betaResponsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(betaResponsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(betaResponsesServerEvent.responseInProgress()).isEmpty assertThat(betaResponsesServerEvent.responseFailed()).isEmpty assertThat(betaResponsesServerEvent.responseIncomplete()).isEmpty @@ -8528,6 +9561,93 @@ internal class BetaResponsesServerEventTest { assertThat(roundtrippedBetaResponsesServerEvent).isEqualTo(betaResponsesServerEvent) } + @Test + fun ofResponseInjectFailedStreamIdMetadata() { + val mapper = jsonMapper() + val original = + BetaResponsesServerEvent.ofResponseInjectFailed( + BetaResponseInjectFailedEvent.builder() + .error( + BetaResponseInjectFailedEvent.Error.builder() + .code( + BetaResponseInjectFailedEvent.Error.Code.RESPONSE_ALREADY_COMPLETED + ) + .message("message") + .build() + ) + .addInput( + BetaEasyInputMessage.builder() + .content("string") + .role(BetaEasyInputMessage.Role.USER) + .phase(BetaEasyInputMessage.Phase.COMMENTARY) + .type(BetaEasyInputMessage.Type.MESSAGE) + .build() + ) + .responseId("response_id") + .sequenceNumber(0L) + .streamId("stream_id") + .build() + ) + val originalIsValid = original.isValid() + val seed = mapper.readTree(mapper.writeValueAsString(original)) + for (value in listOf(null, "null", "\"route\"", "42", "[]", "{}")) { + val node = seed.deepCopy() + node.put("x_castiron_unknown", "preserved") + if (value == null) { + node.remove("stream_id") + } else { + node.set( + "stream_id", + mapper.readTree(value), + ) + } + val json = mapper.writeValueAsString(node) + val deserialized = mapper.readValue(json, jacksonTypeRef()) + val wrapped = + BetaResponsesServerEvent.ofResponseInjectFailed( + mapper.readValue(json, original.asResponseInjectFailed().javaClass) + ) + for (event in listOf(deserialized, wrapped)) { + assertThat(event.isResponseInjectFailed()).isTrue() + assertThat(mapper.readTree(mapper.writeValueAsString(event))).isEqualTo(node) + when (value) { + null, + "null" -> assertThat(event.streamId()).isEmpty + "\"route\"" -> assertThat(event.streamId()).contains("route") + else -> { + assertThrows { event.streamId() } + assertThrows { event.validate() } + assertThat(event.isValid()).isFalse() + continue + } + } + assertThat(event.isValid()).isEqualTo(originalIsValid) + if (originalIsValid) { + assertThat(event.validate()).isSameAs(event) + assertThat(event.validate()).isSameAs(event) + } + } + } + } + + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { + BOOLEAN(JsonValue.from(false)), + STRING(JsonValue.from("invalid")), + INTEGER(JsonValue.from(-1)), + FLOAT(JsonValue.from(3.14)), + ARRAY(JsonValue.from(listOf("invalid", "array"))), + } + + @ParameterizedTest + @EnumSource + fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { + val betaResponsesServerEvent = + jsonMapper().convertValue(testCase.value, jacksonTypeRef()) + + val e = assertThrows { betaResponsesServerEvent.validate() } + assertThat(e).hasMessageStartingWith("Unknown ") + } + @Test fun websocketStreamId() { val betaResponsesServerEvent = @@ -8559,24 +9679,6 @@ internal class BetaResponsesServerEventTest { assertThat(betaResponsesServerEvent.isValid()).isFalse() } - enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { - BOOLEAN(JsonValue.from(false)), - STRING(JsonValue.from("invalid")), - INTEGER(JsonValue.from(-1)), - FLOAT(JsonValue.from(3.14)), - ARRAY(JsonValue.from(listOf("invalid", "array"))), - } - - @ParameterizedTest - @EnumSource - fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { - val betaResponsesServerEvent = - jsonMapper().convertValue(testCase.value, jacksonTypeRef()) - - val e = assertThrows { betaResponsesServerEvent.validate() } - assertThat(e).hasMessageStartingWith("Unknown ") - } - @Test fun shellCallCommandAddedPreservesStreamId() { val mapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt index c6924b7ce..a437b6574 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt @@ -21,16 +21,11 @@ internal class ResponsesServerEventTest { @Test fun ofResponseAudioDelta() { val responseAudioDelta = - ResponseAudioDeltaEvent.builder() - .delta("delta") - .sequenceNumber(0L) - .putAdditionalProperty("stream_id", JsonValue.from("stream_id")) - .build() + ResponseAudioDeltaEvent.builder().delta("delta").sequenceNumber(0L).build() val responsesServerEvent = ResponsesServerEvent.ofResponseAudioDelta(responseAudioDelta) assertThat(responsesServerEvent.responseAudioDelta()).contains(responseAudioDelta) - assertThat(responsesServerEvent.streamId()).contains("stream_id") assertThat(responsesServerEvent.responseAudioDone()).isEmpty assertThat(responsesServerEvent.responseAudioTranscriptDelta()).isEmpty assertThat(responsesServerEvent.responseAudioTranscriptDone()).isEmpty @@ -48,6 +43,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -102,6 +102,55 @@ internal class ResponsesServerEventTest { assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) } + @Test + fun ofResponseAudioDeltaStreamIdMetadata() { + val mapper = jsonMapper() + val original = + ResponsesServerEvent.ofResponseAudioDelta( + ResponseAudioDeltaEvent.builder().delta("delta").sequenceNumber(0L).build() + ) + val originalIsValid = original.isValid() + val seed = mapper.readTree(mapper.writeValueAsString(original)) + for (value in listOf(null, "null", "\"route\"", "42", "[]", "{}")) { + val node = seed.deepCopy() + node.put("x_castiron_unknown", "preserved") + if (value == null) { + node.remove("stream_id") + } else { + node.set( + "stream_id", + mapper.readTree(value), + ) + } + val json = mapper.writeValueAsString(node) + val deserialized = mapper.readValue(json, jacksonTypeRef()) + val wrapped = + ResponsesServerEvent.ofResponseAudioDelta( + mapper.readValue(json, original.asResponseAudioDelta().javaClass) + ) + for (event in listOf(deserialized, wrapped)) { + assertThat(event.isResponseAudioDelta()).isTrue() + assertThat(mapper.readTree(mapper.writeValueAsString(event))).isEqualTo(node) + when (value) { + null, + "null" -> assertThat(event.streamId()).isEmpty + "\"route\"" -> assertThat(event.streamId()).contains("route") + else -> { + assertThrows { event.streamId() } + assertThrows { event.validate() } + assertThat(event.isValid()).isFalse() + continue + } + } + assertThat(event.isValid()).isEqualTo(originalIsValid) + if (originalIsValid) { + assertThat(event.validate()).isSameAs(event) + assertThat(event.validate()).isSameAs(event) + } + } + } + } + @Test fun ofResponseAudioDone() { val responseAudioDone = ResponseAudioDoneEvent.builder().sequenceNumber(0L).build() @@ -126,6 +175,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -207,6 +261,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -291,6 +350,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -379,6 +443,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -472,6 +541,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -564,6 +638,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -655,6 +734,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -746,6 +830,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -1037,6 +1126,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -1366,6 +1460,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -1508,6 +1607,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -1826,6 +1930,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -2128,6 +2237,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -2219,6 +2333,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -2308,6 +2427,11 @@ internal class ResponsesServerEventTest { .contains(responseFileSearchCallSearching) assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -2400,6 +2524,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()) .contains(responseFunctionCallArgumentsDelta) assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -2494,6 +2623,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()) .contains(responseFunctionCallArgumentsDone) + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -2554,6 +2688,520 @@ internal class ResponsesServerEventTest { assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) } + @Test + fun ofResponseShellCallCommandAdded() { + val responseShellCallCommandAdded = + ResponseShellCallCommandAddedEvent.builder() + .command("command") + .commandIndex(0L) + .outputIndex(0L) + .sequenceNumber(0L) + .build() + + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallCommandAdded(responseShellCallCommandAdded) + + assertThat(responsesServerEvent.responseAudioDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioDone()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(responsesServerEvent.responseCompleted()).isEmpty + assertThat(responsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(responsesServerEvent.responseContentPartDone()).isEmpty + assertThat(responsesServerEvent.responseCreated()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()) + .contains(responseShellCallCommandAdded) + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(responsesServerEvent.responseInProgress()).isEmpty + assertThat(responsesServerEvent.responseFailed()).isEmpty + assertThat(responsesServerEvent.responseIncomplete()).isEmpty + assertThat(responsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(responsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(responsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(responsesServerEvent.responseRefusalDone()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(responsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(responsesServerEvent.responseQueued()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(responsesServerEvent.error()).isEmpty + } + + @Test + fun ofResponseShellCallCommandAddedRoundtrip() { + val jsonMapper = jsonMapper() + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallCommandAdded( + ResponseShellCallCommandAddedEvent.builder() + .command("command") + .commandIndex(0L) + .outputIndex(0L) + .sequenceNumber(0L) + .build() + ) + + val roundtrippedResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) + } + + @Test + fun ofResponseShellCallCommandDelta() { + val responseShellCallCommandDelta = + ResponseShellCallCommandDeltaEvent.builder() + .commandIndex(0L) + .delta("delta") + .outputIndex(0L) + .sequenceNumber(0L) + .obfuscation("obfuscation") + .build() + + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallCommandDelta(responseShellCallCommandDelta) + + assertThat(responsesServerEvent.responseAudioDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioDone()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(responsesServerEvent.responseCompleted()).isEmpty + assertThat(responsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(responsesServerEvent.responseContentPartDone()).isEmpty + assertThat(responsesServerEvent.responseCreated()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()) + .contains(responseShellCallCommandDelta) + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(responsesServerEvent.responseInProgress()).isEmpty + assertThat(responsesServerEvent.responseFailed()).isEmpty + assertThat(responsesServerEvent.responseIncomplete()).isEmpty + assertThat(responsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(responsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(responsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(responsesServerEvent.responseRefusalDone()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(responsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(responsesServerEvent.responseQueued()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(responsesServerEvent.error()).isEmpty + } + + @Test + fun ofResponseShellCallCommandDeltaRoundtrip() { + val jsonMapper = jsonMapper() + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallCommandDelta( + ResponseShellCallCommandDeltaEvent.builder() + .commandIndex(0L) + .delta("delta") + .outputIndex(0L) + .sequenceNumber(0L) + .obfuscation("obfuscation") + .build() + ) + + val roundtrippedResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) + } + + @Test + fun ofResponseShellCallCommandDone() { + val responseShellCallCommandDone = + ResponseShellCallCommandDoneEvent.builder() + .command("command") + .commandIndex(0L) + .outputIndex(0L) + .sequenceNumber(0L) + .build() + + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallCommandDone(responseShellCallCommandDone) + + assertThat(responsesServerEvent.responseAudioDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioDone()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(responsesServerEvent.responseCompleted()).isEmpty + assertThat(responsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(responsesServerEvent.responseContentPartDone()).isEmpty + assertThat(responsesServerEvent.responseCreated()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()) + .contains(responseShellCallCommandDone) + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(responsesServerEvent.responseInProgress()).isEmpty + assertThat(responsesServerEvent.responseFailed()).isEmpty + assertThat(responsesServerEvent.responseIncomplete()).isEmpty + assertThat(responsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(responsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(responsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(responsesServerEvent.responseRefusalDone()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(responsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(responsesServerEvent.responseQueued()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(responsesServerEvent.error()).isEmpty + } + + @Test + fun ofResponseShellCallCommandDoneRoundtrip() { + val jsonMapper = jsonMapper() + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallCommandDone( + ResponseShellCallCommandDoneEvent.builder() + .command("command") + .commandIndex(0L) + .outputIndex(0L) + .sequenceNumber(0L) + .build() + ) + + val roundtrippedResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) + } + + @Test + fun ofResponseShellCallOutputContentDelta() { + val responseShellCallOutputContentDelta = + ResponseShellCallOutputContentDeltaEvent.builder() + .commandIndex(0L) + .delta( + ResponseShellCallOutputContentDeltaEvent.Delta.builder() + .stderr("stderr") + .stdout("stdout") + .build() + ) + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .build() + + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallOutputContentDelta( + responseShellCallOutputContentDelta + ) + + assertThat(responsesServerEvent.responseAudioDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioDone()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(responsesServerEvent.responseCompleted()).isEmpty + assertThat(responsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(responsesServerEvent.responseContentPartDone()).isEmpty + assertThat(responsesServerEvent.responseCreated()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()) + .contains(responseShellCallOutputContentDelta) + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty + assertThat(responsesServerEvent.responseInProgress()).isEmpty + assertThat(responsesServerEvent.responseFailed()).isEmpty + assertThat(responsesServerEvent.responseIncomplete()).isEmpty + assertThat(responsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(responsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(responsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(responsesServerEvent.responseRefusalDone()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(responsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(responsesServerEvent.responseQueued()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(responsesServerEvent.error()).isEmpty + } + + @Test + fun ofResponseShellCallOutputContentDeltaRoundtrip() { + val jsonMapper = jsonMapper() + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallOutputContentDelta( + ResponseShellCallOutputContentDeltaEvent.builder() + .commandIndex(0L) + .delta( + ResponseShellCallOutputContentDeltaEvent.Delta.builder() + .stderr("stderr") + .stdout("stdout") + .build() + ) + .itemId("item_id") + .outputIndex(0L) + .sequenceNumber(0L) + .build() + ) + + val roundtrippedResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) + } + + @Test + fun ofResponseShellCallOutputContentDone() { + val responseShellCallOutputContentDone = + ResponseShellCallOutputContentDoneEvent.builder() + .commandIndex(0L) + .itemId("item_id") + .addOutput( + ResponseShellCallOutputContentDoneEvent.Output.builder() + .outcomeTimeout() + .stderr("stderr") + .stdout("stdout") + .createdBy("created_by") + .build() + ) + .outputIndex(0L) + .sequenceNumber(0L) + .build() + + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallOutputContentDone( + responseShellCallOutputContentDone + ) + + assertThat(responsesServerEvent.responseAudioDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioDone()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDelta()).isEmpty + assertThat(responsesServerEvent.responseAudioTranscriptDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDelta()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCodeDone()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseCodeInterpreterCallInterpreting()).isEmpty + assertThat(responsesServerEvent.responseCompleted()).isEmpty + assertThat(responsesServerEvent.responseContentPartAdded()).isEmpty + assertThat(responsesServerEvent.responseContentPartDone()).isEmpty + assertThat(responsesServerEvent.responseCreated()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()) + .contains(responseShellCallOutputContentDone) + assertThat(responsesServerEvent.responseInProgress()).isEmpty + assertThat(responsesServerEvent.responseFailed()).isEmpty + assertThat(responsesServerEvent.responseIncomplete()).isEmpty + assertThat(responsesServerEvent.responseOutputItemAdded()).isEmpty + assertThat(responsesServerEvent.responseOutputItemDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartAdded()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryPartDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningSummaryTextDone()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDelta()).isEmpty + assertThat(responsesServerEvent.responseReasoningTextDone()).isEmpty + assertThat(responsesServerEvent.responseRefusalDelta()).isEmpty + assertThat(responsesServerEvent.responseRefusalDone()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDelta()).isEmpty + assertThat(responsesServerEvent.responseOutputTextDone()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseWebSearchCallSearching()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallGenerating()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseImageGenerationCallPartialImage()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDelta()).isEmpty + assertThat(responsesServerEvent.responseMcpCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseMcpCallCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpCallFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpCallInProgress()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsCompleted()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsFailed()).isEmpty + assertThat(responsesServerEvent.responseMcpListToolsInProgress()).isEmpty + assertThat(responsesServerEvent.responseOutputTextAnnotationAdded()).isEmpty + assertThat(responsesServerEvent.responseQueued()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDelta()).isEmpty + assertThat(responsesServerEvent.responseCustomToolCallInputDone()).isEmpty + assertThat(responsesServerEvent.error()).isEmpty + } + + @Test + fun ofResponseShellCallOutputContentDoneRoundtrip() { + val jsonMapper = jsonMapper() + val responsesServerEvent = + ResponsesServerEvent.ofResponseShellCallOutputContentDone( + ResponseShellCallOutputContentDoneEvent.builder() + .commandIndex(0L) + .itemId("item_id") + .addOutput( + ResponseShellCallOutputContentDoneEvent.Output.builder() + .outcomeTimeout() + .stderr("stderr") + .stdout("stdout") + .createdBy("created_by") + .build() + ) + .outputIndex(0L) + .sequenceNumber(0L) + .build() + ) + + val roundtrippedResponsesServerEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responsesServerEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) + } + @Test fun ofResponseInProgress() { val responseInProgress = @@ -2787,6 +3435,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).contains(responseInProgress) assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -3291,6 +3944,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).contains(responseFailed) assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -3795,6 +4453,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).contains(responseIncomplete) @@ -4128,6 +4791,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4280,6 +4948,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4404,6 +5077,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4502,6 +5180,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4598,6 +5281,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4693,6 +5381,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4786,6 +5479,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4879,6 +5577,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -4971,6 +5674,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5062,6 +5770,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5166,6 +5879,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5282,6 +6000,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5384,6 +6107,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5473,6 +6201,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5562,6 +6295,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5653,6 +6391,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5744,6 +6487,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5835,6 +6583,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5903,6 +6656,10 @@ internal class ResponsesServerEventTest { .partialImageB64("partial_image_b64") .partialImageIndex(0L) .sequenceNumber(0L) + .background("background") + .outputFormat("output_format") + .quality("quality") + .size("size") .build() val responsesServerEvent = @@ -5928,6 +6685,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -5977,6 +6739,10 @@ internal class ResponsesServerEventTest { .partialImageB64("partial_image_b64") .partialImageIndex(0L) .sequenceNumber(0L) + .background("background") + .outputFormat("output_format") + .quality("quality") + .size("size") .build() ) @@ -6020,6 +6786,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6111,6 +6882,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6201,6 +6977,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6290,6 +7071,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6378,6 +7164,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6467,6 +7258,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6556,6 +7352,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6645,6 +7446,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -6745,6 +7551,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -7046,6 +7857,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -7350,6 +8166,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -7441,6 +8262,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -7501,37 +8327,6 @@ internal class ResponsesServerEventTest { assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) } - @Test - fun websocketStreamId() { - val responsesServerEvent = - jsonMapper() - .readValue( - """{"type":"response.audio.delta","delta":"delta","sequence_number":0,"stream_id":"stream_id"}""", - jacksonTypeRef(), - ) - - assertThat(responsesServerEvent.streamId()).contains("stream_id") - assertThat(responsesServerEvent.responseAudioDelta()).isPresent - assertThat(responsesServerEvent.asResponseAudioDelta().delta()).isEqualTo("delta") - assertThat(jsonMapper().writeValueAsString(responsesServerEvent)).contains("stream_id") - assertThat(responsesServerEvent.validate()).isSameAs(responsesServerEvent) - assertThat(responsesServerEvent.isValid()).isTrue() - } - - @Test - fun websocketStreamIdRejectsMalformedValue() { - val responsesServerEvent = - jsonMapper() - .readValue( - """{"type":"response.audio.delta","delta":"delta","sequence_number":0,"stream_id":42}""", - jacksonTypeRef(), - ) - - assertThrows { responsesServerEvent.streamId() } - assertThrows { responsesServerEvent.validate() } - assertThat(responsesServerEvent.isValid()).isFalse() - } - @Test fun ofError() { val error = @@ -7574,6 +8369,11 @@ internal class ResponsesServerEventTest { assertThat(responsesServerEvent.responseFileSearchCallSearching()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDelta()).isEmpty assertThat(responsesServerEvent.responseFunctionCallArgumentsDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandAdded()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallCommandDone()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDelta()).isEmpty + assertThat(responsesServerEvent.responseShellCallOutputContentDone()).isEmpty assertThat(responsesServerEvent.responseInProgress()).isEmpty assertThat(responsesServerEvent.responseFailed()).isEmpty assertThat(responsesServerEvent.responseIncomplete()).isEmpty @@ -7645,6 +8445,70 @@ internal class ResponsesServerEventTest { assertThat(roundtrippedResponsesServerEvent).isEqualTo(responsesServerEvent) } + @Test + fun ofErrorStreamIdMetadata() { + val mapper = jsonMapper() + val original = + ResponsesServerEvent.ofError( + ResponsesServerEvent.ResponseWsError.builder() + .error( + ResponsesServerEvent.ResponseWsError.Error.builder() + .code("code") + .message("message") + .param("param") + .type("type") + .headers( + ResponsesServerEvent.ResponseWsError.Error.Headers.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .sequenceNumber(0L) + .status(0L) + .streamId("stream_id") + .build() + ) + val originalIsValid = original.isValid() + val seed = mapper.readTree(mapper.writeValueAsString(original)) + for (value in listOf(null, "null", "\"route\"", "42", "[]", "{}")) { + val node = seed.deepCopy() + node.put("x_castiron_unknown", "preserved") + if (value == null) { + node.remove("stream_id") + } else { + node.set( + "stream_id", + mapper.readTree(value), + ) + } + val json = mapper.writeValueAsString(node) + val deserialized = mapper.readValue(json, jacksonTypeRef()) + val wrapped = + ResponsesServerEvent.ofError(mapper.readValue(json, original.asError().javaClass)) + for (event in listOf(deserialized, wrapped)) { + assertThat(event.isError()).isTrue() + assertThat(mapper.readTree(mapper.writeValueAsString(event))).isEqualTo(node) + when (value) { + null, + "null" -> assertThat(event.streamId()).isEmpty + "\"route\"" -> assertThat(event.streamId()).contains("route") + else -> { + assertThrows { event.streamId() } + assertThrows { event.validate() } + assertThat(event.isValid()).isFalse() + continue + } + } + assertThat(event.isValid()).isEqualTo(originalIsValid) + if (originalIsValid) { + assertThat(event.validate()).isSameAs(event) + assertThat(event.validate()).isSameAs(event) + } + } + } + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), @@ -7663,6 +8527,37 @@ internal class ResponsesServerEventTest { assertThat(e).hasMessageStartingWith("Unknown ") } + @Test + fun websocketStreamId() { + val responsesServerEvent = + jsonMapper() + .readValue( + """{"type":"response.audio.delta","delta":"delta","sequence_number":0,"stream_id":"stream_id"}""", + jacksonTypeRef(), + ) + + assertThat(responsesServerEvent.streamId()).contains("stream_id") + assertThat(responsesServerEvent.responseAudioDelta()).isPresent + assertThat(responsesServerEvent.asResponseAudioDelta().delta()).isEqualTo("delta") + assertThat(jsonMapper().writeValueAsString(responsesServerEvent)).contains("stream_id") + assertThat(responsesServerEvent.validate()).isSameAs(responsesServerEvent) + assertThat(responsesServerEvent.isValid()).isTrue() + } + + @Test + fun websocketStreamIdRejectsMalformedValue() { + val responsesServerEvent = + jsonMapper() + .readValue( + """{"type":"response.audio.delta","delta":"delta","sequence_number":0,"stream_id":42}""", + jacksonTypeRef(), + ) + + assertThrows { responsesServerEvent.streamId() } + assertThrows { responsesServerEvent.validate() } + assertThat(responsesServerEvent.isValid()).isFalse() + } + @Test fun shellCallCommandAddedPreservesStreamId() { val mapper = jsonMapper()