15f4fa80c2ff81fe06bddd1cf9ee78070de7cd92
12
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1ad712d963 |
registry: a package that declares magpie.agent is listed as an agent, with a main or without (#737)
An agent that needs a runtime (miaocell's magpie-agent-deva) keeps its moejs agent file and adds a Bun module as main, as agent-kimi-desktop and agent-reasonix-desktop do. The README's agent convention now says so, and that such a package is kind "agent" in registry.json. check.mjs fails a registry entry whose package declares magpie.agent but whose kind is not "agent" (agentKindProblems in scripts/registry.mjs). magpie's side is v0.1.2995 (ed7aeb052): the GitHub list and the Installed row read the declaration, not the main. Run: bun test scripts/check.test.mjs, 17 pass (the new test also checks the repo's real kimi-desktop, reasonix-desktop and aider packages); bun scripts/check.mjs exit 0. Broken by hand: agent-kimi-desktop's kind removed from registry.json made check.mjs fail with '@magpie-community/agent-kimi-desktop declares magpie.agent, but its entry's kind is null, not "agent"'; restored. No package version changes, so nothing publishes. |
||
|
|
0daf0c7421 |
sap-aicore 0.3.0: a new provider for SAP AI Core's GPT Responses and Claude Messages deployments (caikn, #651)
A new provider package, @magpie-community/opencode-sap-aicore-auth 0.3.0
(packages/sap-aicore). It signs in from a local SAP AI Core client-secret
credential file, discovers the account's running GPT (Responses) and Claude
(Messages, Bedrock) deployments per resource group, and sends requests only to
https://*.authentication.*.hana.ondemand.com (token) and
https://api.ai.*.hana.ondemand.com (inference). Image input is gated per model
on the catalog's inputTypes. Also: the root README row, a registry.json entry,
.DS_Store in .gitignore, and scripts/check.mjs accepts an empty static model
list for a package whose provider.models hook is a function with the same id
(npm and the loader are still required).
Reviewed at head b44b3e1b68889c2a12bcaa37ad5d546a398bdde0, with main
|
||
|
|
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. |
||
|
|
e08e420581 |
check: accept quota-only providers without model transport (#654)
scripts/check.mjs accepts a provider that declares auth.usage, an empty
model map and no npm or api (a quota-only provider). Its loader is still
required, and a provider with models, npm or api is still checked as
before. Tests in scripts/check.test.mjs cover the accepted case, the three
incomplete configurations and a missing loader. (sunny0826, split out of
#653 as asked there.)
Run at the reviewed head bc57c1362e, rebased on main
|
||
|
|
eaca1cf4f1 |
check: parse registry.json and hold each entry to what magpie reads (#612)
bun scripts/check.mjs exited 0 on a registry.json that wasn't JSON, or
had an entry with a bogus kind, so a listing PR could break the Plugins
page's list and pass CI. check.mjs now checks registry.json first
(scripts/registry.mjs) and fails on:
- text that isn't JSON, isn't an object, or is over 1 MiB (what magpie
fetches); version not 1; plugins not a non-empty list;
- an entry whose package isn't a name magpie's pkgName pattern
(internal/plugin/store.go) matches, or over npm's 214 characters
(magpie drops such an entry); the same package listed twice;
- no name, no summary.en or summary.zh;
- a kind other than middleware, hooks, agent, tools or page (plugins.js's
kindOf; a provider has none), which would list it as a provider;
- a value of the wrong type for community, providers, replaces or
summary: market.go unmarshals the whole file into typed fields, so one
such value loses every listing; an icon with a scheme other than https
or data:image; a field magpie doesn't read (a typo like "kinds").
All 72 current entries pass, the 5 without community included (magpie
skips them; kept as they are).
Run on mote, HOME=$(mktemp -d), bun 1.4.2:
- bun test: 4709 pass, 12 skip, 0 fail (363 files).
- bun scripts/check.mjs: exit 0, ✓ registry.json.
Broken by hand on mote: "{" appended to registry.json -> exit 1, "not
JSON"; every "kind": "middleware" made "bogus" -> exit 1, each entry
named. registryProblems stubbed to return [] -> the three #612 tests go
red.
Open listing PRs (#611, #610) merged onto this commit pass the check;
#582 doesn't touch registry.json.
|
||
|
|
ea9201df1f |
mail-watch 0.1.0: mail session ends, failed turns and refusals through your own SMTP (#457)
mail-watch 0.1.0: a hooks plugin that mails a rendered event (per event or as a digest) when a session ends, a turn fails, or a request is refused, through the user's own SMTP server. The digest's due time is kept in the state file (digestAt/digestHours), so a restart neither resets nor fires it early; the timer step is capped at 2^31-1 ms and an early wake re-arms for the rest instead of sending. Run at the reviewed head 8415dd9eb (sandbox HOME): - mote: packages/mail-watch `bun test` 44 pass, 0 fail, three times; whole repo `bun test` 2982 pass, 8 skip, 0 fail; `bun scripts/check.mjs` exit 0; e2e.smoke.mjs against a local SMTP sink: onRequest returns undefined, onResponse returns without awaiting the mail, the mail arrives with the rendered event and subject. - Linux (WSL2 Ubuntu 24.04): packages/mail-watch `bun test` 44 pass, 0 fail. - Broken by hand, each red: no step cap (2 red: monthly digest, early wake), no due-time-ahead check (early wake), no persisted due time (restart test), no prune, raw guard, no shrink (1 red each). Making the persist write unconditional stayed green, as expected (a cost fix only). - CI at this head: test and on-npm green. Not tried: a real SMTP provider (Gmail, Fastmail); the smoke test uses a local sink. |
||
|
|
526c7853c3 |
page-chat 0.1.0: Magic_zero's chat page, with tests, a registry entry and check.mjs for a page's host part
Lists Magic_zero's (Magiczerowxy) magpie-chat as @magpie-community/page-chat:
a chat page in magpie's window over magpie's own gateway, models, MCP
servers, instructions and skills. Not a provider or a relay: it signs in
to nothing and every request goes through magpie's gateway.
- chat.test.mjs starts the service on a free port against a fake
gateway in a temp config folder: no token (Origin null and none), a
wrong token, another Origin and a rebound Host are refused and nothing
reaches the gateway; with the token a chat streams with the caller key;
the icon redirect has a Location; boot.js makes no request; app.js
sends the token.
- scripts/check.mjs takes the OpenCode v1 default export {id, server}
as magpie's host does, and doesn't start a page's server (it would bind
a port and write config); layerfs's tools are still checked.
- package.json declares the port option (3477) both parts read; boot.js's
comment says so instead of a fallback to 3478 that never existed.
- README in the repo's style with credit, what the service reads and
sends, who can use it, and the changes from the original.
- registry.json entry and a row in the Pages table.
Run on mote (bun 1.4.2) at this tree:
- cd packages/chat && HOME=$(mktemp -d) bun test: 11 pass.
- HOME=$(mktemp -d) bun test (whole repo): 3119 pass, 0 fail, 3127
tests across 261 files; bun scripts/check.mjs: exit 0, chat and
layerfs ok.
Broken by hand: with the token check off, "a page without the token
can't chat" went red; with the Host check off, "a DNS-rebound Host is
refused" went red.
Not tried: the page in a real magpie window (sandboxed frame navigation
and the host calling server()).
Co-authored-by: Magiczerowxy <magiczerowxy@users.noreply.github.com>
|
||
|
|
6188ab5be7 |
search1api 0.1.0: Search1API's six tools with API key or OAuth sign-in (#384)
Adds packages/search1api as @magpie-community/tools-search1api 0.1.0
(fatwang2, replacing #340). It has six tools: search, news, ask, crawl,
sitemap and trending. Sign-in is one account by API key or OAuth: PKCE
S256, dynamic client registration and a loopback callback. Tokens refresh
through auth.refresh and on a 401. scripts/check.mjs now accepts a tools
plugin with auth and no loader, as long as its config gives the provider
no npm and no models.
Run at 7cf6a5c merged onto main, in a sandbox HOME, with HTTPS_PROXY
pointed at a dead port:
- bun test packages/search1api scripts/check.test.mjs: 19 pass.
- node --test on the package's own tests: 16 pass.
- tests/host.integration.mjs against main magpie's host.js: 2 pass.
- bun test across the whole repo: 2647 pass, 0 fail. This needs
|
||
|
|
b93c9eca8c |
scripts: check tools-only plugins, skip pages and routings, run strategies.json
check.mjs now checks a plugin whose only hook is `tool`: each tool's name is one an MCP client takes, and it has a description, args and execute. It skips packages with magpie.gateway (routing strategies) and page-only packages (magpie.page with no main), whose own tests check them. middleware.mjs gains order() and checkStrategies(): a gateway plugin's strategy is asked for an order the way magpie's gateway asks it (internal/routes.Apply), falling back to the listed order on a throw or an answer that isn't a permutation, and strategies.json cases are run against it. Run: HOME=$(mktemp -d) bun test (1554 pass, 0 fail) and bun scripts/check.mjs (every package ok) at this tree with the three packages that follow. |
||
|
|
6e720301aa |
agent-aider 0.1.0: Aider as a magpie agent plugin, the first of the new agent kind (#78)
magpie (cb406c84) lets a plugin add an agent it has no setup of its own for. This one writes Aider's ~/.aider.conf.yml: the model under litellm's openai/ prefix, magpie's /v1 and Aider's own key. check.mjs skips agent packages as it does middleware; README gains an Agents section. Run: bun test packages/aider (2 pass); bun scripts/check.mjs; the module loaded through magpie's agentplug.Compile and its connect returned the three keys. The same module, in a sandbox magpie, wired a real aider 0.86.2 that answered from a real DeepSeek account, and Disconnect put the file back byte for byte. |
||
|
|
d9236e976f | middleware: param-override, model-map, system-prompt, word-guard and think-tags — gateway middleware that magpie runs on every agent's requests and replies, mostly New API's channel settings with the same JSON (the owner) — magpie can now run a plugin as gateway middleware (onRequest, onEvent, onResponse, in-process on moejs), and these are the first ones: param-override is New API's param_override (both forms, operations with gjson paths and conditions, return_error); model-map is model_mapping (chains, /regex/ keys with $1) and puts the asked-for name back into replies; system-prompt adds a prompt in each API's own place, keeping an agent's own unless override (New API's semantics), by agent or model; word-guard is the sensitive-word filter (reject or mask the user's text, optionally replies); think-tags strips a leading <think>…</think> from replies across stream chunks, or puts Chat reasoning_content into the text (thinking_to_content). Each is one file with no imports, named @magpie-community/middleware-<name>, with magpie.options as the example the app's editor starts from; registry.json lists them with "kind": "middleware" and no providers; check.mjs skips middleware-only packages. scripts/middleware.mjs calls the hooks as the gateway does (events split, [DONE] passed by) and runs each package's cases.json. Tested with a real DeepSeek account and real Claude Code through magpie's gateway: a mapped model named back in message_start, max_tokens capped, a system prompt appended for claude only, a word turned away as a 400 in Anthropic's shape, return_error as a 403 in Chat's, <think> stripped from Chat and Responses streams and an Anthropic whole reply, reasoning_content moved into the text. bun test (61 for these five) and bun scripts/check.mjs pass; packages/devin's two image tests fail on this machine only, as on main. Their first npm version has to be published by hand (trusted publishing can't create a package); until then magpie shows them as Coming soon. | ||
|
|
2578f471bb | Scaffold: conventions for OpenCode provider plugins of coding-plan subscriptions, a hook checker and a sandboxed magpie runner |