import { $n as ISecureClientConfig, Ar as IActionServeLogger, Bn as ITransportConnectionContext, Cr as TTransportRouteParams, Dn as createBinaryWireSessionFactory, Dr as TransportConnection$1, En as IBinaryWireSessionOptions, Er as TUpdateActionRunConfig, Fn as ChannelConnector, Gn as IActionTransportDef, Hn as PeerLink, In as createChannelConnector, Jn as IActionTransportReadyData_Base, Kn as IActionTransportInitialized, On as IActionWireFormat, Or as ISecureChannelAcceptorOptions, Qn as IFrameReliabilityWire, Sr as TTransportInitializationFinishedInfo, Tr as TTransportStatusInfo_GetTransport_Output, Un as ETransportShape, Vn as Transport, Wn as ETransportStatus, Xn as IActionTransportResolvers, Yn as IActionTransportReadyData_Methods, Zn as IFrameReliability, _r as TOnResolveIncomingResponse, a as TAcceptorCaseFn, an as IHibernatableWsServerAdapterOptions, ar as ITransportRouteInfo, at as TExchangeReply, br as TSendReturnDataMethod, c as TActionConnectionEncoding, cn as IConnectionAttachment, cr as ITransportStatusInfo_Initializing, ct as decodeExchangeRequest, d as ActionRuntime, dr as IUpdateActionRunConfig_Output, dt as IExchangeAcceptorConfig, er as ITransportDispatchAction, fr as TGetTransportFn, ft as IExchangeAcceptorSecurity, gr as TOnResolveIncomingRequestJson, hr as TOnResolveIncomingRequest, i as IChannelAcceptorOptions, in as IDuplexConnectionRouter, ir as ITransportRouteConnectParams, jn as IExchangeCarrier$1, kn as IDuplexCarrier$1, kr as createSecureChannelAcceptor, l as createChannelAcceptor, ln as IConnectionStateStoreOptions, lr as ITransportStatusInfo_Ready, lt as encodeExchange, mr as TOnResolveAnyIncomingActionData_Json, n as IAcceptorConnectionBinding, nr as ITransportRouteActionParams, o as TAcceptorConnectionCaseFn, on as createHibernatableWsServerAdapter, or as ITransportStatusInfo_Base, ot as TExchangeRequest, pr as TOnResolveAnyIncomingActionData, qn as IActionTransportReady, rr as ITransportRouteClientParams, s as TActionChannelFormatMessage, sn as ConnectionStateStore, sr as ITransportStatusInfo_Failed, st as decodeExchangeReply, t as ChannelAcceptor, tr as ITransportMethod_SendActionData_Input, u as ActionDomain, un as createConnectionStateStore, ur as ITransportStatusInfo_Unsupported, ut as ExchangeAcceptor, vr as TOnResolveIncomingResponseJson, wr as TTransportStatusInfo, xr as TTransportCache, yr as TSendActionDataMethod } from "../ChannelAcceptor-Cmu6jyhn.mjs"; import { EHandshakeMessageType, IActionFrameCrypto, IActionFrameCryptoConfig, IClientHandshakeConfig, IHandshakeEncryptionKeyMaterial, IHandshakeResult, IReliableInboxResult, IReliableLogOptions, IReliableLogStore, IReliableReceiver, IServerHandshakeConfig, IWireLinkKeepalive, ReliableInbox, ReliableLog, TControlMessage, THandshakeMessage, TWireTapFn, WireProtocolMux, createActionFrameCrypto, createClientHandshake, createMemoryReliableLogStore, createServerHandshake, decodeControlFrame, decodeHandshakeMessage, encodeControlFrame, encodeHandshakeMessage } from "@nice-code/wire"; //#region src/ActionRuntime/Handler/PeerLink/Acceptor/createActionFetchHandler.d.ts interface IActionFetchHandlerOptions { /** * CORS headers merged onto every response (a preflight `OPTIONS` is answered `204` with them). * Defaults to permissive `*`; pass `false` to attach no CORS headers at all. */ cors?: Record | false; /** Which requests carry an action wire on `POST`. Default: pathname ends with `/action`. */ isActionPath?: (url: URL) => boolean; /** Which requests are WebSocket upgrades. Default: pathname ends with `/ws`. */ isWebSocketPath?: (url: URL) => boolean; /** * Whether a request is a WebSocket upgrade for this endpoint, given the whole request (not just the * URL). When set it *replaces* the default gate (an `Upgrade: websocket` header on an * {@link isWebSocketPath} match) — use it when the discriminant needs a header or method, not only the * path. Only consulted when {@link onWebSocketUpgrade} is present. */ isWebSocketUpgrade?: (request: Request, url: URL) => boolean; /** * Perform the transport-specific WebSocket upgrade (e.g. a Durable Object's * `new WebSocketPair()` + `ctx.acceptWebSocket()` returning a `101`). Omit for HTTP-only endpoints. * Its response is returned as-is — a `101` upgrade carries no CORS headers. */ onWebSocketUpgrade?: (request: Request, url: URL) => Response | Promise; /** Forwarded to `ActionPayload_Result.toHttpResponse` — use the error's HTTP status (default true). */ useErrorStatus?: boolean; /** * Enable the secure exchange protocol (handshake + token sessions + body encryption) on the `/action` * endpoint, mirroring an `ChannelAcceptor`'s `security`. The matching connector is a secure HTTP * transport (`connectChannel(..., { transports: [{ carrier: httpCarrier(...) }] })`). When omitted, the * endpoint speaks the plain protocol (the raw action wire is POSTed and the result is the response body). */ security?: IExchangeAcceptorSecurity; /** * Optional server-side logger — called per inbound action request with its outcome. Threaded into the * secure {@link ExchangeAcceptor} and used directly on the plain action POST, so both endpoint styles log. */ logger?: IActionServeLogger; /** Short carrier-kind label surfaced to the logger as the request's transport (default `"http"`). */ transportLabel?: string; } /** * Build the `fetch` handler a server/Durable-Object exposes for action traffic, folding in the * boilerplate every endpoint repeats: CORS (incl. the `OPTIONS` preflight), routing the `/action` * `POST` body through the runtime (`handleActionPayloadWire` → `waitForResultPayload` → * `toHttpResponse`), an optional WebSocket-upgrade hook, and a `404` fallback. * * It only touches web-standard `Request`/`Response`, so it stays transport-agnostic — the one * environment-specific bit (the WS upgrade) is injected via {@link IActionFetchHandlerOptions.onWebSocketUpgrade}: * ```ts * this.fetchHandler = createActionFetchHandler(this.runtime, { * onWebSocketUpgrade: () => { * const pair = new WebSocketPair(); * this.ctx.acceptWebSocket(pair[1]); * return new Response(null, { status: 101, webSocket: pair[0] }); * }, * }); * // async fetch(request) { return this.fetchHandler(request); } * ``` */ declare function createActionFetchHandler(runtime: ActionRuntime, options?: IActionFetchHandlerOptions): (request: Request) => Promise; //#endregion //#region src/ActionRuntime/Transport/codec/createBinaryWireAdapter.d.ts /** * Builds a *stateless* `formatMessage` pipeline for {@link LinkTransport}, packing action * payloads into a compact msgpackr binary frame instead of JSON. The `domain`/`id` route collapses to * a single integer drawn from a shared dictionary; `form`/`type`, the recomputable * `inputHash`/`outputHash`, and the per-frame `context.routing`/`context.timeCreated` are all dropped * (see {@link ENVELOPE}). * * No validation runs here: `incoming` blindly reconstructs the wire JSON shape and hands it back to * the connection. `ActionRuntime` hydrates the request and validates its input at the universal execution * boundary, before any local handler sees it, exactly as it does for a JSON frame. * * Both ends of the socket MUST construct the adapter with the same domains in the same order — the * integer dictionary is positional. Mismatched dictionaries will route to the wrong action. * * Because `incoming` returns `undefined` for text frames, a binary server can still serve plain-JSON * clients on the same runtime (the connection falls back to its built-in JSON parser). */ declare function createBinaryWireAdapter(domains: ActionDomain[]): IActionWireFormat; //#endregion //#region src/ActionRuntime/Transport/Exchange/TransportExchange.types.d.ts interface IActionTransportReadyData_Exchange extends IActionTransportReadyData_Base { /** The live request/reply carrier this connection drives its session over. */ carrier: IExchangeCarrier$1; /** Optional authenticated/encrypted config; the handshake runs once at bring-up when set. */ secureChannel?: ISecureClientConfig; } interface IActionTransportInitialized_Exchange extends IActionTransportInitialized {} interface IActionTransportDef_Exchange extends IActionTransportDef {} //#endregion //#region src/ActionRuntime/Transport/Exchange/ExchangeConnection.d.ts /** * Carrier-agnostic live connection for the exchange (request → single reply) shape — the HTTP * counterpart to {@link LinkConnection}. It owns only the bring-up (run the secure handshake on first * use); the request/reply lifecycle + crypto live in the shared `establishExchangeSession`. */ declare class ExchangeConnection extends TransportConnection$1 { constructor(def: Omit); protected _getCacheKey(input: TTransportRouteParams): string; protected _needsAsyncBringUp(data: IActionTransportReadyData_Exchange): boolean; protected _finalizeReady(data: IActionTransportReadyData_Exchange): IActionTransportReadyData_Methods | Promise; _finalizeTransportMethods(data: IActionTransportReadyData_Exchange): IActionTransportReadyData_Methods; private _sessionContext; } //#endregion //#region src/ActionRuntime/Transport/Exchange/ExchangeTransport.d.ts interface IExchangeTransportOptions { /** Open (or reuse) the exchange carrier for an action — e.g. `httpCarrier(...).open`. */ openCarrier: (input: TTransportRouteParams) => IExchangeCarrier$1; /** Secure config; when set (and `securityLevel !== none`) the handshake runs once at bring-up. */ security?: ISecureClientConfig; updateRunConfig?: TUpdateActionRunConfig; /** Keys identifying a reusable session, so one carrier is shared across actions to the same peer. */ getTransportCacheKey?: (input: TTransportRouteParams) => string[]; /** * Optional availability gate. When it returns `false`, the manager skips this transport for that action * (reporting `unsupported`) and falls through to the next — without opening the carrier or computing its * cache key. Re-evaluated per dispatch, so the transport can become available later with no reconnect. */ available?: (input: TTransportRouteParams) => boolean; /** Short label for the devtools chip (defaults to "exchange"). */ label?: string; getRouteInfo?: (input: TTransportRouteParams) => ITransportRouteInfo; /** The connection's frame-protocol mux, when one exists — consulted only by the D-11 guard. */ mux?: WireProtocolMux; /** * Whether *every* transport on this connection is exchange-shaped (computed by `connectChannel`). * Prefixed protocols need a duplex transport (plan D-11) — on an exchange-only connection they * could never speak, so bringing this transport up with protocols registered on {@link mux} * throws `err_nice_wire_connect.protocol_on_exchange_only` instead of leaving them silently mute. * A mixed chain (duplex preferred, exchange fallback) never sets this: there the protocols * legitimately ride the duplex transport when it is up. */ exchangeOnlyConnection?: boolean; /** Wire-traffic observation (devtools) — request/reply envelope bytes under the `"http"` lane. */ wireTap?: TWireTapFn; } /** * A carrier-agnostic exchange (request → single reply) transport: it drives nice-action's secure session * over any {@link IExchangeCarrier} (HTTP being the one built-in). The duplex counterpart is * {@link LinkTransport}; this is the no-push half — its reply rides the response to its own request, so it * can't deliver an unsolicited frame (the runtime never picks it for the return path). */ declare class ExchangeTransport extends Transport { private readonly options; readonly type = ETransportShape.exchange; constructor(options: IExchangeTransportOptions); static create(options: IExchangeTransportOptions): ExchangeTransport; _createConnection(_ctx: ITransportConnectionContext): ExchangeConnection; getRouteInfo(input: TTransportRouteParams): ITransportRouteInfo; } //#endregion //#region src/ActionRuntime/Transport/Link/TransportLink.types.d.ts /** The per-connection codec (positional binary wire / JSON fallback) the carrier's session uses. */ type TLinkFormatMessage = IActionWireFormat; interface IActionTransportReadyData_Link extends IActionTransportReadyData_Base { /** The live carrier this connection drives its session over. */ channel: IDuplexCarrier$1; formatMessage?: TLinkFormatMessage; /** Optional authenticated/encrypted channel; the connection runs the handshake during init. */ secureChannel?: ISecureClientConfig; /** Wire keepalive (8b.3) for this link's session — resolved per dial by `connectChannel`. */ linkKeepalive?: IWireLinkKeepalive; /** Wire-traffic observation (devtools) — every carrier frame's true bytes, threaded by `connectChannel`. */ wireTap?: TWireTapFn; } interface IActionTransportInitialized_Link extends IActionTransportInitialized {} interface IActionTransportDef_Link extends IActionTransportDef {} //#endregion //#region src/ActionRuntime/Transport/Link/LinkConnection.d.ts /** * Carrier-agnostic live connection. It owns only the *bring-up* (open the carrier, then run the secure * session); the session itself — handshake, frame crypto, codec, send/receive — lives in the shared * {@link finalizeSecureLinkMethods}/{@link finalizePlainLinkMethods}, so a WebSocket, a WebRTC data * channel, a Bluetooth characteristic, and an in-memory pipe all run the identical secure layer. */ declare class LinkConnection extends TransportConnection$1 { private resolvers; constructor(def: Omit, resolvers?: IActionTransportResolvers); protected _getCacheKey(input: TTransportRouteParams): string; protected _needsAsyncBringUp(): boolean; protected _awaitCarrierReady(data: IActionTransportReadyData_Link): Promise; protected _finalizeReady(data: IActionTransportReadyData_Link): IActionTransportReadyData_Methods | Promise; private _sessionContext; _finalizeTransportMethods(data: IActionTransportReadyData_Link): IActionTransportReadyData_Methods; } //#endregion //#region src/ActionRuntime/Transport/Link/LinkTransport.d.ts interface ILinkTransportOptions { /** * Open (or reuse) the carrier for an action — a WebSocket adapter, a WebRTC data channel, a Bluetooth * characteristic, an in-memory pipe, anything that satisfies {@link IDuplexCarrier}. */ openChannel: (input: TTransportRouteParams) => IDuplexCarrier$1; /** Shared codec for every channel (stateless). */ formatMessage?: TLinkFormatMessage; /** * Per-channel codec factory — called once per opened channel so stateful codecs (e.g. the binary * session) get their own instance. Takes precedence over `formatMessage`. */ createFormatMessage?: () => TLinkFormatMessage; /** Secure-channel config; when set (and `securityLevel !== none`) the handshake runs on init. */ security?: ISecureClientConfig; updateRunConfig?: TUpdateActionRunConfig; /** Keys identifying a reusable channel, so one carrier is shared across actions to the same peer. */ getTransportCacheKey?: (input: TTransportRouteParams) => string[]; /** * Optional availability gate. When it returns `false`, the manager skips this transport for that action * (reporting `unsupported`) and falls through to the next — without opening the carrier or computing its * cache key. Re-evaluated per dispatch, so the transport can become available later with no reconnect. */ available?: (input: TTransportRouteParams) => boolean; /** Short label for the devtools chip (defaults to "link"). */ label?: string; getRouteInfo?: (input: TTransportRouteParams) => ITransportRouteInfo; /** * Wire keepalive (8b.3) resolver — a thunk so `connectChannel` can decide **at dial time** * (protocols register on the mux after the connector is built; the auto-on default depends on * them). Returns the concrete config, or `undefined` for off. */ linkKeepalive?: () => import("@nice-code/wire").IWireLinkKeepalive | undefined; /** Wire-traffic observation (devtools) — threaded into every dial's session (survives redials). */ wireTap?: import("@nice-code/wire").TWireTapFn; } /** * A carrier-agnostic transport: it drives nice-action's secure session + action routing over any * {@link IDuplexCarrier}. The WebSocket transport is the special case that opens a `WebSocket`; * this opens whatever `openChannel` returns, so the identical secure layer works over WebRTC, Bluetooth, * or an in-memory pipe. Reported with an overridable carrier label in the devtools (defaults to "link"). */ declare class LinkTransport extends Transport { private readonly options; readonly type = ETransportShape.duplex; constructor(options: ILinkTransportOptions); static create(options: ILinkTransportOptions): LinkTransport; _createConnection(ctx: ITransportConnectionContext): LinkConnection; getRouteInfo(input: TTransportRouteParams): ITransportRouteInfo; } //#endregion export { ChannelAcceptor, ChannelConnector, ConnectionStateStore, EHandshakeMessageType, type ETransportShape, ETransportStatus, ExchangeAcceptor, ExchangeTransport, type IAcceptorConnectionBinding, type IActionFetchHandlerOptions, type IActionFrameCrypto, type IActionFrameCryptoConfig, IActionTransportDef, IActionTransportInitialized, IActionTransportReady, IActionTransportReadyData_Base, type IActionTransportReadyData_Exchange, type IActionTransportReadyData_Link, IActionTransportReadyData_Methods, IActionTransportResolvers, type IActionWireFormat, type IBinaryWireSessionOptions, type IChannelAcceptorOptions, type IClientHandshakeConfig, type IConnectionAttachment, type IConnectionStateStoreOptions, type IDuplexConnectionRouter, type IExchangeAcceptorConfig, type IExchangeAcceptorSecurity, type IExchangeTransportOptions, type IFrameReliability, type IFrameReliabilityWire, type IHandshakeEncryptionKeyMaterial, type IHandshakeResult, type IHibernatableWsServerAdapterOptions, type ILinkTransportOptions, type IReliableInboxResult, type IReliableLogOptions, type IReliableLogStore, type IReliableReceiver, type ISecureChannelAcceptorOptions, ISecureClientConfig, type IServerHandshakeConfig, type ITransportConnectionContext, ITransportDispatchAction, ITransportMethod_SendActionData_Input, ITransportRouteActionParams, ITransportRouteClientParams, ITransportRouteConnectParams, ITransportRouteInfo, type ITransportStatusInfo_Base, type ITransportStatusInfo_Failed, type ITransportStatusInfo_Initializing, type ITransportStatusInfo_Ready, type ITransportStatusInfo_Unsupported, IUpdateActionRunConfig_Output, LinkTransport, PeerLink, ReliableInbox, ReliableLog, type TAcceptorCaseFn, type TAcceptorConnectionCaseFn, type TActionChannelFormatMessage, type TActionConnectionEncoding, type TControlMessage, type TExchangeReply, type TExchangeRequest, TGetTransportFn, type THandshakeMessage, type TLinkFormatMessage, TOnResolveAnyIncomingActionData, TOnResolveAnyIncomingActionData_Json, TOnResolveIncomingRequest, TOnResolveIncomingRequestJson, TOnResolveIncomingResponse, TOnResolveIncomingResponseJson, TSendActionDataMethod, TSendReturnDataMethod, TTransportCache, type TTransportInitializationFinishedInfo, TTransportRouteParams, type TTransportStatusInfo, type TTransportStatusInfo_GetTransport_Output, TUpdateActionRunConfig, Transport, createActionFetchHandler, createActionFrameCrypto, createBinaryWireAdapter, createBinaryWireSessionFactory, createChannelAcceptor, createChannelConnector, createClientHandshake, createConnectionStateStore, createHibernatableWsServerAdapter, createMemoryReliableLogStore, createSecureChannelAcceptor, createServerHandshake, decodeControlFrame, decodeExchangeReply, decodeExchangeRequest, decodeHandshakeMessage, encodeControlFrame, encodeExchange, encodeHandshakeMessage }; //# sourceMappingURL=index.d.mts.map