@runloop/remote-agents-sdk
    Preparing search index...

    Interface ACPAxonConnectionOptions

    Options for creating an ACPAxonConnection.

    interface ACPAxonConnectionOptions {
        afterSequence?: number;
        createClient?: CreateClientFn;
        onDisconnect?: () => void | Promise<void>;
        onError?: (error: unknown) => void;
        replay?: boolean;
        requestPermission?: (
            params: RequestPermissionRequest,
        ) => Promise<RequestPermissionResponse>;
        source?: string;
        verbose?: boolean;
    }

    Hierarchy (View Summary)

    Index

    ACP Protocol

    afterSequence?: number

    Axon sequence number to resume from. When set, the initial SSE subscription uses { after_sequence } so only events after this sequence are delivered — earlier events are never requested.

    Omit (or pass undefined) to start from the beginning of the Axon channel.

    Composes with replay:

    • replay: true (the default) — bounded replay. The connection still resolves the channel head and treats the events in (afterSequence, head] as history: timeline listeners receive each one, control/permission requests are paired with their answers, and only the still-unanswered requests reach handlers once the head is passed. If the head is at or below afterSequence there is nothing to replay and the first event delivered is live.
    • replay: false — live-only. Every event after afterSequence is dispatched to handlers as it arrives, including requests that a later event in the log already answered.

    Typical usage: persist AxonEventView.sequence from a previous session, or the start of the turn you care about, and pass it here so a long-lived channel does not replay from sequence 0.

    Codex: with a bound past the thread/started frame the connection never observes the thread id, so threadId stays undefined after connect(). Seed it with the Codex threadId option or call resumeThread(threadId).

    createClient?: CreateClientFn

    Provide a full custom Client implementation for the underlying ClientSideConnection. Use this when you need to handle agent-to-client callbacks beyond permissions and session updates — for example file I/O, terminal management, or elicitation.

    When set, the built-in requestPermission / onSessionUpdate wiring is bypassed — the returned Client is used as-is.

    Design note: A composition-based approach (partial overrides merged with defaults) would be more ergonomic but the Client interface from @agentclientprotocol/sdk doesn't lend itself to easy merging. This all-or-nothing option keeps the boundary clear. See CreateClientFn for the @todo on future composition support.

    onDisconnect?: () => void | Promise<void>

    Async teardown callback invoked by disconnect() (e.g. devbox shutdown).

    onError?: (error: unknown) => void

    Called when a non-critical error occurs (e.g. unparseable event, listener exception). Defaults to console.error.

    replay?: boolean

    When true, the connection queries the axon for the current head sequence and replays all events up to that point without invoking handlers. Unresolved permission/control requests are dispatched to handlers after replay completes. Timeline events are emitted for all replayed events regardless.

    Set to false to replay the full history with handlers firing for every event (legacy behavior).

    Combine with afterSequence to bound the replayed range to (afterSequence, head] instead of the whole channel.

    true

    requestPermission?: (
        params: RequestPermissionRequest,
    ) => Promise<RequestPermissionResponse>

    Custom handler for agent permission requests. Receives the permission options and must return the selected outcome.

    Defaults to auto-approving with preference: allow_always > allow_once > first option.

    Ignored when createClient is provided (the custom client is responsible for handling permissions).

    source?: string

    The source string attached to every event this client publishes to the Axon API. Use it to identify which client produced a user prompt (e.g. distinguishing multiple integrations writing to the same channel).

    Defaults to the built-in client identifier ("claude-sdk-client", "acp-sdk-client", or "codex-sdk-client" depending on the connection type).

    verbose?: boolean

    When true, emit timestamped diagnostic logs to stderr for every transport read/write and lifecycle event. Useful during development; too noisy for production.

    false