|
1 | 1 | import { DEFAULT_HEARTBEAT_ACK_MAX_CHARS, stripHeartbeatToken } from "../auto-reply/heartbeat.js"; |
2 | 2 | import { normalizeVerboseLevel } from "../auto-reply/thinking.js"; |
3 | | -import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; |
| 3 | +import { isSilentReplyText, isSilentTokenOnOwnLine, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; |
4 | 4 | import { loadConfig } from "../config/config.js"; |
5 | 5 | import { type AgentEventPayload, getAgentRunContext } from "../infra/agent-events.js"; |
6 | 6 | import { resolveHeartbeatVisibility } from "../infra/heartbeat-visibility.js"; |
@@ -359,7 +359,7 @@ export function createAgentEventHandler({ |
359 | 359 | return; |
360 | 360 | } |
361 | 361 | chatRunState.buffers.set(clientRunId, mergedText); |
362 | | - if (isSilentReplyText(mergedText, SILENT_REPLY_TOKEN)) { |
| 362 | + if (isSilentReplyText(mergedText, SILENT_REPLY_TOKEN) || isSilentTokenOnOwnLine(mergedText, SILENT_REPLY_TOKEN)) { |
363 | 363 | return; |
364 | 364 | } |
365 | 365 | if (isSilentReplyLeadFragment(mergedText)) { |
@@ -406,7 +406,9 @@ export function createAgentEventHandler({ |
406 | 406 | }); |
407 | 407 | const text = normalizedHeartbeatText.text.trim(); |
408 | 408 | const shouldSuppressSilent = |
409 | | - normalizedHeartbeatText.suppress || isSilentReplyText(text, SILENT_REPLY_TOKEN); |
| 409 | + normalizedHeartbeatText.suppress || |
| 410 | + isSilentReplyText(text, SILENT_REPLY_TOKEN) || |
| 411 | + isSilentTokenOnOwnLine(text, SILENT_REPLY_TOKEN); |
410 | 412 | const shouldSuppressSilentLeadFragment = isSilentReplyLeadFragment(text); |
411 | 413 | const shouldSuppressHeartbeatStreaming = shouldHideHeartbeatChatOutput( |
412 | 414 | clientRunId, |
@@ -463,7 +465,9 @@ export function createAgentEventHandler({ |
463 | 465 | }); |
464 | 466 | const text = normalizedHeartbeatText.text.trim(); |
465 | 467 | const shouldSuppressSilent = |
466 | | - normalizedHeartbeatText.suppress || isSilentReplyText(text, SILENT_REPLY_TOKEN); |
| 468 | + normalizedHeartbeatText.suppress || |
| 469 | + isSilentReplyText(text, SILENT_REPLY_TOKEN) || |
| 470 | + isSilentTokenOnOwnLine(text, SILENT_REPLY_TOKEN); |
467 | 471 | // Flush any throttled delta so streaming clients receive the complete text |
468 | 472 | // before the final event. The 150 ms throttle in emitChatDelta may have |
469 | 473 | // suppressed the most recent chunk, leaving the client with stale text. |
|
0 commit comments