koneck 2.128.16 → 2.128.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAmKA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1E;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOlD"}
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAwMA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB1E;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOlD"}
package/dist/highlight.js CHANGED
@@ -153,6 +153,42 @@ function colorMdLine(line) {
153
153
  .replace(/(\*[^*]+\*)/g, m => chalk.italic(m));
154
154
  }
155
155
  // ─── Public API ──────────────────────────────────────────────────────────────
156
+ /**
157
+ * Colouring is a pure function of a line and its language, so it is done once per distinct line.
158
+ *
159
+ * Every one of the colourisers above is a chain of regex replacements over a string. That is cheap
160
+ * once and ruinous sixty times a second, which is what was happening: a transcript in alt-screen
161
+ * mode is re-rendered on every repaint, and each repaint re-highlighted every code block on screen
162
+ * from scratch. The text had not changed — nothing about a finished reply ever changes — so the
163
+ * work was entirely repeated. Measured on a Raspberry Pi 5, re-parsing and re-highlighting a
164
+ * thirty-row transcript cost 14.5ms of a frame budget of 80ms, before React or the layout engine
165
+ * were reached.
166
+ *
167
+ * Keyed per line rather than per block so a streaming reply, which re-renders the same growing
168
+ * block over and over with one more line each time, hits the cache for everything it has already
169
+ * shown and pays only for the line that just arrived.
170
+ */
171
+ const LINE_CACHE = new Map();
172
+ /**
173
+ * Bounded, because a long session would otherwise keep every line it has ever displayed alive for
174
+ * the life of the process. Insertion order is eviction order — the oldest entry goes — which for a
175
+ * transcript is very nearly least-recently-used, since what is on screen is what is recent.
176
+ */
177
+ const LINE_CACHE_MAX = 4000;
178
+ function colorized(line, lang, fn) {
179
+ const key = lang + '' + line;
180
+ const hit = LINE_CACHE.get(key);
181
+ if (hit !== undefined)
182
+ return hit;
183
+ const out = fn(line);
184
+ if (LINE_CACHE.size >= LINE_CACHE_MAX) {
185
+ const oldest = LINE_CACHE.keys().next().value;
186
+ if (oldest !== undefined)
187
+ LINE_CACHE.delete(oldest);
188
+ }
189
+ LINE_CACHE.set(key, out);
190
+ return out;
191
+ }
156
192
  export function highlightLines(lines, filename) {
157
193
  const lang = langFromExt(filename);
158
194
  const fn = lang === 'html' ? colorHtmlLine :
@@ -163,7 +199,11 @@ export function highlightLines(lines, filename) {
163
199
  lang === 'sh' ? colorShLine :
164
200
  lang === 'md' ? colorMdLine :
165
201
  (l) => l;
166
- return lines.map(fn);
202
+ // 'generic' has no colouriser, so caching identity would fill the map with the text it was
203
+ // handed for no gain.
204
+ if (lang === 'generic')
205
+ return lines.slice();
206
+ return lines.map(line => colorized(line, lang, fn));
167
207
  }
168
208
  export function langLabel(filename) {
169
209
  const lang = langFromExt(filename);
@@ -1 +1 @@
1
- {"version":3,"file":"highlight.js","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,QAAQ,EAAC,QAAQ,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAC,UAAU;IAC3E,OAAO,EAAC,SAAS,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM;IACtE,KAAK,EAAC,OAAO,EAAC,IAAI,EAA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QAAQ,CAAC,CAAC;IACnC,MAAM,EAAE,GACN,IAAI,KAAK,MAAM,CAAI,CAAC,CAAC,aAAa,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,CAAK,CAAC,CAAC,YAAY,CAAE,CAAC;YACpC,IAAI,KAAK,IAAI,CAAM,CAAC,CAAC,WAAW,CAAG,CAAC;gBACpC,IAAI,KAAK,MAAM,CAAI,CAAC,CAAC,aAAa,CAAC,CAAC;oBACpC,IAAI,KAAK,IAAI,CAAM,CAAC,CAAC,WAAW,CAAG,CAAC;wBACpC,IAAI,KAAK,IAAI,CAAM,CAAC,CAAC,WAAW,CAAG,CAAC;4BACpC,IAAI,KAAK,IAAI,CAAM,CAAC,CAAC,WAAW,CAAG,CAAC;gCACpC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC;IAEnB,2FAA2F;IAC3F,sBAAsB;IACtB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IAC7C,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,MAAM,GAAyB;QACnC,IAAI,EAAC,MAAM,EAAE,GAAG,EAAC,KAAK,EAAE,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM;QAC/C,EAAE,EAAC,QAAQ,EAAE,EAAE,EAAC,OAAO,EAAE,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,EAAE;KACnD,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC"}
@@ -346,6 +346,36 @@ export declare function defaultAltScreen(stdout?: {
346
346
  * a default chosen for one machine and endured on the other.
347
347
  */
348
348
  compositesRedraws?: boolean): boolean;
349
+ /**
350
+ * Whether the session starts on the alternate screen, given what has been saved.
351
+ *
352
+ * The order matters, and it used to be wrong. `diffPanel` came first, because the side-by-side
353
+ * panel needs a fixed frame to draw in — so `diffPanel: true`, which is the default, turned the
354
+ * alternate screen on regardless of what `altScreen` said. Anyone who had gone looking for that
355
+ * setting and switched it off was put straight back on it at the next start, silently.
356
+ *
357
+ * That is not a cosmetic mistake. On the alternate screen nothing goes through <Static>, so the
358
+ * whole visible transcript is re-rendered on every repaint — and a repaint is caused by every
359
+ * keystroke, not just by the animation. Measured on a Raspberry Pi 5 at thirty rows: 168ms a
360
+ * frame, which is a six-frames-a-second interface where each keypress waits behind a full redraw
361
+ * of the conversation. The person who had already found the setting that avoids all of that was
362
+ * the last person who should have been paying for it.
363
+ *
364
+ * So an explicit `altScreen: false` now outranks everything. Nothing breaks by honouring it:
365
+ * `diffPanelOpen` is `showDiffPanel && altScreen`, so with no frame to draw in the panel stays
366
+ * shut and the diffs render inline in the transcript, where they were before the panel existed.
367
+ *
368
+ * Only an explicit `false` wins, not an absent setting — leaving `diffPanel: true` free to ask for
369
+ * a frame when nobody has expressed a view.
370
+ */
371
+ export declare function initialAltScreen(cfg: {
372
+ altScreen?: boolean;
373
+ diffPanel?: boolean;
374
+ }, compositesRedraws: boolean, stdout?: {
375
+ isTTY?: boolean;
376
+ rows?: number;
377
+ columns?: number;
378
+ }, env?: NodeJS.ProcessEnv): boolean;
349
379
  /**
350
380
  * The live diff panel — the work as it happens, beside the conversation.
351
381
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ink-chat.d.ts","sourceRoot":"","sources":["../src/ink-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA2B3D,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAuCtE,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiB5D,OAAO,EAA6C,KAAK,YAAY,EAAE,MAAM,aAAa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AM,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAmB,EAC7E,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAMT;AA2BD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAgB,EAAE,EAAE;IACpD,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACA,KAAK,CAAC,GAAG,CAAC,OAAO,CA2GnB;AAED;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,kBAA0B,EAAE,EACxE;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7C,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA01KhE;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE"}
package/dist/ink-chat.js CHANGED
@@ -1211,6 +1211,37 @@ compositesRedraws = false) {
1211
1211
  return false;
1212
1212
  return compositesRedraws;
1213
1213
  }
1214
+ /**
1215
+ * Whether the session starts on the alternate screen, given what has been saved.
1216
+ *
1217
+ * The order matters, and it used to be wrong. `diffPanel` came first, because the side-by-side
1218
+ * panel needs a fixed frame to draw in — so `diffPanel: true`, which is the default, turned the
1219
+ * alternate screen on regardless of what `altScreen` said. Anyone who had gone looking for that
1220
+ * setting and switched it off was put straight back on it at the next start, silently.
1221
+ *
1222
+ * That is not a cosmetic mistake. On the alternate screen nothing goes through <Static>, so the
1223
+ * whole visible transcript is re-rendered on every repaint — and a repaint is caused by every
1224
+ * keystroke, not just by the animation. Measured on a Raspberry Pi 5 at thirty rows: 168ms a
1225
+ * frame, which is a six-frames-a-second interface where each keypress waits behind a full redraw
1226
+ * of the conversation. The person who had already found the setting that avoids all of that was
1227
+ * the last person who should have been paying for it.
1228
+ *
1229
+ * So an explicit `altScreen: false` now outranks everything. Nothing breaks by honouring it:
1230
+ * `diffPanelOpen` is `showDiffPanel && altScreen`, so with no frame to draw in the panel stays
1231
+ * shut and the diffs render inline in the transcript, where they were before the panel existed.
1232
+ *
1233
+ * Only an explicit `false` wins, not an absent setting — leaving `diffPanel: true` free to ask for
1234
+ * a frame when nobody has expressed a view.
1235
+ */
1236
+ export function initialAltScreen(cfg, compositesRedraws, stdout = process.stdout, env = process.env) {
1237
+ if (cfg.altScreen === false)
1238
+ return false;
1239
+ // A panel explicitly enabled in saved settings needs a frame from the first render. Previously
1240
+ // it was marked on but silently had nowhere to draw until `/diff off` then `/diff on` happened.
1241
+ if (cfg.diffPanel === true || cfg.altScreen === true)
1242
+ return true;
1243
+ return defaultAltScreen(stdout, env, compositesRedraws);
1244
+ }
1214
1245
  /**
1215
1246
  * One diff line, syntax-coloured, on its tinted band.
1216
1247
  *
@@ -1344,6 +1375,8 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1344
1375
  const providerFramesRef = useRef(0);
1345
1376
  /** Last time an incoming provider event was allowed to refresh a still screen. */
1346
1377
  const lastIncomingPaintRef = useRef(0);
1378
+ /** A deferred paint for content that arrived inside the throttle window; see below. */
1379
+ const paintTimerRef = useRef(null);
1347
1380
  /**
1348
1381
  * Reasoning characters this turn, and when the last one arrived.
1349
1382
  *
@@ -1450,7 +1483,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1450
1483
  sayRef.current += text;
1451
1484
  streamedRef.current += text;
1452
1485
  charsRef.current += text.length;
1453
- requestIncomingPaint();
1486
+ requestIncomingPaint(true);
1454
1487
  const cut = safeCommitPoint(sayRef.current);
1455
1488
  if (cut <= 0)
1456
1489
  return;
@@ -1710,7 +1743,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1710
1743
  // produce tens of thousands of characters per turn, and what anyone watching wants is what
1711
1744
  // it is thinking now.
1712
1745
  thinkingTextRef.current = (thinkingTextRef.current + text).slice(-THINKING_TAIL_CHARS);
1713
- requestIncomingPaint();
1746
+ requestIncomingPaint(true);
1714
1747
  },
1715
1748
  onAgentProgress: (list) => { agentsRef.current = list; setAgents(list); },
1716
1749
  onWindowDetected: (limit, source) => setDetectedContext({ limit, source }),
@@ -1735,6 +1768,16 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1735
1768
  */
1736
1769
  const activeSession = useState(() => ({ p: null }))[0];
1737
1770
  const [rows, setRows] = useState([{ role: 'header' }]);
1771
+ /**
1772
+ * Rendered markup for rows that have stopped changing; see `renderRowCached`.
1773
+ *
1774
+ * A WeakMap keyed by the row object, so a row dropped from the transcript takes its rendered
1775
+ * tree with it, and the key it was cached under — which is what makes the cache safe when rows
1776
+ * are popped and the indices below them shift.
1777
+ */
1778
+ const rowCacheRef = useRef(new WeakMap());
1779
+ /** The layout the cache was built for. A change here invalidates all of it at once. */
1780
+ const rowCacheKeyRef = useRef('');
1738
1781
  /*
1739
1782
  * Whether the live diff panel is open.
1740
1783
  *
@@ -1839,12 +1882,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1839
1882
  *
1840
1883
  * /altscreen off, or `altScreen: false` in config, goes back to the terminal's own scrollback.
1841
1884
  */
1842
- const [altScreen, setAltScreen] = useState(
1843
- // A panel explicitly enabled in saved settings needs a frame from the first render. Previously
1844
- // it was marked on but silently had nowhere to draw until `/diff off` then `/diff on` happened.
1845
- cfg.diffPanel === true || cfg.altScreen === true
1846
- ? true
1847
- : defaultAltScreen(process.stdout, process.env, synchronizedFrames));
1885
+ const [altScreen, setAltScreen] = useState(() => initialAltScreen(cfg, synchronizedFrames));
1848
1886
  /**
1849
1887
  * How many rows back from the newest the viewport is looking, in alt-screen mode.
1850
1888
  *
@@ -1927,18 +1965,56 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
1927
1965
  * `animate: false` means no idle animation frames, not "hide real incoming work until the
1928
1966
  * turn completes". The old ticker was the only thing that painted ref-backed stream text, so
1929
1967
  * a provider could stream an entire reply while the screen stayed still, then reveal it in one
1930
- * burst. Refresh only when the provider actually sends progress, and cap it at one small frame
1931
- * per 1.2 seconds: that makes thinking and output visible without recreating the flicker that
1932
- * the still-screen setting exists to avoid.
1968
+ * burst. Refresh only when the provider actually sends progress: nothing arriving is still a
1969
+ * still screen, which is the whole point of the setting.
1970
+ *
1971
+ * The rate was a flat 1.2 seconds, and that was too slow to read as streaming at all. Reported
1972
+ * as "what it's typing/responding i only see the complete response, not even typing it in real
1973
+ * time" — accurate, because at 0.83 frames a second a reply that takes two seconds to arrive
1974
+ * gets one or two paints, which is indistinguishable from appearing all at once.
1975
+ *
1976
+ * That cap was defending against a repaint that cost 168ms on a Raspberry Pi 5, when the whole
1977
+ * transcript was re-rendered every frame. It no longer is — finished rows are cached and, off
1978
+ * the alternate screen, live in <Static> — so a repaint is one to two milliseconds and there is
1979
+ * nothing left to ration. The rate is now the terminal's own: 80ms where a redraw is composited,
1980
+ * 250ms where it is not, the same floor the animation uses, so a terminal that would flash is
1981
+ * still not asked to flash.
1933
1982
  */
1934
- function requestIncomingPaint() {
1983
+ function requestIncomingPaint(trailing = false) {
1935
1984
  if (animate || ask)
1936
1985
  return;
1986
+ const floor = floorFor(syncedFramesRef.current);
1937
1987
  const now = Date.now();
1938
- if (now - lastIncomingPaintRef.current < 1_200)
1988
+ const since = now - lastIncomingPaintRef.current;
1989
+ if (since >= floor) {
1990
+ lastIncomingPaintRef.current = now;
1991
+ setRepaint(n => n + 1);
1939
1992
  return;
1940
- lastIncomingPaintRef.current = now;
1941
- setRepaint(n => n + 1);
1993
+ }
1994
+ /*
1995
+ * Inside the window, with something new to show: paint when the window expires.
1996
+ *
1997
+ * The throttle used to have a leading edge only — a request arriving too soon after the last
1998
+ * paint was dropped, not deferred. So whether a chunk of the reply was ever displayed came
1999
+ * down to whether the next chunk happened to land after the window had expired, and text that
2000
+ * arrived in the wrong millisecond was never painted at all. At the old 1.2-second window that
2001
+ * was most of the reply, which is why it read as no streaming whatsoever: "what it's
2002
+ * typing/responding i only see the complete response, not even typing it in real time".
2003
+ *
2004
+ * One timer, not one per chunk: whatever has accumulated by the time it fires is what gets
2005
+ * painted, so a fast stream still costs one frame per window rather than one per token.
2006
+ *
2007
+ * Only for callers that actually change what is on screen. A content-free keep-alive frame
2008
+ * from the provider has nothing new to paint, and scheduling one for it would repaint a
2009
+ * screen that is meant to stay still while nothing is arriving.
2010
+ */
2011
+ if (!trailing || paintTimerRef.current)
2012
+ return;
2013
+ paintTimerRef.current = setTimeout(() => {
2014
+ paintTimerRef.current = null;
2015
+ lastIncomingPaintRef.current = Date.now();
2016
+ setRepaint(n => n + 1);
2017
+ }, Math.max(1, floor - since));
1942
2018
  }
1943
2019
  const [ask, setAsk] = useState(null);
1944
2020
  /*
@@ -2288,7 +2364,6 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
2288
2364
  const spinFrame = anim.spin;
2289
2365
  const shimmerFrame = anim.shimmer;
2290
2366
  const [spinWord, setSpinWord] = useState(0);
2291
- const elapsedMs = anim.elapsed;
2292
2367
  /**
2293
2368
  * Extra cursor movements from a single input chunk.
2294
2369
  *
@@ -2340,6 +2415,27 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
2340
2415
  /** Tools this turn has run, which is what separates work from a plain answer. */
2341
2416
  const turnToolsRef = useRef(0); // a tool failed and was worked around
2342
2417
  const busyStart = useRef(0);
2418
+ /**
2419
+ * How long this turn has been running, read from the clock at render rather than from the
2420
+ * animation.
2421
+ *
2422
+ * It used to be `anim.elapsed`, which is only ever written by the animation ticker — and that
2423
+ * ticker does not run when `animate` is off. So with the animation disabled the status line
2424
+ * reported "(0ms)" for the entire turn while the token count beside it climbed, because the
2425
+ * tokens are read from a ref at render and the time was not. Reported exactly that way, with a
2426
+ * screenshot: "(0ms | 184 tokens)".
2427
+ *
2428
+ * It was not only cosmetic. This figure decides which tier of work word is shown, and whether
2429
+ * the line says "no response from the provider yet" after eight seconds. Frozen at zero, the
2430
+ * word never advanced and the stall warning could never appear — so a turn that had genuinely
2431
+ * hung looked identical to one that had just started.
2432
+ *
2433
+ * Computed here instead, so every repaint shows the truth whatever caused it, and no repaint is
2434
+ * needed merely to keep a clock honest.
2435
+ */
2436
+ const elapsedMs = busy && busyStart.current > 0
2437
+ ? Date.now() - busyStart.current
2438
+ : anim.elapsed;
2343
2439
  /*
2344
2440
  * Whether this terminal composites a redraw, decided once before Ink started.
2345
2441
  *
@@ -2411,9 +2507,21 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
2411
2507
  // Drive the animated working indicator while busy. With animation off, no timer is permitted:
2412
2508
  // in an alternate-screen terminal every tick erases and redraws the complete frame, which is
2413
2509
  // the visible black flash people configured this setting to eliminate.
2510
+ // A deferred paint belongs to the turn that asked for it. Left to fire after the turn ended it
2511
+ // would repaint a finished screen, and after unmount it would set state on a gone component.
2512
+ useEffect(() => () => {
2513
+ if (paintTimerRef.current) {
2514
+ clearTimeout(paintTimerRef.current);
2515
+ paintTimerRef.current = null;
2516
+ }
2517
+ }, []);
2414
2518
  useEffect(() => {
2415
2519
  if (!busy) {
2416
2520
  busyStart.current = 0;
2521
+ if (paintTimerRef.current) {
2522
+ clearTimeout(paintTimerRef.current);
2523
+ paintTimerRef.current = null;
2524
+ }
2417
2525
  setAnim({ spin: 0, shimmer: 0, elapsed: 0 });
2418
2526
  return;
2419
2527
  }
@@ -5740,6 +5848,72 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5740
5848
  // markdown tables needlessly narrow. A marker plus the content reads better and
5741
5849
  // cannot misalign, which is how Claude Code presents its own answers.
5742
5850
  _jsxs(Box, { flexDirection: "column", marginTop: row.continued ? 0 : 1, children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: CYAN, bold: true, children: row.continued ? ' ' : G.brand }), _jsx(Box, { flexDirection: "column", children: _jsx(Markdown, { text: row.text ?? '', width: barWidth - 3 }) })] }), row.tokens != null && (_jsxs(Text, { color: MUTED, children: [_jsx(Text, { color: GREEN, children: "* " }), row.done ? `${row.done} in ${fmtElapsed(row.elapsed ?? 0)}` : fmtElapsed(row.elapsed ?? 0), ' | ', row.tokens, " tokens", ' | ', cfg.provider, " ", modelShort] }))] }, index)));
5851
+ /**
5852
+ * A row that has stopped changing, and so never needs rendering twice.
5853
+ *
5854
+ * Every row in the transcript is immutable once appended — they are only ever created fresh and
5855
+ * spread into a new array — with exactly one exception: a `steps` row whose tool is still
5856
+ * running redraws its spinner glyph and its elapsed time on every frame. That row is always the
5857
+ * last one. Everything above it is finished text that will look identical for the rest of the
5858
+ * session.
5859
+ */
5860
+ const settledRow = (row) => row.role !== 'steps'
5861
+ || (row.steps ?? []).every(s => s.kind === 'say' || s.endedAt != null);
5862
+ /**
5863
+ * Rendered rows, kept between frames.
5864
+ *
5865
+ * This is the fix for the thing that made the interface feel like a slideshow. In alt-screen
5866
+ * mode nothing goes through <Static>, so every visible row was rebuilt — markdown re-parsed,
5867
+ * code re-highlighted, elements re-created, the lot re-laid-out by yoga — on every repaint. And
5868
+ * a repaint is caused by every keystroke, not just by the animation. Measured on a Raspberry Pi
5869
+ * 5: 28.7ms for a five-row screen, 75.5ms at fifteen rows, 168.6ms at thirty. Node has one
5870
+ * thread, so that is the whole event loop blocked; the keystroke that triggered the repaint
5871
+ * could not be echoed until it finished, and the next one queued behind that. Six frames a
5872
+ * second, each arriving a different amount of time late, is what was being seen as both the lag
5873
+ * and the flicker.
5874
+ *
5875
+ * A settled row's markup is a pure function of the row and the handful of layout values below,
5876
+ * so it is computed once and held. Typing now re-renders the composer and the status bar; the
5877
+ * conversation above them is handed back the same elements it was given last frame, which React
5878
+ * skips and yoga does not re-measure.
5879
+ *
5880
+ * Keyed by row identity — the object, not an index — because indices shift when a row is popped,
5881
+ * which several commands do, and an index key would have handed the wrong markup to the wrong
5882
+ * row. A WeakMap so a trimmed-away row does not keep its rendered tree alive.
5883
+ */
5884
+ /**
5885
+ * What a settled row's appearance depends on besides the row itself. If any of these change the
5886
+ * cache is stale in its entirety, so it is dropped rather than checked entry by entry.
5887
+ */
5888
+ // JSON rather than a joined string: a model name or a workspace path may contain whatever
5889
+ // separator was picked, and two different layouts hashing to one key would serve stale markup.
5890
+ const rowLayoutKey = JSON.stringify([uiWidth, barWidth, altScreen, modelShort, cfg.provider,
5891
+ workspace, diffPanelOpen]);
5892
+ if (rowCacheKeyRef.current !== rowLayoutKey) {
5893
+ rowCacheKeyRef.current = rowLayoutKey;
5894
+ rowCacheRef.current = new WeakMap();
5895
+ }
5896
+ // Read after the invalidation above, never before: on the render where the width changed the old
5897
+ // map is still on the ref until it is replaced, and reading first would serve markup laid out for
5898
+ // the previous width from a cache that had just been declared stale.
5899
+ const rowCache = rowCacheRef.current;
5900
+ /**
5901
+ * Used by the alt-screen viewport only, deliberately.
5902
+ *
5903
+ * <Static> already writes each row exactly once and never repaints it, so in inline mode there is
5904
+ * no repeated work here to save. Feeding it cached elements would only risk handing it markup
5905
+ * carrying the key it was first built with, and buy nothing for the trouble.
5906
+ */
5907
+ const renderRowCached = (row, index) => {
5908
+ if (!settledRow(row))
5909
+ return renderRow(row, index);
5910
+ const hit = rowCache.get(row);
5911
+ if (hit !== undefined)
5912
+ return hit;
5913
+ const el = renderRow(row, index);
5914
+ rowCache.set(row, el);
5915
+ return el;
5916
+ };
5743
5917
  /**
5744
5918
  * The rows the alt-screen viewport should draw.
5745
5919
  *
@@ -5775,7 +5949,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
5775
5949
  //
5776
5950
  // Both halves matter. Clipping the bottom would hide what just happened; anchoring
5777
5951
  // always to the bottom is what put the banner there.
5778
- _jsx(Box, { flexGrow: 0, flexShrink: 1, flexDirection: "column", justifyContent: "flex-end", overflowY: "hidden", children: visibleRows.map((row, i) => (_jsx(Box, { flexDirection: "column", flexShrink: 0, children: renderRow(row, i) }, i))) })), altScreen && !ask && scrollBack > 0 && (_jsx(Text, { color: AMBER, children: `${G.caret} scrolled back ${scrollBack} rows — Ctrl+End follows live · Ctrl+Up/Down moves by section` })), showAnalytics && (_jsxs(Box, { borderStyle: "round", borderColor: AMBER, paddingX: 1, marginBottom: 1, flexDirection: "column", width: barWidth, children: [_jsx(Text, { color: AMBER, bold: true, children: "\u25C6 Session Analytics" }), _jsxs(Text, { color: MUTED, children: ["Turns : ", _jsx(Text, { color: INK, children: stats.turns })] }), _jsxs(Text, { color: MUTED, children: ["Prompt tok : ", _jsx(Text, { color: INK, children: stats.promptTokens.toLocaleString() })] }), _jsxs(Text, { color: MUTED, children: ["Output tok : ", _jsx(Text, { color: INK, children: stats.completionTokens.toLocaleString() })] }), _jsxs(Text, { color: MUTED, children: ["Total tok : ", _jsx(Text, { color: INK, children: stats.totalTokens.toLocaleString() })] }), _jsxs(Text, { color: MUTED, children: ["Model : ", _jsx(Text, { color: INK, children: modelShort }), " Provider: ", _jsx(Text, { color: INK, children: cfg.provider })] }), _jsx(Text, { color: DIM, children: "Tab to close" })] })), _jsx(Static, { items: altScreen ? [] : rows, children: (row, index) => renderRow(row, index) }), _jsx(Box, { flexDirection: "column", flexShrink: 0, children: !ask && busy && (agentState === 'processing' || agentState === 'syncing') && (_jsxs(Box, { flexDirection: "column", children: [!ask && sayRef.current.trim() !== '' && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: CYAN, bold: true, children: replyStartedRef.current ? ' ' : G.brand }), _jsx(Box, { flexDirection: "column", children: tailLines(sayRef.current, liveReplyLines(termRows), replyWidth - 3)
5952
+ _jsx(Box, { flexGrow: 0, flexShrink: 1, flexDirection: "column", justifyContent: "flex-end", overflowY: "hidden", children: visibleRows.map((row, i) => (_jsx(Box, { flexDirection: "column", flexShrink: 0, children: renderRowCached(row, i) }, i))) })), altScreen && !ask && scrollBack > 0 && (_jsx(Text, { color: AMBER, children: `${G.caret} scrolled back ${scrollBack} rows — Ctrl+End follows live · Ctrl+Up/Down moves by section` })), showAnalytics && (_jsxs(Box, { borderStyle: "round", borderColor: AMBER, paddingX: 1, marginBottom: 1, flexDirection: "column", width: barWidth, children: [_jsx(Text, { color: AMBER, bold: true, children: "\u25C6 Session Analytics" }), _jsxs(Text, { color: MUTED, children: ["Turns : ", _jsx(Text, { color: INK, children: stats.turns })] }), _jsxs(Text, { color: MUTED, children: ["Prompt tok : ", _jsx(Text, { color: INK, children: stats.promptTokens.toLocaleString() })] }), _jsxs(Text, { color: MUTED, children: ["Output tok : ", _jsx(Text, { color: INK, children: stats.completionTokens.toLocaleString() })] }), _jsxs(Text, { color: MUTED, children: ["Total tok : ", _jsx(Text, { color: INK, children: stats.totalTokens.toLocaleString() })] }), _jsxs(Text, { color: MUTED, children: ["Model : ", _jsx(Text, { color: INK, children: modelShort }), " Provider: ", _jsx(Text, { color: INK, children: cfg.provider })] }), _jsx(Text, { color: DIM, children: "Tab to close" })] })), _jsx(Static, { items: altScreen ? [] : rows, children: (row, index) => renderRow(row, index) }), _jsx(Box, { flexDirection: "column", flexShrink: 0, children: !ask && busy && (agentState === 'processing' || agentState === 'syncing') && (_jsxs(Box, { flexDirection: "column", children: [!ask && sayRef.current.trim() !== '' && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: CYAN, bold: true, children: replyStartedRef.current ? ' ' : G.brand }), _jsx(Box, { flexDirection: "column", children: tailLines(sayRef.current, liveReplyLines(termRows), replyWidth - 3)
5779
5953
  .split('\n').map((line, i) => _jsx(Text, { color: INK, children: line }, i)) })] })), liveToolRef.current && renderStep(liveToolRef.current, 1), queued.length > 0 && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: AMBER, children: "\u25AA" }), _jsxs(Text, { color: MUTED, children: [queued.length, " queued, will run when this finishes \u00B7 /aside to ask without waiting"] })] }), queued.map((q, i) => (_jsx(Box, { paddingLeft: 2, children: _jsx(Text, { color: DIM, children: fitCells(q.split('\n')[0] ?? '', Math.max(20, barWidth - 6), true) }) }, i)))] })), !activityPanelOpen && agents.length > 0 && (() => {
5780
5954
  const done = agents.filter(a => a.status !== 'running').length;
5781
5955
  const failed = agents.filter(a => a.status === 'failed').length;