@denizokcu/haze 0.8.0 → 0.10.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 (182) hide show
  1. package/CHANGELOG.md +67 -17
  2. package/README.md +121 -64
  3. package/dist/cli/chat/chatMetrics.d.ts +17 -1
  4. package/dist/cli/chat/chatMetrics.js +22 -5
  5. package/dist/cli/chat/contextReport.d.ts +11 -0
  6. package/dist/cli/chat/contextReport.js +44 -0
  7. package/dist/cli/chat/fileMentionSuggestions.d.ts +29 -0
  8. package/dist/cli/chat/fileMentionSuggestions.js +91 -0
  9. package/dist/cli/chat/inputSuggestions.d.ts +5 -0
  10. package/dist/cli/chat/inputSuggestions.js +17 -3
  11. package/dist/cli/chat/sessionLifecycle.d.ts +58 -0
  12. package/dist/cli/chat/sessionLifecycle.js +155 -0
  13. package/dist/cli/chat/sessionRecorder.d.ts +3 -0
  14. package/dist/cli/chat/sessionRecorder.js +21 -8
  15. package/dist/cli/chat/startupInfo.d.ts +1 -0
  16. package/dist/cli/chat/startupInfo.js +11 -0
  17. package/dist/cli/chat/tips.d.ts +21 -0
  18. package/dist/cli/chat/tips.js +43 -0
  19. package/dist/cli/chat/wizardDispatch.d.ts +64 -0
  20. package/dist/cli/chat/wizardDispatch.js +645 -0
  21. package/dist/cli/commands/chat.d.ts +1 -0
  22. package/dist/cli/commands/chat.js +246 -779
  23. package/dist/cli/commands/chatModes.d.ts +1 -1
  24. package/dist/cli/commands/chatModes.js +7 -2
  25. package/dist/cli/commands/commandHelp.js +5 -3
  26. package/dist/cli/commands/commands.d.ts +4 -3
  27. package/dist/cli/commands/commands.js +12 -13
  28. package/dist/cli/commands/fleetCommand.d.ts +14 -0
  29. package/dist/cli/commands/fleetCommand.js +46 -0
  30. package/dist/cli/commands/formatters.d.ts +5 -0
  31. package/dist/cli/commands/formatters.js +36 -9
  32. package/dist/cli/commands/logsCommand.js +8 -28
  33. package/dist/cli/commands/mcpWizard.js +24 -2
  34. package/dist/cli/commands/modelCommand.js +1 -1
  35. package/dist/cli/commands/providerWizard.d.ts +1 -0
  36. package/dist/cli/commands/providerWizard.js +31 -5
  37. package/dist/cli/commands/runCommand.d.ts +1 -0
  38. package/dist/cli/commands/runCommand.js +32 -20
  39. package/dist/cli/commands/sessionPicker.d.ts +9 -0
  40. package/dist/cli/commands/sessionPicker.js +29 -0
  41. package/dist/cli/commands/settingsSummary.js +8 -4
  42. package/dist/cli/commands/skillConfirmRemove.js +4 -3
  43. package/dist/cli/commands/skillWizard.d.ts +2 -0
  44. package/dist/cli/commands/skillWizard.js +16 -6
  45. package/dist/cli/commands/streaming/idleTimer.d.ts +26 -0
  46. package/dist/cli/commands/streaming/idleTimer.js +24 -0
  47. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +2 -0
  48. package/dist/cli/commands/streaming/toolGroupRenderer.js +4 -2
  49. package/dist/cli/commands/streaming/turnOutcome.d.ts +10 -0
  50. package/dist/cli/commands/streaming/turnOutcome.js +13 -0
  51. package/dist/cli/commands/streaming/turnRuntime.js +6 -4
  52. package/dist/cli/commands/streaming.d.ts +13 -1
  53. package/dist/cli/commands/streaming.js +104 -44
  54. package/dist/cli/commands/wizardActions.d.ts +6 -0
  55. package/dist/cli/commands/wizardActions.js +6 -0
  56. package/dist/cli/commands/wizardPrompts.js +1 -1
  57. package/dist/cli/commands/wizardSuggestions.d.ts +8 -0
  58. package/dist/cli/commands/wizardSuggestions.js +62 -13
  59. package/dist/cli/commands/wizardTransition.d.ts +37 -0
  60. package/dist/cli/commands/wizardTransition.js +43 -0
  61. package/dist/cli/index.js +17 -3
  62. package/dist/cli/terminalTitle.d.ts +6 -0
  63. package/dist/cli/terminalTitle.js +36 -0
  64. package/dist/config/contextFiles.js +6 -3
  65. package/dist/config/endpointSecurity.d.ts +2 -0
  66. package/dist/config/endpointSecurity.js +28 -0
  67. package/dist/config/inputHistory.d.ts +3 -3
  68. package/dist/config/inputHistory.js +13 -17
  69. package/dist/config/modelDiscovery.d.ts +20 -0
  70. package/dist/config/modelDiscovery.js +51 -0
  71. package/dist/config/privateStorage.d.ts +6 -0
  72. package/dist/config/privateStorage.js +61 -0
  73. package/dist/config/providerPresets.d.ts +16 -4
  74. package/dist/config/providerPresets.js +263 -34
  75. package/dist/config/providers.d.ts +2 -0
  76. package/dist/config/providers.js +7 -0
  77. package/dist/config/settings.d.ts +22 -0
  78. package/dist/config/settings.js +33 -5
  79. package/dist/config/skillSettings.d.ts +6 -13
  80. package/dist/config/skillSettings.js +20 -19
  81. package/dist/config/updateCheck.js +4 -2
  82. package/dist/core/agent/budgets.d.ts +26 -0
  83. package/dist/core/agent/budgets.js +34 -0
  84. package/dist/core/agent/compaction.js +17 -3
  85. package/dist/core/agent/contextBudget.d.ts +8 -0
  86. package/dist/core/agent/contextBudget.js +29 -0
  87. package/dist/core/agent/errors.js +6 -2
  88. package/dist/core/agent/events.d.ts +12 -0
  89. package/dist/core/agent/toolOutputStore.d.ts +8 -0
  90. package/dist/core/agent/toolOutputStore.js +49 -11
  91. package/dist/core/agent/workState.d.ts +1 -1
  92. package/dist/core/agent/workState.js +0 -4
  93. package/dist/core/attachments/imageAttachments.d.ts +90 -0
  94. package/dist/core/attachments/imageAttachments.js +245 -0
  95. package/dist/core/attachments/readBlessings.d.ts +37 -0
  96. package/dist/core/attachments/readBlessings.js +79 -0
  97. package/dist/core/goal/completionPolicy.d.ts +0 -28
  98. package/dist/core/goal/completionPolicy.js +0 -88
  99. package/dist/core/goal/requestClassifier.d.ts +0 -3
  100. package/dist/core/goal/requestClassifier.js +0 -13
  101. package/dist/core/io/boundedRead.d.ts +15 -0
  102. package/dist/core/io/boundedRead.js +144 -0
  103. package/dist/core/limits/byteBudgets.d.ts +18 -0
  104. package/dist/core/limits/byteBudgets.js +18 -0
  105. package/dist/core/limits/textBudgets.d.ts +23 -0
  106. package/dist/core/limits/textBudgets.js +23 -0
  107. package/dist/core/log/llmLog.d.ts +10 -0
  108. package/dist/core/log/llmLog.js +59 -13
  109. package/dist/core/persistence/orderedFileWriter.d.ts +11 -0
  110. package/dist/core/persistence/orderedFileWriter.js +29 -0
  111. package/dist/core/process/backgroundRegistry.d.ts +35 -0
  112. package/dist/core/process/backgroundRegistry.js +194 -0
  113. package/dist/core/process/runBoundedProcess.d.ts +30 -0
  114. package/dist/core/process/runBoundedProcess.js +116 -0
  115. package/dist/core/safety/urlGuard.d.ts +2 -1
  116. package/dist/core/safety/urlGuard.js +3 -2
  117. package/dist/core/session/sessionSlimming.js +47 -4
  118. package/dist/core/session/sessionStore.d.ts +37 -0
  119. package/dist/core/session/sessionStore.js +136 -27
  120. package/dist/core/subagent/contracts.d.ts +116 -0
  121. package/dist/core/subagent/contracts.js +54 -0
  122. package/dist/core/subagent/executionProfiles.d.ts +28 -0
  123. package/dist/core/subagent/executionProfiles.js +45 -0
  124. package/dist/core/subagent/subagentCoordinator.d.ts +74 -0
  125. package/dist/core/subagent/subagentCoordinator.js +134 -0
  126. package/dist/core/subagent/subagentRunner.d.ts +211 -145
  127. package/dist/core/subagent/subagentRunner.js +228 -98
  128. package/dist/core/subagent/workspaceMutationPolicy.d.ts +11 -0
  129. package/dist/core/subagent/workspaceMutationPolicy.js +52 -0
  130. package/dist/core/tasks/taskStorage.js +12 -1
  131. package/dist/llm/client.d.ts +20 -29
  132. package/dist/llm/client.js +33 -29
  133. package/dist/llm/hazeTools.d.ts +2396 -67
  134. package/dist/llm/hazeTools.js +50 -37
  135. package/dist/llm/lsp.d.ts +23 -3
  136. package/dist/llm/lsp.js +73 -16
  137. package/dist/llm/lspTools.d.ts +96 -48
  138. package/dist/llm/mcp.d.ts +1 -1
  139. package/dist/llm/mcp.js +65 -16
  140. package/dist/llm/requestContext.d.ts +23 -1
  141. package/dist/llm/requestContext.js +50 -7
  142. package/dist/llm/systemPrompt.d.ts +4 -1
  143. package/dist/llm/systemPrompt.js +14 -4
  144. package/dist/llm/toolResultTypes.d.ts +1 -1
  145. package/dist/llm/tools/bashTool.d.ts +1210 -16
  146. package/dist/llm/tools/bashTool.js +43 -60
  147. package/dist/llm/tools/fetchTool.d.ts +26 -26
  148. package/dist/llm/tools/fetchTool.js +1 -1
  149. package/dist/llm/tools/fileToolShared.d.ts +2 -1
  150. package/dist/llm/tools/fileToolShared.js +5 -5
  151. package/dist/llm/tools/grepRunner.d.ts +20 -0
  152. package/dist/llm/tools/grepRunner.js +66 -0
  153. package/dist/llm/tools/outputCap.d.ts +2 -6
  154. package/dist/llm/tools/outputCap.js +2 -6
  155. package/dist/llm/tools/processTool.d.ts +1077 -0
  156. package/dist/llm/tools/processTool.js +41 -0
  157. package/dist/llm/tools/toolContext.d.ts +8 -0
  158. package/dist/llm/tools/toolContext.js +22 -11
  159. package/dist/llm/tools/workspaceFile.d.ts +9 -1
  160. package/dist/llm/tools/workspaceFile.js +33 -4
  161. package/dist/llm/webFetch.js +24 -11
  162. package/dist/llm/workerContext.d.ts +18 -0
  163. package/dist/llm/workerContext.js +55 -0
  164. package/dist/skills/SkillLoader.d.ts +2 -2
  165. package/dist/skills/SkillLoader.js +17 -5
  166. package/dist/skills/SkillRegistry.d.ts +3 -2
  167. package/dist/skills/SkillRegistry.js +53 -10
  168. package/dist/skills/builder/SkillBuilder.d.ts +3 -0
  169. package/dist/skills/builder/SkillBuilder.js +23 -5
  170. package/dist/skills/skillTools.js +11 -4
  171. package/dist/skills/types.d.ts +11 -1
  172. package/dist/ui/components/TextInput.d.ts +5 -2
  173. package/dist/ui/components/TextInput.js +76 -8
  174. package/dist/utils/format.d.ts +2 -0
  175. package/dist/utils/format.js +8 -0
  176. package/dist/utils/fs.d.ts +0 -1
  177. package/dist/utils/fs.js +0 -4
  178. package/dist/utils/openPath.d.ts +2 -0
  179. package/dist/utils/openPath.js +9 -0
  180. package/dist/utils/path.d.ts +2 -0
  181. package/dist/utils/path.js +9 -4
  182. package/package.json +1 -1
@@ -1,7 +1,10 @@
1
1
  /**
2
- * Known provider presets derived from community conventions (nanocoder, OpenRouter docs, etc.).
3
- * Each preset carries a pre-configured base URL so users only need to supply an API key and model names.
4
- * Local/keyless providers have sensible localhost defaults.
2
+ * Known provider presets derived from community conventions (nanocoder, OpenRouter docs, etc.),
3
+ * enriched from Pi's built-in provider registry and generated model catalog
4
+ * (https://github.com/earendil-works/pi, `packages/ai` — provider ids, base URLs,
5
+ * API-key env var conventions, and current model ids).
6
+ * Each preset carries a pre-configured OpenAI-compatible base URL so users only need to supply
7
+ * an API key and model names. Local/keyless providers have sensible localhost defaults.
5
8
  */
6
9
  export const PROVIDER_PRESETS = [
7
10
  // ── Cloud providers (API key required) ──────────────────────────────
@@ -10,12 +13,14 @@ export const PROVIDER_PRESETS = [
10
13
  name: 'OpenRouter',
11
14
  baseUrl: 'https://openrouter.ai/api/v1',
12
15
  needsApiKey: true,
16
+ apiKeyEnvVar: 'OPENROUTER_API_KEY',
13
17
  suggestedModels: [
14
18
  // SOTA
15
19
  'anthropic/claude-opus-4.8',
16
- 'openai/gpt-5.4',
17
- 'google/gemini-3.1-pro',
20
+ 'openai/gpt-5.5',
21
+ 'google/gemini-3.1-pro-preview',
18
22
  // Fast
23
+ 'anthropic/claude-sonnet-5',
19
24
  'anthropic/claude-sonnet-4.6',
20
25
  'openai/gpt-5.4-mini',
21
26
  'google/gemini-3.5-flash',
@@ -28,9 +33,12 @@ export const PROVIDER_PRESETS = [
28
33
  name: 'OpenAI',
29
34
  baseUrl: 'https://api.openai.com/v1',
30
35
  needsApiKey: true,
36
+ apiKeyEnvVar: 'OPENAI_API_KEY',
31
37
  suggestedModels: [
32
38
  // SOTA
33
39
  'gpt-5.5',
40
+ 'gpt-5.6-sol',
41
+ 'gpt-5.6-terra',
34
42
  'o3',
35
43
  // Fast
36
44
  'gpt-5.4',
@@ -44,11 +52,14 @@ export const PROVIDER_PRESETS = [
44
52
  name: 'Anthropic Claude',
45
53
  baseUrl: 'https://api.anthropic.com/v1',
46
54
  needsApiKey: true,
55
+ apiKeyEnvVar: 'ANTHROPIC_API_KEY',
47
56
  suggestedModels: [
48
57
  // SOTA
58
+ 'claude-opus-5',
49
59
  'claude-opus-4-8',
50
60
  'claude-fable-5',
51
61
  // Fast
62
+ 'claude-sonnet-5',
52
63
  'claude-sonnet-4-6',
53
64
  'claude-haiku-4-5',
54
65
  ],
@@ -60,11 +71,13 @@ export const PROVIDER_PRESETS = [
60
71
  baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
61
72
  needsApiKey: true,
62
73
  apiKeyHint: 'API Key (from https://aistudio.google.com/apikey)',
74
+ apiKeyEnvVar: 'GEMINI_API_KEY',
63
75
  suggestedModels: [
64
76
  // SOTA
77
+ 'gemini-3.1-pro-preview',
65
78
  'gemini-3.5-flash',
66
- 'gemini-3.1-pro',
67
79
  // Fast
80
+ 'gemini-3.6-flash',
68
81
  'gemini-3.1-flash-lite',
69
82
  'gemini-2.5-flash',
70
83
  'gemini-2.5-pro',
@@ -76,6 +89,7 @@ export const PROVIDER_PRESETS = [
76
89
  name: 'Mistral AI',
77
90
  baseUrl: 'https://api.mistral.ai/v1',
78
91
  needsApiKey: true,
92
+ apiKeyEnvVar: 'MISTRAL_API_KEY',
79
93
  suggestedModels: [
80
94
  // SOTA
81
95
  'mistral-large-2512',
@@ -83,6 +97,36 @@ export const PROVIDER_PRESETS = [
83
97
  // Fast
84
98
  'mistral-small-2603',
85
99
  'codestral-2508',
100
+ 'devstral-2512',
101
+ ],
102
+ category: 'cloud',
103
+ },
104
+ {
105
+ id: 'deepseek',
106
+ name: 'DeepSeek',
107
+ baseUrl: 'https://api.deepseek.com/v1',
108
+ needsApiKey: true,
109
+ apiKeyEnvVar: 'DEEPSEEK_API_KEY',
110
+ suggestedModels: [
111
+ // SOTA
112
+ 'deepseek-v4-pro',
113
+ // Fast
114
+ 'deepseek-v4-flash',
115
+ ],
116
+ category: 'cloud',
117
+ },
118
+ {
119
+ id: 'xai',
120
+ name: 'xAI Grok',
121
+ baseUrl: 'https://api.x.ai/v1',
122
+ needsApiKey: true,
123
+ apiKeyEnvVar: 'XAI_API_KEY',
124
+ suggestedModels: [
125
+ // SOTA
126
+ 'grok-4.5',
127
+ 'grok-4.3',
128
+ // Fast
129
+ 'grok-build-0.1',
86
130
  ],
87
131
  category: 'cloud',
88
132
  },
@@ -91,9 +135,11 @@ export const PROVIDER_PRESETS = [
91
135
  name: 'Z.ai',
92
136
  baseUrl: 'https://api.z.ai/api/paas/v4/',
93
137
  needsApiKey: true,
138
+ apiKeyEnvVar: 'ZAI_API_KEY',
94
139
  suggestedModels: [
140
+ 'glm-5.2',
95
141
  'glm-5.1',
96
- 'glm-5.1-fw',
142
+ 'glm-5-turbo',
97
143
  ],
98
144
  category: 'cloud',
99
145
  },
@@ -102,9 +148,208 @@ export const PROVIDER_PRESETS = [
102
148
  name: 'Z.ai Coding Subscription',
103
149
  baseUrl: 'https://api.z.ai/api/coding/paas/v4/',
104
150
  needsApiKey: true,
151
+ apiKeyEnvVar: 'ZAI_API_KEY',
105
152
  suggestedModels: [
153
+ 'glm-5.2',
106
154
  'glm-5.1',
107
- 'glm-5.1-fw',
155
+ 'glm-5v-turbo',
156
+ ],
157
+ category: 'cloud',
158
+ },
159
+ {
160
+ id: 'kimi-code',
161
+ name: 'Kimi Code',
162
+ baseUrl: 'https://api.kimi.com/coding/v1',
163
+ needsApiKey: true,
164
+ apiKeyEnvVar: 'KIMI_API_KEY',
165
+ suggestedModels: [
166
+ 'kimi-for-coding',
167
+ 'k3',
168
+ ],
169
+ category: 'cloud',
170
+ },
171
+ {
172
+ id: 'moonshot',
173
+ name: 'Moonshot AI (Kimi API)',
174
+ baseUrl: 'https://api.moonshot.ai/v1',
175
+ needsApiKey: true,
176
+ apiKeyEnvVar: 'MOONSHOT_API_KEY',
177
+ suggestedModels: [
178
+ // SOTA
179
+ 'kimi-k3',
180
+ 'kimi-k2.7-code',
181
+ // Fast
182
+ 'kimi-k2.6',
183
+ 'kimi-k2.5',
184
+ ],
185
+ category: 'cloud',
186
+ },
187
+ {
188
+ id: 'minimax-coding',
189
+ name: 'MiniMax Coding Plan',
190
+ baseUrl: 'https://api.minimax.io/anthropic/v1',
191
+ needsApiKey: true,
192
+ apiKeyEnvVar: 'MINIMAX_API_KEY',
193
+ suggestedModels: [
194
+ // SOTA
195
+ 'MiniMax-M3',
196
+ // Fast
197
+ 'MiniMax-M2.7',
198
+ 'MiniMax-M2.7-highspeed',
199
+ ],
200
+ category: 'cloud',
201
+ },
202
+ {
203
+ id: 'groq',
204
+ name: 'Groq',
205
+ baseUrl: 'https://api.groq.com/openai/v1',
206
+ needsApiKey: true,
207
+ apiKeyEnvVar: 'GROQ_API_KEY',
208
+ suggestedModels: [
209
+ 'openai/gpt-oss-120b',
210
+ 'qwen/qwen3-32b',
211
+ 'llama-3.3-70b-versatile',
212
+ ],
213
+ category: 'cloud',
214
+ },
215
+ {
216
+ id: 'cerebras',
217
+ name: 'Cerebras',
218
+ baseUrl: 'https://api.cerebras.ai/v1',
219
+ needsApiKey: true,
220
+ apiKeyEnvVar: 'CEREBRAS_API_KEY',
221
+ suggestedModels: [
222
+ 'gpt-oss-120b',
223
+ 'zai-glm-4.7',
224
+ ],
225
+ category: 'cloud',
226
+ },
227
+ {
228
+ id: 'together',
229
+ name: 'Together AI',
230
+ baseUrl: 'https://api.together.ai/v1',
231
+ needsApiKey: true,
232
+ apiKeyEnvVar: 'TOGETHER_API_KEY',
233
+ suggestedModels: [
234
+ // SOTA
235
+ 'moonshotai/Kimi-K3',
236
+ 'deepseek-ai/DeepSeek-V4-Pro',
237
+ // Fast
238
+ 'moonshotai/Kimi-K2.7-Code',
239
+ 'zai-org/GLM-5.2',
240
+ ],
241
+ category: 'cloud',
242
+ },
243
+ {
244
+ id: 'fireworks',
245
+ name: 'Fireworks AI',
246
+ baseUrl: 'https://api.fireworks.ai/inference/v1',
247
+ needsApiKey: true,
248
+ apiKeyEnvVar: 'FIREWORKS_API_KEY',
249
+ suggestedModels: [
250
+ // SOTA
251
+ 'accounts/fireworks/models/kimi-k3',
252
+ 'accounts/fireworks/models/glm-5p2',
253
+ // Fast
254
+ 'accounts/fireworks/routers/kimi-k3-fast',
255
+ 'accounts/fireworks/models/minimax-m3',
256
+ ],
257
+ category: 'cloud',
258
+ },
259
+ {
260
+ id: 'huggingface',
261
+ name: 'Hugging Face Router',
262
+ baseUrl: 'https://router.huggingface.co/v1',
263
+ needsApiKey: true,
264
+ apiKeyHint: 'Hugging Face token (from https://huggingface.co/settings/tokens)',
265
+ apiKeyEnvVar: 'HF_TOKEN',
266
+ suggestedModels: [
267
+ // SOTA
268
+ 'moonshotai/Kimi-K3',
269
+ 'zai-org/GLM-5.2',
270
+ // Fast
271
+ 'deepseek-ai/DeepSeek-V4-Flash',
272
+ 'Qwen/Qwen3-Coder-Next',
273
+ ],
274
+ category: 'cloud',
275
+ },
276
+ {
277
+ id: 'nvidia',
278
+ name: 'NVIDIA NIM',
279
+ baseUrl: 'https://integrate.api.nvidia.com/v1',
280
+ needsApiKey: true,
281
+ apiKeyEnvVar: 'NVIDIA_API_KEY',
282
+ suggestedModels: [
283
+ 'nvidia/nemotron-3-ultra-550b-a55b',
284
+ 'nvidia/nemotron-3-super-120b-a12b',
285
+ 'minimaxai/minimax-m3',
286
+ ],
287
+ category: 'cloud',
288
+ },
289
+ {
290
+ id: 'qwen-token-plan',
291
+ name: 'Qwen Token Plan',
292
+ baseUrl: 'https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1',
293
+ needsApiKey: true,
294
+ apiKeyHint: 'Alibaba Cloud Model Studio API key with a token plan',
295
+ apiKeyEnvVar: 'QWEN_TOKEN_PLAN_API_KEY',
296
+ suggestedModels: [
297
+ // SOTA
298
+ 'qwen3.7-max',
299
+ 'glm-5.2',
300
+ // Fast
301
+ 'qwen3.7-plus',
302
+ 'kimi-k2.7-code',
303
+ ],
304
+ category: 'cloud',
305
+ },
306
+ {
307
+ id: 'opencode-zen',
308
+ name: 'OpenCode Zen',
309
+ baseUrl: 'https://opencode.ai/zen/v1',
310
+ needsApiKey: true,
311
+ apiKeyEnvVar: 'OPENCODE_API_KEY',
312
+ suggestedModels: [
313
+ // SOTA
314
+ 'claude-opus-4-8',
315
+ 'gpt-5.5',
316
+ // Fast
317
+ 'claude-sonnet-4-6',
318
+ 'kimi-k3',
319
+ 'minimax-m3',
320
+ ],
321
+ category: 'cloud',
322
+ },
323
+ {
324
+ id: 'requesty',
325
+ name: 'Requesty',
326
+ baseUrl: 'https://router.requesty.ai/v1',
327
+ needsApiKey: true,
328
+ apiKeyHint: 'API Key (from https://app.requesty.ai/api-keys)',
329
+ suggestedModels: [
330
+ 'openai/gpt-4o-mini',
331
+ ],
332
+ category: 'cloud',
333
+ },
334
+ {
335
+ id: 'thesean',
336
+ name: 'Thesean AI',
337
+ baseUrl: 'https://api.thesean.ai',
338
+ needsApiKey: true,
339
+ apiKeyHint: 'API Key (from https://app.thesean.ai/)',
340
+ suggestedModels: [
341
+ 'ship-like/claude-opus-4-8',
342
+ ],
343
+ category: 'cloud',
344
+ },
345
+ {
346
+ id: 'atlas-cloud',
347
+ name: 'Atlas Cloud',
348
+ baseUrl: 'https://api.atlascloud.ai/v1',
349
+ needsApiKey: true,
350
+ apiKeyHint: 'API Key (from atlascloud.ai/developer)',
351
+ suggestedModels: [
352
+ 'gpt-5.6-sol',
108
353
  ],
109
354
  category: 'cloud',
110
355
  },
@@ -114,6 +359,7 @@ export const PROVIDER_PRESETS = [
114
359
  baseUrl: 'https://models.github.ai/inference',
115
360
  needsApiKey: true,
116
361
  apiKeyHint: 'GitHub Token (PAT with models:read scope)',
362
+ apiKeyEnvVar: 'GITHUB_TOKEN',
117
363
  suggestedModels: [
118
364
  'gpt-5.4',
119
365
  'gpt-5.4-mini',
@@ -125,14 +371,17 @@ export const PROVIDER_PRESETS = [
125
371
  {
126
372
  id: 'github-copilot',
127
373
  name: 'GitHub Copilot',
128
- baseUrl: 'https://api.githubcopilot.com',
374
+ baseUrl: 'https://api.individual.githubcopilot.com',
129
375
  needsApiKey: true,
130
376
  apiKeyHint: 'GitHub Copilot token (OAuth)',
377
+ apiKeyEnvVar: 'COPILOT_GITHUB_TOKEN',
131
378
  suggestedModels: [
379
+ 'gpt-5.6-sol',
380
+ 'gpt-5.5',
132
381
  'gpt-5.4',
133
382
  'claude-fable-5',
134
383
  'claude-sonnet-4-6',
135
- 'gemini-3.1-pro',
384
+ 'gemini-3.1-pro-preview',
136
385
  ],
137
386
  category: 'cloud',
138
387
  },
@@ -143,31 +392,10 @@ export const PROVIDER_PRESETS = [
143
392
  needsApiKey: true,
144
393
  apiKeyHint: 'ChatGPT session token (OAuth)',
145
394
  suggestedModels: [
395
+ 'gpt-5.5',
146
396
  'gpt-5.4',
147
- 'o4-mini',
148
- ],
149
- category: 'cloud',
150
- },
151
- {
152
- id: 'kimi-code',
153
- name: 'Kimi Code',
154
- baseUrl: 'https://api.kimi.com/coding/v1',
155
- needsApiKey: true,
156
- suggestedModels: [
157
- 'kimi-for-coding',
158
- ],
159
- category: 'cloud',
160
- },
161
- {
162
- id: 'minimax-coding',
163
- name: 'MiniMax Coding Plan',
164
- baseUrl: 'https://api.minimax.io/anthropic/v1',
165
- needsApiKey: true,
166
- suggestedModels: [
167
- // SOTA
168
- 'MiniMax-M3',
169
- // Fast
170
- 'MiniMax-M2.7',
397
+ 'gpt-5.3-codex',
398
+ 'gpt-5.3-codex-spark',
171
399
  ],
172
400
  category: 'cloud',
173
401
  },
@@ -180,6 +408,7 @@ export const PROVIDER_PRESETS = [
180
408
  suggestedModels: [
181
409
  // SOTA
182
410
  'claude-opus-4.8',
411
+ 'gpt-5.6-sol',
183
412
  'gpt-5.5',
184
413
  'gemini-3.5-flash',
185
414
  // Fast
@@ -21,3 +21,5 @@ export declare function resolveModelSelector(settings: HazeSettings, selector: s
21
21
  export declare function modelSelector(provider: HazeProviderSettings, model: string): string;
22
22
  export declare function upsertProvider(settings: HazeSettings, provider: HazeProviderSettings): HazeProviderSettings[];
23
23
  export declare function providerHasKey(settings: HazeSettings, provider: HazeProviderSettings): boolean;
24
+ /** Image input is explicit-only (F03): never inferred from URL or model name. */
25
+ export declare function providerImageCapable(provider: HazeProviderSettings): boolean;
@@ -19,10 +19,13 @@ function normalizeProvider(provider, fallbackModel) {
19
19
  if (!name || !url)
20
20
  return undefined;
21
21
  const key = provider.key?.trim();
22
+ // Capabilities are explicit only: an absent/false flag means "not capable".
23
+ const capabilities = provider.capabilities ?? undefined;
22
24
  return {
23
25
  name,
24
26
  url,
25
27
  ...(key ? { key } : {}),
28
+ ...(capabilities ? { capabilities } : {}),
26
29
  models: normalizeModels(provider.models, fallbackModel),
27
30
  };
28
31
  }
@@ -86,3 +89,7 @@ export function upsertProvider(settings, provider) {
86
89
  export function providerHasKey(settings, provider) {
87
90
  return Boolean(provider.key ?? (provider.name === 'openrouter' ? settings.apiKey : undefined));
88
91
  }
92
+ /** Image input is explicit-only (F03): never inferred from URL or model name. */
93
+ export function providerImageCapable(provider) {
94
+ return provider.capabilities?.images === true;
95
+ }
@@ -3,6 +3,13 @@ export interface HazeProviderSettings {
3
3
  url: string;
4
4
  key?: string;
5
5
  models: string[];
6
+ /**
7
+ * Explicit endpoint capabilities. Never inferred: images are only sent to
8
+ * providers the user marked image-capable (F03).
9
+ */
10
+ capabilities?: {
11
+ images?: boolean;
12
+ };
6
13
  }
7
14
  export interface HazeLspServerSettings {
8
15
  name: string;
@@ -33,8 +40,16 @@ export interface HazeMcpServer {
33
40
  */
34
41
  export interface HazeSkillSetting {
35
42
  name: string;
43
+ /** Omitted by older settings and interpreted as global. */
44
+ scope?: 'global' | 'project';
36
45
  enabled?: boolean;
37
46
  }
47
+ export interface HazeSubagentSettings {
48
+ workerModel?: string;
49
+ defaultProfile?: string;
50
+ profiles?: Record<string, Record<string, unknown>>;
51
+ [key: string]: unknown;
52
+ }
38
53
  export interface HazeSettings {
39
54
  provider?: string;
40
55
  model?: string;
@@ -42,6 +57,11 @@ export interface HazeSettings {
42
57
  lspServers?: HazeLspServerSettings[];
43
58
  mcpServers?: HazeMcpServer[];
44
59
  skills?: HazeSkillSetting[];
60
+ subagents?: HazeSubagentSettings;
61
+ /** UI tweaks: rotating tips under the busy label, etc. Default enabled. */
62
+ tips?: {
63
+ enabled?: boolean;
64
+ };
45
65
  apiKey?: string;
46
66
  baseURL?: string;
47
67
  [key: string]: unknown;
@@ -50,3 +70,5 @@ export declare const SETTINGS_FILE: string;
50
70
  export declare function readSettings(): Promise<HazeSettings>;
51
71
  export declare function writeSettings(settings: HazeSettings): Promise<void>;
52
72
  export declare function updateSettings(patch: HazeSettings): Promise<HazeSettings>;
73
+ /** Patch subagent settings without dropping unknown nested/profile fields. */
74
+ export declare function updateSubagentSettings(patch: HazeSubagentSettings): Promise<HazeSettings>;
@@ -2,12 +2,18 @@ import fs from 'fs-extra';
2
2
  import path from 'node:path';
3
3
  import { z } from 'zod';
4
4
  import { HAZE_DIR } from './paths.js';
5
+ import { tightenPrivateFile, writePrivateJsonAtomic } from './privateStorage.js';
6
+ import { customProfileSchema } from '../core/subagent/executionProfiles.js';
5
7
  export const SETTINGS_FILE = path.join(HAZE_DIR, 'settings.json');
8
+ const providerCapabilitiesSchema = z.object({
9
+ images: z.boolean().optional(),
10
+ }).passthrough();
6
11
  const providerSchema = z.object({
7
12
  name: z.string(),
8
13
  url: z.string(),
9
14
  key: z.string().optional(),
10
15
  models: z.array(z.string()),
16
+ capabilities: providerCapabilitiesSchema.optional(),
11
17
  }).passthrough();
12
18
  const lspServerSchema = z.object({
13
19
  name: z.string(),
@@ -27,7 +33,12 @@ const mcpServerSchema = z.object({
27
33
  headers: z.array(mcpHeaderSchema).optional(),
28
34
  enabled: z.boolean().optional(),
29
35
  }).passthrough();
30
- const skillSettingSchema = z.object({ name: z.string(), enabled: z.boolean().optional() }).passthrough();
36
+ const skillSettingSchema = z.object({ name: z.string(), scope: z.enum(['global', 'project']).optional(), enabled: z.boolean().optional() }).passthrough();
37
+ const subagentSettingsSchema = z.object({
38
+ workerModel: z.string().trim().min(1).optional(),
39
+ defaultProfile: z.string().trim().min(1).optional(),
40
+ profiles: z.record(z.string().min(1), customProfileSchema).optional(),
41
+ }).passthrough();
31
42
  const settingsSchema = z.object({
32
43
  provider: z.string().optional(),
33
44
  model: z.string().optional(),
@@ -35,6 +46,8 @@ const settingsSchema = z.object({
35
46
  lspServers: z.array(lspServerSchema).optional(),
36
47
  mcpServers: z.array(mcpServerSchema).optional(),
37
48
  skills: z.array(skillSettingSchema).optional(),
49
+ subagents: subagentSettingsSchema.optional(),
50
+ tips: z.object({ enabled: z.boolean().optional() }).optional(),
38
51
  apiKey: z.string().optional(),
39
52
  baseURL: z.string().optional(),
40
53
  }).passthrough();
@@ -44,6 +57,8 @@ function settingsReadError(error) {
44
57
  }
45
58
  export async function readSettings() {
46
59
  try {
60
+ if (await fs.pathExists(SETTINGS_FILE))
61
+ await tightenPrivateFile(SETTINGS_FILE);
47
62
  const raw = await fs.readJson(SETTINGS_FILE);
48
63
  return settingsSchema.parse(raw);
49
64
  }
@@ -55,14 +70,27 @@ export async function readSettings() {
55
70
  }
56
71
  }
57
72
  export async function writeSettings(settings) {
58
- await fs.ensureDir(HAZE_DIR);
59
73
  const parsed = settingsSchema.parse(settings);
60
- const tempFile = `${SETTINGS_FILE}.${process.pid}.${Date.now()}.tmp`;
61
- await fs.writeJson(tempFile, parsed, { spaces: 2 });
62
- await fs.move(tempFile, SETTINGS_FILE, { overwrite: true });
74
+ await writePrivateJsonAtomic(SETTINGS_FILE, parsed);
63
75
  }
64
76
  export async function updateSettings(patch) {
65
77
  const next = { ...await readSettings(), ...patch };
66
78
  await writeSettings(next);
67
79
  return next;
68
80
  }
81
+ /** Patch subagent settings without dropping unknown nested/profile fields. */
82
+ export async function updateSubagentSettings(patch) {
83
+ const current = await readSettings();
84
+ const currentSubagents = current.subagents ?? {};
85
+ const profiles = patch.profiles
86
+ ? Object.fromEntries(Object.entries(patch.profiles).map(([name, value]) => [name, { ...(currentSubagents.profiles?.[name] ?? {}), ...value }]))
87
+ : undefined;
88
+ const subagents = {
89
+ ...currentSubagents,
90
+ ...patch,
91
+ ...(profiles ? { profiles: { ...(currentSubagents.profiles ?? {}), ...profiles } } : {}),
92
+ };
93
+ const next = { ...current, subagents };
94
+ await writeSettings(next);
95
+ return next;
96
+ }
@@ -1,15 +1,8 @@
1
1
  import type { HazeSettings, HazeSkillSetting } from './settings.js';
2
- /**
3
- * Normalized skill metadata overrides. The list is override-only: only skills that
4
- * deviate from the default (enabled) appear here, so it never desyncs from disk.
5
- */
2
+ import type { SkillSource } from '../skills/types.js';
3
+ /** Normalized override-only skill settings. Legacy entries apply to global skills. */
6
4
  export declare function configuredSkillSettings(settings: HazeSettings): HazeSkillSetting[];
7
- /** A skill is enabled unless an explicit override disables it. */
8
- export declare function isSkillEnabled(settings: HazeSettings, name: string): boolean;
9
- /**
10
- * Toggle a skill. Enabling clears its override (back to default); disabling records
11
- * `enabled: false`. Returns the next `skills` array for updateSettings.
12
- */
13
- export declare function setSkillEnabled(settings: HazeSettings, name: string, enabled: boolean): HazeSkillSetting[];
14
- /** Drop a skill's override entry. Called when a skill directory is removed. */
15
- export declare function removeSkillSetting(settings: HazeSettings, name: string): HazeSkillSetting[];
5
+ /** A skill is enabled unless an explicit scope-aware override disables it. */
6
+ export declare function isSkillEnabled(settings: HazeSettings, name: string, scope?: SkillSource): boolean;
7
+ export declare function setSkillEnabled(settings: HazeSettings, name: string, enabled: boolean, scope?: SkillSource): HazeSkillSetting[];
8
+ export declare function removeSkillSetting(settings: HazeSettings, name: string, scope?: SkillSource): HazeSkillSetting[];
@@ -1,32 +1,33 @@
1
- import { findByName, removeByName } from '../utils/collections.js';
2
- /**
3
- * Normalized skill metadata overrides. The list is override-only: only skills that
4
- * deviate from the default (enabled) appear here, so it never desyncs from disk.
5
- */
1
+ /** Normalized override-only skill settings. Legacy entries apply to global skills. */
6
2
  export function configuredSkillSettings(settings) {
7
3
  const result = [];
8
4
  for (const entry of settings.skills ?? []) {
9
5
  const name = entry.name?.trim();
10
6
  if (!name)
11
7
  continue;
12
- result.push({ name, ...(entry.enabled === false ? { enabled: false } : {}) });
8
+ result.push({
9
+ name,
10
+ ...(entry.scope ? { scope: entry.scope } : {}),
11
+ ...(entry.enabled === false ? { enabled: false } : {}),
12
+ });
13
13
  }
14
14
  return result;
15
15
  }
16
- /** A skill is enabled unless an explicit override disables it. */
17
- export function isSkillEnabled(settings, name) {
18
- const entry = findByName(configuredSkillSettings(settings), name);
16
+ function settingScope(entry) {
17
+ return entry.scope ?? 'global';
18
+ }
19
+ function matches(entry, name, scope) {
20
+ return entry.name === name && settingScope(entry) === scope;
21
+ }
22
+ /** A skill is enabled unless an explicit scope-aware override disables it. */
23
+ export function isSkillEnabled(settings, name, scope = 'global') {
24
+ const entry = configuredSkillSettings(settings).find(candidate => matches(candidate, name, scope));
19
25
  return entry ? entry.enabled !== false : true;
20
26
  }
21
- /**
22
- * Toggle a skill. Enabling clears its override (back to default); disabling records
23
- * `enabled: false`. Returns the next `skills` array for updateSettings.
24
- */
25
- export function setSkillEnabled(settings, name, enabled) {
26
- const others = removeByName(configuredSkillSettings(settings), name);
27
- return enabled ? others : [...others, { name, enabled: false }];
27
+ export function setSkillEnabled(settings, name, enabled, scope = 'global') {
28
+ const others = configuredSkillSettings(settings).filter(entry => !matches(entry, name, scope));
29
+ return enabled ? others : [...others, { name, ...(scope === 'project' ? { scope } : {}), enabled: false }];
28
30
  }
29
- /** Drop a skill's override entry. Called when a skill directory is removed. */
30
- export function removeSkillSetting(settings, name) {
31
- return removeByName(configuredSkillSettings(settings), name);
31
+ export function removeSkillSetting(settings, name, scope = 'global') {
32
+ return configuredSkillSettings(settings).filter(entry => !matches(entry, name, scope));
32
33
  }
@@ -4,6 +4,7 @@ import fs from 'fs-extra';
4
4
  import path from 'node:path';
5
5
  import { HAZE_DIR } from './paths.js';
6
6
  import { isNewer } from '../utils/version.js';
7
+ import { tightenPrivateFile, writePrivateJsonAtomic } from './privateStorage.js';
7
8
  const execFile = promisify(execFileCallback);
8
9
  export const UPDATE_CHECK_FILE = path.join(HAZE_DIR, 'updateCheck.json');
9
10
  const DEFAULT_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24h
@@ -13,11 +14,12 @@ async function defaultExecVersion(packageName, options) {
13
14
  return stdout;
14
15
  }
15
16
  async function defaultReadStore(file) {
17
+ if (await fs.pathExists(file))
18
+ await tightenPrivateFile(file);
16
19
  return fs.readJson(file).catch(() => ({}));
17
20
  }
18
21
  async function defaultWriteStore(file, store) {
19
- await fs.ensureDir(path.dirname(file));
20
- await fs.writeJson(file, store, { spaces: 2 });
22
+ await writePrivateJsonAtomic(file, store);
21
23
  }
22
24
  /**
23
25
  * Non-blockingly check whether a newer version of `packageName` is published.