



























@@ -2,12 +2,17 @@ import {
22type ChannelDoctorAdapter,
33type ChannelDoctorEmptyAllowlistAccountContext,
44} from "openclaw/plugin-sdk/channel-contract";
5+import {
6+resolveChannelStreamingBlockEnabled,
7+resolveChannelStreamingPreviewToolProgress,
8+} from "openclaw/plugin-sdk/channel-streaming";
59import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
610import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
711import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
812import { inspectTelegramAccount } from "./account-inspect.js";
913import {
1014listTelegramAccountIds,
15+mergeTelegramAccountConfig,
1116resolveDefaultTelegramAccountId,
1217resolveTelegramAccount,
1318} from "./accounts.js";
@@ -18,8 +23,10 @@ import {
1823legacyConfigRules as TELEGRAM_LEGACY_CONFIG_RULES,
1924normalizeCompatibilityConfig as normalizeTelegramCompatibilityConfig,
2025} from "./doctor-contract.js";
26+import { resolveTelegramPreviewStreamMode } from "./preview-streaming.js";
21272228type TelegramAllowFromInvalidHit = { path: string; entry: string };
29+type TelegramSelectedQuoteToolProgressHit = { path: string; replyToMode: string };
2330type TelegramApiRootBotEndpointHit = {
2431path: string;
2532pathSegments: string[];
@@ -196,6 +203,58 @@ export function collectTelegramApiRootWarnings(params: {
196203];
197204}
198205206+function formatTelegramAccountConfigPath(cfg: OpenClawConfig, accountId: string): string {
207+const telegram = asObjectRecord((cfg.channels as Record<string, unknown> | undefined)?.telegram);
208+const accounts = asObjectRecord(telegram?.accounts);
209+if (!accounts || Object.keys(accounts).length === 0) {
210+return "channels.telegram";
211+}
212+return accountId === "default" ? "channels.telegram" : `channels.telegram.accounts.${accountId}`;
213+}
214+215+export function scanTelegramSelectedQuoteToolProgressWarnings(
216+cfg: OpenClawConfig,
217+): TelegramSelectedQuoteToolProgressHit[] {
218+if (!asObjectRecord((cfg.channels as Record<string, unknown> | undefined)?.telegram)) {
219+return [];
220+}
221+return listTelegramAccountIds(cfg).flatMap((accountId) => {
222+const account = mergeTelegramAccountConfig(cfg, accountId);
223+const replyToMode = account.replyToMode ?? "off";
224+if (replyToMode === "off") {
225+return [];
226+}
227+if (resolveTelegramPreviewStreamMode(account) === "off") {
228+return [];
229+}
230+const blockStreamingEnabled =
231+resolveChannelStreamingBlockEnabled(account) ??
232+cfg.agents?.defaults?.blockStreamingDefault === "on";
233+if (blockStreamingEnabled || !resolveChannelStreamingPreviewToolProgress(account)) {
234+return [];
235+}
236+return [
237+{
238+path: formatTelegramAccountConfigPath(cfg, accountId),
239+ replyToMode,
240+},
241+];
242+});
243+}
244+245+export function collectTelegramSelectedQuoteToolProgressWarnings(params: {
246+hits: TelegramSelectedQuoteToolProgressHit[];
247+}): string[] {
248+if (params.hits.length === 0) {
249+return [];
250+}
251+const sample = params.hits[0] ?? { path: "channels.telegram", replyToMode: "first" };
252+return [
253+`- ${sanitizeForLog(sample.path)} has replyToMode: "${sanitizeForLog(sample.replyToMode)}" while Telegram preview tool-progress is enabled. Telegram selected quote replies must send the final answer through the native quote-reply path, so those turns skip the short "Working..." tool-progress preview. Current-message replies without selected quote text still keep preview streaming.`,
254+'- Set replyToMode: "off" when tool-progress preview matters more than native quote replies, or set streaming.preview.toolProgress: false to keep quote replies and silence this warning.',
255+];
256+}
257+199258export function maybeRepairTelegramApiRoots(cfg: OpenClawConfig): {
200259config: OpenClawConfig;
201260changes: string[];
@@ -506,6 +565,9 @@ export const telegramDoctor: ChannelDoctorAdapter = {
506565hits: scanTelegramBotEndpointApiRoots(cfg),
507566 doctorFixCommand,
508567}),
568+ ...collectTelegramSelectedQuoteToolProgressWarnings({
569+hits: scanTelegramSelectedQuoteToolProgressWarnings(cfg),
570+}),
509571],
510572repairConfig: async ({ cfg }) => await repairTelegramConfig({ cfg }),
511573collectEmptyAllowlistExtraWarnings: collectTelegramEmptyAllowlistExtraWarnings,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。