import type { OwnedRuntimeEndpointView, RegisterRuntimeEndpointParams, RegisterRuntimeEndpointResponse, RuntimeMessageFrame, RuntimeNodeRef, RuntimeParticipantConversationSubject, RuntimePresentedReceiptOutcome, RuntimeServicesDisclosedParticipant, RuntimeTargetMessageDeliveryFacts } from "./types.js"; export type RuntimeAdapterFetch = typeof fetch; export declare const TARGET_SENDER_MEDIA_TYPE = "application/vnd.masons.icm-messaging-v2+json"; export type RuntimeAdapterRequestKind = "register_runtime_endpoint" | "get_owned_runtime_endpoint" | "list_runtime_session_conversations" | "list_runtime_directed_session_targets" | "submit_runtime_target_send" | "ack_runtime_control_event" | "post_runtime_receipts" | "post_runtime_typing"; export interface RuntimeAdapterClientConfig { apiHost: string; fetch?: RuntimeAdapterFetch; } export interface RuntimeEndpointReadOptions { endpointNonce?: string; } export declare class RuntimeAdapterApiError extends Error { readonly status: number; readonly code: string; constructor(status: number, code: string, message: string); } export declare class RuntimeAdapterNetworkError extends Error { readonly code: "timeout" | "network"; readonly detail: string; readonly requestKind: RuntimeAdapterRequestKind; constructor(code: "timeout" | "network", detail: string, requestKind: RuntimeAdapterRequestKind); } export type RuntimeDirectedSessionResolutionQuery = { kind: "node_match"; match: { kind: "canonical_handle_exact"; handle: string; }; } | { kind: "node_sessions"; node_ref: string; match: { kind: "approved_display_exact"; label: string; pick_code?: string; }; } | { kind: "browse_nodes"; }; export interface RuntimeDirectedSessionResolutionParams { endpoint_id: string; endpoint_nonce: string; continuation?: string; query: RuntimeDirectedSessionResolutionQuery; } export type RuntimeTargetSendSource = { kind: "node"; node_ref: string; } | { kind: "exact_session"; session_ref: string; }; export type RuntimeDirectedSessionTargetCoverage = "exact_sessions_complete" | "exact_sessions_not_applicable" | "exact_sessions_incomplete"; export interface RuntimeDirectedSessionResolutionNode { node_ref: string; identity?: RuntimeNodeRef; display: { label: string; }; coverage: RuntimeDirectedSessionTargetCoverage; } export interface RuntimeDirectedSessionResolutionSession { display: { name?: string; label: string; host_label?: string; }; target_ref: string; pick_code?: string; } export type RuntimeDirectedSessionResolutionResponse = { status: "runtime_node_target_resolution"; contract_version: 3; acting_source: RuntimeTargetSendSource; query: { kind: "node_match"; match: "canonical_handle_exact"; handle: string; }; outcome: "zero" | "one"; nodes: RuntimeDirectedSessionResolutionNode[]; } | { status: "runtime_node_session_target_resolution"; contract_version: 3; acting_source: RuntimeTargetSendSource; query: { kind: "node_sessions"; match: "approved_display_exact"; node_ref: string; label: string; pick_code?: string; }; node: RuntimeDirectedSessionResolutionNode; outcome: "not_applicable" | "zero" | "one" | "many"; sessions: RuntimeDirectedSessionResolutionSession[]; }; export interface RuntimePermittedHostDeclarationsV1 { conversation_scid?: string; } type RuntimeTargetSendInvocation = { endpoint_id: string; endpoint_nonce: string; } | { endpoint_id?: never; endpoint_nonce?: never; }; type RuntimeTargetSendParamsBase = { send_request_id: string; acting_source: RuntimeTargetSendSource; content: string; content_type: string; } & RuntimeTargetSendInvocation; export type RuntimeTargetSendParams = (RuntimeTargetSendParamsBase & { send_intent: "initiate"; addressed_grain: "exact_session"; addressed_party_ref: string; requested_conversation_ref?: never; declarations?: never; }) | (RuntimeTargetSendParamsBase & { send_intent: "initiate"; addressed_grain: "node"; addressed_party_ref: string; requested_conversation_ref?: never; declarations?: never; }) | (RuntimeTargetSendParamsBase & { send_intent: "continue"; addressed_grain?: never; addressed_party_ref?: never; requested_conversation_ref: string; declarations?: RuntimePermittedHostDeclarationsV1; }); export type RuntimeTargetSenderAttemptOutcome = { attempt_ref: string; projection_etag: string; outcome: "refused"; refusal_code: "remote_definitive_refusal"; remote_refusal_decided_at: string; local_outcome_recorded_at: string; outcome_at: string; } | { attempt_ref: string; projection_etag: string; outcome: "dispatch_pending" | "acceptance_unconfirmed"; outcome_at: string; }; interface RuntimeTargetSenderMessageOutcomeCommon { message_ref: string; subject: RuntimeParticipantConversationSubject; projection_etag: string; outcome_at: string; } export type RuntimeTargetSenderMessageOutcome = RuntimeTargetSenderMessageOutcomeCommon & RuntimeTargetMessageDeliveryFacts; export type RuntimeTargetSendOutcome = RuntimeTargetSenderAttemptOutcome | RuntimeTargetSenderMessageOutcome; export declare function registerRuntimeEndpoint(cfg: RuntimeAdapterClientConfig, runtimeKey: string, params: RegisterRuntimeEndpointParams): Promise; export declare function runtimeControlEventStreamUrl(cfg: RuntimeAdapterClientConfig, nodeId: string): string; export declare function ackRuntimeControlEvent(cfg: RuntimeAdapterClientConfig, runtimeKey: string, ack: { idempotency_key: string; status: "applied" | "failed"; detail?: string; }): Promise<"confirmed" | "gone">; export declare function postRuntimeTyping(cfg: RuntimeAdapterClientConfig, runtimeKey: string, typing: { conversation_ref: string; endpoint_id: string; endpoint_nonce: string; }): Promise; export declare function postRuntimePresentedReceipt(cfg: RuntimeAdapterClientConfig, runtimeKey: string, receipt: { endpoint_id: string; endpoint_nonce: string; message_ref: string; content_digest: string; }): Promise; export declare function getOwnedRuntimeEndpoint(cfg: RuntimeAdapterClientConfig, runtimeKey: string, endpointId: string, options?: RuntimeEndpointReadOptions): Promise; export declare function resolveRuntimeDirectedSessionTargets(cfg: RuntimeAdapterClientConfig, runtimeKey: string, params: RuntimeDirectedSessionResolutionParams): Promise; export declare function submitRuntimeTargetSend(cfg: RuntimeAdapterClientConfig, runtimeKey: string, params: RuntimeTargetSendParams): Promise; export declare function parseRuntimeServicesDisclosedParticipant(raw: unknown): RuntimeServicesDisclosedParticipant | null; export declare const PICK_CODE: RegExp; export declare function readRuntimeMessageFrame(raw: unknown): RuntimeMessageFrame | null; export declare function isTerminalStatus(status: number): boolean; export interface RuntimeSessionConversationsParams { endpoint_id: string; endpoint_nonce: string; limit?: number; since?: string; } export interface RuntimeSessionConversationItem { conversation_ref: string; counterparty: RuntimeServicesDisclosedParticipant; self_participant_kind: "session" | "node"; last_message_at: string; last_message?: { sent_at: string; excerpt: string; speaker_participant_ref: string; }; message_count?: number; } export interface RuntimeSessionConversationsPage { self_participant_ref: string; items: RuntimeSessionConversationItem[]; } export declare function listRuntimeSessionConversations(cfg: RuntimeAdapterClientConfig, runtimeKey: string, params: RuntimeSessionConversationsParams): Promise; export {}; //# sourceMappingURL=runtime-adapter-api.d.ts.map