import { u as ReplyPayload } from "./types-CgXdquv1.js"; import { T as ReplyToMode } from "./types.base-bTa1ro6X.js"; import { A as LiveMessageState, C as DeriveDurableFinalDeliveryRequirementsParams, E as DurableFinalDeliveryRequirementMap, I as MessageReceiptPartKind, L as MessageReceiptSourceResult, M as LivePreviewFinalizerCapabilityMap, N as MessageDurabilityPolicy, O as DurableMessageSendIntent, P as MessageReceipt, R as MessageSendContext, _ as ChannelMessageSendPollContext, a as ChannelMessageLiveCapability, b as ChannelMessageSendTextContext, c as ChannelMessageReceiveAdapterShape, g as ChannelMessageSendPayloadContext, h as ChannelMessageSendMediaContext, i as ChannelMessageLiveAdapterShape, j as LivePreviewFinalizerCapability, n as ChannelMessageAdapterShape, s as ChannelMessageReceiveAckPolicy, t as ChannelMessageAdapter, w as DurableFinalDeliveryCapability, z as RenderedMessageBatch } from "./types-CejLKAZg.js"; import { S as OutboundPayloadDeliverySuppressionReason, b as OutboundDeliveryResult } from "./outbound.types-ylohpEJA.js"; import { r as PluginStateKeyedStore } from "./plugin-state-store.types-BaJtc5SJ.js"; import { i as OutboundDeliveryIntent, t as DeliverOutboundPayloadsParams } from "./deliver-KmSK2RgG.js"; import { n as kernel_d_exports } from "./kernel-DXI6x5iz.js"; //#region src/channels/message/send.d.ts type DurableMessageBatchSendParams = Omit & { payloads: ReplyPayload[]; attempt?: number; signal?: AbortSignal; /** @deprecated Use `signal`. */ abortSignal?: AbortSignal; previousReceipt?: MessageReceipt; }; type DurableMessageSuppressionReason = OutboundPayloadDeliverySuppressionReason | "no_visible_result"; type DurableMessageFailureStage = "platform_send" | "queue" | "unknown"; type DurableMessagePayloadDeliveryOutcome = { index: number; status: "sent"; results: OutboundDeliveryResult[]; } | { index: number; status: "suppressed"; reason: DurableMessageSuppressionReason; hookEffect?: { cancelReason?: string; metadata?: Record; }; } | { index: number; status: "failed"; error: unknown; sentBeforeError: boolean; stage: DurableMessageFailureStage; }; type DurableMessageBatchSendResult = { status: "sent"; results: OutboundDeliveryResult[]; receipt: MessageReceipt; deliveryIntent?: OutboundDeliveryIntent; payloadOutcomes?: DurableMessagePayloadDeliveryOutcome[]; } | { status: "suppressed"; results: []; receipt: MessageReceipt; deliveryIntent?: OutboundDeliveryIntent; reason: DurableMessageSuppressionReason; payloadOutcomes?: DurableMessagePayloadDeliveryOutcome[]; } | { status: "partial_failed"; results: OutboundDeliveryResult[]; receipt: MessageReceipt; error: unknown; sentBeforeError: true; deliveryIntent?: OutboundDeliveryIntent; payloadOutcomes?: DurableMessagePayloadDeliveryOutcome[]; } | { status: "failed"; error: unknown; stage?: DurableMessageFailureStage; payloadOutcomes?: DurableMessagePayloadDeliveryOutcome[]; }; type DurableMessageSendContextParams = DurableMessageBatchSendParams & { durability?: Exclude; preview?: LiveMessageState; onPreviewUpdate?: (rendered: RenderedMessageBatch, state: LiveMessageState) => Promise> | LiveMessageState; onEditReceipt?: (receipt: MessageReceipt, rendered: RenderedMessageBatch) => Promise | MessageReceipt; onDeleteReceipt?: (receipt: MessageReceipt) => Promise | void; onCommitReceipt?: (receipt: MessageReceipt) => Promise | void; onSendFailure?: (error: unknown) => Promise | void; }; type DurableMessageSendContext = MessageSendContext; //#endregion //#region src/channels/message/capabilities.d.ts declare function deriveDurableFinalDeliveryRequirements(params: DeriveDurableFinalDeliveryRequirementsParams): DurableFinalDeliveryRequirementMap; //#endregion //#region src/channels/message/adapter.d.ts declare const defaultManualReceiveAdapter: { readonly defaultAckPolicy: "manual"; readonly supportedAckPolicies: readonly ["manual"]; }; type ChannelMessageAdapterWithDefaultReceive = TAdapter & { receive: TAdapter["receive"] extends undefined ? typeof defaultManualReceiveAdapter : NonNullable; }; declare function defineChannelMessageAdapter(adapter: TAdapter): ChannelMessageAdapter>; //#endregion //#region src/channels/message/outbound-bridge.d.ts type ChannelMessageOutboundBridgeResult = MessageReceiptSourceResult & { receipt?: MessageReceipt; messageId?: string; }; type ChannelMessageOutboundBridgeAdapter = { deliveryCapabilities?: { durableFinal?: DurableFinalDeliveryRequirementMap; }; sendText?: (ctx: ChannelMessageSendTextContext) => Promise; sendMedia?: (ctx: ChannelMessageSendMediaContext) => Promise; sendPayload?: (ctx: ChannelMessageSendPayloadContext) => Promise; sendPoll?: (ctx: ChannelMessageSendPollContext) => Promise; }; type CreateChannelMessageAdapterFromOutboundParams = { id?: string; outbound: ChannelMessageOutboundBridgeAdapter; capabilities?: DurableFinalDeliveryRequirementMap; live?: ChannelMessageLiveAdapterShape; receive?: ChannelMessageReceiveAdapterShape; }; declare function createChannelMessageAdapterFromOutbound(params: CreateChannelMessageAdapterFromOutboundParams): ChannelMessageAdapterShape; //#endregion //#region src/channels/message/durable-receive.d.ts type DurableInboundReceivePendingRecord = { id: string; payload: TPayload; metadata?: TMetadata; receivedAt: number; updatedAt: number; attempts: number; lastAttemptAt?: number; lastError?: string; }; type DurableInboundReceiveCompletedRecord = { id: string; completedAt: number; metadata?: TMetadata; }; type DurableInboundReceiveAcceptResult = { kind: "accepted"; duplicate: false; record: DurableInboundReceivePendingRecord; } | { kind: "pending"; duplicate: true; record: DurableInboundReceivePendingRecord; } | { kind: "completed"; duplicate: true; record: DurableInboundReceiveCompletedRecord; }; type DurableInboundReceiveJournalOptions = { pendingStore: PluginStateKeyedStore>; completedStore: PluginStateKeyedStore>; now?: () => number; pendingTtlMs?: number; completedTtlMs?: number; }; type DurableInboundReceiveAcceptOptions = { metadata?: TMetadata; receivedAt?: number; }; type DurableInboundReceiveCompleteOptions = { metadata?: TCompletedMetadata; completedAt?: number; }; type DurableInboundReceiveReleaseOptions = { lastError?: string; releasedAt?: number; }; type DurableInboundReceiveJournal = { accept(id: string, payload: TPayload, options?: DurableInboundReceiveAcceptOptions): Promise>; pending(): Promise>>; complete(id: string, options?: DurableInboundReceiveCompleteOptions): Promise; release(id: string, options?: DurableInboundReceiveReleaseOptions): Promise; deletePending(id: string): Promise; }; declare function createDurableInboundReceiveJournal(options: DurableInboundReceiveJournalOptions): DurableInboundReceiveJournal; //#endregion //#region src/channels/message/contracts.d.ts type DurableFinalCapabilityProof = () => Promise | void; type DurableFinalCapabilityProofMap = Partial>; type DurableFinalCapabilityProofResult = { capability: DurableFinalDeliveryCapability; status: "verified" | "not_declared"; }; type LivePreviewFinalizerCapabilityProof = () => Promise | void; type ChannelMessageLiveCapabilityProof = () => Promise | void; type ChannelMessageReceiveAckPolicyProof = () => Promise | void; type LivePreviewFinalizerCapabilityProofMap = Partial>; type ChannelMessageLiveCapabilityProofMap = Partial>; type ChannelMessageReceiveAckPolicyProofMap = Partial>; type LivePreviewFinalizerCapabilityProofResult = { capability: LivePreviewFinalizerCapability; status: "verified" | "not_declared"; }; type ChannelMessageLiveCapabilityProofResult = { capability: ChannelMessageLiveCapability; status: "verified" | "not_declared"; }; type ChannelMessageReceiveAckPolicyProofResult = { policy: ChannelMessageReceiveAckPolicy; status: "verified" | "not_declared"; }; declare function listDeclaredDurableFinalCapabilities(capabilities: DurableFinalDeliveryRequirementMap | undefined): DurableFinalDeliveryCapability[]; declare function listDeclaredLivePreviewFinalizerCapabilities(capabilities: LivePreviewFinalizerCapabilityMap | undefined): LivePreviewFinalizerCapability[]; declare function listDeclaredChannelMessageLiveCapabilities(capabilities: Partial> | undefined): ChannelMessageLiveCapability[]; declare function listDeclaredReceiveAckPolicies(receive: ChannelMessageAdapterShape["receive"] | undefined): ChannelMessageReceiveAckPolicy[]; declare function verifyDurableFinalCapabilityProofs(params: { adapterName: string; capabilities?: DurableFinalDeliveryRequirementMap; proofs: DurableFinalCapabilityProofMap; }): Promise; declare function verifyLivePreviewFinalizerCapabilityProofs(params: { adapterName: string; capabilities?: LivePreviewFinalizerCapabilityMap; proofs: LivePreviewFinalizerCapabilityProofMap; }): Promise; declare function verifyChannelMessageLiveCapabilityProofs(params: { adapterName: string; capabilities?: Partial>; proofs: ChannelMessageLiveCapabilityProofMap; }): Promise; declare function verifyChannelMessageReceiveAckPolicyProofs(params: { adapterName: string; receive?: ChannelMessageAdapterShape["receive"]; proofs: ChannelMessageReceiveAckPolicyProofMap; }): Promise; declare function verifyChannelMessageAdapterCapabilityProofs(params: { adapterName: string; adapter: Pick; proofs: DurableFinalCapabilityProofMap; }): Promise; declare function verifyChannelMessageReceiveAckPolicyAdapterProofs(params: { adapterName: string; adapter: Pick; proofs: ChannelMessageReceiveAckPolicyProofMap; }): Promise; declare function verifyChannelMessageLiveFinalizerProofs(params: { adapterName: string; adapter: Pick; proofs: LivePreviewFinalizerCapabilityProofMap; }): Promise; declare function verifyChannelMessageLiveCapabilityAdapterProofs(params: { adapterName: string; adapter: Pick; proofs: ChannelMessageLiveCapabilityProofMap; }): Promise; //#endregion //#region src/channels/message/receipt.d.ts type MessageReceiptInputResult = MessageReceiptSourceResult & { receipt?: MessageReceipt; }; declare function createMessageReceiptFromOutboundResults(params: { results: readonly MessageReceiptInputResult[]; kind?: MessageReceiptPartKind; threadId?: string; replyToId?: string; sentAt?: number; }): MessageReceipt; declare function listMessageReceiptPlatformIds(receipt: MessageReceipt): string[]; declare function resolveMessageReceiptPrimaryId(receipt: MessageReceipt): string | undefined; //#endregion //#region src/channels/message/receive.d.ts type MessageAckPolicy = ChannelMessageReceiveAckPolicy; type MessageAckStage = "receive_record" | "agent_dispatch" | "durable_send" | "manual"; type MessageAckState = "pending" | "acked" | "nacked"; type MessageReceiveContext = { id: string; channel: string; accountId?: string; message: TMessage; ackPolicy: MessageAckPolicy; ackState: MessageAckState; ackedAt?: number; nackErrorMessage?: string; receivedAt: number; signal: AbortSignal; shouldAckAfter(stage: MessageAckStage): boolean; ack(): Promise; nack(error: unknown): Promise; }; declare function shouldAckMessageAfterStage(policy: MessageAckPolicy, stage: MessageAckStage): boolean; declare function createMessageReceiveContext(params: { id: string; channel: string; accountId?: string; message: TMessage; ackPolicy?: MessageAckPolicy; receivedAt?: number; signal?: AbortSignal; onAck?: () => Promise | void; onNack?: (error: unknown) => Promise | void; }): MessageReceiveContext; //#endregion //#region src/channels/message/state.d.ts type DurableMessageSendState = "pending" | "sent" | "suppressed" | "failed" | "unknown_after_send"; type DurableMessageStateRecord = { intent: DurableMessageSendIntent; state: DurableMessageSendState; receipt?: MessageReceipt; updatedAt: number; errorMessage?: string; }; declare function createDurableMessageStateRecord(params: { intent: DurableMessageSendIntent; state?: DurableMessageSendState; receipt?: MessageReceipt; updatedAt?: number; error?: unknown; }): DurableMessageStateRecord; declare function classifyDurableSendRecoveryState(params: { hasIntent: boolean; hasReceipt: boolean; platformSendMayHaveStarted: boolean; failed?: boolean; suppressed?: boolean; }): DurableMessageSendState; //#endregion //#region src/infra/outbound/reply-policy.d.ts type ReplyToResolution = { replyToId?: string; source?: "explicit" | "implicit"; }; declare function createReplyToFanout(params: { replyToId?: string | null; replyToMode?: ReplyToMode; replyToIdSource?: ReplyToResolution["source"]; }): () => string | undefined; //#endregion //#region src/plugin-sdk/channel-outbound.d.ts type ChannelInboundKernelModule = typeof kernel_d_exports; declare const deliverInboundReplyWithMessageSendContext: ChannelInboundKernelModule["deliverInboundReplyWithMessageSendContext"]; declare function sendDurableMessageBatch(params: DurableMessageSendContextParams): Promise; declare function withDurableMessageSendContext(params: DurableMessageSendContextParams, run: (ctx: DurableMessageSendContext) => Promise): Promise; //#endregion export { ChannelMessageOutboundBridgeResult as $, LivePreviewFinalizerCapabilityProofResult as A, verifyChannelMessageReceiveAckPolicyProofs as B, ChannelMessageReceiveAckPolicyProofMap as C, DurableFinalCapabilityProofResult as D, DurableFinalCapabilityProofMap as E, verifyChannelMessageAdapterCapabilityProofs as F, DurableInboundReceiveCompleteOptions as G, verifyLivePreviewFinalizerCapabilityProofs as H, verifyChannelMessageLiveCapabilityAdapterProofs as I, DurableInboundReceiveJournalOptions as J, DurableInboundReceiveCompletedRecord as K, verifyChannelMessageLiveCapabilityProofs as L, listDeclaredDurableFinalCapabilities as M, listDeclaredLivePreviewFinalizerCapabilities as N, LivePreviewFinalizerCapabilityProof as O, listDeclaredReceiveAckPolicies as P, ChannelMessageOutboundBridgeAdapter as Q, verifyChannelMessageLiveFinalizerProofs as R, ChannelMessageReceiveAckPolicyProof as S, DurableFinalCapabilityProof as T, DurableInboundReceiveAcceptOptions as U, verifyDurableFinalCapabilityProofs as V, DurableInboundReceiveAcceptResult as W, DurableInboundReceiveReleaseOptions as X, DurableInboundReceivePendingRecord as Y, createDurableInboundReceiveJournal as Z, listMessageReceiptPlatformIds as _, createReplyToFanout as a, DurableMessageBatchSendResult as at, ChannelMessageLiveCapabilityProofMap as b, classifyDurableSendRecoveryState as c, MessageAckStage as d, CreateChannelMessageAdapterFromOutboundParams as et, MessageAckState as f, createMessageReceiptFromOutboundResults as g, shouldAckMessageAfterStage as h, ReplyToResolution as i, DurableMessageBatchSendParams as it, listDeclaredChannelMessageLiveCapabilities as j, LivePreviewFinalizerCapabilityProofMap as k, createDurableMessageStateRecord as l, createMessageReceiveContext as m, sendDurableMessageBatch as n, defineChannelMessageAdapter as nt, DurableMessageSendState as o, DurableMessageSendContext as ot, MessageReceiveContext as p, DurableInboundReceiveJournal as q, withDurableMessageSendContext as r, deriveDurableFinalDeliveryRequirements as rt, DurableMessageStateRecord as s, DurableMessageSendContextParams as st, deliverInboundReplyWithMessageSendContext as t, createChannelMessageAdapterFromOutbound as tt, MessageAckPolicy as u, resolveMessageReceiptPrimaryId as v, ChannelMessageReceiveAckPolicyProofResult as w, ChannelMessageLiveCapabilityProofResult as x, ChannelMessageLiveCapabilityProof as y, verifyChannelMessageReceiveAckPolicyAdapterProofs as z };