mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-03 06:47:03 +00:00
feat(opencode): fork and rewind OpenCode v2 conversations (#2424)
This commit is contained in:
@@ -40,6 +40,8 @@ export class MessageQueue2<T> {
|
||||
private closed = false;
|
||||
private onMessageHandler: ((message: string, mode: T) => void) | null = null;
|
||||
onBatchConsumed: ((localIds: string[]) => void) | null = null;
|
||||
/** Optional synchronous admission, before removing or acknowledging a batch. */
|
||||
beforeDequeue: (() => void) | null = null;
|
||||
modeHasher: (mode: T) => string;
|
||||
private readonly reservations = new Map<string, QueueReservation<T>>();
|
||||
private readonly consumedReservations = new Set<string>();
|
||||
@@ -625,6 +627,8 @@ export class MessageQueue2<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.beforeDequeue?.();
|
||||
|
||||
const firstItem = this.queue[0];
|
||||
const sameModeMessages: string[] = [];
|
||||
const consumedLocalIds: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user