ACP v2 (Preview) TypeScript SDK — UNSTABLE - v2.12.1
    Preparing search index...

    Class AgentProtocolRouterExperimental

    Routes a client connection to a version-specific ACP agent implementation, including the experimental draft ACP v2 API.

    The router reads messages until a valid initialize request arrives. Before that, notifications and responses are ignored, other requests get -32600, a JSON array (a JSON-RPC batch, which ACP does not use) gets a single -32600 with id: null, and an initialize that fails (malformed params, an unsupported version) gets an error response. None of these close the connection, so the client may send initialize again. Endpoints exposing v2 select the highest configured version at or below the requested version. V1-only endpoints retain the legacy fallback to v1. Only initialize params are normalized. Later messages are forwarded unchanged.

    When the requested version is newer than the selected one, initialize params that do not parse under the selected version are dropped instead of rejected. A missing or malformed v2 info becomes { name: "unknown", version: "unknown" }, and is omitted when downgrading to v1, where clientInfo is optional. Requests for exactly the selected version are validated strictly. On a v2 route, the first initialize must have a string or integer ID.

    The selected implementation handles any repeated initialize; the router never re-routes a connection. A v2 implementation accepts a repeat that requests v2 or newer before any other request. A repeat that requests a lower version is negotiated like a first initialize against v2 alone, so it gets -32022 with supported: [2] and the v2 initialization stays in effect. To use v1 after that, the client opens a new connection.

    Implements

    Index