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

    Class ClientContextExperimental

    Experimental draft ACP v2 context used by clients to call agent-side ACP methods.

    connectWith passes a ClientContext to the callback. Client handlers also receive one as ctx.agent when they need to call back into the agent.

    Hierarchy

    • AcpContext
      • ClientContext
    Index
    • get requestId(): JsonRpcId | undefined
      Experimental

      JSON-RPC id of the request currently being handled.

      This is undefined for notification handlers and for contexts created outside an inbound request, such as connect(...) and connectWith(...).

      Returns JsonRpcId | undefined

    • Experimental

      Creates a builder for starting and observing an ACP session.

      Pass an absolute path for the common case where only cwd is needed, or pass a full NewSessionRequest when you need MCP servers, _meta, or additional session fields.

      Parameters

      • cwd: string

      Returns SessionBuilder

    • Experimental

      Creates a builder for starting and observing an ACP session.

      Pass an absolute path for the common case where only cwd is needed, or pass a full NewSessionRequest when you need MCP servers, _meta, or additional session fields.

      Parameters

      Returns SessionBuilder

    • Experimental

      Sends a request to the agent by ACP method name.

      Built-in method literals infer their params and response types. Custom methods can specify their response and params types with generics.

      Other requests wait until initialize has completed. initialize may be repeated once the previous one completed and before any other request has been sent; otherwise it throws -32600 synchronously. A repeat that fails leaves the previous initialization in effect, and a first initialize that gets an error response leaves the connection uninitialized, so it can be sent again.

      Closing or deleting a session is idempotent: a -32002 (Resource not found) response to session/close or session/delete resolves with an empty result instead of rejecting.

      Type Parameters

      Parameters

      Returns Promise<AgentRequestResponsesByMethod[Method]>

    • Experimental

      Sends a request to the agent by ACP method name.

      Built-in method literals infer their params and response types. Custom methods can specify their response and params types with generics.

      Other requests wait until initialize has completed. initialize may be repeated once the previous one completed and before any other request has been sent; otherwise it throws -32600 synchronously. A repeat that fails leaves the previous initialization in effect, and a first initialize that gets an error response leaves the connection uninitialized, so it can be sent again.

      Closing or deleting a session is idempotent: a -32002 (Resource not found) response to session/close or session/delete resolves with an empty result instead of rejecting.

      Type Parameters

      • Response = unknown
      • Params = unknown

      Parameters

      Returns Promise<Response>

    • Experimental

      Sends a request to the agent by ACP method name.

      Built-in method literals infer their params and response types. Custom methods can specify their response and params types with generics.

      Other requests wait until initialize has completed. initialize may be repeated once the previous one completed and before any other request has been sent; otherwise it throws -32600 synchronously. A repeat that fails leaves the previous initialization in effect, and a first initialize that gets an error response leaves the connection uninitialized, so it can be sent again.

      Closing or deleting a session is idempotent: a -32002 (Resource not found) response to session/close or session/delete resolves with an empty result instead of rejecting.

      Type Parameters

      • Response = unknown
      • Params = unknown
      • const Method extends string = never

      Parameters

      Returns Promise<Response>

    • Experimental

      Sends a notification to the agent by ACP method name.

      Built-in method literals infer their params type. Custom notifications can specify their params type with a generic.

      Type Parameters

      Parameters

      Returns Promise<void>

    • Experimental

      Sends a notification to the agent by ACP method name.

      Built-in method literals infer their params type. Custom notifications can specify their params type with a generic.

      Parameters

      Returns Promise<void>

    • Experimental

      Sends a notification to the agent by ACP method name.

      Built-in method literals infer their params type. Custom notifications can specify their params type with a generic.

      Type Parameters

      • Params = unknown

      Parameters

      • method: `_${string}`
      • Optionalparams: Params

      Returns Promise<void>

    • Experimental

      Sends a notification to the agent by ACP method name.

      Built-in method literals infer their params type. Custom notifications can specify their params type with a generic.

      Type Parameters

      • Params = unknown
      • const Method extends string = never

      Parameters

      Returns Promise<void>