@denizokcu/haze 1.0.0 → 1.1.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/CHANGELOG.md +33 -0
- package/README.md +17 -8
- package/SECURITY.md +3 -1
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/TaskBar.js +1 -1
- package/dist/cli/chat/busyIndicator.d.ts +11 -0
- package/dist/cli/chat/busyIndicator.js +34 -0
- package/dist/cli/chat/chatMetrics.d.ts +0 -1
- package/dist/cli/chat/chatMetrics.js +1 -7
- package/dist/cli/chat/followUpQueue.d.ts +11 -0
- package/dist/cli/chat/followUpQueue.js +38 -0
- package/dist/cli/chat/inputSuggestions.js +1 -0
- package/dist/cli/chat/messages.d.ts +0 -22
- package/dist/cli/chat/messages.js +42 -87
- package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
- package/dist/cli/chat/sessionLifecycle.js +6 -1
- package/dist/cli/chat/sessionRecorder.d.ts +2 -0
- package/dist/cli/chat/sessionRecorder.js +6 -0
- package/dist/cli/chat/startupSequence.d.ts +29 -0
- package/dist/cli/chat/startupSequence.js +59 -0
- package/dist/cli/chat/transcriptPartition.d.ts +23 -0
- package/dist/cli/chat/transcriptPartition.js +78 -0
- package/dist/cli/chat/wizard/fieldTransitions.d.ts +38 -0
- package/dist/cli/chat/wizard/fieldTransitions.js +43 -0
- package/dist/cli/chat/wizard/lspHandlers.d.ts +4 -0
- package/dist/cli/chat/wizard/lspHandlers.js +85 -0
- package/dist/cli/chat/wizard/mcpHandlers.d.ts +8 -0
- package/dist/cli/chat/wizard/mcpHandlers.js +82 -0
- package/dist/cli/chat/wizard/providerHandlers.d.ts +12 -0
- package/dist/cli/chat/wizard/providerHandlers.js +420 -0
- package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +4 -0
- package/dist/cli/chat/wizard/sessionThemeHandlers.js +48 -0
- package/dist/cli/chat/wizard/skillsHandlers.d.ts +4 -0
- package/dist/cli/chat/wizard/skillsHandlers.js +125 -0
- package/dist/cli/chat/wizard/types.d.ts +63 -0
- package/dist/cli/chat/wizard/types.js +24 -0
- package/dist/cli/chat/wizard/uiState.d.ts +56 -0
- package/dist/cli/chat/wizard/uiState.js +15 -0
- package/dist/cli/chat/wizardDispatch.d.ts +11 -113
- package/dist/cli/chat/wizardDispatch.js +41 -805
- package/dist/cli/commands/chat.js +89 -110
- package/dist/cli/commands/commandHelp.js +2 -0
- package/dist/cli/commands/commands.js +2 -0
- package/dist/cli/commands/formatters.d.ts +0 -3
- package/dist/cli/commands/formatters.js +6 -29
- package/dist/cli/commands/runCommand.d.ts +2 -0
- package/dist/cli/commands/runCommand.js +67 -4
- package/dist/cli/commands/settingsSummary.js +2 -0
- package/dist/cli/commands/streaming/assistantSegments.d.ts +19 -0
- package/dist/cli/commands/streaming/assistantSegments.js +48 -0
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -2
- package/dist/cli/commands/streaming/attemptOutcome.js +17 -7
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +69 -8
- package/dist/cli/commands/streaming/goalCheckpoint.js +36 -1
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +17 -2
- package/dist/cli/commands/streaming/goalSupervisor.js +62 -12
- package/dist/cli/commands/streaming/prepareStep.d.ts +35 -0
- package/dist/cli/commands/streaming/prepareStep.js +100 -0
- package/dist/cli/commands/streaming/recoverySlices.d.ts +15 -0
- package/dist/cli/commands/streaming/recoverySlices.js +29 -0
- package/dist/cli/commands/streaming/stallRecovery.d.ts +0 -1
- package/dist/cli/commands/streaming/stallRecovery.js +0 -4
- package/dist/cli/commands/streaming/streamLoop.js +9 -230
- package/dist/cli/commands/streaming/toolGroupRenderer.js +2 -1
- package/dist/cli/commands/streaming/toolPartHandlers.d.ts +19 -0
- package/dist/cli/commands/streaming/toolPartHandlers.js +95 -0
- package/dist/cli/commands/streaming.d.ts +4 -1
- package/dist/cli/commands/streaming.js +6 -21
- package/dist/cli/commands/themesCommand.d.ts +17 -0
- package/dist/cli/commands/themesCommand.js +24 -0
- package/dist/cli/commands/wizardFlow.d.ts +7 -0
- package/dist/cli/commands/wizardFlow.js +20 -0
- package/dist/cli/index.js +3 -1
- package/dist/config/providerPresets.d.ts +7 -0
- package/dist/config/providerPresets.js +195 -391
- package/dist/config/settings.d.ts +2 -0
- package/dist/config/settings.js +1 -0
- package/dist/core/agent/completionController.d.ts +14 -7
- package/dist/core/agent/completionController.js +12 -6
- package/dist/core/agent/events.d.ts +12 -0
- package/dist/core/agent/goalPolicy.d.ts +4 -3
- package/dist/core/agent/goalPolicy.js +9 -4
- package/dist/core/agent/workState.d.ts +25 -15
- package/dist/core/agent/workState.js +71 -43
- package/dist/core/safety/secretPaths.d.ts +18 -0
- package/dist/core/safety/secretPaths.js +115 -0
- package/dist/core/session/sessionSlimming.js +8 -0
- package/dist/core/session/sessionStore.d.ts +61 -1
- package/dist/core/session/sessionStore.js +115 -6
- package/dist/llm/hazeTools.d.ts +64 -208
- package/dist/llm/hazeTools.js +6 -0
- package/dist/llm/systemPrompt.js +3 -1
- package/dist/llm/toolResultTypes.d.ts +1 -1
- package/dist/llm/tools/failures.d.ts +6 -0
- package/dist/llm/tools/failures.js +8 -2
- package/dist/llm/tools/readRecovery.js +2 -0
- package/dist/llm/tools/shellTool.js +3 -0
- package/dist/llm/tools/taskTool.d.ts +64 -208
- package/dist/llm/tools/taskTool.js +22 -10
- package/dist/llm/tools/workspaceFile.d.ts +4 -3
- package/dist/llm/tools/workspaceFile.js +30 -13
- package/dist/ui/components/Header.js +1 -1
- package/dist/ui/components/MarkdownText.js +10 -10
- package/dist/ui/components/TextInput.d.ts +1 -1
- package/dist/ui/components/TextInput.js +8 -69
- package/dist/ui/components/useInputSuggestions.d.ts +27 -0
- package/dist/ui/components/useInputSuggestions.js +98 -0
- package/dist/ui/terminalColors.d.ts +29 -0
- package/dist/ui/terminalColors.js +47 -0
- package/dist/ui/theme.d.ts +105 -10
- package/dist/ui/theme.js +125 -15
- package/dist/ui/themes/registry.d.ts +5 -0
- package/dist/ui/themes/registry.js +436 -0
- package/dist/utils/format.d.ts +10 -0
- package/dist/utils/format.js +45 -0
- package/package.json +1 -1
package/dist/ui/theme.js
CHANGED
|
@@ -1,16 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Haze theming core, aligned with the oh-my-zsh / zsh `colors` vocabulary so
|
|
3
|
+
* that oh-my-zsh themes port over with minimal effort.
|
|
4
|
+
*
|
|
5
|
+
* oh-my-zsh themes never define RGB colors. They reference terminal palette
|
|
6
|
+
* slots using zsh's `colors` vocabulary:
|
|
7
|
+
*
|
|
8
|
+
* $fg[cyan] → the named palette slot `cyan`
|
|
9
|
+
* $fg_bold[green] → named slot `green` (bold is a text attribute, not a color)
|
|
10
|
+
* ${FG[214]} / %F{214} → an xterm-256 color index
|
|
11
|
+
* %F{#ff8800} → truecolor hex
|
|
12
|
+
*
|
|
13
|
+
* Haze themes mirror that split in two layers:
|
|
14
|
+
*
|
|
15
|
+
* 1. Palette — `ZSH_NAMED_COLORS`, one entry per zsh `colors` key
|
|
16
|
+
* (`black red green yellow blue magenta cyan white default`), approximated
|
|
17
|
+
* as RGB because haze cannot assume the host terminal's palette.
|
|
18
|
+
* A theme spec may override slots with `palette`.
|
|
19
|
+
* 2. Roles — semantic haze surfaces (accent, command, warning, …) whose
|
|
20
|
+
* values are written in the same vocabulary an oh-my-zsh theme uses:
|
|
21
|
+
* a zsh color name, an xterm-256 index string, or `#rrggbb` hex.
|
|
22
|
+
*
|
|
23
|
+
* The built-in themes live in `src/ui/themes/registry.ts` — one data entry per
|
|
24
|
+
* theme, named like its oh-my-zsh counterpart — including ports of famous
|
|
25
|
+
* `.zsh-theme` files where `robbyrussell`'s `$fg_bold[green]➜` becomes
|
|
26
|
+
* `accent: 'green'`, its `$fg[cyan]%c` becomes `command: 'cyan'`, etc. See
|
|
27
|
+
* `src/ui/themes/AGENTS.md` for the full conversion guide and the segment →
|
|
28
|
+
* role translation table.
|
|
29
|
+
*/
|
|
30
|
+
import { BASE_THEME_SPEC, THEMES } from './themes/registry.js';
|
|
31
|
+
export { THEMES as BUILT_IN_THEME_SPECS };
|
|
32
|
+
/** The theme used when settings name none; also the fallback base for roles another theme omits. */
|
|
33
|
+
export const DEFAULT_THEME_NAME = 'purple';
|
|
34
|
+
export const ZSH_COLOR_NAMES = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
|
|
35
|
+
/**
|
|
36
|
+
* RGB approximation of the terminal palette slots the zsh names reference,
|
|
37
|
+
* based on the Tango palette (GNOME Terminal's classic default) because
|
|
38
|
+
* oh-my-zsh themes leave the actual RGB to the terminal. `default` approximates
|
|
39
|
+
* the terminal's default foreground color.
|
|
40
|
+
*/
|
|
41
|
+
export const ZSH_NAMED_COLORS = {
|
|
42
|
+
black: '#2e3436',
|
|
43
|
+
red: '#cc0000',
|
|
44
|
+
green: '#4e9a06',
|
|
45
|
+
yellow: '#c4a000',
|
|
46
|
+
blue: '#3465a4',
|
|
47
|
+
magenta: '#75507b',
|
|
48
|
+
cyan: '#06989a',
|
|
49
|
+
white: '#d3d7cf',
|
|
50
|
+
default: '#ffffff',
|
|
16
51
|
};
|
|
52
|
+
/** Bright variants (ANSI slots 8–15), used to resolve xterm-256 indices 8–15. */
|
|
53
|
+
const ANSI_16_BRIGHT = [
|
|
54
|
+
'#555753', '#ef2929', '#8ae234', '#fce94f', '#729fcf', '#ad7fa8', '#34e2e2', '#eeeeec',
|
|
55
|
+
];
|
|
56
|
+
export const THEME_ROLES = [
|
|
57
|
+
'background', 'accent', 'accentDim', 'border', 'info', 'muted', 'foreground', 'command',
|
|
58
|
+
'success', 'successBg', 'danger', 'dangerBg', 'warning', 'surfaceBg', 'codeBg',
|
|
59
|
+
];
|
|
60
|
+
const HEX_COLOR = /^#[0-9a-fA-F]{6}$/;
|
|
61
|
+
const XTERM_CUBE_LEVELS = [0, 95, 135, 175, 215, 255];
|
|
62
|
+
/** xterm-256 index → RGB hex, mirroring zsh's `%F{nnn}` / `${FG[nnn]}` resolution. Base slots 0–7 resolve through the given palette. */
|
|
63
|
+
export function xterm256Color(index, palette = ZSH_NAMED_COLORS) {
|
|
64
|
+
if (index < 8)
|
|
65
|
+
return palette[ZSH_COLOR_NAMES[index]].toLowerCase();
|
|
66
|
+
if (index < 16)
|
|
67
|
+
return ANSI_16_BRIGHT[index - 8];
|
|
68
|
+
if (index <= 231) {
|
|
69
|
+
const n = index - 16;
|
|
70
|
+
const r = XTERM_CUBE_LEVELS[Math.floor(n / 36)];
|
|
71
|
+
const g = XTERM_CUBE_LEVELS[Math.floor(n / 6) % 6];
|
|
72
|
+
const b = XTERM_CUBE_LEVELS[n % 6];
|
|
73
|
+
return toHex(r, g, b);
|
|
74
|
+
}
|
|
75
|
+
const gray = 8 + 10 * (index - 232);
|
|
76
|
+
return toHex(gray, gray, gray);
|
|
77
|
+
}
|
|
78
|
+
function toHex(r, g, b) {
|
|
79
|
+
const part = (v) => v.toString(16).padStart(2, '0');
|
|
80
|
+
return `#${part(r)}${part(g)}${part(b)}`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolve a color spec (`'cyan'`, `'214'`, `'#ff8800'`) to `#rrggbb` hex.
|
|
84
|
+
* Throws with the accepted vocabulary for unknown values (fail loudly).
|
|
85
|
+
*/
|
|
86
|
+
export function resolveColorSpec(spec, palette = ZSH_NAMED_COLORS) {
|
|
87
|
+
const value = spec.trim();
|
|
88
|
+
if (HEX_COLOR.test(value))
|
|
89
|
+
return value.toLowerCase();
|
|
90
|
+
if (/^[0-9]{1,3}$/.test(value)) {
|
|
91
|
+
const index = Number(value);
|
|
92
|
+
if (index <= 255)
|
|
93
|
+
return xterm256Color(index, palette);
|
|
94
|
+
}
|
|
95
|
+
if (ZSH_COLOR_NAMES.includes(value))
|
|
96
|
+
return palette[value].toLowerCase();
|
|
97
|
+
throw new Error(`Unknown color "${spec}". Use a zsh color name (${ZSH_COLOR_NAMES.join(', ')}), an xterm-256 index like "214", or hex like "#ff8800".`);
|
|
98
|
+
}
|
|
99
|
+
/** Resolve a built-in theme name (+ optional role overrides) to a complete `HazeTheme`. Throws with valid names for unknown themes. */
|
|
100
|
+
export function resolveTheme(name, overrides) {
|
|
101
|
+
const spec = THEMES[name ?? DEFAULT_THEME_NAME];
|
|
102
|
+
if (!spec) {
|
|
103
|
+
const validNames = Object.keys(THEMES).join(', ');
|
|
104
|
+
throw new Error(`Unknown theme name "${name}". Valid themes: ${validNames}`);
|
|
105
|
+
}
|
|
106
|
+
const palette = { ...ZSH_NAMED_COLORS };
|
|
107
|
+
for (const [slot, value] of Object.entries(spec.palette ?? {})) {
|
|
108
|
+
if (!ZSH_COLOR_NAMES.includes(slot)) {
|
|
109
|
+
throw new Error(`Unknown palette color "${slot}" in theme "${name}". Valid palette colors: ${ZSH_COLOR_NAMES.join(', ')}.`);
|
|
110
|
+
}
|
|
111
|
+
if (typeof value !== 'string' || !HEX_COLOR.test(value)) {
|
|
112
|
+
throw new Error(`Palette overrides must be "#rrggbb" hex; theme "${name}" has "${slot}": "${String(value)}".`);
|
|
113
|
+
}
|
|
114
|
+
palette[slot] = value.toLowerCase();
|
|
115
|
+
}
|
|
116
|
+
const merged = { ...BASE_THEME_SPEC.roles, ...spec.roles, ...overrides };
|
|
117
|
+
const resolved = {};
|
|
118
|
+
for (const role of THEME_ROLES)
|
|
119
|
+
resolved[role] = resolveColorSpec(String(merged[role] ?? ''), palette);
|
|
120
|
+
return resolved;
|
|
121
|
+
}
|
|
122
|
+
/** The active theme instance; swap with `setActiveTheme` before rendering (and on future `/theme` switches). */
|
|
123
|
+
export let theme = resolveTheme();
|
|
124
|
+
export function setActiveTheme(next) {
|
|
125
|
+
theme = next;
|
|
126
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HazeThemeSpec } from '../theme.js';
|
|
2
|
+
/** Every built-in theme, keyed by its settings name. Key order drives the `/themes` picker listing. */
|
|
3
|
+
export declare const THEMES: Record<string, HazeThemeSpec>;
|
|
4
|
+
/** The base theme other themes inherit omitted roles from (also the default). */
|
|
5
|
+
export declare const BASE_THEME_SPEC: HazeThemeSpec;
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every built-in theme, keyed by its settings name, in one registry — the
|
|
3
|
+
* single place a theme is declared (see AGENTS.md in this folder for how to
|
|
4
|
+
* add/convert themes). Mirrors how oh-my-zsh discovers `themes/<name>.zsh-theme`
|
|
5
|
+
* by `ZSH_THEME=<name>`; `tests/ui/theme.test.ts` enforces the expected names.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* haze's own brand palette and the default theme: the purple-fog look that
|
|
9
|
+
* shipped as haze 1.0's hard-coded colors. Selected when `theme` is unset in
|
|
10
|
+
* settings, and the fallback base for roles another theme omits.
|
|
11
|
+
*/
|
|
12
|
+
const purple = {
|
|
13
|
+
roles: {
|
|
14
|
+
// Terminal background: the docs site's darkest haze tone (--terminal-quote),
|
|
15
|
+
// one step under surfaceBg so the user-message block stays visible on it.
|
|
16
|
+
background: '#171127',
|
|
17
|
+
accent: '#a78bfa',
|
|
18
|
+
accentDim: '#6d28d9',
|
|
19
|
+
border: '#6d28d9',
|
|
20
|
+
info: '#60a5fa',
|
|
21
|
+
muted: '#9ca3af',
|
|
22
|
+
foreground: '#f0eef6',
|
|
23
|
+
command: '#ffb86c',
|
|
24
|
+
success: '#39ff14',
|
|
25
|
+
successBg: '#14331f',
|
|
26
|
+
danger: '#fb7185',
|
|
27
|
+
dangerBg: '#3a1720',
|
|
28
|
+
warning: '#fbbf24',
|
|
29
|
+
surfaceBg: '#1f1633',
|
|
30
|
+
codeBg: '#202124',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/** Light-terminal variant of the haze `purple` palette: every fg/bg pair re-tuned together. */
|
|
34
|
+
const light = {
|
|
35
|
+
roles: {
|
|
36
|
+
// Pure white terminal background; layered surfaces stay slightly off-white.
|
|
37
|
+
background: '#ffffff',
|
|
38
|
+
accent: '#a78bfa',
|
|
39
|
+
accentDim: '#c4b5fd',
|
|
40
|
+
border: '#6b7280',
|
|
41
|
+
info: '#3b82f6',
|
|
42
|
+
muted: '#6b7280',
|
|
43
|
+
foreground: '#1e293b',
|
|
44
|
+
command: '#f59e0b',
|
|
45
|
+
success: '#10b981',
|
|
46
|
+
successBg: '#f0fdf4',
|
|
47
|
+
danger: '#ef4444',
|
|
48
|
+
dangerBg: '#fef2f2',
|
|
49
|
+
warning: '#f59e0b',
|
|
50
|
+
surfaceBg: '#f8fafc',
|
|
51
|
+
codeBg: '#f1f5f9',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Port of robbyrussell.zsh-theme (the oh-my-zsh default):
|
|
56
|
+
* $fg_bold[green]➜ → accent 'green' $fg[cyan]%c → command 'cyan'
|
|
57
|
+
* $fg_bold[blue]git:→ info 'blue' $fg[red]branch → danger 'red'
|
|
58
|
+
* $fg[yellow]✗ → warning 'yellow'
|
|
59
|
+
*/
|
|
60
|
+
const robbyrussell = {
|
|
61
|
+
roles: {
|
|
62
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
63
|
+
background: '#121212',
|
|
64
|
+
accent: 'green',
|
|
65
|
+
accentDim: 'green',
|
|
66
|
+
border: 'black',
|
|
67
|
+
info: 'blue',
|
|
68
|
+
muted: '245',
|
|
69
|
+
foreground: 'default',
|
|
70
|
+
command: 'cyan',
|
|
71
|
+
success: 'green',
|
|
72
|
+
successBg: '22',
|
|
73
|
+
danger: 'red',
|
|
74
|
+
dangerBg: '52',
|
|
75
|
+
warning: 'yellow',
|
|
76
|
+
surfaceBg: '234',
|
|
77
|
+
codeBg: '234',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Port of af-magic.zsh-theme, which uses xterm-256 slots — kept numeric so
|
|
82
|
+
* the port stays a transliteration of ${FG[105]}», ${FG[032]}%~, ${FG[075]}(,
|
|
83
|
+
* ${FG[078]}branch, ${FG[214]}*, ${FG[237]}dashes, $fg[red]%? ↵.
|
|
84
|
+
*/
|
|
85
|
+
const afMagic = {
|
|
86
|
+
roles: {
|
|
87
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
88
|
+
background: '#121212',
|
|
89
|
+
accent: '105',
|
|
90
|
+
accentDim: '61',
|
|
91
|
+
border: '237',
|
|
92
|
+
info: '75',
|
|
93
|
+
muted: '237',
|
|
94
|
+
foreground: '251',
|
|
95
|
+
command: '32',
|
|
96
|
+
success: '78',
|
|
97
|
+
successBg: '22',
|
|
98
|
+
danger: 'red',
|
|
99
|
+
dangerBg: '52',
|
|
100
|
+
warning: '214',
|
|
101
|
+
surfaceBg: '234',
|
|
102
|
+
codeBg: '234',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Port of agnoster.zsh-theme (Powerline segments): AGNOSTER_GIT_CLEAN_BG=green,
|
|
107
|
+
* AGNOSTER_DIR_BG=blue, AGNOSTER_GIT_DIRTY_BG=yellow, AGNOSTER_STATUS_RETVAL_FG=red,
|
|
108
|
+
* AGNOSTER_STATUS_JOB_FG=cyan. The theme's README recommends Solarized, so the
|
|
109
|
+
* port pins a Solarized-dark palette instead of the default Tango approximation.
|
|
110
|
+
* haze has no background segments, so the segment colors become the foreground
|
|
111
|
+
* identity.
|
|
112
|
+
*/
|
|
113
|
+
const agnoster = {
|
|
114
|
+
palette: {
|
|
115
|
+
black: '#073642',
|
|
116
|
+
red: '#dc322f',
|
|
117
|
+
green: '#859900',
|
|
118
|
+
yellow: '#b58900',
|
|
119
|
+
blue: '#268bd2',
|
|
120
|
+
magenta: '#d33682',
|
|
121
|
+
cyan: '#2aa198',
|
|
122
|
+
white: '#93a1a1',
|
|
123
|
+
default: '#eee8d5',
|
|
124
|
+
},
|
|
125
|
+
roles: {
|
|
126
|
+
// The theme's README recommends Solarized Dark, so the canvas is base03 and
|
|
127
|
+
// the surfaces move to base02 to stay inside that palette.
|
|
128
|
+
background: '#002b36',
|
|
129
|
+
accent: 'green',
|
|
130
|
+
accentDim: '236',
|
|
131
|
+
border: '236',
|
|
132
|
+
info: 'cyan',
|
|
133
|
+
muted: '245',
|
|
134
|
+
foreground: 'default',
|
|
135
|
+
command: 'blue',
|
|
136
|
+
success: 'green',
|
|
137
|
+
successBg: '22',
|
|
138
|
+
danger: 'red',
|
|
139
|
+
dangerBg: '52',
|
|
140
|
+
warning: 'yellow',
|
|
141
|
+
surfaceBg: '#073642', // base02
|
|
142
|
+
codeBg: '#073642', // base02
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Port of bira.zsh-theme (the ╭─/╰─ two-line prompt):
|
|
147
|
+
* $fg[green]%n@%m (user, non-root) → accent 'green'
|
|
148
|
+
* %B$fg[blue]%~ (cwd, bold) → command 'blue'
|
|
149
|
+
* $fg[yellow]‹branch› → info 'yellow'
|
|
150
|
+
* $fg[red]● (dirty), %? ↵ → danger 'red'
|
|
151
|
+
* $fg[green]‹venv› → success 'green'
|
|
152
|
+
*/
|
|
153
|
+
const bira = {
|
|
154
|
+
roles: {
|
|
155
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
156
|
+
background: '#121212',
|
|
157
|
+
accent: 'green',
|
|
158
|
+
accentDim: 'green',
|
|
159
|
+
border: '236',
|
|
160
|
+
info: 'yellow',
|
|
161
|
+
muted: '245',
|
|
162
|
+
foreground: 'default',
|
|
163
|
+
command: 'blue',
|
|
164
|
+
success: 'green',
|
|
165
|
+
successBg: '22',
|
|
166
|
+
danger: 'red',
|
|
167
|
+
dangerBg: '52',
|
|
168
|
+
warning: 'yellow',
|
|
169
|
+
surfaceBg: '234',
|
|
170
|
+
codeBg: '234',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Port of bureau.zsh-theme [±master ▾●]:
|
|
175
|
+
* $fg_bold[green]± ✓ $ (prompt) → accent 'green'
|
|
176
|
+
* $fg_bold[white]%n %~ (user/path) → command 'white' (cwd), foreground
|
|
177
|
+
* $fg[cyan]▴ (ahead) → info 'cyan'
|
|
178
|
+
* $fg_bold[yellow]● (unstaged) → warning 'yellow'
|
|
179
|
+
* $fg_bold[red]● (untracked) → danger 'red'
|
|
180
|
+
*/
|
|
181
|
+
const bureau = {
|
|
182
|
+
roles: {
|
|
183
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
184
|
+
background: '#121212',
|
|
185
|
+
accent: 'green',
|
|
186
|
+
accentDim: '236',
|
|
187
|
+
border: '236',
|
|
188
|
+
info: 'cyan',
|
|
189
|
+
muted: '245',
|
|
190
|
+
foreground: 'default',
|
|
191
|
+
command: 'white',
|
|
192
|
+
success: 'green',
|
|
193
|
+
successBg: '22',
|
|
194
|
+
danger: 'red',
|
|
195
|
+
dangerBg: '52',
|
|
196
|
+
warning: 'yellow',
|
|
197
|
+
surfaceBg: '234',
|
|
198
|
+
codeBg: '235',
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Port of clean.zsh-theme:
|
|
203
|
+
* $fg_bold[white]%n (user) → accent 'white'
|
|
204
|
+
* $fg_bold[blue]%c/ (cwd) → command 'blue'
|
|
205
|
+
* $fg_bold[blue]( git branch → info 'blue', branch $fg[yellow] → warning
|
|
206
|
+
* $fg_bold[red]✗ (dirty) → danger 'red'
|
|
207
|
+
*/
|
|
208
|
+
const clean = {
|
|
209
|
+
roles: {
|
|
210
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
211
|
+
background: '#121212',
|
|
212
|
+
accent: 'white',
|
|
213
|
+
accentDim: '236',
|
|
214
|
+
border: '236',
|
|
215
|
+
info: 'blue',
|
|
216
|
+
muted: '245',
|
|
217
|
+
foreground: 'default',
|
|
218
|
+
command: 'blue',
|
|
219
|
+
success: 'green',
|
|
220
|
+
successBg: '22',
|
|
221
|
+
danger: 'red',
|
|
222
|
+
dangerBg: '52',
|
|
223
|
+
warning: 'yellow',
|
|
224
|
+
surfaceBg: '234',
|
|
225
|
+
codeBg: '234',
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Port of cloud.zsh-theme: $fg_bold[cyan]☁, $fg[green]%c,
|
|
230
|
+
* $fg[green][$fg[cyan]branch, $fg[yellow]⚡ dirty.
|
|
231
|
+
*/
|
|
232
|
+
const cloud = {
|
|
233
|
+
roles: {
|
|
234
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
235
|
+
background: '#121212',
|
|
236
|
+
accent: 'cyan',
|
|
237
|
+
accentDim: '236',
|
|
238
|
+
border: '236',
|
|
239
|
+
info: 'blue',
|
|
240
|
+
muted: '245',
|
|
241
|
+
foreground: 'default',
|
|
242
|
+
command: 'green',
|
|
243
|
+
success: 'green',
|
|
244
|
+
successBg: '22',
|
|
245
|
+
danger: 'red',
|
|
246
|
+
dangerBg: '52',
|
|
247
|
+
warning: 'yellow',
|
|
248
|
+
surfaceBg: '234',
|
|
249
|
+
codeBg: '234',
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Port of dst.zsh-theme:
|
|
254
|
+
* $fg[magenta]%n (user) → accent 'magenta'
|
|
255
|
+
* $fg[yellow]%m (host) → warning 'yellow'
|
|
256
|
+
* $fg_bold[blue]%~ (cwd) → command 'blue'
|
|
257
|
+
* $fg[green]branch prefix → info 'green' $fg[red]! (dirty) → danger 'red'
|
|
258
|
+
* $fg[green][%*] (clock) → success 'green'
|
|
259
|
+
*/
|
|
260
|
+
const dst = {
|
|
261
|
+
roles: {
|
|
262
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
263
|
+
background: '#121212',
|
|
264
|
+
accent: 'magenta',
|
|
265
|
+
accentDim: 'magenta',
|
|
266
|
+
border: '236',
|
|
267
|
+
info: 'green',
|
|
268
|
+
muted: '245',
|
|
269
|
+
foreground: 'default',
|
|
270
|
+
command: 'blue',
|
|
271
|
+
success: 'green',
|
|
272
|
+
successBg: '22',
|
|
273
|
+
danger: 'red',
|
|
274
|
+
dangerBg: '52',
|
|
275
|
+
warning: 'yellow',
|
|
276
|
+
surfaceBg: '234',
|
|
277
|
+
codeBg: '234',
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Port of fishy.zsh-theme: $fg[green]%n and cwd (user_color='green'),
|
|
282
|
+
* $fg_bold[red] exit status, and its git-status markers (+ green, ! blue,
|
|
283
|
+
* - red, > magenta, # yellow, ? cyan).
|
|
284
|
+
*/
|
|
285
|
+
const fishy = {
|
|
286
|
+
roles: {
|
|
287
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
288
|
+
background: '#121212',
|
|
289
|
+
accent: 'green',
|
|
290
|
+
accentDim: 'green',
|
|
291
|
+
border: '236',
|
|
292
|
+
info: 'cyan',
|
|
293
|
+
muted: '245',
|
|
294
|
+
foreground: 'default',
|
|
295
|
+
command: 'green',
|
|
296
|
+
success: 'green',
|
|
297
|
+
successBg: '22',
|
|
298
|
+
danger: 'red',
|
|
299
|
+
dangerBg: '52',
|
|
300
|
+
warning: 'yellow',
|
|
301
|
+
surfaceBg: '234',
|
|
302
|
+
codeBg: '235',
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Port of steeef.zsh-theme (Steve Losh's Prose style), using its 256-color
|
|
307
|
+
* branch — kept numeric so the port stays a transliteration:
|
|
308
|
+
* %F{135}%n (user, purple) → accent '135'
|
|
309
|
+
* %F{166}%m (host, orange), unstaged ● → warning '166'
|
|
310
|
+
* %F{118}%~ (cwd, limegreen) → command/success '118'
|
|
311
|
+
* %F{81}branch (turquoise) → info '81'
|
|
312
|
+
* %F{161}● (untracked, hotpink) → danger '161'
|
|
313
|
+
*/
|
|
314
|
+
const steeef = {
|
|
315
|
+
roles: {
|
|
316
|
+
// Classic dark-terminal canvas, one step under the xterm-256 234 surfaces.
|
|
317
|
+
background: '#121212',
|
|
318
|
+
accent: '135',
|
|
319
|
+
accentDim: '61',
|
|
320
|
+
border: '236',
|
|
321
|
+
info: '81',
|
|
322
|
+
muted: '245',
|
|
323
|
+
foreground: 'default',
|
|
324
|
+
command: '118',
|
|
325
|
+
success: '118',
|
|
326
|
+
successBg: '22',
|
|
327
|
+
danger: '161',
|
|
328
|
+
dangerBg: '52',
|
|
329
|
+
warning: '166',
|
|
330
|
+
surfaceBg: '234',
|
|
331
|
+
codeBg: '235',
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Port of Solarized Dark (Ethan Schoonover, ethanschoonover.com/solarized).
|
|
336
|
+
* Solarized is a terminal *palette*, not a prompt theme, so the port pins the
|
|
337
|
+
* canonical 16-color mapping as `palette` and writes roles as zsh names.
|
|
338
|
+
*
|
|
339
|
+
* Base tones (dark mode): bg base03, emphasis bg base02, body base0,
|
|
340
|
+
* comments base01. Accent colors are identical in both modes by design —
|
|
341
|
+
* each Solarized accent maps to exactly one haze role:
|
|
342
|
+
* blue #268bd2 → accent violet #6c71c4 → accentDim yellow #b58900 → command
|
|
343
|
+
* cyan #2aa198 → info green #859900 → success orange #cb4b16 → warning
|
|
344
|
+
* red #dc322f → danger
|
|
345
|
+
* All backgrounds use base02 ("bg highlight"), Solarized's own surface tone
|
|
346
|
+
* for selection/diff regions: the accent foreground carries the meaning.
|
|
347
|
+
*/
|
|
348
|
+
const solarizedDark = {
|
|
349
|
+
palette: {
|
|
350
|
+
black: '#002b36', // base03 (ANSI slot 0)
|
|
351
|
+
red: '#dc322f',
|
|
352
|
+
green: '#859900',
|
|
353
|
+
yellow: '#b58900',
|
|
354
|
+
blue: '#268bd2',
|
|
355
|
+
magenta: '#d33682',
|
|
356
|
+
cyan: '#2aa198',
|
|
357
|
+
white: '#eee8d5', // base2 (ANSI slot 7)
|
|
358
|
+
default: '#839496', // base0 — dark-mode body text
|
|
359
|
+
},
|
|
360
|
+
roles: {
|
|
361
|
+
background: '#002b36', // base03 — the dark-mode canvas
|
|
362
|
+
accent: 'blue',
|
|
363
|
+
accentDim: '#6c71c4', // violet
|
|
364
|
+
border: '#586e75', // base01 — chrome structure
|
|
365
|
+
info: 'cyan',
|
|
366
|
+
muted: '#586e75', // base01 — dark-mode comments
|
|
367
|
+
foreground: 'default',
|
|
368
|
+
command: 'yellow',
|
|
369
|
+
success: 'green',
|
|
370
|
+
successBg: '#073642', // base02
|
|
371
|
+
danger: 'red',
|
|
372
|
+
dangerBg: '#073642', // base02
|
|
373
|
+
warning: '#cb4b16', // orange
|
|
374
|
+
surfaceBg: '#073642', // base02
|
|
375
|
+
codeBg: '#073642', // base02
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Port of Solarized Light (Ethan Schoonover, ethanschoonover.com/solarized).
|
|
380
|
+
* Same accent palette as `solarized-dark` — Solarized's two modes swap only
|
|
381
|
+
* the base tones, never the accent colors:
|
|
382
|
+
* dark: bg base03, surfaces base02, body base0, comments base01
|
|
383
|
+
* light: bg base3, surfaces base2, body base00, comments base1
|
|
384
|
+
* Role → accent mapping is identical to solarized-dark (see its comment);
|
|
385
|
+
* orange/red gain contrast on light while yellow softens, exactly as in the
|
|
386
|
+
* source palette.
|
|
387
|
+
*/
|
|
388
|
+
const solarizedLight = {
|
|
389
|
+
palette: {
|
|
390
|
+
black: '#002b36', // base03 (ANSI slot 0)
|
|
391
|
+
red: '#dc322f',
|
|
392
|
+
green: '#859900',
|
|
393
|
+
yellow: '#b58900',
|
|
394
|
+
blue: '#268bd2',
|
|
395
|
+
magenta: '#d33682',
|
|
396
|
+
cyan: '#2aa198',
|
|
397
|
+
white: '#eee8d5', // base2 (ANSI slot 7)
|
|
398
|
+
default: '#657b83', // base00 — light-mode body text
|
|
399
|
+
},
|
|
400
|
+
roles: {
|
|
401
|
+
background: '#fdf6e3', // base3 — the light-mode canvas (full Solarized Light)
|
|
402
|
+
accent: 'blue',
|
|
403
|
+
accentDim: '#6c71c4', // violet
|
|
404
|
+
border: '#93a1a1', // base1 — chrome structure on light
|
|
405
|
+
info: 'cyan',
|
|
406
|
+
muted: '#93a1a1', // base1 — light-mode comments
|
|
407
|
+
foreground: 'default',
|
|
408
|
+
command: 'yellow',
|
|
409
|
+
success: 'green',
|
|
410
|
+
successBg: '#eee8d5', // base2
|
|
411
|
+
danger: 'red',
|
|
412
|
+
dangerBg: '#eee8d5', // base2
|
|
413
|
+
warning: '#cb4b16', // orange
|
|
414
|
+
surfaceBg: '#eee8d5', // base2
|
|
415
|
+
codeBg: '#eee8d5', // base2
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
/** Every built-in theme, keyed by its settings name. Key order drives the `/themes` picker listing. */
|
|
419
|
+
export const THEMES = {
|
|
420
|
+
purple,
|
|
421
|
+
light,
|
|
422
|
+
'af-magic': afMagic,
|
|
423
|
+
agnoster,
|
|
424
|
+
bira,
|
|
425
|
+
bureau,
|
|
426
|
+
clean,
|
|
427
|
+
cloud,
|
|
428
|
+
dst,
|
|
429
|
+
fishy,
|
|
430
|
+
robbyrussell,
|
|
431
|
+
'solarized-dark': solarizedDark,
|
|
432
|
+
'solarized-light': solarizedLight,
|
|
433
|
+
steeef,
|
|
434
|
+
};
|
|
435
|
+
/** The base theme other themes inherit omitted roles from (also the default). */
|
|
436
|
+
export const BASE_THEME_SPEC = purple;
|
package/dist/utils/format.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
/** Human-readable byte sizes for display text (CLI rows, session placeholders). */
|
|
2
2
|
export declare function formatBytes(bytes: number): string;
|
|
3
|
+
/** Compact token counts for status rows: 999, 1.5k, 13k, 1.5m. */
|
|
4
|
+
export declare function formatTokenCount(tokens: number): string;
|
|
5
|
+
/** Milliseconds as fractional seconds, e.g. "1.2s". */
|
|
6
|
+
export declare function formatSeconds(milliseconds: number): string;
|
|
7
|
+
/** Minutes for timeout/deadline copy, e.g. "5 minutes". */
|
|
8
|
+
export declare function formatIdleMinutes(milliseconds: number): string;
|
|
9
|
+
/** Elapsed time with fractional seconds: "1.5s", "2m 03.4s", "1h 02m 03.4s". */
|
|
10
|
+
export declare function formatElapsedTime(milliseconds: number): string;
|
|
11
|
+
/** Elapsed time in whole seconds: "1s", "2m 03s", "1h 02m 03s". */
|
|
12
|
+
export declare function formatElapsedTimeWhole(milliseconds: number): string;
|
package/dist/utils/format.js
CHANGED
|
@@ -6,3 +6,48 @@ export function formatBytes(bytes) {
|
|
|
6
6
|
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
7
7
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
8
8
|
}
|
|
9
|
+
/** Compact token counts for status rows: 999, 1.5k, 13k, 1.5m. */
|
|
10
|
+
export function formatTokenCount(tokens) {
|
|
11
|
+
if (tokens >= 1_000_000)
|
|
12
|
+
return `${(tokens / 1_000_000).toFixed(tokens >= 10_000_000 ? 0 : 1).replace(/\.0$/, '')}m`;
|
|
13
|
+
if (tokens >= 1_000)
|
|
14
|
+
return `${(tokens / 1_000).toFixed(tokens >= 10_000 ? 0 : 1).replace(/\.0$/, '')}k`;
|
|
15
|
+
return String(tokens);
|
|
16
|
+
}
|
|
17
|
+
/** Milliseconds as fractional seconds, e.g. "1.2s". */
|
|
18
|
+
export function formatSeconds(milliseconds) {
|
|
19
|
+
return `${(milliseconds / 1000).toFixed(1)}s`;
|
|
20
|
+
}
|
|
21
|
+
/** Minutes for timeout/deadline copy, e.g. "5 minutes". */
|
|
22
|
+
export function formatIdleMinutes(milliseconds) {
|
|
23
|
+
const minutes = Math.round(milliseconds / 60_000);
|
|
24
|
+
return `${minutes} minute${minutes === 1 ? '' : 's'}`;
|
|
25
|
+
}
|
|
26
|
+
/** Elapsed time with fractional seconds: "1.5s", "2m 03.4s", "1h 02m 03.4s". */
|
|
27
|
+
export function formatElapsedTime(milliseconds) {
|
|
28
|
+
const totalSeconds = Math.max(0, milliseconds / 1000);
|
|
29
|
+
const wholeSeconds = Math.floor(totalSeconds);
|
|
30
|
+
const seconds = totalSeconds - Math.floor(wholeSeconds / 60) * 60;
|
|
31
|
+
const totalMinutes = Math.floor(wholeSeconds / 60);
|
|
32
|
+
const minutes = totalMinutes % 60;
|
|
33
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
34
|
+
const secondsLabel = `${seconds.toFixed(1)}s`;
|
|
35
|
+
if (hours > 0)
|
|
36
|
+
return `${hours}h ${minutes}m ${secondsLabel}`;
|
|
37
|
+
if (minutes > 0)
|
|
38
|
+
return `${minutes}m ${secondsLabel}`;
|
|
39
|
+
return secondsLabel;
|
|
40
|
+
}
|
|
41
|
+
/** Elapsed time in whole seconds: "1s", "2m 03s", "1h 02m 03s". */
|
|
42
|
+
export function formatElapsedTimeWhole(milliseconds) {
|
|
43
|
+
const totalSeconds = Math.max(0, Math.floor(milliseconds / 1000));
|
|
44
|
+
const seconds = totalSeconds % 60;
|
|
45
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
46
|
+
const minutes = totalMinutes % 60;
|
|
47
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
48
|
+
if (hours > 0)
|
|
49
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
50
|
+
if (minutes > 0)
|
|
51
|
+
return `${minutes}m ${seconds}s`;
|
|
52
|
+
return `${seconds}s`;
|
|
53
|
+
}
|