@bismawy/pi-arnative 0.12.0 → 0.14.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 +43 -6
- package/README.md +13 -4
- package/extensions/arnative.ts +374 -68
- package/extensions/autocompact.ts +772 -64
- package/extensions/budget.ts +4 -3
- package/extensions/footer.ts +43 -39
- package/extensions/model-heal.ts +14 -17
- package/extensions/render-cache.ts +638 -0
- package/extensions/tools.ts +52 -2
- package/extensions/ui-render-tweaks.ts +23 -7
- package/extensions/usage.ts +3 -4
- package/lib/color.ts +34 -0
- package/lib/list-picker.ts +20 -12
- package/lib/patch.ts +26 -1
- package/lib/preset-store.ts +10 -1
- package/lib/status-widget.ts +5 -16
- package/lib/usage-store.ts +4 -5
- package/package.json +49 -49
- package/themes/arnative-blossom.json +9 -9
- package/themes/arnative-crimson.json +10 -10
- package/themes/arnative-cyberpunk.json +9 -9
- package/themes/arnative-dracula.json +9 -9
- package/themes/arnative-earthy.json +10 -10
- package/themes/arnative-garden.json +10 -10
- package/themes/arnative-gruvbox.json +10 -10
- package/themes/arnative-lemonade.json +9 -9
- package/themes/arnative-magical.json +9 -9
- package/themes/arnative-matrix.json +9 -9
- package/themes/arnative-neutral.json +9 -9
- package/themes/arnative-nord.json +8 -8
- package/themes/arnative-zinc.json +9 -9
- package/themes/arnative.json +9 -9
- package/themes/gen-themes.mjs +43 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.14.0] - 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **In-app Payload limit setting in `/arnative`.** Choose `Off`, `1 MB` (default), `4 MB`, `8 MB`, `16 MB`, `32 MB`, or `Custom` (1 to 1024 MB) under `/arnative` → **Payload limit**. Choices save to `config.json` (`payloadLimit`) and apply immediately to active sessions, footer pressure labels, and compaction input caps without restarting Pi; `PI_ARNATIVE_BYTE_WALL_MB` remains supported as a shell override (`extensions/arnative.ts`, `extensions/autocompact.ts`, `lib/preset-store.ts`).
|
|
4
9
|
|
|
5
10
|
### Fixed
|
|
6
|
-
-
|
|
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.
|
|
11
|
+
- **Box backgrounds are visible again on dark and 256-color terminals.** The user chat panel, system-message box, tool cards, selection and search highlight all sat at L≈19%, which resolves to `#001817` on the base theme: 1.14:1 against a black terminal, close enough to invisible that the chat bubble looked like it had no background at all. Every box now uses a measured lightness (`userMessageBg` L 32%, tool and system cards L 30%, selection L 36%), and box chroma has a floor so the tint survives quantization. On `TERM=xterm-256color` without `COLORTERM`, pi draws colors through `rgbToAnsi256`, which mapped the old backgrounds onto 6x6x6 cube black (index 16) for 13 of 14 themes; all 98 box tokens now quantize to a real color. Two themes' `primary` (`crimson`, `gruvbox`) and the thinking ramp's dimmest step were lifted to keep their contrast floors against the brighter canvas (`themes/gen-themes.mjs`, all `themes/*.json`, `lib/color.ts`, `extensions/ui-render-tweaks.ts`).
|
|
10
12
|
|
|
11
|
-
## [
|
|
13
|
+
## [0.13.1] - 2026-11-18
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **Organize `/arnative` into four top-level categories.** The root `/arnative` picker now lists `Appearance`, `Performance`, `Models`, and `Spend` with summaries of their contents, opening each category's submenu on `Enter` with `←` stepping back up (`extensions/arnative.ts`).
|
|
17
|
+
|
|
18
|
+
## [0.13.0] - 2026-11-18
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **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`).
|
|
22
|
+
- **`/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`).
|
|
23
|
+
- **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`).
|
|
24
|
+
- **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`).
|
|
25
|
+
- **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`).
|
|
26
|
+
- **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`).
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- 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`).
|
|
30
|
+
- 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`).
|
|
31
|
+
- **`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`).
|
|
32
|
+
- **`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`).
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- **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`).
|
|
36
|
+
- **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`).
|
|
37
|
+
- 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`).
|
|
38
|
+
- **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`).
|
|
39
|
+
- **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`).
|
|
40
|
+
- **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
41
|
|
|
13
42
|
## [0.12.0] - 2026-11-14
|
|
14
43
|
|
|
@@ -65,6 +94,14 @@
|
|
|
65
94
|
- **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
95
|
- **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
96
|
|
|
97
|
+
## [0.10.1] - 2026-11-11
|
|
98
|
+
|
|
99
|
+
### Fixed
|
|
100
|
+
- Manual Model heal shows a start notice and live progress for flags, catalogs, and thinking probes. Final results now include partial failures.
|
|
101
|
+
- Manual Model heal now cancels on session reload or replacement. Model refresh captures the current model before awaiting and uses the bound extension API.
|
|
102
|
+
- Model heal now respects the one-hour cooldown after a failed effort probe. Reordering thinking map keys no longer triggers another probe.
|
|
103
|
+
- 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.
|
|
104
|
+
|
|
68
105
|
## [0.10.0] - 2026-11-08
|
|
69
106
|
|
|
70
107
|
### 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:
|
|
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
|
-
- **
|
|
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
|
+
- **Payload limit (`/arnative` → Payload limit, or `PI_ARNATIVE_BYTE_WALL_MB`):** For `remote/*`, `remote-magpie/*`, and models that saw HTTP 413, payloads approaching `900 KB` (at the default `1 MB` limit) are trimmed in-memory before sending without triggering compaction or altering session history. Choose `Off`, `1 MB`, `4 MB`, `8 MB`, `16 MB`, `32 MB`, or `Custom` (1 to 1024 MB) in `/arnative` (saved to `config.json` and applied immediately; `PI_ARNATIVE_BYTE_WALL_MB` overrides it per shell). The footer shows wire bytes on the left row while active.
|
|
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, Payload limit, 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 |
|