Documentation
¶
Overview ¶
Package agentplug runs the agents plugins add: a module, named by a plugin's package.json magpie.agent, that says where an agent magpie has no wiring of its own keeps its model, and what else to write there for it to use magpie's gateway. internal/agent makes each one an Agent.
A module exports
export const agent = {
id: "aider", name: "Aider",
config: "~/.aider.conf.yml", // the file magpie edits
model: "model", // the key path of the model in it
prefix: "openai/", // what the agent wants before the id
}
export function connect({ gateway, model, models }) {
return { "openai-api-base": gateway.v1, "openai-api-key": gateway.key }
}
and it runs in moejs in magpie's own process, as gateway middleware does: there is no Node here, so a package it imports is bundled into it.
The agent export may also say where its agent reads what magpie's Library gives (internal/library): an instructions file, an MCP file in one of MCPFormats, and a skills folder; each is optional.
library: {
instructions: "~/.aider/AGENTS.md",
mcp: "~/.aider/mcp.json", mcpFormat: "claude",
skills: "~/.aider/skills",
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Formats = map[string]string{
".json": "json", ".jsonc": "json",
".yaml": "yaml", ".yml": "yaml",
".env": "env",
}
Formats are the config files an agent plugin's file may be, by the name its agent.format gives or its extension says.
var MCPFormats = []string{
"alma", "antigravity", "claude", "cline", "codex", "commandcode", "copilot",
"crush", "cursor", "devin", "gemini", "goose", "grok", "hermes", "kimi",
"omp", "opencode", "zed",
}
MCPFormats are the MCP files an agent plugin's agent may keep, each named for the agent whose file it is written as: "claude" is {"mcpServers": {name: {type, command, args, env, url, headers}}}.
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
Spec string // the plugin's spec in plugins.json
File string
Desc Desc
// contains filtered or unexported fields
}
Agent is one plugin's agent, compiled.
func Compile ¶
Compile compiles the agent module in file, of the plugin spec, and checks what its agent export says.
type Desc ¶
type Desc struct {
ID string `json:"id"`
Name string `json:"name"`
Config string `json:"config"`
Format string `json:"format"`
Model string `json:"model"`
Prefix string `json:"prefix"`
Bin string `json:"bin"`
Dir string `json:"dir"`
UA []string `json:"ua"`
Icon string `json:"icon"`
// Notice is advice shown after a change, as a built-in agent's is
// (an agent that reads its config at start-up needs a restart)
Notice string `json:"notice"`
// Library is where the agent reads the Library's instructions, MCP
// servers and skills
Library Places `json:"library"`
}
Desc is what a module's agent export says.
type Places ¶ added in v0.1.1178
type Places struct {
Instructions string `json:"instructions"`
MCP string `json:"mcp"`
// MCPFormat is how its MCP file lists servers: one of MCPFormats
MCPFormat string `json:"mcpFormat"`
Skills string `json:"skills"`
}
Places are where an agent reads what the Library gives it, each a path as Config is (~ and $VAR expanded); an empty one is a thing it isn't given.