@denizokcu/haze 1.7.9 → 1.7.11
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 +13 -0
- package/README.md +22 -8
- 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/sessionLifecycle.d.ts +2 -0
- package/dist/cli/chat/sessionLifecycle.js +27 -18
- package/dist/cli/chat/sessionRecorder.d.ts +2 -1
- package/dist/cli/chat/sessionRecorder.js +25 -8
- 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 +39 -7
- package/dist/cli/commands/commandHelp.js +2 -2
- 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/attemptLifecycle.js +1 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +5 -1
- package/dist/cli/commands/streaming/attemptSetup.js +5 -3
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +1 -1
- package/dist/cli/commands/streaming/goalSupervisor.js +20 -1
- package/dist/cli/commands/streaming/streamLoop.js +11 -10
- package/dist/cli/commands/streaming.d.ts +2 -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 +6 -3
- 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/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/limits.d.ts +0 -2
- package/dist/core/limits.js +0 -2
- 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/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 +4 -1
- package/dist/core/toolOutput/reduction.d.ts +55 -2
- package/dist/core/toolOutput/reduction.js +77 -2
- package/dist/llm/client.d.ts +4 -2
- package/dist/llm/client.js +115 -56
- package/dist/llm/hazeTools.d.ts +16 -16
- 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.js +8 -7
- package/dist/llm/subagentRunner.js +15 -7
- package/dist/llm/toolResultTypes.js +7 -1
- package/dist/llm/tools/fetchTool.d.ts +16 -16
- package/dist/llm/tools/outputCap.d.ts +2 -7
- package/dist/llm/tools/outputCap.js +3 -11
- package/dist/llm/tools/replaceInFiles.js +5 -0
- package/package.json +14 -8
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']),
|
|
@@ -19,7 +19,10 @@ export const hazeBuildManifestSchema = z.object({
|
|
|
19
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: '
|
|
22
|
+
const DEFAULT_DEPLOYMENTS = [{ modelRepository: 'cyankiwi/Ornith-1.5-35B-A3B-AWQ-INT4',
|
|
23
|
+
modelRevision: '8afa232234a67f5bce4567982541a99688ac5137',
|
|
24
|
+
templateSha256: '182e77dd83bd8e9ca818b240b82e28f243762cd5dda32e6eef327df7b1cd107e', runtimeVersion: '0.32.0' },
|
|
25
|
+
{ modelRepository: 'ornith-ai/Ornith-1.5-35B-A3B-FP8',
|
|
23
26
|
modelRevision: 'b93dbd8128d3d2e6655b8570c992de97fc8ece6e',
|
|
24
27
|
templateSha256: '182e77dd83bd8e9ca818b240b82e28f243762cd5dda32e6eef327df7b1cd107e', runtimeVersion: '0.32.0' },
|
|
25
28
|
{ modelRepository: 'cyankiwi/Qwen3.6-35B-A3B-AWQ-4bit',
|
|
@@ -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
|
|
@@ -1,24 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
const ENDPOINT_MODEL_LIMITS = {
|
|
2
|
+
'https://openrouter.ai/api/v1': {
|
|
3
|
+
'anthropic/claude-opus-5.5': [1_000_000, 128_000],
|
|
4
|
+
'anthropic/claude-sonnet-5.5': [1_000_000, 128_000],
|
|
5
|
+
'openai/gpt-6.1-sol': [922_000, 128_000],
|
|
6
|
+
'openai/gpt-6-luna': [922_000, 128_000],
|
|
7
|
+
'google/gemini-4-argon': [1_048_576, 32_768],
|
|
8
|
+
'google/gemini-3.8-flash': [1_048_576, 65_536],
|
|
9
|
+
'mistralai/mistral-large-4-0': [1_048_576, 262_144],
|
|
10
|
+
'deepseek/deepseek-v4.1-flash': [1_048_576, 393_216],
|
|
11
|
+
'moonshotai/kimi-k3.1-pro': [1_048_576, 131_072],
|
|
12
|
+
'z-ai/glm-5.3': [1_000_000, 131_072],
|
|
13
|
+
'qwen/qwen3.8-2.4t-a95b': [1_048_576, 131_072],
|
|
14
|
+
'minimax/minimax-m3.1-flash': [1_048_576, 524_288],
|
|
15
|
+
'x-ai/grok-4.7': [500_000, 450_000],
|
|
16
|
+
},
|
|
17
|
+
'https://api.openai.com/v1': {
|
|
18
|
+
'gpt-6.1-sol': [922_000, 128_000],
|
|
19
|
+
'gpt-6-astra': [922_000, 128_000],
|
|
20
|
+
'gpt-6-luna': [922_000, 128_000],
|
|
21
|
+
},
|
|
22
|
+
'https://chatgpt.com/backend-api/codex': {
|
|
23
|
+
'gpt-6.1-sol': [500_000, 128_000],
|
|
24
|
+
'gpt-6.1-terra': [500_000, 128_000],
|
|
25
|
+
'gpt-6-luna': [272_000, 128_000],
|
|
26
|
+
'gpt-5.6-sol': [272_000, 128_000],
|
|
27
|
+
'gpt-5.6-terra': [272_000, 128_000],
|
|
28
|
+
'gpt-5.6-luna': [272_000, 128_000],
|
|
29
|
+
},
|
|
30
|
+
'https://generativelanguage.googleapis.com/v1beta/openai': {
|
|
31
|
+
'gemini-4-argon': [1_048_576, 32_768],
|
|
32
|
+
'gemini-3.8-flash': [1_048_576, 65_536],
|
|
33
|
+
},
|
|
34
|
+
'https://api.mistral.ai/v1': {
|
|
35
|
+
'mistral-large-4': [1_048_576, 262_144],
|
|
36
|
+
},
|
|
37
|
+
'https://api.deepseek.com/v1': {
|
|
38
|
+
'deepseek-v4-pro': [1_048_576, 393_216],
|
|
39
|
+
'deepseek-flash': [1_048_576, 393_216],
|
|
40
|
+
},
|
|
41
|
+
'https://api.x.ai/v1': {
|
|
42
|
+
'grok-4.7': [500_000, 500_000],
|
|
43
|
+
'grok-4.6': [500_000, 500_000],
|
|
44
|
+
},
|
|
45
|
+
'https://api.z.ai/api/paas/v4': {
|
|
46
|
+
'glm-5.3': [1_000_000, 131_072],
|
|
47
|
+
'glm-5.3-flash': [1_000_000, 131_072],
|
|
48
|
+
},
|
|
49
|
+
'https://api.z.ai/api/coding/paas/v4': {
|
|
50
|
+
'glm-5.3': [1_000_000, 131_072],
|
|
51
|
+
'glm-5.2-highspeed': [1_000_000, 131_072],
|
|
52
|
+
},
|
|
53
|
+
'https://api.moonshot.ai/v1': {
|
|
54
|
+
'kimi-k3.1-pro': [1_048_576, 131_072],
|
|
55
|
+
'kimi-k3': [1_048_576, 131_072],
|
|
56
|
+
},
|
|
57
|
+
'https://api.kimi.com/coding/v1': {
|
|
58
|
+
'k3': [1_048_576, 131_072],
|
|
59
|
+
'k3.1-pro': [1_048_576, 131_072],
|
|
60
|
+
},
|
|
61
|
+
'https://api.groq.com/openai/v1': {
|
|
62
|
+
'openai/gpt-oss-120b': [131_072, 65_536],
|
|
63
|
+
'qwen/qwen3.8-27b': [131_072, 16_384],
|
|
64
|
+
},
|
|
65
|
+
'https://api.together.ai/v1': {
|
|
66
|
+
'deepseek-ai/DeepSeek-V4-Pro-0813': [1_048_576, 384_000],
|
|
67
|
+
'moonshotai/Kimi-K3.1-Pro': [1_048_576, 131_072],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
function documentedReasoningLevels(url, model) {
|
|
71
|
+
let host;
|
|
72
|
+
try {
|
|
73
|
+
host = new URL(url).hostname.toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (host === 'api.mistral.ai') {
|
|
79
|
+
switch (model.toLowerCase()) {
|
|
80
|
+
case 'mistral-small-2603':
|
|
81
|
+
case 'mistral-small-latest':
|
|
82
|
+
case 'mistral-medium-latest':
|
|
83
|
+
case 'mistral-medium-3-5':
|
|
84
|
+
case 'mistral-vibe-cli-latest': return ['none', 'high'];
|
|
85
|
+
case 'mistral-large-4':
|
|
86
|
+
case 'mistral-large-4-0': return ['low', 'medium', 'high'];
|
|
87
|
+
case 'zai-glm-5-3':
|
|
88
|
+
case 'zai-glm-5-3-flash': return ['low', 'high', 'max'];
|
|
89
|
+
default: return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (host === 'api.openai.com') {
|
|
93
|
+
if (/^gpt-4(?:o|\.1)(?:-|$)/i.test(model))
|
|
94
|
+
return [];
|
|
95
|
+
if (/^gpt-5\.(?:2|4)(?:-mini)?(?:-\d{4}-\d{2}-\d{2})?$/i.test(model))
|
|
96
|
+
return ['none', 'low', 'medium', 'high', 'xhigh'];
|
|
97
|
+
if (/^gpt-5\.6(?:-(?:sol|terra|luna))?$/i.test(model))
|
|
98
|
+
return ['none', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
99
|
+
if (/^gpt-5\.5$/i.test(model))
|
|
100
|
+
return ['none', 'low', 'medium', 'high', 'xhigh'];
|
|
101
|
+
if (/^gpt-6(?:\.1)?-(?:astra|sol|terra|luna)$/i.test(model)) {
|
|
102
|
+
return /^gpt-6(?:-sol|-luna|\.1-terra)$/i.test(model) ? ['none', 'low', 'medium', 'high', 'xhigh', 'max'] : ['low', 'medium', 'high', 'xhigh', 'max'];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (host === 'generativelanguage.googleapis.com') {
|
|
106
|
+
if (/^gemini-3\.(?:7|8)-flash(?:-|$)/i.test(model))
|
|
107
|
+
return ['low', 'medium', 'high'];
|
|
108
|
+
if (/^gemini-3-pro(?:-|$)/i.test(model))
|
|
109
|
+
return ['low', 'high'];
|
|
110
|
+
if (/^gemini-3\.1-pro(?:-|$)/i.test(model))
|
|
111
|
+
return ['low', 'medium', 'high'];
|
|
112
|
+
if (/^gemini-3(?:\.1)?-(?:pro|flash)(?:-lite)?(?:-|$)/i.test(model))
|
|
113
|
+
return ['minimal', 'low', 'medium', 'high'];
|
|
114
|
+
if (/^gemini-2\.5-pro(?:-|$)/i.test(model))
|
|
115
|
+
return ['low', 'medium', 'high'];
|
|
116
|
+
if (/^gemini-2\.5-flash(?:-lite)?(?:-|$)/i.test(model))
|
|
117
|
+
return ['none', 'low', 'medium', 'high'];
|
|
118
|
+
}
|
|
119
|
+
if (host === 'api.deepseek.com' && /^(?:deepseek-flash|deepseek-v4(?:\.1)?-(?:flash|pro))$/i.test(model))
|
|
120
|
+
return ['none', 'low', 'high', 'max'];
|
|
121
|
+
if (host === 'api.groq.com') {
|
|
122
|
+
if (/^openai\/gpt-oss-(?:20b|120b)$/i.test(model))
|
|
123
|
+
return ['low', 'medium', 'high'];
|
|
124
|
+
if (model.toLowerCase() === 'qwen/qwen3.8-27b')
|
|
125
|
+
return ['none', 'low', 'medium', 'high'];
|
|
126
|
+
}
|
|
127
|
+
if ((host === 'api.x.ai' || host.endsWith('.api.x.ai')) && /^grok-4\.[67]$/i.test(model))
|
|
128
|
+
return ['low', 'medium', 'high', 'xhigh'];
|
|
129
|
+
// The coding subscription and direct API have always-thinking K3 variants;
|
|
130
|
+
// use the shared subset instead of sending unsupported none to workers.
|
|
131
|
+
if ((host === 'api.moonshot.ai' && /^kimi-k3(?:\.1-pro)?$/i.test(model))
|
|
132
|
+
|| ((host === 'api.kimi.com' || host === 'api.kimi.ai') && /^k3(?:\.1-pro)?$/i.test(model)))
|
|
133
|
+
return ['low', 'high', 'max'];
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
/** Lookup uses the actual endpoint and exact model ID; documented aliases are handled by the reasoning profiles. */
|
|
137
|
+
export function endpointModelFacts(url, model) {
|
|
138
|
+
const endpoint = url.replace(/\/+$/, '').toLowerCase();
|
|
139
|
+
const entries = ENDPOINT_MODEL_LIMITS[endpoint];
|
|
140
|
+
const key = model.toLowerCase();
|
|
141
|
+
const values = entries && Object.entries(entries).find(([id]) => id.toLowerCase() === key)?.[1];
|
|
142
|
+
const limits = values ? { contextWindowTokens: values[0], maxOutputTokens: values[1] } : undefined;
|
|
143
|
+
const reasoningLevels = documentedReasoningLevels(url, model);
|
|
144
|
+
return { ...(limits ? { limits } : {}), ...(reasoningLevels !== undefined ? { reasoningLevels } : {}) };
|
|
145
|
+
}
|
|
22
146
|
const MODEL_CATALOG = [
|
|
23
147
|
// ── OpenAI ────────────────────────────────────────────────────────────────
|
|
24
148
|
{ match: 'gpt-6.1-sol', contextWindowTokens: 1_050_000, maxOutputTokens: 128_000 },
|
|
@@ -6,19 +6,14 @@
|
|
|
6
6
|
* Hosted presets carry a pre-configured base URL so users only need to supply an API key
|
|
7
7
|
* and model names. Local/keyless providers have sensible localhost defaults.
|
|
8
8
|
*
|
|
9
|
-
* Presets
|
|
10
|
-
*
|
|
11
|
-
* `[id, contextWindowTokens, maxOutputTokens]` tuple instead of appearing twice (once in
|
|
12
|
-
* `suggestedModels`, once in `modelLimits`), and `needsApiKey` is derived from the
|
|
13
|
-
* category (cloud presets need a key unless they carry an explicit OAuth flow; local
|
|
14
|
-
* ones never do).
|
|
9
|
+
* Presets list model IDs; limits and reasoning capabilities live in the shared
|
|
10
|
+
* endpoint/model facts. `needsApiKey` is derived from category and auth flow.
|
|
15
11
|
*
|
|
16
|
-
* `modelLimits` values are curated from models.dev
|
|
17
|
-
* consume; recent releases refreshed 2026-10-04 from https://models.dev/api.json). They are keyed by the exact suggested model id for
|
|
12
|
+
* `modelLimits` values are curated from provider catalogs and models.dev. They are keyed by the exact suggested model id for
|
|
18
13
|
* THIS preset: aggregators may cap context below the origin model's capability (e.g.
|
|
19
14
|
* Together serves DeepSeek-V4-Pro at 512K vs DeepSeek's own 1M), so limits never
|
|
20
|
-
* transfer between providers.
|
|
21
|
-
*
|
|
15
|
+
* transfer between providers. These values remain in the shared facts and are resolved at
|
|
16
|
+
* runtime after explicit settings and live discovery.
|
|
22
17
|
* Local providers (Ollama/llama.cpp/MLX/LM Studio) intentionally carry no limits: their
|
|
23
18
|
* effective context depends on the local server configuration, not the model.
|
|
24
19
|
*/
|
|
@@ -38,7 +33,7 @@ export interface ProviderPreset {
|
|
|
38
33
|
/** Whether an API key is typically required. Local and OAuth providers use false. */
|
|
39
34
|
needsApiKey: boolean;
|
|
40
35
|
/** Provider-specific sign-in flow, when setup is not an API-key prompt. */
|
|
41
|
-
auth?: 'chatgpt-oauth';
|
|
36
|
+
auth?: 'chatgpt-oauth' | 'mistral-vibe';
|
|
42
37
|
/** Hint shown when prompting for the API key. */
|
|
43
38
|
apiKeyHint?: string;
|
|
44
39
|
/**
|
|
@@ -61,15 +56,9 @@ export interface ProviderPreset {
|
|
|
61
56
|
/** Category for grouping in the picker. */
|
|
62
57
|
category: 'cloud' | 'local';
|
|
63
58
|
}
|
|
64
|
-
export declare const PROVIDER_PRESETS: ProviderPreset[];
|
|
59
|
+
export declare const PROVIDER_PRESETS: readonly ProviderPreset[];
|
|
65
60
|
export declare function findPreset(id: string): ProviderPreset | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Limits for models a wizard flow is adding to a provider, matched by the
|
|
68
|
-
* provider's base URL or its name (a provider created from a preset keeps the
|
|
69
|
-
* preset's name unless the user renamed it). Returns only entries the caller
|
|
70
|
-
* should merge into the provider's settings `modelLimits`; user-configured
|
|
71
|
-
* limits always win because callers merge without overwriting existing keys.
|
|
72
|
-
*/
|
|
61
|
+
/** Only copy limits for selected models and an unambiguous provider endpoint. */
|
|
73
62
|
export declare function presetModelLimitsForModels(provider: {
|
|
74
63
|
name?: string;
|
|
75
64
|
url?: string;
|