* Replace char/hyperlink pools with fresh instances to prevent unbounded * growth during long sessions. Migrates the front frame's screen IDs into * the new pools so diffing remains correct. The back frame doesn't need * migration — resetScreen zeros it before any reads. * * Call betw
()
| 1714 | * Call between conversation turns or periodically. |
| 1715 | */ |
| 1716 | resetPools(): void { |
| 1717 | this.charPool = new CharPool(); |
| 1718 | this.hyperlinkPool = new HyperlinkPool(); |
| 1719 | migrateScreenPools(this.frontFrame.screen, this.charPool, this.hyperlinkPool); |
| 1720 | if (this.logicalFrontFrame !== this.frontFrame) { |
| 1721 | migrateScreenPools(this.logicalFrontFrame.screen, this.charPool, this.hyperlinkPool); |
| 1722 | } |
| 1723 | // Back frame's data is zeroed by resetScreen before reads, but its pool |
| 1724 | // references are used by the renderer to intern new characters. Point |
| 1725 | // them at the new pools so the next frame's IDs are comparable. |
| 1726 | this.backFrame.screen.charPool = this.charPool; |
| 1727 | this.backFrame.screen.hyperlinkPool = this.hyperlinkPool; |
| 1728 | this.logicalBackFrame.screen.charPool = this.charPool; |
| 1729 | this.logicalBackFrame.screen.hyperlinkPool = this.hyperlinkPool; |
| 1730 | } |
| 1731 | patchConsole(): () => void { |
| 1732 | // biome-ignore lint/suspicious/noConsole: intentionally patching global console |
| 1733 | const con = console; |
no test coverage detected