@bismawy/pi-arnative 0.12.0 → 0.13.0

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/CHANGELOG.md CHANGED
@@ -1,14 +1,28 @@
1
1
  # Changelog
2
2
 
3
- ## [0.10.1] - 2026-11-11
3
+ ## [0.13.0] - 2026-11-18
4
+
5
+ ### Added
6
+ - **The byte-shed ceiling follows the proxy wall.** `SHED_TRIGGER_BYTES` was a fixed 900 KB, so a 1M-token model shed at roughly 12% of its window and lost context the token budget could still hold. `PI_ARNATIVE_BYTE_WALL_MB` now scales the trigger, target, and compaction ceilings (default `1`, unchanged behaviour). Set it to the wall your proxy accepts, for example `16` after raising nginx to `client_max_body_size 16m`. The footer label follows: `0.74MB/900KB` below 1 MB, `0.74MB/14.06MB` at a 16 MB wall (`extensions/autocompact.ts`, `extensions/footer.ts`).
7
+ - **`/arnative` pickers wrap at the top and bottom rows.** Navigation used to clamp, so a held arrow key stuck at the first or last row. The cursor now wraps like `/jev-eye`: up from the top lands on the last row, down from the last row lands on the top. Every submenu shares `ListPicker`, so one change covers them all (`lib/list-picker.ts`).
8
+ - **Render cache (`/arnative` → Render cache: `On`/`Off`, default `On`): reuse rendered transcript lines for idle frames.** Container-level render caching attaches to the `chatContainer` instance and patches `rebuildChatFromMessages`; known, settled transcript frames are served from a cached snapshot after checking child state (prior synthetic render-only benchmark: idle 15.23 ms → 0.77 ms per frame, streaming 10.46 ms → 6.43 ms), and the cache clears on `session_start`, `model_select`, and `session_compact` (`extensions/render-cache.ts`, `scripts/bench-render-cache.mjs`, `test/render-cache.test.ts`).
9
+ - **Auto-compact `Smart` now scales with Render cache.** With `Render cache: On`, windows ≥192k compact at **90%** of `contextWindow` (1M → ~943k tokens); with `Render cache: Off`, Smart keeps the conservative tiers (1M→20% · 512k→40% · 256k→80%); windows <192k still defer to pi core. The picker note in `/arnative` reflects the active state (`extensions/autocompact.ts`, `smartPercent`, `extensions/arnative.ts`).
10
+ - **Remote 1 MB byte protection is now silent and decoupled from `ctx.compact()`.** For `remote/*`, `remote-magpie/*`, and models that saw HTTP 413, payloads approaching ~900 KB are trimmed in-memory (with hysteresis down to ~760 KB; 820→680 KB after a 413) by dropping older images → older thinking blocks (keeping the latest turn intact) → bulky old tool outputs → old `toolCall` args → head turns. The transcript, UI, and `render-cache` stay untouched, and byte pressure alone never triggers session compaction anymore: only token thresholds do (`extensions/autocompact.ts`).
11
+ - **Footer payload pressure for byte-limited models (`󰆓 x.xxMB/900KB` on the left row).** The cell renders beside the extension statuses, split by the row `|` separator, so the right metrics (speed, cache, tokens, cost) keep their slots. The byte count comes from the autocompact snapshot (messages plus measured overhead) for `remote/*`, `remote-magpie/*`, and models that saw HTTP 413. The denominator is the shed trigger (900KB), not the 1MB proxy wall: at 758KB the old `/1MB` label read 74% while the trim wall was already at 84%. Plain models never see the cell (`extensions/footer.ts`, `extensions/autocompact.ts`, `test/wire-bytes.test.ts`, `test/wire-bytes-left.test.ts`).
4
12
 
5
13
  ### Fixed
6
- - Manual Model heal shows a start notice and live progress for flags, catalogs, and thinking probes. Final results now include partial failures.
7
- - Manual Model heal now cancels on session reload or replacement. Model refresh captures the current model before awaiting and uses the bound extension API.
8
- - Model heal now respects the one-hour cooldown after a failed effort probe. Reordering thinking map keys no longer triggers another probe.
9
- - Failed model catalogs now wait one hour before an automatic retry. Successful catalogs keep their six-hour TTL; forced heals and endpoint changes bypass the cooldown.
14
+ - Custom message renderers, unknown transcript components, and extension subclasses bypass the render cache. Nested content changes now appear without parent invalidation, while known Pi siblings remain cached and mouse hitbox heights stay current (`extensions/render-cache.ts`, `test/render-cache.test.ts`).
15
+ - Measure byte-limited message arrays as serialized JSON UTF-8, including Unicode, JSON escapes, and array separators. This replaces inaccurate structural sizing and object-identity caches, so oversized Unicode payloads trigger the byte guard on their first request (`extensions/autocompact.ts`, `test/wire-bytes.test.ts`).
16
+ - **`model-heal.ts` crash: `ReferenceError: DEBOUNCE_MS is not defined` exited pi.** The widget→notify refactor removed the `DEBOUNCE_MS` constant but left its use in the `models.json` `FSWatcher` debounce; a heal pass writing `models.json` crashed pi via uncaught exception. The constant is restored, the watcher now handles async `error` events (deleting the watched directory makes `fs.watch` emit an `EPERM` that no try/catch can intercept), and two regression tests drive the real extension in a child process so removing either the constant or the handler fails the suite (`extensions/model-heal.ts`, `test/model-heal-watcher.test.ts`, `test/fixtures/watcher-child.mjs`).
17
+ - **`renderCache` key order is pinned in `config.json`.** `KEY_ORDER` in `lib/preset-store.ts` now includes `renderCache` after `modelHeal`, so partial configs keep a stable order (`test/profile.test.ts`).
10
18
 
11
- ## [Unreleased]
19
+ ### Changed
20
+ - **Documented Render cache, Smart tiers, and `PI_ARNATIVE_BYTE_WALL_MB` in `README.md`.** Added the `Render cache` toggle (`On` by default), updated `Smart` auto-compact tiers (`90%` for `>= 192k` with Render cache `On`, conservative tiers with `Off`), summarized fixed-budget trade-offs and byte-wall scaling, and updated the `/arnative` shortcut and architecture tables (`README.md`).
21
+ - **The footer hourly rate renders `dim`.** `$19.98 (~$7.06/h)` painted both values the same, so the cost read as one number. The rate suffix now takes `dim` while the amount keeps `soft`; an active budget cap still paints the whole cell one alert colour (`extensions/footer.ts`, `test/footer-rate.test.ts`).
22
+ - Byte measurement is skipped for models without a byte wall. Byte-limited sessions use exact serialized JSON UTF-8 measurements; Pi clones the message array before each `context` event, so per-object caches do not stay warm across requests (`extensions/autocompact.ts`).
23
+ - **Render-cache width LRU holds 3 widths.** A 3-way width toggle (font-size steps, tmux pane alternation) thrashed the 2-slot LRU at ~710 us/render; 3 slots keep it warm at ~35 us/render (`extensions/render-cache.ts`, `test/render-cache.test.ts`).
24
+ - **Arnative notices now render as transcript notifies instead of the widget slot above the editor.** The old `setWidget` notice covered the prompt; `announce()` now emits a `notify` line that stays visible in scrollback without blocking anything (`lib/status-widget.ts`).
25
+ - **Tool box scroll indicators hold-to-repeat.** Holding left-click on a boxed tool's `↑ N more` / `↓ N more` border indicator auto-scrolls (250 ms delay, then every 90 ms) until release or the boundary (`extensions/tools.ts`).
12
26
 
13
27
  ## [0.12.0] - 2026-11-14
14
28
 
@@ -65,6 +79,14 @@
65
79
  - **Enter says Select, each footer names one exit, and Budget changes on Space.** The shared menu legend read `[Enter] Open` while the pickers read `Select`; it now says `Select` everywhere. The Footers legend drops the duplicate `[←] Back` and renames `[Esc] Revert` to `[Esc] Back`, because both keys already ran the same `back()`. The Budget screen moves its change action to Space (`[↑↓] Move [Space] Change [Esc] Back`) and Enter no longer changes a row; it stops calling Esc `Close` when it returns to `/arnative`. The Thinking list spells its number keys as `[0-6] Set level`, the provider delete prompt uses the arnative box instead of pi's stock confirm, and the Usage description names the active view, with its legend reading `[Space/Click] Show/Hide` and `[v] Next: <view>` stating where the key leads (`lib/shortcuts.ts`, `LEGEND_ROOT`/`LEGEND_MOVE`; `extensions/arnative.ts`, `footersPickerText`; `extensions/budget.ts`, `BUDGET_PICKER_TEXT`; `lib/provider.ts`, `THINKING_LEGEND`, `deleteProviderFlow`; `extensions/usage.ts`, the dashboard description; pinned in the list-picker, shortcuts, arnative, budget and usage self-checks).
66
80
  - **The Usage dashboard drops two summary lines and groups the price table.** The Total row now shows the catalog estimate (`~$2.93`) when no provider reported a billed total, instead of a bare `-`. The `today · 7d · 30d` line and the separate estimate line under it are gone, and the detail line writes `$2.93 est.` without a second `~`. In the Prices view, models sit under their provider like the Provider view, the group row stays blank, and the rate columns gained a space. Rows follow the menu palette: a group row (provider or project) uses the plain text color, model and price rows are dim, the expand arrow is accent, and the selected row takes the soft accent. Project and Prices keep that same two-level shape: one group row, then its indented rows (`softOf` derives it from the theme accent, so a theme without the `accentSoft` token still renders; `extensions/usage.ts`, `UsageModalComponent`, `buildFlatRows`, the row and Total renderers; pinned in the usage self-check).
67
81
 
82
+ ## [0.10.1] - 2026-11-11
83
+
84
+ ### Fixed
85
+ - Manual Model heal shows a start notice and live progress for flags, catalogs, and thinking probes. Final results now include partial failures.
86
+ - Manual Model heal now cancels on session reload or replacement. Model refresh captures the current model before awaiting and uses the bound extension API.
87
+ - Model heal now respects the one-hour cooldown after a failed effort probe. Reordering thinking map keys no longer triggers another probe.
88
+ - Failed model catalogs now wait one hour before an automatic retry. Successful catalogs keep their six-hour TTL; forced heals and endpoint changes bypass the cooldown.
89
+
68
90
  ## [0.10.0] - 2026-11-08
69
91
 
70
92
  ### Added
package/README.md CHANGED
@@ -24,7 +24,8 @@ pi-arnative replaces pi’s default terminal chrome with a unified visual interf
24
24
  - Prometheus Textfile Export: On every `turn_end` (at most one write per minute, and only when the numbers changed) the usage summary is written as an exposition file to `~/.pi/agent/arnative/usage.prom` — point a textfile collector at that folder (`node_exporter --collector.textfile.directory=~/.pi/agent/arnative`) and the spend lands in Grafana next to the infra metrics; set `PI_ARNATIVE_EXPORT=0` to turn it off.
25
25
  - Custom Providers: Interactive `/providers` wizard to probe endpoints, pick models, set thinking levels, edit the base URL, provider id or API key, and save OpenAI-, Anthropic-, Gemini-, or Ollama-compatible channels to `models.json` and `auth.json`.
26
26
  - Model Heal: Background sync (`/model-heal`) that fills missing compat flags, `/models` token limits, and accepted reasoning effort levels in `models.json`.
27
- - Auto-compact: Automatic context compaction after a turn settles using smart window tiers or a fixed token budget.
27
+ - Auto-compact: Triggers context compaction after a turn settles using Render-cache-aware Smart tiers or a fixed token budget, plus silent in-memory byte trimming for byte-capped proxies.
28
+ - Render Cache: Caches settled transcript components inside `chatContainer` so TUI redraws stay fast on large sessions (`On` by default).
28
29
 
29
30
  <details>
30
31
  <summary><b>Configuration & Presets</b></summary>
@@ -35,7 +36,12 @@ Saved to `~/.pi/agent/arnative/config.json` via `/arnative`:
35
36
  - **Footer cost:** off by default. Press `[c]` in the Footers picker to add the session's cost (`$0.42`, `~$0.42` when no provider reported a billed total) to the metrics row; the choice is stored as `footerCost` in `config.json`.
36
37
  - **Chatbox:** `Arnative` (default: rounded box with configurable prompt icon `❯`, `>`, `›`, `▸`, `→`, `\uf44f`, `\udb82\udf79`, `\uf51b`, `\udb80\udf7d`, `\uf120`, `\uf489`, or `\udb80\udd7a` cycled with `[i]`, painted `primary` while typing and `dim` after 3s idle) or `Pi (system)` (built-in top and bottom lines), plus `[D]` to position the working status dialog (`Left`, `Center`, `Right`, `Inside`, `Outside`).
37
38
  - **Animations:** 18 presets (`Arnative` default, `Pi (system)`, and alphabetical variants). Press `[g]` in the picker to toggle the Google gradient sweep.
38
- - **Auto-compact:** Off by default. **Smart** tiers trigger near ~200k tokens (`≥768k→20%`, `≥384k→40%`, `≥192k→80%`, `<192k→pi core`), or pick a fixed budget (`100k` to `400k`).
39
+ - **Render cache:** `On` by default. Reuses rendered lines for settled Pi transcript components in `chatContainer`; streaming items, active animations, and custom or unknown renderers bypass the cache.
40
+ - **Auto-compact:** `Off` by default (extension trigger disabled; Pi core compaction stays in charge).
41
+ - **Smart:** Adapts to `Render cache` and `contextWindow`. With `Render cache: On`, windows `>= 192k` trigger at `90%` (`~180k` on `200k`, `~900k` on `1M`, `943,718` on `1,048,576`), while `< 192k` defers to Pi core. With `Render cache: Off`, `Smart` uses conservative tiers (`1M -> 20%`, `512k -> 40%`, `256k -> 80%`, `< 192k -> pi core`).
42
+ - **Fixed budgets (`100k` to `400k`):** Fire at one absolute token count on any window. A budget above a model's capacity does not expand it; Pi core (`reserveTokens`) and provider limits still apply first.
43
+ - **Trade-offs:** `Smart` retains raw history longer on large windows and avoids unnecessary summarization on short sessions. An earlier fixed budget such as `300k` shrinks prompts after compaction on 1M-window models, but pays an upfront summary cost and resets the prefix cache once; in a 6-turn GLM/Magpie coding A/B sample, `300k` broke even at request 5 and cost 16.1% less at configured rates, while a 2-turn ~250k test cost more than keeping the prefix cached. Thresholds are triggers, not hard caps.
44
+ - **Byte guard (`PI_ARNATIVE_BYTE_WALL_MB`):** For `remote/*`, `remote-magpie/*`, and models that saw HTTP 413, payloads approaching `900 KB` (at the default `1` MB wall) are trimmed in-memory before sending without triggering compaction or altering session history. Set `PI_ARNATIVE_BYTE_WALL_MB` before starting Pi to scale the ceiling (for example `16` for a `16m` proxy limit); the footer shows wire bytes on the left row.
39
45
  - **Model heal:** **Full** (default: offline compat flags, `GET /models` limits and reasoning effort probes cached locally until new models appear, with failed fetches retried after 1h), **Flags** (offline only), or **Off**. Hand-edited fields are never overwritten. `/model-heal` forces every pass, warns that thinking probes can use paid tokens, and shows the stage it is in.
40
46
  - **Task list (`todo`):** Stored per session in `~/.pi/agent/arnative/todos/<session-id>.json` (uninstall `@juicesharp/rpiv-todo` first to avoid tool name conflict). Click `[show]` / `[hide]` (or single-click anywhere on the box) or press `ctrl+alt+o` (`alt+o`) to toggle; click `↑`/`↓` counters or press `ctrl+alt+j`/`k` (`alt+j`/`k`) to scroll. Auto-hides 30s after completion (set `PI_ARNATIVE_TODO_HIDE_MS` to override, `0` for immediate hide; expanding pauses the timer).
41
47
 
@@ -75,7 +81,7 @@ module deleted here is pruned from the installed copy (a stale entry point would
75
81
  | `ctrl+alt+k` · `alt+k` | Scroll task list up |
76
82
  | Click `[show]` / `[hide]` · `ctrl+o` | Toggle tool output box |
77
83
  | `←` / `Esc` | Step back to parent menu / close active screen |
78
- | `/arnative` | Settings menu (Themes, Headers, Footers, Animations, Auto-compact, Model heal, Providers, Usage, Budget) |
84
+ | `/arnative` | Settings menu (Themes, Headers, Footers, Animations, Render cache, Auto-compact, Model heal, Providers, Usage, Budget) |
79
85
  | `/usage` | Token & cost dashboard |
80
86
  | `/todos` | Full task list recap |
81
87
  | `/providers` | Custom provider manager |
@@ -112,7 +118,10 @@ Bind `app.session.new` in `~/.pi/agent/keybindings.json`:
112
118
  | `extensions/tools.ts` | Rounded tool boxes, spinners, duration, and `[show]` / `[hide]` toggles |
113
119
  | `extensions/todos.ts` | `todo` tool, boxed widget above editor, and `/todos` screen |
114
120
  | `extensions/animations.ts` | Spinner preset picker and live preview |
115
- | `extensions/autocompact.ts` | Smart and fixed-budget context compaction |
121
+ | `extensions/autocompact.ts` | Smart and fixed-budget context compaction plus silent byte-wall shedding |
122
+ | `extensions/render-cache.ts` | Per-child and container transcript render cache for `chatContainer` |
123
+ | `extensions/budget.ts` | UTC day and rolling 30-day spend caps and footer warnings |
124
+ | `extensions/usage-export.ts` | Prometheus textfile metric export (`usage.prom`) |
116
125
  | `extensions/model-heal.ts` | Automatic `models.json` heal triggers and `/model-heal` |
117
126
  | `extensions/timestamps.ts` | Message timestamps and bubble backgrounds |
118
127
  | `extensions/ui-render-tweaks.ts` | Contrast tweaks, selection styling, and UI polish |
@@ -24,7 +24,7 @@ import {
24
24
  setSpinnerGradient,
25
25
  setSpinnerPreset,
26
26
  } from "./animations.ts";
27
- import { CHATBOX_DIALOG_KEY, CHATBOX_PRESET_KEY, CHATBOX_PROMPT_KEY, FOOTER_COST_KEY, FOOTER_PRESET_KEY, HEADER_PRESET_KEY, BUDGET_DAY_KEY, BUDGET_ENFORCE_KEY, BUDGET_MONTH_KEY, ensureChoices } from "../lib/preset-store.ts";
27
+ import { CHATBOX_DIALOG_KEY, CHATBOX_PRESET_KEY, CHATBOX_PROMPT_KEY, FOOTER_COST_KEY, FOOTER_PRESET_KEY, HEADER_PRESET_KEY, BUDGET_DAY_KEY, BUDGET_ENFORCE_KEY, BUDGET_MONTH_KEY, RENDER_CACHE_KEY, ensureChoices } from "../lib/preset-store.ts";
28
28
  import { CHATBOX_DIALOGS, CHATBOX_PRESETS, CHATBOX_PROMPTS, DEFAULT_CHATBOX_DIALOG, FOOTER_PRESETS, activeChatboxDialog, activeChatboxPreset, activeChatboxPrompt, activeFooterCost, activeFooterPreset, nextChatboxDialog, nextChatboxPrompt, setChatboxDialog, setChatboxPreset, setChatboxPrompt, setFooterCost, setFooterPreset, type ChatboxPreset, type FooterPreset } from "./footer.ts";
29
29
  import { activeBudgetDay, activeBudgetEnforce, activeBudgetMonth, openBudget } from "./budget.ts";
30
30
  import { HEADER_PRESETS, activeHeaderPreset, setHeaderPreset, type HeaderPreset } from "./section-headers.ts";
@@ -37,6 +37,12 @@ import {
37
37
  } from "./autocompact.ts";
38
38
  import { cancelManualHeal, healNow } from "./model-heal.ts";
39
39
  import { MODEL_HEAL_CHOICES, MODEL_HEAL_KEY, activeModelHeal, setModelHeal, type ModelHealChoice } from "../lib/model-heal.ts";
40
+ import {
41
+ RENDER_CACHE_CHOICES,
42
+ activeRenderCache,
43
+ setRenderCache,
44
+ type RenderCacheChoice,
45
+ } from "./render-cache.ts";
40
46
  import { LIST_LEGEND_LIVE, LIST_LEGEND_MOVE, LIST_LEGEND_ROOT, ListPicker, nameRows, rowText, type ListPickerText, type ListRow } from "../lib/list-picker.ts";
41
47
  import { BACK_KEY_LABEL } from "../lib/shortcuts.ts";
42
48
  import { openProviders } from "../lib/provider.ts";
@@ -59,7 +65,7 @@ export function menuRows(menus: Pick<ArnativeMenu, "label" | "description">[]):
59
65
  /** Title of the settings menu, derived from `screenTitle` so the format lives in one place. */
60
66
  export const MENU_TITLE = screenTitle("Settings");
61
67
  /** One-line description under the menu title. */
62
- export const MENU_DESC = "Themes, headers, footers, chatbox, animations, auto-compact, providers, usage, budget";
68
+ export const MENU_DESC = "Themes, headers, footers, chatbox, animations, auto-compact, render, providers, usage, budget";
63
69
 
64
70
  const THEMES_PICKER_TEXT: ListPickerText = {
65
71
  title: screenTitle("Themes"),
@@ -365,20 +371,26 @@ const AUTOCOMPACT_PICKER_TEXT: ListPickerText = {
365
371
  legend: LIST_LEGEND_MOVE,
366
372
  };
367
373
 
368
- /** One note per row: Smart states its tier table, a manual budget its window-independence. */
369
- const AUTO_COMPACT_NOTES: Record<AutoCompactChoice, string> = {
370
- Off: "never — pi's own compaction stays in charge",
371
- Smart: "by window: 1M→20% · 512k→40% · 256k→80% · <192k→pi core",
372
- "100k": "always above 100k tokens, any window",
373
- "150k": "always above 150k tokens, any window",
374
- "200k": "always above 200k tokens, any window",
375
- "300k": "always above 300k tokens, any window",
376
- "400k": "always above 400k tokens, any window",
377
- };
374
+ /** One note per row: Smart reflects Render cache state, a manual budget its window-independence. */
375
+ function autoCompactNotes(): Record<AutoCompactChoice, string> {
376
+ return {
377
+ Off: "never — pi's own compaction stays in charge",
378
+ Smart:
379
+ activeRenderCache() === "On"
380
+ ? "90% of window (≥192k) · <192k→pi core"
381
+ : "by window: 1M→20% · 512k→40% · 256k→80% · <192k→pi core",
382
+ "100k": "always above 100k tokens, any window",
383
+ "150k": "always above 150k tokens, any window",
384
+ "200k": "always above 200k tokens, any window",
385
+ "300k": "always above 300k tokens, any window",
386
+ "400k": "always above 400k tokens, any window",
387
+ };
388
+ }
378
389
 
379
390
  /** Rows for the Auto-compact picker: the saved choice ends its row with a green ✓. */
380
391
  export function autoCompactRows(opened: AutoCompactChoice): ListRow[] {
381
- return AUTO_COMPACT_CHOICES.map((c) => ({ label: c, note: AUTO_COMPACT_NOTES[c], chosen: c === opened }));
392
+ const notes = autoCompactNotes();
393
+ return AUTO_COMPACT_CHOICES.map((c) => ({ label: c, note: notes[c], chosen: c === opened }));
382
394
  }
383
395
 
384
396
  /** A plain (non-live) picker: the choice is committed by Enter, nothing previews. The
@@ -497,6 +509,62 @@ const openModelHeal = async (ctx: ExtensionCommandContext): Promise<boolean | vo
497
509
  return goBack === true;
498
510
  };
499
511
 
512
+ const RENDER_CACHE_PICKER_TEXT: ListPickerText = {
513
+ title: screenTitle("Render cache"),
514
+ description: "Cache settled chat messages and tool boxes so long sessions stay smooth across frames.",
515
+ legend: LIST_LEGEND_MOVE,
516
+ };
517
+
518
+ const RENDER_CACHE_NOTES: Record<RenderCacheChoice, string> = {
519
+ On: "reuse rendered lines for finished messages and tool boxes (default)",
520
+ Off: "render every transcript component directly on each frame",
521
+ };
522
+
523
+ /** Rows for the Render cache picker: the saved choice ends its row with a green ✓. */
524
+ export function renderCacheRows(opened: RenderCacheChoice): ListRow[] {
525
+ return RENDER_CACHE_CHOICES.map((c) => ({ label: c, note: RENDER_CACHE_NOTES[c], chosen: c === opened }));
526
+ }
527
+
528
+ const openRenderCache = async (ctx: ExtensionCommandContext): Promise<boolean | void> => {
529
+ const opened = activeRenderCache();
530
+
531
+ if (ctx.mode !== "tui") {
532
+ const labels = RENDER_CACHE_CHOICES.map((c) => (c === opened ? `${c} ✓` : c));
533
+ const pick = await ctx.ui.select(RENDER_CACHE_PICKER_TEXT.title, labels);
534
+ if (pick === undefined) return;
535
+ const choice = RENDER_CACHE_CHOICES[labels.indexOf(pick)]!;
536
+ setRenderCache(choice);
537
+ ctx.ui.notify(`[arnative] Render cache: ${choice}`, "info");
538
+ return;
539
+ }
540
+
541
+ const goBack = await ctx.ui.custom<boolean>((tui, theme, _kb, done) => {
542
+ const picker = new ListPicker(
543
+ theme,
544
+ renderCacheRows(opened),
545
+ opened,
546
+ {
547
+ preview: () => {},
548
+ revert: () => {},
549
+ done: () => {
550
+ const choice = RENDER_CACHE_CHOICES[picker.index]!;
551
+ setRenderCache(choice);
552
+ announce(ctx.ui, `Render cache: ${choice}.`);
553
+ done(false);
554
+ },
555
+ cancel: () => done(false),
556
+ back: () => done(true),
557
+ requestRender: () => tui.requestRender(),
558
+ },
559
+ RENDER_CACHE_PICKER_TEXT,
560
+ false,
561
+ ctx.thinkingLevel,
562
+ );
563
+ return picker;
564
+ });
565
+ return goBack === true;
566
+ };
567
+
500
568
  export const MENUS: ArnativeMenu[] = [
501
569
  {
502
570
  value: "themes",
@@ -540,6 +608,12 @@ export const MENUS: ArnativeMenu[] = [
540
608
  description: "auto-fix models.json: compat flags, limits, thinking levels (on by default)",
541
609
  open: openModelHeal,
542
610
  },
611
+ {
612
+ value: "render",
613
+ label: "Render cache",
614
+ description: "cache settled transcript rows across frames (on by default)",
615
+ open: openRenderCache,
616
+ },
543
617
  {
544
618
  value: "providers",
545
619
  label: "Providers",
@@ -649,7 +723,7 @@ export function shouldApplyDefaultTheme(
649
723
  * set without starting a session. */
650
724
  export function registerCommands(pi: Pick<ExtensionAPI, "registerCommand">): void {
651
725
  pi.registerCommand("arnative", {
652
- description: "Arnative settings menu: themes, headers, footers, chatbox, animations, auto-compact, model heal, providers, usage, budget",
726
+ description: "Arnative settings menu: themes, headers, footers, chatbox, animations, auto-compact, model heal, render cache, providers, usage, budget",
653
727
  getArgumentCompletions: arnativeCompletions,
654
728
  handler: arnativeHandler,
655
729
  });
@@ -675,6 +749,7 @@ export function recordProfile(): void {
675
749
  [SPINNER_GRADIENT_KEY]: activeSpinnerGradient() ? "on" : "off",
676
750
  [AUTO_COMPACT_KEY]: activeAutoCompact(),
677
751
  [MODEL_HEAL_KEY]: activeModelHeal(),
752
+ [RENDER_CACHE_KEY]: activeRenderCache(),
678
753
  [BUDGET_DAY_KEY]: activeBudgetDay() === undefined ? "" : String(activeBudgetDay()),
679
754
  [BUDGET_MONTH_KEY]: activeBudgetMonth() === undefined ? "" : String(activeBudgetMonth()),
680
755
  [BUDGET_ENFORCE_KEY]: activeBudgetEnforce() ? "on" : "off",
@@ -712,18 +787,22 @@ if (isMain(import.meta.url)) {
712
787
  assert(rowText(labels[0]!) === "Themes · arnative themes only (all themes: /settings → Theme)", "menu row text format");
713
788
  assert(labels[0]!.label === "Themes" && labels[0]!.note === "arnative themes only (all themes: /settings → Theme)", "menu row keeps label and note apart");
714
789
  assert(MENU_TITLE === "Settings - Arnative\u2819", `the menu title is the pinned string, got ${MENU_TITLE}`);
715
- assert(MENU_DESC === "Themes, headers, footers, chatbox, animations, auto-compact, providers, usage, budget", `the menu description is the pinned string, got ${MENU_DESC}`);
790
+ assert(MENU_DESC === "Themes, headers, footers, chatbox, animations, auto-compact, render, providers, usage, budget", `the menu description is the pinned string, got ${MENU_DESC}`);
716
791
  // Every menu row is reachable and the description names them all, so a new screen cannot
717
792
  // be added to MENUS and forgotten in the copy a user reads first.
718
- assert(MENUS.length === 10, "ten settings screens");
793
+ assert(MENUS.length === 11, "eleven settings screens");
719
794
  {
720
795
  const values = MENUS.map((m) => m.value);
721
796
  assert(values.indexOf("heal") === values.indexOf("compact") + 1, "Model heal row sits right after Auto-compact");
797
+ assert(values.indexOf("render") === values.indexOf("heal") + 1, "Render cache row sits right after Model heal");
722
798
  const heal = modelHealRows("Flags");
723
799
  assert(heal.map((r) => r.label).join(",") === "Full,Flags,Off,Run now", "Model heal rows: three modes then Run now");
724
800
  assert(heal.filter((r) => r.chosen).map((r) => r.label).join(",") === "Flags", "Model heal marks only the saved mode");
801
+ const rc = renderCacheRows("On");
802
+ assert(rc.map((r) => r.label).join(",") === "On,Off", "Render cache rows: On then Off");
803
+ assert(rc.filter((r) => r.chosen).map((r) => r.label).join(",") === "On", "Render cache marks only the saved mode");
725
804
  }
726
- for (const label of ["Themes", "Headers", "Footers", "Chatbox", "Animations", "Auto-compact", "Providers", "Usage", "Budget"]) {
805
+ for (const label of ["Themes", "Headers", "Footers", "Chatbox", "Animations", "Auto-compact", "Render cache", "Providers", "Usage", "Budget"]) {
727
806
  assert(MENUS.some((m) => m.label === label), `MENUS carries the ${label} screen`);
728
807
  }
729
808
  assert(/^Settings - Arnative/.test(MENU_TITLE), "title follows `<setting> - <extension>`");
@@ -747,6 +826,8 @@ if (isMain(import.meta.url)) {
747
826
  assert(acRows[1]!.chosen === true && acRows[0]!.chosen !== true, "the ✓ follows the saved choice");
748
827
  assert(acRows.every((r) => r.note!.length > 0), "every Auto-compact row carries its note");
749
828
  assert(autoCompactRows("Off")[0]!.chosen === true, "the marker moves when the saved choice changes");
829
+ assert(arnativeCompletions("re")![0]!.value === "render", "render cache menu has completions");
830
+ assert(MENUS.some((m) => m.value === "render"), "render cache menu registered");
750
831
  assert(arnativeCompletions("pr")![0]!.value === "providers", "providers menu has completions");
751
832
  assert(MENUS.some((m) => m.value === "providers"), "providers menu registered");
752
833
  // Every slash command, and the one alias: `/providers` must land on the providers screen.
@@ -757,7 +838,7 @@ if (isMain(import.meta.url)) {
757
838
  assert(typeof registered.get("providers")!.handler === "function", "/providers has a handler");
758
839
  assert(MENUS.some((m) => m.value === "providers"), "/providers routes to a menu row that exists");
759
840
  assert(
760
- registered.get("arnative")!.description === "Arnative settings menu: themes, headers, footers, chatbox, animations, auto-compact, model heal, providers, usage, budget",
841
+ registered.get("arnative")!.description === "Arnative settings menu: themes, headers, footers, chatbox, animations, auto-compact, model heal, render cache, providers, usage, budget",
761
842
  "the /arnative command description names every screen: " + registered.get("arnative")!.description,
762
843
  );
763
844
  }
@@ -793,7 +874,9 @@ if (isMain(import.meta.url)) {
793
874
  const previews: string[] = [];
794
875
  let reverted = 0;
795
876
  let done = 0;
796
- const picker = new ListPicker(fakeTheme, nameRows(["arnative", "arnative-cyberpunk"]), "arnative", {
877
+ // Wrap means one step down from the last row lands on the initial value, leaving
878
+ // nothing for Esc to revert, so the list carries a third row for this assertion.
879
+ const picker = new ListPicker(fakeTheme, nameRows(["arnative", "arnative-cyberpunk", "arnative-mono"]), "arnative", {
797
880
  preview: (n) => previews.push(n),
798
881
  revert: () => reverted++,
799
882
  done: () => done++,