orinsid's desktop-client logs (#675, 11-04) show OrcaTerm 1.6.8 renewing from a long-lived oauth_refresh_token_v2 on a 110-minute schedule, while the plugin dropped the exchange's refresh token (`refresh: r.accessToken`) and renewed from the two-hour access token, which OrcaTerm answers SESSION_EXPIRED for 30 minutes into an idle sign-in. OrcaTerm's own bundle (orcaterm.cloud.tencent.com/terminal, orcaterm_components/orcaterm_app, fetched 11-04) settles the protocol: - the WeChat exchange sends {code, state, client: "desktop"} from the desktop client, and reads data.refreshToken from the reply; - the client keeps a refresh token only when it matches /^<uuid>\.\d{1,6}\.[A-Za-z0-9_-]{43}$/ and its uuid is the access token's jti (persistLoginRefreshToken); - OAuthRefreshToken sends {refreshToken} when it has one, else {accessToken}. The plugin now does the same: the exchange sends client "desktop", a matching refresh token is the sign-in's `refresh`, renewal sends it (an access token past its expiry no longer stops a renewal that has one), and a reply's RefreshToken replaces it, else it is kept. A sign-in from before 0.1.6 has the access token in `refresh` and renews as before until the next scan. Run (mote): packages/orcaterm `bun test`, 121 pass / 0 fail, including the new refresh-token.test.mjs (6 tests). Broken by hand: dropped client "desktop", sent {accessToken} always and saved `refresh: r.accessToken` again: 4 of the 6 new tests went red (the two that stay green check a mismatched token isn't kept and the pre-0.1.6 path). Not tried: a real WeChat sign-in. No OrcaTerm account here, so whether the reply to client "desktop" carries refreshToken for this flow, and whether renewal rotates it, is from the vendor's bundle, not a capture. If the reply has none, the sign-in falls back to the 0.1.5 behaviour.
21 lines
1.4 KiB
JSON
21 lines
1.4 KiB
JSON
{
|
|
"name": "@magpie-community/opencode-orcaterm-auth",
|
|
"version": "0.1.6",
|
|
"description": "OrcaTerm (Tencent Cloud 遨驰终端) AI quota as an OpenAI-compatible provider for magpie and OpenCode",
|
|
"type": "module",
|
|
"main": "./opencode.mjs",
|
|
"exports": { ".": "./opencode2.mjs" },
|
|
"files": ["index.mjs", "opencode.mjs", "opencode2.mjs", "wechat.mjs", "README.md", "LICENSE"],
|
|
"keywords": ["opencode", "opencode-plugin", "magpie", "orcaterm", "tencent"],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/orcaterm"
|
|
},
|
|
"magpie": {
|
|
"maxConcurrency": 1,
|
|
"icon": "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='1' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%231C74C7'/%3E%3Cstop offset='.55' stop-color='%238870FF'/%3E%3Cstop offset='1' stop-color='%23FEAECB'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23a)' d='M56 54c-7-12.5-26.2-13.2-35.5-22.5C14.4 25.2 14 16.4 16.7 11 19.5 5.3 25.9 1 33.1 1c2.7 0 8 1 11 3 14.1 9.4 18 22.7 19.6 28.5 1.6 5.8 1.5 14.5-7.7 21.5z'/%3E%3Cpath fill='url(%23a)' opacity='.85' d='M86.2 58C78.2 75.5 48.2 70.5 33.2 64 20.6 66.3 15.2 72 15.2 81c0 9.5 6.2 17.4 15.5 18.5 9.3 1.1 22.6-5.5 33-14 9-7.4 19.8-17.6 22.5-27.5z'/%3E%3C/svg%3E"
|
|
}
|
|
}
|