@magpie-community/opencode-trae-auth 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +6 -5
  2. package/index.mjs +7 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -33,9 +33,9 @@ agent's `POST https://trae-api-cn.mchost.guru/api/agent/v3/llm_utils_chat`:
33
33
  - The messages go as `{role, content: [{type: "text", text}]}`.
34
34
  - The model goes as `config_name` and `model`.
35
35
  - The function is the one whose model list has the model (`chat_v3`, the
36
- classic IDE's, first; else `solo_work_lite`, SOLO's). If Trae answers
37
- 4001, 4023 or 1005, the plugin tries the other once and remembers which
38
- one worked.
36
+ classic IDE's, first; else `solo_work_lite`, SOLO's Work mode; else
37
+ `solo_agent`, the TRAE agent's). If Trae answers 4001, 4023 or 1005,
38
+ the plugin tries the others once and remembers which one worked.
39
39
  - **Headers:** the IDE's: `Authorization: Cloud-IDE-JWT …`,
40
40
  `X-Cloudide-Token`, `x-app-id`, `x-ide-version`, the device headers and
41
41
  `x-uid`.
@@ -56,8 +56,9 @@ agent's `POST https://trae-api-cn.mchost.guru/api/agent/v3/llm_utils_chat`:
56
56
  - Images aren't sent.
57
57
 
58
58
  The model list is the account's own, from `/api/ide/v1/get_detail_param`,
59
- asked for both functions and put together: SOLO lists models `chat_v3`
60
- doesn't (DeepSeek-V4.1-Flash). When neither can be read, the plugin uses the models Trae CN's `chat_v3` is
59
+ asked for each of those functions and put together: SOLO and the TRAE
60
+ agent list models `chat_v3` doesn't (deepseek-v4.1-flash is the TRAE
61
+ agent's, `solo_agent`). When neither can be read, the plugin uses the models Trae CN's `chat_v3` is
61
62
  known to serve: GLM-5.2, GLM-5, Kimi K2.6, Qwen 3.7 Plus, DeepSeek V4 Pro
62
63
  and DeepSeek V4 Flash.
63
64
 
package/index.mjs CHANGED
@@ -26,8 +26,10 @@ const SIGN_IN_TIMEOUT = 10 * 60 * 1000
26
26
  const EARLY_MS = 2 * 60 * 1000 // a token this close to its end is renewed before a request
27
27
  const LEAD_MS = 10 * 60 * 1000 // and this close, magpie renews it ahead of time (auth.refresh)
28
28
  const DAY = 24 * 3600 * 1000
29
- // the IDE's chat functions: the classic IDE's agent, then SOLO's
30
- const FUNCTIONS = ["chat_v3", "solo_work_lite"]
29
+ // the IDE's chat functions: the classic IDE's agent, then SOLO's Work
30
+ // mode, then the TRAE agent (solo_agent): Trae CN 3.3.104's agent-type map
31
+ // files its models under "trae", and only that one has deepseek-v4.1-flash
32
+ const FUNCTIONS = ["chat_v3", "solo_work_lite", "solo_agent"]
31
33
 
32
34
  const MODEL = { attachment: false, tool_call: true, reasoning: true, temperature: true, limit: { context: 128_000, output: 32_000 }, modalities: { input: ["text"], output: ["text"] } }
33
35
  // what Trae CN's chat_v3 is known to serve; the live list replaces it
@@ -689,7 +691,7 @@ async function openai(req, it) {
689
691
  return new Response(stream, { status: 200, headers: { "content-type": "text/event-stream", "cache-control": "no-cache" } })
690
692
  }
691
693
 
692
- // a model or function this account's chat_v3 doesn't take: SOLO's may
694
+ // a model or function this account's chat_v3 doesn't take: another may
693
695
  const wrongFunction = (code) => ["4001", "4023", "1005"].includes(String(code))
694
696
 
695
697
  // ---- usage ------------------------------------------------------------------------
@@ -828,8 +830,8 @@ export const TraeCNAuthPlugin = async ({ client }) => {
828
830
  }
829
831
 
830
832
  // liveModels is the account's model list: every chat function's, since
831
- // SOLO lists models the classic IDE's chat_v3 doesn't (DeepSeek-V4.1-Flash
832
- // came to SOLO first, yetone/magpie#681); a model listed by one function
833
+ // SOLO lists models the classic IDE's chat_v3 doesn't (deepseek-v4.1-flash
834
+ // came to the TRAE agent's first, yetone/magpie#681); a model listed by one function
833
835
  // only is asked through that one. One function's list failing leaves the
834
836
  // others'; all failing is the error.
835
837
  const liveModels = async (a) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-trae-auth",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "OpenCode provider plugin for Trae CN (trae.cn): your Trae CN account's models, free tier included, with Trae's own browser sign-in",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",