@denizokcu/haze 0.11.0 → 1.1.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 (278) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +28 -14
  3. package/SECURITY.md +5 -3
  4. package/dist/buildInfo.json +3 -3
  5. package/dist/cli/chat/TaskBar.js +1 -1
  6. package/dist/cli/chat/chatMetrics.d.ts +2 -2
  7. package/dist/cli/chat/chatMetrics.js +1 -1
  8. package/dist/cli/chat/fileMentionSuggestions.js +1 -1
  9. package/dist/cli/chat/inputSuggestions.d.ts +8 -16
  10. package/dist/cli/chat/inputSuggestions.js +10 -41
  11. package/dist/cli/chat/messages.d.ts +0 -2
  12. package/dist/cli/chat/messages.js +5 -5
  13. package/dist/cli/chat/sessionLifecycle.d.ts +2 -1
  14. package/dist/cli/chat/turnState.d.ts +1 -1
  15. package/dist/cli/chat/wizardDispatch.d.ts +90 -28
  16. package/dist/cli/chat/wizardDispatch.js +257 -130
  17. package/dist/cli/commands/chat.js +61 -77
  18. package/dist/cli/commands/chatModes.d.ts +8 -1
  19. package/dist/cli/commands/chatModes.js +9 -44
  20. package/dist/cli/commands/commandHelp.js +2 -0
  21. package/dist/cli/commands/commands.js +2 -0
  22. package/dist/cli/commands/doctor.js +1 -1
  23. package/dist/cli/commands/formatters.d.ts +3 -3
  24. package/dist/cli/commands/formatters.js +12 -25
  25. package/dist/cli/commands/providerWizard.js +2 -3
  26. package/dist/cli/commands/runCommand.js +1 -1
  27. package/dist/cli/commands/serverWizard.d.ts +34 -0
  28. package/dist/cli/commands/{mcpWizard.js → serverWizard.js} +44 -2
  29. package/dist/cli/commands/settingsSummary.js +2 -0
  30. package/dist/cli/commands/skillsWizard.d.ts +41 -0
  31. package/dist/cli/commands/{skillWizard.js → skillsWizard.js} +33 -11
  32. package/dist/cli/commands/streaming/abortCause.d.ts +2 -1
  33. package/dist/cli/commands/streaming/agentAttempt.d.ts +43 -0
  34. package/dist/cli/commands/streaming/agentAttempt.js +79 -0
  35. package/dist/cli/commands/streaming/attemptLifecycle.d.ts +56 -0
  36. package/dist/cli/commands/streaming/attemptLifecycle.js +110 -0
  37. package/dist/cli/commands/streaming/attemptOutcome.d.ts +96 -0
  38. package/dist/cli/commands/streaming/attemptOutcome.js +206 -0
  39. package/dist/cli/commands/streaming/attemptSetup.d.ts +78 -0
  40. package/dist/cli/commands/streaming/attemptSetup.js +167 -0
  41. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +1 -1
  42. package/dist/cli/commands/streaming/goalCheckpoint.js +2 -2
  43. package/dist/cli/commands/streaming/goalSupervisor.js +9 -6
  44. package/dist/cli/commands/streaming/stallRecovery.d.ts +94 -0
  45. package/dist/cli/commands/streaming/stallRecovery.js +105 -0
  46. package/dist/cli/commands/streaming/streamLoop.d.ts +72 -0
  47. package/dist/cli/commands/streaming/streamLoop.js +448 -0
  48. package/dist/cli/commands/streaming/toolCallRecovery.d.ts +14 -0
  49. package/dist/cli/commands/streaming/toolCallRecovery.js +56 -0
  50. package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +2 -1
  51. package/dist/cli/commands/streaming/turnRuntime.d.ts +4 -0
  52. package/dist/cli/commands/streaming/turnRuntime.js +6 -0
  53. package/dist/cli/commands/streaming.d.ts +14 -25
  54. package/dist/cli/commands/streaming.js +43 -754
  55. package/dist/cli/commands/themesCommand.d.ts +17 -0
  56. package/dist/cli/commands/themesCommand.js +24 -0
  57. package/dist/cli/commands/wizardFlow.d.ts +341 -0
  58. package/dist/cli/commands/wizardFlow.js +397 -0
  59. package/dist/cli/contextReport.js +3 -0
  60. package/dist/cli/index.js +1 -1
  61. package/dist/config/contextFiles.js +9 -3
  62. package/dist/config/inputHistory.d.ts +0 -1
  63. package/dist/config/inputHistory.js +1 -1
  64. package/dist/config/modelDiscovery.d.ts +0 -15
  65. package/dist/config/modelDiscovery.js +1 -1
  66. package/dist/config/settings.d.ts +9 -0
  67. package/dist/config/settings.js +4 -0
  68. package/dist/config/skillSettings.js +4 -4
  69. package/dist/config/updateCheck.d.ts +0 -1
  70. package/dist/config/updateCheck.js +1 -1
  71. package/dist/core/agent/budgets.d.ts +63 -1
  72. package/dist/core/agent/budgets.js +84 -1
  73. package/dist/core/agent/compaction.js +1 -1
  74. package/dist/core/agent/completionController.d.ts +7 -13
  75. package/dist/core/agent/completionController.js +17 -8
  76. package/dist/core/agent/contextBudget.d.ts +0 -4
  77. package/dist/core/agent/contextBudget.js +3 -3
  78. package/dist/core/agent/errors.d.ts +0 -1
  79. package/dist/core/agent/errors.js +1 -1
  80. package/dist/core/agent/events.d.ts +5 -1
  81. package/dist/core/{goal/completionPolicy.d.ts → agent/goalPolicy.d.ts} +18 -0
  82. package/dist/core/agent/goalPolicy.js +106 -0
  83. package/dist/core/agent/requestAssembly.d.ts +2 -2
  84. package/dist/core/agent/requestAssembly.js +16 -4
  85. package/dist/core/agent/toolCapabilities.d.ts +2 -2
  86. package/dist/core/agent/toolCapabilities.js +5 -5
  87. package/dist/core/agent/toolOutputStore.js +1 -1
  88. package/dist/core/agent/toolResults.js +1 -1
  89. package/dist/core/agent/workState.d.ts +6 -3
  90. package/dist/core/agent/workState.js +62 -7
  91. package/dist/core/attachments/imageAttachments.js +90 -42
  92. package/dist/core/deadline.d.ts +0 -6
  93. package/dist/core/deadline.js +1 -1
  94. package/dist/core/io/boundedRead.js +1 -1
  95. package/dist/core/limits.d.ts +51 -0
  96. package/dist/core/limits.js +51 -0
  97. package/dist/core/log/llmLog.js +1 -1
  98. package/dist/core/process/backgroundRegistry.d.ts +2 -3
  99. package/dist/core/process/backgroundRegistry.js +10 -6
  100. package/dist/core/process/userShell.d.ts +16 -0
  101. package/dist/core/process/userShell.js +59 -0
  102. package/dist/core/safety/secretPaths.d.ts +18 -0
  103. package/dist/core/safety/secretPaths.js +115 -0
  104. package/dist/core/safety/shellClassifier.d.ts +11 -0
  105. package/dist/core/safety/{bashClassifier.js → shellClassifier.js} +5 -3
  106. package/dist/core/safety/urlGuard.d.ts +1 -1
  107. package/dist/core/session/sessionSlimming.d.ts +0 -3
  108. package/dist/core/session/sessionSlimming.js +2 -3
  109. package/dist/core/session/sessionStore.d.ts +1 -0
  110. package/dist/core/session/sessionStore.js +39 -20
  111. package/dist/core/{bashOutput → shellOutput}/lineFilter.js +8 -2
  112. package/dist/core/{bashOutput → shellOutput}/reducers/search.d.ts +0 -1
  113. package/dist/core/{bashOutput → shellOutput}/reducers/search.js +1 -1
  114. package/dist/core/shellOutput/registry.d.ts +2 -0
  115. package/dist/core/{bashOutput → shellOutput}/registry.js +3 -3
  116. package/dist/core/{bashOutput → shellOutput}/types.d.ts +6 -5
  117. package/dist/core/subagent/contracts.d.ts +2 -14
  118. package/dist/core/subagent/contracts.js +3 -3
  119. package/dist/core/subagent/executionProfiles.js +2 -2
  120. package/dist/core/subagent/subagentRunner.js +3 -4
  121. package/dist/core/toolOutput/reduction.d.ts +0 -12
  122. package/dist/core/toolOutput/reduction.js +1 -1
  123. package/dist/core/validation/outputParser.d.ts +2 -2
  124. package/dist/llm/client.js +5 -1
  125. package/dist/llm/hazeTools.d.ts +139 -124
  126. package/dist/llm/hazeTools.js +20 -11
  127. package/dist/llm/initPrompt.js +1 -1
  128. package/dist/llm/lsp/client.d.ts +45 -0
  129. package/dist/llm/lsp/client.js +195 -0
  130. package/dist/llm/lsp/pool.d.ts +23 -0
  131. package/dist/llm/lsp/pool.js +86 -0
  132. package/dist/llm/lsp/protocol.d.ts +64 -0
  133. package/dist/llm/lsp/protocol.js +128 -0
  134. package/dist/llm/lsp/requests.d.ts +94 -0
  135. package/dist/llm/lsp/requests.js +119 -0
  136. package/dist/llm/lspTools.d.ts +3824 -570
  137. package/dist/llm/lspTools.js +65 -1
  138. package/dist/llm/openaiCodex.d.ts +0 -2
  139. package/dist/llm/openaiCodex.js +0 -4
  140. package/dist/llm/openaiCodexOAuth.d.ts +0 -3
  141. package/dist/llm/openaiCodexOAuth.js +6 -3
  142. package/dist/llm/requestContext.d.ts +5 -1
  143. package/dist/llm/requestContext.js +25 -2
  144. package/dist/llm/systemPrompt.d.ts +1 -0
  145. package/dist/llm/systemPrompt.js +16 -7
  146. package/dist/llm/toolResultTypes.d.ts +1 -15
  147. package/dist/llm/toolResultTypes.js +1 -4
  148. package/dist/llm/tools/editMatch.d.ts +0 -9
  149. package/dist/llm/tools/editMatch.js +1 -1
  150. package/dist/llm/tools/failures.d.ts +6 -0
  151. package/dist/llm/tools/failures.js +8 -2
  152. package/dist/llm/tools/fetchTool.js +1 -1
  153. package/dist/llm/tools/fileToolShared.d.ts +4 -2
  154. package/dist/llm/tools/fileToolShared.js +9 -5
  155. package/dist/llm/tools/gitIgnore.d.ts +25 -32
  156. package/dist/llm/tools/gitIgnore.js +216 -98
  157. package/dist/llm/tools/grepParse.d.ts +2 -1
  158. package/dist/llm/tools/grepRunner.d.ts +1 -1
  159. package/dist/llm/tools/grepRunner.js +2 -2
  160. package/dist/llm/tools/outputCap.d.ts +2 -7
  161. package/dist/llm/tools/outputCap.js +3 -3
  162. package/dist/llm/tools/processTool.d.ts +16 -16
  163. package/dist/llm/tools/processTool.js +1 -1
  164. package/dist/llm/tools/readRecovery.d.ts +0 -2
  165. package/dist/llm/tools/readRecovery.js +4 -2
  166. package/dist/llm/tools/{bashTool.d.ts → shellTool.d.ts} +123 -107
  167. package/dist/llm/tools/{bashTool.js → shellTool.js} +18 -14
  168. package/dist/llm/tools/toolContext.js +5 -5
  169. package/dist/llm/tools/workspaceFile.d.ts +4 -4
  170. package/dist/llm/tools/workspaceFile.js +29 -17
  171. package/dist/llm/webFetch.d.ts +1 -1
  172. package/dist/skills/SkillLoader.d.ts +1 -11
  173. package/dist/skills/SkillLoader.js +1 -2
  174. package/dist/skills/types.d.ts +2 -1
  175. package/dist/ui/components/Header.js +1 -1
  176. package/dist/ui/components/MarkdownText.js +10 -10
  177. package/dist/ui/components/TextInput.d.ts +1 -1
  178. package/dist/ui/components/TextInput.js +2 -2
  179. package/dist/ui/terminalColors.d.ts +29 -0
  180. package/dist/ui/terminalColors.js +47 -0
  181. package/dist/ui/theme.d.ts +105 -10
  182. package/dist/ui/theme.js +126 -15
  183. package/dist/ui/themes/af-magic.d.ts +7 -0
  184. package/dist/ui/themes/af-magic.js +25 -0
  185. package/dist/ui/themes/agnoster.d.ts +10 -0
  186. package/dist/ui/themes/agnoster.js +40 -0
  187. package/dist/ui/themes/bira.d.ts +10 -0
  188. package/dist/ui/themes/bira.js +28 -0
  189. package/dist/ui/themes/bureau.d.ts +10 -0
  190. package/dist/ui/themes/bureau.js +28 -0
  191. package/dist/ui/themes/clean.d.ts +9 -0
  192. package/dist/ui/themes/clean.js +27 -0
  193. package/dist/ui/themes/cloud.d.ts +6 -0
  194. package/dist/ui/themes/cloud.js +24 -0
  195. package/dist/ui/themes/dst.d.ts +10 -0
  196. package/dist/ui/themes/dst.js +28 -0
  197. package/dist/ui/themes/fishy.d.ts +7 -0
  198. package/dist/ui/themes/fishy.js +25 -0
  199. package/dist/ui/themes/index.d.ts +8 -0
  200. package/dist/ui/themes/index.js +36 -0
  201. package/dist/ui/themes/light.d.ts +3 -0
  202. package/dist/ui/themes/light.js +21 -0
  203. package/dist/ui/themes/purple.d.ts +7 -0
  204. package/dist/ui/themes/purple.js +26 -0
  205. package/dist/ui/themes/robbyrussell.d.ts +8 -0
  206. package/dist/ui/themes/robbyrussell.js +26 -0
  207. package/dist/ui/themes/solarized-dark.d.ts +16 -0
  208. package/dist/ui/themes/solarized-dark.js +44 -0
  209. package/dist/ui/themes/solarized-light.d.ts +12 -0
  210. package/dist/ui/themes/solarized-light.js +40 -0
  211. package/dist/ui/themes/steeef.d.ts +11 -0
  212. package/dist/ui/themes/steeef.js +29 -0
  213. package/dist/utils/buildInfo.d.ts +6 -13
  214. package/dist/utils/buildInfo.js +6 -15
  215. package/dist/utils/fs.d.ts +7 -5
  216. package/dist/utils/fs.js +5 -2
  217. package/dist/utils/path.d.ts +0 -1
  218. package/dist/utils/path.js +1 -1
  219. package/package.json +6 -4
  220. package/dist/cli/commands/lspWizard.d.ts +0 -14
  221. package/dist/cli/commands/lspWizard.js +0 -44
  222. package/dist/cli/commands/mcpWizard.d.ts +0 -15
  223. package/dist/cli/commands/skillConfirmRemove.d.ts +0 -11
  224. package/dist/cli/commands/skillConfirmRemove.js +0 -20
  225. package/dist/cli/commands/skillCreation.d.ts +0 -12
  226. package/dist/cli/commands/skillCreation.js +0 -14
  227. package/dist/cli/commands/skillWizard.d.ts +0 -17
  228. package/dist/cli/commands/streaming/idleTimer.d.ts +0 -26
  229. package/dist/cli/commands/streaming/idleTimer.js +0 -24
  230. package/dist/cli/commands/streaming/turnOutcome.d.ts +0 -27
  231. package/dist/cli/commands/streaming/turnOutcome.js +0 -29
  232. package/dist/cli/commands/wizardActions.d.ts +0 -47
  233. package/dist/cli/commands/wizardActions.js +0 -47
  234. package/dist/cli/commands/wizardInput.d.ts +0 -4
  235. package/dist/cli/commands/wizardInput.js +0 -19
  236. package/dist/cli/commands/wizardPrompts.d.ts +0 -22
  237. package/dist/cli/commands/wizardPrompts.js +0 -58
  238. package/dist/cli/commands/wizardSuggestions.d.ts +0 -31
  239. package/dist/cli/commands/wizardSuggestions.js +0 -190
  240. package/dist/cli/commands/wizardTransition.d.ts +0 -37
  241. package/dist/cli/commands/wizardTransition.js +0 -43
  242. package/dist/core/agent/toolExecutionBudget.d.ts +0 -35
  243. package/dist/core/agent/toolExecutionBudget.js +0 -49
  244. package/dist/core/agent/turnBudget.d.ts +0 -35
  245. package/dist/core/agent/turnBudget.js +0 -27
  246. package/dist/core/bashOutput/ansi.d.ts +0 -1
  247. package/dist/core/bashOutput/ansi.js +0 -7
  248. package/dist/core/bashOutput/registry.d.ts +0 -4
  249. package/dist/core/goal/completionPolicy.js +0 -43
  250. package/dist/core/goal/requestClassifier.d.ts +0 -3
  251. package/dist/core/goal/requestClassifier.js +0 -18
  252. package/dist/core/goal/sessionGoal.d.ts +0 -8
  253. package/dist/core/goal/sessionGoal.js +0 -30
  254. package/dist/core/limits/byteBudgets.d.ts +0 -20
  255. package/dist/core/limits/byteBudgets.js +0 -20
  256. package/dist/core/limits/textBudgets.d.ts +0 -25
  257. package/dist/core/limits/textBudgets.js +0 -25
  258. package/dist/core/safety/bashClassifier.d.ts +0 -10
  259. package/dist/llm/lsp.d.ts +0 -149
  260. package/dist/llm/lsp.js +0 -368
  261. package/dist/ui/components/ErrorView.d.ts +0 -4
  262. package/dist/ui/components/ErrorView.js +0 -7
  263. package/dist/utils/yaml.d.ts +0 -2
  264. package/dist/utils/yaml.js +0 -8
  265. package/examples/skills/files/SKILL.md +0 -16
  266. package/examples/skills/files/examples/file-editing.md +0 -3
  267. /package/dist/core/{bashOutput → shellOutput}/command.d.ts +0 -0
  268. /package/dist/core/{bashOutput → shellOutput}/command.js +0 -0
  269. /package/dist/core/{bashOutput → shellOutput}/lineFilter.d.ts +0 -0
  270. /package/dist/core/{bashOutput → shellOutput}/reducers/content.d.ts +0 -0
  271. /package/dist/core/{bashOutput → shellOutput}/reducers/content.js +0 -0
  272. /package/dist/core/{bashOutput → shellOutput}/reducers/gh.d.ts +0 -0
  273. /package/dist/core/{bashOutput → shellOutput}/reducers/gh.js +0 -0
  274. /package/dist/core/{bashOutput → shellOutput}/reducers/git.d.ts +0 -0
  275. /package/dist/core/{bashOutput → shellOutput}/reducers/git.js +0 -0
  276. /package/dist/core/{bashOutput → shellOutput}/reducers/validation.d.ts +0 -0
  277. /package/dist/core/{bashOutput → shellOutput}/reducers/validation.js +0 -0
  278. /package/dist/core/{bashOutput → shellOutput}/types.js +0 -0
@@ -1 +0,0 @@
1
- export declare function stripAnsi(text: string): string;
@@ -1,7 +0,0 @@
1
- /* eslint-disable no-control-regex */
2
- export function stripAnsi(text) {
3
- // Covers common CSI/OSC escape sequences emitted by CLIs.
4
- return text
5
- .replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g, '')
6
- .replace(/[\u001B\u009B][[\]()#;?]*(?:(?:(?:[a-zA-Z\d]*(?:;[a-zA-Z\d]*)*)?\u0007)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))/g, '');
7
- }
@@ -1,4 +0,0 @@
1
- import type { BashOutputFilterInput, BashOutputFilterResult } from './types.js';
2
- import type { LineFilterDefinition } from './lineFilter.js';
3
- export declare const builtInLineFilters: LineFilterDefinition[];
4
- export declare function filterBashOutput(input: BashOutputFilterInput): BashOutputFilterResult;
@@ -1,43 +0,0 @@
1
- export function toolLoopBudgetPrompt() {
2
- return 'Tool slice reached for this model step — tools are no longer callable in this turn. Stop attempting to describe or announce tool calls (e.g. "Let me install", "Now I\'ll run", "Let me X"); those phrases imply tool use you cannot perform. Answer once with a bounded progress checkpoint: what is done so far (changes + validation evidence) and, if work remains, the single next concrete unfinished action. haze continues the active goal automatically from that line — do not manufacture a completion summary and do not treat this as the end of the task. Do not repeat yourself, do not loop, do not emit XML/JSON tool-call syntax.';
3
- }
4
- export function repeatedToolCallPrompt(toolNames) {
5
- const names = [...new Set(toolNames)].join(', ');
6
- return `You already called ${names || 'a tool'} with identical input in this turn. Do not call the same tool again with the same arguments. Use the existing tool result already in the conversation, choose a different concrete tool/input if genuinely needed, or give the final/blocked status now.`;
7
- }
8
- /**
9
- * Ephemeral control appended to continue a response truncated by an
10
- * output-length finish. Asks the model to resume from where it stopped and
11
- * complete the requested artifact/answer. One-request nudge only.
12
- */
13
- export function lengthContinuationPrompt() {
14
- return 'Your previous response was truncated by the output-token limit before it finished. Continue exactly from where you stopped and complete the requested artifact or answer. Do not repeat what you already produced; finish the in-progress work and then stop.';
15
- }
16
- /**
17
- * Ephemeral control for the single completion-rescue slice. Only mutation and
18
- * validation tools are available; discovery must not be reopened. The model gets
19
- * one tool-bearing step (at most two tool calls) to apply a concrete remaining
20
- * deliverable you already discovered, then one final tool-free synthesis.
21
- */
22
- export function completionRescuePrompt() {
23
- return 'You reached the tool-boundary without a substantive final answer. Only edit/write and validation tools are available now. Use at most two tool calls to apply the single most important remaining concrete deliverable you already discovered (do not explore or read new files), then give the final status: current-task changes plus validation evidence, or a single short line stating the next unfinished action. Do not loop.';
24
- }
25
- export function malformedToolCallPrompt(toolName, chunkBytes) {
26
- const chunkGuidance = toolName === 'writeFile'
27
- ? ` Keep content below ${chunkBytes} UTF-8 bytes per call: write the first chunk normally, then continue the same file with append=true.`
28
- : '';
29
- return `The ${toolName} call had invalid, malformed, or truncated JSON input and did not execute. Retry it now with valid smaller arguments; do not merely announce that you will retry.${chunkGuidance}`;
30
- }
31
- /**
32
- * Ephemeral control for a goal-continuation slice or a fresh continuation
33
- * turn. The model's stop was rejected (or its physical turn hit a budget
34
- * boundary) while structured evidence — declared task counts, post-edit
35
- * validation — shows unfinished work; this nudge requires resuming concrete
36
- * work rather than summarizing again. One-request nudge only.
37
- */
38
- export function goalContinuationPrompt(reason, taskCounts) {
39
- const taskLine = taskCounts
40
- ? ` The task list currently shows ${taskCounts.pending + taskCounts.inProgress} open item${taskCounts.pending + taskCounts.inProgress === 1 ? '' : 's'} of ${taskCounts.total}; update writeTasks as you complete them.`
41
- : '';
42
- return `Continue the active goal: haze rejected stopping because structured evidence shows this turn is not complete (${reason}). 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.`;
43
- }
@@ -1,3 +0,0 @@
1
- export type RequestIntent = 'implement' | 'fix' | 'test' | 'review' | 'plan' | 'answer' | 'unknown';
2
- export declare function isPlanOnlyRequest(value: string): boolean;
3
- export declare function classifyRequestIntent(value: string): RequestIntent;
@@ -1,18 +0,0 @@
1
- export function isPlanOnlyRequest(value) {
2
- return /\b(create|make|write|draft|outline)\s+(?:a\s+)?plan\b|\bplan\s+(?:for|to)\b/i.test(value) && !/\bimplement|execute|do\b/i.test(value);
3
- }
4
- export function classifyRequestIntent(value) {
5
- if (isPlanOnlyRequest(value))
6
- return 'plan';
7
- if (/\b(review|audit|inspect|analy[sz]e|compare)\b/i.test(value))
8
- return 'review';
9
- if (/\b(fix|repair|resolve|debug)\b/i.test(value))
10
- return 'fix';
11
- if (/\b(run|verify|check|validate)\b/i.test(value) || /\btests?\b/i.test(value) && !/\b(add|create|write)\b/i.test(value))
12
- return 'test';
13
- if (/\b(add|create|write|implement|update|change|support|wire|document|docs|documentation)\b/i.test(value))
14
- return 'implement';
15
- if (/\b(what|why|how|explain|tell me)\b/i.test(value))
16
- return 'answer';
17
- return 'unknown';
18
- }
@@ -1,8 +0,0 @@
1
- import { observeWorkToolEvent, type WorkState, type WorkStatus, type WorkValidationStatus } from '../agent/workState.js';
2
- export type SessionGoalStatus = WorkStatus;
3
- export type ValidationStatus = WorkValidationStatus;
4
- export type SessionGoal = WorkState;
5
- export type GoalToolEvent = Parameters<typeof observeWorkToolEvent>[1];
6
- export declare function createSessionGoal(request: string, now?: number): SessionGoal;
7
- export declare function observeGoalToolEvent(goal: SessionGoal, event: GoalToolEvent, now?: number): WorkState;
8
- export declare function formatGoalStatus(goal: SessionGoal): string;
@@ -1,30 +0,0 @@
1
- import { classifyRequestIntent } from './requestClassifier.js';
2
- import { createWorkState, observeWorkToolEvent } from '../agent/workState.js';
3
- function shortRequest(value) {
4
- return value.replace(/\s+/g, ' ').trim().slice(0, 160) || 'current request';
5
- }
6
- export function createSessionGoal(request, now = Date.now()) {
7
- const intent = classifyRequestIntent(request);
8
- const successCriteria = intent === 'plan'
9
- ? ['Create or update the requested plan artifact/answer', 'Do not implement source changes unless asked']
10
- : intent === 'test'
11
- ? ['Run the requested validation or closest relevant check', 'Report pass/fail accurately']
12
- : intent === 'review'
13
- ? ['Inspect the relevant current project state', 'Return evidence-based findings with file paths']
14
- : intent === 'answer'
15
- ? ['Answer the user using current project context when needed']
16
- : ['Inspect the relevant files', 'Make the requested change when needed', 'Validate the change when practical', 'Summarize only current-task changes and validation'];
17
- return createWorkState(request, intent, successCriteria, now);
18
- }
19
- export function observeGoalToolEvent(goal, event, now = Date.now()) {
20
- return observeWorkToolEvent(goal, event, now);
21
- }
22
- export function formatGoalStatus(goal) {
23
- const action = goal.phase === 'starting' ? 'starting'
24
- : goal.phase === 'inspecting' ? 'inspecting'
25
- : goal.phase === 'editing' ? `${goal.touchedFiles.length} file${goal.touchedFiles.length === 1 ? '' : 's'} changed`
26
- : goal.phase === 'validating' ? `validation ${goal.validationCommands.at(-1)?.status ?? 'running'}`
27
- : goal.phase === 'summarizing' ? 'summarizing'
28
- : 'done';
29
- return `Goal: ${shortRequest(goal.originalUserRequest)} · ${action}`;
30
- }
@@ -1,20 +0,0 @@
1
- export declare const BASH_STREAM_BYTES: number;
2
- export declare const BACKGROUND_PROCESS_OUTPUT_BYTES: number;
3
- export declare const GREP_STREAM_BYTES: number;
4
- export declare const PROCESS_STDERR_BYTES: number;
5
- export declare const TOOL_OUTPUT_ENTRY_BYTES: number;
6
- export declare const TOOL_OUTPUT_TOTAL_BYTES: number;
7
- export declare const LSP_DOCUMENT_BYTES: number;
8
- export declare const LSP_HEADER_BYTES: number;
9
- export declare const LSP_FRAME_BYTES: number;
10
- export declare const LSP_BUFFER_BYTES: number;
11
- export declare const SKILL_MARKDOWN_BYTES: number;
12
- export declare const EXACT_MUTATION_BYTES: number;
13
- export declare const JSONL_LINE_BYTES: number;
14
- export declare const TEXT_LINE_BYTES: number;
15
- /** Maximum byte size of a prompt read from piped stdin. */
16
- export declare const STDIN_PROMPT_BYTES: number;
17
- /** Maximum size of one user-attached image (checked before the read). */
18
- export declare const IMAGE_ATTACHMENT_BYTES: number;
19
- /** Maximum number of image attachments in a single user message. */
20
- export declare const IMAGE_ATTACHMENTS_PER_MESSAGE = 4;
@@ -1,20 +0,0 @@
1
- export const BASH_STREAM_BYTES = 2 * 1024 * 1024;
2
- export const BACKGROUND_PROCESS_OUTPUT_BYTES = 256 * 1024;
3
- export const GREP_STREAM_BYTES = 8 * 1024 * 1024;
4
- export const PROCESS_STDERR_BYTES = 64 * 1024;
5
- export const TOOL_OUTPUT_ENTRY_BYTES = 2 * 1024 * 1024;
6
- export const TOOL_OUTPUT_TOTAL_BYTES = 16 * 1024 * 1024;
7
- export const LSP_DOCUMENT_BYTES = 2 * 1024 * 1024;
8
- export const LSP_HEADER_BYTES = 16 * 1024;
9
- export const LSP_FRAME_BYTES = 8 * 1024 * 1024;
10
- export const LSP_BUFFER_BYTES = LSP_FRAME_BYTES + LSP_HEADER_BYTES;
11
- export const SKILL_MARKDOWN_BYTES = 256 * 1024;
12
- export const EXACT_MUTATION_BYTES = 8 * 1024 * 1024;
13
- export const JSONL_LINE_BYTES = 4 * 1024 * 1024;
14
- export const TEXT_LINE_BYTES = 1024 * 1024;
15
- /** Maximum byte size of a prompt read from piped stdin. */
16
- export const STDIN_PROMPT_BYTES = 256 * 1024;
17
- /** Maximum size of one user-attached image (checked before the read). */
18
- export const IMAGE_ATTACHMENT_BYTES = 5 * 1024 * 1024;
19
- /** Maximum number of image attachments in a single user message. */
20
- export const IMAGE_ATTACHMENTS_PER_MESSAGE = 4;
@@ -1,25 +0,0 @@
1
- /**
2
- * Model-facing text caps (characters). Byte budgets live in `byteBudgets.ts`;
3
- * these bound the text returned to the model or persisted in previews so
4
- * callers cite a named constant instead of a magic number (CR-014).
5
- */
6
- /** Per-page cap for numbered file content returned by readFile/listFiles-style tools. */
7
- export declare const MAX_OUTPUT_CHARS = 50000;
8
- /** Default compact cap for stored bash output shown to the model. */
9
- export declare const COMPACT_COMMAND_CHARS = 12000;
10
- /** Compact cap for passing-validation summaries. */
11
- export declare const SHORT_VALIDATION_CHARS = 2000;
12
- /** Total rendered size cap for grep match output. */
13
- export declare const GREP_MAX_OUTPUT_CHARS = 30000;
14
- /** Per-line cap for rendered grep matches. */
15
- export declare const GREP_MAX_LINE_CHARS = 500;
16
- /** Bounded excerpt of older messages kept by /compact-style compaction. */
17
- export declare const COMPACTION_OLDER_CHARS = 8000;
18
- /** Bounded older-transcript budget sent to the model for LLM-summarized /compact (F-09). */
19
- export declare const COMPACTION_LLM_TRANSCRIPT_CHARS = 60000;
20
- /** Session JSONL values up to this size stay inline; larger ones become previews. */
21
- export declare const SESSION_INLINE_VALUE_BYTES: number;
22
- /** Preview length for slimmed session values. */
23
- export declare const SESSION_PREVIEW_CHARS: number;
24
- /** Strings longer than this are truncated in session snapshots. */
25
- export declare const SESSION_LARGE_STRING_CHARS: number;
@@ -1,25 +0,0 @@
1
- /**
2
- * Model-facing text caps (characters). Byte budgets live in `byteBudgets.ts`;
3
- * these bound the text returned to the model or persisted in previews so
4
- * callers cite a named constant instead of a magic number (CR-014).
5
- */
6
- /** Per-page cap for numbered file content returned by readFile/listFiles-style tools. */
7
- export const MAX_OUTPUT_CHARS = 50_000;
8
- /** Default compact cap for stored bash output shown to the model. */
9
- export const COMPACT_COMMAND_CHARS = 12_000;
10
- /** Compact cap for passing-validation summaries. */
11
- export const SHORT_VALIDATION_CHARS = 2_000;
12
- /** Total rendered size cap for grep match output. */
13
- export const GREP_MAX_OUTPUT_CHARS = 30_000;
14
- /** Per-line cap for rendered grep matches. */
15
- export const GREP_MAX_LINE_CHARS = 500;
16
- /** Bounded excerpt of older messages kept by /compact-style compaction. */
17
- export const COMPACTION_OLDER_CHARS = 8_000;
18
- /** Bounded older-transcript budget sent to the model for LLM-summarized /compact (F-09). */
19
- export const COMPACTION_LLM_TRANSCRIPT_CHARS = 60_000;
20
- /** Session JSONL values up to this size stay inline; larger ones become previews. */
21
- export const SESSION_INLINE_VALUE_BYTES = 32 * 1024;
22
- /** Preview length for slimmed session values. */
23
- export const SESSION_PREVIEW_CHARS = 4 * 1024;
24
- /** Strings longer than this are truncated in session snapshots. */
25
- export const SESSION_LARGE_STRING_CHARS = 8 * 1024;
@@ -1,10 +0,0 @@
1
- export type BashRiskLevel = 'read_only' | 'mutating' | 'destructive' | 'network' | 'unknown';
2
- export type BashTrait = 'reads_files' | 'writes_files' | 'deletes_files' | 'installs_dependencies' | 'runs_tests' | 'runs_build' | 'uses_network' | 'changes_git_state' | 'changes_permissions';
3
- export type BashClassification = {
4
- riskLevel: BashRiskLevel;
5
- traits: BashTrait[];
6
- confidence: 'high' | 'medium' | 'low';
7
- reason: string;
8
- };
9
- export declare function classifyBashCommand(command: string): BashClassification;
10
- export declare function isValidationClassification(classification: BashClassification): boolean;
package/dist/llm/lsp.d.ts DELETED
@@ -1,149 +0,0 @@
1
- import { type ChildProcessWithoutNullStreams } from 'node:child_process';
2
- import type { HazeLspServer } from '../config/lspSettings.js';
3
- type Json = null | boolean | number | string | Json[] | {
4
- [key: string]: Json;
5
- };
6
- export declare class LspError extends Error {
7
- constructor(message: string);
8
- }
9
- export declare function languageId(filePath: string): string;
10
- export declare function toUri(absolutePath: string): string;
11
- export declare function fromUri(uri: string): string;
12
- export declare function isObject(value: unknown): value is Record<string, unknown>;
13
- export declare function asRange(value: unknown): {
14
- start: {
15
- line: number;
16
- character: number;
17
- };
18
- end: {
19
- line: number;
20
- character: number;
21
- };
22
- } | undefined;
23
- export declare function locationToResult(value: unknown): {
24
- external?: boolean | undefined;
25
- path: string;
26
- range: {
27
- start: {
28
- line: number;
29
- character: number;
30
- };
31
- end: {
32
- line: number;
33
- character: number;
34
- };
35
- };
36
- } | undefined;
37
- export declare function locationToWorkspaceResult(value: unknown): Promise<{
38
- external?: boolean | undefined;
39
- path: string;
40
- range: {
41
- start: {
42
- line: number;
43
- character: number;
44
- };
45
- end: {
46
- line: number;
47
- character: number;
48
- };
49
- };
50
- } | undefined>;
51
- export declare function flattenSymbols(symbols: unknown[], filePath: string, limit: number): {
52
- name: string;
53
- kind?: number;
54
- path: string;
55
- range?: ReturnType<typeof asRange>;
56
- selectionRange?: ReturnType<typeof asRange>;
57
- }[];
58
- export declare function pickLspServer(servers: HazeLspServer[], filePath: string): HazeLspServer | undefined;
59
- export declare class StdioLspClient {
60
- private server;
61
- private child;
62
- private id;
63
- private buffer;
64
- private pending;
65
- private terminating;
66
- constructor(server: HazeLspServer, child: ChildProcessWithoutNullStreams);
67
- static start(server: HazeLspServer): StdioLspClient;
68
- private rejectAll;
69
- private terminate;
70
- /** Whether this client has begun (or completed) teardown and must not be reused. */
71
- get terminated(): boolean;
72
- private onData;
73
- private send;
74
- request(method: string, params?: Json, timeoutMs?: number): Promise<unknown>;
75
- notify(method: string, params?: Json): void;
76
- initialize(): Promise<void>;
77
- openDocument(absolutePath: string): Promise<void>;
78
- close(): Promise<void>;
79
- }
80
- /**
81
- * Turn-scoped pool of reused LSP clients (RH-009). Autonomous code navigation
82
- * issues many symbols/definition/references calls per turn; reusing one
83
- * initialized server and its opened documents avoids repeating expensive
84
- * startup and indexing on every call. Clients are keyed by server name; a
85
- * crashed/terminated client is evicted so the next call restarts it.
86
- */
87
- export declare class LspPool {
88
- private readonly clients;
89
- private readonly openedDocuments;
90
- private closed;
91
- /** Get (or lazily start + initialize) the reusable client for a server. */
92
- getClient(server: HazeLspServer): Promise<StdioLspClient>;
93
- /** Open a document once per client; subsequent calls for the same URI are no-ops. */
94
- ensureOpen(server: HazeLspServer, client: StdioLspClient, absolutePath: string): Promise<void>;
95
- /** Bounded teardown of every pooled client. Safe to call once. */
96
- close(): Promise<void>;
97
- }
98
- export declare function lspDocumentSymbols(server: HazeLspServer, filePath: string, limit: number, pool?: LspPool): Promise<{
99
- name: string;
100
- kind?: number;
101
- path: string;
102
- range?: ReturnType<typeof asRange>;
103
- selectionRange?: ReturnType<typeof asRange>;
104
- }[]>;
105
- export declare function lspDefinition(server: HazeLspServer, filePath: string, line: number, character: number, limit: number, pool?: LspPool): Promise<{
106
- external?: boolean | undefined;
107
- path: string;
108
- range: {
109
- start: {
110
- line: number;
111
- character: number;
112
- };
113
- end: {
114
- line: number;
115
- character: number;
116
- };
117
- };
118
- }[]>;
119
- export declare function lspReferences(server: HazeLspServer, filePath: string, line: number, character: number, limit: number, pool?: LspPool): Promise<{
120
- external?: boolean | undefined;
121
- path: string;
122
- range: {
123
- start: {
124
- line: number;
125
- character: number;
126
- };
127
- end: {
128
- line: number;
129
- character: number;
130
- };
131
- };
132
- }[]>;
133
- export declare function lspWorkspaceSymbols(server: HazeLspServer, query: string, limit: number, pool?: LspPool): Promise<{
134
- external?: boolean | undefined;
135
- path: string;
136
- range: {
137
- start: {
138
- line: number;
139
- character: number;
140
- };
141
- end: {
142
- line: number;
143
- character: number;
144
- };
145
- };
146
- name: string;
147
- kind: number | undefined;
148
- }[]>;
149
- export {};