Files
plugins/packages/trae/package.json
T
yetone 925d6a253f trae 0.2.32: a conversation keeps its session_id when the plugin restarts
baoguo on magpie's Discord: every call seemed to be a new Trae
conversation, billed and cached as fresh; asked for one Trae session per
agent session. The plugin already sends one session_id per conversation
(0.2.6, #58): the session magpie names (the agent's own header, Claude
Code's x-claude-code-session-id, Codex's session_id, DSH's
x-deepseek-harness-session-id, OpenCode's session; else magpie's hash of
how the conversation opens), with the account, hashed. But the hash's
salt was new in each process, and magpie restarts its plugins on every
update of magpie or of any plugin, so every conversation going on then
went on under a session_id of its own from that point.

Now the salt is made once, in ~/.config/magpie/trae-session-salt
(MAGPIE_TRAE_SESSION_SALT names another file), written to a temp name
and hard-linked into place so processes starting together all read the
one that won. A file that can't be read or made, or holds anything else,
is left as it is and the process has a salt of its own, as before. The
id is derived, not cached, so there is nothing to bound or expire: the
same agent session gives the same id for good. Tests now write their
salt in a temp folder (nonet.mjs).

Run: HOME=$(mktemp -d) bun test packages/trae on mote, 243 pass, 0 fail;
bun scripts/check.mjs trae ok; conversation.test.mjs on Windows
(xiaomi-gpu), 10 pass. Broken by hand: a salt new in each process makes
"a conversation keeps its session_id when the plugin's process starts
again" fail; overwriting the file on a race makes "processes starting at
once on no salt yet all take the one that was made" fail.
Not tried: a real Trae account (none in this magpie), so whether Trae's
prompt cache follows session_id is not measured. dsh-connect-trae's
probe (docs, 11-03) saw cache_read 0 on three same-prefix requests since
10-26, which no session id would change. Claude Code subagents still
share their lead's session, as magpie names them.

Reported-by: baoguo
2026-11-06 17:36:42 +08:00

32 lines
713 B
JSON

{
"name": "@magpie-community/opencode-trae-auth",
"version": "0.2.32",
"description": "OpenCode provider plugins for Trae: Trae CN (trae.cn) and Trae Global (trae.ai), free tier included, with Trae's own browser sign-in",
"type": "module",
"main": "./opencode.mjs",
"exports": {
".": "./opencode2.mjs"
},
"files": [
"index.mjs",
"opencode.mjs",
"opencode2.mjs",
"README.md"
],
"keywords": [
"opencode",
"opencode-plugin",
"magpie",
"trae",
"trae-cn",
"trae-global",
"bytedance"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/trae"
}
}