MCPcopy Create free account
hub / github.com/Noumena-Network/code / resetPools

Method resetPools

src/ink/ink.tsx:1716–1730  ·  view source on GitHub ↗

* 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

()

Source from the content-addressed store, hash-verified

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;

Callers 1

onRenderMethod · 0.95

Calls 1

migrateScreenPoolsFunction · 0.85

Tested by

no test coverage detected