@denizokcu/haze 1.1.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/README.md +9 -5
  3. package/dist/buildInfo.json +3 -3
  4. package/dist/cli/chat/busyIndicator.d.ts +11 -0
  5. package/dist/cli/chat/busyIndicator.js +34 -0
  6. package/dist/cli/chat/chatMetrics.d.ts +0 -1
  7. package/dist/cli/chat/chatMetrics.js +1 -7
  8. package/dist/cli/chat/followUpQueue.d.ts +11 -0
  9. package/dist/cli/chat/followUpQueue.js +38 -0
  10. package/dist/cli/chat/messages.d.ts +0 -22
  11. package/dist/cli/chat/messages.js +40 -85
  12. package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
  13. package/dist/cli/chat/sessionLifecycle.js +6 -1
  14. package/dist/cli/chat/sessionRecorder.d.ts +2 -0
  15. package/dist/cli/chat/sessionRecorder.js +6 -0
  16. package/dist/cli/chat/startupSequence.d.ts +29 -0
  17. package/dist/cli/chat/startupSequence.js +59 -0
  18. package/dist/cli/chat/transcriptPartition.d.ts +23 -0
  19. package/dist/cli/chat/transcriptPartition.js +78 -0
  20. package/dist/cli/chat/wizard/fieldTransitions.d.ts +38 -0
  21. package/dist/cli/chat/wizard/fieldTransitions.js +43 -0
  22. package/dist/cli/chat/wizard/lspHandlers.d.ts +4 -0
  23. package/dist/cli/chat/wizard/lspHandlers.js +85 -0
  24. package/dist/cli/chat/wizard/mcpHandlers.d.ts +8 -0
  25. package/dist/cli/chat/wizard/mcpHandlers.js +82 -0
  26. package/dist/cli/chat/wizard/providerHandlers.d.ts +12 -0
  27. package/dist/cli/chat/wizard/providerHandlers.js +420 -0
  28. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +4 -0
  29. package/dist/cli/chat/wizard/sessionThemeHandlers.js +48 -0
  30. package/dist/cli/chat/wizard/skillsHandlers.d.ts +4 -0
  31. package/dist/cli/chat/wizard/skillsHandlers.js +125 -0
  32. package/dist/cli/chat/wizard/types.d.ts +63 -0
  33. package/dist/cli/chat/wizard/types.js +24 -0
  34. package/dist/cli/chat/wizard/uiState.d.ts +56 -0
  35. package/dist/cli/chat/wizard/uiState.js +15 -0
  36. package/dist/cli/chat/wizardDispatch.d.ts +11 -113
  37. package/dist/cli/chat/wizardDispatch.js +41 -815
  38. package/dist/cli/commands/chat.js +45 -108
  39. package/dist/cli/commands/formatters.d.ts +0 -3
  40. package/dist/cli/commands/formatters.js +0 -29
  41. package/dist/cli/commands/runCommand.d.ts +2 -0
  42. package/dist/cli/commands/runCommand.js +67 -4
  43. package/dist/cli/commands/streaming/assistantSegments.d.ts +19 -0
  44. package/dist/cli/commands/streaming/assistantSegments.js +48 -0
  45. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -2
  46. package/dist/cli/commands/streaming/attemptOutcome.js +17 -7
  47. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +69 -8
  48. package/dist/cli/commands/streaming/goalCheckpoint.js +36 -1
  49. package/dist/cli/commands/streaming/goalSupervisor.d.ts +17 -2
  50. package/dist/cli/commands/streaming/goalSupervisor.js +62 -12
  51. package/dist/cli/commands/streaming/prepareStep.d.ts +35 -0
  52. package/dist/cli/commands/streaming/prepareStep.js +100 -0
  53. package/dist/cli/commands/streaming/recoverySlices.d.ts +15 -0
  54. package/dist/cli/commands/streaming/recoverySlices.js +29 -0
  55. package/dist/cli/commands/streaming/stallRecovery.d.ts +0 -1
  56. package/dist/cli/commands/streaming/stallRecovery.js +0 -4
  57. package/dist/cli/commands/streaming/streamLoop.js +9 -230
  58. package/dist/cli/commands/streaming/toolGroupRenderer.js +2 -1
  59. package/dist/cli/commands/streaming/toolPartHandlers.d.ts +19 -0
  60. package/dist/cli/commands/streaming/toolPartHandlers.js +95 -0
  61. package/dist/cli/commands/streaming.d.ts +4 -1
  62. package/dist/cli/commands/streaming.js +6 -21
  63. package/dist/cli/index.js +3 -1
  64. package/dist/config/providerPresets.d.ts +7 -0
  65. package/dist/config/providerPresets.js +195 -391
  66. package/dist/core/agent/completionController.d.ts +14 -7
  67. package/dist/core/agent/completionController.js +12 -6
  68. package/dist/core/agent/events.d.ts +12 -0
  69. package/dist/core/agent/goalPolicy.d.ts +4 -3
  70. package/dist/core/agent/goalPolicy.js +9 -4
  71. package/dist/core/agent/workState.d.ts +25 -15
  72. package/dist/core/agent/workState.js +71 -43
  73. package/dist/core/session/sessionSlimming.js +8 -0
  74. package/dist/core/session/sessionStore.d.ts +61 -1
  75. package/dist/core/session/sessionStore.js +115 -6
  76. package/dist/llm/hazeTools.d.ts +64 -208
  77. package/dist/llm/tools/taskTool.d.ts +64 -208
  78. package/dist/llm/tools/taskTool.js +22 -10
  79. package/dist/ui/components/TextInput.js +6 -67
  80. package/dist/ui/components/useInputSuggestions.d.ts +27 -0
  81. package/dist/ui/components/useInputSuggestions.js +98 -0
  82. package/dist/ui/theme.d.ts +8 -8
  83. package/dist/ui/theme.js +11 -12
  84. package/dist/ui/themes/registry.d.ts +5 -0
  85. package/dist/ui/themes/registry.js +436 -0
  86. package/dist/utils/format.d.ts +10 -0
  87. package/dist/utils/format.js +45 -0
  88. package/package.json +1 -1
  89. package/dist/ui/themes/af-magic.d.ts +0 -7
  90. package/dist/ui/themes/af-magic.js +0 -25
  91. package/dist/ui/themes/agnoster.d.ts +0 -10
  92. package/dist/ui/themes/agnoster.js +0 -40
  93. package/dist/ui/themes/bira.d.ts +0 -10
  94. package/dist/ui/themes/bira.js +0 -28
  95. package/dist/ui/themes/bureau.d.ts +0 -10
  96. package/dist/ui/themes/bureau.js +0 -28
  97. package/dist/ui/themes/clean.d.ts +0 -9
  98. package/dist/ui/themes/clean.js +0 -27
  99. package/dist/ui/themes/cloud.d.ts +0 -6
  100. package/dist/ui/themes/cloud.js +0 -24
  101. package/dist/ui/themes/dst.d.ts +0 -10
  102. package/dist/ui/themes/dst.js +0 -28
  103. package/dist/ui/themes/fishy.d.ts +0 -7
  104. package/dist/ui/themes/fishy.js +0 -25
  105. package/dist/ui/themes/index.d.ts +0 -8
  106. package/dist/ui/themes/index.js +0 -36
  107. package/dist/ui/themes/light.d.ts +0 -3
  108. package/dist/ui/themes/light.js +0 -21
  109. package/dist/ui/themes/purple.d.ts +0 -7
  110. package/dist/ui/themes/purple.js +0 -26
  111. package/dist/ui/themes/robbyrussell.d.ts +0 -8
  112. package/dist/ui/themes/robbyrussell.js +0 -26
  113. package/dist/ui/themes/solarized-dark.d.ts +0 -16
  114. package/dist/ui/themes/solarized-dark.js +0 -44
  115. package/dist/ui/themes/solarized-light.d.ts +0 -12
  116. package/dist/ui/themes/solarized-light.js +0 -40
  117. package/dist/ui/themes/steeef.d.ts +0 -11
  118. package/dist/ui/themes/steeef.js +0 -29
@@ -0,0 +1,98 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { detectMentionAtCursor } from '../../cli/chat/fileMentionSuggestions.js';
3
+ /**
4
+ * The suggestion engine behind TextInput, extracted as a standalone hook:
5
+ * two composable layers — slash-command filtering (sync, prefix/substring
6
+ * match over the caller's suggestion list) and `@token` mention completion
7
+ * (async fetch with cancellation so fast typing never races stale results) —
8
+ * plus the shared selection state the keyboard handler moves through.
9
+ */
10
+ export function useInputSuggestions({ value, cursor, suggestions, suggestionMode, mask, getMentionSuggestions }) {
11
+ const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(0);
12
+ const [mentionContext, setMentionContext] = useState();
13
+ const [mentionSuggestions, setMentionSuggestions] = useState([]);
14
+ const [mentionSelectedIndex, setMentionSelectedIndex] = useState(0);
15
+ const suggestionQuery = !mask && (suggestionMode === 'always' || value.startsWith('/'))
16
+ ? (suggestionMode === 'always' ? value : value.slice(1)).toLowerCase()
17
+ : undefined;
18
+ const filteredSuggestions = suggestionQuery == null ? [] : suggestions
19
+ .filter(suggestion => {
20
+ const suggestionValue = suggestionMode === 'always' ? suggestion.value : suggestion.value.slice(1);
21
+ return suggestionValue.toLowerCase().includes(suggestionQuery) || suggestion.description?.toLowerCase().includes(suggestionQuery);
22
+ })
23
+ .slice(0, 20);
24
+ // `@token` mention detection — only in chat mode (slash) so wizard pickers
25
+ // never grab `@`-prefixed tokens. Detection is sync; suggestion fetch is
26
+ // async with cancellation so fast typing does not race stale results.
27
+ const detectedMention = !mask && suggestionMode === 'slash' && !value.startsWith('/') && getMentionSuggestions
28
+ ? detectMentionAtCursor(value, cursor)
29
+ : undefined;
30
+ useEffect(() => {
31
+ setMentionContext(detectedMention);
32
+ }, [detectedMention?.token, detectedMention?.start, detectedMention?.end]);
33
+ useEffect(() => {
34
+ if (!mentionContext || !getMentionSuggestions) {
35
+ if (mentionSuggestions.length > 0)
36
+ setMentionSuggestions([]);
37
+ return;
38
+ }
39
+ let cancelled = false;
40
+ Promise.resolve(getMentionSuggestions(mentionContext.token))
41
+ .then(results => { if (!cancelled) {
42
+ setMentionSuggestions(results);
43
+ setMentionSelectedIndex(0);
44
+ } })
45
+ .catch(() => { if (!cancelled)
46
+ setMentionSuggestions([]); });
47
+ return () => { cancelled = true; };
48
+ }, [mentionContext?.token, mentionContext?.start, mentionContext?.end]);
49
+ const inMentionMode = !!detectedMention;
50
+ const mentionList = inMentionMode ? mentionSuggestions : [];
51
+ const activeMentionIndex = Math.min(mentionSelectedIndex, Math.max(0, mentionList.length - 1));
52
+ const activeSuggestionIndex = Math.min(selectedSuggestionIndex, Math.max(0, filteredSuggestions.length - 1));
53
+ const activeSuggestion = inMentionMode ? mentionList[activeMentionIndex] : filteredSuggestions[activeSuggestionIndex];
54
+ /** Reset both selection layers (called whenever the input value is replaced). */
55
+ function resetSelection() {
56
+ setSelectedSuggestionIndex(0);
57
+ setMentionSelectedIndex(0);
58
+ }
59
+ /**
60
+ * Move the active selection for vertical arrows. Returns true when a
61
+ * suggestion layer consumed the key (mention mode always consumes; the
62
+ * slash list consumes while another entry remains in that direction),
63
+ * false when the caller should fall through to cursor/history handling.
64
+ */
65
+ function moveSelection(direction) {
66
+ if (inMentionMode) {
67
+ if (mentionList.length > 0) {
68
+ if (direction < 0)
69
+ setMentionSelectedIndex(current => Math.max(0, current - 1));
70
+ else
71
+ setMentionSelectedIndex(current => Math.min(mentionList.length - 1, current + 1));
72
+ }
73
+ return true;
74
+ }
75
+ if (filteredSuggestions.length > 0) {
76
+ if (direction < 0 && activeSuggestionIndex > 0) {
77
+ setSelectedSuggestionIndex(current => Math.max(0, current - 1));
78
+ return true;
79
+ }
80
+ if (direction > 0 && activeSuggestionIndex < filteredSuggestions.length - 1) {
81
+ setSelectedSuggestionIndex(current => Math.min(filteredSuggestions.length - 1, current + 1));
82
+ return true;
83
+ }
84
+ }
85
+ return false;
86
+ }
87
+ return {
88
+ detectedMention,
89
+ inMentionMode,
90
+ filteredSuggestions,
91
+ mentionList,
92
+ activeMentionIndex,
93
+ activeSuggestionIndex,
94
+ activeSuggestion,
95
+ resetSelection,
96
+ moveSelection,
97
+ };
98
+ }
@@ -20,15 +20,15 @@
20
20
  * values are written in the same vocabulary an oh-my-zsh theme uses:
21
21
  * a zsh color name, an xterm-256 index string, or `#rrggbb` hex.
22
22
  *
23
- * The built-in themes live in `src/ui/themes/` (one file per theme, named like
24
- * its oh-my-zsh counterpart) — including ports of famous `.zsh-theme` files
25
- * where `robbyrussell`'s `$fg_bold[green]➜` becomes `accent: 'green'`, its
26
- * `$fg[cyan]%c` becomes `command: 'cyan'`, etc. See `src/ui/themes/AGENTS.md`
27
- * for the full conversion guide and `docs/theming-plan.md` §6–§7 for the
28
- * research and the segment → role translation table.
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
29
  */
30
- import { BUILT_IN_THEME_SPECS } from './themes/index.js';
31
- export { BUILT_IN_THEME_SPECS };
30
+ import { THEMES } from './themes/registry.js';
31
+ export { THEMES as BUILT_IN_THEME_SPECS };
32
32
  /** The theme used when settings name none; also the fallback base for roles another theme omits. */
33
33
  export declare const DEFAULT_THEME_NAME = "purple";
34
34
  /** zsh `colors` associative-array keys — exactly the names `$fg[...]` accepts. */
package/dist/ui/theme.js CHANGED
@@ -20,16 +20,15 @@
20
20
  * values are written in the same vocabulary an oh-my-zsh theme uses:
21
21
  * a zsh color name, an xterm-256 index string, or `#rrggbb` hex.
22
22
  *
23
- * The built-in themes live in `src/ui/themes/` (one file per theme, named like
24
- * its oh-my-zsh counterpart) — including ports of famous `.zsh-theme` files
25
- * where `robbyrussell`'s `$fg_bold[green]➜` becomes `accent: 'green'`, its
26
- * `$fg[cyan]%c` becomes `command: 'cyan'`, etc. See `src/ui/themes/AGENTS.md`
27
- * for the full conversion guide and `docs/theming-plan.md` §6–§7 for the
28
- * research and the segment → role translation table.
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
29
  */
30
- import { BUILT_IN_THEME_SPECS } from './themes/index.js';
31
- import { purple } from './themes/purple.js';
32
- export { BUILT_IN_THEME_SPECS };
30
+ import { BASE_THEME_SPEC, THEMES } from './themes/registry.js';
31
+ export { THEMES as BUILT_IN_THEME_SPECS };
33
32
  /** The theme used when settings name none; also the fallback base for roles another theme omits. */
34
33
  export const DEFAULT_THEME_NAME = 'purple';
35
34
  export const ZSH_COLOR_NAMES = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
@@ -99,9 +98,9 @@ export function resolveColorSpec(spec, palette = ZSH_NAMED_COLORS) {
99
98
  }
100
99
  /** Resolve a built-in theme name (+ optional role overrides) to a complete `HazeTheme`. Throws with valid names for unknown themes. */
101
100
  export function resolveTheme(name, overrides) {
102
- const spec = BUILT_IN_THEME_SPECS[name ?? DEFAULT_THEME_NAME];
101
+ const spec = THEMES[name ?? DEFAULT_THEME_NAME];
103
102
  if (!spec) {
104
- const validNames = Object.keys(BUILT_IN_THEME_SPECS).join(', ');
103
+ const validNames = Object.keys(THEMES).join(', ');
105
104
  throw new Error(`Unknown theme name "${name}". Valid themes: ${validNames}`);
106
105
  }
107
106
  const palette = { ...ZSH_NAMED_COLORS };
@@ -114,7 +113,7 @@ export function resolveTheme(name, overrides) {
114
113
  }
115
114
  palette[slot] = value.toLowerCase();
116
115
  }
117
- const merged = { ...purple.roles, ...spec.roles, ...overrides };
116
+ const merged = { ...BASE_THEME_SPEC.roles, ...spec.roles, ...overrides };
118
117
  const resolved = {};
119
118
  for (const role of THEME_ROLES)
120
119
  resolved[role] = resolveColorSpec(String(merged[role] ?? ''), palette);
@@ -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;
@@ -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;
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A minimal LLM harness for your terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",