@denizokcu/haze 0.8.0 → 0.10.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.
Files changed (182) hide show
  1. package/CHANGELOG.md +67 -17
  2. package/README.md +121 -64
  3. package/dist/cli/chat/chatMetrics.d.ts +17 -1
  4. package/dist/cli/chat/chatMetrics.js +22 -5
  5. package/dist/cli/chat/contextReport.d.ts +11 -0
  6. package/dist/cli/chat/contextReport.js +44 -0
  7. package/dist/cli/chat/fileMentionSuggestions.d.ts +29 -0
  8. package/dist/cli/chat/fileMentionSuggestions.js +91 -0
  9. package/dist/cli/chat/inputSuggestions.d.ts +5 -0
  10. package/dist/cli/chat/inputSuggestions.js +17 -3
  11. package/dist/cli/chat/sessionLifecycle.d.ts +58 -0
  12. package/dist/cli/chat/sessionLifecycle.js +155 -0
  13. package/dist/cli/chat/sessionRecorder.d.ts +3 -0
  14. package/dist/cli/chat/sessionRecorder.js +21 -8
  15. package/dist/cli/chat/startupInfo.d.ts +1 -0
  16. package/dist/cli/chat/startupInfo.js +11 -0
  17. package/dist/cli/chat/tips.d.ts +21 -0
  18. package/dist/cli/chat/tips.js +43 -0
  19. package/dist/cli/chat/wizardDispatch.d.ts +64 -0
  20. package/dist/cli/chat/wizardDispatch.js +645 -0
  21. package/dist/cli/commands/chat.d.ts +1 -0
  22. package/dist/cli/commands/chat.js +246 -779
  23. package/dist/cli/commands/chatModes.d.ts +1 -1
  24. package/dist/cli/commands/chatModes.js +7 -2
  25. package/dist/cli/commands/commandHelp.js +5 -3
  26. package/dist/cli/commands/commands.d.ts +4 -3
  27. package/dist/cli/commands/commands.js +12 -13
  28. package/dist/cli/commands/fleetCommand.d.ts +14 -0
  29. package/dist/cli/commands/fleetCommand.js +46 -0
  30. package/dist/cli/commands/formatters.d.ts +5 -0
  31. package/dist/cli/commands/formatters.js +36 -9
  32. package/dist/cli/commands/logsCommand.js +8 -28
  33. package/dist/cli/commands/mcpWizard.js +24 -2
  34. package/dist/cli/commands/modelCommand.js +1 -1
  35. package/dist/cli/commands/providerWizard.d.ts +1 -0
  36. package/dist/cli/commands/providerWizard.js +31 -5
  37. package/dist/cli/commands/runCommand.d.ts +1 -0
  38. package/dist/cli/commands/runCommand.js +32 -20
  39. package/dist/cli/commands/sessionPicker.d.ts +9 -0
  40. package/dist/cli/commands/sessionPicker.js +29 -0
  41. package/dist/cli/commands/settingsSummary.js +8 -4
  42. package/dist/cli/commands/skillConfirmRemove.js +4 -3
  43. package/dist/cli/commands/skillWizard.d.ts +2 -0
  44. package/dist/cli/commands/skillWizard.js +16 -6
  45. package/dist/cli/commands/streaming/idleTimer.d.ts +26 -0
  46. package/dist/cli/commands/streaming/idleTimer.js +24 -0
  47. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +2 -0
  48. package/dist/cli/commands/streaming/toolGroupRenderer.js +4 -2
  49. package/dist/cli/commands/streaming/turnOutcome.d.ts +10 -0
  50. package/dist/cli/commands/streaming/turnOutcome.js +13 -0
  51. package/dist/cli/commands/streaming/turnRuntime.js +6 -4
  52. package/dist/cli/commands/streaming.d.ts +13 -1
  53. package/dist/cli/commands/streaming.js +104 -44
  54. package/dist/cli/commands/wizardActions.d.ts +6 -0
  55. package/dist/cli/commands/wizardActions.js +6 -0
  56. package/dist/cli/commands/wizardPrompts.js +1 -1
  57. package/dist/cli/commands/wizardSuggestions.d.ts +8 -0
  58. package/dist/cli/commands/wizardSuggestions.js +62 -13
  59. package/dist/cli/commands/wizardTransition.d.ts +37 -0
  60. package/dist/cli/commands/wizardTransition.js +43 -0
  61. package/dist/cli/index.js +17 -3
  62. package/dist/cli/terminalTitle.d.ts +6 -0
  63. package/dist/cli/terminalTitle.js +36 -0
  64. package/dist/config/contextFiles.js +6 -3
  65. package/dist/config/endpointSecurity.d.ts +2 -0
  66. package/dist/config/endpointSecurity.js +28 -0
  67. package/dist/config/inputHistory.d.ts +3 -3
  68. package/dist/config/inputHistory.js +13 -17
  69. package/dist/config/modelDiscovery.d.ts +20 -0
  70. package/dist/config/modelDiscovery.js +51 -0
  71. package/dist/config/privateStorage.d.ts +6 -0
  72. package/dist/config/privateStorage.js +61 -0
  73. package/dist/config/providerPresets.d.ts +16 -4
  74. package/dist/config/providerPresets.js +263 -34
  75. package/dist/config/providers.d.ts +2 -0
  76. package/dist/config/providers.js +7 -0
  77. package/dist/config/settings.d.ts +22 -0
  78. package/dist/config/settings.js +33 -5
  79. package/dist/config/skillSettings.d.ts +6 -13
  80. package/dist/config/skillSettings.js +20 -19
  81. package/dist/config/updateCheck.js +4 -2
  82. package/dist/core/agent/budgets.d.ts +26 -0
  83. package/dist/core/agent/budgets.js +34 -0
  84. package/dist/core/agent/compaction.js +17 -3
  85. package/dist/core/agent/contextBudget.d.ts +8 -0
  86. package/dist/core/agent/contextBudget.js +29 -0
  87. package/dist/core/agent/errors.js +6 -2
  88. package/dist/core/agent/events.d.ts +12 -0
  89. package/dist/core/agent/toolOutputStore.d.ts +8 -0
  90. package/dist/core/agent/toolOutputStore.js +49 -11
  91. package/dist/core/agent/workState.d.ts +1 -1
  92. package/dist/core/agent/workState.js +0 -4
  93. package/dist/core/attachments/imageAttachments.d.ts +90 -0
  94. package/dist/core/attachments/imageAttachments.js +245 -0
  95. package/dist/core/attachments/readBlessings.d.ts +37 -0
  96. package/dist/core/attachments/readBlessings.js +79 -0
  97. package/dist/core/goal/completionPolicy.d.ts +0 -28
  98. package/dist/core/goal/completionPolicy.js +0 -88
  99. package/dist/core/goal/requestClassifier.d.ts +0 -3
  100. package/dist/core/goal/requestClassifier.js +0 -13
  101. package/dist/core/io/boundedRead.d.ts +15 -0
  102. package/dist/core/io/boundedRead.js +144 -0
  103. package/dist/core/limits/byteBudgets.d.ts +18 -0
  104. package/dist/core/limits/byteBudgets.js +18 -0
  105. package/dist/core/limits/textBudgets.d.ts +23 -0
  106. package/dist/core/limits/textBudgets.js +23 -0
  107. package/dist/core/log/llmLog.d.ts +10 -0
  108. package/dist/core/log/llmLog.js +59 -13
  109. package/dist/core/persistence/orderedFileWriter.d.ts +11 -0
  110. package/dist/core/persistence/orderedFileWriter.js +29 -0
  111. package/dist/core/process/backgroundRegistry.d.ts +35 -0
  112. package/dist/core/process/backgroundRegistry.js +194 -0
  113. package/dist/core/process/runBoundedProcess.d.ts +30 -0
  114. package/dist/core/process/runBoundedProcess.js +116 -0
  115. package/dist/core/safety/urlGuard.d.ts +2 -1
  116. package/dist/core/safety/urlGuard.js +3 -2
  117. package/dist/core/session/sessionSlimming.js +47 -4
  118. package/dist/core/session/sessionStore.d.ts +37 -0
  119. package/dist/core/session/sessionStore.js +136 -27
  120. package/dist/core/subagent/contracts.d.ts +116 -0
  121. package/dist/core/subagent/contracts.js +54 -0
  122. package/dist/core/subagent/executionProfiles.d.ts +28 -0
  123. package/dist/core/subagent/executionProfiles.js +45 -0
  124. package/dist/core/subagent/subagentCoordinator.d.ts +74 -0
  125. package/dist/core/subagent/subagentCoordinator.js +134 -0
  126. package/dist/core/subagent/subagentRunner.d.ts +211 -145
  127. package/dist/core/subagent/subagentRunner.js +228 -98
  128. package/dist/core/subagent/workspaceMutationPolicy.d.ts +11 -0
  129. package/dist/core/subagent/workspaceMutationPolicy.js +52 -0
  130. package/dist/core/tasks/taskStorage.js +12 -1
  131. package/dist/llm/client.d.ts +20 -29
  132. package/dist/llm/client.js +33 -29
  133. package/dist/llm/hazeTools.d.ts +2396 -67
  134. package/dist/llm/hazeTools.js +50 -37
  135. package/dist/llm/lsp.d.ts +23 -3
  136. package/dist/llm/lsp.js +73 -16
  137. package/dist/llm/lspTools.d.ts +96 -48
  138. package/dist/llm/mcp.d.ts +1 -1
  139. package/dist/llm/mcp.js +65 -16
  140. package/dist/llm/requestContext.d.ts +23 -1
  141. package/dist/llm/requestContext.js +50 -7
  142. package/dist/llm/systemPrompt.d.ts +4 -1
  143. package/dist/llm/systemPrompt.js +14 -4
  144. package/dist/llm/toolResultTypes.d.ts +1 -1
  145. package/dist/llm/tools/bashTool.d.ts +1210 -16
  146. package/dist/llm/tools/bashTool.js +43 -60
  147. package/dist/llm/tools/fetchTool.d.ts +26 -26
  148. package/dist/llm/tools/fetchTool.js +1 -1
  149. package/dist/llm/tools/fileToolShared.d.ts +2 -1
  150. package/dist/llm/tools/fileToolShared.js +5 -5
  151. package/dist/llm/tools/grepRunner.d.ts +20 -0
  152. package/dist/llm/tools/grepRunner.js +66 -0
  153. package/dist/llm/tools/outputCap.d.ts +2 -6
  154. package/dist/llm/tools/outputCap.js +2 -6
  155. package/dist/llm/tools/processTool.d.ts +1077 -0
  156. package/dist/llm/tools/processTool.js +41 -0
  157. package/dist/llm/tools/toolContext.d.ts +8 -0
  158. package/dist/llm/tools/toolContext.js +22 -11
  159. package/dist/llm/tools/workspaceFile.d.ts +9 -1
  160. package/dist/llm/tools/workspaceFile.js +33 -4
  161. package/dist/llm/webFetch.js +24 -11
  162. package/dist/llm/workerContext.d.ts +18 -0
  163. package/dist/llm/workerContext.js +55 -0
  164. package/dist/skills/SkillLoader.d.ts +2 -2
  165. package/dist/skills/SkillLoader.js +17 -5
  166. package/dist/skills/SkillRegistry.d.ts +3 -2
  167. package/dist/skills/SkillRegistry.js +53 -10
  168. package/dist/skills/builder/SkillBuilder.d.ts +3 -0
  169. package/dist/skills/builder/SkillBuilder.js +23 -5
  170. package/dist/skills/skillTools.js +11 -4
  171. package/dist/skills/types.d.ts +11 -1
  172. package/dist/ui/components/TextInput.d.ts +5 -2
  173. package/dist/ui/components/TextInput.js +76 -8
  174. package/dist/utils/format.d.ts +2 -0
  175. package/dist/utils/format.js +8 -0
  176. package/dist/utils/fs.d.ts +0 -1
  177. package/dist/utils/fs.js +0 -4
  178. package/dist/utils/openPath.d.ts +2 -0
  179. package/dist/utils/openPath.js +9 -0
  180. package/dist/utils/path.d.ts +2 -0
  181. package/dist/utils/path.js +9 -4
  182. package/package.json +1 -1
@@ -8,9 +8,11 @@ export declare function shouldInsertNewline(input: string, key: TextInputKey): b
8
8
  export type TextInputSuggestion = {
9
9
  value: string;
10
10
  description?: string;
11
- kind?: 'command' | 'skill' | 'provider' | 'model' | 'lsp' | 'mcp';
11
+ kind?: 'command' | 'skill' | 'provider' | 'model' | 'lsp' | 'mcp' | 'session' | 'file';
12
12
  };
13
- export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }: {
13
+ /** Cursor-aware path completer for `@token` mentions; receives the token verbatim. */
14
+ export type MentionSuggestionsProvider = (token: string) => Promise<TextInputSuggestion[]> | TextInputSuggestion[];
15
+ export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, getMentionSuggestions, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }: {
14
16
  placeholder?: string;
15
17
  disabled?: boolean;
16
18
  mask?: boolean;
@@ -20,6 +22,7 @@ export declare function TextInput({ placeholder, disabled, mask, historyItems, r
20
22
  suggestionMode?: 'slash' | 'always';
21
23
  submitOnEmpty?: boolean;
22
24
  width?: number;
25
+ getMentionSuggestions?: MentionSuggestionsProvider;
23
26
  onHistoryAdd?: (value: string) => void;
24
27
  onCancel?: () => void;
25
28
  onEscape?: () => void;
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from 'react';
3
3
  import { Box, Text, useInput } from 'ink';
4
4
  import { theme } from '../theme.js';
5
5
  import { compactPasteBlocksForDisplay, cursorPosition, displayCursorForValueCursor, lineCount, normalizeLineEndings, updatePasteBlocksForReplacement, valueCursorForDisplayCursor, wrapDisplayValue, } from '../inputBuffer.js';
6
+ import { detectMentionAtCursor } from '../../cli/chat/fileMentionSuggestions.js';
6
7
  const COMPACT_PASTE_MIN_LINES = 4;
7
8
  const CTRL_ENTER_ESCAPE_INPUTS = new Set(['\u001B[13;5u', '\u001B[13;5~']);
8
9
  export function shouldInsertNewline(input, key) {
@@ -10,11 +11,14 @@ export function shouldInsertNewline(input, key) {
10
11
  || input === '\n'
11
12
  || CTRL_ENTER_ESCAPE_INPUTS.has(input);
12
13
  }
13
- export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }) {
14
+ export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, getMentionSuggestions, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }) {
14
15
  const [value, setValue] = useState('');
15
16
  const [cursor, setCursor] = useState(0);
16
17
  const [pasteBlocks, setPasteBlocks] = useState([]);
17
18
  const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(0);
19
+ const [mentionContext, setMentionContext] = useState();
20
+ const [mentionSuggestions, setMentionSuggestions] = useState([]);
21
+ const [mentionSelectedIndex, setMentionSelectedIndex] = useState(0);
18
22
  const history = useRef(historyItems);
19
23
  const historyIndex = useRef(null);
20
24
  const draft = useRef('');
@@ -40,6 +44,7 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
40
44
  setCursor(Math.max(0, Math.min(nextCursor, next.length)));
41
45
  setPasteBlocks(nextPasteBlocks);
42
46
  setSelectedSuggestionIndex(0);
47
+ setMentionSelectedIndex(0);
43
48
  }
44
49
  function replaceInput(start, end, inserted) {
45
50
  const normalizedInserted = normalizeLineEndings(inserted);
@@ -65,8 +70,36 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
65
70
  return suggestionValue.toLowerCase().includes(suggestionQuery) || suggestion.description?.toLowerCase().includes(suggestionQuery);
66
71
  })
67
72
  .slice(0, 20);
73
+ // `@token` mention detection — only in chat mode (slash) so wizard pickers
74
+ // never grab `@`-prefixed tokens. Detection is sync; suggestion fetch is
75
+ // async with cancellation so fast typing does not race stale results.
76
+ const detectedMention = !mask && suggestionMode === 'slash' && !value.startsWith('/') && getMentionSuggestions
77
+ ? detectMentionAtCursor(value, cursor)
78
+ : undefined;
79
+ useEffect(() => {
80
+ setMentionContext(detectedMention);
81
+ }, [detectedMention?.token, detectedMention?.start, detectedMention?.end]);
82
+ useEffect(() => {
83
+ if (!mentionContext || !getMentionSuggestions) {
84
+ if (mentionSuggestions.length > 0)
85
+ setMentionSuggestions([]);
86
+ return;
87
+ }
88
+ let cancelled = false;
89
+ Promise.resolve(getMentionSuggestions(mentionContext.token))
90
+ .then(results => { if (!cancelled) {
91
+ setMentionSuggestions(results);
92
+ setMentionSelectedIndex(0);
93
+ } })
94
+ .catch(() => { if (!cancelled)
95
+ setMentionSuggestions([]); });
96
+ return () => { cancelled = true; };
97
+ }, [mentionContext?.token, mentionContext?.start, mentionContext?.end]);
98
+ const inMentionMode = !!detectedMention;
99
+ const mentionList = inMentionMode ? mentionSuggestions : [];
100
+ const activeMentionIndex = Math.min(mentionSelectedIndex, Math.max(0, mentionList.length - 1));
68
101
  const activeSuggestionIndex = Math.min(selectedSuggestionIndex, Math.max(0, filteredSuggestions.length - 1));
69
- const activeSuggestion = filteredSuggestions[activeSuggestionIndex];
102
+ const activeSuggestion = inMentionMode ? mentionList[activeMentionIndex] : filteredSuggestions[activeSuggestionIndex];
70
103
  const displayValue = mask ? '•'.repeat(value.length) : compactPasteBlocksForDisplay(value, pasteBlocks);
71
104
  const displayCursor = mask ? cursor : displayCursorForValueCursor(pasteBlocks, cursor);
72
105
  const inputWidth = Math.max(1, width - 2);
@@ -108,6 +141,13 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
108
141
  return;
109
142
  }
110
143
  if (key.tab && activeSuggestion) {
144
+ if (inMentionMode && detectedMention) {
145
+ // Partial replacement of the `@token` range, not the whole input —
146
+ // mention completion fires mid-prompt.
147
+ replaceInput(detectedMention.start, detectedMention.end, activeSuggestion.value);
148
+ historyIndex.current = null;
149
+ return;
150
+ }
111
151
  setInput(activeSuggestion.value);
112
152
  historyIndex.current = null;
113
153
  return;
@@ -117,9 +157,21 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
117
157
  return;
118
158
  }
119
159
  if (key.return) {
120
- const shouldUseSuggestion = activeSuggestion && activeSuggestion.value !== value.trim() && (suggestionMode === 'always' || value.startsWith('/'));
121
- const submitted = shouldUseSuggestion ? activeSuggestion.value : value.trim();
122
- const submittedSuggestion = activeSuggestion?.value === submitted ? activeSuggestion : undefined;
160
+ // Mention mode: complete the `@token` range before submitting, so
161
+ // pressing Enter on `read @packa` with `@package.json` highlighted
162
+ // submits `read @package.json` (matches slash-command behavior).
163
+ let submittedValue;
164
+ let submittedSuggestion;
165
+ if (inMentionMode && detectedMention && activeSuggestion && activeSuggestion.value !== detectedMention.token) {
166
+ submittedValue = value.slice(0, detectedMention.start) + activeSuggestion.value + value.slice(detectedMention.end);
167
+ submittedSuggestion = activeSuggestion;
168
+ }
169
+ else {
170
+ const shouldUseSuggestion = !!activeSuggestion && activeSuggestion.value !== value.trim() && (suggestionMode === 'always' || value.startsWith('/'));
171
+ submittedValue = shouldUseSuggestion && activeSuggestion ? activeSuggestion.value : value;
172
+ submittedSuggestion = shouldUseSuggestion ? activeSuggestion : undefined;
173
+ }
174
+ const submitted = submittedValue.trim();
123
175
  const historyValue = submittedSuggestion && submittedSuggestion.kind !== 'command' ? '' : submitted;
124
176
  setInput('');
125
177
  historyIndex.current = null;
@@ -140,12 +192,19 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
140
192
  return;
141
193
  }
142
194
  if (key.upArrow) {
195
+ if (inMentionMode && mentionList.length > 0) {
196
+ if (activeMentionIndex > 0)
197
+ setMentionSelectedIndex(current => Math.max(0, current - 1));
198
+ return;
199
+ }
143
200
  if (filteredSuggestions.length > 0 && activeSuggestionIndex > 0) {
144
201
  setSelectedSuggestionIndex(current => Math.max(0, current - 1));
145
202
  return;
146
203
  }
147
- if (filteredSuggestions.length === 0 && moveCursorVertically(-1))
204
+ if (filteredSuggestions.length === 0 && !inMentionMode && moveCursorVertically(-1))
148
205
  return;
206
+ if (inMentionMode)
207
+ return; // no history navigation while completing
149
208
  preferredColumn.current = null;
150
209
  if (history.current.length === 0)
151
210
  return;
@@ -159,11 +218,18 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
159
218
  return;
160
219
  }
161
220
  if (key.downArrow) {
221
+ if (inMentionMode && mentionList.length > 0) {
222
+ if (activeMentionIndex < mentionList.length - 1)
223
+ setMentionSelectedIndex(current => Math.min(mentionList.length - 1, current + 1));
224
+ return;
225
+ }
162
226
  if (filteredSuggestions.length > 0 && activeSuggestionIndex < filteredSuggestions.length - 1) {
163
227
  setSelectedSuggestionIndex(current => Math.min(filteredSuggestions.length - 1, current + 1));
164
228
  return;
165
229
  }
166
- if (filteredSuggestions.length === 0 && moveCursorVertically(1))
230
+ if (filteredSuggestions.length === 0 && !inMentionMode && moveCursorVertically(1))
231
+ return;
232
+ if (inMentionMode)
167
233
  return;
168
234
  preferredColumn.current = null;
169
235
  if (historyIndex.current === null)
@@ -212,7 +278,9 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
212
278
  const maxVisibleLines = 4;
213
279
  const firstVisibleLine = Math.max(0, Math.min(currentCursorPosition.lineIndex - maxVisibleLines + 1, wrappedLines.length - maxVisibleLines));
214
280
  const visibleLines = wrappedLines.slice(firstVisibleLine, firstVisibleLine + maxVisibleLines);
215
- return _jsxs(Box, { flexDirection: "column", width: "100%", children: [filteredSuggestions.length > 0 && _jsx(Box, { flexDirection: "column", marginBottom: 1, children: filteredSuggestions.map((suggestion, index) => _jsxs(Text, { color: index === activeSuggestionIndex ? theme.success : theme.muted, wrap: "truncate-end", children: [index === activeSuggestionIndex ? '› ' : ' ', suggestion.value, _jsxs(Text, { color: theme.muted, children: [" ", suggestion.kind ?? 'command', suggestion.description ? ` — ${suggestion.description}` : ''] })] }, suggestion.value)) }), value.length === 0 ? _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: theme.purple, children: "\u203A " }), _jsx(Text, { inverse: true, children: " " }), _jsxs(Text, { color: theme.muted, dimColor: true, children: [" ", placeholder ?? 'Type a message...'] })] }) : visibleLines.map((line, index) => {
281
+ const displayList = inMentionMode ? mentionList : filteredSuggestions;
282
+ const displayActiveIndex = inMentionMode ? activeMentionIndex : activeSuggestionIndex;
283
+ return _jsxs(Box, { flexDirection: "column", width: "100%", children: [displayList.length > 0 && _jsx(Box, { flexDirection: "column", marginBottom: 1, children: displayList.map((suggestion, index) => _jsxs(Text, { color: index === displayActiveIndex ? theme.success : theme.muted, wrap: "truncate-end", children: [index === displayActiveIndex ? '› ' : ' ', suggestion.value, _jsxs(Text, { color: theme.muted, children: [" ", suggestion.kind ?? 'command', suggestion.description ? ` — ${suggestion.description}` : ''] })] }, suggestion.value)) }), value.length === 0 ? _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: theme.purple, children: "\u203A " }), _jsx(Text, { inverse: true, children: " " }), _jsxs(Text, { color: theme.muted, dimColor: true, children: [" ", placeholder ?? 'Type a message...'] })] }) : visibleLines.map((line, index) => {
216
284
  const absoluteLineIndex = firstVisibleLine + index;
217
285
  const isCursorLine = absoluteLineIndex === currentCursorPosition.lineIndex;
218
286
  const lineCursor = isCursorLine ? Math.max(0, Math.min(displayCursor - line.start, line.text.length)) : -1;
@@ -0,0 +1,2 @@
1
+ /** Human-readable byte sizes for display text (CLI rows, session placeholders). */
2
+ export declare function formatBytes(bytes: number): string;
@@ -0,0 +1,8 @@
1
+ /** Human-readable byte sizes for display text (CLI rows, session placeholders). */
2
+ export function formatBytes(bytes) {
3
+ if (bytes < 1024)
4
+ return `${bytes} B`;
5
+ if (bytes < 1024 * 1024)
6
+ return `${(bytes / 1024).toFixed(1)} KB`;
7
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
8
+ }
@@ -12,4 +12,3 @@ export interface WalkOptions {
12
12
  filter?: (entry: WalkEntry) => boolean | Promise<boolean>;
13
13
  }
14
14
  export declare function walkDir(root: string, options?: WalkOptions): Promise<WalkEntry[]>;
15
- export declare function listFilesRecursive(root: string): Promise<string[]>;
package/dist/utils/fs.js CHANGED
@@ -34,7 +34,3 @@ export async function walkDir(root, options = {}) {
34
34
  await walk(root);
35
35
  return result;
36
36
  }
37
- export async function listFilesRecursive(root) {
38
- const entries = await walkDir(root, { recursive: true });
39
- return entries.filter(e => e.isFile).map(e => e.path).sort();
40
- }
@@ -0,0 +1,2 @@
1
+ /** Open a file with the platform default handler. Tests mock this module. */
2
+ export declare function openPath(filePath: string): void;
@@ -0,0 +1,9 @@
1
+ import { spawn } from 'node:child_process';
2
+ /** Open a file with the platform default handler. Tests mock this module. */
3
+ export function openPath(filePath) {
4
+ const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'cmd' : 'xdg-open';
5
+ const args = process.platform === 'win32' ? ['/c', 'start', '', filePath] : [filePath];
6
+ const child = spawn(command, args, { stdio: 'ignore', detached: true });
7
+ child.on('error', () => undefined);
8
+ child.unref();
9
+ }
@@ -1,5 +1,7 @@
1
1
  export declare function workspaceRoot(): string;
2
2
  export declare function resolveWorkspacePath(inputPath: string): string;
3
3
  export declare function workspaceRelativePath(absolutePath: string): string;
4
+ export declare function assertPathInsideRoot(root: string, candidate: string, inputPath: string, label?: string): void;
5
+ export declare function assertRealPathInsideRoot(root: string, candidate: string, inputPath?: string, label?: string): Promise<string>;
4
6
  export declare function assertRealPathInsideWorkspace(absolutePath: string, inputPath?: string): Promise<void>;
5
7
  export declare function assertWritablePathInsideWorkspace(absolutePath: string, inputPath?: string): Promise<void>;
@@ -15,18 +15,23 @@ export function resolveWorkspacePath(inputPath) {
15
15
  export function workspaceRelativePath(absolutePath) {
16
16
  return path.relative(workspaceRoot(), absolutePath) || '.';
17
17
  }
18
- function assertPathInsideRoot(root, candidate, inputPath) {
18
+ export function assertPathInsideRoot(root, candidate, inputPath, label = 'workspace') {
19
19
  const relative = path.relative(root, candidate);
20
20
  if (relative.startsWith('..') || path.isAbsolute(relative)) {
21
- throw new Error(`Path is outside the workspace: ${inputPath}`);
21
+ throw new Error(`Path is outside the ${label}: ${inputPath}`);
22
22
  }
23
23
  }
24
+ export async function assertRealPathInsideRoot(root, candidate, inputPath = candidate, label = 'root') {
25
+ const [realRoot, realCandidate] = await Promise.all([fs.realpath(root), fs.realpath(candidate)]);
26
+ assertPathInsideRoot(realRoot, realCandidate, inputPath, label);
27
+ return realCandidate;
28
+ }
24
29
  export async function assertRealPathInsideWorkspace(absolutePath, inputPath = absolutePath) {
25
30
  const [realRoot, realPath] = await Promise.all([
26
31
  fs.realpath(workspaceRoot()),
27
32
  fs.realpath(absolutePath),
28
33
  ]);
29
- assertPathInsideRoot(realRoot, realPath, inputPath);
34
+ assertPathInsideRoot(realRoot, realPath, inputPath, 'workspace');
30
35
  }
31
36
  async function nearestExistingPath(absolutePath) {
32
37
  let current = absolutePath;
@@ -52,5 +57,5 @@ export async function assertWritablePathInsideWorkspace(absolutePath, inputPath
52
57
  nearestExistingPath(absolutePath),
53
58
  ]);
54
59
  const realExisting = await fs.realpath(existing);
55
- assertPathInsideRoot(realRoot, realExisting, inputPath);
60
+ assertPathInsideRoot(realRoot, realExisting, inputPath, 'workspace');
56
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "A pragmatic agentic CLI for building apps from the terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",