Commit Graph
9 Commits
Author SHA1 Message Date
yetone 929eb2c0b1 opendesign 0.1.12: a model asked on another of amr-link's APIs is signed for that API (#888)
amr-link serves every model on chat completions, Responses and Anthropic's
messages (keyblues measured all fourteen). The plugin declares one API per
model (MODEL_WIRE, kept: it is where each model thinks, plugins#141), and
magpie's host signs a request with the declared package's header. So a model
asked on another API (magpie's per-model API choice; the OpenDesign provider
has all three URLs) went with the wrong header: a chat model on /messages
with a Bearer, glm-5.3-flash on /chat/completions with x-api-key.

The loader now returns a fetch that signs by the request's path: x-api-key
(and anthropic-version when missing) on /messages and /messages/count_tokens,
Bearer on everything else. A request on the declared API goes as before.

Zero-config native protocol per agent needs magpie: its plugin contract has
one API per model (provider.pluginAPIs returns pluginProtocol's one), so the
gateway translates every other agent's protocol to it. Reported, not changed.

Run on mote under lockf ~/suite.lock:
- bun test packages/opendesign: 31 pass, 0 fail (at ff9d3a64 and again at
  the rebased head).
- bun test (full, isolated HOME): 7578 pass, 0 fail, at base ff9d3a64. A run
  with mote's real HOME had the suite's isolated-HOME guards (zcode) and
  Devin's local-CLI tests red, untouched packages; isolated, they pass.
- bun scripts/check.mjs: ok.

Broken by hand: the loader without `fetch: signFor(key)`; the new test and
the loader test went red (2 fail), green again with it back.

Not tried: against the real gateway (no OpenDesign key), so x-api-key on
amr-link's /v1/messages for a chat-declared model is the reporter's result,
not mine.

Reported-by: keyblues
2026-11-10 02:56:52 +08:00
yetone e68748a78e opendesign 0.1.11: cap glm-5.3-flash and gemini-3.8-flash output at what amr-link takes (#827)
amr-link's /v1/models publishes context_budget 232000 for glm-5.3-flash
and 264000 for gemini-3.8-flash. Its API refuses anything over 131072 and
65536 with a 400, "Open Design: The request could not be completed.",
which names no field. Gitleonan measured this on 2026-11-09 with two
accounts (one of them took 232000 for GLM). A client that sends no limit,
such as Codex, gets the published number from magpie
(forwardTranslated's askedOutput), so every turn on those models failed.

modelOf now caps limit.output for those two models (CAP). It applies to
the seed and to every live catalog entry. A copy an earlier version kept
in the provider's config is capped too: config hands kept models back as
they were. models.mjs is left alone because refresh-models.mjs writes the
vendor's number back into it, and the live catalog's number overrides the
seed's anyway. A catalog number under the cap is used as it is.

This does not fix the red test dot through a Remote magpie. That comes
from the stream glm-5.3-flash sends when it reaches max_tokens: it ends
after content_block_stop with no message_delta or message_stop. magpie's
test asks for 16 tokens, and the model always thinks first, so it always
reaches the limit. On the issue I point to the magpie code for that path.

Run (on mote): bun test packages/opendesign gives 30 pass, 0 fail.
Broken by hand: with origin/main's index.mjs, the new test fails, and
with the config cap removed (the modelOf cap kept), it fails on the kept
gemini copy's 264000.
Not tried: a real amr-link request. There's no Open Design account here,
so the caps are the reporter's measurements, not ours.

Reported-by: Gitleonan
2026-11-09 09:56:29 +08:00
yetone 32bf0e68f9 opendesign 0.1.10: a model keeps the seed's input kinds and limits the live catalog leaves out (#829)
modelsOf() built each signed-in model from amr-link's catalog entry alone
(facts(m)). When the entry for deepseek-v4.1-flash-eco didn't list image,
the seed's input: ["image"] was lost, magpie listed it text-only and
described the image with another vision model (claude-haiku-5.5), while
amr-link takes the image itself (the reporter's direct POST). Limits and
the cost/capability words had the same loss: an entry without them fell to
200K/32K and no word, not the seed's.

withSeed() now fills what the entry leaves out from models.mjs. Input is
the seed's kinds and the catalog's together, also when the catalog lists
text only: the seed's kinds are what the catalog itself listed at the last
refresh, and a kind wrongly dropped is silent (the image is swapped for a
description on another account's allowance), while a kind wrongly kept is
the vendor's visible error. A model or kind the seed doesn't declare is the
catalog's alone. refresh-models.mjs does the same merge and prints each
kind it kept, so removing one is an edit to models.mjs.

Siblings: astudio, cline and sensenova read input_modalities too. cline
leaves an absent list unsaid, sensenova already unions its curated list
with the live one, astudio has no seed kinds to lose. No change there.

Run on mote:
- bun test packages/opendesign: 29 pass.
- Broken by hand: the old index.mjs and refresh-models.mjs fail both new
  tests (image false; no "kept image" line, eco written without input);
  only the context fallback reverted fails the modelsOf test.
- bun scripts/check.mjs opendesign: ok.
- HOME=$(mktemp -d) bun test (whole repo): 6766 pass, 20 skip, 1 fail:
  reasonix-desktop "normal host exit flushes a disconnect and leaves an
  active connection configured" (1162ms), untouched here; it passes 3 of 3
  run alone. Its output was lost to a tail; not filed.

Not tried: a signed-in opendesign account (we have none), so whether the
live entry lists ["text"] or omits the modalities is not seen; the fix
covers both. refresh-models.mjs against the real catalog.

Reported-by: exposir
2026-11-07 17:46:50 +08:00
Bernardxu123 6549b6335d opendesign 0.1.9: the plan's own credit multipliers, and V4.1 Flash Eco (#794)
A model's rate is now the Design Plan's own deduction multiplier from
open-design.ai/zh/model-credits/ (rates.mjs), not amr-link's catalog cost
word, which disagreed for seven models (Claude Haiku 5.5 2x, GPT-6 Luna 4x,
DeepSeek V4 Pro 1x, ...). A model the table doesn't name keeps its catalog
word. deepseek-v4.1-flash-eco joins the seed with V4.1 Flash's limits and
levels at 0.27x.

Reviewed at 0335afb86a9afb53a576813445c0b6cb4705cfeb:
- rates.mjs checked row by row against the vendor page, fetched 2026-11-06;
  the 0.25x row is the 10-20..10-27 promo, over.
- mote, HOME=$(mktemp -d), Bun 1.4.2: bun test packages/opendesign 27 pass;
  bun scripts/check.mjs opendesign ok; npm pack has rates.mjs and the packed
  plugin imports.
- Broken by hand: rateOf ignoring the table (2 red), config hook not
  re-declaring rate (1 red), eco seed line removed (3 red).
- magpie's host builds config models without rate and never writes a hook's
  result back, so the re-declared rate overrides nothing a user set.
- npm had 0.1.8; 0.1.9 is next.
Not tried: a real Open Design account; the live ids of hy4-preview and
minimax-m3.1-flash (not in the seed).
2026-11-06 20:18:20 +08:00
yetone 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.
2026-11-03 13:54:26 +08:00
yetone c9a52b3baf opendesign 0.1.7: the sign-in names this computer, never "magpie" (#357)
The device authorization sent `host: hostname() || "magpie"`. The Open
Design CLI, `vela login` (@powerformer/vela-cli 0.1.7, darwin-arm64
binary), sends `{"cliVersion","host","profile":"prod"}` with host from
os.Hostname(), and when the name can't be read it stops with "resolve
hostname: %w" instead of sending a name of its own. The plugin now does
the same: this computer's name, or a sign-in that stops and says why,
with nothing sent.

Run:
- vela 0.1.7 `login` in a sandbox HOME/AMR_HOME with VELA_API_URL at a
  local recorder: body {"cliVersion":"0.1.7","host":"yetone-mac-mini.local",
  "profile":"prod"}
- bun test (packages/opendesign): 24 pass, 0 fail
- bun scripts/check.mjs: ok
- no-magpie.test.mjs against HEAD's index.mjs: 2 of 2 red

Not changed: cliVersion stays "0.1.4" and the User-Agent stays the
package's own name; neither names magpie.
Not tried: a live sign-in. There is no Open Design account to approve it.
2026-10-24 17:41:18 +08:00
yetoneandsryimnoob ffc06aca49 opendesign 0.1.6: each model is asked on the API amr-link thinks on, and reasons at max too (#141, sryimnoob123)
sryimnoob123 measured a streaming request to every model on each of
amr-link's three APIs: chat completions carries the thinking of most,
claude-haiku-5.5 and deepseek-v4-pro think longer on Responses, and
glm-5.3-flash thinks only on Anthropic's messages. The vendor also names
max beside low and high. #141 was written against 0.1.4 and conflicted
with 0.1.5 (#137's levels), so it is ported onto main here:

- WIRE/MODEL_WIRE/wireOf as the PR had them; the provider default is
  chat completions, and a live list's and the seed's models each carry
  api.npm/provider.npm, which magpie's host reads per model.
- The config hook sets every model's wire again over a kept copy, so a
  model 0.1.5 left on the Responses API moves to its own.
- max joins every measured level list.

Run: bun test in packages/opendesign, 22 pass (a new test holds a kept
0.1.5 model moving to its wire; the old Responses-only expectations were
changed to the measured ones). Not tried against a real amr-link account.

Co-authored-by: sryimnoob <314134180+sryimnoob123@users.noreply.github.com>
2026-10-16 00:53:37 +08:00
yetone b549b40b14 opendesign 0.1.5: a signed-in account's models reason in magpie, at the low and high levels amr-link took (#137, sryimnoob123)
sryimnoob123 measured amr-link with reasoning_effort high and low on all
11 models (magpie 0.1.1254, Windows): every one answered 200, and all but
gpt-6-luna streamed reasoning, four the catalog calls "standard" too.
Their install showed all 11 with reasoning false and no levels. Two
causes:

- provider.models gave the live list in the config's shape
  (reasoning: true, modalities: [...]). magpie's plugin host reads a
  listed model's thinking from capabilities.reasoning and its kinds from
  capabilities.input, so for a signed-in account every model read as not
  reasoning, with no image input. It now gives OpenCode's model shape
  (servedOf: api, capabilities, variants), as minimax/workbuddy do.
- No model had levels: nothing declared variants, and magpie shows a
  model's levels only from them. models.mjs now records the measured
  levels (efforts): ["low", "high"] on the 10 that thought, [] on
  gpt-6-luna (took it, never thought). Only the two levels the table
  shows were given. A model with levels reasons whatever its capability
  word; one the seed doesn't know keeps the old rule (advanced reasons)
  with no levels. refresh-models.mjs keeps efforts like names.

Run:
- bun test packages/opendesign: 21 pass, 0 fail. New: "a signed-in
  account's models reason at the levels amr-link took (#137)", "the
  seed's models carry the measured levels as the config's variants";
  the live-list test now pins the OpenCode shape.
- Broken by hand: modelsOf back on modelOf (config shape) -> 2 fail;
  efforts not passed from the seed to the live list -> 1 fail.
- magpie origin/main internal/plugin/host.js run under bun with a
  preloaded fetch stub serving a 3-model catalog (init + providers, a
  stored oauth account): with 0.1.4 gpt-6-luna, deepseek-v4-pro and
  claude-haiku-5.5 all list reasoning=false variants=[] image=false;
  with this change luna false/[]/image true, v4-pro true/[low high],
  haiku true/[low high]/image true, url the amr-link base.
- refresh-models.mjs against the same stub: efforts kept per model.
- bun scripts/check.mjs: every package ok.
- TMPDIR/HOME isolated bun test (whole repo): 1526 pass, 0 fail. A first
  run had 1 fail, packages/grok/login.test.mjs "a login's link is still
  handed on" timing out at 5s with load average ~100; alone 3/3 pass and
  the rerun of the whole repo passed. Untouched package; not filed.

Not tried: a real Open Design account (none here) or magpie's
`model efforts` command end to end; the levels rest on the reporter's
table.

Full suite: bun test (whole repo, with factory 0.1.30 below it): 1527 pass, 0 fail
2026-10-15 21:11:53 +08:00
dbydd 3db704a677 opendesign 0.1.4: Open Design Cloud (Design Plan) as a provider (#84, dbydd)
New package @magpie-community/opencode-opendesign-auth 0.1.4, provider id `opendesign`: an Open Design Cloud account's Design Plan as a magpie provider (dbydd, #84).

Reviewed at this head (37ef688), as in the PR's last review: `HOME=<temp> bun test` for packages/opendesign, 19 pass; `bun scripts/check.mjs opendesign` ✓; the package loads under Node and Bun; `npm pack --dry-run` packs 5 files; a stubbed usage call sent its User-Agent to amr-api.open-design.ai only. The only hosts in it are amr-api.open-design.ai and amr-link.open-design.ai, with no install script, child process, or write outside OpenCode's auth store.

It no longer waits on its first npm publish: the publish workflow packs it onto the dist branch, and magpie 0.1.1243 and later install it from there until npm has it.
2026-10-15 06:44:45 +08:00