Adds `@magpie-community/agent-zycode` 0.1.0: zycode (`zypi`, the VS Code extension, the ACP agent) on magpie's Agents page. magpie writes the model, gateway URL and key to `~/.pi-python/local.env`. A host part (`bridge.mjs`) copies them into the `[model]` table of `agent.toml` as text, and puts the file back byte for byte on disconnect, keeping any edits the user made meanwhile. Reviewed at 618771e7c9269c8248599f05cd86eb18e00c358f: - WSL Ubuntu 24.04, Bun 1.4.2: `bun test` in packages/zycode 20 pass; `bun scripts/check.mjs zycode` exit 0. - Broken by hand: disconnect leaving agent.toml as is (`const back = current`) turns 9 of 20 red. - No network and no child processes; local files only, temp-and-rename, symlinks refused. - Real run by the author (Ubuntu VM, zypi 0.9.1, magpie v0.1.4069): only the four [model] lines changed; one turn answered through magpie (Usage shows zycode, 4 calls); after disconnect, agent.toml and local.env have identical sha256. Not tried: Windows, macOS, the VS Code extension's frozen agent binary. Co-authored-by: zy1233 <zy1233@users.noreply.github.com>
22 lines
711 B
JavaScript
22 lines
711 B
JavaScript
// zycode (https://github.com/zy1233/pi-python) reads its model from the
|
|
// [model] table of ~/.pi-python/agent.toml, and its keys from
|
|
// ~/.pi-python/local.env. magpie cannot edit TOML, so magpie writes the
|
|
// three values to local.env, where it can, and index.mjs puts them into
|
|
// the [model] table (see bridge.mjs).
|
|
export const agent = {
|
|
id: "zycode",
|
|
name: "zycode",
|
|
bin: "zypi",
|
|
dir: "~/.pi-python",
|
|
config: "~/.pi-python/local.env",
|
|
model: "MAGPIE_ZYCODE_MODEL",
|
|
notice: "zycode reads its settings when it starts: restart it to use the new model.",
|
|
}
|
|
|
|
export function connect({ gateway }) {
|
|
return {
|
|
MAGPIE_ZYCODE_API_KEY: gateway.key,
|
|
MAGPIE_ZYCODE_BASE_URL: gateway.v1,
|
|
}
|
|
}
|