UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

56 lines (55 loc) • 2.14 kB
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import type { TelegramInlineButtons } from "./button-types.js"; import type { TelegramDraftStream } from "./draft-stream.js"; export type LaneName = "answer" | "reasoning"; export type DraftLaneState = { stream: TelegramDraftStream | undefined; lastPartialText: string; hasStreamedMessage: boolean; }; export type ArchivedPreview = { messageId: number; textSnapshot: string; deleteIfUnused?: boolean; }; export type LanePreviewLifecycle = "transient" | "complete"; export type LaneDeliveryResult = { kind: "preview-finalized"; delivery: { content: string; messageId?: number; }; } | { kind: "preview-retained" | "preview-updated" | "sent" | "skipped"; }; type CreateLaneTextDelivererParams = { lanes: Record<LaneName, DraftLaneState>; archivedAnswerPreviews: ArchivedPreview[]; activePreviewLifecycleByLane: Record<LaneName, LanePreviewLifecycle>; retainPreviewOnCleanupByLane: Record<LaneName, boolean>; draftMaxChars: number; applyTextToPayload: (payload: ReplyPayload, text: string) => ReplyPayload; sendPayload: (payload: ReplyPayload) => Promise<boolean>; flushDraftLane: (lane: DraftLaneState) => Promise<void>; stopDraftLane: (lane: DraftLaneState) => Promise<void>; editPreview: (params: { laneName: LaneName; messageId: number; text: string; context: "final" | "update"; previewButtons?: TelegramInlineButtons; }) => Promise<void>; deletePreviewMessage: (messageId: number) => Promise<void>; log: (message: string) => void; markDelivered: () => void; }; type DeliverLaneTextParams = { laneName: LaneName; text: string; payload: ReplyPayload; infoKind: string; previewButtons?: TelegramInlineButtons; allowPreviewUpdateForNonFinal?: boolean; }; export declare function createLaneTextDeliverer(params: CreateLaneTextDelivererParams): ({ laneName, text, payload, infoKind, previewButtons, allowPreviewUpdateForNonFinal, }: DeliverLaneTextParams) => Promise<LaneDeliveryResult>; export {};