@denizokcu/haze 0.7.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 (48) hide show
  1. package/CHANGELOG.md +24 -8
  2. package/README.md +31 -31
  3. package/dist/cli/chat/inputSuggestions.js +2 -2
  4. package/dist/cli/commands/chat.js +46 -20
  5. package/dist/cli/commands/chatModes.js +1 -1
  6. package/dist/cli/commands/commandHelp.js +2 -2
  7. package/dist/cli/commands/formatters.d.ts +6 -0
  8. package/dist/cli/commands/formatters.js +38 -0
  9. package/dist/cli/commands/streaming.js +34 -23
  10. package/dist/cli/commands/wizardSuggestions.js +1 -1
  11. package/dist/config/providers.js +5 -9
  12. package/dist/config/settings.d.ts +1 -0
  13. package/dist/config/settings.js +54 -2
  14. package/dist/core/agent/compaction.js +2 -2
  15. package/dist/core/agent/errors.js +1 -1
  16. package/dist/core/agent/requestAssembly.d.ts +1 -0
  17. package/dist/core/agent/requestAssembly.js +13 -0
  18. package/dist/core/bashOutput/registry.js +11 -9
  19. package/dist/core/goal/completionPolicy.js +1 -1
  20. package/dist/core/subagent/subagentRunner.d.ts +252 -9
  21. package/dist/core/subagent/subagentRunner.js +13 -18
  22. package/dist/core/toolOutput/reduction.d.ts +2 -0
  23. package/dist/core/toolOutput/reduction.js +12 -0
  24. package/dist/core/validation/outputParser.js +5 -3
  25. package/dist/llm/client.d.ts +2 -2
  26. package/dist/llm/client.js +15 -2
  27. package/dist/llm/hazeTools.d.ts +7709 -364
  28. package/dist/llm/hazeTools.js +7 -1
  29. package/dist/llm/initPrompt.js +1 -1
  30. package/dist/llm/lsp.js +10 -1
  31. package/dist/llm/lspTools.d.ts +2310 -101
  32. package/dist/llm/systemPrompt.js +2 -2
  33. package/dist/llm/tools/bashTool.d.ts +251 -5
  34. package/dist/llm/tools/bashTool.js +4 -3
  35. package/dist/llm/tools/fetchTool.d.ts +1201 -65
  36. package/dist/llm/tools/fetchTool.js +2 -1
  37. package/dist/llm/tools/storedOutputTool.d.ts +351 -10
  38. package/dist/llm/tools/taskTool.d.ts +629 -28
  39. package/dist/llm/tools/toolContext.d.ts +7 -2
  40. package/dist/llm/tools/toolContext.js +11 -2
  41. package/dist/llm/webFetch.js +31 -21
  42. package/dist/skills/builder/SkillBuilder.js +7 -7
  43. package/dist/ui/components/TextInput.d.ts +7 -0
  44. package/dist/ui/components/TextInput.js +10 -0
  45. package/dist/utils/modelName.d.ts +2 -0
  46. package/dist/utils/modelName.js +15 -0
  47. package/examples/skills/files/SKILL.md +1 -1
  48. package/package.json +14 -14
@@ -15,7 +15,7 @@ import { HazeToolError, structuredToolFailure } from './tools/failures.js';
15
15
  import { compactGrepMatches, renderGrepMatches } from './tools/outputCap.js';
16
16
  import { parseRipgrepJsonStream } from './tools/grepParse.js';
17
17
  import { findEditRange, splitDiffLines, lineNumberAtOffset, replacementDiff } from './tools/editMatch.js';
18
- import { runDedupedTool, discoverScopedContext, withScopedContext } from './tools/toolContext.js';
18
+ import { runDedupedTool, discoverScopedContext, withScopedContext, hazeToolContextSchema } from './tools/toolContext.js';
19
19
  import { prepareWorkspaceExisting, prepareWorkspaceMutation, prepareWorkspaceRead, prepareWorkspaceWritePath } from './tools/workspaceFile.js';
20
20
  import { fetchTool } from './tools/fetchTool.js';
21
21
  import { bashTool } from './tools/bashTool.js';
@@ -24,6 +24,7 @@ const execFile = promisify(execFileCallback);
24
24
  export const hazeTools = {
25
25
  listFiles: tool({
26
26
  description: 'List workspace files/directories with pagination. Prefer this to bash for discovery.',
27
+ contextSchema: hazeToolContextSchema,
27
28
  inputSchema: z.object({
28
29
  path: z.string().default('.').describe('Directory path relative to the current workspace'),
29
30
  recursive: z.boolean().default(false).describe('Whether to list files recursively'),
@@ -70,6 +71,7 @@ export const hazeTools = {
70
71
  }),
71
72
  readFile: tool({
72
73
  description: 'Read numbered lines from a UTF-8 workspace file. Defaults to exact mode; outline mode is for discovery only and must be followed by exact reads before editing.',
74
+ contextSchema: hazeToolContextSchema,
73
75
  inputSchema: z.object({
74
76
  path: z.string().describe('File path relative to the current workspace'),
75
77
  offset: z.number().int().positive().optional().describe('1-based line number to start reading from'),
@@ -138,6 +140,7 @@ export const hazeTools = {
138
140
  }),
139
141
  grep: tool({
140
142
  description: 'Regex search workspace files with structured, globally capped results. Prefer this to reading files one by one.',
143
+ contextSchema: hazeToolContextSchema,
141
144
  inputSchema: z.object({
142
145
  pattern: z.string().min(1).describe('Regex pattern'),
143
146
  path: z.string().default('.').describe('Workspace-relative file or directory'),
@@ -216,6 +219,7 @@ export const hazeTools = {
216
219
  }),
217
220
  replaceLines: tool({
218
221
  description: 'Replace a 1-based inclusive line range. Use after readFile when exact editFile text is ambiguous or stale.',
222
+ contextSchema: hazeToolContextSchema,
219
223
  inputSchema: z.object({
220
224
  path: z.string().describe('File path relative to the current workspace'),
221
225
  startLine: z.number().int().positive().describe('First 1-based line number to replace'),
@@ -264,6 +268,7 @@ export const hazeTools = {
264
268
  }),
265
269
  writeFile: tool({
266
270
  description: 'Create a UTF-8 file. Existing files require explicit full-rewrite approval.',
271
+ contextSchema: hazeToolContextSchema,
267
272
  inputSchema: z.object({
268
273
  path: z.string().describe('File path relative to the current workspace'),
269
274
  content: z.string().describe('Complete file contents to write'),
@@ -299,6 +304,7 @@ export const hazeTools = {
299
304
  }),
300
305
  editFile: tool({
301
306
  description: 'Apply unique text replacements. Batch same-file edits; reread and use replaceLines if matching fails.',
307
+ contextSchema: hazeToolContextSchema,
302
308
  inputSchema: z.object({
303
309
  path: z.string().describe('File path relative to the current workspace'),
304
310
  edits: z.array(z.object({
@@ -1,6 +1,6 @@
1
1
  import { MAX_CONTEXT_FILE_CHARS } from '../config/contextFiles.js';
2
2
  export function buildInitPrompt() {
3
- return `Initialize this repository for Haze by creating a best-practice AGENTS.md file.
3
+ return `Initialize this repository for haze by creating a best-practice AGENTS.md file.
4
4
 
5
5
  Explore the codebase first, respecting .gitignore, but keep this quick and minimal:
6
6
  1. Start with exactly one listFiles call from the workspace root. Do not announce that you are starting before the tool call.
package/dist/llm/lsp.js CHANGED
@@ -92,7 +92,16 @@ export class StdioLspClient {
92
92
  constructor(server, child) {
93
93
  this.server = server;
94
94
  this.child = child;
95
- child.stdout.on('data', chunk => this.onData(chunk));
95
+ child.stdout.on('data', chunk => {
96
+ try {
97
+ this.onData(chunk);
98
+ }
99
+ catch (error) {
100
+ const lspError = error instanceof Error ? error : new LspError(String(error));
101
+ this.rejectAll(lspError);
102
+ this.child.kill('SIGTERM');
103
+ }
104
+ });
96
105
  child.stderr.on('data', () => undefined);
97
106
  child.on('error', error => this.rejectAll(error instanceof Error ? error : new Error(String(error))));
98
107
  child.on('exit', code => this.rejectAll(new LspError(`LSP server exited${code == null ? '' : ` with code ${code}`}`)));