@denizokcu/haze 0.6.0 → 0.8.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 (160) hide show
  1. package/CHANGELOG.md +42 -7
  2. package/README.md +81 -34
  3. package/dist/cli/chat/TaskBar.d.ts +9 -0
  4. package/dist/cli/chat/TaskBar.js +40 -0
  5. package/dist/cli/chat/chatMetrics.d.ts +11 -0
  6. package/dist/cli/chat/chatMetrics.js +50 -0
  7. package/dist/cli/chat/inputSuggestions.d.ts +16 -0
  8. package/dist/cli/chat/inputSuggestions.js +55 -0
  9. package/dist/cli/chat/messages.d.ts +9 -0
  10. package/dist/cli/chat/messages.js +76 -0
  11. package/dist/cli/chat/sessionRecorder.d.ts +12 -0
  12. package/dist/cli/chat/sessionRecorder.js +21 -0
  13. package/dist/cli/chat/startupInfo.d.ts +4 -0
  14. package/dist/cli/chat/startupInfo.js +53 -0
  15. package/dist/cli/chat/turnState.d.ts +5 -0
  16. package/dist/cli/chat/turnState.js +20 -0
  17. package/dist/cli/commands/chat.d.ts +0 -1
  18. package/dist/cli/commands/chat.js +331 -906
  19. package/dist/cli/commands/chatModes.d.ts +8 -0
  20. package/dist/cli/commands/chatModes.js +44 -0
  21. package/dist/cli/commands/commandHelp.d.ts +6 -0
  22. package/dist/cli/commands/commandHelp.js +25 -0
  23. package/dist/cli/commands/commands.d.ts +1 -1
  24. package/dist/cli/commands/commands.js +41 -267
  25. package/dist/cli/commands/formatters.d.ts +6 -0
  26. package/dist/cli/commands/formatters.js +50 -4
  27. package/dist/cli/commands/initCommand.d.ts +2 -0
  28. package/dist/cli/commands/initCommand.js +19 -0
  29. package/dist/cli/commands/logsCommand.d.ts +2 -0
  30. package/dist/cli/commands/logsCommand.js +63 -0
  31. package/dist/cli/commands/lspWizard.d.ts +14 -0
  32. package/dist/cli/commands/lspWizard.js +44 -0
  33. package/dist/cli/commands/mcpWizard.d.ts +15 -0
  34. package/dist/cli/commands/mcpWizard.js +69 -0
  35. package/dist/cli/commands/modelCommand.d.ts +2 -0
  36. package/dist/cli/commands/modelCommand.js +36 -0
  37. package/dist/cli/commands/providerWizard.d.ts +30 -0
  38. package/dist/cli/commands/providerWizard.js +114 -0
  39. package/dist/cli/commands/runCommand.d.ts +16 -0
  40. package/dist/cli/commands/runCommand.js +170 -0
  41. package/dist/cli/commands/settingsSummary.d.ts +3 -0
  42. package/dist/cli/commands/settingsSummary.js +40 -0
  43. package/dist/cli/commands/skillConfirmRemove.d.ts +11 -0
  44. package/dist/cli/commands/skillConfirmRemove.js +19 -0
  45. package/dist/cli/commands/skillCreation.d.ts +12 -0
  46. package/dist/cli/commands/skillCreation.js +14 -0
  47. package/dist/cli/commands/skillWizard.d.ts +15 -0
  48. package/dist/cli/commands/skillWizard.js +38 -0
  49. package/dist/cli/commands/streaming/assistantText.d.ts +17 -0
  50. package/dist/cli/commands/streaming/assistantText.js +115 -0
  51. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +55 -0
  52. package/dist/cli/commands/streaming/toolGroupRenderer.js +102 -0
  53. package/dist/cli/commands/streaming/toolResultState.d.ts +13 -0
  54. package/dist/cli/commands/streaming/toolResultState.js +25 -0
  55. package/dist/cli/commands/streaming/turnRuntime.d.ts +78 -0
  56. package/dist/cli/commands/streaming/turnRuntime.js +86 -0
  57. package/dist/cli/commands/streaming.d.ts +9 -25
  58. package/dist/cli/commands/streaming.js +109 -363
  59. package/dist/cli/commands/wizardActions.d.ts +40 -0
  60. package/dist/cli/commands/wizardActions.js +40 -0
  61. package/dist/cli/commands/wizardInput.d.ts +4 -0
  62. package/dist/cli/commands/wizardInput.js +19 -0
  63. package/dist/cli/commands/wizardPrompts.d.ts +22 -0
  64. package/dist/cli/commands/wizardPrompts.js +52 -0
  65. package/dist/cli/commands/wizardSuggestions.d.ts +23 -0
  66. package/dist/cli/commands/wizardSuggestions.js +139 -0
  67. package/dist/cli/index.js +62 -4
  68. package/dist/config/contextFiles.d.ts +8 -1
  69. package/dist/config/contextFiles.js +25 -12
  70. package/dist/config/lspSettings.js +3 -6
  71. package/dist/config/mcpSettings.js +5 -5
  72. package/dist/config/providers.js +8 -12
  73. package/dist/config/settings.d.ts +1 -0
  74. package/dist/config/settings.js +54 -2
  75. package/dist/config/skillSettings.js +4 -3
  76. package/dist/core/agent/budgets.d.ts +6 -0
  77. package/dist/core/agent/budgets.js +6 -0
  78. package/dist/core/agent/compaction.js +3 -3
  79. package/dist/core/agent/errors.js +1 -1
  80. package/dist/core/agent/requestAssembly.d.ts +1 -7
  81. package/dist/core/agent/requestAssembly.js +40 -5
  82. package/dist/core/agent/toolOutputStore.js +5 -4
  83. package/dist/core/agent/toolResults.d.ts +31 -0
  84. package/dist/core/agent/toolResults.js +42 -0
  85. package/dist/core/agent/turnPolicy.d.ts +8 -0
  86. package/dist/core/agent/turnPolicy.js +23 -0
  87. package/dist/core/agent/workState.d.ts +18 -5
  88. package/dist/core/agent/workState.js +39 -20
  89. package/dist/core/bashOutput/reducers/content.d.ts +1 -0
  90. package/dist/core/bashOutput/reducers/content.js +1 -1
  91. package/dist/core/bashOutput/reducers/gh.d.ts +1 -0
  92. package/dist/core/bashOutput/reducers/gh.js +77 -0
  93. package/dist/core/bashOutput/registry.js +18 -8
  94. package/dist/core/goal/completionPolicy.js +1 -1
  95. package/dist/core/goal/sessionGoal.d.ts +6 -30
  96. package/dist/core/goal/sessionGoal.js +3 -68
  97. package/dist/core/safety/bashClassifier.js +30 -0
  98. package/dist/core/safety/urlGuard.d.ts +1 -0
  99. package/dist/core/safety/urlGuard.js +6 -1
  100. package/dist/core/session/sessionSlimming.d.ts +5 -0
  101. package/dist/core/session/sessionSlimming.js +78 -0
  102. package/dist/core/session/sessionStore.d.ts +23 -3
  103. package/dist/core/session/sessionStore.js +30 -10
  104. package/dist/core/subagent/subagentRunner.d.ts +258 -5
  105. package/dist/core/subagent/subagentRunner.js +14 -18
  106. package/dist/core/toolOutput/reduction.d.ts +2 -0
  107. package/dist/core/toolOutput/reduction.js +12 -0
  108. package/dist/core/validation/outputParser.js +5 -3
  109. package/dist/llm/capabilities.d.ts +12 -0
  110. package/dist/llm/capabilities.js +10 -0
  111. package/dist/llm/client.d.ts +3 -2
  112. package/dist/llm/client.js +26 -4
  113. package/dist/llm/hazeTools.d.ts +7710 -366
  114. package/dist/llm/hazeTools.js +46 -567
  115. package/dist/llm/initPrompt.js +1 -1
  116. package/dist/llm/lsp.d.ts +46 -1
  117. package/dist/llm/lsp.js +19 -10
  118. package/dist/llm/lspTools.d.ts +2310 -119
  119. package/dist/llm/mcp.js +9 -0
  120. package/dist/llm/requestContext.js +7 -22
  121. package/dist/llm/systemPrompt.d.ts +1 -0
  122. package/dist/llm/systemPrompt.js +3 -3
  123. package/dist/llm/tools/bashTool.d.ts +251 -0
  124. package/dist/llm/tools/bashTool.js +82 -0
  125. package/dist/llm/tools/editMatch.d.ts +55 -0
  126. package/dist/llm/tools/editMatch.js +99 -0
  127. package/dist/llm/tools/failures.d.ts +36 -0
  128. package/dist/llm/tools/failures.js +38 -0
  129. package/dist/llm/tools/fetchTool.d.ts +1201 -0
  130. package/dist/llm/tools/fetchTool.js +46 -0
  131. package/dist/llm/tools/fileToolShared.d.ts +10 -0
  132. package/dist/llm/tools/fileToolShared.js +43 -0
  133. package/dist/llm/tools/grepParse.d.ts +13 -0
  134. package/dist/llm/tools/grepParse.js +67 -0
  135. package/dist/llm/tools/outputCap.d.ts +53 -0
  136. package/dist/llm/tools/outputCap.js +67 -0
  137. package/dist/llm/tools/storedOutputTool.d.ts +351 -0
  138. package/dist/llm/tools/storedOutputTool.js +17 -0
  139. package/dist/llm/tools/taskTool.d.ts +629 -0
  140. package/dist/llm/tools/taskTool.js +41 -0
  141. package/dist/llm/tools/toolContext.d.ts +74 -0
  142. package/dist/llm/tools/toolContext.js +196 -0
  143. package/dist/llm/tools/workspaceFile.d.ts +33 -0
  144. package/dist/llm/tools/workspaceFile.js +27 -0
  145. package/dist/llm/webFetch.d.ts +13 -1
  146. package/dist/llm/webFetch.js +122 -28
  147. package/dist/skills/builder/SkillBuilder.d.ts +3 -0
  148. package/dist/skills/builder/SkillBuilder.js +8 -8
  149. package/dist/ui/components/TextInput.d.ts +7 -0
  150. package/dist/ui/components/TextInput.js +10 -98
  151. package/dist/ui/inputBuffer.d.ts +28 -0
  152. package/dist/ui/inputBuffer.js +99 -0
  153. package/dist/utils/collections.d.ts +6 -0
  154. package/dist/utils/collections.js +9 -0
  155. package/dist/utils/modelName.d.ts +2 -0
  156. package/dist/utils/modelName.js +15 -0
  157. package/dist/utils/path.d.ts +2 -0
  158. package/dist/utils/path.js +40 -0
  159. package/examples/skills/files/SKILL.md +1 -1
  160. package/package.json +14 -15
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
+ type TextInputKey = {
3
+ return?: boolean;
4
+ shift?: boolean;
5
+ ctrl?: boolean;
6
+ };
7
+ export declare function shouldInsertNewline(input: string, key: TextInputKey): boolean;
2
8
  export type TextInputSuggestion = {
3
9
  value: string;
4
10
  description?: string;
@@ -20,3 +26,4 @@ export declare function TextInput({ placeholder, disabled, mask, historyItems, r
20
26
  onToggleTasks?: () => void;
21
27
  onSubmit: (value: string) => void;
22
28
  }): React.JSX.Element;
29
+ export {};
@@ -2,105 +2,13 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { Box, Text, useInput } from 'ink';
4
4
  import { theme } from '../theme.js';
5
+ import { compactPasteBlocksForDisplay, cursorPosition, displayCursorForValueCursor, lineCount, normalizeLineEndings, updatePasteBlocksForReplacement, valueCursorForDisplayCursor, wrapDisplayValue, } from '../inputBuffer.js';
5
6
  const COMPACT_PASTE_MIN_LINES = 4;
6
- function normalizeLineEndings(text) {
7
- return text.replace(/\r\n|\r/g, '\n');
8
- }
9
- function lineCount(text) {
10
- return normalizeLineEndings(text).split('\n').length;
11
- }
12
- function pastePlaceholder(block) {
13
- return `[paste #${block.id} +${block.lineCount} lines]`;
14
- }
15
- function updatePasteBlocksForReplacement(blocks, start, end, insertedLength) {
16
- const delta = insertedLength - (end - start);
17
- return blocks.flatMap(block => {
18
- const replacesInsideBlock = start < block.end && end > block.start;
19
- const insertsInsideBlock = start === end && start > block.start && start < block.end;
20
- if (replacesInsideBlock || insertsInsideBlock)
21
- return [];
22
- if (block.start >= end)
23
- return [{ ...block, start: block.start + delta, end: block.end + delta }];
24
- return [block];
25
- });
26
- }
27
- function displayCursorForValueCursor(blocks, valueCursor) {
28
- let displayCursor = valueCursor;
29
- for (const block of [...blocks].sort((a, b) => a.start - b.start)) {
30
- const placeholderLength = pastePlaceholder(block).length;
31
- const compactedLength = block.end - block.start - placeholderLength;
32
- if (valueCursor <= block.start)
33
- break;
34
- if (valueCursor < block.end)
35
- return block.start + placeholderLength;
36
- displayCursor -= compactedLength;
37
- }
38
- return displayCursor;
39
- }
40
- function compactPasteBlocksForDisplay(value, blocks) {
41
- if (blocks.length === 0)
42
- return value;
43
- let displayValue = '';
44
- let offset = 0;
45
- for (const block of [...blocks].sort((a, b) => a.start - b.start)) {
46
- displayValue += value.slice(offset, block.start);
47
- displayValue += pastePlaceholder(block);
48
- offset = block.end;
49
- }
50
- displayValue += value.slice(offset);
51
- return displayValue;
52
- }
53
- function valueCursorForDisplayCursor(blocks, displayCursor) {
54
- let valueCursor = displayCursor;
55
- let displayOffset = 0;
56
- for (const block of [...blocks].sort((a, b) => a.start - b.start)) {
57
- const placeholderLength = pastePlaceholder(block).length;
58
- const displayStart = block.start - displayOffset;
59
- const displayEnd = displayStart + placeholderLength;
60
- if (displayCursor <= displayStart)
61
- break;
62
- if (displayCursor <= displayEnd)
63
- return block.end;
64
- const compactedLength = block.end - block.start - placeholderLength;
65
- valueCursor += compactedLength;
66
- displayOffset += compactedLength;
67
- }
68
- return valueCursor;
69
- }
70
- function wrapDisplayValue(displayValue, width) {
71
- const wrapWidth = Math.max(1, width);
72
- const lines = [];
73
- let start = 0;
74
- let text = '';
75
- for (let index = 0; index < displayValue.length; index += 1) {
76
- const char = displayValue[index];
77
- if (char === '\n') {
78
- lines.push({ text, start, end: index });
79
- start = index + 1;
80
- text = '';
81
- continue;
82
- }
83
- if (text.length >= wrapWidth) {
84
- lines.push({ text, start, end: index });
85
- start = index;
86
- text = '';
87
- }
88
- text += char;
89
- }
90
- lines.push({ text, start, end: displayValue.length });
91
- return lines;
92
- }
93
- function cursorPosition(lines, displayCursor) {
94
- const foundIndex = lines.findIndex((line, index) => {
95
- const isLast = index === lines.length - 1;
96
- if (line.start === line.end)
97
- return displayCursor === line.start;
98
- const nextLineStartsAfterNewline = lines[index + 1]?.start === line.end + 1;
99
- return displayCursor >= line.start && (displayCursor < line.end || (nextLineStartsAfterNewline && displayCursor === line.end) || (isLast && displayCursor <= line.end));
100
- });
101
- const lineIndex = Math.max(0, foundIndex);
102
- const line = lines[lineIndex] ?? lines[0] ?? { start: 0, end: 0 };
103
- return { lineIndex, column: Math.max(0, Math.min(displayCursor - line.start, line.end - line.start)) };
7
+ const CTRL_ENTER_ESCAPE_INPUTS = new Set(['\u001B[13;5u', '\u001B[13;5~']);
8
+ export function shouldInsertNewline(input, key) {
9
+ return (key.return === true && (key.shift === true || key.ctrl === true))
10
+ || input === '\n'
11
+ || CTRL_ENTER_ESCAPE_INPUTS.has(input);
104
12
  }
105
13
  export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }) {
106
14
  const [value, setValue] = useState('');
@@ -204,6 +112,10 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
204
112
  historyIndex.current = null;
205
113
  return;
206
114
  }
115
+ if (shouldInsertNewline(input, key)) {
116
+ replaceInput(cursor, cursor, '\n');
117
+ return;
118
+ }
207
119
  if (key.return) {
208
120
  const shouldUseSuggestion = activeSuggestion && activeSuggestion.value !== value.trim() && (suggestionMode === 'always' || value.startsWith('/'));
209
121
  const submitted = shouldUseSuggestion ? activeSuggestion.value : value.trim();
@@ -0,0 +1,28 @@
1
+ export type PasteBlock = {
2
+ id: number;
3
+ start: number;
4
+ end: number;
5
+ lineCount: number;
6
+ };
7
+ export type WrappedLine = {
8
+ text: string;
9
+ start: number;
10
+ end: number;
11
+ };
12
+ export declare function normalizeLineEndings(text: string): string;
13
+ export declare function lineCount(text: string): number;
14
+ export declare function pastePlaceholder(block: PasteBlock): string;
15
+ export declare function updatePasteBlocksForReplacement(blocks: PasteBlock[], start: number, end: number, insertedLength: number): {
16
+ start: number;
17
+ end: number;
18
+ id: number;
19
+ lineCount: number;
20
+ }[];
21
+ export declare function displayCursorForValueCursor(blocks: PasteBlock[], valueCursor: number): number;
22
+ export declare function compactPasteBlocksForDisplay(value: string, blocks: PasteBlock[]): string;
23
+ export declare function valueCursorForDisplayCursor(blocks: PasteBlock[], displayCursor: number): number;
24
+ export declare function wrapDisplayValue(displayValue: string, width: number): WrappedLine[];
25
+ export declare function cursorPosition(lines: WrappedLine[], displayCursor: number): {
26
+ lineIndex: number;
27
+ column: number;
28
+ };
@@ -0,0 +1,99 @@
1
+ export function normalizeLineEndings(text) {
2
+ return text.replace(/\r\n|\r/g, '\n');
3
+ }
4
+ export function lineCount(text) {
5
+ return normalizeLineEndings(text).split('\n').length;
6
+ }
7
+ export function pastePlaceholder(block) {
8
+ return `[paste #${block.id} +${block.lineCount} lines]`;
9
+ }
10
+ export function updatePasteBlocksForReplacement(blocks, start, end, insertedLength) {
11
+ const delta = insertedLength - (end - start);
12
+ return blocks.flatMap(block => {
13
+ const replacesInsideBlock = start < block.end && end > block.start;
14
+ const insertsInsideBlock = start === end && start > block.start && start < block.end;
15
+ if (replacesInsideBlock || insertsInsideBlock)
16
+ return [];
17
+ if (block.start >= end)
18
+ return [{ ...block, start: block.start + delta, end: block.end + delta }];
19
+ return [block];
20
+ });
21
+ }
22
+ export function displayCursorForValueCursor(blocks, valueCursor) {
23
+ let displayCursor = valueCursor;
24
+ for (const block of [...blocks].sort((a, b) => a.start - b.start)) {
25
+ const placeholderLength = pastePlaceholder(block).length;
26
+ const compactedLength = block.end - block.start - placeholderLength;
27
+ if (valueCursor <= block.start)
28
+ break;
29
+ if (valueCursor < block.end)
30
+ return block.start + placeholderLength;
31
+ displayCursor -= compactedLength;
32
+ }
33
+ return displayCursor;
34
+ }
35
+ export function compactPasteBlocksForDisplay(value, blocks) {
36
+ if (blocks.length === 0)
37
+ return value;
38
+ let displayValue = '';
39
+ let offset = 0;
40
+ for (const block of [...blocks].sort((a, b) => a.start - b.start)) {
41
+ displayValue += value.slice(offset, block.start);
42
+ displayValue += pastePlaceholder(block);
43
+ offset = block.end;
44
+ }
45
+ displayValue += value.slice(offset);
46
+ return displayValue;
47
+ }
48
+ export function valueCursorForDisplayCursor(blocks, displayCursor) {
49
+ let valueCursor = displayCursor;
50
+ let displayOffset = 0;
51
+ for (const block of [...blocks].sort((a, b) => a.start - b.start)) {
52
+ const placeholderLength = pastePlaceholder(block).length;
53
+ const displayStart = block.start - displayOffset;
54
+ const displayEnd = displayStart + placeholderLength;
55
+ if (displayCursor <= displayStart)
56
+ break;
57
+ if (displayCursor <= displayEnd)
58
+ return block.end;
59
+ const compactedLength = block.end - block.start - placeholderLength;
60
+ valueCursor += compactedLength;
61
+ displayOffset += compactedLength;
62
+ }
63
+ return valueCursor;
64
+ }
65
+ export function wrapDisplayValue(displayValue, width) {
66
+ const wrapWidth = Math.max(1, width);
67
+ const lines = [];
68
+ let start = 0;
69
+ let text = '';
70
+ for (let index = 0; index < displayValue.length; index += 1) {
71
+ const char = displayValue[index];
72
+ if (char === '\n') {
73
+ lines.push({ text, start, end: index });
74
+ start = index + 1;
75
+ text = '';
76
+ continue;
77
+ }
78
+ if (text.length >= wrapWidth) {
79
+ lines.push({ text, start, end: index });
80
+ start = index;
81
+ text = '';
82
+ }
83
+ text += char;
84
+ }
85
+ lines.push({ text, start, end: displayValue.length });
86
+ return lines;
87
+ }
88
+ export function cursorPosition(lines, displayCursor) {
89
+ const foundIndex = lines.findIndex((line, index) => {
90
+ const isLast = index === lines.length - 1;
91
+ if (line.start === line.end)
92
+ return displayCursor === line.start;
93
+ const nextLineStartsAfterNewline = lines[index + 1]?.start === line.end + 1;
94
+ return displayCursor >= line.start && (displayCursor < line.end || (nextLineStartsAfterNewline && displayCursor === line.end) || (isLast && displayCursor <= line.end));
95
+ });
96
+ const lineIndex = Math.max(0, foundIndex);
97
+ const line = lines[lineIndex] ?? lines[0] ?? { start: 0, end: 0 };
98
+ return { lineIndex, column: Math.max(0, Math.min(displayCursor - line.start, line.end - line.start)) };
99
+ }
@@ -0,0 +1,6 @@
1
+ export type NamedItem = {
2
+ name: string;
3
+ };
4
+ export declare function findByName<T extends NamedItem>(items: readonly T[], name: string): T | undefined;
5
+ export declare function removeByName<T extends NamedItem>(items: readonly T[], name: string): T[];
6
+ export declare function upsertByName<T extends NamedItem>(items: readonly T[], item: T): T[];
@@ -0,0 +1,9 @@
1
+ export function findByName(items, name) {
2
+ return items.find(item => item.name === name);
3
+ }
4
+ export function removeByName(items, name) {
5
+ return items.filter(item => item.name !== name);
6
+ }
7
+ export function upsertByName(items, item) {
8
+ return [...removeByName(items, item.name), item];
9
+ }
@@ -0,0 +1,2 @@
1
+ export declare function shortModelName(modelName: string | undefined): string;
2
+ export declare function modelThinkingLabel(modelName: string | undefined): string;
@@ -0,0 +1,15 @@
1
+ export function shortModelName(modelName) {
2
+ const trimmed = modelName?.trim();
3
+ if (!trimmed)
4
+ return 'model';
5
+ const slashIndex = trimmed.indexOf('/');
6
+ const colonIndex = trimmed.indexOf(':');
7
+ const selectorShort = colonIndex >= 0 && (slashIndex < 0 || colonIndex < slashIndex)
8
+ ? trimmed.slice(colonIndex + 1)
9
+ : trimmed;
10
+ const slashShort = selectorShort.split('/').filter(Boolean).at(-1) ?? selectorShort;
11
+ return slashShort.length > 32 ? `${slashShort.slice(0, 29)}…` : slashShort;
12
+ }
13
+ export function modelThinkingLabel(modelName) {
14
+ return `${shortModelName(modelName)} is thinking`;
15
+ }
@@ -1,3 +1,5 @@
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 assertRealPathInsideWorkspace(absolutePath: string, inputPath?: string): Promise<void>;
5
+ export declare function assertWritablePathInsideWorkspace(absolutePath: string, inputPath?: string): Promise<void>;
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs/promises';
1
2
  import path from 'node:path';
2
3
  export function workspaceRoot() {
3
4
  return process.cwd();
@@ -14,3 +15,42 @@ export function resolveWorkspacePath(inputPath) {
14
15
  export function workspaceRelativePath(absolutePath) {
15
16
  return path.relative(workspaceRoot(), absolutePath) || '.';
16
17
  }
18
+ function assertPathInsideRoot(root, candidate, inputPath) {
19
+ const relative = path.relative(root, candidate);
20
+ if (relative.startsWith('..') || path.isAbsolute(relative)) {
21
+ throw new Error(`Path is outside the workspace: ${inputPath}`);
22
+ }
23
+ }
24
+ export async function assertRealPathInsideWorkspace(absolutePath, inputPath = absolutePath) {
25
+ const [realRoot, realPath] = await Promise.all([
26
+ fs.realpath(workspaceRoot()),
27
+ fs.realpath(absolutePath),
28
+ ]);
29
+ assertPathInsideRoot(realRoot, realPath, inputPath);
30
+ }
31
+ async function nearestExistingPath(absolutePath) {
32
+ let current = absolutePath;
33
+ while (true) {
34
+ try {
35
+ await fs.access(current);
36
+ return current;
37
+ }
38
+ catch (error) {
39
+ const code = typeof error === 'object' && error != null && 'code' in error ? error.code : undefined;
40
+ if (code !== 'ENOENT')
41
+ throw error;
42
+ const parent = path.dirname(current);
43
+ if (parent === current)
44
+ throw error;
45
+ current = parent;
46
+ }
47
+ }
48
+ }
49
+ export async function assertWritablePathInsideWorkspace(absolutePath, inputPath = absolutePath) {
50
+ const [realRoot, existing] = await Promise.all([
51
+ fs.realpath(workspaceRoot()),
52
+ nearestExistingPath(absolutePath),
53
+ ]);
54
+ const realExisting = await fs.realpath(existing);
55
+ assertPathInsideRoot(realRoot, realExisting, inputPath);
56
+ }
@@ -3,7 +3,7 @@ name: files
3
3
  description: Use when the user asks for a careful file-inspection or file-editing workflow.
4
4
  ---
5
5
 
6
- Use Haze's built-in file tools rather than shell commands for file discovery and edits.
6
+ Use haze's built-in file tools rather than shell commands for file discovery and edits.
7
7
 
8
8
  Workflow:
9
9
  1. Use `listFiles` for project discovery.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "A pragmatic agentic CLI for building apps from the terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "engines": {
19
- "node": ">=20"
19
+ "node": ">=22"
20
20
  },
21
21
  "bin": {
22
22
  "haze": "bin/haze.js"
@@ -44,19 +44,18 @@
44
44
  "prepublishOnly": "npm run typecheck && npm run build"
45
45
  },
46
46
  "dependencies": {
47
- "@ai-sdk/mcp": "^1.0.52",
48
- "@ai-sdk/openai": "3.0.73",
49
- "@inquirer/prompts": "8.5.2",
47
+ "@ai-sdk/mcp": "^2.0.10",
48
+ "@ai-sdk/openai": "4.0.10",
50
49
  "@vscode/ripgrep": "1.18.0",
51
- "ai": "6.0.208",
50
+ "ai": "7.0.19",
52
51
  "cli-highlight": "2.1.11",
53
52
  "commander": "15.0.0",
54
- "defuddle": "^0.19.0",
55
- "fs-extra": "11.3.5",
53
+ "defuddle": "^0.19.1",
54
+ "fs-extra": "11.3.6",
56
55
  "ink": "7.1.0",
57
56
  "ink-spinner": "5.0.0",
58
- "linkedom": "^0.18.12",
59
- "marked": "18.0.5",
57
+ "linkedom": "^0.18.13",
58
+ "marked": "18.0.6",
60
59
  "react": "19.2.7",
61
60
  "strip-ansi": "7.2.0",
62
61
  "turndown": "^7.2.4",
@@ -66,13 +65,13 @@
66
65
  "devDependencies": {
67
66
  "@eslint/js": "^10.0.1",
68
67
  "@types/fs-extra": "11.0.4",
69
- "@types/node": "26.0.0",
68
+ "@types/node": "26.1.1",
70
69
  "@types/react": "19.2.17",
71
- "eslint": "^10.5.0",
72
- "tsx": "4.22.4",
70
+ "eslint": "^10.6.0",
71
+ "tsx": "4.23.0",
73
72
  "typescript": "6.0.3",
74
- "typescript-eslint": "^8.61.1",
75
- "vitest": "^4.1.9"
73
+ "typescript-eslint": "^8.63.0",
74
+ "vitest": "^4.1.10"
76
75
  },
77
76
  "allowScripts": {
78
77
  "esbuild@0.28.1": true,