惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
IT之家
IT之家
博客园 - 聂微东
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
小众软件
小众软件
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
量子位
月光博客
月光博客
博客园 - 【当耐特】
博客园 - 叶小钗

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
Telegram: keep verbose tool results separate from final a...
jalehman · 2026-05-12 · via Recent Commits to openclaw:main

@@ -588,6 +588,19 @@ export const dispatchTelegramMessage = async ({

588588

let streamToolProgressSuppressed = false;

589589

let streamToolProgressLines: string[] = [];

590590

let lastAnswerPartialText = "";

591+

let activeAnswerDraftIsToolProgressOnly = false;

592+

function resetAnswerToolProgressDraft() {

593+

activeAnswerDraftIsToolProgressOnly = false;

594+

}

595+

async function prepareAnswerLaneForToolProgress() {

596+

if (activeAnswerDraftIsToolProgressOnly) {

597+

return;

598+

}

599+

if (answerLane.hasStreamedMessage) {

600+

await rotateLaneForNewMessage(answerLane);

601+

}

602+

activeAnswerDraftIsToolProgressOnly = true;

603+

}

591604

const renderProgressDraft = async (options?: { flush?: boolean }) => {

592605

if (!answerLane.stream || streamMode !== "progress") {

593606

return;

@@ -601,6 +614,7 @@ export const dispatchTelegramMessage = async ({

601614

if (!streamText || streamText === answerLane.lastPartialText) {

602615

return;

603616

}

617+

await prepareAnswerLaneForToolProgress();

604618

answerLane.lastPartialText = streamText;

605619

answerLane.hasStreamedMessage = true;

606620

answerLane.finalized = false;

@@ -640,6 +654,7 @@ export const dispatchTelegramMessage = async ({

640654

seed: progressSeed,

641655

formatLine: formatProgressAsMarkdownCode,

642656

});

657+

await prepareAnswerLaneForToolProgress();

643658

answerLane.lastPartialText = streamText;

644659

answerLane.hasStreamedMessage = true;

645660

answerLane.finalized = false;

@@ -732,6 +747,9 @@ export const dispatchTelegramMessage = async ({

732747

}

733748

lane.hasStreamedMessage = false;

734749

lane.finalized = false;

750+

if (lane === answerLane) {

751+

resetAnswerToolProgressDraft();

752+

}

735753

};

736754

const rotateLaneForNewMessage = async (lane: DraftLaneState) => {

737755

if (!lane.hasStreamedMessage && typeof lane.stream?.messageId() !== "number") {

@@ -742,7 +760,21 @@ export const dispatchTelegramMessage = async ({

742760

lane.stream?.forceNewMessage();

743761

resetDraftLaneState(lane);

744762

};

763+

const rotateAnswerLaneAfterToolProgress = async () => {

764+

if (!activeAnswerDraftIsToolProgressOnly) {

765+

return false;

766+

}

767+

await answerLane.stream?.stop();

768+

answerLane.stream?.forceNewMessage();

769+

resetDraftLaneState(answerLane);

770+

streamToolProgressSuppressed = true;

771+

streamToolProgressLines = [];

772+

return true;

773+

};

745774

const prepareAnswerLaneForText = async () => {

775+

if (await rotateAnswerLaneAfterToolProgress()) {

776+

return;

777+

}

746778

if (!answerLane.finalized) {

747779

return;

748780

}

@@ -762,6 +794,7 @@ export const dispatchTelegramMessage = async ({

762794

if (streamMode === "progress") {

763795

return;

764796

}

797+

resetAnswerToolProgressDraft();

765798

streamToolProgressSuppressed = true;

766799

streamToolProgressLines = [];

767800

}

@@ -1092,8 +1125,12 @@ export const dispatchTelegramMessage = async ({

10921125

payload: ReplyPayload,

10931126

text: string,

10941127

): Promise<LaneDeliveryResult> => {

1095-

await answerLane.stream?.clear();

1096-

resetDraftLaneState(answerLane);

1128+

if (activeAnswerDraftIsToolProgressOnly) {

1129+

await rotateAnswerLaneAfterToolProgress();

1130+

} else {

1131+

await answerLane.stream?.clear();

1132+

resetDraftLaneState(answerLane);

1133+

}

10971134

const delivered = await sendPayload(applyTextToPayload(payload, text), { durable: true });

10981135

answerLane.finalized = true;

10991136

return delivered ? { kind: "sent" } : { kind: "skipped" };

@@ -1216,6 +1253,24 @@ export const dispatchTelegramMessage = async ({

12161253

const segments = split.segments;

12171254

const reply = resolveSendableOutboundReplyParts(effectivePayload);

121812551256+

const deliverFinalAnswerText = async (

1257+

answerPayload: ReplyPayload,

1258+

text: string,

1259+

buttons?: TelegramInlineButtons,

1260+

) => {

1261+

if (streamMode === "progress") {

1262+

return deliverProgressModeFinalAnswer(answerPayload, text);

1263+

}

1264+

await rotateAnswerLaneAfterToolProgress();

1265+

return deliverLaneText({

1266+

laneName: "answer",

1267+

text,

1268+

payload: answerPayload,

1269+

infoKind: "final",

1270+

buttons,

1271+

});

1272+

};

1273+12191274

const flushBufferedFinalAnswer = async () => {

12201275

const buffered =

12211276

reasoningStepState.takeBufferedFinalAnswer(replyFenceGeneration);

@@ -1227,13 +1282,11 @@ export const dispatchTelegramMessage = async ({

12271282

| { buttons?: TelegramInlineButtons }

12281283

| undefined

12291284

)?.buttons;

1230-

await deliverLaneText({

1231-

laneName: "answer",

1232-

text: buffered.text,

1233-

payload: buffered.payload,

1234-

infoKind: "final",

1235-

buttons: bufferedButtons,

1236-

});

1285+

await deliverFinalAnswerText(

1286+

buffered.payload,

1287+

buffered.text,

1288+

bufferedButtons,

1289+

);

12371290

reasoningStepState.resetForNextStep();

12381291

};

12391292

@@ -1254,13 +1307,15 @@ export const dispatchTelegramMessage = async ({

12541307

if (segment.lane === "reasoning") {

12551308

reasoningStepState.noteReasoningHint();

12561309

}

1310+

if (segment.lane === "answer" && info.kind === "tool") {

1311+

await prepareAnswerLaneForToolProgress();

1312+

}

12571313

const result =

1258-

streamMode === "progress" &&

1259-

segment.lane === "answer" &&

1260-

info.kind === "final"

1261-

? await deliverProgressModeFinalAnswer(

1314+

segment.lane === "answer" && info.kind === "final"

1315+

? await deliverFinalAnswerText(

12621316

effectivePayload,

12631317

segment.update.text,

1318+

telegramButtons,

12641319

)

12651320

: await deliverLaneText({

12661321

laneName: segment.lane,

@@ -1315,6 +1370,7 @@ export const dispatchTelegramMessage = async ({

13151370

}

1316137113171372

if (info.kind === "final") {

1373+

await rotateAnswerLaneAfterToolProgress();

13181374

await answerLane.stream?.stop();

13191375

await reasoningLane.stream?.stop();

13201376

reasoningStepState.resetForNextStep();