Commit Graph
1 Commits
Author SHA1 Message Date
yetone 26816de2f9 library, agentplug: an agent a plugin adds is given the Library's instructions, MCP servers and skills where its agent.library says (AlmarionAI on X)
Agent plugins wired models and keys only: library.targetOf had no case
for them, so the Library's instructions, MCP servers and skills never
reached an agent a plugin adds, while the announcement said the
Library carries over.

An agent export can now say
  library: { instructions, mcp, mcpFormat, skills }
each a path (~ and $VAR expanded, as config is). mcpFormat names the
agent whose MCP file it is shaped like (agentplug.MCPFormats: claude,
codex, gemini, opencode, cursor, zed, ... 18 of the library's
mcpFormats). A format outside the list, or an mcp without one, keeps
the plugin from loading. library.pluginTarget makes such an agent a
Target, so it is written as any agent is: magpie's marker block in the
instructions file, servers merged beside the user's own (their fields
kept), skills linked or copied, Applied recording only magpie's part,
backups kept. Takes refuses a place the plugin doesn't name, and says
which agent.library key would give it.

Docs: docs/subsystems/library.md and agent-wiring.md; plugins.html
(en, zh, ja) gets the library field and what magpie does with it.

Run:
- internal/library/agent_plugin_test.go: TestPluginAgentGetsTheLibrary,
  TestPluginAgentWithoutAPlaceIsRefused, TestPluginAgentMCPFormat,
  TestPluginMCPFormatsAreWritten. With targetOf's plugin case and the
  check() validation taken out by hand, the first three go red.
- e2e: a nogui build in a scratchpad HOME (env -i, no live configs),
  `magpie plugin add` of a throwaway toy agent plugin; `library
  instructions set/agents`, `library mcp add/rm` wrote and took back
  only magpie's block and server, the user's "mine" server, its "note"
  field and other keys kept, backups made; with mcp dropped from the
  plugin, `library mcp add ... agents=toy` is refused naming
  agent.library.mcp.
- go test -tags nogui ./... (one unrelated FIFO flake in internal/agent,
  fixed in the commit before), gofmt -l clean, go vet for GOOS=linux
  and GOOS=windows clean. No GUI code changed.
2026-10-11 07:55:23 +08:00