Files
plugins/packages
如是 228628689f Add Trae Global (trae.ai) plugin - trae-global provider (#22)
* Add Trae Global (trae.ai) plugin — trae-global provider

Trae international (trae.ai, ByteDance's AI IDE international build) as a
provider plugin: sign in with Trae's own browser flow, free tier included,
models served through the international llm_utils_chat gateway.

Same plugin contract and request/response machinery as the Trae CN
plugin (packages/trae), a separate deployment: different domains, OAuth
client, model catalog, plus a US region (coreva) routed by the account's
AIRegion. The usage card reads the dollar billing's entitlements
(basic+bonus allowance) from the pay host, with the Free plan's /month
allowance riding it.

bun test: 41 pass; bun scripts/check.mjs trae-global: ok

* trae-global: a stream the agent walks away from closes Trae's connection

The bug: an answer whose tool call the agent acts on is cancelled mid-read,
and the read to Trae was left hanging. A generator's return cannot break a
read that is already waiting on reader.read(), so the SSE reader kept its
half of the connection open, and the host the next ask reused was one Trae
had dropped — a stream that runs, then dies, exactly around tool calls.

The fix: the answer's fetch is what gets stopped. The loader builds one
AbortController per request, follows the caller's abort signal into it, and
openai() aborts it when the stream is cancelled. sse() also lets its reader
go in a finally, for the paths that end the generator rather than the fetch.

stream.test.mjs: the agent reads, then cancels with nothing more coming, so
only aborting Trae's fetch can release the read — red before, green after.
bun test (42 pass); bun scripts/check.mjs trae-global: ok

* trae-global: the review's three blockers — planLocked, the 0.1.15 Max, usage's error code

planLocked is gone. It read display_contact_config's identity_list and
assumed every account is Free (identity 0), so a paying account lost
exactly the models it pays for — gpt-5.5, the gpt-5.6 family, gpt-6,
glm-5.2 — and could never pick them. The plugin is never told the
account's own identity (not at sign-in, not in the entitlement answer),
so nothing is filtered on identity now: the list is the account's own,
the IDE greys out what the plan locks, and a locked model answers Trae's
own 1005 when asked. The picker's invisible entries (paygo/auto twins,
search agents) stay out, as before.

maxModel takes the 0.1.15 fix: a model's Max is found across every list
that names it, not just the one entry the model is listed through —
chat_v3 can name the __max model while the SOLO list names only __dev,
and the window can be another entry's again. Without it the same
"no -max model" bug the CN plugin fixed in 0.1.15 comes back here.
maxes holds each model's Max for the models hook, as CN's does.

usage: a 200 carrying an error code (e.code !== "0") now says Trae's own
message instead of "no entitlement pack in the answer", as CN's does.

README: the verification range is stated honestly — one Free account,
SG realm, no Pro and no US account tried; paid-account behaviour is
implemented from the interface's shape, not confirmed on a live one.
registry.json marks Trae Global experimental, as Trae CN is.

usage.test.mjs: the locked-model test now asserts the paying account's
list, and a new one asks a paid account's gpt-5.5 through the gateway.
stream.test.mjs: a Max split across lists is listed and asked where its
__max model is named. Each red before its fix, green after.
bun test (46 pass); bun scripts/check.mjs trae-global: ok
2026-10-05 16:10:35 +08:00
..
commandcode 0.1.8: a model of the plan takes pictures as its maker's models do, not none of them (ARNO on magpie 0.1.810, Discord: command code provider 的所有模型都没有自动勾上支持图片输入) — Command Code's /provider/v1/models gives no modalities (all 86 entries, testdata/models.json and the live list read from a moved account's plugin-providers.json alike), and runtimeModel always set capabilities.input.image to !!m.images, false for every model, which magpie's plugin host reads as the plugin's answer (host.js: imageSaid when the value is a boolean) and takes over models.dev's. So every model of a moved plan, Claude, GPT-6, Kimi K3 and Qwen 3.8 included, showed no image input, where the built-in (whose list said nothing either) answered from models.dev (catalog.SeesImages). runtimeModel now says image only when m.images is a boolean; liveModels takes the list's modalities when it gives them, else the default list's answer (which now marks Claude Sonnet 5, Opus 5.5, GPT-6 Sol, Kimi K3 and MiniMax M3, as models.dev has them; DeepSeek V4 and GLM-5.3 read text alone and say nothing), else the CLI's table's (GO_MODELS, Pixel Canary among them), else true for a Claude model, and of any other says nothing, so magpie answers from models.dev as the built-in did (DeepSeek V4, GLM-5.x, MiniMax M2.x, Hy4 and the rest models.dev calls text-only stay without). A list that gives modalities is taken at its word, an explicit text-only included (the old || undefined dropped it). Go's goModels is unchanged but no longer says false for a model the table doesn't mark. models.test.mjs gains a test (a Pro account's 86 models: known image models say true, the rest leave image unsaid, a list's own modalities win, Go keeps the table's); it fails on 0.1.7 and passes. HOME=$(mktemp -d) bun test (459 pass) and bun scripts/check.mjs commandcode pass. Not tried in a real OpenCode/magpie session with the new version; magpie needs the mover's min raised to 0.1.8 for moved users to get it.
2026-10-04 12:04:57 +08:00
kiro 0.1.7: a Builder ID sign-in is asked with Builder ID's service profile, so its models are listed and served, as the built-in (#16, YuanZhe-99: a Kiro Student account moved to the plugin was offered no claude-opus-5.5 or claude-sonnet-5.5, which the built-in listed) — a Builder ID sign-in (kiro-cli's, the Kiro IDE's or one made here) names no profile, and Kiro won't list one for it: List-Available-Profiles answers 403 "AWS Builder ID is not supported for this operation" in both regions, so profileOf threw, provider.models fell back to Auto alone, and usage and chat failed. magpie's built-in has asked such a sign-in with the service profile kiro-cli and the IDE use (arn:aws:codewhisperer:us-east-1:638616132270:profile/AAAACCCCXXXX) since magpie 40102f74 (yetone/magpie#422); the plugin now does as it does: kiro-cli's odic sign-in with Builder ID's start URL or none, the IDE's with provider BuilderId, and one signed in here (or moved from the built-in) with loginProvider BuilderId take it without asking, and an AWS sign-in whose profile listing is that 403 takes it too. Identity Center sign-ins still have their profile listed. builderid.test.mjs (fake management and runtime API: one signed in here lists claude-opus-5.5 and chats under the service profile, the 403 found, Identity Center unchanged, kiro-cli's with and without a start URL, the IDE's) fails 4 of 5 on 0.1.6 and passes; bun test (28 pass) and bun scripts/check.mjs kiro pass under a temp HOME. Checked for real with a Google sign-in (profile listed, models listed, claude-sonnet-4.5 answers): unchanged. Not tried with a real Builder ID or Kiro Student account (none here).
2026-10-04 12:04:57 +08:00
qoder 0.2.6: the window a request is sent holds the reply's max_tokens too (yetone/magpie#700 follow-up, kyzhouxu: a group's DeepSeek V4.1 Flash refused near 207K until Qoder's DeepSeek-Flash was taken out of it) — since 0.2.5 windowFor sends the model's default window (200K on the models context_config lists 200K/400K/1M for) while the request's estimate, a token per 3 bytes of its messages and tools, fits it, and asked for nothing of the reply: a 180K conversation with the 32000 max_tokens Qoder is sent went out with context_length 200000, which a prompt plus reply past 200K overflows, while magpie and the agents behind it are told the model takes 1M. The estimate now adds the reply's max_tokens (what qoderBody sends), so that request is sent 400K; a short one still gets the default window. Qoder's own metadata does say 1M for dfmodel: its live listing's max_input_tokens was 1000000 (the context 0.2.4 cached for it in a sandbox magpie on 2026-10-03, where MiniMax-M3 read 180000) and 0.2.5 reads 1M as its largest window, and docs.qoder.com/cli/model lists DeepSeek-V4-Flash with 200K / 400K / 1M, so the reported context stays 1M. When kyzhouxu's refusal happened isn't known: #700 itself (ynky007) was opened before 0.2.5, when every request was sent context_length 1000000, and their comment came after it (2026-10-04 03:34 UTC), so this is the way 0.2.5 can refuse a request under the window magpie reports, not shown to be what they hit. context.test.mjs gains the case (180K prompt: 200K with max_tokens 1000, 400K with 32000 and with none asked); it fails on 0.2.5 (200000) and passes; bun test (49 pass) and bun scripts/check.mjs qoder under a temp HOME pass. Not tried with a real Qoder account.
2026-10-04 12:00:17 +08:00