@denizokcu/haze 1.7.1 → 1.7.8

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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.8 - 2026-11-04
4
+
5
+ ### Changed
6
+
7
+ - Update compatibility with current model deployments while preserving support for earlier deployments.
8
+ - Preserve explicitly configured trusted deployment identities.
9
+
10
+ ## 1.7.5 - 2026-11-02
11
+
12
+ ### Changed
13
+
14
+ - Improve recovery from malformed tool inputs and preserve actionable diagnostics.
15
+ - Add bounded jitter and server-directed delay to transient provider retries.
16
+
17
+ ## 1.7.2 - 2026-10-31
18
+
19
+ ### Changed
20
+
21
+ - Update the AI SDK and development tooling to their latest compatible patch versions.
22
+ - Generate the public homepage and documentation with Astro components while preserving existing URLs.
23
+
3
24
  ## 1.7.1 - 2026-10-31
4
25
 
5
26
  ### Fixed
package/README.md CHANGED
@@ -4,7 +4,19 @@ A minimal LLM harness for your terminal.
4
4
 
5
5
  [![Known Vulnerabilities](https://snyk.io/test/github/DenizOkcu/haze/badge.svg)](https://snyk.io/test/github/DenizOkcu/haze)
6
6
 
7
- ## What's new in 1.7.1
7
+ ## What's new in 1.7.8
8
+
9
+ This release improves compatibility with updated model deployments and preserves explicitly configured deployment trust.
10
+
11
+ ### Changes in 1.7.5
12
+
13
+ Improved recovery from malformed tool calls and more resilient retry handling for temporary provider errors.
14
+
15
+ ### Changes in 1.7.2
16
+
17
+ This patch updates the AI SDK and development tooling, and moves the public website and documentation to maintainable Astro components.
18
+
19
+ ### Changes in 1.7.1
8
20
 
9
21
  This patch updates a provider preset's default endpoint.
10
22
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "1.7.1",
4
- "commit": "c2dce047adbd9c8e287e08133a2f1267bb110c2c",
5
- "builtAt": "2026-10-31T20:08:52.695Z"
3
+ "version": "1.7.8",
4
+ "commit": "2c47ff34529c466a2dfd4791039a84bfb733f072",
5
+ "builtAt": "2026-11-04T20:07:24.190Z"
6
6
  }
@@ -127,7 +127,7 @@ export function providerSetImageCapable(settings, providerName, enabled) {
127
127
  if (!provider)
128
128
  return { message: 'No provider selected.' };
129
129
  if (enabled && provider.kind === 'haze-build')
130
- return { provider, message: 'haze.build haze0.1-coder-flash is text/tools only; images are not supported.' };
130
+ return { provider, message: 'haze.build haze1.5-builder-flash is text/tools only; images are not supported.' };
131
131
  const capabilities = { ...(provider.capabilities ?? {}), images: enabled };
132
132
  return {
133
133
  provider,
@@ -7,7 +7,7 @@ import { checkKindsOfIds, deriveValidationOutcome, redPairStatus, unresolvedFail
7
7
  import { withoutRejectedAssistantFinal } from '../../../core/agent/requestAssembly.js';
8
8
  import { buildIncompleteGoalResume, taskCountsOf } from './goalCheckpoint.js';
9
9
  import { formatSeconds } from '../../../utils/format.js';
10
- import { retryDelayMs } from './turnRuntime.js';
10
+ import { retryDelayMs, transientRetryDelayMs } from './turnRuntime.js';
11
11
  import { salvageConversationToLastStep } from './stallRecovery.js';
12
12
  import { formatIdleMinutes } from '../../../utils/format.js';
13
13
  /**
@@ -72,7 +72,7 @@ export function finalizeAttemptOutcome(deps) {
72
72
  const classification = classifyTerminalOutcome(turnState, completionEvidence);
73
73
  const turnStatus = terminalTurnStatus({ aborted: false, assistantText: stream.assistantText, sawToolCall: stream.sawToolCall, lastToolOk: stream.lastToolOk, lastFailedToolWasValidation: stream.lastFailedToolWasValidation, finishReason: stream.finishReason, budgetReached: turnState.budgetBoundary, unresolvedToolInputError: stream.unresolvedToolInputError, intent: turnState.intent, mutationCount: turnState.mutationCount, validationOutcome: turnState.validationOutcome, taskProgress: turnState.taskProgress, requiresTaskLedger: turnState.requiresTaskLedger, ...(turnState.redPair ? { redPair: turnState.redPair } : {}) });
74
74
  if (stream.unresolvedMalformedToolName)
75
- callbacks.addMessage({ role: 'system', text: `${stream.unresolvedMalformedToolName} did not execute because its generated input remained invalid or truncated. The requested work is incomplete.` });
75
+ callbacks.addMessage({ role: 'system', text: `${stream.unresolvedMalformedToolName} did not execute because its generated input remained invalid or truncated${stream.unresolvedMalformedToolProblem ? ` — ${stream.unresolvedMalformedToolProblem}` : ''}. The requested work is incomplete.` });
76
76
  goal.phase = 'done';
77
77
  // Non-error overflow recovery (Pillar 1.2/1.4): a silent overflow completed
78
78
  // its response, so compact only — the next physical turn (or the supervisor)
@@ -265,7 +265,7 @@ export function handleAttemptFailure(deps) {
265
265
  // Transient model errors share the bounded retry pool with idle-stream
266
266
  // stalls, so a turn can never retry more than its configured total.
267
267
  if (retryAttempt < maxRetries && isRetryableModelError(error)) {
268
- const delay = retryDelayMs(retryAttempt, retryBaseDelayMs);
268
+ const delay = transientRetryDelayMs(retryAttempt, retryBaseDelayMs, error);
269
269
  callbacks.onEvent?.(agentEvent({ type: 'retry', attempt: retryAttempt + 1, maxAttempts: maxRetries, delayMs: delay, error: text }));
270
270
  callbacks.addMessage({ role: 'system', text: `Transient model error; retrying attempt ${retryAttempt + 1}/${maxRetries} in ${formatSeconds(delay)}: ${text}` });
271
271
  return { status: 'failed', retry: { attempt: retryAttempt + 1, delayMs: delay } };
@@ -7,7 +7,7 @@ import { scopedContextMessage } from '../../../config/contextFiles.js';
7
7
  import { latestRepeatedToolNames, toolOnlyStepCount } from '../../../core/agent/turnPolicy.js';
8
8
  import { RESCUE_BOUNDARY } from '../../../core/agent/completionController.js';
9
9
  import { MAIN_TOOL_CALL_LIMIT, REPEATED_TOOL_NUDGE_LIMIT, WRITE_FILE_CHUNK_BYTES } from '../../../core/agent/budgets.js';
10
- import { clampOutOfBoundsToolNumbers, isMalformedToolInputError } from './toolCallRecovery.js';
10
+ import { clampOutOfBoundsToolNumbers, describeToolInputProblem, isMalformedToolInputError } from './toolCallRecovery.js';
11
11
  /**
12
12
  * Late-discovered scoped AGENTS.md/CLAUDE.md content rides an ordinary user
13
13
  * message with the standard `<project_instructions>` framing — never the
@@ -32,8 +32,14 @@ export function createRepairToolCall(deps) {
32
32
  callbacks.debugLog(`clamped out-of-range numeric input for ${toolCall.toolName}; executing repaired call`);
33
33
  return { type: 'tool-call', toolCallId: toolCall.toolCallId, toolName: toolCall.toolName, input: JSON.stringify(clamped) };
34
34
  }
35
+ // Name the exact defect in the forced-retry instruction: the generic
36
+ // "invalid or truncated" wording was ignored 19 consecutive times while a
37
+ // model dropped readFile's required `path` (observed 2026-10-31 session d5fe72).
38
+ const problem = await describeToolInputProblem(toolCall.input, toolCall.toolName, error, inputSchema);
35
39
  loopState.pendingMalformedToolName = toolCall.toolName;
40
+ loopState.pendingMalformedToolProblem = problem;
36
41
  loopState.unresolvedMalformedToolName = toolCall.toolName;
42
+ loopState.unresolvedMalformedToolProblem = problem;
37
43
  }
38
44
  // Truncated generated file content cannot be reconstructed safely here;
39
45
  // let the next agent step retry under the bounded tool-choice constraint.
@@ -89,10 +95,12 @@ export function createPrepareStep(deps) {
89
95
  if (loopState.pendingMalformedToolName && loopState.pendingMalformedToolName in sliceTools) {
90
96
  const toolName = loopState.pendingMalformedToolName;
91
97
  const attempt = loopState.malformedRecoveryAttempts.get(String(toolName)) ?? 0;
98
+ const problem = loopState.pendingMalformedToolProblem;
92
99
  loopState.pendingMalformedToolName = undefined;
100
+ loopState.pendingMalformedToolProblem = undefined;
93
101
  if (attempt >= 2) {
94
102
  callbacks.debugLog(`malformed ${String(toolName)} recovery exhausted`);
95
- return { toolChoice: 'none', messages: appendSyntheticControl(scopedMessages, `The ${String(toolName)} input remained invalid after two smaller retries. Report this as blocked; do not promise another retry or claim completion.`) };
103
+ return { toolChoice: 'none', messages: appendSyntheticControl(scopedMessages, `The ${String(toolName)} input remained invalid after two smaller retries${problem ? ` — ${problem}` : ''}. Report this as blocked; do not promise another retry or claim completion.`) };
96
104
  }
97
105
  loopState.malformedRecoveryAttempts.set(String(toolName), attempt + 1);
98
106
  callbacks.debugLog(`forcing smaller retry after malformed ${String(toolName)} input`);
@@ -101,7 +109,7 @@ export function createPrepareStep(deps) {
101
109
  // required) and reject the object form with HTTP 400. Narrowing to a
102
110
  // single active tool plus 'required' preserves the forced-call
103
111
  // semantics on every server.
104
- return { activeTools: [toolName], toolChoice: 'required', messages: appendSyntheticControl(scopedMessages, malformedToolCallPrompt(String(toolName), WRITE_FILE_CHUNK_BYTES)) };
112
+ return { activeTools: [toolName], toolChoice: 'required', messages: appendSyntheticControl(scopedMessages, malformedToolCallPrompt(String(toolName), WRITE_FILE_CHUNK_BYTES, problem)) };
105
113
  }
106
114
  if (loopState.toolResultState.editRecoveryPath && !loopState.toolResultState.editRecoveryReadSatisfied) {
107
115
  // Instruct, do not restrict: the execution-time gate in toolContext
@@ -29,7 +29,11 @@ export interface AttemptLoopState {
29
29
  earlyValidationNudgeIssued: boolean;
30
30
  sawToolCall: boolean;
31
31
  pendingMalformedToolName: string | undefined;
32
+ /** Targeted diagnosis for the pending malformed-tool retry (missing/wrong-typed parameters); undefined keeps the generic wording. */
33
+ pendingMalformedToolProblem: string | undefined;
32
34
  unresolvedMalformedToolName: string | undefined;
35
+ /** Last known diagnosis for the unresolved malformed tool; rides the turn-end system note so later turns see the exact defect. */
36
+ unresolvedMalformedToolProblem: string | undefined;
33
37
  /** Per-attempt (not per-turn) recovery counter: a transient retry gets a fresh map. Bounded across the whole turn by MAIN_TOOL_CALL_LIMIT. */
34
38
  malformedRecoveryAttempts: Map<string, number>;
35
39
  toolResultState: ToolResultState;
@@ -70,6 +74,7 @@ export interface AttemptStreamOutcome {
70
74
  assistantText: string;
71
75
  sawToolCall: boolean;
72
76
  unresolvedMalformedToolName: string | undefined;
77
+ unresolvedMalformedToolProblem: string | undefined;
73
78
  unresolvedToolInputError: boolean;
74
79
  /**
75
80
  * Non-error context overflow detected from usage (Pillar 1.2): `silent`
@@ -31,7 +31,9 @@ export function createAttemptLoopState(previousAssistantText, contextFiles, call
31
31
  earlyValidationNudgeIssued: false,
32
32
  sawToolCall: false,
33
33
  pendingMalformedToolName: undefined,
34
+ pendingMalformedToolProblem: undefined,
34
35
  unresolvedMalformedToolName: undefined,
36
+ unresolvedMalformedToolProblem: undefined,
35
37
  malformedRecoveryAttempts: new Map(),
36
38
  toolResultState: initialToolResultState(),
37
39
  inFlightTools: new Set(),
@@ -467,6 +469,7 @@ export async function runAttemptStream(deps) {
467
469
  assistantText: loopState.assistantText,
468
470
  sawToolCall: loopState.sawToolCall,
469
471
  unresolvedMalformedToolName: loopState.unresolvedMalformedToolName,
472
+ unresolvedMalformedToolProblem: loopState.unresolvedMalformedToolProblem,
470
473
  unresolvedToolInputError: loopState.unresolvedMalformedToolName != null,
471
474
  usageOverflow,
472
475
  };
@@ -14,3 +14,20 @@ export type ToolInputSchemaResolver = (options: {
14
14
  export declare function clampOutOfBoundsToolNumbers(input: unknown, toolName: string, resolveSchema: ToolInputSchemaResolver): Promise<Record<string, unknown> | null>;
15
15
  /** Identifies tool-input failures that are safe to send back to the model for a smaller retry. */
16
16
  export declare function isMalformedToolInputError(error: unknown): boolean;
17
+ /**
18
+ * Concise diagnosis of why a tool input failed validation, derived from the
19
+ * error's Zod issues alone — e.g. "the input omitted the required parameter
20
+ * `path`". Used where no tool schema resolver is available (streamed tool-error
21
+ * parts). Undefined when the error carries no structured issues.
22
+ */
23
+ export declare function toolInputProblemFromError(error: unknown): string | undefined;
24
+ /**
25
+ * Diagnosis for the forced malformed-retry prompt: names the exact defect
26
+ * (omitted required parameters, wrong value types) instead of the generic
27
+ * "invalid or truncated" wording, which models ignored 19 times in a row while
28
+ * dropping readFile's `path` (observed 2026-10-31 session d5fe72). Prefers the
29
+ * error's structured Zod issues; falls back to diffing the emitted input keys
30
+ * against the tool's JSON schema. Undefined when neither yields a diagnosis —
31
+ * callers then keep the generic wording.
32
+ */
33
+ export declare function describeToolInputProblem(input: unknown, toolName: string, error: unknown, resolveSchema?: ToolInputSchemaResolver): Promise<string | undefined>;
@@ -38,16 +38,8 @@ function numericBoundsFor(schema, key) {
38
38
  * untouched so genuinely malformed input still takes the forced-retry path.
39
39
  */
40
40
  export async function clampOutOfBoundsToolNumbers(input, toolName, resolveSchema) {
41
- let value = input;
42
- if (typeof value === 'string') {
43
- try {
44
- value = JSON.parse(value);
45
- }
46
- catch {
47
- return null;
48
- }
49
- }
50
- if (value == null || typeof value !== 'object' || Array.isArray(value))
41
+ const parsed = parseInputObject(input);
42
+ if (!parsed)
51
43
  return null;
52
44
  let schema;
53
45
  try {
@@ -56,7 +48,7 @@ export async function clampOutOfBoundsToolNumbers(input, toolName, resolveSchema
56
48
  catch {
57
49
  return null;
58
50
  }
59
- const repaired = { ...value };
51
+ const repaired = { ...parsed };
60
52
  let changed = false;
61
53
  for (const [key, entry] of Object.entries(repaired)) {
62
54
  if (typeof entry !== 'number' || !Number.isFinite(entry))
@@ -78,3 +70,138 @@ export function isMalformedToolInputError(error) {
78
70
  const text = errorFragments(error).join(' ');
79
71
  return /AI_(?:JSONParse|InvalidToolInput)Error|JSON parsing failed|Invalid input for tool|invalid tool input/i.test(text);
80
72
  }
73
+ /** Parses a tool-call input (stringified JSON or object) into a plain object; null when not a JSON object. */
74
+ function parseInputObject(input) {
75
+ let value = input;
76
+ if (typeof value === 'string') {
77
+ try {
78
+ value = JSON.parse(value);
79
+ }
80
+ catch {
81
+ return null;
82
+ }
83
+ }
84
+ if (value == null || typeof value !== 'object' || Array.isArray(value))
85
+ return null;
86
+ return value;
87
+ }
88
+ /**
89
+ * Extracts Zod-style validation issues from an AI SDK tool-input error's cause
90
+ * chain (InvalidToolInputError → TypeValidationError → ZodError.issues). Zod 4
91
+ * folds the received type into the message ("…received undefined") instead of a
92
+ * `received` issue field, so both shapes are normalized here.
93
+ */
94
+ function toolInputIssuesFromError(error) {
95
+ let node = error;
96
+ for (let depth = 0; depth < 5 && node != null; depth += 1) {
97
+ if (typeof node !== 'object')
98
+ return undefined;
99
+ const record = node;
100
+ if (Array.isArray(record.issues)) {
101
+ const issues = [];
102
+ for (const entry of record.issues) {
103
+ if (entry == null || typeof entry !== 'object')
104
+ continue;
105
+ const issue = entry;
106
+ const path = Array.isArray(issue.path)
107
+ ? issue.path.filter(segment => typeof segment === 'string' || typeof segment === 'number').join('.')
108
+ : undefined;
109
+ if (path == null || path === '')
110
+ continue;
111
+ let received = typeof issue.received === 'string' ? issue.received : undefined;
112
+ if (received == null && typeof issue.message === 'string')
113
+ received = /received (\w+)/.exec(issue.message)?.[1];
114
+ issues.push({ path, expected: typeof issue.expected === 'string' ? issue.expected : undefined, received });
115
+ }
116
+ if (issues.length > 0)
117
+ return issues;
118
+ }
119
+ node = record.cause;
120
+ }
121
+ return undefined;
122
+ }
123
+ const MAX_LISTED_MISMATCHES = 3;
124
+ function quotedList(values) {
125
+ return values.map(value => `\`${value}\``).join(', ');
126
+ }
127
+ function describeProblemParts(parts) {
128
+ const clauses = [];
129
+ if (parts.missing.length > 0) {
130
+ clauses.push(parts.missing.length === 1
131
+ ? `the input omitted the required parameter ${quotedList(parts.missing)}`
132
+ : `the input omitted the required parameters ${quotedList(parts.missing)}`);
133
+ }
134
+ if (parts.mismatches.length > 0) {
135
+ const listed = parts.mismatches.slice(0, MAX_LISTED_MISMATCHES).map(m => `\`${m.path}\` expects ${m.expected} but received ${m.received}`);
136
+ const extra = parts.mismatches.length > MAX_LISTED_MISMATCHES ? ` (and ${parts.mismatches.length - MAX_LISTED_MISMATCHES} more)` : '';
137
+ clauses.push(`${listed.join('; ')}${extra}`);
138
+ }
139
+ return clauses.length > 0 ? clauses.join('; ') : undefined;
140
+ }
141
+ /**
142
+ * Concise diagnosis of why a tool input failed validation, derived from the
143
+ * error's Zod issues alone — e.g. "the input omitted the required parameter
144
+ * `path`". Used where no tool schema resolver is available (streamed tool-error
145
+ * parts). Undefined when the error carries no structured issues.
146
+ */
147
+ export function toolInputProblemFromError(error) {
148
+ const issues = toolInputIssuesFromError(error);
149
+ if (!issues)
150
+ return undefined;
151
+ const missing = [...new Set(issues.filter(issue => issue.received === 'undefined').map(issue => issue.path))];
152
+ const mismatches = issues
153
+ .filter(issue => issue.expected != null && issue.received != null && issue.received !== 'undefined' && issue.expected !== issue.received)
154
+ .map(issue => ({ path: issue.path, expected: issue.expected, received: issue.received }));
155
+ return describeProblemParts({ missing, mismatches });
156
+ }
157
+ /** Diff of an emitted tool-call input against the tool's JSON schema (fallback when the error carries no issues). */
158
+ async function schemaProblemParts(input, toolName, resolveSchema) {
159
+ let schema;
160
+ try {
161
+ schema = await resolveSchema({ toolName });
162
+ }
163
+ catch {
164
+ return undefined;
165
+ }
166
+ const { required, properties } = (schema ?? {});
167
+ const missing = Array.isArray(required)
168
+ ? [...new Set(required.filter((key) => typeof key === 'string' && input[key] === undefined))]
169
+ : [];
170
+ const mismatches = [];
171
+ if (properties != null && typeof properties === 'object' && !Array.isArray(properties)) {
172
+ for (const [key, declared] of Object.entries(properties)) {
173
+ const value = input[key];
174
+ if (value === undefined)
175
+ continue;
176
+ const type = declared?.type;
177
+ const expected = type === 'integer' ? 'number' : type;
178
+ if (expected !== 'string' && expected !== 'number' && expected !== 'boolean')
179
+ continue;
180
+ const received = typeof value;
181
+ if (received !== expected)
182
+ mismatches.push({ path: key, expected, received });
183
+ }
184
+ }
185
+ return missing.length > 0 || mismatches.length > 0 ? { missing, mismatches } : undefined;
186
+ }
187
+ /**
188
+ * Diagnosis for the forced malformed-retry prompt: names the exact defect
189
+ * (omitted required parameters, wrong value types) instead of the generic
190
+ * "invalid or truncated" wording, which models ignored 19 times in a row while
191
+ * dropping readFile's `path` (observed 2026-10-31 session d5fe72). Prefers the
192
+ * error's structured Zod issues; falls back to diffing the emitted input keys
193
+ * against the tool's JSON schema. Undefined when neither yields a diagnosis —
194
+ * callers then keep the generic wording.
195
+ */
196
+ export async function describeToolInputProblem(input, toolName, error, resolveSchema) {
197
+ const fromError = toolInputProblemFromError(error);
198
+ if (fromError)
199
+ return fromError;
200
+ if (!resolveSchema)
201
+ return undefined;
202
+ const parsed = parseInputObject(input);
203
+ if (!parsed)
204
+ return undefined;
205
+ const parts = await schemaProblemParts(parsed, toolName, resolveSchema);
206
+ return parts ? describeProblemParts(parts) : undefined;
207
+ }
@@ -6,7 +6,7 @@ import { isDuplicateSkippedOutput, safeToolFailureDetails, toolOutputOk } from '
6
6
  import { validationSummaryFromOutput } from '../../../core/agent/workState.js';
7
7
  import { toolResultSummary } from '../formatters.js';
8
8
  import { toolDiffFromResult } from './toolGroupRenderer.js';
9
- import { isMalformedToolInputError } from './toolCallRecovery.js';
9
+ import { isMalformedToolInputError, toolInputProblemFromError } from './toolCallRecovery.js';
10
10
  import { logEntry, rememberContextFilesFromToolOutput, subagentTokenEstimate } from './turnRuntime.js';
11
11
  function releaseCompletedToolCall(loopState, toolCallId) {
12
12
  // The exact protocol message remains in provider history; display state has
@@ -58,8 +58,10 @@ export function handleToolResultPart(deps, part) {
58
58
  // the completion gates; a failed edit/write stays a hard tool failure even
59
59
  // when an earlier check also failed.
60
60
  loopState.lastFailedToolWasValidation = !ok && toolName === 'shell' && validationSummaryFromOutput(part.output) != null;
61
- if (ok && part.toolName === loopState.unresolvedMalformedToolName)
61
+ if (ok && part.toolName === loopState.unresolvedMalformedToolName) {
62
62
  loopState.unresolvedMalformedToolName = undefined;
63
+ loopState.unresolvedMalformedToolProblem = undefined;
64
+ }
63
65
  const finish = { toolCall, success: ok, output: part.output, durationMs: Date.now() - startedAt };
64
66
  const item = toolDisplay.ensureToolItem(toolCall);
65
67
  item.status = ok ? 'success' : 'error';
@@ -94,6 +96,14 @@ export function handleToolErrorPart(deps, part) {
94
96
  loopState.lastToolOk = false;
95
97
  loopState.lastFailedToolWasValidation = false;
96
98
  if (isMalformedToolInputError(part.error)) {
99
+ // The repair hook already stored a schema-aware diagnosis for this call;
100
+ // this streamed-part path only sees the error, so derive from its Zod
101
+ // issues when possible and keep the hook's diagnosis otherwise.
102
+ const problem = toolInputProblemFromError(part.error);
103
+ if (problem != null || part.toolName !== loopState.unresolvedMalformedToolName) {
104
+ loopState.pendingMalformedToolProblem = problem;
105
+ loopState.unresolvedMalformedToolProblem = problem;
106
+ }
97
107
  loopState.pendingMalformedToolName = toolName;
98
108
  loopState.unresolvedMalformedToolName = toolName;
99
109
  }
@@ -17,6 +17,8 @@ export interface TokenUsage {
17
17
  effectiveNonCachedInput: number | undefined;
18
18
  }
19
19
  export declare function retryDelayMs(attempt: number, baseDelayMs?: number): number;
20
+ /** Jitter transient retries and honor bounded provider guidance when present. */
21
+ export declare function transientRetryDelayMs(attempt: number, baseDelayMs: number, error: unknown, random?: () => number, now?: number): number;
20
22
  /** Append one entry to the per-turn LLM log when file logging is enabled; never blocks the turn. */
21
23
  export declare function logEntry(log: LlmLog | undefined, entry: LlmLogEntry): void;
22
24
  export declare function abortableDelay(milliseconds: number, signal: AbortSignal): Promise<void>;
@@ -5,6 +5,22 @@ import { DEFAULT_RETRY_BASE_DELAY_MS } from '../../../core/agent/budgets.js';
5
5
  export function retryDelayMs(attempt, baseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS) {
6
6
  return Math.min(baseDelayMs * 4, baseDelayMs * 2 ** attempt);
7
7
  }
8
+ /** Jitter transient retries and honor bounded provider guidance when present. */
9
+ export function transientRetryDelayMs(attempt, baseDelayMs, error, random = Math.random, now = Date.now()) {
10
+ const backoff = retryDelayMs(attempt, baseDelayMs);
11
+ let retryAfter = 0;
12
+ if (error && typeof error === 'object' && 'responseHeaders' in error) {
13
+ const headers = error.responseHeaders;
14
+ if (headers && typeof headers === 'object') {
15
+ const value = headers instanceof Headers ? headers.get('retry-after') : Object.entries(headers).find(([key]) => key.toLowerCase() === 'retry-after')?.[1];
16
+ if (typeof value === 'string') {
17
+ const seconds = Number(value);
18
+ retryAfter = Number.isFinite(seconds) && seconds >= 0 ? seconds * 1000 : Math.max(0, Date.parse(value) - now) || 0;
19
+ }
20
+ }
21
+ }
22
+ return Math.min(60_000, Math.max(retryAfter, Math.round(backoff * (0.5 + random() * 0.5))));
23
+ }
8
24
  /** Append one entry to the per-turn LLM log when file logging is enabled; never blocks the turn. */
9
25
  export function logEntry(log, entry) {
10
26
  if (log)
@@ -1,15 +1,18 @@
1
1
  import { z } from 'zod';
2
2
  import type { HazeProviderSettings } from './settings.js';
3
3
  export declare const HAZE_BUILD_PROVIDER = "haze.build";
4
- export declare const HAZE_BUILD_MODEL = "haze0.1-coder-flash";
4
+ export declare const HAZE_BUILD_MODEL = "haze1.5-builder-flash";
5
5
  export declare const hazeBuildManifestSchema: z.ZodObject<{
6
6
  schemaVersion: z.ZodLiteral<1>;
7
7
  provider: z.ZodLiteral<"haze.build">;
8
- model: z.ZodLiteral<"haze0.1-coder-flash">;
9
- modelRepository: z.ZodLiteral<"cyankiwi/Qwen3.6-35B-A3B-AWQ-4bit">;
10
- modelRevision: z.ZodLiteral<"f1e8415c4f29508fe281da4e256df26573213bfd">;
11
- templateSha256: z.ZodLiteral<"e84f32a23fdda27689f868aa4a1a5621f41133e51a48d7f3efcbea2839574259">;
12
- runtimeVersion: z.ZodLiteral<"0.32.0">;
8
+ model: z.ZodEnum<{
9
+ "haze1.5-builder-flash": "haze1.5-builder-flash";
10
+ "haze0.1-coder-flash": "haze0.1-coder-flash";
11
+ }>;
12
+ modelRepository: z.ZodString;
13
+ modelRevision: z.ZodString;
14
+ templateSha256: z.ZodString;
15
+ runtimeVersion: z.ZodString;
13
16
  sourceRevision: z.ZodString;
14
17
  scheduler: z.ZodObject<{
15
18
  maxBatchedTokens: z.ZodNumber;
@@ -29,6 +32,7 @@ export declare const hazeBuildManifestSchema: z.ZodObject<{
29
32
  baseline: "baseline";
30
33
  ngram: "ngram";
31
34
  mtp: "mtp";
35
+ dflash: "dflash";
32
36
  }>;
33
37
  capabilities: z.ZodObject<{
34
38
  text: z.ZodLiteral<true>;
@@ -40,4 +44,4 @@ export declare const hazeBuildManifestSchema: z.ZodObject<{
40
44
  }, z.core.$strip>;
41
45
  export type HazeBuildManifest = z.infer<typeof hazeBuildManifestSchema>;
42
46
  /** Refreshed per attempt: a mutable endpoint alias must never imply stale capacity. */
43
- export declare function discoverHazeBuildManifest(provider: Pick<HazeProviderSettings, 'url' | 'key'>, fetchImpl?: typeof fetch): Promise<HazeBuildManifest>;
47
+ export declare function discoverHazeBuildManifest(provider: Pick<HazeProviderSettings, 'url' | 'key' | 'trustedDeployments'>, fetchImpl?: typeof fetch): Promise<HazeBuildManifest>;
@@ -1,24 +1,30 @@
1
1
  import { z } from 'zod';
2
2
  import { assertCredentialedEndpointSecure } from './endpointSecurity.js';
3
3
  export const HAZE_BUILD_PROVIDER = 'haze.build';
4
- export const HAZE_BUILD_MODEL = 'haze0.1-coder-flash';
4
+ export const HAZE_BUILD_MODEL = 'haze1.5-builder-flash';
5
5
  export const hazeBuildManifestSchema = z.object({
6
6
  schemaVersion: z.literal(1),
7
7
  provider: z.literal(HAZE_BUILD_PROVIDER),
8
- model: z.literal(HAZE_BUILD_MODEL),
9
- modelRepository: z.literal('cyankiwi/Qwen3.6-35B-A3B-AWQ-4bit'),
10
- modelRevision: z.literal('f1e8415c4f29508fe281da4e256df26573213bfd'),
11
- templateSha256: z.literal('e84f32a23fdda27689f868aa4a1a5621f41133e51a48d7f3efcbea2839574259'),
12
- runtimeVersion: z.literal('0.32.0'),
8
+ model: z.enum([HAZE_BUILD_MODEL, 'haze0.1-coder-flash']),
9
+ modelRepository: z.string().min(1).max(256),
10
+ modelRevision: z.string().regex(/^[a-f0-9]{40}$/),
11
+ templateSha256: z.string().regex(/^[a-f0-9]{64}$/),
12
+ runtimeVersion: z.string().regex(/^\d+\.\d+\.\d+$/),
13
13
  sourceRevision: z.string().regex(/^(?:[a-f0-9]{40}|unrecorded)$/),
14
- scheduler: z.object({ maxBatchedTokens: z.number().int().min(256).max(8192), gpuMemoryUtilization: z.number().min(0.5).max(0.95), cpuOffloadGb: z.number().min(0).max(12), eager: z.boolean() }),
14
+ scheduler: z.object({ maxBatchedTokens: z.number().int().min(256).max(16384), gpuMemoryUtilization: z.number().min(0.5).max(0.95), cpuOffloadGb: z.number().min(0).max(12), eager: z.boolean() }),
15
15
  contextWindowTokens: z.number().int().min(4096).max(262144),
16
16
  maxOutputTokens: z.number().int().min(256).max(32768),
17
- activeSequences: z.number().int().min(1).max(4),
17
+ activeSequences: z.number().int().min(1).max(8),
18
18
  servingProfile: z.enum(['quality', 'concurrent', 'full-context']),
19
- decodeProfile: z.enum(['baseline', 'ngram', 'mtp']),
19
+ decodeProfile: z.enum(['baseline', 'ngram', 'mtp', 'dflash']),
20
20
  capabilities: z.object({ text: z.literal(true), tools: z.literal(true), images: z.literal(false), thinking: z.literal('binary'), preserveThinking: z.literal(true) }),
21
21
  });
22
+ const DEFAULT_DEPLOYMENTS = [{ modelRepository: 'ornith-ai/Ornith-1.5-35B-A3B-FP8',
23
+ modelRevision: 'b93dbd8128d3d2e6655b8570c992de97fc8ece6e',
24
+ templateSha256: '182e77dd83bd8e9ca818b240b82e28f243762cd5dda32e6eef327df7b1cd107e', runtimeVersion: '0.32.0' },
25
+ { modelRepository: 'cyankiwi/Qwen3.6-35B-A3B-AWQ-4bit',
26
+ modelRevision: 'f1e8415c4f29508fe281da4e256df26573213bfd',
27
+ templateSha256: 'e84f32a23fdda27689f868aa4a1a5621f41133e51a48d7f3efcbea2839574259', runtimeVersion: '0.32.0' }];
22
28
  /** Refreshed per attempt: a mutable endpoint alias must never imply stale capacity. */
23
29
  export async function discoverHazeBuildManifest(provider, fetchImpl = fetch) {
24
30
  if (!provider.key?.trim())
@@ -85,7 +91,10 @@ export async function discoverHazeBuildManifest(provider, fetchImpl = fetch) {
85
91
  }
86
92
  const parsed = hazeBuildManifestSchema.safeParse(payload);
87
93
  if (!parsed.success)
88
- throw new Error('Incompatible haze.build manifest. Expected contract v1, haze0.1-coder-flash, text/tools and binary thinking with preservation.');
94
+ throw new Error('Incompatible haze.build manifest. Expected contract v1, haze1.5-builder-flash, text/tools and binary thinking with preservation.');
95
+ const identities = [...DEFAULT_DEPLOYMENTS, ...(provider.trustedDeployments ?? [])];
96
+ if (!identities.some(identity => identity.modelRepository === parsed.data.modelRepository && identity.modelRevision === parsed.data.modelRevision && identity.templateSha256 === parsed.data.templateSha256 && identity.runtimeVersion === parsed.data.runtimeVersion))
97
+ throw new Error('Incompatible haze.build manifest: deployment identity is not trusted.');
89
98
  if (parsed.data.maxOutputTokens >= parsed.data.contextWindowTokens)
90
99
  throw new Error('Invalid haze.build output/context envelope.');
91
100
  return parsed.data;
@@ -24,7 +24,7 @@
24
24
  */
25
25
  const PRESET_DEFINITIONS = [
26
26
  { id: 'haze.build', name: 'haze.build', kind: 'haze-build',
27
- baseUrl: 'https://llm.haze.build/v1', category: 'cloud', models: ['haze0.1-coder-flash'],
27
+ baseUrl: 'https://llm.haze.build/v1', category: 'cloud', models: ['haze1.5-builder-flash'],
28
28
  apiKeyHint: 'your deployed haze.build inference key' },
29
29
  // ── Cloud providers (API key required) ──────────────────────────────
30
30
  {
@@ -28,6 +28,7 @@ function normalizeProvider(provider, fallbackModel) {
28
28
  ...(provider.kind ? { kind: provider.kind } : {}),
29
29
  ...(capabilities ? { capabilities } : {}),
30
30
  ...(provider.modelLimits ? { modelLimits: provider.modelLimits } : {}),
31
+ ...(provider.trustedDeployments ? { trustedDeployments: provider.trustedDeployments } : {}),
31
32
  models: normalizeModels(provider.models, fallbackModel),
32
33
  };
33
34
  }
@@ -27,6 +27,13 @@ export interface HazeProviderSettings {
27
27
  images?: boolean;
28
28
  reasoningEffort?: boolean;
29
29
  };
30
+ /** Additional exact deployment identities explicitly approved for this native provider. */
31
+ trustedDeployments?: Array<{
32
+ modelRepository: string;
33
+ modelRevision: string;
34
+ templateSha256: string;
35
+ runtimeVersion: string;
36
+ }>;
30
37
  /**
31
38
  * Optional per-model capacity metadata used for request budgeting (RH-005).
32
39
  * Absent entries fall back to a conservative default window. Preserved as
@@ -24,6 +24,7 @@ const providerSchema = z.object({
24
24
  models: z.array(z.string()),
25
25
  kind: z.enum(['openai-compatible', 'chatgpt-codex', 'haze-build']).optional(),
26
26
  capabilities: providerCapabilitiesSchema.optional(),
27
+ trustedDeployments: z.array(z.object({ modelRepository: z.string().min(1).max(256), modelRevision: z.string().regex(/^[a-f0-9]{40}$/), templateSha256: z.string().regex(/^[a-f0-9]{64}$/), runtimeVersion: z.string().regex(/^\d+\.\d+\.\d+$/) })).max(8).optional(),
27
28
  modelLimits: z.record(z.string(), z.object({ contextWindowTokens: z.number().int().positive(), maxOutputTokens: z.number().int().positive() }).partial()).optional(),
28
29
  }).passthrough();
29
30
  const lspServerSchema = z.object({
@@ -11,7 +11,7 @@ export function isRetryableModelError(error) {
11
11
  return false;
12
12
  // Status codes are matched as whole words so "15000 tokens" or "processed
13
13
  // 5000 files" are not misclassified (CR-020).
14
- if (/\b(?:400|401|403)\b/.test(text) || /quota|billing|balance|auth|api key|invalid request|permission|forbidden/.test(text))
14
+ if (/\b(?:400|401|403)\b/.test(text) || /quota|billing|balance|allowance.exhausted|auth|api key|invalid request|permission|forbidden/.test(text))
15
15
  return false;
16
16
  return /\b(?:429|500|502|503|504)\b/.test(text) || /overload|rate limit|network|connection|timeout|timed? out|terminated|econnreset|etimedout|fetch failed|stream disconnected|stream closed|stream aborted|stream error/.test(text);
17
17
  }
@@ -41,7 +41,7 @@ export declare function lengthContinuationPrompt(): string;
41
41
  * deliverable you already discovered, then one final tool-free synthesis.
42
42
  */
43
43
  export declare function completionRescuePrompt(): string;
44
- export declare function malformedToolCallPrompt(toolName: string, chunkBytes: number): string;
44
+ export declare function malformedToolCallPrompt(toolName: string, chunkBytes: number, problem?: string): string;
45
45
  /**
46
46
  * Ephemeral control for read-only edit recovery: a failed file mutation
47
47
  * requested a fresh read before any further mutation. Names the exact path
@@ -76,11 +76,13 @@ export function formatGoalStatus(goal) {
76
76
  }
77
77
  /** One-request direction for the active goal. The user request remains the source of truth. */
78
78
  export function goalDirectionPrompt(intent, compact) {
79
+ const scope = 'Follow the user’s requested scope in any language. A request to plan, review, or explain implementation authorizes that deliverable, not implementation itself. A task list is not permission to expand the request. If implementation was not requested, do not implement it.';
79
80
  if (intent === 'plan' || intent === 'review' || intent === 'answer')
80
- return '';
81
+ return scope;
81
82
  return [
83
+ scope,
82
84
  '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.',
85
+ 'When implementation is requested, 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
86
  '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
87
  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
88
  ].filter(Boolean).join(' ');
@@ -117,11 +119,12 @@ export function lengthContinuationPrompt() {
117
119
  export function completionRescuePrompt() {
118
120
  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.';
119
121
  }
120
- export function malformedToolCallPrompt(toolName, chunkBytes) {
122
+ export function malformedToolCallPrompt(toolName, chunkBytes, problem) {
121
123
  const chunkGuidance = toolName === 'writeFile'
122
124
  ? ` Keep content below ${chunkBytes} UTF-8 bytes per call: write the first chunk normally, then continue the same file with append=true.`
123
125
  : '';
124
- 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}`;
126
+ const diagnosis = problem ? ` Specific problem: ${problem}.` : '';
127
+ return `The ${toolName} call had invalid, malformed, or truncated JSON input and did not execute.${diagnosis} Retry it now with valid smaller arguments${problem ? ' that include every required parameter with the declared type' : ''}; do not merely announce that you will retry.${chunkGuidance}`;
125
128
  }
126
129
  /**
127
130
  * Ephemeral control for read-only edit recovery: a failed file mutation
@@ -154,5 +157,5 @@ export function goalContinuationPrompt(reason, taskCounts, detail) {
154
157
  ? ' Rerun the same validation command that failed before the edit and resolve it; a different check does not close the captured red evidence.'
155
158
  : '';
156
159
  const detailLine = detail ? ` ${detail}` : '';
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.`;
160
+ return `Continue the active goal: haze rejected stopping because structured evidence shows this turn is not complete (${reason}).${validationLine}${ledgerLine}${redLine}${detailLine} The user's original request defines the scope in any language. A task list cannot authorize work beyond that request; revise out-of-scope tasks rather than carrying them out. Resume the next authorized unfinished task.${taskLine} 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.`;
158
161
  }
@@ -271,7 +271,7 @@ export function imageCapabilityError(provider) {
271
271
  if (!provider)
272
272
  return 'No provider is configured. Run /provider to add one, then attach the image again.';
273
273
  if (provider.kind === 'haze-build')
274
- return 'haze.build haze0.1-coder-flash is text/tools only; images are not supported.';
274
+ return 'haze.build haze1.5-builder-flash is text/tools only; images are not supported.';
275
275
  if (provider.capabilities?.images === true)
276
276
  return undefined;
277
277
  return `Provider '${provider.name}' is not marked image-capable. Enable image input for it via /provider, or switch models.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "1.7.1",
3
+ "version": "1.7.8",
4
4
  "description": "A minimal LLM harness for your terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "@ai-sdk/openai-compatible": "3.0.82",
56
56
  "@inkjs/ui": "2.0.0",
57
57
  "@vscode/ripgrep": "1.18.0",
58
- "ai": "7.0.158",
58
+ "ai": "7.0.159",
59
59
  "commander": "15.0.0",
60
60
  "defuddle": "^0.19.6",
61
61
  "highlight.js": "^11.12.0",
@@ -74,7 +74,7 @@
74
74
  "@types/react": "19.3.0",
75
75
  "eslint": "^10.14.0",
76
76
  "ink-testing-library": "^4.0.0",
77
- "knip": "6.44.0",
77
+ "knip": "6.44.1",
78
78
  "strip-ansi": "7.2.0",
79
79
  "tsx": "4.23.15",
80
80
  "typescript": "6.0.3",