Files
SivanColaandSivanCola 8768126af3 deepzora 0.1.0: Deepzora as a magpie agent through a reversible TOML bridge (#1043)
Adds @magpie-community/agent-deepzora: Deepzora on magpie's Agents page, through a reversible bridge that adds a magpie-agent provider to ~/.deepzora/config.toml and the key to ~/.deepzora/.env, and puts both back on disconnect. The package is reasonix-desktop's bridge with Deepzora's names; vendor.mjs is byte for byte the merged reasonix-desktop copy (sha256 46e08060…).

Run at the reviewed head 858f09aa, on a separate test Mac, Bun 1.4.2 and Node 22.22.0, temp HOME:
- bun test packages/deepzora: 12 pass; node --test: 12 pass
- bun scripts/check.mjs: ok; npm pack --dry-run: 13 files, 57.0 kB
- a probe over the bridge in temp dirs (corrupt and half-written TOML, user edits across a switch and a disconnect, pre-existing keys in four forms, CRLF, read-only dir, 0-byte config): each as expected
- full root bun test at 858f09aa: 8482 pass, 20 skip, 0 fail

Broken by hand: 17 breaks, 13 red. Four stay green (an edited credential on switch, a half-written control file read as disconnect, no provider_access cleanup, no lock), the same gaps reasonix-desktop's tests have; listed in the review.

Not tried: a real Deepzora binary or session, acceptance.mjs and resident-acceptance.mjs, Windows (Deepzora uses %APPDATA%\deepzora there; the descriptor has no per-OS paths), a Deepzora Desktop settings save while connected.

The first npm publish of @magpie-community/agent-deepzora is the maintainer's.

Co-authored-by: SivanCola <SivanCola@users.noreply.github.com>
2026-11-12 16:27:26 +08:00

23 lines
891 B
JavaScript

import { pathsFor, startBridge, syncBridge } from "./bridge.mjs"
const instance = Symbol.for("magpie.deepzora.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 DeepzoraBridgePlugin() {
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("Deepzora bridge restoration paused; configuration and recovery files retained.")
}
})
}
return {}
}