@denizokcu/haze 1.7.10 → 1.7.12
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 +25 -0
- package/README.md +125 -99
- package/assets/graph-grammars/NOTICE.md +21 -0
- package/assets/graph-grammars/tree-sitter-javascript.wasm +0 -0
- package/assets/graph-grammars/tree-sitter-tsx.wasm +0 -0
- package/assets/graph-grammars/tree-sitter-typescript.wasm +0 -0
- package/assets/graph-grammars/web-tree-sitter.cjs +4116 -0
- package/assets/graph-grammars/web-tree-sitter.cjs.map +7 -0
- package/assets/graph-grammars/web-tree-sitter.js +4056 -0
- package/assets/graph-grammars/web-tree-sitter.js.map +7 -0
- package/assets/graph-grammars/web-tree-sitter.wasm +0 -0
- package/assets/graph-grammars/web-tree-sitter.wasm.map +55 -0
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/BusyBar.d.ts +2 -1
- package/dist/cli/chat/BusyBar.js +2 -2
- package/dist/cli/chat/chatMetrics.d.ts +25 -0
- package/dist/cli/chat/chatMetrics.js +36 -0
- package/dist/cli/chat/inputSuggestions.js +1 -0
- package/dist/cli/chat/sessionLifecycle.d.ts +2 -0
- package/dist/cli/chat/sessionLifecycle.js +29 -19
- package/dist/cli/chat/sessionRecorder.d.ts +2 -1
- package/dist/cli/chat/sessionRecorder.js +29 -9
- package/dist/cli/chat/startupSequence.d.ts +2 -0
- package/dist/cli/chat/startupSequence.js +6 -0
- package/dist/cli/chat/transcriptPartition.js +10 -4
- package/dist/cli/chat/wizard/providerHandlers.js +57 -9
- package/dist/cli/chat/wizard/sessionThemeHandlers.js +5 -1
- package/dist/cli/commands/chat.js +44 -9
- package/dist/cli/commands/commandHelp.js +6 -3
- package/dist/cli/commands/commands.js +2 -0
- package/dist/cli/commands/formatters.js +28 -0
- package/dist/cli/commands/graphCommand.d.ts +2 -0
- package/dist/cli/commands/graphCommand.js +60 -0
- package/dist/cli/commands/initCommand.js +14 -0
- package/dist/cli/commands/providerWizard.js +9 -17
- package/dist/cli/commands/reasoningCommand.d.ts +1 -0
- package/dist/cli/commands/reasoningCommand.js +32 -4
- package/dist/cli/commands/runCommand.js +7 -1
- package/dist/cli/commands/streaming/agentAttempt.js +11 -1
- package/dist/cli/commands/streaming/attemptLifecycle.js +1 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +6 -2
- package/dist/cli/commands/streaming/attemptSetup.d.ts +3 -0
- package/dist/cli/commands/streaming/attemptSetup.js +13 -6
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +1 -1
- package/dist/cli/commands/streaming/goalSupervisor.js +22 -1
- package/dist/cli/commands/streaming/prepareStep.js +1 -0
- package/dist/cli/commands/streaming/streamLoop.d.ts +2 -0
- package/dist/cli/commands/streaming/streamLoop.js +14 -10
- package/dist/cli/commands/streaming/toolPartHandlers.js +7 -1
- package/dist/cli/commands/streaming.d.ts +2 -0
- package/dist/cli/commands/streaming.js +5 -0
- package/dist/cli/commands/wizardFlow.d.ts +1 -0
- package/dist/cli/commands/wizardFlow.js +10 -4
- package/dist/cli/index.js +5 -3
- package/dist/config/hazeBuild.d.ts +2 -2
- package/dist/config/hazeBuild.js +2 -2
- package/dist/config/modelDiscovery.d.ts +1 -1
- package/dist/config/modelDiscovery.js +8 -8
- package/dist/config/{modelCatalog.d.ts → providerModelFacts.d.ts} +13 -2
- package/dist/config/{modelCatalog.js → providerModelFacts.js} +145 -21
- package/dist/config/providerPresets.d.ts +8 -19
- package/dist/config/providerPresets.js +86 -555
- package/dist/config/providerReasoning.d.ts +16 -0
- package/dist/config/providerReasoning.js +56 -0
- package/dist/config/providers.d.ts +4 -0
- package/dist/config/providers.js +19 -2
- package/dist/config/settings.d.ts +14 -0
- package/dist/config/settings.js +5 -0
- package/dist/core/agent/compaction.d.ts +1 -0
- package/dist/core/agent/compaction.js +3 -0
- package/dist/core/agent/events.d.ts +1 -1
- package/dist/core/agent/providerTransition.d.ts +8 -0
- package/dist/core/agent/providerTransition.js +47 -0
- package/dist/core/agent/reasoningPolicy.d.ts +1 -1
- package/dist/core/agent/reasoningPolicy.js +4 -2
- package/dist/core/graph/analyze.d.ts +61 -0
- package/dist/core/graph/analyze.js +274 -0
- package/dist/core/graph/buildGraph.d.ts +44 -0
- package/dist/core/graph/buildGraph.js +290 -0
- package/dist/core/graph/digest.d.ts +2 -0
- package/dist/core/graph/digest.js +40 -0
- package/dist/core/graph/extract.d.ts +58 -0
- package/dist/core/graph/extract.js +394 -0
- package/dist/core/graph/model.d.ts +63 -0
- package/dist/core/graph/model.js +96 -0
- package/dist/core/graph/query.d.ts +69 -0
- package/dist/core/graph/query.js +391 -0
- package/dist/core/graph/store.d.ts +64 -0
- package/dist/core/graph/store.js +171 -0
- package/dist/core/limits.d.ts +0 -2
- package/dist/core/limits.js +0 -2
- package/dist/core/process/runBoundedProcess.js +12 -6
- package/dist/core/providerContracts.d.ts +9 -8
- package/dist/core/providerContracts.js +21 -1
- package/dist/core/safety/redaction.js +12 -2
- package/dist/core/safety/untrustedEnvelopes.d.ts +6 -0
- package/dist/core/safety/untrustedEnvelopes.js +17 -2
- package/dist/core/session/sessionSlimming.js +5 -59
- package/dist/core/session/sessionStore.d.ts +4 -0
- package/dist/core/session/sessionStore.js +149 -9
- package/dist/core/session/snapshotCodec.d.ts +5 -0
- package/dist/core/session/snapshotCodec.js +47 -0
- package/dist/core/shellOutput/registry.js +2 -46
- package/dist/core/subagent/executionProfiles.js +8 -5
- package/dist/core/tasks/taskStorage.js +11 -1
- package/dist/core/toolOutput/reduction.d.ts +55 -2
- package/dist/core/toolOutput/reduction.js +77 -2
- package/dist/core/validation/outputParser.js +16 -8
- package/dist/llm/client.d.ts +4 -2
- package/dist/llm/client.js +104 -55
- package/dist/llm/hazeTools.d.ts +2 -12426
- package/dist/llm/hazeTools.js +2 -0
- package/dist/llm/lspTools.d.ts +3 -12622
- package/dist/llm/mistralReasoning.d.ts +2 -0
- package/dist/llm/mistralReasoning.js +17 -0
- package/dist/llm/mistralVibeAuth.d.ts +5 -0
- package/dist/llm/mistralVibeAuth.js +63 -0
- package/dist/llm/requestContext.d.ts +3 -0
- package/dist/llm/requestContext.js +21 -11
- package/dist/llm/subagentRunner.d.ts +2 -308
- package/dist/llm/subagentRunner.js +15 -7
- package/dist/llm/systemPrompt.js +7 -4
- package/dist/llm/toolResultTypes.d.ts +1 -1
- package/dist/llm/toolResultTypes.js +7 -1
- package/dist/llm/tools/fetchTool.d.ts +2 -1221
- package/dist/llm/tools/fileTools.d.ts +2 -7768
- package/dist/llm/tools/graphAdvisory.d.ts +22 -0
- package/dist/llm/tools/graphAdvisory.js +68 -0
- package/dist/llm/tools/graphTools.d.ts +13 -0
- package/dist/llm/tools/graphTools.js +195 -0
- package/dist/llm/tools/outputCap.d.ts +2 -7
- package/dist/llm/tools/outputCap.js +3 -11
- package/dist/llm/tools/processTool.d.ts +2 -1081
- package/dist/llm/tools/replaceInFiles.js +5 -0
- package/dist/llm/tools/shellTool.d.ts +2 -1513
- package/dist/llm/tools/storedOutputTool.d.ts +2 -355
- package/dist/llm/tools/taskTool.d.ts +2 -489
- package/dist/llm/tools/toolContext.js +24 -9
- package/dist/llm/tools/toolContextState.d.ts +3 -0
- package/dist/llm/tools/toolContextState.js +2 -1
- package/dist/skills/skillTools.js +4 -1
- package/package.json +24 -15
|
@@ -3,6 +3,7 @@ import type { ContextFile } from '../../../config/contextFiles.js';
|
|
|
3
3
|
import { type ToolExecutionBudgetState, type TurnBudget } from '../../../core/agent/budgets.js';
|
|
4
4
|
import { type SessionGoal } from '../../../core/agent/goalPolicy.js';
|
|
5
5
|
import { calculateRequestTokenBudget, type ContextUsageAnchor } from '../../../core/agent/contextBudget.js';
|
|
6
|
+
import type { TurnExecutionState } from '../../../core/agent/completionController.js';
|
|
6
7
|
import { providerRequestSettings, type ModelRuntimeSelection } from '../../../llm/client.js';
|
|
7
8
|
import type { StoredReasoningSetting } from '../../../core/agent/reasoningPolicy.js';
|
|
8
9
|
import { type ToolCategory, type TurnExecutionScope } from '../../../llm/requestContext.js';
|
|
@@ -71,6 +72,8 @@ export interface AttemptSetupDeps {
|
|
|
71
72
|
executionScope?: TurnExecutionScope;
|
|
72
73
|
};
|
|
73
74
|
turnBudget: TurnBudget;
|
|
75
|
+
/** Turn-wide execution state; the attempt's step cap is clamped against its cumulative usage. */
|
|
76
|
+
turnState: TurnExecutionState;
|
|
74
77
|
globalBudget: ToolExecutionBudgetState;
|
|
75
78
|
/** Shared slice execution state (see AgentAttemptInput.sliceBudget). */
|
|
76
79
|
sliceBudget: ToolExecutionBudgetState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readSettings } from '../../../config/settings.js';
|
|
2
|
-
import { DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_RETRY_BASE_DELAY_MS, MAIN_STEP_LIMIT, MAIN_TOOL_CALL_LIMIT, SUBAGENT_TOOL_DEADLINE_MS, DEFAULT_TOOL_DEADLINE_MS, DEFAULT_MODEL_RETRIES, resolveStreamIdleTimeoutMs, usesPatientIdleWindow, withToolExecutionBudget } from '../../../core/agent/budgets.js';
|
|
2
|
+
import { DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_RETRY_BASE_DELAY_MS, MAIN_STEP_LIMIT, MAIN_TOOL_CALL_LIMIT, SUBAGENT_TOOL_DEADLINE_MS, DEFAULT_TOOL_DEADLINE_MS, DEFAULT_MODEL_RETRIES, resolveStreamIdleTimeoutMs, remainingSteps, usesPatientIdleWindow, withToolExecutionBudget } from '../../../core/agent/budgets.js';
|
|
3
3
|
import { agentEvent } from '../../../core/agent/events.js';
|
|
4
4
|
import { goalDirectionPrompt, isPlanOnlyRequest } from '../../../core/agent/goalPolicy.js';
|
|
5
5
|
import { projectPreflight } from '../../../core/agent/projectPreflight.js';
|
|
@@ -40,7 +40,7 @@ export function restrictToRescueTools(tools) {
|
|
|
40
40
|
* configured (the caller-reported failure path).
|
|
41
41
|
*/
|
|
42
42
|
export async function prepareAttempt(deps) {
|
|
43
|
-
const { value, contextFiles, callbacks, retryingExistingRequest, session, modelOverride, reasoningOverride, abortController, turnOptions, turnScope, turnBudget, goal, globalBudget, sliceBudget, onContextFileRead, usageAnchor } = deps;
|
|
43
|
+
const { value, contextFiles, callbacks, retryingExistingRequest, session, modelOverride, reasoningOverride, abortController, turnOptions, turnScope, turnState, turnBudget, goal, globalBudget, sliceBudget, onContextFileRead, usageAnchor } = deps;
|
|
44
44
|
// Single choke point: one fresh settings read per attempt, shared by model
|
|
45
45
|
// resolution and request assembly (CR-024, relaxed in Pillar 1.9 so a
|
|
46
46
|
// provider/model switch mid-goal applies from the next attempt — the first
|
|
@@ -60,6 +60,8 @@ export async function prepareAttempt(deps) {
|
|
|
60
60
|
const reasoningPolicy = runtime.config.reasoningPolicy;
|
|
61
61
|
if (reasoningPolicy)
|
|
62
62
|
callbacks.onEvent?.(agentEvent({ type: 'reasoning_policy', requested: reasoningPolicy.requested, effective: reasoningPolicy.effective, reason: reasoningPolicy.reason }));
|
|
63
|
+
if (reasoningPolicy?.effective === 'disabled' && reasoningPolicy.requested && (reasoningOverride || session?.reasoningByModel?.[runtime.selector] || turnSettings.reasoning))
|
|
64
|
+
callbacks.addMessage({ role: 'system', text: `Reasoning ${reasoningPolicy.requested} was not applied: ${reasoningPolicy.reason}.` });
|
|
63
65
|
// Make the context-budget guess observable: a stream event every turn
|
|
64
66
|
// (headless consumers can gate on it), and — interactively — a system
|
|
65
67
|
// message only when the built-in default was used for a model this session
|
|
@@ -99,8 +101,8 @@ export async function prepareAttempt(deps) {
|
|
|
99
101
|
// Keep the active provider history exact. Routine tool-history slimming used
|
|
100
102
|
// to rewrite older successful calls/results here, invalidating provider
|
|
101
103
|
// prompt-cache prefixes before the context budget required compaction.
|
|
102
|
-
// Durable session snapshots
|
|
103
|
-
//
|
|
104
|
+
// Durable session snapshots preserve this history; only model-aware
|
|
105
|
+
// compaction or an explicit provider transition may rewrite it.
|
|
104
106
|
const durableRequestMessages = retryingExistingRequest
|
|
105
107
|
? stripSyntheticControls(callbacks.getConversation())
|
|
106
108
|
: [...stripSyntheticControls(callbacks.getConversation()), userTurnMessage(value, turnOptions.attachments ?? [])];
|
|
@@ -144,9 +146,14 @@ export async function prepareAttempt(deps) {
|
|
|
144
146
|
mutationPolicy,
|
|
145
147
|
blessedPaths: turnOptions.blessedPaths,
|
|
146
148
|
postMutationDiagnostics: assembled.postMutationDiagnostics,
|
|
149
|
+
postMutationGraph: assembled.postMutationGraph,
|
|
147
150
|
};
|
|
148
151
|
const recoverySlice = turnOptions.recoverySlice;
|
|
149
|
-
|
|
152
|
+
// The turn-wide step budget never resets (matching the tool-call execution
|
|
153
|
+
// boundary): a provider retry must not re-arm the main step cap, so clamp
|
|
154
|
+
// this attempt's cap to what the turn has left. Recovery slices were
|
|
155
|
+
// already clamped at admission; Math.min keeps them unchanged.
|
|
156
|
+
const stepCap = Math.min(recoverySlice?.maxSteps ?? MAIN_STEP_LIMIT, remainingSteps(turnState.stepsUsed, turnBudget));
|
|
150
157
|
// Rescue exposes only mutation + validation-capable built-in tools so
|
|
151
158
|
// discovery cannot be reopened near the boundary. Length-continuation keeps
|
|
152
159
|
// the full tool set. When no built-in mutation/validation tool qualifies,
|
|
@@ -195,7 +202,7 @@ export async function prepareAttempt(deps) {
|
|
|
195
202
|
toolCategories,
|
|
196
203
|
modelRetries: typeof turnSettings.modelRetries === 'number' ? turnSettings.modelRetries : DEFAULT_MODEL_RETRIES,
|
|
197
204
|
retryBaseDelayMs: typeof turnSettings.retryBaseDelayMs === 'number' ? turnSettings.retryBaseDelayMs : DEFAULT_RETRY_BASE_DELAY_MS,
|
|
198
|
-
streamIdleTimeoutMs: resolveStreamIdleTimeoutMs(turnSettings.streamIdleTimeoutMs, usesPatientIdleWindow(isLocalProviderUrl(runtime.config.baseURL), runtime.config.providerKind)),
|
|
205
|
+
streamIdleTimeoutMs: resolveStreamIdleTimeoutMs(turnSettings.streamIdleTimeoutMs, usesPatientIdleWindow(runtime.config.isLocal ?? isLocalProviderUrl(runtime.config.baseURL), runtime.config.providerKind)),
|
|
199
206
|
steeringProfile,
|
|
200
207
|
};
|
|
201
208
|
}
|
|
@@ -5,7 +5,7 @@ import type { StoredReasoningSetting } from '../../../core/agent/reasoningPolicy
|
|
|
5
5
|
import { type StreamCallbacks, type TurnExecutionOptions } from '../streaming.js';
|
|
6
6
|
import { type GoalCheckpoint, type GoalLedgerAppend } from './goalCheckpoint.js';
|
|
7
7
|
/** Why a logical goal stopped. `completed` is the only success. */
|
|
8
|
-
export type GoalStopReason = 'completed' | 'no-progress' | 'goal-deadline' | 'blocked' | 'model-error' | 'model-stream-idle' | 'user-aborted' | 'context-exhausted';
|
|
8
|
+
export type GoalStopReason = 'completed' | 'no-progress' | 'goal-deadline' | 'blocked' | 'model-error' | 'model-stream-idle' | 'user-aborted' | 'context-exhausted' | 'cycle-limit';
|
|
9
9
|
export type { GoalLedgerAppend };
|
|
10
10
|
/** Authoritative outcome of a logical goal (one or more physical turns). */
|
|
11
11
|
export interface GoalRunResult {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { agentEvent } from '../../../core/agent/events.js';
|
|
2
|
+
import { transitionProviderConversation } from '../../../core/agent/providerTransition.js';
|
|
2
3
|
import { describeCompletionReadiness } from '../../../core/agent/completionController.js';
|
|
3
4
|
import { checkKindsOfIds } from '../../../core/agent/workState.js';
|
|
4
5
|
import { classifyRequestIntent, goalContinuationPrompt } from '../../../core/agent/goalPolicy.js';
|
|
@@ -6,6 +7,10 @@ import { runAgentTurn } from '../streaming.js';
|
|
|
6
7
|
import { goalCheckpointSignature, hashRequest } from './goalCheckpoint.js';
|
|
7
8
|
/** Pause after one corrective physical turn without measurable outcome progress. */
|
|
8
9
|
const GOAL_NO_PROGRESS_LIMIT = 1;
|
|
10
|
+
/** Hard ceiling on physical turns for a single logical goal. The no-progress
|
|
11
|
+
* guard above stops most stuck goals; this is a backstop so a goal that keeps
|
|
12
|
+
* inching forward without completing cannot run unbounded. */
|
|
13
|
+
const GOAL_MAX_CYCLES = 12;
|
|
9
14
|
function checkpointFromResume(resume, noProgressCount) {
|
|
10
15
|
const validationOutcome = resume.validationOutcome ?? 'not_applicable';
|
|
11
16
|
return {
|
|
@@ -85,13 +90,19 @@ export async function runAgentGoal(options) {
|
|
|
85
90
|
if (!selected || escalated || selected === activeModelOverride)
|
|
86
91
|
return false;
|
|
87
92
|
escalated = true;
|
|
93
|
+
const history = callbacks.getConversation();
|
|
94
|
+
if (history.length) {
|
|
95
|
+
const portable = transitionProviderConversation(history);
|
|
96
|
+
callbacks.setConversation(portable);
|
|
97
|
+
callbacks.onModelTransition?.(selected, portable);
|
|
98
|
+
}
|
|
88
99
|
activeModelOverride = selected;
|
|
89
100
|
noProgressCount = 0;
|
|
90
101
|
prevSignature = undefined;
|
|
91
102
|
// The model switch is a supervisor boundary like any other: it must reach
|
|
92
103
|
// the durable ledger so a crash resume does not silently lose it.
|
|
93
104
|
appendLedger('goal_continue');
|
|
94
|
-
callbacks.onEvent?.(agentEvent({ type: 'goal_notice', text: `Continuing with explicitly configured escalation model ${selected} after ${reason}.` }));
|
|
105
|
+
callbacks.onEvent?.(agentEvent({ type: 'goal_notice', text: `Continuing with explicitly configured escalation model ${selected} after ${reason}. Previous tool history was converted to text and provider reasoning state was cleared.` }));
|
|
95
106
|
return true;
|
|
96
107
|
};
|
|
97
108
|
const appendLedger = (phase, extra = {}) => {
|
|
@@ -124,6 +135,11 @@ export async function runAgentGoal(options) {
|
|
|
124
135
|
// guessed from semantic versions.
|
|
125
136
|
callbacks.debugLog('goal supervisor enabled; automatic continuation across physical-turn budgets');
|
|
126
137
|
const finish = (status, stopReason, resume) => {
|
|
138
|
+
if (escalated && options.modelOverride) {
|
|
139
|
+
const portable = transitionProviderConversation(callbacks.getConversation());
|
|
140
|
+
callbacks.setConversation(portable);
|
|
141
|
+
callbacks.onModelTransition?.(options.modelOverride, portable);
|
|
142
|
+
}
|
|
127
143
|
appendLedger('goal_end', {
|
|
128
144
|
status,
|
|
129
145
|
gateDecision: status === 'complete' ? 'ready' : ['no-progress', 'context-exhausted', 'goal-deadline'].includes(stopReason) ? checkpoint?.readiness : undefined,
|
|
@@ -178,8 +194,13 @@ export async function runAgentGoal(options) {
|
|
|
178
194
|
lastEvidence = result.evidence;
|
|
179
195
|
if (result.checkpoint)
|
|
180
196
|
checkpoint = result.checkpoint;
|
|
197
|
+
// Structured completion wins over the cycle bound: a goal that finishes
|
|
198
|
+
// on the limit cycle is a success, never a cycle-limit failure.
|
|
181
199
|
if (result.status === 'complete')
|
|
182
200
|
return finish('complete', 'completed');
|
|
201
|
+
if (cycle >= GOAL_MAX_CYCLES) {
|
|
202
|
+
return finish('failed', 'cycle-limit', checkpoint ? { kind: 'incomplete-goal', checkpoint } : undefined);
|
|
203
|
+
}
|
|
183
204
|
if (result.status === 'aborted') {
|
|
184
205
|
return result.abortReason === 'turn-deadline'
|
|
185
206
|
? finish('failed', 'goal-deadline', checkpoint ? { kind: 'incomplete-goal', checkpoint } : undefined)
|
|
@@ -40,6 +40,7 @@ export function createRepairToolCall(deps) {
|
|
|
40
40
|
loopState.pendingMalformedToolProblem = problem;
|
|
41
41
|
loopState.unresolvedMalformedToolName = toolCall.toolName;
|
|
42
42
|
loopState.unresolvedMalformedToolProblem = problem;
|
|
43
|
+
loopState.unresolvedMalformedAtStep = loopState.completedSteps;
|
|
43
44
|
}
|
|
44
45
|
// Truncated generated file content cannot be reconstructed safely here;
|
|
45
46
|
// let the next agent step retry under the bounded tool-choice constraint.
|
|
@@ -34,6 +34,8 @@ export interface AttemptLoopState {
|
|
|
34
34
|
unresolvedMalformedToolName: string | undefined;
|
|
35
35
|
/** Last known diagnosis for the unresolved malformed tool; rides the turn-end system note so later turns see the exact defect. */
|
|
36
36
|
unresolvedMalformedToolProblem: string | undefined;
|
|
37
|
+
/** Attempt-local completed-step count when the unresolved malformed call was recorded; a same-name success clears the flag only from a later step. */
|
|
38
|
+
unresolvedMalformedAtStep: number | undefined;
|
|
37
39
|
/** Per-attempt (not per-turn) recovery counter: a transient retry gets a fresh map. Bounded across the whole turn by MAIN_TOOL_CALL_LIMIT. */
|
|
38
40
|
malformedRecoveryAttempts: Map<string, number>;
|
|
39
41
|
toolResultState: ToolResultState;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { ToolLoopAgent,
|
|
2
|
+
import { ToolLoopAgent, streamText, isStepCount } from 'ai';
|
|
3
3
|
import { agentEvent } from '../../../core/agent/events.js';
|
|
4
|
+
import { auxiliaryRequestOptions } from '../../../core/providerContracts.js';
|
|
4
5
|
import { contextTokensFromUsage, estimateConversationTokens, estimateValueTokens } from '../../../core/agent/contextBudget.js';
|
|
5
6
|
import { stripSyntheticControls } from '../../../core/agent/requestAssembly.js';
|
|
6
7
|
import { buildLlmCompactionPrompt, chooseBoundaryCompactionMethod, compactModelMessages, compactModelMessagesWithSummary, extractExistingCompactionSummary } from '../../../core/agent/compaction.js';
|
|
8
|
+
import { buildCodeGraphDigest } from '../../../core/graph/digest.js';
|
|
7
9
|
import { isLengthStopOverflow, isSilentContextOverflow } from '../../../core/agent/overflow.js';
|
|
8
10
|
import { isValidationRerunToolCall } from '../../../core/agent/turnPolicy.js';
|
|
9
11
|
import { COMPACTION_LLM_MAX_OUTPUT_TOKENS, COMPACTION_LLM_MIN_OLDER_TOKENS } from '../../../core/agent/budgets.js';
|
|
@@ -34,6 +36,7 @@ export function createAttemptLoopState(previousAssistantText, contextFiles, call
|
|
|
34
36
|
pendingMalformedToolProblem: undefined,
|
|
35
37
|
unresolvedMalformedToolName: undefined,
|
|
36
38
|
unresolvedMalformedToolProblem: undefined,
|
|
39
|
+
unresolvedMalformedAtStep: undefined,
|
|
37
40
|
malformedRecoveryAttempts: new Map(),
|
|
38
41
|
toolResultState: initialToolResultState(),
|
|
39
42
|
inFlightTools: new Set(),
|
|
@@ -366,15 +369,16 @@ async function compactAtEpochBoundary(deps, providerMessages) {
|
|
|
366
369
|
older: split.older,
|
|
367
370
|
previousSummary: extractExistingCompactionSummary(providerMessages),
|
|
368
371
|
splitTurn: split.splitTurn,
|
|
372
|
+
codeGraphDigest: await buildCodeGraphDigest(),
|
|
369
373
|
});
|
|
370
|
-
const summarization =
|
|
374
|
+
const summarization = streamText({
|
|
371
375
|
model: setup.runtime.model,
|
|
372
376
|
prompt,
|
|
373
|
-
...(setup.runtime.config.
|
|
374
|
-
maxOutputTokens: Math.min(COMPACTION_LLM_MAX_OUTPUT_TOKENS, setup.runtime.config.maxOutputTokens ?? COMPACTION_LLM_MAX_OUTPUT_TOKENS),
|
|
377
|
+
...auxiliaryRequestOptions({ ...setup.providerSettings, omitMaxOutputTokens: setup.omitMaxOutputTokens }, setup.runtime.config.capabilities, 'compaction', Math.min(COMPACTION_LLM_MAX_OUTPUT_TOKENS, setup.runtime.config.maxOutputTokens ?? COMPACTION_LLM_MAX_OUTPUT_TOKENS)),
|
|
375
378
|
abortSignal: abortController.signal,
|
|
376
379
|
});
|
|
377
|
-
const summaryText = summarization.text.trim();
|
|
380
|
+
const summaryText = (await summarization.text).trim();
|
|
381
|
+
const usage = await summarization.usage;
|
|
378
382
|
if (!summaryText)
|
|
379
383
|
throw new Error('model returned an empty summary');
|
|
380
384
|
const result = compactModelMessagesWithSummary(providerMessages, { summaryText, tokenBudget, workState: goal });
|
|
@@ -382,16 +386,16 @@ async function compactAtEpochBoundary(deps, providerMessages) {
|
|
|
382
386
|
throw new Error('nothing older to compact');
|
|
383
387
|
callbacks.onEvent?.(agentEvent({ type: 'compaction_end', reason: 'threshold', method: 'llm', compacted: true, olderCount: result.olderCount, keptCount: result.keptCount }));
|
|
384
388
|
callbacks.recordTokenUsage?.({
|
|
385
|
-
inputTokens:
|
|
386
|
-
outputTokens:
|
|
389
|
+
inputTokens: usage?.inputTokens,
|
|
390
|
+
outputTokens: usage?.outputTokens,
|
|
387
391
|
systemPrompt: 0,
|
|
388
392
|
messages: 0,
|
|
389
393
|
toolSchemas: 0,
|
|
390
394
|
outputEstimate: 0,
|
|
391
|
-
cacheReadTokens:
|
|
392
|
-
cacheWriteTokens:
|
|
395
|
+
cacheReadTokens: usage?.inputTokenDetails?.cacheReadTokens ?? 0,
|
|
396
|
+
cacheWriteTokens: usage?.inputTokenDetails?.cacheWriteTokens ?? 0,
|
|
393
397
|
noCacheTokens: 0,
|
|
394
|
-
reasoningTokens:
|
|
398
|
+
reasoningTokens: usage?.outputTokenDetails?.reasoningTokens ?? 0,
|
|
395
399
|
logicalInputEstimate: 0,
|
|
396
400
|
effectiveNonCachedInput: undefined,
|
|
397
401
|
});
|
|
@@ -58,9 +58,15 @@ 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
|
-
|
|
61
|
+
// A successful same-name call clears the unresolved flag only when it ran
|
|
62
|
+
// in a *later* step: a successful sibling within the same parallel batch
|
|
63
|
+
// (same completed-step count) must not mask the malformed call's failure.
|
|
64
|
+
if (ok && part.toolName === loopState.unresolvedMalformedToolName
|
|
65
|
+
&& loopState.unresolvedMalformedAtStep != null
|
|
66
|
+
&& loopState.completedSteps > loopState.unresolvedMalformedAtStep) {
|
|
62
67
|
loopState.unresolvedMalformedToolName = undefined;
|
|
63
68
|
loopState.unresolvedMalformedToolProblem = undefined;
|
|
69
|
+
loopState.unresolvedMalformedAtStep = undefined;
|
|
64
70
|
}
|
|
65
71
|
const finish = { toolCall, success: ok, output: part.output, durationMs: Date.now() - startedAt };
|
|
66
72
|
const item = toolDisplay.ensureToolItem(toolCall);
|
|
@@ -102,6 +102,8 @@ export interface StreamCallbacks {
|
|
|
102
102
|
addMessage: (msg: Message) => void;
|
|
103
103
|
updateMessage: (id: string, update: Partial<Message>) => void;
|
|
104
104
|
setConversation: (messages: ModelMessage[]) => void;
|
|
105
|
+
/** Persist an atomic portable boundary when the supervisor switches models. */
|
|
106
|
+
onModelTransition?: (selector: string, messages: ModelMessage[]) => void;
|
|
105
107
|
setBusy: (busy: boolean) => void;
|
|
106
108
|
setBusyLabel?: (label: string) => void;
|
|
107
109
|
debugLog: (line: string) => void;
|
|
@@ -131,6 +131,11 @@ export async function runAgentTurn(value, displayValue, contextFiles, callbacks,
|
|
|
131
131
|
await abortableDelay(result.retry.delayMs, abortController.signal);
|
|
132
132
|
if (abortController.signal.aborted) {
|
|
133
133
|
status = 'aborted';
|
|
134
|
+
// The abort landed during retry backoff, after the attempt result
|
|
135
|
+
// was classified: recover the cause from the shared holder so a
|
|
136
|
+
// turn-deadline abort reaches the supervisor as `turn-deadline`
|
|
137
|
+
// (goal-deadline checkpoint) instead of a plain user cancel.
|
|
138
|
+
abortReason = abortCause.kind === 'turn-deadline' ? 'turn-deadline' : 'user';
|
|
134
139
|
break;
|
|
135
140
|
}
|
|
136
141
|
continue;
|
|
@@ -24,6 +24,7 @@ export declare const PROVIDER_ACTIONS: {
|
|
|
24
24
|
readonly addModels: "add models";
|
|
25
25
|
readonly manageAccess: "set API key";
|
|
26
26
|
readonly signInChatGpt: "sign in with ChatGPT";
|
|
27
|
+
readonly signInMistral: "sign in with Mistral Vibe";
|
|
27
28
|
readonly markImageCapable: "mark image-capable";
|
|
28
29
|
readonly clearImageCapable: "clear image-capable";
|
|
29
30
|
readonly removeModels: "remove models";
|
|
@@ -4,7 +4,8 @@ import { configuredMcpServers, findMcpServer, findMcpPreset, presetIds } from '.
|
|
|
4
4
|
import { isSkillEnabled } from '../../config/skillSettings.js';
|
|
5
5
|
import { PROVIDER_PRESETS } from '../../config/providerPresets.js';
|
|
6
6
|
import { CHATGPT_CODEX_BASE_URL } from '../../llm/openaiCodexOAuth.js';
|
|
7
|
-
import { isStoredReasoning, resolveReasoningChoice
|
|
7
|
+
import { isStoredReasoning, resolveReasoningChoice } from '../../core/agent/reasoningPolicy.js';
|
|
8
|
+
import { reasoningLevelsForProvider } from '../../config/providerReasoning.js';
|
|
8
9
|
import { BUILT_IN_THEME_SPECS, DEFAULT_THEME_NAME, resolveTheme } from '../../ui/theme.js';
|
|
9
10
|
import { sessionActionSuggestions, sessionSuggestions } from './sessionPicker.js';
|
|
10
11
|
/**
|
|
@@ -29,6 +30,7 @@ export const PROVIDER_ACTIONS = {
|
|
|
29
30
|
addModels: 'add models',
|
|
30
31
|
manageAccess: 'set API key',
|
|
31
32
|
signInChatGpt: 'sign in with ChatGPT',
|
|
33
|
+
signInMistral: 'sign in with Mistral Vibe',
|
|
32
34
|
markImageCapable: 'mark image-capable',
|
|
33
35
|
clearImageCapable: 'clear image-capable',
|
|
34
36
|
removeModels: 'remove models',
|
|
@@ -181,6 +183,7 @@ export function providerActionSuggestions(settings, selectedProviderName) {
|
|
|
181
183
|
...(provider?.kind === 'chatgpt-codex'
|
|
182
184
|
? [{ value: PROVIDER_ACTIONS.signInChatGpt, description: 'Sign in again or switch ChatGPT account', kind: 'provider' }]
|
|
183
185
|
: [{ value: PROVIDER_ACTIONS.manageAccess, description: provider?.key ? 'Update the saved API key' : 'Add an API key', kind: 'provider' }]),
|
|
186
|
+
...(provider?.url === 'https://api.mistral.ai/v1' ? [{ value: PROVIDER_ACTIONS.signInMistral, description: 'Sign in or switch Mistral Vibe account', kind: 'provider' }] : []),
|
|
184
187
|
provider
|
|
185
188
|
? (providerImageCapable(provider)
|
|
186
189
|
? { value: PROVIDER_ACTIONS.clearImageCapable, description: 'Stop sending attached images to this provider', kind: 'provider' }
|
|
@@ -196,7 +199,7 @@ export function presetSuggestions() {
|
|
|
196
199
|
return [
|
|
197
200
|
...cloudPresets.map(preset => ({
|
|
198
201
|
value: preset.id,
|
|
199
|
-
description: `${preset.baseUrl}${preset.auth
|
|
202
|
+
description: `${preset.baseUrl}${preset.auth ? ' · browser sign-in' : ''}${preset.suggestedModels?.length ? ' · e.g. ' + preset.suggestedModels.slice(0, 2).join(', ') : ''}`,
|
|
200
203
|
kind: 'provider',
|
|
201
204
|
})),
|
|
202
205
|
...localPresets.map(preset => ({
|
|
@@ -388,13 +391,16 @@ export function reasoningSuggestions(settings, sessionReasoning) {
|
|
|
388
391
|
medium: 'moderate reasoning',
|
|
389
392
|
high: 'deep reasoning',
|
|
390
393
|
xhigh: 'maximum reasoning',
|
|
394
|
+
max: 'maximum reasoning (supported models)',
|
|
391
395
|
};
|
|
392
396
|
const active = activeModel(settings);
|
|
397
|
+
const binary = active?.provider.kind === 'haze-build' || active?.provider.reasoningFormat === 'thinking' || active?.provider.reasoningFormat === 'enable-thinking';
|
|
398
|
+
const levels = active ? reasoningLevelsForProvider(active.provider, active.model) : [];
|
|
393
399
|
const choice = resolveReasoningChoice(active ? sessionReasoning?.[modelSelector(active.provider, active.model)] : undefined, isStoredReasoning(settings.reasoning) ? settings.reasoning : undefined);
|
|
394
400
|
return [
|
|
395
|
-
...
|
|
401
|
+
...levels.map(level => ({
|
|
396
402
|
value: level,
|
|
397
|
-
description: `${descriptions[level] ?? 'reasoning level'}${choice.level === level ? ' · active' : ''}`,
|
|
403
|
+
description: `${binary ? (level === 'none' ? 'thinking off' : 'thinking on') : descriptions[level] ?? 'reasoning level'}${choice.level === level ? ' · active' : ''}`,
|
|
398
404
|
kind: 'command',
|
|
399
405
|
})),
|
|
400
406
|
{ value: 'unset', description: 'provider default — sends no reasoning parameter', kind: 'command' },
|
package/dist/cli/index.js
CHANGED
|
@@ -23,7 +23,7 @@ program
|
|
|
23
23
|
.option('--no-session', 'run without saving or resuming a durable session')
|
|
24
24
|
.option('-p, --prompt <text>', 'print mode: run a single non-interactive turn and print the result (falls back to piped stdin)')
|
|
25
25
|
.option('-m, --model <selector>', 'override the model for this run only — a registered model name or provider:name')
|
|
26
|
-
.addOption(new Option('--reasoning <level>', 'print-mode reasoning effort for this run only — none, minimal, low, medium, high, xhigh, or unset (no parameter sent; provider default)').choices(['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'unset', 'off']))
|
|
26
|
+
.addOption(new Option('--reasoning <level>', 'print-mode reasoning effort for this run only — none, minimal, low, medium, high, xhigh, max, or unset (no parameter sent; provider default)').choices(['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'unset', 'off']))
|
|
27
27
|
.addOption(new Option('--output <format>', 'print-mode output: plain text, a single JSON result envelope, or a stream-json NDJSON event stream').choices(['text', 'json', 'stream-json']).default('text'))
|
|
28
28
|
.option('--timeout <duration>', 'print-mode absolute turn deadline (e.g. 30s, 10m, 2h); bounds total elapsed time so a busy tool cannot run indefinitely')
|
|
29
29
|
.option('--until-done', 'print mode: relaunch the goal after transient model failures (with backoff) until it structurally completes, the --timeout deadline hits, or repeated relaunches make no progress');
|
|
@@ -52,7 +52,7 @@ Print mode (-p):
|
|
|
52
52
|
detection without raw tool inputs or outputs. --model overrides the model for this
|
|
53
53
|
run only (no settings change) and must already be registered under a provider (add it once via
|
|
54
54
|
the /provider picker). --reasoning overrides the reasoning effort for this run only (levels
|
|
55
|
-
none–
|
|
55
|
+
none–max; unset sends no reasoning parameter, provider default). Print-mode runs are non-durable: --continue is ignored and no session is
|
|
56
56
|
saved. --resume <id> loads saved context for the turn without changing that session. On a
|
|
57
57
|
provider context overflow, haze compacts the conversation and retries at a progressively smaller
|
|
58
58
|
message budget (up to twice); exhausted retries pause with a context_exhausted checkpoint, and
|
|
@@ -85,7 +85,9 @@ async function readStdinPrompt() {
|
|
|
85
85
|
};
|
|
86
86
|
const onError = () => {
|
|
87
87
|
cleanup();
|
|
88
|
-
|
|
88
|
+
// A stdin read error is a real failure, not "no prompt": reject so the
|
|
89
|
+
// caller surfaces it instead of silently starting an empty chat turn.
|
|
90
|
+
reject(new Error('stdin prompt could not be read.'));
|
|
89
91
|
};
|
|
90
92
|
process.stdin.setEncoding('utf8');
|
|
91
93
|
process.stdin.on('data', onData);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { HazeProviderSettings } from './settings.js';
|
|
3
|
-
export declare const HAZE_BUILD_PROVIDER = "haze.build";
|
|
4
3
|
export declare const HAZE_BUILD_MODEL = "haze1.5-builder-flash";
|
|
5
|
-
|
|
4
|
+
declare const hazeBuildManifestSchema: z.ZodObject<{
|
|
6
5
|
schemaVersion: z.ZodLiteral<1>;
|
|
7
6
|
provider: z.ZodLiteral<"haze.build">;
|
|
8
7
|
model: z.ZodEnum<{
|
|
@@ -45,3 +44,4 @@ export declare const hazeBuildManifestSchema: z.ZodObject<{
|
|
|
45
44
|
export type HazeBuildManifest = z.infer<typeof hazeBuildManifestSchema>;
|
|
46
45
|
/** Refreshed per attempt: a mutable endpoint alias must never imply stale capacity. */
|
|
47
46
|
export declare function discoverHazeBuildManifest(provider: Pick<HazeProviderSettings, 'url' | 'key' | 'trustedDeployments'>, fetchImpl?: typeof fetch): Promise<HazeBuildManifest>;
|
|
47
|
+
export {};
|
package/dist/config/hazeBuild.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { assertCredentialedEndpointSecure } from './endpointSecurity.js';
|
|
3
|
-
|
|
3
|
+
const HAZE_BUILD_PROVIDER = 'haze.build';
|
|
4
4
|
export const HAZE_BUILD_MODEL = 'haze1.5-builder-flash';
|
|
5
|
-
|
|
5
|
+
const hazeBuildManifestSchema = z.object({
|
|
6
6
|
schemaVersion: z.literal(1),
|
|
7
7
|
provider: z.literal(HAZE_BUILD_PROVIDER),
|
|
8
8
|
model: z.enum([HAZE_BUILD_MODEL, 'haze0.1-coder-flash']),
|
|
@@ -29,7 +29,7 @@ export declare function ollamaContextFromShow(show: unknown): OllamaShowFacts;
|
|
|
29
29
|
/**
|
|
30
30
|
* Probe a local Ollama server for the effective context of the given models.
|
|
31
31
|
* Best-effort: any failing request simply omits that model. Only call for
|
|
32
|
-
*
|
|
32
|
+
* endpoints explicitly classified as local (the /api/* surface is Ollama-specific).
|
|
33
33
|
*/
|
|
34
34
|
export declare function ollamaModelLimits(input: {
|
|
35
35
|
baseUrl: string;
|
|
@@ -86,7 +86,7 @@ function firstHarvested(...values) {
|
|
|
86
86
|
const OLLAMA_PROBE_TIMEOUT_MS = 4_000;
|
|
87
87
|
/** Bound the per-save /api/show probe loop so bulk pastes stay cheap. */
|
|
88
88
|
const OLLAMA_PROBE_MAX_MODELS = 8;
|
|
89
|
-
function
|
|
89
|
+
function endpointRoot(baseUrl) {
|
|
90
90
|
try {
|
|
91
91
|
const url = new URL(baseUrl);
|
|
92
92
|
return `${url.protocol}//${url.host}`;
|
|
@@ -109,7 +109,7 @@ export function ollamaContextFromShow(show) {
|
|
|
109
109
|
// which describe the pre-scaling trained length, not the usable window.
|
|
110
110
|
if (!key.endsWith('.context_length') || /rope|original/.test(key))
|
|
111
111
|
continue;
|
|
112
|
-
if (typeof value === 'number' && Number.isSafeInteger(value) && value > 0) {
|
|
112
|
+
if (typeof value === 'number' && Number.isSafeInteger(value) && value > 0 && value <= HARVEST_MAX_TOKENS) {
|
|
113
113
|
max = max === undefined ? value : Math.max(max, value);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -119,7 +119,7 @@ export function ollamaContextFromShow(show) {
|
|
|
119
119
|
if (typeof record.parameters === 'string') {
|
|
120
120
|
const match = /(?<![\w.])num_ctx\s+(\d+)/.exec(record.parameters);
|
|
121
121
|
const parsed = match ? Number(match[1]) : undefined;
|
|
122
|
-
if (parsed !== undefined && Number.isSafeInteger(parsed) && parsed > 0)
|
|
122
|
+
if (parsed !== undefined && Number.isSafeInteger(parsed) && parsed > 0 && parsed <= HARVEST_MAX_TOKENS)
|
|
123
123
|
facts.numCtx = parsed;
|
|
124
124
|
}
|
|
125
125
|
return facts;
|
|
@@ -137,19 +137,19 @@ function resolveOllamaContext(psContext, facts, conservativeCap) {
|
|
|
137
137
|
/**
|
|
138
138
|
* Probe a local Ollama server for the effective context of the given models.
|
|
139
139
|
* Best-effort: any failing request simply omits that model. Only call for
|
|
140
|
-
*
|
|
140
|
+
* endpoints explicitly classified as local (the /api/* surface is Ollama-specific).
|
|
141
141
|
*/
|
|
142
142
|
export async function ollamaModelLimits(input) {
|
|
143
|
-
const root =
|
|
143
|
+
const root = endpointRoot(input.baseUrl);
|
|
144
144
|
if (!root || input.models.length === 0)
|
|
145
145
|
return {};
|
|
146
146
|
const fetchImpl = input.fetchImpl ?? fetch;
|
|
147
147
|
const timeoutMs = input.timeoutMs ?? OLLAMA_PROBE_TIMEOUT_MS;
|
|
148
148
|
const get = async (url, init) => {
|
|
149
|
-
const response = await fetchImpl(url, { ...init, signal: AbortSignal.timeout(timeoutMs) });
|
|
149
|
+
const response = await fetchImpl(url, { ...init, redirect: 'manual', signal: AbortSignal.timeout(timeoutMs) });
|
|
150
150
|
if (!response.ok)
|
|
151
151
|
throw new Error(`HTTP ${response.status}`);
|
|
152
|
-
return await response
|
|
152
|
+
return await readBodyBounded(response);
|
|
153
153
|
};
|
|
154
154
|
const out = {};
|
|
155
155
|
// Runtime ground truth for loaded models (one request, may be stale/empty).
|
|
@@ -158,7 +158,7 @@ export async function ollamaModelLimits(input) {
|
|
|
158
158
|
const ps = await get(`${root}/api/ps`);
|
|
159
159
|
for (const entry of ps?.models ?? []) {
|
|
160
160
|
for (const key of [entry.name, entry.model]) {
|
|
161
|
-
if (typeof key === 'string' && typeof entry.context_length === 'number' && entry.context_length > 0) {
|
|
161
|
+
if (typeof key === 'string' && typeof entry.context_length === 'number' && Number.isSafeInteger(entry.context_length) && entry.context_length > 0 && entry.context_length <= HARVEST_MAX_TOKENS) {
|
|
162
162
|
psLoaded.set(key, entry.context_length);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import type { ReasoningLevel } from '../core/agent/reasoningPolicy.js';
|
|
2
|
+
/** Curated endpoint/model facts. Unknown entries remain unknown, not inferred. */
|
|
3
|
+
export interface EndpointModelFacts {
|
|
4
|
+
limits?: {
|
|
5
|
+
contextWindowTokens: number;
|
|
6
|
+
maxOutputTokens: number;
|
|
7
|
+
};
|
|
8
|
+
reasoningLevels?: readonly ReasoningLevel[];
|
|
9
|
+
}
|
|
10
|
+
/** Lookup uses the actual endpoint and exact model ID; documented aliases are handled by the reasoning profiles. */
|
|
11
|
+
export declare function endpointModelFacts(url: string, model: string): EndpointModelFacts;
|
|
1
12
|
/**
|
|
2
13
|
* Curated model metadata catalog (Pillar 1.8 of the Pi learning roadmap).
|
|
3
14
|
*
|
|
@@ -5,8 +16,8 @@
|
|
|
5
16
|
* most models through user-configured OpenAI-compatible gateways where the
|
|
6
17
|
* provider name is arbitrary — the model id is the only stable identity.
|
|
7
18
|
*
|
|
8
|
-
* Precedence (enforced in `llm/client.ts`):
|
|
9
|
-
* this catalog → user
|
|
19
|
+
* Precedence (enforced in `llm/client.ts`): explicit model limits → discovered
|
|
20
|
+
* limits → provider preset → this catalog → user fallback → built-in fallback.
|
|
10
21
|
* Values are deliberately conservative (input-safe): when a family differs
|
|
11
22
|
* between variants, the smaller window wins — under-budgeting only compacts a
|
|
12
23
|
* little earlier, over-budgeting hard-fails the request. First match wins, so
|