Repository navigation
feat(trae-cn): add experimental manual ACP adapter #8339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
AaronZ345
wants to merge
68
commits into
lidge-jun:dev
Choose a base branch
from
AaronZ345:feat/trae-cn-acp-provider
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
1e3a5d6
feat(trae-cn): add official ACP provider
1c9f8f2
fix(trae-cn): address ACP lifecycle and catalog review
invalid-email-address bb24343
fix(trae-cn): enforce transport capabilities and refresh catalogs
invalid-email-address 2a9b9aa
fix(trae-cn): close cancellation and discovery edge cases
invalid-email-address 649d7dd
fix(trae-cn): redact protocol failures and preserve CLI sign-in
invalid-email-address 62e9e33
fix(trae-cn): bound streaming and supervise process cleanup
invalid-email-address ecfca0c
fix(trae-cn): retain job ownership and safe diagnostics
invalid-email-address fe468ee
fix(trae-cn): resolve Windows hosts and retain failed-turn usage
invalid-email-address 88c5439
fix(trae-cn): prevent prompt replay and preserve ACP stops
invalid-email-address 1ccbcdb
fix(trae-cn): reconcile ACP state and launcher discovery
invalid-email-address bdc1065
docs(trae-cn): split setup guide to preserve line budget
invalid-email-address 6132c32
fix(trae-cn): report Windows forwarding failures
invalid-email-address cb4aaac
test(trae-cn): cover live discovery and dispatch boundaries
invalid-email-address 5047d60
Merge dev and reconcile TRAE CN provider integration
e346339
Merge dev and retain TRAE probe rosters during publication
d23e826
docs(trae-cn): qualify observed model discovery and account scope
094a7d5
fix(trae-cn): preserve local spend-ledger storage refusals
9f318bb
docs(trae-cn): describe local spend-ledger storage refusals
2dd6fa0
fix(trae-cn): retain terminal usage across cleanup cancellation
9a0e1e4
fix(trae-cn): keep provider reference inert and commit regressions
747333e
fix(trae-cn): isolate discovery and preserve replay chronology
685c347
docs(trae-cn): document cache accounting and supervisor frames
109e1b7
fix(trae-cn): reject instruction images and retain cancelled RPC usage
a203033
feat(trae-cn): preserve instruction media before projection
3609407
fix(trae-cn): guard projected media and preserve safe fallback
7f998d3
test(trae-cn): cover policy media retention
e574f7f
fix(trae-cn): preserve Chat instruction media across policy retries
bc81243
Merge remote-tracking branch 'origin/dev' into feat/trae-cn-acp-provider
invalid-email-address f657e5d
fix(trae-cn): preserve media and settings on policy retries
12bd6c9
fix(trae-cn): bound image caption admission
e1e5059
fix(trae-cn): keep instruction audio in user content
28e74d4
fix(trae-cn): reuse OpenAI vision credentials
e58e6d9
fix(trae-cn): keep single-leading attachments in user content
2906881
fix: address TRAE review follow-ups
b95efea
test: cover TRAE review regressions
d285dee
fix: retain discovered TRAE roster under pressure
9de51c0
test: cover TRAE roster pressure publication
515d14a
fix: revalidate TRAE roster revisions before pinning
e88fd22
test: cover concurrent TRAE roster refresh
0c864ca
fix: preserve combo media and TRAE roster pins
127b45a
test: cover combo media and multi-roster pressure
6ef68f0
fix: close combo media and roster cleanup gaps
71b104a
test: cover native combo media and pin cleanup
47b67bc
fix: reject stale TRAE rosters before pinning
11d35e6
test: cover pre-pin TRAE roster replacement
2279135
fix: serialize TRAE discovery and retain refusal usage
c1f1a82
test: cover discovery order and refusal usage
cdceb1a
fix: bind discovery authority and refusal usage
c04e71b
test: cover queued authority and malformed usage
150b558
fix: surface trailing TRAE reader failures
2de2bdd
test: cover queued authority and trailing failures
0e61e1f
fix: preserve usage through ACP EOF wrapping
2ad779e
test: cover usage-bearing ACP EOF
4b91820
fix: retain prompt usage across cleanup errors
e286e74
test: cover reader failure cleanup timeout
5e3e9a5
fix: preserve primary TRAE failures through cleanup
7581f2d
test: cover cancellation and cleanup precedence
f985628
fix: bind buffered combo error usage
58bf3fd
test: cover buffered combo error usage
f8bc598
fix: preserve policy snapshots and media carriers
6755882
test: cover policy snapshots and rich carriers
9d6649f
fix: drain buffered TRAE replies before refusal
4df0db0
test: cover tool-before-reply usage
d3c2945
fix: preserve TRAE cache age and batch usage
fc7cbd8
test: cover cache age and malformed batch order
9711eae
fix: let combos bypass unavailable TRAE models
6c51573
test: cover TRAE fallback and media owners
6eb4368
Merge dev (aa30ea9d) into feat/trae-cn-acp-provider
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| title: TRAE CN (ACP) | ||
| description: Connect OpenCodex to the signed-in official TRAE CN CLI. | ||
| --- | ||
|
|
||
| The experimental `trae-cn` adapter can be configured manually through `custom`. Its directory | ||
| entry is reference-only; canonical promotion awaits a maintenance owner, vendor discovery and | ||
| forwarding evidence, and security review. It uses the signed-in official CLI through `traecli acp serve`. | ||
| OpenCodex does not read desktop tokens, private IDE endpoints, or Ferry. | ||
| Non-text parts in system or developer instructions are refused before CLI startup, including images, videos, audio and file references in Responses, Chat and combo requests. | ||
| File and audio references in native agent messages are refused too. A routing policy or combo may choose another eligible provider after a pre-dispatch refusal; an already dispatched TRAE prompt is never replayed for fallback. | ||
|
|
||
| ```json | ||
| { | ||
| "providers": { | ||
| "trae-cn": { | ||
| "adapter": "trae-cn", | ||
| "baseUrl": "https://www.trae.cn", | ||
| "keyOptional": true | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| - **Prerequisites:** Install and sign in to [TRAE CN](https://www.trae.cn/) and its official CLI | ||
| on the host running the OpenCodex proxy. A remote dashboard uses that host's CLI session. | ||
| The CLI owns authentication and token refresh; the provider needs no API key. | ||
| OpenCodex preserves the default `~/.trae` CLI directory while isolating HOME. Set `TRAE_HOME` | ||
| before starting OpenCodex to select a different signed-in CLI directory. | ||
| - **Model discovery:** The tested signed-in CLI returned model IDs through `session/new` → | ||
| `models.availableModels[].modelId`. This is observed CLI behavior. The [vendor ACP documentation](https://docs.trae.cn/cli_agent-client-protocol) | ||
| does not document these discovery fields or guarantee their account scope. | ||
| Successful discovery is cached by the normal provider catalog mechanism, with the last good | ||
| catalog and explicitly configured models as degraded fallbacks. | ||
| Read-only catalog gathers and management admission use cached evidence; they never start the CLI or refresh its sign-in. | ||
| The automatic refresh worker prepares CLI evidence before its next catalog convergence, so a slow CLI does not delay unrelated management responses. | ||
| Set `liveModels: false` for a static allowlist; **Test connection** then returns not applicable. | ||
| After switching CLI accounts, enable live discovery and run **Test connection**. It | ||
| replaces the roster and refreshes Codex and connected clients. It reports pending or failed | ||
| publication separately; restart running Codex sessions after publication. | ||
| The probed roster stays available while publishing under memory pressure. If it cannot fit | ||
| the memory budget, the probe reports pending retention; retry after active requests finish. | ||
| A probe overtaken before updating the model cache asks you to retry. Disk-only edits require | ||
| reloading provider configuration and testing again. | ||
| - **Transport:** Each turn opens a fresh ACP session for the selected model and streams text and reasoning. | ||
| Conversation history is replayed as labelled text. The limit is 1,000,000 UTF-16 code units | ||
| (JavaScript string length); an emoji may use two units. Oversized replay is rejected. | ||
| - **Capability boundary:** This initial provider supports text conversations only. It rejects | ||
| client tools, tool replay, images, audio, video and attached documents. Model capability overrides | ||
| cannot enable native image input or verbosity. Images require the vision sidecar to describe them first. | ||
| Permission requests fail with `trae_client_request_unsupported`; internal tool notifications fail | ||
| with `trae_tool_call_unsupported`. An empty `end_turn` fails with `trae_empty_response`; `max_tokens` without text stays incomplete. | ||
| These completions and refusals retain usage. OpenCodex does not replay a dispatched TRAE prompt on another provider. | ||
| Client cancellation emits no provider error and preserves already-received usage for accounting. | ||
| Cancellation initiated by the CLI returns an incomplete turn. | ||
| Unsafe local spend-ledger files produce the shared `spend_ledger_storage_unavailable`/503 | ||
| diagnostic; follow its local-storage recovery instructions before retrying. | ||
| Requests with an output-token limit fail with `unsupported_max_output_tokens` because this | ||
| adapter has no verified ACP field for that limit. ACP `max_turn_requests` returns an incomplete turn with that reason. | ||
| - **CLI process:** The CLI uses an empty temporary workspace, no session MCP/skills and a finite tool denylist. | ||
| Shutdown targets the owned POSIX process group or Windows Job Object (Windows 10+, PowerShell 5.1). POSIX descendants | ||
| that detach into another group can survive; this mechanism does not contain untrusted hooks or tools. | ||
| Use a trusted CLI and configuration: its hooks and unlisted tools are outside OpenCodex's | ||
| client-capability controls. Temporary directories and tool denial do not provide an OS sandbox. | ||
| - **Destination:** `https://www.trae.cn` identifies this provider; OpenCodex does not call it | ||
| directly. A custom destination is refused. This row is separate from TRAE International and | ||
| from a custom OpenAI-compatible provider named `trae`. | ||
| - **Network routing:** The official CLI owns its network route. Provider `proxy` and `noProxy` | ||
| overrides, including `direct` and `null`, are rejected before CLI startup. OpenCodex does not | ||
| change system proxy settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.