mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-10 03:09:50 +08:00
refactor: 移除 Python upstream 依赖,清理全部 legacy/Python 兼容层
- 移除 upstream_base_url 参数及 AETHER_GATEWAY_UPSTREAM 环境变量,gateway 不再需要指向 Python 宿主 - 删除所有 LEGACY_*/PYTHON_* 常量、路由组、header 定义及 sunset/phaseout 机制 - 将 legacy_gateway_bridge 重命名为 internal_gateway,executor 相关命名统一为 execution_runtime - dev.sh 新增 Postgres/Redis 预检查,移除 upstream 相关启动参数和提示 - 新增 ai_public 路由处理器 - 全量适配 handler、test、state、control 等模块的命名和接口变更
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
use super::util::crc32;
|
||||
use super::*;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use super::KiroToClaudeCliStreamState;
|
||||
|
||||
fn encode_string_header(name: &str, value: &str) -> Vec<u8> {
|
||||
let mut out = Vec::new();
|
||||
out.push(name.len() as u8);
|
||||
|
||||
@@ -139,7 +139,14 @@ pub(crate) fn provider_adaptation_should_unwrap_stream_envelope(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::{
|
||||
provider_adaptation_allows_sync_finalize_envelope,
|
||||
provider_adaptation_anchor_api_format,
|
||||
provider_adaptation_requires_eventstream_accept,
|
||||
provider_adaptation_should_unwrap_stream_envelope,
|
||||
ANTIGRAVITY_V1INTERNAL_ENVELOPE_NAME, GEMINI_CLI_V1INTERNAL_ENVELOPE_NAME,
|
||||
KIRO_ENVELOPE_NAME,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn resolves_private_surface_anchor_contracts() {
|
||||
|
||||
@@ -151,7 +151,11 @@ fn is_standard_api_format(api_format: &str) -> bool {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::{
|
||||
request_conversion_kind, sync_chat_response_conversion_kind,
|
||||
sync_cli_response_conversion_kind, RequestConversionKind, SyncChatResponseConversionKind,
|
||||
SyncCliResponseConversionKind,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn request_conversion_registry_supports_bidirectional_standard_matrix() {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
use base64::Engine as _;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde_json::{json, Map, Value};
|
||||
|
||||
use super::*;
|
||||
use crate::gateway::ai_pipeline::finalize::common::{
|
||||
build_generated_tool_call_id, build_local_success_outcome, canonicalize_tool_arguments,
|
||||
local_finalize_allows_envelope, parse_stream_json_events, unwrap_local_finalize_response_value,
|
||||
LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::gateway::{GatewayControlDecision, GatewayError, GatewaySyncReportRequest};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct ClaudeContentBlockState {
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
use base64::Engine as _;
|
||||
|
||||
use super::aggregate_claude_stream_sync_response;
|
||||
use super::*;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::gateway::ai_pipeline::finalize::common::{
|
||||
build_generated_tool_call_id, build_local_success_outcome, canonicalize_tool_arguments,
|
||||
local_finalize_allows_envelope, unwrap_local_finalize_response_value,
|
||||
LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::gateway::ai_pipeline::finalize::standard::build_openai_cli_response;
|
||||
use crate::gateway::{GatewayControlDecision, GatewayError, GatewaySyncReportRequest};
|
||||
|
||||
pub(crate) fn maybe_build_local_claude_cli_stream_sync_response(
|
||||
trace_id: &str,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
use base64::Engine as _;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde_json::{json, Map, Value};
|
||||
|
||||
use super::*;
|
||||
use crate::gateway::ai_pipeline::finalize::common::{
|
||||
build_generated_tool_call_id, build_local_success_outcome, canonicalize_tool_arguments,
|
||||
local_finalize_allows_envelope, parse_stream_json_events, unwrap_local_finalize_response_value,
|
||||
LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::gateway::{GatewayControlDecision, GatewayError, GatewaySyncReportRequest};
|
||||
|
||||
pub(crate) fn maybe_build_local_gemini_stream_sync_response(
|
||||
trace_id: &str,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
use base64::Engine as _;
|
||||
|
||||
use super::aggregate_gemini_stream_sync_response;
|
||||
use super::*;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::gateway::ai_pipeline::finalize::common::{
|
||||
build_generated_tool_call_id, build_local_success_outcome, canonicalize_tool_arguments,
|
||||
local_finalize_allows_envelope, unwrap_local_finalize_response_value,
|
||||
LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::gateway::ai_pipeline::finalize::standard::build_openai_cli_response;
|
||||
use crate::gateway::{GatewayControlDecision, GatewayError, GatewaySyncReportRequest};
|
||||
|
||||
pub(crate) fn maybe_build_local_gemini_cli_stream_sync_response(
|
||||
trace_id: &str,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use base64::Engine as _;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde_json::{json, Map, Value};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
aggregate_claude_stream_sync_response, aggregate_gemini_stream_sync_response,
|
||||
aggregate_openai_cli_stream_sync_response, convert_claude_chat_response_to_openai_chat,
|
||||
@@ -13,6 +15,7 @@ use crate::gateway::ai_pipeline::finalize::common::{
|
||||
local_finalize_allows_envelope, unwrap_local_finalize_response_value,
|
||||
LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::gateway::{GatewayControlDecision, GatewayError, GatewaySyncReportRequest};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct OpenAIChatChoiceState {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use base64::Engine as _;
|
||||
|
||||
use super::*;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use super::{
|
||||
aggregate_claude_stream_sync_response, aggregate_gemini_stream_sync_response,
|
||||
convert_claude_cli_response_to_openai_cli, convert_gemini_cli_response_to_openai_cli,
|
||||
@@ -11,6 +12,7 @@ use crate::gateway::ai_pipeline::finalize::common::{
|
||||
canonicalize_tool_arguments, local_finalize_allows_envelope,
|
||||
unwrap_local_finalize_response_value, LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::gateway::{GatewayControlDecision, GatewayError, GatewaySyncReportRequest};
|
||||
|
||||
pub(crate) fn maybe_build_local_openai_cli_stream_sync_response(
|
||||
trace_id: &str,
|
||||
|
||||
@@ -103,7 +103,9 @@ mod tests {
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
prefer_local_tunnel_owner_candidates, GatewayMinimalCandidateSelectionCandidate, AppState,
|
||||
};
|
||||
use crate::gateway::tunnel::TunnelAttachmentRecord;
|
||||
use crate::gateway::GatewayDataState;
|
||||
|
||||
@@ -245,7 +247,7 @@ mod tests {
|
||||
.expect("local attachment should serialize"),
|
||||
),
|
||||
]);
|
||||
let state = AppState::new("http://127.0.0.1:1")
|
||||
let state = AppState::new()
|
||||
.expect("state should build")
|
||||
.with_data_state_for_tests(data_state)
|
||||
.with_tunnel_identity_for_tests("gateway-a", Some("http://gateway-a:8080"));
|
||||
@@ -274,7 +276,7 @@ mod tests {
|
||||
std::sync::Arc::new(provider_catalog),
|
||||
"development-key",
|
||||
);
|
||||
let state = AppState::new("http://127.0.0.1:1")
|
||||
let state = AppState::new()
|
||||
.expect("state should build")
|
||||
.with_data_state_for_tests(data_state)
|
||||
.with_tunnel_identity_for_tests("gateway-a", Some("http://gateway-a:8080"));
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
use super::*;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde_json::Value;
|
||||
use url::form_urlencoded;
|
||||
|
||||
use super::{
|
||||
apply_local_body_rules, build_antigravity_v1internal_url, build_claude_code_messages_url,
|
||||
build_claude_messages_url, build_gemini_content_url,
|
||||
build_kiro_generate_assistant_response_url, build_kiro_provider_request_body,
|
||||
build_passthrough_path_url, build_vertex_api_key_gemini_content_url,
|
||||
resolve_local_vertex_api_key_query_auth, sanitize_claude_code_request_body,
|
||||
AntigravityRequestUrlAction, LocalSameFormatProviderFamily, LocalSameFormatProviderSpec,
|
||||
};
|
||||
|
||||
pub(super) fn build_same_format_provider_request_body(
|
||||
body_json: &Value,
|
||||
|
||||
@@ -156,7 +156,8 @@ fn build_openai_chat_request_body(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::build_standard_request_body;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn builds_openai_chat_request_from_claude_chat_source() {
|
||||
|
||||
@@ -306,7 +306,8 @@ pub(crate) fn build_cross_format_openai_cli_upstream_url(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::build_cross_format_openai_cli_request_body;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn builds_openai_family_cross_format_request_body_from_compact_source() {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use aether_contracts::RequestBody;
|
||||
use aether_contracts::{ExecutionPlan, RequestBody};
|
||||
|
||||
use super::augment_sync_report_context;
|
||||
use super::*;
|
||||
use super::{augment_sync_report_context, LocalStreamPlanAndReport, LocalSyncPlanAndReport};
|
||||
use crate::gateway::ai_pipeline::adaptation::surfaces::provider_adaptation_requires_eventstream_accept;
|
||||
use crate::gateway::ai_pipeline::planner::generic_decision_missing_exact_provider_request;
|
||||
use crate::gateway::provider_transport::ensure_upstream_auth_header;
|
||||
use crate::gateway::{GatewayControlSyncDecisionResponse, GatewayError};
|
||||
|
||||
pub(crate) fn build_standard_sync_plan_from_decision(
|
||||
_parts: &http::request::Parts,
|
||||
|
||||
@@ -415,7 +415,10 @@ fn truncate_body(body: &str) -> String {
|
||||
mod tests {
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use super::*;
|
||||
use super::{IDC_AMZ_USER_AGENT, KiroOAuthRefreshAdapter};
|
||||
use crate::gateway::provider_transport::oauth_refresh::{
|
||||
LocalOAuthRefreshAdapter, LocalResolvedOAuthRequestAuth,
|
||||
};
|
||||
use crate::gateway::provider_transport::snapshot::{
|
||||
GatewayProviderTransportEndpoint, GatewayProviderTransportKey,
|
||||
GatewayProviderTransportProvider, GatewayProviderTransportSnapshot,
|
||||
@@ -426,6 +429,7 @@ mod tests {
|
||||
use axum::routing::any;
|
||||
use axum::{Json, Router};
|
||||
use http::StatusCode;
|
||||
use serde_json::{json, Value};
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user