Skip to content

[Tracking] Make third-party adapters and providers buildable from the published package #43

Open

Description

@SergeevDmitry

Context & Rationale

ProtocolName and PaymentMethodName are closed unions in the frozen contract, and docs/contributing-adapters.md tells an author to add a name to them inside this repository. Rail-specific challenge and proof handling also sits outside the providers: in src/gateway/routes.ts (HTTP headers and error bodies), src/core/domain/wire.ts (_payment) and src/protocols/mcp/adapter.ts (the MCP _meta proof). A third-party protocol or rail needs a fork.

Widening these unions would break consumers' exhaustive checks, so they cannot open in a 2.x minor. Do the internal work in 2.12.0 and widen the types in 3.0.0.

Each checkbox tracks a separate PR.

Proposed Changes

  • Move each rail's challenge and proof handling into its provider
    • The HTTP routes, the _payment field and the MCP adapter call the provider instead of branching on the rail's name.
  • Let each plugin bring its own config block and schema
  • 3.0.0: open ProtocolName and PaymentMethodName to registered names
    • With collision checks, and undeclared names rejected at config validation.
  • 3.0.0: rewrite docs/contributing-adapters.md for registration, and build its example adapter and provider from the packed package in CI

Non-goals / Invariants Preserved

  • No new member of either union in 2.x. A new protocol or rail waits for 3.x.
  • Wire formats do not change in 2.12.0: the same headers, _meta keys, _payment forms and error bodies.
  • Optional peers stay out of the main entry's and the CLI's static imports.
  • No plugin marketplace and no runtime download of code.
  • The conformance suite for third-party adapters is separate 3.x work.

Impact & Value

Done when external developers can build protocol adapters and payment providers from the published package without src/ imports, casts or a fork to register new names.

Test plan

2.12.0: payment-required, paid and refused responses over HTTP, MCP and A2A are byte-equal before and after the move, for x402 and MPP. The packaging test still finds no static import of a peer in the main entry. 3.0.0: an example adapter and provider built from npm pack output register new names; a name that collides with a built-in is refused.

Activity

  1. added
    enhancement
    tracking
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementtracking

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions