Summary
Implement a unified middleware/plugin bus that makes the entire AgentPlugins pipeline customizable while keeping the core lean.
Goals
- Custom adapters —
defineConfig({ adapters: [myAdapter], targets: ['claude','my-harness'] }) without publishing
- Plugin bus — vite-style
defineConfig({ plugins: [...] }) exposing lifecycle hooks (preValidate, transformIR, postEmit, …)
- Security as middleware — fold security/audit into a transparent, reorderable middleware chain (on by default, removable)
Architecture
- New
@agentplugins/pipeline kernel: Plugin, Middleware, contexts, createApp/runBuild/runInstall
- Adapters become
Plugin objects with an adapter field; registry = plugin set
TargetPlatform widened to z.string() branded; custom targets allowed
defineConfig in @agentplugins/core for power users; backward-compatible with bare manifests
- Mutable emitter registry (
registerEmitter)
Phases
feat(pipeline) — kernel package (no wiring)
refactor(compile) — validate/lint/compile/write as middleware factories
refactor(cli) — build path through app; drop getAdapterFactory switch
refactor(core) — replace registry.ts; fix claude-only bug
feat(contract) — widen TargetPlatform
feat(core) — defineConfig API + config-loader shape detection
feat(compile) — registerEmitter + mutable emitter registry
refactor(security,store) — security as install-pipeline middleware
docs — ARCHITECTURE.md, porting guide, adapters reference, example plugin
Plan: .agents/plans/2026-06-29-extensibility-middleware-pipeline.md
Summary
Implement a unified middleware/plugin bus that makes the entire AgentPlugins pipeline customizable while keeping the core lean.
Goals
defineConfig({ adapters: [myAdapter], targets: ['claude','my-harness'] })without publishingdefineConfig({ plugins: [...] })exposing lifecycle hooks (preValidate,transformIR,postEmit, …)Architecture
@agentplugins/pipelinekernel:Plugin,Middleware, contexts,createApp/runBuild/runInstallPluginobjects with anadapterfield; registry = plugin setTargetPlatformwidened toz.string()branded; custom targets alloweddefineConfigin@agentplugins/corefor power users; backward-compatible with bare manifestsregisterEmitter)Phases
feat(pipeline)— kernel package (no wiring)refactor(compile)— validate/lint/compile/write as middleware factoriesrefactor(cli)— build path through app; drop getAdapterFactory switchrefactor(core)— replace registry.ts; fix claude-only bugfeat(contract)— widen TargetPlatformfeat(core)— defineConfig API + config-loader shape detectionfeat(compile)— registerEmitter + mutable emitter registryrefactor(security,store)— security as install-pipeline middlewaredocs— ARCHITECTURE.md, porting guide, adapters reference, example pluginPlan:
.agents/plans/2026-06-29-extensibility-middleware-pipeline.md