@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.
- package/CHANGELOG.md +78 -0
- package/README.md +26 -15
- package/SECURITY.md +1 -1
- package/bin/haze.js +27 -7
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/inputSuggestions.js +3 -0
- package/dist/cli/chat/liveMessages.d.ts +36 -0
- package/dist/cli/chat/liveMessages.js +64 -0
- package/dist/cli/chat/sessionLifecycle.d.ts +2 -1
- package/dist/cli/chat/sessionLifecycle.js +25 -2
- package/dist/cli/chat/sessionRecorder.d.ts +7 -0
- package/dist/cli/chat/sessionRecorder.js +6 -0
- package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +1 -1
- package/dist/cli/chat/wizard/sessionThemeHandlers.js +16 -1
- package/dist/cli/commands/chat.js +63 -36
- package/dist/cli/commands/commandHelp.js +2 -0
- package/dist/cli/commands/commands.js +2 -0
- package/dist/cli/commands/formatters.js +5 -1
- package/dist/cli/commands/ndjsonSink.d.ts +12 -0
- package/dist/cli/commands/ndjsonSink.js +29 -0
- package/dist/cli/commands/reasoningCommand.d.ts +35 -0
- package/dist/cli/commands/reasoningCommand.js +46 -0
- package/dist/cli/commands/runCommand.d.ts +14 -0
- package/dist/cli/commands/runCommand.js +43 -11
- package/dist/cli/commands/settingsSummary.js +2 -0
- package/dist/cli/commands/streaming/agentAttempt.d.ts +14 -1
- package/dist/cli/commands/streaming/agentAttempt.js +9 -5
- package/dist/cli/commands/streaming/assistantSegments.d.ts +0 -7
- package/dist/cli/commands/streaming/assistantSegments.js +1 -1
- package/dist/cli/commands/streaming/attemptLifecycle.js +13 -9
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +23 -3
- package/dist/cli/commands/streaming/attemptOutcome.js +64 -11
- package/dist/cli/commands/streaming/attemptSetup.d.ts +13 -3
- package/dist/cli/commands/streaming/attemptSetup.js +40 -15
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +6 -0
- package/dist/cli/commands/streaming/goalCheckpoint.js +1 -0
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +6 -1
- package/dist/cli/commands/streaming/goalSupervisor.js +18 -4
- package/dist/cli/commands/streaming/prepareStep.d.ts +6 -4
- package/dist/cli/commands/streaming/prepareStep.js +43 -22
- package/dist/cli/commands/streaming/stallRecovery.js +2 -2
- package/dist/cli/commands/streaming/streamLoop.d.ts +31 -4
- package/dist/cli/commands/streaming/streamLoop.js +280 -44
- package/dist/cli/commands/streaming/toolPartHandlers.js +13 -0
- package/dist/cli/commands/streaming/turnRuntime.d.ts +1 -1
- package/dist/cli/commands/streaming/turnRuntime.js +3 -2
- package/dist/cli/commands/streaming.d.ts +15 -2
- package/dist/cli/commands/streaming.js +37 -8
- package/dist/cli/commands/wizardFlow.d.ts +7 -0
- package/dist/cli/commands/wizardFlow.js +22 -0
- package/dist/cli/index.js +8 -3
- package/dist/config/modelCatalog.d.ts +32 -0
- package/dist/config/modelCatalog.js +84 -0
- package/dist/config/modelDiscovery.js +68 -5
- package/dist/config/settings.d.ts +18 -6
- package/dist/config/settings.js +11 -1
- package/dist/core/agent/budgets.d.ts +10 -2
- package/dist/core/agent/budgets.js +10 -2
- package/dist/core/agent/compaction.d.ts +42 -3
- package/dist/core/agent/compaction.js +53 -5
- package/dist/core/agent/completionController.d.ts +11 -1
- package/dist/core/agent/completionController.js +33 -0
- package/dist/core/agent/contextBudget.d.ts +56 -0
- package/dist/core/agent/contextBudget.js +53 -0
- package/dist/core/agent/errors.js +2 -2
- package/dist/core/agent/events.d.ts +26 -2
- package/dist/core/agent/goalPolicy.d.ts +7 -0
- package/dist/core/agent/goalPolicy.js +9 -0
- package/dist/core/agent/overflow.d.ts +45 -0
- package/dist/core/agent/overflow.js +91 -0
- package/dist/core/agent/reasoningPolicy.d.ts +45 -9
- package/dist/core/agent/reasoningPolicy.js +49 -9
- package/dist/core/agent/requestAssembly.d.ts +7 -0
- package/dist/core/agent/requestAssembly.js +15 -7
- package/dist/core/agent/toolCapabilities.d.ts +3 -3
- package/dist/core/agent/toolCapabilities.js +31 -7
- package/dist/core/agent/workState.d.ts +6 -4
- package/dist/core/agent/workState.js +53 -29
- package/dist/core/deadline.js +22 -24
- package/dist/core/safety/secretPaths.js +10 -7
- package/dist/core/safety/shellClassifier.d.ts +18 -0
- package/dist/core/safety/shellClassifier.js +39 -0
- package/dist/core/session/sessionSlimming.d.ts +2 -0
- package/dist/core/session/sessionSlimming.js +50 -1
- package/dist/core/session/sessionStore.d.ts +14 -8
- package/dist/core/session/sessionStore.js +59 -32
- package/dist/core/shellOutput/reducers/git.js +7 -2
- package/dist/core/shellOutput/reducers/validation.d.ts +1 -1
- package/dist/core/shellOutput/reducers/validation.js +14 -1
- package/dist/core/shellOutput/registry.js +3 -2
- package/dist/core/subagent/contracts.d.ts +8 -1
- package/dist/core/subagent/subagentRunner.d.ts +4 -0
- package/dist/core/subagent/subagentRunner.js +33 -25
- package/dist/core/tasks/taskStorage.js +8 -1
- package/dist/core/validation/outputParser.d.ts +1 -1
- package/dist/core/validation/outputParser.js +30 -1
- package/dist/llm/client.d.ts +4 -3
- package/dist/llm/client.js +34 -16
- package/dist/llm/hazeTools.d.ts +2039 -16
- package/dist/llm/hazeTools.js +43 -2
- package/dist/llm/lsp/client.d.ts +7 -1
- package/dist/llm/lsp/client.js +58 -9
- package/dist/llm/lsp/pool.d.ts +11 -0
- package/dist/llm/lsp/pool.js +61 -4
- package/dist/llm/lsp/protocol.d.ts +6 -23
- package/dist/llm/lsp/requests.d.ts +54 -60
- package/dist/llm/lsp/requests.js +152 -28
- package/dist/llm/lsp/symbols.d.ts +16 -0
- package/dist/llm/lsp/symbols.js +70 -0
- package/dist/llm/lsp/workspaceEdit.d.ts +43 -0
- package/dist/llm/lsp/workspaceEdit.js +117 -0
- package/dist/llm/lspTools.d.ts +7518 -2859
- package/dist/llm/lspTools.js +195 -110
- package/dist/llm/requestContext.d.ts +3 -2
- package/dist/llm/requestContext.js +8 -4
- package/dist/llm/systemPrompt.js +2 -2
- package/dist/llm/tools/fetchTool.d.ts +4 -0
- package/dist/llm/tools/processTool.d.ts +4 -0
- package/dist/llm/tools/replaceInFiles.d.ts +105 -0
- package/dist/llm/tools/replaceInFiles.js +131 -0
- package/dist/llm/tools/shellTool.d.ts +4 -0
- package/dist/llm/tools/shellTool.js +27 -8
- package/dist/llm/tools/storedOutputTool.d.ts +4 -0
- package/dist/llm/tools/taskTool.d.ts +4 -0
- package/dist/llm/tools/toolContext.d.ts +3 -0
- package/dist/llm/tools/toolContext.js +26 -4
- package/dist/skills/SkillLoader.js +27 -1
- package/dist/ui/components/TextInput.d.ts +18 -1
- package/dist/ui/components/TextInput.js +44 -6
- package/dist/ui/components/useInputSuggestions.js +18 -6
- package/dist/utils/buildInfo.js +29 -8
- package/dist/utils/fs.js +5 -1
- package/package.json +20 -19
package/dist/llm/client.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
3
|
import { readSettings } from '../config/settings.js';
|
|
4
|
+
import { catalogLimitsFor } from '../config/modelCatalog.js';
|
|
4
5
|
import { activeModel, modelSelector, resolveModelSelector } from '../config/providers.js';
|
|
5
6
|
import { assertCredentialedEndpointSecure } from '../config/endpointSecurity.js';
|
|
6
|
-
import { resolveReasoningPolicy } from '../core/agent/reasoningPolicy.js';
|
|
7
|
+
import { effectiveRequestedReasoning, isStoredReasoning, reasoningCallSetting, resolveReasoningPolicy } from '../core/agent/reasoningPolicy.js';
|
|
7
8
|
import { FALLBACK_CONTEXT_WINDOW_TOKENS, FALLBACK_LOCAL_CONTEXT_TOKENS } from '../core/agent/contextBudget.js';
|
|
8
9
|
import { createChatGptCodexFetch } from './openaiCodex.js';
|
|
9
10
|
const HAZE_SITE_URL = 'https://denizokcu.github.io/haze/';
|
|
@@ -33,7 +34,9 @@ function capabilities(providerName, baseURL, providerKind) {
|
|
|
33
34
|
supportsStickySessionId: openRouter,
|
|
34
35
|
supportsServerCompaction: false,
|
|
35
36
|
supportsTextVerbosity: directOpenAI,
|
|
36
|
-
|
|
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,
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
42
|
/** True for loopback/local inference servers, whose effective window is server-configured (often far below the model's). */
|
|
@@ -46,7 +49,7 @@ export function isLocalProviderUrl(url) {
|
|
|
46
49
|
return false;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
function runtimeForSelection(settings, selection, cwd) {
|
|
52
|
+
function runtimeForSelection(settings, selection, cwd, reasoningOverride) {
|
|
50
53
|
const baseURL = selection.provider.url;
|
|
51
54
|
const providerKind = selection.provider.kind;
|
|
52
55
|
const configuredKey = providerKind === 'chatgpt-codex' ? undefined : selection.provider.key ?? settings.apiKey;
|
|
@@ -56,7 +59,13 @@ function runtimeForSelection(settings, selection, cwd) {
|
|
|
56
59
|
const cacheSeed = cwd ?? process.cwd();
|
|
57
60
|
const cacheKey = crypto.createHash('sha256').update(`${cacheSeed}\0${name}`).digest('hex').slice(0, 32);
|
|
58
61
|
const caps = capabilities(selection.provider.name, baseURL, providerKind);
|
|
59
|
-
|
|
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);
|
|
60
69
|
const reasoningPolicy = resolveReasoningPolicy({ requested: requestedReasoning, capabilities: caps });
|
|
61
70
|
const openai = providerKind === 'chatgpt-codex'
|
|
62
71
|
? createOpenAI({ apiKey: OAUTH_SDK_SENTINEL, baseURL, fetch: createChatGptCodexFetch(selection.provider.name) })
|
|
@@ -64,15 +73,22 @@ function runtimeForSelection(settings, selection, cwd) {
|
|
|
64
73
|
const limits = modelLimitsFor(selection.provider, name);
|
|
65
74
|
// Class-aware fallback so unknown local models (server-configured window,
|
|
66
75
|
// silent truncation) stay conservative while unknown hosted models get the
|
|
67
|
-
// modern 128K floor.
|
|
68
|
-
//
|
|
69
|
-
//
|
|
76
|
+
// modern 128K floor. The curated catalog (Pillar 1.8) fills known families
|
|
77
|
+
// before any fallback; local servers never consult it because their
|
|
78
|
+
// effective window is server-configured. A user-set fallback setting
|
|
79
|
+
// overrides the built-in default; the source tag distinguishes an
|
|
80
|
+
// intentional guess (no warning) from the default guess (warned once per
|
|
81
|
+
// session) (RH-005).
|
|
70
82
|
const isLocal = isLocalProviderUrl(baseURL);
|
|
83
|
+
const catalog = isLocal ? undefined : catalogLimitsFor(name);
|
|
71
84
|
const userFallback = isLocal ? settings.localContextWindowFallbackTokens : settings.contextWindowFallbackTokens;
|
|
72
85
|
const fallbackTokens = userFallback ?? (isLocal ? FALLBACK_LOCAL_CONTEXT_TOKENS : FALLBACK_CONTEXT_WINDOW_TOKENS);
|
|
73
86
|
const contextWindowSource = limits.contextWindowTokens !== undefined
|
|
74
87
|
? 'settings'
|
|
75
|
-
:
|
|
88
|
+
: catalog
|
|
89
|
+
? 'catalog'
|
|
90
|
+
: userFallback !== undefined ? 'user-fallback' : 'default-fallback';
|
|
91
|
+
const maxOutputTokens = limits.maxOutputTokens ?? catalog?.maxOutputTokens;
|
|
76
92
|
return {
|
|
77
93
|
model: providerKind === 'chatgpt-codex' ? openai.responses(name) : openai.chat(name),
|
|
78
94
|
selector: modelSelector(selection.provider, name),
|
|
@@ -84,9 +100,9 @@ function runtimeForSelection(settings, selection, cwd) {
|
|
|
84
100
|
cacheKey,
|
|
85
101
|
capabilities: caps,
|
|
86
102
|
reasoningPolicy,
|
|
87
|
-
contextWindowTokens: limits.contextWindowTokens ?? fallbackTokens,
|
|
103
|
+
contextWindowTokens: limits.contextWindowTokens ?? catalog?.contextWindowTokens ?? fallbackTokens,
|
|
88
104
|
contextWindowSource,
|
|
89
|
-
...(
|
|
105
|
+
...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
|
|
90
106
|
},
|
|
91
107
|
};
|
|
92
108
|
}
|
|
@@ -102,9 +118,6 @@ function modelLimitsFor(provider, modelName) {
|
|
|
102
118
|
out.maxOutputTokens = limits.maxOutputTokens;
|
|
103
119
|
return out;
|
|
104
120
|
}
|
|
105
|
-
function isReasoningLevel(value) {
|
|
106
|
-
return value === 'low' || value === 'medium' || value === 'high';
|
|
107
|
-
}
|
|
108
121
|
export async function modelWithConfig(session, settings) {
|
|
109
122
|
// Callers may pass pre-read settings so a turn performs a single settings
|
|
110
123
|
// read (CR-024); otherwise read fresh.
|
|
@@ -118,7 +131,7 @@ export async function modelWithConfig(session, settings) {
|
|
|
118
131
|
}
|
|
119
132
|
else
|
|
120
133
|
selection = activeModel(resolvedSettings);
|
|
121
|
-
return selection ? runtimeForSelection(resolvedSettings, selection, session?.cwd) : undefined;
|
|
134
|
+
return selection ? runtimeForSelection(resolvedSettings, selection, session?.cwd, session?.reasoningOverride) : undefined;
|
|
122
135
|
}
|
|
123
136
|
export async function resolveWorkerRuntime(input) {
|
|
124
137
|
const requested = input.selector?.trim();
|
|
@@ -132,11 +145,17 @@ export async function resolveWorkerRuntime(input) {
|
|
|
132
145
|
return { status: 'found', runtime: { model: selected.model, selector: selected.selector, providerName: selected.config.providerName, capabilities: selected.config.capabilities, requestOptions: providerRequestSettings(selected.config) } };
|
|
133
146
|
}
|
|
134
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;
|
|
135
153
|
if (config.providerKind === 'chatgpt-codex') {
|
|
136
154
|
return {
|
|
137
155
|
omitMaxOutputTokens: true,
|
|
138
156
|
providerOptions: { openai: { store: false, include: ['reasoning.encrypted_content'] } },
|
|
139
157
|
headers: { 'session-id': config.cacheKey },
|
|
158
|
+
...(reasoning ? { reasoning } : {}),
|
|
140
159
|
};
|
|
141
160
|
}
|
|
142
161
|
const caps = config.capabilities;
|
|
@@ -145,11 +164,10 @@ export function providerRequestSettings(config) {
|
|
|
145
164
|
openaiOptions.promptCacheKey = config.cacheKey;
|
|
146
165
|
if (caps.supportsTextVerbosity)
|
|
147
166
|
openaiOptions.textVerbosity = 'low';
|
|
148
|
-
if (config.reasoningPolicy.effective !== 'disabled')
|
|
149
|
-
openaiOptions.reasoningEffort = config.reasoningPolicy.effective;
|
|
150
167
|
const providerOptions = Object.keys(openaiOptions).length > 0 ? { openai: openaiOptions } : undefined;
|
|
151
168
|
return {
|
|
152
169
|
...(providerOptions ? { providerOptions } : {}),
|
|
153
170
|
...(caps.supportsStickySessionId ? { headers: { 'x-session-id': config.cacheKey } } : {}),
|
|
171
|
+
...(reasoning ? { reasoning } : {}),
|
|
154
172
|
};
|
|
155
173
|
}
|