From ff47d8d48ac6dc7defa9c97a052b46d49b39f79b Mon Sep 17 00:00:00 2001 From: ZheFox Date: Thu, 30 Jul 2026 20:34:41 +0800 Subject: [PATCH] fix(gateway): route response history through ai seam --- .../finalize/internal/stream_rewrite.rs | 3 +- .../aether-gateway/src/ai_serving/pure/mod.rs | 34 +++++++++---------- .../src/ai_serving/response_history.rs | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/apps/aether-gateway/src/ai_serving/finalize/internal/stream_rewrite.rs b/apps/aether-gateway/src/ai_serving/finalize/internal/stream_rewrite.rs index bad26766f..c1b8c0425 100644 --- a/apps/aether-gateway/src/ai_serving/finalize/internal/stream_rewrite.rs +++ b/apps/aether-gateway/src/ai_serving/finalize/internal/stream_rewrite.rs @@ -1,9 +1,8 @@ use serde_json::Value; -use aether_ai_formats::api::ResponseHistoryRecord; - use crate::ai_serving::{ maybe_build_ai_surface_stream_rewriter, AiSurfaceFinalizeError, AiSurfaceStreamRewriter, + ResponseHistoryRecord, }; use crate::GatewayError; diff --git a/apps/aether-gateway/src/ai_serving/pure/mod.rs b/apps/aether-gateway/src/ai_serving/pure/mod.rs index e2c34787e..64523a428 100644 --- a/apps/aether-gateway/src/ai_serving/pure/mod.rs +++ b/apps/aether-gateway/src/ai_serving/pure/mod.rs @@ -57,7 +57,7 @@ pub(crate) use aether_ai_formats::api::{ find_kiro_real_thinking_end_tag, find_kiro_real_thinking_end_tag_at_buffer_end, find_kiro_real_thinking_start_tag, forbid_upstream_streaming_for_provider, force_upstream_streaming_for_provider, gemini_request_is_image_generation, - implicit_sync_finalize_report_kind, is_core_error_finalize_kind, + hydrate_response_history, implicit_sync_finalize_report_kind, is_core_error_finalize_kind, is_matching_stream_http_request, is_matching_stream_request, is_openai_image_stream_request, is_openai_responses_compact_format, is_openai_responses_family_format, is_openai_responses_format, kiro_crc32, map_claude_stop_reason, @@ -88,10 +88,10 @@ pub(crate) use aether_ai_formats::api::{ provider_adaptation_descriptor_for_provider_type, provider_adaptation_requires_eventstream_accept, provider_adaptation_should_unwrap_stream_envelope, - provider_private_response_allows_sync_finalize, request_candidate_api_format_preference, - request_candidate_api_formats, request_conversion_kind, - request_conversion_requires_enable_flag, request_path_implies_stream_request, - resolve_claude_stream_spec, resolve_claude_sync_spec, + provider_private_response_allows_sync_finalize, record_converted_response_history, + request_candidate_api_format_preference, request_candidate_api_formats, + request_conversion_kind, request_conversion_requires_enable_flag, + request_path_implies_stream_request, resolve_claude_stream_spec, resolve_claude_sync_spec, resolve_codex_responses_model_capabilities, resolve_execution_runtime_stream_plan_kind, resolve_execution_runtime_stream_plan_kind_with_client_surface, resolve_execution_runtime_sync_plan_kind, @@ -105,14 +105,14 @@ pub(crate) use aether_ai_formats::api::{ resolve_openai_responses_sync_spec, resolve_requested_gemini_image_model_for_request, resolve_requested_openai_image_model_for_request, resolve_upstream_is_stream_for_provider as resolve_format_upstream_is_stream_for_provider, - resolve_upstream_is_stream_from_endpoint_config, sanitize_request_path, - sanitize_request_path_and_query, sanitize_request_query_string, - stream_body_contains_error_event, supports_stream_execution_decision_kind, - supports_sync_execution_decision_kind, sync_chat_response_conversion_kind, - sync_cli_response_conversion_kind, transform_provider_private_stream_line, - validate_openai_provider_request_contract, value_as_u64, AiControlPlanRequest, - AiSurfaceFinalizeError, AiSurfaceStreamRewriter, CanonicalStreamFrame, - ChatGptWebImageRequestError, ClaudeClientEmitter, ClaudeProviderState, + resolve_upstream_is_stream_from_endpoint_config, response_history_is_loaded, + response_history_storage_key, sanitize_request_path, sanitize_request_path_and_query, + sanitize_request_query_string, stream_body_contains_error_event, + supports_stream_execution_decision_kind, supports_sync_execution_decision_kind, + sync_chat_response_conversion_kind, sync_cli_response_conversion_kind, + transform_provider_private_stream_line, validate_openai_provider_request_contract, + value_as_u64, AiControlPlanRequest, AiSurfaceFinalizeError, AiSurfaceStreamRewriter, + CanonicalStreamFrame, ChatGptWebImageRequestError, ClaudeClientEmitter, ClaudeProviderState, CodexResponsesModelCapabilities, ExecutionRuntimeAuthContext, FinalizeStreamRewriteMode, FormatContext, GeminiClientEmitter, GeminiImageRequestForOpenAi, GeminiProviderState, KiroToClaudeCliStreamState, LocalCoreSyncErrorKind, LocalGeminiFilesSpec, LocalOpenAiImageSpec, @@ -124,10 +124,10 @@ pub(crate) use aether_ai_formats::api::{ OpenAiImageRequestForGemini, OpenAiImageResponseFormat, OpenAiImageStreamState, OpenAiImageSyncFinalizeProduct, OpenAiProviderRequestFinalization, ProviderAdaptationDescriptor, ProviderAdaptationSurface, ProviderPrivateStreamNormalizer, - ReasoningEffort, RequestConversionKind, ServiceTier, StandardCrossFormatSyncProduct, - StandardSyncFinalizeNormalizedProduct, StreamingStandardFormatMatrix, - SyncChatResponseConversionKind, SyncCliResponseConversionKind, SyncToStreamBridgeOutcome, - ANTIGRAVITY_V1INTERNAL_ENVELOPE_NAME, CLAUDE_CHAT_STREAM_PLAN_KIND, + ReasoningEffort, RequestConversionKind, ResponseHistoryRecord, ServiceTier, + StandardCrossFormatSyncProduct, StandardSyncFinalizeNormalizedProduct, + StreamingStandardFormatMatrix, SyncChatResponseConversionKind, SyncCliResponseConversionKind, + SyncToStreamBridgeOutcome, ANTIGRAVITY_V1INTERNAL_ENVELOPE_NAME, CLAUDE_CHAT_STREAM_PLAN_KIND, CLAUDE_CHAT_STREAM_SUCCESS_REPORT_KIND, CLAUDE_CHAT_SYNC_ERROR_REPORT_KIND, CLAUDE_CHAT_SYNC_FINALIZE_REPORT_KIND, CLAUDE_CHAT_SYNC_PLAN_KIND, CLAUDE_CHAT_SYNC_SUCCESS_REPORT_KIND, CLAUDE_CLI_STREAM_PLAN_KIND, diff --git a/apps/aether-gateway/src/ai_serving/response_history.rs b/apps/aether-gateway/src/ai_serving/response_history.rs index 69f57f9f3..2578d0b5e 100644 --- a/apps/aether-gateway/src/ai_serving/response_history.rs +++ b/apps/aether-gateway/src/ai_serving/response_history.rs @@ -1,4 +1,4 @@ -use aether_ai_formats::api::{ +use crate::ai_serving::{ hydrate_response_history, normalize_api_format_alias, record_converted_response_history, response_history_is_loaded, response_history_storage_key, ResponseHistoryRecord, };