feat(tg): 去掉 '> Thinking…' 思考提示流水

用户要求:不再发送思考指示(assistant/chunk 的 reasoning 分支整段移除,
连带 thinkingSessions 状态与相关清理)。tool/call、tool/result、todo/write、
turn/end 的流水保持不变。
This commit is contained in:
dsh-agent
2026-09-14 19:16:28 +08:00
parent 9a45bde25a
commit 5fa2827ed6
3 changed files with 0 additions and 41 deletions
-19
View File
@@ -113,8 +113,6 @@ export class TelegramBridge {
disposeApprovalHook;
/** dsh 0.1.5 起 ask 走 'user-questions/request' waterfall(不再有 userQuestions.provider)。 */
disposeUserQuestionHook;
/** sessionId → thinking indicator state (one notice per reasoning phase) */
thinkingSessions = new Map();
/** callId → tool name (tool/result failure notices) */
callNames = new Map();
/** sessionId → latest todo snapshot (/mission) */
@@ -199,7 +197,6 @@ export class TelegramBridge {
this.noticeQueue.clear();
this.pendingAsks.clear();
this.pendingApprovalsTG.clear();
this.thinkingSessions.clear();
this.callNames.clear();
this.lastTodos.clear();
for (const controller of this.compactAborts.values())
@@ -1101,7 +1098,6 @@ export class TelegramBridge {
}
if (event.type === 'turn/end') {
this.busySessions.delete(id);
this.thinkingSessions.delete(id);
for (const b of targets)
this.stopTypingHeartbeat(b.chatId);
// Abnormal endings (API failure / abort / crash-recovery) must be
@@ -1129,7 +1125,6 @@ export class TelegramBridge {
const name = event.data?.name ?? 'tool';
if (name === 'ask_user_question')
return;
this.thinkingSessions.set(id, false);
if (event.data?.callId !== undefined) {
if (this.callNames.size > 400) {
const first = this.callNames.keys().next().value;
@@ -1147,25 +1142,11 @@ export class TelegramBridge {
}
if (event.type === 'assistant/message') {
const text = contentToText(event.data.message.content);
this.thinkingSessions.set(id, false);
if (!text)
return;
await Promise.all(targets.map((b) => this.deliver(b.chatId, text)));
return;
}
if (event.type === 'assistant/chunk') {
// Thinking indicator: once per reasoning phase, status only (no content).
const chunk = event.data?.chunk;
const ctype = String(chunk?.type ?? '');
const btype = String(chunk?.block?.type ?? '');
const isReasoning = ctype.includes('reasoning') || btype.includes('reasoning') || btype.includes('think');
if (isReasoning && this.thinkingSessions.get(id) !== true) {
this.thinkingSessions.set(id, true);
for (const b of targets)
this.enqueueNotice(b.chatId, '> Thinking…');
}
return;
}
if (event.type === 'tool/result') {
// Only failures — successful results are too noisy for the phone.
const data = event.data;