@denizokcu/haze 0.6.0 → 0.7.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 (147) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +59 -12
  3. package/dist/cli/chat/TaskBar.d.ts +9 -0
  4. package/dist/cli/chat/TaskBar.js +40 -0
  5. package/dist/cli/chat/chatMetrics.d.ts +11 -0
  6. package/dist/cli/chat/chatMetrics.js +50 -0
  7. package/dist/cli/chat/inputSuggestions.d.ts +16 -0
  8. package/dist/cli/chat/inputSuggestions.js +55 -0
  9. package/dist/cli/chat/messages.d.ts +9 -0
  10. package/dist/cli/chat/messages.js +76 -0
  11. package/dist/cli/chat/sessionRecorder.d.ts +12 -0
  12. package/dist/cli/chat/sessionRecorder.js +21 -0
  13. package/dist/cli/chat/startupInfo.d.ts +4 -0
  14. package/dist/cli/chat/startupInfo.js +53 -0
  15. package/dist/cli/chat/turnState.d.ts +5 -0
  16. package/dist/cli/chat/turnState.js +20 -0
  17. package/dist/cli/commands/chat.d.ts +0 -1
  18. package/dist/cli/commands/chat.js +293 -894
  19. package/dist/cli/commands/chatModes.d.ts +8 -0
  20. package/dist/cli/commands/chatModes.js +44 -0
  21. package/dist/cli/commands/commandHelp.d.ts +6 -0
  22. package/dist/cli/commands/commandHelp.js +25 -0
  23. package/dist/cli/commands/commands.d.ts +1 -1
  24. package/dist/cli/commands/commands.js +41 -267
  25. package/dist/cli/commands/formatters.js +12 -4
  26. package/dist/cli/commands/initCommand.d.ts +2 -0
  27. package/dist/cli/commands/initCommand.js +19 -0
  28. package/dist/cli/commands/logsCommand.d.ts +2 -0
  29. package/dist/cli/commands/logsCommand.js +63 -0
  30. package/dist/cli/commands/lspWizard.d.ts +14 -0
  31. package/dist/cli/commands/lspWizard.js +44 -0
  32. package/dist/cli/commands/mcpWizard.d.ts +15 -0
  33. package/dist/cli/commands/mcpWizard.js +69 -0
  34. package/dist/cli/commands/modelCommand.d.ts +2 -0
  35. package/dist/cli/commands/modelCommand.js +36 -0
  36. package/dist/cli/commands/providerWizard.d.ts +30 -0
  37. package/dist/cli/commands/providerWizard.js +114 -0
  38. package/dist/cli/commands/runCommand.d.ts +16 -0
  39. package/dist/cli/commands/runCommand.js +170 -0
  40. package/dist/cli/commands/settingsSummary.d.ts +3 -0
  41. package/dist/cli/commands/settingsSummary.js +40 -0
  42. package/dist/cli/commands/skillConfirmRemove.d.ts +11 -0
  43. package/dist/cli/commands/skillConfirmRemove.js +19 -0
  44. package/dist/cli/commands/skillCreation.d.ts +12 -0
  45. package/dist/cli/commands/skillCreation.js +14 -0
  46. package/dist/cli/commands/skillWizard.d.ts +15 -0
  47. package/dist/cli/commands/skillWizard.js +38 -0
  48. package/dist/cli/commands/streaming/assistantText.d.ts +17 -0
  49. package/dist/cli/commands/streaming/assistantText.js +115 -0
  50. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +55 -0
  51. package/dist/cli/commands/streaming/toolGroupRenderer.js +102 -0
  52. package/dist/cli/commands/streaming/toolResultState.d.ts +13 -0
  53. package/dist/cli/commands/streaming/toolResultState.js +25 -0
  54. package/dist/cli/commands/streaming/turnRuntime.d.ts +78 -0
  55. package/dist/cli/commands/streaming/turnRuntime.js +86 -0
  56. package/dist/cli/commands/streaming.d.ts +9 -25
  57. package/dist/cli/commands/streaming.js +82 -347
  58. package/dist/cli/commands/wizardActions.d.ts +40 -0
  59. package/dist/cli/commands/wizardActions.js +40 -0
  60. package/dist/cli/commands/wizardInput.d.ts +4 -0
  61. package/dist/cli/commands/wizardInput.js +19 -0
  62. package/dist/cli/commands/wizardPrompts.d.ts +22 -0
  63. package/dist/cli/commands/wizardPrompts.js +52 -0
  64. package/dist/cli/commands/wizardSuggestions.d.ts +23 -0
  65. package/dist/cli/commands/wizardSuggestions.js +139 -0
  66. package/dist/cli/index.js +62 -4
  67. package/dist/config/contextFiles.d.ts +8 -1
  68. package/dist/config/contextFiles.js +25 -12
  69. package/dist/config/lspSettings.js +3 -6
  70. package/dist/config/mcpSettings.js +5 -5
  71. package/dist/config/providers.js +4 -4
  72. package/dist/config/skillSettings.js +4 -3
  73. package/dist/core/agent/budgets.d.ts +6 -0
  74. package/dist/core/agent/budgets.js +6 -0
  75. package/dist/core/agent/compaction.js +1 -1
  76. package/dist/core/agent/requestAssembly.d.ts +0 -7
  77. package/dist/core/agent/requestAssembly.js +27 -5
  78. package/dist/core/agent/toolOutputStore.js +5 -4
  79. package/dist/core/agent/toolResults.d.ts +31 -0
  80. package/dist/core/agent/toolResults.js +42 -0
  81. package/dist/core/agent/turnPolicy.d.ts +8 -0
  82. package/dist/core/agent/turnPolicy.js +23 -0
  83. package/dist/core/agent/workState.d.ts +18 -5
  84. package/dist/core/agent/workState.js +39 -20
  85. package/dist/core/bashOutput/reducers/content.d.ts +1 -0
  86. package/dist/core/bashOutput/reducers/content.js +1 -1
  87. package/dist/core/bashOutput/reducers/gh.d.ts +1 -0
  88. package/dist/core/bashOutput/reducers/gh.js +77 -0
  89. package/dist/core/bashOutput/registry.js +8 -0
  90. package/dist/core/goal/sessionGoal.d.ts +6 -30
  91. package/dist/core/goal/sessionGoal.js +3 -68
  92. package/dist/core/safety/bashClassifier.js +30 -0
  93. package/dist/core/safety/urlGuard.d.ts +1 -0
  94. package/dist/core/safety/urlGuard.js +6 -1
  95. package/dist/core/session/sessionSlimming.d.ts +5 -0
  96. package/dist/core/session/sessionSlimming.js +78 -0
  97. package/dist/core/session/sessionStore.d.ts +23 -3
  98. package/dist/core/session/sessionStore.js +30 -10
  99. package/dist/core/subagent/subagentRunner.d.ts +11 -1
  100. package/dist/core/subagent/subagentRunner.js +1 -0
  101. package/dist/llm/capabilities.d.ts +12 -0
  102. package/dist/llm/capabilities.js +10 -0
  103. package/dist/llm/client.d.ts +1 -0
  104. package/dist/llm/client.js +11 -2
  105. package/dist/llm/hazeTools.d.ts +31 -32
  106. package/dist/llm/hazeTools.js +40 -567
  107. package/dist/llm/lsp.d.ts +46 -1
  108. package/dist/llm/lsp.js +9 -9
  109. package/dist/llm/lspTools.d.ts +2 -20
  110. package/dist/llm/mcp.js +9 -0
  111. package/dist/llm/requestContext.js +7 -22
  112. package/dist/llm/systemPrompt.d.ts +1 -0
  113. package/dist/llm/systemPrompt.js +1 -1
  114. package/dist/llm/tools/bashTool.d.ts +5 -0
  115. package/dist/llm/tools/bashTool.js +81 -0
  116. package/dist/llm/tools/editMatch.d.ts +55 -0
  117. package/dist/llm/tools/editMatch.js +99 -0
  118. package/dist/llm/tools/failures.d.ts +36 -0
  119. package/dist/llm/tools/failures.js +38 -0
  120. package/dist/llm/tools/fetchTool.d.ts +65 -0
  121. package/dist/llm/tools/fetchTool.js +45 -0
  122. package/dist/llm/tools/fileToolShared.d.ts +10 -0
  123. package/dist/llm/tools/fileToolShared.js +43 -0
  124. package/dist/llm/tools/grepParse.d.ts +13 -0
  125. package/dist/llm/tools/grepParse.js +67 -0
  126. package/dist/llm/tools/outputCap.d.ts +53 -0
  127. package/dist/llm/tools/outputCap.js +67 -0
  128. package/dist/llm/tools/storedOutputTool.d.ts +10 -0
  129. package/dist/llm/tools/storedOutputTool.js +17 -0
  130. package/dist/llm/tools/taskTool.d.ts +28 -0
  131. package/dist/llm/tools/taskTool.js +41 -0
  132. package/dist/llm/tools/toolContext.d.ts +69 -0
  133. package/dist/llm/tools/toolContext.js +187 -0
  134. package/dist/llm/tools/workspaceFile.d.ts +33 -0
  135. package/dist/llm/tools/workspaceFile.js +27 -0
  136. package/dist/llm/webFetch.d.ts +13 -1
  137. package/dist/llm/webFetch.js +91 -7
  138. package/dist/skills/builder/SkillBuilder.d.ts +3 -0
  139. package/dist/skills/builder/SkillBuilder.js +1 -1
  140. package/dist/ui/components/TextInput.js +1 -99
  141. package/dist/ui/inputBuffer.d.ts +28 -0
  142. package/dist/ui/inputBuffer.js +99 -0
  143. package/dist/utils/collections.d.ts +6 -0
  144. package/dist/utils/collections.js +9 -0
  145. package/dist/utils/path.d.ts +2 -0
  146. package/dist/utils/path.js +40 -0
  147. package/package.json +1 -2
@@ -2,224 +2,40 @@ import { ToolLoopAgent, stepCountIs } from 'ai';
2
2
  import { appendLogEntry as logAppend } from '../../core/log/llmLog.js';
3
3
  import { modelWithConfig, providerRequestSettings } from '../../llm/client.js';
4
4
  import { assembleRequestContext } from '../../llm/requestContext.js';
5
+ import { projectContextSection } from '../../llm/systemPrompt.js';
5
6
  import { closeMcpClients } from '../../llm/mcp.js';
6
- import { compact, toolCallSummary, toolResultSummary, formatElapsedTimeWhole, formatSeconds } from './formatters.js';
7
+ import { toolCallSummary, toolResultSummary, formatSeconds } from './formatters.js';
7
8
  import { agentEvent } from '../../core/agent/events.js';
8
9
  import { isContextOverflowError, isRetryableModelError } from '../../core/agent/errors.js';
9
10
  import { isPlanOnlyRequest } from '../../core/goal/requestClassifier.js';
10
11
  import { repeatedToolCallPrompt, toolLoopBudgetPrompt } from '../../core/goal/completionPolicy.js';
11
- import { contextBreakdown, cacheHitRatio, effectiveNonCachedInput, estimateValueTokens } from '../../core/agent/contextBudget.js';
12
+ import { estimateValueTokens } from '../../core/agent/contextBudget.js';
12
13
  import { compactToolHistory, stripSyntheticControls, withSyntheticControl } from '../../core/agent/requestAssembly.js';
14
+ import { isDuplicateSkippedOutput, toolInputField, toolOutputOk } from '../../core/agent/toolResults.js';
15
+ import { uniqueRepeatedToolNames, toolOnlyStepCount } from '../../core/agent/turnPolicy.js';
16
+ export { uniqueRepeatedToolNames, toolOnlyStepCount } from '../../core/agent/turnPolicy.js';
13
17
  import { compactModelMessages } from '../../core/agent/compaction.js';
18
+ import { ACTIVE_CONTEXT_TOKEN_BUDGET, DEFAULT_MAX_OUTPUT_TOKENS, IDLE_TIMEOUT_MS, MAIN_STEP_LIMIT, MAIN_TOOL_CALL_LIMIT, MAIN_TOOL_ONLY_STEP_LIMIT } from '../../core/agent/budgets.js';
14
19
  import { createSessionGoal, formatGoalStatus, observeGoalToolEvent } from '../../core/goal/sessionGoal.js';
15
- function stableToolKey(toolCall) {
16
- return `${toolCall.toolName}:${JSON.stringify(toolCall.input)}`;
17
- }
18
- export function uniqueRepeatedToolNames(toolCalls) {
19
- const seen = new Set();
20
- const repeated = new Set();
21
- for (const toolCall of toolCalls) {
22
- const key = stableToolKey(toolCall);
23
- if (seen.has(key))
24
- repeated.add(toolCall.toolName);
25
- seen.add(key);
26
- }
27
- return [...repeated];
28
- }
29
- export function toolOnlyStepCount(steps) {
30
- let count = 0;
31
- for (const step of [...steps].reverse()) {
32
- if (step.toolCalls.length === 0 || step.text.trim().length > 0)
33
- break;
34
- count += 1;
35
- }
36
- return count;
37
- }
38
- function sanitizeAssistantText(text) {
39
- return [...text].filter(char => {
40
- const code = char.charCodeAt(0);
41
- return !(code <= 8 || code === 11 || code === 12 || (code >= 14 && code <= 31) || code === 127 || code === 155);
42
- }).join('');
43
- }
44
- function hideSyntheticToolCallMarkup(text) {
45
- return text
46
- .replace(/(^|\n)\s*(?:```(?:xml)?\s*)?(?:xml\s*)?<tool_call>[\s\S]*?<\/tool_call>\s*(?:```)?/gi, '$1')
47
- .replace(/(^|\n)\s*(?:```(?:xml)?\s*)?(?:xml\s*)?<tool_call>[\s\S]*$/i, '$1');
48
- }
49
- function isWordChar(char) {
50
- return char.toLowerCase() !== char.toUpperCase() || (char >= '0' && char <= '9');
51
- }
52
- function wordCount(text) {
53
- let count = 0;
54
- let inWord = false;
55
- for (const char of text) {
56
- if (isWordChar(char)) {
57
- if (!inWord)
58
- count += 1;
59
- inWord = true;
60
- }
61
- else {
62
- inWord = false;
63
- }
64
- }
65
- return count;
66
- }
67
- function endsWithSentenceBoundary(text) {
68
- const trimmed = text.trim();
69
- if (!trimmed || wordCount(trimmed) === 0)
70
- return false;
71
- const last = trimmed.at(-1) ?? '';
72
- return last === '.' || last === '!' || last === '?' || last === ':' || last === ';' || last === ')';
73
- }
74
- function isNonSubstantiveAssistantText(text) {
75
- return wordCount(text) === 0;
76
- }
77
- function isSubstantiveAssistantText(text) {
78
- const trimmed = text.trim();
79
- const words = wordCount(trimmed);
80
- if (words === 0)
81
- return false;
82
- if (trimmed.length >= 24)
83
- return true;
84
- if (endsWithSentenceBoundary(trimmed))
85
- return true;
86
- return words >= 4;
87
- }
88
- function isIncompleteAssistantFragment(text) {
89
- const trimmed = text.trim();
90
- return !isSubstantiveAssistantText(trimmed) && wordCount(trimmed) <= 2 && !endsWithSentenceBoundary(trimmed);
91
- }
92
- function isLikelyUnfinishedMarkdownFragment(text) {
93
- const trimmed = text.trim();
94
- if (!trimmed.includes('\n'))
95
- return false;
96
- const last = trimmed.at(-1) ?? '';
97
- return last === '-' || last === '*' || last === '#' || last === '`' || last === '>';
98
- }
99
- export function isShortUnfinishedBridgeBeforeTool(text) {
100
- const trimmed = text.trim();
101
- return trimmed.length > 0 && wordCount(trimmed) <= 12 && !endsWithSentenceBoundary(trimmed) && !isLikelyUnfinishedMarkdownFragment(trimmed);
102
- }
103
- function isHiddenAssistantText(text) {
104
- return text.length === 0 || isNonSubstantiveAssistantText(text);
105
- }
106
- function isHiddenAssistantFragment(text) {
107
- return isHiddenAssistantText(text) || isIncompleteAssistantFragment(text) || isLikelyUnfinishedMarkdownFragment(text);
108
- }
109
- export function isHiddenUnstartedFinalText(text) {
110
- return isHiddenAssistantText(text) || isLikelyUnfinishedMarkdownFragment(text);
111
- }
112
- const ASSISTANT_STREAM_DEBOUNCE_MS = 200;
113
- export function shouldStartAssistantStream(text, startedAt) {
114
- if (isHiddenAssistantFragment(text))
115
- return false;
116
- return isSubstantiveAssistantText(text) || Date.now() - startedAt >= ASSISTANT_STREAM_DEBOUNCE_MS;
117
- }
118
- function assistantDisplayText(text) {
119
- return hideSyntheticToolCallMarkup(text).trim();
120
- }
121
- function normalizeAssistantText(text) {
122
- return assistantDisplayText(text)
123
- .replace(/[`*_~#>\-–—:;,.!?()[\]{}"']/g, '')
124
- .replace(/\s+/g, ' ')
125
- .trim()
126
- .toLowerCase();
127
- }
128
- function toolInputPath(input) {
129
- return typeof input === 'object' && input != null && 'path' in input && typeof input.path === 'string'
130
- ? input.path
131
- : undefined;
132
- }
133
- function isDuplicateSkippedOutput(output) {
134
- return typeof output === 'object' && output != null && 'duplicateSkipped' in output && output.duplicateSkipped === true;
135
- }
136
- function retryDelayMs(attempt) {
137
- return Math.min(4000, 1000 * 2 ** attempt);
138
- }
139
- async function abortableDelay(milliseconds, signal) {
140
- if (signal.aborted)
141
- return;
142
- await new Promise(resolve => {
143
- const timer = setTimeout(resolve, milliseconds);
144
- signal.addEventListener('abort', () => {
145
- clearTimeout(timer);
146
- resolve();
147
- }, { once: true });
148
- });
149
- }
150
- const DEFAULT_MAX_OUTPUT_TOKENS = 16384;
151
- const IDLE_TIMEOUT_MS = 5 * 60_000;
152
- const MAIN_STEP_LIMIT = 64;
153
- const MAIN_TOOL_CALL_LIMIT = 120;
154
- const MAIN_TOOL_ONLY_STEP_LIMIT = 24;
155
- const ACTIVE_CONTEXT_TOKEN_BUDGET = 40_000;
156
- function toolOutputOk(output, success) {
157
- if (!success)
158
- return false;
159
- return !(typeof output === 'object' && output != null && 'ok' in output && output.ok === false);
160
- }
161
- function estimateInputBreakdown(input) {
162
- const breakdown = contextBreakdown(input);
163
- return {
164
- breakdown,
165
- systemPrompt: breakdown.system,
166
- messages: Object.values(breakdown.messagesByRole).reduce((sum, value) => sum + value, 0),
167
- toolSchemas: breakdown.toolSchemas.reduce((sum, value) => sum + value.tokens, 0),
168
- logicalInputEstimate: breakdown.logicalInputEstimate,
169
- };
170
- }
20
+ import { sanitizeAssistantText, assistantDisplayText, normalizeAssistantText, shouldStartAssistantStream, isHiddenAssistantFragment, isHiddenUnstartedFinalText, isShortLeadInBeforeTool, isShortUnfinishedLeadIn } from './streaming/assistantText.js';
21
+ import { createToolGroupRenderer } from './streaming/toolGroupRenderer.js';
22
+ import { applyToolResultState, initialToolResultState, isMutatingToolName } from './streaming/toolResultState.js';
23
+ import { abortableDelay, estimateInputBreakdown, extractUsage, rememberContextFilesFromToolOutput, responseCompletionMetrics, retryDelayMs, stepCacheMetrics, subagentTokenEstimate } from './streaming/turnRuntime.js';
171
24
  function logEntry(log, entry) {
172
25
  if (log)
173
26
  void logAppend(log, entry).catch(() => undefined);
174
27
  }
175
- function responseCompletionMetrics(text, generationStartedAt) {
176
- const finishedAt = Date.now();
177
- const elapsedSeconds = Math.max((finishedAt - generationStartedAt) / 1000, 0.001);
178
- const outputTokens = estimateValueTokens(text);
179
- return {
180
- finishedAt,
181
- tokensPerSecond: outputTokens > 0 ? outputTokens / elapsedSeconds : undefined,
182
- };
183
- }
184
- function extractUsage(event) {
185
- const cacheReadTokens = event.usage?.inputTokenDetails?.cacheReadTokens ?? 0;
186
- return {
187
- inputTokens: event.usage?.inputTokens,
188
- outputTokens: event.usage?.outputTokens,
189
- cacheReadTokens,
190
- cacheWriteTokens: event.usage?.inputTokenDetails?.cacheWriteTokens ?? 0,
191
- noCacheTokens: event.usage?.inputTokenDetails?.noCacheTokens ?? effectiveNonCachedInput(event.usage?.inputTokens, cacheReadTokens) ?? 0,
192
- reasoningTokens: event.usage?.outputTokenDetails?.reasoningTokens ?? 0,
193
- };
194
- }
195
- function subagentTokenEstimate(output) {
196
- if (typeof output !== 'object' || output == null || !('tokens' in output))
197
- return undefined;
198
- const tokens = output.tokens;
199
- const input = typeof tokens?.in === 'number' ? tokens.in : 0;
200
- const outputTokens = typeof tokens?.out === 'number' ? tokens.out : 0;
201
- return input > 0 || outputTokens > 0 ? { input, output: outputTokens } : undefined;
202
- }
203
- function rememberContextFilesFromToolOutput(activeContextFiles, output) {
204
- if (typeof output !== 'object' || output == null)
205
- return activeContextFiles;
206
- const files = output.applicableProjectInstructions;
207
- if (!Array.isArray(files))
208
- return activeContextFiles;
209
- const seen = new Set(activeContextFiles.map(file => file.path));
210
- const next = [...activeContextFiles];
211
- for (const file of files) {
212
- if (typeof file !== 'object' || file == null)
213
- continue;
214
- const candidate = file;
215
- if (typeof candidate.path !== 'string' || typeof candidate.content !== 'string' || seen.has(candidate.path))
216
- continue;
217
- next.push({ path: candidate.path, content: candidate.content });
218
- seen.add(candidate.path);
219
- }
220
- return next;
28
+ function withScopedContextSystem(messages, context) {
29
+ const files = context.pendingContextFiles ?? [];
30
+ if (files.length === 0)
31
+ return messages;
32
+ context.pendingContextFiles = [];
33
+ return [
34
+ ...messages,
35
+ { role: 'system', content: `Additional scoped project instructions were just read for a non-root path touched by a tool call. Apply them to subsequent work in that subtree.${projectContextSection(files)}` },
36
+ ];
221
37
  }
222
- export async function runAgentTurn(value, displayValue, contextFiles, callbacks, retryAttempt = 0, retryingExistingRequest = false, contextOverflowRecovered = false, session) {
38
+ export async function runAgentTurn(value, displayValue, contextFiles, callbacks, retryAttempt = 0, retryingExistingRequest = false, contextOverflowRecovered = false, session, modelOverride) {
223
39
  const displayVal = displayValue ?? value;
224
40
  callbacks.onEvent?.(agentEvent({ type: 'turn_start', request: value }));
225
41
  callbacks.setBusy(true);
@@ -238,86 +54,13 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
238
54
  abortController.abort('Haze turn timed out after no model/tool activity.');
239
55
  }, IDLE_TIMEOUT_MS);
240
56
  };
241
- const createToolGroup = () => ({ id: `tools-${Date.now()}-${Math.random().toString(36).slice(2)}`, items: [], started: false, finalized: false });
242
- let toolGroup = createToolGroup();
243
- let toolTimer;
244
- const renderToolGroup = (group = toolGroup) => {
245
- const running = group.items.some(item => item.status === 'running');
246
- const failures = group.items.filter(item => item.status === 'error').length;
247
- const changes = group.items.filter(item => /^(editFile|replaceLines|writeFile)\b/.test(item.summary)).length;
248
- const elapsedMs = group.items.length > 0
249
- ? (running ? Date.now() : Math.max(...group.items.map(item => item.finishedAt ?? item.startedAt))) - Math.min(...group.items.map(item => item.startedAt))
250
- : 0;
251
- const summaryParts = [`${group.items.length} calls`, `${changes} changes`];
252
- if (failures > 0)
253
- summaryParts.push(`${failures} failed`);
254
- summaryParts.push(formatElapsedTimeWhole(elapsedMs));
255
- return [summaryParts.join(' · '), ...group.items.map(item => {
256
- const icon = item.status === 'running' ? '…' : item.status === 'success' ? '✓' : '✗';
257
- const result = item.status === 'running' ? '' : ` — ${item.result ?? item.status}${item.durationMs == null ? '' : ` in ${formatSeconds(item.durationMs)}`}`;
258
- return ` ${icon} ${item.summary}${result}`;
259
- })].join('\n');
260
- };
261
- const updateToolGroup = (streaming = true, group = toolGroup) => {
262
- const text = renderToolGroup(group);
263
- if (!group.started) {
264
- group.started = true;
265
- group.finalized = !streaming;
266
- callbacks.addMessage({ id: group.id, role: 'tool', text, streaming });
267
- }
268
- else {
269
- group.finalized = !streaming;
270
- callbacks.updateMessage(group.id, { text, streaming });
271
- }
272
- };
273
- const finalizeToolGroup = (group = toolGroup) => {
274
- if (!group.started || group.finalized)
275
- return;
276
- updateToolGroup(false, group);
277
- };
278
- const startFreshToolGroup = () => {
279
- if (!toolGroup.started || toolGroup.items.some(item => item.status === 'running'))
280
- return;
281
- finalizeToolGroup(toolGroup);
282
- toolGroup = createToolGroup();
283
- };
284
- const stopToolTimer = () => {
285
- if (!toolTimer)
286
- return;
287
- clearInterval(toolTimer);
288
- toolTimer = undefined;
289
- };
290
- const startToolTimer = () => {
291
- if (toolTimer)
292
- return;
293
- toolTimer = setInterval(() => {
294
- if (toolGroup.items.some(item => item.status === 'running'))
295
- updateToolGroup(true);
296
- else
297
- stopToolTimer();
298
- }, 1000);
299
- };
300
- const ensureToolItem = (toolCall) => {
301
- if (toolGroup.finalized)
302
- toolGroup = createToolGroup();
303
- let item = toolGroup.items.find(candidate => candidate.id === toolCall.toolCallId);
304
- if (!item) {
305
- item = { id: toolCall.toolCallId, summary: toolCallSummary(toolCall.toolName, toolCall.input), status: 'running', startedAt: Date.now() };
306
- toolGroup.items.push(item);
307
- callbacks.onEvent?.(agentEvent({ type: 'tool_start', id: toolCall.toolCallId, name: toolCall.toolName, input: toolCall.input }));
308
- logEntry(callbacks.log, { at: new Date().toISOString(), type: 'tool_call', stream: 'main', toolCall: { id: toolCall.toolCallId, name: toolCall.toolName, input: toolCall.input } });
309
- callbacks.debugLog(`tool start: ${toolCall.toolName} ${compact(toolCall.input)}`);
310
- startToolTimer();
311
- updateToolGroup(true);
312
- }
313
- return item;
314
- };
57
+ const toolDisplay = createToolGroupRenderer({ addMessage: callbacks.addMessage, updateMessage: callbacks.updateMessage, debugLog: callbacks.debugLog, onEvent: callbacks.onEvent, log: callbacks.log });
315
58
  try {
316
- const runtime = await modelWithConfig(session ? { cwd: session.cwd } : undefined);
59
+ const runtime = await modelWithConfig({ cwd: session?.cwd, modelSelector: modelOverride });
317
60
  if (!runtime?.model) {
318
61
  callbacks.addMessage({ role: 'assistant', text: 'No model provider configured. Run /provider to choose or add a provider. Haze cannot hallucinate without a model. Progress.' });
319
62
  turnStatus = 'complete';
320
- return;
63
+ return { status: turnStatus };
321
64
  }
322
65
  let activeContextFiles = contextFiles;
323
66
  const activeModel = runtime.model;
@@ -328,7 +71,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
328
71
  if (loadedMcp?.errors.length)
329
72
  callbacks.addMessage({ role: 'system', text: `MCP: ${loadedMcp.errors.join('; ')}` });
330
73
  const goal = createSessionGoal(value);
331
- callbacks.setWorkState?.(goal.workState);
74
+ callbacks.setWorkState?.(goal);
332
75
  callbacks.setGoalStatus?.(formatGoalStatus(goal));
333
76
  const likelyPlanOnlyRequest = isPlanOnlyRequest(value);
334
77
  const durableRequestMessages = compactToolHistory(retryingExistingRequest
@@ -336,7 +79,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
336
79
  : [...stripSyntheticControls(callbacks.getConversation()), { role: 'user', content: value }]).messages;
337
80
  let requestMessages = durableRequestMessages;
338
81
  if (estimateValueTokens(requestMessages) > ACTIVE_CONTEXT_TOKEN_BUDGET) {
339
- requestMessages = compactModelMessages(requestMessages, { tokenBudget: ACTIVE_CONTEXT_TOKEN_BUDGET, workState: goal.workState }).messages;
82
+ requestMessages = compactModelMessages(requestMessages, { tokenBudget: ACTIVE_CONTEXT_TOKEN_BUDGET, workState: goal }).messages;
340
83
  }
341
84
  callbacks.setConversation(stripSyntheticControls(requestMessages));
342
85
  const systemPrompt = assembled.systemPrompt;
@@ -351,7 +94,8 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
351
94
  visibleAssistantTexts.add(normalized);
352
95
  callbacks.setLastAssistantText(text);
353
96
  };
354
- const toolExecutionContext = { inFlightToolCalls: new Map(), loadedContextFilePaths: new Set(activeContextFiles.map(file => file.path)) };
97
+ const contextFileSignatures = callbacks.contextFileSignatures ?? new Map(activeContextFiles.flatMap(file => file.signature ? [[file.path, file.signature]] : []));
98
+ const toolExecutionContext = { inFlightToolCalls: new Map(), loadedContextFilePaths: new Set(activeContextFiles.map(file => file.path)), loadedContextFileSignatures: contextFileSignatures, onContextFileRead: path => toolDisplay.addContextFileRead(path) };
355
99
  const startedTools = new Map();
356
100
  const latestToolCalls = new Map();
357
101
  let latestAccumulatedResponseMessages = [];
@@ -362,9 +106,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
362
106
  let currentAssistantText = '';
363
107
  let streamError;
364
108
  let streamFinished = false;
365
- let mutatingToolSucceeded = false;
366
- let editRecoveryPath;
367
- let editRecoveryReadSatisfied = false;
109
+ let toolResultState = initialToolResultState();
368
110
  const resetAssistantSegment = () => {
369
111
  currentAssistantId = `assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;
370
112
  assistantStarted = false;
@@ -374,7 +116,10 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
374
116
  const finalizeAssistantSegment = (options = {}) => {
375
117
  const finalText = assistantDisplayText(currentAssistantText);
376
118
  const normalized = normalizeAssistantText(finalText);
377
- const hidden = (assistantStarted ? isHiddenAssistantFragment(finalText) : isHiddenUnstartedFinalText(finalText)) || (options.beforeTool === true && isShortUnfinishedBridgeBeforeTool(finalText)) || (normalized.length > 0 && visibleAssistantTexts.has(normalized));
119
+ const hidden = (assistantStarted ? isHiddenAssistantFragment(finalText) : isHiddenUnstartedFinalText(finalText))
120
+ || (options.beforeTool === true && isShortLeadInBeforeTool(finalText))
121
+ || (options.beforeTool !== true && isShortUnfinishedLeadIn(finalText))
122
+ || (normalized.length > 0 && visibleAssistantTexts.has(normalized));
378
123
  if (assistantStarted) {
379
124
  if (!hidden)
380
125
  rememberVisibleAssistantText(finalText);
@@ -403,34 +148,30 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
403
148
  prepareStep({ steps, messages }) {
404
149
  const toolCalls = steps.flatMap(step => step.toolCalls);
405
150
  const repeatedToolNames = uniqueRepeatedToolNames(toolCalls);
406
- if (likelyPlanOnlyRequest && mutatingToolSucceeded)
407
- return { toolChoice: 'none' };
408
- if (editRecoveryPath && !editRecoveryReadSatisfied)
409
- return { activeTools: ['readFile'] };
151
+ const scopedMessages = withScopedContextSystem(messages, toolExecutionContext);
152
+ const messagesChanged = scopedMessages !== messages;
153
+ if (likelyPlanOnlyRequest && toolResultState.mutatingToolSucceeded)
154
+ return messagesChanged ? { toolChoice: 'none', messages: scopedMessages } : { toolChoice: 'none' };
155
+ if (toolResultState.editRecoveryPath && !toolResultState.editRecoveryReadSatisfied)
156
+ return messagesChanged ? { activeTools: ['readFile'], messages: scopedMessages } : { activeTools: ['readFile'] };
410
157
  if (repeatedToolNames.length > 0) {
411
158
  const activeTools = Object.keys(availableTools).filter(name => !repeatedToolNames.includes(name));
412
159
  callbacks.debugLog(`disabling repeated tools for next step: ${repeatedToolNames.join(', ')}`);
413
160
  return activeTools.length > 0
414
- ? { activeTools, messages: withSyntheticControl(messages, repeatedToolCallPrompt(repeatedToolNames)) }
415
- : { toolChoice: 'none', messages: withSyntheticControl(messages, repeatedToolCallPrompt(repeatedToolNames)) };
161
+ ? { activeTools, messages: withSyntheticControl(scopedMessages, repeatedToolCallPrompt(repeatedToolNames)) }
162
+ : { toolChoice: 'none', messages: withSyntheticControl(scopedMessages, repeatedToolCallPrompt(repeatedToolNames)) };
416
163
  }
417
164
  if (toolCalls.length >= MAIN_TOOL_CALL_LIMIT || toolOnlyStepCount(steps) >= MAIN_TOOL_ONLY_STEP_LIMIT) {
418
165
  callbacks.debugLog('forcing text response to avoid tool loop');
419
- return { toolChoice: 'none', messages: withSyntheticControl(messages, toolLoopBudgetPrompt()) };
166
+ return { toolChoice: 'none', messages: withSyntheticControl(scopedMessages, toolLoopBudgetPrompt()) };
420
167
  }
421
- return undefined;
168
+ return messagesChanged ? { messages: scopedMessages } : undefined;
422
169
  },
423
170
  onStepFinish({ stepNumber, text, toolCalls, toolResults, finishReason, usage, response }) {
424
171
  if (Array.isArray(response?.messages) && response.messages.length > 0)
425
172
  latestAccumulatedResponseMessages = response.messages;
426
- const stepInputTokens = usage?.inputTokens;
427
- const stepOutputTokens = usage?.outputTokens;
428
- const stepCacheRead = usage?.inputTokenDetails?.cacheReadTokens ?? 0;
429
- const stepCacheWrite = usage?.inputTokenDetails?.cacheWriteTokens ?? 0;
430
- const stepReasoning = usage?.outputTokenDetails?.reasoningTokens ?? 0;
431
- const stepNoCache = effectiveNonCachedInput(stepInputTokens, stepCacheRead) ?? 0;
432
- const stepCacheHitRatio = cacheHitRatio(stepInputTokens, stepCacheRead || undefined);
433
- logEntry(callbacks.log, { at: new Date().toISOString(), type: 'step', stream: 'main', step: stepNumber, text, finishReason, usage: { inputTokens: stepInputTokens, outputTokens: stepOutputTokens, cacheReadTokens: stepCacheRead || undefined, cacheWriteTokens: stepCacheWrite || undefined, noCacheTokens: stepNoCache || undefined, reasoningTokens: stepReasoning || undefined, cacheHitRatio: stepCacheHitRatio } });
173
+ const stepUsage = stepCacheMetrics(usage);
174
+ logEntry(callbacks.log, { at: new Date().toISOString(), type: 'step', stream: 'main', step: stepNumber, text, finishReason, usage: { inputTokens: stepUsage.inputTokens, outputTokens: usage?.outputTokens, cacheReadTokens: stepUsage.cacheReadTokens || undefined, cacheWriteTokens: stepUsage.cacheWriteTokens || undefined, noCacheTokens: stepUsage.noCacheTokens || undefined, reasoningTokens: stepUsage.reasoningTokens || undefined, cacheHitRatio: stepUsage.cacheHitRatio } });
434
175
  callbacks.debugLog(`step ${stepNumber} finished: ${finishReason}; text=${text.length}; toolCalls=${toolCalls.length}; toolResults=${toolResults.length}`);
435
176
  },
436
177
  onFinish(event) {
@@ -447,7 +188,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
447
188
  noCacheTokens: providerUsage.noCacheTokens,
448
189
  reasoningTokens: providerUsage.reasoningTokens,
449
190
  logicalInputEstimate: inputBreakdown.logicalInputEstimate,
450
- effectiveNonCachedInput: effectiveNonCachedInput(providerUsage.inputTokens, providerUsage.cacheReadTokens),
191
+ effectiveNonCachedInput: providerUsage.effectiveNonCachedInput,
451
192
  });
452
193
  const accumulated = [...stripSyntheticControls(requestMessages), ...event.response.messages];
453
194
  const compacted = compactToolHistory(accumulated);
@@ -461,7 +202,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
461
202
  resetIdleTimer();
462
203
  switch (part.type) {
463
204
  case 'text-delta': {
464
- startFreshToolGroup();
205
+ toolDisplay.startFreshToolGroup();
465
206
  const delta = sanitizeAssistantText(part.text);
466
207
  assistantText += delta;
467
208
  currentAssistantText += delta;
@@ -481,23 +222,31 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
481
222
  break;
482
223
  }
483
224
  case 'tool-input-start': {
484
- if (currentAssistantText.trim().length > 0 || assistantStarted)
485
- finalizeAssistantSegment({ beforeTool: true });
225
+ if (currentAssistantText.trim().length > 0 || assistantStarted) {
226
+ const pending = assistantDisplayText(currentAssistantText);
227
+ const shown = finalizeAssistantSegment({ beforeTool: true });
228
+ if (!shown && pending)
229
+ toolDisplay.setGroupCaption(pending);
230
+ }
486
231
  const toolCall = { toolCallId: part.id, toolName: part.toolName, input: {} };
487
232
  latestToolCalls.set(part.id, toolCall);
488
233
  startedTools.set(part.id, Date.now());
489
- ensureToolItem(toolCall);
234
+ toolDisplay.ensureToolItem(toolCall);
490
235
  break;
491
236
  }
492
237
  case 'tool-call': {
493
- if (currentAssistantText.trim().length > 0 || assistantStarted)
494
- finalizeAssistantSegment({ beforeTool: true });
238
+ if (currentAssistantText.trim().length > 0 || assistantStarted) {
239
+ const pending = assistantDisplayText(currentAssistantText);
240
+ const shown = finalizeAssistantSegment({ beforeTool: true });
241
+ if (!shown && pending)
242
+ toolDisplay.setGroupCaption(pending);
243
+ }
495
244
  const toolCall = { toolCallId: part.toolCallId, toolName: part.toolName, input: part.input };
496
245
  latestToolCalls.set(part.toolCallId, toolCall);
497
246
  if (!startedTools.has(part.toolCallId))
498
247
  startedTools.set(part.toolCallId, Date.now());
499
- ensureToolItem(toolCall).summary = toolCallSummary(part.toolName, part.input);
500
- updateToolGroup(true);
248
+ toolDisplay.ensureToolItem(toolCall).summary = toolCallSummary(part.toolName, part.input);
249
+ toolDisplay.updateToolGroup(true);
501
250
  break;
502
251
  }
503
252
  case 'tool-result': {
@@ -505,7 +254,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
505
254
  latestToolCalls.set(part.toolCallId, toolCall);
506
255
  const startedAt = startedTools.get(part.toolCallId) ?? Date.now();
507
256
  const finish = { toolCall, success: true, output: part.output, durationMs: Date.now() - startedAt };
508
- const item = ensureToolItem(toolCall);
257
+ const item = toolDisplay.ensureToolItem(toolCall);
509
258
  item.status = toolOutputOk(part.output, true) ? 'success' : 'error';
510
259
  item.result = toolResultSummary(finish);
511
260
  item.durationMs = finish.durationMs;
@@ -513,23 +262,9 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
513
262
  callbacks.onEvent?.(agentEvent({ type: 'tool_end', id: toolCall.toolCallId, name: toolCall.toolName, success: true, output: part.output, durationMs: finish.durationMs }));
514
263
  logEntry(callbacks.log, { at: new Date().toISOString(), type: 'tool_result', stream: 'main', toolResult: { id: toolCall.toolCallId, name: toolCall.toolName, success: true, output: part.output, durationMs: finish.durationMs } });
515
264
  const ok = toolOutputOk(part.output, true);
516
- const path = toolInputPath(toolCall.input);
517
- if (!ok && ['editFile', 'replaceLines', 'writeFile'].includes(toolCall.toolName)) {
518
- editRecoveryPath = path;
519
- editRecoveryReadSatisfied = false;
520
- }
521
- if (ok && toolCall.toolName === 'readFile' && path && path === editRecoveryPath && !isDuplicateSkippedOutput(part.output)) {
522
- editRecoveryReadSatisfied = true;
523
- }
524
- if (ok && !isDuplicateSkippedOutput(part.output) && ['editFile', 'replaceLines', 'writeFile'].includes(toolCall.toolName)) {
525
- mutatingToolSucceeded = true;
526
- if (!path || path === editRecoveryPath) {
527
- editRecoveryPath = undefined;
528
- editRecoveryReadSatisfied = false;
529
- }
530
- }
265
+ toolResultState = applyToolResultState(toolResultState, { toolName: toolCall.toolName, input: toolCall.input, output: part.output, ok });
531
266
  observeGoalToolEvent(goal, { ...toolCall, success: ok, output: part.output, duplicateSkipped: isDuplicateSkippedOutput(part.output) });
532
- callbacks.setWorkState?.(goal.workState);
267
+ callbacks.setWorkState?.(goal);
533
268
  callbacks.setGoalStatus?.(formatGoalStatus(goal));
534
269
  activeContextFiles = rememberContextFilesFromToolOutput(activeContextFiles, part.output);
535
270
  if (toolCall.toolName === 'writeTasks')
@@ -537,7 +272,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
537
272
  const nestedTokens = subagentTokenEstimate(part.output);
538
273
  if (nestedTokens)
539
274
  callbacks.recordTokenUsage?.({ inputTokens: nestedTokens.input, outputTokens: nestedTokens.output, systemPrompt: 0, messages: 0, toolSchemas: 0, outputEstimate: 0, cacheReadTokens: 0, cacheWriteTokens: 0, noCacheTokens: nestedTokens.input, reasoningTokens: 0, logicalInputEstimate: nestedTokens.input, effectiveNonCachedInput: nestedTokens.input });
540
- updateToolGroup(true);
275
+ toolDisplay.updateToolGroup(true);
541
276
  break;
542
277
  }
543
278
  case 'tool-error': {
@@ -545,21 +280,20 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
545
280
  const toolCall = { toolCallId: part.toolCallId, toolName: part.toolName, input: part.input ?? existing?.input };
546
281
  const startedAt = startedTools.get(part.toolCallId) ?? Date.now();
547
282
  const finish = { toolCall, success: false, error: part.error, durationMs: Date.now() - startedAt };
548
- const item = ensureToolItem(toolCall);
283
+ const item = toolDisplay.ensureToolItem(toolCall);
549
284
  item.status = 'error';
550
285
  item.result = toolResultSummary(finish);
551
286
  item.durationMs = finish.durationMs;
552
287
  item.finishedAt = startedAt + finish.durationMs;
553
288
  callbacks.onEvent?.(agentEvent({ type: 'tool_end', id: toolCall.toolCallId, name: toolCall.toolName, success: false, error: part.error, durationMs: finish.durationMs }));
554
289
  logEntry(callbacks.log, { at: new Date().toISOString(), type: 'tool_result', stream: 'main', toolResult: { id: toolCall.toolCallId, name: toolCall.toolName, success: false, error: part.error, durationMs: finish.durationMs } });
555
- if (['editFile', 'replaceLines', 'writeFile'].includes(toolCall.toolName)) {
556
- editRecoveryPath = toolInputPath(toolCall.input);
557
- editRecoveryReadSatisfied = false;
290
+ if (isMutatingToolName(toolCall.toolName)) {
291
+ toolResultState = { ...toolResultState, editRecoveryPath: toolInputField(toolCall.input, 'path'), editRecoveryReadSatisfied: false };
558
292
  }
559
- observeGoalToolEvent(goal, { ...toolCall, success: false, error: part.error });
560
- callbacks.setWorkState?.(goal.workState);
293
+ observeGoalToolEvent(goal, { ...toolCall, success: false, output: part.error });
294
+ callbacks.setWorkState?.(goal);
561
295
  callbacks.setGoalStatus?.(formatGoalStatus(goal));
562
- updateToolGroup(true);
296
+ toolDisplay.updateToolGroup(true);
563
297
  break;
564
298
  }
565
299
  case 'error':
@@ -593,7 +327,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
593
327
  finalizeAssistantSegment();
594
328
  }
595
329
  else if (latestToolCalls.size > 0) {
596
- const fallback = `Finished tool work.${toolInputPath([...latestToolCalls.values()].at(-1)?.input) ? '' : ''}`;
330
+ const fallback = 'Finished tool work.';
597
331
  callbacks.addMessage({ id: currentAssistantId, role: 'assistant', text: fallback, streaming: false, startedAt: assistantStartedAt, ...responseCompletionMetrics(fallback, assistantStartedAt) });
598
332
  }
599
333
  goal.phase = 'done';
@@ -615,8 +349,7 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
615
349
  callbacks.onEvent?.(agentEvent({ type: 'context_overflow', recovered: compacted, error: text }));
616
350
  if (compacted) {
617
351
  callbacks.addMessage({ role: 'system', text: 'Context overflow detected; compacted older context and retrying the same request once.' });
618
- await runAgentTurn(value, displayValue, contextFiles, callbacks, retryAttempt, true, true, session);
619
- return;
352
+ return await runAgentTurn(value, displayValue, contextFiles, callbacks, retryAttempt, true, true, session, modelOverride);
620
353
  }
621
354
  callbacks.addMessage({ role: 'system', text: 'Context overflow detected, but there was not enough conversation history to compact automatically.' });
622
355
  }
@@ -626,10 +359,11 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
626
359
  callbacks.onEvent?.(agentEvent({ type: 'retry', attempt: retryAttempt + 1, maxAttempts: maxRetries, delayMs: delay, error: text }));
627
360
  callbacks.addMessage({ role: 'system', text: `Transient model error; retrying attempt ${retryAttempt + 1}/${maxRetries} in ${formatSeconds(delay)}: ${text}` });
628
361
  await abortableDelay(delay, abortController.signal);
629
- if (abortController.signal.aborted)
630
- return;
631
- await runAgentTurn(value, displayValue, contextFiles, callbacks, retryAttempt + 1, true, contextOverflowRecovered, session);
632
- return;
362
+ if (abortController.signal.aborted) {
363
+ turnStatus = 'aborted';
364
+ return { status: turnStatus };
365
+ }
366
+ return await runAgentTurn(value, displayValue, contextFiles, callbacks, retryAttempt + 1, true, contextOverflowRecovered, session, modelOverride);
633
367
  }
634
368
  callbacks.addMessage({ role: 'assistant', text: `Model call failed: ${text}` });
635
369
  }
@@ -639,11 +373,12 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
639
373
  await closeMcpClients(loadedMcp.clients);
640
374
  if (idleTimer)
641
375
  clearTimeout(idleTimer);
642
- stopToolTimer();
643
- finalizeToolGroup();
376
+ toolDisplay.stopToolTimer();
377
+ toolDisplay.finalizeToolGroup();
644
378
  callbacks.onEvent?.(agentEvent({ type: 'turn_end', request: value, status: turnStatus }));
645
379
  callbacks.setAbortController?.(null);
646
380
  callbacks.setBusyLabel?.('Haze is thinking');
647
381
  callbacks.setBusy(false);
648
382
  }
383
+ return { status: turnStatus };
649
384
  }
@@ -0,0 +1,40 @@
1
+ export declare const PROVIDER_CHOICES: {
2
+ readonly addProvider: "add provider";
3
+ readonly custom: "custom";
4
+ };
5
+ export declare const PROVIDER_ACTIONS: {
6
+ readonly useProvider: "use provider";
7
+ readonly addModels: "add models";
8
+ readonly setApiKey: "set API key";
9
+ readonly removeModels: "remove models";
10
+ readonly removeProvider: "remove provider";
11
+ };
12
+ export declare const SERVER_CHOICES: {
13
+ readonly addServer: "add server";
14
+ readonly custom: "custom";
15
+ };
16
+ export declare const COMMON_ACTIONS: {
17
+ readonly enable: "enable";
18
+ readonly disable: "disable";
19
+ };
20
+ export declare const LSP_ACTIONS: {
21
+ readonly removeServer: "remove server";
22
+ };
23
+ export declare const MCP_ACTIONS: {
24
+ readonly setApiKey: "set API key";
25
+ readonly removeServer: "remove server";
26
+ };
27
+ export declare const MCP_TRANSPORTS: {
28
+ readonly http: "http";
29
+ readonly sse: "sse";
30
+ readonly stdio: "stdio";
31
+ };
32
+ export declare const SKILL_CHOICES: {
33
+ readonly addSkill: "add skill";
34
+ };
35
+ export declare const SKILL_ACTIONS: {
36
+ readonly showInfo: "show info";
37
+ readonly validate: "validate";
38
+ readonly removeSkill: "remove skill";
39
+ };
40
+ export declare const YES_CONFIRMATION = "yes";