Skip to content

feat(pipeline): unified middleware pipeline & extensibility #51

Description

@espetro

Summary

Implement a unified middleware/plugin bus that makes the entire AgentPlugins pipeline customizable while keeping the core lean.

Goals

  1. Custom adaptersdefineConfig({ adapters: [myAdapter], targets: ['claude','my-harness'] }) without publishing
  2. Plugin bus — vite-style defineConfig({ plugins: [...] }) exposing lifecycle hooks (preValidate, transformIR, postEmit, …)
  3. 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

  1. feat(pipeline) — kernel package (no wiring)
  2. refactor(compile) — validate/lint/compile/write as middleware factories
  3. refactor(cli) — build path through app; drop getAdapterFactory switch
  4. refactor(core) — replace registry.ts; fix claude-only bug
  5. feat(contract) — widen TargetPlatform
  6. feat(core) — defineConfig API + config-loader shape detection
  7. feat(compile) — registerEmitter + mutable emitter registry
  8. refactor(security,store) — security as install-pipeline middleware
  9. docs — ARCHITECTURE.md, porting guide, adapters reference, example plugin

Plan: .agents/plans/2026-06-29-extensibility-middleware-pipeline.md

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions