Repository navigation
Add PinK agent plugin to registry - #514
Conversation
|
Thanks for this. PinK on the Agents page is welcome, and the package does its job well. I reviewed it at 78185d2 and am holding the merge for one problem. What I checked
The problem: the worker outlives magpie
if (enabled === false) break;
if (enabled === void 0 && !processAlive(next.parentPid)) break;So while the plugin is on and magpie quits, the worker keeps running. It re-reads The fix looks small. if (enabled === false || !processAlive(next.parentPid)) break;I tried that one line in my run. The worker was gone 5 s after the host exited, and connect, switch and disconnect all behaved as before. Please publish that as 0.1.1, along with a test that the worker exits once its host's pid is gone while the plugin is on. Then update this PR, or just comment, and I'll run it again and merge. A minor note, not blocking: the README's install steps say to download a release tgz and use |
|
Fixed the issue raised in this review and published magpie-plugin-pink@0.1.1. The fix commit and GitHub release are available for review.
Validation: type checking and all 29 unit tests pass. The lifecycle regression check keeps the plugin enabled, terminates its last host, and requires both lease cleanup and worker process exit within five seconds. It also covers two-host takeover, absence of a restart loop, generation handoff, offline restore, and normal disconnect restoration. I installed 0.1.1 from npm and tested it with official Magpie 0.1.2183 under an isolated HOME: connection, model switching, shutdown/restart reconciliation, disable/re-enable/removal, and gateway usage attribution with a mock upstream. One behavior boundary is now explicit: without a persistent host, a standalone magpie pink command does not necessarily load the plugin. The old version relied on its persistent worker for those operations. In 0.1.1, automatic synchronization requires the Magpie desktop app or gateway service to be running with the plugin loaded. Offline CLI model selection or disconnection is reconciled when the plugin next loads; before disabling or uninstalling offline, run restore first. This is documented and tested separately from operations performed while Magpie is running. Real PinK chat remains unverified. The registry entry uses an unpinned package name, so no registry.json change is needed for this release. The PR description now references 0.1.1 for retesting. |
yetone
left a comment
There was a problem hiding this comment.
Thanks, YuchenWell. 0.1.1 fixes the worker lifecycle, and I'm merging the entry.
What I checked
-
The package. I downloaded
magpie-plugin-pink@0.1.1from registry.npmjs.org into an empty folder. Its sha512 matches the registry'sdist.integrity(sha512-7orjsdh1…Iyng==). Next to 0.1.0,cli.mjsandpink.agent.mjsare byte for byte the same.package.jsonchanges only its version and how the keywords are laid out, and there is still no install script. Two files change:worker.mjs: the loop now exits oncenext.parentPidis gone, whateverenabledis. A generation hand-off starts a new worker only while the new host is alive.index.mjs:ensureWorkerrewriteslaunch.json, with the live host's pid, before it starts a worker.
Neither change adds a network call, a new path or encoded code. The README puts npm first, as suggested.
-
The registry entry. Your entry names the package without a version, so magpie installs the newest one and the entry doesn't need to change for 0.1.1. The icon URL still serves the same PNG I checked last time (same SHA-1). On current main (848497c) the entry is unique, and the other 61 are unchanged.
-
The lifecycle, run again. I used the same harness as last time (macOS, sandbox HOME, a mock PinK
Userfolder, network refused) and calleddefault.serverthe way magpie's plugin host does:- Connect, switch to another model, disconnect (both files given back byte for byte), and a manual edit kept on disconnect all behave as in 0.1.0.
- When the host exits with the plugin still on, the worker is gone within 1 s. On 0.1.0 it was still alive 5 s later, reparented to launchd.
- A second host start spawns a fresh worker, and that worker exits with its host too.
- With the host still up, turning the plugin off stops the worker within 3 s.
- Two hosts: a long-lived host A, then a short-lived host B that exits after 2 s. A worker was alive under A for the whole run after B left. Once A exited no worker was left, and
pgrepfound no strayworker.mjs.
-
The repo suite on a local merge of 78185d2 into main 848497c:
HOME=$(mktemp -d) bun testgives 3808 pass, 8 skip, 0 fail. Inbun scripts/check.mjsthe only ✗ is cloudflare-workers-ai, the known #519 when there is no network.
Not tried: real PinK chat (as you say, it needs a PinK sign-in), and a run inside a real magpie app rather than a harness that calls default.server.
List PinK as an independently maintained Agent plugin, installed from magpie-plugin-pink@0.1.1. Source: https://github.com/YuchenWell/magpie-plugin-pink (MIT).
The plugin adds PinK to Magpie's native Agents page. A bundled Bun worker synchronizes model selection and the model catalog into PinK's Custom Endpoint configuration, including Profile inheritance. Requests through Magpie are attributed to PinK in Usage. While Magpie is running, disconnecting, disabling or removing the plugin restores managed configuration while preserving manual edits. The worker exits when its host is gone; an active host can take over after a transient CLI host exits. Offline CLI changes are applied on the next host startup, and offline disable/removal requires the documented restore command first.
This change adds only the registry entry, with the display name PinK, an icon and English/Chinese summaries. The package is maintained in its own repository. Requires Magpie 0.1.2136 or later.
Validation: