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:
fawney19
2026-04-04 01:40:24 +08:00
parent 1d9c77522a
commit cbc811f6ce
484 changed files with 11046 additions and 3925 deletions

View File

@@ -1,5 +1,3 @@
use super::*;
mod body;
mod path;
mod transport;

View File

@@ -1,4 +1,4 @@
use super::*;
use serde_json::{Map, Value};
pub(crate) fn context_text(context: &Map<String, Value>, key: &str) -> Option<String> {
context

View File

@@ -1,4 +1,11 @@
use super::*;
use std::time::{SystemTime, UNIX_EPOCH};
use aether_data::repository::video_tasks::VideoTaskStatus as StoredVideoTaskStatus;
use uuid::Uuid;
use super::super::{
LocalVideoTaskRegistryMutation, LocalVideoTaskStatus, VideoTaskTruthSourceMode,
};
pub(crate) fn extract_openai_task_id_from_path(path: &str) -> Option<&str> {
let suffix = path.strip_prefix("/v1/videos/")?;

View File

@@ -1,4 +1,23 @@
use super::*;
use std::collections::BTreeMap;
use aether_contracts::ExecutionPlan;
use aether_data::repository::video_tasks::{
StoredVideoTask, VideoTaskStatus as StoredVideoTaskStatus,
};
use serde_json::{Map, Value};
use super::super::{
LocalVideoTaskFollowUpPlan, LocalVideoTaskPersistence, LocalVideoTaskStatus,
LocalVideoTaskTransport,
};
use crate::gateway::provider_transport::{
resolve_local_gemini_auth, resolve_local_standard_auth, resolve_transport_execution_timeouts,
supports_local_gemini_transport, supports_local_standard_transport,
GatewayProviderTransportSnapshot,
};
use crate::gateway::GatewayControlAuthContext;
use super::{context_text, non_empty_owned};
impl LocalVideoTaskTransport {
pub(crate) fn from_plan(plan: &ExecutionPlan) -> Option<Self> {

View File

@@ -1,5 +1,3 @@
use super::*;
mod gemini;
mod openai;
mod snapshot;

View File

@@ -1,4 +1,15 @@
use super::*;
use aether_contracts::{ExecutionPlan, RequestBody};
use aether_data::repository::video_tasks::UpsertVideoTask;
use serde_json::{json, Map, Value};
use crate::gateway::GatewayControlAuthContext;
use super::super::{
build_video_follow_up_report_context, current_unix_timestamp_secs, gemini_metadata_video_url,
request_body_string, request_body_u32, resolve_follow_up_auth, GeminiVideoTaskSeed,
LocalVideoTaskFollowUpPlan, LocalVideoTaskSnapshot, LocalVideoTaskStatus,
DEFAULT_VIDEO_TASK_MAX_POLL_COUNT, DEFAULT_VIDEO_TASK_POLL_INTERVAL_SECONDS,
};
impl GeminiVideoTaskSeed {
pub(crate) fn apply_provider_body(&mut self, provider_body: &Map<String, Value>) {

View File

@@ -1,5 +1,3 @@
use super::*;
mod client;
mod follow_up;
mod persist;

View File

@@ -1,4 +1,12 @@
use super::*;
use std::collections::BTreeMap;
use aether_contracts::{ExecutionPlan, RequestBody};
use serde_json::{json, Value};
use super::super::super::{
map_openai_task_status, parse_video_content_variant, LocalVideoTaskContentAction,
LocalVideoTaskStatus, OpenAiVideoTaskSeed,
};
impl OpenAiVideoTaskSeed {
pub(crate) fn build_content_stream_action(

View File

@@ -1,4 +1,12 @@
use super::*;
use aether_contracts::{ExecutionPlan, RequestBody};
use serde_json::Value;
use crate::gateway::GatewayControlAuthContext;
use super::super::super::{
build_video_follow_up_report_context, resolve_follow_up_auth, LocalVideoTaskFollowUpPlan,
LocalVideoTaskStatus, OpenAiVideoTaskSeed,
};
impl OpenAiVideoTaskSeed {
pub(crate) fn build_delete_follow_up_plan(

View File

@@ -1,4 +1,11 @@
use super::*;
use aether_data::repository::video_tasks::UpsertVideoTask;
use serde_json::json;
use super::super::super::{
current_unix_timestamp_secs, request_body_string, request_body_u32, LocalVideoTaskSnapshot,
LocalVideoTaskStatus, OpenAiVideoTaskSeed, DEFAULT_VIDEO_TASK_MAX_POLL_COUNT,
DEFAULT_VIDEO_TASK_POLL_INTERVAL_SECONDS,
};
impl OpenAiVideoTaskSeed {
pub(crate) fn to_upsert_record(&self) -> UpsertVideoTask {

View File

@@ -1,4 +1,6 @@
use super::*;
use serde_json::{Map, Value};
use super::super::super::{LocalVideoTaskStatus, OpenAiVideoTaskSeed};
impl OpenAiVideoTaskSeed {
pub(crate) fn apply_provider_body(&mut self, provider_body: &Map<String, Value>) {

View File

@@ -1,4 +1,13 @@
use super::*;
use aether_data::repository::video_tasks::{StoredVideoTask, UpsertVideoTask};
use serde_json::{json, Map, Value};
use crate::gateway::provider_transport::GatewayProviderTransportSnapshot;
use super::super::{
local_status_from_stored, non_empty_owned, request_body_string, GeminiVideoTaskSeed,
LocalVideoTaskPersistence, LocalVideoTaskReadResponse, LocalVideoTaskSnapshot,
LocalVideoTaskStatus, LocalVideoTaskTransport, OpenAiVideoTaskSeed,
};
impl LocalVideoTaskSnapshot {
pub(crate) fn to_upsert_record(&self) -> UpsertVideoTask {

View File

@@ -1,4 +1,14 @@
use super::*;
use aether_contracts::ExecutionPlan;
use serde_json::{json, Map, Value};
use uuid::Uuid;
use super::super::{
context_text, context_u64, current_unix_timestamp_secs, generate_local_short_id,
request_body_text, GeminiVideoTaskSeed, LocalVideoTaskPersistence, LocalVideoTaskSeed,
LocalVideoTaskSnapshot, LocalVideoTaskStatus, LocalVideoTaskSuccessPlan,
LocalVideoTaskTransport, OpenAiVideoTaskSeed, VideoTaskSyncReportMode,
VideoTaskTruthSourceMode,
};
impl LocalVideoTaskSeed {
pub(crate) fn from_sync_finalize(

View File

@@ -1,4 +1,8 @@
use super::*;
use std::path::PathBuf;
use std::sync::Arc;
use super::store::{FileVideoTaskStore, InMemoryVideoTaskStore, VideoTaskStore};
use super::VideoTaskTruthSourceMode;
mod follow_up;
mod lifecycle;

View File

@@ -1,4 +1,13 @@
use super::*;
use serde_json::Value;
use super::super::{
extract_gemini_short_id_from_cancel_path, extract_openai_task_id_from_cancel_path,
extract_openai_task_id_from_path, extract_openai_task_id_from_remix_path,
LocalVideoTaskFollowUpPlan,
};
use crate::gateway::GatewayControlAuthContext;
use super::VideoTaskService;
impl VideoTaskService {
pub(crate) fn prepare_follow_up_sync_plan(

View File

@@ -1,4 +1,11 @@
use super::*;
use aether_contracts::ExecutionPlan;
use aether_data::repository::video_tasks::StoredVideoTask;
use serde_json::{Map, Value};
use super::super::{
resolve_local_video_registry_mutation, LocalVideoTaskSnapshot, LocalVideoTaskSuccessPlan,
};
use super::VideoTaskService;
impl VideoTaskService {
pub(crate) fn prepare_sync_success(

View File

@@ -1,4 +1,10 @@
use super::*;
use super::super::{
extract_gemini_short_id_from_path, extract_openai_task_id_from_content_path,
extract_openai_task_id_from_path, LocalVideoTaskContentAction, LocalVideoTaskReadResponse,
LocalVideoTaskSnapshot, VideoTaskTruthSourceMode,
};
use super::VideoTaskService;
impl VideoTaskService {
pub(crate) fn read_response(

View File

@@ -1,4 +1,13 @@
use super::*;
use aether_data::repository::video_tasks::StoredVideoTask;
use serde_json::{Map, Value};
use super::super::{
extract_gemini_short_id_from_path, extract_openai_task_id_from_path,
LocalVideoTaskProjectionTarget, LocalVideoTaskReadRefreshPlan, LocalVideoTaskSnapshot,
VideoTaskTruthSourceMode,
};
use super::VideoTaskService;
impl VideoTaskService {
pub(crate) fn snapshot_for_refresh_plan(

View File

@@ -1,4 +1,9 @@
use super::*;
use serde_json::{Map, Value};
use super::{
GeminiVideoTaskSeed, LocalVideoTaskReadResponse, LocalVideoTaskRegistryMutation,
LocalVideoTaskSnapshot, OpenAiVideoTaskSeed,
};
mod backend;
mod registry;

View File

@@ -1,4 +1,14 @@
use super::*;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use serde_json::{Map, Value};
use super::super::{
GeminiVideoTaskSeed, LocalVideoTaskReadResponse, LocalVideoTaskRegistryMutation,
LocalVideoTaskSnapshot, OpenAiVideoTaskSeed,
};
use super::{VideoTaskRegistry, VideoTaskStore};
#[derive(Debug, Default)]
pub(crate) struct InMemoryVideoTaskStore {

View File

@@ -1,4 +1,12 @@
use super::*;
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use super::super::{
GeminiVideoTaskSeed, LocalVideoTaskReadResponse, LocalVideoTaskRegistryMutation,
LocalVideoTaskSnapshot, LocalVideoTaskStatus, OpenAiVideoTaskSeed,
};
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub(super) struct VideoTaskRegistry {

View File

@@ -1,4 +1,15 @@
use super::*;
use std::collections::BTreeMap;
use aether_contracts::{ExecutionPlan, ExecutionTimeouts, ProxySnapshot, RequestBody};
use serde_json::{json, Map, Value};
use uuid::Uuid;
use super::{
GatewayControlAuthContext, GeminiVideoTaskSeed, LocalVideoTaskContentAction,
LocalVideoTaskPersistence, LocalVideoTaskSeed, LocalVideoTaskSnapshot, LocalVideoTaskStatus,
LocalVideoTaskTransport, OpenAiVideoTaskSeed, VideoTaskService, VideoTaskSyncReportMode,
VideoTaskTruthSourceMode,
};
mod fixtures;
mod plans;

View File

@@ -1,4 +1,11 @@
use super::*;
use std::collections::BTreeMap;
use serde_json::json;
use super::{
ExecutionPlan, ExecutionTimeouts, GatewayControlAuthContext, LocalVideoTaskPersistence,
LocalVideoTaskTransport, ProxySnapshot, RequestBody,
};
pub(super) fn sample_transport(
base_url: &str,

View File

@@ -1,5 +1,11 @@
use super::fixtures::*;
use super::*;
use serde_json::{json, Value};
use uuid::Uuid;
use super::{
GeminiVideoTaskSeed, LocalVideoTaskSnapshot, LocalVideoTaskStatus, OpenAiVideoTaskSeed,
VideoTaskService, VideoTaskTruthSourceMode,
};
#[test]
fn rust_authoritative_service_builds_openai_cancel_follow_up_plan() {

View File

@@ -1,5 +1,10 @@
use super::fixtures::*;
use super::*;
use serde_json::{json, Value};
use super::{
GeminiVideoTaskSeed, LocalVideoTaskContentAction, LocalVideoTaskSnapshot, LocalVideoTaskStatus,
OpenAiVideoTaskSeed, VideoTaskService, VideoTaskTruthSourceMode,
};
#[test]
fn rust_authoritative_service_projects_openai_status_into_local_read_response() {

View File

@@ -1,5 +1,10 @@
use super::fixtures::*;
use super::*;
use serde_json::{json, Map, Value};
use super::{
GeminiVideoTaskSeed, LocalVideoTaskSeed, LocalVideoTaskSnapshot, LocalVideoTaskStatus,
OpenAiVideoTaskSeed, VideoTaskService, VideoTaskSyncReportMode, VideoTaskTruthSourceMode,
};
#[test]
fn openai_video_seed_preserves_existing_local_identity() {

View File

@@ -1,4 +1,8 @@
use super::*;
use std::collections::BTreeMap;
use aether_contracts::{ExecutionPlan, ExecutionTimeouts, ProxySnapshot};
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum VideoTaskSyncReportMode {