Commit Graph
10 Commits
Author SHA1 Message Date
hspnick 8e479f1171 trae 0.2.20: every chat function's roster is read, and a model's levels are kept (#300)
Every chat function's roster is read, so each model's reasoning levels come from Trae's own config, and a model keeps its levels in magpie and in plain OpenCode (#300, sphuang1030-prog).

- A model in the fallback table keeps the levels its entry names, even though the host hands every model `variants: {}`.
- A variant's value is OpenCode's name (low/high/xhigh); effortOf takes either spelling and sends Trae's (light/high/extra_high), and nothing for a level the model doesn't name.
- The token-keyed record check that never fired is gone; the host's strict refresh reads the list again after a re-sign-in.

Reviewed at 4b968adb: bun test in packages/trae (temp HOME/TMPDIR) 203 pass / 0 fail on bun 1.4.2; bun scripts/check.mjs exit 0. The three new tests go red on the previous head 41904d9. Probes through the loader's fetch: low→light, high→high, xhigh→extra_high; medium/__proto__ send nothing; glm-5.2 fallback gives high, xhigh (was []). merge-tree against main clean; npm latest trae 0.2.19.
Not tried: a real Trae account; OpenCode's own source (whether it fills default variants first).
2026-10-23 09:57:37 +08:00
tearsleeand李 3e6a8d0e03 trae: a model keeps the name its lists agree on (#62)
Trae's usage page books a request under the name of the list it was served
through, and its lists name a model differently: chat_v3 calls
deepseek-v4.1-flash "DeepSeek-V4-Flash 正式版", where the SOLO lists call it
"DeepSeek-V4.1-Flash" (yetone/magpie#681). On 2026-10-09 Trae renamed its
official entries — DeepSeek-V4-Flash-Official is "DeepSeek-V4-Flash" now —
which left chat_v3 the only list still calling deepseek-v4.1-flash by
another's name, so the collision the misnamed test leans on no longer
matches and chat_v3's entry won on list order alone: the page then showed
"DeepSeek-V4-Flash 正式版" for every request, where Trae's own client, served
through a SOLO list, shows "DeepSeek-V4.1-Flash".

A model's name is now the one most of its lists give it — the name Trae's
own client is served under — and the entry carrying it is preferred for the
model's window, reply limit and serving function, as is the Max entry asked
for it. deepseek-v4.1-flash goes back to "DeepSeek-V4.1-Flash", a 200K
window and a 32K reply limit (was 116K/16K from chat_v3's entry), asked
through the SOLO list that names its __dev/__max models.

Co-authored-by: 李 <oncwnuKMG1gRkPtw27nJROKWWRUM@git.weixin.qq.com>
2026-10-09 22:32:20 +08:00
yetone 4c4e91689e trae 0.1.14: GLM's own <arg_key>/<arg_value> calls are calls, answer text under unnamed events isn't lost, reasoning written into the text isn't the answer, a failed reply doesn't say stop, and a model's Max context is a model of its own (歧路亡羊 on magpie's Discord) — GLM wrote <tool_call>read<arg_key>path</arg_key><arg_value>a</arg_value></tool_call>, its own template, which wasn't read: the call went to the agent as text. It is now a call (a string argument as written, other types read as JSON, split over events or not), as is a native call whose name holds the whole call (as JSON or in that template). A call to a requested tool named but for case or punctuation (Read) goes on as the request's (read); any other name goes on as written, so the agent can tell the model it doesn't exist. Text under an event named delta, message, content… or none was skipped; it is the answer's now. A {"reasoning_content":"…"} object in the text is reasoning, and reasoning Trae sends again is sent once. done's finish_reason length/max_tokens is length; a reply that fails (an error event, or Trae's stream breaking off) ends with the error and [DONE], not a stop and its usage, and the stream is closed whatever happens (an agent going away stops the read). A config with a __max model and a bigger context_window_tokens.max (deepseek-v4.1-flash: 1M, 64K–128K out) is listed again as <id>-max, "… (Max)", with that window and output; it asks the config's __max model with max_tokens set and user_message_context.model_info.prompt_max_tokens = window − max_tokens. Reasoning effort: Trae's request takes no level, so no variants are listed (as before) and the README says a picked level does nothing. 9 new tests fail on 0.1.13; bun test (46 pass) and bun scripts/check.mjs trae pass. Not tried with a real Trae CN account (none here). 2026-10-05 11:41:17 +08:00
yetone c172d93901 trae 0.1.12: a reply limit Trae doesn't give is none, not a made-up 32K, and a request asking more than Trae's is held to it (ARNO on magpie's Discord: Trae CN's deepseek-v4.1-flash said maxTokens 32000) — a model whose list names no __dev max_tokens (deepseek-v4.1-flash in chat_v3, kimi-k2.6, the fallback list's) was given MODEL's 32_000, which agents were told as its reply limit. It is now 0, which magpie reads as unknown and fills from models.dev (DeepSeek V4.1 Flash's 384K); one Trae gives (glm-5.2__dev's 32000, deepseek-v4.1-flash__dev's 64000 in solo_agent) is kept, and a request asking more than it is sent with Trae's. The new test fails on 0.1.11; bun test (35 pass) and bun scripts/check.mjs trae under a temp HOME pass. Not tried with a real Trae CN account (none here). 2026-10-05 04:29:12 +08:00
yetone 2caced14ef trae 0.1.6: the usage card says Trae CN's credits in the Credits row, as WorkBuddy's, not as an English balance line under it (yetone/magpie#694, Hu9956 on magpie 0.1.784: 积分显示的样式有点不一样 — WorkBuddy's cards read "积分 1,689.01 / 2,400 积分 · 剩余 70.4%", Trae CN's "积分 剩余 60.7%" with "余额 2307.42 of 3800 credits left" in large type below) — usage gave the share alone on its Credits window and the count as a balance string, "<left> of <limit> credits left", which magpie shows as a separate 余额 row (balanceRow, beside windows) in the plugin's own English and number format, and never flips with 已用/剩余. The window now carries the count as WorkBuddy's does (amount = credits used, limit = the packs' total, unit "credits", magpie#659), so magpie's quotaCount writes "2,307.42 / 3,800 积分 · 剩余 60.7%" (or "1,492.58 / 3,800 积分 · 已用 39.3%"; "credits" in English) in the row itself, and the balance is left out; an unlimited account still says "unlimited" as its balance. No magpie change needed: plugin_usage.go already passes a plugin window's amount, limit and unit to the card. usage.test.mjs now expects the window's amount/limit/unit and no balance (fails on 0.1.5); HOME=$(mktemp -d) bun test (465 pass) and bun scripts/check.mjs trae pass. Checked in magpie's Usage page (webkit, zh and en, API faked with the old and new shapes beside WorkBuddy and WorkBuddy AI cards): the Trae CN card's row reads like WorkBuddy's and the 余额 line is gone. Not tried with a real Trae CN account. 2026-10-04 13:07:10 +08:00
yetone d2449d53e6 trae 0.1.5: a model chat_v3 gives another model's name is named and asked as SOLO lists it (yetone/magpie#681, ChenstarMr: Trae's usage page booked magpie's DeepSeek V4.1 Flash as "DeepSeek-V4-Flash 正式版") — Trae CN's chat_v3 list names deepseek-v4.1-flash "DeepSeek-V4-Flash 正式版", the name it gives DeepSeek-V4-Flash-Official too, while solo_work_lite, solo_agent and solo_agent_lite name it DeepSeek-V4.1-Flash (the reporter's batch_get_detail_param answer). Both entries name the same upstream model, deepseek-v4.1-flash__dev, so the request reached V4.1 Flash, but the list showed two models with one name, and Trae's usage page booked the request under chat_v3's name (TraeCode), where SOLO's request was booked as DeepSeek-V4.1-Flash (TraeWork). liveModels now marks an entry misnamed when another model in the same list has its name and another list names it otherwise, and takes for each model the first function whose entry names a __dev model and isn't misnamed (else the first naming a __dev model, else the first, as before): deepseek-v4.1-flash is named DeepSeek-V4.1-Flash and asked through solo_work_lite with deepseek-v4.1-flash__dev, while DeepSeek-V4-Flash-Official, named alike everywhere, stays on chat_v3. usage.test.mjs gains the reporter's shape; it fails on 0.1.4 and passes; bun test (29 pass) and bun scripts/check.mjs trae pass. Not tried with a real Trae CN account (none here). 2026-10-04 10:26:56 +08:00
yetone 6596a31c84 trae 0.1.3: the model lists are asked as TRAE SOLO CN asks them, in one batch, as client 0.1.69 (yetone/magpie#681)
0.1.2 still showed no DeepSeek V4.1 Flash: its lists came from get_detail_param, one function at a time, sent as the Trae CN IDE 3.3.65 (version code 20260401). The reporter's TRAE SOLO CN 0.1.69 (version code 20260917, same app id) asks POST /api/ide/v1/batch_get_detail_param on trae-api-cn.mchost.guru (its ai-agent log, get_model_list -> batch_get_model_detail_param; 290 configs cached), and picks deepseek-v4.1-flash from it; two other open tools that list it (smart-open/TraeWorkAssistant, zhengwuji/Jet-Hub) ask the same batch, as a 0.1.5x SOLO client, and find it under solo_agent with model_name deepseek-v4.1-flash__dev.

Now the lists come from batch_get_detail_param (functions chat_v3, solo_work_lite, solo_agent, solo_agent_lite; agent_type "", access_type 0, show_custom_model), with get_detail_param per function when the batch gives none; the model host is told the client is 0.1.69 / 20260917 (x-ide-version, x-app-version and their codes). A model several functions list is asked through the first whose entry names a __dev model, and that model goes as model_name. The IDE's helpers (usage other than chat_completion: summary, fast_apply...), configs switched off and custom-model slots are left out of the list; names come from display_config.display_name, context from context_window_tokens.dev (max is Max mode's), output from the __dev model's max_tokens.

usage.test.mjs: the batch test (one ask, its body and version headers, DeepSeek-V4.1-Flash listed with 200000/64000 and asked through solo_agent as deepseek-v4.1-flash__dev) and the signed-out batch test fail on 0.1.2 and pass; bun test (24 pass) and scripts/check.mjs trae pass. Not tried with a real Trae CN account (none here).
2026-10-04 01:13:59 +08:00
yetone c8ff2c63ab trae 0.1.2: the TRAE agent's models (solo_agent) are listed too, so DeepSeek V4.1 Flash shows (yetone/magpie#681)
Trae CN 3.3.104's agent-type map (libai_agent.dylib manifests/mapping.json)
files deepseek-v4.1-flash under the "trae" agent only, which is function
solo_agent; solo_work_lite (SOLO Work) lists DeepSeek-V4-Flash-Official and
the custom_model_deepseek_* ones the issue shows. get_detail_param is now
asked for chat_v3, solo_work_lite and solo_agent, merged, and a model is
asked through the function that lists it. Not tried with a real account.
2026-10-03 22:30:10 +08:00
yetone a6ebbc55d8 trae 0.1.1: SOLO's models are listed too, and asked through SOLO's function (yetone/magpie#681)
DeepSeek-V4.1-Flash, which Trae CN's SOLO picker offers, was missing from
magpie's list: the plugin read the account's models from
/api/ide/v1/get_detail_param for chat_v3 (the classic IDE's chat) only, and
SOLO's models (the user's list showed DeepSeek-V4-Flash-Official and the
custom_model_* entries of chat_v3, no V4.1) come under solo_work_lite. Now
the list is asked for every chat function (chat_v3, solo_work_lite) and put
together, chat_v3's first; one list failing leaves the other's, a lapsed
sign-in still throws. A model only SOLO lists is asked through
solo_work_lite first, the 4001/4023/1005 fallback kept.

usage.test.mjs "SOLO's models are listed too" fails on 0.1.0 (V4.1 absent)
and passes; bun test: 21 pass. Not tried with a real Trae CN account (none
signed in here).
2026-10-03 21:17:55 +08:00
yetone 6c048c7fc2 trae 0.1.0: Trae CN (trae.cn) accounts, free tier included, with Trae's browser sign-in (experimental; Discord pdzebkbd0701)
Sign-in is trae.cn's authorization page back to a 127.0.0.1 /authorize
callback (userJwt + userInfo, or a refresh token exchanged), with a device
made at sign-in and kept for the account. ExchangeToken renews the JWT
through auth.refresh (refreshLead 10 min, one renewal per refresh token).
Requests go to the IDE agent's llm_utils_chat (chat_v3, then
solo_work_lite on 4001/4023/1005), its SSE events turned into OpenAI
chunks; tools named natively and as <tool_call> blocks. Usage is the
entitlement packs' credits. Worked out from wangqi233/trae2api and
autumnsentiment/Trae2api-cn; not run against a real account.
2026-10-03 14:34:31 +08:00