@denizokcu/haze 1.2.0 → 1.5.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 (179) hide show
  1. package/CHANGELOG.md +86 -1
  2. package/README.md +23 -10
  3. package/SECURITY.md +1 -1
  4. package/bin/haze.js +27 -7
  5. package/dist/buildInfo.json +3 -3
  6. package/dist/cli/chat/BusyBar.d.ts +7 -0
  7. package/dist/cli/chat/BusyBar.js +8 -0
  8. package/dist/cli/chat/DynamicFrame.d.ts +37 -0
  9. package/dist/cli/chat/DynamicFrame.js +43 -0
  10. package/dist/cli/chat/busyIndicator.d.ts +3 -1
  11. package/dist/cli/chat/busyIndicator.js +11 -9
  12. package/dist/cli/chat/chatMetrics.d.ts +1 -1
  13. package/dist/cli/chat/chatMetrics.js +3 -3
  14. package/dist/cli/chat/inputSuggestions.js +4 -0
  15. package/dist/cli/chat/liveMessages.d.ts +36 -0
  16. package/dist/cli/chat/liveMessages.js +64 -0
  17. package/dist/cli/chat/liveRegion.js +1 -1
  18. package/dist/cli/chat/messages.js +27 -16
  19. package/dist/cli/chat/sessionLifecycle.d.ts +5 -2
  20. package/dist/cli/chat/sessionLifecycle.js +36 -4
  21. package/dist/cli/chat/sessionRecorder.d.ts +2 -1
  22. package/dist/cli/chat/sessionRecorder.js +8 -0
  23. package/dist/cli/chat/shutdown.d.ts +27 -0
  24. package/dist/cli/chat/shutdown.js +79 -0
  25. package/dist/cli/chat/terminalControl.d.ts +45 -0
  26. package/dist/cli/chat/terminalControl.js +107 -0
  27. package/dist/cli/chat/tips.js +1 -0
  28. package/dist/cli/chat/userInput.d.ts +43 -0
  29. package/dist/cli/chat/userInput.js +63 -0
  30. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +1 -1
  31. package/dist/cli/chat/wizard/sessionThemeHandlers.js +24 -1
  32. package/dist/cli/chat/wizard/types.d.ts +8 -1
  33. package/dist/cli/chat/wizardDispatch.js +1 -1
  34. package/dist/cli/commands/chat.js +277 -193
  35. package/dist/cli/commands/commandHelp.js +6 -0
  36. package/dist/cli/commands/commands.d.ts +8 -0
  37. package/dist/cli/commands/commands.js +13 -0
  38. package/dist/cli/commands/formatters.d.ts +1 -1
  39. package/dist/cli/commands/formatters.js +25 -3
  40. package/dist/cli/commands/logsCommand.js +21 -2
  41. package/dist/cli/commands/ndjsonSink.d.ts +12 -0
  42. package/dist/cli/commands/ndjsonSink.js +29 -0
  43. package/dist/cli/commands/reasoningCommand.d.ts +44 -0
  44. package/dist/cli/commands/reasoningCommand.js +79 -0
  45. package/dist/cli/commands/runCommand.d.ts +14 -0
  46. package/dist/cli/commands/runCommand.js +56 -22
  47. package/dist/cli/commands/settingsSummary.js +2 -0
  48. package/dist/cli/commands/streaming/agentAttempt.d.ts +3 -0
  49. package/dist/cli/commands/streaming/agentAttempt.js +2 -2
  50. package/dist/cli/commands/streaming/assistantSegments.d.ts +0 -7
  51. package/dist/cli/commands/streaming/assistantSegments.js +1 -1
  52. package/dist/cli/commands/streaming/attemptLifecycle.js +13 -9
  53. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
  54. package/dist/cli/commands/streaming/attemptOutcome.js +24 -9
  55. package/dist/cli/commands/streaming/attemptSetup.d.ts +4 -0
  56. package/dist/cli/commands/streaming/attemptSetup.js +21 -7
  57. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +14 -1
  58. package/dist/cli/commands/streaming/goalCheckpoint.js +4 -2
  59. package/dist/cli/commands/streaming/goalSupervisor.d.ts +9 -0
  60. package/dist/cli/commands/streaming/goalSupervisor.js +51 -10
  61. package/dist/cli/commands/streaming/prepareStep.d.ts +0 -3
  62. package/dist/cli/commands/streaming/prepareStep.js +14 -5
  63. package/dist/cli/commands/streaming/streamLoop.d.ts +5 -0
  64. package/dist/cli/commands/streaming/streamLoop.js +3 -0
  65. package/dist/cli/commands/streaming/toolPartHandlers.js +6 -0
  66. package/dist/cli/commands/streaming.d.ts +8 -3
  67. package/dist/cli/commands/streaming.js +46 -21
  68. package/dist/cli/commands/wizardFlow.d.ts +10 -0
  69. package/dist/cli/commands/wizardFlow.js +34 -5
  70. package/dist/cli/index.js +22 -2
  71. package/dist/config/contextFiles.d.ts +9 -0
  72. package/dist/config/contextFiles.js +21 -1
  73. package/dist/config/modelCatalog.d.ts +3 -0
  74. package/dist/config/modelCatalog.js +29 -0
  75. package/dist/config/modelDiscovery.js +68 -5
  76. package/dist/config/providerPresets.d.ts +1 -1
  77. package/dist/config/providerPresets.js +42 -3
  78. package/dist/config/settings.d.ts +14 -6
  79. package/dist/config/settings.js +16 -1
  80. package/dist/core/agent/budgets.d.ts +13 -17
  81. package/dist/core/agent/budgets.js +15 -19
  82. package/dist/core/agent/completionController.d.ts +14 -2
  83. package/dist/core/agent/completionController.js +48 -3
  84. package/dist/core/agent/events.d.ts +2 -1
  85. package/dist/core/agent/goalPolicy.d.ts +17 -0
  86. package/dist/core/agent/goalPolicy.js +53 -6
  87. package/dist/core/agent/projectPreflight.d.ts +2 -0
  88. package/dist/core/agent/projectPreflight.js +56 -0
  89. package/dist/core/agent/reasoningPolicy.d.ts +76 -10
  90. package/dist/core/agent/reasoningPolicy.js +72 -9
  91. package/dist/core/agent/toolCapabilities.d.ts +3 -3
  92. package/dist/core/agent/toolCapabilities.js +31 -7
  93. package/dist/core/agent/workState.d.ts +14 -4
  94. package/dist/core/agent/workState.js +229 -34
  95. package/dist/core/deadline.js +22 -24
  96. package/dist/core/providerContracts.d.ts +29 -0
  97. package/dist/core/providerContracts.js +1 -0
  98. package/dist/core/safety/secretPaths.js +10 -7
  99. package/dist/core/safety/shellClassifier.d.ts +2 -0
  100. package/dist/core/safety/shellClassifier.js +9 -1
  101. package/dist/core/session/sessionReport.d.ts +33 -0
  102. package/dist/core/session/sessionReport.js +121 -0
  103. package/dist/core/session/sessionSlimming.d.ts +2 -0
  104. package/dist/core/session/sessionSlimming.js +59 -4
  105. package/dist/core/session/sessionStore.d.ts +16 -8
  106. package/dist/core/session/sessionStore.js +71 -34
  107. package/dist/core/shellOutput/reducers/git.js +7 -2
  108. package/dist/core/shellOutput/reducers/validation.d.ts +1 -1
  109. package/dist/core/shellOutput/reducers/validation.js +14 -1
  110. package/dist/core/shellOutput/registry.js +3 -2
  111. package/dist/core/subagent/contracts.d.ts +3 -18
  112. package/dist/core/subagent/executionProfiles.js +4 -4
  113. package/dist/core/tasks/taskStorage.js +8 -1
  114. package/dist/core/validation/outputParser.d.ts +6 -1
  115. package/dist/core/validation/outputParser.js +30 -2
  116. package/dist/llm/client.d.ts +6 -3
  117. package/dist/llm/client.js +28 -11
  118. package/dist/llm/hazeTools.d.ts +9161 -7135
  119. package/dist/llm/hazeTools.js +6 -462
  120. package/dist/llm/lsp/client.d.ts +7 -1
  121. package/dist/llm/lsp/client.js +58 -9
  122. package/dist/llm/lsp/pool.d.ts +11 -0
  123. package/dist/llm/lsp/pool.js +61 -4
  124. package/dist/llm/lsp/protocol.d.ts +6 -23
  125. package/dist/llm/lsp/requests.d.ts +54 -60
  126. package/dist/llm/lsp/requests.js +152 -28
  127. package/dist/llm/lsp/symbols.d.ts +16 -0
  128. package/dist/llm/lsp/symbols.js +70 -0
  129. package/dist/llm/lsp/workspaceEdit.d.ts +43 -0
  130. package/dist/llm/lsp/workspaceEdit.js +117 -0
  131. package/dist/llm/lspTools.d.ts +7518 -2859
  132. package/dist/llm/lspTools.js +195 -110
  133. package/dist/llm/mcp.js +3 -0
  134. package/dist/llm/requestContext.d.ts +4 -3
  135. package/dist/llm/requestContext.js +9 -5
  136. package/dist/{core/subagent → llm}/subagentRunner.d.ts +13 -9
  137. package/dist/{core/subagent → llm}/subagentRunner.js +54 -49
  138. package/dist/llm/systemPrompt.d.ts +11 -1
  139. package/dist/llm/systemPrompt.js +4 -13
  140. package/dist/llm/tools/fetchTool.d.ts +34 -30
  141. package/dist/llm/tools/fileTools.d.ts +7768 -0
  142. package/dist/llm/tools/fileTools.js +510 -0
  143. package/dist/llm/tools/processTool.d.ts +34 -30
  144. package/dist/llm/tools/replaceInFiles.d.ts +105 -0
  145. package/dist/llm/tools/replaceInFiles.js +131 -0
  146. package/dist/llm/tools/shellTool.d.ts +34 -30
  147. package/dist/llm/tools/shellTool.js +8 -4
  148. package/dist/llm/tools/storedOutputTool.d.ts +4 -0
  149. package/dist/llm/tools/taskTool.d.ts +4 -0
  150. package/dist/llm/tools/toolContext.d.ts +3 -29
  151. package/dist/llm/tools/toolContext.js +56 -53
  152. package/dist/llm/tools/toolContextState.d.ts +40 -0
  153. package/dist/llm/tools/toolContextState.js +34 -0
  154. package/dist/llm/workerContext.d.ts +7 -0
  155. package/dist/llm/workerContext.js +18 -1
  156. package/dist/skills/SkillLoader.js +30 -4
  157. package/dist/skills/SkillRegistry.js +3 -3
  158. package/dist/skills/builder/SkillBuilder.js +3 -3
  159. package/dist/skills/confinement.d.ts +7 -0
  160. package/dist/skills/confinement.js +15 -0
  161. package/dist/ui/codeHighlight.js +4 -4
  162. package/dist/ui/components/MarkdownText.js +7 -8
  163. package/dist/ui/components/NativeIndicators.d.ts +15 -0
  164. package/dist/ui/components/NativeIndicators.js +32 -0
  165. package/dist/ui/components/StreamingMarkdownText.d.ts +9 -0
  166. package/dist/ui/components/StreamingMarkdownText.js +38 -0
  167. package/dist/ui/components/TextInput.d.ts +7 -2
  168. package/dist/ui/components/TextInput.js +103 -46
  169. package/dist/ui/components/WizardChoices.d.ts +18 -0
  170. package/dist/ui/components/WizardChoices.js +32 -0
  171. package/dist/ui/components/useInputSuggestions.js +18 -6
  172. package/dist/ui/inputBuffer.js +12 -6
  173. package/dist/ui/textGeometry.d.ts +14 -0
  174. package/dist/ui/textGeometry.js +31 -0
  175. package/dist/utils/buildInfo.js +29 -8
  176. package/dist/utils/fs.js +5 -1
  177. package/package.json +23 -22
  178. /package/dist/cli/{contextReport.d.ts → contextReportCli.d.ts} +0 -0
  179. /package/dist/cli/{contextReport.js → contextReportCli.js} +0 -0
@@ -1,4 +1,5 @@
1
1
  export declare const processTool: ({
2
+ deferLoading?: boolean;
2
3
  title?: string;
3
4
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
4
5
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -8,17 +9,17 @@ export declare const processTool: ({
8
9
  limit: number;
9
10
  backgroundId?: string | undefined;
10
11
  }>;
11
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
12
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
12
13
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
13
14
  action: "output" | "kill" | "list";
14
15
  offset: number;
15
16
  limit: number;
16
17
  backgroundId?: string | undefined;
17
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
18
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
18
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
19
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
19
20
  onInputDelta?: ((options: {
20
21
  inputTextDelta: string;
21
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
22
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
22
23
  onInputAvailable?: ((options: {
23
24
  input: {
24
25
  action: "output" | "kill" | "list";
@@ -26,7 +27,7 @@ export declare const processTool: ({
26
27
  limit: number;
27
28
  backgroundId?: string | undefined;
28
29
  };
29
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
30
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
30
31
  toModelOutput?: ((options: {
31
32
  toolCallId: string;
32
33
  input: {
@@ -194,10 +195,10 @@ export declare const processTool: ({
194
195
  error?: undefined;
195
196
  suggestedNextStep?: undefined;
196
197
  processes?: undefined;
197
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
198
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
198
199
  } & {
199
200
  description?: string | ((options: {
200
- context: NoInfer<import("./toolContext.js").HazeToolContext>;
201
+ context: NoInfer<import("./toolContextState.js").HazeToolContext>;
201
202
  experimental_sandbox?: import("ai").Experimental_SandboxSession;
202
203
  }) => string) | undefined;
203
204
  strict?: boolean;
@@ -271,8 +272,9 @@ export declare const processTool: ({
271
272
  error?: undefined;
272
273
  suggestedNextStep?: undefined;
273
274
  processes?: undefined;
274
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
275
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
275
276
  }) | ({
277
+ deferLoading?: boolean;
276
278
  title?: string;
277
279
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
278
280
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -282,17 +284,17 @@ export declare const processTool: ({
282
284
  limit: number;
283
285
  backgroundId?: string | undefined;
284
286
  }>;
285
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
287
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
286
288
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
287
289
  action: "output" | "kill" | "list";
288
290
  offset: number;
289
291
  limit: number;
290
292
  backgroundId?: string | undefined;
291
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
292
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
293
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
294
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
293
295
  onInputDelta?: ((options: {
294
296
  inputTextDelta: string;
295
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
297
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
296
298
  onInputAvailable?: ((options: {
297
299
  input: {
298
300
  action: "output" | "kill" | "list";
@@ -300,7 +302,7 @@ export declare const processTool: ({
300
302
  limit: number;
301
303
  backgroundId?: string | undefined;
302
304
  };
303
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
305
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
304
306
  toModelOutput?: ((options: {
305
307
  toolCallId: string;
306
308
  input: {
@@ -468,10 +470,10 @@ export declare const processTool: ({
468
470
  error?: undefined;
469
471
  suggestedNextStep?: undefined;
470
472
  processes?: undefined;
471
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
473
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
472
474
  } & {
473
475
  description?: string | ((options: {
474
- context: NoInfer<import("./toolContext.js").HazeToolContext>;
476
+ context: NoInfer<import("./toolContextState.js").HazeToolContext>;
475
477
  experimental_sandbox?: import("ai").Experimental_SandboxSession;
476
478
  }) => string) | undefined;
477
479
  strict?: boolean;
@@ -545,8 +547,9 @@ export declare const processTool: ({
545
547
  error?: undefined;
546
548
  suggestedNextStep?: undefined;
547
549
  processes?: undefined;
548
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
550
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
549
551
  }) | ({
552
+ deferLoading?: boolean;
550
553
  title?: string;
551
554
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
552
555
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -556,17 +559,17 @@ export declare const processTool: ({
556
559
  limit: number;
557
560
  backgroundId?: string | undefined;
558
561
  }>;
559
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
562
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
560
563
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
561
564
  action: "output" | "kill" | "list";
562
565
  offset: number;
563
566
  limit: number;
564
567
  backgroundId?: string | undefined;
565
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
566
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
568
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
569
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
567
570
  onInputDelta?: ((options: {
568
571
  inputTextDelta: string;
569
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
572
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
570
573
  onInputAvailable?: ((options: {
571
574
  input: {
572
575
  action: "output" | "kill" | "list";
@@ -574,7 +577,7 @@ export declare const processTool: ({
574
577
  limit: number;
575
578
  backgroundId?: string | undefined;
576
579
  };
577
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
580
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
578
581
  toModelOutput?: ((options: {
579
582
  toolCallId: string;
580
583
  input: {
@@ -742,7 +745,7 @@ export declare const processTool: ({
742
745
  error?: undefined;
743
746
  suggestedNextStep?: undefined;
744
747
  processes?: undefined;
745
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
748
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
746
749
  } & {
747
750
  type: "provider";
748
751
  id: `${string}.${string}`;
@@ -809,8 +812,9 @@ export declare const processTool: ({
809
812
  error?: undefined;
810
813
  suggestedNextStep?: undefined;
811
814
  processes?: undefined;
812
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
815
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
813
816
  }) | ({
817
+ deferLoading?: boolean;
814
818
  title?: string;
815
819
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
816
820
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -820,17 +824,17 @@ export declare const processTool: ({
820
824
  limit: number;
821
825
  backgroundId?: string | undefined;
822
826
  }>;
823
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
827
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
824
828
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
825
829
  action: "output" | "kill" | "list";
826
830
  offset: number;
827
831
  limit: number;
828
832
  backgroundId?: string | undefined;
829
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
830
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
833
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
834
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
831
835
  onInputDelta?: ((options: {
832
836
  inputTextDelta: string;
833
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
837
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
834
838
  onInputAvailable?: ((options: {
835
839
  input: {
836
840
  action: "output" | "kill" | "list";
@@ -838,7 +842,7 @@ export declare const processTool: ({
838
842
  limit: number;
839
843
  backgroundId?: string | undefined;
840
844
  };
841
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
845
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
842
846
  toModelOutput?: ((options: {
843
847
  toolCallId: string;
844
848
  input: {
@@ -1006,7 +1010,7 @@ export declare const processTool: ({
1006
1010
  error?: undefined;
1007
1011
  suggestedNextStep?: undefined;
1008
1012
  processes?: undefined;
1009
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
1013
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
1010
1014
  } & {
1011
1015
  type: "provider";
1012
1016
  id: `${string}.${string}`;
@@ -1073,5 +1077,5 @@ export declare const processTool: ({
1073
1077
  error?: undefined;
1074
1078
  suggestedNextStep?: undefined;
1075
1079
  processes?: undefined;
1076
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
1080
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
1077
1081
  });
@@ -0,0 +1,105 @@
1
+ import type { ToolExecutionContext } from './toolContext.js';
2
+ export interface ReplaceInFilesInput {
3
+ path: string;
4
+ needle: string;
5
+ replacement: string;
6
+ mode: 'literal' | 'regex';
7
+ includeGlob?: string;
8
+ excludeGlob?: string;
9
+ dryRun: boolean;
10
+ occurrenceIds?: string[];
11
+ expectedCount?: number;
12
+ }
13
+ export declare function replaceInFiles(input: ReplaceInFilesInput, context: ToolExecutionContext): Promise<{
14
+ ok: boolean;
15
+ toolName: string;
16
+ path: string;
17
+ error: string;
18
+ reasonCode: "scoped_instructions_discovered";
19
+ recoverable: boolean;
20
+ suggestedNextStep: string;
21
+ applicableProjectInstructions: import("../../config/contextFiles.js").ContextFile[];
22
+ } | {
23
+ occurrenceHandle?: string | undefined;
24
+ skippedFiles: number;
25
+ occurrences: {
26
+ before: string;
27
+ after: string;
28
+ id: string;
29
+ path: string;
30
+ line: number;
31
+ }[];
32
+ occurrencesTruncated: boolean;
33
+ ok: boolean;
34
+ dryRun: boolean;
35
+ occurrenceCount: number;
36
+ fileCount: number;
37
+ error?: undefined;
38
+ staleOccurrenceIds?: undefined;
39
+ recoverable?: undefined;
40
+ suggestedNextStep?: undefined;
41
+ changedPaths?: undefined;
42
+ uncertainPaths?: undefined;
43
+ } | {
44
+ recoverable: boolean;
45
+ occurrenceHandle?: string | undefined;
46
+ skippedFiles: number;
47
+ occurrences: {
48
+ before: string;
49
+ after: string;
50
+ id: string;
51
+ path: string;
52
+ line: number;
53
+ }[];
54
+ occurrencesTruncated: boolean;
55
+ ok: boolean;
56
+ error: string;
57
+ staleOccurrenceIds?: undefined;
58
+ suggestedNextStep?: undefined;
59
+ changedPaths?: undefined;
60
+ uncertainPaths?: undefined;
61
+ } | {
62
+ ok: boolean;
63
+ error: string;
64
+ staleOccurrenceIds: string[];
65
+ recoverable: boolean;
66
+ suggestedNextStep: string;
67
+ changedPaths?: undefined;
68
+ uncertainPaths?: undefined;
69
+ } | {
70
+ ok: boolean;
71
+ error: string;
72
+ recoverable: boolean;
73
+ staleOccurrenceIds?: undefined;
74
+ suggestedNextStep?: undefined;
75
+ changedPaths?: undefined;
76
+ uncertainPaths?: undefined;
77
+ } | {
78
+ ok: boolean;
79
+ changedPaths: string[];
80
+ uncertainPaths: string[];
81
+ error: string;
82
+ recoverable: boolean;
83
+ suggestedNextStep: string;
84
+ staleOccurrenceIds?: undefined;
85
+ } | {
86
+ diffHandle?: string | undefined;
87
+ ok: boolean;
88
+ dryRun: boolean;
89
+ changedPaths: string[];
90
+ noChange: boolean;
91
+ occurrenceCount: number;
92
+ fileCount: number;
93
+ diffLineCount: number;
94
+ files: {
95
+ diff: import("../toolResultTypes.js").ToolDiffLine[];
96
+ addedLines: number;
97
+ removedLines: number;
98
+ path: string;
99
+ }[];
100
+ error?: undefined;
101
+ staleOccurrenceIds?: undefined;
102
+ recoverable?: undefined;
103
+ suggestedNextStep?: undefined;
104
+ uncertainPaths?: undefined;
105
+ }>;
@@ -0,0 +1,131 @@
1
+ import crypto from 'node:crypto';
2
+ import fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { walkDir } from '../../utils/fs.js';
5
+ import { workspaceRoot } from '../../utils/path.js';
6
+ import { prepareWorkspaceMutation, prepareWorkspaceRead } from './workspaceFile.js';
7
+ import { createIgnoreClassifier } from './gitIgnore.js';
8
+ import { boundedDiff, fileDiff } from './editMatch.js';
9
+ import { readUtf8Prefix } from '../../core/io/boundedRead.js';
10
+ import { EXACT_MUTATION_BYTES } from '../../core/limits.js';
11
+ import { storeToolOutput } from '../../core/agent/toolOutputStore.js';
12
+ function globRegex(glob) {
13
+ const escaped = glob.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*\*/g, '__HAZE_DOUBLE_STAR__').replace(/\*/g, '[^/]*').replace(/\?/g, '[^/]').replace(/__HAZE_DOUBLE_STAR__/g, '.*');
14
+ return new RegExp(`^${escaped}$`);
15
+ }
16
+ function matcher(input) {
17
+ if (input.mode === 'literal')
18
+ return new RegExp(input.needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
19
+ return new RegExp(input.needle, 'gm');
20
+ }
21
+ function occurrencesIn(filePath, content, input) {
22
+ const regex = matcher(input);
23
+ const result = [];
24
+ for (const match of content.matchAll(regex)) {
25
+ const start = match.index;
26
+ if (start == null)
27
+ continue;
28
+ const matched = match[0];
29
+ if (matched.length === 0)
30
+ throw new Error('needle must not match an empty string');
31
+ let replacement = input.replacement;
32
+ if (input.mode === 'regex') {
33
+ // A sticky match retains lookaround, captures, and native $`/$' input context.
34
+ const single = new RegExp(input.needle, 'my');
35
+ single.lastIndex = start;
36
+ const replaced = content.replace(single, input.replacement);
37
+ replacement = replaced.slice(start, replaced.length - (content.length - start - matched.length));
38
+ }
39
+ const digest = crypto.createHash('sha256').update(`${filePath}\0${start}\0${matched}`).digest('hex').slice(0, 12);
40
+ result.push({ id: `${filePath}:${result.length}@${digest}`, path: filePath, start, end: start + matched.length, line: content.slice(0, start).split('\n').length, matched, replacement });
41
+ }
42
+ return result;
43
+ }
44
+ function applyOccurrences(content, occurrences) {
45
+ let updated = content;
46
+ for (const occurrence of [...occurrences].sort((a, b) => b.start - a.start))
47
+ updated = `${updated.slice(0, occurrence.start)}${occurrence.replacement}${updated.slice(occurrence.end)}`;
48
+ return updated;
49
+ }
50
+ export async function replaceInFiles(input, context) {
51
+ if (!input.needle)
52
+ throw new Error('needle must not be empty');
53
+ const base = await prepareWorkspaceRead(input.path, false, context);
54
+ const stat = await fs.stat(base);
55
+ const ignore = createIgnoreClassifier(workspaceRoot());
56
+ const entries = stat.isFile() ? [{ path: path.relative(workspaceRoot(), base), absolutePath: base, isFile: true, isDirectory: false, name: path.basename(base) }] : await walkDir(base, {
57
+ recursive: true,
58
+ maxEntries: 20_000,
59
+ ignoreBatch: async (values) => await ignore.classify(values.map(value => ({ path: path.relative(workspaceRoot(), value.absolutePath), isDirectory: value.isDirectory }))),
60
+ });
61
+ const include = input.includeGlob ? globRegex(input.includeGlob) : undefined;
62
+ const exclude = input.excludeGlob ? globRegex(input.excludeGlob) : undefined;
63
+ const files = [];
64
+ let skippedFiles = 0;
65
+ for (const entry of entries) {
66
+ if (!entry.isFile)
67
+ continue;
68
+ const relative = path.relative(workspaceRoot(), entry.absolutePath).replace(/\\/g, '/');
69
+ if ((include && !include.test(relative)) || exclude?.test(relative))
70
+ continue;
71
+ let content;
72
+ try {
73
+ const safePath = await prepareWorkspaceRead(entry.absolutePath, false, context);
74
+ const read = await readUtf8Prefix(safePath, EXACT_MUTATION_BYTES);
75
+ if (read.truncated)
76
+ continue;
77
+ content = read.content;
78
+ }
79
+ catch {
80
+ skippedFiles++;
81
+ continue;
82
+ }
83
+ if (content.includes('\0'))
84
+ continue;
85
+ const occurrences = occurrencesIn(relative, content, input);
86
+ if (occurrences.length > 0)
87
+ files.push({ path: relative, absolutePath: entry.absolutePath, content, occurrences });
88
+ }
89
+ const all = files.flatMap(file => file.occurrences);
90
+ const fullPreview = all.map(occurrence => ({ id: occurrence.id, path: occurrence.path, line: occurrence.line, before: occurrence.matched, after: occurrence.replacement }));
91
+ const preview = fullPreview.slice(0, 100).map(occurrence => ({ ...occurrence, before: occurrence.before.slice(0, 200), after: occurrence.after.slice(0, 200) }));
92
+ const occurrenceHandle = fullPreview.length > preview.length || fullPreview.some(occurrence => occurrence.before.length > 200 || occurrence.after.length > 200)
93
+ ? storeToolOutput(JSON.stringify(fullPreview, null, 2))
94
+ : undefined;
95
+ const previewFields = { skippedFiles, occurrences: preview, occurrencesTruncated: occurrenceHandle != null, ...(occurrenceHandle ? { occurrenceHandle } : {}) };
96
+ if (input.dryRun)
97
+ return { ok: true, dryRun: true, occurrenceCount: all.length, fileCount: files.length, ...previewFields };
98
+ if (input.expectedCount != null && input.expectedCount !== all.length)
99
+ return { ok: false, error: `expectedCount=${input.expectedCount}, but found ${all.length}; no changes applied.`, ...previewFields, recoverable: true };
100
+ const requested = input.occurrenceIds ? new Set(input.occurrenceIds) : undefined;
101
+ if (requested) {
102
+ const currentIds = new Set(all.map(occurrence => occurrence.id));
103
+ const stale = [...requested].filter(id => !currentIds.has(id));
104
+ if (stale.length > 0)
105
+ return { ok: false, error: `${stale.length} occurrence id(s) are stale or unknown; no changes applied.`, staleOccurrenceIds: stale, recoverable: true, suggestedNextStep: 'Run replaceInFiles with dryRun=true again and use the current occurrence IDs.' };
106
+ }
107
+ const selectedFiles = files.map(file => ({ ...file, selected: requested ? file.occurrences.filter(occurrence => requested.has(occurrence.id)) : file.occurrences })).filter(file => file.selected.length > 0);
108
+ if (selectedFiles.length === 0)
109
+ return { ok: false, error: 'No occurrences selected; no changes applied.', recoverable: true };
110
+ for (const file of selectedFiles) {
111
+ const prepared = await prepareWorkspaceMutation('replaceInFiles', file.path, false, context);
112
+ if (prepared.scopedStop)
113
+ return prepared.scopedStop;
114
+ }
115
+ const changed = selectedFiles.map(file => ({ ...file, updated: applyOccurrences(file.content, file.selected) })).filter(file => file.updated !== file.content);
116
+ const changedPaths = [];
117
+ for (const file of changed) {
118
+ try {
119
+ await fs.writeFile(file.absolutePath, file.updated, 'utf8');
120
+ changedPaths.push(file.path);
121
+ }
122
+ catch {
123
+ return { ok: false, changedPaths, uncertainPaths: [file.path], error: `Write failed for ${file.path}; earlier writes were not rolled back.`, recoverable: true, suggestedNextStep: 'Read the changed and uncertain paths before retrying; validate all completed changes.' };
124
+ }
125
+ }
126
+ const fullFiles = changed.map(file => ({ path: file.path, ...fileDiff(file.content, file.updated) }));
127
+ const changedFiles = fullFiles.map(file => ({ ...file, diff: boundedDiff(file.diff, 12).diff }));
128
+ const diffLineCount = fullFiles.reduce((sum, file) => sum + file.diff.length, 0);
129
+ const diffHandle = diffLineCount > changedFiles.reduce((sum, file) => sum + file.diff.length, 0) ? storeToolOutput(JSON.stringify(fullFiles, null, 2)) : undefined;
130
+ return { ok: true, dryRun: false, changedPaths, noChange: changed.length === 0, occurrenceCount: changed.reduce((sum, file) => sum + file.selected.length, 0), fileCount: changed.length, diffLineCount, files: changedFiles, ...(diffHandle ? { diffHandle } : {}) };
131
+ }
@@ -1,4 +1,5 @@
1
1
  export declare const shellTool: ({
2
+ deferLoading?: boolean;
2
3
  title?: string;
3
4
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
4
5
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -8,17 +9,17 @@ export declare const shellTool: ({
8
9
  background: boolean;
9
10
  timeoutSeconds?: number | undefined;
10
11
  }>;
11
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
12
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
12
13
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
13
14
  command: string;
14
15
  purpose: "validation" | "auto";
15
16
  background: boolean;
16
17
  timeoutSeconds?: number | undefined;
17
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
18
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
18
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
19
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
19
20
  onInputDelta?: ((options: {
20
21
  inputTextDelta: string;
21
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
22
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
22
23
  onInputAvailable?: ((options: {
23
24
  input: {
24
25
  command: string;
@@ -26,7 +27,7 @@ export declare const shellTool: ({
26
27
  background: boolean;
27
28
  timeoutSeconds?: number | undefined;
28
29
  };
29
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
30
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
30
31
  toModelOutput?: ((options: {
31
32
  toolCallId: string;
32
33
  input: {
@@ -272,10 +273,10 @@ export declare const shellTool: ({
272
273
  recoverable?: undefined;
273
274
  suggestedNextStep?: undefined;
274
275
  background?: undefined;
275
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
276
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
276
277
  } & {
277
278
  description?: string | ((options: {
278
- context: NoInfer<import("./toolContext.js").HazeToolContext>;
279
+ context: NoInfer<import("./toolContextState.js").HazeToolContext>;
279
280
  experimental_sandbox?: import("ai").Experimental_SandboxSession;
280
281
  }) => string) | undefined;
281
282
  strict?: boolean;
@@ -375,8 +376,9 @@ export declare const shellTool: ({
375
376
  recoverable?: undefined;
376
377
  suggestedNextStep?: undefined;
377
378
  background?: undefined;
378
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
379
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
379
380
  }) | ({
381
+ deferLoading?: boolean;
380
382
  title?: string;
381
383
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
382
384
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -386,17 +388,17 @@ export declare const shellTool: ({
386
388
  background: boolean;
387
389
  timeoutSeconds?: number | undefined;
388
390
  }>;
389
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
391
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
390
392
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
391
393
  command: string;
392
394
  purpose: "validation" | "auto";
393
395
  background: boolean;
394
396
  timeoutSeconds?: number | undefined;
395
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
396
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
397
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
398
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
397
399
  onInputDelta?: ((options: {
398
400
  inputTextDelta: string;
399
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
401
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
400
402
  onInputAvailable?: ((options: {
401
403
  input: {
402
404
  command: string;
@@ -404,7 +406,7 @@ export declare const shellTool: ({
404
406
  background: boolean;
405
407
  timeoutSeconds?: number | undefined;
406
408
  };
407
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
409
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
408
410
  toModelOutput?: ((options: {
409
411
  toolCallId: string;
410
412
  input: {
@@ -650,10 +652,10 @@ export declare const shellTool: ({
650
652
  recoverable?: undefined;
651
653
  suggestedNextStep?: undefined;
652
654
  background?: undefined;
653
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
655
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
654
656
  } & {
655
657
  description?: string | ((options: {
656
- context: NoInfer<import("./toolContext.js").HazeToolContext>;
658
+ context: NoInfer<import("./toolContextState.js").HazeToolContext>;
657
659
  experimental_sandbox?: import("ai").Experimental_SandboxSession;
658
660
  }) => string) | undefined;
659
661
  strict?: boolean;
@@ -753,8 +755,9 @@ export declare const shellTool: ({
753
755
  recoverable?: undefined;
754
756
  suggestedNextStep?: undefined;
755
757
  background?: undefined;
756
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
758
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
757
759
  }) | ({
760
+ deferLoading?: boolean;
758
761
  title?: string;
759
762
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
760
763
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -764,17 +767,17 @@ export declare const shellTool: ({
764
767
  background: boolean;
765
768
  timeoutSeconds?: number | undefined;
766
769
  }>;
767
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
770
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
768
771
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
769
772
  command: string;
770
773
  purpose: "validation" | "auto";
771
774
  background: boolean;
772
775
  timeoutSeconds?: number | undefined;
773
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
774
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
776
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
777
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
775
778
  onInputDelta?: ((options: {
776
779
  inputTextDelta: string;
777
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
780
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
778
781
  onInputAvailable?: ((options: {
779
782
  input: {
780
783
  command: string;
@@ -782,7 +785,7 @@ export declare const shellTool: ({
782
785
  background: boolean;
783
786
  timeoutSeconds?: number | undefined;
784
787
  };
785
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
788
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
786
789
  toModelOutput?: ((options: {
787
790
  toolCallId: string;
788
791
  input: {
@@ -1028,7 +1031,7 @@ export declare const shellTool: ({
1028
1031
  recoverable?: undefined;
1029
1032
  suggestedNextStep?: undefined;
1030
1033
  background?: undefined;
1031
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
1034
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
1032
1035
  } & {
1033
1036
  type: "provider";
1034
1037
  id: `${string}.${string}`;
@@ -1121,8 +1124,9 @@ export declare const shellTool: ({
1121
1124
  recoverable?: undefined;
1122
1125
  suggestedNextStep?: undefined;
1123
1126
  background?: undefined;
1124
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
1127
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
1125
1128
  }) | ({
1129
+ deferLoading?: boolean;
1126
1130
  title?: string;
1127
1131
  providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
1128
1132
  metadata?: import("@ai-sdk/provider").JSONObject;
@@ -1132,17 +1136,17 @@ export declare const shellTool: ({
1132
1136
  background: boolean;
1133
1137
  timeoutSeconds?: number | undefined;
1134
1138
  }>;
1135
- contextSchema?: import("ai").FlexibleSchema<import("./toolContext.js").HazeToolContext> | undefined;
1139
+ contextSchema?: import("ai").FlexibleSchema<import("./toolContextState.js").HazeToolContext> | undefined;
1136
1140
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
1137
1141
  command: string;
1138
1142
  purpose: "validation" | "auto";
1139
1143
  background: boolean;
1140
1144
  timeoutSeconds?: number | undefined;
1141
- }, NoInfer<import("./toolContext.js").HazeToolContext>> | undefined;
1142
- onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
1145
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>> | undefined;
1146
+ onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
1143
1147
  onInputDelta?: ((options: {
1144
1148
  inputTextDelta: string;
1145
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
1149
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
1146
1150
  onInputAvailable?: ((options: {
1147
1151
  input: {
1148
1152
  command: string;
@@ -1150,7 +1154,7 @@ export declare const shellTool: ({
1150
1154
  background: boolean;
1151
1155
  timeoutSeconds?: number | undefined;
1152
1156
  };
1153
- } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContext.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
1157
+ } & import("ai").ToolExecutionOptions<NoInfer<import("./toolContextState.js").HazeToolContext>>) => void | PromiseLike<void>) | undefined;
1154
1158
  toModelOutput?: ((options: {
1155
1159
  toolCallId: string;
1156
1160
  input: {
@@ -1396,7 +1400,7 @@ export declare const shellTool: ({
1396
1400
  recoverable?: undefined;
1397
1401
  suggestedNextStep?: undefined;
1398
1402
  background?: undefined;
1399
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
1403
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
1400
1404
  } & {
1401
1405
  type: "provider";
1402
1406
  id: `${string}.${string}`;
@@ -1489,5 +1493,5 @@ export declare const shellTool: ({
1489
1493
  recoverable?: undefined;
1490
1494
  suggestedNextStep?: undefined;
1491
1495
  background?: undefined;
1492
- }, NoInfer<import("./toolContext.js").HazeToolContext>>;
1496
+ }, NoInfer<import("./toolContextState.js").HazeToolContext>>;
1493
1497
  });