@denizokcu/haze 0.9.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 (241) hide show
  1. package/CHANGELOG.md +133 -17
  2. package/README.md +164 -68
  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/chatMetrics.d.ts +17 -1
  9. package/dist/cli/chat/chatMetrics.js +22 -5
  10. package/dist/cli/chat/contextReport.d.ts +11 -0
  11. package/dist/cli/chat/contextReport.js +46 -0
  12. package/dist/cli/chat/fileMentionSuggestions.d.ts +29 -0
  13. package/dist/cli/chat/fileMentionSuggestions.js +92 -0
  14. package/dist/cli/chat/inputSuggestions.d.ts +5 -0
  15. package/dist/cli/chat/inputSuggestions.js +17 -3
  16. package/dist/cli/chat/liveRegion.d.ts +25 -0
  17. package/dist/cli/chat/liveRegion.js +48 -0
  18. package/dist/cli/chat/messages.d.ts +33 -2
  19. package/dist/cli/chat/messages.js +216 -33
  20. package/dist/cli/chat/sessionLifecycle.d.ts +67 -0
  21. package/dist/cli/chat/sessionLifecycle.js +205 -0
  22. package/dist/cli/chat/sessionRecorder.js +80 -14
  23. package/dist/cli/chat/startupInfo.js +11 -4
  24. package/dist/cli/chat/tips.d.ts +21 -0
  25. package/dist/cli/chat/tips.js +43 -0
  26. package/dist/cli/chat/wizardDispatch.d.ts +64 -0
  27. package/dist/cli/chat/wizardDispatch.js +744 -0
  28. package/dist/cli/commands/chat.d.ts +6 -0
  29. package/dist/cli/commands/chat.js +373 -790
  30. package/dist/cli/commands/chatModes.d.ts +1 -1
  31. package/dist/cli/commands/chatModes.js +7 -2
  32. package/dist/cli/commands/commandHelp.js +5 -3
  33. package/dist/cli/commands/commands.d.ts +5 -2
  34. package/dist/cli/commands/commands.js +22 -18
  35. package/dist/cli/commands/doctor.d.ts +19 -0
  36. package/dist/cli/commands/doctor.js +76 -0
  37. package/dist/cli/commands/fleetCommand.d.ts +14 -0
  38. package/dist/cli/commands/fleetCommand.js +46 -0
  39. package/dist/cli/commands/formatters.d.ts +5 -0
  40. package/dist/cli/commands/formatters.js +35 -6
  41. package/dist/cli/commands/logsCommand.js +1 -7
  42. package/dist/cli/commands/modelCommand.js +1 -1
  43. package/dist/cli/commands/ndjsonSink.d.ts +23 -0
  44. package/dist/cli/commands/ndjsonSink.js +38 -0
  45. package/dist/cli/commands/providerWizard.d.ts +10 -2
  46. package/dist/cli/commands/providerWizard.js +50 -4
  47. package/dist/cli/commands/runCommand.d.ts +4 -0
  48. package/dist/cli/commands/runCommand.js +142 -16
  49. package/dist/cli/commands/sessionPicker.d.ts +9 -0
  50. package/dist/cli/commands/sessionPicker.js +29 -0
  51. package/dist/cli/commands/settingsSummary.js +6 -4
  52. package/dist/cli/commands/skillConfirmRemove.js +4 -3
  53. package/dist/cli/commands/skillWizard.d.ts +2 -0
  54. package/dist/cli/commands/skillWizard.js +16 -6
  55. package/dist/cli/commands/streaming/abortCause.d.ts +24 -0
  56. package/dist/cli/commands/streaming/abortCause.js +16 -0
  57. package/dist/cli/commands/streaming/assistantText.js +9 -2
  58. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +65 -0
  59. package/dist/cli/commands/streaming/goalCheckpoint.js +23 -0
  60. package/dist/cli/commands/streaming/goalSupervisor.d.ts +64 -0
  61. package/dist/cli/commands/streaming/goalSupervisor.js +127 -0
  62. package/dist/cli/commands/streaming/idleTimer.d.ts +26 -0
  63. package/dist/cli/commands/streaming/idleTimer.js +24 -0
  64. package/dist/cli/commands/streaming/toolCallRecovery.d.ts +2 -0
  65. package/dist/cli/commands/streaming/toolCallRecovery.js +24 -0
  66. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +31 -0
  67. package/dist/cli/commands/streaming/toolGroupRenderer.js +50 -2
  68. package/dist/cli/commands/streaming/toolResultState.d.ts +6 -1
  69. package/dist/cli/commands/streaming/toolResultState.js +29 -7
  70. package/dist/cli/commands/streaming/turnOutcome.d.ts +17 -0
  71. package/dist/cli/commands/streaming/turnOutcome.js +27 -11
  72. package/dist/cli/commands/streaming/turnRuntime.js +6 -4
  73. package/dist/cli/commands/streaming.d.ts +82 -3
  74. package/dist/cli/commands/streaming.js +528 -91
  75. package/dist/cli/commands/wizardActions.d.ts +7 -0
  76. package/dist/cli/commands/wizardActions.js +7 -0
  77. package/dist/cli/commands/wizardPrompts.js +7 -1
  78. package/dist/cli/commands/wizardSuggestions.d.ts +8 -0
  79. package/dist/cli/commands/wizardSuggestions.js +64 -14
  80. package/dist/cli/commands/wizardTransition.d.ts +4 -0
  81. package/dist/cli/commands/wizardTransition.js +1 -2
  82. package/dist/cli/index.js +82 -22
  83. package/dist/cli/terminalTitle.d.ts +6 -0
  84. package/dist/cli/terminalTitle.js +36 -0
  85. package/dist/config/inputHistory.d.ts +3 -3
  86. package/dist/config/inputHistory.js +12 -18
  87. package/dist/config/modelDiscovery.d.ts +71 -0
  88. package/dist/config/modelDiscovery.js +214 -0
  89. package/dist/config/privateStorage.js +28 -2
  90. package/dist/config/providerAuth.d.ts +14 -0
  91. package/dist/config/providerAuth.js +49 -0
  92. package/dist/config/providerPresets.d.ts +49 -5
  93. package/dist/config/providerPresets.js +573 -73
  94. package/dist/config/providers.d.ts +2 -0
  95. package/dist/config/providers.js +9 -0
  96. package/dist/config/settings.d.ts +58 -0
  97. package/dist/config/settings.js +38 -1
  98. package/dist/config/skillSettings.d.ts +6 -13
  99. package/dist/config/skillSettings.js +20 -19
  100. package/dist/core/agent/budgets.d.ts +36 -0
  101. package/dist/core/agent/budgets.js +44 -0
  102. package/dist/core/agent/compaction.d.ts +38 -0
  103. package/dist/core/agent/compaction.js +108 -19
  104. package/dist/core/agent/completionController.d.ts +230 -0
  105. package/dist/core/agent/completionController.js +287 -0
  106. package/dist/core/agent/contextBudget.d.ts +46 -0
  107. package/dist/core/agent/contextBudget.js +89 -7
  108. package/dist/core/agent/errors.js +6 -2
  109. package/dist/core/agent/events.d.ts +86 -0
  110. package/dist/core/agent/reasoningPolicy.d.ts +31 -0
  111. package/dist/core/agent/reasoningPolicy.js +27 -0
  112. package/dist/core/agent/toolCapabilities.d.ts +27 -0
  113. package/dist/core/agent/toolCapabilities.js +58 -0
  114. package/dist/core/agent/toolExecutionBudget.d.ts +35 -0
  115. package/dist/core/agent/toolExecutionBudget.js +49 -0
  116. package/dist/core/agent/toolOutputStore.d.ts +13 -0
  117. package/dist/core/agent/toolOutputStore.js +27 -10
  118. package/dist/core/agent/toolResults.d.ts +12 -0
  119. package/dist/core/agent/toolResults.js +38 -0
  120. package/dist/core/agent/turnBudget.d.ts +35 -0
  121. package/dist/core/agent/turnBudget.js +27 -0
  122. package/dist/core/agent/turnPolicy.d.ts +11 -0
  123. package/dist/core/agent/turnPolicy.js +19 -0
  124. package/dist/core/agent/workState.d.ts +76 -1
  125. package/dist/core/agent/workState.js +120 -13
  126. package/dist/core/attachments/imageAttachments.d.ts +90 -0
  127. package/dist/core/attachments/imageAttachments.js +245 -0
  128. package/dist/core/attachments/readBlessings.d.ts +37 -0
  129. package/dist/core/attachments/readBlessings.js +79 -0
  130. package/dist/core/deadline.d.ts +33 -0
  131. package/dist/core/deadline.js +74 -0
  132. package/dist/core/goal/completionPolicy.d.ts +27 -0
  133. package/dist/core/goal/completionPolicy.js +37 -1
  134. package/dist/core/goal/requestClassifier.d.ts +0 -3
  135. package/dist/core/goal/requestClassifier.js +0 -13
  136. package/dist/core/io/boundedRead.js +76 -29
  137. package/dist/core/limits/byteBudgets.d.ts +7 -0
  138. package/dist/core/limits/byteBudgets.js +7 -0
  139. package/dist/core/limits/textBudgets.d.ts +25 -0
  140. package/dist/core/limits/textBudgets.js +25 -0
  141. package/dist/core/log/llmLog.js +7 -0
  142. package/dist/core/persistence/orderedFileWriter.d.ts +10 -0
  143. package/dist/core/persistence/orderedFileWriter.js +16 -2
  144. package/dist/core/process/backgroundRegistry.d.ts +35 -0
  145. package/dist/core/process/backgroundRegistry.js +195 -0
  146. package/dist/core/process/runBoundedProcess.d.ts +9 -0
  147. package/dist/core/process/runBoundedProcess.js +74 -29
  148. package/dist/core/safety/missingExecutable.d.ts +42 -0
  149. package/dist/core/safety/missingExecutable.js +77 -0
  150. package/dist/core/safety/urlGuard.d.ts +2 -1
  151. package/dist/core/safety/urlGuard.js +3 -2
  152. package/dist/core/session/sessionSlimming.js +47 -4
  153. package/dist/core/session/sessionStore.d.ts +74 -0
  154. package/dist/core/session/sessionStore.js +268 -18
  155. package/dist/core/subagent/contracts.d.ts +120 -0
  156. package/dist/core/subagent/contracts.js +55 -0
  157. package/dist/core/subagent/executionProfiles.d.ts +28 -0
  158. package/dist/core/subagent/executionProfiles.js +45 -0
  159. package/dist/core/subagent/subagentCoordinator.d.ts +78 -0
  160. package/dist/core/subagent/subagentCoordinator.js +164 -0
  161. package/dist/core/subagent/subagentRunner.d.ts +211 -145
  162. package/dist/core/subagent/subagentRunner.js +208 -98
  163. package/dist/core/subagent/workspaceMutationPolicy.d.ts +11 -0
  164. package/dist/core/subagent/workspaceMutationPolicy.js +52 -0
  165. package/dist/core/tasks/taskStorage.js +12 -1
  166. package/dist/llm/client.d.ts +36 -29
  167. package/dist/llm/client.js +102 -33
  168. package/dist/llm/hazeTools.d.ts +2559 -150
  169. package/dist/llm/hazeTools.js +119 -31
  170. package/dist/llm/lsp.d.ts +26 -4
  171. package/dist/llm/lsp.js +90 -14
  172. package/dist/llm/lspTools.d.ts +2366 -0
  173. package/dist/llm/lspTools.js +87 -79
  174. package/dist/llm/openaiCodex.d.ts +3 -0
  175. package/dist/llm/openaiCodex.js +47 -0
  176. package/dist/llm/openaiCodexOAuth.d.ts +54 -0
  177. package/dist/llm/openaiCodexOAuth.js +214 -0
  178. package/dist/llm/requestContext.d.ts +25 -1
  179. package/dist/llm/requestContext.js +51 -8
  180. package/dist/llm/systemPrompt.d.ts +15 -1
  181. package/dist/llm/systemPrompt.js +24 -8
  182. package/dist/llm/toolResultTypes.d.ts +8 -1
  183. package/dist/llm/tools/bashTool.d.ts +906 -32
  184. package/dist/llm/tools/bashTool.js +30 -4
  185. package/dist/llm/tools/editMatch.d.ts +14 -0
  186. package/dist/llm/tools/editMatch.js +72 -0
  187. package/dist/llm/tools/failures.d.ts +2 -0
  188. package/dist/llm/tools/failures.js +1 -0
  189. package/dist/llm/tools/fetchTool.d.ts +42 -26
  190. package/dist/llm/tools/fetchTool.js +1 -1
  191. package/dist/llm/tools/fileToolShared.d.ts +6 -4
  192. package/dist/llm/tools/fileToolShared.js +18 -23
  193. package/dist/llm/tools/gitIgnore.d.ts +49 -0
  194. package/dist/llm/tools/gitIgnore.js +129 -0
  195. package/dist/llm/tools/grepRunner.d.ts +5 -0
  196. package/dist/llm/tools/grepRunner.js +52 -71
  197. package/dist/llm/tools/outputCap.d.ts +2 -6
  198. package/dist/llm/tools/outputCap.js +2 -6
  199. package/dist/llm/tools/processTool.d.ts +1077 -0
  200. package/dist/llm/tools/processTool.js +41 -0
  201. package/dist/llm/tools/readRecovery.d.ts +10 -0
  202. package/dist/llm/tools/readRecovery.js +135 -0
  203. package/dist/llm/tools/toolContext.d.ts +9 -1
  204. package/dist/llm/tools/toolContext.js +83 -43
  205. package/dist/llm/tools/workspaceFile.d.ts +9 -1
  206. package/dist/llm/tools/workspaceFile.js +33 -4
  207. package/dist/llm/webFetch.d.ts +17 -0
  208. package/dist/llm/webFetch.js +66 -86
  209. package/dist/llm/workerContext.d.ts +18 -0
  210. package/dist/llm/workerContext.js +55 -0
  211. package/dist/skills/SkillLoader.d.ts +2 -2
  212. package/dist/skills/SkillRegistry.d.ts +3 -2
  213. package/dist/skills/SkillRegistry.js +43 -13
  214. package/dist/skills/builder/SkillBuilder.d.ts +3 -0
  215. package/dist/skills/builder/SkillBuilder.js +23 -5
  216. package/dist/skills/skillTools.js +11 -4
  217. package/dist/skills/types.d.ts +6 -1
  218. package/dist/ui/codeHighlight.d.ts +4 -0
  219. package/dist/ui/codeHighlight.js +31 -0
  220. package/dist/ui/components/Header.d.ts +1 -1
  221. package/dist/ui/components/MarkdownText.d.ts +16 -2
  222. package/dist/ui/components/MarkdownText.js +244 -34
  223. package/dist/ui/components/TextInput.d.ts +12 -2
  224. package/dist/ui/components/TextInput.js +80 -8
  225. package/dist/ui/theme.d.ts +4 -3
  226. package/dist/ui/theme.js +5 -4
  227. package/dist/utils/buildInfo.d.ts +104 -0
  228. package/dist/utils/buildInfo.js +253 -0
  229. package/dist/utils/format.d.ts +2 -0
  230. package/dist/utils/format.js +8 -0
  231. package/dist/utils/fs.d.ts +9 -1
  232. package/dist/utils/fs.js +87 -29
  233. package/dist/utils/openPath.d.ts +2 -0
  234. package/dist/utils/openPath.js +22 -0
  235. package/dist/utils/path.d.ts +2 -0
  236. package/dist/utils/path.js +5 -1
  237. package/dist/utils/utf8.d.ts +22 -0
  238. package/dist/utils/utf8.js +54 -0
  239. package/dist/utils/version.d.ts +9 -3
  240. package/dist/utils/version.js +28 -2
  241. package/package.json +24 -19
@@ -1,36 +1,102 @@
1
1
  import { appendSessionEntry } from '../../core/session/sessionStore.js';
2
+ import { OrderedFileWriter } from '../../core/persistence/orderedFileWriter.js';
2
3
  export function createSessionRecorder(getSession) {
3
- let tail = Promise.resolve();
4
- let firstError;
5
- const append = (entry) => {
4
+ // Ordered appends and first-error capture come from the shared writer
5
+ // primitive; entries recorded before a session exists are dropped (CR-005).
6
+ const writer = new OrderedFileWriter(({ session, entry }) => appendSessionEntry(session, entry));
7
+ const appendEntry = (entry) => {
6
8
  const session = getSession();
7
9
  if (!session)
8
10
  return;
9
- tail = tail.then(() => appendSessionEntry(session, entry)).catch(error => {
10
- firstError ??= error instanceof Error ? error : new Error(String(error));
11
+ void writer.append({ session, entry });
12
+ };
13
+ // Full-history snapshot coalescing (RH-008). conversation_snapshot and
14
+ // work_state_snapshot entries are large and only the latest of each is ever
15
+ // restored. A long autonomous turn calls setConversation many times; writing
16
+ // the full history on every call makes the JSONL grow quadratically. Keep at
17
+ // most one snapshot of each type in flight: while a write is pending, newer
18
+ // snapshots replace the pending one so only the latest reaches disk.
19
+ let pendingConversation;
20
+ let pendingWorkState;
21
+ let conversationInFlight = false;
22
+ let workStateInFlight = false;
23
+ const writeConversation = (snapshot) => {
24
+ const session = getSession();
25
+ if (!session)
26
+ return;
27
+ conversationInFlight = true;
28
+ void writer
29
+ .append({ session, entry: { type: 'conversation_snapshot', at: snapshot.at, messages: snapshot.messages } })
30
+ .catch(() => undefined)
31
+ .finally(() => {
32
+ conversationInFlight = false;
33
+ drainConversation();
34
+ });
35
+ };
36
+ const drainConversation = () => {
37
+ if (conversationInFlight || !pendingConversation)
38
+ return;
39
+ const snapshot = pendingConversation;
40
+ pendingConversation = undefined;
41
+ writeConversation(snapshot);
42
+ };
43
+ const writeWorkState = (snapshot) => {
44
+ const session = getSession();
45
+ if (!session)
46
+ return;
47
+ workStateInFlight = true;
48
+ void writer
49
+ .append({ session, entry: { type: 'work_state_snapshot', at: snapshot.at, state: snapshot.state } })
50
+ .catch(() => undefined)
51
+ .finally(() => {
52
+ workStateInFlight = false;
53
+ drainWorkState();
11
54
  });
12
55
  };
56
+ const drainWorkState = () => {
57
+ if (workStateInFlight || !pendingWorkState)
58
+ return;
59
+ const snapshot = pendingWorkState;
60
+ pendingWorkState = undefined;
61
+ writeWorkState(snapshot);
62
+ };
13
63
  return {
14
64
  recordUiMessage(message) {
15
- append({ type: 'ui_message', at: new Date().toISOString(), role: message.role, text: message.text });
65
+ appendEntry({ type: 'ui_message', at: new Date().toISOString(), role: message.role, text: message.text });
16
66
  },
17
67
  recordConversation(messages) {
18
- append({ type: 'conversation_snapshot', at: new Date().toISOString(), messages });
68
+ pendingConversation = { messages, at: new Date().toISOString() };
69
+ drainConversation();
19
70
  },
20
71
  recordWorkState(state) {
21
- append({ type: 'work_state_snapshot', at: new Date().toISOString(), state });
72
+ pendingWorkState = { state, at: new Date().toISOString() };
73
+ drainWorkState();
22
74
  },
23
75
  recordEvent(event) {
24
- append({ type: 'event', at: event.at, name: event.type, text: JSON.stringify(event) });
76
+ // message_update is transient UI progress; never persist it (RH-006). It is
77
+ // dropped here, before JSON.stringify, so high-volume streaming updates do
78
+ // not pay serialization or queueing cost in the durable writer.
79
+ if (event.type === 'message_update')
80
+ return;
81
+ appendEntry({ type: 'event', at: event.at, name: event.type, text: JSON.stringify(event) });
25
82
  },
26
83
  recordNamedEvent(name, text) {
27
- append({ type: 'event', at: new Date().toISOString(), name, text });
84
+ appendEntry({ type: 'event', at: new Date().toISOString(), name, text });
28
85
  },
29
86
  async flush() {
30
- await tail;
31
- if (firstError)
32
- throw firstError;
87
+ // Fold coalesced snapshots into the writer queue, then wait for the queue
88
+ // to drain. Loop because a write completing mid-flush may have queued a
89
+ // newer coalesced snapshot from its finally callback.
90
+ let guard = 0;
91
+ while ((pendingConversation || conversationInFlight || pendingWorkState || workStateInFlight) && guard++ < 1000) {
92
+ drainConversation();
93
+ drainWorkState();
94
+ await writer.flush();
95
+ }
96
+ await writer.flush();
97
+ },
98
+ error() {
99
+ return writer.error();
33
100
  },
34
- error() { return firstError; },
35
101
  };
36
102
  }
@@ -1,11 +1,13 @@
1
1
  import { activeModel, configuredProviders, providerHasKey } from '../../config/providers.js';
2
2
  import { configuredLspServers } from '../../config/lspSettings.js';
3
3
  import { configuredMcpServers } from '../../config/mcpSettings.js';
4
+ import { chatgptCodexUrlWarning } from '../commands/providerWizard.js';
4
5
  export function startupContextInfo(contextFiles) {
5
6
  const lines = contextFiles.map(file => `- ${file.path}`);
6
7
  return [
7
- 'Context files sent with the system prompt',
8
+ 'Context files included with the first request:',
8
9
  ...(lines.length > 0 ? lines : ['- none']),
10
+ 'Nested AGENTS.md and CLAUDE.md files load when haze works in their subfolders.',
9
11
  ].join('\n');
10
12
  }
11
13
  export function startupProviderInfo(settings) {
@@ -15,12 +17,12 @@ export function startupProviderInfo(settings) {
15
17
  const enabledLsp = lspServers.filter(server => server.enabled !== false);
16
18
  const lspLine = enabledLsp.length > 0
17
19
  ? `- LSP: ${enabledLsp.length} configured (${enabledLsp.map(server => server.name).join(', ')}; tools appear only when the command is installed)`
18
- : '- LSP: none configured (optional: install a language server, then /lsp presets and /lsp add typescript for semantic code navigation)';
20
+ : '- LSP: not configured (optional: use /lsp presets, then /lsp add typescript)';
19
21
  const mcpServers = configuredMcpServers(settings);
20
22
  const enabledMcp = mcpServers.filter(server => server.enabled !== false);
21
23
  const mcpLine = enabledMcp.length > 0
22
24
  ? `- MCP: ${enabledMcp.length} configured (${enabledMcp.map(server => server.name).join(', ')}; tools load each turn)`
23
- : '- MCP: none configured (optional: /mcp add context7 for up-to-date library docs)';
25
+ : '- MCP: not configured (optional: use /mcp add context7 for current library docs)';
24
26
  if (!selection) {
25
27
  return [
26
28
  'Provider configuration',
@@ -40,12 +42,17 @@ export function startupProviderInfo(settings) {
40
42
  const baseURL = selection.provider.url;
41
43
  const apiKeySource = providerHasKey(settings, selection.provider) ? `provider ${selection.provider.name}` : 'missing';
42
44
  const provider = selection.provider.name;
45
+ const authLine = selection.provider.kind === 'chatgpt-codex'
46
+ ? '- Authentication: ChatGPT OAuth credentials stored separately'
47
+ : `- API key: ${apiKeySource === 'missing' ? 'not configured; local providers may not need one' : `configured via ${apiKeySource}`}`;
48
+ const divergence = chatgptCodexUrlWarning(selection.provider);
43
49
  return [
44
50
  'Provider configuration',
45
51
  `- Provider: ${provider}`,
46
52
  `- Model: ${model} (${modelSource})`,
47
53
  `- Base URL: ${baseURL} (settings)`,
48
- `- API key: ${apiKeySource === 'missing' ? 'not configured; local providers may not need one' : `configured via ${apiKeySource}`}`,
54
+ ...(divergence ? [divergence] : []),
55
+ authLine,
49
56
  `- Configured providers: ${configuredCount}`,
50
57
  lspLine,
51
58
  mcpLine,
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Rotating tips shown under the busy label while the model is thinking.
3
+ *
4
+ * The registry is data, not code, so rewording or pruning is trivial. Tips
5
+ * must describe things the user can do from their keyboard (slash commands,
6
+ * `@`-mentions, key presses, flags) — never internal model-tool mechanics
7
+ * like how `readFile` pages or `grep` caps results. Keep one idea per entry,
8
+ * lead with the action, and stay terminal-width-friendly.
9
+ */
10
+ export declare const TIPS: readonly string[];
11
+ /**
12
+ * Pick a random tip index, avoiding the previous one when possible so the
13
+ * rotation never shows the same tip twice in a row.
14
+ */
15
+ export declare function randomTipIndex(exclude?: number): number;
16
+ /** Whether the tips rotation is enabled in user settings (default true). */
17
+ export declare function tipsEnabled(settings: {
18
+ tips?: {
19
+ enabled?: boolean;
20
+ };
21
+ }): boolean;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Rotating tips shown under the busy label while the model is thinking.
3
+ *
4
+ * The registry is data, not code, so rewording or pruning is trivial. Tips
5
+ * must describe things the user can do from their keyboard (slash commands,
6
+ * `@`-mentions, key presses, flags) — never internal model-tool mechanics
7
+ * like how `readFile` pages or `grep` caps results. Keep one idea per entry,
8
+ * lead with the action, and stay terminal-width-friendly.
9
+ */
10
+ export const TIPS = [
11
+ 'Attach an image with @path/to/img.png — or any path with / — png/jpg/jpeg/gif/webp.',
12
+ 'Type @ to browse workspace files; Tab completes the path.',
13
+ 'Mention any file or directory by @path (or paste a /-containing path) to let the model read it this turn, even outside the workspace.',
14
+ 'Backslash-escape spaces in paths: @screen\\ 2026.png works for macOS screenshots.',
15
+ 'Mark a provider image-capable in /provider so attached images actually get sent.',
16
+ '/mcp add context7 loads external tools for up-to-date library docs.',
17
+ '/lsp presets then /lsp add typescript enables jump-to-definition, references, and rename.',
18
+ '/skills browses packaged workflows — skills inject instructions, never code.',
19
+ '/init scaffolds an AGENTS.md so future sessions start with project context.',
20
+ 'Conversations persist under ~/.haze/sessions; resume the latest with /resume.',
21
+ 'Long threads compact automatically; /compact does it on demand.',
22
+ '/fleet runs genuinely independent tasks through disposable contexts in parallel.',
23
+ 'Press esc to interrupt a running turn and reclaim control.',
24
+ '/context shows a token breakdown — system, project context, tools, and messages.',
25
+ '/model <name> sets a model directly (e.g. /model sonnet); selecting one also sets its provider.',
26
+ '/tips toggles this hint line off if you find it distracting.',
27
+ ];
28
+ /**
29
+ * Pick a random tip index, avoiding the previous one when possible so the
30
+ * rotation never shows the same tip twice in a row.
31
+ */
32
+ export function randomTipIndex(exclude) {
33
+ if (TIPS.length <= 1)
34
+ return 0;
35
+ let next = Math.floor(Math.random() * TIPS.length);
36
+ while (next === exclude)
37
+ next = Math.floor(Math.random() * TIPS.length);
38
+ return next;
39
+ }
40
+ /** Whether the tips rotation is enabled in user settings (default true). */
41
+ export function tipsEnabled(settings) {
42
+ return settings.tips?.enabled !== false;
43
+ }
@@ -0,0 +1,64 @@
1
+ import type { HazeMcpServer, HazeProviderSettings, HazeSettings } from '../../config/settings.js';
2
+ import type { HazeLspServer } from '../../config/lspSettings.js';
3
+ import type { LoadedSkill, SkillSource } from '../../skills/types.js';
4
+ import type { SessionSummary } from '../../core/session/sessionStore.js';
5
+ import type { Mode } from '../commands/chatModes.js';
6
+ /**
7
+ * Wizard submit dispatch (CR-006): one table-driven entry point for every
8
+ * picker/wizard mode. Handlers call the pure `*Wizard.ts` result functions and
9
+ * apply the shared settingsPatch/mode/message shape, so `chat.tsx` stays
10
+ * orchestration glue instead of a 150-line if-chain.
11
+ */
12
+ export interface WizardDispatchDeps {
13
+ settings: HazeSettings;
14
+ skills: LoadedSkill[];
15
+ modelProviderFilter: string | undefined;
16
+ selectedProviderName: string | undefined;
17
+ selectedSkillName: string | undefined;
18
+ selectedLspName: string | undefined;
19
+ selectedMcpName: string | undefined;
20
+ sessions?: SessionSummary[];
21
+ selectedSessionId?: string;
22
+ providerDraft: Partial<HazeProviderSettings>;
23
+ lspDraft: Partial<HazeLspServer>;
24
+ mcpDraft: Partial<HazeMcpServer>;
25
+ skillDraft: {
26
+ name?: string;
27
+ scope?: SkillSource;
28
+ };
29
+ setMode: (mode: Mode) => void;
30
+ setSettings: (next: HazeSettings) => void;
31
+ setSelectedProviderName: (name: string | undefined) => void;
32
+ setSelectedSkillName: (name: string | undefined) => void;
33
+ setSelectedLspName: (name: string | undefined) => void;
34
+ setSelectedMcpName: (name: string | undefined) => void;
35
+ setSelectedSessionId?: (id: string | undefined) => void;
36
+ resumeSessionById?: (id: string) => Promise<boolean>;
37
+ forkSessionById?: (id: string) => Promise<boolean>;
38
+ setModelProviderFilter: (filter: string | undefined) => void;
39
+ setProviderDraft: (draft: Partial<HazeProviderSettings>) => void;
40
+ setSkillDraft: (draft: {
41
+ name?: string;
42
+ scope?: SkillSource;
43
+ }) => void;
44
+ setLspDraft: (draft: Partial<HazeLspServer>) => void;
45
+ setMcpDraft: (draft: Partial<HazeMcpServer>) => void;
46
+ setDiscoveredModels: (models: string[]) => void;
47
+ /** Curated preset models pinned atop discovered ones; cleared with discovered models. */
48
+ setSuggestedModels: (models: string[]) => void;
49
+ showMessage: (message: string | undefined) => void;
50
+ refreshSkills: () => Promise<unknown>;
51
+ setBusyLabel: (label: string) => void;
52
+ setBusy: (busy: boolean) => void;
53
+ /** Busy label to restore when a skill creation finishes. */
54
+ idleBusyLabel: string;
55
+ }
56
+ export interface WizardDispatch {
57
+ /** Handle the value for wizard/picker modes; returns false for non-wizard modes. */
58
+ dispatch: (mode: Mode, value: string) => Promise<boolean>;
59
+ /** Exposed for the MCP field-transition path in submit(). */
60
+ finishMcpCustom: (keyValue?: string, draft?: Partial<HazeMcpServer>) => Promise<void>;
61
+ /** Exposed for the provider field-transition path: discover models for a provider draft after its key step. */
62
+ discoverProviderModelsForDraft: (draft: Partial<HazeProviderSettings>) => Promise<void>;
63
+ }
64
+ export declare function createWizardDispatch(deps: WizardDispatchDeps): WizardDispatch;