refactor: 拆分 gateway 单体为独立 crate,新增 systemd 部署方案

将 gateway 内部的 model-fetch、provider-transport、scheduler-core、
usage-runtime、video-tasks-core 模块提取为独立 crate;重构 gateway
内部模块结构(state/router/cache/data/query 等);移除大量遗留模块
文件;新增 systemd 二进制部署骨架及相关文档;更新前端 usage 相关
API 和组件。
This commit is contained in:
fawney19
2026-04-05 20:23:16 +08:00
parent cbc811f6ce
commit 763ff03a7b
777 changed files with 42654 additions and 21464 deletions
@@ -64,13 +64,13 @@ enum FrameParseError {
Invalid(String),
}
#[path = "kiro_stream/stream/decoder.rs"]
#[path = "stream/decoder.rs"]
mod decoder;
#[path = "kiro_stream/stream/state.rs"]
#[path = "stream/state.rs"]
mod state;
#[path = "kiro_stream/stream/util.rs"]
#[path = "stream/util.rs"]
mod util;
#[cfg(test)]
#[path = "kiro_stream/stream/tests.rs"]
#[path = "stream/tests.rs"]
mod tests;
@@ -1,7 +1,7 @@
use serde_json::{json, Value};
use uuid::Uuid;
use crate::gateway::GatewayError;
use crate::GatewayError;
use super::util::{
encode_events, estimate_tokens, find_real_thinking_end_tag,
@@ -1,6 +1,6 @@
use serde_json::Value;
use crate::gateway::GatewayError;
use crate::GatewayError;
use super::QUOTE_CHARS;
@@ -1,8 +1,8 @@
pub(crate) mod kiro_stream;
pub(crate) mod kiro;
pub(crate) mod private_envelope;
pub(crate) mod surfaces;
pub(crate) use kiro_stream::KiroToClaudeCliStreamState;
pub(crate) use kiro::KiroToClaudeCliStreamState;
pub(crate) use private_envelope::{
maybe_build_provider_private_stream_normalizer,
maybe_normalize_provider_private_sync_report_payload,
@@ -3,13 +3,15 @@ use std::collections::BTreeMap;
use base64::Engine as _;
use serde_json::Value;
use crate::gateway::ai_pipeline::adaptation::surfaces::{
use crate::ai_pipeline::adaptation::surfaces::{
provider_adaptation_allows_sync_finalize_envelope, provider_adaptation_descriptor_for_envelope,
provider_adaptation_should_unwrap_stream_envelope, ANTIGRAVITY_V1INTERNAL_ENVELOPE_NAME,
GEMINI_CLI_V1INTERNAL_ENVELOPE_NAME,
};
use crate::gateway::ai_pipeline::runtime::{KiroToClaudeCliStreamState, KIRO_ENVELOPE_NAME};
use crate::gateway::{GatewayError, GatewaySyncReportRequest};
use crate::ai_pipeline::runtime::adapters::kiro::{
KiroToClaudeCliStreamState, KIRO_ENVELOPE_NAME,
};
use crate::{usage::GatewaySyncReportRequest, GatewayError};
enum ProviderPrivateStreamNormalizeMode {
EnvelopeUnwrap,
@@ -1,4 +1,4 @@
use crate::gateway::ai_pipeline::runtime::adapters::{
use crate::ai_pipeline::runtime::adapters::{
antigravity::ANTIGRAVITY_PROVIDER_TYPE,
kiro::{KIRO_ENVELOPE_NAME, PROVIDER_TYPE as KIRO_PROVIDER_TYPE},
};
@@ -140,12 +140,10 @@ pub(crate) fn provider_adaptation_should_unwrap_stream_envelope(
#[cfg(test)]
mod tests {
use super::{
provider_adaptation_allows_sync_finalize_envelope,
provider_adaptation_anchor_api_format,
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,
provider_adaptation_should_unwrap_stream_envelope, ANTIGRAVITY_V1INTERNAL_ENVELOPE_NAME,
GEMINI_CLI_V1INTERNAL_ENVELOPE_NAME, KIRO_ENVELOPE_NAME,
};
#[test]