openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
29 lines (28 loc) • 1.41 kB
JavaScript
import { r as createLazyRuntimeModule } from "./lazy-runtime-zGjszCtt.mjs";
import { w as runWithGatewayIndependentRootWorkAdmission } from "./gateway-work-admission-79pid1hQ.mjs";
import { t as captureDeliveryQueueStateContext } from "./delivery-queue-state-context-Cxp-xMAQ.mjs";
import "./delivery-queue-sqlite-lyIJZlO0.mjs";
import { t as drainPendingDeliveriesCore } from "./delivery-queue-recovery-Cwouxa5a.mjs";
//#region src/plugin-sdk/delivery-queue-runtime.ts
const loadOutboundDeliverRuntime = createLazyRuntimeModule(() => import("./deliver-runtime-DEFuEFQa.mjs"));
/**
* Drain queued outbound payloads after a channel reconnect or transport recovery.
* When no deliver function is provided, the heavy outbound delivery runtime is
* loaded lazily so importing this SDK subpath does not eagerly bind send internals.
*/
async function drainPendingDeliveries(e) {
const t = captureDeliveryQueueStateContext(e.stateDir);
await runWithGatewayIndependentRootWorkAdmission(async () => {
const n = e.deliver ?? (await loadOutboundDeliverRuntime()).deliverOutboundPayloadsInternal;
await drainPendingDeliveriesCore({
...e,
deliver: n,
selectEntry: (t, n) => t.deliveryCompletion?.kind === "conversation" ? {
match: false,
bypassBackoff: false
} : e.selectEntry(t, n)
}, e.deliver ? void 0 : n, t);
}, "delivery-queue:drain");
}
//#endregion
export { drainPendingDeliveries as t };