feat(compaction): support SubAPI native remote compaction

- support sub-api/openai-responses through the public Responses endpoint
- preserve explicit Authorization and support header-only authentication
- retain Codex JWT requirements and native compaction failure fallback
- restore SubAPI checkpoints and preserve portable model-switching summaries
- add provider, authentication and checkpoint lifecycle regression tests
- document compatibility requirements and the Sub2API protocol reference
This commit is contained in:
云服务部-叶林立
2026-09-07 16:25:48 +08:00
parent 6e7effa792
commit ff1e7400da
9 changed files with 431 additions and 12 deletions
+8
View File
@@ -21,3 +21,11 @@ This package is maintained directly in `my-pi` and combines two separately licen
- License: `LICENSES/pi-codex-compaction-MIT.txt`
No npm tarball, npm cache, `node_modules`, build output, or nested Git metadata is used as an import source.
## Sub2API protocol reference
- Official repository: https://github.com/Wei-Shaw/sub2api
- Reference commit: `ab99d56e9626e6cd731592dae8553c9758a0efa2`
- Protocol evidence: `backend/internal/service/openai_compact_body_signal.go` identifies native remote compaction v2 as Responses plus `stream: true` and `compaction_trigger`, and handles the Codex beta feature.
- The local `src/native-provider.ts` adapter is independently implemented against that protocol. No Sub2API source was imported; the existing Codex serializer, stream parser and checkpoint format are reused.
- This reference describes upstream capability, not a guarantee about any particular deployment, model or account. The separate Responses compact endpoint is not used by this adapter.