@denizokcu/haze 1.1.1 → 1.4.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 (133) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +26 -15
  3. package/SECURITY.md +1 -1
  4. package/bin/haze.js +27 -7
  5. package/dist/buildInfo.json +3 -3
  6. package/dist/cli/chat/inputSuggestions.js +3 -0
  7. package/dist/cli/chat/liveMessages.d.ts +36 -0
  8. package/dist/cli/chat/liveMessages.js +64 -0
  9. package/dist/cli/chat/sessionLifecycle.d.ts +2 -1
  10. package/dist/cli/chat/sessionLifecycle.js +25 -2
  11. package/dist/cli/chat/sessionRecorder.d.ts +7 -0
  12. package/dist/cli/chat/sessionRecorder.js +6 -0
  13. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +1 -1
  14. package/dist/cli/chat/wizard/sessionThemeHandlers.js +16 -1
  15. package/dist/cli/commands/chat.js +63 -36
  16. package/dist/cli/commands/commandHelp.js +2 -0
  17. package/dist/cli/commands/commands.js +2 -0
  18. package/dist/cli/commands/formatters.js +5 -1
  19. package/dist/cli/commands/ndjsonSink.d.ts +12 -0
  20. package/dist/cli/commands/ndjsonSink.js +29 -0
  21. package/dist/cli/commands/reasoningCommand.d.ts +35 -0
  22. package/dist/cli/commands/reasoningCommand.js +46 -0
  23. package/dist/cli/commands/runCommand.d.ts +14 -0
  24. package/dist/cli/commands/runCommand.js +43 -11
  25. package/dist/cli/commands/settingsSummary.js +2 -0
  26. package/dist/cli/commands/streaming/agentAttempt.d.ts +14 -1
  27. package/dist/cli/commands/streaming/agentAttempt.js +9 -5
  28. package/dist/cli/commands/streaming/assistantSegments.d.ts +0 -7
  29. package/dist/cli/commands/streaming/assistantSegments.js +1 -1
  30. package/dist/cli/commands/streaming/attemptLifecycle.js +13 -9
  31. package/dist/cli/commands/streaming/attemptOutcome.d.ts +23 -3
  32. package/dist/cli/commands/streaming/attemptOutcome.js +64 -11
  33. package/dist/cli/commands/streaming/attemptSetup.d.ts +13 -3
  34. package/dist/cli/commands/streaming/attemptSetup.js +40 -15
  35. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +6 -0
  36. package/dist/cli/commands/streaming/goalCheckpoint.js +1 -0
  37. package/dist/cli/commands/streaming/goalSupervisor.d.ts +6 -1
  38. package/dist/cli/commands/streaming/goalSupervisor.js +18 -4
  39. package/dist/cli/commands/streaming/prepareStep.d.ts +6 -4
  40. package/dist/cli/commands/streaming/prepareStep.js +43 -22
  41. package/dist/cli/commands/streaming/stallRecovery.js +2 -2
  42. package/dist/cli/commands/streaming/streamLoop.d.ts +31 -4
  43. package/dist/cli/commands/streaming/streamLoop.js +280 -44
  44. package/dist/cli/commands/streaming/toolPartHandlers.js +13 -0
  45. package/dist/cli/commands/streaming/turnRuntime.d.ts +1 -1
  46. package/dist/cli/commands/streaming/turnRuntime.js +3 -2
  47. package/dist/cli/commands/streaming.d.ts +15 -2
  48. package/dist/cli/commands/streaming.js +37 -8
  49. package/dist/cli/commands/wizardFlow.d.ts +7 -0
  50. package/dist/cli/commands/wizardFlow.js +22 -0
  51. package/dist/cli/index.js +8 -3
  52. package/dist/config/modelCatalog.d.ts +32 -0
  53. package/dist/config/modelCatalog.js +84 -0
  54. package/dist/config/modelDiscovery.js +68 -5
  55. package/dist/config/settings.d.ts +18 -6
  56. package/dist/config/settings.js +11 -1
  57. package/dist/core/agent/budgets.d.ts +10 -2
  58. package/dist/core/agent/budgets.js +10 -2
  59. package/dist/core/agent/compaction.d.ts +42 -3
  60. package/dist/core/agent/compaction.js +53 -5
  61. package/dist/core/agent/completionController.d.ts +11 -1
  62. package/dist/core/agent/completionController.js +33 -0
  63. package/dist/core/agent/contextBudget.d.ts +56 -0
  64. package/dist/core/agent/contextBudget.js +53 -0
  65. package/dist/core/agent/errors.js +2 -2
  66. package/dist/core/agent/events.d.ts +26 -2
  67. package/dist/core/agent/goalPolicy.d.ts +7 -0
  68. package/dist/core/agent/goalPolicy.js +9 -0
  69. package/dist/core/agent/overflow.d.ts +45 -0
  70. package/dist/core/agent/overflow.js +91 -0
  71. package/dist/core/agent/reasoningPolicy.d.ts +45 -9
  72. package/dist/core/agent/reasoningPolicy.js +49 -9
  73. package/dist/core/agent/requestAssembly.d.ts +7 -0
  74. package/dist/core/agent/requestAssembly.js +15 -7
  75. package/dist/core/agent/toolCapabilities.d.ts +3 -3
  76. package/dist/core/agent/toolCapabilities.js +31 -7
  77. package/dist/core/agent/workState.d.ts +6 -4
  78. package/dist/core/agent/workState.js +53 -29
  79. package/dist/core/deadline.js +22 -24
  80. package/dist/core/safety/secretPaths.js +10 -7
  81. package/dist/core/safety/shellClassifier.d.ts +18 -0
  82. package/dist/core/safety/shellClassifier.js +39 -0
  83. package/dist/core/session/sessionSlimming.d.ts +2 -0
  84. package/dist/core/session/sessionSlimming.js +50 -1
  85. package/dist/core/session/sessionStore.d.ts +14 -8
  86. package/dist/core/session/sessionStore.js +59 -32
  87. package/dist/core/shellOutput/reducers/git.js +7 -2
  88. package/dist/core/shellOutput/reducers/validation.d.ts +1 -1
  89. package/dist/core/shellOutput/reducers/validation.js +14 -1
  90. package/dist/core/shellOutput/registry.js +3 -2
  91. package/dist/core/subagent/contracts.d.ts +8 -1
  92. package/dist/core/subagent/subagentRunner.d.ts +4 -0
  93. package/dist/core/subagent/subagentRunner.js +33 -25
  94. package/dist/core/tasks/taskStorage.js +8 -1
  95. package/dist/core/validation/outputParser.d.ts +1 -1
  96. package/dist/core/validation/outputParser.js +30 -1
  97. package/dist/llm/client.d.ts +4 -3
  98. package/dist/llm/client.js +34 -16
  99. package/dist/llm/hazeTools.d.ts +2039 -16
  100. package/dist/llm/hazeTools.js +43 -2
  101. package/dist/llm/lsp/client.d.ts +7 -1
  102. package/dist/llm/lsp/client.js +58 -9
  103. package/dist/llm/lsp/pool.d.ts +11 -0
  104. package/dist/llm/lsp/pool.js +61 -4
  105. package/dist/llm/lsp/protocol.d.ts +6 -23
  106. package/dist/llm/lsp/requests.d.ts +54 -60
  107. package/dist/llm/lsp/requests.js +152 -28
  108. package/dist/llm/lsp/symbols.d.ts +16 -0
  109. package/dist/llm/lsp/symbols.js +70 -0
  110. package/dist/llm/lsp/workspaceEdit.d.ts +43 -0
  111. package/dist/llm/lsp/workspaceEdit.js +117 -0
  112. package/dist/llm/lspTools.d.ts +7518 -2859
  113. package/dist/llm/lspTools.js +195 -110
  114. package/dist/llm/requestContext.d.ts +3 -2
  115. package/dist/llm/requestContext.js +8 -4
  116. package/dist/llm/systemPrompt.js +2 -2
  117. package/dist/llm/tools/fetchTool.d.ts +4 -0
  118. package/dist/llm/tools/processTool.d.ts +4 -0
  119. package/dist/llm/tools/replaceInFiles.d.ts +105 -0
  120. package/dist/llm/tools/replaceInFiles.js +131 -0
  121. package/dist/llm/tools/shellTool.d.ts +4 -0
  122. package/dist/llm/tools/shellTool.js +27 -8
  123. package/dist/llm/tools/storedOutputTool.d.ts +4 -0
  124. package/dist/llm/tools/taskTool.d.ts +4 -0
  125. package/dist/llm/tools/toolContext.d.ts +3 -0
  126. package/dist/llm/tools/toolContext.js +26 -4
  127. package/dist/skills/SkillLoader.js +27 -1
  128. package/dist/ui/components/TextInput.d.ts +18 -1
  129. package/dist/ui/components/TextInput.js +44 -6
  130. package/dist/ui/components/useInputSuggestions.js +18 -6
  131. package/dist/utils/buildInfo.js +29 -8
  132. package/dist/utils/fs.js +5 -1
  133. package/package.json +20 -19
@@ -109,24 +109,45 @@ export function resolvePackageRoot(start = MODULE_DIR) {
109
109
  */
110
110
  export function gitHeadCommit(root) {
111
111
  const sha = (value) => (/^[0-9a-f]{7,40}$/i.test((value ?? '').trim()) ? value.trim() : undefined);
112
+ const readFile = (file) => {
113
+ try {
114
+ return readFileSync(file, 'utf8');
115
+ }
116
+ catch {
117
+ return undefined;
118
+ }
119
+ };
112
120
  try {
113
121
  const dotGitPath = join(root, '.git');
114
122
  const stat = statSync(dotGitPath);
123
+ // `gitdir: <path>` may be relative (resolve against the checkout root) and
124
+ // may contain spaces, so capture to end-of-line rather than \S+ (MR-05).
115
125
  const gitDir = stat.isDirectory()
116
126
  ? dotGitPath
117
- : /gitdir:\s*(\S+)/.exec(readFileSync(dotGitPath, 'utf8'))?.[1];
127
+ : resolve(root, (/gitdir:\s*(.+?)\s*$/.exec(readFile(dotGitPath) ?? '') ?? [])[1] ?? '');
118
128
  if (!gitDir)
119
129
  return undefined;
120
- const head = readFileSync(join(gitDir, 'HEAD'), 'utf8').trim();
130
+ // Linked worktrees keep refs in the common Git directory; per-worktree dirs
131
+ // carry only HEAD and private refs. Resolve via `commondir` when present.
132
+ const commonDirRaw = /\s*(.+?)\s*$/.exec(readFile(join(gitDir, 'commondir')) ?? '')?.[1];
133
+ const refDirs = commonDirRaw ? [resolve(gitDir, commonDirRaw)] : [];
134
+ const head = (readFile(join(gitDir, 'HEAD')) ?? '').trim();
121
135
  if (!head.startsWith('ref:'))
122
136
  return sha(head);
123
137
  const ref = head.slice(4).trim();
124
- const refPath = join(gitDir, ref);
125
- if (existsSync(refPath))
126
- return sha(readFileSync(refPath, 'utf8'));
127
- const packed = readFileSync(join(gitDir, 'packed-refs'), 'utf8');
128
- const escaped = ref.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
129
- return sha(new RegExp(`^([0-9a-f]{40}) ${escaped}$`, 'm').exec(packed)?.[1]);
138
+ for (const dir of [gitDir, ...refDirs]) {
139
+ const loose = sha(readFile(join(dir, ref)));
140
+ if (loose)
141
+ return loose;
142
+ const packed = readFile(join(dir, 'packed-refs'));
143
+ if (packed) {
144
+ const escaped = ref.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
145
+ const packedSha = sha(new RegExp(`^([0-9a-f]{40}) ${escaped}$`, 'm').exec(packed)?.[1]);
146
+ if (packedSha)
147
+ return packedSha;
148
+ }
149
+ }
150
+ return undefined;
130
151
  }
131
152
  catch {
132
153
  return undefined;
package/dist/utils/fs.js CHANGED
@@ -5,11 +5,15 @@ import path from 'node:path';
5
5
  // and prevents dependency contents from crowding out workspace source files.
6
6
  const SKIP_ENTRIES = new Set(['.git', 'node_modules']);
7
7
  export async function walkDir(root, options = {}) {
8
- const { recursive = false, maxEntries = Infinity, cursor, filter, ignoreBatch } = options;
8
+ const { recursive = false, maxEntries = Infinity, filter, ignoreBatch } = options;
9
9
  const result = [];
10
10
  // Cursor semantics: the cursor is the last entry a previous page returned.
11
11
  // This walk resumes strictly *after* that entry in depth-first traversal
12
12
  // order, without re-checking or even descending into earlier subtrees.
13
+ // An empty/whitespace cursor normalizes to absent: callers whose optional
14
+ // pagination field materializes as "" (JSON round-trips, default-filled
15
+ // schemas) must not silently receive an empty first page (RT-01).
16
+ const cursor = typeof options.cursor === 'string' && options.cursor.trim() !== '' ? options.cursor : undefined;
13
17
  const cursorSegments = cursor ? cursor.split(/[\\/]/).filter(Boolean) : [];
14
18
  let collecting = cursor == null;
15
19
  if (!(await fs.pathExists(root)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "1.1.1",
3
+ "version": "1.4.0",
4
4
  "description": "A minimal LLM harness for your terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,43 +42,44 @@
42
42
  "lint:knip": "knip",
43
43
  "typecheck": "tsc --noEmit",
44
44
  "context:report": "node --import tsx src/cli/contextReport.ts",
45
+ "eval": "node scripts/run-evals.mjs",
45
46
  "release:verify": "node scripts/verify-release-metadata.mjs",
46
47
  "haze": "tsx src/cli/index.ts",
47
48
  "prepublishOnly": "npm run typecheck && npm test && npm run lint && npm run build && npm audit --audit-level=high && npm run release:verify"
48
49
  },
49
50
  "dependencies": {
50
- "@ai-sdk/mcp": "^2.0.31",
51
- "@ai-sdk/openai": "4.0.41",
51
+ "@ai-sdk/mcp": "^2.0.56",
52
+ "@ai-sdk/openai": "4.0.73",
52
53
  "@vscode/ripgrep": "1.18.0",
53
- "ai": "7.0.64",
54
+ "ai": "7.0.112",
54
55
  "cli-highlight": "2.1.11",
55
56
  "commander": "15.0.0",
56
- "defuddle": "^0.19.2",
57
- "fs-extra": "11.4.0",
58
- "ignore": "^7.0.6",
57
+ "defuddle": "^0.19.4",
58
+ "fs-extra": "11.4.1",
59
+ "ignore": "^7.0.10",
59
60
  "ink": "7.1.1",
60
61
  "ink-spinner": "5.0.0",
61
62
  "linkedom": "^0.18.13",
62
- "marked": "18.0.9",
63
- "react": "19.2.8",
63
+ "marked": "18.0.14",
64
+ "react": "19.3.0",
64
65
  "strip-ansi": "7.2.0",
65
66
  "turndown": "^7.2.4",
66
- "wrap-ansi": "10.0.0",
67
- "yaml": "2.9.0",
68
- "zod": "4.4.3"
67
+ "wrap-ansi": "10.0.2",
68
+ "yaml": "2.9.1",
69
+ "zod": "4.6.5"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@eslint/js": "^10.0.1",
72
73
  "@types/fs-extra": "11.0.4",
73
- "@types/node": "26.2.0",
74
- "@types/react": "19.2.18",
75
- "eslint": "^10.8.1",
74
+ "@types/node": "26.6.2",
75
+ "@types/react": "19.3.0",
76
+ "eslint": "^10.11.0",
76
77
  "ink-testing-library": "^4.0.0",
77
- "knip": "5.88.1",
78
- "tsx": "4.23.12",
78
+ "knip": "6.38.0",
79
+ "tsx": "4.23.15",
79
80
  "typescript": "6.0.3",
80
- "typescript-eslint": "^8.67.0",
81
- "vitest": "^4.1.10"
81
+ "typescript-eslint": "^8.70.1",
82
+ "vitest": "^5.0.1"
82
83
  },
83
84
  "allowScripts": {
84
85
  "fsevents@2.3.3": true,