import { u as ReplyPayload } from "./types-CQee7pkj.js"; import { R as StreamingMode, T as ReplyToMode } from "./types.base-CrXPFJf5.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-D77zZaVv.js"; import { S as OutboundPayloadDeliverySuppressionReason, b as OutboundDeliveryResult } from "./outbound.types-CfSE45o1.js"; import { As as ChannelIngressQueuePruneOptions, nr as kernel_d_exports, ws as ChannelIngressQueue } from "./types-BftTUA7h.js"; import { r as PluginStateKeyedStore } from "./plugin-state-store.types-Bm0_upwK.js"; import { i as OutboundDeliveryIntent, t as DeliverOutboundPayloadsParams } from "./deliver-CiIAxhtB.js"; import { c as StreamingCompatEntry, t as ChannelProgressDraftLine } from "./streaming-DZCVNyI3.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 /** Derives the adapter capabilities core needs before it can require durable final delivery. */ 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; }; /** Defines a message adapter while defaulting receive acknowledgement to manual. */ declare function defineChannelMessageAdapter(adapter: TAdapter): ChannelMessageAdapter>; //#endregion //#region src/channels/message/outbound-bridge.d.ts /** Send result accepted from legacy outbound bridge methods before receipt normalization. */ type ChannelMessageOutboundBridgeResult = MessageReceiptSourceResult & { receipt?: MessageReceipt; messageId?: string; }; /** Legacy outbound adapter shape bridged into the channel message adapter contract. */ type ChannelMessageOutboundBridgeAdapter = { deliveryCapabilities?: { durableFinal?: DurableFinalDeliveryRequirementMap; }; sendText?: (ctx: ChannelMessageSendTextContext) => Promise; sendMedia?: (ctx: ChannelMessageSendMediaContext) => Promise; sendPayload?: (ctx: ChannelMessageSendPayloadContext) => Promise; sendPoll?: (ctx: ChannelMessageSendPollContext) => Promise; }; /** Options for building a message adapter from legacy outbound send functions. */ type CreateChannelMessageAdapterFromOutboundParams = { id?: string; outbound: ChannelMessageOutboundBridgeAdapter; capabilities?: DurableFinalDeliveryRequirementMap; live?: ChannelMessageLiveAdapterShape; receive?: ChannelMessageReceiveAdapterShape; }; /** Converts legacy outbound send methods into a typed channel message adapter. */ declare function createChannelMessageAdapterFromOutbound(params: CreateChannelMessageAdapterFromOutboundParams): ChannelMessageAdapterShape; //#endregion //#region src/channels/message/durable-receive.d.ts /** Pending inbound receive record kept until agent dispatch or durable send completes. */ type DurableInboundReceivePendingRecord = { id: string; payload: TPayload; metadata?: TMetadata; receivedAt: number; updatedAt: number; attempts: number; lastAttemptAt?: number; lastError?: string; }; /** Completed inbound receive tombstone used to detect duplicate platform events. */ type DurableInboundReceiveCompletedRecord = { id: string; completedAt: number; metadata?: TMetadata; }; /** Accept result for a new or duplicate inbound platform event. */ type DurableInboundReceiveAcceptResult = { kind: "accepted"; duplicate: false; record: DurableInboundReceivePendingRecord; } | { kind: "pending"; duplicate: true; record: DurableInboundReceivePendingRecord; } | { kind: "completed"; duplicate: true; record: DurableInboundReceiveCompletedRecord; }; /** Store-backed durable receive journal options. */ type DurableInboundReceiveJournalOptions = { pendingStore: PluginStateKeyedStore>; completedStore: PluginStateKeyedStore>; now?: () => number; pendingTtlMs?: number; completedTtlMs?: number; }; /** Options recorded when accepting a pending inbound event. */ type DurableInboundReceiveAcceptOptions = { metadata?: TMetadata; receivedAt?: number; }; /** Options recorded when marking an inbound event complete. */ type DurableInboundReceiveCompleteOptions = { metadata?: TCompletedMetadata; completedAt?: number; }; /** Options recorded when releasing an inbound event for retry. */ type DurableInboundReceiveReleaseOptions = { lastError?: string; releasedAt?: number; }; /** Durable receive journal facade used by channel receive pipelines. */ 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; }; /** Queue-backed durable receive journal options with optional retention pruning. */ type DurableInboundReceiveQueueJournalOptions = { queue: ChannelIngressQueue; retention?: ChannelIngressQueuePruneOptions; }; /** Creates a store-backed journal for accepting, completing, and retrying inbound events. */ declare function createDurableInboundReceiveJournal(options: DurableInboundReceiveJournalOptions): DurableInboundReceiveJournal; /** Adapts the shared channel ingress queue to the durable receive journal API. */ declare function createDurableInboundReceiveJournalFromQueue(options: DurableInboundReceiveQueueJournalOptions): DurableInboundReceiveJournal; //#endregion //#region src/channels/message/contracts.d.ts /** * Proof callback used to verify one declared durable-final delivery capability. */ type DurableFinalCapabilityProof = () => Promise | void; /** * Proof callbacks keyed by durable-final delivery capability. */ type DurableFinalCapabilityProofMap = Partial>; /** * Verification result for one durable-final delivery capability. */ type DurableFinalCapabilityProofResult = { capability: DurableFinalDeliveryCapability; status: "verified" | "not_declared"; }; /** * Proof callback used to verify one live-preview finalizer capability. */ type LivePreviewFinalizerCapabilityProof = () => Promise | void; /** * Proof callback used to verify one live message capability. */ type ChannelMessageLiveCapabilityProof = () => Promise | void; /** * Proof callback used to verify one receive acknowledgement policy. */ type ChannelMessageReceiveAckPolicyProof = () => Promise | void; /** * Proof callbacks keyed by live-preview finalizer capability. */ type LivePreviewFinalizerCapabilityProofMap = Partial>; /** * Proof callbacks keyed by live message capability. */ type ChannelMessageLiveCapabilityProofMap = Partial>; /** * Proof callbacks keyed by receive acknowledgement policy. */ type ChannelMessageReceiveAckPolicyProofMap = Partial>; /** * Verification result for one live-preview finalizer capability. */ type LivePreviewFinalizerCapabilityProofResult = { capability: LivePreviewFinalizerCapability; status: "verified" | "not_declared"; }; /** * Verification result for one live message capability. */ type ChannelMessageLiveCapabilityProofResult = { capability: ChannelMessageLiveCapability; status: "verified" | "not_declared"; }; /** * Verification result for one receive acknowledgement policy. */ type ChannelMessageReceiveAckPolicyProofResult = { policy: ChannelMessageReceiveAckPolicy; status: "verified" | "not_declared"; }; /** * Lists declared durable-final delivery capabilities in stable contract order. */ declare function listDeclaredDurableFinalCapabilities(capabilities: DurableFinalDeliveryRequirementMap | undefined): DurableFinalDeliveryCapability[]; /** * Lists declared live-preview finalizer capabilities in stable contract order. */ declare function listDeclaredLivePreviewFinalizerCapabilities(capabilities: LivePreviewFinalizerCapabilityMap | undefined): LivePreviewFinalizerCapability[]; /** * Lists declared live message capabilities in stable contract order. */ declare function listDeclaredChannelMessageLiveCapabilities(capabilities: Partial> | undefined): ChannelMessageLiveCapability[]; /** * Lists declared receive acknowledgement policies, including the default policy fallback. */ declare function listDeclaredReceiveAckPolicies(receive: ChannelMessageAdapterShape["receive"] | undefined): ChannelMessageReceiveAckPolicy[]; /** * Verifies proof callbacks for every declared durable-final delivery capability. */ declare function verifyDurableFinalCapabilityProofs(params: { adapterName: string; capabilities?: DurableFinalDeliveryRequirementMap; proofs: DurableFinalCapabilityProofMap; }): Promise; /** * Verifies proof callbacks for every declared live-preview finalizer capability. */ declare function verifyLivePreviewFinalizerCapabilityProofs(params: { adapterName: string; capabilities?: LivePreviewFinalizerCapabilityMap; proofs: LivePreviewFinalizerCapabilityProofMap; }): Promise; /** * Verifies proof callbacks for every declared live message capability. */ declare function verifyChannelMessageLiveCapabilityProofs(params: { adapterName: string; capabilities?: Partial>; proofs: ChannelMessageLiveCapabilityProofMap; }): Promise; /** * Verifies proof callbacks for every declared receive acknowledgement policy. */ declare function verifyChannelMessageReceiveAckPolicyProofs(params: { adapterName: string; receive?: ChannelMessageAdapterShape["receive"]; proofs: ChannelMessageReceiveAckPolicyProofMap; }): Promise; /** * Verifies durable-final proofs from a channel message adapter declaration. */ declare function verifyChannelMessageAdapterCapabilityProofs(params: { adapterName: string; adapter: Pick; proofs: DurableFinalCapabilityProofMap; }): Promise; /** * Verifies receive acknowledgement proofs from a channel message adapter declaration. */ declare function verifyChannelMessageReceiveAckPolicyAdapterProofs(params: { adapterName: string; adapter: Pick; proofs: ChannelMessageReceiveAckPolicyProofMap; }): Promise; /** * Verifies live-preview finalizer proofs from a channel message adapter declaration. */ declare function verifyChannelMessageLiveFinalizerProofs(params: { adapterName: string; adapter: Pick; proofs: LivePreviewFinalizerCapabilityProofMap; }): Promise; /** * Verifies live message capability proofs from a channel message adapter declaration. */ declare function verifyChannelMessageLiveCapabilityAdapterProofs(params: { adapterName: string; adapter: Pick; proofs: ChannelMessageLiveCapabilityProofMap; }): Promise; //#endregion //#region src/channels/message/receipt.d.ts type MessageReceiptInputResult = MessageReceiptSourceResult & { receipt?: MessageReceipt; }; /** Builds one normalized receipt from platform send results or nested adapter receipts. */ declare function createMessageReceiptFromOutboundResults(params: { results: readonly MessageReceiptInputResult[]; kind?: MessageReceiptPartKind; threadId?: string; replyToId?: string; sentAt?: number; }): MessageReceipt; /** Lists unique platform message ids in receipt order. */ declare function listMessageReceiptPlatformIds(receipt: MessageReceipt): string[]; /** Resolves the explicit primary platform id, falling back to the first unique receipt id. */ declare function resolveMessageReceiptPrimaryId(receipt: MessageReceipt): string | undefined; //#endregion //#region src/channels/message/receive.d.ts /** Public alias for channel receive acknowledgement policy names. */ type MessageAckPolicy = ChannelMessageReceiveAckPolicy; /** Processing stage where a durable inbound message may be acknowledged. */ type MessageAckStage = "receive_record" | "agent_dispatch" | "durable_send" | "manual"; /** Current acknowledgement state for one inbound message context. */ type MessageAckState = "pending" | "acked" | "nacked"; /** Mutable receive context passed through durable inbound message processing. */ 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; }; /** Returns whether an ack policy should acknowledge at the supplied processing stage. */ declare function shouldAckMessageAfterStage(policy: MessageAckPolicy, stage: MessageAckStage): boolean; /** Creates a receive context with idempotent ack and explicit nack state transitions. */ 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 /** Durable send state stored for recovery and operator-visible delivery status. */ type DurableMessageSendState = "pending" | "sent" | "suppressed" | "failed" | "unknown_after_send"; /** Recovery record for one durable outbound message intent. */ type DurableMessageStateRecord = { intent: DurableMessageSendIntent; state: DurableMessageSendState; receipt?: MessageReceipt; updatedAt: number; errorMessage?: string; }; /** Creates a durable message recovery record from intent, receipt, and optional error state. */ declare function createDurableMessageStateRecord(params: { intent: DurableMessageSendIntent; state?: DurableMessageSendState; receipt?: MessageReceipt; updatedAt?: number; error?: unknown; }): DurableMessageStateRecord; /** Classifies recovery state from persisted intent/receipt facts after a send interruption. */ declare function classifyDurableSendRecoveryState(params: { hasIntent: boolean; hasReceipt: boolean; platformSendMayHaveStarted: boolean; failed?: boolean; suppressed?: boolean; }): DurableMessageSendState; //#endregion //#region src/infra/outbound/reply-policy.d.ts /** Resolved reply target plus whether it came from payload or ambient context. */ type ReplyToResolution = { replyToId?: string; source?: "explicit" | "implicit"; }; /** Creates a reply-to supplier that consumes implicit single-use reply ids once. */ declare function createReplyToFanout(params: { replyToId?: string | null; replyToMode?: ReplyToMode; replyToIdSource?: ReplyToResolution["source"]; }): () => string | undefined; //#endregion //#region src/channels/progress-draft-compositor.d.ts type ChannelProgressDraftMode = StreamingMode; type ChannelProgressDraftCompositor = ReturnType; type ProgressDraftLine = string | ChannelProgressDraftLine; /** Creates a stateful compositor for one streaming channel reply. */ declare function createChannelProgressDraftCompositor(params: { entry: StreamingCompatEntry | null | undefined; mode: ChannelProgressDraftMode; active: boolean; seed: string; update: (text: string, options?: { flush?: boolean; }) => Promise | void; deleteCurrent?: () => Promise | void; tryNativeUpdate?: (text: string) => Promise | boolean; formatLine?: (line: string) => string; isEmptyLine?: (line: ProgressDraftLine | undefined) => boolean; shouldStartNow?: (line: ProgressDraftLine | undefined) => boolean; }): { readonly previewToolProgressEnabled: boolean; readonly commentaryProgressEnabled: boolean; readonly suppressDefaultToolProgressMessages: boolean; readonly hasStarted: boolean; markFinalReplyStarted(): void; markFinalReplyDelivered(): void; reset(): void; suppress(): void; cancel(): void; start(): Promise; pushToolProgress: (line?: ProgressDraftLine, options?: { toolName?: string; startImmediately?: boolean; }) => Promise; pushReasoningProgress(text?: string, options?: { snapshot?: boolean; }): Promise; pushCommentaryProgress(text?: string, options?: { itemId?: string; }): Promise; }; //#endregion //#region src/plugin-sdk/channel-outbound.d.ts type ChannelInboundKernelModule = typeof kernel_d_exports; /** Lazily forwards inbound reply delivery through the channel turn kernel. */ declare const deliverInboundReplyWithMessageSendContext: ChannelInboundKernelModule["deliverInboundReplyWithMessageSendContext"]; /** Sends a durable message batch without eager-loading channel message runtime internals. */ declare function sendDurableMessageBatch( /** * Durable send context and outbound batch data forwarded to the channel runtime. */ params: DurableMessageSendContextParams): Promise; /** Runs work inside a durable message send context loaded through the SDK lazy boundary. */ declare function withDurableMessageSendContext( /** * Durable send context used to bind sends, receipts, and lifecycle callbacks. */ params: DurableMessageSendContextParams, /** * Callback executed with the loaded durable-send runtime context. */ run: (ctx: DurableMessageSendContext) => Promise): Promise; //#endregion export { DurableInboundReceiveQueueJournalOptions as $, DurableFinalCapabilityProofResult as A, verifyChannelMessageLiveCapabilityProofs as B, ChannelMessageLiveCapabilityProofMap as C, ChannelMessageReceiveAckPolicyProofResult as D, ChannelMessageReceiveAckPolicyProofMap as E, listDeclaredDurableFinalCapabilities as F, verifyLivePreviewFinalizerCapabilityProofs as G, verifyChannelMessageReceiveAckPolicyAdapterProofs as H, listDeclaredLivePreviewFinalizerCapabilities as I, DurableInboundReceiveCompleteOptions as J, DurableInboundReceiveAcceptOptions as K, listDeclaredReceiveAckPolicies as L, LivePreviewFinalizerCapabilityProofMap as M, LivePreviewFinalizerCapabilityProofResult as N, DurableFinalCapabilityProof as O, listDeclaredChannelMessageLiveCapabilities as P, DurableInboundReceivePendingRecord as Q, verifyChannelMessageAdapterCapabilityProofs as R, ChannelMessageLiveCapabilityProof as S, ChannelMessageReceiveAckPolicyProof as T, verifyChannelMessageReceiveAckPolicyProofs as U, verifyChannelMessageLiveFinalizerProofs as V, verifyDurableFinalCapabilityProofs as W, DurableInboundReceiveJournal as X, DurableInboundReceiveCompletedRecord as Y, DurableInboundReceiveJournalOptions as Z, createMessageReceiveContext as _, ChannelProgressDraftMode as a, CreateChannelMessageAdapterFromOutboundParams as at, listMessageReceiptPlatformIds as b, createReplyToFanout as c, deriveDurableFinalDeliveryRequirements as ct, classifyDurableSendRecoveryState as d, DurableMessageSendContext as dt, DurableInboundReceiveReleaseOptions as et, createDurableMessageStateRecord as f, DurableMessageSendContextParams as ft, MessageReceiveContext as g, MessageAckState as h, ChannelProgressDraftCompositor as i, ChannelMessageOutboundBridgeResult as it, LivePreviewFinalizerCapabilityProof as j, DurableFinalCapabilityProofMap as k, DurableMessageSendState as l, DurableMessageBatchSendParams as lt, MessageAckStage as m, sendDurableMessageBatch as n, createDurableInboundReceiveJournalFromQueue as nt, createChannelProgressDraftCompositor as o, createChannelMessageAdapterFromOutbound as ot, MessageAckPolicy as p, DurableInboundReceiveAcceptResult as q, withDurableMessageSendContext as r, ChannelMessageOutboundBridgeAdapter as rt, ReplyToResolution as s, defineChannelMessageAdapter as st, deliverInboundReplyWithMessageSendContext as t, createDurableInboundReceiveJournal as tt, DurableMessageStateRecord as u, DurableMessageBatchSendResult as ut, shouldAckMessageAfterStage as v, ChannelMessageLiveCapabilityProofResult as w, resolveMessageReceiptPrimaryId as x, createMessageReceiptFromOutboundResults as y, verifyChannelMessageLiveCapabilityAdapterProofs as z };