fix(status): remove redundant final message timer
This commit is contained in:
parent
44a13df83b
commit
5039223581
@ -324,7 +324,7 @@ export async function runReplyAgent(params: {
|
||||
// NOTE: Edit mode requires channel-specific edit APIs which aren't available
|
||||
// at the agent-runner level. Use mode="inline" in config for now.
|
||||
// Telegram/Discord support editing but need integration at dispatch level.
|
||||
let lastStatusMessageId: string | undefined;
|
||||
|
||||
const statusCallbacks = optsWithRunId?.onBlockReply
|
||||
? {
|
||||
sendStatus: async (text: string, _messageId?: string) => {
|
||||
@ -335,13 +335,12 @@ export async function runReplyAgent(params: {
|
||||
{ timeoutMs: 3000 },
|
||||
);
|
||||
if (typeof res === "string") {
|
||||
lastStatusMessageId = res;
|
||||
return res;
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
editFinal: async (text: string, messageId: string) => {
|
||||
log.debug(`Editing final status update: ${messageId} (tracked: ${lastStatusMessageId})`);
|
||||
log.debug(`Editing final status update: ${messageId}`);
|
||||
await optsWithRunId.onBlockReply?.(
|
||||
{ text, isStatusMessage: true, editMessageId: messageId },
|
||||
{ timeoutMs: 3000 },
|
||||
|
||||
@ -202,10 +202,9 @@ export class StatusUpdateController {
|
||||
|
||||
// If we have a final text and config says to mark with checkmark
|
||||
if (finalText && this.config.markFinalWithCheckmark) {
|
||||
this.state.elapsedSeconds = Math.floor((Date.now() - this.state.startedAt) / 1000);
|
||||
// NOTE: We rely on Telegram delivery to do the edit/replacement, so we just format
|
||||
// the string correctly for the final response.
|
||||
const marked = `${finalText.trimEnd()} _(${formatElapsedTime(this.state.elapsedSeconds)})_`;
|
||||
|
||||
const marked = `${finalText.trimEnd()} ✅`;
|
||||
|
||||
return marked;
|
||||
}
|
||||
@ -291,24 +290,6 @@ export function createStatusUpdateController(
|
||||
return new StatusUpdateController(config, callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a text response with the completion checkmark if enabled.
|
||||
*/
|
||||
export function markResponseComplete(
|
||||
text: string | undefined,
|
||||
config?: StatusUpdateConfig,
|
||||
): string | undefined {
|
||||
if (!text) return text;
|
||||
|
||||
const resolved = resolveStatusUpdateConfig(config);
|
||||
if (!resolved.enabled || !resolved.markFinalWithCheckmark) return text;
|
||||
|
||||
// Don't double-mark
|
||||
if (text.trimEnd().endsWith("✅")) return text;
|
||||
|
||||
return `${text.trimEnd()} ✅`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create status update callbacks for channels that support message editing.
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user