hmm speculative

This commit is contained in:
Your Name
2026-04-08 20:27:00 +00:00
parent 57f13a196e
commit 42022279bb
12 changed files with 321 additions and 211 deletions
+8 -8
View File
@@ -38,22 +38,22 @@ export class HistoryObserver {
this.unsubscribeHistory = this.chatHistory.subscribe(
(_event: HistoryEvent) => {
// Rebuild the pristine IR graph from the full source history on every change.
// Wait, toIr still returns an Episode[].
// Wait, toIr still returns an Episode[].
// We actually need to map the Episode[] to a flat ConcreteNode[] here to form the 'ship'.
const pristineEpisodes = IrMapper.toIr(
this.chatHistory.get(),
this.tokenCalculator,
);
const ship: import('./ir/types.js').ConcreteNode[] = [];
for (const ep of pristineEpisodes) {
if (ep.concreteNodeIds) {
for (const child of ep.concreteNodeIds) {
ship.push(child as unknown as import('./ir/types.js').ConcreteNode);
}
}
if (ep.concreteNodes) {
for (const child of ep.concreteNodes) {
ship.push(child);
}
}
}
const newNodes = new Set<string>();
for (const node of ship) {
if (!this.seenNodeIds.has(node.id)) {