diff --git a/README.md b/README.md index c02aade..733b30a 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,7 @@ it off puts the config back. | [opencodereview](packages/opencodereview) | [Open Code Review](https://github.com/alibaba/open-code-review) (`ocr`): `~/.opencodereview/config.json` as a custom Anthropic provider, so `ocr review` / `ocr scan` run on magpie's models | | [nowledge-mem-agent](packages/nowledge-mem-agent) | [Nowledge Mem / AI Now](https://mem.nowledge.co/): choose Default, AI Now and Background models through Magpie, with recovery journaling; separate from the Nowledge memory recall/capture gateway plugin | | [minimax-design](packages/minimax-design) | [MiniMax Design](https://design.minimax.io), the local multimodal creation studio: one custom-model entry in `%APPDATA%\@hilo\desktop\hub-config.json` whose model menu follows magpie's list; Windows only | +| [eta](packages/eta) | [Eta](https://github.com/Lingwcy/eta): connect-only local gateway integration; choose models and routing groups in Eta’s own picker after restarting. Requires Eta 0.1.164 or later | ```sh magpie plugin add @magpie-community/agent- diff --git a/packages/eta/LICENSE b/packages/eta/LICENSE new file mode 100644 index 0000000..02b3e70 --- /dev/null +++ b/packages/eta/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Eta contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/eta/README.md b/packages/eta/README.md new file mode 100644 index 0000000..b5c66ef --- /dev/null +++ b/packages/eta/README.md @@ -0,0 +1,50 @@ +# Magpie agent plugin for Eta + +![Eta](./icon.svg) + +Use Magpie's models and routing groups in Eta's existing model picker, without rebuilding Magpie or configuring an address or key in Eta. + +## Install and use + +Requires [Eta 0.1.164 or later](https://github.com/Lingwcy/eta/releases/tag/v0.1.164) and an official Magpie version supporting agent plugins (`magpie.agent`). Tested against the unmodified host at **v0.1.3233**; the earliest compatible release has not been established. + +1. Keep this plugin in a permanent folder. In Magpie's Plugins page, add its absolute folder path (not the individual module). This lets Magpie read the **Eta** display name, icon and bilingual summary from the package. Alternatively, run: + + ```sh + magpie plugin add /absolute/path/to/magpie-agent-eta + ``` + + In a checkout of the community plugins repository, the folder is `packages/eta`. No Node runtime, build step, source patch or external setup tool is needed. Local plugins reference their files in place: do not delete or move the installed folder. + + Once published and listed, the package is `@magpie-community/agent-eta`, displayed as **Eta** under Plugins → Discover → Agents. The community release workflow distributes it after review and merge. + + If you previously imported the standalone agent file alone, disconnect Eta and remove that single-file plugin entry before adding the package folder; do not install both at once. Standalone files still work, but the installed-plugin row cannot read their package name or summary and may show the filename instead. + +2. In Magpie's Agents page, connect **Eta** to Magpie and choose which models and routing groups Eta may see. Installing the plugin exposes the Eta entry even before Eta's first launch; it does not automatically connect it. +3. Keep Magpie running on the same computer. Fully quit and reopen Eta, then select a model from the **Magpie** group. Your current selection, direct providers and saved conversations are unchanged. + +After changing model visibility, restart Eta to reload its catalog. After changing the gateway port, reapply Eta's Magpie provider in Magpie before restarting Eta: the tested host does not automatically rewrite this plugin's gateway address on every port change. + +## Disconnect or remove + +Disconnect Eta on Magpie's Agents page, or disable/remove this plugin on its Plugins page, then restart Eta. Magpie restores the previous values of the integration keys and retains unrelated fields. If there were no previous values, it may leave an empty JSON object; Eta treats that as disconnected. Re-enabling the plugin does not silently reconnect Eta: connect it again in Magpie. + +The host identifies ownership by the gateway key. Replacing the key yourself makes the connection yours and prevents automatic restoration. Changes to Magpie-managed fields while retaining its key may be overwritten by synchronization or restoration; keep custom settings outside those fields. Existing Eta credentials are never edited. + +## Configuration and limits + +Magpie writes `~/.config/eta/magpie.json` on all platforms. Eta prefers this stable plugin path; only when it is absent does it read the older `$XDG_CONFIG_HOME/eta/magpie.json` location. Do not delete the restored object if you still have an old XDG configuration you do not want to reactivate. + +The versioned contract is: + +```json +{ "version": 1, "baseUrl": "http://127.0.0.1:3425", "apiKey": "magpie-eta" } +``` + +The address and key are examples; the plugin uses Magpie's configured origin and Eta-scoped gateway key. Eta fetches the visible catalog from `/v1/models` rather than copying model lists into this file, and calls OpenAI Chat Completions through Magpie. Route IDs stay intact. + +Only same-machine HTTP loopback gateways are supported, not remote gateways or WSL routing. A missing/unavailable Magpie does not silently switch Eta to a direct provider. This plugin does not configure remote Bots. Native desktop interaction and paid upstream model acceptance are not covered by the package tests. + +## License + +MIT. diff --git a/packages/eta/eta.agent.js b/packages/eta/eta.agent.js new file mode 100644 index 0000000..13a32e5 --- /dev/null +++ b/packages/eta/eta.agent.js @@ -0,0 +1,28 @@ +// Agent plugins run in Magpie's embedded JS engine, without Node or filesystem access. +export const agent = { + id: "eta", + name: "Eta", + // Embed Eta’s shipped favicon so both Agents and installed plugins work offline. + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHJvbGU9ImltZyIgYXJpYS1sYWJlbD0iRXRhIj4KICA8cmVjdCB4PSI2NCIgeT0iNjQiIHdpZHRoPSI4OTYiIGhlaWdodD0iODk2IiByeD0iMjAwIiBmaWxsPSIjMTcxNzE3Ii8+CiAgPHBhdGggZD0iTTM0Ni4wNDMgMzMwLjczOUwzMzYuMDM2IDMxOC42NDZRNDExLjUwOSAyMzQuMDAwIDQ1MC4yODcgMjM0LjAwMFE0ODcuMzk4IDIzNC4wMDAgNDg3LjM5OCAyNzUuMjgxUTQ4Ny4zOTggMjg3LjM3MyA0NzYuNTU3IDMyMy4yMzNMNDQ2LjUzNSA0MjYuNjQzUTUxNy40MjEgMzE5Ljg5NyA1NjIuMjQ2IDI3Ni45NDlRNjA3LjA3MSAyMzQuMDAwIDY0NS44NTAgMjM0LjAwMFE2OTMuODAyIDIzNC4wMDAgNjkzLjgwMiAyODcuNzkwUTY5My44MDIgMzA2LjEzNyA2ODQuNjI4IDMzOS45MTJMNjA5LjE1NiA2MTMuODY2UTU4Mi4wNTIgNzEyLjI3MyA1ODIuMDUyIDc2OS44MTVRNTgyLjA1MiA3ODEuNDkxIDU4My4zMDMgNzk0LjAwMEw1MjEuNTkwIDc5NC4wMDBRNTE5LjA4OSA3NzcuMzIxIDUxOS4wODkgNzYzLjE0NFE1MTkuMDg5IDcwOC4xMDMgNTQ1Ljc3NSA2MTIuNjE1TDYyMC40MTQgMzQ0LjA4MlE2MjcuNTAzIDMxOC42NDYgNjI3LjUwMyAzMDUuNzIwUTYyNy41MDMgMjgxLjk1MiA2MDguMzIyIDI4MS45NTJRNTgxLjIxOCAyODEuOTUyIDUyMi40MjQgMzUyLjYzMFE0NjMuNjMxIDQyMy4zMDggNDE2LjA5NSA1MzQuNjQwTDM5Mi4zMjggNjExLjM2NEwzMzAuMTk4IDYxMS4zNjRMNDE2LjkyOSAzMTYuMTQ0UTQyMS4wOTkgMzAyLjM4NCA0MjEuMDk5IDI5NS43MTNRNDIxLjA5OSAyNzkuMDM0IDQwOC41OTAgMjc5LjAzNFEzOTMuMTYyIDI3OS4wMzQgMzQ2LjA0MyAzMzAuNzM5WiIgZmlsbD0iI2ZmZmZmZiIvPgo8L3N2Zz4=", + config: "~/.config/eta/magpie.json", + format: "json", + // Installing this opt-in plugin makes Eta available even before its first launch. + dir: "~", + ua: ["eta", "eta-desktop"], + notice: + "Restart Eta, then choose a model from its Magpie group. 重启 Eta 后,在模型选择器的 Magpie 类目中选择模型。", +}; + +// No model/startup field: Eta owns model selection; Magpie exposes its model-list controls. +export function connect({ gateway }) { + if ( + !gateway || + typeof gateway.url !== "string" || + !/^http:\/\/(?:localhost|127(?:\.\d{1,3}){3}|\[::1\])(?::\d{1,5})?\/?$/.test(gateway.url) || + typeof gateway.key !== "string" || + !/^[A-Za-z0-9._~+/-]+=*$/.test(gateway.key) + ) { + throw new Error("Eta requires a local HTTP Magpie gateway and a valid gateway key"); + } + return { version: 1, baseUrl: gateway.url.replace(/\/$/, ""), apiKey: gateway.key }; +} diff --git a/packages/eta/eta.test.mjs b/packages/eta/eta.test.mjs new file mode 100644 index 0000000..78161e8 --- /dev/null +++ b/packages/eta/eta.test.mjs @@ -0,0 +1,67 @@ +import { expect, test } from "bun:test"; +import { agent, connect } from "./eta.agent.js"; + +const pkg = await Bun.file(new URL("./package.json", import.meta.url)).json(); + +test("writes only the local gateway origin and Eta-scoped key; Eta owns model selection", () => { + for (const url of ["http://127.0.0.1:3425", "http://localhost:3425/", "http://[::1]:3425/"]) { + expect( + connect({ + gateway: { url, v1: url + "/v1", key: "magpie-eta" }, + models: [{ id: "route/group" }, { id: "vendor/model" }], + }), + ).toEqual({ version: 1, baseUrl: url.replace(/\/$/, ""), apiKey: "magpie-eta" }); + } +}); + +test("rejects remote gateways and malformed keys without echoing credentials", () => { + for (const url of [ + "https://127.0.0.1:3425", + "http://example.com", + "http://127.0.0.1:3425/v1", + "http://localhost.evil:3425", + "http://user@localhost:3425", + ]) { + expect(() => connect({ gateway: { url, key: "private-key" } })).toThrow( + "Eta requires a local HTTP Magpie gateway and a valid gateway key", + ); + } + for (const key of ["", "secret key", "private\r\nvalue", null]) { + expect(() => connect({ gateway: { url: "http://127.0.0.1:3425", key } })).toThrow(); + } +}); + +test("uses the same offline Eta artwork for agent and installed-package discovery", async () => { + const icon = await Bun.file(new URL("./icon.svg", import.meta.url)).text(); + const dataUri = "data:image/svg+xml;base64," + Buffer.from(icon).toString("base64"); + expect(agent.icon).toBe(dataUri); + expect(pkg.magpie.icon).toBe(dataUri); + expect(pkg.magpie.name).toBe("Eta"); + expect(pkg.name).toBe("@magpie-community/agent-eta"); + expect(pkg.magpie.summary.en).toBeTruthy(); + expect(pkg.magpie.summary.zh).toBeTruthy(); + // A pure agent must not be sent to the separate Bun/provider host. + expect(pkg.main).toBeUndefined(); + expect(pkg.exports).toBeUndefined(); +}); + +test("the installed package contains the descriptor, artwork and instructions", async () => { + for (const path of [pkg.magpie.agent.replace(/^\.\//, ""), "icon.svg", "README.md", "LICENSE"]) { + expect(pkg.files).toContain(path); + expect(await Bun.file(new URL(path, import.meta.url)).exists()).toBe(true); + } + expect(agent.config).toBe("~/.config/eta/magpie.json"); + expect(agent.model).toBeUndefined(); + expect(agent.startup).toBeUndefined(); +}); + +test("the market lists Eta as an agent with the package's name, artwork and summaries", async () => { + const registry = await Bun.file(new URL("../../registry.json", import.meta.url)).json() + const entries = registry.plugins.filter((entry) => entry.package === pkg.name) + expect(entries).toHaveLength(1) + expect(entries[0].kind).toBe("agent") + expect(entries[0].providers).toBeUndefined() + for (const key of ["name", "icon", "summary"]) { + expect(entries[0][key]).toEqual(pkg.magpie[key]) + } +}) diff --git a/packages/eta/icon.svg b/packages/eta/icon.svg new file mode 100644 index 0000000..a64097a --- /dev/null +++ b/packages/eta/icon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/packages/eta/package.json b/packages/eta/package.json new file mode 100644 index 0000000..4431d29 --- /dev/null +++ b/packages/eta/package.json @@ -0,0 +1,36 @@ +{ + "name": "@magpie-community/agent-eta", + "version": "0.1.0", + "description": "Connect Eta to Magpie's agent-scoped model catalog", + "keywords": [ + "eta", + "magpie-agent", + "magpie-plugin" + ], + "homepage": "https://github.com/Lingwcy/eta", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/magpie-community/plugins.git", + "directory": "packages/eta" + }, + "files": [ + "eta.agent.js", + "icon.svg", + "README.md", + "LICENSE" + ], + "type": "module", + "scripts": { + "test": "bun test eta.test.mjs" + }, + "magpie": { + "agent": "./eta.agent.js", + "name": "Eta", + "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHJvbGU9ImltZyIgYXJpYS1sYWJlbD0iRXRhIj4KICA8cmVjdCB4PSI2NCIgeT0iNjQiIHdpZHRoPSI4OTYiIGhlaWdodD0iODk2IiByeD0iMjAwIiBmaWxsPSIjMTcxNzE3Ii8+CiAgPHBhdGggZD0iTTM0Ni4wNDMgMzMwLjczOUwzMzYuMDM2IDMxOC42NDZRNDExLjUwOSAyMzQuMDAwIDQ1MC4yODcgMjM0LjAwMFE0ODcuMzk4IDIzNC4wMDAgNDg3LjM5OCAyNzUuMjgxUTQ4Ny4zOTggMjg3LjM3MyA0NzYuNTU3IDMyMy4yMzNMNDQ2LjUzNSA0MjYuNjQzUTUxNy40MjEgMzE5Ljg5NyA1NjIuMjQ2IDI3Ni45NDlRNjA3LjA3MSAyMzQuMDAwIDY0NS44NTAgMjM0LjAwMFE2OTMuODAyIDIzNC4wMDAgNjkzLjgwMiAyODcuNzkwUTY5My44MDIgMzA2LjEzNyA2ODQuNjI4IDMzOS45MTJMNjA5LjE1NiA2MTMuODY2UTU4Mi4wNTIgNzEyLjI3MyA1ODIuMDUyIDc2OS44MTVRNTgyLjA1MiA3ODEuNDkxIDU4My4zMDMgNzk0LjAwMEw1MjEuNTkwIDc5NC4wMDBRNTE5LjA4OSA3NzcuMzIxIDUxOS4wODkgNzYzLjE0NFE1MTkuMDg5IDcwOC4xMDMgNTQ1Ljc3NSA2MTIuNjE1TDYyMC40MTQgMzQ0LjA4MlE2MjcuNTAzIDMxOC42NDYgNjI3LjUwMyAzMDUuNzIwUTYyNy41MDMgMjgxLjk1MiA2MDguMzIyIDI4MS45NTJRNTgxLjIxOCAyODEuOTUyIDUyMi40MjQgMzUyLjYzMFE0NjMuNjMxIDQyMy4zMDggNDE2LjA5NSA1MzQuNjQwTDM5Mi4zMjggNjExLjM2NEwzMzAuMTk4IDYxMS4zNjRMNDE2LjkyOSAzMTYuMTQ0UTQyMS4wOTkgMzAyLjM4NCA0MjEuMDk5IDI5NS43MTNRNDIxLjA5OSAyNzkuMDM0IDQwOC41OTAgMjc5LjAzNFEzOTMuMTYyIDI3OS4wMzQgMzQ2LjA0MyAzMzAuNzM5WiIgZmlsbD0iI2ZmZmZmZiIvPgo8L3N2Zz4=", + "summary": { + "en": "Use Magpie models and routing groups in Eta’s own model picker. Requires Eta 0.1.164 or later; restart Eta after connecting.", + "zh": "在 Eta 自带的模型选择器中使用 Magpie 模型与路由组。需要 Eta 0.1.164 或更新版本;连接后重启 Eta。" + } + } +} diff --git a/registry.json b/registry.json index 02ba0d3..84dd9b7 100644 --- a/registry.json +++ b/registry.json @@ -165,6 +165,8 @@ "summary": { "en": "CiteBox on magpie's Agents page: pick one of magpie's models for its text AI, set reasoning effort in Settings, and switch it off to put its config back. Needs CiteBox 0.38.0 or later.", "zh": "把 CiteBox 加到 magpie 的 Agent 页:给它的文本 AI 选 magpie 的模型,在设置里调整思考强度,关掉即恢复原来的配置。需要 CiteBox 0.38.0 或更新版本。" } }, { "package": "@hoptoper/magpie-agent-wisp-science", "name": "Wisp Science", "kind": "agent", "summary": { "en": "Wisp Science on magpie's Agents page: pick one of magpie's models, set reasoning effort in the composer, and switch it off to put its config back. Needs Wisp Science 1.23.0 or later.", "zh": "把 Wisp Science 加到 magpie 的 Agent 页:选择 magpie 的模型,在输入框里设置思考强度,关掉即恢复原来的配置。需要 Wisp Science 1.23.0 或更新版本。" } }, + { "package": "@magpie-community/agent-eta", "name": "Eta", "kind": "agent", "community": true, "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHJvbGU9ImltZy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TAgMjc5LjAzNFEzOTMuMTYyIDI3OS4wMzQgMzQ2LjA0MyAzMzAuNzM5WiIgZmlsbD0iI2ZmZmZmZiIvPgo8L3N2Zz4=", + "summary": { "en": "Use Magpie models and routing groups in Eta’s own model picker. Requires Eta 0.1.164 or later; restart Eta after connecting.", "zh": "在 Eta 自带的模型选择器中使用 Magpie 模型与路由组。需要 Eta 0.1.164 或更新版本;连接后重启 Eta。" } }, { "package": "@magpie-community/tools-goanyapi", "name": "GoAnyAPI", "kind": "tools", "community": true, "summary": { "en": "Explore Google Trends, website traffic, domain rating (DR), keyword suggestions, SERPs, backlinks, and ads statistics for market, keyword, and competitor research.", "zh": "查询 Google 趋势、网站流量、域名权重(DR)、关键词建议、SERP、外链和广告统计,辅助市场、关键词与竞品研究。" } }, {