(
candidate: ShellRunUpdate,
options?: { announceSettle?: boolean },
)
| 28 | const pendingUpdates = new ShellRunUpdateBuffer('cli.pi-tui-hydration-buffer'); |
| 29 | |
| 30 | const applyViewUpdate = ( |
| 31 | candidate: ShellRunUpdate, |
| 32 | options?: { announceSettle?: boolean }, |
| 33 | ): boolean => { |
| 34 | const index = ownerMappings.findIndex( |
| 35 | (update) => |
| 36 | update.sessionId === candidate.sessionId && |
| 37 | update.sourceToolCallId === candidate.sourceToolCallId, |
| 38 | ); |
| 39 | const merged = mergeShellRunUpdate( |
| 40 | index >= 0 ? ownerMappings[index] : undefined, |
| 41 | candidate, |
| 42 | 'cli.pi-tui-runner', |
| 43 | ); |
| 44 | const retainOwnerMapping = |
| 45 | merged.update.ownership.kind === 'source_owned' && |
| 46 | isActiveShellRunStatus(merged.update.result.status); |
| 47 | if (index >= 0 && retainOwnerMapping) ownerMappings[index] = merged.update; |
| 48 | else if (index >= 0) ownerMappings.splice(index, 1); |
| 49 | else if (retainOwnerMapping) ownerMappings.push(merged.update); |
| 50 | return input.applyToTranscript(merged.update, options); |
| 51 | }; |
| 52 | |
| 53 | const replayPendingUpdates = (sessionId: string): boolean => { |
| 54 | const buffered = pendingUpdates.drain(); |
no test coverage detected