@denizokcu/haze 1.2.0 → 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 (109) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +18 -10
  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 +23 -2
  11. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +1 -1
  12. package/dist/cli/chat/wizard/sessionThemeHandlers.js +16 -1
  13. package/dist/cli/commands/chat.js +39 -34
  14. package/dist/cli/commands/commandHelp.js +2 -0
  15. package/dist/cli/commands/commands.js +2 -0
  16. package/dist/cli/commands/formatters.js +5 -1
  17. package/dist/cli/commands/ndjsonSink.d.ts +12 -0
  18. package/dist/cli/commands/ndjsonSink.js +29 -0
  19. package/dist/cli/commands/reasoningCommand.d.ts +35 -0
  20. package/dist/cli/commands/reasoningCommand.js +46 -0
  21. package/dist/cli/commands/runCommand.d.ts +14 -0
  22. package/dist/cli/commands/runCommand.js +37 -11
  23. package/dist/cli/commands/settingsSummary.js +2 -0
  24. package/dist/cli/commands/streaming/agentAttempt.d.ts +3 -0
  25. package/dist/cli/commands/streaming/agentAttempt.js +2 -2
  26. package/dist/cli/commands/streaming/assistantSegments.d.ts +0 -7
  27. package/dist/cli/commands/streaming/assistantSegments.js +1 -1
  28. package/dist/cli/commands/streaming/attemptLifecycle.js +13 -9
  29. package/dist/cli/commands/streaming/attemptOutcome.js +13 -3
  30. package/dist/cli/commands/streaming/attemptSetup.d.ts +3 -0
  31. package/dist/cli/commands/streaming/attemptSetup.js +11 -3
  32. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +6 -0
  33. package/dist/cli/commands/streaming/goalCheckpoint.js +1 -0
  34. package/dist/cli/commands/streaming/goalSupervisor.d.ts +5 -0
  35. package/dist/cli/commands/streaming/goalSupervisor.js +9 -4
  36. package/dist/cli/commands/streaming/prepareStep.d.ts +0 -3
  37. package/dist/cli/commands/streaming/prepareStep.js +8 -3
  38. package/dist/cli/commands/streaming.d.ts +7 -2
  39. package/dist/cli/commands/streaming.js +24 -5
  40. package/dist/cli/commands/wizardFlow.d.ts +7 -0
  41. package/dist/cli/commands/wizardFlow.js +22 -0
  42. package/dist/cli/index.js +5 -1
  43. package/dist/config/modelDiscovery.js +68 -5
  44. package/dist/config/settings.d.ts +8 -4
  45. package/dist/config/settings.js +8 -1
  46. package/dist/core/agent/budgets.d.ts +0 -2
  47. package/dist/core/agent/budgets.js +0 -2
  48. package/dist/core/agent/completionController.d.ts +8 -0
  49. package/dist/core/agent/completionController.js +32 -0
  50. package/dist/core/agent/events.d.ts +2 -1
  51. package/dist/core/agent/goalPolicy.d.ts +7 -0
  52. package/dist/core/agent/goalPolicy.js +9 -0
  53. package/dist/core/agent/reasoningPolicy.d.ts +45 -9
  54. package/dist/core/agent/reasoningPolicy.js +49 -9
  55. package/dist/core/agent/toolCapabilities.d.ts +3 -3
  56. package/dist/core/agent/toolCapabilities.js +31 -7
  57. package/dist/core/agent/workState.d.ts +6 -4
  58. package/dist/core/agent/workState.js +40 -28
  59. package/dist/core/deadline.js +22 -24
  60. package/dist/core/safety/secretPaths.js +10 -7
  61. package/dist/core/safety/shellClassifier.d.ts +2 -0
  62. package/dist/core/safety/shellClassifier.js +9 -1
  63. package/dist/core/session/sessionSlimming.d.ts +2 -0
  64. package/dist/core/session/sessionSlimming.js +50 -1
  65. package/dist/core/session/sessionStore.d.ts +4 -8
  66. package/dist/core/session/sessionStore.js +53 -32
  67. package/dist/core/shellOutput/reducers/git.js +7 -2
  68. package/dist/core/shellOutput/reducers/validation.d.ts +1 -1
  69. package/dist/core/shellOutput/reducers/validation.js +14 -1
  70. package/dist/core/shellOutput/registry.js +3 -2
  71. package/dist/core/subagent/contracts.d.ts +8 -1
  72. package/dist/core/subagent/subagentRunner.d.ts +4 -0
  73. package/dist/core/subagent/subagentRunner.js +33 -25
  74. package/dist/core/tasks/taskStorage.js +8 -1
  75. package/dist/core/validation/outputParser.js +24 -0
  76. package/dist/llm/client.d.ts +2 -1
  77. package/dist/llm/client.js +20 -10
  78. package/dist/llm/hazeTools.d.ts +2039 -16
  79. package/dist/llm/hazeTools.js +43 -2
  80. package/dist/llm/lsp/client.d.ts +7 -1
  81. package/dist/llm/lsp/client.js +58 -9
  82. package/dist/llm/lsp/pool.d.ts +11 -0
  83. package/dist/llm/lsp/pool.js +61 -4
  84. package/dist/llm/lsp/protocol.d.ts +6 -23
  85. package/dist/llm/lsp/requests.d.ts +54 -60
  86. package/dist/llm/lsp/requests.js +152 -28
  87. package/dist/llm/lsp/symbols.d.ts +16 -0
  88. package/dist/llm/lsp/symbols.js +70 -0
  89. package/dist/llm/lsp/workspaceEdit.d.ts +43 -0
  90. package/dist/llm/lsp/workspaceEdit.js +117 -0
  91. package/dist/llm/lspTools.d.ts +7518 -2859
  92. package/dist/llm/lspTools.js +195 -110
  93. package/dist/llm/requestContext.d.ts +3 -2
  94. package/dist/llm/requestContext.js +8 -4
  95. package/dist/llm/systemPrompt.js +2 -2
  96. package/dist/llm/tools/fetchTool.d.ts +4 -0
  97. package/dist/llm/tools/processTool.d.ts +4 -0
  98. package/dist/llm/tools/replaceInFiles.d.ts +105 -0
  99. package/dist/llm/tools/replaceInFiles.js +131 -0
  100. package/dist/llm/tools/shellTool.d.ts +4 -0
  101. package/dist/llm/tools/storedOutputTool.d.ts +4 -0
  102. package/dist/llm/tools/taskTool.d.ts +4 -0
  103. package/dist/llm/tools/toolContext.d.ts +3 -0
  104. package/dist/llm/tools/toolContext.js +26 -4
  105. package/dist/skills/SkillLoader.js +27 -1
  106. package/dist/ui/components/useInputSuggestions.js +18 -6
  107. package/dist/utils/buildInfo.js +29 -8
  108. package/dist/utils/fs.js +5 -1
  109. package/package.json +19 -19
@@ -4,7 +4,7 @@ import { readSettings } from '../config/settings.js';
4
4
  import { catalogLimitsFor } from '../config/modelCatalog.js';
5
5
  import { activeModel, modelSelector, resolveModelSelector } from '../config/providers.js';
6
6
  import { assertCredentialedEndpointSecure } from '../config/endpointSecurity.js';
7
- import { resolveReasoningPolicy } from '../core/agent/reasoningPolicy.js';
7
+ import { effectiveRequestedReasoning, isStoredReasoning, reasoningCallSetting, resolveReasoningPolicy } from '../core/agent/reasoningPolicy.js';
8
8
  import { FALLBACK_CONTEXT_WINDOW_TOKENS, FALLBACK_LOCAL_CONTEXT_TOKENS } from '../core/agent/contextBudget.js';
9
9
  import { createChatGptCodexFetch } from './openaiCodex.js';
10
10
  const HAZE_SITE_URL = 'https://denizokcu.github.io/haze/';
@@ -34,7 +34,9 @@ function capabilities(providerName, baseURL, providerKind) {
34
34
  supportsStickySessionId: openRouter,
35
35
  supportsServerCompaction: false,
36
36
  supportsTextVerbosity: directOpenAI,
37
- supportsReasoningEffort: directOpenAI,
37
+ // Pass-through marker: the SDK maps the top-level `reasoning` parameter
38
+ // per provider and endpoints without native support ignore the field.
39
+ supportsReasoningEffort: true,
38
40
  };
39
41
  }
40
42
  /** True for loopback/local inference servers, whose effective window is server-configured (often far below the model's). */
@@ -47,7 +49,7 @@ export function isLocalProviderUrl(url) {
47
49
  return false;
48
50
  }
49
51
  }
50
- function runtimeForSelection(settings, selection, cwd) {
52
+ function runtimeForSelection(settings, selection, cwd, reasoningOverride) {
51
53
  const baseURL = selection.provider.url;
52
54
  const providerKind = selection.provider.kind;
53
55
  const configuredKey = providerKind === 'chatgpt-codex' ? undefined : selection.provider.key ?? settings.apiKey;
@@ -57,7 +59,13 @@ function runtimeForSelection(settings, selection, cwd) {
57
59
  const cacheSeed = cwd ?? process.cwd();
58
60
  const cacheKey = crypto.createHash('sha256').update(`${cacheSeed}\0${name}`).digest('hex').slice(0, 32);
59
61
  const caps = capabilities(selection.provider.name, baseURL, providerKind);
60
- const requestedReasoning = isReasoningLevel(settings.reasoning) ? settings.reasoning : undefined;
62
+ // Run-scoped reasoning override (CLI `--reasoning`): an explicit level or
63
+ // the provider-default sentinel wins for this run; otherwise the stored
64
+ // settings value (default high, sentinel → no parameter) applies. The
65
+ // capability gate in resolveReasoningPolicy is unchanged — an override never
66
+ // forces the parameter onto an unsupported protocol.
67
+ const storedReasoning = reasoningOverride ?? (isStoredReasoning(settings.reasoning) ? settings.reasoning : undefined);
68
+ const requestedReasoning = effectiveRequestedReasoning(storedReasoning);
61
69
  const reasoningPolicy = resolveReasoningPolicy({ requested: requestedReasoning, capabilities: caps });
62
70
  const openai = providerKind === 'chatgpt-codex'
63
71
  ? createOpenAI({ apiKey: OAUTH_SDK_SENTINEL, baseURL, fetch: createChatGptCodexFetch(selection.provider.name) })
@@ -110,9 +118,6 @@ function modelLimitsFor(provider, modelName) {
110
118
  out.maxOutputTokens = limits.maxOutputTokens;
111
119
  return out;
112
120
  }
113
- function isReasoningLevel(value) {
114
- return value === 'low' || value === 'medium' || value === 'high';
115
- }
116
121
  export async function modelWithConfig(session, settings) {
117
122
  // Callers may pass pre-read settings so a turn performs a single settings
118
123
  // read (CR-024); otherwise read fresh.
@@ -126,7 +131,7 @@ export async function modelWithConfig(session, settings) {
126
131
  }
127
132
  else
128
133
  selection = activeModel(resolvedSettings);
129
- return selection ? runtimeForSelection(resolvedSettings, selection, session?.cwd) : undefined;
134
+ return selection ? runtimeForSelection(resolvedSettings, selection, session?.cwd, session?.reasoningOverride) : undefined;
130
135
  }
131
136
  export async function resolveWorkerRuntime(input) {
132
137
  const requested = input.selector?.trim();
@@ -140,11 +145,17 @@ export async function resolveWorkerRuntime(input) {
140
145
  return { status: 'found', runtime: { model: selected.model, selector: selected.selector, providerName: selected.config.providerName, capabilities: selected.config.capabilities, requestOptions: providerRequestSettings(selected.config) } };
141
146
  }
142
147
  export function providerRequestSettings(config) {
148
+ // Top-level AI SDK `reasoning` setting; the key is omitted entirely when the
149
+ // policy is disabled so the parameter is never sent (and never merged with a
150
+ // providerOptions reasoning key — the SDK ignores the top-level value then).
151
+ const setting = reasoningCallSetting(config.reasoningPolicy);
152
+ const reasoning = setting !== undefined && setting !== 'provider-default' ? setting : undefined;
143
153
  if (config.providerKind === 'chatgpt-codex') {
144
154
  return {
145
155
  omitMaxOutputTokens: true,
146
156
  providerOptions: { openai: { store: false, include: ['reasoning.encrypted_content'] } },
147
157
  headers: { 'session-id': config.cacheKey },
158
+ ...(reasoning ? { reasoning } : {}),
148
159
  };
149
160
  }
150
161
  const caps = config.capabilities;
@@ -153,11 +164,10 @@ export function providerRequestSettings(config) {
153
164
  openaiOptions.promptCacheKey = config.cacheKey;
154
165
  if (caps.supportsTextVerbosity)
155
166
  openaiOptions.textVerbosity = 'low';
156
- if (config.reasoningPolicy.effective !== 'disabled')
157
- openaiOptions.reasoningEffort = config.reasoningPolicy.effective;
158
167
  const providerOptions = Object.keys(openaiOptions).length > 0 ? { openai: openaiOptions } : undefined;
159
168
  return {
160
169
  ...(providerOptions ? { providerOptions } : {}),
161
170
  ...(caps.supportsStickySessionId ? { headers: { 'x-session-id': config.cacheKey } } : {}),
171
+ ...(reasoning ? { reasoning } : {}),
162
172
  };
163
173
  }