feat(web,hub): cancel queued messages (#568)

This commit is contained in:
Junmo Kim
2026-05-06 13:32:45 +08:00
committed by GitHub
parent de69027926
commit 8185f0287e
30 changed files with 1365 additions and 15 deletions
+14
View File
@@ -182,6 +182,20 @@ export class MessageQueue2<T> {
logger.debug(`[MessageQueue2] unshift() completed. Queue size: ${this.queue.length}`);
}
/**
* Remove the first queued message that matches the given localId.
* Returns true if a message was removed, false if not found.
* Best-effort: if the CLI is offline when cancel is issued, the message
* may already have been collected for invocation and won't be found here.
*/
cancelByLocalId(localId: string): boolean {
if (!localId) return false;
const idx = this.queue.findIndex(item => item.localId === localId);
if (idx === -1) return false;
this.queue.splice(idx, 1);
return true;
}
/**
* Reset the queue - clears all messages and resets to empty state
*/