@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
@@ -18,7 +18,7 @@ export function buildSystemPrompt(contextFiles = [], session, options = {}) {
18
18
  const mcpToolRule = options.mcpAvailable
19
19
  ? '- MCP server tools (e.g. Context7 docs lookup) are available when configured via /mcp. They extend the toolset with external capabilities; use them when the user asks for up-to-date docs or library info those tools expose, instead of guessing from memory.\n'
20
20
  : '';
21
- return `You are Haze, an autonomous coding assistant in a terminal. Infer the requested outcome, inspect only what is relevant, make the smallest correct change, validate it when practical, and report status honestly.
21
+ return `You are haze, an autonomous coding assistant in a terminal. Infer the requested outcome, inspect only what is relevant, make the smallest correct change, validate it when practical, and report status honestly.
22
22
 
23
23
  ## Operating rules
24
24
  - Action request: continue through inspection, edits, and relevant validation. Do not stop at a plan.
@@ -39,7 +39,7 @@ ${lspToolRule}${mcpToolRule}- grep locates text patterns and non-semantic matche
39
39
  - Ignored files require explicit need. Keep file mutations separate from validation commands when practical.
40
40
  - File tools may surface scoped AGENTS.md/CLAUDE.md instructions for the target path. Review newly surfaced instructions before mutating that path; prefer the more specific path, and at the same scope AGENTS.md overrides CLAUDE.md.
41
41
  - Batch independent tool calls in a single step (e.g. multiple writeFile or read operations that don't depend on each other). Do not narrate each call with phrases like "Now let me X" or "Next, I'll Y" — emit the tool calls directly. Reserve prose for non-obvious decisions, blockers, or final summaries.
42
- - When the tool set is narrowed (activeTools) or tools are removed (toolChoice: none), Haze is steering recovery or preventing a loop; the constraint is intentional. Do not emit tool-call syntax (XML, JSON, or angle-bracket blocks) as text. If forced to stop mid-task, summarize current-turn changes and validation evidence, then state the single next concrete unfinished action so Haze can continue in a fresh step.
42
+ - When the tool set is narrowed (activeTools) or tools are removed (toolChoice: none), haze is steering recovery or preventing a loop; the constraint is intentional. Do not emit tool-call syntax (XML, JSON, or angle-bracket blocks) as text. If forced to stop mid-task, summarize current-turn changes and validation evidence, then state the single next concrete unfinished action so haze can continue in a fresh step.
43
43
 
44
44
  ## Completion
45
45
  - After edits, run the smallest relevant test, typecheck, lint, or build command you can identify.
@@ -1,5 +1,251 @@
1
- export declare const bashTool: import("ai").Tool<{
2
- command: string;
3
- allowMutation: boolean;
4
- timeoutSeconds?: number | undefined;
5
- }, unknown>;
1
+ export declare const bashTool: ({
2
+ title?: string;
3
+ providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
4
+ metadata?: import("@ai-sdk/provider").JSONObject;
5
+ inputSchema: import("ai").FlexibleSchema<{
6
+ command: string;
7
+ allowMutation: boolean;
8
+ timeoutSeconds?: number | undefined;
9
+ }>;
10
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
11
+ needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
12
+ command: string;
13
+ allowMutation: boolean;
14
+ timeoutSeconds?: number | undefined;
15
+ }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
16
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
17
+ onInputDelta?: ((options: {
18
+ inputTextDelta: string;
19
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
20
+ onInputAvailable?: ((options: {
21
+ input: {
22
+ command: string;
23
+ allowMutation: boolean;
24
+ timeoutSeconds?: number | undefined;
25
+ };
26
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
27
+ toModelOutput?: ((options: {
28
+ toolCallId: string;
29
+ input: {
30
+ command: string;
31
+ allowMutation: boolean;
32
+ timeoutSeconds?: number | undefined;
33
+ };
34
+ output: unknown;
35
+ }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
36
+ } & {
37
+ outputSchema?: import("ai").FlexibleSchema<unknown> | undefined;
38
+ execute: import("ai").ToolExecuteFunction<{
39
+ command: string;
40
+ allowMutation: boolean;
41
+ timeoutSeconds?: number | undefined;
42
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
43
+ } & {
44
+ description?: string | ((options: {
45
+ context: NoInfer<import("./toolContext.js").HazeToolContext>;
46
+ experimental_sandbox?: import("ai").Experimental_SandboxSession;
47
+ }) => string) | undefined;
48
+ strict?: boolean;
49
+ inputExamples?: {
50
+ input: NoInfer<{
51
+ command: string;
52
+ allowMutation: boolean;
53
+ timeoutSeconds?: number | undefined;
54
+ }>;
55
+ }[] | undefined;
56
+ id?: never;
57
+ isProviderExecuted?: never;
58
+ args?: never;
59
+ supportsDeferredResults?: never;
60
+ } & {
61
+ type?: undefined | "function";
62
+ } & {
63
+ execute: import("ai").ToolExecuteFunction<{
64
+ command: string;
65
+ allowMutation: boolean;
66
+ timeoutSeconds?: number | undefined;
67
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
68
+ }) | ({
69
+ title?: string;
70
+ providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
71
+ metadata?: import("@ai-sdk/provider").JSONObject;
72
+ inputSchema: import("ai").FlexibleSchema<{
73
+ command: string;
74
+ allowMutation: boolean;
75
+ timeoutSeconds?: number | undefined;
76
+ }>;
77
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
78
+ needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
79
+ command: string;
80
+ allowMutation: boolean;
81
+ timeoutSeconds?: number | undefined;
82
+ }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
83
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
84
+ onInputDelta?: ((options: {
85
+ inputTextDelta: string;
86
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
87
+ onInputAvailable?: ((options: {
88
+ input: {
89
+ command: string;
90
+ allowMutation: boolean;
91
+ timeoutSeconds?: number | undefined;
92
+ };
93
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
94
+ toModelOutput?: ((options: {
95
+ toolCallId: string;
96
+ input: {
97
+ command: string;
98
+ allowMutation: boolean;
99
+ timeoutSeconds?: number | undefined;
100
+ };
101
+ output: unknown;
102
+ }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
103
+ } & {
104
+ outputSchema?: import("ai").FlexibleSchema<unknown> | undefined;
105
+ execute: import("ai").ToolExecuteFunction<{
106
+ command: string;
107
+ allowMutation: boolean;
108
+ timeoutSeconds?: number | undefined;
109
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
110
+ } & {
111
+ description?: string | ((options: {
112
+ context: NoInfer<import("./toolContext.js").HazeToolContext>;
113
+ experimental_sandbox?: import("ai").Experimental_SandboxSession;
114
+ }) => string) | undefined;
115
+ strict?: boolean;
116
+ inputExamples?: {
117
+ input: NoInfer<{
118
+ command: string;
119
+ allowMutation: boolean;
120
+ timeoutSeconds?: number | undefined;
121
+ }>;
122
+ }[] | undefined;
123
+ id?: never;
124
+ isProviderExecuted?: never;
125
+ args?: never;
126
+ supportsDeferredResults?: never;
127
+ } & {
128
+ type: "dynamic";
129
+ } & {
130
+ execute: import("ai").ToolExecuteFunction<{
131
+ command: string;
132
+ allowMutation: boolean;
133
+ timeoutSeconds?: number | undefined;
134
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
135
+ }) | ({
136
+ title?: string;
137
+ providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
138
+ metadata?: import("@ai-sdk/provider").JSONObject;
139
+ inputSchema: import("ai").FlexibleSchema<{
140
+ command: string;
141
+ allowMutation: boolean;
142
+ timeoutSeconds?: number | undefined;
143
+ }>;
144
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
145
+ needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
146
+ command: string;
147
+ allowMutation: boolean;
148
+ timeoutSeconds?: number | undefined;
149
+ }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
150
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
151
+ onInputDelta?: ((options: {
152
+ inputTextDelta: string;
153
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
154
+ onInputAvailable?: ((options: {
155
+ input: {
156
+ command: string;
157
+ allowMutation: boolean;
158
+ timeoutSeconds?: number | undefined;
159
+ };
160
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
161
+ toModelOutput?: ((options: {
162
+ toolCallId: string;
163
+ input: {
164
+ command: string;
165
+ allowMutation: boolean;
166
+ timeoutSeconds?: number | undefined;
167
+ };
168
+ output: unknown;
169
+ }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
170
+ } & {
171
+ outputSchema?: import("ai").FlexibleSchema<unknown> | undefined;
172
+ execute: import("ai").ToolExecuteFunction<{
173
+ command: string;
174
+ allowMutation: boolean;
175
+ timeoutSeconds?: number | undefined;
176
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
177
+ } & {
178
+ type: "provider";
179
+ id: `${string}.${string}`;
180
+ args: Record<string, unknown>;
181
+ description?: never;
182
+ strict?: never;
183
+ inputExamples?: never;
184
+ } & {
185
+ isProviderExecuted: false;
186
+ supportsDeferredResults?: never;
187
+ } & {
188
+ execute: import("ai").ToolExecuteFunction<{
189
+ command: string;
190
+ allowMutation: boolean;
191
+ timeoutSeconds?: number | undefined;
192
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
193
+ }) | ({
194
+ title?: string;
195
+ providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
196
+ metadata?: import("@ai-sdk/provider").JSONObject;
197
+ inputSchema: import("ai").FlexibleSchema<{
198
+ command: string;
199
+ allowMutation: boolean;
200
+ timeoutSeconds?: number | undefined;
201
+ }>;
202
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
203
+ needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
204
+ command: string;
205
+ allowMutation: boolean;
206
+ timeoutSeconds?: number | undefined;
207
+ }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
208
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
209
+ onInputDelta?: ((options: {
210
+ inputTextDelta: string;
211
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
212
+ onInputAvailable?: ((options: {
213
+ input: {
214
+ command: string;
215
+ allowMutation: boolean;
216
+ timeoutSeconds?: number | undefined;
217
+ };
218
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
219
+ toModelOutput?: ((options: {
220
+ toolCallId: string;
221
+ input: {
222
+ command: string;
223
+ allowMutation: boolean;
224
+ timeoutSeconds?: number | undefined;
225
+ };
226
+ output: unknown;
227
+ }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
228
+ } & {
229
+ outputSchema?: import("ai").FlexibleSchema<unknown> | undefined;
230
+ execute: import("ai").ToolExecuteFunction<{
231
+ command: string;
232
+ allowMutation: boolean;
233
+ timeoutSeconds?: number | undefined;
234
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
235
+ } & {
236
+ type: "provider";
237
+ id: `${string}.${string}`;
238
+ args: Record<string, unknown>;
239
+ description?: never;
240
+ strict?: never;
241
+ inputExamples?: never;
242
+ } & {
243
+ isProviderExecuted: true;
244
+ supportsDeferredResults?: boolean;
245
+ } & {
246
+ execute: import("ai").ToolExecuteFunction<{
247
+ command: string;
248
+ allowMutation: boolean;
249
+ timeoutSeconds?: number | undefined;
250
+ }, unknown, NoInfer<import("./toolContext.js").HazeToolContext>>;
251
+ });
@@ -7,16 +7,17 @@ import { filterBashOutput } from '../../core/bashOutput/registry.js';
7
7
  import { storeToolOutput } from '../../core/agent/toolOutputStore.js';
8
8
  import { workspaceRoot } from '../../utils/path.js';
9
9
  import { compactStoredOutput, COMPACT_COMMAND_CHARS } from './outputCap.js';
10
- import { runDedupedTool } from './toolContext.js';
10
+ import { hazeToolContextSchema, runDedupedTool } from './toolContext.js';
11
11
  const SHORT_VALIDATION_CHARS = 2_000;
12
12
  export const bashTool = tool({
13
- description: 'Run workspace tests, builds, validation, or inspection. Use file tools for edits.',
13
+ description: 'Run workspace tests, builds, validation, or inspection. Risk classification is informational; use file tools for edits.',
14
+ contextSchema: hazeToolContextSchema,
14
15
  inputSchema: z.object({
15
16
  command: z.string().min(1).describe('Command to execute with bash -lc'),
16
17
  timeoutSeconds: z.number().int().positive().max(600).optional().describe('Timeout in seconds; defaults to 60'),
17
18
  allowMutation: z.boolean().default(false).describe('Deprecated compatibility flag. Commands run without confirmation; retained for compatibility.'),
18
19
  }),
19
- execute: async ({ command, timeoutSeconds, allowMutation }, context) => runDedupedTool('bash', { command, timeoutSeconds, allowMutation }, context, async () => {
20
+ execute: async ({ command, timeoutSeconds }, context) => runDedupedTool('bash', { command, timeoutSeconds }, context, async () => {
20
21
  const cwd = workspaceRoot();
21
22
  const classification = classifyBashCommand(command);
22
23
  const timeoutMs = (timeoutSeconds ?? 60) * 1000;