@denizokcu/haze 0.10.0 → 0.11.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 (169) hide show
  1. package/CHANGELOG.md +77 -1
  2. package/README.md +66 -25
  3. package/SECURITY.md +22 -0
  4. package/bin/haze.js +102 -1
  5. package/dist/buildInfo.json +7 -0
  6. package/dist/cli/chat/TaskBar.d.ts +2 -1
  7. package/dist/cli/chat/TaskBar.js +7 -4
  8. package/dist/cli/chat/contextReport.js +2 -0
  9. package/dist/cli/chat/fileMentionSuggestions.js +3 -2
  10. package/dist/cli/chat/liveRegion.d.ts +25 -0
  11. package/dist/cli/chat/liveRegion.js +48 -0
  12. package/dist/cli/chat/messages.d.ts +33 -2
  13. package/dist/cli/chat/messages.js +216 -33
  14. package/dist/cli/chat/sessionLifecycle.d.ts +9 -0
  15. package/dist/cli/chat/sessionLifecycle.js +64 -14
  16. package/dist/cli/chat/sessionRecorder.js +75 -7
  17. package/dist/cli/chat/startupInfo.d.ts +0 -1
  18. package/dist/cli/chat/startupInfo.js +11 -15
  19. package/dist/cli/chat/wizardDispatch.js +111 -12
  20. package/dist/cli/commands/chat.d.ts +5 -0
  21. package/dist/cli/commands/chat.js +203 -101
  22. package/dist/cli/commands/commands.d.ts +2 -0
  23. package/dist/cli/commands/commands.js +10 -5
  24. package/dist/cli/commands/doctor.d.ts +19 -0
  25. package/dist/cli/commands/doctor.js +76 -0
  26. package/dist/cli/commands/formatters.js +2 -0
  27. package/dist/cli/commands/ndjsonSink.d.ts +23 -0
  28. package/dist/cli/commands/ndjsonSink.js +38 -0
  29. package/dist/cli/commands/providerWizard.d.ts +9 -2
  30. package/dist/cli/commands/providerWizard.js +37 -4
  31. package/dist/cli/commands/runCommand.d.ts +3 -0
  32. package/dist/cli/commands/runCommand.js +117 -11
  33. package/dist/cli/commands/streaming/abortCause.d.ts +24 -0
  34. package/dist/cli/commands/streaming/abortCause.js +16 -0
  35. package/dist/cli/commands/streaming/assistantText.js +9 -2
  36. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +65 -0
  37. package/dist/cli/commands/streaming/goalCheckpoint.js +23 -0
  38. package/dist/cli/commands/streaming/goalSupervisor.d.ts +64 -0
  39. package/dist/cli/commands/streaming/goalSupervisor.js +127 -0
  40. package/dist/cli/commands/streaming/toolCallRecovery.d.ts +2 -0
  41. package/dist/cli/commands/streaming/toolCallRecovery.js +24 -0
  42. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +29 -0
  43. package/dist/cli/commands/streaming/toolGroupRenderer.js +50 -4
  44. package/dist/cli/commands/streaming/toolResultState.d.ts +6 -1
  45. package/dist/cli/commands/streaming/toolResultState.js +29 -7
  46. package/dist/cli/commands/streaming/turnOutcome.d.ts +17 -0
  47. package/dist/cli/commands/streaming/turnOutcome.js +27 -11
  48. package/dist/cli/commands/streaming.d.ts +70 -3
  49. package/dist/cli/commands/streaming.js +491 -77
  50. package/dist/cli/commands/wizardActions.d.ts +1 -0
  51. package/dist/cli/commands/wizardActions.js +1 -0
  52. package/dist/cli/commands/wizardPrompts.js +7 -1
  53. package/dist/cli/commands/wizardSuggestions.js +5 -3
  54. package/dist/cli/index.js +68 -22
  55. package/dist/cli/terminalTitle.js +1 -1
  56. package/dist/config/modelDiscovery.d.ts +51 -0
  57. package/dist/config/modelDiscovery.js +164 -1
  58. package/dist/config/privateStorage.js +28 -2
  59. package/dist/config/providerAuth.d.ts +14 -0
  60. package/dist/config/providerAuth.js +49 -0
  61. package/dist/config/providerPresets.d.ts +39 -7
  62. package/dist/config/providerPresets.js +371 -100
  63. package/dist/config/providers.js +2 -0
  64. package/dist/config/settings.d.ts +36 -0
  65. package/dist/config/settings.js +9 -0
  66. package/dist/core/agent/budgets.d.ts +10 -0
  67. package/dist/core/agent/budgets.js +10 -0
  68. package/dist/core/agent/compaction.d.ts +38 -0
  69. package/dist/core/agent/compaction.js +92 -17
  70. package/dist/core/agent/completionController.d.ts +230 -0
  71. package/dist/core/agent/completionController.js +287 -0
  72. package/dist/core/agent/contextBudget.d.ts +38 -0
  73. package/dist/core/agent/contextBudget.js +60 -7
  74. package/dist/core/agent/events.d.ts +74 -0
  75. package/dist/core/agent/reasoningPolicy.d.ts +31 -0
  76. package/dist/core/agent/reasoningPolicy.js +27 -0
  77. package/dist/core/agent/toolCapabilities.d.ts +27 -0
  78. package/dist/core/agent/toolCapabilities.js +58 -0
  79. package/dist/core/agent/toolExecutionBudget.d.ts +35 -0
  80. package/dist/core/agent/toolExecutionBudget.js +49 -0
  81. package/dist/core/agent/toolOutputStore.d.ts +8 -0
  82. package/dist/core/agent/toolOutputStore.js +10 -10
  83. package/dist/core/agent/toolResults.d.ts +12 -0
  84. package/dist/core/agent/toolResults.js +38 -0
  85. package/dist/core/agent/turnBudget.d.ts +35 -0
  86. package/dist/core/agent/turnBudget.js +27 -0
  87. package/dist/core/agent/turnPolicy.d.ts +11 -0
  88. package/dist/core/agent/turnPolicy.js +19 -0
  89. package/dist/core/agent/workState.d.ts +75 -0
  90. package/dist/core/agent/workState.js +120 -9
  91. package/dist/core/deadline.d.ts +33 -0
  92. package/dist/core/deadline.js +74 -0
  93. package/dist/core/goal/completionPolicy.d.ts +27 -0
  94. package/dist/core/goal/completionPolicy.js +37 -1
  95. package/dist/core/limits/byteBudgets.d.ts +2 -0
  96. package/dist/core/limits/byteBudgets.js +2 -0
  97. package/dist/core/limits/textBudgets.d.ts +2 -0
  98. package/dist/core/limits/textBudgets.js +2 -0
  99. package/dist/core/log/llmLog.js +7 -0
  100. package/dist/core/persistence/orderedFileWriter.d.ts +10 -0
  101. package/dist/core/persistence/orderedFileWriter.js +16 -2
  102. package/dist/core/process/backgroundRegistry.js +8 -7
  103. package/dist/core/process/runBoundedProcess.d.ts +8 -2
  104. package/dist/core/process/runBoundedProcess.js +15 -6
  105. package/dist/core/safety/missingExecutable.d.ts +42 -0
  106. package/dist/core/safety/missingExecutable.js +77 -0
  107. package/dist/core/session/sessionStore.d.ts +37 -0
  108. package/dist/core/session/sessionStore.js +215 -51
  109. package/dist/core/subagent/contracts.d.ts +4 -0
  110. package/dist/core/subagent/contracts.js +1 -0
  111. package/dist/core/subagent/subagentCoordinator.d.ts +4 -0
  112. package/dist/core/subagent/subagentCoordinator.js +32 -2
  113. package/dist/core/subagent/subagentRunner.js +17 -37
  114. package/dist/llm/client.d.ts +17 -1
  115. package/dist/llm/client.js +82 -14
  116. package/dist/llm/hazeTools.d.ts +554 -80
  117. package/dist/llm/hazeTools.js +103 -24
  118. package/dist/llm/lsp.d.ts +24 -4
  119. package/dist/llm/lsp.js +72 -11
  120. package/dist/llm/lspTools.d.ts +2366 -0
  121. package/dist/llm/lspTools.js +87 -79
  122. package/dist/llm/openaiCodex.d.ts +3 -0
  123. package/dist/llm/openaiCodex.js +47 -0
  124. package/dist/llm/openaiCodexOAuth.d.ts +54 -0
  125. package/dist/llm/openaiCodexOAuth.js +214 -0
  126. package/dist/llm/requestContext.d.ts +3 -0
  127. package/dist/llm/requestContext.js +7 -4
  128. package/dist/llm/systemPrompt.d.ts +11 -0
  129. package/dist/llm/systemPrompt.js +12 -6
  130. package/dist/llm/toolResultTypes.d.ts +8 -1
  131. package/dist/llm/tools/bashTool.d.ts +48 -16
  132. package/dist/llm/tools/bashTool.js +5 -0
  133. package/dist/llm/tools/editMatch.d.ts +14 -0
  134. package/dist/llm/tools/editMatch.js +72 -0
  135. package/dist/llm/tools/failures.d.ts +2 -0
  136. package/dist/llm/tools/failures.js +1 -0
  137. package/dist/llm/tools/fetchTool.d.ts +16 -0
  138. package/dist/llm/tools/fileToolShared.d.ts +4 -3
  139. package/dist/llm/tools/fileToolShared.js +16 -21
  140. package/dist/llm/tools/gitIgnore.d.ts +49 -0
  141. package/dist/llm/tools/gitIgnore.js +129 -0
  142. package/dist/llm/tools/readRecovery.d.ts +10 -0
  143. package/dist/llm/tools/readRecovery.js +135 -0
  144. package/dist/llm/tools/toolContext.d.ts +1 -1
  145. package/dist/llm/tools/toolContext.js +61 -32
  146. package/dist/llm/webFetch.d.ts +17 -0
  147. package/dist/llm/webFetch.js +64 -97
  148. package/dist/ui/codeHighlight.d.ts +4 -0
  149. package/dist/ui/codeHighlight.js +31 -0
  150. package/dist/ui/components/Header.d.ts +1 -1
  151. package/dist/ui/components/MarkdownText.d.ts +16 -2
  152. package/dist/ui/components/MarkdownText.js +244 -34
  153. package/dist/ui/components/TextInput.d.ts +8 -1
  154. package/dist/ui/components/TextInput.js +6 -2
  155. package/dist/ui/theme.d.ts +4 -3
  156. package/dist/ui/theme.js +5 -4
  157. package/dist/utils/buildInfo.d.ts +104 -0
  158. package/dist/utils/buildInfo.js +253 -0
  159. package/dist/utils/fs.d.ts +9 -0
  160. package/dist/utils/fs.js +87 -25
  161. package/dist/utils/openPath.d.ts +2 -2
  162. package/dist/utils/openPath.js +19 -6
  163. package/dist/utils/path.d.ts +2 -0
  164. package/dist/utils/path.js +5 -1
  165. package/dist/utils/utf8.d.ts +22 -0
  166. package/dist/utils/utf8.js +54 -0
  167. package/dist/utils/version.d.ts +9 -3
  168. package/dist/utils/version.js +28 -2
  169. package/package.json +24 -19
@@ -1,9 +1,15 @@
1
- export type ToolFailureReasonCode = 'old_text_missing' | 'old_text_not_unique' | 'overlapping_edits' | 'ignored_path' | 'existing_file_requires_overwrite' | 'invalid_line_range' | 'io_error' | 'file_too_large' | 'blocked_url' | 'background_limit' | 'background_not_allowed' | 'process_id_required' | 'process_not_found' | 'process_already_exited' | 'process_kill_failed' | 'output_expired' | 'aborted' | 'scoped_instructions_discovered';
1
+ export type ToolFailureReasonCode = 'old_text_missing' | 'old_text_not_unique' | 'overlapping_edits' | 'ignored_path' | 'ignore_check_unavailable' | 'path_not_found' | 'not_a_file' | 'permission_denied' | 'outside_workspace' | 'binary_file' | 'existing_file_requires_overwrite' | 'write_chunk_too_large' | 'conflicting_write_modes' | 'append_target_missing' | 'invalid_line_range' | 'io_error' | 'file_too_large' | 'blocked_url' | 'background_limit' | 'background_not_allowed' | 'process_id_required' | 'process_not_found' | 'process_already_exited' | 'process_kill_failed' | 'output_expired' | 'aborted' | 'missing_executable' | 'scoped_instructions_discovered';
2
2
  export type ToolDiffLine = {
3
3
  type: 'add' | 'remove' | 'context';
4
4
  oldLine?: number;
5
5
  newLine?: number;
6
6
  text: string;
7
+ } | {
8
+ type: 'gap';
9
+ omittedLines: number;
10
+ } | {
11
+ type: 'meta';
12
+ text: string;
7
13
  };
8
14
  export type ValidationKind = 'test' | 'typecheck' | 'lint' | 'build' | 'generic';
9
15
  export type ValidationSummary = {
@@ -32,6 +38,7 @@ export type StructuredToolFailure = {
32
38
  suggestedNextStep: string;
33
39
  recoveryTool?: string;
34
40
  recoveryInput?: unknown;
41
+ suggestedPaths?: string[];
35
42
  };
36
43
  export declare function isObject(value: unknown): value is Record<string, unknown>;
37
44
  export declare function isStructuredToolFailure(value: unknown): value is StructuredToolFailure;
@@ -81,6 +81,9 @@ export declare const bashTool: ({
81
81
  suggestedNextStep: string;
82
82
  } | {
83
83
  error?: string | undefined;
84
+ missingExecutableStep?: string | undefined;
85
+ reasonCode?: "missing_executable" | undefined;
86
+ missingExecutable?: string | undefined;
84
87
  ok: boolean;
85
88
  code: number | null;
86
89
  command: string;
@@ -104,7 +107,6 @@ export declare const bashTool: ({
104
107
  retainedBytes: number;
105
108
  omittedBytes: number;
106
109
  };
107
- reasonCode?: undefined;
108
110
  recoverable?: undefined;
109
111
  suggestedNextStep?: undefined;
110
112
  background?: undefined;
@@ -157,6 +159,9 @@ export declare const bashTool: ({
157
159
  suggestedNextStep: string;
158
160
  } | {
159
161
  error?: string | undefined;
162
+ missingExecutableStep?: string | undefined;
163
+ reasonCode?: "missing_executable" | undefined;
164
+ missingExecutable?: string | undefined;
160
165
  ok: boolean;
161
166
  code: number | null;
162
167
  command: string;
@@ -180,7 +185,6 @@ export declare const bashTool: ({
180
185
  retainedBytes: number;
181
186
  omittedBytes: number;
182
187
  };
183
- reasonCode?: undefined;
184
188
  recoverable?: undefined;
185
189
  suggestedNextStep?: undefined;
186
190
  background?: undefined;
@@ -236,6 +240,9 @@ export declare const bashTool: ({
236
240
  suggestedNextStep: string;
237
241
  } | {
238
242
  error?: string | undefined;
243
+ missingExecutableStep?: string | undefined;
244
+ reasonCode?: "missing_executable" | undefined;
245
+ missingExecutable?: string | undefined;
239
246
  ok: boolean;
240
247
  code: number | null;
241
248
  command: string;
@@ -259,7 +266,6 @@ export declare const bashTool: ({
259
266
  retainedBytes: number;
260
267
  omittedBytes: number;
261
268
  };
262
- reasonCode?: undefined;
263
269
  recoverable?: undefined;
264
270
  suggestedNextStep?: undefined;
265
271
  background?: undefined;
@@ -336,6 +342,9 @@ export declare const bashTool: ({
336
342
  suggestedNextStep: string;
337
343
  } | {
338
344
  error?: string | undefined;
345
+ missingExecutableStep?: string | undefined;
346
+ reasonCode?: "missing_executable" | undefined;
347
+ missingExecutable?: string | undefined;
339
348
  ok: boolean;
340
349
  code: number | null;
341
350
  command: string;
@@ -359,7 +368,6 @@ export declare const bashTool: ({
359
368
  retainedBytes: number;
360
369
  omittedBytes: number;
361
370
  };
362
- reasonCode?: undefined;
363
371
  recoverable?: undefined;
364
372
  suggestedNextStep?: undefined;
365
373
  background?: undefined;
@@ -447,6 +455,9 @@ export declare const bashTool: ({
447
455
  suggestedNextStep: string;
448
456
  } | {
449
457
  error?: string | undefined;
458
+ missingExecutableStep?: string | undefined;
459
+ reasonCode?: "missing_executable" | undefined;
460
+ missingExecutable?: string | undefined;
450
461
  ok: boolean;
451
462
  code: number | null;
452
463
  command: string;
@@ -470,7 +481,6 @@ export declare const bashTool: ({
470
481
  retainedBytes: number;
471
482
  omittedBytes: number;
472
483
  };
473
- reasonCode?: undefined;
474
484
  recoverable?: undefined;
475
485
  suggestedNextStep?: undefined;
476
486
  background?: undefined;
@@ -523,6 +533,9 @@ export declare const bashTool: ({
523
533
  suggestedNextStep: string;
524
534
  } | {
525
535
  error?: string | undefined;
536
+ missingExecutableStep?: string | undefined;
537
+ reasonCode?: "missing_executable" | undefined;
538
+ missingExecutable?: string | undefined;
526
539
  ok: boolean;
527
540
  code: number | null;
528
541
  command: string;
@@ -546,7 +559,6 @@ export declare const bashTool: ({
546
559
  retainedBytes: number;
547
560
  omittedBytes: number;
548
561
  };
549
- reasonCode?: undefined;
550
562
  recoverable?: undefined;
551
563
  suggestedNextStep?: undefined;
552
564
  background?: undefined;
@@ -602,6 +614,9 @@ export declare const bashTool: ({
602
614
  suggestedNextStep: string;
603
615
  } | {
604
616
  error?: string | undefined;
617
+ missingExecutableStep?: string | undefined;
618
+ reasonCode?: "missing_executable" | undefined;
619
+ missingExecutable?: string | undefined;
605
620
  ok: boolean;
606
621
  code: number | null;
607
622
  command: string;
@@ -625,7 +640,6 @@ export declare const bashTool: ({
625
640
  retainedBytes: number;
626
641
  omittedBytes: number;
627
642
  };
628
- reasonCode?: undefined;
629
643
  recoverable?: undefined;
630
644
  suggestedNextStep?: undefined;
631
645
  background?: undefined;
@@ -702,6 +716,9 @@ export declare const bashTool: ({
702
716
  suggestedNextStep: string;
703
717
  } | {
704
718
  error?: string | undefined;
719
+ missingExecutableStep?: string | undefined;
720
+ reasonCode?: "missing_executable" | undefined;
721
+ missingExecutable?: string | undefined;
705
722
  ok: boolean;
706
723
  code: number | null;
707
724
  command: string;
@@ -725,7 +742,6 @@ export declare const bashTool: ({
725
742
  retainedBytes: number;
726
743
  omittedBytes: number;
727
744
  };
728
- reasonCode?: undefined;
729
745
  recoverable?: undefined;
730
746
  suggestedNextStep?: undefined;
731
747
  background?: undefined;
@@ -813,6 +829,9 @@ export declare const bashTool: ({
813
829
  suggestedNextStep: string;
814
830
  } | {
815
831
  error?: string | undefined;
832
+ missingExecutableStep?: string | undefined;
833
+ reasonCode?: "missing_executable" | undefined;
834
+ missingExecutable?: string | undefined;
816
835
  ok: boolean;
817
836
  code: number | null;
818
837
  command: string;
@@ -836,7 +855,6 @@ export declare const bashTool: ({
836
855
  retainedBytes: number;
837
856
  omittedBytes: number;
838
857
  };
839
- reasonCode?: undefined;
840
858
  recoverable?: undefined;
841
859
  suggestedNextStep?: undefined;
842
860
  background?: undefined;
@@ -889,6 +907,9 @@ export declare const bashTool: ({
889
907
  suggestedNextStep: string;
890
908
  } | {
891
909
  error?: string | undefined;
910
+ missingExecutableStep?: string | undefined;
911
+ reasonCode?: "missing_executable" | undefined;
912
+ missingExecutable?: string | undefined;
892
913
  ok: boolean;
893
914
  code: number | null;
894
915
  command: string;
@@ -912,7 +933,6 @@ export declare const bashTool: ({
912
933
  retainedBytes: number;
913
934
  omittedBytes: number;
914
935
  };
915
- reasonCode?: undefined;
916
936
  recoverable?: undefined;
917
937
  suggestedNextStep?: undefined;
918
938
  background?: undefined;
@@ -968,6 +988,9 @@ export declare const bashTool: ({
968
988
  suggestedNextStep: string;
969
989
  } | {
970
990
  error?: string | undefined;
991
+ missingExecutableStep?: string | undefined;
992
+ reasonCode?: "missing_executable" | undefined;
993
+ missingExecutable?: string | undefined;
971
994
  ok: boolean;
972
995
  code: number | null;
973
996
  command: string;
@@ -991,7 +1014,6 @@ export declare const bashTool: ({
991
1014
  retainedBytes: number;
992
1015
  omittedBytes: number;
993
1016
  };
994
- reasonCode?: undefined;
995
1017
  recoverable?: undefined;
996
1018
  suggestedNextStep?: undefined;
997
1019
  background?: undefined;
@@ -1058,6 +1080,9 @@ export declare const bashTool: ({
1058
1080
  suggestedNextStep: string;
1059
1081
  } | {
1060
1082
  error?: string | undefined;
1083
+ missingExecutableStep?: string | undefined;
1084
+ reasonCode?: "missing_executable" | undefined;
1085
+ missingExecutable?: string | undefined;
1061
1086
  ok: boolean;
1062
1087
  code: number | null;
1063
1088
  command: string;
@@ -1081,7 +1106,6 @@ export declare const bashTool: ({
1081
1106
  retainedBytes: number;
1082
1107
  omittedBytes: number;
1083
1108
  };
1084
- reasonCode?: undefined;
1085
1109
  recoverable?: undefined;
1086
1110
  suggestedNextStep?: undefined;
1087
1111
  background?: undefined;
@@ -1169,6 +1193,9 @@ export declare const bashTool: ({
1169
1193
  suggestedNextStep: string;
1170
1194
  } | {
1171
1195
  error?: string | undefined;
1196
+ missingExecutableStep?: string | undefined;
1197
+ reasonCode?: "missing_executable" | undefined;
1198
+ missingExecutable?: string | undefined;
1172
1199
  ok: boolean;
1173
1200
  code: number | null;
1174
1201
  command: string;
@@ -1192,7 +1219,6 @@ export declare const bashTool: ({
1192
1219
  retainedBytes: number;
1193
1220
  omittedBytes: number;
1194
1221
  };
1195
- reasonCode?: undefined;
1196
1222
  recoverable?: undefined;
1197
1223
  suggestedNextStep?: undefined;
1198
1224
  background?: undefined;
@@ -1245,6 +1271,9 @@ export declare const bashTool: ({
1245
1271
  suggestedNextStep: string;
1246
1272
  } | {
1247
1273
  error?: string | undefined;
1274
+ missingExecutableStep?: string | undefined;
1275
+ reasonCode?: "missing_executable" | undefined;
1276
+ missingExecutable?: string | undefined;
1248
1277
  ok: boolean;
1249
1278
  code: number | null;
1250
1279
  command: string;
@@ -1268,7 +1297,6 @@ export declare const bashTool: ({
1268
1297
  retainedBytes: number;
1269
1298
  omittedBytes: number;
1270
1299
  };
1271
- reasonCode?: undefined;
1272
1300
  recoverable?: undefined;
1273
1301
  suggestedNextStep?: undefined;
1274
1302
  background?: undefined;
@@ -1324,6 +1352,9 @@ export declare const bashTool: ({
1324
1352
  suggestedNextStep: string;
1325
1353
  } | {
1326
1354
  error?: string | undefined;
1355
+ missingExecutableStep?: string | undefined;
1356
+ reasonCode?: "missing_executable" | undefined;
1357
+ missingExecutable?: string | undefined;
1327
1358
  ok: boolean;
1328
1359
  code: number | null;
1329
1360
  command: string;
@@ -1347,7 +1378,6 @@ export declare const bashTool: ({
1347
1378
  retainedBytes: number;
1348
1379
  omittedBytes: number;
1349
1380
  };
1350
- reasonCode?: undefined;
1351
1381
  recoverable?: undefined;
1352
1382
  suggestedNextStep?: undefined;
1353
1383
  background?: undefined;
@@ -1414,6 +1444,9 @@ export declare const bashTool: ({
1414
1444
  suggestedNextStep: string;
1415
1445
  } | {
1416
1446
  error?: string | undefined;
1447
+ missingExecutableStep?: string | undefined;
1448
+ reasonCode?: "missing_executable" | undefined;
1449
+ missingExecutable?: string | undefined;
1417
1450
  ok: boolean;
1418
1451
  code: number | null;
1419
1452
  command: string;
@@ -1437,7 +1470,6 @@ export declare const bashTool: ({
1437
1470
  retainedBytes: number;
1438
1471
  omittedBytes: number;
1439
1472
  };
1440
- reasonCode?: undefined;
1441
1473
  recoverable?: undefined;
1442
1474
  suggestedNextStep?: undefined;
1443
1475
  background?: undefined;
@@ -1,6 +1,7 @@
1
1
  import { tool } from 'ai';
2
2
  import { z } from 'zod';
3
3
  import { classifyBashCommand, isValidationClassification } from '../../core/safety/bashClassifier.js';
4
+ import { detectMissingExecutable, missingExecutableFields } from '../../core/safety/missingExecutable.js';
4
5
  import { parseValidationOutput } from '../../core/validation/outputParser.js';
5
6
  import { filterBashOutput } from '../../core/bashOutput/registry.js';
6
7
  import { storeToolOutput } from '../../core/agent/toolOutputStore.js';
@@ -53,12 +54,16 @@ export const bashTool = tool({
53
54
  : undefined;
54
55
  const validationPassed = validationSummary?.status === 'passed';
55
56
  const output = filterBashOutput({ command, code, stdout, stderr, timedOut, classification, validationSummary, storeRawOutput: storeToolOutput, fallbackCompact: compactStoredOutput, compactMaxChars: validationPassed ? SHORT_VALIDATION_CHARS : COMPACT_COMMAND_CHARS });
57
+ // Generic, dependency-agnostic diagnostic for a missing executable. Only the
58
+ // executable name and a generic next step are exposed (never raw stderr).
59
+ const missing = code !== 0 && !processResult.aborted ? detectMissingExecutable({ command, code, stderr }) : undefined;
56
60
  return {
57
61
  ok: code === 0 && !timedOut && !processResult.aborted && !processResult.error,
58
62
  code, command, cwd, classification, durationMs: Date.now() - startedAt, timedOut,
59
63
  aborted: processResult.aborted, signal: processResult.signal, forcedTermination: processResult.forced,
60
64
  stdout: output.stdout, stderr: output.stderr, validationSummary,
61
65
  stdoutBytes: streamByteStats(processResult.stdout), stderrBytes: streamByteStats(processResult.stderr),
66
+ ...(missing ? { ...missingExecutableFields(missing), missingExecutableStep: missing.suggestedNextStep } : {}),
62
67
  ...(processResult.error ? { error: processResult.error } : {}),
63
68
  };
64
69
  }),
@@ -53,3 +53,17 @@ export declare function replacementDiff(oldText: string, newText: string, oldSta
53
53
  addedLines: number;
54
54
  removedLines: number;
55
55
  };
56
+ /** Build a compact whole-file diff by trimming unchanged leading/trailing lines. */
57
+ export declare function fileDiff(oldText: string, newText: string): {
58
+ diff: ToolDiffLine[];
59
+ addedLines: number;
60
+ removedLines: number;
61
+ };
62
+ /** Keep every mutation visible while bounding the inline result size. */
63
+ export declare function boundedDiff(diff: ToolDiffLine[], maxLines: number): {
64
+ diff: ToolDiffLine[];
65
+ truncated: boolean;
66
+ omittedLines: number;
67
+ };
68
+ /** Render a complete diff as retrievable plain unified-diff-like text. */
69
+ export declare function renderToolDiff(filePath: string, diff: ToolDiffLine[]): string;
@@ -68,6 +68,8 @@ export function findEditRange(original, oldText) {
68
68
  }
69
69
  /** Split text into diff lines, dropping a single trailing newline. */
70
70
  export function splitDiffLines(text) {
71
+ if (text.length === 0)
72
+ return [];
71
73
  const lines = text.split(/\r?\n/);
72
74
  if (text.endsWith('\n') || text.endsWith('\r\n'))
73
75
  lines.pop();
@@ -97,3 +99,73 @@ export function replacementDiff(oldText, newText, oldStartLine, newStartLine, co
97
99
  diff.push({ type: 'context', ...context.after });
98
100
  return { diff, addedLines: newLines.length, removedLines: oldLines.length };
99
101
  }
102
+ /** Build a compact whole-file diff by trimming unchanged leading/trailing lines. */
103
+ export function fileDiff(oldText, newText) {
104
+ if (oldText === newText)
105
+ return { diff: [], addedLines: 0, removedLines: 0 };
106
+ const oldLines = splitDiffLines(oldText);
107
+ const newLines = splitDiffLines(newText);
108
+ let prefixLines = 0;
109
+ while (prefixLines < oldLines.length && prefixLines < newLines.length && oldLines[prefixLines] === newLines[prefixLines])
110
+ prefixLines++;
111
+ let suffixLines = 0;
112
+ while (suffixLines < oldLines.length - prefixLines
113
+ && suffixLines < newLines.length - prefixLines
114
+ && oldLines[oldLines.length - suffixLines - 1] === newLines[newLines.length - suffixLines - 1])
115
+ suffixLines++;
116
+ if (prefixLines === oldLines.length && prefixLines === newLines.length) {
117
+ const lineNumber = Math.max(1, oldLines.length);
118
+ const text = oldLines.at(-1) ?? '';
119
+ const oldHasTrailingNewline = /\r?\n$/.test(oldText);
120
+ const newHasTrailingNewline = /\r?\n$/.test(newText);
121
+ return {
122
+ diff: [
123
+ { type: 'remove', oldLine: lineNumber, text },
124
+ ...(!oldHasTrailingNewline ? [{ type: 'meta', text: 'No newline at end of file' }] : []),
125
+ { type: 'add', newLine: lineNumber, text },
126
+ ...(!newHasTrailingNewline ? [{ type: 'meta', text: 'No newline at end of file' }] : []),
127
+ ],
128
+ addedLines: 1,
129
+ removedLines: 1,
130
+ };
131
+ }
132
+ const oldChanged = oldLines.slice(prefixLines, oldLines.length - suffixLines);
133
+ const newChanged = newLines.slice(prefixLines, newLines.length - suffixLines);
134
+ const startLine = prefixLines + 1;
135
+ const before = prefixLines > 0
136
+ ? { oldLine: prefixLines, newLine: prefixLines, text: oldLines[prefixLines - 1] ?? '' }
137
+ : undefined;
138
+ const after = suffixLines > 0
139
+ ? {
140
+ oldLine: oldLines.length - suffixLines + 1,
141
+ newLine: newLines.length - suffixLines + 1,
142
+ text: oldLines[oldLines.length - suffixLines] ?? '',
143
+ }
144
+ : undefined;
145
+ return replacementDiff(oldChanged.join('\n'), newChanged.join('\n'), startLine, startLine, { before, after });
146
+ }
147
+ /** Keep every mutation visible while bounding the inline result size. */
148
+ export function boundedDiff(diff, maxLines) {
149
+ if (diff.length <= maxLines)
150
+ return { diff, truncated: false, omittedLines: 0 };
151
+ const headLines = Math.ceil(maxLines / 2);
152
+ const tailLines = Math.floor(maxLines / 2);
153
+ const omittedLines = diff.length - headLines - tailLines;
154
+ return {
155
+ diff: [...diff.slice(0, headLines), { type: 'gap', omittedLines }, ...diff.slice(diff.length - tailLines)],
156
+ truncated: true,
157
+ omittedLines,
158
+ };
159
+ }
160
+ /** Render a complete diff as retrievable plain unified-diff-like text. */
161
+ export function renderToolDiff(filePath, diff) {
162
+ const lines = diff.map(line => {
163
+ if (line.type === 'gap')
164
+ return `... ${line.omittedLines} diff lines omitted ...`;
165
+ if (line.type === 'meta')
166
+ return `\\ ${line.text}`;
167
+ const marker = line.type === 'add' ? '+' : line.type === 'remove' ? '-' : ' ';
168
+ return `${marker}${line.text}`;
169
+ });
170
+ return [`--- a/${filePath}`, `+++ b/${filePath}`, ...lines].join('\n');
171
+ }
@@ -23,7 +23,9 @@ export declare function structuredToolFailure(toolName: string, error: unknown,
23
23
  reasonCode?: ToolFailureReasonCode;
24
24
  recoveryTool?: string;
25
25
  recoveryInput?: unknown;
26
+ suggestedPaths?: string[];
26
27
  }): {
28
+ suggestedPaths?: string[] | undefined;
27
29
  ok: boolean;
28
30
  toolName: string;
29
31
  path: string | undefined;
@@ -34,5 +34,6 @@ export function structuredToolFailure(toolName, error, suggestedNextStep, pathFo
34
34
  suggestedNextStep,
35
35
  recoveryTool: options?.recoveryTool ?? hazeError?.recoveryTool,
36
36
  recoveryInput: options?.recoveryInput ?? hazeError?.recoveryInput,
37
+ ...(options?.suggestedPaths?.length ? { suggestedPaths: options.suggestedPaths } : {}),
37
38
  };
38
39
  }
@@ -28,6 +28,7 @@ export declare const fetchTool: ({
28
28
  format: "text" | "auto";
29
29
  };
30
30
  output: NoInfer<{
31
+ suggestedPaths?: string[] | undefined;
31
32
  ok: boolean;
32
33
  toolName: string;
33
34
  path: string | undefined;
@@ -92,6 +93,7 @@ export declare const fetchTool: ({
92
93
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
93
94
  } & {
94
95
  outputSchema?: import("ai").FlexibleSchema<{
96
+ suggestedPaths?: string[] | undefined;
95
97
  ok: boolean;
96
98
  toolName: string;
97
99
  path: string | undefined;
@@ -157,6 +159,7 @@ export declare const fetchTool: ({
157
159
  url: string;
158
160
  format: "text" | "auto";
159
161
  }, {
162
+ suggestedPaths?: string[] | undefined;
160
163
  ok: boolean;
161
164
  toolName: string;
162
165
  path: string | undefined;
@@ -241,6 +244,7 @@ export declare const fetchTool: ({
241
244
  url: string;
242
245
  format: "text" | "auto";
243
246
  }, {
247
+ suggestedPaths?: string[] | undefined;
244
248
  ok: boolean;
245
249
  toolName: string;
246
250
  path: string | undefined;
@@ -332,6 +336,7 @@ export declare const fetchTool: ({
332
336
  format: "text" | "auto";
333
337
  };
334
338
  output: NoInfer<{
339
+ suggestedPaths?: string[] | undefined;
335
340
  ok: boolean;
336
341
  toolName: string;
337
342
  path: string | undefined;
@@ -396,6 +401,7 @@ export declare const fetchTool: ({
396
401
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
397
402
  } & {
398
403
  outputSchema?: import("ai").FlexibleSchema<{
404
+ suggestedPaths?: string[] | undefined;
399
405
  ok: boolean;
400
406
  toolName: string;
401
407
  path: string | undefined;
@@ -461,6 +467,7 @@ export declare const fetchTool: ({
461
467
  url: string;
462
468
  format: "text" | "auto";
463
469
  }, {
470
+ suggestedPaths?: string[] | undefined;
464
471
  ok: boolean;
465
472
  toolName: string;
466
473
  path: string | undefined;
@@ -545,6 +552,7 @@ export declare const fetchTool: ({
545
552
  url: string;
546
553
  format: "text" | "auto";
547
554
  }, {
555
+ suggestedPaths?: string[] | undefined;
548
556
  ok: boolean;
549
557
  toolName: string;
550
558
  path: string | undefined;
@@ -636,6 +644,7 @@ export declare const fetchTool: ({
636
644
  format: "text" | "auto";
637
645
  };
638
646
  output: NoInfer<{
647
+ suggestedPaths?: string[] | undefined;
639
648
  ok: boolean;
640
649
  toolName: string;
641
650
  path: string | undefined;
@@ -700,6 +709,7 @@ export declare const fetchTool: ({
700
709
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
701
710
  } & {
702
711
  outputSchema?: import("ai").FlexibleSchema<{
712
+ suggestedPaths?: string[] | undefined;
703
713
  ok: boolean;
704
714
  toolName: string;
705
715
  path: string | undefined;
@@ -765,6 +775,7 @@ export declare const fetchTool: ({
765
775
  url: string;
766
776
  format: "text" | "auto";
767
777
  }, {
778
+ suggestedPaths?: string[] | undefined;
768
779
  ok: boolean;
769
780
  toolName: string;
770
781
  path: string | undefined;
@@ -841,6 +852,7 @@ export declare const fetchTool: ({
841
852
  url: string;
842
853
  format: "text" | "auto";
843
854
  }, {
855
+ suggestedPaths?: string[] | undefined;
844
856
  ok: boolean;
845
857
  toolName: string;
846
858
  path: string | undefined;
@@ -932,6 +944,7 @@ export declare const fetchTool: ({
932
944
  format: "text" | "auto";
933
945
  };
934
946
  output: NoInfer<{
947
+ suggestedPaths?: string[] | undefined;
935
948
  ok: boolean;
936
949
  toolName: string;
937
950
  path: string | undefined;
@@ -996,6 +1009,7 @@ export declare const fetchTool: ({
996
1009
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
997
1010
  } & {
998
1011
  outputSchema?: import("ai").FlexibleSchema<{
1012
+ suggestedPaths?: string[] | undefined;
999
1013
  ok: boolean;
1000
1014
  toolName: string;
1001
1015
  path: string | undefined;
@@ -1061,6 +1075,7 @@ export declare const fetchTool: ({
1061
1075
  url: string;
1062
1076
  format: "text" | "auto";
1063
1077
  }, {
1078
+ suggestedPaths?: string[] | undefined;
1064
1079
  ok: boolean;
1065
1080
  toolName: string;
1066
1081
  path: string | undefined;
@@ -1137,6 +1152,7 @@ export declare const fetchTool: ({
1137
1152
  url: string;
1138
1153
  format: "text" | "auto";
1139
1154
  }, {
1155
+ suggestedPaths?: string[] | undefined;
1140
1156
  ok: boolean;
1141
1157
  toolName: string;
1142
1158
  path: string | undefined;
@@ -1,9 +1,10 @@
1
1
  import { MAX_OUTPUT_CHARS } from '../../core/limits/textBudgets.js';
2
+ import { isGitIgnored } from './gitIgnore.js';
2
3
  export { MAX_OUTPUT_CHARS };
3
4
  export declare const DEFAULT_READ_LINES = 300;
4
- /** Inline diff lines beyond this count are omitted (just the count is returned). */
5
- export declare const INLINE_DIFF_LINE_LIMIT = 20;
6
- export declare function isGitIgnored(absolutePath: string): Promise<boolean>;
5
+ /** Maximum real diff rows shown inline; larger diffs retain a head/tail preview and retrieval handle. */
6
+ export declare const INLINE_DIFF_LINE_LIMIT = 8;
7
+ export { isGitIgnored };
7
8
  export declare function assertNotIgnored(absolutePath: string, inputPath: string, allowIgnored?: boolean): Promise<void>;
8
9
  export declare function sourceOutlineEntries(lines: string[], startLine: number): {
9
10
  lineNumber: number;
@@ -1,31 +1,26 @@
1
- import { execFile as execFileCallback } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import { workspaceRelativePath, workspaceRoot } from '../../utils/path.js';
4
1
  import { MAX_OUTPUT_CHARS } from '../../core/limits/textBudgets.js';
5
2
  import { HazeToolError } from './failures.js';
6
- const execFile = promisify(execFileCallback);
3
+ import { checkGitIgnored, isGitIgnored } from './gitIgnore.js';
7
4
  export { MAX_OUTPUT_CHARS };
8
5
  export const DEFAULT_READ_LINES = 300;
9
- /** Inline diff lines beyond this count are omitted (just the count is returned). */
10
- export const INLINE_DIFF_LINE_LIMIT = 20;
11
- export async function isGitIgnored(absolutePath) {
12
- const relative = workspaceRelativePath(absolutePath);
13
- if (relative === '.')
14
- return false;
15
- try {
16
- await execFile('git', ['-C', workspaceRoot(), 'check-ignore', '-q', '--', relative]);
17
- return true;
18
- }
19
- catch {
20
- // Fail open: exit 1 means "not ignored", exit 128 means "not a repo", and
21
- // any other git failure should not block workspace reads (CR-016).
22
- return false;
23
- }
24
- }
6
+ /** Maximum real diff rows shown inline; larger diffs retain a head/tail preview and retrieval handle. */
7
+ export const INLINE_DIFF_LINE_LIMIT = 8;
8
+ // Re-exported so existing import sites keep a single source for ignore checks
9
+ // while traversal uses the batched classifier in `gitIgnore.ts` (RH-001).
10
+ export { isGitIgnored };
25
11
  export async function assertNotIgnored(absolutePath, inputPath, allowIgnored) {
26
- if (!allowIgnored && await isGitIgnored(absolutePath)) {
12
+ if (allowIgnored)
13
+ return;
14
+ // Mutations fail closed when ignore status cannot be verified (F-05): reads
15
+ // failing open is right, but silently proceeding into a possibly-ignored
16
+ // path because Git is missing/broken is the unsafe direction for writes.
17
+ const status = await checkGitIgnored(absolutePath);
18
+ if (status === 'ignored') {
27
19
  throw new HazeToolError(`Path is ignored by .gitignore: ${inputPath}. Set allowIgnored=true only if you explicitly need to access ignored files.`, 'ignored_path', { recoveryTool: 'listFiles' });
28
20
  }
21
+ if (status === 'unknown') {
22
+ throw new HazeToolError(`Could not verify git-ignore status for ${inputPath} (Git unavailable or failed). Set allowIgnored=true to proceed anyway.`, 'ignore_check_unavailable', { recoveryTool: 'listFiles' });
23
+ }
29
24
  }
30
25
  const SOURCE_OUTLINE_PATTERNS = [
31
26
  /^\s*(?:import|from|export|package|namespace|module|using)\b/,