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

    Class AgentAppExperimental

    Agent-side app builder for the experimental draft ACP v2 API.

    Methods on this class register typed request or notification handlers and return this, so apps can be built with a fluent chain. Handler params are parsed with the generated ACP schemas before your handler runs, and thrown errors are converted to JSON-RPC errors by the connection layer.

    Index
    • Experimental

      Registers a handler that runs when this agent app opens a connection.

      Use this for connection-scoped work that needs to call client-side ACP methods outside an inbound request handler, or to set up per-connection state that the request handlers use. Requests and notifications sent through connection.client wait until initialize has completed.

      Handlers are called synchronously in registration order and are not awaited. A handler that throws or rejects closes the connection. When they are called depends on who opens the connection:

      • connect(...) and connectWith(...) call them before the connection handles its first inbound message, and so does AgentProtocolRouter.connect when it routes to this app. Only the work a handler does before its first await is guaranteed to come first.
      • The experimental AcpServer calls them after the client has completed initialize. Request handlers, including initialize, can run before them.

      Parameters

      Returns this

    • Experimental

      Registers a notification handler by ACP method name.

      Built-in method literals infer their params type from method. Pass a parser as the second argument to register custom extension notifications. Use "*" without a parser for a raw fallback after normal dispatch.

      The connection dispatches one message per event-loop task, in the order received, so handlers start in that order across all methods. It does not wait for an async handler to settle before dispatching the next message, so async handlers can run concurrently. Serialize work yourself when its effects must be applied in order.

      Parameters

      Returns this

    • Experimental

      Registers a notification handler by ACP method name.

      Built-in method literals infer their params type from method. Pass a parser as the second argument to register custom extension notifications. Use "*" without a parser for a raw fallback after normal dispatch.

      The connection dispatches one message per event-loop task, in the order received, so handlers start in that order across all methods. It does not wait for an async handler to settle before dispatching the next message, so async handlers can run concurrently. Serialize work yourself when its effects must be applied in order.

      Type Parameters

      Parameters

      Returns this

    • Experimental

      Registers a notification handler by ACP method name.

      Built-in method literals infer their params type from method. Pass a parser as the second argument to register custom extension notifications. Use "*" without a parser for a raw fallback after normal dispatch.

      The connection dispatches one message per event-loop task, in the order received, so handlers start in that order across all methods. It does not wait for an async handler to settle before dispatching the next message, so async handlers can run concurrently. Serialize work yourself when its effects must be applied in order.

      Type Parameters

      • Params

      Parameters

      Returns this

    • Experimental

      Registers a notification handler by ACP method name.

      Built-in method literals infer their params type from method. Pass a parser as the second argument to register custom extension notifications. Use "*" without a parser for a raw fallback after normal dispatch.

      The connection dispatches one message per event-loop task, in the order received, so handlers start in that order across all methods. It does not wait for an async handler to settle before dispatching the next message, so async handlers can run concurrently. Serialize work yourself when its effects must be applied in order.

      Type Parameters

      • Params
      • const Method extends string = never

      Returns this