7b42e404f5f656d7bfb4aa5c7ddbcd1031264a86
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9fb09a0f41 |
orcaterm 0.1.7: a tool call the model writes as text is not sent on as the answer (#969)
orcaterm 0.1.7 reads the tool call a model writes as text (DSML, <tool_call>, <function_calls>, <function=, <invoke name=) on both the streamed and non-streamed paths. The answer stops where the call begins, and the turn ends as a text_tool_call error (an error frame when streamed, a 502 when not), so magpie can retry or try another account instead of passing the call on as prose. A call shown in a code fence or in backticks is ordinary text, as in trae. A call carried only in the thinking goes through the same guard: the call is read from the extractor that cut it (answerAndCall), so prose before it no longer hides it. An `ask` envelope reaches the client as its question with its options under it, one per line, whether it is complete JSON, hand-written with a bare line break, cut short by the stream, or appended after prose. Reviewed at 39b4ef653e89e2b3e8c2d1b803563089ba4e3e2b, every line changed since 7a49ed7c. Merge-tested with origin/main |
||
|
|
db307844e7 |
orcaterm 0.1.6: keep the WeChat sign-in's refresh token and renew from it (#675)
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. |
||
|
|
016a869062 |
orcaterm 0.1.5: a refused renewal doesn't sign out a token that still has life (#675)
orinsid's idle run (0.1.4, magpie v0.1.2861): the token was issued with a
2h life, the host's first background renewal at +30min got SESSION_EXPIRED
from OAuthRefreshToken, and auth.refresh threw signIn "expired" on any
message matching /expired/, so the account was marked signed out with 90
minutes of token left. That token drives the chat by itself until its own
exp, and magpie's contract is that a failed renewal not marked "expired"
is kept and tried again.
Now a renewal refused as expired fails without `signIn` while the token's
exp (JWT claim or the stored expires) is more than a minute away; once the
token has expired too, it still marks the account.
Not changed, and not known: why upstream answers SESSION_EXPIRED 30
minutes into a 2h token. The renewal sends only {accessToken} with no
cookie, while OrcaTerm's product calls send ot_session (and the server
sets an ot_sid session cookie); an idle server-side session timeout is
the likely cause. Neither can be checked without a real account, so this
only stops the false sign-out; the session may still lapse while idle.
Run: bun test in packages/orcaterm (115 pass); the new "still has life"
test is red on 0.1.4's index.mjs and green here. Not tried: a real
OrcaTerm account, a real idle run.
Reported-by: orinsid
|
||
|
|
1dfdec29dc |
orcaterm 0.1.4: renew the WeChat token 90 minutes before it expires (#675)
orinsid measured that OrcaTerm drops the OAuth session together with an expired 2h access token: OAuthRefreshToken then answers SESSION_EXPIRED for good. The plugin declared no auth.refreshLead, so magpie's host renewed only when the account was used in the token's last 5 minutes, and an account idle past that had to scan again. auth.refreshLead is now 90 minutes (what orinsid's local patch ran for 40+ hours with no expiry): any request or usage read in the last 90 minutes renews it. Not changed: magpie's host renews only when something uses the account (host.js fresh(): loader, models, usage, checkin). An account nothing touches for the whole two hours still expires; that is the host's to fix. Run at this head, on mote: packages/orcaterm bun test, 113 pass 0 fail (11 files, renew.test.mjs new); bun scripts/check.mjs exit 0. Broken by hand: refreshLead commented out, renew.test.mjs goes 2 fail 1 pass (the hourly-use case and the lead-as-said case). Not tried: a real WeChat sign-in left idle across an expiry. |
||
|
|
17e5ef7457 |
all: load on OpenCode 2.x through a default {id, setup} (#657)
nbczw8750 (#657): trae 0.2.26 on OpenCode 2.2.5 fails with "Plugin must export a default definition with an id and an effect or setup function. (cause: SchemaError(Missing key at ["default"]))". 2.x imports a package's exports["."] (a plugin dir and an npm install alike) and has no V1 path at all, so every package here that serves models failed the same way, not only trae. Every one of the 32 model packages now has: - opencode2.mjs, exports["."]: a copy of scripts/opencode2.mjs, an adapter that runs the package's V1 plugins inside 2.x's promise API. Config providers become 2.x providers (package pinned so the aisdk sdk hook runs), V1 auth methods become integration methods (oauth auto/code with forms; api without authorize as a key method), V1 credentials are kept in metadata.v1, the loader's baseURL, apiKey, headers and fetch are applied through the sdk hook, an auth.set renewal is stored per credential, and credential.switched /updated reload the account's own model list. - opencode.mjs, main: re-exports the V1 plugin functions only. OpenCode 1.x and magpie's host.js take main. On 1.x, trae 0.2.26's main exported a non-plugin (_internal) and 1.19.5 refused it ("Plugin export is not a function"); the new main fixes that too. - both files in "files"; patch version bumped. devin already had 2.x and is unchanged. scripts/check.mjs fails a model package whose 2.x entry has no default {id, setup}, whose opencode2.mjs differs from the canonical one, whose entry is missing from files, or whose main exports a non-plugin. Run at this head (mote): - HOME=$(mktemp -d) bun test, as CI runs it: 4900 pass, 0 fail (4914 tests, 374 files). A first run set globalThis.fetch for the whole process from opencode2.test and failed 528 tests in other packages; the block is now set and put back around that file's tests. - bun scripts/check.mjs: every package passes. With the network blocked cloudflare-workers-ai fails on its fetched catalog, the same on origin/main. - Real OpenCode 2.2.5 (npm opencode-ai), sandbox HOME, packed trae 0.2.27: loads with no error; /api/integration lists trae-cn "Trae CN" and trae-global "Trae Global" with their browser sign-ins; `auth login` starts the trae.cn authorization and waits (cancelled there); with a fake credential POSTed to /api/credential, `opencode models` lists trae-cn's six models. - Real 2.2.5 with a fake V1 key plugin through the same adapter against a local fake server: `auth login` with a key, `models`, `opencode run` reached /real/v1/chat/completions with the loader's "Bearer loader-sk-fake" and header, and printed the fake's reply; with @ai-sdk/anthropic it reached /real/v1/messages with x-api-key from the loader. This run found the key method missing after 2.x's second integration transform (a once-only flag outside the transform); fixed, and opencode2.test checks a rebuild. - Real OpenCode 1.19.5, sandbox HOME, trae 0.2.27: `opencode models` lists trae-cn and trae-global models; 0.2.26 failed there. Broken by hand (scratch copy, bun test scripts/ and check.mjs): - trae's exports back to "./index.mjs": the trae 2.x test fails (default.id undefined), check fails trae with "OpenCode 2.x: ./index.mjs has no default {id, setup} (plugins#657)". - zed's opencode2.mjs changed: the copies test fails, check fails zed "differs from scripts/opencode2.mjs". - the key flag back outside the transform: the 1.x plugin test fails on the rebuilt sign-ins (key missing). Not tried: a real sign-in with a real account on 2.x; Windows (the reporter's OS); chat.headers, chat.params, usage and tool hooks, which the adapter doesn't carry to 2.x; the tools/pages packages (calc, goanyapi, layerfs, search1api, aelios, agent-console, chat, fingerprint, nowledge-mem, kimi-desktop), which still load only on 1.x. |
||
|
|
2fc8945de4 |
orcaterm 0.1.2: a new upstream conversation per request, and the envelope unwrapped wherever it shows (#564)
ferocknew saw a reply come out as the assistant's own envelope
({"action":"completion","ph_1":"--","taskCompletion":"…"}) and another
session's transcript end with OrcaTerm's output format.
Cause: the plugin kept one upstream conversationId per account and
session (and "default" when no session was named). OrcaTerm keeps a
conversation's turns by its id, while the plugin already sends the whole
transcript, so a reused id put upstream's copy of earlier turns (the RE_ACT
output format and raw envelopes) in front of each request; two sessions on
one id (no session id, or magpie's first-user-turn hash shared by a title
request or a same-opening chat) read each other's. Three more routes let an
envelope through: one written with bare line breaks or quotes is not JSON
and went out whole; an envelope sent only as thinking was the fallback
text as it was; and an earlier envelope the agent kept in its history went
back up as the assistant's turn, which the model then imitated.
Now every request gets a fresh cid-<uuid>-orcaterm (the user id stays per
session), a hand-written envelope is read for its answer
(looseEnvelopeAnswer), the thinking fallback and the history turns go
through the same extractor. The plugin adds nothing to other providers'
requests: its only non-auth hook is chat.headers, gated on providerID.
Run on mote: bun test in packages/orcaterm 110/110 pass; bun scripts/check.mjs
orcaterm ok; bun test scripts 3/3. leak.test.mjs at the old index.mjs: 4 of
7 red (bare line breaks, thinking-only, history turn, shared conversation
id); the reporter's literal envelope itself already unwrapped when clean.
Not tried: a real OrcaTerm account (none here), so upstream's keeping of
turns by conversationId is from the plugin's own measurements, not re-run.
|
||
|
|
848497c40b |
orcaterm 0.1.1: QR sign-in null fields, OAuth quota, stable account identity (#510)
orcaterm 0.1.1 (hg1048596-pixel): - WeChat QR sign-in accepts the official bridge's null fields. - QR accounts read their AI quota through orcaterm.com's product API, with the token sent as the ot_session cookie only to https://orcaterm.com/cgi/api and redirects refused. - A QR re-sign-in reuses the same account, keyed by the stable OrcaTerm user id. - The README (en and zh) lists every host and what each one receives. Run at the reviewed head a9ab6853b (Mac mini, Bun 1.4.2): `bun test` in packages/orcaterm passed 101 of 101 with every non-loopback fetch and socket refused (none was attempted), and `bun scripts/check.mjs orcaterm` passed. Broken by hand at fa028746c, the last code change, each going red: the /cb null check, accountId on the QR result, and redirect: "error". |
||
|
|
fdc5002319 |
orcaterm 0.1.0: Tencent Cloud OrcaTerm's assistant as a provider, with WeChat QR sign-in (#460)
New package @magpie-community/opencode-orcaterm-auth 0.1.0: Tencent Cloud OrcaTerm's own AI assistant (its monthly question allowance) as provider `orcaterm`, with WeChat QR sign-in (the same sign-in OrcaTerm's clients use) or a pasted console cookie. Credentials go only to Tencent's hosts (orcaterm.com, *.cloud.tencent.com) and WeChat's widget (open.weixin.qq.com, res.wx.qq.com). The nine models OrcaTerm's picker offers are listed; others resolve only as aliases. Per-account pacing at 10 chats/min, maxConcurrency 1; a JSON or SSE refusal inside a 200 becomes 429/401/502. registry.json gains its entry. Author: hg1048596-pixel (#460, replaces #422) The last review's three points are fixed at this head: the index.mjs header, toUpstreamBody and plugin-entry comments describe the code; the README's License links the package's own LICENSE; /cb accepts a bridge error without a code and shows it, and a later scan still finishes. Run at a75a2ae0fb554b3cb6ae879d5571b5dd7b2300a7 on mote (macOS, Bun 1.4.2), HOME=$(mktemp -d) as CI: - bun test packages/orcaterm: 88 pass, 0 fail - bun test (whole repo): 3624 pass, 8 skip, 0 fail - bun scripts/check.mjs: every package ok, orcaterm included - npm pack: 5 files (index.mjs, wechat.mjs, README.md, LICENSE, package.json); the extracted index.mjs imports with bun and its plugin returns provider orcaterm; node scripts/dist.mjs packs opencode-orcaterm-auth@0.1.0 - The earlier review's fake-upstream script against the packed package: 27 of 27 (JSON 429 with and without rate-limit words, SSE quota, rate and sign-in errors, envelopes in stream and JSON mode, per-account pacing, bearer headers, nine listed models, credentials only to lightai.cloud.tencent.com) - The /cb script against the packed wechat.mjs: foreign, missing and rebinding origins 403, wrong state refused, right origin and state finish the sign-in Broken by hand: requiring a string code again turns "callback preserves bridge errors without a code" red (87 pass, 1 fail). Not tried: a real OrcaTerm account, so neither the QR sign-in nor the real upstream. |