Refactor proxy-core surfaces and transformer boundaries (#163)

* refactor: add canonical request contracts

* test: harden transformer boundary contracts

* refactor: adapt protocol transformers to canonical contract

* refactor: add cli profile registry

* refactor: extract provider profiles

* refactor: add conductor and provider executors

* refactor: add models surface

* refactor: migrate responses surface

* refactor: migrate chat surface

* refactor: migrate gemini surface

* refactor: migrate file surfaces

* test: align runtime executor undici mock

* fix: preserve compact SSE closeout payloads

* feat: support all-api-hub v2 backup imports

* fix: aggregate codex oauth SSE final payloads

* fix: harden responses SSE failure handling
This commit is contained in:
Cita
2026-03-19 16:07:56 +08:00
committed by GitHub
parent c0c993f448
commit 24483c28eb
75 changed files with 8333 additions and 3574 deletions
@@ -1,5 +1,5 @@
import type { Response as UndiciResponse } from 'undici';
import type { DownstreamFormat } from './normalized.js';
import type { EndpointAttemptContext, EndpointRecoverResult } from '../../routes/proxy/endpointFlow.js';
import {
buildMinimalJsonHeadersForCompatibility,
isEndpointDispatchDeniedError,
@@ -13,6 +13,18 @@ import {
shouldRetryNormalizedMessagesBody,
} from '../anthropic/messages/compatibility.js';
type EndpointAttemptContext = {
request: CompatibilityRequest;
targetUrl: string;
response: UndiciResponse;
rawErrText: string;
};
type EndpointRecoverResult = {
upstream: UndiciResponse;
upstreamPath: string;
} | null;
type CompatibilityRequest = {
endpoint: CompatibilityEndpoint;
path: string;