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.
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.
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"`
}
Desc is what a module's agent export says.