mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:04:31 +00:00
refactor(outbound): dedupe queued delivery param types
This commit is contained in:
@@ -65,19 +65,21 @@ export async function ensureQueueDir(stateDir?: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Persist a delivery entry to disk before attempting send. Returns the entry ID. */
|
/** Persist a delivery entry to disk before attempting send. Returns the entry ID. */
|
||||||
|
type QueuedDeliveryParams = {
|
||||||
|
channel: Exclude<OutboundChannel, "none">;
|
||||||
|
to: string;
|
||||||
|
accountId?: string;
|
||||||
|
payloads: ReplyPayload[];
|
||||||
|
threadId?: string | number | null;
|
||||||
|
replyToId?: string | null;
|
||||||
|
bestEffort?: boolean;
|
||||||
|
gifPlayback?: boolean;
|
||||||
|
silent?: boolean;
|
||||||
|
mirror?: DeliveryMirrorPayload;
|
||||||
|
};
|
||||||
|
|
||||||
export async function enqueueDelivery(
|
export async function enqueueDelivery(
|
||||||
params: {
|
params: QueuedDeliveryParams,
|
||||||
channel: Exclude<OutboundChannel, "none">;
|
|
||||||
to: string;
|
|
||||||
accountId?: string;
|
|
||||||
payloads: ReplyPayload[];
|
|
||||||
threadId?: string | number | null;
|
|
||||||
replyToId?: string | null;
|
|
||||||
bestEffort?: boolean;
|
|
||||||
gifPlayback?: boolean;
|
|
||||||
silent?: boolean;
|
|
||||||
mirror?: DeliveryMirrorPayload;
|
|
||||||
},
|
|
||||||
stateDir?: string,
|
stateDir?: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const queueDir = await ensureQueueDir(stateDir);
|
const queueDir = await ensureQueueDir(stateDir);
|
||||||
@@ -191,20 +193,13 @@ export function computeBackoffMs(retryCount: number): number {
|
|||||||
return BACKOFF_MS[Math.min(retryCount - 1, BACKOFF_MS.length - 1)] ?? BACKOFF_MS.at(-1) ?? 0;
|
return BACKOFF_MS[Math.min(retryCount - 1, BACKOFF_MS.length - 1)] ?? BACKOFF_MS.at(-1) ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DeliverFn = (params: {
|
export type DeliverFn = (
|
||||||
cfg: OpenClawConfig;
|
params: {
|
||||||
channel: Exclude<OutboundChannel, "none">;
|
cfg: OpenClawConfig;
|
||||||
to: string;
|
} & QueuedDeliveryParams & {
|
||||||
accountId?: string;
|
skipQueue?: boolean;
|
||||||
payloads: ReplyPayload[];
|
},
|
||||||
threadId?: string | number | null;
|
) => Promise<unknown>;
|
||||||
replyToId?: string | null;
|
|
||||||
bestEffort?: boolean;
|
|
||||||
gifPlayback?: boolean;
|
|
||||||
silent?: boolean;
|
|
||||||
mirror?: DeliveryMirrorPayload;
|
|
||||||
skipQueue?: boolean;
|
|
||||||
}) => Promise<unknown>;
|
|
||||||
|
|
||||||
export interface RecoveryLogger {
|
export interface RecoveryLogger {
|
||||||
info(msg: string): void;
|
info(msg: string): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user