@denizokcu/haze 1.4.0 → 1.5.1

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 (134) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/README.md +28 -12
  3. package/SECURITY.md +1 -1
  4. package/dist/buildInfo.json +3 -3
  5. package/dist/cli/chat/BusyBar.d.ts +7 -0
  6. package/dist/cli/chat/BusyBar.js +8 -0
  7. package/dist/cli/chat/DynamicFrame.d.ts +37 -0
  8. package/dist/cli/chat/DynamicFrame.js +48 -0
  9. package/dist/cli/chat/busyIndicator.d.ts +3 -1
  10. package/dist/cli/chat/busyIndicator.js +11 -9
  11. package/dist/cli/chat/chatMetrics.d.ts +1 -1
  12. package/dist/cli/chat/chatMetrics.js +3 -3
  13. package/dist/cli/chat/inputSuggestions.js +2 -1
  14. package/dist/cli/chat/liveRegion.js +1 -1
  15. package/dist/cli/chat/messages.js +27 -16
  16. package/dist/cli/chat/resizeGuard.d.ts +20 -0
  17. package/dist/cli/chat/resizeGuard.js +25 -0
  18. package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
  19. package/dist/cli/chat/sessionLifecycle.js +13 -2
  20. package/dist/cli/chat/sessionRecorder.d.ts +2 -1
  21. package/dist/cli/chat/sessionRecorder.js +8 -0
  22. package/dist/cli/chat/shutdown.d.ts +27 -0
  23. package/dist/cli/chat/shutdown.js +79 -0
  24. package/dist/cli/chat/terminalControl.d.ts +45 -0
  25. package/dist/cli/chat/terminalControl.js +107 -0
  26. package/dist/cli/chat/tips.js +1 -0
  27. package/dist/cli/chat/userInput.d.ts +43 -0
  28. package/dist/cli/chat/userInput.js +63 -0
  29. package/dist/cli/chat/wizard/sessionThemeHandlers.js +14 -6
  30. package/dist/cli/chat/wizard/types.d.ts +8 -1
  31. package/dist/cli/chat/wizardDispatch.js +1 -1
  32. package/dist/cli/commands/chat.js +258 -172
  33. package/dist/cli/commands/commandHelp.js +6 -2
  34. package/dist/cli/commands/commands.d.ts +8 -0
  35. package/dist/cli/commands/commands.js +11 -0
  36. package/dist/cli/commands/formatters.d.ts +1 -1
  37. package/dist/cli/commands/formatters.js +20 -2
  38. package/dist/cli/commands/logsCommand.js +21 -2
  39. package/dist/cli/commands/reasoningCommand.d.ts +23 -14
  40. package/dist/cli/commands/reasoningCommand.js +53 -20
  41. package/dist/cli/commands/runCommand.js +19 -11
  42. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
  43. package/dist/cli/commands/streaming/attemptOutcome.js +11 -6
  44. package/dist/cli/commands/streaming/attemptSetup.d.ts +1 -0
  45. package/dist/cli/commands/streaming/attemptSetup.js +11 -5
  46. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +8 -1
  47. package/dist/cli/commands/streaming/goalCheckpoint.js +3 -2
  48. package/dist/cli/commands/streaming/goalSupervisor.d.ts +4 -0
  49. package/dist/cli/commands/streaming/goalSupervisor.js +43 -7
  50. package/dist/cli/commands/streaming/prepareStep.js +7 -3
  51. package/dist/cli/commands/streaming/streamLoop.d.ts +5 -0
  52. package/dist/cli/commands/streaming/streamLoop.js +3 -0
  53. package/dist/cli/commands/streaming/toolPartHandlers.js +6 -0
  54. package/dist/cli/commands/streaming.d.ts +1 -1
  55. package/dist/cli/commands/streaming.js +23 -17
  56. package/dist/cli/commands/wizardFlow.d.ts +5 -2
  57. package/dist/cli/commands/wizardFlow.js +17 -10
  58. package/dist/cli/index.js +17 -1
  59. package/dist/config/contextFiles.d.ts +9 -0
  60. package/dist/config/contextFiles.js +21 -1
  61. package/dist/config/modelCatalog.d.ts +3 -0
  62. package/dist/config/modelCatalog.js +29 -0
  63. package/dist/config/providerPresets.d.ts +1 -1
  64. package/dist/config/providerPresets.js +42 -3
  65. package/dist/config/settings.d.ts +11 -4
  66. package/dist/config/settings.js +9 -0
  67. package/dist/core/agent/budgets.d.ts +13 -15
  68. package/dist/core/agent/budgets.js +15 -17
  69. package/dist/core/agent/completionController.d.ts +6 -2
  70. package/dist/core/agent/completionController.js +16 -3
  71. package/dist/core/agent/goalPolicy.d.ts +10 -0
  72. package/dist/core/agent/goalPolicy.js +44 -6
  73. package/dist/core/agent/projectPreflight.d.ts +2 -0
  74. package/dist/core/agent/projectPreflight.js +56 -0
  75. package/dist/core/agent/reasoningPolicy.d.ts +34 -4
  76. package/dist/core/agent/reasoningPolicy.js +27 -4
  77. package/dist/core/agent/workState.d.ts +8 -0
  78. package/dist/core/agent/workState.js +191 -8
  79. package/dist/core/providerContracts.d.ts +32 -0
  80. package/dist/core/providerContracts.js +1 -0
  81. package/dist/core/session/sessionReport.d.ts +33 -0
  82. package/dist/core/session/sessionReport.js +121 -0
  83. package/dist/core/session/sessionSlimming.js +9 -3
  84. package/dist/core/session/sessionStore.d.ts +12 -0
  85. package/dist/core/session/sessionStore.js +20 -4
  86. package/dist/core/subagent/contracts.d.ts +3 -25
  87. package/dist/core/subagent/executionProfiles.js +4 -4
  88. package/dist/core/validation/outputParser.d.ts +6 -1
  89. package/dist/core/validation/outputParser.js +6 -2
  90. package/dist/llm/client.d.ts +4 -2
  91. package/dist/llm/client.js +44 -16
  92. package/dist/llm/hazeTools.d.ts +8553 -8550
  93. package/dist/llm/hazeTools.js +6 -503
  94. package/dist/llm/lspTools.d.ts +120 -120
  95. package/dist/llm/mcp.js +3 -0
  96. package/dist/llm/requestContext.d.ts +1 -1
  97. package/dist/llm/requestContext.js +1 -1
  98. package/dist/{core/subagent → llm}/subagentRunner.d.ts +9 -9
  99. package/dist/{core/subagent → llm}/subagentRunner.js +22 -25
  100. package/dist/llm/systemPrompt.d.ts +11 -1
  101. package/dist/llm/systemPrompt.js +2 -11
  102. package/dist/llm/tools/fetchTool.d.ts +30 -30
  103. package/dist/llm/tools/fileTools.d.ts +7768 -0
  104. package/dist/llm/tools/fileTools.js +510 -0
  105. package/dist/llm/tools/processTool.d.ts +30 -30
  106. package/dist/llm/tools/shellTool.d.ts +30 -30
  107. package/dist/llm/tools/shellTool.js +8 -4
  108. package/dist/llm/tools/toolContext.d.ts +3 -32
  109. package/dist/llm/tools/toolContext.js +33 -52
  110. package/dist/llm/tools/toolContextState.d.ts +40 -0
  111. package/dist/llm/tools/toolContextState.js +34 -0
  112. package/dist/llm/workerContext.d.ts +7 -0
  113. package/dist/llm/workerContext.js +18 -1
  114. package/dist/skills/SkillLoader.js +3 -3
  115. package/dist/skills/SkillRegistry.js +3 -3
  116. package/dist/skills/builder/SkillBuilder.js +3 -3
  117. package/dist/skills/confinement.d.ts +7 -0
  118. package/dist/skills/confinement.js +15 -0
  119. package/dist/ui/codeHighlight.js +4 -4
  120. package/dist/ui/components/MarkdownText.js +7 -8
  121. package/dist/ui/components/NativeIndicators.d.ts +15 -0
  122. package/dist/ui/components/NativeIndicators.js +32 -0
  123. package/dist/ui/components/StreamingMarkdownText.d.ts +9 -0
  124. package/dist/ui/components/StreamingMarkdownText.js +38 -0
  125. package/dist/ui/components/TextInput.d.ts +7 -2
  126. package/dist/ui/components/TextInput.js +103 -46
  127. package/dist/ui/components/WizardChoices.d.ts +18 -0
  128. package/dist/ui/components/WizardChoices.js +32 -0
  129. package/dist/ui/inputBuffer.js +12 -6
  130. package/dist/ui/textGeometry.d.ts +14 -0
  131. package/dist/ui/textGeometry.js +31 -0
  132. package/package.json +14 -13
  133. /package/dist/cli/{contextReport.d.ts → contextReportCli.d.ts} +0 -0
  134. /package/dist/cli/{contextReport.js → contextReportCli.js} +0 -0
@@ -12,12 +12,25 @@
12
12
  * little earlier, over-budgeting hard-fails the request. First match wins, so
13
13
  * keep more specific patterns before broader family prefixes.
14
14
  *
15
+ * Refreshed 2026-10-04 against https://models.dev/api.json. Provider-specific
16
+ * caps belong in provider presets/settings, not these conservative family entries.
17
+ *
15
18
  * Local inference servers (localhost URLs) never consult the catalog: their
16
19
  * effective window is set by server configuration (often far below the model's
17
20
  * nominal window) and silent truncation there is undetectable.
18
21
  */
19
22
  const MODEL_CATALOG = [
20
23
  // ── OpenAI ────────────────────────────────────────────────────────────────
24
+ { match: 'gpt-6.1-sol', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
25
+ { match: 'gpt-6-astra', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
26
+ { match: 'gpt-6-sol', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
27
+ { match: 'gpt-6-luna', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
28
+ { match: 'gpt-5.6', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
29
+ { match: 'gpt-5.5', contextWindowTokens: 400_000, maxOutputTokens: 128_000, note: 'Poe caps this family at 400K; origin limits belong in presets' },
30
+ { match: 'gpt-5.4-mini', contextWindowTokens: 400_000, maxOutputTokens: 128_000 },
31
+ { match: 'gpt-5.4-nano', contextWindowTokens: 400_000, maxOutputTokens: 128_000 },
32
+ { match: 'gpt-5.4', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
33
+ { match: 'gpt-5.3-codex-spark', contextWindowTokens: 128_000, maxOutputTokens: 32_000 },
21
34
  { match: 'gpt-5.1-codex', contextWindowTokens: 400_000, maxOutputTokens: 128_000 },
22
35
  { match: 'gpt-5.1-codex-mini', contextWindowTokens: 400_000, maxOutputTokens: 128_000 },
23
36
  { match: 'gpt-5', contextWindowTokens: 400_000, maxOutputTokens: 128_000 },
@@ -27,6 +40,9 @@ const MODEL_CATALOG = [
27
40
  { match: 'o3', contextWindowTokens: 200_000, maxOutputTokens: 100_000 },
28
41
  { match: 'o1', contextWindowTokens: 200_000, maxOutputTokens: 100_000 },
29
42
  // ── Anthropic ─────────────────────────────────────────────────────────────
43
+ { match: 'claude-opus-5', contextWindowTokens: 1_000_000, maxOutputTokens: 128_000 },
44
+ { match: 'claude-sonnet-5', contextWindowTokens: 1_000_000, maxOutputTokens: 128_000 },
45
+ { match: 'claude-fable-5', contextWindowTokens: 1_000_000, maxOutputTokens: 128_000 },
30
46
  { match: 'claude-opus-4', contextWindowTokens: 200_000, maxOutputTokens: 32_000 },
31
47
  { match: 'claude-sonnet-4', contextWindowTokens: 200_000, maxOutputTokens: 64_000 },
32
48
  { match: 'claude-haiku-4', contextWindowTokens: 200_000, maxOutputTokens: 32_000 },
@@ -37,17 +53,30 @@ const MODEL_CATALOG = [
37
53
  { match: 'gemini-2.5', contextWindowTokens: 1_048_576, maxOutputTokens: 65_536 },
38
54
  { match: 'gemini-2.0', contextWindowTokens: 1_048_576, maxOutputTokens: 8_192 },
39
55
  // ── xAI ───────────────────────────────────────────────────────────────────
56
+ { match: 'grok-4.7', contextWindowTokens: 500_000, maxOutputTokens: 450_000, note: 'smaller OpenRouter output cap' },
57
+ { match: 'grok-4.6', contextWindowTokens: 500_000, maxOutputTokens: 500_000 },
58
+ { match: 'grok-4.5', contextWindowTokens: 500_000, maxOutputTokens: 500_000 },
40
59
  { match: 'grok-4', contextWindowTokens: 256_000, maxOutputTokens: 32_768 },
41
60
  { match: 'grok-3', contextWindowTokens: 131_072, maxOutputTokens: 32_768 },
42
61
  // ── DeepSeek ──────────────────────────────────────────────────────────────
62
+ { match: 'deepseek-v4.1', contextWindowTokens: 1_000_000, maxOutputTokens: 384_000, note: 'smaller gateway window and output cap' },
63
+ { match: 'deepseek-v4', contextWindowTokens: 512_000, maxOutputTokens: 384_000, note: 'Together caps V4 Pro at 512K' },
64
+ { match: 'deepseek-flash', contextWindowTokens: 1_000_000, maxOutputTokens: 393_216 },
43
65
  { match: 'deepseek-reasoner', contextWindowTokens: 128_000, maxOutputTokens: 32_768, note: 'R1/reasoner family' },
44
66
  { match: 'deepseek-r1', contextWindowTokens: 128_000, maxOutputTokens: 32_768 },
45
67
  { match: 'deepseek', contextWindowTokens: 128_000, maxOutputTokens: 8_192 },
46
68
  // ── Alibaba / Moonshot / Zhipu / MiniMax ─────────────────────────────────
69
+ { match: 'qwen3.8-max', contextWindowTokens: 262_144, maxOutputTokens: 131_072, note: 'smaller OpenCode window' },
47
70
  { match: 'qwen3-coder', contextWindowTokens: 262_144, maxOutputTokens: 32_768 },
48
71
  { match: 'qwen3', contextWindowTokens: 131_072, maxOutputTokens: 32_768, note: 'native window without YaRN extension' },
49
72
  { match: 'qwen', contextWindowTokens: 131_072, maxOutputTokens: 8_192 },
73
+ { match: 'kimi-k3', contextWindowTokens: 1_048_576, maxOutputTokens: 131_072, note: 'smaller gateway output cap' },
50
74
  { match: 'kimi-k2', contextWindowTokens: 131_072, maxOutputTokens: 32_768, note: 'input-safe half of the 256K total' },
75
+ { match: 'glm-5.3', contextWindowTokens: 1_000_000, maxOutputTokens: 131_072 },
76
+ { match: 'glm-5.2', contextWindowTokens: 262_144, maxOutputTokens: 131_072, note: 'smaller Hugging Face window' },
77
+ { match: 'glm-5.1', contextWindowTokens: 200_000, maxOutputTokens: 131_072 },
78
+ { match: 'glm-5-turbo', contextWindowTokens: 200_000, maxOutputTokens: 131_072 },
79
+ { match: 'glm-4.7', contextWindowTokens: 200_000, maxOutputTokens: 131_072 },
51
80
  { match: 'glm-4.6', contextWindowTokens: 200_000, maxOutputTokens: 32_768 },
52
81
  { match: 'glm-4.5', contextWindowTokens: 131_072, maxOutputTokens: 32_768 },
53
82
  { match: 'minimax-m2', contextWindowTokens: 204_800, maxOutputTokens: 1_048_576, note: 'output budget exceeds window in interleave mode' },
@@ -14,7 +14,7 @@
14
14
  * ones never do).
15
15
  *
16
16
  * `modelLimits` values are curated from models.dev (the same catalog pi and nanocoder
17
- * consume; refreshed 2026-08-15). They are keyed by the exact suggested model id for
17
+ * consume; recent releases refreshed 2026-10-04 from https://models.dev/api.json). They are keyed by the exact suggested model id for
18
18
  * THIS preset: aggregators may cap context below the origin model's capability (e.g.
19
19
  * Together serves DeepSeek-V4-Pro at 512K vs DeepSeek's own 1M), so limits never
20
20
  * transfer between providers. When the wizard adds a suggested model, these values are
@@ -14,7 +14,7 @@
14
14
  * ones never do).
15
15
  *
16
16
  * `modelLimits` values are curated from models.dev (the same catalog pi and nanocoder
17
- * consume; refreshed 2026-08-15). They are keyed by the exact suggested model id for
17
+ * consume; recent releases refreshed 2026-10-04 from https://models.dev/api.json). They are keyed by the exact suggested model id for
18
18
  * THIS preset: aggregators may cap context below the origin model's capability (e.g.
19
19
  * Together serves DeepSeek-V4-Pro at 512K vs DeepSeek's own 1M), so limits never
20
20
  * transfer between providers. When the wizard adds a suggested model, these values are
@@ -31,12 +31,22 @@ const PRESET_DEFINITIONS = [
31
31
  apiKeyEnvVar: 'OPENROUTER_API_KEY',
32
32
  models: [
33
33
  // SOTA
34
+ ['openai/gpt-6.1-sol', 1_050_000, 128_000],
35
+ ['openai/gpt-6-astra', 1_050_000, 128_000],
36
+ ['anthropic/claude-opus-5.5', 1_000_000, 128_000],
37
+ ['anthropic/claude-sonnet-5.5', 1_000_000, 128_000],
38
+ ['anthropic/claude-fable-5.1', 1_000_000, 128_000],
39
+ ['google/gemini-3.8-flash', 1_048_576, 65_536],
34
40
  ['anthropic/claude-opus-5', 1_048_576, 128_000],
35
41
  ['openai/gpt-5.6', 1_050_000, 128_000],
36
42
  ['google/gemini-3.7-flash', 1_048_576, 65_536],
37
43
  ['anthropic/claude-sonnet-5', 1_000_000, 128_000],
38
44
  ['qwen/qwen3.8-2.4t-a95b', 1_048_576, 262_144],
39
45
  // Fast
46
+ ['openai/gpt-6-luna', 1_050_000, 128_000],
47
+ ['x-ai/grok-4.7', 500_000, 450_000],
48
+ ['deepseek/deepseek-v4.1-flash', 1_048_576, 943_718],
49
+ ['z-ai/glm-5.3-prime', 1_000_000, 131_072],
40
50
  ['x-ai/grok-4.6', 500_000, 500_000],
41
51
  ['openai/gpt-5.4-mini', 400_000, 128_000],
42
52
  ['google/gemini-3.5-flash', 1_048_576, 65_536],
@@ -51,6 +61,10 @@ const PRESET_DEFINITIONS = [
51
61
  apiKeyEnvVar: 'OPENAI_API_KEY',
52
62
  models: [
53
63
  // SOTA
64
+ ['gpt-6.1-sol', 1_050_000, 128_000],
65
+ ['gpt-6-astra', 1_050_000, 128_000],
66
+ ['gpt-6-sol', 1_050_000, 128_000],
67
+ ['gpt-6-luna', 1_050_000, 128_000],
54
68
  ['gpt-5.6', 1_050_000, 128_000],
55
69
  ['gpt-5.6-sol', 1_050_000, 128_000],
56
70
  ['gpt-5.6-terra', 1_050_000, 128_000],
@@ -72,6 +86,7 @@ const PRESET_DEFINITIONS = [
72
86
  apiKeyEnvVar: 'GEMINI_API_KEY',
73
87
  models: [
74
88
  // SOTA
89
+ ['gemini-3.8-flash', 1_048_576, 65_536],
75
90
  ['gemini-3.1-pro-preview', 1_048_576, 65_536],
76
91
  ['gemini-3.7-flash', 1_048_576, 65_536],
77
92
  // Fast
@@ -105,9 +120,10 @@ const PRESET_DEFINITIONS = [
105
120
  apiKeyEnvVar: 'DEEPSEEK_API_KEY',
106
121
  models: [
107
122
  // SOTA
108
- ['deepseek-v4-pro', 1_000_000, 384_000],
123
+ ['deepseek-v4-pro', 1_000_000, 393_216],
109
124
  // Fast
110
- ['deepseek-v4-flash', 1_000_000, 384_000],
125
+ ['deepseek-flash', 1_000_000, 393_216],
126
+ ['deepseek-v4-flash', 1_000_000, 393_216],
111
127
  ],
112
128
  category: 'cloud',
113
129
  },
@@ -118,6 +134,7 @@ const PRESET_DEFINITIONS = [
118
134
  apiKeyEnvVar: 'XAI_API_KEY',
119
135
  models: [
120
136
  // SOTA
137
+ ['grok-4.7', 500_000, 500_000],
121
138
  ['grok-4.6', 500_000, 500_000],
122
139
  ['grok-4.5', 500_000, 500_000],
123
140
  ['grok-4.3', 1_000_000, 30_000],
@@ -132,6 +149,8 @@ const PRESET_DEFINITIONS = [
132
149
  baseUrl: 'https://api.z.ai/api/paas/v4/',
133
150
  apiKeyEnvVar: 'ZAI_API_KEY',
134
151
  models: [
152
+ ['glm-5.3-flash', 1_000_000, 131_072],
153
+ ['glm-5.3-flashx', 1_000_000, 131_072],
135
154
  ['glm-5.2', 1_000_000, 131_072],
136
155
  ['glm-5.1', 200_000, 131_072],
137
156
  ['glm-5-turbo', 200_000, 131_072],
@@ -294,6 +313,11 @@ const PRESET_DEFINITIONS = [
294
313
  apiKeyEnvVar: 'OPENCODE_API_KEY',
295
314
  models: [
296
315
  // SOTA
316
+ ['gpt-6.1-sol', 1_050_000, 128_000],
317
+ ['gpt-6-astra', 1_050_000, 128_000],
318
+ ['claude-opus-5-5', 1_000_000, 128_000],
319
+ ['claude-sonnet-5-5', 1_000_000, 128_000],
320
+ ['gemini-3.8-flash', 1_048_576, 65_536],
297
321
  ['claude-opus-5', 1_000_000, 128_000],
298
322
  ['gpt-5.5', 1_050_000, 128_000],
299
323
  ['claude-opus-4-8', 1_000_000, 128_000],
@@ -311,6 +335,12 @@ const PRESET_DEFINITIONS = [
311
335
  baseUrl: 'https://router.requesty.ai/v1',
312
336
  apiKeyHint: 'API Key (from https://app.requesty.ai/api-keys)',
313
337
  models: [
338
+ ['gpt-6.1-sol', 1_050_000, 128_000],
339
+ ['gpt-6.1-sol@eu', 1_050_000, 128_000],
340
+ ['claude-opus-5-5', 1_000_000, 128_000],
341
+ ['claude-sonnet-5-5', 1_000_000, 128_000],
342
+ ['gemini-3.8-flash', 1_048_576, 65_535],
343
+ ['deepseek-v4.1-flash', 1_048_576, 393_216],
314
344
  ['claude-opus-4-8', 1_000_000, 128_000],
315
345
  ['gpt-5.5@eu', 1_050_000, 128_000],
316
346
  ['gemini-3.5-flash', 1_048_576, 65_535],
@@ -346,6 +376,10 @@ const PRESET_DEFINITIONS = [
346
376
  baseUrl: 'https://chatgpt.com/backend-api/codex',
347
377
  auth: 'chatgpt-oauth',
348
378
  models: [
379
+ ['gpt-6.1-sol', 1_050_000, 128_000],
380
+ ['gpt-6-astra', 1_050_000, 128_000],
381
+ ['gpt-6-sol', 1_050_000, 128_000],
382
+ ['gpt-6-luna', 1_050_000, 128_000],
349
383
  ['gpt-5.6-sol', 1_050_000, 128_000],
350
384
  ['gpt-5.6-terra', 1_050_000, 128_000],
351
385
  ['gpt-5.6-luna', 1_050_000, 128_000],
@@ -383,6 +417,11 @@ const PRESET_DEFINITIONS = [
383
417
  apiKeyEnvVar: 'KILO_API_KEY',
384
418
  models: [
385
419
  // SOTA
420
+ ['openai/gpt-6.1-sol', 1_050_000, 128_000],
421
+ ['anthropic/claude-opus-5.5', 1_000_000, 128_000],
422
+ ['anthropic/claude-sonnet-5.5', 1_000_000, 128_000],
423
+ ['google/gemini-3.8-flash', 1_048_576, 65_536],
424
+ ['deepseek/deepseek-v4.1-flash', 1_048_576, 943_718],
386
425
  ['anthropic/claude-opus-5', 1_000_000, 128_000],
387
426
  ['openai/gpt-5.6-sol', 1_050_000, 128_000],
388
427
  ['moonshotai/kimi-k3', 1_048_576, 1_048_576],
@@ -2,11 +2,11 @@ import { z } from 'zod';
2
2
  import { type ReasoningLevel, type StoredReasoningSetting } from '../core/agent/reasoningPolicy.js';
3
3
  export type { ReasoningLevel, StoredReasoningSetting };
4
4
  export declare const reasoningLevelSchema: z.ZodEnum<{
5
- high: "high";
6
- medium: "medium";
7
- low: "low";
8
5
  none: "none";
9
6
  minimal: "minimal";
7
+ low: "low";
8
+ medium: "medium";
9
+ high: "high";
10
10
  xhigh: "xhigh";
11
11
  "provider-default": "provider-default";
12
12
  }>;
@@ -19,10 +19,13 @@ export interface HazeProviderSettings {
19
19
  kind?: 'openai-compatible' | 'chatgpt-codex';
20
20
  /**
21
21
  * Explicit endpoint capabilities. Never inferred: images are only sent to
22
- * providers the user marked image-capable (F03).
22
+ * providers the user marked image-capable (F03); `reasoningEffort: false`
23
+ * stops the reasoning-effort parameter from being sent at all (for
24
+ * endpoints whose own reasoning switch coerces unknown levels).
23
25
  */
24
26
  capabilities?: {
25
27
  images?: boolean;
28
+ reasoningEffort?: boolean;
26
29
  };
27
30
  /**
28
31
  * Optional per-model capacity metadata used for request budgeting (RH-005).
@@ -83,6 +86,10 @@ export interface HazeSettings {
83
86
  subagents?: HazeSubagentSettings;
84
87
  /** Optional reasoning depth; absent means the built-in default (`high`), the `provider-default` sentinel sends no parameter. */
85
88
  reasoning?: StoredReasoningSetting;
89
+ /** `compact` keeps working context small for models with limited reliable context/tool calling. Default: `standard`. */
90
+ steeringProfile?: 'standard' | 'compact';
91
+ /** Optional, explicitly configured model to try once after a stalled goal. */
92
+ escalationModel?: string;
86
93
  /**
87
94
  * Context-window fallback for models without `modelLimits` metadata, in
88
95
  * tokens. Unset means the built-in default (128K hosted / 32K local —
@@ -15,6 +15,7 @@ export const reasoningLevelSchema = z.enum(storedReasoningValues);
15
15
  export const SETTINGS_FILE = path.join(HAZE_DIR, 'settings.json');
16
16
  const providerCapabilitiesSchema = z.object({
17
17
  images: z.boolean().optional(),
18
+ reasoningEffort: z.boolean().optional(),
18
19
  }).passthrough();
19
20
  const providerSchema = z.object({
20
21
  name: z.string(),
@@ -55,6 +56,12 @@ const contextWindowFallbackSchema = z.number().int().min(1_000).max(10_000_000);
55
56
  const modelRetriesSchema = z.number().int().min(0).max(10);
56
57
  /** Retry backoff base must be a plausible delay (not fractions/junk). */
57
58
  const retryBaseDelaySchema = z.number().int().min(250).max(60_000);
59
+ /**
60
+ * An escalation model is an explicit `provider:model` selector (KISS: shape
61
+ * only — whether the provider/model actually resolves is checked by the
62
+ * provider layer when the switch is attempted).
63
+ */
64
+ const escalationModelSchema = z.string().trim().regex(/^[^\s:]+:.+$/, 'must be a provider:model selector');
58
65
  const settingsSchema = z.object({
59
66
  provider: z.string().optional(),
60
67
  model: z.string().optional(),
@@ -64,6 +71,8 @@ const settingsSchema = z.object({
64
71
  skills: z.array(skillSettingSchema).optional(),
65
72
  subagents: subagentSettingsSchema.optional(),
66
73
  reasoning: reasoningLevelSchema.optional(),
74
+ steeringProfile: z.enum(['standard', 'compact']).optional(),
75
+ escalationModel: escalationModelSchema.optional(),
67
76
  contextWindowFallbackTokens: contextWindowFallbackSchema.optional(),
68
77
  localContextWindowFallbackTokens: contextWindowFallbackSchema.optional(),
69
78
  modelRetries: modelRetriesSchema.optional(),
@@ -7,9 +7,7 @@ export declare const IDLE_TIMEOUT_MS: number;
7
7
  export declare const DEFAULT_TOOL_DEADLINE_MS: number;
8
8
  /** Subagents legitimately run long; give their wrapper a larger deadline. */
9
9
  export declare const SUBAGENT_TOOL_DEADLINE_MS: number;
10
- /** Absolute main-turn deadline: no single turn runs longer than this by default. */
11
- export declare const DEFAULT_TURN_DEADLINE_MS: number;
12
- /** Maximum accepted explicit `--timeout` value (24 hours). */
10
+ /** Maximum accepted explicit `--timeout` value (24 hours). No deadline is imposed unless the user sets one. */
13
11
  export declare const MAX_TURN_DEADLINE_MS: number;
14
12
  export declare const MAIN_STEP_LIMIT = 64;
15
13
  export declare const MAIN_TOOL_CALL_LIMIT = 120;
@@ -23,19 +21,19 @@ export declare const SUBAGENT_SCOPE_CHARS = 240;
23
21
  export declare const SUBAGENT_ACCEPTANCE_ITEMS = 8;
24
22
  export declare const SUBAGENT_ACCEPTANCE_CHARS = 300;
25
23
  export declare const SUBAGENT_MIN_STEPS = 4;
26
- export declare const SUBAGENT_DEFAULT_STEPS = 25;
27
- export declare const SUBAGENT_MAX_STEPS = 50;
28
- export declare const SUBAGENT_DEFAULT_TOOL_CALLS = 20;
29
- export declare const SUBAGENT_MAX_TOOL_CALLS = 50;
30
- export declare const SUBAGENT_TOOL_ONLY_LIMIT = 12;
24
+ export declare const SUBAGENT_DEFAULT_STEPS = 50;
25
+ export declare const SUBAGENT_MAX_STEPS = 100;
26
+ export declare const SUBAGENT_DEFAULT_TOOL_CALLS = 40;
27
+ export declare const SUBAGENT_MAX_TOOL_CALLS = 100;
28
+ export declare const SUBAGENT_TOOL_ONLY_LIMIT = 24;
31
29
  export declare const SUBAGENT_SYNTHESIS_RESERVE = 2;
32
- export declare const SUBAGENT_DEFAULT_OUTPUT_TOKENS = 4096;
33
- export declare const SUBAGENT_MAX_OUTPUT_TOKENS = 16384;
34
- export declare const SUBAGENT_DEFAULT_SUMMARY_CHARS = 4000;
35
- export declare const SUBAGENT_MAX_SUMMARY_CHARS = 12000;
36
- export declare const SUBAGENT_DEFAULT_INPUT_TOKENS = 40000;
37
- export declare const SUBAGENT_MAX_INPUT_TOKENS = 200000;
38
- export declare const SUBAGENT_DEFAULT_DEADLINE_MS = 300000;
30
+ export declare const SUBAGENT_DEFAULT_OUTPUT_TOKENS = 8192;
31
+ export declare const SUBAGENT_MAX_OUTPUT_TOKENS = 32768;
32
+ export declare const SUBAGENT_DEFAULT_SUMMARY_CHARS = 8000;
33
+ export declare const SUBAGENT_MAX_SUMMARY_CHARS = 24000;
34
+ export declare const SUBAGENT_DEFAULT_INPUT_TOKENS = 80000;
35
+ export declare const SUBAGENT_MAX_INPUT_TOKENS = 400000;
36
+ export declare const SUBAGENT_DEFAULT_DEADLINE_MS = 600000;
39
37
  export declare const SUBAGENT_MIN_DEADLINE_MS = 1000;
40
38
  export declare const SUBAGENT_MAX_DEADLINE_MS: number;
41
39
  export declare const SUBAGENT_MAX_CONCURRENCY = 10;
@@ -5,10 +5,8 @@ export const IDLE_TIMEOUT_MS = 5 * 60_000;
5
5
  /** Default per-tool execution deadline; an uncooperative tool cannot defer the turn indefinitely (RH-004). */
6
6
  export const DEFAULT_TOOL_DEADLINE_MS = 10 * 60_000;
7
7
  /** Subagents legitimately run long; give their wrapper a larger deadline. */
8
- export const SUBAGENT_TOOL_DEADLINE_MS = 20 * 60_000;
9
- /** Absolute main-turn deadline: no single turn runs longer than this by default. */
10
- export const DEFAULT_TURN_DEADLINE_MS = 30 * 60_000;
11
- /** Maximum accepted explicit `--timeout` value (24 hours). */
8
+ export const SUBAGENT_TOOL_DEADLINE_MS = 40 * 60_000;
9
+ /** Maximum accepted explicit `--timeout` value (24 hours). No deadline is imposed unless the user sets one. */
12
10
  export const MAX_TURN_DEADLINE_MS = 24 * 60 * 60_000;
13
11
  export const MAIN_STEP_LIMIT = 64;
14
12
  export const MAIN_TOOL_CALL_LIMIT = 120;
@@ -30,21 +28,21 @@ export const SUBAGENT_SCOPE_CHARS = 240;
30
28
  export const SUBAGENT_ACCEPTANCE_ITEMS = 8;
31
29
  export const SUBAGENT_ACCEPTANCE_CHARS = 300;
32
30
  export const SUBAGENT_MIN_STEPS = 4;
33
- export const SUBAGENT_DEFAULT_STEPS = 25;
34
- export const SUBAGENT_MAX_STEPS = 50;
35
- export const SUBAGENT_DEFAULT_TOOL_CALLS = 20;
36
- export const SUBAGENT_MAX_TOOL_CALLS = 50;
37
- export const SUBAGENT_TOOL_ONLY_LIMIT = 12;
31
+ export const SUBAGENT_DEFAULT_STEPS = 50;
32
+ export const SUBAGENT_MAX_STEPS = 100;
33
+ export const SUBAGENT_DEFAULT_TOOL_CALLS = 40;
34
+ export const SUBAGENT_MAX_TOOL_CALLS = 100;
35
+ export const SUBAGENT_TOOL_ONLY_LIMIT = 24;
38
36
  export const SUBAGENT_SYNTHESIS_RESERVE = 2;
39
- export const SUBAGENT_DEFAULT_OUTPUT_TOKENS = 4_096;
40
- export const SUBAGENT_MAX_OUTPUT_TOKENS = 16_384;
41
- export const SUBAGENT_DEFAULT_SUMMARY_CHARS = 4_000;
42
- export const SUBAGENT_MAX_SUMMARY_CHARS = 12_000;
43
- export const SUBAGENT_DEFAULT_INPUT_TOKENS = 40_000;
44
- export const SUBAGENT_MAX_INPUT_TOKENS = 200_000;
45
- export const SUBAGENT_DEFAULT_DEADLINE_MS = 300_000;
37
+ export const SUBAGENT_DEFAULT_OUTPUT_TOKENS = 8_192;
38
+ export const SUBAGENT_MAX_OUTPUT_TOKENS = 32_768;
39
+ export const SUBAGENT_DEFAULT_SUMMARY_CHARS = 8_000;
40
+ export const SUBAGENT_MAX_SUMMARY_CHARS = 24_000;
41
+ export const SUBAGENT_DEFAULT_INPUT_TOKENS = 80_000;
42
+ export const SUBAGENT_MAX_INPUT_TOKENS = 400_000;
43
+ export const SUBAGENT_DEFAULT_DEADLINE_MS = 600_000;
46
44
  export const SUBAGENT_MIN_DEADLINE_MS = 1_000;
47
- export const SUBAGENT_MAX_DEADLINE_MS = 30 * 60_000;
45
+ export const SUBAGENT_MAX_DEADLINE_MS = 60 * 60_000;
48
46
  export const SUBAGENT_MAX_CONCURRENCY = 10;
49
47
  export const SUBAGENT_MAX_RETRIES = 5;
50
48
  /** Default size of the shared bounded model-retry pool for transient model errors and idle-stream stalls, per turn. Configurable via the `modelRetries` setting (0 disables automatic retries). */
@@ -35,6 +35,7 @@ export interface TurnExecutionState {
35
35
  intent: RequestIntent;
36
36
  /** Latest current-turn task-list evidence from a successful writeTasks call. */
37
37
  taskProgress: WorkTaskProgress | undefined;
38
+ requiresTaskLedger: boolean;
38
39
  /** Goal-continuation cycles issued this turn (bounded by the global budget + progress guard). */
39
40
  goalContinuationsUsed: number;
40
41
  /** Whether the single focused post-edit validation-repair slice was admitted. */
@@ -83,6 +84,8 @@ export interface CompletionEvidence {
83
84
  sawToolCall: boolean;
84
85
  assistantText: string;
85
86
  lastToolOk: boolean | undefined;
87
+ /** True when the last failed tool call was the classifier-confirmed validation check itself. */
88
+ lastFailedToolWasValidation: boolean;
86
89
  unresolvedToolInputError: boolean;
87
90
  }
88
91
  export type TurnStatus = 'complete' | 'aborted' | 'failed';
@@ -93,7 +96,7 @@ export type TurnStatus = 'complete' | 'aborted' | 'failed';
93
96
  * mutation, validation, red→green, tool, and budget evidence is
94
97
  * authoritative).
95
98
  */
96
- export type CompletionReadiness = 'ready' | 'pending_tasks' | 'validation_failed' | 'validation_stale' | 'validation_absent_after_mutation' | 'red_check_not_green' | 'tool_failure' | 'unresolved_tool_input' | 'aborted'
99
+ export type CompletionReadiness = 'ready' | 'pending_tasks' | 'task_ledger_absent' | 'validation_failed' | 'validation_stale' | 'validation_absent_after_mutation' | 'red_check_not_green' | 'tool_failure' | 'unresolved_tool_input' | 'aborted'
97
100
  /** Produced only by the context-overflow exhaustion path (Pillar 1.4): the window stayed full after bounded compact-and-retry attempts. */
98
101
  | 'context_exhausted';
99
102
  /** Inputs `assessCompletionReadiness` needs; matches the TurnExecutionState projection. */
@@ -103,6 +106,7 @@ export interface CompletionReadinessInput {
103
106
  mutationCount: number;
104
107
  validationOutcome: ValidationOutcome;
105
108
  taskProgress: WorkTaskProgress | undefined;
109
+ requiresTaskLedger?: boolean;
106
110
  /** Red→green pair state; absent/not-required disables the gate. */
107
111
  redPair?: 'not-required' | 'missing' | 'satisfied';
108
112
  }
@@ -114,7 +118,7 @@ export interface CompletionReadinessInput {
114
118
  * the fix-intent red→green pair. A task list is enforced only when this turn
115
119
  * declared one via a successful writeTasks call.
116
120
  */
117
- export declare function assessCompletionReadiness(state: CompletionReadinessInput, evidence: Pick<CompletionEvidence, 'lastToolOk' | 'unresolvedToolInputError'>): CompletionReadiness;
121
+ export declare function assessCompletionReadiness(state: CompletionReadinessInput, evidence: Pick<CompletionEvidence, 'lastToolOk' | 'lastFailedToolWasValidation' | 'unresolvedToolInputError'>): CompletionReadiness;
118
122
  /** Human-readable, safe (no commands/content) description of a readiness result. */
119
123
  export declare function describeCompletionReadiness(readiness: CompletionReadiness, taskProgress?: WorkTaskProgress): string;
120
124
  /**
@@ -25,6 +25,7 @@ export function createTurnExecutionState() {
25
25
  validationAfterMutation: false,
26
26
  intent: 'unknown',
27
27
  taskProgress: undefined,
28
+ requiresTaskLedger: false,
28
29
  goalContinuationsUsed: 0,
29
30
  validationContinuationUsed: false,
30
31
  goalContinuationProgress: undefined,
@@ -61,11 +62,21 @@ export function assessCompletionReadiness(state, evidence) {
61
62
  return 'aborted';
62
63
  if (evidence.unresolvedToolInputError)
63
64
  return 'unresolved_tool_input';
64
- if (evidence.lastToolOk === false)
65
+ // A validation-only goal is fulfilled by running the check and reporting its
66
+ // failure, not by repairing code. Keep the failed status, but do not turn a
67
+ // truthful report into an automatic repair slice (even after another read).
68
+ if (state.intent === 'test' && state.mutationCount === 0 && state.validationOutcome === 'failed')
65
69
  return 'tool_failure';
70
+ // A failing validation command is repairable work, not a terminal tool
71
+ // failure — but only when the failed call *is* that validation check. A
72
+ // failed edit/write after a failed validation stays a hard tool failure.
73
+ if (evidence.lastToolOk === false && !(state.validationOutcome === 'failed' && evidence.lastFailedToolWasValidation))
74
+ return 'tool_failure';
75
+ if (state.requiresTaskLedger && (!state.taskProgress || state.taskProgress.total === 0))
76
+ return 'task_ledger_absent';
66
77
  if (state.taskProgress && (state.taskProgress.pending > 0 || state.taskProgress.inProgress > 0))
67
78
  return 'pending_tasks';
68
- if (intentExpectsValidation(state.intent)) {
79
+ if (intentExpectsValidation(state.intent) || (state.intent === 'unknown' && state.mutationCount > 0)) {
69
80
  if (state.validationOutcome === 'failed')
70
81
  return 'validation_failed';
71
82
  if (state.validationOutcome === 'stale')
@@ -84,6 +95,7 @@ export function describeCompletionReadiness(readiness, taskProgress) {
84
95
  const open = taskProgress ? taskProgress.pending + taskProgress.inProgress : 0;
85
96
  return `${open} declared task${open === 1 ? '' : 's'} still pending or in progress`;
86
97
  }
98
+ case 'task_ledger_absent': return 'this broad request has no declared outcome list';
87
99
  case 'validation_failed': return 'the latest validation failed and remains unresolved';
88
100
  case 'validation_stale': return 'edits landed after the latest validation';
89
101
  case 'validation_absent_after_mutation': return 'edits landed without any relevant validation';
@@ -238,6 +250,7 @@ const VALIDATION_CONTINUATION_SLICE = { steps: 3, toolCalls: 3 };
238
250
  /** Readiness reasons a bounded continuation can plausibly resolve with more work. */
239
251
  export function goalContinuationRecoverable(readiness) {
240
252
  return readiness === 'pending_tasks'
253
+ || readiness === 'task_ledger_absent'
241
254
  || readiness === 'validation_failed'
242
255
  || readiness === 'validation_stale'
243
256
  || readiness === 'validation_absent_after_mutation'
@@ -302,7 +315,7 @@ export function decideGoalContinuation(state, evidence, budget) {
302
315
  return stop('finish shape is not recoverable');
303
316
  if (evidence.assistantText.trim().length === 0)
304
317
  return stop('no substantive final to reject');
305
- if (evidence.lastToolOk === false || evidence.unresolvedToolInputError)
318
+ if ((evidence.lastToolOk === false && !(state.validationOutcome === 'failed' && evidence.lastFailedToolWasValidation)) || evidence.unresolvedToolInputError)
306
319
  return stop('unresolved tool failure');
307
320
  const readiness = assessCompletionReadiness(state, evidence);
308
321
  if (readiness === 'ready')
@@ -11,11 +11,21 @@ import { observeWorkToolEvent, type WorkState } from './workState.js';
11
11
  export type RequestIntent = 'implement' | 'fix' | 'test' | 'review' | 'plan' | 'answer' | 'unknown';
12
12
  export declare function isPlanOnlyRequest(value: string): boolean;
13
13
  export declare function classifyRequestIntent(value: string): RequestIntent;
14
+ /**
15
+ * Only broad implementation requests need a declared outcome ledger. Breadth
16
+ * needs two or more enumerated outcomes (bullet/numbered lines) — a single
17
+ * detailed item, however long, stays a quick focused edit.
18
+ */
19
+ export declare function requiresTaskLedger(request: string, intent: RequestIntent): boolean;
14
20
  export type SessionGoal = WorkState;
15
21
  export type GoalToolEvent = Parameters<typeof observeWorkToolEvent>[1];
16
22
  export declare function createSessionGoal(request: string, now?: number): SessionGoal;
17
23
  export declare function observeGoalToolEvent(goal: SessionGoal, event: GoalToolEvent, now?: number): WorkState;
18
24
  export declare function formatGoalStatus(goal: SessionGoal): string;
25
+ /** One-request direction for the active goal. The user request remains the source of truth. */
26
+ export declare function goalDirectionPrompt(intent: RequestIntent, compact: boolean): string;
27
+ /** A single mid-implementation nudge; the caller prevents repeats. */
28
+ export declare function earlyValidationPrompt(): string;
19
29
  export declare function toolLoopBudgetPrompt(): string;
20
30
  export declare function repeatedToolCallPrompt(toolNames: string[]): string;
21
31
  /**
@@ -14,18 +14,36 @@ export function isPlanOnlyRequest(value) {
14
14
  export function classifyRequestIntent(value) {
15
15
  if (isPlanOnlyRequest(value))
16
16
  return 'plan';
17
- if (/\b(review|audit|inspect|analy[sz]e|compare)\b/i.test(value))
17
+ // A leading review request remains read-only unless it explicitly asks for
18
+ // follow-on changes. Incidental terms such as "how to build" are context.
19
+ if (/^\s*(?:please\s+)?(?:review|audit|inspect|analy[sz]e|compare)\b/i.test(value)
20
+ && !/\b(?:,|;|and|then)\s*(?:please\s+)?(?:fix|repair|implement|build|add|create|update|change)\b/i.test(value))
18
21
  return 'review';
19
22
  if (/\b(fix|repair|resolve|debug)\b/i.test(value))
20
23
  return 'fix';
21
- if (/\b(run|verify|check|validate)\b/i.test(value) || /\btests?\b/i.test(value) && !/\b(add|create|write)\b/i.test(value))
22
- return 'test';
23
- if (/\b(add|create|write|implement|update|change|support|wire|document|docs|documentation)\b/i.test(value))
24
+ // Creation verbs win over incidental words such as "run locally" or
25
+ // "test the app" in a larger implementation request.
26
+ if (/\b(add|create|write|implement|build|make|update|change|support|wire|document|docs|documentation|commit)\b/i.test(value))
24
27
  return 'implement';
28
+ if (/\b(review|audit|inspect|analy[sz]e|compare)\b/i.test(value))
29
+ return 'review';
30
+ if (/\b(run|verify|check|validate)\b/i.test(value) || /\btests?\b/i.test(value))
31
+ return 'test';
25
32
  if (/\b(what|why|how|explain|tell me)\b/i.test(value))
26
33
  return 'answer';
27
34
  return 'unknown';
28
35
  }
36
+ /**
37
+ * Only broad implementation requests need a declared outcome ledger. Breadth
38
+ * needs two or more enumerated outcomes (bullet/numbered lines) — a single
39
+ * detailed item, however long, stays a quick focused edit.
40
+ */
41
+ export function requiresTaskLedger(request, intent) {
42
+ if (intent !== 'implement' && intent !== 'fix')
43
+ return false;
44
+ const items = request.match(/(?:^|\n)\s*(?:[-*]|\d+[.)])\s+\S/g) ?? [];
45
+ return items.length >= 2;
46
+ }
29
47
  function shortRequest(value) {
30
48
  return value.replace(/\s+/g, ' ').trim().slice(0, 160) || 'current request';
31
49
  }
@@ -40,7 +58,9 @@ export function createSessionGoal(request, now = Date.now()) {
40
58
  : intent === 'answer'
41
59
  ? ['Answer the user using current project context when needed']
42
60
  : ['Inspect the relevant files', 'Make the requested change when needed', 'Validate the change when practical', 'Summarize only current-task changes and validation'];
43
- return createWorkState(request, intent, successCriteria, now);
61
+ const state = createWorkState(request, intent, successCriteria, now);
62
+ state.requiresTaskLedger = requiresTaskLedger(request, intent);
63
+ return state;
44
64
  }
45
65
  export function observeGoalToolEvent(goal, event, now = Date.now()) {
46
66
  return observeWorkToolEvent(goal, event, now);
@@ -54,6 +74,21 @@ export function formatGoalStatus(goal) {
54
74
  : 'done';
55
75
  return `Goal: ${shortRequest(goal.originalUserRequest)} · ${action}`;
56
76
  }
77
+ /** One-request direction for the active goal. The user request remains the source of truth. */
78
+ export function goalDirectionPrompt(intent, compact) {
79
+ if (intent === 'plan' || intent === 'review' || intent === 'answer')
80
+ return '';
81
+ return [
82
+ 'For this goal, turn the user\'s explicit requirements into observable outcomes. For substantial work, use writeTasks as the outcome ledger and keep it current.',
83
+ 'Implement one runnable slice, check it, then extend it. Run a relevant check before generating a large batch of dependent files. Keep failed checks open until the same check passes after the fix.',
84
+ 'For UI work, exercise a real interaction when a browser runner is available; otherwise name that coverage gap. Do not describe shadcn-style components as an installed shadcn system unless the project actually has one.',
85
+ compact ? 'Compact profile: handle a few files per slice, make one dependent tool decision at a time, prefer concise tool output and targeted reads, and keep the next action explicit.' : '',
86
+ ].filter(Boolean).join(' ');
87
+ }
88
+ /** A single mid-implementation nudge; the caller prevents repeats. */
89
+ export function earlyValidationPrompt() {
90
+ return 'Several files changed without a check. Run the smallest relevant build, test, typecheck, or direct artifact check now; use its result to guide the next slice.';
91
+ }
57
92
  // ── Completion/continuation control prompts ─────────────────────────────────
58
93
  // Keep these small and reusable; prefer one shared helper over embedding
59
94
  // near-identical model-facing control text in multiple loops. They are
@@ -112,9 +147,12 @@ export function goalContinuationPrompt(reason, taskCounts, detail) {
112
147
  const validationLine = reason.includes('validation')
113
148
  ? ' No recognized post-edit validation was recorded. Run one standard test/build command, directly execute the changed artifact as one unchained command, or call shell with purpose=validation for a custom assertion check.'
114
149
  : '';
150
+ const ledgerLine = reason.includes('outcome list')
151
+ ? ' First call writeTasks with the concrete user-visible outcomes and their checks; keep the list until each outcome is complete.'
152
+ : '';
115
153
  const redLine = reason.includes('failing check')
116
154
  ? ' Rerun the same validation command that failed before the edit and resolve it; a different check does not close the captured red evidence.'
117
155
  : '';
118
156
  const detailLine = detail ? ` ${detail}` : '';
119
- return `Continue the active goal: haze rejected stopping because structured evidence shows this turn is not complete (${reason}).${validationLine}${redLine}${detailLine} Do not summarize again or restate what remains — resume the next concrete unfinished task now.${taskLine} If you declared a task list with writeTasks, its pending and in-progress items are commitments: complete them and update writeTasks at each meaningful phase change and at completion. After any further edits, run the smallest relevant validation and report its real outcome. Report a blocker only when it is a concrete external tool, permission, dependency, or environment failure; unfinished work is not a blocker.`;
157
+ return `Continue the active goal: haze rejected stopping because structured evidence shows this turn is not complete (${reason}).${validationLine}${ledgerLine}${redLine}${detailLine} Do not summarize again or restate what remains — resume the next concrete unfinished task now.${taskLine} If you declared a task list with writeTasks, its pending and in-progress items are commitments: complete them and update writeTasks at each meaningful phase change and at completion. After any further edits, run the smallest relevant validation and report its real outcome. Report a blocker only when it is a concrete external tool, permission, dependency, or environment failure; unfinished work is not a blocker.`;
120
158
  }
@@ -0,0 +1,2 @@
1
+ /** Read-only, bounded hints for a compact-profile model; never runs a command. */
2
+ export declare function projectPreflight(cwd: string): Promise<string>;