Commit Graph
2 Commits
Author SHA1 Message Date
1sh1ro 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 2f8e65a1 (clean, no conflicts in packages/orcaterm).

Ran, with Bun 1.4.2:
- WSL magpie-desktop (wsl-run, HOME=$(mktemp -d)): bun test packages/orcaterm 160 pass, 0 fail;
  bun scripts/check.mjs exit 0. The same after merging origin/main 2f8e65a1: 160 pass, 0 fail,
  check exit 0.
- Windows xiaomi-gpu (win-run, fresh HOME and USERPROFILE): bun test packages/orcaterm 160 pass,
  0 fail; bun scripts/check.mjs exit 0.
- Review probes (local, not pushed): 40, all green. That covers the 21 from round 2, including the
  three thinking-only calls (prose + call streamed gives the prose plus an error frame, not
  streamed gives a 502, a call inside a thinking envelope gives the error frame), the loose ask, the
  cut-short ask and prose + ask. It also covers 19 new ones: streamed and non-streamed give the same
  result for a loose ask in 1-, 3- and 4096-character frames, prose + loose ask, prose + fenced ask,
  an appended completion still dropped, a fenced or backticked call in the thinking shown, content
  winning over a call in the thinking, a call split over 1-character thinking frames, a cut-short
  opener in the thinking, a complete ask followed by prose kept verbatim, a backticked ask example
  kept, and an appended ask whose question carries a call (502 / error frame).

Broken by hand, one at a time (cp-restored and touched each time), the whole orcaterm suite:
13 of 17 breaks go red. Red: trusting a match at the end of the text (3), the quoted check in
answerCut (6), the complete-opener hold (18), the i flag (2), the streamed thinking guard (3), the
non-streamed thinking guard (1), answerAndCall returning no call (4), answerField always
taskCompletion (2), the appended ask dropped (1), the loose reader's options strip (1), the loose ask's
options (1), the cut-short field (1), the ask unwrap (2).
Not red in the suite (each one red in the review probes): object options read for their label, a
blank question treated as none, and the fence taken off an appended ask (break it and the question
of "Two options.\n```json\n{ask}\n```" is dropped). textCallIn without quoted() has no effect any
more, because nothing calls textCallIn now apart from its export.

Correction to round 2: the "duplicate" <function_calls> in TEXT_CALL_OPEN and TEXT_CALL_MARKS is
<function_calls> and its antml:-prefixed form. Our tooling had shown both lines the same. Not a
duplicate.

Not tried: a real OrcaTerm account (none used from this PR), and an end-to-end magpie gateway run.
Edges noted, not blocking: an ask carrying both taskCompletion and question answers with
taskCompletion when it is valid JSON, and with question when it is hand-written. A hand-written
ask whose option string contains "]" still goes out raw.
2026-11-11 16:07:38 +08:00
狂気のMad Scientist鳳凰院胸針 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.
2026-10-30 00:44:34 +08:00