Creates the gateway; nothing connects before Gateway.frames is iterated.
The WebSocket URL (gatewayUrl).
The agent's API token and optional DPoP key.
Consumer, agent ID, settings, clock, random, heartbeat source, User-Agent, nonce sink, WebSocket constructor and logger.
ReadonlyagentThe agent's principal ID.
ReadonlyclockThe time source.
Why the gateway stopped, once it has.
The number of opened connections.
ReadonlyconsumerThe consumer name.
ReadonlysettingsThe resolved SDK settings.
ReadonlyurlThe WebSocket URL (gatewayUrl).
The highest acknowledged seq (the cursor of a resume).
The gateway session of the last ready, if any.
Acknowledges every event up to seq (op ack, cumulative); without a connection the
acknowledgement is dropped, the next one covers it.
The highest settled seq.
A promise that resolves once the frame is handed to the socket.
Returns the wait before reconnect attempt attempt: uniform in
[0, min(sync.reconnect_backoff_cap, sync.reconnect_backoff_base * 2^attempt)].
The attempt, from zero; ready and resumed reset it.
The wait in milliseconds.
Closes with 1000; Gateway.frames ends without reconnecting.
A promise that resolves once the close is started.
Connects, keeps the session alive and yields every relevant server frame.
The iterator reconnects after every close code that allows it and ends when the gateway stops; Gateway.closeReason then tells why. Breaking out of the loop closes the gateway.
The server frames ready, resumed, dispatch, cursor, resync_required and
error (with a GatewayOpError as model).
Sends the op command.autocomplete_result.
The request of the command.autocomplete_requested event.
The choices.
Optionalref: stringA reference the error frame repeats.
A promise that resolves once the frame is handed to the socket.
Sends the op run.update (no success reply; a failure comes as an error frame).
The run.
The version the patch is based on.
The RFC 6902 operations.
Optionalref: stringA reference the error frame repeats.
A promise that resolves once the frame is handed to the socket.
One agent's gateway session with reconnects, as an async iterator of server frames.
Nothing connects before Gateway.frames is iterated. Control frames (
hello,heartbeat_ack) are handled when they arrive; the other frames wait for the consumer in arrival order.