@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/themes/arnative.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"error": "oklch(76% 0.13 25)",
|
|
18
18
|
"warning": "oklch(86% 0.13 85)",
|
|
19
19
|
"tone": "oklch(95.1% 0.073 196)",
|
|
20
|
-
"surfaceMsg": "oklch(
|
|
20
|
+
"surfaceMsg": "oklch(32% 0.04 191)"
|
|
21
21
|
},
|
|
22
22
|
"colors": {
|
|
23
23
|
"accent": "accent",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
"text": "fg",
|
|
33
33
|
|
|
34
34
|
"thinkingText": "fgMuted",
|
|
35
|
-
"selectedBg": "oklch(
|
|
35
|
+
"selectedBg": "oklch(36% 0.033 86)",
|
|
36
36
|
"scrollbarTrack": "fgFaint",
|
|
37
37
|
"scrollbarThumb": "accentSoft",
|
|
38
|
-
"searchMatchBg": "oklch(
|
|
38
|
+
"searchMatchBg": "oklch(40% 0.059 0)",
|
|
39
39
|
"searchMatchText": "fg",
|
|
40
40
|
"userMessageBg": "surfaceMsg",
|
|
41
41
|
"userMessageText": "fg",
|
|
42
|
-
"customMessageBg": "oklch(
|
|
42
|
+
"customMessageBg": "oklch(30% 0.052 96)",
|
|
43
43
|
"customMessageText": "fg",
|
|
44
44
|
"customMessageLabel": "oklch(78% 0.091 96)",
|
|
45
|
-
"toolPendingBg": "oklch(
|
|
46
|
-
"toolSuccessBg": "oklch(
|
|
47
|
-
"toolErrorBg": "oklch(
|
|
45
|
+
"toolPendingBg": "oklch(30% 0.039 193)",
|
|
46
|
+
"toolSuccessBg": "oklch(30% 0.052 145)",
|
|
47
|
+
"toolErrorBg": "oklch(30% 0.052 25)",
|
|
48
48
|
"toolTitle": "fg",
|
|
49
49
|
|
|
50
50
|
"toolOutput": "fgMuted",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"syntaxOperator": "fg",
|
|
73
73
|
|
|
74
74
|
"syntaxPunctuation": "fgMuted",
|
|
75
|
-
"thinkingOff": "oklch(
|
|
76
|
-
"thinkingMinimal": "oklch(
|
|
75
|
+
"thinkingOff": "oklch(45% 0.012 205)",
|
|
76
|
+
"thinkingMinimal": "oklch(50% 0.033 193)",
|
|
77
77
|
"thinkingLow": "oklch(55% 0.052 193)",
|
|
78
78
|
"thinkingMedium": "oklch(63% 0.078 193)",
|
|
79
79
|
"thinkingHigh": "oklch(71% 0.104 193)",
|
package/themes/gen-themes.mjs
CHANGED
|
@@ -52,6 +52,15 @@ function soften(value, scale = 0.35, l = 0.90) {
|
|
|
52
52
|
return `oklch(${+(l * 100).toFixed(1)}% ${+chroma.toFixed(5)} ${Math.round(hue(o.H))})`;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Chroma a box background may keep. A panel tint needs to survive the 256-color
|
|
57
|
+
* quantizer, which drops any color whose channels are within 10 levels of each other
|
|
58
|
+
* onto the grey ramp. Enforcing a floor keeps the theme's hue in both color modes.
|
|
59
|
+
*/
|
|
60
|
+
function boxChroma(chroma) {
|
|
61
|
+
return Math.min(Math.max(chroma, 0.031), 0.06);
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
/** Normalize a spec color to an oklch literal: hex is converted, oklch passes through. */
|
|
56
65
|
function colorLiteral(value) {
|
|
57
66
|
const s = String(value).trim();
|
|
@@ -65,7 +74,23 @@ function colorLiteral(value) {
|
|
|
65
74
|
// --- shared ramps ----------------------------------------------------------
|
|
66
75
|
|
|
67
76
|
const NEUTRAL = { fg: 0.88, fgMuted: 0.72, fgDim: 0.61, fgFaint: 0.49 };
|
|
68
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Lightness of every box background (message panel, tool cards, selection).
|
|
79
|
+
*
|
|
80
|
+
* Two hard floors decide these numbers, both measured, not chosen:
|
|
81
|
+
*
|
|
82
|
+
* 1. A pure-black terminal (`#000000`) hides anything below L≈0.22: the panel at the
|
|
83
|
+
* old L 0.19 rendered `#001817`, contrast 1.14 against black — a box nobody sees.
|
|
84
|
+
* pi's own dark theme keeps its panel at L 0.338, which is the weight below.
|
|
85
|
+
* 2. 256-color terminals (any `TERM=*-256color` without `COLORTERM`) quantize every
|
|
86
|
+
* background through `rgbToAnsi256`. Below L≈0.23 the nearest entry is the 6x6x6
|
|
87
|
+
* cube black (index 16), so the box is drawn pure black on every theme.
|
|
88
|
+
*/
|
|
89
|
+
const CANVAS = { userMessage: 0.32, customMessage: 0.30, toolPending: 0.30, toolSuccess: 0.30, toolError: 0.30, selected: 0.36, searchMatch: 0.40 };
|
|
90
|
+
// Thinking ramp. `off` must still read as a visible step above CANVAS.userMessage
|
|
91
|
+
// (floor 1.3 contrast); at the old 0.40 the brightest canvas themes dropped it to
|
|
92
|
+
// 1.24, so the ramp starts at 0.45 and keeps its monotonic spacing to `minimal`.
|
|
93
|
+
const THINKING = { off: 0.45, minimal: 0.50, low: 0.55, medium: 0.63, high: 0.71, xhigh: 0.79 };
|
|
69
94
|
const SEMANTIC = { success: 145, error: 25, warning: 85 };
|
|
70
95
|
const SYNTAX_OFFSET = { keyword: 0, func: 45, variable: -45, string: 120, number: 180, type: 90 };
|
|
71
96
|
|
|
@@ -102,7 +127,7 @@ const THEMES = {
|
|
|
102
127
|
primary: "oklch(88.8% 0.181 96)",
|
|
103
128
|
secondary: "oklch(84.2% 0.172 86)",
|
|
104
129
|
tone: "oklch(95.1% 0.073 196)",
|
|
105
|
-
// Teal panel
|
|
130
|
+
// Teal panel; CANVAS.userMessage sets its lightness so the box stays visible.
|
|
106
131
|
surfaceMsg: "oklch(19% 0.04 191)",
|
|
107
132
|
// The label tier follows the accent (soft cyan); the gold signature lives on
|
|
108
133
|
// headings and links instead, so the theme keeps two tones without the label gap.
|
|
@@ -142,7 +167,7 @@ const THEMES = {
|
|
|
142
167
|
canvasL: 0.24,
|
|
143
168
|
neutralHue: 31,
|
|
144
169
|
neutralChroma: 0.015,
|
|
145
|
-
primary: "oklch(
|
|
170
|
+
primary: "oklch(60.5% 0.175 37)",
|
|
146
171
|
secondary: "oklch(79.2% 0.161 75)",
|
|
147
172
|
tone: "oklch(82% 0.14 70)",
|
|
148
173
|
surfaceMsg: "primary",
|
|
@@ -278,7 +303,7 @@ const THEMES = {
|
|
|
278
303
|
canvasL: 0.25,
|
|
279
304
|
neutralHue: 60,
|
|
280
305
|
neutralChroma: 0.008,
|
|
281
|
-
primary: "oklch(
|
|
306
|
+
primary: "oklch(61% 0.203 29)",
|
|
282
307
|
secondary: "oklch(57.6% 0.066 199)",
|
|
283
308
|
tone: "oklch(78% 0.045 170)",
|
|
284
309
|
surfaceMsg: "primary",
|
|
@@ -366,7 +391,7 @@ const THEMES = {
|
|
|
366
391
|
canvasL: 0.24,
|
|
367
392
|
neutralHue: 68,
|
|
368
393
|
neutralChroma: 0.012,
|
|
369
|
-
primary: "oklch(
|
|
394
|
+
primary: "oklch(58.5% 0.076 120)",
|
|
370
395
|
secondary: "oklch(60.9% 0.13 57)",
|
|
371
396
|
tone: "oklch(80% 0.06 120)",
|
|
372
397
|
surfaceMsg: "primary",
|
|
@@ -388,7 +413,7 @@ const THEMES = {
|
|
|
388
413
|
canvasL: 0.24,
|
|
389
414
|
neutralHue: 75,
|
|
390
415
|
neutralChroma: 0.012,
|
|
391
|
-
primary: "oklch(
|
|
416
|
+
primary: "oklch(58.5% 0.053 119)",
|
|
392
417
|
secondary: "oklch(48.9% 0.07 54)",
|
|
393
418
|
tone: "oklch(78% 0.04 119)",
|
|
394
419
|
surfaceMsg: "primary",
|
|
@@ -475,14 +500,17 @@ function derive(spec) {
|
|
|
475
500
|
if (spec.headingTone) vars.headingTone = colorLiteral(spec.headingTone);
|
|
476
501
|
|
|
477
502
|
// The message panel: a literal/hex override, or the name of a var whose hue is
|
|
478
|
-
//
|
|
503
|
+
// reused at the box lightness — so a theme keeps its signature tint on the panel
|
|
479
504
|
// instead of hand-picking a color. Defaults to the neutral canvas tint.
|
|
480
505
|
if (typeof spec.surfaceMsg === "string" && spec.surfaceMsg in vars) {
|
|
481
506
|
const src = parseOklch(vars[spec.surfaceMsg]);
|
|
482
507
|
assert(src !== null, `surfaceMsg var must be an oklch color: ${spec.surfaceMsg}`);
|
|
483
|
-
vars.surfaceMsg = oklch(
|
|
508
|
+
vars.surfaceMsg = oklch(CANVAS.userMessage, boxChroma(src.C), src.H);
|
|
484
509
|
} else {
|
|
485
|
-
|
|
510
|
+
const src = spec.surfaceMsg ? parseOklch(spec.surfaceMsg) : null;
|
|
511
|
+
vars.surfaceMsg = src
|
|
512
|
+
? oklch(CANVAS.userMessage, boxChroma(src.C), src.H)
|
|
513
|
+
: oklch(CANVAS.userMessage, boxChroma(nc * 0.5), nh);
|
|
486
514
|
}
|
|
487
515
|
|
|
488
516
|
const accentLiteral = oklch(0.8, Math.min(c * 0.7, 0.14), h);
|
|
@@ -499,20 +527,20 @@ function derive(spec) {
|
|
|
499
527
|
text: "fg",
|
|
500
528
|
thinkingText: "fgMuted",
|
|
501
529
|
|
|
502
|
-
selectedBg: oklch(
|
|
530
|
+
selectedBg: oklch(CANVAS.selected, Math.min(c * 0.25, 0.06), roleHue("selected")),
|
|
503
531
|
scrollbarTrack: "fgFaint",
|
|
504
532
|
scrollbarThumb: "accentSoft",
|
|
505
|
-
searchMatchBg: oklch(
|
|
533
|
+
searchMatchBg: oklch(CANVAS.searchMatch, Math.min(c * 0.45, 0.10), roleHue("searchMatch")),
|
|
506
534
|
searchMatchText: "fg",
|
|
507
535
|
userMessageBg: "surfaceMsg",
|
|
508
536
|
userMessageText: "fg",
|
|
509
|
-
customMessageBg: oklch(
|
|
537
|
+
customMessageBg: oklch(CANVAS.customMessage, boxChroma(c * 0.4), roleHue("label")),
|
|
510
538
|
customMessageText: "fg",
|
|
511
539
|
customMessageLabel: spec.labelColor ?? oklch(0.78, Math.min(c * 0.7, 0.14), roleHue("label")),
|
|
512
540
|
|
|
513
|
-
toolPendingBg: oklch(
|
|
514
|
-
toolSuccessBg: oklch(
|
|
515
|
-
toolErrorBg: oklch(
|
|
541
|
+
toolPendingBg: oklch(CANVAS.toolPending, boxChroma(c * 0.3), h),
|
|
542
|
+
toolSuccessBg: oklch(CANVAS.toolSuccess, boxChroma(c * 0.4), sem("success")),
|
|
543
|
+
toolErrorBg: oklch(CANVAS.toolError, boxChroma(c * 0.4), sem("error")),
|
|
516
544
|
toolTitle: "fg",
|
|
517
545
|
toolOutput: "fgMuted",
|
|
518
546
|
|