aegiscode 6.7.0 → 6.7.1
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/README.md +46 -0
- package/bin/aegiscode.js +87 -0
- package/package.json +1 -1
- package/src/art.js +114 -60
- package/src/caps.js +597 -0
- package/src/commands.js +85 -1
- package/src/panels.js +59 -1
- package/src/render.js +27 -16
- package/src/screen.js +20 -20
- package/src/theme.js +297 -160
package/src/theme.js
CHANGED
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Design tokens — the aegiscodex-dev design system, adopted wholesale
|
|
4
|
+
* Design tokens — the aegiscodex-dev design system, adopted wholesale, and
|
|
5
|
+
* resolved through the terminal's capabilities (`caps.js`) rather than the
|
|
6
|
+
* platform the process happens to run on.
|
|
5
7
|
*
|
|
6
|
-
* Every value below is copied verbatim from `aegiscodex-dev/src/theme.js`,
|
|
7
|
-
* extracted them from the live ANSI stream of Claude Code: gold 255,193,7
|
|
8
|
-
* coral 215,119,87 · lavender 177,185,249 · blue 120,160,250 · green 78,186,101
|
|
9
|
-
* · red 220,90,90 · gray 153,153,153 · dim 80,80,80.
|
|
8
|
+
* Every colour value below is copied verbatim from `aegiscodex-dev/src/theme.js`,
|
|
9
|
+
* which extracted them from the live ANSI stream of Claude Code: gold 255,193,7
|
|
10
|
+
* · coral 215,119,87 · lavender 177,185,249 · blue 120,160,250 · green 78,186,101
|
|
11
|
+
* · red 220,90,90 · gray 153,153,153 · dim 80,80,80. `test/cli-conformance.test.mjs`
|
|
12
|
+
* pins them to aegiscodex-dev's source and reads them back out of a truecolor
|
|
13
|
+
* SGR prefix, so the design cannot drift.
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* What DOES change per terminal is how those triples reach the screen:
|
|
16
|
+
*
|
|
17
|
+
* · `RGB()`/`BG()` go through `caps.rgb()/caps.bg()`, which emit 24-bit SGR,
|
|
18
|
+
* the 256-colour cube, the 16 ANSI slots, or nothing at all — decided by the
|
|
19
|
+
* terminal, not by us. On a legacy Windows console or `TERM=linux` the UI
|
|
20
|
+
* now paints in colours that console can actually show, instead of emitting
|
|
21
|
+
* truecolor escapes it renders as literal text or dithers unpredictably.
|
|
22
|
+
* · `glyphsFor()` is a function of the resolved capabilities, so PowerShell in
|
|
23
|
+
* Windows Terminal gets the same ❯ ⎿ ✻ ✦ set as zsh, and only a terminal
|
|
24
|
+
* that genuinely cannot draw them (legacy console, `TERM=dumb`, a non-UTF-8
|
|
25
|
+
* locale, `AEGIS_ART=ascii`) gets the ASCII stand-ins.
|
|
26
|
+
*
|
|
27
|
+
* Both are re-materialised when the capabilities change (`onCapsChange`), so
|
|
28
|
+
* `aegiscode --ascii`, `--no-color` and the `/terminal` command take effect on
|
|
29
|
+
* the palette and glyph table of a *running* session — the exported objects are
|
|
30
|
+
* mutated in place rather than replaced, because renderers hold references to
|
|
31
|
+
* them (`const { C } = require('./theme.js')`).
|
|
15
32
|
*
|
|
16
33
|
* Zero dependencies: SGR escapes are hand-built, like the rest of this repo.
|
|
17
34
|
*/
|
|
18
35
|
|
|
36
|
+
const { caps, detect, onCapsChange, rgb, bg } = require('./caps.js');
|
|
37
|
+
|
|
19
38
|
// The stencil is the mark's single source of truth for its own runes — this
|
|
20
39
|
// file resolves `star` through it rather than restating the platform rule.
|
|
21
|
-
// `art.js` requires
|
|
40
|
+
// `art.js` requires only `caps.js`, so this import cannot cycle.
|
|
22
41
|
const { STAR, stencilGlyph } = require('./art.js');
|
|
23
42
|
|
|
24
43
|
const RESET = '\x1b[0m';
|
|
@@ -32,111 +51,99 @@ const UNDER_OFF = '\x1b[24m';
|
|
|
32
51
|
const RESET_FG = '\x1b[39m';
|
|
33
52
|
const RESET_BG = '\x1b[49m';
|
|
34
53
|
|
|
35
|
-
|
|
36
|
-
const
|
|
54
|
+
/** Truecolour foreground SGR (or the best the terminal can do — see caps.js). */
|
|
55
|
+
const RGB = (r, g, b) => rgb(r, g, b);
|
|
56
|
+
/** Truecolour background SGR (or the best the terminal can do). */
|
|
57
|
+
const BG = (r, g, b) => bg(r, g, b);
|
|
37
58
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
lavender: RGB(177, 185, 249), // selection cursor ❯, links, focused option
|
|
43
|
-
blue: RGB(120, 160, 250), // selected palette row
|
|
44
|
-
green: RGB(78, 186, 101), // checkmarks, success, diff additions
|
|
45
|
-
red: RGB(220, 90, 90), // diff removals, errors
|
|
46
|
-
gray: RGB(153, 153, 153), // secondary text, menu numbers, hints
|
|
47
|
-
dim: RGB(80, 80, 80), // ╌ divider lines
|
|
48
|
-
white: RGB(255, 255, 255), // primary text, spinner glyphs
|
|
49
|
-
black: RGB(30, 30, 30), // code-block background
|
|
50
|
-
darkBg: RGB(20, 20, 20), // theme card background
|
|
51
|
-
};
|
|
59
|
+
// ── the palettes ─────────────────────────────────────────────────────────────
|
|
60
|
+
// Built by functions and written into stable objects: `Object.assign` on every
|
|
61
|
+
// capability change keeps the key set identical (the conformance guard pins
|
|
62
|
+
// `Object.keys(C)`) while the escapes follow the new depth.
|
|
52
63
|
|
|
64
|
+
/** The dark palette. Role names match aegiscodex-dev exactly. */
|
|
65
|
+
const C = {};
|
|
53
66
|
/** Light-theme approximations, true to the dark palette's hue mapping. */
|
|
54
|
-
const LIGHT = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
gray: RGB(110, 110, 110),
|
|
62
|
-
dim: RGB(170, 170, 170),
|
|
63
|
-
white: RGB(40, 40, 40),
|
|
64
|
-
black: RGB(245, 245, 245),
|
|
65
|
-
darkBg: RGB(255, 255, 255),
|
|
66
|
-
};
|
|
67
|
+
const LIGHT = {};
|
|
68
|
+
/** The colourblind-friendly dark/light variants. */
|
|
69
|
+
const CB_DARK = {};
|
|
70
|
+
const CB_LIGHT = {};
|
|
71
|
+
/** The 16-colour ANSI-only variants. */
|
|
72
|
+
const ANSI_DARK = {};
|
|
73
|
+
const ANSI_LIGHT = {};
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
* contains, so it keeps its own definition.
|
|
82
|
-
*/
|
|
83
|
-
function glyphsFor(platform = process.platform) {
|
|
84
|
-
const base = {
|
|
85
|
-
cursor: '❯', // menu selection marker, prompt prefix
|
|
86
|
-
check: '✔', // selected / completed
|
|
87
|
-
divider: '╌', // menu separators
|
|
88
|
-
bullet: '·', // inline separators
|
|
89
|
-
hint: '❯', // "Try ..." suggestion marker
|
|
90
|
-
pause: '⏸', // bottom status line (manual mode)
|
|
91
|
-
star: stencilGlyph(STAR, platform), // own-session marker, decorations
|
|
92
|
-
rightarrow: '→', // the manual ⇄ auto mode switch, advertised on the status line
|
|
93
|
-
pointer: '▸', // tips list bullets
|
|
94
|
-
hook: '⎿', // inline command / tip rows (tool commands, usage hints)
|
|
95
|
-
block: '●', // streaming cursor / assistant answer marker
|
|
96
|
-
bloom: '✻', // "done" spinner glyph (✻ Brewed for 2s)
|
|
97
|
-
spin: ['✢', '·', '✻', '*', '✽', '✶'], // working spinner
|
|
98
|
-
ellipse: '…',
|
|
75
|
+
function buildDark() {
|
|
76
|
+
return {
|
|
77
|
+
gold: RGB(255, 193, 7), // header line, accents, welcome frame
|
|
78
|
+
coral: RGB(215, 119, 87), // "Welcome to ..." title
|
|
79
|
+
lavender: RGB(177, 185, 249), // selection cursor ❯, links, focused option
|
|
80
|
+
blue: RGB(120, 160, 250), // selected palette row
|
|
81
|
+
green: RGB(78, 186, 101), // checkmarks, success, diff additions
|
|
82
|
+
red: RGB(220, 90, 90), // diff removals, errors
|
|
83
|
+
gray: RGB(153, 153, 153), // secondary text, menu numbers, hints
|
|
84
|
+
dim: RGB(80, 80, 80), // ╌ divider lines
|
|
85
|
+
white: RGB(255, 255, 255), // primary text, spinner glyphs
|
|
86
|
+
black: RGB(30, 30, 30), // code-block background
|
|
87
|
+
darkBg: RGB(20, 20, 20), // theme card background
|
|
99
88
|
};
|
|
100
|
-
if (platform === 'win32') {
|
|
101
|
-
return {
|
|
102
|
-
...base,
|
|
103
|
-
pause: '❚❚', // ⏸ U+23F8 missing from many Windows fonts
|
|
104
|
-
hook: '_|', // ⎿ U+23BF almost never present in Windows fonts
|
|
105
|
-
bloom: '*', // ✻ U+273B
|
|
106
|
-
spin: ['|', '/', '-', '\\', '*', '-'],
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (platform === 'darwin') {
|
|
110
|
-
return {
|
|
111
|
-
...base,
|
|
112
|
-
pause: '❚❚', // ⏸ has an emoji presentation on Apple fonts
|
|
113
|
-
hook: '_|', // ⎿ U+23BF not in Apple monospace fonts
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
return base;
|
|
117
89
|
}
|
|
118
90
|
|
|
119
|
-
|
|
91
|
+
function buildLight() {
|
|
92
|
+
return {
|
|
93
|
+
gold: RGB(180, 130, 0),
|
|
94
|
+
coral: RGB(190, 100, 70),
|
|
95
|
+
lavender: RGB(120, 130, 220),
|
|
96
|
+
blue: RGB(70, 110, 220),
|
|
97
|
+
green: RGB(60, 150, 80),
|
|
98
|
+
red: RGB(200, 60, 60),
|
|
99
|
+
gray: RGB(110, 110, 110),
|
|
100
|
+
dim: RGB(170, 170, 170),
|
|
101
|
+
white: RGB(40, 40, 40),
|
|
102
|
+
black: RGB(245, 245, 245),
|
|
103
|
+
darkBg: RGB(255, 255, 255),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
120
106
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
'Fiddle-faddling',
|
|
133
|
-
'Orbiting',
|
|
134
|
-
'Prestidigitating',
|
|
135
|
-
];
|
|
107
|
+
function buildCbDark() {
|
|
108
|
+
return {
|
|
109
|
+
...buildDark(),
|
|
110
|
+
// The red/green pair — the one that carries meaning in diffs and errors —
|
|
111
|
+
// is remapped to the blue/orange axis, which stays distinguishable under
|
|
112
|
+
// deuteranopia and protanopia.
|
|
113
|
+
green: RGB(86, 182, 194),
|
|
114
|
+
red: RGB(255, 146, 43),
|
|
115
|
+
gold: RGB(255, 203, 71),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
136
118
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
function buildCbLight() {
|
|
120
|
+
return {
|
|
121
|
+
...buildLight(),
|
|
122
|
+
green: RGB(30, 130, 145),
|
|
123
|
+
red: RGB(200, 100, 20),
|
|
124
|
+
gold: RGB(150, 110, 0),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 16-colour SGR foregrounds. Written as escape strings rather than RGB triples
|
|
129
|
+
// because the variant exists precisely to hand the decision to the terminal.
|
|
130
|
+
const A = (n) => (caps().color ? `\x1b[${n}m` : '');
|
|
131
|
+
|
|
132
|
+
function buildAnsiDark() {
|
|
133
|
+
return {
|
|
134
|
+
gold: A(93), coral: A(91), lavender: A(94), blue: A(94), green: A(92),
|
|
135
|
+
red: A(91), gray: A(90), dim: A(90), white: A(97), black: A(40),
|
|
136
|
+
darkBg: caps().color ? '\x1b[48;5;236m' : '',
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function buildAnsiLight() {
|
|
141
|
+
return {
|
|
142
|
+
gold: A(33), coral: A(31), lavender: A(34), blue: A(34), green: A(32),
|
|
143
|
+
red: A(31), gray: A(90), dim: A(37), white: A(30), black: A(47),
|
|
144
|
+
darkBg: caps().color ? '\x1b[48;5;254m' : '',
|
|
145
|
+
};
|
|
146
|
+
}
|
|
140
147
|
|
|
141
148
|
/**
|
|
142
149
|
* Diff palette for edit blocks in the transcript — Monokai Extended, taken
|
|
@@ -151,23 +158,28 @@ const DONE_VERBS = ['Churned', 'Worked'];
|
|
|
151
158
|
* entry folded into the palette would fail the conformance guard. This is the
|
|
152
159
|
* same reason `DIFF` is its own object in the engine.
|
|
153
160
|
*/
|
|
154
|
-
const DIFF = {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
const DIFF = {};
|
|
162
|
+
const DIFF_LIGHT = {};
|
|
163
|
+
|
|
164
|
+
function buildDiff() {
|
|
165
|
+
return {
|
|
166
|
+
delFg: RGB(220, 90, 90),
|
|
167
|
+
delBg: BG(61, 1, 0),
|
|
168
|
+
delHiFg: RGB(248, 248, 242),
|
|
169
|
+
delHiBg: BG(92, 2, 0),
|
|
170
|
+
addFg: RGB(80, 200, 80),
|
|
171
|
+
addBg: BG(2, 40, 0),
|
|
172
|
+
addHiFg: RGB(255, 255, 255),
|
|
173
|
+
addHiBg: BG(4, 71, 0),
|
|
174
|
+
codeFg: RGB(248, 248, 242),
|
|
175
|
+
gutter: RGB(120, 120, 120),
|
|
176
|
+
kw: RGB(102, 217, 239),
|
|
177
|
+
fn: RGB(166, 226, 46),
|
|
178
|
+
str: RGB(230, 219, 116),
|
|
179
|
+
num: RGB(174, 129, 255),
|
|
180
|
+
comment: RGB(117, 113, 94),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
171
183
|
|
|
172
184
|
/**
|
|
173
185
|
* The light-theme diff palette. Monokai's dark backgrounds on a light terminal
|
|
@@ -175,52 +187,35 @@ const DIFF = {
|
|
|
175
187
|
* keeps its hue mapping from the dark set — the same relationship `LIGHT`
|
|
176
188
|
* already has to `C`.
|
|
177
189
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
function buildDiffLight() {
|
|
191
|
+
return {
|
|
192
|
+
delFg: RGB(160, 40, 40),
|
|
193
|
+
delBg: BG(255, 235, 233),
|
|
194
|
+
delHiFg: RGB(90, 0, 0),
|
|
195
|
+
delHiBg: BG(255, 205, 200),
|
|
196
|
+
addFg: RGB(30, 130, 40),
|
|
197
|
+
addBg: BG(232, 250, 232),
|
|
198
|
+
addHiFg: RGB(0, 80, 0),
|
|
199
|
+
addHiBg: BG(195, 240, 195),
|
|
200
|
+
codeFg: RGB(40, 40, 40),
|
|
201
|
+
gutter: RGB(150, 150, 150),
|
|
202
|
+
kw: RGB(0, 120, 160),
|
|
203
|
+
fn: RGB(80, 140, 0),
|
|
204
|
+
str: RGB(150, 110, 0),
|
|
205
|
+
num: RGB(120, 60, 200),
|
|
206
|
+
comment: RGB(140, 140, 130),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
195
209
|
|
|
196
210
|
const THEMES = { dark: C, light: LIGHT };
|
|
197
211
|
|
|
198
212
|
/**
|
|
199
213
|
* The two extra palette families the reference's theme picker offers.
|
|
200
214
|
*
|
|
201
|
-
* `cb` is the colourblind-friendly variant
|
|
202
|
-
* carries meaning in diffs and errors) is remapped to the blue/orange axis so
|
|
203
|
-
* the two remain distinguishable under deuteranopia and protanopia. `ansi` uses
|
|
215
|
+
* `cb` is the colourblind-friendly variant (see `buildCbDark`). `ansi` uses
|
|
204
216
|
* the terminal's own 16-colour table, for terminals whose truecolour output is
|
|
205
217
|
* remapped anyway — the whole point being that the *terminal* decides, not us.
|
|
206
218
|
*/
|
|
207
|
-
const CB_DARK = { ...C, green: RGB(86, 182, 194), red: RGB(255, 146, 43), gold: RGB(255, 203, 71) };
|
|
208
|
-
const CB_LIGHT = { ...LIGHT, green: RGB(30, 130, 145), red: RGB(200, 100, 20), gold: RGB(150, 110, 0) };
|
|
209
|
-
|
|
210
|
-
// 16-colour SGR foregrounds. Written as escape strings rather than RGB triples
|
|
211
|
-
// because the variant exists precisely to hand the decision to the terminal.
|
|
212
|
-
const A = (n) => `\x1b[${n}m`;
|
|
213
|
-
const ANSI_DARK = {
|
|
214
|
-
gold: A(93), coral: A(91), lavender: A(94), blue: A(94), green: A(92),
|
|
215
|
-
red: A(91), gray: A(90), dim: A(90), white: A(97), black: A(40),
|
|
216
|
-
darkBg: '\x1b[48;5;236m',
|
|
217
|
-
};
|
|
218
|
-
const ANSI_LIGHT = {
|
|
219
|
-
gold: A(33), coral: A(31), lavender: A(34), blue: A(34), green: A(32),
|
|
220
|
-
red: A(31), gray: A(90), dim: A(37), white: A(30), black: A(47),
|
|
221
|
-
darkBg: '\x1b[48;5;254m',
|
|
222
|
-
};
|
|
223
|
-
|
|
224
219
|
/**
|
|
225
220
|
* The theme picker's table, copied from `aegiscodex-dev/src/screens.js` THEMES
|
|
226
221
|
* (names and notes verbatim). `light` is the flag the reference sets on commit
|
|
@@ -253,6 +248,12 @@ function themeForIndex(i) {
|
|
|
253
248
|
* exactly as before. The colourblind and ANSI families are only consulted when
|
|
254
249
|
* `themeIndex` actually names one of them (3–6), so an app that seeds
|
|
255
250
|
* `themeIndex` to 0/1 for light/dark is unaffected.
|
|
251
|
+
*
|
|
252
|
+
* The *depth* is deliberately not consulted here: `C` is already built from
|
|
253
|
+
* `RGB()`, which is depth-aware, so a 16-colour console gets a 16-colour dark
|
|
254
|
+
* palette rather than being silently switched to the ANSI picker row — the
|
|
255
|
+
* picker row must keep meaning "use the terminal's own table", not
|
|
256
|
+
* "your terminal is too old".
|
|
256
257
|
*/
|
|
257
258
|
function themeOf(ctx) {
|
|
258
259
|
if (ctx && typeof ctx.themeIndex === 'number' && ctx.themeIndex >= 3 && ctx.themeIndex <= 6) {
|
|
@@ -275,6 +276,141 @@ function diffOf(ctx) {
|
|
|
275
276
|
return light ? DIFF_LIGHT : DIFF;
|
|
276
277
|
}
|
|
277
278
|
|
|
279
|
+
// ── glyphs ───────────────────────────────────────────────────────────────────
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The glyph table for a terminal, resolved from its capabilities.
|
|
283
|
+
*
|
|
284
|
+
* A few of the reference's glyphs are missing from some terminal fonts
|
|
285
|
+
* (⎿ U+23BF, ⏸ U+23F8, ✔ U+2714, ▸ U+25B8) or render as double-width emoji
|
|
286
|
+
* (✦ U+2726, ✻/✢/✽/✶), which breaks row alignment exactly like the welcome art.
|
|
287
|
+
* The three capability classes in `caps.js` decide the set:
|
|
288
|
+
*
|
|
289
|
+
* · `glyphs: 'ascii'` — no Unicode claim at all: legacy Windows console,
|
|
290
|
+
* `TERM=dumb`, a non-UTF-8 locale, `AEGIS_ART=ascii`. Every mark becomes a
|
|
291
|
+
* single-column ASCII stand-in, so the layout is identical but nothing is
|
|
292
|
+
* mis-rendered by a font that lacks the glyph.
|
|
293
|
+
* · `face: 'edges'` — the block palette survives but the quartile edges
|
|
294
|
+
* and the typographic marks (⎿, ⏸, ✔) do not (Apple fonts, older Windows
|
|
295
|
+
* fonts). Only those are swapped.
|
|
296
|
+
* · native — the reference's own set, on any terminal that can
|
|
297
|
+
* draw it: Windows Terminal, VS Code, iTerm2, WezTerm, kitty, Ghostty,
|
|
298
|
+
* Alacritty, GNOME Terminal, xterm, zsh on Linux/macOS.
|
|
299
|
+
*
|
|
300
|
+
* `star` is NOT restated here: it is resolved through `art.js`'s stencil, the
|
|
301
|
+
* single source of truth for the mark's runes, so the glyph table and the art
|
|
302
|
+
* can never disagree about the same character.
|
|
303
|
+
*
|
|
304
|
+
* @param {string|object} [target] a `process.platform` name, or a caps object,
|
|
305
|
+
* or nothing at all for the live process's resolved capabilities.
|
|
306
|
+
*/
|
|
307
|
+
function glyphsFor(target = null) {
|
|
308
|
+
const c = !target
|
|
309
|
+
? caps()
|
|
310
|
+
: typeof target === 'string'
|
|
311
|
+
? detect(process.env, process.stdout, target)
|
|
312
|
+
: target;
|
|
313
|
+
const ascii = c.glyphs === 'ascii';
|
|
314
|
+
const edges = ascii || c.face === 'edges';
|
|
315
|
+
|
|
316
|
+
if (ascii) {
|
|
317
|
+
return {
|
|
318
|
+
cursor: '>', // menu selection marker, prompt prefix
|
|
319
|
+
check: '+', // selected / completed
|
|
320
|
+
divider: '-', // menu separators
|
|
321
|
+
bullet: '.', // inline separators
|
|
322
|
+
hint: '>', // "Try ..." suggestion marker
|
|
323
|
+
pause: '||', // bottom status line (manual mode)
|
|
324
|
+
star: stencilGlyph(STAR, c), // own-session marker, decorations
|
|
325
|
+
rightarrow: '->', // the manual ⇄ auto mode switch
|
|
326
|
+
pointer: '>', // tips list bullets
|
|
327
|
+
hook: '_|', // inline command / tip rows
|
|
328
|
+
block: '*', // streaming cursor / assistant answer marker
|
|
329
|
+
bloom: '*', // "done" spinner glyph (✻ Brewed for 2s)
|
|
330
|
+
spin: ['|', '/', '-', '\\', '*', '-'], // working spinner
|
|
331
|
+
ellipse: '...',
|
|
332
|
+
err: 'x', // failed check
|
|
333
|
+
warn: '!', // warning mark
|
|
334
|
+
rule: '-', // ruled section headers
|
|
335
|
+
ruleHeavy: '=', // the welcome banner's frame rule
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const base = {
|
|
340
|
+
cursor: '❯', // menu selection marker, prompt prefix
|
|
341
|
+
check: '✔', // selected / completed
|
|
342
|
+
divider: '╌', // menu separators
|
|
343
|
+
bullet: '·', // inline separators
|
|
344
|
+
hint: '❯', // "Try ..." suggestion marker
|
|
345
|
+
pause: edges ? '❚❚' : '⏸', // bottom status line (manual mode)
|
|
346
|
+
star: stencilGlyph(STAR, c), // own-session marker, decorations
|
|
347
|
+
rightarrow: '→', // the manual ⇄ auto mode switch, advertised on the status line
|
|
348
|
+
pointer: '▸', // tips list bullets
|
|
349
|
+
hook: edges ? '_|' : '⎿', // inline command / tip rows (tool commands, usage hints)
|
|
350
|
+
block: '●', // streaming cursor / assistant answer marker
|
|
351
|
+
bloom: '✻', // "done" spinner glyph (✻ Brewed for 2s)
|
|
352
|
+
spin: ['✢', '·', '✻', '*', '✽', '✶'], // working spinner
|
|
353
|
+
ellipse: '…',
|
|
354
|
+
err: '✗', // failed check (render.js's notice marks live here too)
|
|
355
|
+
warn: '⚠', // warning mark
|
|
356
|
+
rule: '─', // ruled section headers
|
|
357
|
+
ruleHeavy: '━', // the welcome banner's frame rule
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
if (edges) {
|
|
361
|
+
// ⏸ U+23F8 and ⎿ U+23BF are the two the font stacks in this class lack;
|
|
362
|
+
// ✻ U+273B has an emoji presentation on them as well.
|
|
363
|
+
return { ...base, bloom: '*', spin: ['|', '/', '-', '\\', '*', '-'] };
|
|
364
|
+
}
|
|
365
|
+
return base;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** The live glyph table — re-materialised whenever the capabilities change. */
|
|
369
|
+
const GLYPH = glyphsFor();
|
|
370
|
+
|
|
371
|
+
/** Working-line verbs, verbatim from the capture-backed table. */
|
|
372
|
+
const VERBS = [
|
|
373
|
+
'Incubating',
|
|
374
|
+
'Tempering',
|
|
375
|
+
'Determining',
|
|
376
|
+
'Beboppin\'',
|
|
377
|
+
'Julienning',
|
|
378
|
+
'Inferring',
|
|
379
|
+
'Simmering',
|
|
380
|
+
'Twisting',
|
|
381
|
+
'Fermenting',
|
|
382
|
+
'Fiddle-faddling',
|
|
383
|
+
'Orbiting',
|
|
384
|
+
'Prestidigitating',
|
|
385
|
+
];
|
|
386
|
+
|
|
387
|
+
/** Completion verbs: "✻ Churned for 3s" after a chat turn, "✻ Worked for 3s"
|
|
388
|
+
* after one that used tools. */
|
|
389
|
+
const DONE_VERBS = ['Churned', 'Worked'];
|
|
390
|
+
|
|
391
|
+
// ── materialisation ──────────────────────────────────────────────────────────
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Rebuild every palette and the glyph table for the current capabilities.
|
|
395
|
+
* Mutates in place: renderers, screens and panels capture these objects at
|
|
396
|
+
* require time, and swapping the object would leave them drawing the previous
|
|
397
|
+
* terminal's colours after `--ascii` or `/terminal`.
|
|
398
|
+
*/
|
|
399
|
+
function rematerialize() {
|
|
400
|
+
Object.assign(C, buildDark());
|
|
401
|
+
Object.assign(LIGHT, buildLight());
|
|
402
|
+
Object.assign(CB_DARK, buildCbDark());
|
|
403
|
+
Object.assign(CB_LIGHT, buildCbLight());
|
|
404
|
+
Object.assign(ANSI_DARK, buildAnsiDark());
|
|
405
|
+
Object.assign(ANSI_LIGHT, buildAnsiLight());
|
|
406
|
+
Object.assign(DIFF, buildDiff());
|
|
407
|
+
Object.assign(DIFF_LIGHT, buildDiffLight());
|
|
408
|
+
Object.assign(GLYPH, glyphsFor());
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
rematerialize();
|
|
412
|
+
onCapsChange(rematerialize);
|
|
413
|
+
|
|
278
414
|
module.exports = {
|
|
279
415
|
RGB,
|
|
280
416
|
BG,
|
|
@@ -305,4 +441,5 @@ module.exports = {
|
|
|
305
441
|
VERBS,
|
|
306
442
|
DONE_VERBS,
|
|
307
443
|
themeOf,
|
|
444
|
+
rematerialize,
|
|
308
445
|
};
|