Skip to content

Commit e311943

Browse files
authored
refactor(telegram): localize private implementation types (#100975)
1 parent 063eeb6 commit e311943

26 files changed

Lines changed: 49 additions & 57 deletions

extensions/telegram/src/allowed-updates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Telegram plugin module implements allowed updates behavior.
22
import { API_CONSTANTS } from "grammy";
33

4-
export type TelegramUpdateType = (typeof API_CONSTANTS.ALL_UPDATE_TYPES)[number];
4+
type TelegramUpdateType = (typeof API_CONSTANTS.ALL_UPDATE_TYPES)[number];
55

66
export const DEFAULT_TELEGRAM_UPDATE_TYPES: ReadonlyArray<TelegramUpdateType> =
77
API_CONSTANTS.DEFAULT_UPDATE_TYPES;

extensions/telegram/src/approval-handler.runtime.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ type TelegramPendingDelivery = {
3636
buttons: ReturnType<typeof resolveTelegramInlineButtons>;
3737
};
3838

39-
export type TelegramExecApprovalHandlerDeps = {
39+
type TelegramExecApprovalHandlerDeps = {
4040
nowMs?: () => number;
4141
sendTyping?: typeof sendTypingTelegram;
4242
sendMessage?: typeof sendMessageTelegram;
4343
editReplyMarkup?: typeof editMessageReplyMarkupTelegram;
4444
};
4545

46-
export type TelegramApprovalHandlerContext = {
46+
type TelegramApprovalHandlerContext = {
4747
token: string;
4848
deps?: TelegramExecApprovalHandlerDeps;
4949
};

extensions/telegram/src/bot-info-cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type TelegramBotInfoCacheState = {
1919
botInfo: TelegramBotInfo;
2020
};
2121

22-
export type CachedTelegramBotInfo = {
22+
type CachedTelegramBotInfo = {
2323
botInfo: TelegramBotInfo;
2424
fetchedAt: string;
2525
};

extensions/telegram/src/bot-message-context.session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
} from "./group-history-window.js";
5959
import type { TelegramReplyChainEntry } from "./message-cache.js";
6060

61-
export type TelegramInboundContextPayload = BuiltChannelInboundEventContext & {
61+
type TelegramInboundContextPayload = BuiltChannelInboundEventContext & {
6262
From: string;
6363
To: string;
6464
ChatType: string;

extensions/telegram/src/bot-message-dispatch.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ type DispatchTelegramMessageParams = {
246246
suppressFailureFallback?: boolean;
247247
};
248248

249-
export type TelegramDispatchResult =
250-
| { kind: "completed" }
251-
| { kind: "failed-retryable"; error: unknown };
249+
type TelegramDispatchResult = { kind: "completed" } | { kind: "failed-retryable"; error: unknown };
252250

253251
type TelegramReasoningLevel = "off" | "on" | "stream";
254252

extensions/telegram/src/conversation-route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export type TelegramConversationBindingMode =
3737
}
3838
| { kind: "plugin-owned-runtime" };
3939

40-
export type TelegramConversationRouteResult = {
40+
type TelegramConversationRouteResult = {
4141
route: TelegramResolvedRoute;
4242
bindingMode: TelegramConversationBindingMode;
4343
};

extensions/telegram/src/exec-approval-resolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway
33
import type { ExecApprovalReplyDecision } from "openclaw/plugin-sdk/approval-reply-runtime";
44
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
55

6-
export type ResolveTelegramExecApprovalParams = {
6+
type ResolveTelegramExecApprovalParams = {
77
cfg: OpenClawConfig;
88
approvalId: string;
99
decision: ExecApprovalReplyDecision;

extensions/telegram/src/format.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const TELEGRAM_RICH_NESTING_LIMIT = 16;
2424

2525
export type TelegramRichHtmlDegradationReason = "table-ascii";
2626

27-
export type TelegramOutboundRichHtmlNormalization = {
27+
type TelegramOutboundRichHtmlNormalization = {
2828
html: string;
2929
degradationReasons: readonly TelegramRichHtmlDegradationReason[];
3030
};
@@ -803,7 +803,7 @@ function normalizeTelegramLegacyHtmlTables(html: string): string {
803803
});
804804
}
805805

806-
export function limitTelegramRichHtmlNesting(html: string, maxDepth: number): string {
806+
function limitTelegramRichHtmlNesting(html: string, maxDepth: number): string {
807807
const normalizedMaxDepth = Math.max(1, Math.floor(maxDepth));
808808
const stack: Array<{ name: string; kept: boolean }> = [];
809809
let keptDepth = 0;

extensions/telegram/src/inbound-event-delivery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Telegram plugin module implements inbound event delivery behavior.
22
import { stripTelegramInternalPrefixes } from "./targets.js";
33

4-
export type TelegramInboundEventDeliveryEnd = () => void;
4+
type TelegramInboundEventDeliveryEnd = () => void;
55

66
type ActiveInboundEvent = {
77
outboundTo: string;
@@ -39,7 +39,7 @@ function telegramDeliveryTargetsMatch(expected: string, actual: string): boolean
3939
);
4040
}
4141

42-
export function resolveTelegramInboundEventDeliveryCorrelationKey(
42+
function resolveTelegramInboundEventDeliveryCorrelationKey(
4343
sessionKey: string | undefined,
4444
inboundEventKind?: string,
4545
): string | undefined {

extensions/telegram/src/message-cache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export type TelegramCachedMessageNode = Omit<TelegramReplyChainEntry, "messageId
2424
sourceMessage: Message;
2525
};
2626

27-
export type TelegramConversationContextNode = {
27+
type TelegramConversationContextNode = {
2828
node: TelegramCachedMessageNode;
2929
isReplyTarget?: boolean;
3030
};
3131

32-
export type TelegramMessageCache = {
32+
type TelegramMessageCache = {
3333
record: (params: {
3434
accountId: string;
3535
chatId: string | number;
@@ -96,7 +96,7 @@ export const TELEGRAM_MESSAGE_CACHE_PERSISTENT_NAMESPACE = "telegram.message-cac
9696
const PERSISTENT_BUCKET_KEY = `plugin-state:${TELEGRAM_MESSAGE_CACHE_PERSISTENT_NAMESPACE}`;
9797
const persistedMessageCacheBuckets = new Map<string, TelegramMessageCacheBucket>();
9898

99-
export type PersistedTelegramMessageCacheValue = {
99+
type PersistedTelegramMessageCacheValue = {
100100
sourceMessage: Message;
101101
threadId?: string;
102102
};

0 commit comments

Comments
 (0)