Adds Reasonix 1.x (Desktop and CLI) to Plugins → Discover → Agents as `@magpie-community/agent-reasonix-desktop`, agent id `reasonix-desktop`, separate from magpie's built-in `reasonix` adapter (Studio 2.x and native 1.39). A JSON agent descriptor plus a Bun-host companion (the kimi-desktop pattern) adds one `magpie-agent` provider to Reasonix's global config.toml and keeps only the assigned gateway key in its .env, with a journal, a lock and byte-exact restore on disconnect. Review commit on the branch: the registry entry's icon was `reasonix`, a mask name with no icons/reasonix.svg, so Discover would show the generic mark; it is `reasonix-color` now. Run at the reviewed head 6cb328f090d8b66e6cf590a69aa4e7b18144c684 (mote): - packages/reasonix-desktop `bun test`: 12 pass, 0 fail. - acceptance.mjs with a real Reasonix 1.38.10 (npm) and a magpie built from origin/main 4ca55c6b6, sandbox HOME: magpie installs and discovers the plugin and bridges the selected model; unchanged Reasonix sends its selected model and assigned key to the local API; disconnect restores the original selection and credentials. - resident-acceptance.mjs (a running `magpie serve` follows the switch): passed. - vendor.mjs rebuilt from its pinned sources: byte-identical. - CI run 41773750085 on 6cb328f0: success. Not tried: Reasonix Desktop's GUI app itself (the CLI reads the same config files), Windows and Linux.
23 lines
894 B
JavaScript
23 lines
894 B
JavaScript
import { pathsFor, startBridge, syncBridge } from "./bridge.mjs"
|
|
|
|
const instance = Symbol.for("magpie.reasonix-desktop.bridge.v1")
|
|
|
|
// The Agent entry runs in moejs; this companion runs in the shared Bun host
|
|
// because current Magpie cannot edit TOML and a separate dotenv file there.
|
|
export default async function ReasonixDesktop() {
|
|
if (!globalThis[instance]) {
|
|
const paths = pathsFor()
|
|
const stop = startBridge(paths)
|
|
globalThis[instance] = { stop }
|
|
// Magpie restores the control JSON before closing the host on disable or
|
|
// removal. Flush it synchronously on normal exit, without taking over the
|
|
// shared host's signals or terminating other plugins.
|
|
process.once("exit", () => {
|
|
try { syncBridge(paths) } catch {
|
|
console.error("Reasonix bridge restoration paused; configuration and recovery files retained.")
|
|
}
|
|
})
|
|
}
|
|
return {}
|
|
}
|