Files
plugins/packages/bub/bub.agent.js
T
GabiandGabyran 51f179057b agent-bub 0.1.0: Bub as a magpie agent plugin (#81)
Adds packages/bub: Bub (bub.build) as a magpie agent plugin. It writes
~/.bub/config.yml with the model as magpie:<provider>/<model> and a
providers.magpie entry (type openai, magpie's /v1, Bub's own key), and
puts the file back when one of Bub's own models is picked or it is turned
off. Needs Bub 0.5.1 or later (bubbuild/bub#343). Plus its row in the
README's Agents table, which is now in alphabetical order.

Reviewed at 4b879fb (2026-10-11), with a real Bub 0.5.1 run against a
sandbox magpie. Since then only merges of main; the PR's own diff from the
merge base is the five files above, packages/bub unchanged since 4b879fb.
It waited only for a first npm publish, which the repo no longer requires
(README: a new plugin merges once its review is done; served from dist).

Run on mote at the merged tree (origin/main 202ec68 + head 13058fe92),
Bun 1.4.2: bun test packages/bub 7 pass; bun scripts/check.mjs all ok;
whole bun test with a temp HOME and TMPDIR 2949 pass, 8 skip, 0 fail.

Co-authored-by: Gabyran <Gabyran@users.noreply.github.com>
2026-10-28 12:31:02 +08:00

18 lines
665 B
JavaScript

export const agent = {
id: "bub",
name: "Bub",
bin: "bub",
dir: "~/.bub",
config: "~/.bub/config.yml",
model: "model",
prefix: "magpie:",
notice: "Bub reads its settings at start-up: restart bub gateway and open bub chat sessions to use the new model. This needs Bub 0.5.1 or later (uv tool install --reinstall bub); an older Bub fails every turn on a magpie: model.",
}
export function connect({ gateway }) {
const provider = { type: "openai", api_base: gateway.v1, api_key: gateway.key }
const out = { "providers.magpie": provider }
for (const [key, value] of Object.entries(provider)) out[`providers.magpie.${key}`] = value
return out
}