omnius 1.0.349 → 1.0.350

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -614567,11 +614567,20 @@ ${CONTENT_BG_SEQ}`);
614567
614567
  * many times per second (e.g. the shell timer) refreshes without the whole
614568
614568
  * TUI flashing. Implements the DynamicBlockHost.refreshDynamicBlocks contract.
614569
614569
  */
614570
+ _dynamicRefreshCoalesceTimer = null;
614570
614571
  refreshDynamicBlocks() {
614571
614572
  if (!this.active) return;
614572
614573
  if (this._contentScrollOffset > 0 || this._mouseSelecting) return;
614573
614574
  if (isOverlayActive() || this._suspendContentLayer) return;
614574
- this.repaintContent();
614575
+ if (this._dynamicRefreshCoalesceTimer) return;
614576
+ this._dynamicRefreshCoalesceTimer = setTimeout(() => {
614577
+ this._dynamicRefreshCoalesceTimer = null;
614578
+ if (!this.active) return;
614579
+ if (this._contentScrollOffset > 0 || this._mouseSelecting) return;
614580
+ if (isOverlayActive() || this._suspendContentLayer) return;
614581
+ this.repaintContent();
614582
+ }, 16);
614583
+ this._dynamicRefreshCoalesceTimer.unref?.();
614575
614584
  }
614576
614585
  clearStreamingRepaintTimer() {
614577
614586
  if (!this._streamingRepaintTimer) return;
@@ -614690,7 +614699,23 @@ ${CONTENT_BG_SEQ}`);
614690
614699
  }));
614691
614700
  });
614692
614701
  }
614702
+ // Memoize per-line reflow: it is a PURE function of (line, width), and
614703
+ // reflowContentLines re-wraps the entire scrollback every repaint. Caching
614704
+ // it makes a static line reflow ONCE instead of on every paint (which, for a
614705
+ // long session, was the O(n) per-repaint cost behind the freeze). Callers map
614706
+ // over the result (never mutate it), so a shared cached array is safe. Key
614707
+ // includes width, so a resize naturally re-keys; bounded with clear-on-grow.
614708
+ _reflowLineCache = /* @__PURE__ */ new Map();
614693
614709
  reflowContentLine(line, width) {
614710
+ const key = `${width}\0${line}`;
614711
+ const cached = this._reflowLineCache.get(key);
614712
+ if (cached) return cached;
614713
+ const result = this._reflowContentLineUncached(line, width);
614714
+ if (this._reflowLineCache.size > 8e3) this._reflowLineCache.clear();
614715
+ this._reflowLineCache.set(key, result);
614716
+ return result;
614717
+ }
614718
+ _reflowContentLineUncached(line, width) {
614694
614719
  const visible = stripAnsi(line);
614695
614720
  if (visible.length <= width) return [line];
614696
614721
  const continuationIndent = this.hangingIndentForVisibleLine(visible, width);
@@ -614943,7 +614968,21 @@ ${CONTENT_BG_SEQ}`);
614943
614968
  const h = this.contentHeight;
614944
614969
  const livePartialLine = this.getLiveBufferedLine();
614945
614970
  const w = termCols();
614971
+ const _perfOn = process.env["OMNIUS_TUI_PERF"] === "1";
614972
+ const _t0 = _perfOn ? performance.now() : 0;
614946
614973
  const reflowedLines = this.reflowContentLines(livePartialLine, w);
614974
+ if (_perfOn) {
614975
+ const _ms = performance.now() - _t0;
614976
+ if (_ms > 8) {
614977
+ try {
614978
+ process.stderr.write(
614979
+ `[TUI-PERF] reflow ${_ms.toFixed(1)}ms (lines=${reflowedLines.length}, w=${w})
614980
+ `
614981
+ );
614982
+ } catch {
614983
+ }
614984
+ }
614985
+ }
614947
614986
  const totalLines = reflowedLines.length;
614948
614987
  const maxOffset = Math.max(0, totalLines - h);
614949
614988
  if (this._contentScrollOffset > maxOffset) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.349",
3
+ "version": "1.0.350",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.349",
9
+ "version": "1.0.350",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.349",
3
+ "version": "1.0.350",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",